You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
480 KiB
JavaScript

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

/*! For license information please see ticlab.js.LICENSE.txt */
(()=>{var t={970:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-CommandPalette, /* </DEPRECATED> */\n.lm-CommandPalette {\n font-family: sans-serif;\n background: #F5F5F5;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-search, /* </DEPRECATED> */\n.lm-CommandPalette-search {\n padding: 8px;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-wrapper, /* </DEPRECATED> */\n.lm-CommandPalette-wrapper {\n padding: 4px 6px;\n background: white;\n border: 1px solid #E0E0E0;\n position: relative;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-input, /* </DEPRECATED> */\n.lm-CommandPalette-input {\n width: 92%;\n border: none;\n outline: none;\n font-size: 16px;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-header, /* </DEPRECATED> */\n.lm-CommandPalette-header {\n padding: 4px;\n color: #757575;\n font-size: 12px;\n font-weight: 600;\n background: #E1E1E1;\n cursor: pointer;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-header:hover::before, /* </DEPRECATED> */\n.lm-CommandPalette-header:hover::before {\n content: '\\2026'; /* ellipsis */\n float: right;\n margin-right: 4px;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-header > mark, /* </DEPRECATED> */\n.lm-CommandPalette-header > mark {\n background-color: transparent;\n font-weight: bold;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-item, /* </DEPRECATED> */\n.lm-CommandPalette-item {\n padding: 4px 8px;\n color: #757575;\n font-size: 13px;\n font-weight: 500;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-emptyMessage, /* </DEPRECATED> */\n.lm-CommandPalette-emptyMessage {\n padding: 4px;\n color: #757575;\n font-size: 12px;\n font-weight: 600;\n text-align: center;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-item.p-mod-disabled, /* </DEPRECATED> */\n.lm-CommandPalette-item.lm-mod-disabled {\n color: rgba(0, 0, 0, 0.25);\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-item.p-mod-active, /* </DEPRECATED> */\n.lm-CommandPalette-item.lm-mod-active {\n background: #7FDBFF;\n}\n\n\n/* <DEPRECATED> */\n.p-CommandPalette-item:hover:not(.p-mod-active):not(.p-mod-disabled),\n/* </DEPRECATED> */\n.lm-CommandPalette-item:hover:not(.lm-mod-active):not(.lm-mod-disabled) {\n background: #E5E5E5;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-itemIcon, /* </DEPRECATED> */\n.lm-CommandPalette-itemIcon {\n display: none;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-itemLabel > mark, /* </DEPRECATED> */\n.lm-CommandPalette-itemLabel > mark {\n background-color: transparent;\n font-weight: bold;\n}\n\n\n/* <DEPRECATED> */\n.p-CommandPalette-item.p-mod-disabled mark,\n/* </DEPRECATED> */\n.lm-CommandPalette-item.lm-mod-disabled mark {\n color: rgba(0, 0, 0, 0.4);\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-itemCaption, /* </DEPRECATED> */\n.lm-CommandPalette-itemCaption {\n color: #9E9E9E;\n font-size: 11px;\n font-weight: 400;\n}\n",""]),t.exports=e},470:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2018, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-DataGrid, /* </DEPRECATED> */\n.lm-DataGrid {\n min-width: 64px;\n min-height: 64px;\n border: 1px solid #A0A0A0;\n}\n\n\n/* <DEPRECATED> */ .p-DataGrid-scrollCorner, /* </DEPRECATED> */\n.lm-DataGrid-scrollCorner {\n background-color: #F0F0F0;\n}\n\n\n/* <DEPRECATED> */ .p-DataGrid-scrollCorner::after, /* </DEPRECATED> */\n.lm-DataGrid-scrollCorner::after {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 1px;\n height: 1px;\n background-color: #A0A0A0;\n}\n\n.lm-DataGrid-cellEditorOccluder {\n pointer-events: none;\n position: absolute;\n overflow: hidden;\n}\n\n.lm-DataGrid-cellEditorContainer {\n pointer-events: auto;\n position: absolute;\n background-color: #ffffff;\n box-sizing: border-box;\n box-shadow: 0px 0px 6px #006bf7;\n border: 2px solid #006bf7;\n}\n\n.lm-DataGrid-cellEditorContainer.lm-mod-invalid {\n box-shadow: 0px 0px 6px red;\n border: 2px solid red;\n}\n\n.lm-DataGrid-cellEditorContainer > form {\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n.lm-DataGrid-cellEditorWidget {\n width: 100%;\n height: 100%;\n outline: none;\n box-sizing: border-box;\n}\n\n.lm-DataGrid-cellEditorInput {\n background-color: #ffffff;\n border: 0;\n}\n\n.lm-DataGrid-cellEditorCheckbox {\n margin: 0;\n}\n\n.lm-DataGrid-notification {\n position: absolute;\n display: flex;\n overflow: visible;\n animation: fade-in 300ms ease-out;\n}\n\n.lm-DataGrid-notificationContainer {\n box-shadow: 0px 2px 5px #999999;\n border-radius: 3px;\n background-color: white;\n color: black;\n border: 1px solid black;\n font-family: sans-serif;\n font-size: 13px;\n padding: 4px;\n}\n\n@keyframes fade-in {\n 0% {\n opacity: 0;\n }\n 50% {\n opacity: 0.7;\n }\n 100% {\n opacity: 1;\n }\n}\n",""]),t.exports=e},502:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-DockPanel-overlay, /* </DEPRECATED> */\n.lm-DockPanel-overlay {\n background: rgba(255, 255, 255, 0.6);\n border: 1px dashed black;\n transition-property: top, left, right, bottom;\n transition-duration: 150ms;\n transition-timing-function: ease;\n}\n",""]),t.exports=e},302:(t,e,n)=>{var i=n(495),r=n(834),o=n(955),s=n(970),a=n(470),l=n(502),c=n(306),u=n(704),d=n(229),h=n(584);(e=i(!1)).i(r),e.i(o),e.i(s),e.i(a),e.i(l),e.i(c),e.i(u),e.i(d),e.i(h),e.push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2018, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n",""]),t.exports=e},306:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-Menu, /* </DEPRECATED> */\n.lm-Menu {\n padding: 3px 0px;\n background: white;\n color: rgba(0, 0, 0, 0.87);\n border: 1px solid #C0C0C0;\n font: 12px Helvetica, Arial, sans-serif;\n box-shadow: 0px 1px 6px rgba(0, 0, 0, 0.2);\n}\n\n\n/* <DEPRECATED> */ .p-Menu-item.p-mod-active, /* </DEPRECATED> */\n.lm-Menu-item.lm-mod-active {\n background: #E5E5E5;\n}\n\n\n/* <DEPRECATED> */ .p-Menu-item.p-mod-disabled, /* </DEPRECATED> */\n.lm-Menu-item.lm-mod-disabled {\n color: rgba(0, 0, 0, 0.25);\n}\n\n\n/* <DEPRECATED> */ .p-Menu-itemIcon, /* </DEPRECATED> */\n.lm-Menu-itemIcon {\n width: 21px;\n padding: 4px 2px;\n}\n\n\n/* <DEPRECATED> */ .p-Menu-itemLabel, /* </DEPRECATED> */\n.lm-Menu-itemLabel {\n padding: 4px 35px 4px 2px;\n}\n\n\n/* <DEPRECATED> */ .p-Menu-itemMnemonic, /* </DEPRECATED> */\n.lm-Menu-itemMnemonic {\n text-decoration: underline;\n}\n\n\n/* <DEPRECATED> */ .p-Menu-itemShortcut, /* </DEPRECATED> */\n.lm-Menu-itemShortcut {\n padding: 4px 0px;\n}\n\n\n/* <DEPRECATED> */ .p-Menu-itemSubmenuIcon, /* </DEPRECATED> */\n.lm-Menu-itemSubmenuIcon {\n width: 16px;\n padding: 4px 0px;\n}\n\n\n/* <DEPRECATED> */\n.p-Menu-item[data-type='separator'] > div,\n/* </DEPRECATED> */\n.lm-Menu-item[data-type='separator'] > div {\n padding: 0;\n height: 9px;\n}\n\n\n/* <DEPRECATED> */\n.p-Menu-item[data-type='separator'] > div::after,\n/* </DEPRECATED> */\n.lm-Menu-item[data-type='separator'] > div::after {\n content: '';\n display: block;\n position: relative;\n top: 4px;\n border-top: 1px solid #DDDDDD;\n}\n\n\n/* <DEPRECATED> */\n.p-Menu-itemIcon::before,\n.p-Menu-itemSubmenuIcon::before,\n/* </DEPRECATED> */\n.lm-Menu-itemIcon::before,\n.lm-Menu-itemSubmenuIcon::before {\n font-family: FontAwesome;\n}\n\n\n/* <DEPRECATED> */\n.p-Menu-item.lm-mod-toggled > .p-Menu-itemIcon::before,\n/* </DEPRECATED> */\n.lm-Menu-item.lm-mod-toggled > .lm-Menu-itemIcon::before {\n content: '\\f00c';\n}\n\n\n/* <DEPRECATED> */\n.p-Menu-item[data-type='submenu'] > .p-Menu-itemSubmenuIcon::before,\n/* </DEPRECATED> */\n.lm-Menu-item[data-type='submenu'] > .lm-Menu-itemSubmenuIcon::before {\n content: '\\f0da';\n}\n",""]),t.exports=e},704:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-MenuBar, /* </DEPRECATED> */\n.lm-MenuBar {\n padding-left: 5px;\n background: #FAFAFA;\n color: rgba(0, 0, 0, 0.87);\n border-bottom: 1px solid #DDDDDD;\n font: 13px Helvetica, Arial, sans-serif;\n}\n\n\n/* <DEPRECATED> */ .p-MenuBar-menu, /* </DEPRECATED> */\n.lm-MenuBar-menu {\n transform: translateY(-1px);\n}\n\n\n/* <DEPRECATED> */ .p-MenuBar-item, /* </DEPRECATED> */\n.lm-MenuBar-item {\n padding: 4px 8px;\n border-left: 1px solid transparent;\n border-right: 1px solid transparent;\n}\n\n\n/* <DEPRECATED> */ .p-MenuBar-item.p-mod-active, /* </DEPRECATED> */\n.lm-MenuBar-item.lm-mod-active {\n background: #E5E5E5;\n}\n\n\n/* <DEPRECATED> */\n.p-MenuBar.p-mod-active .p-MenuBar-item.p-mod-active,\n/* </DEPRECATED> */\n.lm-MenuBar.lm-mod-active .lm-MenuBar-item.lm-mod-active {\n z-index: 10001;\n background: white;\n border-left: 1px solid #C0C0C0;\n border-right: 1px solid #C0C0C0;\n box-shadow: 0px 0px 6px rgba(0, 0, 0, 0.2);\n}\n",""]),t.exports=e},229:(t,e,n)=>{var i=n(495),r=n(490),o=n(775),s=n(338),a=n(467),l=n(465);e=i(!1);var c=r(o),u=r(s),d=r(a),h=r(l);e.push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */\n.p-ScrollBar[data-orientation='horizontal'],\n/* </DEPRECATED> */\n.lm-ScrollBar[data-orientation='horizontal'] {\n min-height: 16px;\n max-height: 16px;\n min-width: 45px;\n border-top: 1px solid #A0A0A0;\n}\n\n\n/* <DEPRECATED> */\n.p-ScrollBar[data-orientation='vertical'],\n/* </DEPRECATED> */\n.lm-ScrollBar[data-orientation='vertical'] {\n min-width: 16px;\n max-width: 16px;\n min-height: 45px;\n border-left: 1px solid #A0A0A0;\n}\n\n\n/* <DEPRECATED> */ .p-ScrollBar-button, /* </DEPRECATED> */\n.lm-ScrollBar-button {\n background-color: #F0F0F0;\n background-position: center center;\n min-height: 15px;\n max-height: 15px;\n min-width: 15px;\n max-width: 15px;\n}\n\n\n/* <DEPRECATED> */ .p-ScrollBar-button:hover, /* </DEPRECATED> */\n.lm-ScrollBar-button:hover {\n background-color: #DADADA;\n}\n\n\n/* <DEPRECATED> */ .p-ScrollBar-button.p-mod-active, /* </DEPRECATED> */\n.lm-ScrollBar-button.lm-mod-active {\n background-color: #CDCDCD;\n}\n\n\n/* <DEPRECATED> */ .p-ScrollBar-track, /* </DEPRECATED> */\n.lm-ScrollBar-track {\n background: #F0F0F0;\n}\n\n\n/* <DEPRECATED> */ .p-ScrollBar-thumb, /* </DEPRECATED> */\n.lm-ScrollBar-thumb {\n background: #CDCDCD;\n}\n\n\n/* <DEPRECATED> */ .p-ScrollBar-thumb:hover, /* </DEPRECATED> */\n.lm-ScrollBar-thumb:hover {\n background: #BABABA;\n}\n\n\n/* <DEPRECATED> */ .p-ScrollBar-thumb.lm-mod-active, /* </DEPRECATED> */\n.lm-ScrollBar-thumb.lm-mod-active {\n background: #A0A0A0;\n}\n\n\n/* <DEPRECATED> */\n.p-ScrollBar[data-orientation='horizontal'] .p-ScrollBar-thumb,\n/* </DEPRECATED> */\n.lm-ScrollBar[data-orientation='horizontal'] .lm-ScrollBar-thumb {\n height: 100%;\n min-width: 15px;\n border-left: 1px solid #A0A0A0;\n border-right: 1px solid #A0A0A0;\n}\n\n\n/* <DEPRECATED> */\n.p-ScrollBar[data-orientation='vertical'] .p-ScrollBar-thumb,\n/* </DEPRECATED> */\n.lm-ScrollBar[data-orientation='vertical'] .lm-ScrollBar-thumb {\n width: 100%;\n min-height: 15px;\n border-top: 1px solid #A0A0A0;\n border-bottom: 1px solid #A0A0A0;\n}\n\n\n/* <DEPRECATED> */\n.p-ScrollBar[data-orientation='horizontal'] .p-ScrollBar-button[data-action='decrement'],\n/* </DEPRECATED> */\n.lm-ScrollBar[data-orientation='horizontal'] .lm-ScrollBar-button[data-action='decrement'] {\n background-image: url("+c+");\n}\n\n\n/* <DEPRECATED> */\n.p-ScrollBar[data-orientation='horizontal'] .p-ScrollBar-button[data-action='increment'],\n/* </DEPRECATED> */\n.lm-ScrollBar[data-orientation='horizontal'] .lm-ScrollBar-button[data-action='increment'] {\n background-image: url("+u+");\n}\n\n\n/* <DEPRECATED> */\n.p-ScrollBar[data-orientation='vertical'] .p-ScrollBar-button[data-action='decrement'],\n/* </DEPRECATED> */\n.lm-ScrollBar[data-orientation='vertical'] .lm-ScrollBar-button[data-action='decrement'] {\n background-image: url("+d+");\n}\n\n\n/* <DEPRECATED> */\n.p-ScrollBar[data-orientation='vertical'] .p-ScrollBar-button[data-action='increment'],\n/* </DEPRECATED> */\n.lm-ScrollBar[data-orientation='vertical'] .lm-ScrollBar-button[data-action='increment'] {\n background-image: url("+h+");\n}\n",""]),t.exports=e},584:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-TabBar, /* </DEPRECATED> */\n.lm-TabBar {\n min-height: 24px;\n max-height: 24px;\n}\n\n\n/* <DEPRECATED> */ .p-TabBar-content, /* </DEPRECATED> */\n.lm-TabBar-content {\n min-width: 0;\n min-height: 0;\n align-items: flex-end;\n border-bottom: 1px solid #C0C0C0;\n}\n\n\n/* <DEPRECATED> */ .p-TabBar-tab, /* </DEPRECATED> */\n.lm-TabBar-tab {\n padding: 0px 10px;\n background: #E5E5E5;\n border: 1px solid #C0C0C0;\n border-bottom: none;\n font: 12px Helvetica, Arial, sans-serif;\n flex: 0 1 125px;\n min-height: 20px;\n max-height: 20px;\n min-width: 35px;\n margin-left: -1px;\n line-height: 20px;\n}\n\n\n.lm-TabBar-tabLabel .lm-TabBar-tabInput {\n padding: 0px;\n border: 0px;\n font: 12px Helvetica, Arial, sans-serif\n}\n\n\n/* <DEPRECATED> */ .p-TabBar-tab.p-mod-current, /* </DEPRECATED> */\n.lm-TabBar-tab.lm-mod-current {\n background: white;\n}\n\n\n/* <DEPRECATED> */ .p-TabBar-tab:hover:not(.p-mod-current), /* </DEPRECATED> */\n.lm-TabBar-tab:hover:not(.lm-mod-current) {\n background: #F0F0F0;\n}\n\n\n/* <DEPRECATED> */ .p-TabBar-tab:first-child, /* </DEPRECATED> */\n.lm-TabBar-tab:first-child {\n margin-left: 0;\n}\n\n\n/* <DEPRECATED> */ .p-TabBar-tab.p-mod-current, /* </DEPRECATED> */\n.lm-TabBar-tab.lm-mod-current {\n min-height: 23px;\n max-height: 23px;\n transform: translateY(1px);\n}\n\n\n/* <DEPRECATED> */\n.p-TabBar-tabIcon,\n.p-TabBar-tabLabel,\n.p-TabBar-tabCloseIcon,\n/* </DEPRECATED> */\n.lm-TabBar-tabIcon,\n.lm-TabBar-tabLabel,\n.lm-TabBar-tabCloseIcon {\n display: inline-block;\n}\n\n\n/* <DEPRECATED> */\n.p-TabBar-tab.p-mod-closable > .p-TabBar-tabCloseIcon,\n/* </DEPRECATED> */\n.lm-TabBar-tab.lm-mod-closable > .lm-TabBar-tabCloseIcon {\n margin-left: 4px;\n}\n\n\n/* <DEPRECATED> */\n.p-TabBar-tab.p-mod-closable > .p-TabBar-tabCloseIcon:before,\n/* </DEPRECATED> */\n.lm-TabBar-tab.lm-mod-closable > .lm-TabBar-tabCloseIcon:before {\n content: '\\f00d';\n font-family: FontAwesome;\n}\n\n\n/* <DEPRECATED> */\n.p-TabBar-tab.p-mod-drag-image,\n/* </DEPRECATED> */\n.lm-TabBar-tab.lm-mod-drag-image {\n min-height: 23px;\n max-height: 23px;\n min-width: 125px;\n border: none;\n box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);\n transform: translateX(-40%) translateY(-58%);\n}\n",""]),t.exports=e},834:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ body.p-mod-override-cursor *, /* </DEPRECATED> */\nbody.lm-mod-override-cursor * {\n cursor: inherit !important;\n}\n",""]),t.exports=e},999:(t,e,n)=>{(e=n(495)(!1)).push([t.id,'/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-CommandPalette, /* </DEPRECATED> */\n.lm-CommandPalette {\n display: flex;\n flex-direction: column;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-search, /* </DEPRECATED> */\n.lm-CommandPalette-search {\n flex: 0 0 auto;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-content, /* </DEPRECATED> */\n.lm-CommandPalette-content {\n flex: 1 1 auto;\n margin: 0;\n padding: 0;\n min-height: 0;\n overflow: auto;\n list-style-type: none;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-header, /* </DEPRECATED> */\n.lm-CommandPalette-header {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-item, /* </DEPRECATED> */\n.lm-CommandPalette-item {\n display: flex;\n flex-direction: row;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-itemIcon, /* </DEPRECATED> */\n.lm-CommandPalette-itemIcon {\n flex: 0 0 auto;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-itemContent, /* </DEPRECATED> */\n.lm-CommandPalette-itemContent {\n flex: 1 1 auto;\n overflow: hidden;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-itemShortcut, /* </DEPRECATED> */\n.lm-CommandPalette-itemShortcut {\n flex: 0 0 auto;\n}\n\n\n/* <DEPRECATED> */ .p-CommandPalette-itemLabel, /* </DEPRECATED> */\n.lm-CommandPalette-itemLabel {\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n\n.lm-close-icon {\n\tborder:1px solid transparent;\n background-color: transparent;\n position: absolute;\n\tz-index:1;\n\tright:3%;\n\ttop: 0;\n\tbottom: 0;\n\tmargin: auto;\n\tpadding: 7px 0;\n\tdisplay: none;\n\tvertical-align: middle;\n outline: 0;\n cursor: pointer;\n}\n.lm-close-icon:after {\n\tcontent: "X";\n\tdisplay: block;\n\twidth: 15px;\n\theight: 15px;\n\ttext-align: center;\n\tcolor:#000;\n\tfont-weight: normal;\n\tfont-size: 12px;\n\tcursor: pointer;\n}\n',""]),t.exports=e},272:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-DockPanel, /* </DEPRECATED> */\n.lm-DockPanel {\n z-index: 0;\n}\n\n\n/* <DEPRECATED> */ .p-DockPanel-widget, /* </DEPRECATED> */\n.lm-DockPanel-widget {\n z-index: 0;\n}\n\n\n/* <DEPRECATED> */ .p-DockPanel-tabBar, /* </DEPRECATED> */\n.lm-DockPanel-tabBar {\n z-index: 1;\n}\n\n\n/* <DEPRECATED> */ .p-DockPanel-handle, /* </DEPRECATED> */\n.lm-DockPanel-handle {\n z-index: 2;\n}\n\n\n/* <DEPRECATED> */ .p-DockPanel-handle.p-mod-hidden, /* </DEPRECATED> */\n.lm-DockPanel-handle.lm-mod-hidden {\n display: none !important;\n}\n\n\n/* <DEPRECATED> */ .p-DockPanel-handle:after, /* </DEPRECATED> */\n.lm-DockPanel-handle:after {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n content: '';\n}\n\n\n/* <DEPRECATED> */\n.p-DockPanel-handle[data-orientation='horizontal'],\n/* </DEPRECATED> */\n.lm-DockPanel-handle[data-orientation='horizontal'] {\n cursor: ew-resize;\n}\n\n\n/* <DEPRECATED> */\n.p-DockPanel-handle[data-orientation='vertical'],\n/* </DEPRECATED> */\n.lm-DockPanel-handle[data-orientation='vertical'] {\n cursor: ns-resize;\n}\n\n\n/* <DEPRECATED> */\n.p-DockPanel-handle[data-orientation='horizontal']:after,\n/* </DEPRECATED> */\n.lm-DockPanel-handle[data-orientation='horizontal']:after {\n left: 50%;\n min-width: 8px;\n transform: translateX(-50%);\n}\n\n\n/* <DEPRECATED> */\n.p-DockPanel-handle[data-orientation='vertical']:after,\n/* </DEPRECATED> */\n.lm-DockPanel-handle[data-orientation='vertical']:after {\n top: 50%;\n min-height: 8px;\n transform: translateY(-50%);\n}\n\n\n/* <DEPRECATED> */ .p-DockPanel-overlay, /* </DEPRECATED> */\n.lm-DockPanel-overlay {\n z-index: 3;\n box-sizing: border-box;\n pointer-events: none;\n}\n\n\n/* <DEPRECATED> */ .p-DockPanel-overlay.p-mod-hidden, /* </DEPRECATED> */\n.lm-DockPanel-overlay.lm-mod-hidden {\n display: none !important;\n}\n",""]),t.exports=e},955:(t,e,n)=>{var i=n(495),r=n(866),o=n(999),s=n(272),a=n(686),l=n(837),c=n(547),u=n(770),d=n(780),h=n(804);(e=i(!1)).i(r),e.i(o),e.i(s),e.i(a),e.i(l),e.i(c),e.i(u),e.i(d),e.i(h),e.push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n",""]),t.exports=e},686:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-Menu, /* </DEPRECATED> */\n.lm-Menu {\n z-index: 10000;\n position: absolute;\n white-space: nowrap;\n overflow-x: hidden;\n overflow-y: auto;\n outline: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n/* <DEPRECATED> */ .p-Menu-content, /* </DEPRECATED> */\n.lm-Menu-content {\n margin: 0;\n padding: 0;\n display: table;\n list-style-type: none;\n}\n\n\n/* <DEPRECATED> */ .p-Menu-item, /* </DEPRECATED> */\n.lm-Menu-item {\n display: table-row;\n}\n\n\n/* <DEPRECATED> */\n.p-Menu-item.p-mod-hidden,\n.p-Menu-item.p-mod-collapsed,\n/* </DEPRECATED> */\n.lm-Menu-item.lm-mod-hidden,\n.lm-Menu-item.lm-mod-collapsed {\n display: none !important;\n}\n\n\n/* <DEPRECATED> */\n.p-Menu-itemIcon,\n.p-Menu-itemSubmenuIcon,\n/* </DEPRECATED> */\n.lm-Menu-itemIcon,\n.lm-Menu-itemSubmenuIcon {\n display: table-cell;\n text-align: center;\n}\n\n\n/* <DEPRECATED> */ .p-Menu-itemLabel, /* </DEPRECATED> */\n.lm-Menu-itemLabel {\n display: table-cell;\n text-align: left;\n}\n\n\n/* <DEPRECATED> */ .p-Menu-itemShortcut, /* </DEPRECATED> */\n.lm-Menu-itemShortcut {\n display: table-cell;\n text-align: right;\n}\n",""]),t.exports=e},837:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-MenuBar, /* </DEPRECATED> */\n.lm-MenuBar {\n outline: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n/* <DEPRECATED> */ .p-MenuBar-content, /* </DEPRECATED> */\n.lm-MenuBar-content {\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: row;\n list-style-type: none;\n}\n\n\n/* <DEPRECATED> */ .p--MenuBar-item, /* </DEPRECATED> */\n.lm-MenuBar-item {\n box-sizing: border-box;\n}\n\n\n/* <DEPRECATED> */\n.p-MenuBar-itemIcon,\n.p-MenuBar-itemLabel,\n/* </DEPRECATED> */\n.lm-MenuBar-itemIcon,\n.lm-MenuBar-itemLabel {\n display: inline-block;\n}\n",""]),t.exports=e},547:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-ScrollBar, /* </DEPRECATED> */\n.lm-ScrollBar {\n display: flex;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n/* <DEPRECATED> */\n.p-ScrollBar[data-orientation='horizontal'],\n/* </DEPRECATED> */\n.lm-ScrollBar[data-orientation='horizontal'] {\n flex-direction: row;\n}\n\n\n/* <DEPRECATED> */\n.p-ScrollBar[data-orientation='vertical'],\n/* </DEPRECATED> */\n.lm-ScrollBar[data-orientation='vertical'] {\n flex-direction: column;\n}\n\n\n/* <DEPRECATED> */ .p-ScrollBar-button, /* </DEPRECATED> */\n.lm-ScrollBar-button {\n box-sizing: border-box;\n flex: 0 0 auto;\n}\n\n\n/* <DEPRECATED> */ .p-ScrollBar-track, /* </DEPRECATED> */\n.lm-ScrollBar-track {\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n flex: 1 1 auto;\n}\n\n\n/* <DEPRECATED> */ .p-ScrollBar-thumb, /* </DEPRECATED> */\n.lm-ScrollBar-thumb {\n box-sizing: border-box;\n position: absolute;\n}\n",""]),t.exports=e},770:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-SplitPanel-child, /* </DEPRECATED> */\n.lm-SplitPanel-child {\n z-index: 0;\n}\n\n\n/* <DEPRECATED> */ .p-SplitPanel-handle, /* </DEPRECATED> */\n.lm-SplitPanel-handle {\n z-index: 1;\n}\n\n\n/* <DEPRECATED> */ .p-SplitPanel-handle.p-mod-hidden, /* </DEPRECATED> */\n.lm-SplitPanel-handle.lm-mod-hidden {\n display: none !important;\n}\n\n\n/* <DEPRECATED> */ .p-SplitPanel-handle:after, /* </DEPRECATED> */\n.lm-SplitPanel-handle:after {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n content: '';\n}\n\n\n/* <DEPRECATED> */\n.p-SplitPanel[data-orientation='horizontal'] > .p-SplitPanel-handle,\n/* </DEPRECATED> */\n.lm-SplitPanel[data-orientation='horizontal'] > .lm-SplitPanel-handle {\n cursor: ew-resize;\n}\n\n\n/* <DEPRECATED> */\n.p-SplitPanel[data-orientation='vertical'] > .p-SplitPanel-handle,\n/* </DEPRECATED> */\n.lm-SplitPanel[data-orientation='vertical'] > .lm-SplitPanel-handle {\n cursor: ns-resize;\n}\n\n\n/* <DEPRECATED> */\n.p-SplitPanel[data-orientation='horizontal'] > .p-SplitPanel-handle:after,\n/* </DEPRECATED> */\n.lm-SplitPanel[data-orientation='horizontal'] > .lm-SplitPanel-handle:after {\n left: 50%;\n min-width: 8px;\n transform: translateX(-50%);\n}\n\n\n/* <DEPRECATED> */\n.p-SplitPanel[data-orientation='vertical'] > .p-SplitPanel-handle:after,\n/* </DEPRECATED> */\n.lm-SplitPanel[data-orientation='vertical'] > .lm-SplitPanel-handle:after {\n top: 50%;\n min-height: 8px;\n transform: translateY(-50%);\n}\n",""]),t.exports=e},780:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-TabBar, /* </DEPRECATED> */\n.lm-TabBar {\n display: flex;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n\n/* <DEPRECATED> */ .p-TabBar[data-orientation='horizontal'], /* </DEPRECATED> */\n.lm-TabBar[data-orientation='horizontal'] {\n flex-direction: row;\n}\n\n\n/* <DEPRECATED> */ .p-TabBar[data-orientation='vertical'], /* </DEPRECATED> */\n.lm-TabBar[data-orientation='vertical'] {\n flex-direction: column;\n}\n\n\n/* <DEPRECATED> */ .p-TabBar-content, /* </DEPRECATED> */\n.lm-TabBar-content {\n margin: 0;\n padding: 0;\n display: flex;\n flex: 1 1 auto;\n list-style-type: none;\n}\n\n\n/* <DEPRECATED> */\n.p-TabBar[data-orientation='horizontal'] > .p-TabBar-content,\n/* </DEPRECATED> */\n.lm-TabBar[data-orientation='horizontal'] > .lm-TabBar-content {\n flex-direction: row;\n}\n\n\n/* <DEPRECATED> */\n.p-TabBar[data-orientation='vertical'] > .p-TabBar-content,\n/* </DEPRECATED> */\n.lm-TabBar[data-orientation='vertical'] > .lm-TabBar-content {\n flex-direction: column;\n}\n\n\n/* <DEPRECATED> */ .p-TabBar-tab, /* </DEPRECATED> */\n.lm-TabBar-tab {\n display: flex;\n flex-direction: row;\n box-sizing: border-box;\n overflow: hidden;\n}\n\n\n/* <DEPRECATED> */\n.p-TabBar-tabIcon,\n.p-TabBar-tabCloseIcon,\n/* </DEPRECATED> */\n.lm-TabBar-tabIcon,\n.lm-TabBar-tabCloseIcon {\n flex: 0 0 auto;\n}\n\n\n/* <DEPRECATED> */ .p-TabBar-tabLabel, /* </DEPRECATED> */\n.lm-TabBar-tabLabel {\n flex: 1 1 auto;\n overflow: hidden;\n white-space: nowrap;\n}\n\n\n.lm-TabBar-tabInput {\n user-select: all;\n width: 100%;\n box-sizing : border-box;\n}\n\n\n/* <DEPRECATED> */ .p-TabBar-tab.p-mod-hidden, /* </DEPRECATED> */\n.lm-TabBar-tab.lm-mod-hidden {\n display: none !important;\n}\n\n\n/* <DEPRECATED> */ .p-TabBar.p-mod-dragging .p-TabBar-tab, /* </DEPRECATED> */\n.lm-TabBar.lm-mod-dragging .lm-TabBar-tab {\n position: relative;\n}\n\n\n/* <DEPRECATED> */\n.p-TabBar.p-mod-dragging[data-orientation='horizontal'] .p-TabBar-tab,\n/* </DEPRECATED> */\n.lm-TabBar.lm-mod-dragging[data-orientation='horizontal'] .lm-TabBar-tab {\n left: 0;\n transition: left 150ms ease;\n}\n\n\n/* <DEPRECATED> */\n.p-TabBar.p-mod-dragging[data-orientation='vertical'] .p-TabBar-tab,\n/* </DEPRECATED> */\n.lm-TabBar.lm-mod-dragging[data-orientation='vertical'] .lm-TabBar-tab {\n top: 0;\n transition: top 150ms ease;\n}\n\n\n/* <DEPRECATED> */\n.p-TabBar.p-mod-dragging .p-TabBar-tab.p-mod-dragging,\n/* </DEPRECATED> */\n.lm-TabBar.lm-mod-dragging .lm-TabBar-tab.lm-mod-dragging {\n transition: none;\n}\n",""]),t.exports=e},804:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-TabPanel-tabBar, /* </DEPRECATED> */\n.lm-TabPanel-tabBar {\n z-index: 1;\n}\n\n\n/* <DEPRECATED> */ .p-TabPanel-stackedPanel, /* </DEPRECATED> */\n.lm-TabPanel-stackedPanel {\n z-index: 0;\n}\n",""]),t.exports=e},866:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n/* <DEPRECATED> */ .p-Widget, /* </DEPRECATED> */\n.lm-Widget {\n box-sizing: border-box;\n position: relative;\n overflow: hidden;\n cursor: default;\n}\n\n\n/* <DEPRECATED> */ .p-Widget.p-mod-hidden, /* </DEPRECATED> */\n.lm-Widget.lm-mod-hidden {\n display: none !important;\n}\n",""]),t.exports=e},815:(t,e,n)=>{(e=n(495)(!1)).push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) Jupyter Development Team.\n| Copyright (c) 2014-2017, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\n.content {\n min-width: 50px;\n min-height: 50px;\n display: flex;\n flex-direction: column;\n /*padding: 8px;*/\n border: 1px solid #C0C0C0;\n border-top: none;\n background: white;\n box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);\n}\n\n.CodeMirror {\n height: 100%;\n}\n\n.content > div {\n flex: 1 1 auto;\n /*border: 1px solid #C0C0C0;*/\n overflow: auto;\n}\n\n\n.content input {\n margin: 8px;\n}\n\n\n.red > div {\n background: #E74C3C;\n}\n\n\n.yellow > div {\n background: #F1C40F;\n}\n\n\n.green > div {\n background: #27AE60;\n}\n\n\n.blue > div {\n background: #3498DB;\n}\n\n\n\n",""]),t.exports=e},760:(t,e,n)=>{var i=n(495),r=n(302),o=n(815);(e=i(!1)).i(r),e.i(o),e.push([t.id,"/*-----------------------------------------------------------------------------\n| Copyright (c) 2014-2018, PhosphorJS Contributors\n|\n| Distributed under the terms of the BSD 3-Clause License.\n|\n| The full license is in the file LICENSE, distributed with this software.\n|----------------------------------------------------------------------------*/\n\n\nbody {\n display: flex;\n flex-direction: column;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n margin: 0;\n padding: 0;\n overflow: hidden;\n}\n\n\n#menuBar {\n flex: 0 0 auto;\n}\n\n\n#main {\n flex: 1 1 auto;\n}\n\n\n#palette {\n min-width: 300px;\n border-right: 1px solid #DDDDDD;\n}\n\n\n#dock {\n padding: 4px;\n}\n",""]),t.exports=e},465:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>i});const i=n.p+"7a564d5604efdab6ca2325dcced48457.png"},775:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>i});const i=n.p+"995a1d96b1fef026c61ac03f4c6ff841.png"},338:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>i});const i=n.p+"200b3fc810ff360a023c4cc309f77e5a.png"},467:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>i});const i=n.p+"1c8b268ec020a3aa5cd211cdda05fe2b.png"},162:(t,e,n)=>{!function(t){"use strict";function e(e,n,r,o){if(r&&r.call){var s=r;r=null}else s=i(e,r,"rangeFinder");"number"==typeof n&&(n=t.Pos(n,0));var a=i(e,r,"minFoldSize");function l(t){var i=s(e,n);if(!i||i.to.line-i.from.line<a)return null;for(var r=e.findMarksAt(i.from),l=0;l<r.length;++l)if(r[l].__isFold&&"fold"!==o){if(!t)return null;i.cleared=!0,r[l].clear()}return i}var c=l(!0);if(i(e,r,"scanUp"))for(;!c&&n.line>e.firstLine();)n=t.Pos(n.line-1,0),c=l(!1);if(c&&!c.cleared&&"unfold"!==o){var u=function(t,e,n){var r=i(t,e,"widget");if("function"==typeof r&&(r=r(n.from,n.to)),"string"==typeof r){var o=document.createTextNode(r);(r=document.createElement("span")).appendChild(o),r.className="CodeMirror-foldmarker"}else r&&(r=r.cloneNode(!0));return r}(e,r,c);t.on(u,"mousedown",(function(e){d.clear(),t.e_preventDefault(e)}));var d=e.markText(c.from,c.to,{replacedWith:u,clearOnEnter:i(e,r,"clearOnEnter"),__isFold:!0});d.on("clear",(function(n,i){t.signal(e,"unfold",e,n,i)})),t.signal(e,"fold",e,c.from,c.to)}}t.newFoldFunction=function(t,n){return function(i,r){e(i,r,{rangeFinder:t,widget:n})}},t.defineExtension("foldCode",(function(t,n,i){e(this,t,n,i)})),t.defineExtension("isFolded",(function(t){for(var e=this.findMarksAt(t),n=0;n<e.length;++n)if(e[n].__isFold)return!0})),t.commands.toggleFold=function(t){t.foldCode(t.getCursor())},t.commands.fold=function(t){t.foldCode(t.getCursor(),null,"fold")},t.commands.unfold=function(t){t.foldCode(t.getCursor(),null,"unfold")},t.commands.foldAll=function(e){e.operation((function(){for(var n=e.firstLine(),i=e.lastLine();n<=i;n++)e.foldCode(t.Pos(n,0),null,"fold")}))},t.commands.unfoldAll=function(e){e.operation((function(){for(var n=e.firstLine(),i=e.lastLine();n<=i;n++)e.foldCode(t.Pos(n,0),null,"unfold")}))},t.registerHelper("fold","combine",(function(){var t=Array.prototype.slice.call(arguments,0);return function(e,n){for(var i=0;i<t.length;++i){var r=t[i](e,n);if(r)return r}}})),t.registerHelper("fold","auto",(function(t,e){for(var n=t.getHelpers(e,"fold"),i=0;i<n.length;i++){var r=n[i](t,e);if(r)return r}}));var n={rangeFinder:t.fold.auto,widget:"↔",minFoldSize:0,scanUp:!1,clearOnEnter:!0};function i(t,e,i){if(e&&void 0!==e[i])return e[i];var r=t.options.foldOptions;return r&&void 0!==r[i]?r[i]:n[i]}t.defineOption("foldOptions",null),t.defineExtension("foldOption",(function(t,e){return i(this,t,e)}))}(n(28))},992:(t,e,n)=>{!function(t){"use strict";t.defineOption("foldGutter",!1,(function(e,i,r){var o;r&&r!=t.Init&&(e.clearGutter(e.state.foldGutter.options.gutter),e.state.foldGutter=null,e.off("gutterClick",l),e.off("changes",c),e.off("viewportChange",u),e.off("fold",d),e.off("unfold",d),e.off("swapDoc",c)),i&&(e.state.foldGutter=new n((!0===(o=i)&&(o={}),null==o.gutter&&(o.gutter="CodeMirror-foldgutter"),null==o.indicatorOpen&&(o.indicatorOpen="CodeMirror-foldgutter-open"),null==o.indicatorFolded&&(o.indicatorFolded="CodeMirror-foldgutter-folded"),o)),a(e),e.on("gutterClick",l),e.on("changes",c),e.on("viewportChange",u),e.on("fold",d),e.on("unfold",d),e.on("swapDoc",c))}));var e=t.Pos;function n(t){this.options=t,this.from=this.to=0}function i(t,n){for(var i=t.findMarks(e(n,0),e(n+1,0)),r=0;r<i.length;++r)if(i[r].__isFold){var o=i[r].find(-1);if(o&&o.line===n)return i[r]}}function r(t){if("string"==typeof t){var e=document.createElement("div");return e.className=t+" CodeMirror-guttermarker-subtle",e}return t.cloneNode(!0)}function o(t,n,o){var a=t.state.foldGutter.options,l=n-1,c=t.foldOption(a,"minFoldSize"),u=t.foldOption(a,"rangeFinder"),d="string"==typeof a.indicatorFolded&&s(a.indicatorFolded),h="string"==typeof a.indicatorOpen&&s(a.indicatorOpen);t.eachLine(n,o,(function(n){++l;var o=null,s=n.gutterMarkers;if(s&&(s=s[a.gutter]),i(t,l)){if(d&&s&&d.test(s.className))return;o=r(a.indicatorFolded)}else{var p=e(l,0),f=u&&u(t,p);if(f&&f.to.line-f.from.line>=c){if(h&&s&&h.test(s.className))return;o=r(a.indicatorOpen)}}(o||s)&&t.setGutterMarker(n,a.gutter,o)}))}function s(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}function a(t){var e=t.getViewport(),n=t.state.foldGutter;n&&(t.operation((function(){o(t,e.from,e.to)})),n.from=e.from,n.to=e.to)}function l(t,n,r){var o=t.state.foldGutter;if(o){var s=o.options;if(r==s.gutter){var a=i(t,n);a?a.clear():t.foldCode(e(n,0),s)}}}function c(t){var e=t.state.foldGutter;if(e){var n=e.options;e.from=e.to=0,clearTimeout(e.changeUpdate),e.changeUpdate=setTimeout((function(){a(t)}),n.foldOnChangeTimeSpan||600)}}function u(t){var e=t.state.foldGutter;if(e){var n=e.options;clearTimeout(e.changeUpdate),e.changeUpdate=setTimeout((function(){var n=t.getViewport();e.from==e.to||n.from-e.to>20||e.from-n.to>20?a(t):t.operation((function(){n.from<e.from&&(o(t,n.from,e.from),e.from=n.from),n.to>e.to&&(o(t,e.to,n.to),e.to=n.to)}))}),n.updateViewportTimeSpan||400)}}function d(t,e){var n=t.state.foldGutter;if(n){var i=e.line;i>=n.from&&i<n.to&&o(t,i,i+1)}}}(n(28),n(162))},28:function(t){t.exports=function(){"use strict";var t=navigator.userAgent,e=navigator.platform,n=/gecko\/\d/i.test(t),i=/MSIE \d/.test(t),r=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(t),o=/Edge\/(\d+)/.exec(t),s=i||r||o,a=s&&(i?document.documentMode||6:+(o||r)[1]),l=!o&&/WebKit\//.test(t),c=l&&/Qt\/\d+\.\d+/.test(t),u=!o&&/Chrome\//.test(t),d=/Opera\//.test(t),h=/Apple Computer/.test(navigator.vendor),p=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(t),f=/PhantomJS/.test(t),m=h&&(/Mobile\/\w+/.test(t)||navigator.maxTouchPoints>2),g=/Android/.test(t),v=m||g||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(t),y=m||/Mac/.test(e),b=/\bCrOS\b/.test(t),_=/win/i.test(e),w=d&&t.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(d=!1,l=!0);var x=y&&(c||d&&(null==w||w<12.11)),C=n||s&&a>=9;function E(t){return new RegExp("(^|\\s)"+t+"(?:$|\\s)\\s*")}var D,M=function(t,e){var n=t.className,i=E(e).exec(n);if(i){var r=n.slice(i.index+i[0].length);t.className=n.slice(0,i.index)+(r?i[1]+r:"")}};function S(t){for(var e=t.childNodes.length;e>0;--e)t.removeChild(t.firstChild);return t}function T(t,e){return S(t).appendChild(e)}function k(t,e,n,i){var r=document.createElement(t);if(n&&(r.className=n),i&&(r.style.cssText=i),"string"==typeof e)r.appendChild(document.createTextNode(e));else if(e)for(var o=0;o<e.length;++o)r.appendChild(e[o]);return r}function A(t,e,n,i){var r=k(t,e,n,i);return r.setAttribute("role","presentation"),r}function P(t,e){if(3==e.nodeType&&(e=e.parentNode),t.contains)return t.contains(e);do{if(11==e.nodeType&&(e=e.host),e==t)return!0}while(e=e.parentNode)}function L(){var t;try{t=document.activeElement}catch(e){t=document.body||null}for(;t&&t.shadowRoot&&t.shadowRoot.activeElement;)t=t.shadowRoot.activeElement;return t}function I(t,e){var n=t.className;E(e).test(n)||(t.className+=(n?" ":"")+e)}function z(t,e){for(var n=t.split(" "),i=0;i<n.length;i++)n[i]&&!E(n[i]).test(e)&&(e+=" "+n[i]);return e}D=document.createRange?function(t,e,n,i){var r=document.createRange();return r.setEnd(i||t,n),r.setStart(t,e),r}:function(t,e,n){var i=document.body.createTextRange();try{i.moveToElementText(t.parentNode)}catch(t){return i}return i.collapse(!0),i.moveEnd("character",n),i.moveStart("character",e),i};var B=function(t){t.select()};function R(t){var e=Array.prototype.slice.call(arguments,1);return function(){return t.apply(null,e)}}function O(t,e,n){for(var i in e||(e={}),t)!t.hasOwnProperty(i)||!1===n&&e.hasOwnProperty(i)||(e[i]=t[i]);return e}function N(t,e,n,i,r){null==e&&-1==(e=t.search(/[^\s\u00a0]/))&&(e=t.length);for(var o=i||0,s=r||0;;){var a=t.indexOf("\t",o);if(a<0||a>=e)return s+(e-o);s+=a-o,s+=n-s%n,o=a+1}}m?B=function(t){t.selectionStart=0,t.selectionEnd=t.value.length}:s&&(B=function(t){try{t.select()}catch(t){}});var W=function(){this.id=null,this.f=null,this.time=0,this.handler=R(this.onTimeout,this)};function H(t,e){for(var n=0;n<t.length;++n)if(t[n]==e)return n;return-1}W.prototype.onTimeout=function(t){t.id=0,t.time<=+new Date?t.f():setTimeout(t.handler,t.time-+new Date)},W.prototype.set=function(t,e){this.f=e;var n=+new Date+t;(!this.id||n<this.time)&&(clearTimeout(this.id),this.id=setTimeout(this.handler,t),this.time=n)};var F={toString:function(){return"CodeMirror.Pass"}},j={scroll:!1},q={origin:"*mouse"},V={origin:"+move"};function U(t,e,n){for(var i=0,r=0;;){var o=t.indexOf("\t",i);-1==o&&(o=t.length);var s=o-i;if(o==t.length||r+s>=e)return i+Math.min(s,e-r);if(r+=o-i,i=o+1,(r+=n-r%n)>=e)return i}}var K=[""];function G(t){for(;K.length<=t;)K.push($(K)+" ");return K[t]}function $(t){return t[t.length-1]}function Y(t,e){for(var n=[],i=0;i<t.length;i++)n[i]=e(t[i],i);return n}function X(){}function J(t,e){var n;return Object.create?n=Object.create(t):(X.prototype=t,n=new X),e&&O(e,n),n}var Z=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;function Q(t){return/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Z.test(t))}function tt(t,e){return e?!!(e.source.indexOf("\\w")>-1&&Q(t))||e.test(t):Q(t)}function et(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return!1;return!0}var nt=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function it(t){return t.charCodeAt(0)>=768&&nt.test(t)}function rt(t,e,n){for(;(n<0?e>0:e<t.length)&&it(t.charAt(e));)e+=n;return e}function ot(t,e,n){for(var i=e>n?-1:1;;){if(e==n)return e;var r=(e+n)/2,o=i<0?Math.ceil(r):Math.floor(r);if(o==e)return t(o)?e:n;t(o)?n=o:e=o+i}}var st=null;function at(t,e,n){var i;st=null;for(var r=0;r<t.length;++r){var o=t[r];if(o.from<e&&o.to>e)return r;o.to==e&&(o.from!=o.to&&"before"==n?i=r:st=r),o.from==e&&(o.from!=o.to&&"before"!=n?i=r:st=r)}return null!=i?i:st}var lt=function(){var t=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,e=/[stwN]/,n=/[LRr]/,i=/[Lb1n]/,r=/[1n]/;function o(t,e,n){this.level=t,this.from=e,this.to=n}return function(s,a){var l,c="ltr"==a?"L":"R";if(0==s.length||"ltr"==a&&!t.test(s))return!1;for(var u=s.length,d=[],h=0;h<u;++h)d.push((l=s.charCodeAt(h))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(l):1424<=l&&l<=1524?"R":1536<=l&&l<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(l-1536):1774<=l&&l<=2220?"r":8192<=l&&l<=8203?"w":8204==l?"b":"L");for(var p=0,f=c;p<u;++p){var m=d[p];"m"==m?d[p]=f:f=m}for(var g=0,v=c;g<u;++g){var y=d[g];"1"==y&&"r"==v?d[g]="n":n.test(y)&&(v=y,"r"==y&&(d[g]="R"))}for(var b=1,_=d[0];b<u-1;++b){var w=d[b];"+"==w&&"1"==_&&"1"==d[b+1]?d[b]="1":","!=w||_!=d[b+1]||"1"!=_&&"n"!=_||(d[b]=_),_=w}for(var x=0;x<u;++x){var C=d[x];if(","==C)d[x]="N";else if("%"==C){var E=void 0;for(E=x+1;E<u&&"%"==d[E];++E);for(var D=x&&"!"==d[x-1]||E<u&&"1"==d[E]?"1":"N",M=x;M<E;++M)d[M]=D;x=E-1}}for(var S=0,T=c;S<u;++S){var k=d[S];"L"==T&&"1"==k?d[S]="L":n.test(k)&&(T=k)}for(var A=0;A<u;++A)if(e.test(d[A])){var P=void 0;for(P=A+1;P<u&&e.test(d[P]);++P);for(var L="L"==(A?d[A-1]:c),I=L==("L"==(P<u?d[P]:c))?L?"L":"R":c,z=A;z<P;++z)d[z]=I;A=P-1}for(var B,R=[],O=0;O<u;)if(i.test(d[O])){var N=O;for(++O;O<u&&i.test(d[O]);++O);R.push(new o(0,N,O))}else{var W=O,H=R.length,F="rtl"==a?1:0;for(++O;O<u&&"L"!=d[O];++O);for(var j=W;j<O;)if(r.test(d[j])){W<j&&(R.splice(H,0,new o(1,W,j)),H+=F);var q=j;for(++j;j<O&&r.test(d[j]);++j);R.splice(H,0,new o(2,q,j)),H+=F,W=j}else++j;W<O&&R.splice(H,0,new o(1,W,O))}return"ltr"==a&&(1==R[0].level&&(B=s.match(/^\s+/))&&(R[0].from=B[0].length,R.unshift(new o(0,0,B[0].length))),1==$(R).level&&(B=s.match(/\s+$/))&&($(R).to-=B[0].length,R.push(new o(0,u-B[0].length,u)))),"rtl"==a?R.reverse():R}}();function ct(t,e){var n=t.order;return null==n&&(n=t.order=lt(t.text,e)),n}var ut=[],dt=function(t,e,n){if(t.addEventListener)t.addEventListener(e,n,!1);else if(t.attachEvent)t.attachEvent("on"+e,n);else{var i=t._handlers||(t._handlers={});i[e]=(i[e]||ut).concat(n)}};function ht(t,e){return t._handlers&&t._handlers[e]||ut}function pt(t,e,n){if(t.removeEventListener)t.removeEventListener(e,n,!1);else if(t.detachEvent)t.detachEvent("on"+e,n);else{var i=t._handlers,r=i&&i[e];if(r){var o=H(r,n);o>-1&&(i[e]=r.slice(0,o).concat(r.slice(o+1)))}}}function ft(t,e){var n=ht(t,e);if(n.length)for(var i=Array.prototype.slice.call(arguments,2),r=0;r<n.length;++r)n[r].apply(null,i)}function mt(t,e,n){return"string"==typeof e&&(e={type:e,preventDefault:function(){this.defaultPrevented=!0}}),ft(t,n||e.type,t,e),wt(e)||e.codemirrorIgnore}function gt(t){var e=t._handlers&&t._handlers.cursorActivity;if(e)for(var n=t.curOp.cursorActivityHandlers||(t.curOp.cursorActivityHandlers=[]),i=0;i<e.length;++i)-1==H(n,e[i])&&n.push(e[i])}function vt(t,e){return ht(t,e).length>0}function yt(t){t.prototype.on=function(t,e){dt(this,t,e)},t.prototype.off=function(t,e){pt(this,t,e)}}function bt(t){t.preventDefault?t.preventDefault():t.returnValue=!1}function _t(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}function wt(t){return null!=t.defaultPrevented?t.defaultPrevented:0==t.returnValue}function xt(t){bt(t),_t(t)}function Ct(t){return t.target||t.srcElement}function Et(t){var e=t.which;return null==e&&(1&t.button?e=1:2&t.button?e=3:4&t.button&&(e=2)),y&&t.ctrlKey&&1==e&&(e=3),e}var Dt,Mt,St=function(){if(s&&a<9)return!1;var t=k("div");return"draggable"in t||"dragDrop"in t}();function Tt(t){if(null==Dt){var e=k("span","");T(t,k("span",[e,document.createTextNode("x")])),0!=t.firstChild.offsetHeight&&(Dt=e.offsetWidth<=1&&e.offsetHeight>2&&!(s&&a<8))}var n=Dt?k("span",""):k("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function kt(t){if(null!=Mt)return Mt;var e=T(t,document.createTextNode("AخA")),n=D(e,0,1).getBoundingClientRect(),i=D(e,1,2).getBoundingClientRect();return S(t),!(!n||n.left==n.right)&&(Mt=i.right-n.right<3)}var At,Pt=3!="\n\nb".split(/\n/).length?function(t){for(var e=0,n=[],i=t.length;e<=i;){var r=t.indexOf("\n",e);-1==r&&(r=t.length);var o=t.slice(e,"\r"==t.charAt(r-1)?r-1:r),s=o.indexOf("\r");-1!=s?(n.push(o.slice(0,s)),e+=s+1):(n.push(o),e=r+1)}return n}:function(t){return t.split(/\r\n?|\n/)},Lt=window.getSelection?function(t){try{return t.selectionStart!=t.selectionEnd}catch(t){return!1}}:function(t){var e;try{e=t.ownerDocument.selection.createRange()}catch(t){}return!(!e||e.parentElement()!=t)&&0!=e.compareEndPoints("StartToEnd",e)},It="oncopy"in(At=k("div"))||(At.setAttribute("oncopy","return;"),"function"==typeof At.oncopy),zt=null;var Bt={},Rt={};function Ot(t,e){arguments.length>2&&(e.dependencies=Array.prototype.slice.call(arguments,2)),Bt[t]=e}function Nt(t){if("string"==typeof t&&Rt.hasOwnProperty(t))t=Rt[t];else if(t&&"string"==typeof t.name&&Rt.hasOwnProperty(t.name)){var e=Rt[t.name];"string"==typeof e&&(e={name:e}),(t=J(e,t)).name=e.name}else{if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return Nt("application/xml");if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+json$/.test(t))return Nt("application/json")}return"string"==typeof t?{name:t}:t||{name:"null"}}function Wt(t,e){e=Nt(e);var n=Bt[e.name];if(!n)return Wt(t,"text/plain");var i=n(t,e);if(Ht.hasOwnProperty(e.name)){var r=Ht[e.name];for(var o in r)r.hasOwnProperty(o)&&(i.hasOwnProperty(o)&&(i["_"+o]=i[o]),i[o]=r[o])}if(i.name=e.name,e.helperType&&(i.helperType=e.helperType),e.modeProps)for(var s in e.modeProps)i[s]=e.modeProps[s];return i}var Ht={};function Ft(t,e){O(e,Ht.hasOwnProperty(t)?Ht[t]:Ht[t]={})}function jt(t,e){if(!0===e)return e;if(t.copyState)return t.copyState(e);var n={};for(var i in e){var r=e[i];r instanceof Array&&(r=r.concat([])),n[i]=r}return n}function qt(t,e){for(var n;t.innerMode&&(n=t.innerMode(e))&&n.mode!=t;)e=n.state,t=n.mode;return n||{mode:t,state:e}}function Vt(t,e,n){return!t.startState||t.startState(e,n)}var Ut=function(t,e,n){this.pos=this.start=0,this.string=t,this.tabSize=e||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Kt(t,e){if((e-=t.first)<0||e>=t.size)throw new Error("There is no line "+(e+t.first)+" in the document.");for(var n=t;!n.lines;)for(var i=0;;++i){var r=n.children[i],o=r.chunkSize();if(e<o){n=r;break}e-=o}return n.lines[e]}function Gt(t,e,n){var i=[],r=e.line;return t.iter(e.line,n.line+1,(function(t){var o=t.text;r==n.line&&(o=o.slice(0,n.ch)),r==e.line&&(o=o.slice(e.ch)),i.push(o),++r})),i}function $t(t,e,n){var i=[];return t.iter(e,n,(function(t){i.push(t.text)})),i}function Yt(t,e){var n=e-t.height;if(n)for(var i=t;i;i=i.parent)i.height+=n}function Xt(t){if(null==t.parent)return null;for(var e=t.parent,n=H(e.lines,t),i=e.parent;i;e=i,i=i.parent)for(var r=0;i.children[r]!=e;++r)n+=i.children[r].chunkSize();return n+e.first}function Jt(t,e){var n=t.first;t:do{for(var i=0;i<t.children.length;++i){var r=t.children[i],o=r.height;if(e<o){t=r;continue t}e-=o,n+=r.chunkSize()}return n}while(!t.lines);for(var s=0;s<t.lines.length;++s){var a=t.lines[s].height;if(e<a)break;e-=a}return n+s}function Zt(t,e){return e>=t.first&&e<t.first+t.size}function Qt(t,e){return String(t.lineNumberFormatter(e+t.firstLineNumber))}function te(t,e,n){if(void 0===n&&(n=null),!(this instanceof te))return new te(t,e,n);this.line=t,this.ch=e,this.sticky=n}function ee(t,e){return t.line-e.line||t.ch-e.ch}function ne(t,e){return t.sticky==e.sticky&&0==ee(t,e)}function ie(t){return te(t.line,t.ch)}function re(t,e){return ee(t,e)<0?e:t}function oe(t,e){return ee(t,e)<0?t:e}function se(t,e){return Math.max(t.first,Math.min(e,t.first+t.size-1))}function ae(t,e){if(e.line<t.first)return te(t.first,0);var n=t.first+t.size-1;return e.line>n?te(n,Kt(t,n).text.length):function(t,e){var n=t.ch;return null==n||n>e?te(t.line,e):n<0?te(t.line,0):t}(e,Kt(t,e.line).text.length)}function le(t,e){for(var n=[],i=0;i<e.length;i++)n[i]=ae(t,e[i]);return n}Ut.prototype.eol=function(){return this.pos>=this.string.length},Ut.prototype.sol=function(){return this.pos==this.lineStart},Ut.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ut.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ut.prototype.eat=function(t){var e=this.string.charAt(this.pos);if("string"==typeof t?e==t:e&&(t.test?t.test(e):t(e)))return++this.pos,e},Ut.prototype.eatWhile=function(t){for(var e=this.pos;this.eat(t););return this.pos>e},Ut.prototype.eatSpace=function(){for(var t=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t},Ut.prototype.skipToEnd=function(){this.pos=this.string.length},Ut.prototype.skipTo=function(t){var e=this.string.indexOf(t,this.pos);if(e>-1)return this.pos=e,!0},Ut.prototype.backUp=function(t){this.pos-=t},Ut.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=N(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?N(this.string,this.lineStart,this.tabSize):0)},Ut.prototype.indentation=function(){return N(this.string,null,this.tabSize)-(this.lineStart?N(this.string,this.lineStart,this.tabSize):0)},Ut.prototype.match=function(t,e,n){if("string"!=typeof t){var i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&!1!==e&&(this.pos+=i[0].length),i)}var r=function(t){return n?t.toLowerCase():t};if(r(this.string.substr(this.pos,t.length))==r(t))return!1!==e&&(this.pos+=t.length),!0},Ut.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ut.prototype.hideFirstChars=function(t,e){this.lineStart+=t;try{return e()}finally{this.lineStart-=t}},Ut.prototype.lookAhead=function(t){var e=this.lineOracle;return e&&e.lookAhead(t)},Ut.prototype.baseToken=function(){var t=this.lineOracle;return t&&t.baseToken(this.pos)};var ce=function(t,e){this.state=t,this.lookAhead=e},ue=function(t,e,n,i){this.state=e,this.doc=t,this.line=n,this.maxLookAhead=i||0,this.baseTokens=null,this.baseTokenPos=1};function de(t,e,n,i){var r=[t.state.modeGen],o={};_e(t,e.text,t.doc.mode,n,(function(t,e){return r.push(t,e)}),o,i);for(var s=n.state,a=function(i){n.baseTokens=r;var a=t.state.overlays[i],l=1,c=0;n.state=!0,_e(t,e.text,a.mode,n,(function(t,e){for(var n=l;c<t;){var i=r[l];i>t&&r.splice(l,1,t,r[l+1],i),l+=2,c=Math.min(t,i)}if(e)if(a.opaque)r.splice(n,l-n,t,"overlay "+e),l=n+2;else for(;n<l;n+=2){var o=r[n+1];r[n+1]=(o?o+" ":"")+"overlay "+e}}),o),n.state=s,n.baseTokens=null,n.baseTokenPos=1},l=0;l<t.state.overlays.length;++l)a(l);return{styles:r,classes:o.bgClass||o.textClass?o:null}}function he(t,e,n){if(!e.styles||e.styles[0]!=t.state.modeGen){var i=pe(t,Xt(e)),r=e.text.length>t.options.maxHighlightLength&&jt(t.doc.mode,i.state),o=de(t,e,i);r&&(i.state=r),e.stateAfter=i.save(!r),e.styles=o.styles,o.classes?e.styleClasses=o.classes:e.styleClasses&&(e.styleClasses=null),n===t.doc.highlightFrontier&&(t.doc.modeFrontier=Math.max(t.doc.modeFrontier,++t.doc.highlightFrontier))}return e.styles}function pe(t,e,n){var i=t.doc,r=t.display;if(!i.mode.startState)return new ue(i,!0,e);var o=function(t,e,n){for(var i,r,o=t.doc,s=n?-1:e-(t.doc.mode.innerMode?1e3:100),a=e;a>s;--a){if(a<=o.first)return o.first;var l=Kt(o,a-1),c=l.stateAfter;if(c&&(!n||a+(c instanceof ce?c.lookAhead:0)<=o.modeFrontier))return a;var u=N(l.text,null,t.options.tabSize);(null==r||i>u)&&(r=a-1,i=u)}return r}(t,e,n),s=o>i.first&&Kt(i,o-1).stateAfter,a=s?ue.fromSaved(i,s,o):new ue(i,Vt(i.mode),o);return i.iter(o,e,(function(n){fe(t,n.text,a);var i=a.line;n.stateAfter=i==e-1||i%5==0||i>=r.viewFrom&&i<r.viewTo?a.save():null,a.nextLine()})),n&&(i.modeFrontier=a.line),a}function fe(t,e,n,i){var r=t.doc.mode,o=new Ut(e,t.options.tabSize,n);for(o.start=o.pos=i||0,""==e&&me(r,n.state);!o.eol();)ge(r,o,n.state),o.start=o.pos}function me(t,e){if(t.blankLine)return t.blankLine(e);if(t.innerMode){var n=qt(t,e);return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function ge(t,e,n,i){for(var r=0;r<10;r++){i&&(i[0]=qt(t,n).mode);var o=t.token(e,n);if(e.pos>e.start)return o}throw new Error("Mode "+t.name+" failed to advance stream.")}ue.prototype.lookAhead=function(t){var e=this.doc.getLine(this.line+t);return null!=e&&t>this.maxLookAhead&&(this.maxLookAhead=t),e},ue.prototype.baseToken=function(t){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=t;)this.baseTokenPos+=2;var e=this.baseTokens[this.baseTokenPos+1];return{type:e&&e.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-t}},ue.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ue.fromSaved=function(t,e,n){return e instanceof ce?new ue(t,jt(t.mode,e.state),n,e.lookAhead):new ue(t,jt(t.mode,e),n)},ue.prototype.save=function(t){var e=!1!==t?jt(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new ce(e,this.maxLookAhead):e};var ve=function(t,e,n){this.start=t.start,this.end=t.pos,this.string=t.current(),this.type=e||null,this.state=n};function ye(t,e,n,i){var r,o,s=t.doc,a=s.mode,l=Kt(s,(e=ae(s,e)).line),c=pe(t,e.line,n),u=new Ut(l.text,t.options.tabSize,c);for(i&&(o=[]);(i||u.pos<e.ch)&&!u.eol();)u.start=u.pos,r=ge(a,u,c.state),i&&o.push(new ve(u,r,jt(s.mode,c.state)));return i?o:new ve(u,r,c.state)}function be(t,e){if(t)for(;;){var n=t.match(/(?:^|\s+)line-(background-)?(\S+)/);if(!n)break;t=t.slice(0,n.index)+t.slice(n.index+n[0].length);var i=n[1]?"bgClass":"textClass";null==e[i]?e[i]=n[2]:new RegExp("(?:^|\\s)"+n[2]+"(?:$|\\s)").test(e[i])||(e[i]+=" "+n[2])}return t}function _e(t,e,n,i,r,o,s){var a=n.flattenSpans;null==a&&(a=t.options.flattenSpans);var l,c=0,u=null,d=new Ut(e,t.options.tabSize,i),h=t.options.addModeClass&&[null];for(""==e&&be(me(n,i.state),o);!d.eol();){if(d.pos>t.options.maxHighlightLength?(a=!1,s&&fe(t,e,i,d.pos),d.pos=e.length,l=null):l=be(ge(n,d,i.state,h),o),h){var p=h[0].name;p&&(l="m-"+(l?p+" "+l:p))}if(!a||u!=l){for(;c<d.start;)r(c=Math.min(d.start,c+5e3),u);u=l}d.start=d.pos}for(;c<d.pos;){var f=Math.min(d.pos,c+5e3);r(f,u),c=f}}var we=!1,xe=!1;function Ce(t,e,n){this.marker=t,this.from=e,this.to=n}function Ee(t,e){if(t)for(var n=0;n<t.length;++n){var i=t[n];if(i.marker==e)return i}}function De(t,e){for(var n,i=0;i<t.length;++i)t[i]!=e&&(n||(n=[])).push(t[i]);return n}function Me(t,e){if(e.full)return null;var n=Zt(t,e.from.line)&&Kt(t,e.from.line).markedSpans,i=Zt(t,e.to.line)&&Kt(t,e.to.line).markedSpans;if(!n&&!i)return null;var r=e.from.ch,o=e.to.ch,s=0==ee(e.from,e.to),a=function(t,e,n){var i;if(t)for(var r=0;r<t.length;++r){var o=t[r],s=o.marker;if(null==o.from||(s.inclusiveLeft?o.from<=e:o.from<e)||o.from==e&&"bookmark"==s.type&&(!n||!o.marker.insertLeft)){var a=null==o.to||(s.inclusiveRight?o.to>=e:o.to>e);(i||(i=[])).push(new Ce(s,o.from,a?null:o.to))}}return i}(n,r,s),l=function(t,e,n){var i;if(t)for(var r=0;r<t.length;++r){var o=t[r],s=o.marker;if(null==o.to||(s.inclusiveRight?o.to>=e:o.to>e)||o.from==e&&"bookmark"==s.type&&(!n||o.marker.insertLeft)){var a=null==o.from||(s.inclusiveLeft?o.from<=e:o.from<e);(i||(i=[])).push(new Ce(s,a?null:o.from-e,null==o.to?null:o.to-e))}}return i}(i,o,s),c=1==e.text.length,u=$(e.text).length+(c?r:0);if(a)for(var d=0;d<a.length;++d){var h=a[d];if(null==h.to){var p=Ee(l,h.marker);p?c&&(h.to=null==p.to?null:p.to+u):h.to=r}}if(l)for(var f=0;f<l.length;++f){var m=l[f];null!=m.to&&(m.to+=u),null==m.from?Ee(a,m.marker)||(m.from=u,c&&(a||(a=[])).push(m)):(m.from+=u,c&&(a||(a=[])).push(m))}a&&(a=Se(a)),l&&l!=a&&(l=Se(l));var g=[a];if(!c){var v,y=e.text.length-2;if(y>0&&a)for(var b=0;b<a.length;++b)null==a[b].to&&(v||(v=[])).push(new Ce(a[b].marker,null,null));for(var _=0;_<y;++_)g.push(v);g.push(l)}return g}function Se(t){for(var e=0;e<t.length;++e){var n=t[e];null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&t.splice(e--,1)}return t.length?t:null}function Te(t){var e=t.markedSpans;if(e){for(var n=0;n<e.length;++n)e[n].marker.detachLine(t);t.markedSpans=null}}function ke(t,e){if(e){for(var n=0;n<e.length;++n)e[n].marker.attachLine(t);t.markedSpans=e}}function Ae(t){return t.inclusiveLeft?-1:0}function Pe(t){return t.inclusiveRight?1:0}function Le(t,e){var n=t.lines.length-e.lines.length;if(0!=n)return n;var i=t.find(),r=e.find(),o=ee(i.from,r.from)||Ae(t)-Ae(e);return o?-o:ee(i.to,r.to)||Pe(t)-Pe(e)||e.id-t.id}function Ie(t,e){var n,i=xe&&t.markedSpans;if(i)for(var r=void 0,o=0;o<i.length;++o)(r=i[o]).marker.collapsed&&null==(e?r.from:r.to)&&(!n||Le(n,r.marker)<0)&&(n=r.marker);return n}function ze(t){return Ie(t,!0)}function Be(t){return Ie(t,!1)}function Re(t,e){var n,i=xe&&t.markedSpans;if(i)for(var r=0;r<i.length;++r){var o=i[r];o.marker.collapsed&&(null==o.from||o.from<e)&&(null==o.to||o.to>e)&&(!n||Le(n,o.marker)<0)&&(n=o.marker)}return n}function Oe(t,e,n,i,r){var o=Kt(t,e),s=xe&&o.markedSpans;if(s)for(var a=0;a<s.length;++a){var l=s[a];if(l.marker.collapsed){var c=l.marker.find(0),u=ee(c.from,n)||Ae(l.marker)-Ae(r),d=ee(c.to,i)||Pe(l.marker)-Pe(r);if(!(u>=0&&d<=0||u<=0&&d>=0)&&(u<=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ee(c.to,n)>=0:ee(c.to,n)>0)||u>=0&&(l.marker.inclusiveRight&&r.inclusiveLeft?ee(c.from,i)<=0:ee(c.from,i)<0)))return!0}}}function Ne(t){for(var e;e=ze(t);)t=e.find(-1,!0).line;return t}function We(t,e){var n=Kt(t,e),i=Ne(n);return n==i?e:Xt(i)}function He(t,e){if(e>t.lastLine())return e;var n,i=Kt(t,e);if(!Fe(t,i))return e;for(;n=Be(i);)i=n.find(1,!0).line;return Xt(i)+1}function Fe(t,e){var n=xe&&e.markedSpans;if(n)for(var i=void 0,r=0;r<n.length;++r)if((i=n[r]).marker.collapsed){if(null==i.from)return!0;if(!i.marker.widgetNode&&0==i.from&&i.marker.inclusiveLeft&&je(t,e,i))return!0}}function je(t,e,n){if(null==n.to){var i=n.marker.find(1,!0);return je(t,i.line,Ee(i.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==e.text.length)return!0;for(var r=void 0,o=0;o<e.markedSpans.length;++o)if((r=e.markedSpans[o]).marker.collapsed&&!r.marker.widgetNode&&r.from==n.to&&(null==r.to||r.to!=n.from)&&(r.marker.inclusiveLeft||n.marker.inclusiveRight)&&je(t,e,r))return!0}function qe(t){for(var e=0,n=(t=Ne(t)).parent,i=0;i<n.lines.length;++i){var r=n.lines[i];if(r==t)break;e+=r.height}for(var o=n.parent;o;o=(n=o).parent)for(var s=0;s<o.children.length;++s){var a=o.children[s];if(a==n)break;e+=a.height}return e}function Ve(t){if(0==t.height)return 0;for(var e,n=t.text.length,i=t;e=ze(i);){var r=e.find(0,!0);i=r.from.line,n+=r.from.ch-r.to.ch}for(i=t;e=Be(i);){var o=e.find(0,!0);n-=i.text.length-o.from.ch,n+=(i=o.to.line).text.length-o.to.ch}return n}function Ue(t){var e=t.display,n=t.doc;e.maxLine=Kt(n,n.first),e.maxLineLength=Ve(e.maxLine),e.maxLineChanged=!0,n.iter((function(t){var n=Ve(t);n>e.maxLineLength&&(e.maxLineLength=n,e.maxLine=t)}))}var Ke=function(t,e,n){this.text=t,ke(this,e),this.height=n?n(this):1};function Ge(t){t.parent=null,Te(t)}Ke.prototype.lineNo=function(){return Xt(this)},yt(Ke);var $e={},Ye={};function Xe(t,e){if(!t||/^\s*$/.test(t))return null;var n=e.addModeClass?Ye:$e;return n[t]||(n[t]=t.replace(/\S+/g,"cm-$&"))}function Je(t,e){var n=A("span",null,null,l?"padding-right: .1px":null),i={pre:A("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:t,trailingSpace:!1,splitSpaces:t.getOption("lineWrapping")};e.measure={};for(var r=0;r<=(e.rest?e.rest.length:0);r++){var o=r?e.rest[r-1]:e.line,s=void 0;i.pos=0,i.addToken=Qe,kt(t.display.measure)&&(s=ct(o,t.doc.direction))&&(i.addToken=tn(i.addToken,s)),i.map=[],nn(o,i,he(t,o,e!=t.display.externalMeasured&&Xt(o))),o.styleClasses&&(o.styleClasses.bgClass&&(i.bgClass=z(o.styleClasses.bgClass,i.bgClass||"")),o.styleClasses.textClass&&(i.textClass=z(o.styleClasses.textClass,i.textClass||""))),0==i.map.length&&i.map.push(0,0,i.content.appendChild(Tt(t.display.measure))),0==r?(e.measure.map=i.map,e.measure.cache={}):((e.measure.maps||(e.measure.maps=[])).push(i.map),(e.measure.caches||(e.measure.caches=[])).push({}))}if(l){var a=i.content.lastChild;(/\bcm-tab\b/.test(a.className)||a.querySelector&&a.querySelector(".cm-tab"))&&(i.content.className="cm-tab-wrap-hack")}return ft(t,"renderLine",t,e.line,i.pre),i.pre.className&&(i.textClass=z(i.pre.className,i.textClass||"")),i}function Ze(t){var e=k("span","•","cm-invalidchar");return e.title="\\u"+t.charCodeAt(0).toString(16),e.setAttribute("aria-label",e.title),e}function Qe(t,e,n,i,r,o,l){if(e){var c,u=t.splitSpaces?function(t,e){if(t.length>1&&!/ /.test(t))return t;for(var n=e,i="",r=0;r<t.length;r++){var o=t.charAt(r);" "!=o||!n||r!=t.length-1&&32!=t.charCodeAt(r+1)||(o=" "),i+=o,n=" "==o}return i}(e,t.trailingSpace):e,d=t.cm.state.specialChars,h=!1;if(d.test(e)){c=document.createDocumentFragment();for(var p=0;;){d.lastIndex=p;var f=d.exec(e),m=f?f.index-p:e.length-p;if(m){var g=document.createTextNode(u.slice(p,p+m));s&&a<9?c.appendChild(k("span",[g])):c.appendChild(g),t.map.push(t.pos,t.pos+m,g),t.col+=m,t.pos+=m}if(!f)break;p+=m+1;var v=void 0;if("\t"==f[0]){var y=t.cm.options.tabSize,b=y-t.col%y;(v=c.appendChild(k("span",G(b),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),t.col+=b}else"\r"==f[0]||"\n"==f[0]?((v=c.appendChild(k("span","\r"==f[0]?"␍":"␤","cm-invalidchar"))).setAttribute("cm-text",f[0]),t.col+=1):((v=t.cm.options.specialCharPlaceholder(f[0])).setAttribute("cm-text",f[0]),s&&a<9?c.appendChild(k("span",[v])):c.appendChild(v),t.col+=1);t.map.push(t.pos,t.pos+1,v),t.pos++}}else t.col+=e.length,c=document.createTextNode(u),t.map.push(t.pos,t.pos+e.length,c),s&&a<9&&(h=!0),t.pos+=e.length;if(t.trailingSpace=32==u.charCodeAt(e.length-1),n||i||r||h||o||l){var _=n||"";i&&(_+=i),r&&(_+=r);var w=k("span",[c],_,o);if(l)for(var x in l)l.hasOwnProperty(x)&&"style"!=x&&"class"!=x&&w.setAttribute(x,l[x]);return t.content.appendChild(w)}t.content.appendChild(c)}}function tn(t,e){return function(n,i,r,o,s,a,l){r=r?r+" cm-force-border":"cm-force-border";for(var c=n.pos,u=c+i.length;;){for(var d=void 0,h=0;h<e.length&&!((d=e[h]).to>c&&d.from<=c);h++);if(d.to>=u)return t(n,i,r,o,s,a,l);t(n,i.slice(0,d.to-c),r,o,null,a,l),o=null,i=i.slice(d.to-c),c=d.to}}}function en(t,e,n,i){var r=!i&&n.widgetNode;r&&t.map.push(t.pos,t.pos+e,r),!i&&t.cm.display.input.needsContentAttribute&&(r||(r=t.content.appendChild(document.createElement("span"))),r.setAttribute("cm-marker",n.id)),r&&(t.cm.display.input.setUneditable(r),t.content.appendChild(r)),t.pos+=e,t.trailingSpace=!1}function nn(t,e,n){var i=t.markedSpans,r=t.text,o=0;if(i)for(var s,a,l,c,u,d,h,p=r.length,f=0,m=1,g="",v=0;;){if(v==f){l=c=u=a="",h=null,d=null,v=1/0;for(var y=[],b=void 0,_=0;_<i.length;++_){var w=i[_],x=w.marker;if("bookmark"==x.type&&w.from==f&&x.widgetNode)y.push(x);else if(w.from<=f&&(null==w.to||w.to>f||x.collapsed&&w.to==f&&w.from==f)){if(null!=w.to&&w.to!=f&&v>w.to&&(v=w.to,c=""),x.className&&(l+=" "+x.className),x.css&&(a=(a?a+";":"")+x.css),x.startStyle&&w.from==f&&(u+=" "+x.startStyle),x.endStyle&&w.to==v&&(b||(b=[])).push(x.endStyle,w.to),x.title&&((h||(h={})).title=x.title),x.attributes)for(var C in x.attributes)(h||(h={}))[C]=x.attributes[C];x.collapsed&&(!d||Le(d.marker,x)<0)&&(d=w)}else w.from>f&&v>w.from&&(v=w.from)}if(b)for(var E=0;E<b.length;E+=2)b[E+1]==v&&(c+=" "+b[E]);if(!d||d.from==f)for(var D=0;D<y.length;++D)en(e,0,y[D]);if(d&&(d.from||0)==f){if(en(e,(null==d.to?p+1:d.to)-f,d.marker,null==d.from),null==d.to)return;d.to==f&&(d=!1)}}if(f>=p)break;for(var M=Math.min(p,v);;){if(g){var S=f+g.length;if(!d){var T=S>M?g.slice(0,M-f):g;e.addToken(e,T,s?s+l:l,u,f+T.length==v?c:"",a,h)}if(S>=M){g=g.slice(M-f),f=M;break}f=S,u=""}g=r.slice(o,o=n[m++]),s=Xe(n[m++],e.cm.options)}}else for(var k=1;k<n.length;k+=2)e.addToken(e,r.slice(o,o=n[k]),Xe(n[k+1],e.cm.options))}function rn(t,e,n){this.line=e,this.rest=function(t){for(var e,n;e=Be(t);)t=e.find(1,!0).line,(n||(n=[])).push(t);return n}(e),this.size=this.rest?Xt($(this.rest))-n+1:1,this.node=this.text=null,this.hidden=Fe(t,e)}function on(t,e,n){for(var i,r=[],o=e;o<n;o=i){var s=new rn(t.doc,Kt(t.doc,o),o);i=o+s.size,r.push(s)}return r}var sn=null;var an=null;function ln(t,e){var n=ht(t,e);if(n.length){var i,r=Array.prototype.slice.call(arguments,2);sn?i=sn.delayedCallbacks:an?i=an:(i=an=[],setTimeout(cn,0));for(var o=function(t){i.push((function(){return n[t].apply(null,r)}))},s=0;s<n.length;++s)o(s)}}function cn(){var t=an;an=null;for(var e=0;e<t.length;++e)t[e]()}function un(t,e,n,i){for(var r=0;r<e.changes.length;r++){var o=e.changes[r];"text"==o?pn(t,e):"gutter"==o?mn(t,e,n,i):"class"==o?fn(t,e):"widget"==o&&gn(t,e,i)}e.changes=null}function dn(t){return t.node==t.text&&(t.node=k("div",null,null,"position: relative"),t.text.parentNode&&t.text.parentNode.replaceChild(t.node,t.text),t.node.appendChild(t.text),s&&a<8&&(t.node.style.zIndex=2)),t.node}function hn(t,e){var n=t.display.externalMeasured;return n&&n.line==e.line?(t.display.externalMeasured=null,e.measure=n.measure,n.built):Je(t,e)}function pn(t,e){var n=e.text.className,i=hn(t,e);e.text==e.node&&(e.node=i.pre),e.text.parentNode.replaceChild(i.pre,e.text),e.text=i.pre,i.bgClass!=e.bgClass||i.textClass!=e.textClass?(e.bgClass=i.bgClass,e.textClass=i.textClass,fn(t,e)):n&&(e.text.className=n)}function fn(t,e){(function(t,e){var n=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(n&&(n+=" CodeMirror-linebackground"),e.background)n?e.background.className=n:(e.background.parentNode.removeChild(e.background),e.background=null);else if(n){var i=dn(e);e.background=i.insertBefore(k("div",null,n),i.firstChild),t.display.input.setUneditable(e.background)}})(t,e),e.line.wrapClass?dn(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var n=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=n||""}function mn(t,e,n,i){if(e.gutter&&(e.node.removeChild(e.gutter),e.gutter=null),e.gutterBackground&&(e.node.removeChild(e.gutterBackground),e.gutterBackground=null),e.line.gutterClass){var r=dn(e);e.gutterBackground=k("div",null,"CodeMirror-gutter-background "+e.line.gutterClass,"left: "+(t.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px; width: "+i.gutterTotalWidth+"px"),t.display.input.setUneditable(e.gutterBackground),r.insertBefore(e.gutterBackground,e.text)}var o=e.line.gutterMarkers;if(t.options.lineNumbers||o){var s=dn(e),a=e.gutter=k("div",null,"CodeMirror-gutter-wrapper","left: "+(t.options.fixedGutter?i.fixedPos:-i.gutterTotalWidth)+"px");if(t.display.input.setUneditable(a),s.insertBefore(a,e.text),e.line.gutterClass&&(a.className+=" "+e.line.gutterClass),!t.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(e.lineNumber=a.appendChild(k("div",Qt(t.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+i.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+t.display.lineNumInnerWidth+"px"))),o)for(var l=0;l<t.display.gutterSpecs.length;++l){var c=t.display.gutterSpecs[l].className,u=o.hasOwnProperty(c)&&o[c];u&&a.appendChild(k("div",[u],"CodeMirror-gutter-elt","left: "+i.gutterLeft[c]+"px; width: "+i.gutterWidth[c]+"px"))}}}function gn(t,e,n){e.alignable&&(e.alignable=null);for(var i=E("CodeMirror-linewidget"),r=e.node.firstChild,o=void 0;r;r=o)o=r.nextSibling,i.test(r.className)&&e.node.removeChild(r);yn(t,e,n)}function vn(t,e,n,i){var r=hn(t,e);return e.text=e.node=r.pre,r.bgClass&&(e.bgClass=r.bgClass),r.textClass&&(e.textClass=r.textClass),fn(t,e),mn(t,e,n,i),yn(t,e,i),e.node}function yn(t,e,n){if(bn(t,e.line,e,n,!0),e.rest)for(var i=0;i<e.rest.length;i++)bn(t,e.rest[i],e,n,!1)}function bn(t,e,n,i,r){if(e.widgets)for(var o=dn(n),s=0,a=e.widgets;s<a.length;++s){var l=a[s],c=k("div",[l.node],"CodeMirror-linewidget"+(l.className?" "+l.className:""));l.handleMouseEvents||c.setAttribute("cm-ignore-events","true"),_n(l,c,n,i),t.display.input.setUneditable(c),r&&l.above?o.insertBefore(c,n.gutter||n.text):o.appendChild(c),ln(l,"redraw")}}function _n(t,e,n,i){if(t.noHScroll){(n.alignable||(n.alignable=[])).push(e);var r=i.wrapperWidth;e.style.left=i.fixedPos+"px",t.coverGutter||(r-=i.gutterTotalWidth,e.style.paddingLeft=i.gutterTotalWidth+"px"),e.style.width=r+"px"}t.coverGutter&&(e.style.zIndex=5,e.style.position="relative",t.noHScroll||(e.style.marginLeft=-i.gutterTotalWidth+"px"))}function wn(t){if(null!=t.height)return t.height;var e=t.doc.cm;if(!e)return 0;if(!P(document.body,t.node)){var n="position: relative;";t.coverGutter&&(n+="margin-left: -"+e.display.gutters.offsetWidth+"px;"),t.noHScroll&&(n+="width: "+e.display.wrapper.clientWidth+"px;"),T(e.display.measure,k("div",[t.node],null,n))}return t.height=t.node.parentNode.offsetHeight}function xn(t,e){for(var n=Ct(e);n!=t.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==t.sizer&&n!=t.mover)return!0}function Cn(t){return t.lineSpace.offsetTop}function En(t){return t.mover.offsetHeight-t.lineSpace.offsetHeight}function Dn(t){if(t.cachedPaddingH)return t.cachedPaddingH;var e=T(t.measure,k("pre","x","CodeMirror-line-like")),n=window.getComputedStyle?window.getComputedStyle(e):e.currentStyle,i={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)};return isNaN(i.left)||isNaN(i.right)||(t.cachedPaddingH=i),i}function Mn(t){return 50-t.display.nativeBarWidth}function Sn(t){return t.display.scroller.clientWidth-Mn(t)-t.display.barWidth}function Tn(t){return t.display.scroller.clientHeight-Mn(t)-t.display.barHeight}function kn(t,e,n){if(t.line==e)return{map:t.measure.map,cache:t.measure.cache};for(var i=0;i<t.rest.length;i++)if(t.rest[i]==e)return{map:t.measure.maps[i],cache:t.measure.caches[i]};for(var r=0;r<t.rest.length;r++)if(Xt(t.rest[r])>n)return{map:t.measure.maps[r],cache:t.measure.caches[r],before:!0}}function An(t,e,n,i){return In(t,Ln(t,e),n,i)}function Pn(t,e){if(e>=t.display.viewFrom&&e<t.display.viewTo)return t.display.view[ui(t,e)];var n=t.display.externalMeasured;return n&&e>=n.lineN&&e<n.lineN+n.size?n:void 0}function Ln(t,e){var n=Xt(e),i=Pn(t,n);i&&!i.text?i=null:i&&i.changes&&(un(t,i,n,oi(t)),t.curOp.forceUpdate=!0),i||(i=function(t,e){var n=Xt(e=Ne(e)),i=t.display.externalMeasured=new rn(t.doc,e,n);i.lineN=n;var r=i.built=Je(t,i);return i.text=r.pre,T(t.display.lineMeasure,r.pre),i}(t,e));var r=kn(i,e,n);return{line:e,view:i,rect:null,map:r.map,cache:r.cache,before:r.before,hasHeights:!1}}function In(t,e,n,i,r){e.before&&(n=-1);var o,l=n+(i||"");return e.cache.hasOwnProperty(l)?o=e.cache[l]:(e.rect||(e.rect=e.view.text.getBoundingClientRect()),e.hasHeights||(function(t,e,n){var i=t.options.lineWrapping,r=i&&Sn(t);if(!e.measure.heights||i&&e.measure.width!=r){var o=e.measure.heights=[];if(i){e.measure.width=r;for(var s=e.text.firstChild.getClientRects(),a=0;a<s.length-1;a++){var l=s[a],c=s[a+1];Math.abs(l.bottom-c.bottom)>2&&o.push((l.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}(t,e.view,e.rect),e.hasHeights=!0),(o=function(t,e,n,i){var r,o=Rn(e.map,n,i),l=o.node,c=o.start,u=o.end,d=o.collapse;if(3==l.nodeType){for(var h=0;h<4;h++){for(;c&&it(e.line.text.charAt(o.coverStart+c));)--c;for(;o.coverStart+u<o.coverEnd&&it(e.line.text.charAt(o.coverStart+u));)++u;if((r=s&&a<9&&0==c&&u==o.coverEnd-o.coverStart?l.parentNode.getBoundingClientRect():On(D(l,c,u).getClientRects(),i)).left||r.right||0==c)break;u=c,c-=1,d="right"}s&&a<11&&(r=function(t,e){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(t){if(null!=zt)return zt;var e=T(t,k("span","x")),n=e.getBoundingClientRect(),i=D(e,0,1).getBoundingClientRect();return zt=Math.abs(n.left-i.left)>1}(t))return e;var n=screen.logicalXDPI/screen.deviceXDPI,i=screen.logicalYDPI/screen.deviceYDPI;return{left:e.left*n,right:e.right*n,top:e.top*i,bottom:e.bottom*i}}(t.display.measure,r))}else{var p;c>0&&(d=i="right"),r=t.options.lineWrapping&&(p=l.getClientRects()).length>1?p["right"==i?p.length-1:0]:l.getBoundingClientRect()}if(s&&a<9&&!c&&(!r||!r.left&&!r.right)){var f=l.parentNode.getClientRects()[0];r=f?{left:f.left,right:f.left+ri(t.display),top:f.top,bottom:f.bottom}:Bn}for(var m=r.top-e.rect.top,g=r.bottom-e.rect.top,v=(m+g)/2,y=e.view.measure.heights,b=0;b<y.length-1&&!(v<y[b]);b++);var _=b?y[b-1]:0,w=y[b],x={left:("right"==d?r.right:r.left)-e.rect.left,right:("left"==d?r.left:r.right)-e.rect.left,top:_,bottom:w};return r.left||r.right||(x.bogus=!0),t.options.singleCursorHeightPerLine||(x.rtop=m,x.rbottom=g),x}(t,e,n,i)).bogus||(e.cache[l]=o)),{left:o.left,right:o.right,top:r?o.rtop:o.top,bottom:r?o.rbottom:o.bottom}}var zn,Bn={left:0,right:0,top:0,bottom:0};function Rn(t,e,n){for(var i,r,o,s,a,l,c=0;c<t.length;c+=3)if(a=t[c],l=t[c+1],e<a?(r=0,o=1,s="left"):e<l?o=1+(r=e-a):(c==t.length-3||e==l&&t[c+3]>e)&&(r=(o=l-a)-1,e>=l&&(s="right")),null!=r){if(i=t[c+2],a==l&&n==(i.insertLeft?"left":"right")&&(s=n),"left"==n&&0==r)for(;c&&t[c-2]==t[c-3]&&t[c-1].insertLeft;)i=t[2+(c-=3)],s="left";if("right"==n&&r==l-a)for(;c<t.length-3&&t[c+3]==t[c+4]&&!t[c+5].insertLeft;)i=t[(c+=3)+2],s="right";break}return{node:i,start:r,end:o,collapse:s,coverStart:a,coverEnd:l}}function On(t,e){var n=Bn;if("left"==e)for(var i=0;i<t.length&&(n=t[i]).left==n.right;i++);else for(var r=t.length-1;r>=0&&(n=t[r]).left==n.right;r--);return n}function Nn(t){if(t.measure&&(t.measure.cache={},t.measure.heights=null,t.rest))for(var e=0;e<t.rest.length;e++)t.measure.caches[e]={}}function Wn(t){t.display.externalMeasure=null,S(t.display.lineMeasure);for(var e=0;e<t.display.view.length;e++)Nn(t.display.view[e])}function Hn(t){Wn(t),t.display.cachedCharWidth=t.display.cachedTextHeight=t.display.cachedPaddingH=null,t.options.lineWrapping||(t.display.maxLineChanged=!0),t.display.lineNumChars=null}function Fn(){return u&&g?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function jn(){return u&&g?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function qn(t){var e=0;if(t.widgets)for(var n=0;n<t.widgets.length;++n)t.widgets[n].above&&(e+=wn(t.widgets[n]));return e}function Vn(t,e,n,i,r){if(!r){var o=qn(e);n.top+=o,n.bottom+=o}if("line"==i)return n;i||(i="local");var s=qe(e);if("local"==i?s+=Cn(t.display):s-=t.display.viewOffset,"page"==i||"window"==i){var a=t.display.lineSpace.getBoundingClientRect();s+=a.top+("window"==i?0:jn());var l=a.left+("window"==i?0:Fn());n.left+=l,n.right+=l}return n.top+=s,n.bottom+=s,n}function Un(t,e,n){if("div"==n)return e;var i=e.left,r=e.top;if("page"==n)i-=Fn(),r-=jn();else if("local"==n||!n){var o=t.display.sizer.getBoundingClientRect();i+=o.left,r+=o.top}var s=t.display.lineSpace.getBoundingClientRect();return{left:i-s.left,top:r-s.top}}function Kn(t,e,n,i,r){return i||(i=Kt(t.doc,e.line)),Vn(t,i,An(t,i,e.ch,r),n)}function Gn(t,e,n,i,r,o){function s(e,s){var a=In(t,r,e,s?"right":"left",o);return s?a.left=a.right:a.right=a.left,Vn(t,i,a,n)}i=i||Kt(t.doc,e.line),r||(r=Ln(t,i));var a=ct(i,t.doc.direction),l=e.ch,c=e.sticky;if(l>=i.text.length?(l=i.text.length,c="before"):l<=0&&(l=0,c="after"),!a)return s("before"==c?l-1:l,"before"==c);function u(t,e,n){return s(n?t-1:t,1==a[e].level!=n)}var d=at(a,l,c),h=st,p=u(l,d,"before"==c);return null!=h&&(p.other=u(l,h,"before"!=c)),p}function $n(t,e){var n=0;e=ae(t.doc,e),t.options.lineWrapping||(n=ri(t.display)*e.ch);var i=Kt(t.doc,e.line),r=qe(i)+Cn(t.display);return{left:n,right:n,top:r,bottom:r+i.height}}function Yn(t,e,n,i,r){var o=te(t,e,n);return o.xRel=r,i&&(o.outside=i),o}function Xn(t,e,n){var i=t.doc;if((n+=t.display.viewOffset)<0)return Yn(i.first,0,null,-1,-1);var r=Jt(i,n),o=i.first+i.size-1;if(r>o)return Yn(i.first+i.size-1,Kt(i,o).text.length,null,1,1);e<0&&(e=0);for(var s=Kt(i,r);;){var a=ti(t,s,r,e,n),l=Re(s,a.ch+(a.xRel>0||a.outside>0?1:0));if(!l)return a;var c=l.find(1);if(c.line==r)return c;s=Kt(i,r=c.line)}}function Jn(t,e,n,i){i-=qn(e);var r=e.text.length,o=ot((function(e){return In(t,n,e-1).bottom<=i}),r,0);return{begin:o,end:r=ot((function(e){return In(t,n,e).top>i}),o,r)}}function Zn(t,e,n,i){return n||(n=Ln(t,e)),Jn(t,e,n,Vn(t,e,In(t,n,i),"line").top)}function Qn(t,e,n,i){return!(t.bottom<=n)&&(t.top>n||(i?t.left:t.right)>e)}function ti(t,e,n,i,r){r-=qe(e);var o=Ln(t,e),s=qn(e),a=0,l=e.text.length,c=!0,u=ct(e,t.doc.direction);if(u){var d=(t.options.lineWrapping?ni:ei)(t,e,n,o,u,i,r);a=(c=1!=d.level)?d.from:d.to-1,l=c?d.to:d.from-1}var h,p,f=null,m=null,g=ot((function(e){var n=In(t,o,e);return n.top+=s,n.bottom+=s,!!Qn(n,i,r,!1)&&(n.top<=r&&n.left<=i&&(f=e,m=n),!0)}),a,l),v=!1;if(m){var y=i-m.left<m.right-i,b=y==c;g=f+(b?0:1),p=b?"after":"before",h=y?m.left:m.right}else{c||g!=l&&g!=a||g++,p=0==g?"after":g==e.text.length?"before":In(t,o,g-(c?1:0)).bottom+s<=r==c?"after":"before";var _=Gn(t,te(n,g,p),"line",e,o);h=_.left,v=r<_.top?-1:r>=_.bottom?1:0}return Yn(n,g=rt(e.text,g,1),p,v,i-h)}function ei(t,e,n,i,r,o,s){var a=ot((function(a){var l=r[a],c=1!=l.level;return Qn(Gn(t,te(n,c?l.to:l.from,c?"before":"after"),"line",e,i),o,s,!0)}),0,r.length-1),l=r[a];if(a>0){var c=1!=l.level,u=Gn(t,te(n,c?l.from:l.to,c?"after":"before"),"line",e,i);Qn(u,o,s,!0)&&u.top>s&&(l=r[a-1])}return l}function ni(t,e,n,i,r,o,s){var a=Jn(t,e,i,s),l=a.begin,c=a.end;/\s/.test(e.text.charAt(c-1))&&c--;for(var u=null,d=null,h=0;h<r.length;h++){var p=r[h];if(!(p.from>=c||p.to<=l)){var f=In(t,i,1!=p.level?Math.min(c,p.to)-1:Math.max(l,p.from)).right,m=f<o?o-f+1e9:f-o;(!u||d>m)&&(u=p,d=m)}}return u||(u=r[r.length-1]),u.from<l&&(u={from:l,to:u.to,level:u.level}),u.to>c&&(u={from:u.from,to:c,level:u.level}),u}function ii(t){if(null!=t.cachedTextHeight)return t.cachedTextHeight;if(null==zn){zn=k("pre",null,"CodeMirror-line-like");for(var e=0;e<49;++e)zn.appendChild(document.createTextNode("x")),zn.appendChild(k("br"));zn.appendChild(document.createTextNode("x"))}T(t.measure,zn);var n=zn.offsetHeight/50;return n>3&&(t.cachedTextHeight=n),S(t.measure),n||1}function ri(t){if(null!=t.cachedCharWidth)return t.cachedCharWidth;var e=k("span","xxxxxxxxxx"),n=k("pre",[e],"CodeMirror-line-like");T(t.measure,n);var i=e.getBoundingClientRect(),r=(i.right-i.left)/10;return r>2&&(t.cachedCharWidth=r),r||10}function oi(t){for(var e=t.display,n={},i={},r=e.gutters.clientLeft,o=e.gutters.firstChild,s=0;o;o=o.nextSibling,++s){var a=t.display.gutterSpecs[s].className;n[a]=o.offsetLeft+o.clientLeft+r,i[a]=o.clientWidth}return{fixedPos:si(e),gutterTotalWidth:e.gutters.offsetWidth,gutterLeft:n,gutterWidth:i,wrapperWidth:e.wrapper.clientWidth}}function si(t){return t.scroller.getBoundingClientRect().left-t.sizer.getBoundingClientRect().left}function ai(t){var e=ii(t.display),n=t.options.lineWrapping,i=n&&Math.max(5,t.display.scroller.clientWidth/ri(t.display)-3);return function(r){if(Fe(t.doc,r))return 0;var o=0;if(r.widgets)for(var s=0;s<r.widgets.length;s++)r.widgets[s].height&&(o+=r.widgets[s].height);return n?o+(Math.ceil(r.text.length/i)||1)*e:o+e}}function li(t){var e=t.doc,n=ai(t);e.iter((function(t){var e=n(t);e!=t.height&&Yt(t,e)}))}function ci(t,e,n,i){var r=t.display;if(!n&&"true"==Ct(e).getAttribute("cm-not-content"))return null;var o,s,a=r.lineSpace.getBoundingClientRect();try{o=e.clientX-a.left,s=e.clientY-a.top}catch(t){return null}var l,c=Xn(t,o,s);if(i&&c.xRel>0&&(l=Kt(t.doc,c.line).text).length==c.ch){var u=N(l,l.length,t.options.tabSize)-l.length;c=te(c.line,Math.max(0,Math.round((o-Dn(t.display).left)/ri(t.display))-u))}return c}function ui(t,e){if(e>=t.display.viewTo)return null;if((e-=t.display.viewFrom)<0)return null;for(var n=t.display.view,i=0;i<n.length;i++)if((e-=n[i].size)<0)return i}function di(t,e,n,i){null==e&&(e=t.doc.first),null==n&&(n=t.doc.first+t.doc.size),i||(i=0);var r=t.display;if(i&&n<r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>e)&&(r.updateLineNumbers=e),t.curOp.viewChanged=!0,e>=r.viewTo)xe&&We(t.doc,e)<r.viewTo&&pi(t);else if(n<=r.viewFrom)xe&&He(t.doc,n+i)>r.viewFrom?pi(t):(r.viewFrom+=i,r.viewTo+=i);else if(e<=r.viewFrom&&n>=r.viewTo)pi(t);else if(e<=r.viewFrom){var o=fi(t,n,n+i,1);o?(r.view=r.view.slice(o.index),r.viewFrom=o.lineN,r.viewTo+=i):pi(t)}else if(n>=r.viewTo){var s=fi(t,e,e,-1);s?(r.view=r.view.slice(0,s.index),r.viewTo=s.lineN):pi(t)}else{var a=fi(t,e,e,-1),l=fi(t,n,n+i,1);a&&l?(r.view=r.view.slice(0,a.index).concat(on(t,a.lineN,l.lineN)).concat(r.view.slice(l.index)),r.viewTo+=i):pi(t)}var c=r.externalMeasured;c&&(n<c.lineN?c.lineN+=i:e<c.lineN+c.size&&(r.externalMeasured=null))}function hi(t,e,n){t.curOp.viewChanged=!0;var i=t.display,r=t.display.externalMeasured;if(r&&e>=r.lineN&&e<r.lineN+r.size&&(i.externalMeasured=null),!(e<i.viewFrom||e>=i.viewTo)){var o=i.view[ui(t,e)];if(null!=o.node){var s=o.changes||(o.changes=[]);-1==H(s,n)&&s.push(n)}}}function pi(t){t.display.viewFrom=t.display.viewTo=t.doc.first,t.display.view=[],t.display.viewOffset=0}function fi(t,e,n,i){var r,o=ui(t,e),s=t.display.view;if(!xe||n==t.doc.first+t.doc.size)return{index:o,lineN:n};for(var a=t.display.viewFrom,l=0;l<o;l++)a+=s[l].size;if(a!=e){if(i>0){if(o==s.length-1)return null;r=a+s[o].size-e,o++}else r=a-e;e+=r,n+=r}for(;We(t.doc,n)!=n;){if(o==(i<0?0:s.length-1))return null;n+=i*s[o-(i<0?1:0)].size,o+=i}return{index:o,lineN:n}}function mi(t){for(var e=t.display.view,n=0,i=0;i<e.length;i++){var r=e[i];r.hidden||r.node&&!r.changes||++n}return n}function gi(t){t.display.input.showSelection(t.display.input.prepareSelection())}function vi(t,e){void 0===e&&(e=!0);for(var n=t.doc,i={},r=i.cursors=document.createDocumentFragment(),o=i.selection=document.createDocumentFragment(),s=0;s<n.sel.ranges.length;s++)if(e||s!=n.sel.primIndex){var a=n.sel.ranges[s];if(!(a.from().line>=t.display.viewTo||a.to().line<t.display.viewFrom)){var l=a.empty();(l||t.options.showCursorWhenSelecting)&&yi(t,a.head,r),l||_i(t,a,o)}}return i}function yi(t,e,n){var i=Gn(t,e,"div",null,null,!t.options.singleCursorHeightPerLine),r=n.appendChild(k("div"," ","CodeMirror-cursor"));if(r.style.left=i.left+"px",r.style.top=i.top+"px",r.style.height=Math.max(0,i.bottom-i.top)*t.options.cursorHeight+"px",i.other){var o=n.appendChild(k("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));o.style.display="",o.style.left=i.other.left+"px",o.style.top=i.other.top+"px",o.style.height=.85*(i.other.bottom-i.other.top)+"px"}}function bi(t,e){return t.top-e.top||t.left-e.left}function _i(t,e,n){var i=t.display,r=t.doc,o=document.createDocumentFragment(),s=Dn(t.display),a=s.left,l=Math.max(i.sizerWidth,Sn(t)-i.sizer.offsetLeft)-s.right,c="ltr"==r.direction;function u(t,e,n,i){e<0&&(e=0),e=Math.round(e),i=Math.round(i),o.appendChild(k("div",null,"CodeMirror-selected","position: absolute; left: "+t+"px;\n top: "+e+"px; width: "+(null==n?l-t:n)+"px;\n height: "+(i-e)+"px"))}function d(e,n,i){var o,s,d=Kt(r,e),h=d.text.length;function p(n,i){return Kn(t,te(e,n),"div",d,i)}function f(e,n,i){var r=Zn(t,d,null,e),o="ltr"==n==("after"==i)?"left":"right";return p("after"==i?r.begin:r.end-(/\s/.test(d.text.charAt(r.end-1))?2:1),o)[o]}var m=ct(d,r.direction);return function(t,e,n,i){if(!t)return i(e,n,"ltr",0);for(var r=!1,o=0;o<t.length;++o){var s=t[o];(s.from<n&&s.to>e||e==n&&s.to==e)&&(i(Math.max(s.from,e),Math.min(s.to,n),1==s.level?"rtl":"ltr",o),r=!0)}r||i(e,n,"ltr")}(m,n||0,null==i?h:i,(function(t,e,r,d){var g="ltr"==r,v=p(t,g?"left":"right"),y=p(e-1,g?"right":"left"),b=null==n&&0==t,_=null==i&&e==h,w=0==d,x=!m||d==m.length-1;if(y.top-v.top<=3){var C=(c?_:b)&&x,E=(c?b:_)&&w?a:(g?v:y).left,D=C?l:(g?y:v).right;u(E,v.top,D-E,v.bottom)}else{var M,S,T,k;g?(M=c&&b&&w?a:v.left,S=c?l:f(t,r,"before"),T=c?a:f(e,r,"after"),k=c&&_&&x?l:y.right):(M=c?f(t,r,"before"):a,S=!c&&b&&w?l:v.right,T=!c&&_&&x?a:y.left,k=c?f(e,r,"after"):l),u(M,v.top,S-M,v.bottom),v.bottom<y.top&&u(a,v.bottom,null,y.top),u(T,y.top,k-T,y.bottom)}(!o||bi(v,o)<0)&&(o=v),bi(y,o)<0&&(o=y),(!s||bi(v,s)<0)&&(s=v),bi(y,s)<0&&(s=y)})),{start:o,end:s}}var h=e.from(),p=e.to();if(h.line==p.line)d(h.line,h.ch,p.ch);else{var f=Kt(r,h.line),m=Kt(r,p.line),g=Ne(f)==Ne(m),v=d(h.line,h.ch,g?f.text.length+1:null).end,y=d(p.line,g?0:null,p.ch).start;g&&(v.top<y.top-2?(u(v.right,v.top,null,v.bottom),u(a,y.top,y.left,y.bottom)):u(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&u(a,v.bottom,null,y.top)}n.appendChild(o)}function wi(t){if(t.state.focused){var e=t.display;clearInterval(e.blinker);var n=!0;e.cursorDiv.style.visibility="",t.options.cursorBlinkRate>0?e.blinker=setInterval((function(){t.hasFocus()||Di(t),e.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),t.options.cursorBlinkRate):t.options.cursorBlinkRate<0&&(e.cursorDiv.style.visibility="hidden")}}function xi(t){t.hasFocus()||(t.display.input.focus(),t.state.focused||Ei(t))}function Ci(t){t.state.delayingBlurEvent=!0,setTimeout((function(){t.state.delayingBlurEvent&&(t.state.delayingBlurEvent=!1,t.state.focused&&Di(t))}),100)}function Ei(t,e){t.state.delayingBlurEvent&&!t.state.draggingText&&(t.state.delayingBlurEvent=!1),"nocursor"!=t.options.readOnly&&(t.state.focused||(ft(t,"focus",t,e),t.state.focused=!0,I(t.display.wrapper,"CodeMirror-focused"),t.curOp||t.display.selForContextMenu==t.doc.sel||(t.display.input.reset(),l&&setTimeout((function(){return t.display.input.reset(!0)}),20)),t.display.input.receivedFocus()),wi(t))}function Di(t,e){t.state.delayingBlurEvent||(t.state.focused&&(ft(t,"blur",t,e),t.state.focused=!1,M(t.display.wrapper,"CodeMirror-focused")),clearInterval(t.display.blinker),setTimeout((function(){t.state.focused||(t.display.shift=!1)}),150))}function Mi(t){for(var e=t.display,n=e.lineDiv.offsetTop,i=0;i<e.view.length;i++){var r=e.view[i],o=t.options.lineWrapping,l=void 0,c=0;if(!r.hidden){if(s&&a<8){var u=r.node.offsetTop+r.node.offsetHeight;l=u-n,n=u}else{var d=r.node.getBoundingClientRect();l=d.bottom-d.top,!o&&r.text.firstChild&&(c=r.text.firstChild.getBoundingClientRect().right-d.left-1)}var h=r.line.height-l;if((h>.005||h<-.005)&&(Yt(r.line,l),Si(r.line),r.rest))for(var p=0;p<r.rest.length;p++)Si(r.rest[p]);if(c>t.display.sizerWidth){var f=Math.ceil(c/ri(t.display));f>t.display.maxLineLength&&(t.display.maxLineLength=f,t.display.maxLine=r.line,t.display.maxLineChanged=!0)}}}}function Si(t){if(t.widgets)for(var e=0;e<t.widgets.length;++e){var n=t.widgets[e],i=n.node.parentNode;i&&(n.height=i.offsetHeight)}}function Ti(t,e,n){var i=n&&null!=n.top?Math.max(0,n.top):t.scroller.scrollTop;i=Math.floor(i-Cn(t));var r=n&&null!=n.bottom?n.bottom:i+t.wrapper.clientHeight,o=Jt(e,i),s=Jt(e,r);if(n&&n.ensure){var a=n.ensure.from.line,l=n.ensure.to.line;a<o?(o=a,s=Jt(e,qe(Kt(e,a))+t.wrapper.clientHeight)):Math.min(l,e.lastLine())>=s&&(o=Jt(e,qe(Kt(e,l))-t.wrapper.clientHeight),s=l)}return{from:o,to:Math.max(s,o+1)}}function ki(t,e){var n=t.display,i=ii(t.display);e.top<0&&(e.top=0);var r=t.curOp&&null!=t.curOp.scrollTop?t.curOp.scrollTop:n.scroller.scrollTop,o=Tn(t),s={};e.bottom-e.top>o&&(e.bottom=e.top+o);var a=t.doc.height+En(n),l=e.top<i,c=e.bottom>a-i;if(e.top<r)s.scrollTop=l?0:e.top;else if(e.bottom>r+o){var u=Math.min(e.top,(c?a:e.bottom)-o);u!=r&&(s.scrollTop=u)}var d=t.options.fixedGutter?0:n.gutters.offsetWidth,h=t.curOp&&null!=t.curOp.scrollLeft?t.curOp.scrollLeft:n.scroller.scrollLeft-d,p=Sn(t)-n.gutters.offsetWidth,f=e.right-e.left>p;return f&&(e.right=e.left+p),e.left<10?s.scrollLeft=0:e.left<h?s.scrollLeft=Math.max(0,e.left+d-(f?0:10)):e.right>p+h-3&&(s.scrollLeft=e.right+(f?0:10)-p),s}function Ai(t,e){null!=e&&(Ii(t),t.curOp.scrollTop=(null==t.curOp.scrollTop?t.doc.scrollTop:t.curOp.scrollTop)+e)}function Pi(t){Ii(t);var e=t.getCursor();t.curOp.scrollToPos={from:e,to:e,margin:t.options.cursorScrollMargin}}function Li(t,e,n){null==e&&null==n||Ii(t),null!=e&&(t.curOp.scrollLeft=e),null!=n&&(t.curOp.scrollTop=n)}function Ii(t){var e=t.curOp.scrollToPos;e&&(t.curOp.scrollToPos=null,zi(t,$n(t,e.from),$n(t,e.to),e.margin))}function zi(t,e,n,i){var r=ki(t,{left:Math.min(e.left,n.left),top:Math.min(e.top,n.top)-i,right:Math.max(e.right,n.right),bottom:Math.max(e.bottom,n.bottom)+i});Li(t,r.scrollLeft,r.scrollTop)}function Bi(t,e){Math.abs(t.doc.scrollTop-e)<2||(n||lr(t,{top:e}),Ri(t,e,!0),n&&lr(t),ir(t,100))}function Ri(t,e,n){e=Math.max(0,Math.min(t.display.scroller.scrollHeight-t.display.scroller.clientHeight,e)),(t.display.scroller.scrollTop!=e||n)&&(t.doc.scrollTop=e,t.display.scrollbars.setScrollTop(e),t.display.scroller.scrollTop!=e&&(t.display.scroller.scrollTop=e))}function Oi(t,e,n,i){e=Math.max(0,Math.min(e,t.display.scroller.scrollWidth-t.display.scroller.clientWidth)),(n?e==t.doc.scrollLeft:Math.abs(t.doc.scrollLeft-e)<2)&&!i||(t.doc.scrollLeft=e,dr(t),t.display.scroller.scrollLeft!=e&&(t.display.scroller.scrollLeft=e),t.display.scrollbars.setScrollLeft(e))}function Ni(t){var e=t.display,n=e.gutters.offsetWidth,i=Math.round(t.doc.height+En(t.display));return{clientHeight:e.scroller.clientHeight,viewHeight:e.wrapper.clientHeight,scrollWidth:e.scroller.scrollWidth,clientWidth:e.scroller.clientWidth,viewWidth:e.wrapper.clientWidth,barLeft:t.options.fixedGutter?n:0,docHeight:i,scrollHeight:i+Mn(t)+e.barHeight,nativeBarWidth:e.nativeBarWidth,gutterWidth:n}}var Wi=function(t,e,n){this.cm=n;var i=this.vert=k("div",[k("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),r=this.horiz=k("div",[k("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");i.tabIndex=r.tabIndex=-1,t(i),t(r),dt(i,"scroll",(function(){i.clientHeight&&e(i.scrollTop,"vertical")})),dt(r,"scroll",(function(){r.clientWidth&&e(r.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,s&&a<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Wi.prototype.update=function(t){var e=t.scrollWidth>t.clientWidth+1,n=t.scrollHeight>t.clientHeight+1,i=t.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=e?i+"px":"0";var r=t.viewHeight-(e?i:0);this.vert.firstChild.style.height=Math.max(0,t.scrollHeight-t.clientHeight+r)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(e){this.horiz.style.display="block",this.horiz.style.right=n?i+"px":"0",this.horiz.style.left=t.barLeft+"px";var o=t.viewWidth-t.barLeft-(n?i:0);this.horiz.firstChild.style.width=Math.max(0,t.scrollWidth-t.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&t.clientHeight>0&&(0==i&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?i:0,bottom:e?i:0}},Wi.prototype.setScrollLeft=function(t){this.horiz.scrollLeft!=t&&(this.horiz.scrollLeft=t),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Wi.prototype.setScrollTop=function(t){this.vert.scrollTop!=t&&(this.vert.scrollTop=t),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Wi.prototype.zeroWidthHack=function(){var t=y&&!p?"12px":"18px";this.horiz.style.height=this.vert.style.width=t,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new W,this.disableVert=new W},Wi.prototype.enableZeroWidthBar=function(t,e,n){t.style.pointerEvents="auto",e.set(1e3,(function i(){var r=t.getBoundingClientRect();("vert"==n?document.elementFromPoint(r.right-1,(r.top+r.bottom)/2):document.elementFromPoint((r.right+r.left)/2,r.bottom-1))!=t?t.style.pointerEvents="none":e.set(1e3,i)}))},Wi.prototype.clear=function(){var t=this.horiz.parentNode;t.removeChild(this.horiz),t.removeChild(this.vert)};var Hi=function(){};function Fi(t,e){e||(e=Ni(t));var n=t.display.barWidth,i=t.display.barHeight;ji(t,e);for(var r=0;r<4&&n!=t.display.barWidth||i!=t.display.barHeight;r++)n!=t.display.barWidth&&t.options.lineWrapping&&Mi(t),ji(t,Ni(t)),n=t.display.barWidth,i=t.display.barHeight}function ji(t,e){var n=t.display,i=n.scrollbars.update(e);n.sizer.style.paddingRight=(n.barWidth=i.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=i.bottom)+"px",n.heightForcer.style.borderBottom=i.bottom+"px solid transparent",i.right&&i.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=i.bottom+"px",n.scrollbarFiller.style.width=i.right+"px"):n.scrollbarFiller.style.display="",i.bottom&&t.options.coverGutterNextToScrollbar&&t.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=i.bottom+"px",n.gutterFiller.style.width=e.gutterWidth+"px"):n.gutterFiller.style.display=""}Hi.prototype.update=function(){return{bottom:0,right:0}},Hi.prototype.setScrollLeft=function(){},Hi.prototype.setScrollTop=function(){},Hi.prototype.clear=function(){};var qi={native:Wi,null:Hi};function Vi(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&M(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new qi[t.options.scrollbarStyle]((function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),dt(e,"mousedown",(function(){t.state.focused&&setTimeout((function(){return t.display.input.focus()}),0)})),e.setAttribute("cm-not-content","true")}),(function(e,n){"horizontal"==n?Oi(t,e):Bi(t,e)}),t),t.display.scrollbars.addClass&&I(t.display.wrapper,t.display.scrollbars.addClass)}var Ui=0;function Ki(t){var e;t.curOp={cm:t,viewChanged:!1,startHeight:t.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Ui},e=t.curOp,sn?sn.ops.push(e):e.ownsGroup=sn={ops:[e],delayedCallbacks:[]}}function Gi(t){var e=t.curOp;e&&function(t,e){var n=t.ownsGroup;if(n)try{!function(t){var e=t.delayedCallbacks,n=0;do{for(;n<e.length;n++)e[n].call(null);for(var i=0;i<t.ops.length;i++){var r=t.ops[i];if(r.cursorActivityHandlers)for(;r.cursorActivityCalled<r.cursorActivityHandlers.length;)r.cursorActivityHandlers[r.cursorActivityCalled++].call(null,r.cm)}}while(n<e.length)}(n)}finally{sn=null,e(n)}}(e,(function(t){for(var e=0;e<t.ops.length;e++)t.ops[e].cm.curOp=null;!function(t){for(var e=t.ops,n=0;n<e.length;n++)$i(e[n]);for(var i=0;i<e.length;i++)Yi(e[i]);for(var r=0;r<e.length;r++)Xi(e[r]);for(var o=0;o<e.length;o++)Ji(e[o]);for(var s=0;s<e.length;s++)Zi(e[s])}(t)}))}function $i(t){var e=t.cm,n=e.display;(function(t){var e=t.display;!e.scrollbarsClipped&&e.scroller.offsetWidth&&(e.nativeBarWidth=e.scroller.offsetWidth-e.scroller.clientWidth,e.heightForcer.style.height=Mn(t)+"px",e.sizer.style.marginBottom=-e.nativeBarWidth+"px",e.sizer.style.borderRightWidth=Mn(t)+"px",e.scrollbarsClipped=!0)})(e),t.updateMaxLine&&Ue(e),t.mustUpdate=t.viewChanged||t.forceUpdate||null!=t.scrollTop||t.scrollToPos&&(t.scrollToPos.from.line<n.viewFrom||t.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&e.options.lineWrapping,t.update=t.mustUpdate&&new or(e,t.mustUpdate&&{top:t.scrollTop,ensure:t.scrollToPos},t.forceUpdate)}function Yi(t){t.updatedDisplay=t.mustUpdate&&sr(t.cm,t.update)}function Xi(t){var e=t.cm,n=e.display;t.updatedDisplay&&Mi(e),t.barMeasure=Ni(e),n.maxLineChanged&&!e.options.lineWrapping&&(t.adjustWidthTo=An(e,n.maxLine,n.maxLine.text.length).left+3,e.display.sizerWidth=t.adjustWidthTo,t.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+t.adjustWidthTo+Mn(e)+e.display.barWidth),t.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+t.adjustWidthTo-Sn(e))),(t.updatedDisplay||t.selectionChanged)&&(t.preparedSelection=n.input.prepareSelection())}function Ji(t){var e=t.cm;null!=t.adjustWidthTo&&(e.display.sizer.style.minWidth=t.adjustWidthTo+"px",t.maxScrollLeft<e.doc.scrollLeft&&Oi(e,Math.min(e.display.scroller.scrollLeft,t.maxScrollLeft),!0),e.display.maxLineChanged=!1);var n=t.focus&&t.focus==L();t.preparedSelection&&e.display.input.showSelection(t.preparedSelection,n),(t.updatedDisplay||t.startHeight!=e.doc.height)&&Fi(e,t.barMeasure),t.updatedDisplay&&ur(e,t.barMeasure),t.selectionChanged&&wi(e),e.state.focused&&t.updateInput&&e.display.input.reset(t.typing),n&&xi(t.cm)}function Zi(t){var e=t.cm,n=e.display,i=e.doc;t.updatedDisplay&&ar(e,t.update),null==n.wheelStartX||null==t.scrollTop&&null==t.scrollLeft&&!t.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=t.scrollTop&&Ri(e,t.scrollTop,t.forceScroll),null!=t.scrollLeft&&Oi(e,t.scrollLeft,!0,!0),t.scrollToPos&&function(t,e){if(!mt(t,"scrollCursorIntoView")){var n=t.display,i=n.sizer.getBoundingClientRect(),r=null;if(e.top+i.top<0?r=!0:e.bottom+i.top>(window.innerHeight||document.documentElement.clientHeight)&&(r=!1),null!=r&&!f){var o=k("div","",null,"position: absolute;\n top: "+(e.top-n.viewOffset-Cn(t.display))+"px;\n height: "+(e.bottom-e.top+Mn(t)+n.barHeight)+"px;\n left: "+e.left+"px; width: "+Math.max(2,e.right-e.left)+"px;");t.display.lineSpace.appendChild(o),o.scrollIntoView(r),t.display.lineSpace.removeChild(o)}}}(e,function(t,e,n,i){var r;null==i&&(i=0),t.options.lineWrapping||e!=n||(n="before"==(e=e.ch?te(e.line,"before"==e.sticky?e.ch-1:e.ch,"after"):e).sticky?te(e.line,e.ch+1,"before"):e);for(var o=0;o<5;o++){var s=!1,a=Gn(t,e),l=n&&n!=e?Gn(t,n):a,c=ki(t,r={left:Math.min(a.left,l.left),top:Math.min(a.top,l.top)-i,right:Math.max(a.left,l.left),bottom:Math.max(a.bottom,l.bottom)+i}),u=t.doc.scrollTop,d=t.doc.scrollLeft;if(null!=c.scrollTop&&(Bi(t,c.scrollTop),Math.abs(t.doc.scrollTop-u)>1&&(s=!0)),null!=c.scrollLeft&&(Oi(t,c.scrollLeft),Math.abs(t.doc.scrollLeft-d)>1&&(s=!0)),!s)break}return r}(e,ae(i,t.scrollToPos.from),ae(i,t.scrollToPos.to),t.scrollToPos.margin));var r=t.maybeHiddenMarkers,o=t.maybeUnhiddenMarkers;if(r)for(var s=0;s<r.length;++s)r[s].lines.length||ft(r[s],"hide");if(o)for(var a=0;a<o.length;++a)o[a].lines.length&&ft(o[a],"unhide");n.wrapper.offsetHeight&&(i.scrollTop=e.display.scroller.scrollTop),t.changeObjs&&ft(e,"changes",e,t.changeObjs),t.update&&t.update.finish()}function Qi(t,e){if(t.curOp)return e();Ki(t);try{return e()}finally{Gi(t)}}function tr(t,e){return function(){if(t.curOp)return e.apply(t,arguments);Ki(t);try{return e.apply(t,arguments)}finally{Gi(t)}}}function er(t){return function(){if(this.curOp)return t.apply(this,arguments);Ki(this);try{return t.apply(this,arguments)}finally{Gi(this)}}}function nr(t){return function(){var e=this.cm;if(!e||e.curOp)return t.apply(this,arguments);Ki(e);try{return t.apply(this,arguments)}finally{Gi(e)}}}function ir(t,e){t.doc.highlightFrontier<t.display.viewTo&&t.state.highlight.set(e,R(rr,t))}function rr(t){var e=t.doc;if(!(e.highlightFrontier>=t.display.viewTo)){var n=+new Date+t.options.workTime,i=pe(t,e.highlightFrontier),r=[];e.iter(i.line,Math.min(e.first+e.size,t.display.viewTo+500),(function(o){if(i.line>=t.display.viewFrom){var s=o.styles,a=o.text.length>t.options.maxHighlightLength?jt(e.mode,i.state):null,l=de(t,o,i,!0);a&&(i.state=a),o.styles=l.styles;var c=o.styleClasses,u=l.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!s||s.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),h=0;!d&&h<s.length;++h)d=s[h]!=o.styles[h];d&&r.push(i.line),o.stateAfter=i.save(),i.nextLine()}else o.text.length<=t.options.maxHighlightLength&&fe(t,o.text,i),o.stateAfter=i.line%5==0?i.save():null,i.nextLine();if(+new Date>n)return ir(t,t.options.workDelay),!0})),e.highlightFrontier=i.line,e.modeFrontier=Math.max(e.modeFrontier,i.line),r.length&&Qi(t,(function(){for(var e=0;e<r.length;e++)hi(t,r[e],"text")}))}}var or=function(t,e,n){var i=t.display;this.viewport=e,this.visible=Ti(i,t.doc,e),this.editorIsHidden=!i.wrapper.offsetWidth,this.wrapperHeight=i.wrapper.clientHeight,this.wrapperWidth=i.wrapper.clientWidth,this.oldDisplayWidth=Sn(t),this.force=n,this.dims=oi(t),this.events=[]};function sr(t,e){var n=t.display,i=t.doc;if(e.editorIsHidden)return pi(t),!1;if(!e.force&&e.visible.from>=n.viewFrom&&e.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==mi(t))return!1;hr(t)&&(pi(t),e.dims=oi(t));var r=i.first+i.size,o=Math.max(e.visible.from-t.options.viewportMargin,i.first),s=Math.min(r,e.visible.to+t.options.viewportMargin);n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(i.first,n.viewFrom)),n.viewTo>s&&n.viewTo-s<20&&(s=Math.min(r,n.viewTo)),xe&&(o=We(t.doc,o),s=He(t.doc,s));var a=o!=n.viewFrom||s!=n.viewTo||n.lastWrapHeight!=e.wrapperHeight||n.lastWrapWidth!=e.wrapperWidth;(function(t,e,n){var i=t.display;0==i.view.length||e>=i.viewTo||n<=i.viewFrom?(i.view=on(t,e,n),i.viewFrom=e):(i.viewFrom>e?i.view=on(t,e,i.viewFrom).concat(i.view):i.viewFrom<e&&(i.view=i.view.slice(ui(t,e))),i.viewFrom=e,i.viewTo<n?i.view=i.view.concat(on(t,i.viewTo,n)):i.viewTo>n&&(i.view=i.view.slice(0,ui(t,n)))),i.viewTo=n})(t,o,s),n.viewOffset=qe(Kt(t.doc,n.viewFrom)),t.display.mover.style.top=n.viewOffset+"px";var c=mi(t);if(!a&&0==c&&!e.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=function(t){if(t.hasFocus())return null;var e=L();if(!e||!P(t.display.lineDiv,e))return null;var n={activeElt:e};if(window.getSelection){var i=window.getSelection();i.anchorNode&&i.extend&&P(t.display.lineDiv,i.anchorNode)&&(n.anchorNode=i.anchorNode,n.anchorOffset=i.anchorOffset,n.focusNode=i.focusNode,n.focusOffset=i.focusOffset)}return n}(t);return c>4&&(n.lineDiv.style.display="none"),function(t,e,n){var i=t.display,r=t.options.lineNumbers,o=i.lineDiv,s=o.firstChild;function a(e){var n=e.nextSibling;return l&&y&&t.display.currentWheelTarget==e?e.style.display="none":e.parentNode.removeChild(e),n}for(var c=i.view,u=i.viewFrom,d=0;d<c.length;d++){var h=c[d];if(h.hidden);else if(h.node&&h.node.parentNode==o){for(;s!=h.node;)s=a(s);var p=r&&null!=e&&e<=u&&h.lineNumber;h.changes&&(H(h.changes,"gutter")>-1&&(p=!1),un(t,h,u,n)),p&&(S(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(Qt(t.options,u)))),s=h.node.nextSibling}else{var f=vn(t,h,u,n);o.insertBefore(f,s)}u+=h.size}for(;s;)s=a(s)}(t,n.updateLineNumbers,e.dims),c>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(t){if(t&&t.activeElt&&t.activeElt!=L()&&(t.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(t.activeElt.nodeName)&&t.anchorNode&&P(document.body,t.anchorNode)&&P(document.body,t.focusNode))){var e=window.getSelection(),n=document.createRange();n.setEnd(t.anchorNode,t.anchorOffset),n.collapse(!1),e.removeAllRanges(),e.addRange(n),e.extend(t.focusNode,t.focusOffset)}}(u),S(n.cursorDiv),S(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,a&&(n.lastWrapHeight=e.wrapperHeight,n.lastWrapWidth=e.wrapperWidth,ir(t,400)),n.updateLineNumbers=null,!0}function ar(t,e){for(var n=e.viewport,i=!0;;i=!1){if(i&&t.options.lineWrapping&&e.oldDisplayWidth!=Sn(t))i&&(e.visible=Ti(t.display,t.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(t.doc.height+En(t.display)-Tn(t),n.top)}),e.visible=Ti(t.display,t.doc,n),e.visible.from>=t.display.viewFrom&&e.visible.to<=t.display.viewTo)break;if(!sr(t,e))break;Mi(t);var r=Ni(t);gi(t),Fi(t,r),ur(t,r),e.force=!1}e.signal(t,"update",t),t.display.viewFrom==t.display.reportedViewFrom&&t.display.viewTo==t.display.reportedViewTo||(e.signal(t,"viewportChange",t,t.display.viewFrom,t.display.viewTo),t.display.reportedViewFrom=t.display.viewFrom,t.display.reportedViewTo=t.display.viewTo)}function lr(t,e){var n=new or(t,e);if(sr(t,n)){Mi(t),ar(t,n);var i=Ni(t);gi(t),Fi(t,i),ur(t,i),n.finish()}}function cr(t){var e=t.gutters.offsetWidth;t.sizer.style.marginLeft=e+"px"}function ur(t,e){t.display.sizer.style.minHeight=e.docHeight+"px",t.display.heightForcer.style.top=e.docHeight+"px",t.display.gutters.style.height=e.docHeight+t.display.barHeight+Mn(t)+"px"}function dr(t){var e=t.display,n=e.view;if(e.alignWidgets||e.gutters.firstChild&&t.options.fixedGutter){for(var i=si(e)-e.scroller.scrollLeft+t.doc.scrollLeft,r=e.gutters.offsetWidth,o=i+"px",s=0;s<n.length;s++)if(!n[s].hidden){t.options.fixedGutter&&(n[s].gutter&&(n[s].gutter.style.left=o),n[s].gutterBackground&&(n[s].gutterBackground.style.left=o));var a=n[s].alignable;if(a)for(var l=0;l<a.length;l++)a[l].style.left=o}t.options.fixedGutter&&(e.gutters.style.left=i+r+"px")}}function hr(t){if(!t.options.lineNumbers)return!1;var e=t.doc,n=Qt(t.options,e.first+e.size-1),i=t.display;if(n.length!=i.lineNumChars){var r=i.measure.appendChild(k("div",[k("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=r.firstChild.offsetWidth,s=r.offsetWidth-o;return i.lineGutter.style.width="",i.lineNumInnerWidth=Math.max(o,i.lineGutter.offsetWidth-s)+1,i.lineNumWidth=i.lineNumInnerWidth+s,i.lineNumChars=i.lineNumInnerWidth?n.length:-1,i.lineGutter.style.width=i.lineNumWidth+"px",cr(t.display),!0}return!1}function pr(t,e){for(var n=[],i=!1,r=0;r<t.length;r++){var o=t[r],s=null;if("string"!=typeof o&&(s=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!e)continue;i=!0}n.push({className:o,style:s})}return e&&!i&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function fr(t){var e=t.gutters,n=t.gutterSpecs;S(e),t.lineGutter=null;for(var i=0;i<n.length;++i){var r=n[i],o=r.className,s=r.style,a=e.appendChild(k("div",null,"CodeMirror-gutter "+o));s&&(a.style.cssText=s),"CodeMirror-linenumbers"==o&&(t.lineGutter=a,a.style.width=(t.lineNumWidth||1)+"px")}e.style.display=n.length?"":"none",cr(t)}function mr(t){fr(t.display),di(t),dr(t)}function gr(t,e,i,r){var o=this;this.input=i,o.scrollbarFiller=k("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=k("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=A("div",null,"CodeMirror-code"),o.selectionDiv=k("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=k("div",null,"CodeMirror-cursors"),o.measure=k("div",null,"CodeMirror-measure"),o.lineMeasure=k("div",null,"CodeMirror-measure"),o.lineSpace=A("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none");var c=A("div",[o.lineSpace],"CodeMirror-lines");o.mover=k("div",[c],null,"position: relative"),o.sizer=k("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=k("div",null,null,"position: absolute; height: 50px; width: 1px;"),o.gutters=k("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=k("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=k("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),s&&a<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),l||n&&v||(o.scroller.draggable=!0),t&&(t.appendChild?t.appendChild(o.wrapper):t(o.wrapper)),o.viewFrom=o.viewTo=e.first,o.reportedViewFrom=o.reportedViewTo=e.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=pr(r.gutters,r.lineNumbers),fr(o),i.init(o)}or.prototype.signal=function(t,e){vt(t,e)&&this.events.push(arguments)},or.prototype.finish=function(){for(var t=0;t<this.events.length;t++)ft.apply(null,this.events[t])};var vr=0,yr=null;function br(t){var e=t.wheelDeltaX,n=t.wheelDeltaY;return null==e&&t.detail&&t.axis==t.HORIZONTAL_AXIS&&(e=t.detail),null==n&&t.detail&&t.axis==t.VERTICAL_AXIS?n=t.detail:null==n&&(n=t.wheelDelta),{x:e,y:n}}function _r(t){var e=br(t);return e.x*=yr,e.y*=yr,e}function wr(t,e){var i=br(e),r=i.x,o=i.y,s=t.display,a=s.scroller,c=a.scrollWidth>a.clientWidth,u=a.scrollHeight>a.clientHeight;if(r&&c||o&&u){if(o&&y&&l)t:for(var h=e.target,p=s.view;h!=a;h=h.parentNode)for(var f=0;f<p.length;f++)if(p[f].node==h){t.display.currentWheelTarget=h;break t}if(r&&!n&&!d&&null!=yr)return o&&u&&Bi(t,Math.max(0,a.scrollTop+o*yr)),Oi(t,Math.max(0,a.scrollLeft+r*yr)),(!o||o&&u)&&bt(e),void(s.wheelStartX=null);if(o&&null!=yr){var m=o*yr,g=t.doc.scrollTop,v=g+s.wrapper.clientHeight;m<0?g=Math.max(0,g+m-50):v=Math.min(t.doc.height,v+m+50),lr(t,{top:g,bottom:v})}vr<20&&(null==s.wheelStartX?(s.wheelStartX=a.scrollLeft,s.wheelStartY=a.scrollTop,s.wheelDX=r,s.wheelDY=o,setTimeout((function(){if(null!=s.wheelStartX){var t=a.scrollLeft-s.wheelStartX,e=a.scrollTop-s.wheelStartY,n=e&&s.wheelDY&&e/s.wheelDY||t&&s.wheelDX&&t/s.wheelDX;s.wheelStartX=s.wheelStartY=null,n&&(yr=(yr*vr+n)/(vr+1),++vr)}}),200)):(s.wheelDX+=r,s.wheelDY+=o))}}s?yr=-.53:n?yr=15:u?yr=-.7:h&&(yr=-1/3);var xr=function(t,e){this.ranges=t,this.primIndex=e};xr.prototype.primary=function(){return this.ranges[this.primIndex]},xr.prototype.equals=function(t){if(t==this)return!0;if(t.primIndex!=this.primIndex||t.ranges.length!=this.ranges.length)return!1;for(var e=0;e<this.ranges.length;e++){var n=this.ranges[e],i=t.ranges[e];if(!ne(n.anchor,i.anchor)||!ne(n.head,i.head))return!1}return!0},xr.prototype.deepCopy=function(){for(var t=[],e=0;e<this.ranges.length;e++)t[e]=new Cr(ie(this.ranges[e].anchor),ie(this.ranges[e].head));return new xr(t,this.primIndex)},xr.prototype.somethingSelected=function(){for(var t=0;t<this.ranges.length;t++)if(!this.ranges[t].empty())return!0;return!1},xr.prototype.contains=function(t,e){e||(e=t);for(var n=0;n<this.ranges.length;n++){var i=this.ranges[n];if(ee(e,i.from())>=0&&ee(t,i.to())<=0)return n}return-1};var Cr=function(t,e){this.anchor=t,this.head=e};function Er(t,e,n){var i=t&&t.options.selectionsMayTouch,r=e[n];e.sort((function(t,e){return ee(t.from(),e.from())})),n=H(e,r);for(var o=1;o<e.length;o++){var s=e[o],a=e[o-1],l=ee(a.to(),s.from());if(i&&!s.empty()?l>0:l>=0){var c=oe(a.from(),s.from()),u=re(a.to(),s.to()),d=a.empty()?s.from()==s.head:a.from()==a.head;o<=n&&--n,e.splice(--o,2,new Cr(d?u:c,d?c:u))}}return new xr(e,n)}function Dr(t,e){return new xr([new Cr(t,e||t)],0)}function Mr(t){return t.text?te(t.from.line+t.text.length-1,$(t.text).length+(1==t.text.length?t.from.ch:0)):t.to}function Sr(t,e){if(ee(t,e.from)<0)return t;if(ee(t,e.to)<=0)return Mr(e);var n=t.line+e.text.length-(e.to.line-e.from.line)-1,i=t.ch;return t.line==e.to.line&&(i+=Mr(e).ch-e.to.ch),te(n,i)}function Tr(t,e){for(var n=[],i=0;i<t.sel.ranges.length;i++){var r=t.sel.ranges[i];n.push(new Cr(Sr(r.anchor,e),Sr(r.head,e)))}return Er(t.cm,n,t.sel.primIndex)}function kr(t,e,n){return t.line==e.line?te(n.line,t.ch-e.ch+n.ch):te(n.line+(t.line-e.line),t.ch)}function Ar(t){t.doc.mode=Wt(t.options,t.doc.modeOption),Pr(t)}function Pr(t){t.doc.iter((function(t){t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null)})),t.doc.modeFrontier=t.doc.highlightFrontier=t.doc.first,ir(t,100),t.state.modeGen++,t.curOp&&di(t)}function Lr(t,e){return 0==e.from.ch&&0==e.to.ch&&""==$(e.text)&&(!t.cm||t.cm.options.wholeLineUpdateBefore)}function Ir(t,e,n,i){function r(t){return n?n[t]:null}function o(t,n,r){(function(t,e,n,i){t.text=e,t.stateAfter&&(t.stateAfter=null),t.styles&&(t.styles=null),null!=t.order&&(t.order=null),Te(t),ke(t,n);var r=i?i(t):1;r!=t.height&&Yt(t,r)})(t,n,r,i),ln(t,"change",t,e)}function s(t,e){for(var n=[],o=t;o<e;++o)n.push(new Ke(c[o],r(o),i));return n}var a=e.from,l=e.to,c=e.text,u=Kt(t,a.line),d=Kt(t,l.line),h=$(c),p=r(c.length-1),f=l.line-a.line;if(e.full)t.insert(0,s(0,c.length)),t.remove(c.length,t.size-c.length);else if(Lr(t,e)){var m=s(0,c.length-1);o(d,d.text,p),f&&t.remove(a.line,f),m.length&&t.insert(a.line,m)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,a.ch)+h+u.text.slice(l.ch),p);else{var g=s(1,c.length-1);g.push(new Ke(h+u.text.slice(l.ch),p,i)),o(u,u.text.slice(0,a.ch)+c[0],r(0)),t.insert(a.line+1,g)}else if(1==c.length)o(u,u.text.slice(0,a.ch)+c[0]+d.text.slice(l.ch),r(0)),t.remove(a.line+1,f);else{o(u,u.text.slice(0,a.ch)+c[0],r(0)),o(d,h+d.text.slice(l.ch),p);var v=s(1,c.length-1);f>1&&t.remove(a.line+1,f-1),t.insert(a.line+1,v)}ln(t,"change",t,e)}function zr(t,e,n){!function t(i,r,o){if(i.linked)for(var s=0;s<i.linked.length;++s){var a=i.linked[s];if(a.doc!=r){var l=o&&a.sharedHist;n&&!l||(e(a.doc,l),t(a.doc,i,l))}}}(t,null,!0)}function Br(t,e){if(e.cm)throw new Error("This document is already in use.");t.doc=e,e.cm=t,li(t),Ar(t),Rr(t),t.options.lineWrapping||Ue(t),t.options.mode=e.modeOption,di(t)}function Rr(t){("rtl"==t.doc.direction?I:M)(t.display.lineDiv,"CodeMirror-rtl")}function Or(t){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=t||1}function Nr(t,e){var n={from:ie(e.from),to:Mr(e),text:Gt(t,e.from,e.to)};return qr(t,n,e.from.line,e.to.line+1),zr(t,(function(t){return qr(t,n,e.from.line,e.to.line+1)}),!0),n}function Wr(t){for(;t.length&&$(t).ranges;)t.pop()}function Hr(t,e,n,i){var r=t.history;r.undone.length=0;var o,s,a=+new Date;if((r.lastOp==i||r.lastOrigin==e.origin&&e.origin&&("+"==e.origin.charAt(0)&&r.lastModTime>a-(t.cm?t.cm.options.historyEventDelay:500)||"*"==e.origin.charAt(0)))&&(o=function(t,e){return e?(Wr(t.done),$(t.done)):t.done.length&&!$(t.done).ranges?$(t.done):t.done.length>1&&!t.done[t.done.length-2].ranges?(t.done.pop(),$(t.done)):void 0}(r,r.lastOp==i)))s=$(o.changes),0==ee(e.from,e.to)&&0==ee(e.from,s.to)?s.to=Mr(e):o.changes.push(Nr(t,e));else{var l=$(r.done);for(l&&l.ranges||jr(t.sel,r.done),o={changes:[Nr(t,e)],generation:r.generation},r.done.push(o);r.done.length>r.undoDepth;)r.done.shift(),r.done[0].ranges||r.done.shift()}r.done.push(n),r.generation=++r.maxGeneration,r.lastModTime=r.lastSelTime=a,r.lastOp=r.lastSelOp=i,r.lastOrigin=r.lastSelOrigin=e.origin,s||ft(t,"historyAdded")}function Fr(t,e,n,i){var r=t.history,o=i&&i.origin;n==r.lastSelOp||o&&r.lastSelOrigin==o&&(r.lastModTime==r.lastSelTime&&r.lastOrigin==o||function(t,e,n,i){var r=e.charAt(0);return"*"==r||"+"==r&&n.ranges.length==i.ranges.length&&n.somethingSelected()==i.somethingSelected()&&new Date-t.history.lastSelTime<=(t.cm?t.cm.options.historyEventDelay:500)}(t,o,$(r.done),e))?r.done[r.done.length-1]=e:jr(e,r.done),r.lastSelTime=+new Date,r.lastSelOrigin=o,r.lastSelOp=n,i&&!1!==i.clearRedo&&Wr(r.undone)}function jr(t,e){var n=$(e);n&&n.ranges&&n.equals(t)||e.push(t)}function qr(t,e,n,i){var r=e["spans_"+t.id],o=0;t.iter(Math.max(t.first,n),Math.min(t.first+t.size,i),(function(n){n.markedSpans&&((r||(r=e["spans_"+t.id]={}))[o]=n.markedSpans),++o}))}function Vr(t){if(!t)return null;for(var e,n=0;n<t.length;++n)t[n].marker.explicitlyCleared?e||(e=t.slice(0,n)):e&&e.push(t[n]);return e?e.length?e:null:t}function Ur(t,e){var n=function(t,e){var n=e["spans_"+t.id];if(!n)return null;for(var i=[],r=0;r<e.text.length;++r)i.push(Vr(n[r]));return i}(t,e),i=Me(t,e);if(!n)return i;if(!i)return n;for(var r=0;r<n.length;++r){var o=n[r],s=i[r];if(o&&s)t:for(var a=0;a<s.length;++a){for(var l=s[a],c=0;c<o.length;++c)if(o[c].marker==l.marker)continue t;o.push(l)}else s&&(n[r]=s)}return n}function Kr(t,e,n){for(var i=[],r=0;r<t.length;++r){var o=t[r];if(o.ranges)i.push(n?xr.prototype.deepCopy.call(o):o);else{var s=o.changes,a=[];i.push({changes:a});for(var l=0;l<s.length;++l){var c=s[l],u=void 0;if(a.push({from:c.from,to:c.to,text:c.text}),e)for(var d in c)(u=d.match(/^spans_(\d+)$/))&&H(e,Number(u[1]))>-1&&($(a)[d]=c[d],delete c[d])}}}return i}function Gr(t,e,n,i){if(i){var r=t.anchor;if(n){var o=ee(e,r)<0;o!=ee(n,r)<0?(r=e,e=n):o!=ee(e,n)<0&&(e=n)}return new Cr(r,e)}return new Cr(n||e,e)}function $r(t,e,n,i,r){null==r&&(r=t.cm&&(t.cm.display.shift||t.extend)),Qr(t,new xr([Gr(t.sel.primary(),e,n,r)],0),i)}function Yr(t,e,n){for(var i=[],r=t.cm&&(t.cm.display.shift||t.extend),o=0;o<t.sel.ranges.length;o++)i[o]=Gr(t.sel.ranges[o],e[o],null,r);Qr(t,Er(t.cm,i,t.sel.primIndex),n)}function Xr(t,e,n,i){var r=t.sel.ranges.slice(0);r[e]=n,Qr(t,Er(t.cm,r,t.sel.primIndex),i)}function Jr(t,e,n,i){Qr(t,Dr(e,n),i)}function Zr(t,e,n){var i=t.history.done,r=$(i);r&&r.ranges?(i[i.length-1]=e,to(t,e,n)):Qr(t,e,n)}function Qr(t,e,n){to(t,e,n),Fr(t,t.sel,t.cm?t.cm.curOp.id:NaN,n)}function to(t,e,n){(vt(t,"beforeSelectionChange")||t.cm&&vt(t.cm,"beforeSelectionChange"))&&(e=function(t,e,n){var i={ranges:e.ranges,update:function(e){this.ranges=[];for(var n=0;n<e.length;n++)this.ranges[n]=new Cr(ae(t,e[n].anchor),ae(t,e[n].head))},origin:n&&n.origin};return ft(t,"beforeSelectionChange",t,i),t.cm&&ft(t.cm,"beforeSelectionChange",t.cm,i),i.ranges!=e.ranges?Er(t.cm,i.ranges,i.ranges.length-1):e}(t,e,n));var i=n&&n.bias||(ee(e.primary().head,t.sel.primary().head)<0?-1:1);eo(t,io(t,e,i,!0)),n&&!1===n.scroll||!t.cm||"nocursor"==t.cm.getOption("readOnly")||Pi(t.cm)}function eo(t,e){e.equals(t.sel)||(t.sel=e,t.cm&&(t.cm.curOp.updateInput=1,t.cm.curOp.selectionChanged=!0,gt(t.cm)),ln(t,"cursorActivity",t))}function no(t){eo(t,io(t,t.sel,null,!1))}function io(t,e,n,i){for(var r,o=0;o<e.ranges.length;o++){var s=e.ranges[o],a=e.ranges.length==t.sel.ranges.length&&t.sel.ranges[o],l=oo(t,s.anchor,a&&a.anchor,n,i),c=oo(t,s.head,a&&a.head,n,i);(r||l!=s.anchor||c!=s.head)&&(r||(r=e.ranges.slice(0,o)),r[o]=new Cr(l,c))}return r?Er(t.cm,r,e.primIndex):e}function ro(t,e,n,i,r){var o=Kt(t,e.line);if(o.markedSpans)for(var s=0;s<o.markedSpans.length;++s){var a=o.markedSpans[s],l=a.marker,c="selectLeft"in l?!l.selectLeft:l.inclusiveLeft,u="selectRight"in l?!l.selectRight:l.inclusiveRight;if((null==a.from||(c?a.from<=e.ch:a.from<e.ch))&&(null==a.to||(u?a.to>=e.ch:a.to>e.ch))){if(r&&(ft(l,"beforeCursorEnter"),l.explicitlyCleared)){if(o.markedSpans){--s;continue}break}if(!l.atomic)continue;if(n){var d=l.find(i<0?1:-1),h=void 0;if((i<0?u:c)&&(d=so(t,d,-i,d&&d.line==e.line?o:null)),d&&d.line==e.line&&(h=ee(d,n))&&(i<0?h<0:h>0))return ro(t,d,e,i,r)}var p=l.find(i<0?-1:1);return(i<0?c:u)&&(p=so(t,p,i,p.line==e.line?o:null)),p?ro(t,p,e,i,r):null}}return e}function oo(t,e,n,i,r){var o=i||1;return ro(t,e,n,o,r)||!r&&ro(t,e,n,o,!0)||ro(t,e,n,-o,r)||!r&&ro(t,e,n,-o,!0)||(t.cantEdit=!0,te(t.first,0))}function so(t,e,n,i){return n<0&&0==e.ch?e.line>t.first?ae(t,te(e.line-1)):null:n>0&&e.ch==(i||Kt(t,e.line)).text.length?e.line<t.first+t.size-1?te(e.line+1,0):null:new te(e.line,e.ch+n)}function ao(t){t.setSelection(te(t.firstLine(),0),te(t.lastLine()),j)}function lo(t,e,n){var i={canceled:!1,from:e.from,to:e.to,text:e.text,origin:e.origin,cancel:function(){return i.canceled=!0}};return n&&(i.update=function(e,n,r,o){e&&(i.from=ae(t,e)),n&&(i.to=ae(t,n)),r&&(i.text=r),void 0!==o&&(i.origin=o)}),ft(t,"beforeChange",t,i),t.cm&&ft(t.cm,"beforeChange",t.cm,i),i.canceled?(t.cm&&(t.cm.curOp.updateInput=2),null):{from:i.from,to:i.to,text:i.text,origin:i.origin}}function co(t,e,n){if(t.cm){if(!t.cm.curOp)return tr(t.cm,co)(t,e,n);if(t.cm.state.suppressEdits)return}if(!(vt(t,"beforeChange")||t.cm&&vt(t.cm,"beforeChange"))||(e=lo(t,e,!0))){var i=we&&!n&&function(t,e,n){var i=null;if(t.iter(e.line,n.line+1,(function(t){if(t.markedSpans)for(var e=0;e<t.markedSpans.length;++e){var n=t.markedSpans[e].marker;!n.readOnly||i&&-1!=H(i,n)||(i||(i=[])).push(n)}})),!i)return null;for(var r=[{from:e,to:n}],o=0;o<i.length;++o)for(var s=i[o],a=s.find(0),l=0;l<r.length;++l){var c=r[l];if(!(ee(c.to,a.from)<0||ee(c.from,a.to)>0)){var u=[l,1],d=ee(c.from,a.from),h=ee(c.to,a.to);(d<0||!s.inclusiveLeft&&!d)&&u.push({from:c.from,to:a.from}),(h>0||!s.inclusiveRight&&!h)&&u.push({from:a.to,to:c.to}),r.splice.apply(r,u),l+=u.length-3}}return r}(t,e.from,e.to);if(i)for(var r=i.length-1;r>=0;--r)uo(t,{from:i[r].from,to:i[r].to,text:r?[""]:e.text,origin:e.origin});else uo(t,e)}}function uo(t,e){if(1!=e.text.length||""!=e.text[0]||0!=ee(e.from,e.to)){var n=Tr(t,e);Hr(t,e,n,t.cm?t.cm.curOp.id:NaN),fo(t,e,n,Me(t,e));var i=[];zr(t,(function(t,n){n||-1!=H(i,t.history)||(yo(t.history,e),i.push(t.history)),fo(t,e,null,Me(t,e))}))}}function ho(t,e,n){var i=t.cm&&t.cm.state.suppressEdits;if(!i||n){for(var r,o=t.history,s=t.sel,a="undo"==e?o.done:o.undone,l="undo"==e?o.undone:o.done,c=0;c<a.length&&(r=a[c],n?!r.ranges||r.equals(t.sel):r.ranges);c++);if(c!=a.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(r=a.pop()).ranges){if(i)return void a.push(r);break}if(jr(r,l),n&&!r.equals(t.sel))return void Qr(t,r,{clearRedo:!1});s=r}var u=[];jr(s,l),l.push({changes:u,generation:o.generation}),o.generation=r.generation||++o.maxGeneration;for(var d=vt(t,"beforeChange")||t.cm&&vt(t.cm,"beforeChange"),h=function(n){var i=r.changes[n];if(i.origin=e,d&&!lo(t,i,!1))return a.length=0,{};u.push(Nr(t,i));var o=n?Tr(t,i):$(a);fo(t,i,o,Ur(t,i)),!n&&t.cm&&t.cm.scrollIntoView({from:i.from,to:Mr(i)});var s=[];zr(t,(function(t,e){e||-1!=H(s,t.history)||(yo(t.history,i),s.push(t.history)),fo(t,i,null,Ur(t,i))}))},p=r.changes.length-1;p>=0;--p){var f=h(p);if(f)return f.v}}}}function po(t,e){if(0!=e&&(t.first+=e,t.sel=new xr(Y(t.sel.ranges,(function(t){return new Cr(te(t.anchor.line+e,t.anchor.ch),te(t.head.line+e,t.head.ch))})),t.sel.primIndex),t.cm)){di(t.cm,t.first,t.first-e,e);for(var n=t.cm.display,i=n.viewFrom;i<n.viewTo;i++)hi(t.cm,i,"gutter")}}function fo(t,e,n,i){if(t.cm&&!t.cm.curOp)return tr(t.cm,fo)(t,e,n,i);if(e.to.line<t.first)po(t,e.text.length-1-(e.to.line-e.from.line));else if(!(e.from.line>t.lastLine())){if(e.from.line<t.first){var r=e.text.length-1-(t.first-e.from.line);po(t,r),e={from:te(t.first,0),to:te(e.to.line+r,e.to.ch),text:[$(e.text)],origin:e.origin}}var o=t.lastLine();e.to.line>o&&(e={from:e.from,to:te(o,Kt(t,o).text.length),text:[e.text[0]],origin:e.origin}),e.removed=Gt(t,e.from,e.to),n||(n=Tr(t,e)),t.cm?function(t,e,n){var i=t.doc,r=t.display,o=e.from,s=e.to,a=!1,l=o.line;t.options.lineWrapping||(l=Xt(Ne(Kt(i,o.line))),i.iter(l,s.line+1,(function(t){if(t==r.maxLine)return a=!0,!0}))),i.sel.contains(e.from,e.to)>-1&&gt(t),Ir(i,e,n,ai(t)),t.options.lineWrapping||(i.iter(l,o.line+e.text.length,(function(t){var e=Ve(t);e>r.maxLineLength&&(r.maxLine=t,r.maxLineLength=e,r.maxLineChanged=!0,a=!1)})),a&&(t.curOp.updateMaxLine=!0)),function(t,e){if(t.modeFrontier=Math.min(t.modeFrontier,e),!(t.highlightFrontier<e-10)){for(var n=t.first,i=e-1;i>n;i--){var r=Kt(t,i).stateAfter;if(r&&(!(r instanceof ce)||i+r.lookAhead<e)){n=i+1;break}}t.highlightFrontier=Math.min(t.highlightFrontier,n)}}(i,o.line),ir(t,400);var c=e.text.length-(s.line-o.line)-1;e.full?di(t):o.line!=s.line||1!=e.text.length||Lr(t.doc,e)?di(t,o.line,s.line+1,c):hi(t,o.line,"text");var u=vt(t,"changes"),d=vt(t,"change");if(d||u){var h={from:o,to:s,text:e.text,removed:e.removed,origin:e.origin};d&&ln(t,"change",t,h),u&&(t.curOp.changeObjs||(t.curOp.changeObjs=[])).push(h)}t.display.selForContextMenu=null}(t.cm,e,i):Ir(t,e,i),to(t,n,j),t.cantEdit&&oo(t,te(t.firstLine(),0))&&(t.cantEdit=!1)}}function mo(t,e,n,i,r){var o;i||(i=n),ee(i,n)<0&&(n=(o=[i,n])[0],i=o[1]),"string"==typeof e&&(e=t.splitLines(e)),co(t,{from:n,to:i,text:e,origin:r})}function go(t,e,n,i){n<t.line?t.line+=i:e<t.line&&(t.line=e,t.ch=0)}function vo(t,e,n,i){for(var r=0;r<t.length;++r){var o=t[r],s=!0;if(o.ranges){o.copied||((o=t[r]=o.deepCopy()).copied=!0);for(var a=0;a<o.ranges.length;a++)go(o.ranges[a].anchor,e,n,i),go(o.ranges[a].head,e,n,i)}else{for(var l=0;l<o.changes.length;++l){var c=o.changes[l];if(n<c.from.line)c.from=te(c.from.line+i,c.from.ch),c.to=te(c.to.line+i,c.to.ch);else if(e<=c.to.line){s=!1;break}}s||(t.splice(0,r+1),r=0)}}}function yo(t,e){var n=e.from.line,i=e.to.line,r=e.text.length-(i-n)-1;vo(t.done,n,i,r),vo(t.undone,n,i,r)}function bo(t,e,n,i){var r=e,o=e;return"number"==typeof e?o=Kt(t,se(t,e)):r=Xt(e),null==r?null:(i(o,r)&&t.cm&&hi(t.cm,r,n),o)}function _o(t){this.lines=t,this.parent=null;for(var e=0,n=0;n<t.length;++n)t[n].parent=this,e+=t[n].height;this.height=e}function wo(t){this.children=t;for(var e=0,n=0,i=0;i<t.length;++i){var r=t[i];e+=r.chunkSize(),n+=r.height,r.parent=this}this.size=e,this.height=n,this.parent=null}Cr.prototype.from=function(){return oe(this.anchor,this.head)},Cr.prototype.to=function(){return re(this.anchor,this.head)},Cr.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},_o.prototype={chunkSize:function(){return this.lines.length},removeInner:function(t,e){for(var n=t,i=t+e;n<i;++n){var r=this.lines[n];this.height-=r.height,Ge(r),ln(r,"delete")}this.lines.splice(t,e)},collapse:function(t){t.push.apply(t,this.lines)},insertInner:function(t,e,n){this.height+=n,this.lines=this.lines.slice(0,t).concat(e).concat(this.lines.slice(t));for(var i=0;i<e.length;++i)e[i].parent=this},iterN:function(t,e,n){for(var i=t+e;t<i;++t)if(n(this.lines[t]))return!0}},wo.prototype={chunkSize:function(){return this.size},removeInner:function(t,e){this.size-=e;for(var n=0;n<this.children.length;++n){var i=this.children[n],r=i.chunkSize();if(t<r){var o=Math.min(e,r-t),s=i.height;if(i.removeInner(t,o),this.height-=s-i.height,r==o&&(this.children.splice(n--,1),i.parent=null),0==(e-=o))break;t=0}else t-=r}if(this.size-e<25&&(this.children.length>1||!(this.children[0]instanceof _o))){var a=[];this.collapse(a),this.children=[new _o(a)],this.children[0].parent=this}},collapse:function(t){for(var e=0;e<this.children.length;++e)this.children[e].collapse(t)},insertInner:function(t,e,n){this.size+=e.length,this.height+=n;for(var i=0;i<this.children.length;++i){var r=this.children[i],o=r.chunkSize();if(t<=o){if(r.insertInner(t,e,n),r.lines&&r.lines.length>50){for(var s=r.lines.length%25+25,a=s;a<r.lines.length;){var l=new _o(r.lines.slice(a,a+=25));r.height-=l.height,this.children.splice(++i,0,l),l.parent=this}r.lines=r.lines.slice(0,s),this.maybeSpill()}break}t-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var t=this;do{var e=new wo(t.children.splice(t.children.length-5,5));if(t.parent){t.size-=e.size,t.height-=e.height;var n=H(t.parent.children,t);t.parent.children.splice(n+1,0,e)}else{var i=new wo(t.children);i.parent=t,t.children=[i,e],t=i}e.parent=t.parent}while(t.children.length>10);t.parent.maybeSpill()}},iterN:function(t,e,n){for(var i=0;i<this.children.length;++i){var r=this.children[i],o=r.chunkSize();if(t<o){var s=Math.min(e,o-t);if(r.iterN(t,s,n))return!0;if(0==(e-=s))break;t=0}else t-=o}}};var xo=function(t,e,n){if(n)for(var i in n)n.hasOwnProperty(i)&&(this[i]=n[i]);this.doc=t,this.node=e};function Co(t,e,n){qe(e)<(t.curOp&&t.curOp.scrollTop||t.doc.scrollTop)&&Ai(t,n)}xo.prototype.clear=function(){var t=this.doc.cm,e=this.line.widgets,n=this.line,i=Xt(n);if(null!=i&&e){for(var r=0;r<e.length;++r)e[r]==this&&e.splice(r--,1);e.length||(n.widgets=null);var o=wn(this);Yt(n,Math.max(0,n.height-o)),t&&(Qi(t,(function(){Co(t,n,-o),hi(t,i,"widget")})),ln(t,"lineWidgetCleared",t,this,i))}},xo.prototype.changed=function(){var t=this,e=this.height,n=this.doc.cm,i=this.line;this.height=null;var r=wn(this)-e;r&&(Fe(this.doc,i)||Yt(i,i.height+r),n&&Qi(n,(function(){n.curOp.forceUpdate=!0,Co(n,i,r),ln(n,"lineWidgetChanged",n,t,Xt(i))})))},yt(xo);var Eo=0,Do=function(t,e){this.lines=[],this.type=e,this.doc=t,this.id=++Eo};function Mo(t,e,n,i,r){if(i&&i.shared)return function(t,e,n,i,r){(i=O(i)).shared=!1;var o=[Mo(t,e,n,i,r)],s=o[0],a=i.widgetNode;return zr(t,(function(t){a&&(i.widgetNode=a.cloneNode(!0)),o.push(Mo(t,ae(t,e),ae(t,n),i,r));for(var l=0;l<t.linked.length;++l)if(t.linked[l].isParent)return;s=$(o)})),new So(o,s)}(t,e,n,i,r);if(t.cm&&!t.cm.curOp)return tr(t.cm,Mo)(t,e,n,i,r);var o=new Do(t,r),s=ee(e,n);if(i&&O(i,o,!1),s>0||0==s&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=A("span",[o.replacedWith],"CodeMirror-widget"),i.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),i.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Oe(t,e.line,e,n,o)||e.line!=n.line&&Oe(t,n.line,e,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");xe=!0}o.addToHistory&&Hr(t,{from:e,to:n,origin:"markText"},t.sel,NaN);var a,l=e.line,c=t.cm;if(t.iter(l,n.line+1,(function(t){c&&o.collapsed&&!c.options.lineWrapping&&Ne(t)==c.display.maxLine&&(a=!0),o.collapsed&&l!=e.line&&Yt(t,0),function(t,e){t.markedSpans=t.markedSpans?t.markedSpans.concat([e]):[e],e.marker.attachLine(t)}(t,new Ce(o,l==e.line?e.ch:null,l==n.line?n.ch:null)),++l})),o.collapsed&&t.iter(e.line,n.line+1,(function(e){Fe(t,e)&&Yt(e,0)})),o.clearOnEnter&&dt(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(we=!0,(t.history.done.length||t.history.undone.length)&&t.clearHistory()),o.collapsed&&(o.id=++Eo,o.atomic=!0),c){if(a&&(c.curOp.updateMaxLine=!0),o.collapsed)di(c,e.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=e.line;u<=n.line;u++)hi(c,u,"text");o.atomic&&no(c.doc),ln(c,"markerAdded",c,o)}return o}Do.prototype.clear=function(){if(!this.explicitlyCleared){var t=this.doc.cm,e=t&&!t.curOp;if(e&&Ki(t),vt(this,"clear")){var n=this.find();n&&ln(this,"clear",n.from,n.to)}for(var i=null,r=null,o=0;o<this.lines.length;++o){var s=this.lines[o],a=Ee(s.markedSpans,this);t&&!this.collapsed?hi(t,Xt(s),"text"):t&&(null!=a.to&&(r=Xt(s)),null!=a.from&&(i=Xt(s))),s.markedSpans=De(s.markedSpans,a),null==a.from&&this.collapsed&&!Fe(this.doc,s)&&t&&Yt(s,ii(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var l=0;l<this.lines.length;++l){var c=Ne(this.lines[l]),u=Ve(c);u>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=u,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&di(t,i,r+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&no(t.doc)),t&&ln(t,"markerCleared",t,this,i,r),e&&Gi(t),this.parent&&this.parent.clear()}},Do.prototype.find=function(t,e){var n,i;null==t&&"bookmark"==this.type&&(t=1);for(var r=0;r<this.lines.length;++r){var o=this.lines[r],s=Ee(o.markedSpans,this);if(null!=s.from&&(n=te(e?o:Xt(o),s.from),-1==t))return n;if(null!=s.to&&(i=te(e?o:Xt(o),s.to),1==t))return i}return n&&{from:n,to:i}},Do.prototype.changed=function(){var t=this,e=this.find(-1,!0),n=this,i=this.doc.cm;e&&i&&Qi(i,(function(){var r=e.line,o=Xt(e.line),s=Pn(i,o);if(s&&(Nn(s),i.curOp.selectionChanged=i.curOp.forceUpdate=!0),i.curOp.updateMaxLine=!0,!Fe(n.doc,r)&&null!=n.height){var a=n.height;n.height=null;var l=wn(n)-a;l&&Yt(r,r.height+l)}ln(i,"markerChanged",i,t)}))},Do.prototype.attachLine=function(t){if(!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;e.maybeHiddenMarkers&&-1!=H(e.maybeHiddenMarkers,this)||(e.maybeUnhiddenMarkers||(e.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(t)},Do.prototype.detachLine=function(t){if(this.lines.splice(H(this.lines,t),1),!this.lines.length&&this.doc.cm){var e=this.doc.cm.curOp;(e.maybeHiddenMarkers||(e.maybeHiddenMarkers=[])).push(this)}},yt(Do);var So=function(t,e){this.markers=t,this.primary=e;for(var n=0;n<t.length;++n)t[n].parent=this};function To(t){return t.findMarks(te(t.first,0),t.clipPos(te(t.lastLine())),(function(t){return t.parent}))}function ko(t){for(var e=function(e){var n=t[e],i=[n.primary.doc];zr(n.primary.doc,(function(t){return i.push(t)}));for(var r=0;r<n.markers.length;r++){var o=n.markers[r];-1==H(i,o.doc)&&(o.parent=null,n.markers.splice(r--,1))}},n=0;n<t.length;n++)e(n)}So.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0;for(var t=0;t<this.markers.length;++t)this.markers[t].clear();ln(this,"clear")}},So.prototype.find=function(t,e){return this.primary.find(t,e)},yt(So);var Ao=0,Po=function(t,e,n,i,r){if(!(this instanceof Po))return new Po(t,e,n,i,r);null==n&&(n=0),wo.call(this,[new _o([new Ke("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n;var o=te(n,0);this.sel=Dr(o),this.history=new Or(null),this.id=++Ao,this.modeOption=e,this.lineSep=i,this.direction="rtl"==r?"rtl":"ltr",this.extend=!1,"string"==typeof t&&(t=this.splitLines(t)),Ir(this,{from:o,to:o,text:t}),Qr(this,Dr(o),j)};Po.prototype=J(wo.prototype,{constructor:Po,iter:function(t,e,n){n?this.iterN(t-this.first,e-t,n):this.iterN(this.first,this.first+this.size,t)},insert:function(t,e){for(var n=0,i=0;i<e.length;++i)n+=e[i].height;this.insertInner(t-this.first,e,n)},remove:function(t,e){this.removeInner(t-this.first,e)},getValue:function(t){var e=$t(this,this.first,this.first+this.size);return!1===t?e:e.join(t||this.lineSeparator())},setValue:nr((function(t){var e=te(this.first,0),n=this.first+this.size-1;co(this,{from:e,to:te(n,Kt(this,n).text.length),text:this.splitLines(t),origin:"setValue",full:!0},!0),this.cm&&Li(this.cm,0,0),Qr(this,Dr(e),j)})),replaceRange:function(t,e,n,i){mo(this,t,e=ae(this,e),n=n?ae(this,n):e,i)},getRange:function(t,e,n){var i=Gt(this,ae(this,t),ae(this,e));return!1===n?i:i.join(n||this.lineSeparator())},getLine:function(t){var e=this.getLineHandle(t);return e&&e.text},getLineHandle:function(t){if(Zt(this,t))return Kt(this,t)},getLineNumber:function(t){return Xt(t)},getLineHandleVisualStart:function(t){return"number"==typeof t&&(t=Kt(this,t)),Ne(t)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(t){return ae(this,t)},getCursor:function(t){var e=this.sel.primary();return null==t||"head"==t?e.head:"anchor"==t?e.anchor:"end"==t||"to"==t||!1===t?e.to():e.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:nr((function(t,e,n){Jr(this,ae(this,"number"==typeof t?te(t,e||0):t),null,n)})),setSelection:nr((function(t,e,n){Jr(this,ae(this,t),ae(this,e||t),n)})),extendSelection:nr((function(t,e,n){$r(this,ae(this,t),e&&ae(this,e),n)})),extendSelections:nr((function(t,e){Yr(this,le(this,t),e)})),extendSelectionsBy:nr((function(t,e){Yr(this,le(this,Y(this.sel.ranges,t)),e)})),setSelections:nr((function(t,e,n){if(t.length){for(var i=[],r=0;r<t.length;r++)i[r]=new Cr(ae(this,t[r].anchor),ae(this,t[r].head));null==e&&(e=Math.min(t.length-1,this.sel.primIndex)),Qr(this,Er(this.cm,i,e),n)}})),addSelection:nr((function(t,e,n){var i=this.sel.ranges.slice(0);i.push(new Cr(ae(this,t),ae(this,e||t))),Qr(this,Er(this.cm,i,i.length-1),n)})),getSelection:function(t){for(var e,n=this.sel.ranges,i=0;i<n.length;i++){var r=Gt(this,n[i].from(),n[i].to());e=e?e.concat(r):r}return!1===t?e:e.join(t||this.lineSeparator())},getSelections:function(t){for(var e=[],n=this.sel.ranges,i=0;i<n.length;i++){var r=Gt(this,n[i].from(),n[i].to());!1!==t&&(r=r.join(t||this.lineSeparator())),e[i]=r}return e},replaceSelection:function(t,e,n){for(var i=[],r=0;r<this.sel.ranges.length;r++)i[r]=t;this.replaceSelections(i,e,n||"+input")},replaceSelections:nr((function(t,e,n){for(var i=[],r=this.sel,o=0;o<r.ranges.length;o++){var s=r.ranges[o];i[o]={from:s.from(),to:s.to(),text:this.splitLines(t[o]),origin:n}}for(var a=e&&"end"!=e&&function(t,e,n){for(var i=[],r=te(t.first,0),o=r,s=0;s<e.length;s++){var a=e[s],l=kr(a.from,r,o),c=kr(Mr(a),r,o);if(r=a.to,o=c,"around"==n){var u=t.sel.ranges[s],d=ee(u.head,u.anchor)<0;i[s]=new Cr(d?c:l,d?l:c)}else i[s]=new Cr(l,l)}return new xr(i,t.sel.primIndex)}(this,i,e),l=i.length-1;l>=0;l--)co(this,i[l]);a?Zr(this,a):this.cm&&Pi(this.cm)})),undo:nr((function(){ho(this,"undo")})),redo:nr((function(){ho(this,"redo")})),undoSelection:nr((function(){ho(this,"undo",!0)})),redoSelection:nr((function(){ho(this,"redo",!0)})),setExtending:function(t){this.extend=t},getExtending:function(){return this.extend},historySize:function(){for(var t=this.history,e=0,n=0,i=0;i<t.done.length;i++)t.done[i].ranges||++e;for(var r=0;r<t.undone.length;r++)t.undone[r].ranges||++n;return{undo:e,redo:n}},clearHistory:function(){var t=this;this.history=new Or(this.history.maxGeneration),zr(this,(function(e){return e.history=t.history}),!0)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(t){return t&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(t){return this.history.generation==(t||this.cleanGeneration)},getHistory:function(){return{done:Kr(this.history.done),undone:Kr(this.history.undone)}},setHistory:function(t){var e=this.history=new Or(this.history.maxGeneration);e.done=Kr(t.done.slice(0),null,!0),e.undone=Kr(t.undone.slice(0),null,!0)},setGutterMarker:nr((function(t,e,n){return bo(this,t,"gutter",(function(t){var i=t.gutterMarkers||(t.gutterMarkers={});return i[e]=n,!n&&et(i)&&(t.gutterMarkers=null),!0}))})),clearGutter:nr((function(t){var e=this;this.iter((function(n){n.gutterMarkers&&n.gutterMarkers[t]&&bo(e,n,"gutter",(function(){return n.gutterMarkers[t]=null,et(n.gutterMarkers)&&(n.gutterMarkers=null),!0}))}))})),lineInfo:function(t){var e;if("number"==typeof t){if(!Zt(this,t))return null;if(e=t,!(t=Kt(this,t)))return null}else if(null==(e=Xt(t)))return null;return{line:e,handle:t,text:t.text,gutterMarkers:t.gutterMarkers,textClass:t.textClass,bgClass:t.bgClass,wrapClass:t.wrapClass,widgets:t.widgets}},addLineClass:nr((function(t,e,n){return bo(this,t,"gutter"==e?"gutter":"class",(function(t){var i="text"==e?"textClass":"background"==e?"bgClass":"gutter"==e?"gutterClass":"wrapClass";if(t[i]){if(E(n).test(t[i]))return!1;t[i]+=" "+n}else t[i]=n;return!0}))})),removeLineClass:nr((function(t,e,n){return bo(this,t,"gutter"==e?"gutter":"class",(function(t){var i="text"==e?"textClass":"background"==e?"bgClass":"gutter"==e?"gutterClass":"wrapClass",r=t[i];if(!r)return!1;if(null==n)t[i]=null;else{var o=r.match(E(n));if(!o)return!1;var s=o.index+o[0].length;t[i]=r.slice(0,o.index)+(o.index&&s!=r.length?" ":"")+r.slice(s)||null}return!0}))})),addLineWidget:nr((function(t,e,n){return function(t,e,n,i){var r=new xo(t,n,i),o=t.cm;return o&&r.noHScroll&&(o.display.alignWidgets=!0),bo(t,e,"widget",(function(e){var n=e.widgets||(e.widgets=[]);if(null==r.insertAt?n.push(r):n.splice(Math.min(n.length,Math.max(0,r.insertAt)),0,r),r.line=e,o&&!Fe(t,e)){var i=qe(e)<t.scrollTop;Yt(e,e.height+wn(r)),i&&Ai(o,r.height),o.curOp.forceUpdate=!0}return!0})),o&&ln(o,"lineWidgetAdded",o,r,"number"==typeof e?e:Xt(e)),r}(this,t,e,n)})),removeLineWidget:function(t){t.clear()},markText:function(t,e,n){return Mo(this,ae(this,t),ae(this,e),n,n&&n.type||"range")},setBookmark:function(t,e){var n={replacedWith:e&&(null==e.nodeType?e.widget:e),insertLeft:e&&e.insertLeft,clearWhenEmpty:!1,shared:e&&e.shared,handleMouseEvents:e&&e.handleMouseEvents};return Mo(this,t=ae(this,t),t,n,"bookmark")},findMarksAt:function(t){var e=[],n=Kt(this,(t=ae(this,t)).line).markedSpans;if(n)for(var i=0;i<n.length;++i){var r=n[i];(null==r.from||r.from<=t.ch)&&(null==r.to||r.to>=t.ch)&&e.push(r.marker.parent||r.marker)}return e},findMarks:function(t,e,n){t=ae(this,t),e=ae(this,e);var i=[],r=t.line;return this.iter(t.line,e.line+1,(function(o){var s=o.markedSpans;if(s)for(var a=0;a<s.length;a++){var l=s[a];null!=l.to&&r==t.line&&t.ch>=l.to||null==l.from&&r!=t.line||null!=l.from&&r==e.line&&l.from>=e.ch||n&&!n(l.marker)||i.push(l.marker.parent||l.marker)}++r})),i},getAllMarks:function(){var t=[];return this.iter((function(e){var n=e.markedSpans;if(n)for(var i=0;i<n.length;++i)null!=n[i].from&&t.push(n[i].marker)})),t},posFromIndex:function(t){var e,n=this.first,i=this.lineSeparator().length;return this.iter((function(r){var o=r.text.length+i;if(o>t)return e=t,!0;t-=o,++n})),ae(this,te(n,e))},indexFromPos:function(t){var e=(t=ae(this,t)).ch;if(t.line<this.first||t.ch<0)return 0;var n=this.lineSeparator().length;return this.iter(this.first,t.line,(function(t){e+=t.text.length+n})),e},copy:function(t){var e=new Po($t(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction);return e.scrollTop=this.scrollTop,e.scrollLeft=this.scrollLeft,e.sel=this.sel,e.extend=!1,t&&(e.history.undoDepth=this.history.undoDepth,e.setHistory(this.getHistory())),e},linkedDoc:function(t){t||(t={});var e=this.first,n=this.first+this.size;null!=t.from&&t.from>e&&(e=t.from),null!=t.to&&t.to<n&&(n=t.to);var i=new Po($t(this,e,n),t.mode||this.modeOption,e,this.lineSep,this.direction);return t.sharedHist&&(i.history=this.history),(this.linked||(this.linked=[])).push({doc:i,sharedHist:t.sharedHist}),i.linked=[{doc:this,isParent:!0,sharedHist:t.sharedHist}],function(t,e){for(var n=0;n<e.length;n++){var i=e[n],r=i.find(),o=t.clipPos(r.from),s=t.clipPos(r.to);if(ee(o,s)){var a=Mo(t,o,s,i.primary,i.primary.type);i.markers.push(a),a.parent=i}}}(i,To(this)),i},unlinkDoc:function(t){if(t instanceof Ss&&(t=t.doc),this.linked)for(var e=0;e<this.linked.length;++e)if(this.linked[e].doc==t){this.linked.splice(e,1),t.unlinkDoc(this),ko(To(this));break}if(t.history==this.history){var n=[t.id];zr(t,(function(t){return n.push(t.id)}),!0),t.history=new Or(null),t.history.done=Kr(this.history.done,n),t.history.undone=Kr(this.history.undone,n)}},iterLinkedDocs:function(t){zr(this,t)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(t){return this.lineSep?t.split(this.lineSep):Pt(t)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:nr((function(t){var e;"rtl"!=t&&(t="ltr"),t!=this.direction&&(this.direction=t,this.iter((function(t){return t.order=null})),this.cm&&Qi(e=this.cm,(function(){Rr(e),di(e)})))}))}),Po.prototype.eachLine=Po.prototype.iter;var Lo=0;function Io(t){var e=this;if(zo(e),!mt(e,t)&&!xn(e.display,t)){bt(t),s&&(Lo=+new Date);var n=ci(e,t,!0),i=t.dataTransfer.files;if(n&&!e.isReadOnly())if(i&&i.length&&window.FileReader&&window.File)for(var r=i.length,o=Array(r),a=0,l=function(){++a==r&&tr(e,(function(){var t={from:n=ae(e.doc,n),to:n,text:e.doc.splitLines(o.filter((function(t){return null!=t})).join(e.doc.lineSeparator())),origin:"paste"};co(e.doc,t),Zr(e.doc,Dr(ae(e.doc,n),ae(e.doc,Mr(t))))}))()},c=function(t,n){if(e.options.allowDropFileTypes&&-1==H(e.options.allowDropFileTypes,t.type))l();else{var i=new FileReader;i.onerror=function(){return l()},i.onload=function(){var t=i.result;/[\x00-\x08\x0e-\x1f]{2}/.test(t)||(o[n]=t),l()},i.readAsText(t)}},u=0;u<i.length;u++)c(i[u],u);else{if(e.state.draggingText&&e.doc.sel.contains(n)>-1)return e.state.draggingText(t),void setTimeout((function(){return e.display.input.focus()}),20);try{var d=t.dataTransfer.getData("Text");if(d){var h;if(e.state.draggingText&&!e.state.draggingText.copy&&(h=e.listSelections()),to(e.doc,Dr(n,n)),h)for(var p=0;p<h.length;++p)mo(e.doc,"",h[p].anchor,h[p].head,"drag");e.replaceSelection(d,"around","paste"),e.display.input.focus()}}catch(t){}}}}function zo(t){t.display.dragCursor&&(t.display.lineSpace.removeChild(t.display.dragCursor),t.display.dragCursor=null)}function Bo(t){if(document.getElementsByClassName){for(var e=document.getElementsByClassName("CodeMirror"),n=[],i=0;i<e.length;i++){var r=e[i].CodeMirror;r&&n.push(r)}n.length&&n[0].operation((function(){for(var e=0;e<n.length;e++)t(n[e])}))}}var Ro=!1;function Oo(){var t;Ro||(dt(window,"resize",(function(){null==t&&(t=setTimeout((function(){t=null,Bo(No)}),100))})),dt(window,"blur",(function(){return Bo(Di)})),Ro=!0)}function No(t){var e=t.display;e.cachedCharWidth=e.cachedTextHeight=e.cachedPaddingH=null,e.scrollbarsClipped=!1,t.setSize()}for(var Wo={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",224:"Mod",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Ho=0;Ho<10;Ho++)Wo[Ho+48]=Wo[Ho+96]=String(Ho);for(var Fo=65;Fo<=90;Fo++)Wo[Fo]=String.fromCharCode(Fo);for(var jo=1;jo<=12;jo++)Wo[jo+111]=Wo[jo+63235]="F"+jo;var qo={};function Vo(t){var e,n,i,r,o=t.split(/-(?!$)/);t=o[o.length-1];for(var s=0;s<o.length-1;s++){var a=o[s];if(/^(cmd|meta|m)$/i.test(a))r=!0;else if(/^a(lt)?$/i.test(a))e=!0;else if(/^(c|ctrl|control)$/i.test(a))n=!0;else{if(!/^s(hift)?$/i.test(a))throw new Error("Unrecognized modifier name: "+a);i=!0}}return e&&(t="Alt-"+t),n&&(t="Ctrl-"+t),r&&(t="Cmd-"+t),i&&(t="Shift-"+t),t}function Uo(t){var e={};for(var n in t)if(t.hasOwnProperty(n)){var i=t[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==i){delete t[n];continue}for(var r=Y(n.split(" "),Vo),o=0;o<r.length;o++){var s=void 0,a=void 0;o==r.length-1?(a=r.join(" "),s=i):(a=r.slice(0,o+1).join(" "),s="...");var l=e[a];if(l){if(l!=s)throw new Error("Inconsistent bindings for "+a)}else e[a]=s}delete t[n]}for(var c in e)t[c]=e[c];return t}function Ko(t,e,n,i){var r=(e=Xo(e)).call?e.call(t,i):e[t];if(!1===r)return"nothing";if("..."===r)return"multi";if(null!=r&&n(r))return"handled";if(e.fallthrough){if("[object Array]"!=Object.prototype.toString.call(e.fallthrough))return Ko(t,e.fallthrough,n,i);for(var o=0;o<e.fallthrough.length;o++){var s=Ko(t,e.fallthrough[o],n,i);if(s)return s}}}function Go(t){var e="string"==typeof t?t:Wo[t.keyCode];return"Ctrl"==e||"Alt"==e||"Shift"==e||"Mod"==e}function $o(t,e,n){var i=t;return e.altKey&&"Alt"!=i&&(t="Alt-"+t),(x?e.metaKey:e.ctrlKey)&&"Ctrl"!=i&&(t="Ctrl-"+t),(x?e.ctrlKey:e.metaKey)&&"Mod"!=i&&(t="Cmd-"+t),!n&&e.shiftKey&&"Shift"!=i&&(t="Shift-"+t),t}function Yo(t,e){if(d&&34==t.keyCode&&t.char)return!1;var n=Wo[t.keyCode];return null!=n&&!t.altGraphKey&&(3==t.keyCode&&t.code&&(n=t.code),$o(n,t,e))}function Xo(t){return"string"==typeof t?qo[t]:t}function Jo(t,e){for(var n=t.doc.sel.ranges,i=[],r=0;r<n.length;r++){for(var o=e(n[r]);i.length&&ee(o.from,$(i).to)<=0;){var s=i.pop();if(ee(s.from,o.from)<0){o.from=s.from;break}}i.push(o)}Qi(t,(function(){for(var e=i.length-1;e>=0;e--)mo(t.doc,"",i[e].from,i[e].to,"+delete");Pi(t)}))}function Zo(t,e,n){var i=rt(t.text,e+n,n);return i<0||i>t.text.length?null:i}function Qo(t,e,n){var i=Zo(t,e.ch,n);return null==i?null:new te(e.line,i,n<0?"after":"before")}function ts(t,e,n,i,r){if(t){"rtl"==e.doc.direction&&(r=-r);var o=ct(n,e.doc.direction);if(o){var s,a=r<0?$(o):o[0],l=r<0==(1==a.level)?"after":"before";if(a.level>0||"rtl"==e.doc.direction){var c=Ln(e,n);s=r<0?n.text.length-1:0;var u=In(e,c,s).top;s=ot((function(t){return In(e,c,t).top==u}),r<0==(1==a.level)?a.from:a.to-1,s),"before"==l&&(s=Zo(n,s,1))}else s=r<0?a.to:a.from;return new te(i,s,l)}}return new te(i,r<0?n.text.length:0,r<0?"before":"after")}qo.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},qo.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},qo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},qo.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},qo.default=y?qo.macDefault:qo.pcDefault;var es={selectAll:ao,singleSelection:function(t){return t.setSelection(t.getCursor("anchor"),t.getCursor("head"),j)},killLine:function(t){return Jo(t,(function(e){if(e.empty()){var n=Kt(t.doc,e.head.line).text.length;return e.head.ch==n&&e.head.line<t.lastLine()?{from:e.head,to:te(e.head.line+1,0)}:{from:e.head,to:te(e.head.line,n)}}return{from:e.from(),to:e.to()}}))},deleteLine:function(t){return Jo(t,(function(e){return{from:te(e.from().line,0),to:ae(t.doc,te(e.to().line+1,0))}}))},delLineLeft:function(t){return Jo(t,(function(t){return{from:te(t.from().line,0),to:t.from()}}))},delWrappedLineLeft:function(t){return Jo(t,(function(e){var n=t.charCoords(e.head,"div").top+5;return{from:t.coordsChar({left:0,top:n},"div"),to:e.from()}}))},delWrappedLineRight:function(t){return Jo(t,(function(e){var n=t.charCoords(e.head,"div").top+5,i=t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div");return{from:e.from(),to:i}}))},undo:function(t){return t.undo()},redo:function(t){return t.redo()},undoSelection:function(t){return t.undoSelection()},redoSelection:function(t){return t.redoSelection()},goDocStart:function(t){return t.extendSelection(te(t.firstLine(),0))},goDocEnd:function(t){return t.extendSelection(te(t.lastLine()))},goLineStart:function(t){return t.extendSelectionsBy((function(e){return ns(t,e.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(t){return t.extendSelectionsBy((function(e){return is(t,e.head)}),{origin:"+move",bias:1})},goLineEnd:function(t){return t.extendSelectionsBy((function(e){return function(t,e){var n=Kt(t.doc,e),i=function(t){for(var e;e=Be(t);)t=e.find(1,!0).line;return t}(n);return i!=n&&(e=Xt(i)),ts(!0,t,n,e,-1)}(t,e.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(t){return t.extendSelectionsBy((function(e){var n=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:t.display.lineDiv.offsetWidth+100,top:n},"div")}),V)},goLineLeft:function(t){return t.extendSelectionsBy((function(e){var n=t.cursorCoords(e.head,"div").top+5;return t.coordsChar({left:0,top:n},"div")}),V)},goLineLeftSmart:function(t){return t.extendSelectionsBy((function(e){var n=t.cursorCoords(e.head,"div").top+5,i=t.coordsChar({left:0,top:n},"div");return i.ch<t.getLine(i.line).search(/\S/)?is(t,e.head):i}),V)},goLineUp:function(t){return t.moveV(-1,"line")},goLineDown:function(t){return t.moveV(1,"line")},goPageUp:function(t){return t.moveV(-1,"page")},goPageDown:function(t){return t.moveV(1,"page")},goCharLeft:function(t){return t.moveH(-1,"char")},goCharRight:function(t){return t.moveH(1,"char")},goColumnLeft:function(t){return t.moveH(-1,"column")},goColumnRight:function(t){return t.moveH(1,"column")},goWordLeft:function(t){return t.moveH(-1,"word")},goGroupRight:function(t){return t.moveH(1,"group")},goGroupLeft:function(t){return t.moveH(-1,"group")},goWordRight:function(t){return t.moveH(1,"word")},delCharBefore:function(t){return t.deleteH(-1,"codepoint")},delCharAfter:function(t){return t.deleteH(1,"char")},delWordBefore:function(t){return t.deleteH(-1,"word")},delWordAfter:function(t){return t.deleteH(1,"word")},delGroupBefore:function(t){return t.deleteH(-1,"group")},delGroupAfter:function(t){return t.deleteH(1,"group")},indentAuto:function(t){return t.indentSelection("smart")},indentMore:function(t){return t.indentSelection("add")},indentLess:function(t){return t.indentSelection("subtract")},insertTab:function(t){return t.replaceSelection("\t")},insertSoftTab:function(t){for(var e=[],n=t.listSelections(),i=t.options.tabSize,r=0;r<n.length;r++){var o=n[r].from(),s=N(t.getLine(o.line),o.ch,i);e.push(G(i-s%i))}t.replaceSelections(e)},defaultTab:function(t){t.somethingSelected()?t.indentSelection("add"):t.execCommand("insertTab")},transposeChars:function(t){return Qi(t,(function(){for(var e=t.listSelections(),n=[],i=0;i<e.length;i++)if(e[i].empty()){var r=e[i].head,o=Kt(t.doc,r.line).text;if(o)if(r.ch==o.length&&(r=new te(r.line,r.ch-1)),r.ch>0)r=new te(r.line,r.ch+1),t.replaceRange(o.charAt(r.ch-1)+o.charAt(r.ch-2),te(r.line,r.ch-2),r,"+transpose");else if(r.line>t.doc.first){var s=Kt(t.doc,r.line-1).text;s&&(r=new te(r.line,1),t.replaceRange(o.charAt(0)+t.doc.lineSeparator()+s.charAt(s.length-1),te(r.line-1,s.length-1),r,"+transpose"))}n.push(new Cr(r,r))}t.setSelections(n)}))},newlineAndIndent:function(t){return Qi(t,(function(){for(var e=t.listSelections(),n=e.length-1;n>=0;n--)t.replaceRange(t.doc.lineSeparator(),e[n].anchor,e[n].head,"+input");e=t.listSelections();for(var i=0;i<e.length;i++)t.indentLine(e[i].from().line,null,!0);Pi(t)}))},openLine:function(t){return t.replaceSelection("\n","start")},toggleOverwrite:function(t){return t.toggleOverwrite()}};function ns(t,e){var n=Kt(t.doc,e),i=Ne(n);return i!=n&&(e=Xt(i)),ts(!0,t,i,e,1)}function is(t,e){var n=ns(t,e.line),i=Kt(t.doc,n.line),r=ct(i,t.doc.direction);if(!r||0==r[0].level){var o=Math.max(n.ch,i.text.search(/\S/)),s=e.line==n.line&&e.ch<=o&&e.ch;return te(n.line,s?0:o,n.sticky)}return n}function rs(t,e,n){if("string"==typeof e&&!(e=es[e]))return!1;t.display.input.ensurePolled();var i=t.display.shift,r=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),n&&(t.display.shift=!1),r=e(t)!=F}finally{t.display.shift=i,t.state.suppressEdits=!1}return r}var os=new W;function ss(t,e,n,i){var r=t.state.keySeq;if(r){if(Go(e))return"handled";if(/\'$/.test(e)?t.state.keySeq=null:os.set(50,(function(){t.state.keySeq==r&&(t.state.keySeq=null,t.display.input.reset())})),as(t,r+" "+e,n,i))return!0}return as(t,e,n,i)}function as(t,e,n,i){var r=function(t,e,n){for(var i=0;i<t.state.keyMaps.length;i++){var r=Ko(e,t.state.keyMaps[i],n,t);if(r)return r}return t.options.extraKeys&&Ko(e,t.options.extraKeys,n,t)||Ko(e,t.options.keyMap,n,t)}(t,e,i);return"multi"==r&&(t.state.keySeq=e),"handled"==r&&ln(t,"keyHandled",t,e,n),"handled"!=r&&"multi"!=r||(bt(n),wi(t)),!!r}function ls(t,e){var n=Yo(e,!0);return!!n&&(e.shiftKey&&!t.state.keySeq?ss(t,"Shift-"+n,e,(function(e){return rs(t,e,!0)}))||ss(t,n,e,(function(e){if("string"==typeof e?/^go[A-Z]/.test(e):e.motion)return rs(t,e)})):ss(t,n,e,(function(e){return rs(t,e)})))}var cs=null;function us(t){var e=this;if(!(t.target&&t.target!=e.display.input.getField()||(e.curOp.focus=L(),mt(e,t)))){s&&a<11&&27==t.keyCode&&(t.returnValue=!1);var i=t.keyCode;e.display.shift=16==i||t.shiftKey;var r=ls(e,t);d&&(cs=r?i:null,r||88!=i||It||!(y?t.metaKey:t.ctrlKey)||e.replaceSelection("",null,"cut")),n&&!y&&!r&&46==i&&t.shiftKey&&!t.ctrlKey&&document.execCommand&&document.execCommand("cut"),18!=i||/\bCodeMirror-crosshair\b/.test(e.display.lineDiv.className)||function(t){var e=t.display.lineDiv;function n(t){18!=t.keyCode&&t.altKey||(M(e,"CodeMirror-crosshair"),pt(document,"keyup",n),pt(document,"mouseover",n))}I(e,"CodeMirror-crosshair"),dt(document,"keyup",n),dt(document,"mouseover",n)}(e)}}function ds(t){16==t.keyCode&&(this.doc.sel.shift=!1),mt(this,t)}function hs(t){var e=this;if(!(t.target&&t.target!=e.display.input.getField()||xn(e.display,t)||mt(e,t)||t.ctrlKey&&!t.altKey||y&&t.metaKey)){var n=t.keyCode,i=t.charCode;if(d&&n==cs)return cs=null,void bt(t);if(!d||t.which&&!(t.which<10)||!ls(e,t)){var r=String.fromCharCode(null==i?n:i);"\b"!=r&&(function(t,e,n){return ss(t,"'"+n+"'",e,(function(e){return rs(t,e,!0)}))}(e,t,r)||e.display.input.onKeyPress(t))}}}var ps,fs,ms=function(t,e,n){this.time=t,this.pos=e,this.button=n};function gs(t){var e=this,n=e.display;if(!(mt(e,t)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=t.shiftKey,xn(n,t))l||(n.scroller.draggable=!1,setTimeout((function(){return n.scroller.draggable=!0}),100));else if(!bs(e,t)){var i=ci(e,t),r=Et(t),o=i?function(t,e){var n=+new Date;return fs&&fs.compare(n,t,e)?(ps=fs=null,"triple"):ps&&ps.compare(n,t,e)?(fs=new ms(n,t,e),ps=null,"double"):(ps=new ms(n,t,e),fs=null,"single")}(i,r):"single";window.focus(),1==r&&e.state.selectingText&&e.state.selectingText(t),i&&function(t,e,n,i,r){var o="Click";return"double"==i?o="Double"+o:"triple"==i&&(o="Triple"+o),ss(t,$o(o=(1==e?"Left":2==e?"Middle":"Right")+o,r),r,(function(e){if("string"==typeof e&&(e=es[e]),!e)return!1;var i=!1;try{t.isReadOnly()&&(t.state.suppressEdits=!0),i=e(t,n)!=F}finally{t.state.suppressEdits=!1}return i}))}(e,r,i,o,t)||(1==r?i?function(t,e,n,i){s?setTimeout(R(xi,t),0):t.curOp.focus=L();var r,o=function(t,e,n){var i=t.getOption("configureMouse"),r=i?i(t,e,n):{};if(null==r.unit){var o=b?n.shiftKey&&n.metaKey:n.altKey;r.unit=o?"rectangle":"single"==e?"char":"double"==e?"word":"line"}return(null==r.extend||t.doc.extend)&&(r.extend=t.doc.extend||n.shiftKey),null==r.addNew&&(r.addNew=y?n.metaKey:n.ctrlKey),null==r.moveOnDrag&&(r.moveOnDrag=!(y?n.altKey:n.ctrlKey)),r}(t,n,i),c=t.doc.sel;t.options.dragDrop&&St&&!t.isReadOnly()&&"single"==n&&(r=c.contains(e))>-1&&(ee((r=c.ranges[r]).from(),e)<0||e.xRel>0)&&(ee(r.to(),e)>0||e.xRel<0)?function(t,e,n,i){var r=t.display,o=!1,c=tr(t,(function(e){l&&(r.scroller.draggable=!1),t.state.draggingText=!1,t.state.delayingBlurEvent&&(t.hasFocus()?t.state.delayingBlurEvent=!1:Ci(t)),pt(r.wrapper.ownerDocument,"mouseup",c),pt(r.wrapper.ownerDocument,"mousemove",u),pt(r.scroller,"dragstart",d),pt(r.scroller,"drop",c),o||(bt(e),i.addNew||$r(t.doc,n,null,null,i.extend),l&&!h||s&&9==a?setTimeout((function(){r.wrapper.ownerDocument.body.focus({preventScroll:!0}),r.input.focus()}),20):r.input.focus())})),u=function(t){o=o||Math.abs(e.clientX-t.clientX)+Math.abs(e.clientY-t.clientY)>=10},d=function(){return o=!0};l&&(r.scroller.draggable=!0),t.state.draggingText=c,c.copy=!i.moveOnDrag,dt(r.wrapper.ownerDocument,"mouseup",c),dt(r.wrapper.ownerDocument,"mousemove",u),dt(r.scroller,"dragstart",d),dt(r.scroller,"drop",c),t.state.delayingBlurEvent=!0,setTimeout((function(){return r.input.focus()}),20),r.scroller.dragDrop&&r.scroller.dragDrop()}(t,i,e,o):function(t,e,n,i){s&&Ci(t);var r=t.display,o=t.doc;bt(e);var a,l,c=o.sel,u=c.ranges;if(i.addNew&&!i.extend?(l=o.sel.contains(n),a=l>-1?u[l]:new Cr(n,n)):(a=o.sel.primary(),l=o.sel.primIndex),"rectangle"==i.unit)i.addNew||(a=new Cr(n,n)),n=ci(t,e,!0,!0),l=-1;else{var d=vs(t,n,i.unit);a=i.extend?Gr(a,d.anchor,d.head,i.extend):d}i.addNew?-1==l?(l=u.length,Qr(o,Er(t,u.concat([a]),l),{scroll:!1,origin:"*mouse"})):u.length>1&&u[l].empty()&&"char"==i.unit&&!i.extend?(Qr(o,Er(t,u.slice(0,l).concat(u.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),c=o.sel):Xr(o,l,a,q):(l=0,Qr(o,new xr([a],0),q),c=o.sel);var h=n;function p(e){if(0!=ee(h,e))if(h=e,"rectangle"==i.unit){for(var r=[],s=t.options.tabSize,u=N(Kt(o,n.line).text,n.ch,s),d=N(Kt(o,e.line).text,e.ch,s),p=Math.min(u,d),f=Math.max(u,d),m=Math.min(n.line,e.line),g=Math.min(t.lastLine(),Math.max(n.line,e.line));m<=g;m++){var v=Kt(o,m).text,y=U(v,p,s);p==f?r.push(new Cr(te(m,y),te(m,y))):v.length>y&&r.push(new Cr(te(m,y),te(m,U(v,f,s))))}r.length||r.push(new Cr(n,n)),Qr(o,Er(t,c.ranges.slice(0,l).concat(r),l),{origin:"*mouse",scroll:!1}),t.scrollIntoView(e)}else{var b,_=a,w=vs(t,e,i.unit),x=_.anchor;ee(w.anchor,x)>0?(b=w.head,x=oe(_.from(),w.anchor)):(b=w.anchor,x=re(_.to(),w.head));var C=c.ranges.slice(0);C[l]=function(t,e){var n=e.anchor,i=e.head,r=Kt(t.doc,n.line);if(0==ee(n,i)&&n.sticky==i.sticky)return e;var o=ct(r);if(!o)return e;var s=at(o,n.ch,n.sticky),a=o[s];if(a.from!=n.ch&&a.to!=n.ch)return e;var l,c=s+(a.from==n.ch==(1!=a.level)?0:1);if(0==c||c==o.length)return e;if(i.line!=n.line)l=(i.line-n.line)*("ltr"==t.doc.direction?1:-1)>0;else{var u=at(o,i.ch,i.sticky),d=u-s||(i.ch-n.ch)*(1==a.level?-1:1);l=u==c-1||u==c?d<0:d>0}var h=o[c+(l?-1:0)],p=l==(1==h.level),f=p?h.from:h.to,m=p?"after":"before";return n.ch==f&&n.sticky==m?e:new Cr(new te(n.line,f,m),i)}(t,new Cr(ae(o,x),b)),Qr(o,Er(t,C,l),q)}}var f=r.wrapper.getBoundingClientRect(),m=0;function g(e){var n=++m,s=ci(t,e,!0,"rectangle"==i.unit);if(s)if(0!=ee(s,h)){t.curOp.focus=L(),p(s);var a=Ti(r,o);(s.line>=a.to||s.line<a.from)&&setTimeout(tr(t,(function(){m==n&&g(e)})),150)}else{var l=e.clientY<f.top?-20:e.clientY>f.bottom?20:0;l&&setTimeout(tr(t,(function(){m==n&&(r.scroller.scrollTop+=l,g(e))})),50)}}function v(e){t.state.selectingText=!1,m=1/0,e&&(bt(e),r.input.focus()),pt(r.wrapper.ownerDocument,"mousemove",y),pt(r.wrapper.ownerDocument,"mouseup",b),o.history.lastSelOrigin=null}var y=tr(t,(function(t){0!==t.buttons&&Et(t)?g(t):v(t)})),b=tr(t,v);t.state.selectingText=b,dt(r.wrapper.ownerDocument,"mousemove",y),dt(r.wrapper.ownerDocument,"mouseup",b)}(t,i,e,o)}(e,i,o,t):Ct(t)==n.scroller&&bt(t):2==r?(i&&$r(e.doc,i),setTimeout((function(){return n.input.focus()}),20)):3==r&&(C?e.display.input.onContextMenu(t):Ci(e)))}}function vs(t,e,n){if("char"==n)return new Cr(e,e);if("word"==n)return t.findWordAt(e);if("line"==n)return new Cr(te(e.line,0),ae(t.doc,te(e.line+1,0)));var i=n(t,e);return new Cr(i.from,i.to)}function ys(t,e,n,i){var r,o;if(e.touches)r=e.touches[0].clientX,o=e.touches[0].clientY;else try{r=e.clientX,o=e.clientY}catch(t){return!1}if(r>=Math.floor(t.display.gutters.getBoundingClientRect().right))return!1;i&&bt(e);var s=t.display,a=s.lineDiv.getBoundingClientRect();if(o>a.bottom||!vt(t,n))return wt(e);o-=a.top-s.viewOffset;for(var l=0;l<t.display.gutterSpecs.length;++l){var c=s.gutters.childNodes[l];if(c&&c.getBoundingClientRect().right>=r)return ft(t,n,t,Jt(t.doc,o),t.display.gutterSpecs[l].className,e),wt(e)}}function bs(t,e){return ys(t,e,"gutterClick",!0)}function _s(t,e){xn(t.display,e)||function(t,e){return!!vt(t,"gutterContextMenu")&&ys(t,e,"gutterContextMenu",!1)}(t,e)||mt(t,e,"contextmenu")||C||t.display.input.onContextMenu(e)}function ws(t){t.display.wrapper.className=t.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+t.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Hn(t)}ms.prototype.compare=function(t,e,n){return this.time+400>t&&0==ee(e,this.pos)&&n==this.button};var xs={toString:function(){return"CodeMirror.Init"}},Cs={},Es={};function Ds(t,e,n){if(!e!=!(n&&n!=xs)){var i=t.display.dragFunctions,r=e?dt:pt;r(t.display.scroller,"dragstart",i.start),r(t.display.scroller,"dragenter",i.enter),r(t.display.scroller,"dragover",i.over),r(t.display.scroller,"dragleave",i.leave),r(t.display.scroller,"drop",i.drop)}}function Ms(t){t.options.lineWrapping?(I(t.display.wrapper,"CodeMirror-wrap"),t.display.sizer.style.minWidth="",t.display.sizerWidth=null):(M(t.display.wrapper,"CodeMirror-wrap"),Ue(t)),li(t),di(t),Hn(t),setTimeout((function(){return Fi(t)}),100)}function Ss(t,e){var n=this;if(!(this instanceof Ss))return new Ss(t,e);this.options=e=e?O(e):{},O(Cs,e,!1);var i=e.value;"string"==typeof i?i=new Po(i,e.mode,null,e.lineSeparator,e.direction):e.mode&&(i.modeOption=e.mode),this.doc=i;var r=new Ss.inputStyles[e.inputStyle](this),o=this.display=new gr(t,i,r,e);for(var c in o.wrapper.CodeMirror=this,ws(this),e.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Vi(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new W,keySeq:null,specialChars:null},e.autofocus&&!v&&o.input.focus(),s&&a<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),function(t){var e=t.display;dt(e.scroller,"mousedown",tr(t,gs)),dt(e.scroller,"dblclick",s&&a<11?tr(t,(function(e){if(!mt(t,e)){var n=ci(t,e);if(n&&!bs(t,e)&&!xn(t.display,e)){bt(e);var i=t.findWordAt(n);$r(t.doc,i.anchor,i.head)}}})):function(e){return mt(t,e)||bt(e)}),dt(e.scroller,"contextmenu",(function(e){return _s(t,e)})),dt(e.input.getField(),"contextmenu",(function(n){e.scroller.contains(n.target)||_s(t,n)}));var n,i={end:0};function r(){e.activeTouch&&(n=setTimeout((function(){return e.activeTouch=null}),1e3),(i=e.activeTouch).end=+new Date)}function o(t){if(1!=t.touches.length)return!1;var e=t.touches[0];return e.radiusX<=1&&e.radiusY<=1}function l(t,e){if(null==e.left)return!0;var n=e.left-t.left,i=e.top-t.top;return n*n+i*i>400}dt(e.scroller,"touchstart",(function(r){if(!mt(t,r)&&!o(r)&&!bs(t,r)){e.input.ensurePolled(),clearTimeout(n);var s=+new Date;e.activeTouch={start:s,moved:!1,prev:s-i.end<=300?i:null},1==r.touches.length&&(e.activeTouch.left=r.touches[0].pageX,e.activeTouch.top=r.touches[0].pageY)}})),dt(e.scroller,"touchmove",(function(){e.activeTouch&&(e.activeTouch.moved=!0)})),dt(e.scroller,"touchend",(function(n){var i=e.activeTouch;if(i&&!xn(e,n)&&null!=i.left&&!i.moved&&new Date-i.start<300){var o,s=t.coordsChar(e.activeTouch,"page");o=!i.prev||l(i,i.prev)?new Cr(s,s):!i.prev.prev||l(i,i.prev.prev)?t.findWordAt(s):new Cr(te(s.line,0),ae(t.doc,te(s.line+1,0))),t.setSelection(o.anchor,o.head),t.focus(),bt(n)}r()})),dt(e.scroller,"touchcancel",r),dt(e.scroller,"scroll",(function(){e.scroller.clientHeight&&(Bi(t,e.scroller.scrollTop),Oi(t,e.scroller.scrollLeft,!0),ft(t,"scroll",t))})),dt(e.scroller,"mousewheel",(function(e){return wr(t,e)})),dt(e.scroller,"DOMMouseScroll",(function(e){return wr(t,e)})),dt(e.wrapper,"scroll",(function(){return e.wrapper.scrollTop=e.wrapper.scrollLeft=0})),e.dragFunctions={enter:function(e){mt(t,e)||xt(e)},over:function(e){mt(t,e)||(function(t,e){var n=ci(t,e);if(n){var i=document.createDocumentFragment();yi(t,n,i),t.display.dragCursor||(t.display.dragCursor=k("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),t.display.lineSpace.insertBefore(t.display.dragCursor,t.display.cursorDiv)),T(t.display.dragCursor,i)}}(t,e),xt(e))},start:function(e){return function(t,e){if(s&&(!t.state.draggingText||+new Date-Lo<100))xt(e);else if(!mt(t,e)&&!xn(t.display,e)&&(e.dataTransfer.setData("Text",t.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!h)){var n=k("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d&&(n.width=n.height=1,t.display.wrapper.appendChild(n),n._top=n.offsetTop),e.dataTransfer.setDragImage(n,0,0),d&&n.parentNode.removeChild(n)}}(t,e)},drop:tr(t,Io),leave:function(e){mt(t,e)||zo(t)}};var c=e.input.getField();dt(c,"keyup",(function(e){return ds.call(t,e)})),dt(c,"keydown",tr(t,us)),dt(c,"keypress",tr(t,hs)),dt(c,"focus",(function(e){return Ei(t,e)})),dt(c,"blur",(function(e){return Di(t,e)}))}(this),Oo(),Ki(this),this.curOp.forceUpdate=!0,Br(this,i),e.autofocus&&!v||this.hasFocus()?setTimeout((function(){n.hasFocus()&&!n.state.focused&&Ei(n)}),20):Di(this),Es)Es.hasOwnProperty(c)&&Es[c](this,e[c],xs);hr(this),e.finishInit&&e.finishInit(this);for(var u=0;u<Ts.length;++u)Ts[u](this);Gi(this),l&&e.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Ss.defaults=Cs,Ss.optionHandlers=Es;var Ts=[];function ks(t,e,n,i){var r,o=t.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?r=pe(t,e).state:n="prev");var s=t.options.tabSize,a=Kt(o,e),l=N(a.text,null,s);a.stateAfter&&(a.stateAfter=null);var c,u=a.text.match(/^\s*/)[0];if(i||/\S/.test(a.text)){if("smart"==n&&((c=o.mode.indent(r,a.text.slice(u.length),a.text))==F||c>150)){if(!i)return;n="prev"}}else c=0,n="not";"prev"==n?c=e>o.first?N(Kt(o,e-1).text,null,s):0:"add"==n?c=l+t.options.indentUnit:"subtract"==n?c=l-t.options.indentUnit:"number"==typeof n&&(c=l+n),c=Math.max(0,c);var d="",h=0;if(t.options.indentWithTabs)for(var p=Math.floor(c/s);p;--p)h+=s,d+="\t";if(h<c&&(d+=G(c-h)),d!=u)return mo(o,d,te(e,0),te(e,u.length),"+input"),a.stateAfter=null,!0;for(var f=0;f<o.sel.ranges.length;f++){var m=o.sel.ranges[f];if(m.head.line==e&&m.head.ch<u.length){var g=te(e,u.length);Xr(o,f,new Cr(g,g));break}}}Ss.defineInitHook=function(t){return Ts.push(t)};var As=null;function Ps(t){As=t}function Ls(t,e,n,i,r){var o=t.doc;t.display.shift=!1,i||(i=o.sel);var s=+new Date-200,a="paste"==r||t.state.pasteIncoming>s,l=Pt(e),c=null;if(a&&i.ranges.length>1)if(As&&As.text.join("\n")==e){if(i.ranges.length%As.text.length==0){c=[];for(var u=0;u<As.text.length;u++)c.push(o.splitLines(As.text[u]))}}else l.length==i.ranges.length&&t.options.pasteLinesPerSelection&&(c=Y(l,(function(t){return[t]})));for(var d=t.curOp.updateInput,h=i.ranges.length-1;h>=0;h--){var p=i.ranges[h],f=p.from(),m=p.to();p.empty()&&(n&&n>0?f=te(f.line,f.ch-n):t.state.overwrite&&!a?m=te(m.line,Math.min(Kt(o,m.line).text.length,m.ch+$(l).length)):a&&As&&As.lineWise&&As.text.join("\n")==l.join("\n")&&(f=m=te(f.line,0)));var g={from:f,to:m,text:c?c[h%c.length]:l,origin:r||(a?"paste":t.state.cutIncoming>s?"cut":"+input")};co(t.doc,g),ln(t,"inputRead",t,g)}e&&!a&&zs(t,e),Pi(t),t.curOp.updateInput<2&&(t.curOp.updateInput=d),t.curOp.typing=!0,t.state.pasteIncoming=t.state.cutIncoming=-1}function Is(t,e){var n=t.clipboardData&&t.clipboardData.getData("Text");if(n)return t.preventDefault(),e.isReadOnly()||e.options.disableInput||Qi(e,(function(){return Ls(e,n,0,null,"paste")})),!0}function zs(t,e){if(t.options.electricChars&&t.options.smartIndent)for(var n=t.doc.sel,i=n.ranges.length-1;i>=0;i--){var r=n.ranges[i];if(!(r.head.ch>100||i&&n.ranges[i-1].head.line==r.head.line)){var o=t.getModeAt(r.head),s=!1;if(o.electricChars){for(var a=0;a<o.electricChars.length;a++)if(e.indexOf(o.electricChars.charAt(a))>-1){s=ks(t,r.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Kt(t.doc,r.head.line).text.slice(0,r.head.ch))&&(s=ks(t,r.head.line,"smart"));s&&ln(t,"electricInput",t,r.head.line)}}}function Bs(t){for(var e=[],n=[],i=0;i<t.doc.sel.ranges.length;i++){var r=t.doc.sel.ranges[i].head.line,o={anchor:te(r,0),head:te(r+1,0)};n.push(o),e.push(t.getRange(o.anchor,o.head))}return{text:e,ranges:n}}function Rs(t,e,n,i){t.setAttribute("autocorrect",n?"":"off"),t.setAttribute("autocapitalize",i?"":"off"),t.setAttribute("spellcheck",!!e)}function Os(){var t=k("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),e=k("div",[t],null,"overflow: hidden; position: relative; width: 3px; height: 0px;");return l?t.style.width="1000px":t.setAttribute("wrap","off"),m&&(t.style.border="1px solid black"),Rs(t),e}function Ns(t,e,n,i,r){var o=e,s=n,a=Kt(t,e.line),l=r&&"rtl"==t.direction?-n:n;function c(o){var s,c;if("codepoint"==i){var u=a.text.charCodeAt(e.ch+(n>0?0:-1));if(isNaN(u))s=null;else{var d=n>0?u>=55296&&u<56320:u>=56320&&u<57343;s=new te(e.line,Math.max(0,Math.min(a.text.length,e.ch+n*(d?2:1))),-n)}}else s=r?function(t,e,n,i){var r=ct(e,t.doc.direction);if(!r)return Qo(e,n,i);n.ch>=e.text.length?(n.ch=e.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=at(r,n.ch,n.sticky),s=r[o];if("ltr"==t.doc.direction&&s.level%2==0&&(i>0?s.to>n.ch:s.from<n.ch))return Qo(e,n,i);var a,l=function(t,n){return Zo(e,t instanceof te?t.ch:t,n)},c=function(n){return t.options.lineWrapping?(a=a||Ln(t,e),Zn(t,e,a,n)):{begin:0,end:e.text.length}},u=c("before"==n.sticky?l(n,-1):n.ch);if("rtl"==t.doc.direction||1==s.level){var d=1==s.level==i<0,h=l(n,d?1:-1);if(null!=h&&(d?h<=s.to&&h<=u.end:h>=s.from&&h>=u.begin)){var p=d?"before":"after";return new te(n.line,h,p)}}var f=function(t,e,i){for(var o=function(t,e){return e?new te(n.line,l(t,1),"before"):new te(n.line,t,"after")};t>=0&&t<r.length;t+=e){var s=r[t],a=e>0==(1!=s.level),c=a?i.begin:l(i.end,-1);if(s.from<=c&&c<s.to)return o(c,a);if(c=a?s.from:l(s.to,-1),i.begin<=c&&c<i.end)return o(c,a)}},m=f(o+i,i,u);if(m)return m;var g=i>0?u.end:l(u.begin,-1);return null==g||i>0&&g==e.text.length||!(m=f(i>0?0:r.length-1,i,c(g)))?null:m}(t.cm,a,e,n):Qo(a,e,n);if(null==s){if(o||((c=e.line+l)<t.first||c>=t.first+t.size||(e=new te(c,e.ch,e.sticky),!(a=Kt(t,c)))))return!1;e=ts(r,t.cm,a,e.line,l)}else e=s;return!0}if("char"==i||"codepoint"==i)c();else if("column"==i)c(!0);else if("word"==i||"group"==i)for(var u=null,d="group"==i,h=t.cm&&t.cm.getHelper(e,"wordChars"),p=!0;!(n<0)||c(!p);p=!1){var f=a.text.charAt(e.ch)||"\n",m=tt(f,h)?"w":d&&"\n"==f?"n":!d||/\s/.test(f)?null:"p";if(!d||p||m||(m="s"),u&&u!=m){n<0&&(n=1,c(),e.sticky="after");break}if(m&&(u=m),n>0&&!c(!p))break}var g=oo(t,e,o,s,!0);return ne(o,g)&&(g.hitSide=!0),g}function Ws(t,e,n,i){var r,o,s=t.doc,a=e.left;if("page"==i){var l=Math.min(t.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),c=Math.max(l-.5*ii(t.display),3);r=(n>0?e.bottom:e.top)+n*c}else"line"==i&&(r=n>0?e.bottom+3:e.top-3);for(;(o=Xn(t,a,r)).outside;){if(n<0?r<=0:r>=s.height){o.hitSide=!0;break}r+=5*n}return o}var Hs=function(t){this.cm=t,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new W,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Fs(t,e){var n=Pn(t,e.line);if(!n||n.hidden)return null;var i=Kt(t.doc,e.line),r=kn(n,i,e.line),o=ct(i,t.doc.direction),s="left";o&&(s=at(o,e.ch)%2?"right":"left");var a=Rn(r.map,e.ch,s);return a.offset="right"==a.collapse?a.end:a.start,a}function js(t,e){return e&&(t.bad=!0),t}function qs(t,e,n){var i;if(e==t.display.lineDiv){if(!(i=t.display.lineDiv.childNodes[n]))return js(t.clipPos(te(t.display.viewTo-1)),!0);e=null,n=0}else for(i=e;;i=i.parentNode){if(!i||i==t.display.lineDiv)return null;if(i.parentNode&&i.parentNode==t.display.lineDiv)break}for(var r=0;r<t.display.view.length;r++){var o=t.display.view[r];if(o.node==i)return Vs(o,e,n)}}function Vs(t,e,n){var i=t.text.firstChild,r=!1;if(!e||!P(i,e))return js(te(Xt(t.line),0),!0);if(e==i&&(r=!0,e=i.childNodes[n],n=0,!e)){var o=t.rest?$(t.rest):t.line;return js(te(Xt(o),o.text.length),r)}var s=3==e.nodeType?e:null,a=e;for(s||1!=e.childNodes.length||3!=e.firstChild.nodeType||(s=e.firstChild,n&&(n=s.nodeValue.length));a.parentNode!=i;)a=a.parentNode;var l=t.measure,c=l.maps;function u(e,n,i){for(var r=-1;r<(c?c.length:0);r++)for(var o=r<0?l.map:c[r],s=0;s<o.length;s+=3){var a=o[s+2];if(a==e||a==n){var u=Xt(r<0?t.line:t.rest[r]),d=o[s]+i;return(i<0||a!=e)&&(d=o[s+(i?1:0)]),te(u,d)}}}var d=u(s,a,n);if(d)return js(d,r);for(var h=a.nextSibling,p=s?s.nodeValue.length-n:0;h;h=h.nextSibling){if(d=u(h,h.firstChild,0))return js(te(d.line,d.ch-p),r);p+=h.textContent.length}for(var f=a.previousSibling,m=n;f;f=f.previousSibling){if(d=u(f,f.firstChild,-1))return js(te(d.line,d.ch+m),r);m+=f.textContent.length}}Hs.prototype.init=function(t){var e=this,n=this,i=n.cm,r=n.div=t.lineDiv;function o(t){for(var e=t.target;e;e=e.parentNode){if(e==r)return!0;if(/\bCodeMirror-(?:line)?widget\b/.test(e.className))break}return!1}function s(t){if(o(t)&&!mt(i,t)){if(i.somethingSelected())Ps({lineWise:!1,text:i.getSelections()}),"cut"==t.type&&i.replaceSelection("",null,"cut");else{if(!i.options.lineWiseCopyCut)return;var e=Bs(i);Ps({lineWise:!0,text:e.text}),"cut"==t.type&&i.operation((function(){i.setSelections(e.ranges,0,j),i.replaceSelection("",null,"cut")}))}if(t.clipboardData){t.clipboardData.clearData();var s=As.text.join("\n");if(t.clipboardData.setData("Text",s),t.clipboardData.getData("Text")==s)return void t.preventDefault()}var a=Os(),l=a.firstChild;i.display.lineSpace.insertBefore(a,i.display.lineSpace.firstChild),l.value=As.text.join("\n");var c=document.activeElement;B(l),setTimeout((function(){i.display.lineSpace.removeChild(a),c.focus(),c==r&&n.showPrimarySelection()}),50)}}Rs(r,i.options.spellcheck,i.options.autocorrect,i.options.autocapitalize),dt(r,"paste",(function(t){!o(t)||mt(i,t)||Is(t,i)||a<=11&&setTimeout(tr(i,(function(){return e.updateFromDOM()})),20)})),dt(r,"compositionstart",(function(t){e.composing={data:t.data,done:!1}})),dt(r,"compositionupdate",(function(t){e.composing||(e.composing={data:t.data,done:!1})})),dt(r,"compositionend",(function(t){e.composing&&(t.data!=e.composing.data&&e.readFromDOMSoon(),e.composing.done=!0)})),dt(r,"touchstart",(function(){return n.forceCompositionEnd()})),dt(r,"input",(function(){e.composing||e.readFromDOMSoon()})),dt(r,"copy",s),dt(r,"cut",s)},Hs.prototype.screenReaderLabelChanged=function(t){t?this.div.setAttribute("aria-label",t):this.div.removeAttribute("aria-label")},Hs.prototype.prepareSelection=function(){var t=vi(this.cm,!1);return t.focus=document.activeElement==this.div,t},Hs.prototype.showSelection=function(t,e){t&&this.cm.display.view.length&&((t.focus||e)&&this.showPrimarySelection(),this.showMultipleSelections(t))},Hs.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Hs.prototype.showPrimarySelection=function(){var t=this.getSelection(),e=this.cm,i=e.doc.sel.primary(),r=i.from(),o=i.to();if(e.display.viewTo==e.display.viewFrom||r.line>=e.display.viewTo||o.line<e.display.viewFrom)t.removeAllRanges();else{var s=qs(e,t.anchorNode,t.anchorOffset),a=qs(e,t.focusNode,t.focusOffset);if(!s||s.bad||!a||a.bad||0!=ee(oe(s,a),r)||0!=ee(re(s,a),o)){var l=e.display.view,c=r.line>=e.display.viewFrom&&Fs(e,r)||{node:l[0].measure.map[2],offset:0},u=o.line<e.display.viewTo&&Fs(e,o);if(!u){var d=l[l.length-1].measure,h=d.maps?d.maps[d.maps.length-1]:d.map;u={node:h[h.length-1],offset:h[h.length-2]-h[h.length-3]}}if(c&&u){var p,f=t.rangeCount&&t.getRangeAt(0);try{p=D(c.node,c.offset,u.offset,u.node)}catch(t){}p&&(!n&&e.state.focused?(t.collapse(c.node,c.offset),p.collapsed||(t.removeAllRanges(),t.addRange(p))):(t.removeAllRanges(),t.addRange(p)),f&&null==t.anchorNode?t.addRange(f):n&&this.startGracePeriod()),this.rememberSelection()}else t.removeAllRanges()}}},Hs.prototype.startGracePeriod=function(){var t=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){t.gracePeriod=!1,t.selectionChanged()&&t.cm.operation((function(){return t.cm.curOp.selectionChanged=!0}))}),20)},Hs.prototype.showMultipleSelections=function(t){T(this.cm.display.cursorDiv,t.cursors),T(this.cm.display.selectionDiv,t.selection)},Hs.prototype.rememberSelection=function(){var t=this.getSelection();this.lastAnchorNode=t.anchorNode,this.lastAnchorOffset=t.anchorOffset,this.lastFocusNode=t.focusNode,this.lastFocusOffset=t.focusOffset},Hs.prototype.selectionInEditor=function(){var t=this.getSelection();if(!t.rangeCount)return!1;var e=t.getRangeAt(0).commonAncestorContainer;return P(this.div,e)},Hs.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()&&document.activeElement==this.div||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Hs.prototype.blur=function(){this.div.blur()},Hs.prototype.getField=function(){return this.div},Hs.prototype.supportsTouch=function(){return!0},Hs.prototype.receivedFocus=function(){var t=this;this.selectionInEditor()?this.pollSelection():Qi(this.cm,(function(){return t.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,(function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}))},Hs.prototype.selectionChanged=function(){var t=this.getSelection();return t.anchorNode!=this.lastAnchorNode||t.anchorOffset!=this.lastAnchorOffset||t.focusNode!=this.lastFocusNode||t.focusOffset!=this.lastFocusOffset},Hs.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var t=this.getSelection(),e=this.cm;if(g&&u&&this.cm.display.gutterSpecs.length&&function(t){for(var e=t;e;e=e.parentNode)if(/CodeMirror-gutter-wrapper/.test(e.className))return!0;return!1}(t.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus();if(!this.composing){this.rememberSelection();var n=qs(e,t.anchorNode,t.anchorOffset),i=qs(e,t.focusNode,t.focusOffset);n&&i&&Qi(e,(function(){Qr(e.doc,Dr(n,i),j),(n.bad||i.bad)&&(e.curOp.selectionChanged=!0)}))}}},Hs.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null);var t,e,n,i=this.cm,r=i.display,o=i.doc.sel.primary(),s=o.from(),a=o.to();if(0==s.ch&&s.line>i.firstLine()&&(s=te(s.line-1,Kt(i.doc,s.line-1).length)),a.ch==Kt(i.doc,a.line).text.length&&a.line<i.lastLine()&&(a=te(a.line+1,0)),s.line<r.viewFrom||a.line>r.viewTo-1)return!1;s.line==r.viewFrom||0==(t=ui(i,s.line))?(e=Xt(r.view[0].line),n=r.view[0].node):(e=Xt(r.view[t].line),n=r.view[t-1].node.nextSibling);var l,c,u=ui(i,a.line);if(u==r.view.length-1?(l=r.viewTo-1,c=r.lineDiv.lastChild):(l=Xt(r.view[u+1].line)-1,c=r.view[u+1].node.previousSibling),!n)return!1;for(var d=i.doc.splitLines(function(t,e,n,i,r){var o="",s=!1,a=t.doc.lineSeparator(),l=!1;function c(){s&&(o+=a,l&&(o+=a),s=l=!1)}function u(t){t&&(c(),o+=t)}function d(e){if(1==e.nodeType){var n=e.getAttribute("cm-text");if(n)return void u(n);var o,h=e.getAttribute("cm-marker");if(h){var p=t.findMarks(te(i,0),te(r+1,0),(g=+h,function(t){return t.id==g}));return void(p.length&&(o=p[0].find(0))&&u(Gt(t.doc,o.from,o.to).join(a)))}if("false"==e.getAttribute("contenteditable"))return;var f=/^(pre|div|p|li|table|br)$/i.test(e.nodeName);if(!/^br$/i.test(e.nodeName)&&0==e.textContent.length)return;f&&c();for(var m=0;m<e.childNodes.length;m++)d(e.childNodes[m]);/^(pre|p)$/i.test(e.nodeName)&&(l=!0),f&&(s=!0)}else 3==e.nodeType&&u(e.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "));var g}for(;d(e),e!=n;)e=e.nextSibling,l=!1;return o}(i,n,c,e,l)),h=Gt(i.doc,te(e,0),te(l,Kt(i.doc,l).text.length));d.length>1&&h.length>1;)if($(d)==$(h))d.pop(),h.pop(),l--;else{if(d[0]!=h[0])break;d.shift(),h.shift(),e++}for(var p=0,f=0,m=d[0],g=h[0],v=Math.min(m.length,g.length);p<v&&m.charCodeAt(p)==g.charCodeAt(p);)++p;for(var y=$(d),b=$(h),_=Math.min(y.length-(1==d.length?p:0),b.length-(1==h.length?p:0));f<_&&y.charCodeAt(y.length-f-1)==b.charCodeAt(b.length-f-1);)++f;if(1==d.length&&1==h.length&&e==s.line)for(;p&&p>s.ch&&y.charCodeAt(y.length-f-1)==b.charCodeAt(b.length-f-1);)p--,f++;d[d.length-1]=y.slice(0,y.length-f).replace(/^\u200b+/,""),d[0]=d[0].slice(p).replace(/\u200b+$/,"");var w=te(e,p),x=te(l,h.length?$(h).length-f:0);return d.length>1||d[0]||ee(w,x)?(mo(i.doc,d,w,x,"+input"),!0):void 0},Hs.prototype.ensurePolled=function(){this.forceCompositionEnd()},Hs.prototype.reset=function(){this.forceCompositionEnd()},Hs.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Hs.prototype.readFromDOMSoon=function(){var t=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(t.readDOMTimeout=null,t.composing){if(!t.composing.done)return;t.composing=null}t.updateFromDOM()}),80))},Hs.prototype.updateFromDOM=function(){var t=this;!this.cm.isReadOnly()&&this.pollContent()||Qi(this.cm,(function(){return di(t.cm)}))},Hs.prototype.setUneditable=function(t){t.contentEditable="false"},Hs.prototype.onKeyPress=function(t){0==t.charCode||this.composing||(t.preventDefault(),this.cm.isReadOnly()||tr(this.cm,Ls)(this.cm,String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),0))},Hs.prototype.readOnlyChanged=function(t){this.div.contentEditable=String("nocursor"!=t)},Hs.prototype.onContextMenu=function(){},Hs.prototype.resetPosition=function(){},Hs.prototype.needsContentAttribute=!0;var Us=function(t){this.cm=t,this.prevInput="",this.pollingFast=!1,this.polling=new W,this.hasSelection=!1,this.composing=null};Us.prototype.init=function(t){var e=this,n=this,i=this.cm;this.createField(t);var r=this.textarea;function o(t){if(!mt(i,t)){if(i.somethingSelected())Ps({lineWise:!1,text:i.getSelections()});else{if(!i.options.lineWiseCopyCut)return;var e=Bs(i);Ps({lineWise:!0,text:e.text}),"cut"==t.type?i.setSelections(e.ranges,null,j):(n.prevInput="",r.value=e.text.join("\n"),B(r))}"cut"==t.type&&(i.state.cutIncoming=+new Date)}}t.wrapper.insertBefore(this.wrapper,t.wrapper.firstChild),m&&(r.style.width="0px"),dt(r,"input",(function(){s&&a>=9&&e.hasSelection&&(e.hasSelection=null),n.poll()})),dt(r,"paste",(function(t){mt(i,t)||Is(t,i)||(i.state.pasteIncoming=+new Date,n.fastPoll())})),dt(r,"cut",o),dt(r,"copy",o),dt(t.scroller,"paste",(function(e){if(!xn(t,e)&&!mt(i,e)){if(!r.dispatchEvent)return i.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=e.clipboardData,r.dispatchEvent(o)}})),dt(t.lineSpace,"selectstart",(function(e){xn(t,e)||bt(e)})),dt(r,"compositionstart",(function(){var t=i.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:t,range:i.markText(t,i.getCursor("to"),{className:"CodeMirror-composing"})}})),dt(r,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},Us.prototype.createField=function(t){this.wrapper=Os(),this.textarea=this.wrapper.firstChild},Us.prototype.screenReaderLabelChanged=function(t){t?this.textarea.setAttribute("aria-label",t):this.textarea.removeAttribute("aria-label")},Us.prototype.prepareSelection=function(){var t=this.cm,e=t.display,n=t.doc,i=vi(t);if(t.options.moveInputWithCursor){var r=Gn(t,n.sel.primary().head,"div"),o=e.wrapper.getBoundingClientRect(),s=e.lineDiv.getBoundingClientRect();i.teTop=Math.max(0,Math.min(e.wrapper.clientHeight-10,r.top+s.top-o.top)),i.teLeft=Math.max(0,Math.min(e.wrapper.clientWidth-10,r.left+s.left-o.left))}return i},Us.prototype.showSelection=function(t){var e=this.cm.display;T(e.cursorDiv,t.cursors),T(e.selectionDiv,t.selection),null!=t.teTop&&(this.wrapper.style.top=t.teTop+"px",this.wrapper.style.left=t.teLeft+"px")},Us.prototype.reset=function(t){if(!this.contextMenuPending&&!this.composing){var e=this.cm;if(e.somethingSelected()){this.prevInput="";var n=e.getSelection();this.textarea.value=n,e.state.focused&&B(this.textarea),s&&a>=9&&(this.hasSelection=n)}else t||(this.prevInput=this.textarea.value="",s&&a>=9&&(this.hasSelection=null))}},Us.prototype.getField=function(){return this.textarea},Us.prototype.supportsTouch=function(){return!1},Us.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||L()!=this.textarea))try{this.textarea.focus()}catch(t){}},Us.prototype.blur=function(){this.textarea.blur()},Us.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Us.prototype.receivedFocus=function(){this.slowPoll()},Us.prototype.slowPoll=function(){var t=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){t.poll(),t.cm.state.focused&&t.slowPoll()}))},Us.prototype.fastPoll=function(){var t=!1,e=this;e.pollingFast=!0,e.polling.set(20,(function n(){e.poll()||t?(e.pollingFast=!1,e.slowPoll()):(t=!0,e.polling.set(60,n))}))},Us.prototype.poll=function(){var t=this,e=this.cm,n=this.textarea,i=this.prevInput;if(this.contextMenuPending||!e.state.focused||Lt(n)&&!i&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=n.value;if(r==i&&!e.somethingSelected())return!1;if(s&&a>=9&&this.hasSelection===r||y&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var o=r.charCodeAt(0);if(8203!=o||i||(i=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var l=0,c=Math.min(i.length,r.length);l<c&&i.charCodeAt(l)==r.charCodeAt(l);)++l;return Qi(e,(function(){Ls(e,r.slice(l),i.length-l,null,t.composing?"*compose":null),r.length>1e3||r.indexOf("\n")>-1?n.value=t.prevInput="":t.prevInput=r,t.composing&&(t.composing.range.clear(),t.composing.range=e.markText(t.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Us.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Us.prototype.onKeyPress=function(){s&&a>=9&&(this.hasSelection=null),this.fastPoll()},Us.prototype.onContextMenu=function(t){var e=this,n=e.cm,i=n.display,r=e.textarea;e.contextMenuPending&&e.contextMenuPending();var o=ci(n,t),c=i.scroller.scrollTop;if(o&&!d){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&tr(n,Qr)(n.doc,Dr(o),j);var u,h=r.style.cssText,p=e.wrapper.style.cssText,f=e.wrapper.offsetParent.getBoundingClientRect();if(e.wrapper.style.cssText="position: static",r.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(t.clientY-f.top-5)+"px; left: "+(t.clientX-f.left-5)+"px;\n z-index: 1000; background: "+(s?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",l&&(u=window.scrollY),i.input.focus(),l&&window.scrollTo(null,u),i.input.reset(),n.somethingSelected()||(r.value=e.prevInput=" "),e.contextMenuPending=v,i.selForContextMenu=n.doc.sel,clearTimeout(i.detectingSelectAll),s&&a>=9&&g(),C){xt(t);var m=function(){pt(window,"mouseup",m),setTimeout(v,20)};dt(window,"mouseup",m)}else setTimeout(v,50)}function g(){if(null!=r.selectionStart){var t=n.somethingSelected(),o=""+(t?r.value:"");r.value="⇚",r.value=o,e.prevInput=t?"":"",r.selectionStart=1,r.selectionEnd=o.length,i.selForContextMenu=n.doc.sel}}function v(){if(e.contextMenuPending==v&&(e.contextMenuPending=!1,e.wrapper.style.cssText=p,r.style.cssText=h,s&&a<9&&i.scrollbars.setScrollTop(i.scroller.scrollTop=c),null!=r.selectionStart)){(!s||s&&a<9)&&g();var t=0,o=function(){i.selForContextMenu==n.doc.sel&&0==r.selectionStart&&r.selectionEnd>0&&""==e.prevInput?tr(n,ao)(n):t++<10?i.detectingSelectAll=setTimeout(o,500):(i.selForContextMenu=null,i.input.reset())};i.detectingSelectAll=setTimeout(o,200)}}},Us.prototype.readOnlyChanged=function(t){t||this.reset(),this.textarea.disabled="nocursor"==t,this.textarea.readOnly=!!t},Us.prototype.setUneditable=function(){},Us.prototype.needsContentAttribute=!1,function(t){var e=t.optionHandlers;function n(n,i,r,o){t.defaults[n]=i,r&&(e[n]=o?function(t,e,n){n!=xs&&r(t,e,n)}:r)}t.defineOption=n,t.Init=xs,n("value","",(function(t,e){return t.setValue(e)}),!0),n("mode",null,(function(t,e){t.doc.modeOption=e,Ar(t)}),!0),n("indentUnit",2,Ar,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(t){Pr(t),Hn(t),di(t)}),!0),n("lineSeparator",null,(function(t,e){if(t.doc.lineSep=e,e){var n=[],i=t.doc.first;t.doc.iter((function(t){for(var r=0;;){var o=t.text.indexOf(e,r);if(-1==o)break;r=o+e.length,n.push(te(i,o))}i++}));for(var r=n.length-1;r>=0;r--)mo(t.doc,e,n[r],te(n[r].line,n[r].ch+e.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(t,e,n){t.state.specialChars=new RegExp(e.source+(e.test("\t")?"":"|\t"),"g"),n!=xs&&t.refresh()})),n("specialCharPlaceholder",Ze,(function(t){return t.refresh()}),!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(t,e){return t.getInputField().spellcheck=e}),!0),n("autocorrect",!1,(function(t,e){return t.getInputField().autocorrect=e}),!0),n("autocapitalize",!1,(function(t,e){return t.getInputField().autocapitalize=e}),!0),n("rtlMoveVisually",!_),n("wholeLineUpdateBefore",!0),n("theme","default",(function(t){ws(t),mr(t)}),!0),n("keyMap","default",(function(t,e,n){var i=Xo(e),r=n!=xs&&Xo(n);r&&r.detach&&r.detach(t,i),i.attach&&i.attach(t,r||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Ms,!0),n("gutters",[],(function(t,e){t.display.gutterSpecs=pr(e,t.options.lineNumbers),mr(t)}),!0),n("fixedGutter",!0,(function(t,e){t.display.gutters.style.left=e?si(t.display)+"px":"0",t.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(t){return Fi(t)}),!0),n("scrollbarStyle","native",(function(t){Vi(t),Fi(t),t.display.scrollbars.setScrollTop(t.doc.scrollTop),t.display.scrollbars.setScrollLeft(t.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(t,e){t.display.gutterSpecs=pr(t.options.gutters,e),mr(t)}),!0),n("firstLineNumber",1,mr,!0),n("lineNumberFormatter",(function(t){return t}),mr,!0),n("showCursorWhenSelecting",!1,gi,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(t,e){"nocursor"==e&&(Di(t),t.display.input.blur()),t.display.input.readOnlyChanged(e)})),n("screenReaderLabel",null,(function(t,e){e=""===e?null:e,t.display.input.screenReaderLabelChanged(e)})),n("disableInput",!1,(function(t,e){e||t.display.input.reset()}),!0),n("dragDrop",!0,Ds),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,gi,!0),n("singleCursorHeightPerLine",!0,gi,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Pr,!0),n("addModeClass",!1,Pr,!0),n("pollInterval",100),n("undoDepth",200,(function(t,e){return t.doc.history.undoDepth=e})),n("historyEventDelay",1250),n("viewportMargin",10,(function(t){return t.refresh()}),!0),n("maxHighlightLength",1e4,Pr,!0),n("moveInputWithCursor",!0,(function(t,e){e||t.display.input.resetPosition()})),n("tabindex",null,(function(t,e){return t.display.input.getField().tabIndex=e||""})),n("autofocus",null),n("direction","ltr",(function(t,e){return t.doc.setDirection(e)}),!0),n("phrases",null)}(Ss),function(t){var e=t.optionHandlers,n=t.helpers={};t.prototype={constructor:t,focus:function(){window.focus(),this.display.input.focus()},setOption:function(t,n){var i=this.options,r=i[t];i[t]==n&&"mode"!=t||(i[t]=n,e.hasOwnProperty(t)&&tr(this,e[t])(this,n,r),ft(this,"optionChange",this,t))},getOption:function(t){return this.options[t]},getDoc:function(){return this.doc},addKeyMap:function(t,e){this.state.keyMaps[e?"push":"unshift"](Xo(t))},removeKeyMap:function(t){for(var e=this.state.keyMaps,n=0;n<e.length;++n)if(e[n]==t||e[n].name==t)return e.splice(n,1),!0},addOverlay:er((function(e,n){var i=e.token?e:t.getMode(this.options,e);if(i.startState)throw new Error("Overlays may not be stateful.");(function(t,e,n){for(var i=0,r=n(e);i<t.length&&n(t[i])<=r;)i++;t.splice(i,0,e)})(this.state.overlays,{mode:i,modeSpec:e,opaque:n&&n.opaque,priority:n&&n.priority||0},(function(t){return t.priority})),this.state.modeGen++,di(this)})),removeOverlay:er((function(t){for(var e=this.state.overlays,n=0;n<e.length;++n){var i=e[n].modeSpec;if(i==t||"string"==typeof t&&i.name==t)return e.splice(n,1),this.state.modeGen++,void di(this)}})),indentLine:er((function(t,e,n){"string"!=typeof e&&"number"!=typeof e&&(e=null==e?this.options.smartIndent?"smart":"prev":e?"add":"subtract"),Zt(this.doc,t)&&ks(this,t,e,n)})),indentSelection:er((function(t){for(var e=this.doc.sel.ranges,n=-1,i=0;i<e.length;i++){var r=e[i];if(r.empty())r.head.line>n&&(ks(this,r.head.line,t,!0),n=r.head.line,i==this.doc.sel.primIndex&&Pi(this));else{var o=r.from(),s=r.to(),a=Math.max(n,o.line);n=Math.min(this.lastLine(),s.line-(s.ch?0:1))+1;for(var l=a;l<n;++l)ks(this,l,t);var c=this.doc.sel.ranges;0==o.ch&&e.length==c.length&&c[i].from().ch>0&&Xr(this.doc,i,new Cr(o,c[i].to()),j)}}})),getTokenAt:function(t,e){return ye(this,t,e)},getLineTokens:function(t,e){return ye(this,te(t),e,!0)},getTokenTypeAt:function(t){t=ae(this.doc,t);var e,n=he(this,Kt(this.doc,t.line)),i=0,r=(n.length-1)/2,o=t.ch;if(0==o)e=n[2];else for(;;){var s=i+r>>1;if((s?n[2*s-1]:0)>=o)r=s;else{if(!(n[2*s+1]<o)){e=n[2*s+2];break}i=s+1}}var a=e?e.indexOf("overlay "):-1;return a<0?e:0==a?null:e.slice(0,a-1)},getModeAt:function(e){var n=this.doc.mode;return n.innerMode?t.innerMode(n,this.getTokenAt(e).state).mode:n},getHelper:function(t,e){return this.getHelpers(t,e)[0]},getHelpers:function(t,e){var i=[];if(!n.hasOwnProperty(e))return i;var r=n[e],o=this.getModeAt(t);if("string"==typeof o[e])r[o[e]]&&i.push(r[o[e]]);else if(o[e])for(var s=0;s<o[e].length;s++){var a=r[o[e][s]];a&&i.push(a)}else o.helperType&&r[o.helperType]?i.push(r[o.helperType]):r[o.name]&&i.push(r[o.name]);for(var l=0;l<r._global.length;l++){var c=r._global[l];c.pred(o,this)&&-1==H(i,c.val)&&i.push(c.val)}return i},getStateAfter:function(t,e){var n=this.doc;return pe(this,(t=se(n,null==t?n.first+n.size-1:t))+1,e).state},cursorCoords:function(t,e){var n=this.doc.sel.primary();return Gn(this,null==t?n.head:"object"==typeof t?ae(this.doc,t):t?n.from():n.to(),e||"page")},charCoords:function(t,e){return Kn(this,ae(this.doc,t),e||"page")},coordsChar:function(t,e){return Xn(this,(t=Un(this,t,e||"page")).left,t.top)},lineAtHeight:function(t,e){return t=Un(this,{top:t,left:0},e||"page").top,Jt(this.doc,t+this.display.viewOffset)},heightAtLine:function(t,e,n){var i,r=!1;if("number"==typeof t){var o=this.doc.first+this.doc.size-1;t<this.doc.first?t=this.doc.first:t>o&&(t=o,r=!0),i=Kt(this.doc,t)}else i=t;return Vn(this,i,{top:0,left:0},e||"page",n||r).top+(r?this.doc.height-qe(i):0)},defaultTextHeight:function(){return ii(this.display)},defaultCharWidth:function(){return ri(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(t,e,n,i,r){var o,s,a,l=this.display,c=(t=Gn(this,ae(this.doc,t))).bottom,u=t.left;if(e.style.position="absolute",e.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(e),l.sizer.appendChild(e),"over"==i)c=t.top;else if("above"==i||"near"==i){var d=Math.max(l.wrapper.clientHeight,this.doc.height),h=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==i||t.bottom+e.offsetHeight>d)&&t.top>e.offsetHeight?c=t.top-e.offsetHeight:t.bottom+e.offsetHeight<=d&&(c=t.bottom),u+e.offsetWidth>h&&(u=h-e.offsetWidth)}e.style.top=c+"px",e.style.left=e.style.right="","right"==r?(u=l.sizer.clientWidth-e.offsetWidth,e.style.right="0px"):("left"==r?u=0:"middle"==r&&(u=(l.sizer.clientWidth-e.offsetWidth)/2),e.style.left=u+"px"),n&&(o=this,s={left:u,top:c,right:u+e.offsetWidth,bottom:c+e.offsetHeight},null!=(a=ki(o,s)).scrollTop&&Bi(o,a.scrollTop),null!=a.scrollLeft&&Oi(o,a.scrollLeft))},triggerOnKeyDown:er(us),triggerOnKeyPress:er(hs),triggerOnKeyUp:ds,triggerOnMouseDown:er(gs),execCommand:function(t){if(es.hasOwnProperty(t))return es[t].call(null,this)},triggerElectric:er((function(t){zs(this,t)})),findPosH:function(t,e,n,i){var r=1;e<0&&(r=-1,e=-e);for(var o=ae(this.doc,t),s=0;s<e&&!(o=Ns(this.doc,o,r,n,i)).hitSide;++s);return o},moveH:er((function(t,e){var n=this;this.extendSelectionsBy((function(i){return n.display.shift||n.doc.extend||i.empty()?Ns(n.doc,i.head,t,e,n.options.rtlMoveVisually):t<0?i.from():i.to()}),V)})),deleteH:er((function(t,e){var n=this.doc.sel,i=this.doc;n.somethingSelected()?i.replaceSelection("",null,"+delete"):Jo(this,(function(n){var r=Ns(i,n.head,t,e,!1);return t<0?{from:r,to:n.head}:{from:n.head,to:r}}))})),findPosV:function(t,e,n,i){var r=1,o=i;e<0&&(r=-1,e=-e);for(var s=ae(this.doc,t),a=0;a<e;++a){var l=Gn(this,s,"div");if(null==o?o=l.left:l.left=o,(s=Ws(this,l,r,n)).hitSide)break}return s},moveV:er((function(t,e){var n=this,i=this.doc,r=[],o=!this.display.shift&&!i.extend&&i.sel.somethingSelected();if(i.extendSelectionsBy((function(s){if(o)return t<0?s.from():s.to();var a=Gn(n,s.head,"div");null!=s.goalColumn&&(a.left=s.goalColumn),r.push(a.left);var l=Ws(n,a,t,e);return"page"==e&&s==i.sel.primary()&&Ai(n,Kn(n,l,"div").top-a.top),l}),V),r.length)for(var s=0;s<i.sel.ranges.length;s++)i.sel.ranges[s].goalColumn=r[s]})),findWordAt:function(t){var e=Kt(this.doc,t.line).text,n=t.ch,i=t.ch;if(e){var r=this.getHelper(t,"wordChars");"before"!=t.sticky&&i!=e.length||!n?++i:--n;for(var o=e.charAt(n),s=tt(o,r)?function(t){return tt(t,r)}:/\s/.test(o)?function(t){return/\s/.test(t)}:function(t){return!/\s/.test(t)&&!tt(t)};n>0&&s(e.charAt(n-1));)--n;for(;i<e.length&&s(e.charAt(i));)++i}return new Cr(te(t.line,n),te(t.line,i))},toggleOverwrite:function(t){null!=t&&t==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?I(this.display.cursorDiv,"CodeMirror-overwrite"):M(this.display.cursorDiv,"CodeMirror-overwrite"),ft(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==L()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:er((function(t,e){Li(this,t,e)})),getScrollInfo:function(){var t=this.display.scroller;return{left:t.scrollLeft,top:t.scrollTop,height:t.scrollHeight-Mn(this)-this.display.barHeight,width:t.scrollWidth-Mn(this)-this.display.barWidth,clientHeight:Tn(this),clientWidth:Sn(this)}},scrollIntoView:er((function(t,e){null==t?(t={from:this.doc.sel.primary().head,to:null},null==e&&(e=this.options.cursorScrollMargin)):"number"==typeof t?t={from:te(t,0),to:null}:null==t.from&&(t={from:t,to:null}),t.to||(t.to=t.from),t.margin=e||0,null!=t.from.line?function(t,e){Ii(t),t.curOp.scrollToPos=e}(this,t):zi(this,t.from,t.to,t.margin)})),setSize:er((function(t,e){var n=this,i=function(t){return"number"==typeof t||/^\d+$/.test(String(t))?t+"px":t};null!=t&&(this.display.wrapper.style.width=i(t)),null!=e&&(this.display.wrapper.style.height=i(e)),this.options.lineWrapping&&Wn(this);var r=this.display.viewFrom;this.doc.iter(r,this.display.viewTo,(function(t){if(t.widgets)for(var e=0;e<t.widgets.length;e++)if(t.widgets[e].noHScroll){hi(n,r,"widget");break}++r})),this.curOp.forceUpdate=!0,ft(this,"refresh",this)})),operation:function(t){return Qi(this,t)},startOperation:function(){return Ki(this)},endOperation:function(){return Gi(this)},refresh:er((function(){var t=this.display.cachedTextHeight;di(this),this.curOp.forceUpdate=!0,Hn(this),Li(this,this.doc.scrollLeft,this.doc.scrollTop),cr(this.display),(null==t||Math.abs(t-ii(this.display))>.5||this.options.lineWrapping)&&li(this),ft(this,"refresh",this)})),swapDoc:er((function(t){var e=this.doc;return e.cm=null,this.state.selectingText&&this.state.selectingText(),Br(this,t),Hn(this),this.display.input.reset(),Li(this,t.scrollLeft,t.scrollTop),this.curOp.forceScroll=!0,ln(this,"swapDoc",this,e),e})),phrase:function(t){var e=this.options.phrases;return e&&Object.prototype.hasOwnProperty.call(e,t)?e[t]:t},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},yt(t),t.registerHelper=function(e,i,r){n.hasOwnProperty(e)||(n[e]=t[e]={_global:[]}),n[e][i]=r},t.registerGlobalHelper=function(e,i,r,o){t.registerHelper(e,i,o),n[e]._global.push({pred:r,val:o})}}(Ss);var Ks="iter insert remove copy getEditor constructor".split(" ");for(var Gs in Po.prototype)Po.prototype.hasOwnProperty(Gs)&&H(Ks,Gs)<0&&(Ss.prototype[Gs]=function(t){return function(){return t.apply(this.doc,arguments)}}(Po.prototype[Gs]));return yt(Po),Ss.inputStyles={textarea:Us,contenteditable:Hs},Ss.defineMode=function(t){Ss.defaults.mode||"null"==t||(Ss.defaults.mode=t),Ot.apply(this,arguments)},Ss.defineMIME=function(t,e){Rt[t]=e},Ss.defineMode("null",(function(){return{token:function(t){return t.skipToEnd()}}})),Ss.defineMIME("text/plain","null"),Ss.defineExtension=function(t,e){Ss.prototype[t]=e},Ss.defineDocExtension=function(t,e){Po.prototype[t]=e},Ss.fromTextArea=function(t,e){if((e=e?O(e):{}).value=t.value,!e.tabindex&&t.tabIndex&&(e.tabindex=t.tabIndex),!e.placeholder&&t.placeholder&&(e.placeholder=t.placeholder),null==e.autofocus){var n=L();e.autofocus=n==t||null!=t.getAttribute("autofocus")&&n==document.body}function i(){t.value=a.getValue()}var r;if(t.form&&(dt(t.form,"submit",i),!e.leaveSubmitMethodAlone)){var o=t.form;r=o.submit;try{var s=o.submit=function(){i(),o.submit=r,o.submit(),o.submit=s}}catch(t){}}e.finishInit=function(n){n.save=i,n.getTextArea=function(){return t},n.toTextArea=function(){n.toTextArea=isNaN,i(),t.parentNode.removeChild(n.getWrapperElement()),t.style.display="",t.form&&(pt(t.form,"submit",i),e.leaveSubmitMethodAlone||"function"!=typeof t.form.submit||(t.form.submit=r))}},t.style.display="none";var a=Ss((function(e){return t.parentNode.insertBefore(e,t.nextSibling)}),e);return a},function(t){t.off=pt,t.on=dt,t.wheelEventPixels=_r,t.Doc=Po,t.splitLines=Pt,t.countColumn=N,t.findColumn=U,t.isWordChar=Q,t.Pass=F,t.signal=ft,t.Line=Ke,t.changeEnd=Mr,t.scrollbarModel=qi,t.Pos=te,t.cmpPos=ee,t.modes=Bt,t.mimeModes=Rt,t.resolveMode=Nt,t.getMode=Wt,t.modeExtensions=Ht,t.extendMode=Ft,t.copyState=jt,t.startState=Vt,t.innerMode=qt,t.commands=es,t.keyMap=qo,t.keyName=Yo,t.isModifierKey=Go,t.lookupKey=Ko,t.normalizeKeyMap=Uo,t.StringStream=Ut,t.SharedTextMarker=So,t.TextMarker=Do,t.LineWidget=xo,t.e_preventDefault=bt,t.e_stopPropagation=_t,t.e_stop=xt,t.addClass=I,t.contains=P,t.rmClass=M,t.keyNames=Wo}(Ss),Ss.version="5.59.2",Ss}()},489:(t,e,n)=>{!function(t){"use strict";t.defineMode("javascript",(function(e,n){var i,r,o=e.indentUnit,s=n.statementIndent,a=n.jsonld,l=n.json||a,c=n.typescript,u=n.wordCharacters||/[\w$\xa1-\uffff]/,d=function(){function t(t){return{type:t,style:"keyword"}}var e=t("keyword a"),n=t("keyword b"),i=t("keyword c"),r=t("keyword d"),o=t("operator"),s={type:"atom",style:"atom"};return{if:t("if"),while:e,with:e,else:n,do:n,try:n,finally:n,return:r,break:r,continue:r,new:t("new"),delete:i,void:i,throw:i,debugger:t("debugger"),var:t("var"),const:t("var"),let:t("var"),function:t("function"),catch:t("catch"),for:t("for"),switch:t("switch"),case:t("case"),default:t("default"),in:o,typeof:o,instanceof:o,true:s,false:s,null:s,undefined:s,NaN:s,Infinity:s,this:t("this"),class:t("class"),super:t("atom"),yield:i,export:t("export"),import:t("import"),extends:i,await:i}}(),h=/[+\-*&%=<>!?|~^@]/,p=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;function f(t,e,n){return i=t,r=n,e}function m(t,e){var n,i=t.next();if('"'==i||"'"==i)return e.tokenize=(n=i,function(t,e){var i,r=!1;if(a&&"@"==t.peek()&&t.match(p))return e.tokenize=m,f("jsonld-keyword","meta");for(;null!=(i=t.next())&&(i!=n||r);)r=!r&&"\\"==i;return r||(e.tokenize=m),f("string","string")}),e.tokenize(t,e);if("."==i&&t.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/))return f("number","number");if("."==i&&t.match(".."))return f("spread","meta");if(/[\[\]{}\(\),;\:\.]/.test(i))return f(i);if("="==i&&t.eat(">"))return f("=>","operator");if("0"==i&&t.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return f("number","number");if(/\d/.test(i))return t.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),f("number","number");if("/"==i)return t.eat("*")?(e.tokenize=g,g(t,e)):t.eat("/")?(t.skipToEnd(),f("comment","comment")):Yt(t,e,1)?(function(t){for(var e,n=!1,i=!1;null!=(e=t.next());){if(!n){if("/"==e&&!i)return;"["==e?i=!0:i&&"]"==e&&(i=!1)}n=!n&&"\\"==e}}(t),t.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),f("regexp","string-2")):(t.eat("="),f("operator","operator",t.current()));if("`"==i)return e.tokenize=v,v(t,e);if("#"==i&&"!"==t.peek())return t.skipToEnd(),f("meta","meta");if("#"==i&&t.eatWhile(u))return f("variable","property");if("<"==i&&t.match("!--")||"-"==i&&t.match("->")&&!/\S/.test(t.string.slice(0,t.start)))return t.skipToEnd(),f("comment","comment");if(h.test(i))return">"==i&&e.lexical&&">"==e.lexical.type||(t.eat("=")?"!"!=i&&"="!=i||t.eat("="):/[<>*+\-|&?]/.test(i)&&(t.eat(i),">"==i&&t.eat(i))),"?"==i&&t.eat(".")?f("."):f("operator","operator",t.current());if(u.test(i)){t.eatWhile(u);var r=t.current();if("."!=e.lastType){if(d.propertyIsEnumerable(r)){var o=d[r];return f(o.type,o.style,r)}if("async"==r&&t.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/,!1))return f("async","keyword",r)}return f("variable","variable",r)}}function g(t,e){for(var n,i=!1;n=t.next();){if("/"==n&&i){e.tokenize=m;break}i="*"==n}return f("comment","comment")}function v(t,e){for(var n,i=!1;null!=(n=t.next());){if(!i&&("`"==n||"$"==n&&t.eat("{"))){e.tokenize=m;break}i=!i&&"\\"==n}return f("quasi","string-2",t.current())}function y(t,e){e.fatArrowAt&&(e.fatArrowAt=null);var n=t.string.indexOf("=>",t.start);if(!(n<0)){if(c){var i=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(t.string.slice(t.start,n));i&&(n=i.index)}for(var r=0,o=!1,s=n-1;s>=0;--s){var a=t.string.charAt(s),l="([{}])".indexOf(a);if(l>=0&&l<3){if(!r){++s;break}if(0==--r){"("==a&&(o=!0);break}}else if(l>=3&&l<6)++r;else if(u.test(a))o=!0;else if(/["'\/`]/.test(a))for(;;--s){if(0==s)return;if(t.string.charAt(s-1)==a&&"\\"!=t.string.charAt(s-2)){s--;break}}else if(o&&!r){++s;break}}o&&!r&&(e.fatArrowAt=s)}}var b={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0};function _(t,e,n,i,r,o){this.indented=t,this.column=e,this.type=n,this.prev=r,this.info=o,null!=i&&(this.align=i)}function w(t,e){for(var n=t.localVars;n;n=n.next)if(n.name==e)return!0;for(var i=t.context;i;i=i.prev)for(n=i.vars;n;n=n.next)if(n.name==e)return!0}var x={state:null,column:null,marked:null,cc:null};function C(){for(var t=arguments.length-1;t>=0;t--)x.cc.push(arguments[t])}function E(){return C.apply(null,arguments),!0}function D(t,e){for(var n=e;n;n=n.next)if(n.name==t)return!0;return!1}function M(t){var e=x.state;if(x.marked="def",e.context)if("var"==e.lexical.info&&e.context&&e.context.block){var i=S(t,e.context);if(null!=i)return void(e.context=i)}else if(!D(t,e.localVars))return void(e.localVars=new A(t,e.localVars));n.globalVars&&!D(t,e.globalVars)&&(e.globalVars=new A(t,e.globalVars))}function S(t,e){if(e){if(e.block){var n=S(t,e.prev);return n?n==e.prev?e:new k(n,e.vars,!0):null}return D(t,e.vars)?e:new k(e.prev,new A(t,e.vars),!1)}return null}function T(t){return"public"==t||"private"==t||"protected"==t||"abstract"==t||"readonly"==t}function k(t,e,n){this.prev=t,this.vars=e,this.block=n}function A(t,e){this.name=t,this.next=e}var P=new A("this",new A("arguments",null));function L(){x.state.context=new k(x.state.context,x.state.localVars,!1),x.state.localVars=P}function I(){x.state.context=new k(x.state.context,x.state.localVars,!0),x.state.localVars=null}function z(){x.state.localVars=x.state.context.vars,x.state.context=x.state.context.prev}function B(t,e){var n=function(){var n=x.state,i=n.indented;if("stat"==n.lexical.type)i=n.lexical.indented;else for(var r=n.lexical;r&&")"==r.type&&r.align;r=r.prev)i=r.indented;n.lexical=new _(i,x.stream.column(),t,null,n.lexical,e)};return n.lex=!0,n}function R(){var t=x.state;t.lexical.prev&&(")"==t.lexical.type&&(t.indented=t.lexical.indented),t.lexical=t.lexical.prev)}function O(t){return function e(n){return n==t?E():";"==t||"}"==n||")"==n||"]"==n?C():E(e)}}function N(t,e){return"var"==t?E(B("vardef",e),_t,O(";"),R):"keyword a"==t?E(B("form"),j,N,R):"keyword b"==t?E(B("form"),N,R):"keyword d"==t?x.stream.match(/^\s*$/,!1)?E():E(B("stat"),V,O(";"),R):"debugger"==t?E(O(";")):"{"==t?E(B("}"),I,st,R,z):";"==t?E():"if"==t?("else"==x.state.lexical.info&&x.state.cc[x.state.cc.length-1]==R&&x.state.cc.pop()(),E(B("form"),j,N,R,Mt)):"function"==t?E(At):"for"==t?E(B("form"),St,N,R):"class"==t||c&&"interface"==e?(x.marked="keyword",E(B("form","class"==t?t:e),Bt,R)):"variable"==t?c&&"declare"==e?(x.marked="keyword",E(N)):c&&("module"==e||"enum"==e||"type"==e)&&x.stream.match(/^\s*\w/,!1)?(x.marked="keyword","enum"==e?E(Gt):"type"==e?E(Lt,O("operator"),dt,O(";")):E(B("form"),wt,O("{"),B("}"),st,R,R)):c&&"namespace"==e?(x.marked="keyword",E(B("form"),H,N,R)):c&&"abstract"==e?(x.marked="keyword",E(N)):E(B("stat"),Q):"switch"==t?E(B("form"),j,O("{"),B("}","switch"),I,st,R,R,z):"case"==t?E(H,O(":")):"default"==t?E(O(":")):"catch"==t?E(B("form"),L,W,N,R,z):"export"==t?E(B("stat"),Wt,R):"import"==t?E(B("stat"),Ft,R):"async"==t?E(N):"@"==e?E(H,N):C(B("stat"),H,O(";"),R)}function W(t){if("("==t)return E(It,O(")"))}function H(t,e){return q(t,e,!1)}function F(t,e){return q(t,e,!0)}function j(t){return"("!=t?C():E(B(")"),V,O(")"),R)}function q(t,e,n){if(x.state.fatArrowAt==x.stream.start){var i=n?X:Y;if("("==t)return E(L,B(")"),rt(It,")"),R,O("=>"),i,z);if("variable"==t)return C(L,wt,O("=>"),i,z)}var r=n?K:U;return b.hasOwnProperty(t)?E(r):"function"==t?E(At,r):"class"==t||c&&"interface"==e?(x.marked="keyword",E(B("form"),zt,R)):"keyword c"==t||"async"==t?E(n?F:H):"("==t?E(B(")"),V,O(")"),R,r):"operator"==t||"spread"==t?E(n?F:H):"["==t?E(B("]"),Kt,R,r):"{"==t?ot(et,"}",null,r):"quasi"==t?C(G,r):"new"==t?E(function(t){return function(e){return"."==e?E(t?Z:J):"variable"==e&&c?E(vt,t?K:U):C(t?F:H)}}(n)):"import"==t?E(H):E()}function V(t){return t.match(/[;\}\)\],]/)?C():C(H)}function U(t,e){return","==t?E(V):K(t,e,!1)}function K(t,e,n){var i=0==n?U:K,r=0==n?H:F;return"=>"==t?E(L,n?X:Y,z):"operator"==t?/\+\+|--/.test(e)||c&&"!"==e?E(i):c&&"<"==e&&x.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/,!1)?E(B(">"),rt(dt,">"),R,i):"?"==e?E(H,O(":"),r):E(r):"quasi"==t?C(G,i):";"!=t?"("==t?ot(F,")","call",i):"."==t?E(tt,i):"["==t?E(B("]"),V,O("]"),R,i):c&&"as"==e?(x.marked="keyword",E(dt,i)):"regexp"==t?(x.state.lastType=x.marked="operator",x.stream.backUp(x.stream.pos-x.stream.start-1),E(r)):void 0:void 0}function G(t,e){return"quasi"!=t?C():"${"!=e.slice(e.length-2)?E(G):E(H,$)}function $(t){if("}"==t)return x.marked="string-2",x.state.tokenize=v,E(G)}function Y(t){return y(x.stream,x.state),C("{"==t?N:H)}function X(t){return y(x.stream,x.state),C("{"==t?N:F)}function J(t,e){if("target"==e)return x.marked="keyword",E(U)}function Z(t,e){if("target"==e)return x.marked="keyword",E(K)}function Q(t){return":"==t?E(R,N):C(U,O(";"),R)}function tt(t){if("variable"==t)return x.marked="property",E()}function et(t,e){return"async"==t?(x.marked="property",E(et)):"variable"==t||"keyword"==x.style?(x.marked="property","get"==e||"set"==e?E(nt):(c&&x.state.fatArrowAt==x.stream.start&&(n=x.stream.match(/^\s*:\s*/,!1))&&(x.state.fatArrowAt=x.stream.pos+n[0].length),E(it))):"number"==t||"string"==t?(x.marked=a?"property":x.style+" property",E(it)):"jsonld-keyword"==t?E(it):c&&T(e)?(x.marked="keyword",E(et)):"["==t?E(H,at,O("]"),it):"spread"==t?E(F,it):"*"==e?(x.marked="keyword",E(et)):":"==t?C(it):void 0;var n}function nt(t){return"variable"!=t?C(it):(x.marked="property",E(At))}function it(t){return":"==t?E(F):"("==t?C(At):void 0}function rt(t,e,n){function i(r,o){if(n?n.indexOf(r)>-1:","==r){var s=x.state.lexical;return"call"==s.info&&(s.pos=(s.pos||0)+1),E((function(n,i){return n==e||i==e?C():C(t)}),i)}return r==e||o==e?E():n&&n.indexOf(";")>-1?C(t):E(O(e))}return function(n,r){return n==e||r==e?E():C(t,i)}}function ot(t,e,n){for(var i=3;i<arguments.length;i++)x.cc.push(arguments[i]);return E(B(e,n),rt(t,e),R)}function st(t){return"}"==t?E():C(N,st)}function at(t,e){if(c){if(":"==t)return E(dt);if("?"==e)return E(at)}}function lt(t,e){if(c&&(":"==t||"in"==e))return E(dt)}function ct(t){if(c&&":"==t)return x.stream.match(/^\s*\w+\s+is\b/,!1)?E(H,ut,dt):E(dt)}function ut(t,e){if("is"==e)return x.marked="keyword",E()}function dt(t,e){return"keyof"==e||"typeof"==e||"infer"==e?(x.marked="keyword",E("typeof"==e?F:dt)):"variable"==t||"void"==e?(x.marked="type",E(gt)):"|"==e||"&"==e?E(dt):"string"==t||"number"==t||"atom"==t?E(gt):"["==t?E(B("]"),rt(dt,"]",","),R,gt):"{"==t?E(B("}"),pt,R,gt):"("==t?E(rt(mt,")"),ht,gt):"<"==t?E(rt(dt,">"),dt):void 0}function ht(t){if("=>"==t)return E(dt)}function pt(t){return t.match(/[\}\)\]]/)?E():","==t||";"==t?E(pt):C(ft,pt)}function ft(t,e){return"variable"==t||"keyword"==x.style?(x.marked="property",E(ft)):"?"==e||"number"==t||"string"==t?E(ft):":"==t?E(dt):"["==t?E(O("variable"),lt,O("]"),ft):"("==t?C(Pt,ft):t.match(/[;\}\)\],]/)?void 0:E()}function mt(t,e){return"variable"==t&&x.stream.match(/^\s*[?:]/,!1)||"?"==e?E(mt):":"==t?E(dt):"spread"==t?E(mt):C(dt)}function gt(t,e){return"<"==e?E(B(">"),rt(dt,">"),R,gt):"|"==e||"."==t||"&"==e?E(dt):"["==t?E(dt,O("]"),gt):"extends"==e||"implements"==e?(x.marked="keyword",E(dt)):"?"==e?E(dt,O(":"),dt):void 0}function vt(t,e){if("<"==e)return E(B(">"),rt(dt,">"),R,gt)}function yt(){return C(dt,bt)}function bt(t,e){if("="==e)return E(dt)}function _t(t,e){return"enum"==e?(x.marked="keyword",E(Gt)):C(wt,at,Et,Dt)}function wt(t,e){return c&&T(e)?(x.marked="keyword",E(wt)):"variable"==t?(M(e),E()):"spread"==t?E(wt):"["==t?ot(Ct,"]"):"{"==t?ot(xt,"}"):void 0}function xt(t,e){return"variable"!=t||x.stream.match(/^\s*:/,!1)?("variable"==t&&(x.marked="property"),"spread"==t?E(wt):"}"==t?C():"["==t?E(H,O("]"),O(":"),xt):E(O(":"),wt,Et)):(M(e),E(Et))}function Ct(){return C(wt,Et)}function Et(t,e){if("="==e)return E(F)}function Dt(t){if(","==t)return E(_t)}function Mt(t,e){if("keyword b"==t&&"else"==e)return E(B("form","else"),N,R)}function St(t,e){return"await"==e?E(St):"("==t?E(B(")"),Tt,R):void 0}function Tt(t){return"var"==t?E(_t,kt):"variable"==t?E(kt):C(kt)}function kt(t,e){return")"==t?E():";"==t?E(kt):"in"==e||"of"==e?(x.marked="keyword",E(H,kt)):C(H,kt)}function At(t,e){return"*"==e?(x.marked="keyword",E(At)):"variable"==t?(M(e),E(At)):"("==t?E(L,B(")"),rt(It,")"),R,ct,N,z):c&&"<"==e?E(B(">"),rt(yt,">"),R,At):void 0}function Pt(t,e){return"*"==e?(x.marked="keyword",E(Pt)):"variable"==t?(M(e),E(Pt)):"("==t?E(L,B(")"),rt(It,")"),R,ct,z):c&&"<"==e?E(B(">"),rt(yt,">"),R,Pt):void 0}function Lt(t,e){return"keyword"==t||"variable"==t?(x.marked="type",E(Lt)):"<"==e?E(B(">"),rt(yt,">"),R):void 0}function It(t,e){return"@"==e&&E(H,It),"spread"==t?E(It):c&&T(e)?(x.marked="keyword",E(It)):c&&"this"==t?E(at,Et):C(wt,at,Et)}function zt(t,e){return"variable"==t?Bt(t,e):Rt(t,e)}function Bt(t,e){if("variable"==t)return M(e),E(Rt)}function Rt(t,e){return"<"==e?E(B(">"),rt(yt,">"),R,Rt):"extends"==e||"implements"==e||c&&","==t?("implements"==e&&(x.marked="keyword"),E(c?dt:H,Rt)):"{"==t?E(B("}"),Ot,R):void 0}function Ot(t,e){return"async"==t||"variable"==t&&("static"==e||"get"==e||"set"==e||c&&T(e))&&x.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(x.marked="keyword",E(Ot)):"variable"==t||"keyword"==x.style?(x.marked="property",E(Nt,Ot)):"number"==t||"string"==t?E(Nt,Ot):"["==t?E(H,at,O("]"),Nt,Ot):"*"==e?(x.marked="keyword",E(Ot)):c&&"("==t?C(Pt,Ot):";"==t||","==t?E(Ot):"}"==t?E():"@"==e?E(H,Ot):void 0}function Nt(t,e){if("?"==e)return E(Nt);if(":"==t)return E(dt,Et);if("="==e)return E(F);var n=x.state.lexical.prev;return C(n&&"interface"==n.info?Pt:At)}function Wt(t,e){return"*"==e?(x.marked="keyword",E(Ut,O(";"))):"default"==e?(x.marked="keyword",E(H,O(";"))):"{"==t?E(rt(Ht,"}"),Ut,O(";")):C(N)}function Ht(t,e){return"as"==e?(x.marked="keyword",E(O("variable"))):"variable"==t?C(F,Ht):void 0}function Ft(t){return"string"==t?E():"("==t?C(H):C(jt,qt,Ut)}function jt(t,e){return"{"==t?ot(jt,"}"):("variable"==t&&M(e),"*"==e&&(x.marked="keyword"),E(Vt))}function qt(t){if(","==t)return E(jt,qt)}function Vt(t,e){if("as"==e)return x.marked="keyword",E(jt)}function Ut(t,e){if("from"==e)return x.marked="keyword",E(H)}function Kt(t){return"]"==t?E():C(rt(F,"]"))}function Gt(){return C(B("form"),wt,O("{"),B("}"),rt($t,"}"),R,R)}function $t(){return C(wt,Et)}function Yt(t,e,n){return e.tokenize==m&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(e.lastType)||"quasi"==e.lastType&&/\{\s*$/.test(t.string.slice(0,t.pos-(n||0)))}return z.lex=!0,R.lex=!0,{startState:function(t){var e={tokenize:m,lastType:"sof",cc:[],lexical:new _((t||0)-o,0,"block",!1),localVars:n.localVars,context:n.localVars&&new k(null,null,!1),indented:t||0};return n.globalVars&&"object"==typeof n.globalVars&&(e.globalVars=n.globalVars),e},token:function(t,e){if(t.sol()&&(e.lexical.hasOwnProperty("align")||(e.lexical.align=!1),e.indented=t.indentation(),y(t,e)),e.tokenize!=g&&t.eatSpace())return null;var n=e.tokenize(t,e);return"comment"==i?n:(e.lastType="operator"!=i||"++"!=r&&"--"!=r?i:"incdec",function(t,e,n,i,r){var o=t.cc;for(x.state=t,x.stream=r,x.marked=null,x.cc=o,x.style=e,t.lexical.hasOwnProperty("align")||(t.lexical.align=!0);;)if((o.length?o.pop():l?H:N)(n,i)){for(;o.length&&o[o.length-1].lex;)o.pop()();return x.marked?x.marked:"variable"==n&&w(t,i)?"variable-2":e}}(e,n,i,r,t))},indent:function(e,i){if(e.tokenize==g||e.tokenize==v)return t.Pass;if(e.tokenize!=m)return 0;var r,a=i&&i.charAt(0),l=e.lexical;if(!/^\s*else\b/.test(i))for(var c=e.cc.length-1;c>=0;--c){var u=e.cc[c];if(u==R)l=l.prev;else if(u!=Mt)break}for(;("stat"==l.type||"form"==l.type)&&("}"==a||(r=e.cc[e.cc.length-1])&&(r==U||r==K)&&!/^[,\.=+\-*:?[\(]/.test(i));)l=l.prev;s&&")"==l.type&&"stat"==l.prev.type&&(l=l.prev);var d=l.type,p=a==d;return"vardef"==d?l.indented+("operator"==e.lastType||","==e.lastType?l.info.length+1:0):"form"==d&&"{"==a?l.indented:"form"==d?l.indented+o:"stat"==d?l.indented+(function(t,e){return"operator"==t.lastType||","==t.lastType||h.test(e.charAt(0))||/[,.]/.test(e.charAt(0))}(e,i)?s||o:0):"switch"!=l.info||p||0==n.doubleIndentSwitch?l.align?l.column+(p?0:1):l.indented+(p?0:o):l.indented+(/^(?:case|default)\b/.test(i)?o:2*o)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:l?null:"/*",blockCommentEnd:l?null:"*/",blockCommentContinue:l?null:" * ",lineComment:l?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:l?"json":"javascript",jsonldMode:a,jsonMode:l,expressionAllowed:Yt,skipExpression:function(t){var e=t.cc[t.cc.length-1];e!=H&&e!=F||t.cc.pop()}}})),t.registerHelper("wordChars","javascript",/[\w$]/),t.defineMIME("text/javascript","javascript"),t.defineMIME("text/ecmascript","javascript"),t.defineMIME("application/javascript","javascript"),t.defineMIME("application/x-javascript","javascript"),t.defineMIME("application/ecmascript","javascript"),t.defineMIME("application/json",{name:"javascript",json:!0}),t.defineMIME("application/x-json",{name:"javascript",json:!0}),t.defineMIME("application/manifest+json",{name:"javascript",json:!0}),t.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),t.defineMIME("text/typescript",{name:"javascript",typescript:!0}),t.defineMIME("application/typescript",{name:"javascript",typescript:!0})}(n(28))},822:(t,e,n)=>{!function(t){"use strict";t.defineMode("lua",(function(t,e){var n=t.indentUnit;function i(t){return new RegExp("^(?:"+t.join("|")+")$","i")}var r=i(e.specials||[]),o=i(["_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load","loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require","select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall","coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield","debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable","debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable","debug.setupvalue","debug.traceback","close","flush","lines","read","seek","setvbuf","write","io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin","io.stdout","io.tmpfile","io.type","io.write","math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg","math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max","math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh","math.sqrt","math.tan","math.tanh","os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale","os.time","os.tmpname","package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload","package.seeall","string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub","string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper","table.concat","table.insert","table.maxn","table.remove","table.sort"]),s=i(["and","break","elseif","false","nil","not","or","return","true","function","end","if","then","else","do","while","repeat","until","for","in","local"]),a=i(["function","if","repeat","do","\\(","{"]),l=i(["end","until","\\)","}"]),c=new RegExp("^(?:"+["end","until","\\)","}","else","elseif"].join("|")+")","i");function u(t){for(var e=0;t.eat("=");)++e;return t.eat("["),e}function d(t,e){var n,i=t.next();return"-"==i&&t.eat("-")?t.eat("[")&&t.eat("[")?(e.cur=h(u(t),"comment"))(t,e):(t.skipToEnd(),"comment"):'"'==i||"'"==i?(e.cur=(n=i,function(t,e){for(var i,r=!1;null!=(i=t.next())&&(i!=n||r);)r=!r&&"\\"==i;return r||(e.cur=d),"string"}))(t,e):"["==i&&/[\[=]/.test(t.peek())?(e.cur=h(u(t),"string"))(t,e):/\d/.test(i)?(t.eatWhile(/[\w.%]/),"number"):/[\w_]/.test(i)?(t.eatWhile(/[\w\\\-_.]/),"variable"):null}function h(t,e){return function(n,i){for(var r,o=null;null!=(r=n.next());)if(null==o)"]"==r&&(o=0);else if("="==r)++o;else{if("]"==r&&o==t){i.cur=d;break}o=null}return e}}return{startState:function(t){return{basecol:t||0,indentDepth:0,cur:d}},token:function(t,e){if(t.eatSpace())return null;var n=e.cur(t,e),i=t.current();return"variable"==n&&(s.test(i)?n="keyword":o.test(i)?n="builtin":r.test(i)&&(n="variable-2")),"comment"!=n&&"string"!=n&&(a.test(i)?++e.indentDepth:l.test(i)&&--e.indentDepth),n},indent:function(t,e){var i=c.test(e);return t.basecol+n*(t.indentDepth-(i?1:0))},lineComment:"--",blockCommentStart:"--[[",blockCommentEnd:"]]"}})),t.defineMIME("text/x-lua","lua")}(n(28))},495:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n,i,r,o=t[1]||"",s=t[3];if(!s)return o;if(e&&"function"==typeof btoa){var a=(n=s,i=btoa(unescape(encodeURIComponent(JSON.stringify(n)))),r="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(i),"/*# ".concat(r," */")),l=s.sources.map((function(t){return"/*# sourceURL=".concat(s.sourceRoot||"").concat(t," */")}));return[o].concat(l).concat([a]).join("\n")}return[o].join("\n")}(e,t);return e[2]?"@media ".concat(e[2]," {").concat(n,"}"):n})).join("")},e.i=function(t,n,i){"string"==typeof t&&(t=[[null,t,""]]);var r={};if(i)for(var o=0;o<this.length;o++){var s=this[o][0];null!=s&&(r[s]=!0)}for(var a=0;a<t.length;a++){var l=[].concat(t[a]);i&&r[l[0]]||(n&&(l[2]?l[2]="".concat(n," and ").concat(l[2]):l[2]=n),e.push(l))}},e}},490:t=>{"use strict";t.exports=function(t,e){return e||(e={}),"string"!=typeof(t=t&&t.__esModule?t.default:t)?t:(/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t)}},521:function(t){t.exports=function(){"use strict";var t="millisecond",e="second",n="minute",i="hour",r="day",o="week",s="month",a="quarter",l="year",c="date",u=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,h={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},p=function(t,e,n){var i=String(t);return!i||i.length>=e?t:""+Array(e+1-i.length).join(n)+t},f={s:p,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),i=Math.floor(n/60),r=n%60;return(e<=0?"+":"-")+p(i,2,"0")+":"+p(r,2,"0")},m:function t(e,n){if(e.date()<n.date())return-t(n,e);var i=12*(n.year()-e.year())+(n.month()-e.month()),r=e.clone().add(i,s),o=n-r<0,a=e.clone().add(i+(o?-1:1),s);return+(-(i+(n-r)/(o?r-a:a-r))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(u){return{M:s,y:l,w:o,d:r,D:c,h:i,m:n,s:e,ms:t,Q:a}[u]||String(u||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},m="en",g={};g[m]=h;var v=function(t){return t instanceof w},y=function(t,e,n){var i;if(!t)return m;if("string"==typeof t)g[t]&&(i=t),e&&(g[t]=e,i=t);else{var r=t.name;g[r]=t,i=r}return!n&&i&&(m=i),i||!n&&m},b=function(t,e){if(v(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new w(n)},_=f;_.l=y,_.i=v,_.w=function(t,e){return b(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var w=function(){function h(t){this.$L=y(t.locale,null,!0),this.parse(t)}var p=h.prototype;return p.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(_.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var i=e.match(u);if(i){var r=i[2]-1||0,o=(i[7]||"0").substring(0,3);return n?new Date(Date.UTC(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,o)):new Date(i[1],r,i[3]||1,i[4]||0,i[5]||0,i[6]||0,o)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},p.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},p.$utils=function(){return _},p.isValid=function(){return!("Invalid Date"===this.$d.toString())},p.isSame=function(t,e){var n=b(t);return this.startOf(e)<=n&&n<=this.endOf(e)},p.isAfter=function(t,e){return b(t)<this.startOf(e)},p.isBefore=function(t,e){return this.endOf(e)<b(t)},p.$g=function(t,e,n){return _.u(t)?this[e]:this.set(n,t)},p.unix=function(){return Math.floor(this.valueOf()/1e3)},p.valueOf=function(){return this.$d.getTime()},p.startOf=function(t,a){var u=this,d=!!_.u(a)||a,h=_.p(t),p=function(t,e){var n=_.w(u.$u?Date.UTC(u.$y,e,t):new Date(u.$y,e,t),u);return d?n:n.endOf(r)},f=function(t,e){return _.w(u.toDate()[t].apply(u.toDate("s"),(d?[0,0,0,0]:[23,59,59,999]).slice(e)),u)},m=this.$W,g=this.$M,v=this.$D,y="set"+(this.$u?"UTC":"");switch(h){case l:return d?p(1,0):p(31,11);case s:return d?p(1,g):p(0,g+1);case o:var b=this.$locale().weekStart||0,w=(m<b?m+7:m)-b;return p(d?v-w:v+(6-w),g);case r:case c:return f(y+"Hours",0);case i:return f(y+"Minutes",1);case n:return f(y+"Seconds",2);case e:return f(y+"Milliseconds",3);default:return this.clone()}},p.endOf=function(t){return this.startOf(t,!1)},p.$set=function(o,a){var u,d=_.p(o),h="set"+(this.$u?"UTC":""),p=(u={},u[r]=h+"Date",u[c]=h+"Date",u[s]=h+"Month",u[l]=h+"FullYear",u[i]=h+"Hours",u[n]=h+"Minutes",u[e]=h+"Seconds",u[t]=h+"Milliseconds",u)[d],f=d===r?this.$D+(a-this.$W):a;if(d===s||d===l){var m=this.clone().set(c,1);m.$d[p](f),m.init(),this.$d=m.set(c,Math.min(this.$D,m.daysInMonth())).$d}else p&&this.$d[p](f);return this.init(),this},p.set=function(t,e){return this.clone().$set(t,e)},p.get=function(t){return this[_.p(t)]()},p.add=function(t,a){var c,u=this;t=Number(t);var d=_.p(a),h=function(e){var n=b(u);return _.w(n.date(n.date()+Math.round(e*t)),u)};if(d===s)return this.set(s,this.$M+t);if(d===l)return this.set(l,this.$y+t);if(d===r)return h(1);if(d===o)return h(7);var p=(c={},c[n]=6e4,c[i]=36e5,c[e]=1e3,c)[d]||1,f=this.$d.getTime()+t*p;return _.w(f,this)},p.subtract=function(t,e){return this.add(-1*t,e)},p.format=function(t){var e=this;if(!this.isValid())return"Invalid Date";var n=t||"YYYY-MM-DDTHH:mm:ssZ",i=_.z(this),r=this.$locale(),o=this.$H,s=this.$m,a=this.$M,l=r.weekdays,c=r.months,u=function(t,i,r,o){return t&&(t[i]||t(e,n))||r[i].substr(0,o)},h=function(t){return _.s(o%12||12,t,"0")},p=r.meridiem||function(t,e,n){var i=t<12?"AM":"PM";return n?i.toLowerCase():i},f={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:_.s(a+1,2,"0"),MMM:u(r.monthsShort,a,c,3),MMMM:u(c,a),D:this.$D,DD:_.s(this.$D,2,"0"),d:String(this.$W),dd:u(r.weekdaysMin,this.$W,l,2),ddd:u(r.weekdaysShort,this.$W,l,3),dddd:l[this.$W],H:String(o),HH:_.s(o,2,"0"),h:h(1),hh:h(2),a:p(o,s,!0),A:p(o,s,!1),m:String(s),mm:_.s(s,2,"0"),s:String(this.$s),ss:_.s(this.$s,2,"0"),SSS:_.s(this.$ms,3,"0"),Z:i};return n.replace(d,(function(t,e){return e||f[t]||i.replace(":","")}))},p.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},p.diff=function(t,c,u){var d,h=_.p(c),p=b(t),f=6e4*(p.utcOffset()-this.utcOffset()),m=this-p,g=_.m(this,p);return g=(d={},d[l]=g/12,d[s]=g,d[a]=g/3,d[o]=(m-f)/6048e5,d[r]=(m-f)/864e5,d[i]=m/36e5,d[n]=m/6e4,d[e]=m/1e3,d)[h]||m,u?g:_.a(g)},p.daysInMonth=function(){return this.endOf(s).$D},p.$locale=function(){return g[this.$L]},p.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),i=y(t,e,!0);return i&&(n.$L=i),n},p.clone=function(){return _.w(this.$d,this)},p.toDate=function(){return new Date(this.valueOf())},p.toJSON=function(){return this.isValid()?this.toISOString():null},p.toISOString=function(){return this.$d.toISOString()},p.toString=function(){return this.$d.toUTCString()},h}(),x=w.prototype;return b.prototype=x,[["$ms",t],["$s",e],["$m",n],["$H",i],["$W",r],["$M",s],["$y",l],["$D",c]].forEach((function(t){x[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),b.extend=function(t,e){return t.$i||(t(e,w,b),t.$i=!0),b},b.locale=y,b.isDayjs=v,b.unix=function(t){return b(1e3*t)},b.en=g[m],b.Ls=g,b.p={},b}()},827:function(t){t.exports=function(){"use strict";return function(t,e,n){t=t||{};var i=e.prototype,r={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function o(t,e,n,r){return i.fromToBase(t,e,n,r)}n.en.relativeTime=r,i.fromToBase=function(e,i,o,s,a){for(var l,c,u,d=o.$locale().relativeTime||r,h=t.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],p=h.length,f=0;f<p;f+=1){var m=h[f];m.d&&(l=s?n(e).diff(o,m.d,!0):o.diff(e,m.d,!0));var g=(t.rounding||Math.round)(Math.abs(l));if(u=l>0,g<=m.r||!m.r){g<=1&&f>0&&(m=h[f-1]);var v=d[m.l];a&&(g=a(""+g)),c="string"==typeof v?v.replace("%d",g):v(g,i,m.l,u);break}}if(i)return c;var y=u?d.future:d.past;return"function"==typeof y?y(c):y.replace("%s",c)},i.to=function(t,e){return o(t,e,this,!0)},i.from=function(t,e){return o(t,e,this)};var s=function(t){return t.$u?n.utc():n()};i.toNow=function(t){return this.to(s(this),t)},i.fromNow=function(t){return this.from(s(this),t)}}}()},678:(t,e,n)=>{"use strict";!function(e){var n=/^(b|B)$/,i={iec:{bits:["b","Kib","Mib","Gib","Tib","Pib","Eib","Zib","Yib"],bytes:["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"]},jedec:{bits:["b","Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],bytes:["B","KB","MB","GB","TB","PB","EB","ZB","YB"]}},r={iec:["","kibi","mebi","gibi","tebi","pebi","exbi","zebi","yobi"],jedec:["","kilo","mega","giga","tera","peta","exa","zetta","yotta"]};function o(t){var e,o,s,a,l,c,u,d,h,p,f,m,g,v,y,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},_=[],w=0,x=void 0,C=void 0;if(isNaN(t))throw new TypeError("Invalid number");return o=!0===b.bits,f=!0===b.unix,e=b.base||2,p=void 0!==b.round?b.round:f?1:2,c=void 0!==b.locale?b.locale:"",u=b.localeOptions||{},m=void 0!==b.separator?b.separator:"",g=void 0!==b.spacer?b.spacer:f?"":" ",y=b.symbols||{},v=2===e&&b.standard||"jedec",h=b.output||"string",a=!0===b.fullform,l=b.fullforms instanceof Array?b.fullforms:[],x=void 0!==b.exponent?b.exponent:-1,s=2<e?1e3:1024,(d=(C=Number(t))<0)&&(C=-C),(-1===x||isNaN(x))&&(x=Math.floor(Math.log(C)/Math.log(s)))<0&&(x=0),8<x&&(x=8),"exponent"===h?x:(0===C?(_[0]=0,_[1]=f?"":i[v][o?"bits":"bytes"][x]):(w=C/(2===e?Math.pow(2,10*x):Math.pow(1e3,x)),o&&s<=(w*=8)&&x<8&&(w/=s,x++),_[0]=Number(w.toFixed(0<x?p:0)),_[0]===s&&x<8&&void 0===b.exponent&&(_[0]=1,x++),_[1]=10===e&&1===x?o?"kb":"kB":i[v][o?"bits":"bytes"][x],f&&(_[1]="jedec"===v?_[1].charAt(0):0<x?_[1].replace(/B$/,""):_[1],n.test(_[1])&&(_[0]=Math.floor(_[0]),_[1]=""))),d&&(_[0]=-_[0]),_[1]=y[_[1]]||_[1],!0===c?_[0]=_[0].toLocaleString():0<c.length?_[0]=_[0].toLocaleString(c,u):0<m.length&&(_[0]=_[0].toString().replace(".",m)),"array"===h?_:(a&&(_[1]=l[x]?l[x]:r[v][x]+(o?"bit":"byte")+(1===_[0]?"":"s")),"object"===h?{value:_[0],symbol:_[1],exponent:x}:_.join(g)))}o.partial=function(t){return function(e){return o(e,t)}},t.exports=o}("undefined"!=typeof window?window:n.g)},264:(t,e,n)=>{"use strict";var i,r=function(){var t={};return function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(t){n=null}t[e]=n}return t[e]}}(),o=[];function s(t){for(var e=-1,n=0;n<o.length;n++)if(o[n].identifier===t){e=n;break}return e}function a(t,e){for(var n={},i=[],r=0;r<t.length;r++){var a=t[r],l=e.base?a[0]+e.base:a[0],c=n[l]||0,u="".concat(l," ").concat(c);n[l]=c+1;var d=s(u),h={css:a[1],media:a[2],sourceMap:a[3]};-1!==d?(o[d].references++,o[d].updater(h)):o.push({identifier:u,updater:m(h,e),references:1}),i.push(u)}return i}function l(t){var e=document.createElement("style"),i=t.attributes||{};if(void 0===i.nonce){var o=n.nc;o&&(i.nonce=o)}if(Object.keys(i).forEach((function(t){e.setAttribute(t,i[t])})),"function"==typeof t.insert)t.insert(e);else{var s=r(t.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(e)}return e}var c,u=(c=[],function(t,e){return c[t]=e,c.filter(Boolean).join("\n")});function d(t,e,n,i){var r=n?"":i.media?"@media ".concat(i.media," {").concat(i.css,"}"):i.css;if(t.styleSheet)t.styleSheet.cssText=u(e,r);else{var o=document.createTextNode(r),s=t.childNodes;s[e]&&t.removeChild(s[e]),s.length?t.insertBefore(o,s[e]):t.appendChild(o)}}function h(t,e,n){var i=n.css,r=n.media,o=n.sourceMap;if(r?t.setAttribute("media",r):t.removeAttribute("media"),o&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),t.styleSheet)t.styleSheet.cssText=i;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(i))}}var p=null,f=0;function m(t,e){var n,i,r;if(e.singleton){var o=f++;n=p||(p=l(e)),i=d.bind(null,n,o,!1),r=d.bind(null,n,o,!0)}else n=l(e),i=h.bind(null,n,e),r=function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(n)};return i(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap)return;i(t=e)}else r()}}t.exports=function(t,e){(e=e||{}).singleton||"boolean"==typeof e.singleton||(e.singleton=(void 0===i&&(i=Boolean(window&&document&&document.all&&!window.atob)),i));var n=a(t=t||[],e);return function(t){if(t=t||[],"[object Array]"===Object.prototype.toString.call(t)){for(var i=0;i<n.length;i++){var r=s(n[i]);o[r].references--}for(var l=a(t,e),c=0;c<n.length;c++){var u=s(n[c]);0===o[u].references&&(o[u].updater(),o.splice(u,1))}n=l}}}},549:(t,e,n)=>{var i=n(264),r=n(760);"string"==typeof(r=r.__esModule?r.default:r)&&(r=[[t.id,r,""]]);i(r,{insert:"head",singleton:!1}),t.exports=r.locals||{}},906:()=>{}},e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={id:i,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.exports}n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{var t;n.g.importScripts&&(t=n.g.location+"");var e=n.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");i.length&&(t=i[i.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),n.p=t})(),(()=>{"use strict";var t;function e(t){return"function"==typeof t.iter?t.iter():new r(t)}function i(t,n){for(var i,r=0,o=e(t);void 0!==(i=o.next());)if(!1===n(i,r++))return}!function(t){function e(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r,o=t.length;if(0===o)return-1;n=n<0?Math.max(0,n+o):Math.min(n,o-1),r=(i=i<0?Math.max(0,i+o):Math.min(i,o-1))<n?i+1+(o-n):i-n+1;for(var s=0;s<r;++s){var a=(n+s)%o;if(t[a]===e)return a}return-1}function n(t,e,n,i){void 0===n&&(n=-1),void 0===i&&(i=0);var r,o=t.length;if(0===o)return-1;r=(n=n<0?Math.max(0,n+o):Math.min(n,o-1))<(i=i<0?Math.max(0,i+o):Math.min(i,o-1))?n+1+(o-i):n-i+1;for(var s=0;s<r;++s){var a=(n-s+o)%o;if(t[a]===e)return a}return-1}function i(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r,o=t.length;if(0===o)return-1;n=n<0?Math.max(0,n+o):Math.min(n,o-1),r=(i=i<0?Math.max(0,i+o):Math.min(i,o-1))<n?i+1+(o-n):i-n+1;for(var s=0;s<r;++s){var a=(n+s)%o;if(e(t[a],a))return a}return-1}function r(t,e,n,i){void 0===n&&(n=-1),void 0===i&&(i=0);var r,o=t.length;if(0===o)return-1;r=(n=n<0?Math.max(0,n+o):Math.min(n,o-1))<(i=i<0?Math.max(0,i+o):Math.min(i,o-1))?n+1+(o-i):n-i+1;for(var s=0;s<r;++s){var a=(n-s+o)%o;if(e(t[a],a))return a}return-1}function o(t,e,n){void 0===e&&(e=0),void 0===n&&(n=-1);var i=t.length;if(!(i<=1))for(e=e<0?Math.max(0,e+i):Math.min(e,i-1),n=n<0?Math.max(0,n+i):Math.min(n,i-1);e<n;){var r=t[e],o=t[n];t[e++]=o,t[n--]=r}}function s(t,e){var n=t.length;if(e<0&&(e+=n),!(e<0||e>=n)){for(var i=t[e],r=e+1;r<n;++r)t[r-1]=t[r];return t.length=n-1,i}}t.firstIndexOf=e,t.lastIndexOf=n,t.findFirstIndex=i,t.findLastIndex=r,t.findFirstValue=function(t,e,n,r){void 0===n&&(n=0),void 0===r&&(r=-1);var o=i(t,e,n,r);return-1!==o?t[o]:void 0},t.findLastValue=function(t,e,n,i){void 0===n&&(n=-1),void 0===i&&(i=0);var o=r(t,e,n,i);return-1!==o?t[o]:void 0},t.lowerBound=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=-1);var o=t.length;if(0===o)return 0;for(var s=i=i<0?Math.max(0,i+o):Math.min(i,o-1),a=(r=r<0?Math.max(0,r+o):Math.min(r,o-1))-i+1;a>0;){var l=a>>1,c=s+l;n(t[c],e)<0?(s=c+1,a-=l+1):a=l}return s},t.upperBound=function(t,e,n,i,r){void 0===i&&(i=0),void 0===r&&(r=-1);var o=t.length;if(0===o)return 0;for(var s=i=i<0?Math.max(0,i+o):Math.min(i,o-1),a=(r=r<0?Math.max(0,r+o):Math.min(r,o-1))-i+1;a>0;){var l=a>>1,c=s+l;n(t[c],e)>0?a=l:(s=c+1,a-=l+1)}return s},t.shallowEqual=function(t,e,n){if(t===e)return!0;if(t.length!==e.length)return!1;for(var i=0,r=t.length;i<r;++i)if(n?!n(t[i],e[i]):t[i]!==e[i])return!1;return!0},t.slice=function(t,e){void 0===e&&(e={});var n=e.start,i=e.stop,r=e.step;if(void 0===r&&(r=1),0===r)throw new Error("Slice `step` cannot be zero.");var o,s=t.length;void 0===n?n=r<0?s-1:0:n<0?n=Math.max(n+s,r<0?-1:0):n>=s&&(n=r<0?s-1:s),void 0===i?i=r<0?-1:s:i<0?i=Math.max(i+s,r<0?-1:0):i>=s&&(i=r<0?s-1:s),o=r<0&&i>=n||r>0&&n>=i?0:r<0?Math.floor((i-n+1)/r+1):Math.floor((i-n-1)/r+1);for(var a=[],l=0;l<o;++l)a[l]=t[n+l*r];return a},t.move=function(t,e,n){var i=t.length;if(!(i<=1)&&(e=e<0?Math.max(0,e+i):Math.min(e,i-1))!==(n=n<0?Math.max(0,n+i):Math.min(n,i-1))){for(var r=t[e],o=e<n?1:-1,s=e;s!==n;s+=o)t[s]=t[s+o];t[n]=r}},t.reverse=o,t.rotate=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=t.length;if(!(r<=1||(n=n<0?Math.max(0,n+r):Math.min(n,r-1))>=(i=i<0?Math.max(0,i+r):Math.min(i,r-1)))){var s=i-n+1;if(e>0?e%=s:e<0&&(e=(e%s+s)%s),0!==e){var a=n+e;o(t,n,a-1),o(t,a,i),o(t,n,i)}}},t.fill=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=t.length;if(0!==r){var o;n=n<0?Math.max(0,n+r):Math.min(n,r-1),o=(i=i<0?Math.max(0,i+r):Math.min(i,r-1))<n?i+1+(r-n):i-n+1;for(var s=0;s<o;++s)t[(n+s)%r]=e}},t.insert=function(t,e,n){var i=t.length;e=e<0?Math.max(0,e+i):Math.min(e,i);for(var r=i;r>e;--r)t[r]=t[r-1];t[e]=n},t.removeAt=s,t.removeFirstOf=function(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=-1);var o=e(t,n,i,r);return-1!==o&&s(t,o),o},t.removeLastOf=function(t,e,i,r){void 0===i&&(i=-1),void 0===r&&(r=0);var o=n(t,e,i,r);return-1!==o&&s(t,o),o},t.removeAllOf=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=t.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);for(var o=0,s=0;s<r;++s)n<=i&&s>=n&&s<=i&&t[s]===e||i<n&&(s<=i||s>=n)&&t[s]===e?o++:o>0&&(t[s-o]=t[s]);return o>0&&(t.length=r-o),o},t.removeFirstWhere=function(t,e,n,r){var o;void 0===n&&(n=0),void 0===r&&(r=-1);var a=i(t,e,n,r);return-1!==a&&(o=s(t,a)),{index:a,value:o}},t.removeLastWhere=function(t,e,n,i){var o;void 0===n&&(n=-1),void 0===i&&(i=0);var a=r(t,e,n,i);return-1!==a&&(o=s(t,a)),{index:a,value:o}},t.removeAllWhere=function(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=-1);var r=t.length;if(0===r)return 0;n=n<0?Math.max(0,n+r):Math.min(n,r-1),i=i<0?Math.max(0,i+r):Math.min(i,r-1);for(var o=0,s=0;s<r;++s)n<=i&&s>=n&&s<=i&&e(t[s],s)||i<n&&(s<=i||s>=n)&&e(t[s],s)?o++:o>0&&(t[s-o]=t[s]);return o>0&&(t.length=r-o),o}}(t||(t={}));var r=function(){function t(t){this._index=0,this._source=t}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._source.length))return this._source[this._index++]},t}();function o(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new s(e(t.map(e)))}(function(){function t(t,e){void 0===e&&(e=Object.keys(t)),this._index=0,this._source=t,this._keys=e}t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var t=this._keys[this._index++];return t in this._source?t:this.next()}}})(),function(){function t(t,e){void 0===e&&(e=Object.keys(t)),this._index=0,this._source=t,this._keys=e}t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var t=this._keys[this._index++];return t in this._source?this._source[t]:this.next()}}}(),function(){function t(t,e){void 0===e&&(e=Object.keys(t)),this._index=0,this._source=t,this._keys=e}t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source,this._keys);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._keys.length)){var t=this._keys[this._index++];return t in this._source?[t,this._source[t]]:this.next()}}}(),function(){function t(t){this._fn=t}t.prototype.iter=function(){return this},t.prototype.clone=function(){throw new Error("An `FnIterator` cannot be cloned.")},t.prototype.next=function(){return this._fn.call(void 0)}}();var s=function(){function t(t){this._cloned=!1,this._source=t,this._active=void 0}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone());return e._active=this._active&&this._active.clone(),e._cloned=!0,this._cloned=!0,e},t.prototype.next=function(){if(void 0===this._active){var t=this._source.next();if(void 0===t)return;this._active=this._cloned?t.clone():t}var e=this._active.next();return void 0!==e?e:(this._active=void 0,this.next())},t}();function a(){return new l}var l=function(){function t(){}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t},t.prototype.next=function(){},t}();!function(){function t(t,e){this._source=t,this._index=e}t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._index)},t.prototype.next=function(){var t=this._source.next();if(void 0!==t)return[this._index++,t]}}();var c=function(){function t(t,e){this._index=0,this._source=t,this._fn=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){for(var t,e=this._fn,n=this._source;void 0!==(t=n.next());)if(e(t,this._index++))return t},t}();function u(t,n){for(var i,r=0,o=e(t);void 0!==(i=o.next());)if(n(i,r++))return i}function d(t,n){return new p(e(t),n)}var h,p=function(){function t(t,e){this._index=0,this._source=t,this._fn=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source.clone(),this._fn);return e._index=this._index,e},t.prototype.next=function(){var t=this._source.next();if(void 0!==t)return this._fn.call(void 0,t,this._index++)},t}();function f(t,n,i){var r=0,o=e(t),s=o.next();if(void 0===s&&void 0===i)throw new TypeError("Reduce of empty iterable with no initial value.");if(void 0===s)return i;var a,l,c=o.next();if(void 0===c&&void 0===i)return s;if(void 0===c)return n(i,s,r++);for(a=n(void 0===i?s:n(i,s,r++),c,r++);void 0!==(l=o.next());)a=n(a,l,r++);return a}function m(t){return new y(t,1)}!function(){function t(t,e,n){this._index=0,this._start=t,this._stop=e,this._step=n,this._length=h.rangeLength(t,e,n)}t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._start,this._stop,this._step);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index>=this._length))return this._start+this._step*this._index++}}(),function(t){t.rangeLength=function(t,e,n){return 0===n?1/0:t>e&&n>0||t<e&&n<0?0:Math.ceil((e-t)/n)}}(h||(h={}));var g,v,y=function(){function t(t,e){this._value=t,this._count=e}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._value,this._count)},t.prototype.next=function(){if(!(this._count<=0))return this._count--,this._value},t}(),b=function(){function t(t){this._source=t,this._index=t.length-1}return t.prototype.iter=function(){return this},t.prototype.clone=function(){var e=new t(this._source);return e._index=this._index,e},t.prototype.next=function(){if(!(this._index<0||this._index>=this._source.length))return this._source[this._index--]},t}();!function(){function t(t,e){this._source=t,this._step=e}t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._step)},t.prototype.next=function(){for(var t=this._source.next(),e=this._step-1;e>0;--e)this._source.next();return t}}(),function(t){function e(t,e,n){void 0===n&&(n=0);for(var i=new Array(e.length),r=0,o=n,s=e.length;r<s;++r,++o){if(-1===(o=t.indexOf(e[r],o)))return null;i[r]=o}return i}t.findIndices=e,t.matchSumOfSquares=function(t,n,i){void 0===i&&(i=0);var r=e(t,n,i);if(!r)return null;for(var o=0,s=0,a=r.length;s<a;++s){var l=r[s]-i;o+=l*l}return{score:o,indices:r}},t.matchSumOfDeltas=function(t,n,i){void 0===i&&(i=0);var r=e(t,n,i);if(!r)return null;for(var o=0,s=i-1,a=0,l=r.length;a<l;++a){var c=r[a];o+=c-s-1,s=c}return{score:o,indices:r}},t.highlight=function(t,e,n){for(var i=[],r=0,o=0,s=e.length;r<s;){for(var a=e[r],l=e[r];++r<s&&e[r]===l+1;)l++;o<a&&i.push(t.slice(o,a)),a<l+1&&i.push(n(t.slice(a,l+1))),o=l+1}return o<t.length&&i.push(t.slice(o)),i},t.cmp=function(t,e){return t<e?-1:t>e?1:0}}(g||(g={})),function(){function t(t,e){this._source=t,this._count=e}t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.clone(),this._count)},t.prototype.next=function(){if(!(this._count<=0)){var t=this._source.next();if(void 0!==t)return this._count--,t}}}(),function(){function t(t){this._source=t}t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._source.map((function(t){return t.clone()})))},t.prototype.next=function(){for(var t=new Array(this._source.length),e=0,n=this._source.length;e<n;++e){var i=this._source[e].next();if(void 0===i)return;t[e]=i}return t}}(),function(t){function e(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t}function n(t){return Array.isArray(t)}t.emptyObject=Object.freeze({}),t.emptyArray=Object.freeze([]),t.isPrimitive=e,t.isArray=n,t.isObject=function(t){return!e(t)&&!n(t)},t.deepEqual=function t(i,r){if(i===r)return!0;if(e(i)||e(r))return!1;var o=n(i),s=n(r);return o===s&&(o&&s?function(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(var i=0,r=e.length;i<r;++i)if(!t(e[i],n[i]))return!1;return!0}(i,r):function(e,n){if(e===n)return!0;for(var i in e)if(void 0!==e[i]&&!(i in n))return!1;for(var i in n)if(void 0!==n[i]&&!(i in e))return!1;for(var i in e){var r=e[i],o=n[i];if(void 0!==r||void 0!==o){if(void 0===r||void 0===o)return!1;if(!t(r,o))return!1}}return!0}(i,r))},t.deepCopy=function t(i){return e(i)?i:n(i)?function(e){for(var n=new Array(e.length),i=0,r=e.length;i<r;++i)n[i]=t(e[i]);return n}(i):function(e){var n={};for(var i in e){var r=e[i];void 0!==r&&(n[i]=t(r))}return n}(i)}}(v||(v={}));var _,w,x=function(){function t(){this._types=[],this._values=[]}return t.prototype.types=function(){return this._types.slice()},t.prototype.hasData=function(t){return-1!==this._types.indexOf(t)},t.prototype.getData=function(t){var e=this._types.indexOf(t);return-1!==e?this._values[e]:void 0},t.prototype.setData=function(t,e){this.clearData(t),this._types.push(t),this._values.push(e)},t.prototype.clearData=function(t){var e=this._types.indexOf(t);-1!==e&&(this._types.splice(e,1),this._values.splice(e,1))},t.prototype.clear=function(){this._types.length=0,this._values.length=0},t}();!function(){function t(){var t=this;this.promise=new Promise((function(e,n){t._resolve=e,t._reject=n}))}t.prototype.resolve=function(t){(0,this._resolve)(t)},t.prototype.reject=function(t){(0,this._reject)(t)}}(),function(t){var e;t.getRandomValues=(e="undefined"!=typeof window&&(window.crypto||window.msCrypto)||n(906)||null)&&"function"==typeof e.getRandomValues?function(t){return e.getRandomValues(t)}:e&&"function"==typeof e.randomFillSync?function(t){return e.randomFillSync(t)}:e&&"function"==typeof e.randomBytes?function(t){for(var n=e.randomBytes(t.length),i=0,r=n.length;i<r;++i)t[i]=n[i]}:function(t){for(var e=0,n=0,i=t.length;n<i;++n)n%4==0&&(e=4294967295*Math.random()>>>0),t[n]=255&e,e>>>=8}}(_||(_={})),function(t){t.uuid4=function(){for(var t=new Uint8Array(16),e=new Array(256),n=0;n<16;++n)e[n]="0"+n.toString(16);for(n=16;n<256;++n)e[n]=n.toString(16);return function(){return _.getRandomValues(t),t[6]=64|15&t[6],t[8]=128|63&t[8],e[t[0]]+e[t[1]]+e[t[2]]+e[t[3]]+"-"+e[t[4]]+e[t[5]]+"-"+e[t[6]]+e[t[7]]+"-"+e[t[8]]+e[t[9]]+"-"+e[t[10]]+e[t[11]]+e[t[12]]+e[t[13]]+e[t[14]]+e[t[15]]}}()}(w||(w={}));var C,E=function(){function t(t){this.sender=t}return t.prototype.connect=function(t,e){return C.connect(this,t,e)},t.prototype.disconnect=function(t,e){return C.disconnect(this,t,e)},t.prototype.emit=function(t){C.emit(this,t)},t}();!function(t){t.disconnectBetween=function(t,e){C.disconnectBetween(t,e)},t.disconnectSender=function(t){C.disconnectSender(t)},t.disconnectReceiver=function(t){C.disconnectReceiver(t)},t.disconnectAll=function(t){C.disconnectAll(t)},t.clearData=function(t){C.disconnectAll(t)},t.getExceptionHandler=function(){return C.exceptionHandler},t.setExceptionHandler=function(t){var e=C.exceptionHandler;return C.exceptionHandler=t,e}}(E||(E={})),function(e){function n(t){var e=o.get(t);e&&0!==e.length&&(i(e,(function(t){if(t.signal){var e=t.thisArg||t.slot;t.signal=null,h(s.get(e))}})),h(e))}function r(t){var e=s.get(t);e&&0!==e.length&&(i(e,(function(t){if(t.signal){var e=t.signal.sender;t.signal=null,h(o.get(e))}})),h(e))}e.exceptionHandler=function(t){console.error(t)},e.connect=function(t,e,n){n=n||void 0;var i=o.get(t.sender);if(i||(i=[],o.set(t.sender,i)),c(i,t,e,n))return!1;var r=n||e,a=s.get(r);a||(a=[],s.set(r,a));var l={signal:t,slot:e,thisArg:n};return i.push(l),a.push(l),!0},e.disconnect=function(t,e,n){n=n||void 0;var i=o.get(t.sender);if(!i||0===i.length)return!1;var r=c(i,t,e,n);if(!r)return!1;var a=n||e,l=s.get(a);return r.signal=null,h(i),h(l),!0},e.disconnectBetween=function(t,e){var n=o.get(t);if(n&&0!==n.length){var r=s.get(e);r&&0!==r.length&&(i(r,(function(e){e.signal&&e.signal.sender===t&&(e.signal=null)})),h(n),h(r))}},e.disconnectSender=n,e.disconnectReceiver=r,e.disconnectAll=function(t){n(t),r(t)},e.emit=function(t,e){var n=o.get(t.sender);if(n&&0!==n.length)for(var i=0,r=n.length;i<r;++i){var s=n[i];s.signal===t&&d(s,e)}};var o=new WeakMap,s=new WeakMap,a=new Set,l="function"==typeof requestAnimationFrame?requestAnimationFrame:setImmediate;function c(t,e,n,i){return u(t,(function(t){return t.signal===e&&t.slot===n&&t.thisArg===i}))}function d(t,n){var i=t.signal,r=t.slot,o=t.thisArg;try{r.call(o,i.sender,n)}catch(t){e.exceptionHandler(t)}}function h(t){0===a.size&&l(p),a.add(t)}function p(){a.forEach(f),a.clear()}function f(e){t.removeAllWhere(e,m)}function m(t){return null===t.signal}}(C||(C={}));var D=function(t,e){return(D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function M(t,e){function n(){this.constructor=t}D(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var S=function(){function t(t){this._fn=t}return Object.defineProperty(t.prototype,"isDisposed",{get:function(){return!this._fn},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){if(this._fn){var t=this._fn;this._fn=null,t()}},t}(),T=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._disposed=new E(e),e}M(e,t),Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._disposed.emit(void 0),E.clearData(this))}}(S),function(){function t(){this._isDisposed=!1,this._items=new Set}return Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this._isDisposed||(this._isDisposed=!0,this._items.forEach((function(t){t.dispose()})),this._items.clear())},t.prototype.contains=function(t){return this._items.has(t)},t.prototype.add=function(t){this._items.add(t)},t.prototype.remove=function(t){this._items.delete(t)},t.prototype.clear=function(){this._items.clear()},t}());!function(t){t.from=function(e){var n=new t;return i(e,(function(t){n.add(t)})),n}}(T||(T={}));var k,A,P,L,I,z=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._disposed=new E(e),e}return M(e,t),Object.defineProperty(e.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.isDisposed||(t.prototype.dispose.call(this),this._disposed.emit(void 0),E.clearData(this))},e}(T);function B(){return O.keyboardLayout}!function(t){t.from=function(e){var n=new t;return i(e,(function(t){n.add(t)})),n}}(z||(z={})),function(t){t.copyText=function(t){var e=document.body,n=function(i){i.preventDefault(),i.stopPropagation(),i.clipboardData.setData("text",t),e.removeEventListener("copy",n,!0)};e.addEventListener("copy",n,!0),document.execCommand("copy")}}(k||(k={})),function(t){t.boxSizing=function(t){var e=window.getComputedStyle(t),n=parseFloat(e.borderTopWidth)||0,i=parseFloat(e.borderLeftWidth)||0,r=parseFloat(e.borderRightWidth)||0,o=parseFloat(e.borderBottomWidth)||0,s=parseFloat(e.paddingTop)||0,a=parseFloat(e.paddingLeft)||0,l=parseFloat(e.paddingRight)||0,c=parseFloat(e.paddingBottom)||0;return{borderTop:n,borderLeft:i,borderRight:r,borderBottom:o,paddingTop:s,paddingLeft:a,paddingRight:l,paddingBottom:c,horizontalSum:i+a+l+r,verticalSum:n+s+c+o}},t.sizeLimits=function(t){var e=window.getComputedStyle(t),n=parseFloat(e.minWidth)||0,i=parseFloat(e.minHeight)||0,r=parseFloat(e.maxWidth)||1/0,o=parseFloat(e.maxHeight)||1/0;return{minWidth:n,minHeight:i,maxWidth:r=Math.max(n,r),maxHeight:o=Math.max(i,o)}},t.hitTest=function(t,e,n){var i=t.getBoundingClientRect();return e>=i.left&&e<i.right&&n>=i.top&&n<i.bottom},t.scrollIntoViewIfNeeded=function(t,e){var n=t.getBoundingClientRect(),i=e.getBoundingClientRect();i.top<=n.top&&i.bottom>=n.bottom||(i.top<n.top&&i.height<=n.height||i.bottom>n.bottom&&i.height>=n.height?t.scrollTop-=n.top-i.top:(i.top<n.top&&i.height>n.height||i.bottom>n.bottom&&i.height<n.height)&&(t.scrollTop-=n.bottom-i.bottom))}}(A||(A={})),function(t){t.IS_MAC=!!navigator.platform.match(/Mac/i),t.IS_WIN=!!navigator.platform.match(/Win/i),t.IS_IE=/Trident/.test(navigator.userAgent),t.IS_EDGE=/Edge/.test(navigator.userAgent),t.accelKey=function(e){return t.IS_MAC?e.metaKey:e.ctrlKey}}(P||(P={})),function(t){t.calculateSpecificity=function(t){if(t in I.specificityCache)return I.specificityCache[t];var e=I.calculateSingle(t);return I.specificityCache[t]=e},t.isValid=function(t){if(t in I.validityCache)return I.validityCache[t];var e=!0;try{I.testElem.querySelector(t)}catch(t){e=!1}return I.validityCache[t]=e},t.matches=function(t,e){return I.protoMatchFunc.call(t,e)}}(L||(L={})),function(t){var e;t.specificityCache=Object.create(null),t.validityCache=Object.create(null),t.testElem=document.createElement("div"),t.protoMatchFunc=(e=Element.prototype).matches||e.matchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector||e.webkitMatchesSelector||function(t){var e=this,n=e.ownerDocument?e.ownerDocument.querySelectorAll(t):[];return-1!==Array.prototype.indexOf.call(n,e)},t.calculateSingle=function(t){var e=0,u=0,d=0;function h(e){var n=t.match(e);return null!==n&&(t=t.slice(n[0].length),!0)}for(t=(t=t.split(",",1)[0]).replace(c," $1 ");t.length>0;)if(h(n))e++;else if(h(i))u++;else if(h(r))u++;else if(h(s))d++;else if(h(a))u++;else if(h(o))d++;else if(!h(l))return 0;return(e=Math.min(e,255))<<16|(u=Math.min(u,255))<<8|Math.min(d,255)};var n=/^#[^\s\+>~#\.\[:]+/,i=/^\.[^\s\+>~#\.\[:]+/,r=/^\[[^\]]+\]/,o=/^[^\s\+>~#\.\[:]+/,s=/^(::[^\s\+>~#\.\[:]+|:first-line|:first-letter|:before|:after)/,a=/^:[^\s\+>~#\.\[:]+/,l=/^[\s\+>~\*]+/,c=/:not\(([^\)]+)\)/g}(I||(I={}));var R=function(){function t(e,n){this.name=e,this._codes=n,this._keys=t.extractKeys(n)}return t.prototype.keys=function(){return Object.keys(this._keys)},t.prototype.isValidKey=function(t){return t in this._keys},t.prototype.keyForKeydownEvent=function(t){return this._codes[t.keyCode]||""},t}();!function(t){t.extractKeys=function(t){var e=Object.create(null);for(var n in t)e[t[n]]=!0;return e}}(R||(R={}));var O,N=new R("en-us",{8:"Backspace",9:"Tab",13:"Enter",19:"Pause",27:"Escape",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",93:"ContextMenu",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"});!function(t){t.keyboardLayout=N}(O||(O={}));var W,H=function(){function e(){this._timerID=0,this._replaying=!1,this._keystrokes=[],this._keydownEvents=[],this._keyBindings=[],this._exactKeyMatch=null,this._commands=Object.create(null),this._commandChanged=new E(this),this._commandExecuted=new E(this),this._keyBindingChanged=new E(this)}return Object.defineProperty(e.prototype,"commandChanged",{get:function(){return this._commandChanged},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"commandExecuted",{get:function(){return this._commandExecuted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keyBindingChanged",{get:function(){return this._keyBindingChanged},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keyBindings",{get:function(){return this._keyBindings},enumerable:!0,configurable:!0}),e.prototype.listCommands=function(){return Object.keys(this._commands)},e.prototype.hasCommand=function(t){return t in this._commands},e.prototype.addCommand=function(t,e){var n=this;if(t in this._commands)throw new Error("Command '"+t+"' already registered.");return this._commands[t]=W.createCommand(e),this._commandChanged.emit({id:t,type:"added"}),new S((function(){delete n._commands[t],n._commandChanged.emit({id:t,type:"removed"})}))},e.prototype.notifyCommandChanged=function(t){if(void 0!==t&&!(t in this._commands))throw new Error("Command '"+t+"' is not registered.");this._commandChanged.emit({id:t,type:t?"changed":"many-changed"})},e.prototype.label=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return n?n.label.call(void 0,e):""},e.prototype.mnemonic=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return n?n.mnemonic.call(void 0,e):-1},e.prototype.icon=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return n?n.icon.call(void 0,e):""},e.prototype.iconClass=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return n?n.iconClass.call(void 0,e):""},e.prototype.iconLabel=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return n?n.iconLabel.call(void 0,e):""},e.prototype.caption=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return n?n.caption.call(void 0,e):""},e.prototype.usage=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return n?n.usage.call(void 0,e):""},e.prototype.className=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return n?n.className.call(void 0,e):""},e.prototype.dataset=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return n?n.dataset.call(void 0,e):{}},e.prototype.isEnabled=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return!!n&&n.isEnabled.call(void 0,e)},e.prototype.isToggled=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return!!n&&n.isToggled.call(void 0,e)},e.prototype.isToggleable=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return!!n&&n.isToggleable},e.prototype.isVisible=function(t,e){void 0===e&&(e=v.emptyObject);var n=this._commands[t];return!!n&&n.isVisible.call(void 0,e)},e.prototype.execute=function(t,e){void 0===e&&(e=v.emptyObject);var n,i=this._commands[t];if(!i)return Promise.reject(new Error("Command '"+t+"' not registered."));try{n=i.execute.call(void 0,e)}catch(t){n=Promise.reject(t)}var r=Promise.resolve(n);return this._commandExecuted.emit({id:t,args:e,result:r}),r},e.prototype.addKeyBinding=function(e){var n=this,i=W.createKeyBinding(e);return this._keyBindings.push(i),this._keyBindingChanged.emit({binding:i,type:"added"}),new S((function(){t.removeFirstOf(n._keyBindings,i),n._keyBindingChanged.emit({binding:i,type:"removed"})}))},e.prototype.processKeydownEvent=function(t){if(!this._replaying){var n=e.keystrokeForKeydownEvent(t);if(!n)return this._replayKeydownEvents(),void this._clearPendingState();this._keystrokes.push(n);var i=W.matchKeyBinding(this._keyBindings,this._keystrokes,t),r=i.exact,o=i.partial;if(!r&&!o)return this._replayKeydownEvents(),void this._clearPendingState();if(t.preventDefault(),t.stopPropagation(),r&&!o)return this._executeKeyBinding(r),void this._clearPendingState();r&&(this._exactKeyMatch=r),this._keydownEvents.push(t),this._startTimer()}},e.prototype._startTimer=function(){var t=this;this._clearTimer(),this._timerID=window.setTimeout((function(){t._onPendingTimeout()}),W.CHORD_TIMEOUT)},e.prototype._clearTimer=function(){0!==this._timerID&&(clearTimeout(this._timerID),this._timerID=0)},e.prototype._replayKeydownEvents=function(){0!==this._keydownEvents.length&&(this._replaying=!0,this._keydownEvents.forEach(W.replayKeyEvent),this._replaying=!1)},e.prototype._executeKeyBinding=function(t){var e=t.command,n=t.args;if(this.hasCommand(e)&&this.isEnabled(e,n))this.execute(e,n);else{var i=this.hasCommand(e)?"enabled":"registered",r="Cannot execute key binding '"+t.keys.join(", ")+"':",o="command '"+e+"' is not "+i+".";console.warn(r+" "+o)}},e.prototype._clearPendingState=function(){this._clearTimer(),this._exactKeyMatch=null,this._keystrokes.length=0,this._keydownEvents.length=0},e.prototype._onPendingTimeout=function(){this._timerID=0,this._exactKeyMatch?this._executeKeyBinding(this._exactKeyMatch):this._replayKeydownEvents(),this._clearPendingState()},e}();!function(t){function e(t){for(var e="",n=!1,i=!1,r=!1,o=!1,s=0,a=t.split(/\s+/);s<a.length;s++){var l=a[s];"Accel"===l?P.IS_MAC?i=!0:r=!0:"Alt"===l?n=!0:"Cmd"===l?i=!0:"Ctrl"===l?r=!0:"Shift"===l?o=!0:l.length>0&&(e=l)}return{cmd:i,ctrl:r,alt:n,shift:o,key:e}}function n(t){var n="",i=e(t);return i.ctrl&&(n+="Ctrl "),i.alt&&(n+="Alt "),i.shift&&(n+="Shift "),i.cmd&&P.IS_MAC&&(n+="Cmd "),n+i.key}t.parseKeystroke=e,t.normalizeKeystroke=n,t.normalizeKeys=function(t){return(P.IS_WIN?t.winKeys||t.keys:P.IS_MAC?t.macKeys||t.keys:t.linuxKeys||t.keys).map(n)},t.formatKeystroke=function(t){var n="",i=e(t);return P.IS_MAC?(i.ctrl&&(n+="⌃ "),i.alt&&(n+="⌥ "),i.shift&&(n+="⇧ "),i.cmd&&(n+="⌘ ")):(i.ctrl&&(n+="Ctrl+"),i.alt&&(n+="Alt+"),i.shift&&(n+="Shift+")),n+i.key},t.keystrokeForKeydownEvent=function(t){var e=B().keyForKeydownEvent(t);if(!e)return"";var n="";return t.ctrlKey&&(n+="Ctrl "),t.altKey&&(n+="Alt "),t.shiftKey&&(n+="Shift "),t.metaKey&&P.IS_MAC&&(n+="Cmd "),n+e}}(H||(H={})),function(t){t.CHORD_TIMEOUT=1e3,t.createCommand=function(t){var l,c;return t.icon&&"string"!=typeof t.icon?(c=a(t.iconClass,e),l=a(t.icon,s)):l=c=a(t.iconClass||t.icon,e),{execute:t.execute,label:a(t.label,e),mnemonic:a(t.mnemonic,n),icon:l,iconClass:c,iconLabel:a(t.iconLabel,e),caption:a(t.caption,e),usage:a(t.usage,e),className:a(t.className,e),dataset:a(t.dataset,o),isEnabled:t.isEnabled||i,isToggled:t.isToggled||r,isToggleable:t.isToggleable||!!t.isToggled,isVisible:t.isVisible||i}},t.createKeyBinding=function(t){return{keys:H.normalizeKeys(t),selector:l(t),command:t.command,args:t.args||v.emptyObject}},t.matchKeyBinding=function(t,e,n){for(var i=null,r=!1,o=1/0,s=0,a=0,l=t.length;a<l;++a){var d=t[a],h=c(d.keys,e);if(0!==h)if(2!==h){var p=u(d.selector,n);if(!(-1===p||p>o)){var f=L.calculateSpecificity(d.selector);(!i||p<o||f>=s)&&(i=d,o=p,s=f)}}else r||-1===u(d.selector,n)||(r=!0)}return{exact:i,partial:r}},t.replayKeyEvent=function(t){t.target.dispatchEvent(function(t){var e=document.createEvent("Event"),n=t.bubbles||!0,i=t.cancelable||!0;return e.initEvent(t.type||"keydown",n,i),e.key=t.key||"",e.keyCode=t.keyCode||0,e.which=t.keyCode||0,e.ctrlKey=t.ctrlKey||!1,e.altKey=t.altKey||!1,e.shiftKey=t.shiftKey||!1,e.metaKey=t.metaKey||!1,e.view=t.view||window,e}(t))};var e=function(){return""},n=function(){return-1},i=function(){return!0},r=function(){return!1},o=function(){return{}},s=function(){};function a(t,e){return void 0===t?e:"function"==typeof t?t:function(){return t}}function l(t){if(-1!==t.selector.indexOf(","))throw new Error("Selector cannot contain commas: "+t.selector);if(!L.isValid(t.selector))throw new Error("Invalid selector: "+t.selector);return t.selector}function c(t,e){if(t.length<e.length)return 0;for(var n=0,i=e.length;n<i;++n)if(t[n]!==e[n])return 0;return t.length>e.length?2:1}function u(t,e){for(var n=e.target,i=e.currentTarget,r=0;null!==n;n=n.parentElement,++r){if(n.hasAttribute("data-lm-suppress-shortcuts"))return-1;if(n.hasAttribute("data-p-suppress-shortcuts"))return-1;if(L.matches(n,t))return r;if(n===i)return-1}return-1}}(W||(W={}));var F,j=function(){function t(t){this._root=new F.LeafNode,this.cmp=t}return Object.defineProperty(t.prototype,"isEmpty",{get:function(){return 0===this._root.size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._root.size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"first",{get:function(){var t=F.firstLeaf(this._root);return t.size>0?t.items[0]:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"last",{get:function(){var t=F.lastLeaf(this._root);return t.size>0?t.items[t.size-1]:void 0},enumerable:!0,configurable:!0}),t.prototype.iter=function(){return F.iterItems(this._root)},t.prototype.retro=function(){return F.retroItems(this._root)},t.prototype.slice=function(t,e){return F.sliceItems(this._root,t,e)},t.prototype.retroSlice=function(t,e){return F.retroSliceItems(this._root,t,e)},t.prototype.at=function(t){return F.itemAt(this._root,t)},t.prototype.has=function(t,e){return F.hasItem(this._root,t,e)},t.prototype.indexOf=function(t,e){return F.indexOf(this._root,t,e)},t.prototype.get=function(t,e){return F.getItem(this._root,t,e)},t.prototype.assign=function(t){this.clear(),this.update(t)},t.prototype.insert=function(t){var e=F.insertItem(this._root,t,this.cmp);return this._root=F.maybeSplitRoot(this._root),e},t.prototype.update=function(t){var e=this;i(t,(function(t){e.insert(t)}))},t.prototype.delete=function(t,e){var n=F.deleteItem(this._root,t,e);return this._root=F.maybeExtractRoot(this._root),n},t.prototype.remove=function(t){var e=F.removeItem(this._root,t);return this._root=F.maybeExtractRoot(this._root),e},t.prototype.clear=function(){F.clear(this._root),this._root=new F.LeafNode},t}();!function(t){t.from=function(e,n){var i=new t(n);return i.assign(e),i}}(j||(j={})),function(e){var n=function(){function t(){this.items=[],this.sizes=[],this.children=[]}return Object.defineProperty(t.prototype,"type",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.sizes[this.sizes.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.children.length},enumerable:!0,configurable:!0}),t}();e.BranchNode=n;var r=function(){function t(){this.next=null,this.prev=null,this.items=[]}return Object.defineProperty(t.prototype,"type",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this.items.length},enumerable:!0,configurable:!0}),t}();function o(t){for(;0===t.type;)t=t.children[0];return t}function s(t){for(;0===t.type;)t=t.children[t.children.length-1];return t}function l(t){0===t.type?(i(t.children,l),t.children.length=0,t.sizes.length=0,t.items.length=0):(t.items.length=0,t.next=null,t.prev=null)}e.LeafNode=r,e.firstLeaf=o,e.lastLeaf=s,e.iterItems=function(t){var e=o(t);return new d(e,0,-1)},e.retroItems=function(t){var e=s(t);return new h(e,e.size-1,-1)},e.sliceItems=function(t,e,n){e=void 0===e?0:e<0?Math.max(0,e+t.size):Math.min(e,t.size),n=void 0===n?t.size:n<0?Math.max(0,n+t.size):Math.min(n,t.size);var i=Math.max(0,n-e);if(0===i)return a();for(;0===t.type;){var r=p(t.sizes,e);r>0&&(e-=t.sizes[r-1]),t=t.children[r]}return new d(t,e,i)},e.retroSliceItems=function(t,e,n){e=void 0===e?t.size-1:e<0?Math.max(-1,e+t.size):Math.min(e,t.size-1),n=void 0===n?-1:n<0?Math.max(-1,n+t.size):Math.min(n,t.size-1);var i=Math.max(0,e-n);if(0===i)return a();for(;0===t.type;){var r=p(t.sizes,e);r>0&&(e-=t.sizes[r-1]),t=t.children[r]}return new h(t,e,i)},e.itemAt=function(t,e){if(e<0&&(e+=t.size),!(e<0||e>=t.size)){for(;0===t.type;){var n=p(t.sizes,e);n>0&&(e-=t.sizes[n-1]),t=t.children[n]}return t.items[e]}},e.hasItem=function(t,e,n){for(;0===t.type;){var i=f(t.items,e,n);t=t.children[i]}return m(t.items,e,n)>=0},e.indexOf=function(t,e,n){for(var i=0;0===t.type;){var r=f(t.items,e,n);r>0&&(i+=t.sizes[r-1]),t=t.children[r]}var o=m(t.items,e,n);return o>=0?i+o:-i+o},e.getItem=function(t,e,n){for(;0===t.type;){var i=f(t.items,e,n);t=t.children[i]}var r=m(t.items,e,n);return r>=0?t.items[r]:void 0},e.insertItem=function e(n,i,r){if(1===n.type){var o,s=m(n.items,i,r);return s>=0?(o=n.items[s],n.items[s]=i):(o=void 0,t.insert(n.items,-s-1,i)),o}var a=f(n.items,i,r),l=n.children[a],u=l.size,d=e(l,i,r),h=l.size;if(n.items[a]=l.items[0],u===h)return d;if(l.width>c){var p=v(l);t.insert(n.children,a+1,p),t.insert(n.items,a+1,p.items[0])}return g(n,a),d},e.deleteItem=function e(n,i,r){if(1===n.type){var o=m(n.items,i,r);if(o<0)return;return t.removeAt(n.items,o)}var s=f(n.items,i,r),a=n.children[s],l=a.size,c=e(a,i,r);return l===a.size||(n.items[s]=a.items[0],a.width<u&&(s=y(n,s)),g(n,s)),c},e.removeItem=function e(n,i){if(i<0&&(i+=n.size),!(i<0||i>=n.size)){if(1===n.type)return t.removeAt(n.items,i);var r=p(n.sizes,i);r>0&&(i-=n.sizes[r]);var o=n.children[r],s=e(o,i);return n.items[r]=o.items[0],o.width<u&&(r=y(n,r)),g(n,r),s}},e.clear=l,e.maybeSplitRoot=function(t){if(t.width<=c)return t;var e=new n,i=v(t);return e.sizes[0]=t.size,e.sizes[1]=t.size+i.size,e.children[0]=t,e.children[1]=i,e.items[0]=t.items[0],e.items[1]=i.items[0],e},e.maybeExtractRoot=function(t){if(1===t.type)return t;if(t.children.length>1)return t;var e=t.children.pop();return l(t),e};var c=32,u=c>>1,d=function(){function t(t,e,n){this._node=t,this._index=e,this._count=n}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._node,this._index,this._count)},t.prototype.next=function(){if(null!==this._node&&0!==this._count)return this._index>=this._node.size?(this._node=this._node.next,this._index=0,this.next()):(this._count>0&&this._count--,this._node.items[this._index++])},t}(),h=function(){function t(t,e,n){this._node=t,this._index=e,this._count=n}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._node,this._index,this._count)},t.prototype.next=function(){if(null!==this._node&&0!==this._count)return this._index>=this._node.size&&(this._index=this._node.size-1),this._index<0?(this._node=this._node.prev,this._index=this._node?this._node.size-1:-1,this.next()):(this._count>0&&this._count--,this._node.items[this._index--])},t}();function p(t,e){for(var n=t.length,i=0;i<n;++i)if(t[i]>e)return i;return n-1}function f(t,e,n){for(var i=t.length,r=1;r<i;++r)if(n(t[r],e)>0)return r-1;return i-1}function m(t,e,n){for(var i=t.length,r=0;r<i;++r){var o=n(t[r],e);if(0===o)return r;if(o>0)return-r-1}return-i-1}function g(t,e){for(var n=t.sizes,i=t.children,r=e>0?n[e-1]:0,o=i.length;e<o;++e)r=n[e]=r+i[e].size;n.length=i.length}function v(t){if(1===t.type){for(var e=new r,i=t.items,o=e.items,s=u,a=i.length;s<a;++s)o.push(i[s]);return i.length=u,t.next&&(t.next.prev=e),e.next=t.next,e.prev=t,t.next=e,e}var l=new n,c=t.children,d=l.children;for(s=u,a=c.length;s<a;++s)d.push(c[s]);c.length=u;var h=t.items,p=l.items;for(s=u,a=h.length;s<a;++s)p.push(h[s]);return h.length=u,g(t,u),g(l,0),l}function y(e,n){var i,r,o,s,a,c,d=e.children[n],h=0===n?e.children[n+1]:e.children[n-1],p=0===n,f=1===d.type,m=h.width>u;if(f&&m&&p){var v=h;return(y=d).items.push(v.items.shift()),e.items[n+1]=v.items[0],n}if(f&&m&&!p)return v=h,(y=d).items.unshift(v.items.pop()),e.items[n]=y.items[0],n-1;if(f&&!m&&p){var y=d;return(i=(v=h).items).unshift.apply(i,y.items),t.removeAt(e.children,n),t.removeAt(e.items,n+1),y.prev&&(y.prev.next=v),v.prev=y.prev,l(y),n}if(f&&!m&&!p)return y=d,(r=(v=h).items).push.apply(r,y.items),t.removeAt(e.children,n),t.removeAt(e.items,n),y.next&&(y.next.prev=v),v.next=y.next,l(y),n-1;if(!f&&m&&p)return v=h,(y=d).children.push(v.children.shift()),y.items.push(v.items.shift()),e.items[n+1]=v.items[0],g(y,y.width-1),g(v,0),n;if(!f&&m&&!p)return v=h,(y=d).children.unshift(v.children.pop()),y.items.unshift(v.items.pop()),e.items[n]=y.items[0],g(y,0),g(v,v.width-1),n-1;if(!f&&!m&&p)return y=d,(o=(v=h).children).unshift.apply(o,y.children),(s=v.items).unshift.apply(s,y.items),t.removeAt(e.children,n),t.removeAt(e.items,n+1),g(v,0),y.children.length=0,l(y),n;if(!f&&!m&&!p)return y=d,(a=(v=h).children).push.apply(a,y.children),(c=v.items).push.apply(c,y.items),t.removeAt(e.children,n),t.removeAt(e.items,n),g(v,0),y.children.length=0,l(y),n-1;throw"unreachable"}}(F||(F={}));var q,V=function(){function t(){this._first=null,this._last=null,this._size=0}return Object.defineProperty(t.prototype,"isEmpty",{get:function(){return 0===this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"first",{get:function(){return this._first?this._first.value:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"last",{get:function(){return this._last?this._last.value:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"firstNode",{get:function(){return this._first},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lastNode",{get:function(){return this._last},enumerable:!0,configurable:!0}),t.prototype.iter=function(){return new t.ForwardValueIterator(this._first)},t.prototype.retro=function(){return new t.RetroValueIterator(this._last)},t.prototype.nodes=function(){return new t.ForwardNodeIterator(this._first)},t.prototype.retroNodes=function(){return new t.RetroNodeIterator(this._last)},t.prototype.assign=function(t){var e=this;this.clear(),i(t,(function(t){e.addLast(t)}))},t.prototype.push=function(t){this.addLast(t)},t.prototype.pop=function(){return this.removeLast()},t.prototype.shift=function(t){this.addFirst(t)},t.prototype.unshift=function(){return this.removeFirst()},t.prototype.addFirst=function(t){var e=new q.LinkedListNode(this,t);return this._first?(e.next=this._first,this._first.prev=e,this._first=e):(this._first=e,this._last=e),this._size++,e},t.prototype.addLast=function(t){var e=new q.LinkedListNode(this,t);return this._last?(e.prev=this._last,this._last.next=e,this._last=e):(this._first=e,this._last=e),this._size++,e},t.prototype.insertBefore=function(t,e){if(!e||e===this._first)return this.addFirst(t);if(!(e instanceof q.LinkedListNode)||e.list!==this)throw new Error("Reference node is not owned by the list.");var n=new q.LinkedListNode(this,t),i=e,r=i.prev;return n.next=i,n.prev=r,i.prev=n,r.next=n,this._size++,n},t.prototype.insertAfter=function(t,e){if(!e||e===this._last)return this.addLast(t);if(!(e instanceof q.LinkedListNode)||e.list!==this)throw new Error("Reference node is not owned by the list.");var n=new q.LinkedListNode(this,t),i=e,r=i.next;return n.next=r,n.prev=i,i.next=n,r.prev=n,this._size++,n},t.prototype.removeFirst=function(){var t=this._first;if(t)return t===this._last?(this._first=null,this._last=null):(this._first=t.next,this._first.prev=null),t.list=null,t.next=null,t.prev=null,this._size--,t.value},t.prototype.removeLast=function(){var t=this._last;if(t)return t===this._first?(this._first=null,this._last=null):(this._last=t.prev,this._last.next=null),t.list=null,t.next=null,t.prev=null,this._size--,t.value},t.prototype.removeNode=function(t){if(!(t instanceof q.LinkedListNode)||t.list!==this)throw new Error("Node is not owned by the list.");var e=t;e===this._first&&e===this._last?(this._first=null,this._last=null):e===this._first?(this._first=e.next,this._first.prev=null):e===this._last?(this._last=e.prev,this._last.next=null):(e.next.prev=e.prev,e.prev.next=e.next),e.list=null,e.next=null,e.prev=null,this._size--},t.prototype.clear=function(){for(var t=this._first;t;){var e=t.next;t.list=null,t.prev=null,t.next=null,t=e}this._first=null,this._last=null,this._size=0},t}();!function(t){t.from=function(e){var n=new t;return n.assign(e),n};var e=function(){function t(t){this._node=t}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._node)},t.prototype.next=function(){if(this._node){var t=this._node;return this._node=t.next,t.value}},t}();t.ForwardValueIterator=e;var n=function(){function t(t){this._node=t}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._node)},t.prototype.next=function(){if(this._node){var t=this._node;return this._node=t.prev,t.value}},t}();t.RetroValueIterator=n;var i=function(){function t(t){this._node=t}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._node)},t.prototype.next=function(){if(this._node){var t=this._node;return this._node=t.next,t}},t}();t.ForwardNodeIterator=i;var r=function(){function t(t){this._node=t}return t.prototype.iter=function(){return this},t.prototype.clone=function(){return new t(this._node)},t.prototype.next=function(){if(this._node){var t=this._node;return this._node=t.prev,t}},t}();t.RetroNodeIterator=r}(V||(V={})),function(t){t.LinkedListNode=function(t,e){this.list=null,this.next=null,this.prev=null,this.list=t,this.value=e}}(q||(q={}));var U,K=function(t,e){return(K=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},G=function(){function t(t){this.type=t}return Object.defineProperty(t.prototype,"isConflatable",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype.conflate=function(t){return!1},t}(),$=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return function(t,e){function n(){this.constructor=t}K(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),Object.defineProperty(e.prototype,"isConflatable",{get:function(){return!0},enumerable:!0,configurable:!0}),e.prototype.conflate=function(t){return!0},e}(G);!function(n){function r(t,n){var i,r=s.get(t);r&&0!==r.length?function(i,r){for(var o,s=e(i);void 0!==(o=s.next());)if((a=o)&&!function(t,e,n){var i=!0;try{i="function"==typeof t?t(e,n):t.messageHook(e,n)}catch(t){l(t)}return i}(a,t,n))return!1;var a;return!0}("function"==typeof(i=r).retro?i.retro():new b(i))&&p(t,n):p(t,n)}n.sendMessage=r,n.postMessage=function(t,n){n.isConflatable&&function(i,r){for(var o,s=e(i);void 0!==(o=s.next());)if((a=o).handler===t&&a.msg&&a.msg.type===n.type&&a.msg.isConflatable&&a.msg.conflate(n))return!0;var a;return!1}(o)||function(t,e){o.addLast({handler:t,msg:e}),0===c&&(c=d(f))}(t,n)},n.installMessageHook=function(t,e){var n=s.get(t);n&&-1!==n.indexOf(e)||(n?n.push(e):s.set(t,[e]))},n.removeMessageHook=function(t,e){var n=s.get(t);if(n){var i=n.indexOf(e);-1!==i&&(n[i]=null,m(n))}},n.clearData=function(e){var n=s.get(e);n&&n.length>0&&(t.fill(n,null),m(n)),i(o,(function(t){t.handler===e&&(t.handler=null,t.msg=null)}))},n.flush=function(){u||0===c||(h(c),u=!0,f(),u=!1)},n.getExceptionHandler=function(){return l},n.setExceptionHandler=function(t){var e=l;return l=t,e};var o=new V,s=new WeakMap,a=new Set,l=function(t){console.error(t)},c=0,u=!1,d="function"==typeof requestAnimationFrame?requestAnimationFrame:setImmediate,h="function"==typeof cancelAnimationFrame?cancelAnimationFrame:clearImmediate;function p(t,e){try{t.processMessage(e)}catch(t){l(t)}}function f(){if(c=0,!o.isEmpty){var t={handler:null,msg:null};for(o.addLast(t);;){var e=o.removeFirst();if(e===t)return;e.handler&&e.msg&&r(e.handler,e.msg)}}}function m(t){0===a.size&&d(g),a.add(t)}function g(){a.forEach(v),a.clear()}function v(e){t.removeAllWhere(e,y)}function y(t){return null===t}}(U||(U={}));var Y,X=function(){function t(t){this._pid=Y.nextPID(),this.name=t.name,this._create=t.create,this._coerce=t.coerce||null,this._compare=t.compare||null,this._changed=t.changed||null}return t.prototype.get=function(t){var e=Y.ensureMap(t);return this._pid in e?e[this._pid]:e[this._pid]=this._createValue(t)},t.prototype.set=function(t,e){var n,i=Y.ensureMap(t);n=this._pid in i?i[this._pid]:i[this._pid]=this._createValue(t);var r=this._coerceValue(t,e);this._maybeNotify(t,n,i[this._pid]=r)},t.prototype.coerce=function(t){var e,n=Y.ensureMap(t);e=this._pid in n?n[this._pid]:n[this._pid]=this._createValue(t);var i=this._coerceValue(t,e);this._maybeNotify(t,e,n[this._pid]=i)},t.prototype._createValue=function(t){return(0,this._create)(t)},t.prototype._coerceValue=function(t,e){var n=this._coerce;return n?n(t,e):e},t.prototype._compareValue=function(t,e){var n=this._compare;return n?n(t,e):t===e},t.prototype._maybeNotify=function(t,e,n){var i=this._changed;i&&!this._compareValue(e,n)&&i(t,e,n)},t}();!function(t){t.clearData=function(t){Y.ownerData.delete(t)}}(X||(X={})),function(t){var e;t.ownerData=new WeakMap,t.nextPID=(e=0,function(){return"pid-"+(""+Math.random()).slice(2)+"-"+e++}),t.ensureMap=function(e){var n=t.ownerData.get(e);return n||(n=Object.create(null),t.ownerData.set(e,n),n)}}(Y||(Y={}));var J,Z,Q,tt=function(t,e){return(tt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},et=function(t){this.type="text",this.content=t},nt=function(t,e,n,i){this.type="element",this.tag=t,this.attrs=e,this.children=n,this.renderer=i};function it(t){for(var e,n={},i=[],r=1,o=arguments.length;r<o;++r){var s=arguments[r];"string"==typeof s?i.push(new et(s)):s instanceof et||s instanceof nt?i.push(s):s instanceof Array?a(i,s):1!==r&&2!==r||!s||"object"!=typeof s||("render"in s?e=s:n=s)}return new nt(t,n,i,e);function a(t,e){for(var n=0,i=e;n<i.length;n++){var r=i[n];"string"==typeof r?t.push(new et(r)):(r instanceof et||r instanceof nt)&&t.push(r)}}}(function(t,e){function n(){this.constructor=t}tt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)})((function(t,e,n){return Q.call(this,t,e,[],n||void 0)||this}),Q=nt),function(t){t.a=t.bind(void 0,"a"),t.abbr=t.bind(void 0,"abbr"),t.address=t.bind(void 0,"address"),t.area=t.bind(void 0,"area"),t.article=t.bind(void 0,"article"),t.aside=t.bind(void 0,"aside"),t.audio=t.bind(void 0,"audio"),t.b=t.bind(void 0,"b"),t.bdi=t.bind(void 0,"bdi"),t.bdo=t.bind(void 0,"bdo"),t.blockquote=t.bind(void 0,"blockquote"),t.br=t.bind(void 0,"br"),t.button=t.bind(void 0,"button"),t.canvas=t.bind(void 0,"canvas"),t.caption=t.bind(void 0,"caption"),t.cite=t.bind(void 0,"cite"),t.code=t.bind(void 0,"code"),t.col=t.bind(void 0,"col"),t.colgroup=t.bind(void 0,"colgroup"),t.data=t.bind(void 0,"data"),t.datalist=t.bind(void 0,"datalist"),t.dd=t.bind(void 0,"dd"),t.del=t.bind(void 0,"del"),t.dfn=t.bind(void 0,"dfn"),t.div=t.bind(void 0,"div"),t.dl=t.bind(void 0,"dl"),t.dt=t.bind(void 0,"dt"),t.em=t.bind(void 0,"em"),t.embed=t.bind(void 0,"embed"),t.fieldset=t.bind(void 0,"fieldset"),t.figcaption=t.bind(void 0,"figcaption"),t.figure=t.bind(void 0,"figure"),t.footer=t.bind(void 0,"footer"),t.form=t.bind(void 0,"form"),t.h1=t.bind(void 0,"h1"),t.h2=t.bind(void 0,"h2"),t.h3=t.bind(void 0,"h3"),t.h4=t.bind(void 0,"h4"),t.h5=t.bind(void 0,"h5"),t.h6=t.bind(void 0,"h6"),t.header=t.bind(void 0,"header"),t.hr=t.bind(void 0,"hr"),t.i=t.bind(void 0,"i"),t.iframe=t.bind(void 0,"iframe"),t.img=t.bind(void 0,"img"),t.input=t.bind(void 0,"input"),t.ins=t.bind(void 0,"ins"),t.kbd=t.bind(void 0,"kbd"),t.label=t.bind(void 0,"label"),t.legend=t.bind(void 0,"legend"),t.li=t.bind(void 0,"li"),t.main=t.bind(void 0,"main"),t.map=t.bind(void 0,"map"),t.mark=t.bind(void 0,"mark"),t.meter=t.bind(void 0,"meter"),t.nav=t.bind(void 0,"nav"),t.noscript=t.bind(void 0,"noscript"),t.object=t.bind(void 0,"object"),t.ol=t.bind(void 0,"ol"),t.optgroup=t.bind(void 0,"optgroup"),t.option=t.bind(void 0,"option"),t.output=t.bind(void 0,"output"),t.p=t.bind(void 0,"p"),t.param=t.bind(void 0,"param"),t.pre=t.bind(void 0,"pre"),t.progress=t.bind(void 0,"progress"),t.q=t.bind(void 0,"q"),t.rp=t.bind(void 0,"rp"),t.rt=t.bind(void 0,"rt"),t.ruby=t.bind(void 0,"ruby"),t.s=t.bind(void 0,"s"),t.samp=t.bind(void 0,"samp"),t.section=t.bind(void 0,"section"),t.select=t.bind(void 0,"select"),t.small=t.bind(void 0,"small"),t.source=t.bind(void 0,"source"),t.span=t.bind(void 0,"span"),t.strong=t.bind(void 0,"strong"),t.sub=t.bind(void 0,"sub"),t.summary=t.bind(void 0,"summary"),t.sup=t.bind(void 0,"sup"),t.table=t.bind(void 0,"table"),t.tbody=t.bind(void 0,"tbody"),t.td=t.bind(void 0,"td"),t.textarea=t.bind(void 0,"textarea"),t.tfoot=t.bind(void 0,"tfoot"),t.th=t.bind(void 0,"th"),t.thead=t.bind(void 0,"thead"),t.time=t.bind(void 0,"time"),t.title=t.bind(void 0,"title"),t.tr=t.bind(void 0,"tr"),t.track=t.bind(void 0,"track"),t.u=t.bind(void 0,"u"),t.ul=t.bind(void 0,"ul"),t.var_=t.bind(void 0,"var"),t.video=t.bind(void 0,"video"),t.wbr=t.bind(void 0,"wbr")}(it||(it={})),function(t){t.realize=function(t){return Z.createDOMNode(t)},t.render=function(t,e){var n=Z.hostMap.get(e)||[],i=Z.asContentArray(t);Z.hostMap.set(e,i),Z.updateContent(e,n,i)}}(J||(J={})),function(e){function n(t){var e=arguments[1]||null,i=arguments[2]||null;if(e)e.insertBefore(n(t),i);else{if("text"===t.type)return document.createTextNode(t.content);if(o(e=document.createElement(t.tag),t.attrs),t.renderer)return t.renderer.render(e,{attrs:t.attrs,children:t.children}),e;for(var r=0,s=t.children.length;r<s;++r)n(t.children[r],e)}return e}function i(t,e,n,r){for(var o=e.length-1;o>=n;--o){var s=e[o],a=r?t.lastChild:t.childNodes[o];"text"===s.type||(s.renderer&&s.renderer.unrender?s.renderer.unrender(a,{attrs:s.attrs,children:s.children}):i(a,s.children,0,!1)),r&&t.removeChild(a)}}e.hostMap=new WeakMap,e.asContentArray=function(t){return t?t instanceof Array?t:[t]:[]},e.createDOMNode=n,e.updateContent=function e(r,o,a){if(o!==a){for(var l=function(t,e){for(var n=t.firstChild,i=Object.create(null),r=0,o=e;r<o.length;r++){var s=o[r];"element"===s.type&&s.attrs.key&&(i[s.attrs.key]={vNode:s,element:n}),n=n.nextSibling}return i}(r,o),c=o.slice(),u=r.firstChild,d=a.length,h=0;h<d;++h)if(h>=c.length)n(a[h],r);else{var p=c[h],f=a[h];if(p!==f)if("text"!==p.type||"text"!==f.type)if("text"!==p.type&&"text"!==f.type)if(!p.renderer==!f.renderer){var m=f.attrs.key;if(m&&m in l){var g=l[m];g.vNode!==p&&(t.move(c,c.indexOf(g.vNode,h+1),h),r.insertBefore(g.element,u),p=g.vNode,u=g.element)}if(p!==f){var v=p.attrs.key;v&&v!==m?(t.insert(c,h,f),n(f,r,u)):p.tag===f.tag?(s(u,p.attrs,f.attrs),f.renderer?f.renderer.render(u,{attrs:f.attrs,children:f.children}):e(u,p.children,f.children),u=u.nextSibling):(t.insert(c,h,f),n(f,r,u))}else u=u.nextSibling}else t.insert(c,h,f),n(f,r,u);else t.insert(c,h,f),n(f,r,u);else u.textContent=f.content,u=u.nextSibling;else u=u.nextSibling}i(r,c,d,!0)}};var r={key:!0,className:!0,htmlFor:!0,dataset:!0,style:!0};function o(t,e){for(var n in e)n in r||("on"===n.substr(0,2)?t[n]=e[n]:t.setAttribute(n,e[n]));void 0!==e.className&&t.setAttribute("class",e.className),void 0!==e.htmlFor&&t.setAttribute("for",e.htmlFor),e.dataset&&function(t,e){for(var n in e)t.setAttribute("data-"+n,e[n])}(t,e.dataset),e.style&&function(t,e){var n,i=t.style;for(n in e)i[n]=e[n]}(t,e.style)}function s(t,e,n){if(e!==n){var i;for(i in e)i in r||i in n||("on"===i.substr(0,2)?t[i]=null:t.removeAttribute(i));for(i in n)i in r||e[i]===n[i]||("on"===i.substr(0,2)?t[i]=n[i]:t.setAttribute(i,n[i]));e.className!==n.className&&(void 0!==n.className?t.setAttribute("class",n.className):t.removeAttribute("class")),e.htmlFor!==n.htmlFor&&(void 0!==n.htmlFor?t.setAttribute("for",n.htmlFor):t.removeAttribute("for")),e.dataset!==n.dataset&&function(t,e,n){for(var i in e)i in n||t.removeAttribute("data-"+i);for(var r in n)e[r]!==n[r]&&t.setAttribute("data-"+r,n[r])}(t,e.dataset||{},n.dataset||{}),e.style!==n.style&&function(t,e,n){var i,r=t.style;for(i in e)i in n||(r[i]="");for(i in n)e[i]!==n[i]&&(r[i]=n[i])}(t,e.style||{},n.style||{})}}}(Z||(Z={}));var rt,ot=function(){function t(t){var e=this;this._onScrollFrame=function(){if(e._scrollTarget){var t=e._scrollTarget,n=t.element,i=t.edge,r=t.distance,o=rt.SCROLL_EDGE_SIZE-r,s=Math.pow(o/rt.SCROLL_EDGE_SIZE,2),a=Math.max(1,Math.round(s*rt.SCROLL_EDGE_SIZE));switch(i){case"top":n.scrollTop-=a;break;case"left":n.scrollLeft-=a;break;case"right":n.scrollLeft+=a;break;case"bottom":n.scrollTop+=a}requestAnimationFrame(e._onScrollFrame)}},this._disposed=!1,this._dropAction="none",this._override=null,this._currentTarget=null,this._currentElement=null,this._promise=null,this._scrollTarget=null,this._resolve=null,this.mimeData=t.mimeData,this.dragImage=t.dragImage||null,this.proposedAction=t.proposedAction||"copy",this.supportedActions=t.supportedActions||"all",this.source=t.source||null}return t.prototype.dispose=function(){if(!this._disposed){if(this._disposed=!0,this._currentTarget){var t=rt.createMouseEvent("mouseup",-1,-1);rt.dispatchDragLeave(this,this._currentTarget,null,t)}this._finalize("none")}},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),t.prototype.start=function(t,e){var n=this;if(this._disposed)return Promise.resolve("none");if(this._promise)return this._promise;this._addListeners(),this._attachDragImage(t,e),this._promise=new Promise((function(t,e){n._resolve=t}));var i=rt.createMouseEvent("mousemove",t,e);return document.dispatchEvent(i),this._promise},t.prototype.handleEvent=function(t){switch(t.type){case"mousemove":this._evtMouseMove(t);break;case"mouseup":this._evtMouseUp(t);break;case"keydown":this._evtKeyDown(t);break;default:t.preventDefault(),t.stopPropagation()}},t.prototype.moveDragImage=function(t,e){if(this.dragImage){var n=this.dragImage.style;n.top=e+"px",n.left=t+"px"}},t.prototype._evtMouseMove=function(t){t.preventDefault(),t.stopPropagation(),this._updateCurrentTarget(t),this._updateDragScroll(t),this.moveDragImage(t.clientX,t.clientY)},t.prototype._evtMouseUp=function(t){if(t.preventDefault(),t.stopPropagation(),0===t.button)if(this._updateCurrentTarget(t),this._currentTarget){if("none"===this._dropAction)return rt.dispatchDragLeave(this,this._currentTarget,null,t),void this._finalize("none");var e=rt.dispatchDrop(this,this._currentTarget,t);this._finalize(e)}else this._finalize("none")},t.prototype._evtKeyDown=function(t){t.preventDefault(),t.stopPropagation(),27===t.keyCode&&this.dispose()},t.prototype._addListeners=function(){document.addEventListener("mousedown",this,!0),document.addEventListener("mousemove",this,!0),document.addEventListener("mouseup",this,!0),document.addEventListener("mouseenter",this,!0),document.addEventListener("mouseleave",this,!0),document.addEventListener("mouseover",this,!0),document.addEventListener("mouseout",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("keyup",this,!0),document.addEventListener("keypress",this,!0),document.addEventListener("contextmenu",this,!0)},t.prototype._removeListeners=function(){document.removeEventListener("mousedown",this,!0),document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("mouseenter",this,!0),document.removeEventListener("mouseleave",this,!0),document.removeEventListener("mouseover",this,!0),document.removeEventListener("mouseout",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("keyup",this,!0),document.removeEventListener("keypress",this,!0),document.removeEventListener("contextmenu",this,!0)},t.prototype._updateDragScroll=function(t){var e=rt.findScrollTarget(t);(this._scrollTarget||e)&&(this._scrollTarget||setTimeout(this._onScrollFrame,500),this._scrollTarget=e)},t.prototype._updateCurrentTarget=function(t){var e=this._currentTarget,n=this._currentTarget,i=this._currentElement,r=document.elementFromPoint(t.clientX,t.clientY);this._currentElement=r,r!==i&&r!==n&&rt.dispatchDragExit(this,n,r,t),r!==i&&r!==n&&(n=rt.dispatchDragEnter(this,r,n,t)),n!==e&&(this._currentTarget=n,rt.dispatchDragLeave(this,e,n,t));var o=rt.dispatchDragOver(this,n,t);this._setDropAction(o)},t.prototype._attachDragImage=function(t,e){if(this.dragImage){this.dragImage.classList.add("lm-mod-drag-image"),this.dragImage.classList.add("p-mod-drag-image");var n=this.dragImage.style;n.pointerEvents="none",n.position="fixed",n.top=e+"px",n.left=t+"px",document.body.appendChild(this.dragImage)}},t.prototype._detachDragImage=function(){if(this.dragImage){var t=this.dragImage.parentNode;t&&t.removeChild(this.dragImage)}},t.prototype._setDropAction=function(e){if(e=rt.validateAction(e,this.supportedActions),!this._override||this._dropAction!==e)switch(e){case"none":this._dropAction=e,this._override=t.overrideCursor("no-drop");break;case"copy":this._dropAction=e,this._override=t.overrideCursor("copy");break;case"link":this._dropAction=e,this._override=t.overrideCursor("alias");break;case"move":this._dropAction=e,this._override=t.overrideCursor("move")}},t.prototype._finalize=function(t){var e=this._resolve;this._removeListeners(),this._detachDragImage(),this._override&&(this._override.dispose(),this._override=null),this.mimeData.clear(),this._disposed=!0,this._dropAction="none",this._currentTarget=null,this._currentElement=null,this._scrollTarget=null,this._promise=null,this._resolve=null,e&&e(t)},t}();!function(t){t.overrideCursor=function(t){var n=++e;return document.body.style.cursor=t,document.body.classList.add("lm-mod-override-cursor"),document.body.classList.add("p-mod-override-cursor"),new S((function(){n===e&&(document.body.style.cursor="",document.body.classList.remove("lm-mod-override-cursor"),document.body.classList.remove("p-mod-override-cursor"))}))};var e=0}(ot||(ot={})),function(t){t.SCROLL_EDGE_SIZE=20,t.validateAction=function(t,i){return e[t]&n[i]?t:"none"},t.createMouseEvent=function(t,e,n){var i=document.createEvent("MouseEvent");return i.initMouseEvent(t,!0,!0,window,0,0,0,e,n,!1,!1,!1,!1,0,null),i},t.findScrollTarget=function(e){for(var n=e.clientX,i=e.clientY,r=document.elementFromPoint(n,i);r;r=r.parentElement){var o=r.hasAttribute("data-lm-dragscroll");if(o=o||r.hasAttribute("data-p-dragscroll")){var s=0,a=0;r===document.body&&(s=window.pageXOffset,a=window.pageYOffset);var l=r.getBoundingClientRect(),c=l.top+a,u=l.left+s,d=u+l.width,h=c+l.height;if(!(n<u||n>=d||i<c||i>=h)){var p=n-u+1,f=i-c+1,m=d-n,g=h-i,v=Math.min(p,f,m,g);if(!(v>t.SCROLL_EDGE_SIZE)){var y=void 0;switch(v){case g:y="bottom";break;case f:y="top";break;case m:y="right";break;case p:y="left";break;default:throw"unreachable"}var b=r.scrollWidth-r.clientWidth,_=r.scrollHeight-r.clientHeight,w=void 0;switch(y){case"top":w=_>0&&r.scrollTop>0;break;case"left":w=b>0&&r.scrollLeft>0;break;case"right":w=b>0&&r.scrollLeft<b;break;case"bottom":w=_>0&&r.scrollTop<_;break;default:throw"unreachable"}if(w)return{element:r,edge:y,distance:v}}}}}return null},t.dispatchDragEnter=function(t,e,n,r){if(!e)return null;var o=i("lm-dragenter",t,r,n),s=!e.dispatchEvent(o);return s?e:(o=i("p-dragenter",t,r,n),(s=!e.dispatchEvent(o))?e:e===document.body?n:(o=i("lm-dragenter",t,r,n),document.body.dispatchEvent(o),o=i("p-dragenter",t,r,n),document.body.dispatchEvent(o),document.body))},t.dispatchDragExit=function(t,e,n,r){if(e){var o=i("lm-dragexit",t,r,n);e.dispatchEvent(o),o=i("p-dragexit",t,r,n),e.dispatchEvent(o)}},t.dispatchDragLeave=function(t,e,n,r){if(e){var o=i("lm-dragleave",t,r,n);e.dispatchEvent(o),o=i("p-dragleave",t,r,n),e.dispatchEvent(o)}},t.dispatchDragOver=function(t,e,n){if(!e)return"none";var r=i("lm-dragover",t,n,null),o=!e.dispatchEvent(r);return o?r.dropAction:(r=i("p-dragover",t,n,null),(o=!e.dispatchEvent(r))?r.dropAction:"none")},t.dispatchDrop=function(t,e,n){if(!e)return"none";var r=i("lm-drop",t,n,null),o=!e.dispatchEvent(r);return o?r.dropAction:(r=i("p-drop",t,n,null),(o=!e.dispatchEvent(r))?r.dropAction:"none")};var e={none:0,copy:1,link:2,move:4},n={none:e.none,copy:e.copy,link:e.link,move:e.move,"copy-link":e.copy|e.link,"copy-move":e.copy|e.move,"link-move":e.link|e.move,all:e.copy|e.link|e.move};function i(t,e,n,i){var r=document.createEvent("MouseEvent");return r.initMouseEvent(t,!0,!0,window,0,n.screenX,n.screenY,n.clientX,n.clientY,n.ctrlKey,n.altKey,n.shiftKey,n.metaKey,n.button,i),r.dropAction="none",r.mimeData=e.mimeData,r.proposedAction=e.proposedAction,r.supportedActions=e.supportedActions,r.source=e.source,r}}(rt||(rt={}));var st,at=function(){this.sizeHint=0,this.minSize=0,this.maxSize=1/0,this.stretch=1,this.size=0,this.done=!1};!function(t){t.calc=function(t,e){var n=t.length;if(0===n)return e;for(var i=0,r=0,o=0,s=0,a=0,l=0;l<n;++l){var c=(y=t[l]).minSize,u=y.maxSize,d=y.sizeHint;y.done=!1,y.size=Math.max(c,Math.min(d,u)),o+=y.size,i+=c,r+=u,y.stretch>0&&(s+=y.stretch,a++)}if(e===o)return 0;if(e<=i){for(l=0;l<n;++l)(y=t[l]).size=y.minSize;return e-i}if(e>=r){for(l=0;l<n;++l)(y=t[l]).size=y.maxSize;return e-r}var h=.01,p=n;if(e<o){for(var f=o-e;a>0&&f>h;){var m=f,g=s;for(l=0;l<n;++l)if(!(y=t[l]).done&&0!==y.stretch){var v=y.stretch*m/g;y.size-v<=y.minSize?(f-=y.size-y.minSize,s-=y.stretch,y.size=y.minSize,y.done=!0,p--,a--):(f-=v,y.size-=v)}}for(;p>0&&f>h;)for(v=f/p,l=0;l<n;++l)(y=t[l]).done||(y.size-v<=y.minSize?(f-=y.size-y.minSize,y.size=y.minSize,y.done=!0,p--):(f-=v,y.size-=v))}else{for(f=e-o;a>0&&f>h;)for(m=f,g=s,l=0;l<n;++l)(y=t[l]).done||0===y.stretch||(v=y.stretch*m/g,y.size+v>=y.maxSize?(f-=y.maxSize-y.size,s-=y.stretch,y.size=y.maxSize,y.done=!0,p--,a--):(f-=v,y.size+=v));for(;p>0&&f>h;)for(v=f/p,l=0;l<n;++l){var y;(y=t[l]).done||(y.size+v>=y.maxSize?(f-=y.maxSize-y.size,y.size=y.maxSize,y.done=!0,p--):(f-=v,y.size+=v))}}return 0},t.adjust=function(t,e,n){0!==t.length&&0!==n&&(n>0?function(t,e,n){for(var i=0,r=0;r<=e;++r)i+=(c=t[r]).maxSize-c.size;for(var o=0,s=(r=e+1,t.length);r<s;++r)o+=(c=t[r]).size-c.minSize;var a=n=Math.min(n,i,o);for(r=e;r>=0&&a>0;--r)(u=(c=t[r]).maxSize-c.size)>=a?(c.sizeHint=c.size+a,a=0):(c.sizeHint=c.size+u,a-=u);var l=n;for(r=e+1,s=t.length;r<s&&l>0;++r){var c,u;(u=(c=t[r]).size-c.minSize)>=l?(c.sizeHint=c.size-l,l=0):(c.sizeHint=c.size-u,l-=u)}}(t,e,n):function(t,e,n){for(var i=0,r=e+1,o=t.length;r<o;++r)i+=(c=t[r]).maxSize-c.size;var s=0;for(r=0;r<=e;++r)s+=(c=t[r]).size-c.minSize;var a=n=Math.min(n,i,s);for(r=e+1,o=t.length;r<o&&a>0;++r)(u=(c=t[r]).maxSize-c.size)>=a?(c.sizeHint=c.size+a,a=0):(c.sizeHint=c.size+u,a-=u);var l=n;for(r=e;r>=0&&l>0;--r){var c,u;(u=(c=t[r]).size-c.minSize)>=l?(c.sizeHint=c.size-l,l=0):(c.sizeHint=c.size-u,l-=u)}}(t,e,-n))}}(st||(st={}));var lt=function(t,e){return(lt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function ct(t,e){function n(){this.constructor=t}lt(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var ut,dt=function(){return(dt=Object.assign||function(t){for(var e,n=1,i=arguments.length;n<i;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},ht=function(){function t(t){this._label="",this._caption="",this._mnemonic=-1,this._iconClass="",this._iconLabel="",this._className="",this._closable=!1,this._changed=new E(this),this.owner=t.owner,void 0!==t.label&&(this._label=t.label),void 0!==t.mnemonic&&(this._mnemonic=t.mnemonic),void 0!==t.icon?"string"==typeof t.icon?(this._icon=null,this._iconClass=t.icon):this._icon=t.icon:this._icon=null,void 0!==t.iconClass&&(this._iconClass=t.iconClass),void 0!==t.iconLabel&&(this._iconLabel=t.iconLabel),void 0!==t.iconRenderer&&(this._icon=t.iconRenderer),void 0!==t.caption&&(this._caption=t.caption),void 0!==t.className&&(this._className=t.className),void 0!==t.closable&&(this._closable=t.closable),this._dataset=t.dataset||{}}return Object.defineProperty(t.prototype,"changed",{get:function(){return this._changed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"label",{get:function(){return this._label},set:function(t){this._label!==t&&(this._label=t,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mnemonic",{get:function(){return this._mnemonic},set:function(t){this._mnemonic!==t&&(this._mnemonic=t,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"icon",{get:function(){return null===this._icon?this.iconClass:this._icon},set:function(t){if("string"==typeof t)this._icon=null,this.iconClass=t;else{if(this._icon===t)return;this._icon=t,this._changed.emit(void 0)}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconClass",{get:function(){return this._iconClass},set:function(t){this._iconClass!==t&&(this._iconClass=t,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconLabel",{get:function(){return this._iconLabel},set:function(t){this._iconLabel!==t&&(this._iconLabel=t,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"iconRenderer",{get:function(){return this._icon||void 0},set:function(t){this.icon=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"caption",{get:function(){return this._caption},set:function(t){this._caption!==t&&(this._caption=t,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return this._className},set:function(t){this._className!==t&&(this._className=t,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"closable",{get:function(){return this._closable},set:function(t){this._closable!==t&&(this._closable=t,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataset",{get:function(){return this._dataset},set:function(t){this._dataset!==t&&(this._dataset=t,this._changed.emit(void 0))},enumerable:!0,configurable:!0}),t}(),pt=function(){function t(t){void 0===t&&(t={}),this._flags=0,this._layout=null,this._parent=null,this._disposed=new E(this),this.node=ut.createNode(t),this.addClass("lm-Widget"),this.addClass("p-Widget")}return t.prototype.dispose=function(){this.isDisposed||(this.setFlag(t.Flag.IsDisposed),this._disposed.emit(void 0),this.parent?this.parent=null:this.isAttached&&t.detach(this),this._layout&&(this._layout.dispose(),this._layout=null),E.clearData(this),U.clearData(this),X.clearData(this))},Object.defineProperty(t.prototype,"disposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this.testFlag(t.Flag.IsDisposed)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isAttached",{get:function(){return this.testFlag(t.Flag.IsAttached)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isHidden",{get:function(){return this.testFlag(t.Flag.IsHidden)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this.testFlag(t.Flag.IsVisible)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"title",{get:function(){return ut.titleProperty.get(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"id",{get:function(){return this.node.id},set:function(t){this.node.id=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"dataset",{get:function(){return this.node.dataset},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},set:function(e){if(this._parent!==e){if(e&&this.contains(e))throw new Error("Invalid parent widget.");if(this._parent&&!this._parent.isDisposed){var n=new t.ChildMessage("child-removed",this);U.sendMessage(this._parent,n)}this._parent=e,this._parent&&!this._parent.isDisposed&&(n=new t.ChildMessage("child-added",this),U.sendMessage(this._parent,n)),this.isDisposed||U.sendMessage(this,t.Msg.ParentChanged)}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"layout",{get:function(){return this._layout},set:function(e){if(this._layout!==e){if(this.testFlag(t.Flag.DisallowLayout))throw new Error("Cannot set widget layout.");if(this._layout)throw new Error("Cannot change widget layout.");if(e.parent)throw new Error("Cannot change layout parent.");this._layout=e,e.parent=this}},enumerable:!0,configurable:!0}),t.prototype.children=function(){return this._layout?this._layout.iter():a()},t.prototype.contains=function(t){for(var e=t;e;e=e._parent)if(e===this)return!0;return!1},t.prototype.hasClass=function(t){return this.node.classList.contains(t)},t.prototype.addClass=function(t){this.node.classList.add(t)},t.prototype.removeClass=function(t){this.node.classList.remove(t)},t.prototype.toggleClass=function(t,e){return!0===e?(this.node.classList.add(t),!0):!1===e?(this.node.classList.remove(t),!1):this.node.classList.toggle(t)},t.prototype.update=function(){U.postMessage(this,t.Msg.UpdateRequest)},t.prototype.fit=function(){U.postMessage(this,t.Msg.FitRequest)},t.prototype.activate=function(){U.postMessage(this,t.Msg.ActivateRequest)},t.prototype.close=function(){U.sendMessage(this,t.Msg.CloseRequest)},t.prototype.show=function(){if(this.testFlag(t.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||U.sendMessage(this,t.Msg.BeforeShow),this.clearFlag(t.Flag.IsHidden),this.removeClass("lm-mod-hidden"),this.removeClass("p-mod-hidden"),!this.isAttached||this.parent&&!this.parent.isVisible||U.sendMessage(this,t.Msg.AfterShow),this.parent)){var e=new t.ChildMessage("child-shown",this);U.sendMessage(this.parent,e)}},t.prototype.hide=function(){if(!this.testFlag(t.Flag.IsHidden)&&(!this.isAttached||this.parent&&!this.parent.isVisible||U.sendMessage(this,t.Msg.BeforeHide),this.setFlag(t.Flag.IsHidden),this.addClass("lm-mod-hidden"),this.addClass("p-mod-hidden"),!this.isAttached||this.parent&&!this.parent.isVisible||U.sendMessage(this,t.Msg.AfterHide),this.parent)){var e=new t.ChildMessage("child-hidden",this);U.sendMessage(this.parent,e)}},t.prototype.setHidden=function(t){t?this.hide():this.show()},t.prototype.testFlag=function(t){return 0!=(this._flags&t)},t.prototype.setFlag=function(t){this._flags|=t},t.prototype.clearFlag=function(t){this._flags&=~t},t.prototype.processMessage=function(e){switch(e.type){case"resize":this.notifyLayout(e),this.onResize(e);break;case"update-request":this.notifyLayout(e),this.onUpdateRequest(e);break;case"fit-request":this.notifyLayout(e),this.onFitRequest(e);break;case"before-show":this.notifyLayout(e),this.onBeforeShow(e);break;case"after-show":this.setFlag(t.Flag.IsVisible),this.notifyLayout(e),this.onAfterShow(e);break;case"before-hide":this.notifyLayout(e),this.onBeforeHide(e);break;case"after-hide":this.clearFlag(t.Flag.IsVisible),this.notifyLayout(e),this.onAfterHide(e);break;case"before-attach":this.notifyLayout(e),this.onBeforeAttach(e);break;case"after-attach":this.isHidden||this.parent&&!this.parent.isVisible||this.setFlag(t.Flag.IsVisible),this.setFlag(t.Flag.IsAttached),this.notifyLayout(e),this.onAfterAttach(e);break;case"before-detach":this.notifyLayout(e),this.onBeforeDetach(e);break;case"after-detach":this.clearFlag(t.Flag.IsVisible),this.clearFlag(t.Flag.IsAttached),this.notifyLayout(e),this.onAfterDetach(e);break;case"activate-request":this.notifyLayout(e),this.onActivateRequest(e);break;case"close-request":this.notifyLayout(e),this.onCloseRequest(e);break;case"child-added":this.notifyLayout(e),this.onChildAdded(e);break;case"child-removed":this.notifyLayout(e),this.onChildRemoved(e);break;default:this.notifyLayout(e)}},t.prototype.notifyLayout=function(t){this._layout&&this._layout.processParentMessage(t)},t.prototype.onCloseRequest=function(e){this.parent?this.parent=null:this.isAttached&&t.detach(this)},t.prototype.onResize=function(t){},t.prototype.onUpdateRequest=function(t){},t.prototype.onFitRequest=function(t){},t.prototype.onActivateRequest=function(t){},t.prototype.onBeforeShow=function(t){},t.prototype.onAfterShow=function(t){},t.prototype.onBeforeHide=function(t){},t.prototype.onAfterHide=function(t){},t.prototype.onBeforeAttach=function(t){},t.prototype.onAfterAttach=function(t){},t.prototype.onBeforeDetach=function(t){},t.prototype.onAfterDetach=function(t){},t.prototype.onChildAdded=function(t){},t.prototype.onChildRemoved=function(t){},t}();!function(t){var e,n;(n=t.Flag||(t.Flag={}))[n.IsDisposed=1]="IsDisposed",n[n.IsAttached=2]="IsAttached",n[n.IsHidden=4]="IsHidden",n[n.IsVisible=8]="IsVisible",n[n.DisallowLayout=16]="DisallowLayout",(e=t.Msg||(t.Msg={})).BeforeShow=new G("before-show"),e.AfterShow=new G("after-show"),e.BeforeHide=new G("before-hide"),e.AfterHide=new G("after-hide"),e.BeforeAttach=new G("before-attach"),e.AfterAttach=new G("after-attach"),e.BeforeDetach=new G("before-detach"),e.AfterDetach=new G("after-detach"),e.ParentChanged=new G("parent-changed"),e.UpdateRequest=new $("update-request"),e.FitRequest=new $("fit-request"),e.ActivateRequest=new $("activate-request"),e.CloseRequest=new $("close-request");var i=function(t){function e(e,n){var i=t.call(this,e)||this;return i.child=n,i}return ct(e,t),e}(G);t.ChildMessage=i;var r=function(t){function e(e,n){var i=t.call(this,"resize")||this;return i.width=e,i.height=n,i}return ct(e,t),e}(G);t.ResizeMessage=r,function(t){t.UnknownSize=new t(-1,-1)}(r=t.ResizeMessage||(t.ResizeMessage={})),t.attach=function(e,n,i){if(void 0===i&&(i=null),e.parent)throw new Error("Cannot attach a child widget.");if(e.isAttached||document.body.contains(e.node))throw new Error("Widget is already attached.");if(!document.body.contains(n))throw new Error("Host is not attached.");U.sendMessage(e,t.Msg.BeforeAttach),n.insertBefore(e.node,i),U.sendMessage(e,t.Msg.AfterAttach)},t.detach=function(e){if(e.parent)throw new Error("Cannot detach a child widget.");if(!e.isAttached||!document.body.contains(e.node))throw new Error("Widget is not attached.");U.sendMessage(e,t.Msg.BeforeDetach),e.node.parentNode.removeChild(e.node),U.sendMessage(e,t.Msg.AfterDetach)}}(pt||(pt={})),function(t){t.titleProperty=new X({name:"title",create:function(t){return new ht({owner:t})}}),t.createNode=function(t){return t.node||document.createElement(t.tag||"div")}}(ut||(ut={}));var ft=function(){function t(t){void 0===t&&(t={}),this._disposed=!1,this._parent=null,this._fitPolicy=t.fitPolicy||"set-min-size"}return t.prototype.dispose=function(){this._parent=null,this._disposed=!0,E.clearData(this),X.clearData(this)},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return this._parent},set:function(t){if(this._parent!==t){if(this._parent)throw new Error("Cannot change parent widget.");if(t.layout!==this)throw new Error("Invalid parent widget.");this._parent=t,this.init()}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fitPolicy",{get:function(){return this._fitPolicy},set:function(t){if(this._fitPolicy!==t&&(this._fitPolicy=t,this._parent)){var e=this._parent.node.style;e.minWidth="",e.minHeight="",e.maxWidth="",e.maxHeight="",this._parent.fit()}},enumerable:!0,configurable:!0}),t.prototype.processParentMessage=function(t){switch(t.type){case"resize":this.onResize(t);break;case"update-request":this.onUpdateRequest(t);break;case"fit-request":this.onFitRequest(t);break;case"before-show":this.onBeforeShow(t);break;case"after-show":this.onAfterShow(t);break;case"before-hide":this.onBeforeHide(t);break;case"after-hide":this.onAfterHide(t);break;case"before-attach":this.onBeforeAttach(t);break;case"after-attach":this.onAfterAttach(t);break;case"before-detach":this.onBeforeDetach(t);break;case"after-detach":this.onAfterDetach(t);break;case"child-removed":this.onChildRemoved(t);break;case"child-shown":this.onChildShown(t);break;case"child-hidden":this.onChildHidden(t)}},t.prototype.init=function(){var t=this;i(this,(function(e){e.parent=t.parent}))},t.prototype.onResize=function(t){i(this,(function(t){U.sendMessage(t,pt.ResizeMessage.UnknownSize)}))},t.prototype.onUpdateRequest=function(t){i(this,(function(t){U.sendMessage(t,pt.ResizeMessage.UnknownSize)}))},t.prototype.onBeforeAttach=function(t){i(this,(function(e){U.sendMessage(e,t)}))},t.prototype.onAfterAttach=function(t){i(this,(function(e){U.sendMessage(e,t)}))},t.prototype.onBeforeDetach=function(t){i(this,(function(e){U.sendMessage(e,t)}))},t.prototype.onAfterDetach=function(t){i(this,(function(e){U.sendMessage(e,t)}))},t.prototype.onBeforeShow=function(t){i(this,(function(e){e.isHidden||U.sendMessage(e,t)}))},t.prototype.onAfterShow=function(t){i(this,(function(e){e.isHidden||U.sendMessage(e,t)}))},t.prototype.onBeforeHide=function(t){i(this,(function(e){e.isHidden||U.sendMessage(e,t)}))},t.prototype.onAfterHide=function(t){i(this,(function(e){e.isHidden||U.sendMessage(e,t)}))},t.prototype.onChildRemoved=function(t){this.removeWidget(t.child)},t.prototype.onFitRequest=function(t){},t.prototype.onChildShown=function(t){},t.prototype.onChildHidden=function(t){},t}();!function(t){t.getHorizontalAlignment=function(t){return mt.horizontalAlignmentProperty.get(t)},t.setHorizontalAlignment=function(t,e){mt.horizontalAlignmentProperty.set(t,e)},t.getVerticalAlignment=function(t){return mt.verticalAlignmentProperty.get(t)},t.setVerticalAlignment=function(t,e){mt.verticalAlignmentProperty.set(t,e)}}(ft||(ft={}));var mt,gt=function(){function t(t){this._top=NaN,this._left=NaN,this._width=NaN,this._height=NaN,this._minWidth=0,this._minHeight=0,this._maxWidth=1/0,this._maxHeight=1/0,this._disposed=!1,this.widget=t,this.widget.node.style.position="absolute"}return t.prototype.dispose=function(){if(!this._disposed){this._disposed=!0;var t=this.widget.node.style;t.position="",t.top="",t.left="",t.width="",t.height=""}},Object.defineProperty(t.prototype,"minWidth",{get:function(){return this._minWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"minHeight",{get:function(){return this._minHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxWidth",{get:function(){return this._maxWidth},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxHeight",{get:function(){return this._maxHeight},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this._disposed},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isHidden",{get:function(){return this.widget.isHidden},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this.widget.isVisible},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isAttached",{get:function(){return this.widget.isAttached},enumerable:!0,configurable:!0}),t.prototype.fit=function(){var t=A.sizeLimits(this.widget.node);this._minWidth=t.minWidth,this._minHeight=t.minHeight,this._maxWidth=t.maxWidth,this._maxHeight=t.maxHeight},t.prototype.update=function(t,e,n,i){var r=Math.max(this._minWidth,Math.min(n,this._maxWidth)),o=Math.max(this._minHeight,Math.min(i,this._maxHeight));if(r<n)switch(ft.getHorizontalAlignment(this.widget)){case"left":break;case"center":t+=(n-r)/2;break;case"right":t+=n-r;break;default:throw"unreachable"}if(o<i)switch(ft.getVerticalAlignment(this.widget)){case"top":break;case"center":e+=(i-o)/2;break;case"bottom":e+=i-o;break;default:throw"unreachable"}var s=!1,a=this.widget.node.style;if(this._top!==e&&(this._top=e,a.top=e+"px"),this._left!==t&&(this._left=t,a.left=t+"px"),this._width!==r&&(s=!0,this._width=r,a.width=r+"px"),this._height!==o&&(s=!0,this._height=o,a.height=o+"px"),s){var l=new pt.ResizeMessage(r,o);U.sendMessage(this.widget,l)}},t}();!function(t){function e(t){t.parent&&t.parent.layout&&t.parent.update()}t.horizontalAlignmentProperty=new X({name:"horizontalAlignment",create:function(){return"center"},changed:e}),t.verticalAlignmentProperty=new X({name:"verticalAlignment",create:function(){return"top"},changed:e})}(mt||(mt={}));var vt,yt=function(n){function r(){var t=null!==n&&n.apply(this,arguments)||this;return t._widgets=[],t}return ct(r,n),r.prototype.dispose=function(){for(;this._widgets.length>0;)this._widgets.pop().dispose();n.prototype.dispose.call(this)},Object.defineProperty(r.prototype,"widgets",{get:function(){return this._widgets},enumerable:!0,configurable:!0}),r.prototype.iter=function(){return e(this._widgets)},r.prototype.addWidget=function(t){this.insertWidget(this._widgets.length,t)},r.prototype.insertWidget=function(e,n){n.parent=this.parent;var i=this._widgets.indexOf(n),r=Math.max(0,Math.min(e,this._widgets.length));if(-1===i)return t.insert(this._widgets,r,n),void(this.parent&&this.attachWidget(r,n));r===this._widgets.length&&r--,i!==r&&(t.move(this._widgets,i,r),this.parent&&this.moveWidget(i,r,n))},r.prototype.removeWidget=function(t){this.removeWidgetAt(this._widgets.indexOf(t))},r.prototype.removeWidgetAt=function(e){var n=t.removeAt(this._widgets,e);n&&this.parent&&this.detachWidget(e,n)},r.prototype.init=function(){var t=this;n.prototype.init.call(this),i(this,(function(e,n){t.attachWidget(n,e)}))},r.prototype.attachWidget=function(t,e){var n=this.parent.node.children[t];this.parent.isAttached&&U.sendMessage(e,pt.Msg.BeforeAttach),this.parent.node.insertBefore(e.node,n),this.parent.isAttached&&U.sendMessage(e,pt.Msg.AfterAttach)},r.prototype.moveWidget=function(t,e,n){this.parent.isAttached&&U.sendMessage(n,pt.Msg.BeforeDetach),this.parent.node.removeChild(n.node),this.parent.isAttached&&U.sendMessage(n,pt.Msg.AfterDetach);var i=this.parent.node.children[e];this.parent.isAttached&&U.sendMessage(n,pt.Msg.BeforeAttach),this.parent.node.insertBefore(n.node,i),this.parent.isAttached&&U.sendMessage(n,pt.Msg.AfterAttach)},r.prototype.detachWidget=function(t,e){this.parent.isAttached&&U.sendMessage(e,pt.Msg.BeforeDetach),this.parent.node.removeChild(e.node),this.parent.isAttached&&U.sendMessage(e,pt.Msg.AfterDetach)},r}(ft),bt=function(e){function n(t){void 0===t&&(t={});var n=e.call(this)||this;return n._fixed=0,n._spacing=4,n._dirty=!1,n._sizers=[],n._items=[],n._box=null,n._alignment="start",n._direction="top-to-bottom",void 0!==t.direction&&(n._direction=t.direction),void 0!==t.alignment&&(n._alignment=t.alignment),void 0!==t.spacing&&(n._spacing=vt.clampSpacing(t.spacing)),n}return ct(n,e),n.prototype.dispose=function(){i(this._items,(function(t){t.dispose()})),this._box=null,this._items.length=0,this._sizers.length=0,e.prototype.dispose.call(this)},Object.defineProperty(n.prototype,"direction",{get:function(){return this._direction},set:function(t){this._direction!==t&&(this._direction=t,this.parent&&(this.parent.dataset.direction=t,this.parent.fit()))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"alignment",{get:function(){return this._alignment},set:function(t){this._alignment!==t&&(this._alignment=t,this.parent&&(this.parent.dataset.alignment=t,this.parent.update()))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"spacing",{get:function(){return this._spacing},set:function(t){t=vt.clampSpacing(t),this._spacing!==t&&(this._spacing=t,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),n.prototype.init=function(){this.parent.dataset.direction=this.direction,this.parent.dataset.alignment=this.alignment,e.prototype.init.call(this)},n.prototype.attachWidget=function(e,n){t.insert(this._items,e,new gt(n)),t.insert(this._sizers,e,new at),this.parent.isAttached&&U.sendMessage(n,pt.Msg.BeforeAttach),this.parent.node.appendChild(n.node),this.parent.isAttached&&U.sendMessage(n,pt.Msg.AfterAttach),this.parent.fit()},n.prototype.moveWidget=function(e,n,i){t.move(this._items,e,n),t.move(this._sizers,e,n),this.parent.update()},n.prototype.detachWidget=function(e,n){var i=t.removeAt(this._items,e);t.removeAt(this._sizers,e),this.parent.isAttached&&U.sendMessage(n,pt.Msg.BeforeDetach),this.parent.node.removeChild(n.node),this.parent.isAttached&&U.sendMessage(n,pt.Msg.AfterDetach),i.dispose(),this.parent.fit()},n.prototype.onBeforeShow=function(t){e.prototype.onBeforeShow.call(this,t),this.parent.update()},n.prototype.onBeforeAttach=function(t){e.prototype.onBeforeAttach.call(this,t),this.parent.fit()},n.prototype.onChildShown=function(t){this.parent.fit()},n.prototype.onChildHidden=function(t){this.parent.fit()},n.prototype.onResize=function(t){this.parent.isVisible&&this._update(t.width,t.height)},n.prototype.onUpdateRequest=function(t){this.parent.isVisible&&this._update(-1,-1)},n.prototype.onFitRequest=function(t){this.parent.isAttached&&this._fit()},n.prototype._fit=function(){for(var t=0,e=0,i=this._items.length;e<i;++e)t+=+!this._items[e].isHidden;this._fixed=this._spacing*Math.max(0,t-1);var r=vt.isHorizontal(this._direction),o=r?this._fixed:0,s=r?0:this._fixed;for(e=0,i=this._items.length;e<i;++e){var a=this._items[e],l=this._sizers[e];a.isHidden?(l.minSize=0,l.maxSize=0):(a.fit(),l.sizeHint=n.getSizeBasis(a.widget),l.stretch=n.getStretch(a.widget),r?(l.minSize=a.minWidth,l.maxSize=a.maxWidth,o+=a.minWidth,s=Math.max(s,a.minHeight)):(l.minSize=a.minHeight,l.maxSize=a.maxHeight,s+=a.minHeight,o=Math.max(o,a.minWidth)))}var c=this._box=A.boxSizing(this.parent.node);o+=c.horizontalSum,s+=c.verticalSum;var u=this.parent.node.style;u.minWidth=o+"px",u.minHeight=s+"px",this._dirty=!0,this.parent.parent&&U.sendMessage(this.parent.parent,pt.Msg.FitRequest),this._dirty&&U.sendMessage(this.parent,pt.Msg.UpdateRequest)},n.prototype._update=function(t,e){this._dirty=!1;for(var n=0,i=0,r=this._items.length;i<r;++i)n+=+!this._items[i].isHidden;if(0!==n){t<0&&(t=this.parent.node.offsetWidth),e<0&&(e=this.parent.node.offsetHeight),this._box||(this._box=A.boxSizing(this.parent.node));var o,s=this._box.paddingTop,a=this._box.paddingLeft,l=t-this._box.horizontalSum,c=e-this._box.verticalSum;switch(this._direction){case"left-to-right":o=st.calc(this._sizers,Math.max(0,l-this._fixed));break;case"top-to-bottom":o=st.calc(this._sizers,Math.max(0,c-this._fixed));break;case"right-to-left":o=st.calc(this._sizers,Math.max(0,l-this._fixed)),a+=l;break;case"bottom-to-top":o=st.calc(this._sizers,Math.max(0,c-this._fixed)),s+=c;break;default:throw"unreachable"}var u=0,d=0;if(o>0)switch(this._alignment){case"start":break;case"center":u=0,d=o/2;break;case"end":u=0,d=o;break;case"justify":u=o/n,d=0;break;default:throw"unreachable"}for(i=0,r=this._items.length;i<r;++i){var h=this._items[i];if(!h.isHidden){var p=this._sizers[i].size;switch(this._direction){case"left-to-right":h.update(a+d,s,p+u,c),a+=p+u+this._spacing;break;case"top-to-bottom":h.update(a,s+d,l,p+u),s+=p+u+this._spacing;break;case"right-to-left":h.update(a-d-p-u,s,p+u,c),a-=p+u+this._spacing;break;case"bottom-to-top":h.update(a,s-d-p-u,l,p+u),s-=p+u+this._spacing;break;default:throw"unreachable"}}}}},n}(yt);!function(t){t.getStretch=function(t){return vt.stretchProperty.get(t)},t.setStretch=function(t,e){vt.stretchProperty.set(t,e)},t.getSizeBasis=function(t){return vt.sizeBasisProperty.get(t)},t.setSizeBasis=function(t,e){vt.sizeBasisProperty.set(t,e)}}(bt||(bt={})),function(t){function e(t){t.parent&&t.parent.layout instanceof bt&&t.parent.fit()}t.stretchProperty=new X({name:"stretch",create:function(){return 0},coerce:function(t,e){return Math.max(0,Math.floor(e))},changed:e}),t.sizeBasisProperty=new X({name:"sizeBasis",create:function(){return 0},coerce:function(t,e){return Math.max(0,Math.floor(e))},changed:e}),t.isHorizontal=function(t){return"left-to-right"===t||"right-to-left"===t},t.clampSpacing=function(t){return Math.max(0,Math.floor(t))}}(vt||(vt={}));var _t,wt=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.addClass("lm-Panel"),n.addClass("p-Panel"),n.layout=_t.createLayout(e),n}return ct(e,t),Object.defineProperty(e.prototype,"widgets",{get:function(){return this.layout.widgets},enumerable:!0,configurable:!0}),e.prototype.addWidget=function(t){this.layout.addWidget(t)},e.prototype.insertWidget=function(t,e){this.layout.insertWidget(t,e)},e}(pt);!function(t){t.createLayout=function(t){return t.layout||new yt}}(_t||(_t={}));var xt,Ct=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,{layout:xt.createLayout(e)})||this;return n.addClass("lm-BoxPanel"),n.addClass("p-BoxPanel"),n}return ct(e,t),Object.defineProperty(e.prototype,"direction",{get:function(){return this.layout.direction},set:function(t){this.layout.direction=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alignment",{get:function(){return this.layout.alignment},set:function(t){this.layout.alignment=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this.layout.spacing},set:function(t){this.layout.spacing=t},enumerable:!0,configurable:!0}),e.prototype.onChildAdded=function(t){t.child.addClass("lm-BoxPanel-child"),t.child.addClass("p-BoxPanel-child")},e.prototype.onChildRemoved=function(t){t.child.removeClass("lm-BoxPanel-child"),t.child.removeClass("p-BoxPanel-child")},e}(wt);!function(t){t.getStretch=function(t){return bt.getStretch(t)},t.setStretch=function(t,e){bt.setStretch(t,e)},t.getSizeBasis=function(t){return bt.getSizeBasis(t)},t.setSizeBasis=function(t,e){bt.setSizeBasis(t,e)}}(Ct||(Ct={})),function(t){t.createLayout=function(t){return t.layout||new bt(t)}}(xt||(xt={}));var Et,Dt=function(e){function n(t){var i=e.call(this,{node:Et.createNode()})||this;return i._activeIndex=-1,i._items=[],i._results=null,i.addClass("lm-CommandPalette"),i.addClass("p-CommandPalette"),i.setFlag(pt.Flag.DisallowLayout),i.commands=t.commands,i.renderer=t.renderer||n.defaultRenderer,i.commands.commandChanged.connect(i._onGenericChange,i),i.commands.keyBindingChanged.connect(i._onGenericChange,i),i}return ct(n,e),n.prototype.dispose=function(){this._items.length=0,this._results=null,e.prototype.dispose.call(this)},Object.defineProperty(n.prototype,"searchNode",{get:function(){return this.node.getElementsByClassName("lm-CommandPalette-search")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"inputNode",{get:function(){return this.node.getElementsByClassName("lm-CommandPalette-input")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("lm-CommandPalette-content")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"items",{get:function(){return this._items},enumerable:!0,configurable:!0}),n.prototype.addItem=function(t){var e=Et.createItem(this.commands,t);return this._items.push(e),this.refresh(),e},n.prototype.addItems=function(t){var e=this,n=t.map((function(t){return Et.createItem(e.commands,t)}));return n.forEach((function(t){return e._items.push(t)})),this.refresh(),n},n.prototype.removeItem=function(t){this.removeItemAt(this._items.indexOf(t))},n.prototype.removeItemAt=function(e){t.removeAt(this._items,e)&&this.refresh()},n.prototype.clearItems=function(){0!==this._items.length&&(this._items.length=0,this.refresh())},n.prototype.refresh=function(){this._results=null,""!==this.inputNode.value?this.node.getElementsByClassName("lm-close-icon")[0].style.display="inherit":this.node.getElementsByClassName("lm-close-icon")[0].style.display="none",this.update()},n.prototype.handleEvent=function(t){switch(t.type){case"click":this._evtClick(t);break;case"keydown":this._evtKeyDown(t);break;case"input":this.refresh();break;case"focus":case"blur":this._toggleFocused()}},n.prototype.onBeforeAttach=function(t){this.node.addEventListener("click",this),this.node.addEventListener("keydown",this),this.node.addEventListener("input",this),this.node.addEventListener("focus",this,!0),this.node.addEventListener("blur",this,!0)},n.prototype.onAfterDetach=function(t){this.node.removeEventListener("click",this),this.node.removeEventListener("keydown",this),this.node.removeEventListener("input",this),this.node.removeEventListener("focus",this,!0),this.node.removeEventListener("blur",this,!0)},n.prototype.onActivateRequest=function(t){if(this.isAttached){var e=this.inputNode;e.focus(),e.select()}},n.prototype.onUpdateRequest=function(e){var n=this.inputNode.value,i=this.contentNode,r=this._results;if(r||(r=this._results=Et.search(this._items,n),this._activeIndex=n?t.findFirstIndex(r,Et.canActivate):-1),n||0!==r.length)if(n&&0===r.length){var o=this.renderer.renderEmptyMessage({query:n});J.render(o,i)}else{for(var s=this.renderer,a=this._activeIndex,l=new Array(r.length),c=0,u=r.length;c<u;++c){var d=r[c];if("header"===d.type){var h=d.indices,p=d.category;l[c]=s.renderHeader({category:p,indices:h})}else{var f=d.item,m=(h=d.indices,c===a);l[c]=s.renderItem({item:f,indices:h,active:m})}}if(J.render(l,i),a<0||a>=r.length)i.scrollTop=0;else{var g=i.children[a];A.scrollIntoViewIfNeeded(i,g)}}else J.render(null,i)},n.prototype._evtClick=function(e){if(0===e.button){if(e.target.classList.contains("lm-close-icon"))return this.inputNode.value="",void this.refresh();var n=t.findFirstIndex(this.contentNode.children,(function(t){return t.contains(e.target)}));-1!==n&&(e.preventDefault(),e.stopPropagation(),this._execute(n))}},n.prototype._evtKeyDown=function(t){if(!(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey))switch(t.keyCode){case 13:t.preventDefault(),t.stopPropagation(),this._execute(this._activeIndex);break;case 38:t.preventDefault(),t.stopPropagation(),this._activatePreviousItem();break;case 40:t.preventDefault(),t.stopPropagation(),this._activateNextItem()}},n.prototype._activateNextItem=function(){if(this._results&&0!==this._results.length){var e=this._activeIndex,n=this._results.length,i=e<n-1?e+1:0,r=0===i?n-1:i-1;this._activeIndex=t.findFirstIndex(this._results,Et.canActivate,i,r),this.update()}},n.prototype._activatePreviousItem=function(){if(this._results&&0!==this._results.length){var e=this._activeIndex,n=this._results.length,i=e<=0?n-1:e-1,r=i===n-1?0:i+1;this._activeIndex=t.findLastIndex(this._results,Et.canActivate,i,r),this.update()}},n.prototype._execute=function(t){if(this._results){var e=this._results[t];if(e){if("header"===e.type){var n=this.inputNode;return n.value=e.category.toLowerCase()+" ",n.focus(),void this.refresh()}e.item.isEnabled&&(this.commands.execute(e.item.command,e.item.args),this.inputNode.value="",this.refresh())}}},n.prototype._toggleFocused=function(){var t=document.activeElement===this.inputNode;this.toggleClass("lm-mod-focused",t),this.toggleClass("p-mod-focused",t)},n.prototype._onGenericChange=function(){this.refresh()},n}(pt);!function(t){var e=function(){function t(){}return t.prototype.renderHeader=function(t){var e=this.formatHeader(t);return it.li({className:"lm-CommandPalette-header p-CommandPalette-header"},e)},t.prototype.renderItem=function(t){var e=this.createItemClass(t),n=this.createItemDataset(t);return t.item.isToggleable?it.li({className:e,dataset:n,role:"checkbox","aria-checked":""+t.item.isToggled},this.renderItemIcon(t),this.renderItemContent(t),this.renderItemShortcut(t)):it.li({className:e,dataset:n},this.renderItemIcon(t),this.renderItemContent(t),this.renderItemShortcut(t))},t.prototype.renderEmptyMessage=function(t){var e=this.formatEmptyMessage(t);return it.li({className:"lm-CommandPalette-emptyMessage p-CommandPalette-emptyMessage"},e)},t.prototype.renderItemIcon=function(t){var e=this.createIconClass(t);return"string"==typeof t.item.icon?it.div({className:e},t.item.iconLabel):it.div({className:e},t.item.icon,t.item.iconLabel)},t.prototype.renderItemContent=function(t){return it.div({className:"lm-CommandPalette-itemContent p-CommandPalette-itemContent"},this.renderItemLabel(t),this.renderItemCaption(t))},t.prototype.renderItemLabel=function(t){var e=this.formatItemLabel(t);return it.div({className:"lm-CommandPalette-itemLabel p-CommandPalette-itemLabel"},e)},t.prototype.renderItemCaption=function(t){var e=this.formatItemCaption(t);return it.div({className:"lm-CommandPalette-itemCaption p-CommandPalette-itemCaption"},e)},t.prototype.renderItemShortcut=function(t){var e=this.formatItemShortcut(t);return it.div({className:"lm-CommandPalette-itemShortcut p-CommandPalette-itemShortcut"},e)},t.prototype.createItemClass=function(t){var e="lm-CommandPalette-item";e+=" p-CommandPalette-item",t.item.isEnabled||(e+=" lm-mod-disabled",e+=" p-mod-disabled"),t.item.isToggled&&(e+=" lm-mod-toggled",e+=" p-mod-toggled"),t.active&&(e+=" lm-mod-active",e+=" p-mod-active");var n=t.item.className;return n&&(e+=" "+n),e},t.prototype.createItemDataset=function(t){return dt(dt({},t.item.dataset),{command:t.item.command})},t.prototype.createIconClass=function(t){var e="lm-CommandPalette-itemIcon";e+=" p-CommandPalette-itemIcon";var n=t.item.iconClass;return n?e+" "+n:e},t.prototype.formatHeader=function(t){return t.indices&&0!==t.indices.length?g.highlight(t.category,t.indices,it.mark):t.category},t.prototype.formatEmptyMessage=function(t){return"No commands found that match '"+t.query+"'"},t.prototype.formatItemShortcut=function(t){var e=t.item.keyBinding;return e?e.keys.map(H.formatKeystroke).join(", "):null},t.prototype.formatItemLabel=function(t){return t.indices&&0!==t.indices.length?g.highlight(t.item.label,t.indices,it.mark):t.item.label},t.prototype.formatItemCaption=function(t){return t.item.caption},t}();t.Renderer=e,t.defaultRenderer=new e}(Dt||(Dt={})),function(e){function n(e,n){for(var i=e.category.toLowerCase(),r=i+" "+e.label.toLowerCase(),o=1/0,s=null,a=/\b\w/g;;){var l=a.exec(r);if(!l)break;var c=g.matchSumOfDeltas(r,n,l.index);if(!c)break;c&&c.score<=o&&(o=c.score,s=c.indices)}if(!s||o===1/0)return null;for(var u=i.length+1,d=t.lowerBound(s,u,(function(t,e){return t-e})),h=s.slice(0,d),p=s.slice(d),f=0,m=p.length;f<m;++f)p[f]-=u;return 0===h.length?{matchType:0,categoryIndices:null,labelIndices:p,score:o,item:e}:0===p.length?{matchType:1,categoryIndices:h,labelIndices:null,score:o,item:e}:{matchType:2,categoryIndices:h,labelIndices:p,score:o,item:e}}function i(t,e){var n=t.matchType-e.matchType;if(0!==n)return n;var i=t.score-e.score;if(0!==i)return i;var r=0,o=0;switch(t.matchType){case 0:r=t.labelIndices[0],o=e.labelIndices[0];break;case 1:case 2:r=t.categoryIndices[0],o=e.categoryIndices[0]}if(r!==o)return r-o;var s=t.item.category.localeCompare(e.item.category);if(0!==s)return s;var a=t.item.rank,l=e.item.rank;return a!==l?a<l?-1:1:t.item.label.localeCompare(e.item.label)}e.createNode=function(){var t=document.createElement("div"),e=document.createElement("div"),n=document.createElement("div"),i=document.createElement("input"),r=document.createElement("ul"),o=document.createElement("button");return e.className="lm-CommandPalette-search",n.className="lm-CommandPalette-wrapper",i.className="lm-CommandPalette-input",o.className="lm-close-icon",r.className="lm-CommandPalette-content",e.classList.add("p-CommandPalette-search"),n.classList.add("p-CommandPalette-wrapper"),i.classList.add("p-CommandPalette-input"),r.classList.add("p-CommandPalette-content"),i.spellcheck=!1,n.appendChild(i),n.appendChild(o),e.appendChild(n),t.appendChild(e),t.appendChild(r),t},e.createItem=function(t,e){return new r(t,e)},e.search=function(e,r){var o=function(t,e){e=e.replace(/\s+/g,"").toLowerCase();for(var i=[],r=0,o=t.length;r<o;++r){var s=t[r];if(s.isVisible)if(e){var a=n(s,e);a&&(s.isEnabled||(a.score+=1e3),i.push(a))}else i.push({matchType:3,categoryIndices:null,labelIndices:null,score:0,item:s})}return i}(e,r);return o.sort(i),function(e){var n=new Array(e.length);t.fill(n,!1);for(var i=[],r=0,o=e.length;r<o;++r)if(!n[r]){var s=e[r],a=s.item,l=s.categoryIndices,c=a.category;i.push({type:"header",category:c,indices:l});for(var u=r;u<o;++u)if(!n[u]){var d=e[u],h=d.item,p=d.labelIndices;h.category===c&&(i.push({type:"item",item:h,indices:p}),n[u]=!0)}}return i}(o)},e.canActivate=function(t){return"item"===t.type&&t.item.isEnabled};var r=function(){function e(t,e){this._commands=t,this.category=e.category.trim().replace(/\s+/g," "),this.command=e.command,this.args=e.args||v.emptyObject,this.rank=void 0!==e.rank?e.rank:1/0}return Object.defineProperty(e.prototype,"label",{get:function(){return this._commands.label(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"icon",{get:function(){return this._commands.icon(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iconClass",{get:function(){return this._commands.iconClass(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iconLabel",{get:function(){return this._commands.iconLabel(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"caption",{get:function(){return this._commands.caption(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"className",{get:function(){return this._commands.className(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataset",{get:function(){return this._commands.dataset(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._commands.isEnabled(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isToggled",{get:function(){return this._commands.isToggled(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isToggleable",{get:function(){return this._commands.isToggleable(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isVisible",{get:function(){return this._commands.isVisible(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keyBinding",{get:function(){var e=this.command,n=this.args;return t.findLastValue(this._commands.keyBindings,(function(t){return t.command===e&&v.deepEqual(t.args,n)}))||null},enumerable:!0,configurable:!0}),e}()}(Et||(Et={}));var Mt,St,Tt=function(e){function n(t){var i=e.call(this,{node:Mt.createNode()})||this;return i._childIndex=-1,i._activeIndex=-1,i._openTimerID=0,i._closeTimerID=0,i._items=[],i._childMenu=null,i._parentMenu=null,i._aboutToClose=new E(i),i._menuRequested=new E(i),i.addClass("lm-Menu"),i.addClass("p-Menu"),i.setFlag(pt.Flag.DisallowLayout),i.commands=t.commands,i.renderer=t.renderer||n.defaultRenderer,i}return ct(n,e),n.prototype.dispose=function(){this.close(),this._items.length=0,e.prototype.dispose.call(this)},Object.defineProperty(n.prototype,"aboutToClose",{get:function(){return this._aboutToClose},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"menuRequested",{get:function(){return this._menuRequested},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"parentMenu",{get:function(){return this._parentMenu},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"childMenu",{get:function(){return this._childMenu},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"rootMenu",{get:function(){for(var t=this;t._parentMenu;)t=t._parentMenu;return t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"leafMenu",{get:function(){for(var t=this;t._childMenu;)t=t._childMenu;return t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("lm-Menu-content")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"activeItem",{get:function(){return this._items[this._activeIndex]||null},set:function(t){this.activeIndex=t?this._items.indexOf(t):-1},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"activeIndex",{get:function(){return this._activeIndex},set:function(t){(t<0||t>=this._items.length)&&(t=-1),-1===t||Mt.canActivate(this._items[t])||(t=-1),this._activeIndex!==t&&(this._activeIndex=t,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"items",{get:function(){return this._items},enumerable:!0,configurable:!0}),n.prototype.activateNextItem=function(){var e=this._items.length,n=this._activeIndex,i=n<e-1?n+1:0,r=0===i?e-1:i-1;this.activeIndex=t.findFirstIndex(this._items,Mt.canActivate,i,r)},n.prototype.activatePreviousItem=function(){var e=this._items.length,n=this._activeIndex,i=n<=0?e-1:n-1,r=i===e-1?0:i+1;this.activeIndex=t.findLastIndex(this._items,Mt.canActivate,i,r)},n.prototype.triggerActiveItem=function(){if(this.isAttached){var t=this.activeItem;if(t)if(this._cancelOpenTimer(),this._cancelCloseTimer(),"submenu"!==t.type){this.rootMenu.close();var e=t.command,n=t.args;this.commands.isEnabled(e,n)?this.commands.execute(e,n):console.log("Command '"+e+"' is disabled.")}else this._openChildMenu(!0)}},n.prototype.addItem=function(t){return this.insertItem(this._items.length,t)},n.prototype.insertItem=function(e,n){this.isAttached&&this.close(),this.activeIndex=-1;var i=Math.max(0,Math.min(e,this._items.length)),r=Mt.createItem(this,n);return t.insert(this._items,i,r),this.update(),r},n.prototype.removeItem=function(t){this.removeItemAt(this._items.indexOf(t))},n.prototype.removeItemAt=function(e){this.isAttached&&this.close(),this.activeIndex=-1,t.removeAt(this._items,e)&&this.update()},n.prototype.clearItems=function(){this.isAttached&&this.close(),this.activeIndex=-1,0!==this._items.length&&(this._items.length=0,this.update())},n.prototype.open=function(t,e,n){if(void 0===n&&(n={}),!this.isAttached){var i=n.forceX||!1,r=n.forceY||!1;Mt.openRootMenu(this,t,e,i,r),this.activate()}},n.prototype.handleEvent=function(t){switch(t.type){case"keydown":this._evtKeyDown(t);break;case"mouseup":this._evtMouseUp(t);break;case"mousemove":this._evtMouseMove(t);break;case"mouseenter":this._evtMouseEnter(t);break;case"mouseleave":this._evtMouseLeave(t);break;case"mousedown":this._evtMouseDown(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}},n.prototype.onBeforeAttach=function(t){this.node.addEventListener("keydown",this),this.node.addEventListener("mouseup",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("mouseenter",this),this.node.addEventListener("mouseleave",this),this.node.addEventListener("contextmenu",this),document.addEventListener("mousedown",this,!0)},n.prototype.onAfterDetach=function(t){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mouseup",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("mouseenter",this),this.node.removeEventListener("mouseleave",this),this.node.removeEventListener("contextmenu",this),document.removeEventListener("mousedown",this,!0)},n.prototype.onActivateRequest=function(t){this.isAttached&&this.node.focus()},n.prototype.onUpdateRequest=function(t){for(var e=this._items,n=this.renderer,i=this._activeIndex,r=Mt.computeCollapsed(e),o=new Array(e.length),s=0,a=e.length;s<a;++s){var l=e[s],c=s===i,u=r[s];o[s]=n.renderItem({item:l,active:c,collapsed:u})}J.render(o,this.contentNode)},n.prototype.onCloseRequest=function(t){this._cancelOpenTimer(),this._cancelCloseTimer(),this.activeIndex=-1;var n=this._childMenu;n&&(this._childIndex=-1,this._childMenu=null,n._parentMenu=null,n.close());var i=this._parentMenu;i&&(this._parentMenu=null,i._childIndex=-1,i._childMenu=null,i.activate()),this.isAttached&&this._aboutToClose.emit(void 0),e.prototype.onCloseRequest.call(this,t)},n.prototype._evtKeyDown=function(t){t.preventDefault(),t.stopPropagation();var e=t.keyCode;if(13!==e)if(27!==e)if(37!==e)if(38!==e)if(39!==e)if(40!==e){var n=B().keyForKeydownEvent(t);if(n){var i=this._activeIndex+1,r=Mt.findMnemonic(this._items,n,i);-1===r.index||r.multiple?-1!==r.index?this.activeIndex=r.index:-1!==r.auto&&(this.activeIndex=r.auto):(this.activeIndex=r.index,this.triggerActiveItem())}}else this.activateNextItem();else{var o=this.activeItem;o&&"submenu"===o.type?this.triggerActiveItem():this.rootMenu._menuRequested.emit("next")}else this.activatePreviousItem();else this._parentMenu?this.close():this._menuRequested.emit("previous");else this.close();else this.triggerActiveItem()},n.prototype._evtMouseUp=function(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this.triggerActiveItem())},n.prototype._evtMouseMove=function(e){var n=t.findFirstIndex(this.contentNode.children,(function(t){return A.hitTest(t,e.clientX,e.clientY)}));if(n!==this._activeIndex){if(this.activeIndex=n,(n=this.activeIndex)===this._childIndex)return this._cancelOpenTimer(),void this._cancelCloseTimer();-1!==this._childIndex&&this._startCloseTimer(),this._cancelOpenTimer();var i=this.activeItem;i&&"submenu"===i.type&&i.submenu&&this._startOpenTimer()}},n.prototype._evtMouseEnter=function(t){for(var e=this._parentMenu;e;e=e._parentMenu)e._cancelOpenTimer(),e._cancelCloseTimer(),e.activeIndex=e._childIndex},n.prototype._evtMouseLeave=function(t){if(this._cancelOpenTimer(),this._childMenu){var e=t.clientX,n=t.clientY;A.hitTest(this._childMenu.node,e,n)?this._cancelCloseTimer():(this.activeIndex=-1,this._startCloseTimer())}else this.activeIndex=-1},n.prototype._evtMouseDown=function(t){this._parentMenu||(Mt.hitTestMenus(this,t.clientX,t.clientY)?(t.preventDefault(),t.stopPropagation()):this.close())},n.prototype._openChildMenu=function(t){void 0===t&&(t=!1);var e=this.activeItem;if(e&&"submenu"===e.type&&e.submenu){var n=e.submenu;if(n!==this._childMenu){this._closeChildMenu(),this._childMenu=n,this._childIndex=this._activeIndex,n._parentMenu=this,U.sendMessage(this,pt.Msg.UpdateRequest);var i=this.contentNode.children[this._activeIndex];Mt.openSubmenu(n,i),t&&(n.activeIndex=-1,n.activateNextItem()),n.activate()}}else this._closeChildMenu()},n.prototype._closeChildMenu=function(){this._childMenu&&this._childMenu.close()},n.prototype._startOpenTimer=function(){var t=this;0===this._openTimerID&&(this._openTimerID=window.setTimeout((function(){t._openTimerID=0,t._openChildMenu()}),Mt.TIMER_DELAY))},n.prototype._startCloseTimer=function(){var t=this;0===this._closeTimerID&&(this._closeTimerID=window.setTimeout((function(){t._closeTimerID=0,t._closeChildMenu()}),Mt.TIMER_DELAY))},n.prototype._cancelOpenTimer=function(){0!==this._openTimerID&&(clearTimeout(this._openTimerID),this._openTimerID=0)},n.prototype._cancelCloseTimer=function(){0!==this._closeTimerID&&(clearTimeout(this._closeTimerID),this._closeTimerID=0)},n}(pt);!function(t){var e=function(){function t(){}return t.prototype.renderItem=function(t){var e=this.createItemClass(t),n=this.createItemDataset(t),i=this.createItemARIA(t);return it.li(dt({className:e,dataset:n},i),this.renderIcon(t),this.renderLabel(t),this.renderShortcut(t),this.renderSubmenu(t))},t.prototype.renderIcon=function(t){var e=this.createIconClass(t);return"string"==typeof t.item.icon?it.div({className:e},t.item.iconLabel):it.div({className:e},t.item.icon,t.item.iconLabel)},t.prototype.renderLabel=function(t){var e=this.formatLabel(t);return it.div({className:"lm-Menu-itemLabel p-Menu-itemLabel"},e)},t.prototype.renderShortcut=function(t){var e=this.formatShortcut(t);return it.div({className:"lm-Menu-itemShortcut p-Menu-itemShortcut"},e)},t.prototype.renderSubmenu=function(t){return it.div({className:"lm-Menu-itemSubmenuIcon p-Menu-itemSubmenuIcon"})},t.prototype.createItemClass=function(t){var e="lm-Menu-item";e+=" p-Menu-item",t.item.isEnabled||(e+=" lm-mod-disabled",e+=" p-mod-disabled"),t.item.isToggled&&(e+=" lm-mod-toggled",e+=" p-mod-toggled"),t.item.isVisible||(e+=" lm-mod-hidden",e+=" p-mod-hidden"),t.active&&(e+=" lm-mod-active",e+=" p-mod-active"),t.collapsed&&(e+=" lm-mod-collapsed",e+=" p-mod-collapsed");var n=t.item.className;return n&&(e+=" "+n),e},t.prototype.createItemDataset=function(t){var e=t.item,n=e.type,i=e.command,r=e.dataset;return dt(dt({},r),"command"===n?{type:n,command:i}:{type:n})},t.prototype.createIconClass=function(t){var e="lm-Menu-itemIcon";e+=" p-Menu-itemIcon";var n=t.item.iconClass;return n?e+" "+n:e},t.prototype.createItemARIA=function(t){var e={};switch(t.item.type){case"separator":e.role="presentation";break;case"submenu":e["aria-haspopup"]="true";break;default:e.role="menuitem"}return e},t.prototype.formatLabel=function(t){var e=t.item,n=e.label,i=e.mnemonic;if(i<0||i>=n.length)return n;var r=n.slice(0,i),o=n.slice(i+1),s=n[i];return[r,it.span({className:"lm-Menu-itemMnemonic p-Menu-itemMnemonic"},s),o]},t.prototype.formatShortcut=function(t){var e=t.item.keyBinding;return e?e.keys.map(H.formatKeystroke).join(", "):null},t}();t.Renderer=e,t.defaultRenderer=new e}(Tt||(Tt={})),function(e){function n(t){return"separator"!==t.type&&t.isEnabled&&t.isVisible}e.TIMER_DELAY=300,e.SUBMENU_OVERLAP=3,e.createNode=function(){var t=document.createElement("div"),e=document.createElement("ul");return e.className="lm-Menu-content",e.classList.add("p-Menu-content"),t.appendChild(e),e.setAttribute("role","menu"),t.tabIndex=-1,t},e.canActivate=n,e.createItem=function(t,e){return new i(t.commands,e)},e.hitTestMenus=function(t,e,n){for(var i=t;i;i=i.childMenu)if(A.hitTest(i.node,e,n))return!0;return!1},e.computeCollapsed=function(e){var n=new Array(e.length);t.fill(n,!1);for(var i=0,r=e.length;i<r;++i)if((a=e[i]).isVisible){if("separator"!==a.type)break;n[i]=!0}for(var o=r-1;o>=0;--o)if((a=e[o]).isVisible){if("separator"!==a.type)break;n[o]=!0}for(var s=!1;++i<o;){var a;(a=e[i]).isVisible&&("separator"!==a.type?s=!1:s?n[i]=!0:s=!0)}return n},e.openRootMenu=function(t,e,n,i,r){U.sendMessage(t,pt.Msg.UpdateRequest);var o=window.pageXOffset,s=window.pageYOffset,a=document.documentElement.clientWidth,l=document.documentElement.clientHeight,c=l-(r?n:0),u=t.node,d=u.style;d.top="",d.left="",d.width="",d.height="",d.visibility="hidden",d.maxHeight=c+"px",pt.attach(t,document.body);var h=u.getBoundingClientRect(),p=h.width,f=h.height;!i&&e+p>o+a&&(e=o+a-p),!r&&n+f>s+l&&(n>s+l?n=s+l-f:n-=f),d.top=Math.max(0,n)+"px",d.left=Math.max(0,e)+"px",d.visibility=""},e.openSubmenu=function(t,n){U.sendMessage(t,pt.Msg.UpdateRequest);var i=window.pageXOffset,r=window.pageYOffset,o=document.documentElement.clientWidth,s=document.documentElement.clientHeight,a=s,l=t.node,c=l.style;c.top="",c.left="",c.width="",c.height="",c.visibility="hidden",c.maxHeight=a+"px",pt.attach(t,document.body);var u=l.getBoundingClientRect(),d=u.width,h=u.height,p=A.boxSizing(t.node),f=n.getBoundingClientRect(),m=f.right-e.SUBMENU_OVERLAP;m+d>i+o&&(m=f.left+e.SUBMENU_OVERLAP-d);var g=f.top-p.borderTop-p.paddingTop;g+h>r+s&&(g=f.bottom+p.borderBottom+p.paddingBottom-h),c.top=Math.max(0,g)+"px",c.left=Math.max(0,m)+"px",c.visibility=""},e.findMnemonic=function(t,e,i){for(var r=-1,o=-1,s=!1,a=e.toUpperCase(),l=0,c=t.length;l<c;++l){var u=(l+i)%c,d=t[u];if(n(d)){var h=d.label;if(0!==h.length){var p=d.mnemonic;p>=0&&p<h.length?h[p].toUpperCase()===a&&(-1===r?r=u:s=!0):-1===o&&h[0].toUpperCase()===a&&(o=u)}}}return{index:r,multiple:s,auto:o}};var i=function(){function e(t,e){this._commands=t,this.type=e.type||"command",this.command=e.command||"",this.args=e.args||v.emptyObject,this.submenu=e.submenu||null}return Object.defineProperty(e.prototype,"label",{get:function(){return"command"===this.type?this._commands.label(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.label:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mnemonic",{get:function(){return"command"===this.type?this._commands.mnemonic(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.mnemonic:-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"icon",{get:function(){return"command"===this.type?this._commands.icon(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.icon:this.iconClass},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iconClass",{get:function(){return"command"===this.type?this._commands.iconClass(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.iconClass:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"iconLabel",{get:function(){return"command"===this.type?this._commands.iconLabel(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.iconLabel:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"caption",{get:function(){return"command"===this.type?this._commands.caption(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.caption:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"className",{get:function(){return"command"===this.type?this._commands.className(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.className:""},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dataset",{get:function(){return"command"===this.type?this._commands.dataset(this.command,this.args):"submenu"===this.type&&this.submenu?this.submenu.title.dataset:{}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEnabled",{get:function(){return"command"===this.type?this._commands.isEnabled(this.command,this.args):"submenu"!==this.type||null!==this.submenu},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isToggled",{get:function(){return"command"===this.type&&this._commands.isToggled(this.command,this.args)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isVisible",{get:function(){return"command"===this.type?this._commands.isVisible(this.command,this.args):"submenu"!==this.type||null!==this.submenu},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keyBinding",{get:function(){if("command"===this.type){var e=this.command,n=this.args;return t.findLastValue(this._commands.keyBindings,(function(t){return t.command===e&&v.deepEqual(t.args,n)}))||null}return null},enumerable:!0,configurable:!0}),e}()}(Mt||(Mt={})),function(){function e(t){this._idTick=0,this._items=[],this.menu=new Tt(t)}e.prototype.addItem=function(e){var n=this,i=St.createItem(e,this._idTick++);return this._items.push(i),new S((function(){t.removeFirstOf(n._items,i)}))},e.prototype.open=function(t){var e=this;if(this.menu.clearItems(),0===this._items.length)return!1;var n=St.matchItems(this._items,t);return!(!n||0===n.length||(i(n,(function(t){e.menu.addItem(t)})),this.menu.open(t.clientX,t.clientY),0))}}(),function(t){function e(t,e){var n=L.calculateSpecificity(t.selector),i=L.calculateSpecificity(e.selector);if(n!==i)return i-n;var r=t.rank,o=e.rank;return r!==o?r<o?-1:1:t.id-e.id}t.createItem=function(t,e){var n=function(t){if(-1!==t.indexOf(","))throw new Error("Selector cannot contain commas: "+t);if(!L.isValid(t))throw new Error("Invalid selector: "+t);return t}(t.selector),i=void 0!==t.rank?t.rank:1/0;return dt(dt({},t),{selector:n,rank:i,id:e})},t.matchItems=function(t,n){var i=n.target;if(!i)return null;var r=n.currentTarget;if(!r)return null;if(!(r.contains(i)||(i=document.elementFromPoint(n.clientX,n.clientY))&&r.contains(i)))return null;for(var o=[],s=t.slice();null!==i;){for(var a=[],l=0,c=s.length;l<c;++l){var u=s[l];u&&L.matches(i,u.selector)&&(a.push(u),s[l]=null)}if(0!==a.length&&(a.sort(e),o.push.apply(o,a)),i===r)break;i=i.parentElement}return o}}(St||(St={}));var kt,At=function(e){function n(t){var n=e.call(this)||this;return n._spacing=4,n._dirty=!1,n._root=null,n._box=null,n._items=new Map,n.renderer=t.renderer,void 0!==t.spacing&&(n._spacing=kt.clampSpacing(t.spacing)),n}return ct(n,e),n.prototype.dispose=function(){var t=this.iter();this._items.forEach((function(t){t.dispose()})),this._box=null,this._root=null,this._items.clear(),i(t,(function(t){t.dispose()})),e.prototype.dispose.call(this)},Object.defineProperty(n.prototype,"spacing",{get:function(){return this._spacing},set:function(t){t=kt.clampSpacing(t),this._spacing!==t&&(this._spacing=t,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isEmpty",{get:function(){return null===this._root},enumerable:!0,configurable:!0}),n.prototype.iter=function(){return this._root?this._root.iterAllWidgets():a()},n.prototype.widgets=function(){return this._root?this._root.iterUserWidgets():a()},n.prototype.selectedWidgets=function(){return this._root?this._root.iterSelectedWidgets():a()},n.prototype.tabBars=function(){return this._root?this._root.iterTabBars():a()},n.prototype.handles=function(){return this._root?this._root.iterHandles():a()},n.prototype.moveHandle=function(t,e,n){var i=t.classList.contains("lm-mod-hidden");if(i=i||t.classList.contains("p-mod-hidden"),this._root&&!i){var r,o=this._root.findSplitNode(t);o&&0!=(r="horizontal"===o.node.orientation?e-t.offsetLeft:n-t.offsetTop)&&(o.node.holdSizes(),st.adjust(o.node.sizers,o.index,r),this.parent&&this.parent.update())}},n.prototype.saveLayout=function(){return this._root?(this._root.holdAllSizes(),{main:this._root.createConfig()}):{main:null}},n.prototype.restoreLayout=function(t){var e,n=this,r=new Set;e=t.main?kt.normalizeAreaConfig(t.main,r):null;var o=this.widgets(),s=this.tabBars(),a=this.handles();this._root=null,i(o,(function(t){r.has(t)||(t.parent=null)})),i(s,(function(t){t.dispose()})),i(a,(function(t){t.parentNode&&t.parentNode.removeChild(t)})),r.forEach((function(t){t.parent=n.parent})),this._root=e?kt.realizeAreaConfig(e,{createTabBar:function(){return n._createTabBar()},createHandle:function(){return n._createHandle()}}):null,this.parent&&(r.forEach((function(t){n.attachWidget(t)})),this.parent.fit())},n.prototype.addWidget=function(t,e){void 0===e&&(e={});var n=e.ref||null,i=e.mode||"tab-after",r=null;if(this._root&&n&&(r=this._root.findTabNode(n)),n&&!r)throw new Error("Reference widget is not in the layout.");switch(t.parent=this.parent,i){case"tab-after":this._insertTab(t,n,r,!0);break;case"tab-before":this._insertTab(t,n,r,!1);break;case"split-top":this._insertSplit(t,n,r,"vertical",!1);break;case"split-left":this._insertSplit(t,n,r,"horizontal",!1);break;case"split-right":this._insertSplit(t,n,r,"horizontal",!0);break;case"split-bottom":this._insertSplit(t,n,r,"vertical",!0)}this.parent&&(this.attachWidget(t),this.parent.fit())},n.prototype.removeWidget=function(t){this._removeWidget(t),this.parent&&(this.detachWidget(t),this.parent.fit())},n.prototype.hitTestTabAreas=function(t,e){if(!this._root||!this.parent||!this.parent.isVisible)return null;this._box||(this._box=A.boxSizing(this.parent.node));var n=this.parent.node.getBoundingClientRect(),i=t-n.left-this._box.borderLeft,r=e-n.top-this._box.borderTop,o=this._root.hitTestTabNodes(i,r);if(!o)return null;var s=o.tabBar,a=o.top,l=o.left,c=o.width,u=o.height,d=this._box.borderLeft+this._box.borderRight,h=this._box.borderTop+this._box.borderBottom;return{tabBar:s,x:i,y:r,top:a,left:l,right:n.width-d-(l+c),bottom:n.height-h-(a+u),width:c,height:u}},n.prototype.init=function(){var t=this;e.prototype.init.call(this),i(this,(function(e){t.attachWidget(e)})),i(this.handles(),(function(e){t.parent.node.appendChild(e)})),this.parent.fit()},n.prototype.attachWidget=function(t){this.parent.node!==t.node.parentNode&&(this._items.set(t,new gt(t)),this.parent.isAttached&&U.sendMessage(t,pt.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&U.sendMessage(t,pt.Msg.AfterAttach))},n.prototype.detachWidget=function(t){if(this.parent.node===t.node.parentNode){this.parent.isAttached&&U.sendMessage(t,pt.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&U.sendMessage(t,pt.Msg.AfterDetach);var e=this._items.get(t);e&&(this._items.delete(t),e.dispose())}},n.prototype.onBeforeShow=function(t){e.prototype.onBeforeShow.call(this,t),this.parent.update()},n.prototype.onBeforeAttach=function(t){e.prototype.onBeforeAttach.call(this,t),this.parent.fit()},n.prototype.onChildShown=function(t){this.parent.fit()},n.prototype.onChildHidden=function(t){this.parent.fit()},n.prototype.onResize=function(t){this.parent.isVisible&&this._update(t.width,t.height)},n.prototype.onUpdateRequest=function(t){this.parent.isVisible&&this._update(-1,-1)},n.prototype.onFitRequest=function(t){this.parent.isAttached&&this._fit()},n.prototype._removeWidget=function(e){if(this._root){var n=this._root.findTabNode(e);if(n)if(n.tabBar.titles.length>1)n.tabBar.removeTab(e.title);else if(n.tabBar.dispose(),this._root!==n){this._root.holdAllSizes();var i=n.parent;n.parent=null;var r=t.removeFirstOf(i.children,n),o=t.removeAt(i.handles,r);if(t.removeAt(i.sizers,r),o.parentNode&&o.parentNode.removeChild(o),i.children.length>1)i.syncHandles();else{var s=i.parent;i.parent=null;var a=i.children[0],l=i.handles[0];if(i.children.length=0,i.handles.length=0,i.sizers.length=0,l.parentNode&&l.parentNode.removeChild(l),this._root===i)return a.parent=null,void(this._root=a);var c=s,u=c.children.indexOf(i);if(a instanceof kt.TabLayoutNode)return a.parent=c,void(c.children[u]=a);var d=t.removeAt(c.handles,u);t.removeAt(c.children,u),t.removeAt(c.sizers,u),d.parentNode&&d.parentNode.removeChild(d);for(var h=0,p=a.children.length;h<p;++h){var f=a.children[h],m=a.handles[h],g=a.sizers[h];t.insert(c.children,u+h,f),t.insert(c.handles,u+h,m),t.insert(c.sizers,u+h,g),f.parent=c}a.children.length=0,a.handles.length=0,a.sizers.length=0,a.parent=null,c.syncHandles()}}else this._root=null}},n.prototype._insertTab=function(t,e,n,i){if(t!==e){if(!this._root){var r=new kt.TabLayoutNode(this._createTabBar());return r.tabBar.addTab(t.title),void(this._root=r)}var o;n||(n=this._root.findFirstTabNode()),-1===n.tabBar.titles.indexOf(t.title)&&(this._removeWidget(t),t.hide()),o=e?n.tabBar.titles.indexOf(e.title):n.tabBar.currentIndex,n.tabBar.insertTab(o+(i?1:0),t.title)}},n.prototype._insertSplit=function(e,n,i,r,o){if(e!==n||!i||1!==i.tabBar.titles.length){this._removeWidget(e);var s=new kt.TabLayoutNode(this._createTabBar());if(s.tabBar.addTab(e.title),this._root){if(!i||!i.parent){var a=this._splitRoot(r),l=o?a.children.length:0;a.normalizeSizes();var c=kt.createSizer(i?1:kt.GOLDEN_RATIO);return t.insert(a.children,l,s),t.insert(a.sizers,l,c),t.insert(a.handles,l,this._createHandle()),s.parent=a,a.normalizeSizes(),void a.syncHandles()}var u=i.parent;if(u.orientation===r){var d=u.children.indexOf(i);u.normalizeSizes();var h=u.sizers[d].sizeHint/=2,p=d+(o?1:0);return t.insert(u.children,p,s),t.insert(u.sizers,p,kt.createSizer(h)),t.insert(u.handles,p,this._createHandle()),s.parent=u,void u.syncHandles()}var f=t.removeFirstOf(u.children,i),m=new kt.SplitLayoutNode(r);m.normalized=!0,m.children.push(i),m.sizers.push(kt.createSizer(.5)),m.handles.push(this._createHandle()),i.parent=m;var g=o?1:0;t.insert(m.children,g,s),t.insert(m.sizers,g,kt.createSizer(.5)),t.insert(m.handles,g,this._createHandle()),s.parent=m,m.syncHandles(),t.insert(u.children,f,m),m.parent=u}else this._root=s}},n.prototype._splitRoot=function(t){var e=this._root;if(e instanceof kt.SplitLayoutNode&&e.orientation===t)return e;var n=this._root=new kt.SplitLayoutNode(t);return e&&(n.children.push(e),n.sizers.push(kt.createSizer(0)),n.handles.push(this._createHandle()),e.parent=n),n},n.prototype._fit=function(){var t=0,e=0;if(this._root){var n=this._root.fit(this._spacing,this._items);t=n.minWidth,e=n.minHeight}var i=this._box=A.boxSizing(this.parent.node);t+=i.horizontalSum,e+=i.verticalSum;var r=this.parent.node.style;r.minWidth=t+"px",r.minHeight=e+"px",this._dirty=!0,this.parent.parent&&U.sendMessage(this.parent.parent,pt.Msg.FitRequest),this._dirty&&U.sendMessage(this.parent,pt.Msg.UpdateRequest)},n.prototype._update=function(t,e){if(this._dirty=!1,this._root){t<0&&(t=this.parent.node.offsetWidth),e<0&&(e=this.parent.node.offsetHeight),this._box||(this._box=A.boxSizing(this.parent.node));var n=this._box.paddingTop,i=this._box.paddingLeft,r=t-this._box.horizontalSum,o=e-this._box.verticalSum;this._root.update(n,i,r,o,this._spacing,this._items)}},n.prototype._createTabBar=function(){var t=this.renderer.createTabBar();return t.orientation="horizontal",this.parent&&(t.parent=this.parent,this.attachWidget(t)),t},n.prototype._createHandle=function(){var t=this.renderer.createHandle(),e=t.style;return e.position="absolute",e.top="0",e.left="0",e.width="0",e.height="0",this.parent&&this.parent.node.appendChild(t),t},n}(ft);!function(t){function e(t){var e=new at;return e.sizeHint=t,e.size=t,e}t.GOLDEN_RATIO=.618,t.clampSpacing=function(t){return Math.max(0,Math.floor(t))},t.createSizer=e,t.normalizeAreaConfig=function t(e,n){return"tab-area"===e.type?function(t,e){if(0===t.widgets.length)return null;var n=[];if(i(t.widgets,(function(t){e.has(t)||(e.add(t),n.push(t))})),0===n.length)return null;var r=t.currentIndex;return-1!==r&&(r<0||r>=n.length)&&(r=0),{type:"tab-area",widgets:n,currentIndex:r}}(e,n):function(e,n){for(var i=e.orientation,r=[],o=[],s=0,a=e.children.length;s<a;++s){var l=t(e.children[s],n);l&&("tab-area"===l.type||l.orientation!==i?(r.push(l),o.push(Math.abs(e.sizes[s]||0))):(r.push.apply(r,l.children),o.push.apply(o,l.sizes)))}return 0===r.length?null:1===r.length?r[0]:{type:"split-area",orientation:i,children:r,sizes:o}}(e,n)},t.realizeAreaConfig=function t(o,s){return"tab-area"===o.type?function(t,e){var r=e.createTabBar();return i(t.widgets,(function(t){t.hide(),r.addTab(t.title)})),r.currentIndex=t.currentIndex,new n(r)}(o,s):function(n,o){var s=new r(n.orientation);return i(n.children,(function(i,r){var a=t(i,o),l=e(n.sizes[r]),c=o.createHandle();s.children.push(a),s.handles.push(c),s.sizers.push(l),a.parent=s})),s.syncHandles(),s.normalizeSizes(),s}(o,s)};var n=function(){function t(t){this.parent=null,this._top=0,this._left=0,this._width=0,this._height=0;var e=new at,n=new at;e.stretch=0,n.stretch=1,this.tabBar=t,this.sizers=[e,n]}return Object.defineProperty(t.prototype,"top",{get:function(){return this._top},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this._left},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),t.prototype.iterAllWidgets=function(){return o(m(this.tabBar),this.iterUserWidgets())},t.prototype.iterUserWidgets=function(){return d(this.tabBar.titles,(function(t){return t.owner}))},t.prototype.iterSelectedWidgets=function(){var t=this.tabBar.currentTitle;return t?m(t.owner):a()},t.prototype.iterTabBars=function(){return m(this.tabBar)},t.prototype.iterHandles=function(){return a()},t.prototype.findTabNode=function(t){return-1!==this.tabBar.titles.indexOf(t.title)?this:null},t.prototype.findSplitNode=function(t){return null},t.prototype.findFirstTabNode=function(){return this},t.prototype.hitTestTabNodes=function(t,e){return t<this._left||t>=this._left+this._width||e<this._top||e>=this._top+this._height?null:this},t.prototype.createConfig=function(){return{type:"tab-area",widgets:this.tabBar.titles.map((function(t){return t.owner})),currentIndex:this.tabBar.currentIndex}},t.prototype.holdAllSizes=function(){},t.prototype.fit=function(t,e){var n=0,i=0,r=e.get(this.tabBar),o=this.tabBar.currentTitle,s=o?e.get(o.owner):void 0,a=this.sizers,l=a[0],c=a[1];return r&&r.fit(),s&&s.fit(),r&&!r.isHidden?(n=Math.max(n,r.minWidth),i+=r.minHeight,l.minSize=r.minHeight,l.maxSize=r.maxHeight):(l.minSize=0,l.maxSize=0),s&&!s.isHidden?(n=Math.max(n,s.minWidth),i+=s.minHeight,c.minSize=s.minHeight,c.maxSize=1/0):(c.minSize=0,c.maxSize=1/0),{minWidth:n,minHeight:i,maxWidth:1/0,maxHeight:1/0}},t.prototype.update=function(t,e,n,i,r,o){this._top=e,this._left=t,this._width=n,this._height=i;var s=o.get(this.tabBar),a=this.tabBar.currentTitle,l=a?o.get(a.owner):void 0;if(st.calc(this.sizers,i),s&&!s.isHidden){var c=this.sizers[0].size;s.update(t,e,n,c),e+=c}l&&!l.isHidden&&(c=this.sizers[1].size,l.update(t,e,n,c))},t}();t.TabLayoutNode=n;var r=function(){function t(t){this.parent=null,this.normalized=!1,this.children=[],this.sizers=[],this.handles=[],this.orientation=t}return t.prototype.iterAllWidgets=function(){var t=d(this.children,(function(t){return t.iterAllWidgets()}));return new s(t)},t.prototype.iterUserWidgets=function(){var t=d(this.children,(function(t){return t.iterUserWidgets()}));return new s(t)},t.prototype.iterSelectedWidgets=function(){var t=d(this.children,(function(t){return t.iterSelectedWidgets()}));return new s(t)},t.prototype.iterTabBars=function(){var t=d(this.children,(function(t){return t.iterTabBars()}));return new s(t)},t.prototype.iterHandles=function(){var t=d(this.children,(function(t){return t.iterHandles()}));return o(this.handles,new s(t))},t.prototype.findTabNode=function(t){for(var e=0,n=this.children.length;e<n;++e){var i=this.children[e].findTabNode(t);if(i)return i}return null},t.prototype.findSplitNode=function(t){var e=this.handles.indexOf(t);if(-1!==e)return{index:e,node:this};for(var n=0,i=this.children.length;n<i;++n){var r=this.children[n].findSplitNode(t);if(r)return r}return null},t.prototype.findFirstTabNode=function(){return 0===this.children.length?null:this.children[0].findFirstTabNode()},t.prototype.hitTestTabNodes=function(t,e){for(var n=0,i=this.children.length;n<i;++n){var r=this.children[n].hitTestTabNodes(t,e);if(r)return r}return null},t.prototype.createConfig=function(){var t=this.orientation,e=this.createNormalizedSizes();return{type:"split-area",orientation:t,children:this.children.map((function(t){return t.createConfig()})),sizes:e}},t.prototype.syncHandles=function(){var t=this;i(this.handles,(function(e,n){e.setAttribute("data-orientation",t.orientation),n===t.handles.length-1?(e.classList.add("lm-mod-hidden"),e.classList.add("p-mod-hidden")):(e.classList.remove("lm-mod-hidden"),e.classList.remove("p-mod-hidden"))}))},t.prototype.holdSizes=function(){i(this.sizers,(function(t){t.sizeHint=t.size}))},t.prototype.holdAllSizes=function(){i(this.children,(function(t){return t.holdAllSizes()})),this.holdSizes()},t.prototype.normalizeSizes=function(){var t=this.sizers.length;if(0!==t){this.holdSizes();var e=f(this.sizers,(function(t,e){return t+e.sizeHint}),0);i(this.sizers,0===e?function(e){e.size=e.sizeHint=1/t}:function(t){t.size=t.sizeHint/=e}),this.normalized=!0}},t.prototype.createNormalizedSizes=function(){var t=this.sizers.length;if(0===t)return[];var e=this.sizers.map((function(t){return t.size})),n=f(e,(function(t,e){return t+e}),0);return i(e,0===n?function(n,i){e[i]=1/t}:function(t,i){e[i]=t/n}),e},t.prototype.fit=function(t,e){for(var n="horizontal"===this.orientation,i=Math.max(0,this.children.length-1)*t,r=n?i:0,o=n?0:i,s=0,a=this.children.length;s<a;++s){var l=this.children[s].fit(t,e);n?(o=Math.max(o,l.minHeight),r+=l.minWidth,this.sizers[s].minSize=l.minWidth):(r=Math.max(r,l.minWidth),o+=l.minHeight,this.sizers[s].minSize=l.minHeight)}return{minWidth:r,minHeight:o,maxWidth:1/0,maxHeight:1/0}},t.prototype.update=function(t,e,n,r,o,s){var a="horizontal"===this.orientation,l=Math.max(0,this.children.length-1)*o,c=Math.max(0,(a?n:r)-l);this.normalized&&(i(this.sizers,(function(t){t.sizeHint*=c})),this.normalized=!1),st.calc(this.sizers,c);for(var u=0,d=this.children.length;u<d;++u){var h=this.children[u],p=this.sizers[u].size,f=this.handles[u].style;a?(h.update(t,e,p,r,o,s),t+=p,f.top=e+"px",f.left=t+"px",f.width=o+"px",f.height=r+"px",t+=o):(h.update(t,e,n,p,o,s),e+=p,f.top=e+"px",f.left=t+"px",f.width=n+"px",f.height=o+"px",e+=o)}},t}();t.SplitLayoutNode=r}(kt||(kt={}));var Pt,Lt=function(e){function n(t){void 0===t&&(t={});var i=e.call(this,{node:Pt.createNode()})||this;return i._currentIndex=-1,i._titles=[],i._titlesEditable=!1,i._previousTitle=null,i._dragData=null,i._tabMoved=new E(i),i._currentChanged=new E(i),i._tabCloseRequested=new E(i),i._tabDetachRequested=new E(i),i._tabActivateRequested=new E(i),i.addClass("lm-TabBar"),i.addClass("p-TabBar"),i.setFlag(pt.Flag.DisallowLayout),i.tabsMovable=t.tabsMovable||!1,i.titlesEditable=t.titlesEditable||!1,i.allowDeselect=t.allowDeselect||!1,i.insertBehavior=t.insertBehavior||"select-tab-if-needed",i.removeBehavior=t.removeBehavior||"select-tab-after",i.renderer=t.renderer||n.defaultRenderer,i._orientation=t.orientation||"horizontal",i.dataset.orientation=i._orientation,i}return ct(n,e),n.prototype.dispose=function(){this._releaseMouse(),this._titles.length=0,this._previousTitle=null,e.prototype.dispose.call(this)},Object.defineProperty(n.prototype,"currentChanged",{get:function(){return this._currentChanged},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"tabMoved",{get:function(){return this._tabMoved},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"tabActivateRequested",{get:function(){return this._tabActivateRequested},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"tabCloseRequested",{get:function(){return this._tabCloseRequested},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"tabDetachRequested",{get:function(){return this._tabDetachRequested},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"titlesEditable",{get:function(){return this._titlesEditable},set:function(t){this._titlesEditable=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"currentTitle",{get:function(){return this._titles[this._currentIndex]||null},set:function(t){this.currentIndex=t?this._titles.indexOf(t):-1},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"currentIndex",{get:function(){return this._currentIndex},set:function(t){if((t<0||t>=this._titles.length)&&(t=-1),this._currentIndex!==t){var e=this._currentIndex,n=this._titles[e]||null,i=t,r=this._titles[i]||null;this._currentIndex=i,this._previousTitle=n,this.update(),this._currentChanged.emit({previousIndex:e,previousTitle:n,currentIndex:i,currentTitle:r})}},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"orientation",{get:function(){return this._orientation},set:function(t){this._orientation!==t&&(this._releaseMouse(),this._orientation=t,this.dataset.orientation=t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"titles",{get:function(){return this._titles},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("lm-TabBar-content")[0]},enumerable:!0,configurable:!0}),n.prototype.addTab=function(t){return this.insertTab(this._titles.length,t)},n.prototype.insertTab=function(e,n){this._releaseMouse();var i=Pt.asTitle(n),r=this._titles.indexOf(i),o=Math.max(0,Math.min(e,this._titles.length));return-1===r?(t.insert(this._titles,o,i),i.changed.connect(this._onTitleChanged,this),this.update(),this._adjustCurrentForInsert(o,i),i):(o===this._titles.length&&o--,r===o||(t.move(this._titles,r,o),this.update(),this._adjustCurrentForMove(r,o)),i)},n.prototype.removeTab=function(t){this.removeTabAt(this._titles.indexOf(t))},n.prototype.removeTabAt=function(e){this._releaseMouse();var n=t.removeAt(this._titles,e);n&&(n.changed.disconnect(this._onTitleChanged,this),n===this._previousTitle&&(this._previousTitle=null),this.update(),this._adjustCurrentForRemove(e,n))},n.prototype.clearTabs=function(){if(0!==this._titles.length){this._releaseMouse();for(var t=0,e=this._titles;t<e.length;t++)e[t].changed.disconnect(this._onTitleChanged,this);var n=this.currentIndex,i=this.currentTitle;this._currentIndex=-1,this._previousTitle=null,this._titles.length=0,this.update(),-1!==n&&this._currentChanged.emit({previousIndex:n,previousTitle:i,currentIndex:-1,currentTitle:null})}},n.prototype.releaseMouse=function(){this._releaseMouse()},n.prototype.handleEvent=function(t){switch(t.type){case"mousedown":this._evtMouseDown(t);break;case"mousemove":this._evtMouseMove(t);break;case"mouseup":this._evtMouseUp(t);break;case"dblclick":this._evtDblClick(t);break;case"keydown":this._evtKeyDown(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}},n.prototype.onBeforeAttach=function(t){this.node.addEventListener("mousedown",this),this.node.addEventListener("dblclick",this)},n.prototype.onAfterDetach=function(t){this.node.removeEventListener("mousedown",this),this.node.removeEventListener("dblclick",this),this._releaseMouse()},n.prototype.onUpdateRequest=function(t){for(var e=this._titles,n=this.renderer,i=this.currentTitle,r=new Array(e.length),o=0,s=e.length;o<s;++o){var a=e[o],l=a===i,c=l?s:s-o-1;r[o]=n.renderTab({title:a,current:l,zIndex:c})}J.render(r,this.contentNode)},n.prototype._evtDblClick=function(e){if(this.titlesEditable){var n=this.contentNode.children,i=t.findFirstIndex(n,(function(t){return A.hitTest(t,e.clientX,e.clientY)}));if(-1!==i){var r=this.titles[i],o=n[i].querySelector(".lm-TabBar-tabLabel");if(o&&o.contains(e.target)){var s=r.label||"",a=o.innerHTML;o.innerHTML="";var l=document.createElement("input");l.classList.add("lm-TabBar-tabInput"),l.value=s,o.appendChild(l);var c=function(){l.removeEventListener("blur",c),o.innerHTML=a};l.addEventListener("dblclick",(function(t){return t.stopPropagation()})),l.addEventListener("blur",c),l.addEventListener("keydown",(function(t){"Enter"===t.key?(""!==l.value&&(r.label=r.caption=l.value),c()):"Escape"===t.key&&c()})),l.select(),l.focus(),o.children.length>0&&o.children[0].focus()}}}},n.prototype._evtKeyDown=function(t){t.preventDefault(),t.stopPropagation(),27===t.keyCode&&this._releaseMouse()},n.prototype._evtMouseDown=function(e){if((0===e.button||1===e.button)&&!this._dragData){var n=this.contentNode.children,i=t.findFirstIndex(n,(function(t){return A.hitTest(t,e.clientX,e.clientY)}));if(-1!==i&&(e.preventDefault(),e.stopPropagation(),this._dragData={tab:n[i],index:i,pressX:e.clientX,pressY:e.clientY,tabPos:-1,tabSize:-1,tabPressPos:-1,targetIndex:-1,tabLayout:null,contentRect:null,override:null,dragActive:!1,dragAborted:!1,detachRequested:!1},document.addEventListener("mouseup",this,!0),1!==e.button)){var r=n[i].querySelector(this.renderer.closeIconSelector);r&&r.contains(e.target)||(this.tabsMovable&&(document.addEventListener("mousemove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0)),this.allowDeselect&&this.currentIndex===i?this.currentIndex=-1:this.currentIndex=i,-1!==this.currentIndex&&this._tabActivateRequested.emit({index:this.currentIndex,title:this.currentTitle}))}}},n.prototype._evtMouseMove=function(t){var e=this._dragData;if(e){t.preventDefault(),t.stopPropagation();var n=this.contentNode.children;if(e.dragActive||Pt.dragExceeded(e,t)){if(!e.dragActive){var i=e.tab.getBoundingClientRect();"horizontal"===this._orientation?(e.tabPos=e.tab.offsetLeft,e.tabSize=i.width,e.tabPressPos=e.pressX-i.left):(e.tabPos=e.tab.offsetTop,e.tabSize=i.height,e.tabPressPos=e.pressY-i.top),e.tabLayout=Pt.snapTabLayout(n,this._orientation),e.contentRect=this.contentNode.getBoundingClientRect(),e.override=ot.overrideCursor("default"),e.tab.classList.add("lm-mod-dragging"),this.addClass("lm-mod-dragging"),e.tab.classList.add("p-mod-dragging"),this.addClass("p-mod-dragging"),e.dragActive=!0}if(!e.detachRequested&&Pt.detachExceeded(e,t)){e.detachRequested=!0;var r=e.index,o=t.clientX,s=t.clientY,a=n[r],l=this._titles[r];if(this._tabDetachRequested.emit({index:r,title:l,tab:a,clientX:o,clientY:s}),e.dragAborted)return}Pt.layoutTabs(n,e,t,this._orientation)}}},n.prototype._evtMouseUp=function(e){var n=this;if(0===e.button||1===e.button){var i=this._dragData;if(i){if(e.preventDefault(),e.stopPropagation(),document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("contextmenu",this,!0),!i.dragActive){this._dragData=null;var r=this.contentNode.children,o=t.findFirstIndex(r,(function(t){return A.hitTest(t,e.clientX,e.clientY)}));if(o!==i.index)return;var s=this._titles[o];if(!s.closable)return;if(1===e.button)return void this._tabCloseRequested.emit({index:o,title:s});var a=r[o].querySelector(this.renderer.closeIconSelector);return a&&a.contains(e.target)?void this._tabCloseRequested.emit({index:o,title:s}):void 0}if(0===e.button){Pt.finalizeTabPosition(i,this._orientation),i.tab.classList.remove("lm-mod-dragging"),i.tab.classList.remove("p-mod-dragging");var l=Pt.parseTransitionDuration(i.tab);setTimeout((function(){if(!i.dragAborted){n._dragData=null,Pt.resetTabPositions(n.contentNode.children,n._orientation),i.override.dispose(),n.removeClass("lm-mod-dragging"),n.removeClass("p-mod-dragging");var e=i.index,r=i.targetIndex;-1!==r&&e!==r&&(t.move(n._titles,e,r),n._adjustCurrentForMove(e,r),n._tabMoved.emit({fromIndex:e,toIndex:r,title:n._titles[r]}),U.sendMessage(n,pt.Msg.UpdateRequest))}}),l)}}}},n.prototype._releaseMouse=function(){var t=this._dragData;t&&(this._dragData=null,document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("contextmenu",this,!0),t.dragAborted=!0,t.dragActive&&(Pt.resetTabPositions(this.contentNode.children,this._orientation),t.override.dispose(),t.tab.classList.remove("lm-mod-dragging"),this.removeClass("lm-mod-dragging"),t.tab.classList.remove("p-mod-dragging"),this.removeClass("p-mod-dragging")))},n.prototype._adjustCurrentForInsert=function(t,e){var n=this.currentTitle,i=this._currentIndex,r=this.insertBehavior;if("select-tab"===r||"select-tab-if-needed"===r&&-1===i)return this._currentIndex=t,this._previousTitle=n,void this._currentChanged.emit({previousIndex:i,previousTitle:n,currentIndex:t,currentTitle:e});i>=t&&this._currentIndex++},n.prototype._adjustCurrentForMove=function(t,e){this._currentIndex===t?this._currentIndex=e:this._currentIndex<t&&this._currentIndex>=e?this._currentIndex++:this._currentIndex>t&&this._currentIndex<=e&&this._currentIndex--},n.prototype._adjustCurrentForRemove=function(t,e){var n=this._currentIndex,i=this.removeBehavior;if(n===t){if(0===this._titles.length)return this._currentIndex=-1,void this._currentChanged.emit({previousIndex:t,previousTitle:e,currentIndex:-1,currentTitle:null});if("select-tab-after"===i)return this._currentIndex=Math.min(t,this._titles.length-1),void this._currentChanged.emit({previousIndex:t,previousTitle:e,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-tab-before"===i)return this._currentIndex=Math.max(0,t-1),void this._currentChanged.emit({previousIndex:t,previousTitle:e,currentIndex:this._currentIndex,currentTitle:this.currentTitle});if("select-previous-tab"===i)return this._previousTitle?(this._currentIndex=this._titles.indexOf(this._previousTitle),this._previousTitle=null):this._currentIndex=Math.min(t,this._titles.length-1),void this._currentChanged.emit({previousIndex:t,previousTitle:e,currentIndex:this._currentIndex,currentTitle:this.currentTitle});this._currentIndex=-1,this._currentChanged.emit({previousIndex:t,previousTitle:e,currentIndex:-1,currentTitle:null})}else n>t&&this._currentIndex--},n.prototype._onTitleChanged=function(t){this.update()},n}(pt);!function(t){var e=function(){function t(){this.closeIconSelector=".lm-TabBar-tabCloseIcon",this._tabID=0,this._tabKeys=new WeakMap}return t.prototype.renderTab=function(t){var e=t.title.caption,n=this.createTabKey(t),i=this.createTabStyle(t),r=this.createTabClass(t),o=this.createTabDataset(t);return it.li({key:n,className:r,title:e,style:i,dataset:o},this.renderIcon(t),this.renderLabel(t),this.renderCloseIcon(t))},t.prototype.renderIcon=function(t){var e=t.title,n=this.createIconClass(t);return"string"==typeof e.icon?it.div({className:n},e.iconLabel):it.div({className:n},e.icon,e.iconLabel)},t.prototype.renderLabel=function(t){return it.div({className:"lm-TabBar-tabLabel p-TabBar-tabLabel"},t.title.label)},t.prototype.renderCloseIcon=function(t){return it.div({className:"lm-TabBar-tabCloseIcon p-TabBar-tabCloseIcon"})},t.prototype.createTabKey=function(t){var e=this._tabKeys.get(t.title);return void 0===e&&(e="tab-key-"+this._tabID++,this._tabKeys.set(t.title,e)),e},t.prototype.createTabStyle=function(t){return{zIndex:""+t.zIndex}},t.prototype.createTabClass=function(t){var e="lm-TabBar-tab";return e+=" p-TabBar-tab",t.title.className&&(e+=" "+t.title.className),t.title.closable&&(e+=" lm-mod-closable",e+=" p-mod-closable"),t.current&&(e+=" lm-mod-current",e+=" p-mod-current"),e},t.prototype.createTabDataset=function(t){return t.title.dataset},t.prototype.createIconClass=function(t){var e="lm-TabBar-tabIcon";e+=" p-TabBar-tabIcon";var n=t.title.iconClass;return n?e+" "+n:e},t}();t.Renderer=e,t.defaultRenderer=new e}(Lt||(Lt={})),function(t){t.DRAG_THRESHOLD=5,t.DETACH_THRESHOLD=20,t.createNode=function(){var t=document.createElement("div"),e=document.createElement("ul");return e.className="lm-TabBar-content",e.classList.add("p-TabBar-content"),t.appendChild(e),t},t.asTitle=function(t){return t instanceof ht?t:new ht(t)},t.parseTransitionDuration=function(t){var e=window.getComputedStyle(t);return 1e3*(parseFloat(e.transitionDuration)||0)},t.snapTabLayout=function(t,e){for(var n=new Array(t.length),i=0,r=t.length;i<r;++i){var o=t[i],s=window.getComputedStyle(o);n[i]="horizontal"===e?{pos:o.offsetLeft,size:o.offsetWidth,margin:parseFloat(s.marginLeft)||0}:{pos:o.offsetTop,size:o.offsetHeight,margin:parseFloat(s.marginTop)||0}}return n},t.dragExceeded=function(e,n){var i=Math.abs(n.clientX-e.pressX),r=Math.abs(n.clientY-e.pressY);return i>=t.DRAG_THRESHOLD||r>=t.DRAG_THRESHOLD},t.detachExceeded=function(e,n){var i=e.contentRect;return n.clientX<i.left-t.DETACH_THRESHOLD||n.clientX>=i.right+t.DETACH_THRESHOLD||n.clientY<i.top-t.DETACH_THRESHOLD||n.clientY>=i.bottom+t.DETACH_THRESHOLD},t.layoutTabs=function(t,e,n,i){var r,o,s,a;"horizontal"===i?(r=e.pressX,o=n.clientX-e.contentRect.left,s=n.clientX,a=e.contentRect.width):(r=e.pressY,o=n.clientY-e.contentRect.top,s=n.clientY,a=e.contentRect.height);for(var l=e.index,c=o-e.tabPressPos,u=c+e.tabSize,d=0,h=t.length;d<h;++d){var p=void 0,f=e.tabLayout[d],m=f.pos+(f.size>>1);if(d<e.index&&c<m)p=e.tabSize+e.tabLayout[d+1].margin+"px",l=Math.min(l,d);else if(d>e.index&&u>m)p=-e.tabSize-f.margin+"px",l=Math.max(l,d);else if(d===e.index){var g=s-r,v=a-(e.tabPos+e.tabSize);p=Math.max(-e.tabPos,Math.min(g,v))+"px"}else p="";"horizontal"===i?t[d].style.left=p:t[d].style.top=p}e.targetIndex=l},t.finalizeTabPosition=function(t,e){var n,i;if(n="horizontal"===e?t.contentRect.width:t.contentRect.height,t.targetIndex===t.index)i=0;else if(t.targetIndex>t.index)i=(r=t.tabLayout[t.targetIndex]).pos+r.size-t.tabSize-t.tabPos;else{var r;i=(r=t.tabLayout[t.targetIndex]).pos-t.tabPos}var o=n-(t.tabPos+t.tabSize),s=Math.max(-t.tabPos,Math.min(i,o));"horizontal"===e?t.tab.style.left=s+"px":t.tab.style.top=s+"px"},t.resetTabPositions=function(t,e){i(t,(function(t){"horizontal"===e?t.style.left="":t.style.top=""}))}}(Pt||(Pt={}));var It,zt=function(t){function e(n){void 0===n&&(n={});var i=t.call(this)||this;i._drag=null,i._tabsMovable=!0,i._tabsConstrained=!1,i._pressData=null,i._layoutModified=new E(i),i.addClass("lm-DockPanel"),i.addClass("p-DockPanel"),i._mode=n.mode||"multiple-document",i._renderer=n.renderer||e.defaultRenderer,i._edges=n.edges||It.DEFAULT_EDGES,void 0!==n.tabsMovable&&(i._tabsMovable=n.tabsMovable),void 0!==n.tabsConstrained&&(i._tabsConstrained=n.tabsConstrained),i.dataset.mode=i._mode;var r={createTabBar:function(){return i._createTabBar()},createHandle:function(){return i._createHandle()}};return i.layout=new At({renderer:r,spacing:n.spacing}),i.overlay=n.overlay||new e.Overlay,i.node.appendChild(i.overlay.node),i}return ct(e,t),e.prototype.dispose=function(){this._releaseMouse(),this.overlay.hide(0),this._drag&&this._drag.dispose(),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"layoutModified",{get:function(){return this._layoutModified},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderer",{get:function(){return this.layout.renderer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spacing",{get:function(){return this.layout.spacing},set:function(t){this.layout.spacing=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"mode",{get:function(){return this._mode},set:function(t){if(this._mode!==t){this._mode=t,this.dataset.mode=t;var e=this.layout;switch(t){case"multiple-document":i(e.tabBars(),(function(t){t.show()}));break;case"single-document":e.restoreLayout(It.createSingleDocumentConfig(this));break;default:throw"unreachable"}U.postMessage(this,It.LayoutModified)}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabsMovable",{get:function(){return this._tabsMovable},set:function(t){this._tabsMovable=t,i(this.tabBars(),(function(e){e.tabsMovable=t}))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabsConstrained",{get:function(){return this._tabsConstrained},set:function(t){this._tabsConstrained=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.layout.isEmpty},enumerable:!0,configurable:!0}),e.prototype.widgets=function(){return this.layout.widgets()},e.prototype.selectedWidgets=function(){return this.layout.selectedWidgets()},e.prototype.tabBars=function(){return this.layout.tabBars()},e.prototype.handles=function(){return this.layout.handles()},e.prototype.selectWidget=function(t){var e=u(this.tabBars(),(function(e){return-1!==e.titles.indexOf(t.title)}));if(!e)throw new Error("Widget is not contained in the dock panel.");e.currentTitle=t.title},e.prototype.activateWidget=function(t){this.selectWidget(t),t.activate()},e.prototype.saveLayout=function(){return this.layout.saveLayout()},e.prototype.restoreLayout=function(t){this._mode="multiple-document",this.layout.restoreLayout(t),(P.IS_EDGE||P.IS_IE)&&U.flush(),U.postMessage(this,It.LayoutModified)},e.prototype.addWidget=function(t,e){void 0===e&&(e={}),"single-document"===this._mode?this.layout.addWidget(t):this.layout.addWidget(t,e),U.postMessage(this,It.LayoutModified)},e.prototype.processMessage=function(e){"layout-modified"===e.type?this._layoutModified.emit(void 0):t.prototype.processMessage.call(this,e)},e.prototype.handleEvent=function(t){switch(t.type){case"lm-dragenter":this._evtDragEnter(t);break;case"lm-dragleave":this._evtDragLeave(t);break;case"lm-dragover":this._evtDragOver(t);break;case"lm-drop":this._evtDrop(t);break;case"mousedown":this._evtMouseDown(t);break;case"mousemove":this._evtMouseMove(t);break;case"mouseup":this._evtMouseUp(t);break;case"keydown":this._evtKeyDown(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}},e.prototype.onBeforeAttach=function(t){this.node.addEventListener("lm-dragenter",this),this.node.addEventListener("lm-dragleave",this),this.node.addEventListener("lm-dragover",this),this.node.addEventListener("lm-drop",this),this.node.addEventListener("mousedown",this)},e.prototype.onAfterDetach=function(t){this.node.removeEventListener("lm-dragenter",this),this.node.removeEventListener("lm-dragleave",this),this.node.removeEventListener("lm-dragover",this),this.node.removeEventListener("lm-drop",this),this.node.removeEventListener("mousedown",this),this._releaseMouse()},e.prototype.onChildAdded=function(t){It.isGeneratedTabBarProperty.get(t.child)||(t.child.addClass("lm-DockPanel-widget"),t.child.addClass("p-DockPanel-widget"))},e.prototype.onChildRemoved=function(t){It.isGeneratedTabBarProperty.get(t.child)||(t.child.removeClass("lm-DockPanel-widget"),t.child.removeClass("p-DockPanel-widget"),U.postMessage(this,It.LayoutModified))},e.prototype._evtDragEnter=function(t){t.mimeData.hasData("application/vnd.lumino.widget-factory")&&(t.preventDefault(),t.stopPropagation())},e.prototype._evtDragLeave=function(t){t.preventDefault(),t.stopPropagation(),this.overlay.hide(1)},e.prototype._evtDragOver=function(t){t.preventDefault(),t.stopPropagation(),this._tabsConstrained&&t.source!==this||"invalid"===this._showOverlay(t.clientX,t.clientY)?t.dropAction="none":t.dropAction=t.proposedAction},e.prototype._evtDrop=function(t){if(t.preventDefault(),t.stopPropagation(),this.overlay.hide(0),"none"!==t.proposedAction){var e=t.clientX,n=t.clientY,i=It.findDropTarget(this,e,n,this._edges),r=i.zone,o=i.target;if("invalid"!==r){var s=t.mimeData.getData("application/vnd.lumino.widget-factory");if("function"==typeof s){var a=s();if(a instanceof pt)if(a.contains(this))t.dropAction="none";else{var l=o?It.getDropRef(o.tabBar):null;switch(r){case"root-all":this.addWidget(a);break;case"root-top":this.addWidget(a,{mode:"split-top"});break;case"root-left":this.addWidget(a,{mode:"split-left"});break;case"root-right":this.addWidget(a,{mode:"split-right"});break;case"root-bottom":this.addWidget(a,{mode:"split-bottom"});break;case"widget-all":this.addWidget(a,{mode:"tab-after",ref:l});break;case"widget-top":this.addWidget(a,{mode:"split-top",ref:l});break;case"widget-left":this.addWidget(a,{mode:"split-left",ref:l});break;case"widget-right":this.addWidget(a,{mode:"split-right",ref:l});break;case"widget-bottom":this.addWidget(a,{mode:"split-bottom",ref:l});break;case"widget-tab":this.addWidget(a,{mode:"tab-after",ref:l});break;default:throw"unreachable"}t.dropAction=t.proposedAction,this.activateWidget(a)}else t.dropAction="none"}else t.dropAction="none"}else t.dropAction="none"}else t.dropAction="none"},e.prototype._evtKeyDown=function(t){t.preventDefault(),t.stopPropagation(),27===t.keyCode&&(this._releaseMouse(),U.postMessage(this,It.LayoutModified))},e.prototype._evtMouseDown=function(t){if(0===t.button){var e=this.layout,n=t.target,i=u(e.handles(),(function(t){return t.contains(n)}));if(i){t.preventDefault(),t.stopPropagation(),document.addEventListener("keydown",this,!0),document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0),document.addEventListener("contextmenu",this,!0);var r=i.getBoundingClientRect(),o=t.clientX-r.left,s=t.clientY-r.top,a=window.getComputedStyle(i),l=ot.overrideCursor(a.cursor);this._pressData={handle:i,deltaX:o,deltaY:s,override:l}}}},e.prototype._evtMouseMove=function(t){if(this._pressData){t.preventDefault(),t.stopPropagation();var e=this.node.getBoundingClientRect(),n=t.clientX-e.left-this._pressData.deltaX,i=t.clientY-e.top-this._pressData.deltaY;this.layout.moveHandle(this._pressData.handle,n,i)}},e.prototype._evtMouseUp=function(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this._releaseMouse(),U.postMessage(this,It.LayoutModified))},e.prototype._releaseMouse=function(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,document.removeEventListener("keydown",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("mousemove",this,!0),document.removeEventListener("contextmenu",this,!0))},e.prototype._showOverlay=function(t,e){var n,i,r,o,s=It.findDropTarget(this,t,e,this._edges),a=s.zone,l=s.target;if("invalid"===a)return this.overlay.hide(100),a;var c=A.boxSizing(this.node),u=this.node.getBoundingClientRect();switch(a){case"root-all":n=c.paddingTop,i=c.paddingLeft,r=c.paddingRight,o=c.paddingBottom;break;case"root-top":n=c.paddingTop,i=c.paddingLeft,r=c.paddingRight,o=u.height*It.GOLDEN_RATIO;break;case"root-left":n=c.paddingTop,i=c.paddingLeft,r=u.width*It.GOLDEN_RATIO,o=c.paddingBottom;break;case"root-right":n=c.paddingTop,i=u.width*It.GOLDEN_RATIO,r=c.paddingRight,o=c.paddingBottom;break;case"root-bottom":n=u.height*It.GOLDEN_RATIO,i=c.paddingLeft,r=c.paddingRight,o=c.paddingBottom;break;case"widget-all":n=l.top,i=l.left,r=l.right,o=l.bottom;break;case"widget-top":n=l.top,i=l.left,r=l.right,o=l.bottom+l.height/2;break;case"widget-left":n=l.top,i=l.left,r=l.right+l.width/2,o=l.bottom;break;case"widget-right":n=l.top,i=l.left+l.width/2,r=l.right,o=l.bottom;break;case"widget-bottom":n=l.top+l.height/2,i=l.left,r=l.right,o=l.bottom;break;case"widget-tab":var d=l.tabBar.node.getBoundingClientRect().height;n=l.top,i=l.left,r=l.right,o=l.bottom+l.height-d;break;default:throw"unreachable"}return this.overlay.show({top:n,left:i,right:r,bottom:o}),a},e.prototype._createTabBar=function(){var t=this._renderer.createTabBar();return It.isGeneratedTabBarProperty.set(t,!0),"single-document"===this._mode&&t.hide(),t.tabsMovable=this._tabsMovable,t.allowDeselect=!1,t.removeBehavior="select-previous-tab",t.insertBehavior="select-tab-if-needed",t.tabMoved.connect(this._onTabMoved,this),t.currentChanged.connect(this._onCurrentChanged,this),t.tabCloseRequested.connect(this._onTabCloseRequested,this),t.tabDetachRequested.connect(this._onTabDetachRequested,this),t.tabActivateRequested.connect(this._onTabActivateRequested,this),t},e.prototype._createHandle=function(){return this._renderer.createHandle()},e.prototype._onTabMoved=function(){U.postMessage(this,It.LayoutModified)},e.prototype._onCurrentChanged=function(t,e){var n=e.previousTitle,i=e.currentTitle;n&&n.owner.hide(),i&&i.owner.show(),(P.IS_EDGE||P.IS_IE)&&U.flush(),U.postMessage(this,It.LayoutModified)},e.prototype._onTabActivateRequested=function(t,e){e.title.owner.activate()},e.prototype._onTabCloseRequested=function(t,e){e.title.owner.close()},e.prototype._onTabDetachRequested=function(t,e){var n=this;if(!this._drag){t.releaseMouse();var i=e.title,r=e.tab,o=e.clientX,s=e.clientY,a=new x;a.setData("application/vnd.lumino.widget-factory",(function(){return i.owner}));var l=r.cloneNode(!0);this._drag=new ot({mimeData:a,dragImage:l,proposedAction:"move",supportedActions:"move",source:this}),r.classList.add("lm-mod-hidden"),r.classList.add("p-mod-hidden"),this._drag.start(o,s).then((function(){n._drag=null,r.classList.remove("lm-mod-hidden"),r.classList.remove("p-mod-hidden")}))}},e}(pt);!function(t){var e=function(){function t(){this._timer=-1,this._hidden=!0,this.node=document.createElement("div"),this.node.classList.add("lm-DockPanel-overlay"),this.node.classList.add("lm-mod-hidden"),this.node.classList.add("p-DockPanel-overlay"),this.node.classList.add("p-mod-hidden"),this.node.style.position="absolute"}return t.prototype.show=function(t){var e=this.node.style;e.top=t.top+"px",e.left=t.left+"px",e.right=t.right+"px",e.bottom=t.bottom+"px",clearTimeout(this._timer),this._timer=-1,this._hidden&&(this._hidden=!1,this.node.classList.remove("lm-mod-hidden"),this.node.classList.remove("p-mod-hidden"))},t.prototype.hide=function(t){var e=this;if(!this._hidden)return t<=0?(clearTimeout(this._timer),this._timer=-1,this._hidden=!0,this.node.classList.add("lm-mod-hidden"),void this.node.classList.add("p-mod-hidden")):void(-1===this._timer&&(this._timer=window.setTimeout((function(){e._timer=-1,e._hidden=!0,e.node.classList.add("lm-mod-hidden"),e.node.classList.add("p-mod-hidden")}),t)))},t}();t.Overlay=e;var n=function(){function t(){}return t.prototype.createTabBar=function(){var t=new Lt;return t.addClass("lm-DockPanel-tabBar"),t.addClass("p-DockPanel-tabBar"),t},t.prototype.createHandle=function(){var t=document.createElement("div");return t.className="lm-DockPanel-handle",t.classList.add("p-DockPanel-handle"),t},t}();t.Renderer=n,t.defaultRenderer=new n}(zt||(zt={})),function(t){t.GOLDEN_RATIO=.618,t.DEFAULT_EDGES={top:12,right:40,bottom:40,left:40},t.LayoutModified=new $("layout-modified"),t.isGeneratedTabBarProperty=new X({name:"isGeneratedTabBar",create:function(){return!1}}),t.createSingleDocumentConfig=function(t){if(t.isEmpty)return{main:null};var n=function(t){for(var n,i=0,r=[],o=e(t);void 0!==(n=o.next());)r[i++]=n;return r}(t.widgets()),i=t.selectedWidgets().next(),r=i?n.indexOf(i):-1;return{main:{type:"tab-area",widgets:n,currentIndex:r}}},t.findDropTarget=function(t,e,n,i){if(!A.hitTest(t.node,e,n))return{zone:"invalid",target:null};var r=t.layout;if(r.isEmpty)return{zone:"root-all",target:null};if("multiple-document"===t.mode){var o=t.node.getBoundingClientRect(),s=e-o.left+1,a=n-o.top+1,l=o.right-e,c=o.bottom-n;switch(Math.min(a,l,c,s)){case a:if(a<i.top)return{zone:"root-top",target:null};break;case l:if(l<i.right)return{zone:"root-right",target:null};break;case c:if(c<i.bottom)return{zone:"root-bottom",target:null};break;case s:if(s<i.left)return{zone:"root-left",target:null};break;default:throw"unreachable"}}var u=r.hitTestTabAreas(e,n);if(!u)return{zone:"invalid",target:null};if("single-document"===t.mode)return{zone:"widget-all",target:u};var d=u.x-u.left+1,h=u.y-u.top+1,p=u.left+u.width-u.x,f=u.top+u.height-u.y;if(h<u.tabBar.node.getBoundingClientRect().height)return{zone:"widget-tab",target:u};var m,g=Math.round(u.width/3),v=Math.round(u.height/3);if(d>g&&p>g&&h>v&&f>v)return{zone:"widget-all",target:u};switch(d/=g,h/=v,p/=g,f/=v,Math.min(d,h,p,f)){case d:m="widget-left";break;case h:m="widget-top";break;case p:m="widget-right";break;case f:m="widget-bottom";break;default:throw"unreachable"}return{zone:m,target:u}},t.getDropRef=function(t){return 0===t.titles.length?null:t.currentTitle?t.currentTitle.owner:t.titles[t.titles.length-1].owner}}(It||(It={})),function(){function n(){this._counter=0,this._widgets=[],this._activeWidget=null,this._currentWidget=null,this._numbers=new Map,this._nodes=new Map,this._activeChanged=new E(this),this._currentChanged=new E(this)}n.prototype.dispose=function(){var t=this;this._counter<0||(this._counter=-1,E.clearData(this),i(this._widgets,(function(e){e.node.removeEventListener("focus",t,!0),e.node.removeEventListener("blur",t,!0)})),this._activeWidget=null,this._currentWidget=null,this._nodes.clear(),this._numbers.clear(),this._widgets.length=0)},Object.defineProperty(n.prototype,"currentChanged",{get:function(){return this._currentChanged},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"activeChanged",{get:function(){return this._activeChanged},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isDisposed",{get:function(){return this._counter<0},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"currentWidget",{get:function(){return this._currentWidget},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"activeWidget",{get:function(){return this._activeWidget},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"widgets",{get:function(){return this._widgets},enumerable:!0,configurable:!0}),n.prototype.focusNumber=function(t){var e=this._numbers.get(t);return void 0===e?-1:e},n.prototype.has=function(t){return this._numbers.has(t)},n.prototype.add=function(t){if(!this._numbers.has(t)){var e=t.node.contains(document.activeElement),n=e?this._counter++:-1;this._widgets.push(t),this._numbers.set(t,n),this._nodes.set(t.node,t),t.node.addEventListener("focus",this,!0),t.node.addEventListener("blur",this,!0),t.disposed.connect(this._onWidgetDisposed,this),e&&this._setWidgets(t,t)}},n.prototype.remove=function(n){var i=this;if(this._numbers.has(n)&&(n.disposed.disconnect(this._onWidgetDisposed,this),n.node.removeEventListener("focus",this,!0),n.node.removeEventListener("blur",this,!0),t.removeFirstOf(this._widgets,n),this._nodes.delete(n.node),this._numbers.delete(n),this._currentWidget===n)){var r,o,s=function(t,n){var r,o,s=e(t),a=s.next();if(void 0!==a){for(var l=a;void 0!==(a=s.next());)r=a,o=l,i._numbers.get(r)-i._numbers.get(o)>0&&(l=a);return l}}((r=this._widgets,o=function(t){return-1!==i._numbers.get(t)},new c(e(r),o)))||null;this._setWidgets(s,null)}},n.prototype.handleEvent=function(t){switch(t.type){case"focus":this._evtFocus(t);break;case"blur":this._evtBlur(t)}},n.prototype._setWidgets=function(t,e){var n=this._currentWidget;this._currentWidget=t;var i=this._activeWidget;this._activeWidget=e,n!==t&&this._currentChanged.emit({oldValue:n,newValue:t}),i!==e&&this._activeChanged.emit({oldValue:i,newValue:e})},n.prototype._evtFocus=function(t){var e=this._nodes.get(t.currentTarget);e!==this._currentWidget&&this._numbers.set(e,this._counter++),this._setWidgets(e,e)},n.prototype._evtBlur=function(t){var e=this._nodes.get(t.currentTarget),n=t.relatedTarget;n&&(e.node.contains(n)||u(this._widgets,(function(t){return t.node.contains(n)})))||this._setWidgets(this._currentWidget,null)},n.prototype._onWidgetDisposed=function(t){this.remove(t)}}();var Bt,Rt=function(e){function n(t){void 0===t&&(t={});var n=e.call(this,t)||this;return n._dirty=!1,n._rowSpacing=4,n._columnSpacing=4,n._items=[],n._rowStarts=[],n._columnStarts=[],n._rowSizers=[new at],n._columnSizers=[new at],n._box=null,void 0!==t.rowCount&&Bt.reallocSizers(n._rowSizers,t.rowCount),void 0!==t.columnCount&&Bt.reallocSizers(n._columnSizers,t.columnCount),void 0!==t.rowSpacing&&(n._rowSpacing=Bt.clampValue(t.rowSpacing)),void 0!==t.columnSpacing&&(n._columnSpacing=Bt.clampValue(t.columnSpacing)),n}return ct(n,e),n.prototype.dispose=function(){i(this._items,(function(t){var e=t.widget;t.dispose(),e.dispose()})),this._box=null,this._items.length=0,this._rowStarts.length=0,this._rowSizers.length=0,this._columnStarts.length=0,this._columnSizers.length=0,e.prototype.dispose.call(this)},Object.defineProperty(n.prototype,"rowCount",{get:function(){return this._rowSizers.length},set:function(t){t!==this.rowCount&&(Bt.reallocSizers(this._rowSizers,t),this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"columnCount",{get:function(){return this._columnSizers.length},set:function(t){t!==this.columnCount&&(Bt.reallocSizers(this._columnSizers,t),this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"rowSpacing",{get:function(){return this._rowSpacing},set:function(t){t=Bt.clampValue(t),this._rowSpacing!==t&&(this._rowSpacing=t,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"columnSpacing",{get:function(){return this._columnSpacing},set:function(t){t=Bt.clampValue(t),this._columnSpacing!==t&&(this._columnSpacing=t,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),n.prototype.rowStretch=function(t){var e=this._rowSizers[t];return e?e.stretch:-1},n.prototype.setRowStretch=function(t,e){var n=this._rowSizers[t];n&&(e=Bt.clampValue(e),n.stretch!==e&&(n.stretch=e,this.parent&&this.parent.update()))},n.prototype.columnStretch=function(t){var e=this._columnSizers[t];return e?e.stretch:-1},n.prototype.setColumnStretch=function(t,e){var n=this._columnSizers[t];n&&(e=Bt.clampValue(e),n.stretch!==e&&(n.stretch=e,this.parent&&this.parent.update()))},n.prototype.iter=function(){return d(this._items,(function(t){return t.widget}))},n.prototype.addWidget=function(e){-1===t.findFirstIndex(this._items,(function(t){return t.widget===e}))&&(this._items.push(new gt(e)),this.parent&&this.attachWidget(e))},n.prototype.removeWidget=function(e){var n=t.findFirstIndex(this._items,(function(t){return t.widget===e}));if(-1!==n){var i=t.removeAt(this._items,n);this.parent&&this.detachWidget(e),i.dispose()}},n.prototype.init=function(){var t=this;e.prototype.init.call(this),i(this,(function(e){t.attachWidget(e)}))},n.prototype.attachWidget=function(t){this.parent.isAttached&&U.sendMessage(t,pt.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&U.sendMessage(t,pt.Msg.AfterAttach),this.parent.fit()},n.prototype.detachWidget=function(t){this.parent.isAttached&&U.sendMessage(t,pt.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&U.sendMessage(t,pt.Msg.AfterDetach),this.parent.fit()},n.prototype.onBeforeShow=function(t){e.prototype.onBeforeShow.call(this,t),this.parent.update()},n.prototype.onBeforeAttach=function(t){e.prototype.onBeforeAttach.call(this,t),this.parent.fit()},n.prototype.onChildShown=function(t){this.parent.fit()},n.prototype.onChildHidden=function(t){this.parent.fit()},n.prototype.onResize=function(t){this.parent.isVisible&&this._update(t.width,t.height)},n.prototype.onUpdateRequest=function(t){this.parent.isVisible&&this._update(-1,-1)},n.prototype.onFitRequest=function(t){this.parent.isAttached&&this._fit()},n.prototype._fit=function(){for(var t=0,e=this.rowCount;t<e;++t)this._rowSizers[t].minSize=0;for(t=0,e=this.columnCount;t<e;++t)this._columnSizers[t].minSize=0;var i=this._items.filter((function(t){return!t.isHidden}));for(t=0,e=i.length;t<e;++t)i[t].fit();var r=this.rowCount-1,o=this.columnCount-1;for(i.sort(Bt.rowSpanCmp),t=0,e=i.length;t<e;++t){var s=i[t],a=n.getCellConfig(s.widget),l=Math.min(a.row,r),c=Math.min(a.row+a.rowSpan-1,r);Bt.distributeMin(this._rowSizers,l,c,s.minHeight)}for(i.sort(Bt.columnSpanCmp),t=0,e=i.length;t<e;++t){s=i[t],a=n.getCellConfig(s.widget);var u=Math.min(a.column,o),d=Math.min(a.column+a.columnSpan-1,o);Bt.distributeMin(this._columnSizers,u,d,s.minWidth)}if("set-no-constraint"!==this.fitPolicy){var h=r*this._rowSpacing,p=o*this._columnSpacing;for(t=0,e=this.rowCount;t<e;++t)h+=this._rowSizers[t].minSize;for(t=0,e=this.columnCount;t<e;++t)p+=this._columnSizers[t].minSize;var f=this._box=A.boxSizing(this.parent.node);p+=f.horizontalSum,h+=f.verticalSum;var m=this.parent.node.style;m.minWidth=p+"px",m.minHeight=h+"px",this._dirty=!0,this.parent.parent&&U.sendMessage(this.parent.parent,pt.Msg.FitRequest),this._dirty&&U.sendMessage(this.parent,pt.Msg.UpdateRequest)}else U.sendMessage(this.parent,pt.Msg.UpdateRequest)},n.prototype._update=function(t,e){this._dirty=!1,t<0&&(t=this.parent.node.offsetWidth),e<0&&(e=this.parent.node.offsetHeight),this._box||(this._box=A.boxSizing(this.parent.node));var i=this._box.paddingTop,r=this._box.paddingLeft,o=t-this._box.horizontalSum,s=e-this._box.verticalSum,a=this.rowCount-1,l=this.columnCount-1,c=a*this._rowSpacing,u=l*this._columnSpacing;st.calc(this._rowSizers,Math.max(0,s-c)),st.calc(this._columnSizers,Math.max(0,o-u));for(var d=0,h=i,p=this.rowCount;d<p;++d)this._rowStarts[d]=h,h+=this._rowSizers[d].size+this._rowSpacing;for(d=0,h=r,p=this.columnCount;d<p;++d)this._columnStarts[d]=h,h+=this._columnSizers[d].size+this._columnSpacing;for(d=0,p=this._items.length;d<p;++d){var f=this._items[d];if(!f.isHidden){var m=n.getCellConfig(f.widget),g=Math.min(m.row,a),v=Math.min(m.column,l),y=Math.min(m.row+m.rowSpan-1,a),b=Math.min(m.column+m.columnSpan-1,l),_=this._columnStarts[v],w=this._rowStarts[g],x=this._columnStarts[b]+this._columnSizers[b].size-_,C=this._rowStarts[y]+this._rowSizers[y].size-w;f.update(_,w,x,C)}}},n}(ft);!function(t){t.getCellConfig=function(t){return Bt.cellConfigProperty.get(t)},t.setCellConfig=function(t,e){Bt.cellConfigProperty.set(t,Bt.normalizeConfig(e))}}(Rt||(Rt={})),function(t){t.cellConfigProperty=new X({name:"cellConfig",create:function(){return{row:0,column:0,rowSpan:1,columnSpan:1}},changed:function(t){t.parent&&t.parent.layout instanceof Rt&&t.parent.fit()}}),t.normalizeConfig=function(t){return{row:Math.max(0,Math.floor(t.row||0)),column:Math.max(0,Math.floor(t.column||0)),rowSpan:Math.max(1,Math.floor(t.rowSpan||0)),columnSpan:Math.max(1,Math.floor(t.columnSpan||0))}},t.clampValue=function(t){return Math.max(0,Math.floor(t))},t.rowSpanCmp=function(e,n){var i=t.cellConfigProperty.get(e.widget),r=t.cellConfigProperty.get(n.widget);return i.rowSpan-r.rowSpan},t.columnSpanCmp=function(e,n){var i=t.cellConfigProperty.get(e.widget),r=t.cellConfigProperty.get(n.widget);return i.columnSpan-r.columnSpan},t.reallocSizers=function(t,e){for(e=Math.max(1,Math.floor(e));t.length<e;)t.push(new at);t.length>e&&(t.length=e)},t.distributeMin=function(t,e,n,i){if(!(n<e))if(e!==n){for(var r=0,o=e;o<=n;++o)r+=t[o].minSize;if(!(r>=i)){var s=(i-r)/(n-e+1);for(o=e;o<=n;++o)t[o].minSize+=s}}else{var a=t[e];a.minSize=Math.max(a.minSize,i)}}}(Bt||(Bt={}));var Ot,Nt,Wt=function(e){function n(t){void 0===t&&(t={});var i=e.call(this,{node:Ot.createNode()})||this;return i._activeIndex=-1,i._menus=[],i._childMenu=null,i.addClass("lm-MenuBar"),i.addClass("p-MenuBar"),i.setFlag(pt.Flag.DisallowLayout),i.renderer=t.renderer||n.defaultRenderer,i}return ct(n,e),n.prototype.dispose=function(){this._closeChildMenu(),this._menus.length=0,e.prototype.dispose.call(this)},Object.defineProperty(n.prototype,"childMenu",{get:function(){return this._childMenu},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"contentNode",{get:function(){return this.node.getElementsByClassName("lm-MenuBar-content")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"activeMenu",{get:function(){return this._menus[this._activeIndex]||null},set:function(t){this.activeIndex=t?this._menus.indexOf(t):-1},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"activeIndex",{get:function(){return this._activeIndex},set:function(t){(t<0||t>=this._menus.length)&&(t=-1),this._activeIndex!==t&&(this._activeIndex=t,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"menus",{get:function(){return this._menus},enumerable:!0,configurable:!0}),n.prototype.openActiveMenu=function(){-1!==this._activeIndex&&(this._openChildMenu(),this._childMenu&&(this._childMenu.activeIndex=-1,this._childMenu.activateNextItem()))},n.prototype.addMenu=function(t){this.insertMenu(this._menus.length,t)},n.prototype.insertMenu=function(e,n){this._closeChildMenu();var i=this._menus.indexOf(n),r=Math.max(0,Math.min(e,this._menus.length));if(-1===i)return t.insert(this._menus,r,n),n.addClass("lm-MenuBar-menu"),n.addClass("p-MenuBar-menu"),n.aboutToClose.connect(this._onMenuAboutToClose,this),n.menuRequested.connect(this._onMenuMenuRequested,this),n.title.changed.connect(this._onTitleChanged,this),void this.update();r===this._menus.length&&r--,i!==r&&(t.move(this._menus,i,r),this.update())},n.prototype.removeMenu=function(t){this.removeMenuAt(this._menus.indexOf(t))},n.prototype.removeMenuAt=function(e){this._closeChildMenu();var n=t.removeAt(this._menus,e);n&&(n.aboutToClose.disconnect(this._onMenuAboutToClose,this),n.menuRequested.disconnect(this._onMenuMenuRequested,this),n.title.changed.disconnect(this._onTitleChanged,this),n.removeClass("lm-MenuBar-menu"),n.removeClass("p-MenuBar-menu"),this.update())},n.prototype.clearMenus=function(){if(0!==this._menus.length){this._closeChildMenu();for(var t=0,e=this._menus;t<e.length;t++){var n=e[t];n.aboutToClose.disconnect(this._onMenuAboutToClose,this),n.menuRequested.disconnect(this._onMenuMenuRequested,this),n.title.changed.disconnect(this._onTitleChanged,this),n.removeClass("lm-MenuBar-menu"),n.removeClass("p-MenuBar-menu")}this._menus.length=0,this.update()}},n.prototype.handleEvent=function(t){switch(t.type){case"keydown":this._evtKeyDown(t);break;case"mousedown":this._evtMouseDown(t);break;case"mousemove":this._evtMouseMove(t);break;case"mouseleave":this._evtMouseLeave(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}},n.prototype.onBeforeAttach=function(t){this.node.addEventListener("keydown",this),this.node.addEventListener("mousedown",this),this.node.addEventListener("mousemove",this),this.node.addEventListener("mouseleave",this),this.node.addEventListener("contextmenu",this)},n.prototype.onAfterDetach=function(t){this.node.removeEventListener("keydown",this),this.node.removeEventListener("mousedown",this),this.node.removeEventListener("mousemove",this),this.node.removeEventListener("mouseleave",this),this.node.removeEventListener("contextmenu",this),this._closeChildMenu()},n.prototype.onActivateRequest=function(t){this.isAttached&&this.node.focus()},n.prototype.onUpdateRequest=function(t){for(var e=this._menus,n=this.renderer,i=this._activeIndex,r=new Array(e.length),o=0,s=e.length;o<s;++o){var a=e[o].title,l=o===i;r[o]=n.renderItem({title:a,active:l})}J.render(r,this.contentNode)},n.prototype._evtKeyDown=function(t){t.preventDefault(),t.stopPropagation();var e=t.keyCode;if(13!==e&&38!==e&&40!==e){if(27===e)return this._closeChildMenu(),this.activeIndex=-1,void this.node.blur();if(37!==e)if(39!==e){var n=B().keyForKeydownEvent(t);if(n){var i=this._activeIndex+1,r=Ot.findMnemonic(this._menus,n,i);-1===r.index||r.multiple?-1!==r.index?this.activeIndex=r.index:-1!==r.auto&&(this.activeIndex=r.auto):(this.activeIndex=r.index,this.openActiveMenu())}}else o=this._activeIndex,s=this._menus.length,this.activeIndex=o===s-1?0:o+1;else{var o=this._activeIndex,s=this._menus.length;this.activeIndex=0===o?s-1:o-1}}else this.openActiveMenu()},n.prototype._evtMouseDown=function(e){if(A.hitTest(this.node,e.clientX,e.clientY)){e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation();var n=t.findFirstIndex(this.contentNode.children,(function(t){return A.hitTest(t,e.clientX,e.clientY)}));-1!==n?0===e.button&&(this._childMenu?(this._closeChildMenu(),this.activeIndex=n):(this.activeIndex=n,this._openChildMenu())):this._closeChildMenu()}},n.prototype._evtMouseMove=function(e){var n=t.findFirstIndex(this.contentNode.children,(function(t){return A.hitTest(t,e.clientX,e.clientY)}));n!==this._activeIndex&&(-1===n&&this._childMenu||(this.activeIndex=n,this._childMenu&&this._openChildMenu()))},n.prototype._evtMouseLeave=function(t){this._childMenu||(this.activeIndex=-1)},n.prototype._openChildMenu=function(){var t=this.activeMenu;if(t){var e=this._childMenu;if(e!==t){this._childMenu=t,e?e.close():(this.addClass("lm-mod-active"),this.addClass("p-mod-active"),document.addEventListener("mousedown",this,!0)),U.sendMessage(this,pt.Msg.UpdateRequest);var n=this.contentNode.children[this._activeIndex].getBoundingClientRect(),i=n.left,r=n.bottom;t.open(i,r,{forceX:!0,forceY:!0})}}else this._closeChildMenu()},n.prototype._closeChildMenu=function(){if(this._childMenu){this.removeClass("lm-mod-active"),this.removeClass("p-mod-active"),document.removeEventListener("mousedown",this,!0);var t=this._childMenu;this._childMenu=null,t.close(),this.activeIndex=-1}},n.prototype._onMenuAboutToClose=function(t){t===this._childMenu&&(this.removeClass("lm-mod-active"),this.removeClass("p-mod-active"),document.removeEventListener("mousedown",this,!0),this._childMenu=null,this.activeIndex=-1)},n.prototype._onMenuMenuRequested=function(t,e){if(t===this._childMenu){var n=this._activeIndex,i=this._menus.length;switch(e){case"next":this.activeIndex=n===i-1?0:n+1;break;case"previous":this.activeIndex=0===n?i-1:n-1}this.openActiveMenu()}},n.prototype._onTitleChanged=function(){this.update()},n}(pt);!function(t){var e=function(){function t(){}return t.prototype.renderItem=function(t){var e=this.createItemClass(t),n=this.createItemDataset(t),i=this.createItemARIA(t);return it.li(dt({className:e,dataset:n},i),this.renderIcon(t),this.renderLabel(t))},t.prototype.renderIcon=function(t){var e=this.createIconClass(t);return"string"==typeof t.title.icon?it.div({className:e},t.title.iconLabel):it.div({className:e},t.title.icon,t.title.iconLabel)},t.prototype.renderLabel=function(t){var e=this.formatLabel(t);return it.div({className:"lm-MenuBar-itemLabel p-MenuBar-itemLabel"},e)},t.prototype.createItemClass=function(t){var e="lm-MenuBar-item";return e+=" p-MenuBar-item",t.title.className&&(e+=" "+t.title.className),t.active&&(e+=" lm-mod-active",e+=" p-mod-active"),e},t.prototype.createItemDataset=function(t){return t.title.dataset},t.prototype.createItemARIA=function(t){return{role:"menuitem","aria-haspopup":"true"}},t.prototype.createIconClass=function(t){var e="lm-MenuBar-itemIcon";e+=" p-MenuBar-itemIcon";var n=t.title.iconClass;return n?e+" "+n:e},t.prototype.formatLabel=function(t){var e=t.title,n=e.label,i=e.mnemonic;if(i<0||i>=n.length)return n;var r=n.slice(0,i),o=n.slice(i+1),s=n[i];return[r,it.span({className:"lm-MenuBar-itemMnemonic p-MenuBar-itemMnemonic"},s),o]},t}();t.Renderer=e,t.defaultRenderer=new e}(Wt||(Wt={})),function(t){t.createNode=function(){var t=document.createElement("div"),e=document.createElement("ul");return e.className="lm-MenuBar-content",e.classList.add("p-MenuBar-content"),t.appendChild(e),e.setAttribute("role","menubar"),t.tabIndex=-1,t},t.findMnemonic=function(t,e,n){for(var i=-1,r=-1,o=!1,s=e.toUpperCase(),a=0,l=t.length;a<l;++a){var c=(a+n)%l,u=t[c].title;if(0!==u.label.length){var d=u.mnemonic;d>=0&&d<u.label.length?u.label[d].toUpperCase()===s&&(-1===i?i=c:o=!0):-1===r&&u.label[0].toUpperCase()===s&&(r=c)}}return{index:i,multiple:o,auto:r}}}(Ot||(Ot={})),function(t){function e(e){void 0===e&&(e={});var n=t.call(this,{node:Nt.createNode()})||this;return n._onRepeat=function(){if(n._repeatTimer=-1,n._pressData){var t=n._pressData.part;if("thumb"!==t){n._repeatTimer=window.setTimeout(n._onRepeat,20);var e=n._pressData.mouseX,i=n._pressData.mouseY;if("decrement"!==t)if("increment"!==t){if("track"===t){if(!A.hitTest(n.trackNode,e,i))return;var r=n.thumbNode;if(A.hitTest(r,e,i))return;var o,s=r.getBoundingClientRect();return o="horizontal"===n._orientation?e<s.left?"decrement":"increment":i<s.top?"decrement":"increment",void n._pageRequested.emit(o)}}else{if(!A.hitTest(n.incrementNode,e,i))return;n._stepRequested.emit("increment")}else{if(!A.hitTest(n.decrementNode,e,i))return;n._stepRequested.emit("decrement")}}}},n._value=0,n._page=10,n._maximum=100,n._repeatTimer=-1,n._pressData=null,n._thumbMoved=new E(n),n._stepRequested=new E(n),n._pageRequested=new E(n),n.addClass("lm-ScrollBar"),n.addClass("p-ScrollBar"),n.setFlag(pt.Flag.DisallowLayout),n._orientation=e.orientation||"vertical",n.dataset.orientation=n._orientation,void 0!==e.maximum&&(n._maximum=Math.max(0,e.maximum)),void 0!==e.page&&(n._page=Math.max(0,e.page)),void 0!==e.value&&(n._value=Math.max(0,Math.min(e.value,n._maximum))),n}ct(e,t),Object.defineProperty(e.prototype,"thumbMoved",{get:function(){return this._thumbMoved},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stepRequested",{get:function(){return this._stepRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageRequested",{get:function(){return this._pageRequested},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(t){this._orientation!==t&&(this._releaseMouse(),this._orientation=t,this.dataset.orientation=t,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){t=Math.max(0,Math.min(t,this._maximum)),this._value!==t&&(this._value=t,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"page",{get:function(){return this._page},set:function(t){t=Math.max(0,t),this._page!==t&&(this._page=t,this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this._maximum},set:function(t){t=Math.max(0,t),this._maximum!==t&&(this._maximum=t,this._value=Math.min(this._value,t),this.update())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"decrementNode",{get:function(){return this.node.getElementsByClassName("lm-ScrollBar-button")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"incrementNode",{get:function(){return this.node.getElementsByClassName("lm-ScrollBar-button")[1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trackNode",{get:function(){return this.node.getElementsByClassName("lm-ScrollBar-track")[0]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"thumbNode",{get:function(){return this.node.getElementsByClassName("lm-ScrollBar-thumb")[0]},enumerable:!0,configurable:!0}),e.prototype.handleEvent=function(t){switch(t.type){case"mousedown":this._evtMouseDown(t);break;case"mousemove":this._evtMouseMove(t);break;case"mouseup":this._evtMouseUp(t);break;case"keydown":this._evtKeyDown(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}},e.prototype.onBeforeAttach=function(t){this.node.addEventListener("mousedown",this),this.update()},e.prototype.onAfterDetach=function(t){this.node.removeEventListener("mousedown",this),this._releaseMouse()},e.prototype.onUpdateRequest=function(t){var e=100*this._value/this._maximum,n=100*this._page/(this._page+this._maximum);e=Math.max(0,Math.min(e,100)),n=Math.max(0,Math.min(n,100));var i=this.thumbNode.style;"horizontal"===this._orientation?(i.top="",i.height="",i.left=e+"%",i.width=n+"%",i.transform="translate("+-e+"%, 0%)"):(i.left="",i.width="",i.top=e+"%",i.height=n+"%",i.transform="translate(0%, "+-e+"%)")},e.prototype._evtKeyDown=function(t){if(t.preventDefault(),t.stopPropagation(),27===t.keyCode){var e=this._pressData?this._pressData.value:-1;this._releaseMouse(),-1!==e&&this._moveThumb(e)}},e.prototype._evtMouseDown=function(t){if(0===t.button&&(this.activate(),!this._pressData)){var e=Nt.findPart(this,t.target);if(e){t.preventDefault(),t.stopPropagation();var n=ot.overrideCursor("default");if(this._pressData={part:e,override:n,delta:-1,value:-1,mouseX:t.clientX,mouseY:t.clientY},document.addEventListener("mousemove",this,!0),document.addEventListener("mouseup",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0),"thumb"===e){var i=this.thumbNode,r=i.getBoundingClientRect();return"horizontal"===this._orientation?this._pressData.delta=t.clientX-r.left:this._pressData.delta=t.clientY-r.top,i.classList.add("lm-mod-active"),i.classList.add("p-mod-active"),void(this._pressData.value=this._value)}if("track"===e){r=this.thumbNode.getBoundingClientRect();var o;return o="horizontal"===this._orientation?t.clientX<r.left?"decrement":"increment":t.clientY<r.top?"decrement":"increment",this._repeatTimer=window.setTimeout(this._onRepeat,350),void this._pageRequested.emit(o)}return"decrement"===e?(this.decrementNode.classList.add("lm-mod-active"),this.decrementNode.classList.add("p-mod-active"),this._repeatTimer=window.setTimeout(this._onRepeat,350),void this._stepRequested.emit("decrement")):"increment"===e?(this.incrementNode.classList.add("lm-mod-active"),this.incrementNode.classList.add("p-mod-active"),this._repeatTimer=window.setTimeout(this._onRepeat,350),void this._stepRequested.emit("increment")):void 0}}},e.prototype._evtMouseMove=function(t){if(this._pressData&&(t.preventDefault(),t.stopPropagation(),this._pressData.mouseX=t.clientX,this._pressData.mouseY=t.clientY,"thumb"===this._pressData.part)){var e,n,i=this.thumbNode.getBoundingClientRect(),r=this.trackNode.getBoundingClientRect();"horizontal"===this._orientation?(e=t.clientX-r.left-this._pressData.delta,n=r.width-i.width):(e=t.clientY-r.top-this._pressData.delta,n=r.height-i.height);var o=0===n?0:e*this._maximum/n;this._moveThumb(o)}},e.prototype._evtMouseUp=function(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this._releaseMouse())},e.prototype._releaseMouse=function(){this._pressData&&(clearTimeout(this._repeatTimer),this._repeatTimer=-1,this._pressData.override.dispose(),this._pressData=null,document.removeEventListener("mousemove",this,!0),document.removeEventListener("mouseup",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("contextmenu",this,!0),this.thumbNode.classList.remove("lm-mod-active"),this.decrementNode.classList.remove("lm-mod-active"),this.incrementNode.classList.remove("lm-mod-active"),this.thumbNode.classList.remove("p-mod-active"),this.decrementNode.classList.remove("p-mod-active"),this.incrementNode.classList.remove("p-mod-active"))},e.prototype._moveThumb=function(t){t=Math.max(0,Math.min(t,this._maximum)),this._value!==t&&(this._value=t,this.update(),this._thumbMoved.emit(t))}}(pt),function(t){t.createNode=function(){var t=document.createElement("div"),e=document.createElement("div"),n=document.createElement("div"),i=document.createElement("div"),r=document.createElement("div");return e.className="lm-ScrollBar-button",n.className="lm-ScrollBar-button",e.dataset.action="decrement",n.dataset.action="increment",i.className="lm-ScrollBar-track",r.className="lm-ScrollBar-thumb",e.classList.add("p-ScrollBar-button"),n.classList.add("p-ScrollBar-button"),i.classList.add("p-ScrollBar-track"),r.classList.add("p-ScrollBar-thumb"),i.appendChild(r),t.appendChild(e),t.appendChild(i),t.appendChild(n),t},t.findPart=function(t,e){return t.thumbNode.contains(e)?"thumb":t.trackNode.contains(e)?"track":t.decrementNode.contains(e)?"decrement":t.incrementNode.contains(e)?"increment":null}}(Nt||(Nt={})),function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._widget=null,e}ct(e,t),e.prototype.dispose=function(){if(this._widget){var e=this._widget;this._widget=null,e.dispose()}t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"widget",{get:function(){return this._widget},set:function(t){t&&(t.parent=this.parent),this._widget!==t&&(this._widget&&this._widget.dispose(),this._widget=t,this.parent&&t&&this.attachWidget(t))},enumerable:!0,configurable:!0}),e.prototype.iter=function(){return this._widget?m(this._widget):a()},e.prototype.removeWidget=function(t){this._widget===t&&(this._widget=null,this.parent&&this.detachWidget(t))},e.prototype.init=function(){var e=this;t.prototype.init.call(this),i(this,(function(t){e.attachWidget(t)}))},e.prototype.attachWidget=function(t){this.parent.isAttached&&U.sendMessage(t,pt.Msg.BeforeAttach),this.parent.node.appendChild(t.node),this.parent.isAttached&&U.sendMessage(t,pt.Msg.AfterAttach)},e.prototype.detachWidget=function(t){this.parent.isAttached&&U.sendMessage(t,pt.Msg.BeforeDetach),this.parent.node.removeChild(t.node),this.parent.isAttached&&U.sendMessage(t,pt.Msg.AfterDetach)}}(ft);var Ht,Ft=function(e){function n(t){var n=e.call(this)||this;return n._fixed=0,n._spacing=4,n._dirty=!1,n._hasNormedSizes=!1,n._sizers=[],n._items=[],n._handles=[],n._box=null,n._alignment="start",n._orientation="horizontal",n.renderer=t.renderer,void 0!==t.orientation&&(n._orientation=t.orientation),void 0!==t.alignment&&(n._alignment=t.alignment),void 0!==t.spacing&&(n._spacing=Ht.clampSpacing(t.spacing)),n}return ct(n,e),n.prototype.dispose=function(){i(this._items,(function(t){t.dispose()})),this._box=null,this._items.length=0,this._sizers.length=0,this._handles.length=0,e.prototype.dispose.call(this)},Object.defineProperty(n.prototype,"orientation",{get:function(){return this._orientation},set:function(t){this._orientation!==t&&(this._orientation=t,this.parent&&(this.parent.dataset.orientation=t,this.parent.fit()))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"alignment",{get:function(){return this._alignment},set:function(t){this._alignment!==t&&(this._alignment=t,this.parent&&(this.parent.dataset.alignment=t,this.parent.update()))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"spacing",{get:function(){return this._spacing},set:function(t){t=Ht.clampSpacing(t),this._spacing!==t&&(this._spacing=t,this.parent&&this.parent.fit())},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"handles",{get:function(){return this._handles},enumerable:!0,configurable:!0}),n.prototype.relativeSizes=function(){return Ht.normalize(this._sizers.map((function(t){return t.size})))},n.prototype.setRelativeSizes=function(t){for(var e=this._sizers.length,n=t.slice(0,e);n.length<e;)n.push(0);for(var i=Ht.normalize(n),r=0;r<e;++r){var o=this._sizers[r];o.sizeHint=i[r],o.size=i[r]}this._hasNormedSizes=!0,this.parent&&this.parent.update()},n.prototype.moveHandle=function(t,e){var n,i=this._handles[t];if(i&&!i.classList.contains("lm-mod-hidden")&&0!=(n="horizontal"===this._orientation?e-i.offsetLeft:e-i.offsetTop)){for(var r=0,o=this._sizers;r<o.length;r++){var s=o[r];s.size>0&&(s.sizeHint=s.size)}st.adjust(this._sizers,t,n),this.parent&&this.parent.update()}},n.prototype.init=function(){this.parent.dataset.orientation=this.orientation,this.parent.dataset.alignment=this.alignment,e.prototype.init.call(this)},n.prototype.attachWidget=function(e,n){var i=new gt(n),r=Ht.createHandle(this.renderer),o=Ht.averageSize(this._sizers),s=Ht.createSizer(o);t.insert(this._items,e,i),t.insert(this._sizers,e,s),t.insert(this._handles,e,r),this.parent.isAttached&&U.sendMessage(n,pt.Msg.BeforeAttach),this.parent.node.appendChild(n.node),this.parent.node.appendChild(r),this.parent.isAttached&&U.sendMessage(n,pt.Msg.AfterAttach),this.parent.fit()},n.prototype.moveWidget=function(e,n,i){t.move(this._items,e,n),t.move(this._sizers,e,n),t.move(this._handles,e,n),this.parent.fit()},n.prototype.detachWidget=function(e,n){var i=t.removeAt(this._items,e),r=t.removeAt(this._handles,e);t.removeAt(this._sizers,e),this.parent.isAttached&&U.sendMessage(n,pt.Msg.BeforeDetach),this.parent.node.removeChild(n.node),this.parent.node.removeChild(r),this.parent.isAttached&&U.sendMessage(n,pt.Msg.AfterDetach),i.dispose(),this.parent.fit()},n.prototype.onBeforeShow=function(t){e.prototype.onBeforeShow.call(this,t),this.parent.update()},n.prototype.onBeforeAttach=function(t){e.prototype.onBeforeAttach.call(this,t),this.parent.fit()},n.prototype.onChildShown=function(t){this.parent.fit()},n.prototype.onChildHidden=function(t){this.parent.fit()},n.prototype.onResize=function(t){this.parent.isVisible&&this._update(t.width,t.height)},n.prototype.onUpdateRequest=function(t){this.parent.isVisible&&this._update(-1,-1)},n.prototype.onFitRequest=function(t){this.parent.isAttached&&this._fit()},n.prototype._fit=function(){for(var t=0,e=-1,i=0,r=this._items.length;i<r;++i)this._items[i].isHidden?(this._handles[i].classList.add("lm-mod-hidden"),this._handles[i].classList.add("p-mod-hidden")):(this._handles[i].classList.remove("lm-mod-hidden"),this._handles[i].classList.remove("p-mod-hidden"),e=i,t++);-1!==e&&(this._handles[e].classList.add("lm-mod-hidden"),this._handles[e].classList.add("p-mod-hidden")),this._fixed=this._spacing*Math.max(0,t-1);var o="horizontal"===this._orientation,s=o?this._fixed:0,a=o?0:this._fixed;for(i=0,r=this._items.length;i<r;++i){var l=this._items[i],c=this._sizers[i];c.size>0&&(c.sizeHint=c.size),l.isHidden?(c.minSize=0,c.maxSize=0):(l.fit(),c.stretch=n.getStretch(l.widget),o?(c.minSize=l.minWidth,c.maxSize=l.maxWidth,s+=l.minWidth,a=Math.max(a,l.minHeight)):(c.minSize=l.minHeight,c.maxSize=l.maxHeight,a+=l.minHeight,s=Math.max(s,l.minWidth)))}var u=this._box=A.boxSizing(this.parent.node);s+=u.horizontalSum,a+=u.verticalSum;var d=this.parent.node.style;d.minWidth=s+"px",d.minHeight=a+"px",this._dirty=!0,this.parent.parent&&U.sendMessage(this.parent.parent,pt.Msg.FitRequest),this._dirty&&U.sendMessage(this.parent,pt.Msg.UpdateRequest)},n.prototype._update=function(t,e){this._dirty=!1;for(var n=0,i=0,r=this._items.length;i<r;++i)n+=+!this._items[i].isHidden;if(0!==n){t<0&&(t=this.parent.node.offsetWidth),e<0&&(e=this.parent.node.offsetHeight),this._box||(this._box=A.boxSizing(this.parent.node));var o,s=this._box.paddingTop,a=this._box.paddingLeft,l=t-this._box.horizontalSum,c=e-this._box.verticalSum,u="horizontal"===this._orientation;if(o=u?Math.max(0,l-this._fixed):Math.max(0,c-this._fixed),this._hasNormedSizes){for(var d=0,h=this._sizers;d<h.length;d++)h[d].sizeHint*=o;this._hasNormedSizes=!1}var p=st.calc(this._sizers,o),f=0,m=0;if(p>0)switch(this._alignment){case"start":break;case"center":f=0,m=p/2;break;case"end":f=0,m=p;break;case"justify":f=p/n,m=0;break;default:throw"unreachable"}for(i=0,r=this._items.length;i<r;++i){var g=this._items[i];if(!g.isHidden){var v=this._sizers[i].size,y=this._handles[i].style;u?(g.update(a+m,s,v+f,c),a+=v+f,y.top=s+"px",y.left=a+m+"px",y.width=this._spacing+"px",y.height=c+"px",a+=this._spacing):(g.update(a,s+m,l,v+f),s+=v+f,y.top=s+m+"px",y.left=a+"px",y.width=l+"px",y.height=this._spacing+"px",s+=this._spacing)}}}},n}(yt);!function(t){t.getStretch=function(t){return Ht.stretchProperty.get(t)},t.setStretch=function(t,e){Ht.stretchProperty.set(t,e)}}(Ft||(Ft={})),function(t){t.stretchProperty=new X({name:"stretch",create:function(){return 0},coerce:function(t,e){return Math.max(0,Math.floor(e))},changed:function(t){t.parent&&t.parent.layout instanceof Ft&&t.parent.fit()}}),t.createSizer=function(t){var e=new at;return e.sizeHint=Math.floor(t),e},t.createHandle=function(t){var e=t.createHandle();return e.style.position="absolute",e},t.clampSpacing=function(t){return Math.max(0,Math.floor(t))},t.averageSize=function(t){return t.reduce((function(t,e){return t+e.size}),0)/t.length||0},t.normalize=function(t){var e=t.length;if(0===e)return[];var n=t.reduce((function(t,e){return t+Math.abs(e)}),0);return 0===n?t.map((function(t){return 1/e})):t.map((function(t){return t/n}))}}(Ht||(Ht={}));var jt,qt=function(e){function n(t){void 0===t&&(t={});var n=e.call(this,{layout:jt.createLayout(t)})||this;return n._pressData=null,n.addClass("lm-SplitPanel"),n.addClass("p-SplitPanel"),n}return ct(n,e),n.prototype.dispose=function(){this._releaseMouse(),e.prototype.dispose.call(this)},Object.defineProperty(n.prototype,"orientation",{get:function(){return this.layout.orientation},set:function(t){this.layout.orientation=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"alignment",{get:function(){return this.layout.alignment},set:function(t){this.layout.alignment=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"spacing",{get:function(){return this.layout.spacing},set:function(t){this.layout.spacing=t},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"renderer",{get:function(){return this.layout.renderer},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"handles",{get:function(){return this.layout.handles},enumerable:!0,configurable:!0}),n.prototype.relativeSizes=function(){return this.layout.relativeSizes()},n.prototype.setRelativeSizes=function(t){this.layout.setRelativeSizes(t)},n.prototype.handleEvent=function(t){switch(t.type){case"mousedown":this._evtMouseDown(t);break;case"mousemove":this._evtMouseMove(t);break;case"mouseup":this._evtMouseUp(t);break;case"keydown":this._evtKeyDown(t);break;case"contextmenu":t.preventDefault(),t.stopPropagation()}},n.prototype.onBeforeAttach=function(t){this.node.addEventListener("mousedown",this)},n.prototype.onAfterDetach=function(t){this.node.removeEventListener("mousedown",this),this._releaseMouse()},n.prototype.onChildAdded=function(t){t.child.addClass("lm-SplitPanel-child"),t.child.addClass("p-SplitPanel-child"),this._releaseMouse()},n.prototype.onChildRemoved=function(t){t.child.removeClass("lm-SplitPanel-child"),t.child.removeClass("p-SplitPanel-child"),this._releaseMouse()},n.prototype._evtKeyDown=function(t){t.preventDefault(),t.stopPropagation(),27===t.keyCode&&this._releaseMouse()},n.prototype._evtMouseDown=function(e){if(0===e.button){var n=this.layout,i=t.findFirstIndex(n.handles,(function(t){return t.contains(e.target)}));if(-1!==i){var r;e.preventDefault(),e.stopPropagation(),document.addEventListener("mouseup",this,!0),document.addEventListener("mousemove",this,!0),document.addEventListener("keydown",this,!0),document.addEventListener("contextmenu",this,!0);var o=n.handles[i],s=o.getBoundingClientRect();r="horizontal"===n.orientation?e.clientX-s.left:e.clientY-s.top;var a=window.getComputedStyle(o),l=ot.overrideCursor(a.cursor);this._pressData={index:i,delta:r,override:l}}}},n.prototype._evtMouseMove=function(t){var e;t.preventDefault(),t.stopPropagation();var n=this.layout,i=this.node.getBoundingClientRect();e="horizontal"===n.orientation?t.clientX-i.left-this._pressData.delta:t.clientY-i.top-this._pressData.delta,n.moveHandle(this._pressData.index,e)},n.prototype._evtMouseUp=function(t){0===t.button&&(t.preventDefault(),t.stopPropagation(),this._releaseMouse())},n.prototype._releaseMouse=function(){this._pressData&&(this._pressData.override.dispose(),this._pressData=null,document.removeEventListener("mouseup",this,!0),document.removeEventListener("mousemove",this,!0),document.removeEventListener("keydown",this,!0),document.removeEventListener("contextmenu",this,!0))},n}(wt);!function(t){var e=function(){function t(){}return t.prototype.createHandle=function(){var t=document.createElement("div");return t.className="lm-SplitPanel-handle",t.classList.add("p-SplitPanel-handle"),t},t}();t.Renderer=e,t.defaultRenderer=new e,t.getStretch=function(t){return Ft.getStretch(t)},t.setStretch=function(t,e){Ft.setStretch(t,e)}}(qt||(qt={})),function(t){t.createLayout=function(t){return t.layout||new Ft({renderer:t.renderer||qt.defaultRenderer,orientation:t.orientation,alignment:t.alignment,spacing:t.spacing})}}(jt||(jt={}));var Vt,Ut,Kt=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t._dirty=!1,t._items=[],t._box=null,t}return ct(n,e),n.prototype.dispose=function(){i(this._items,(function(t){t.dispose()})),this._box=null,this._items.length=0,e.prototype.dispose.call(this)},n.prototype.attachWidget=function(e,n){t.insert(this._items,e,new gt(n)),this.parent.isAttached&&U.sendMessage(n,pt.Msg.BeforeAttach),this.parent.node.appendChild(n.node),this.parent.isAttached&&U.sendMessage(n,pt.Msg.AfterAttach),this.parent.fit()},n.prototype.moveWidget=function(e,n,i){t.move(this._items,e,n),this.parent.update()},n.prototype.detachWidget=function(e,n){var i=t.removeAt(this._items,e);this.parent.isAttached&&U.sendMessage(n,pt.Msg.BeforeDetach),this.parent.node.removeChild(n.node),this.parent.isAttached&&U.sendMessage(n,pt.Msg.AfterDetach),i.widget.node.style.zIndex="",i.dispose(),this.parent.fit()},n.prototype.onBeforeShow=function(t){e.prototype.onBeforeShow.call(this,t),this.parent.update()},n.prototype.onBeforeAttach=function(t){e.prototype.onBeforeAttach.call(this,t),this.parent.fit()},n.prototype.onChildShown=function(t){this.parent.fit()},n.prototype.onChildHidden=function(t){this.parent.fit()},n.prototype.onResize=function(t){this.parent.isVisible&&this._update(t.width,t.height)},n.prototype.onUpdateRequest=function(t){this.parent.isVisible&&this._update(-1,-1)},n.prototype.onFitRequest=function(t){this.parent.isAttached&&this._fit()},n.prototype._fit=function(){for(var t=0,e=0,n=0,i=this._items.length;n<i;++n){var r=this._items[n];r.isHidden||(r.fit(),t=Math.max(t,r.minWidth),e=Math.max(e,r.minHeight))}var o=this._box=A.boxSizing(this.parent.node);t+=o.horizontalSum,e+=o.verticalSum;var s=this.parent.node.style;s.minWidth=t+"px",s.minHeight=e+"px",this._dirty=!0,this.parent.parent&&U.sendMessage(this.parent.parent,pt.Msg.FitRequest),this._dirty&&U.sendMessage(this.parent,pt.Msg.UpdateRequest)},n.prototype._update=function(t,e){this._dirty=!1;for(var n=0,i=0,r=this._items.length;i<r;++i)n+=+!this._items[i].isHidden;if(0!==n){t<0&&(t=this.parent.node.offsetWidth),e<0&&(e=this.parent.node.offsetHeight),this._box||(this._box=A.boxSizing(this.parent.node));var o=this._box.paddingTop,s=this._box.paddingLeft,a=t-this._box.horizontalSum,l=e-this._box.verticalSum;for(i=0,r=this._items.length;i<r;++i){var c=this._items[i];c.isHidden||(c.widget.node.style.zIndex=""+i,c.update(s,o,a,l))}}},n}(yt),Gt=function(t){function e(e){void 0===e&&(e={});var n=t.call(this,{layout:Vt.createLayout(e)})||this;return n._widgetRemoved=new E(n),n.addClass("lm-StackedPanel"),n.addClass("p-StackedPanel"),n}return ct(e,t),Object.defineProperty(e.prototype,"widgetRemoved",{get:function(){return this._widgetRemoved},enumerable:!0,configurable:!0}),e.prototype.onChildAdded=function(t){t.child.addClass("lm-StackedPanel-child"),t.child.addClass("p-StackedPanel-child")},e.prototype.onChildRemoved=function(t){t.child.removeClass("lm-StackedPanel-child"),t.child.removeClass("p-StackedPanel-child"),this._widgetRemoved.emit(t.child)},e}(wt);!function(t){t.createLayout=function(t){return t.layout||new Kt}}(Vt||(Vt={})),function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;n._currentChanged=new E(n),n.addClass("lm-TabPanel"),n.addClass("p-TabPanel"),n.tabBar=new Lt(e),n.tabBar.addClass("lm-TabPanel-tabBar"),n.stackedPanel=new Gt,n.stackedPanel.addClass("lm-TabPanel-stackedPanel"),n.tabBar.addClass("p-TabPanel-tabBar"),n.stackedPanel.addClass("p-TabPanel-stackedPanel"),n.tabBar.tabMoved.connect(n._onTabMoved,n),n.tabBar.currentChanged.connect(n._onCurrentChanged,n),n.tabBar.tabCloseRequested.connect(n._onTabCloseRequested,n),n.tabBar.tabActivateRequested.connect(n._onTabActivateRequested,n),n.stackedPanel.widgetRemoved.connect(n._onWidgetRemoved,n),n._tabPlacement=e.tabPlacement||"top";var i=Ut.directionFromPlacement(n._tabPlacement),r=Ut.orientationFromPlacement(n._tabPlacement);n.tabBar.orientation=r,n.tabBar.dataset.placement=n._tabPlacement;var o=new bt({direction:i,spacing:0});return bt.setStretch(n.tabBar,0),bt.setStretch(n.stackedPanel,1),o.addWidget(n.tabBar),o.addWidget(n.stackedPanel),n.layout=o,n}ct(e,t),Object.defineProperty(e.prototype,"currentChanged",{get:function(){return this._currentChanged},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentIndex",{get:function(){return this.tabBar.currentIndex},set:function(t){this.tabBar.currentIndex=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentWidget",{get:function(){var t=this.tabBar.currentTitle;return t?t.owner:null},set:function(t){this.tabBar.currentTitle=t?t.title:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabsMovable",{get:function(){return this.tabBar.tabsMovable},set:function(t){this.tabBar.tabsMovable=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabPlacement",{get:function(){return this._tabPlacement},set:function(t){if(this._tabPlacement!==t){this._tabPlacement=t;var e=Ut.directionFromPlacement(t),n=Ut.orientationFromPlacement(t);this.tabBar.orientation=n,this.tabBar.dataset.placement=t,this.layout.direction=e}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"widgets",{get:function(){return this.stackedPanel.widgets},enumerable:!0,configurable:!0}),e.prototype.addWidget=function(t){this.insertWidget(this.widgets.length,t)},e.prototype.insertWidget=function(t,e){e!==this.currentWidget&&e.hide(),this.stackedPanel.insertWidget(t,e),this.tabBar.insertTab(t,e.title)},e.prototype._onCurrentChanged=function(t,e){var n=e.previousIndex,i=e.previousTitle,r=e.currentIndex,o=e.currentTitle,s=i?i.owner:null,a=o?o.owner:null;s&&s.hide(),a&&a.show(),this._currentChanged.emit({previousIndex:n,previousWidget:s,currentIndex:r,currentWidget:a}),(P.IS_EDGE||P.IS_IE)&&U.flush()},e.prototype._onTabActivateRequested=function(t,e){e.title.owner.activate()},e.prototype._onTabCloseRequested=function(t,e){e.title.owner.close()},e.prototype._onTabMoved=function(t,e){this.stackedPanel.insertWidget(e.toIndex,e.title.owner)},e.prototype._onWidgetRemoved=function(t,e){this.tabBar.removeTab(e.title)}}(pt),function(t){t.orientationFromPlacement=function(t){return e[t]},t.directionFromPlacement=function(t){return n[t]};var e={top:"horizontal",left:"vertical",right:"vertical",bottom:"horizontal"},n={top:"top-to-bottom",left:"left-to-right",right:"right-to-left",bottom:"bottom-to-top"}}(Ut||(Ut={})),n(549);var $t=n(28);n(822),n(489),n(162),n(992);const Yt={mode:{name:"lua",specials:["TIC","SCN","OVR","btn","btnp","clip","cls","circ","circb","exit","fget","font","fset","key","keyp","line","map","memcpy","memset","mget","mouse","mset","music","peek","peek4","pix","pmem","poke","poke4","print","rect","rectb","reset","sfx","spr","sync","time","tstamp","trace","tri","textri"],fold:!0},theme:"default",lineNumbers:!0,lineWrapping:!0,foldGutter:!0,gutters:["CodeMirror-linenumbers","CodeMirror-foldgutter"]};class Xt extends pt{static createNode(){let t=document.createElement("div"),e=document.createElement("div");return t.appendChild(e),t}constructor(t){super({node:Xt.createNode()}),this.cm=$t(this.editorDiv,Yt),this.setFlag(pt.Flag.DisallowLayout),this.addClass("content"),this.addClass(t.toLowerCase()),this.title.label=t,this.title.closable=!1,this.title.caption=`Editor: ${t}`}get editorDiv(){return this.node.getElementsByTagName("div")[0]}get inputNode(){return this.node.getElementsByTagName("input")[0]}setValue(t){this.cm.setValue(t)}getValue(){return this.cm.getValue()}onAfterShow(){this.cm.refresh()}onActivateRequest(t){}}function Jt(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{l(i.next(t))}catch(t){o(t)}}function a(t){try{l(i.throw(t))}catch(t){o(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}l((i=i.apply(t,e||[])).next())}))}function Zt(t,e){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var Qt=function(){function t(t){this.IDBTransaction=t,this.db=new ne(t.db),this.error=t.error,this.mode=t.mode,this.objectStoreNames=t.objectStoreNames}return t.prototype.is_complete=function(){var t=this;return new Promise((function(e,n){t.IDBTransaction.onerror=function(t){n(t)},t.IDBTransaction.onabort=function(t){n(t)},t.IDBTransaction.oncomplete=function(){e(!0)}}))},t.prototype.abort=function(){return this.IDBTransaction.abort()},t.prototype.objectStore=function(t){return new ee(this.IDBTransaction.objectStore(t))},t}(),te=function(){function t(t){this.IDBIndex=t,this.name=t.name,this.objectStore=new ee(t.objectStore),this.keyPath=t.keyPath,this.multiEntry=t.multiEntry,this.unique=t.unique}return t.prototype.count=function(t){var e=this,n=this.IDBIndex.count(t);return new Promise((function(t,i){n.onsuccess=function(e){t(e.target.result)},n.onerror=function(t){i(t+" - Error while counting number of record in indexed object store called - "+e.name)}}))},t.prototype.get=function(t){var e=this,n=this.IDBIndex.get(t);return new Promise((function(t,i){n.onerror=function(t){i(t+" - Error while retriving records in indexed object store called - "+e.name)},n.onsuccess=function(e){t(e.target.result)}}))},t.prototype.getKey=function(t){var e=this,n=this.IDBIndex.getKey(t);return new Promise((function(t,i){n.onerror=function(t){i(t+" - Error while getting key in indexed object store called - "+e.name)},n.onsuccess=function(e){t(e.target.result)}}))},t.prototype.getAll=function(t,e){var n=this,i=this.IDBIndex.getAll(t,e);return new Promise((function(t,e){i.onerror=function(t){e(t+" - Error while retriving all records in indexed object store called - "+n.name)},i.onsuccess=function(e){t(e.target.result)}}))},t.prototype.getAllKeys=function(t,e){var n=this,i=this.IDBIndex.getAllKeys(t,e);return new Promise((function(t,e){i.onerror=function(t){e(t+" - Error while retriving all keys in indexed object store called - "+n.name)},i.onsuccess=function(e){t(e.target.result)}}))},t.prototype.openCursor=function(t,e){var n=this,i=[],r=this.IDBIndex.openCursor(t,e);return new Promise((function(t,e){r.onerror=function(t){0===i.length?e(t+" - Error while opeing the cursor from the object store - "+n.name):i[i.length-1].cursorMoved(null,t)},r.onsuccess=function(e){var n=e.target.result;if(0===i.length)i.push(new re(n)),t(i[i.length-1]);else{var r=i[i.length-1];if(n){var o=new re(n);r.cursorMoved(o,null),i.push(o)}else r.cursorMoved(null,null)}}}))},t.prototype.openKeyCursor=function(t,e){var n=this,i=this.IDBIndex.openKeyCursor(t,e),r=[];return new Promise((function(t,e){i.onerror=function(t){0===r.length?e(t+" - Error while opeing the cursor from the object store - "+n.name):r[r.length-1].cursorMoved(null,t)},i.onsuccess=function(e){var n=e.target.result;if(0===r.length)r.push(new re(n)),t(r[r.length-1]);else{var i=r[r.length-1];if(n){var o=new re(n);i.cursorMoved(o,null),r.push(o)}else i.cursorMoved(null,null)}}}))},t}(),ee=function(){function t(t){this.IDBObjectStore=t,this.indexNames=t.indexNames,this.keyPath=t.keyPath,this.name=t.name,this.transaction=new Qt(t.transaction),this.autoIncrement=t.autoIncrement}return t.prototype.add=function(t,e,n){var i=this,r=this.IDBObjectStore.add(t,e);return n&&n(new Qt(r.transaction)),new Promise((function(t,e){r.onsuccess=function(e){t(e.target.result)},r.onerror=function(t){e(t+" - Error while adding new data to object store called - "+i.name)}}))},t.prototype.addAll=function(t){return Jt(this,void 0,void 0,(function(){var e,n,i,r;return Zt(this,(function(o){switch(o.label){case 0:if(e=[],0===t.length)return[3,4];n=0,o.label=1;case 1:return n<t.length?(i=t[n],[4,this.add(i)]):[3,4];case 2:r=o.sent(),e.push(r),o.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},t.prototype.clear=function(){var t=this,e=this.IDBObjectStore.clear();return new Promise((function(n,i){e.onerror=function(e){i(e+" - Error while clearing all the data from the object store called - "+t.name)},e.onsuccess=function(t){t.target.result?i("ERR"):n("DONE")}}))},t.prototype.count=function(t){var e=this,n=this.IDBObjectStore.count(t);return new Promise((function(t,i){n.onerror=function(t){i(t+" - Error while counting all record from the object store called - "+e.name)},n.onsuccess=function(e){t(e.target.result)}}))},t.prototype.createIndex=function(t,e,n){return new te(this.IDBObjectStore.createIndex(t,e,n))},t.prototype.delete=function(t){var e=this,n=this.IDBObjectStore.delete(t);return new Promise((function(t,i){n.onerror=function(t){i(t+" - Error while deleting the row from the object store called - "+e.name)},n.onsuccess=function(e){e.target.result||t("OK")}}))},t.prototype.deleteIndex=function(t){return this.IDBObjectStore.deleteIndex(t)},t.prototype.get=function(t){var e=this,n=this.IDBObjectStore.get(t);return new Promise((function(t,i){n.onerror=function(t){i(t+" - Error while geting the row from the object store called - "+e.name)},n.onsuccess=function(e){t(e.target.result)}}))},t.prototype.getKey=function(t){var e=this,n=this.IDBObjectStore.getKey(t);return new Promise((function(t,i){n.onerror=function(t){i(t+" - Error while geting key from the object store called - "+e.name)},n.onsuccess=function(e){t(e.target.result)}}))},t.prototype.getAll=function(t,e){var n=this,i=this.IDBObjectStore.getAll(t,e);return new Promise((function(t,e){i.onerror=function(t){e(t+" - Error while geting all keys from the object store called - "+n.name)},i.onsuccess=function(e){t(e.target.result)}}))},t.prototype.getAllKeys=function(t,e){var n=this,i=this.IDBObjectStore.getAllKeys(t,e);return new Promise((function(t,e){i.onerror=function(t){e(t+" - Error while getting all keys from the object store - "+n.name)},i.onsuccess=function(e){t(e.target.result)}}))},t.prototype.index=function(t){return new te(this.IDBObjectStore.index(t))},t.prototype.openCursor=function(t,e){var n=this,i=[],r=this.IDBObjectStore.openCursor(t,e);return new Promise((function(t,e){r.onerror=function(t){0===i.length?e(t+" - Error while opeing the cursor from the object store - "+n.name):i[i.length-1].cursorMoved(null,t)},r.onsuccess=function(e){var n=e.target.result;if(0===i.length)i.push(new re(n)),t(i[i.length-1]);else{var r=i[i.length-1];if(n){var o=new re(n);r.cursorMoved(o,null),i.push(o)}else r.cursorMoved(null,null)}}}))},t.prototype.openKeyCursor=function(t,e){var n=this,i=this.IDBObjectStore.openKeyCursor(t,e),r=[];return new Promise((function(t,e){i.onerror=function(t){0===r.length?e(t+" - Error while opeing the cursor from the object store - "+n.name):r[r.length-1].cursorMoved(null,t)},i.onsuccess=function(e){var n=e.target.result;if(0===r.length)r.push(new re(n)),t(r[r.length-1]);else{var i=r[r.length-1];if(n){var o=new re(n);i.cursorMoved(o,null),r.push(o)}else i.cursorMoved(null,null)}}}))},t.prototype.put=function(t,e){var n=this,i=this.IDBObjectStore.put(t,e);return new Promise((function(t,e){i.onerror=function(t){e(t+" - Error while putting value to the object store - "+n.name)},i.onsuccess=function(e){t(e.target.result)}}))},t}(),ne=function(){function t(t){this.IDBDatabase=t,this.name=t.name,this.version=t.version,this.objectStoreNames=t.objectStoreNames}return t.prototype.close=function(){return this.IDBDatabase.close()},t.prototype.createObjectStore=function(t,e){return new ee(this.IDBDatabase.createObjectStore(t,e))},t.prototype.deleteObjectStore=function(t){return this.IDBDatabase.deleteObjectStore(t)},t.prototype.transaction=function(t,e){return new Qt(this.IDBDatabase.transaction(t,e))},t}();function ie(t,e,n){return new Promise((function(i,r){if(window.indexedDB||(console.log("Your browser doesn't support a stable version of IndexedDB. some of the features will not be available."),0)){e&&((s=e).toString().includes(".")||isNaN(Number(s)))&&r("Invalid Version Number | Only Integer is supported");var o=window.indexedDB.open(t,e);o.onsuccess=function(t){i(new ne(t.target.result))},o.onerror=function(t){r(t+" - Error while connecting to database")},o.onupgradeneeded=function(t){n&&n(new ne(t.target.result))}}else r("Browser not supported ");var s}))}var re=function(){function t(t){this.IDBCursor=t,this.cursor_movement_promise={resolve:function(t){},reject:function(t){}},this.direction=this.IDBCursor.direction,this.key=this.IDBCursor.key,this.primaryKey=this.IDBCursor.primaryKey,this.source=this.IDBCursor.source,this.IDBCursor.value?this.value=this.IDBCursor.value:this.value=null}return t.prototype.cursorMoved=function(t,e){return Jt(this,void 0,void 0,(function(){return Zt(this,(function(n){return e?this.cursor_movement_promise.reject(e):t?this.cursor_movement_promise.resolve(t):this.cursor_movement_promise.resolve(null),[2]}))}))},t.prototype.advance=function(t){return Jt(this,void 0,void 0,(function(){var e=this;return Zt(this,(function(n){return[2,new Promise((function(n,i){e.cursor_movement_promise.reject=i,e.cursor_movement_promise.resolve=n,e.IDBCursor.advance(t)}))]}))}))},t.prototype.continue=function(t){return Jt(this,void 0,void 0,(function(){var e=this;return Zt(this,(function(n){return[2,new Promise((function(n,i){e.cursor_movement_promise.reject=i,e.cursor_movement_promise.resolve=n,e.IDBCursor.continue(t)}))]}))}))},t.prototype.continuePrimaryKey=function(t,e){return Jt(this,void 0,void 0,(function(){var n=this;return Zt(this,(function(i){return[2,new Promise((function(i,r){n.cursor_movement_promise.reject=r,n.cursor_movement_promise.resolve=i,n.IDBCursor.continuePrimaryKey(t,e)}))]}))}))},t.prototype.delete=function(){return Jt(this,void 0,void 0,(function(){var e,n=this;return Zt(this,(function(i){return e=this.IDBCursor.delete(),[2,new Promise((function(i,r){e.onsuccess=function(){i({status:"OK",IDBCursor:new t(n.IDBCursor)})},e.onerror=function(t){r("Error while deleting the row using cursor - "+t)}}))]}))}))},t.prototype.update=function(e){var n=this,i=this.IDBCursor.update(e);return new Promise((function(e,r){i.onsuccess=function(i){e({IDBValidKey:i.target.result,IDBCursor:new t(n.IDBCursor)})},i.onerror=function(t){r("Error while update the row using cursor - "+t)}}))},t}();function oe(){}function se(t){return null==t?oe:function(){return this.querySelector(t)}}function ae(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function le(){return[]}function ce(t){return function(e){return e.matches(t)}}n(678);var ue=Array.prototype.find;function de(){return this.firstElementChild}var he=Array.prototype.filter;function pe(){return this.children}function fe(t){return new Array(t.length)}function me(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ge(t){return function(){return t}}function ve(t,e,n,i,r,o){for(var s,a=0,l=e.length,c=o.length;a<c;++a)(s=e[a])?(s.__data__=o[a],i[a]=s):n[a]=new me(t,o[a]);for(;a<l;++a)(s=e[a])&&(r[a]=s)}function ye(t,e,n,i,r,o,s){var a,l,c,u=new Map,d=e.length,h=o.length,p=new Array(d);for(a=0;a<d;++a)(l=e[a])&&(p[a]=c=s.call(l,l.__data__,a,e)+"",u.has(c)?r[a]=l:u.set(c,l));for(a=0;a<h;++a)c=s.call(t,o[a],a,o)+"",(l=u.get(c))?(i[a]=l,l.__data__=o[a],u.delete(c)):n[a]=new me(t,o[a]);for(a=0;a<d;++a)(l=e[a])&&u.get(p[a])===l&&(r[a]=l)}function be(t){return t.__data__}function _e(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}me.prototype={constructor:me,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var we="http://www.w3.org/1999/xhtml";const xe={svg:"http://www.w3.org/2000/svg",xhtml:we,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ce(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),xe.hasOwnProperty(e)?{space:xe[e],local:t}:t}function Ee(t){return function(){this.removeAttribute(t)}}function De(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Me(t,e){return function(){this.setAttribute(t,e)}}function Se(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function Te(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function ke(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ae(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Pe(t){return function(){this.style.removeProperty(t)}}function Le(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Ie(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function ze(t,e){return t.style.getPropertyValue(e)||Ae(t).getComputedStyle(t,null).getPropertyValue(e)}function Be(t){return function(){delete this[t]}}function Re(t,e){return function(){this[t]=e}}function Oe(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function Ne(t){return t.trim().split(/^|\s+/)}function We(t){return t.classList||new He(t)}function He(t){this._node=t,this._names=Ne(t.getAttribute("class")||"")}function Fe(t,e){for(var n=We(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function je(t,e){for(var n=We(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function qe(t){return function(){Fe(this,t)}}function Ve(t){return function(){je(this,t)}}function Ue(t,e){return function(){(e.apply(this,arguments)?Fe:je)(this,t)}}function Ke(){this.textContent=""}function Ge(t){return function(){this.textContent=t}}function $e(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Ye(){this.innerHTML=""}function Xe(t){return function(){this.innerHTML=t}}function Je(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Ze(){this.nextSibling&&this.parentNode.appendChild(this)}function Qe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tn(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===we&&e.documentElement.namespaceURI===we?e.createElement(t):e.createElementNS(n,t)}}function en(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function nn(t){var e=Ce(t);return(e.local?en:tn)(e)}function rn(){return null}function on(){var t=this.parentNode;t&&t.removeChild(this)}function sn(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function an(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ln(t){return t.trim().split(/^|\s+/).map((function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}}))}function cn(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,o=e.length;i<o;++i)n=e[i],t.type&&n.type!==t.type||n.name!==t.name?e[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?e.length=r:delete this.__on}}}function un(t,e,n){return function(){var i,r=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(r)for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===t.type&&i.name===t.name)return this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),void(i.value=e);this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function dn(t,e,n){var i=Ae(t),r=i.CustomEvent;"function"==typeof r?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function hn(t,e){return function(){return dn(this,t,e)}}function pn(t,e){return function(){return dn(this,t,e.apply(this,arguments))}}He.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var fn=[null];function mn(t,e){this._groups=t,this._parents=e}mn.prototype=function(){return new mn([[document.documentElement]],fn)}.prototype={constructor:mn,select:function(t){"function"!=typeof t&&(t=se(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o,s,a=e[r],l=a.length,c=i[r]=new Array(l),u=0;u<l;++u)(o=a[u])&&(s=t.call(o,o.__data__,u,a))&&("__data__"in o&&(s.__data__=o.__data__),c[u]=s);return new mn(i,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);return null==e?[]:ae(e)}}(t):function(t){return null==t?le:function(){return this.querySelectorAll(t)}}(t);for(var e=this._groups,n=e.length,i=[],r=[],o=0;o<n;++o)for(var s,a=e[o],l=a.length,c=0;c<l;++c)(s=a[c])&&(i.push(t.call(s,s.__data__,c,a)),r.push(s));return new mn(i,r)},selectChild:function(t){return this.select(null==t?de:function(t){return function(){return ue.call(this.children,t)}}("function"==typeof t?t:ce(t)))},selectChildren:function(t){return this.selectAll(null==t?pe:function(t){return function(){return he.call(this.children,t)}}("function"==typeof t?t:ce(t)))},filter:function(t){"function"!=typeof t&&(t=function(t){return function(){return this.matches(t)}}(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o,s=e[r],a=s.length,l=i[r]=[],c=0;c<a;++c)(o=s[c])&&t.call(o,o.__data__,c,s)&&l.push(o);return new mn(i,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,be);var n=e?ye:ve,i=this._parents,r=this._groups;"function"!=typeof t&&(t=ge(t));for(var o=r.length,s=new Array(o),a=new Array(o),l=new Array(o),c=0;c<o;++c){var u=i[c],d=r[c],h=d.length,p=ae(t.call(u,u&&u.__data__,c,i)),f=p.length,m=a[c]=new Array(f),g=s[c]=new Array(f),v=l[c]=new Array(h);n(u,d,m,g,v,p,e);for(var y,b,_=0,w=0;_<f;++_)if(y=m[_]){for(_>=w&&(w=_+1);!(b=g[w])&&++w<f;);y._next=b||null}}return(s=new mn(s,i))._enter=a,s._exit=l,s},enter:function(){return new mn(this._enter||this._groups.map(fe),this._parents)},exit:function(){return new mn(this._exit||this._groups.map(fe),this._parents)},join:function(t,e,n){var i=this.enter(),r=this,o=this.exit();return i="function"==typeof t?t(i):i.append(t+""),null!=e&&(r=e(r)),null==n?o.remove():n(o),i&&r?i.merge(r).order():r},merge:function(t){if(!(t instanceof mn))throw new Error("invalid merge");for(var e=this._groups,n=t._groups,i=e.length,r=n.length,o=Math.min(i,r),s=new Array(i),a=0;a<o;++a)for(var l,c=e[a],u=n[a],d=c.length,h=s[a]=new Array(d),p=0;p<d;++p)(l=c[p]||u[p])&&(h[p]=l);for(;a<i;++a)s[a]=e[a];return new mn(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i,r=t[e],o=r.length-1,s=r[o];--o>=0;)(i=r[o])&&(s&&4^i.compareDocumentPosition(s)&&s.parentNode.insertBefore(i,s),s=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=_e);for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o){for(var s,a=n[o],l=a.length,c=r[o]=new Array(l),u=0;u<l;++u)(s=a[u])&&(c[u]=s);c.sort(e)}return new mn(r,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length;r<o;++r){var s=i[r];if(s)return s}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r,o=e[n],s=0,a=o.length;s<a;++s)(r=o[s])&&t.call(r,r.__data__,s,o);return this},attr:function(t,e){var n=Ce(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==e?n.local?De:Ee:"function"==typeof e?n.local?ke:Te:n.local?Se:Me)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?Pe:"function"==typeof e?Ie:Le)(t,e,null==n?"":n)):ze(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?Be:"function"==typeof e?Oe:Re)(t,e)):this.node()[t]},classed:function(t,e){var n=Ne(t+"");if(arguments.length<2){for(var i=We(this.node()),r=-1,o=n.length;++r<o;)if(!i.contains(n[r]))return!1;return!0}return this.each(("function"==typeof e?Ue:e?qe:Ve)(n,e))},text:function(t){return arguments.length?this.each(null==t?Ke:("function"==typeof t?$e:Ge)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Ye:("function"==typeof t?Je:Xe)(t)):this.node().innerHTML},raise:function(){return this.each(Ze)},lower:function(){return this.each(Qe)},append:function(t){var e="function"==typeof t?t:nn(t);return this.select((function(){return this.appendChild(e.apply(this,arguments))}))},insert:function(t,e){var n="function"==typeof t?t:nn(t),i=null==e?rn:"function"==typeof e?e:se(e);return this.select((function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)}))},remove:function(){return this.each(on)},clone:function(t){return this.select(t?an:sn)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var i,r,o=ln(t+""),s=o.length;if(!(arguments.length<2)){for(a=e?un:cn,i=0;i<s;++i)this.each(a(o[i],e,n));return this}var a=this.node().__on;if(a)for(var l,c=0,u=a.length;c<u;++c)for(i=0,l=a[c];i<s;++i)if((r=o[i]).type===l.type&&r.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?pn:hn)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i,r=t[e],o=0,s=r.length;o<s;++o)(i=r[o])&&(yield i)}};const gn="/com.nesbox.tic/TIC-80",vn="FILE_DATA";function yn(t){if(t.startsWith(gn+"/"))return t.substr((gn+"/").length)}async function bn(t,e,n){return await async function(t,e){const n=(await ie(gn)).transaction([vn],"readwrite").objectStore(vn);return await n.put(e,t)}(gn+"/"+t,{timestamp:new Date,contents:e.tobuffer(),mode:n})}var _n=n(521),wn=n(827);_n.extend(wn),console.log("dayjs",_n),window.dayjs=_n;class xn extends pt{static createNode(){let t=document.createElement("div"),e=document.createElement("div");return t.appendChild(e),t}constructor(t){super({node:xn.createNode()}),this.setFlag(pt.Flag.DisallowLayout),this.addClass(t.toLowerCase()),this.title.label=t,this.title.closable=!1,this.title.caption=`Editor: ${t}`,this.listing=function(t){return"string"==typeof t?new mn([[document.querySelector(t)]],[document.documentElement]):new mn([[t]],fn)}(this.node),this.table=this.listing.append("table"),this.thead=this.table.append("thead").append("tr"),this.tbody=this.table.append("tbody"),this.thead.selectAll("th").data(["Name","Last Modified","&nbsp;"]).enter().append("th").html((t=>t)),this.sync()}onActivateRequest(t){}async sync(){console.log("listing.sync");try{var t=(await ie(gn)).transaction([vn],"readonly").objectStore(vn),e=[];await t.openCursor().then((function t(n){if(n){var i=yn(n.key);if(i&&!i.startsWith(".")){var r=new Blob([n.value.contents]),o=URL.createObjectURL(r);e.push({key:n.key,filename:i,size:n.value.contents.length,timestamp:n.value.timestamp,objecturl:o})}return n.continue().then(t)}}));let n=this.tbody.selectAll("tr").data(e,(t=>t.key));n.exit().remove();let i=n.enter().append("tr");i.append("td").attr("class","link").append("a").attr("href","#").html((t=>t.filename)).on("click",(async(t,e)=>{t.preventDefault();var n=yn(e.key);n&&(window._tic.filename=n,window._tic.item=await async function(t){const e=(await ie(gn)).transaction([vn],"readonly").objectStore(vn);return await e.get(t)}(gn+"/"+window._tic.filename),window._tic.cart=function(t){var e,n,i,r,o,s={},a=new DataView(t),l=0;for(s.chunks=[],s.chunks_by_type={};l<a.byteLength;){e=(o=a.getUint8(l,1))>>5,n=31&o,l+=1,i=a.getUint16(l,1),l+=2,r=a.getUint8(l,1),l+=1;var c={bank:e,ctype:n,future_use:r};c.original_length=i,s.chunks.push(c),s.chunks_by_type[n]=c;var u=t.slice(l,l+i);5==n?(s.code=c,c.text=(new TextDecoder).decode(u)):c.data=u,l+=i}return s.tobuffer=function(){var t=0;s.chunks.forEach((e=>{t+=4,t+=e.text?(new TextEncoder).encode(e.text).byteLength:e.data.byteLength}));var e=new Uint8Array(t),n=0,i=new DataView(e.buffer);return s.chunks.forEach((t=>{i.setUint8(n++,t.bank<<5|t.ctype);var e=t.text?(new TextEncoder).encode(t.text):t.data;i.setUint16(n,e.byteLength,1),n+=2,i.setUint8(n++,t.future_use);for(var r=0;r<e.byteLength;r++)i.setUint8(n++,e[r])})),e},s}(window._tic.item.contents.buffer),window._tic.editor.setValue(window._tic.cart.code.text))})),i.append("td").attr("class","timestamp"),i.append("td").attr("class","download").append("a").attr("href",(t=>t.objecturl)).attr("download",(t=>t.filename)).append("i").attr("class","fa fa-download"),i.merge(n).select(".timestamp").html((t=>_n(t.timestamp).fromNow()))}catch(t){console.log(t,"any error during the process")}}}window._tic={};const Cn=new H;window.onload=function(){const t=document.getElementById("dialog"),e=document.getElementById("openfile"),n=document.getElementById("openfile_fileinput");function i(){t.style.display="none",e.style.display="none",n.value=null}document.getElementById("openfile_cancel").addEventListener("click",(t=>{i()})),Cn.addCommand("tic:open",{label:"Open...",mnemonic:1,iconClass:"fa fa-file",execute:()=>{t.style.display="flex",e.style.display="block",n.focus()}}),Cn.addCommand("tic:save",{label:"Save",mnemonic:0,iconClass:"fa fa-save",execute:async()=>{if(console.log("Save"),window._tic.filename&&window._tic.cart){let t=window._tic.cart;t.code.text=a.getValue(),await bn(window._tic.filename,t,window._tic.item.mode),s.sync()}}}),Cn.addCommand("tic:save-as",{label:"Save as...",mnemonic:0,iconClass:"fa fa-save",execute:async()=>{if(console.log("Save as..."),window._tic.cart){let t=prompt("Save as...");if(!t)return;window._tic.filename=t;let e=window._tic.cart;e.code.text=a.getValue(),await bn(t,e,window._tic.item.mode),s.sync()}}}),Cn.addKeyBinding({keys:["Accel S"],selector:"body",command:"tic:save"}),Cn.addKeyBinding({keys:["Accel O"],selector:"body",command:"tic:open"});let r=new Tt({commands:Cn});r.addItem({command:"tic:open"}),r.addItem({command:"tic:save"}),r.addItem({command:"tic:save-as"}),r.title.label="File",r.title.mnemonic=0;let o=new Wt;o.addMenu(r),o.id="menuBar",document.addEventListener("keydown",(e=>{"Escape"==e.key&&"none"!=t.style.display?i():Cn.processKeydownEvent(e)}));let s=new xn("Listing");window._tic.listing=s;let a=new Xt("Code");window._tic.editor=a;let l=new zt;l.addWidget(a,{mode:"split-right"}),l.id="dock",Ct.setStretch(l,1);let c=new qt({direction:"left-to-right",spacing:0});c.id="main",c.addWidget(s),c.addWidget(l),window.onresize=()=>{c.update()},pt.attach(o,document.body),pt.attach(c,document.body)}})()})();