iobroker.javascript 9.0.7 → 9.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -7
- package/admin/assets/OpenAiDialog-CDDsvlCe.js +36 -0
- package/admin/assets/{Save-DgI3b32B.js → Save-D3ZQadHC.js} +1 -1
- package/admin/assets/{ScriptEditor-CXV4FkqA.js → ScriptEditor-Ciz-_SvX.js} +1 -1
- package/admin/assets/{ScriptEditorVanillaMonaco-D-2WOvcn.js → ScriptEditorVanillaMonaco-Cs6PL8eZ.js} +1 -1
- package/admin/assets/createSvgIcon-BDXN8whp.js +30 -0
- package/admin/assets/hostInit-fzxL8JAx.js +1 -1
- package/admin/assets/index-BZGWELt0.js +930 -0
- package/admin/assets/index-BompUVvy.js +1 -0
- package/admin/assets/{index-Del0XJb9.js → index-BxkzUxCi.js} +1 -1
- package/admin/assets/index-DOeHpve2.js +193 -0
- package/admin/assets/{index-x0m5vR1T.js → index-DmpUKunr.js} +1 -1
- package/admin/assets/{index-C5V5CZI4.js → index-DsS-er0h.js} +1 -1
- package/admin/assets/{index-D_7ZHRw9.js → index-PhbDiVdG.js} +1 -1
- package/admin/assets/{index-DLBeMhRC.js → index-quKi7QsD.js} +80 -80
- package/admin/assets/inheritsLoose-BLb-YnoJ.js +36 -0
- package/admin/assets/{iobroker_javascript__loadShare__react__loadShare__-BiJPUKBK.js → iobroker_javascript__loadShare__react__loadShare__-B-pIv4x_.js} +1 -1
- package/admin/assets/iobroker_javascript__mf_v__runtimeInit__mf_v__-CmuPLb0X.js +5 -0
- package/admin/assets/useTheme-BbFVG4-1.js +1 -0
- package/admin/custom/assets/Components-za_0yG9W.js +1 -0
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-BHJt30My.js +1 -0
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_material__loadShare__-WrqdT1Hz.js +1 -0
- package/admin/custom/assets/{ConfigCustomJavascriptSet__loadShare__react__loadShare__-CzzIM-HW.js → ConfigCustomJavascriptSet__loadShare__react__loadShare__-B_YWmFeG.js} +1 -1
- package/admin/custom/assets/{ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__-DibxNPKw.js → ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__-DYzjQQsF.js} +1 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-Cib3-eWa.js +5 -0
- package/admin/custom/assets/DefaultPropsProvider-B41fRCEO.js +1 -0
- package/admin/custom/assets/DefaultPropsProvider-CfXkmG16.js +7 -0
- package/admin/custom/assets/FilledInput-BGGUNS4j.js +2 -0
- package/admin/custom/assets/Tabs-DjdFNknI.js +138 -0
- package/admin/custom/assets/ThemeProvider-Uan4kCQd.js +29 -0
- package/admin/custom/assets/{createSvgIcon-BQThUM-f.js → createSvgIcon-BxCMHFh5.js} +1 -1
- package/admin/custom/assets/createTheme-Ajie0adn.js +16 -0
- package/admin/custom/assets/defaultTheme-C_aSR-NR.js +1 -0
- package/admin/custom/assets/hostInit-CrAs5YZS.js +1 -1
- package/admin/custom/assets/index-7YkEnLQM.js +1 -0
- package/admin/custom/assets/index-B2rBO0oC.js +1 -0
- package/admin/custom/assets/{index-B8sZ2j0S.js → index-BkKMt4bp.js} +1 -1
- package/admin/custom/assets/{index-CoMexdpH.js → index-Bw5ZKbIF.js} +59 -59
- package/admin/custom/assets/index-ClFSKKDu.js +7 -0
- package/admin/custom/assets/index-DOnIDI_a.js +1 -0
- package/admin/custom/assets/{index-DIWNdd4a.js → index-DXg_kRe6.js} +1 -1
- package/admin/custom/assets/index-FOcWxrRT.js +904 -0
- package/admin/custom/assets/index-UhQfKbTz.js +55 -0
- package/admin/custom/assets/{index-CWXHfC2L.js → index-bxilEzdP.js} +1 -1
- package/admin/custom/assets/{index-CUcoXT75.js → index-yiPj_-Rb.js} +1 -1
- package/admin/custom/assets/{jsx-runtime-o-xyxrOj.js → jsx-runtime-lE4rOet2.js} +1 -1
- package/admin/custom/assets/useEnhancedEffect-DSK35Rma.js +8 -0
- package/admin/custom/assets/useTheme-CpiJlUE9.js +1 -0
- package/admin/custom/assets/useTheme-DWmRkwMP.js +1 -0
- package/admin/custom/assets/virtualExposes-4pgHXHfp.js +2 -0
- package/admin/custom/customComponents.js +2 -2
- package/admin/google-blockly/own/blocks_action.js +12 -2
- package/admin/google-blockly/own/blocks_convert.js +17 -3
- package/admin/google-blockly/own/blocks_logic.js +48 -15
- package/admin/google-blockly/own/blocks_object.js +20 -7
- package/admin/google-blockly/own/blocks_sendto.js +48 -11
- package/admin/google-blockly/own/blocks_switch.js +18 -8
- package/admin/google-blockly/own/blocks_system.js +33 -6
- package/admin/google-blockly/own/blocks_text.js +43 -0
- package/admin/google-blockly/own/blocks_time.js +33 -6
- package/admin/google-blockly/own/blocks_trigger.js +60 -22
- package/admin/google-blockly/own/blocks_words.js +4 -0
- package/admin/i18n/pl.json +60 -60
- package/admin/mf-manifest.json +1 -1
- package/admin/remoteEntry.js +2 -2
- package/admin/tab.html +19 -6
- package/io-package.json +14 -14
- package/package.json +2 -2
- package/admin/assets/OpenAiDialog-CVjeP8wR.js +0 -34
- package/admin/assets/createSvgIcon-Dtl7HhPO.js +0 -30
- package/admin/assets/index-BwNmFzfy.js +0 -193
- package/admin/assets/index-C8bcOa64.js +0 -930
- package/admin/assets/index-Dm1jc4t6.js +0 -1
- package/admin/assets/inheritsLoose-C9MZGDit.js +0 -36
- package/admin/assets/iobroker_javascript__mf_v__runtimeInit__mf_v__-CBQgOKij.js +0 -10
- package/admin/assets/useTheme-g_P2Itm2.js +0 -1
- package/admin/custom/assets/Components-D9kRsHNY.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-DAwHgdl6.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_material__loadShare__-BlV79j8y.js +0 -1
- package/admin/custom/assets/ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-BaLGCXMi.js +0 -10
- package/admin/custom/assets/DefaultPropsProvider-9qubdy-V.js +0 -7
- package/admin/custom/assets/DefaultPropsProvider-DbEA5uR6.js +0 -1
- package/admin/custom/assets/FilledInput-BpuM_GyB.js +0 -2
- package/admin/custom/assets/Tabs-CvEv0KOT.js +0 -138
- package/admin/custom/assets/ThemeProvider-DZTpMR8n.js +0 -29
- package/admin/custom/assets/createTheme-BwMO3rTt.js +0 -16
- package/admin/custom/assets/defaultTheme-avbtL0lf.js +0 -1
- package/admin/custom/assets/index-B6ima1M5.js +0 -904
- package/admin/custom/assets/index-B7G6Jpdl.js +0 -1
- package/admin/custom/assets/index-BzS6q3oS.js +0 -55
- package/admin/custom/assets/index-CttBOMyq.js +0 -1
- package/admin/custom/assets/index-Dbe-II7_.js +0 -7
- package/admin/custom/assets/useEnhancedEffect-CdLBzwyA.js +0 -8
- package/admin/custom/assets/useTheme-CDtRWagv.js +0 -1
- package/admin/custom/assets/useTheme-MELayQMj.js +0 -1
- package/admin/custom/assets/useThemeWithoutDefault-C-hl_s0Z.js +0 -1
- package/admin/custom/assets/virtualExposes-BMKIjWrE.js +0 -2
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-
|
|
2
|
-
import{C as qe,R as M}from"./ConfigCustomJavascriptSet__loadShare__react__loadShare__-CzzIM-HW.js";import{a as Zr,c as ke,g as Xr}from"./_commonjsHelpers-D6-XlEtG.js";import{C as N}from"./ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_material__loadShare__-BlV79j8y.js";import{C as Z,a as qr,I as es,D as _i}from"./index-B8sZ2j0S.js";import{C as j,A as ts,a as ki}from"./ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-DAwHgdl6.js";import{R as ns}from"./ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__-DibxNPKw.js";import{F as is}from"./FilledInput-BpuM_GyB.js";import{p as rs}from"./createTheme-BwMO3rTt.js";import{i as Sn}from"./ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-BaLGCXMi.js";import{p as _n}from"./useTheme-MELayQMj.js";import{_ as ss}from"./preload-helper-Dp1pzeXC.js";import"./DefaultPropsProvider-9qubdy-V.js";import"./defaultTheme-avbtL0lf.js";import"./DefaultPropsProvider-DbEA5uR6.js";import"./jsx-runtime-o-xyxrOj.js";import"./useEnhancedEffect-CdLBzwyA.js";import"./useThemeWithoutDefault-C-hl_s0Z.js";const os=Object.freeze(Object.defineProperty({__proto__:null,get ConfigGeneric(){return K},get ConfigPanel(){return ft},get JsonConfig(){return $l},get JsonConfigComponent(){return Yt}},Symbol.toStringTag,{value:"Module"}));var as=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ls=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,hs=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,un={Space_Separator:as,ID_Start:ls,ID_Continue:hs},we={isSpaceSeparator(L){return typeof L=="string"&&un.Space_Separator.test(L)},isIdStartChar(L){return typeof L=="string"&&(L>="a"&&L<="z"||L>="A"&&L<="Z"||L==="$"||L==="_"||un.ID_Start.test(L))},isIdContinueChar(L){return typeof L=="string"&&(L>="a"&&L<="z"||L>="A"&&L<="Z"||L>="0"&&L<="9"||L==="$"||L==="_"||L===""||L===""||un.ID_Continue.test(L))},isDigit(L){return typeof L=="string"&&/[0-9]/.test(L)},isHexDigit(L){return typeof L=="string"&&/[0-9A-Fa-f]/.test(L)}};let Dn,Ae,Ue,Qt,et,Be,Se,kn,Tt;var cs=function(n,i){Dn=String(n),Ae="start",Ue=[],Qt=0,et=1,Be=0,Se=void 0,kn=void 0,Tt=void 0;do Se=us(),fs[Ae]();while(Se.type!=="eof");return typeof i=="function"?xn({"":Tt},"",i):Tt};function xn(L,n,i){const l=L[n];if(l!=null&&typeof l=="object")if(Array.isArray(l))for(let v=0;v<l.length;v++){const s=String(v),c=xn(l,s,i);c===void 0?delete l[s]:Object.defineProperty(l,s,{value:c,writable:!0,enumerable:!0,configurable:!0})}else for(const v in l){const s=xn(l,v,i);s===void 0?delete l[v]:Object.defineProperty(l,v,{value:s,writable:!0,enumerable:!0,configurable:!0})}return i.call(L,n,l)}let le,oe,$t,Ve,ce;function us(){for(le="default",oe="",$t=!1,Ve=1;;){ce=Ge();const L=Mi[le]();if(L)return L}}function Ge(){if(Dn[Qt])return String.fromCodePoint(Dn.codePointAt(Qt))}function X(){const L=Ge();return L===`
|
|
3
|
-
`?(et++,Be=0):L?Be+=L.length:Be++,L&&(Qt+=L.length),L}const
|
|
4
|
-
`:case"\r":case"\u2028":case"\u2029":X();return;case"/":X(),le="comment";return;case void 0:return X(),fe("eof")}if(we.isSpaceSeparator(ce)){X();return}return
|
|
5
|
-
`:case"\r":case"\u2028":case"\u2029":X(),le="default";return;case void 0:return X(),fe("eof")}X()},value(){switch(ce){case"{":case"[":return fe("punctuator",X());case"n":return X(),at("ull"),fe("null",null);case"t":return X(),at("rue"),fe("boolean",!0);case"f":return X(),at("alse"),fe("boolean",!1);case"-":case"+":X()==="-"&&(Ve=-1),le="sign";return;case".":oe=X(),le="decimalPointLeading";return;case"0":oe=X(),le="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":oe=X(),le="decimalInteger";return;case"I":return X(),at("nfinity"),fe("numeric",1/0);case"N":return X(),at("aN"),fe("numeric",NaN);case'"':case"'":$t=X()==='"',oe="",le="string";return}throw ge(X())},identifierNameStartEscape(){if(ce!=="u")throw ge(X());X();const L=
|
|
6
|
-
`:case"\r":throw ge(X());case"\u2028":case"\u2029":
|
|
7
|
-
`;case"r":return X(),"\r";case"t":return X()," ";case"v":return X(),"\v";case"0":if(X(),we.isDigit(Ge()))throw ge(X());return"\0";case"x":return X(),
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DOnIDI_a.js","./index-B2rBO0oC.js","./_commonjsHelpers-D6-XlEtG.js","./ConfigCustomJavascriptSet__loadShare__react__loadShare__-B_YWmFeG.js","./ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-Cib3-eWa.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{C as qe,R as M}from"./ConfigCustomJavascriptSet__loadShare__react__loadShare__-B_YWmFeG.js";import{a as Qr,c as ke,g as Zr}from"./_commonjsHelpers-D6-XlEtG.js";import{C as R}from"./ConfigCustomJavascriptSet__loadShare___mf_0_mui_mf_1_material__loadShare__-WrqdT1Hz.js";import{C as Z,a as Xr,I as qr,D as Ti}from"./index-BkKMt4bp.js";import{C as j,A as es,a as _i}from"./ConfigCustomJavascriptSet__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-BHJt30My.js";import{R as ts}from"./ConfigCustomJavascriptSet__loadShare__react_mf_2_dom__loadShare__-DYzjQQsF.js";import{F as ns}from"./FilledInput-BGGUNS4j.js";import{p as is}from"./createTheme-Ajie0adn.js";import{r as rs,l as ss,i as os}from"./ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-Cib3-eWa.js";import{p as Tn}from"./index-B2rBO0oC.js";import{_ as as}from"./preload-helper-Dp1pzeXC.js";import"./DefaultPropsProvider-B41fRCEO.js";import"./defaultTheme-C_aSR-NR.js";import"./DefaultPropsProvider-CfXkmG16.js";import"./jsx-runtime-lE4rOet2.js";import"./useEnhancedEffect-DSK35Rma.js";import"./useTheme-DWmRkwMP.js";const ls=Object.freeze(Object.defineProperty({__proto__:null,get ConfigGeneric(){return K},get ConfigPanel(){return ft},get JsonConfig(){return _l},get JsonConfigComponent(){return Yt}},Symbol.toStringTag,{value:"Module"}));var hs=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,cs=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,us=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,un={Space_Separator:hs,ID_Start:cs,ID_Continue:us},we={isSpaceSeparator(L){return typeof L=="string"&&un.Space_Separator.test(L)},isIdStartChar(L){return typeof L=="string"&&(L>="a"&&L<="z"||L>="A"&&L<="Z"||L==="$"||L==="_"||un.ID_Start.test(L))},isIdContinueChar(L){return typeof L=="string"&&(L>="a"&&L<="z"||L>="A"&&L<="Z"||L>="0"&&L<="9"||L==="$"||L==="_"||L===""||L===""||un.ID_Continue.test(L))},isDigit(L){return typeof L=="string"&&/[0-9]/.test(L)},isHexDigit(L){return typeof L=="string"&&/[0-9A-Fa-f]/.test(L)}};let Sn,Ae,Ue,Qt,et,Be,Se,_n,Tt;var ps=function(n,i){Sn=String(n),Ae="start",Ue=[],Qt=0,et=1,Be=0,Se=void 0,_n=void 0,Tt=void 0;do Se=ds(),ms[Ae]();while(Se.type!=="eof");return typeof i=="function"?Dn({"":Tt},"",i):Tt};function Dn(L,n,i){const l=L[n];if(l!=null&&typeof l=="object")if(Array.isArray(l))for(let v=0;v<l.length;v++){const s=String(v),c=Dn(l,s,i);c===void 0?delete l[s]:Object.defineProperty(l,s,{value:c,writable:!0,enumerable:!0,configurable:!0})}else for(const v in l){const s=Dn(l,v,i);s===void 0?delete l[v]:Object.defineProperty(l,v,{value:s,writable:!0,enumerable:!0,configurable:!0})}return i.call(L,n,l)}let le,oe,$t,Ve,ce;function ds(){for(le="default",oe="",$t=!1,Ve=1;;){ce=Ge();const L=ki[le]();if(L)return L}}function Ge(){if(Sn[Qt])return String.fromCodePoint(Sn.codePointAt(Qt))}function X(){const L=Ge();return L===`
|
|
3
|
+
`?(et++,Be=0):L?Be+=L.length:Be++,L&&(Qt+=L.length),L}const ki={default(){switch(ce){case" ":case"\v":case"\f":case" ":case" ":case"\uFEFF":case`
|
|
4
|
+
`:case"\r":case"\u2028":case"\u2029":X();return;case"/":X(),le="comment";return;case void 0:return X(),fe("eof")}if(we.isSpaceSeparator(ce)){X();return}return ki[Ae]()},comment(){switch(ce){case"*":X(),le="multiLineComment";return;case"/":X(),le="singleLineComment";return}throw ge(X())},multiLineComment(){switch(ce){case"*":X(),le="multiLineCommentAsterisk";return;case void 0:throw ge(X())}X()},multiLineCommentAsterisk(){switch(ce){case"*":X();return;case"/":X(),le="default";return;case void 0:throw ge(X())}X(),le="multiLineComment"},singleLineComment(){switch(ce){case`
|
|
5
|
+
`:case"\r":case"\u2028":case"\u2029":X(),le="default";return;case void 0:return X(),fe("eof")}X()},value(){switch(ce){case"{":case"[":return fe("punctuator",X());case"n":return X(),at("ull"),fe("null",null);case"t":return X(),at("rue"),fe("boolean",!0);case"f":return X(),at("alse"),fe("boolean",!1);case"-":case"+":X()==="-"&&(Ve=-1),le="sign";return;case".":oe=X(),le="decimalPointLeading";return;case"0":oe=X(),le="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":oe=X(),le="decimalInteger";return;case"I":return X(),at("nfinity"),fe("numeric",1/0);case"N":return X(),at("aN"),fe("numeric",NaN);case'"':case"'":$t=X()==='"',oe="",le="string";return}throw ge(X())},identifierNameStartEscape(){if(ce!=="u")throw ge(X());X();const L=xn();switch(L){case"$":case"_":break;default:if(!we.isIdStartChar(L))throw qn();break}oe+=L,le="identifierName"},identifierName(){switch(ce){case"$":case"_":case"":case"":oe+=X();return;case"\\":X(),le="identifierNameEscape";return}if(we.isIdContinueChar(ce)){oe+=X();return}return fe("identifier",oe)},identifierNameEscape(){if(ce!=="u")throw ge(X());X();const L=xn();switch(L){case"$":case"_":case"":case"":break;default:if(!we.isIdContinueChar(L))throw qn();break}oe+=L,le="identifierName"},sign(){switch(ce){case".":oe=X(),le="decimalPointLeading";return;case"0":oe=X(),le="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":oe=X(),le="decimalInteger";return;case"I":return X(),at("nfinity"),fe("numeric",Ve*(1/0));case"N":return X(),at("aN"),fe("numeric",NaN)}throw ge(X())},zero(){switch(ce){case".":oe+=X(),le="decimalPoint";return;case"e":case"E":oe+=X(),le="decimalExponent";return;case"x":case"X":oe+=X(),le="hexadecimal";return}return fe("numeric",Ve*0)},decimalInteger(){switch(ce){case".":oe+=X(),le="decimalPoint";return;case"e":case"E":oe+=X(),le="decimalExponent";return}if(we.isDigit(ce)){oe+=X();return}return fe("numeric",Ve*Number(oe))},decimalPointLeading(){if(we.isDigit(ce)){oe+=X(),le="decimalFraction";return}throw ge(X())},decimalPoint(){switch(ce){case"e":case"E":oe+=X(),le="decimalExponent";return}if(we.isDigit(ce)){oe+=X(),le="decimalFraction";return}return fe("numeric",Ve*Number(oe))},decimalFraction(){switch(ce){case"e":case"E":oe+=X(),le="decimalExponent";return}if(we.isDigit(ce)){oe+=X();return}return fe("numeric",Ve*Number(oe))},decimalExponent(){switch(ce){case"+":case"-":oe+=X(),le="decimalExponentSign";return}if(we.isDigit(ce)){oe+=X(),le="decimalExponentInteger";return}throw ge(X())},decimalExponentSign(){if(we.isDigit(ce)){oe+=X(),le="decimalExponentInteger";return}throw ge(X())},decimalExponentInteger(){if(we.isDigit(ce)){oe+=X();return}return fe("numeric",Ve*Number(oe))},hexadecimal(){if(we.isHexDigit(ce)){oe+=X(),le="hexadecimalInteger";return}throw ge(X())},hexadecimalInteger(){if(we.isHexDigit(ce)){oe+=X();return}return fe("numeric",Ve*Number(oe))},string(){switch(ce){case"\\":X(),oe+=fs();return;case'"':if($t)return X(),fe("string",oe);oe+=X();return;case"'":if(!$t)return X(),fe("string",oe);oe+=X();return;case`
|
|
6
|
+
`:case"\r":throw ge(X());case"\u2028":case"\u2029":vs(ce);break;case void 0:throw ge(X())}oe+=X()},start(){switch(ce){case"{":case"[":return fe("punctuator",X())}le="value"},beforePropertyName(){switch(ce){case"$":case"_":oe=X(),le="identifierName";return;case"\\":X(),le="identifierNameStartEscape";return;case"}":return fe("punctuator",X());case'"':case"'":$t=X()==='"',le="string";return}if(we.isIdStartChar(ce)){oe+=X(),le="identifierName";return}throw ge(X())},afterPropertyName(){if(ce===":")return fe("punctuator",X());throw ge(X())},beforePropertyValue(){le="value"},afterPropertyValue(){switch(ce){case",":case"}":return fe("punctuator",X())}throw ge(X())},beforeArrayValue(){if(ce==="]")return fe("punctuator",X());le="value"},afterArrayValue(){switch(ce){case",":case"]":return fe("punctuator",X())}throw ge(X())},end(){throw ge(X())}};function fe(L,n){return{type:L,value:n,line:et,column:Be}}function at(L){for(const n of L){if(Ge()!==n)throw ge(X());X()}}function fs(){switch(Ge()){case"b":return X(),"\b";case"f":return X(),"\f";case"n":return X(),`
|
|
7
|
+
`;case"r":return X(),"\r";case"t":return X()," ";case"v":return X(),"\v";case"0":if(X(),we.isDigit(Ge()))throw ge(X());return"\0";case"x":return X(),gs();case"u":return X(),xn();case`
|
|
8
8
|
`:case"\u2028":case"\u2029":return X(),"";case"\r":return X(),Ge()===`
|
|
9
|
-
`&&X(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw ge(X());case void 0:throw ge(X())}return X()}function
|
|
10
|
-
`+s;E=y.join(
|
|
9
|
+
`&&X(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw ge(X());case void 0:throw ge(X())}return X()}function gs(){let L="",n=Ge();if(!we.isHexDigit(n)||(L+=X(),n=Ge(),!we.isHexDigit(n)))throw ge(X());return L+=X(),String.fromCodePoint(parseInt(L,16))}function xn(){let L="",n=4;for(;n-- >0;){const i=Ge();if(!we.isHexDigit(i))throw ge(X());L+=X()}return String.fromCodePoint(parseInt(L,16))}const ms={start(){if(Se.type==="eof")throw lt();pn()},beforePropertyName(){switch(Se.type){case"identifier":case"string":_n=Se.value,Ae="afterPropertyName";return;case"punctuator":zt();return;case"eof":throw lt()}},afterPropertyName(){if(Se.type==="eof")throw lt();Ae="beforePropertyValue"},beforePropertyValue(){if(Se.type==="eof")throw lt();pn()},beforeArrayValue(){if(Se.type==="eof")throw lt();if(Se.type==="punctuator"&&Se.value==="]"){zt();return}pn()},afterPropertyValue(){if(Se.type==="eof")throw lt();switch(Se.value){case",":Ae="beforePropertyName";return;case"}":zt()}},afterArrayValue(){if(Se.type==="eof")throw lt();switch(Se.value){case",":Ae="beforeArrayValue";return;case"]":zt()}},end(){}};function pn(){let L;switch(Se.type){case"punctuator":switch(Se.value){case"{":L={};break;case"[":L=[];break}break;case"null":case"boolean":case"numeric":case"string":L=Se.value;break}if(Tt===void 0)Tt=L;else{const n=Ue[Ue.length-1];Array.isArray(n)?n.push(L):Object.defineProperty(n,_n,{value:L,writable:!0,enumerable:!0,configurable:!0})}if(L!==null&&typeof L=="object")Ue.push(L),Array.isArray(L)?Ae="beforeArrayValue":Ae="beforePropertyName";else{const n=Ue[Ue.length-1];n==null?Ae="end":Array.isArray(n)?Ae="afterArrayValue":Ae="afterPropertyValue"}}function zt(){Ue.pop();const L=Ue[Ue.length-1];L==null?Ae="end":Array.isArray(L)?Ae="afterArrayValue":Ae="afterPropertyValue"}function ge(L){return Zt(L===void 0?`JSON5: invalid end of input at ${et}:${Be}`:`JSON5: invalid character '${Mi(L)}' at ${et}:${Be}`)}function lt(){return Zt(`JSON5: invalid end of input at ${et}:${Be}`)}function qn(){return Be-=5,Zt(`JSON5: invalid identifier character at ${et}:${Be}`)}function vs(L){console.warn(`JSON5: '${Mi(L)}' in strings is not valid ECMAScript; consider escaping`)}function Mi(L){const n={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(n[L])return n[L];if(L<" "){const i=L.charCodeAt(0).toString(16);return"\\x"+("00"+i).substring(i.length)}return L}function Zt(L){const n=new SyntaxError(L);return n.lineNumber=et,n.columnNumber=Be,n}var ys=function(n,i,l){const v=[];let s="",c,d,o="",p;if(i!=null&&typeof i=="object"&&!Array.isArray(i)&&(l=i.space,p=i.quote,i=i.replacer),typeof i=="function")d=i;else if(Array.isArray(i)){c=[];for(const u of i){let f;typeof u=="string"?f=u:(typeof u=="number"||u instanceof String||u instanceof Number)&&(f=String(u)),f!==void 0&&c.indexOf(f)<0&&c.push(f)}}return l instanceof Number?l=Number(l):l instanceof String&&(l=String(l)),typeof l=="number"?l>0&&(l=Math.min(10,Math.floor(l)),o=" ".substr(0,l)):typeof l=="string"&&(o=l.substr(0,10)),e("",{"":n});function e(u,f){let m=f[u];switch(m!=null&&(typeof m.toJSON5=="function"?m=m.toJSON5(u):typeof m.toJSON=="function"&&(m=m.toJSON(u))),d&&(m=d.call(f,u,m)),m instanceof Number?m=Number(m):m instanceof String?m=String(m):m instanceof Boolean&&(m=m.valueOf()),m){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof m=="string")return t(m);if(typeof m=="number")return String(m);if(typeof m=="object")return Array.isArray(m)?a(m):r(m)}function t(u){const f={"'":.1,'"':.2},m={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let y="";for(let E=0;E<u.length;E++){const w=u[E];switch(w){case"'":case'"':f[w]++,y+=w;continue;case"\0":if(we.isDigit(u[E+1])){y+="\\x00";continue}}if(m[w]){y+=m[w];continue}if(w<" "){let g=w.charCodeAt(0).toString(16);y+="\\x"+("00"+g).substring(g.length);continue}y+=w}const x=p||Object.keys(f).reduce((E,w)=>f[E]<f[w]?E:w);return y=y.replace(new RegExp(x,"g"),m[x]),x+y+x}function r(u){if(v.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");v.push(u);let f=s;s=s+o;let m=c||Object.keys(u),y=[];for(const E of m){const w=e(E,u);if(w!==void 0){let g=h(E)+":";o!==""&&(g+=" "),g+=w,y.push(g)}}let x;if(y.length===0)x="{}";else{let E;if(o==="")E=y.join(","),x="{"+E+"}";else{let w=`,
|
|
10
|
+
`+s;E=y.join(w),x=`{
|
|
11
11
|
`+s+E+`,
|
|
12
12
|
`+f+"}"}}return v.pop(),s=f,x}function h(u){if(u.length===0)return t(u);const f=String.fromCodePoint(u.codePointAt(0));if(!we.isIdStartChar(f))return t(u);for(let m=f.length;m<u.length;m++)if(!we.isIdContinueChar(String.fromCodePoint(u.codePointAt(m))))return t(u);return u}function a(u){if(v.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");v.push(u);let f=s;s=s+o;let m=[];for(let x=0;x<u.length;x++){const E=e(String(x),u);m.push(E!==void 0?E:"null")}let y;if(m.length===0)y="[]";else if(o==="")y="["+m.join(",")+"]";else{let x=`,
|
|
13
13
|
`+s,E=m.join(x);y=`[
|
|
14
14
|
`+s+E+`,
|
|
15
|
-
`+f+"]"}return v.pop(),s=f,y}};const vs={parse:cs,stringify:ms};var Ii=vs,Mn={exports:{}};function ys(L){throw new Error('Could not dynamically require "'+L+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Jt={exports:{}};const bs={},ws=Object.freeze(Object.defineProperty({__proto__:null,default:bs},Symbol.toStringTag,{value:"Module"})),Cs=Zr(ws);var Es=Jt.exports,ti;function Ss(){return ti||(ti=1,function(L,n){(function(i,l){L.exports=l()})(Es,function(){var i=i||function(l,v){var s;if(typeof window<"u"&&window.crypto&&(s=window.crypto),typeof self<"u"&&self.crypto&&(s=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(s=globalThis.crypto),!s&&typeof window<"u"&&window.msCrypto&&(s=window.msCrypto),!s&&typeof ke<"u"&&ke.crypto&&(s=ke.crypto),!s&&typeof ys=="function")try{s=Cs}catch{}var c=function(){if(s){if(typeof s.getRandomValues=="function")try{return s.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof s.randomBytes=="function")try{return s.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},d=Object.create||function(){function y(){}return function(x){var E;return y.prototype=x,E=new y,y.prototype=null,E}}(),o={},p=o.lib={},e=p.Base=function(){return{extend:function(y){var x=d(this);return y&&x.mixIn(y),(!x.hasOwnProperty("init")||this.init===x.init)&&(x.init=function(){x.$super.init.apply(this,arguments)}),x.init.prototype=x,x.$super=this,x},create:function(){var y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var x in y)y.hasOwnProperty(x)&&(this[x]=y[x]);y.hasOwnProperty("toString")&&(this.toString=y.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),t=p.WordArray=e.extend({init:function(y,x){y=this.words=y||[],x!=v?this.sigBytes=x:this.sigBytes=y.length*4},toString:function(y){return(y||h).stringify(this)},concat:function(y){var x=this.words,E=y.words,b=this.sigBytes,g=y.sigBytes;if(this.clamp(),b%4)for(var S=0;S<g;S++){var k=E[S>>>2]>>>24-S%4*8&255;x[b+S>>>2]|=k<<24-(b+S)%4*8}else for(var D=0;D<g;D+=4)x[b+D>>>2]=E[D>>>2];return this.sigBytes+=g,this},clamp:function(){var y=this.words,x=this.sigBytes;y[x>>>2]&=4294967295<<32-x%4*8,y.length=l.ceil(x/4)},clone:function(){var y=e.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var x=[],E=0;E<y;E+=4)x.push(c());return new t.init(x,y)}}),r=o.enc={},h=r.Hex={stringify:function(y){for(var x=y.words,E=y.sigBytes,b=[],g=0;g<E;g++){var S=x[g>>>2]>>>24-g%4*8&255;b.push((S>>>4).toString(16)),b.push((S&15).toString(16))}return b.join("")},parse:function(y){for(var x=y.length,E=[],b=0;b<x;b+=2)E[b>>>3]|=parseInt(y.substr(b,2),16)<<24-b%8*4;return new t.init(E,x/2)}},a=r.Latin1={stringify:function(y){for(var x=y.words,E=y.sigBytes,b=[],g=0;g<E;g++){var S=x[g>>>2]>>>24-g%4*8&255;b.push(String.fromCharCode(S))}return b.join("")},parse:function(y){for(var x=y.length,E=[],b=0;b<x;b++)E[b>>>2]|=(y.charCodeAt(b)&255)<<24-b%4*8;return new t.init(E,x)}},u=r.Utf8={stringify:function(y){try{return decodeURIComponent(escape(a.stringify(y)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(y){return a.parse(unescape(encodeURIComponent(y)))}},f=p.BufferedBlockAlgorithm=e.extend({reset:function(){this._data=new t.init,this._nDataBytes=0},_append:function(y){typeof y=="string"&&(y=u.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes},_process:function(y){var x,E=this._data,b=E.words,g=E.sigBytes,S=this.blockSize,k=S*4,D=g/k;y?D=l.ceil(D):D=l.max((D|0)-this._minBufferSize,0);var _=D*S,F=l.min(_*4,g);if(_){for(var A=0;A<_;A+=S)this._doProcessBlock(b,A);x=b.splice(0,_),E.sigBytes-=F}return new t.init(x,F)},clone:function(){var y=e.clone.call(this);return y._data=this._data.clone(),y},_minBufferSize:0});p.Hasher=f.extend({cfg:e.extend(),init:function(y){this.cfg=this.cfg.extend(y),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(y){return this._append(y),this._process(),this},finalize:function(y){y&&this._append(y);var x=this._doFinalize();return x},blockSize:16,_createHelper:function(y){return function(x,E){return new y.init(E).finalize(x)}},_createHmacHelper:function(y){return function(x,E){return new m.HMAC.init(y,E).finalize(x)}}});var m=o.algo={};return o}(Math);return i})}(Jt)),Jt.exports}var Ds=Mn.exports;(function(L,n){(function(i,l){L.exports=l(Ss())})(Ds,function(i){return function(l){var v=i,s=v.lib,c=s.WordArray,d=s.Hasher,o=v.algo,p=[];(function(){for(var u=0;u<64;u++)p[u]=l.abs(l.sin(u+1))*4294967296|0})();var e=o.MD5=d.extend({_doReset:function(){this._hash=new c.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(u,f){for(var m=0;m<16;m++){var y=f+m,x=u[y];u[y]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360}var E=this._hash.words,b=u[f+0],g=u[f+1],S=u[f+2],k=u[f+3],D=u[f+4],_=u[f+5],F=u[f+6],A=u[f+7],$=u[f+8],w=u[f+9],C=u[f+10],T=u[f+11],I=u[f+12],O=u[f+13],R=u[f+14],P=u[f+15],B=E[0],V=E[1],W=E[2],z=E[3];B=t(B,V,W,z,b,7,p[0]),z=t(z,B,V,W,g,12,p[1]),W=t(W,z,B,V,S,17,p[2]),V=t(V,W,z,B,k,22,p[3]),B=t(B,V,W,z,D,7,p[4]),z=t(z,B,V,W,_,12,p[5]),W=t(W,z,B,V,F,17,p[6]),V=t(V,W,z,B,A,22,p[7]),B=t(B,V,W,z,$,7,p[8]),z=t(z,B,V,W,w,12,p[9]),W=t(W,z,B,V,C,17,p[10]),V=t(V,W,z,B,T,22,p[11]),B=t(B,V,W,z,I,7,p[12]),z=t(z,B,V,W,O,12,p[13]),W=t(W,z,B,V,R,17,p[14]),V=t(V,W,z,B,P,22,p[15]),B=r(B,V,W,z,g,5,p[16]),z=r(z,B,V,W,F,9,p[17]),W=r(W,z,B,V,T,14,p[18]),V=r(V,W,z,B,b,20,p[19]),B=r(B,V,W,z,_,5,p[20]),z=r(z,B,V,W,C,9,p[21]),W=r(W,z,B,V,P,14,p[22]),V=r(V,W,z,B,D,20,p[23]),B=r(B,V,W,z,w,5,p[24]),z=r(z,B,V,W,R,9,p[25]),W=r(W,z,B,V,k,14,p[26]),V=r(V,W,z,B,$,20,p[27]),B=r(B,V,W,z,O,5,p[28]),z=r(z,B,V,W,S,9,p[29]),W=r(W,z,B,V,A,14,p[30]),V=r(V,W,z,B,I,20,p[31]),B=h(B,V,W,z,_,4,p[32]),z=h(z,B,V,W,$,11,p[33]),W=h(W,z,B,V,T,16,p[34]),V=h(V,W,z,B,R,23,p[35]),B=h(B,V,W,z,g,4,p[36]),z=h(z,B,V,W,D,11,p[37]),W=h(W,z,B,V,A,16,p[38]),V=h(V,W,z,B,C,23,p[39]),B=h(B,V,W,z,O,4,p[40]),z=h(z,B,V,W,b,11,p[41]),W=h(W,z,B,V,k,16,p[42]),V=h(V,W,z,B,F,23,p[43]),B=h(B,V,W,z,w,4,p[44]),z=h(z,B,V,W,I,11,p[45]),W=h(W,z,B,V,P,16,p[46]),V=h(V,W,z,B,S,23,p[47]),B=a(B,V,W,z,b,6,p[48]),z=a(z,B,V,W,A,10,p[49]),W=a(W,z,B,V,R,15,p[50]),V=a(V,W,z,B,_,21,p[51]),B=a(B,V,W,z,I,6,p[52]),z=a(z,B,V,W,k,10,p[53]),W=a(W,z,B,V,C,15,p[54]),V=a(V,W,z,B,g,21,p[55]),B=a(B,V,W,z,$,6,p[56]),z=a(z,B,V,W,P,10,p[57]),W=a(W,z,B,V,F,15,p[58]),V=a(V,W,z,B,O,21,p[59]),B=a(B,V,W,z,D,6,p[60]),z=a(z,B,V,W,T,10,p[61]),W=a(W,z,B,V,S,15,p[62]),V=a(V,W,z,B,w,21,p[63]),E[0]=E[0]+B|0,E[1]=E[1]+V|0,E[2]=E[2]+W|0,E[3]=E[3]+z|0},_doFinalize:function(){var u=this._data,f=u.words,m=this._nDataBytes*8,y=u.sigBytes*8;f[y>>>5]|=128<<24-y%32;var x=l.floor(m/4294967296),E=m;f[(y+64>>>9<<4)+15]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,f[(y+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,u.sigBytes=(f.length+1)*4,this._process();for(var b=this._hash,g=b.words,S=0;S<4;S++){var k=g[S];g[S]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360}return b},clone:function(){var u=d.clone.call(this);return u._hash=this._hash.clone(),u}});function t(u,f,m,y,x,E,b){var g=u+(f&m|~f&y)+x+b;return(g<<E|g>>>32-E)+f}function r(u,f,m,y,x,E,b){var g=u+(f&y|m&~y)+x+b;return(g<<E|g>>>32-E)+f}function h(u,f,m,y,x,E,b){var g=u+(f^m^y)+x+b;return(g<<E|g>>>32-E)+f}function a(u,f,m,y,x,E,b){var g=u+(m^(f|~y))+x+b;return(g<<E|g>>>32-E)+f}v.MD5=d._createHelper(e),v.HmacMD5=d._createHmacHelper(e)}(Math),i.MD5})})(Mn);var xs=Mn.exports;const ni=Xr(xs),As=window.innerWidth<=600?12:void 0;function dn(L){return Object.prototype.toString.call(L)==="[object Object]"}class K extends qe.Component{static DIFFERENT_VALUE="__different__";static DIFFERENT_LABEL="ra___different__";static NONE_VALUE="";static NONE_LABEL="ra_none";defaultValue;isError;lang;defaultSendToDone;sendToTimeout;noPlaceRequired;constructor(n){super(n),this.state={confirmDialog:!1,confirmNewValue:null,confirmAttr:null,confirmData:null,confirmCallback:null},this.isError={},n.schema&&(n.custom?this.defaultValue=n.schema.defaultFunc?this.executeCustom(n.schema.defaultFunc,n.data,n.customObj,n.oContext.instanceObj,n.arrayIndex,n.globalData):n.schema.default:n.schema.type!=="state"&&(this.defaultValue=n.schema.defaultFunc?this.execute(n.schema.defaultFunc,n.schema.default,n.data,n.arrayIndex,n.globalData):n.schema.default)),this.lang=j.I18n.getLanguage()}componentDidMount(){this.props.oContext.registerOnForceUpdate&&this.props.oContext.registerOnForceUpdate(this.props.attr,this.onUpdate);const n=["select","autocomplete","autocompleteSendTo"];if(this.defaultValue!==void 0){const i=K.getValue(this.props.data,this.props.attr);(i===void 0||n.includes(this.props.schema.type)&&(i===""||i===null))&&setTimeout(()=>{this.props.custom?this.props.onChange(this.props.attr,this.defaultValue,()=>setTimeout(()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data),100)):(K.setValue(this.props.data,this.props.attr,this.defaultValue),this.props.onChange(this.props.data,void 0,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data)))},100)}else this.props.schema.defaultSendTo&&this.sendTo()}sendTo(){if(this.props.alive){this.defaultSendToDone=!0;let n=this.props.schema.data;if(n===void 0&&this.props.schema.jsonData){const i=this.getPattern(this.props.schema.jsonData,null,!0);try{n=JSON.parse(i)}catch{console.error(`Cannot parse json data: ${i}`)}}else n={attr:this.props.attr,value:K.getValue(this.props.data,this.props.attr)};n===void 0&&(n=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.defaultSendTo,n).then(i=>{i!=null&&(this.props.custom?this.props.onChange(this.props.attr,i,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data)):(K.setValue(this.props.data,this.props.attr,i),this.props.onChange(this.props.data,void 0,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data))))})}else this.defaultSendToDone=!1,this.props.schema.allowSaveWithError||this.onError(this.props.attr,j.I18n.t("ra_Instance %s is not alive",this.props.oContext.instance.toString()))}componentWillUnmount(){this.props.oContext.registerOnForceUpdate&&this.props.oContext.registerOnForceUpdate(this.props.attr),this.sendToTimeout&&(clearTimeout(this.sendToTimeout),this.sendToTimeout=null)}onUpdate=n=>{const i=K.getValue(n||this.props.data,this.props.attr)||"";this.state.value!==i?this.setState({value:i}):this.forceUpdate()};static getValue(n,i){if(typeof i=="string")return K.getValue(n,i.split("."));if(i.length===1)return n[i[0]];const l=i.shift();if(typeof l=="string"&&typeof n[l]=="object")return K.getValue(n[l],i)}static setValue(n,i,l){if(typeof i=="string"){K.setValue(n,i.split("."),l);return}if(i.length===1)l===null?delete n[i[0]]:n[i[0]]=l;else{const v=i.shift();if(typeof v!="string")return;(!n[v]||typeof n[v]=="object")&&(n[v]=n[v]||{}),K.setValue(n[v],i,l)}}getText(n,i){if(!n)return"";if(typeof n=="string"){const l=i?n:j.I18n.t(n);return l.includes("${")?this.getPattern(l,null,i):l}return dn(n)?n.func?typeof n.func=="object"?this.getPattern(n.func[this.lang]||n.func.en||"",null,!0):this.getPattern(n.func,null,i):n[this.lang]||n.en||"":n.toString()}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const n=this.state.confirmData||this.props.schema.confirm;let i=null;return n.type==="warning"?i=M.createElement(Z.Warning,null):n.type==="error"?i=M.createElement(Z.Error,null):n.type==="info"&&(i=M.createElement(Z.Info,null)),M.createElement(j.DialogConfirm,{title:this.getText(n.title)||j.I18n.t("ra_Please confirm"),text:this.getText(n.text),ok:this.getText(n.ok)||j.I18n.t("ra_Ok"),cancel:this.getText(n.cancel)||j.I18n.t("ra_Cancel"),icon:i||void 0,onClose:l=>this.setState({confirmDialog:!1},()=>{if(l){if(this.state.confirmCallback){const s=this.state.confirmCallback;this.setState({confirmCallback:null},()=>s(!0));return}const v=JSON.parse(JSON.stringify(this.props.data));this.state.confirmDepAttr&&K.setValue(v,this.state.confirmDepAttr,this.state.confirmDepNewValue),K.setValue(v,this.state.confirmAttr,this.state.confirmNewValue),this.setState({confirmDialog:!1,confirmDepAttr:null,confirmDepNewValue:null,confirmNewValue:null,confirmAttr:null,confirmData:null},()=>this.props.onChange(v))}else{const v=this.state.confirmCallback;this.setState({confirmDialog:!1,confirmDepAttr:null,confirmDepNewValue:null,confirmNewValue:null,confirmAttr:null,confirmData:null,confirmCallback:null},()=>{v&&v(!1)})}})})}getIcon(n){n=n||this.props.schema.icon;let i=null;return n==="auth"?i=M.createElement(Z.Key,null):n==="send"?i=M.createElement(Z.Send,null):n==="web"?i=M.createElement(Z.Public,null):n==="warning"?i=M.createElement(Z.Warning,null):n==="error"?i=M.createElement(Z.Error,null):n==="info"?i=M.createElement(Z.Info,null):n==="search"?i=M.createElement(Z.Search,null):n==="book"?i=M.createElement(Z.MenuBook,null):n==="help"?i=M.createElement(Z.Help,null):n==="upload"?i=M.createElement(Z.UploadFile,null):n==="edit"?i=M.createElement(Z.Edit,null):n==="user"?i=M.createElement(Z.Person,null):n==="group"?i=M.createElement(Z.Group,null):n==="delete"?i=M.createElement(Z.Delete,null):n==="refresh"?i=M.createElement(Z.Refresh,null):n==="add"?i=M.createElement(Z.Add,null):n==="unpair"?i=M.createElement(Z.LinkOff,null):n==="pair"?i=M.createElement(Z.Link,null):n==="save"?i=M.createElement(Z.Save,null):n==="open"?i=M.createElement(Z.OpenInNew,null):n&&((n.endsWith(".png")||n.endsWith(".svg")||n.endsWith(".jpg"))&&!n.startsWith("http://")&&!n.startsWith("https://")&&(n=`./adapter/${this.props.oContext.adapterName}/${n}`),i=M.createElement(j.Icon,{src:n,style:{width:22,height:22}})),i}onChangeAsync(n,i){return new Promise(l=>{const v=this.onChange(n,i,l);v instanceof Promise&&v.catch(s=>console.error(`Cannot set value: ${s}`))})}onChange(n,i,l){const v=JSON.parse(JSON.stringify(this.props.data));if(K.setValue(v,n,i),this.props.schema.confirm&&this.execute(this.props.schema.confirm.condition,!1,v,this.props.arrayIndex,this.props.globalData))return new Promise(c=>{this.setState({confirmDialog:!0,confirmNewValue:i,confirmAttr:n,confirmData:null},()=>{typeof l=="function"?l():c()})});if(this.props.schema.confirmDependsOn)for(let c=0;c<this.props.schema.confirmDependsOn.length;c++){const d=this.props.schema.confirmDependsOn[c];if(d.confirm){const o=K.getValue(v,d.attr);if(this.execute(d.confirm.condition,!1,v,this.props.arrayIndex,this.props.globalData))return new Promise(p=>{this.setState({confirmDialog:!0,confirmNewValue:i,confirmAttr:n,confirmDepNewValue:o,confirmDepAttr:d.attr,confirmData:d.confirm},()=>{typeof l=="function"?l():p()})})}}const s=[];if(this.props.schema.onChangeDependsOn)for(let c=0;c<this.props.schema.onChangeDependsOn.length;c++){const d=this.props.schema.onChangeDependsOn[c];if(d.onChange){const o=K.getValue(v,d.attr);let p;this.props.custom?p=this.executeCustom(d.onChange.calculateFunc,v,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):p=this.execute(d.onChange.calculateFunc,o,v,this.props.arrayIndex,this.props.globalData),p!==o&&(K.setValue(v,d.attr,p),s.push(d.attr))}}if(this.props.schema.hiddenDependsOn)for(let c=0;c<this.props.schema.hiddenDependsOn.length;c++){const d=this.props.schema.hiddenDependsOn[c];d.hidden&&s.push(d.attr)}if(this.props.schema.labelDependsOn)for(let c=0;c<this.props.schema.labelDependsOn.length;c++){const d=this.props.schema.labelDependsOn[c];d.hidden&&s.push(d.attr)}if(this.props.schema.helpDependsOn)for(let c=0;c<this.props.schema.helpDependsOn.length;c++){const d=this.props.schema.helpDependsOn[c];d.hidden&&s.push(d.attr)}if(this.props.schema.onChange&&!this.props.schema.onChange.ignoreOwnChanges){const c=K.getValue(v,this.props.attr),d=this.props.custom?this.executeCustom(this.props.schema.onChange.calculateFunc,v,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):this.execute(this.props.schema.onChange.calculateFunc,c,v,this.props.arrayIndex,this.props.globalData);d!==c&&K.setValue(v,this.props.attr,d)}return this.props.custom?(this.props.onChange(n,i,()=>l&&l()),s!=null&&s.length&&s.forEach((c,d)=>setTimeout(()=>this.props.onChange(c,K.getValue(v,c)),d*50))):this.props.onChange(v,void 0,()=>{s.length&&this.props.oContext.forceUpdate(s,v),l&&l()}),Promise.resolve()}execute(n,i,l,v,s){let c;if(dn(n))c=n.func;else if(typeof n=="string")c=n;else return n;if(!c)return i;try{return new Function("data","originalData","_system","_alive","_common","_socket","_instance","arrayIndex","globalData","_changed",c.includes("return")?c:`return ${c}`)(l||this.props.data,this.props.originalData,this.props.oContext.systemConfig,this.props.alive,this.props.common,this.props.oContext.socket,this.props.oContext.instance,v,s,this.props.changed)}catch(d){return console.error(`Cannot execute ${JSON.stringify(n)}: ${d}`),i}}executeCustom(n,i,l,v,s,c){let d;if(dn(n))d=n.func;else if(typeof n=="string")d=n;else return n;if(!d)return null;try{return new Function("data","originalData","_system","instanceObj","customObj","_socket","arrayIndex","globalData","_changed",d.includes("return")?d:`return ${d}`)(i||this.props.data,this.props.originalData,this.props.oContext.systemConfig,v,l,this.props.oContext.socket,s,c,this.props.changed)}catch(o){return console.error(`Cannot execute ${d}: ${o}`),null}}calculate(n){let i,l,v,s;return this.props.custom?(i=n.validator?!this.executeCustom(n.validator,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,n.disabled===!0?l=!0:l=n.disabled?this.executeCustom(n.disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,n.hidden===!0?v=!0:v=n.hidden?this.executeCustom(n.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,s=n.defaultFunc?this.executeCustom(n.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):n.default):(i=n.validator?!this.execute(n.validator,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,n.disabled===!0?l=!0:l=n.disabled?this.execute(n.disabled,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,n.hidden===!0?v=!0:v=n.hidden?this.execute(n.hidden,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,s=n.defaultFunc?this.execute(n.defaultFunc,n.default,this.props.data,this.props.arrayIndex,this.props.globalData):n.default),{error:i,disabled:l,hidden:v,defaultValue:s}}onError(n,i){i?this.isError[n]=i:delete this.isError[n],this.props.onError&&this.props.onError(n,i)}renderItem(n,i,l){return this.getText(this.props.schema.label)||this.getText(this.props.schema.text)}renderHelp(n,i,l){return i?M.createElement("a",{href:i,target:"_blank",rel:"noreferrer",style:{color:this.props.oContext.themeType==="dark"?"#a147ff":"#5b238f",textDecoration:"underline"}},this.getText(n,l)):(n=this.getText(n,l)||"",n&&(n.includes("<a ")||n.includes("<br")||n.includes("<b>")||n.includes("<i>"))?j.Utils.renderTextWithA(n):n)}static escapeString(n,i){return typeof n!="string"?"":(n=n.replace(/`/g,"\\`"),n=n.replace(/\${([^}]+)}/g,(l,v)=>{if(v&&typeof v=="string"&&v.startsWith("data.")){const s=K.getValue(i,v.replace(/^data\./,""));if(typeof s=="string"&&s.includes('"'))return`\${${v}.replace(/"/g, '\\\\"')}`}return l}),n)}getPattern(n,i,l){if(i=i||this.props.data,!n)return"";let v;typeof n=="object"?n.func?v=n.func:(console.log(`Object must be stringified: ${JSON.stringify(n)}`),v=JSON.stringify(n)):v=n;try{if(this.props.custom)return new Function("data","originalData","arrayIndex","globalData","_system","instanceObj","customObj","_socket","_changed",`return \`${K.escapeString(v,i)}\``)(i,this.props.originalData,this.props.arrayIndex,this.props.globalData,this.props.oContext.systemConfig,this.props.oContext.instanceObj,this.props.customObj,this.props.oContext.socket,this.props.changed);const c=new Function("data","originalData","arrayIndex","globalData","_system","_alive","_common","_socket","_changed",`return \`${K.escapeString(v,i)}\``)(i,this.props.originalData,this.props.arrayIndex,this.props.globalData,this.props.oContext.systemConfig,this.props.alive,this.props.common,this.props.oContext.socket,this.props.changed);return l?c:j.I18n.t(c)}catch(s){return console.error(`Cannot execute ${v}: ${s}`),v}}render(){const n=this.props.schema;if(!n||this.props.expertMode===!1&&n.expertMode)return null;this.props.alive&&this.defaultSendToDone===!1&&(this.sendToTimeout=setTimeout(()=>{this.sendToTimeout=null,this.sendTo()},200));const{error:i,disabled:l,hidden:v,defaultValue:s}=this.calculate(n);if(v){if(Object.keys(this.isError).length&&(setTimeout(o=>Object.keys(o).forEach(p=>this.props.onError(p)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}),n.hideOnlyControl){const o=M.createElement(N.Grid2,{size:{xs:n.xs||As,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0},style:{marginBottom:0,textAlign:"left",...n.style,...this.props.oContext.themeType==="dark"?n.darkStyle:{}}});return n.newLine?M.createElement(M.Fragment,null,M.createElement("div",{style:{flexBasis:"100%",height:0}}),o):o}return null}n.validatorNoSaveOnError&&(i&&!Object.keys(this.isError).length?(this.isError={[this.props.attr]:n.validatorErrorText?j.I18n.t(n.validatorErrorText):!0},setTimeout(o=>Object.keys(o).forEach(p=>this.props.onError(p,o[p])),100,JSON.parse(JSON.stringify(this.isError)))):!i&&Object.keys(this.isError).length&&(setTimeout(o=>Object.keys(o).forEach(p=>this.props.onError(p)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}));const c=this.renderItem(i,l||this.props.commandRunning||this.props.disabled,s);if(this.noPlaceRequired)return c;const d=M.createElement(N.Grid2,{title:this.getText(n.tooltip),size:{xs:n.xs||12,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0},style:{marginBottom:0,textAlign:"left",width:n.type==="divider"||n.type==="header"?n.width||"100%":void 0,...n.style,...this.props.oContext.themeType==="dark"?n.darkStyle:{}}},this.props.schema.defaultSendTo&&this.props.schema.button?M.createElement(N.Grid2,{container:!0,style:{width:"100%"}},M.createElement(N.Grid2,{flex:1},c),M.createElement(N.Grid2,null,M.createElement(N.Button,{disabled:l,variant:"outlined",onClick:()=>this.sendTo(),title:this.props.schema.buttonTooltip?this.getText(this.props.schema.buttonTooltip,this.props.schema.buttonTooltipNoTranslation):j.I18n.t("ra_Request data by instance")},this.getText(this.props.schema.button)))):c);return n.newLine?M.createElement(M.Fragment,null,M.createElement("div",{style:{flexBasis:"100%",height:0}}),this.renderDialogConfirm(),d):this.state.confirmDialog?M.createElement(M.Fragment,null,this.renderDialogConfirm(),d):d}}const Oe={fullWidth:{width:"100%"},accordionSummary:L=>({backgroundColor:L.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)"}),accordionTitle:{},toolbar:L=>({backgroundColor:L.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)",borderRadius:"3px"}),tooltip:{pointerEvents:"none"}};class $s extends K{typingTimer=null;constructor(n){super(n),this.props.schema.items=this.props.schema.items||[]}componentDidMount(){super.componentDidMount();let n=K.getValue(this.props.data,this.props.attr)||[];Array.isArray(n)||(n=[]),this.setState({value:n,activeIndex:-1,iteration:0})}componentWillUnmount(){this.typingTimer&&(clearTimeout(this.typingTimer),this.typingTimer=null),super.componentWillUnmount()}itemAccordion(n,i){const{value:l}=this.state,{schema:v}=this.props,s={type:"panel",items:v.items.reduce((c,d)=>(c[d.attr]=d,c),{}),style:{marginLeft:"-8px",marginTop:"10px",marginBottom:"10px"}};return M.createElement(ft,{oContext:this.props.oContext,index:i+this.state.iteration,arrayIndex:i,changed:this.props.changed,expertMode:this.props.expertMode,globalData:this.props.data,common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:n,custom:!0,schema:s,originalData:this.props.originalData,onChange:(c,d)=>{const o=JSON.parse(JSON.stringify(l));o[i][c]=d,this.setState({value:o},()=>this.onChangeWrapper(o))},onError:(c,d)=>this.onError(c,d),table:this.props.table})}onDelete=n=>()=>{const i=JSON.parse(JSON.stringify(this.state.value));i.splice(n,1),this.setState({value:i,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(i))};onClone=n=>()=>{const i=JSON.parse(JSON.stringify(this.state.value)),l=JSON.parse(JSON.stringify(i[n]));if(typeof this.props.schema.clone=="string"&&typeof l[this.props.schema.clone]=="string"){let v=1,s=l[this.props.schema.clone];const c=s.match(/(\d+)$/);for(c?(s=s.replace(c[0],""),v=parseInt(c[0],10)+1):s+="_";i.find(d=>d[this.props.schema.clone]===s+v.toString());)v++;l[this.props.schema.clone]=`${l[this.props.schema.clone]}_${v}`}i.splice(n,0,l),this.setState({value:i,activeIndex:-1,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(i))};onChangeWrapper=n=>{this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout(i=>{this.typingTimer=null;const l=this.onChange(this.props.attr,i);l instanceof Promise&&l.catch(v=>this.onError(v))},300,n)};onAdd=()=>{const{schema:n}=this.props,i=JSON.parse(JSON.stringify(this.state.value)),l=n.items&&n.items.reduce((v,s)=>{let c;return s.defaultFunc?this.props.custom?c=s.defaultFunc?this.executeCustom(s.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,i.length,this.props.data):this.props.schema.default:c=s.defaultFunc?this.execute(s.defaultFunc,this.props.schema.default,this.props.data,i.length,this.props.data):this.props.schema.default:c=s.default===void 0?null:s.default,v[s.attr]=c,v},{});i.push(l),this.setState({value:i,activeIndex:i.length-1},()=>this.onChangeWrapper(i))};onMoveUp(n){const i=JSON.parse(JSON.stringify(this.state.value)),l=i[n];i.splice(n,1),i.splice(n-1,0,l);const v=this.state.activeIndex-1;this.setState({value:i,activeIndex:v,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(i))}onMoveDown(n){const i=JSON.parse(JSON.stringify(this.state.value)),l=i[n];i.splice(n,1),i.splice(n+1,0,l);const v=this.state.activeIndex+1;this.setState({value:i,activeIndex:v,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(i))}renderItem(){const{schema:n}=this.props,{value:i}=this.state;return i?M.createElement(N.Paper,null,n.label||!n.noDelete?M.createElement(N.Toolbar,{variant:"dense"},n.label?M.createElement(N.Typography,{variant:"h6",id:"tableTitle",component:"div"},this.getText(n.label)):null,n.noDelete?null:M.createElement(N.IconButton,{size:"small",color:"primary",onClick:this.onAdd},M.createElement(Z.Add,null))):null,i.map((l,v)=>M.createElement(N.Accordion,{key:`${l}_${v}`,expanded:this.state.activeIndex===v,onChange:(s,c)=>this.setState({activeIndex:c?v:-1})},M.createElement(N.AccordionSummary,{expandIcon:M.createElement(Z.ExpandMore,null),sx:j.Utils.getStyle(this.props.oContext.theme,Oe.fullWidth,Oe.accordionSummary)},M.createElement(N.Typography,{style:Oe.accordionTitle},l[n.titleAttr])),M.createElement(N.AccordionDetails,{style:{...n.style,...this.props.oContext.themeType?n.darkStyle:void 0}},this.itemAccordion(i[v],v),M.createElement(N.Toolbar,{sx:Oe.toolbar},v?M.createElement(N.Tooltip,{title:j.I18n.t("ra_Move up"),slotProps:{popper:{sx:Oe.tooltip}}},M.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveUp(v)},M.createElement(Z.ArrowUpward,null))):M.createElement("div",{style:Oe.buttonEmpty}),v<i.length-1?M.createElement(N.Tooltip,{title:j.I18n.t("ra_Move down"),slotProps:{popper:{sx:Oe.tooltip}}},M.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveDown(v)},M.createElement(Z.ArrowDownward,null))):M.createElement("div",{style:Oe.buttonEmpty}),n.noDelete?null:M.createElement(N.Tooltip,{title:j.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:Oe.tooltip}}},M.createElement(N.IconButton,{size:"small",onClick:this.onDelete(v)},M.createElement(Z.Delete,null))),n.clone?M.createElement(N.Tooltip,{title:j.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:Oe.tooltip}}},M.createElement(N.IconButton,{size:"small",onClick:this.onClone(v)},M.createElement(Z.ContentCopy,null))):null)))),!n.noDelete&&i.length>0?M.createElement(N.Toolbar,{variant:"dense",sx:Oe.rootTool},M.createElement(N.IconButton,{size:"small",color:"primary",onClick:this.onAdd},M.createElement(Z.Add,null))):null,n.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null):null}}const ii={root:{width:"100%"},notAlive:{color:"#a30000"}};class Ts extends K{componentDidMount(){super.componentDidMount();const n=this.getInstance();this.props.oContext.socket.getState(`${n}.alive`).then(i=>this.setState({alive:!!(i&&i.val),instance:n}))}getInstance(){let n=this.props.schema.instance||`${this.props.oContext.adapterName}.${this.props.oContext.instance}`;return n.includes("${")&&(n=this.getPattern(n,null,!0)),n&&!n.startsWith("system.adapter.")&&(n=`system.adapter.${n}`),n}renderItem(){if(this.getInstance()!==this.state.instance&&setTimeout(()=>{const i=this.getInstance();i?this.props.oContext.socket.getState(`${i}.alive`).then(l=>this.setState({alive:!!(l&&l.val),instance:i})):this.setState({alive:null,instance:i})},200),this.state.alive!==!1&&this.state.alive!==!0)return null;const n=this.state.instance.replace(/^system.adapter./,"");return M.createElement("div",{style:{...ii.root,...this.state.alive?void 0:ii.notAlive}},this.state.alive?this.props.schema.textAlive!==void 0?this.props.schema.textAlive?j.I18n.t(this.props.schema.textAlive,n):"":j.I18n.t("ra_Instance %s is alive",n):this.props.schema.textNotAlive!==void 0?this.props.schema.textNotAlive?j.I18n.t(this.props.schema.textNotAlive,n):"":j.I18n.t("ra_Instance %s is not alive",n))}}class _s extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr),i=this.props.schema.options.map(l=>typeof l=="string"?{label:l,value:l}:JSON.parse(JSON.stringify(l)));Array.isArray(n)?(i.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),this.setState({value:K.DIFFERENT_VALUE,selectOptions:i})):this.setState({value:n,selectOptions:i})}renderItem(n,i){if(!this.state.selectOptions)return null;let l;const v=JSON.parse(JSON.stringify(this.state.selectOptions));return Array.isArray(this.state.value)||this.state.value===K.DIFFERENT_VALUE?([...this.state.value].filter(c=>!v.find(d=>typeof d=="object"?d.value===c:d===c)).forEach(c=>v.push({label:c.toString(),value:c})),l={label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE},v.unshift(l)):(l=this.state.value!==null&&this.state.value!==void 0&&v.find(c=>typeof c=="object"?c.value==this.state.value:c==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!l&&this.props.schema.freeSolo&&(l={value:this.state.value,label:this.state.value},v.push(l))),M.createElement(N.Autocomplete,{fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,value:l,options:v,isOptionEqualToValue:(c,d)=>c.value===d.value,filterOptions:(c,d)=>{const o=c.filter(p=>d.inputValue===""?!0:p.label.toLowerCase().includes(d.inputValue.toLowerCase())||p.value.toLowerCase().includes(d.inputValue.toLowerCase()));return this.props.schema.freeSolo&&d.inputValue!==""&&o.push({label:d.inputValue,value:d.inputValue}),o},onInputChange:c=>{if(!c||!this.props.schema.freeSolo)return;const d=c.target.value;d!==this.state.value&&this.setState({value:d},()=>this.onChange(this.props.attr,d))},onChange:(c,d)=>{const o=typeof d=="object"?d?d.value:"":d;o!==this.state.value&&this.setState({value:o},()=>this.onChange(this.props.attr,o))},getOptionLabel:c=>typeof c=="object"?(c==null?void 0:c.label)??"":"",renderInput:c=>M.createElement(N.TextField,{variant:"standard",...c,error:!!n,placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:i})})}}class ks extends K{initialized=!1;localContext;askInstance(){const n=K.getValue(this.props.data,this.props.attr),i=this.props.schema.options?this.props.schema.options.map(l=>typeof l=="string"?{label:l,value:l}:JSON.parse(JSON.stringify(l))):[];if(this.props.alive){let l=this.props.schema.data;if(l===void 0&&this.props.schema.jsonData){const v=this.getPattern(this.props.schema.jsonData,null,!0);try{typeof v=="string"&&(l=JSON.parse(v))}catch{console.error(`Cannot parse json data: ${JSON.stringify(l)}`)}}l===void 0&&(l=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",l).then(v=>{v&&Array.isArray(v)&&v.forEach(s=>i.push(typeof s=="string"?{label:s,value:s}:JSON.parse(JSON.stringify(s)))),Array.isArray(n)?(i.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),this.setState({value:K.DIFFERENT_VALUE,selectOptions:i})):this.setState({value:n,selectOptions:i})})}else Array.isArray(n)?(i.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),this.setState({value:K.DIFFERENT_VALUE,selectOptions:i})):this.setState({value:n,selectOptions:i})}getContext(){const n={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(i=>n[i]=K.getValue(this.props.data,i)),JSON.stringify(n)}renderItem(n,i){if(this.props.alive){const c=this.getContext();(c!==this.localContext||!this.initialized)&&(this.localContext=c,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}let l;const v=this.state.selectOptions?JSON.parse(JSON.stringify(this.state.selectOptions)):[];return Array.isArray(this.state.value)||this.state.value===K.DIFFERENT_LABEL?([...this.state.value].filter(c=>!v.find(d=>d.value===c)).forEach(c=>v.push({label:c.toString(),value:c})),l={label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE},v.unshift(l)):(l=this.state.value!==null&&this.state.value!==void 0&&v.find(c=>c.value==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!l&&this.props.schema.freeSolo&&(l={value:this.state.value,label:this.state.value},v.push(l)),l=l||null),v.length?M.createElement(N.Autocomplete,{value:l,fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,options:v,isOptionEqualToValue:(c,d)=>c.value===d.value,filterOptions:(c,d)=>{const o=c.filter(p=>d.inputValue===""?!0:p.label.toLowerCase().includes(d.inputValue.toLowerCase())||p.value.toLowerCase().includes(d.inputValue.toLowerCase()));return this.props.schema.freeSolo&&d.inputValue!==""&&o.push({label:d.inputValue,value:d.inputValue}),o},getOptionLabel:c=>(c==null?void 0:c.label)??"",onInputChange:c=>{if(!c||!this.props.schema.freeSolo)return;const d=c.target.value;d!==this.state.value&&this.setState({value:d},()=>this.onChange(this.props.attr,d))},onChange:(c,d)=>{const o=typeof d=="object"?d?d.value:"":d;o!==this.state.value&&this.setState({value:o},()=>this.onChange(this.props.attr,o))},renderInput:c=>M.createElement(N.TextField,{variant:"standard",...c,error:!!n,placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:i})}):M.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!n,disabled:i,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0}},onChange:c=>{const d=c.target.value;this.setState({value:d},()=>this.onChange(this.props.attr,(d||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const fn={fullWidth:{width:"100%"},flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class Ms extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,l=K.getValue(n,i)||"";this.setState({value:l,showDialog:!1})}renderItem(n,i){const{schema:l,attr:v}=this.props,{value:s,showDialog:c}=this.state;return M.createElement(N.FormControl,{style:fn.fullWidth,variant:"standard"},l.label?M.createElement(N.InputLabel,{shrink:!0},this.getText(l.label)):null,M.createElement("div",{style:fn.flex},M.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:s??"",error:!!n,disabled:i,placeholder:this.getText(l.placeholder),label:this.getText(l.label),helperText:this.renderHelp(l.help,l.helpLink,l.noTranslation),onChange:d=>{const o=d.target.value;this.setState({value:o},()=>this.onChange(v,o))}}),M.createElement(N.Button,{color:"grey",disabled:i,style:fn.button,size:"small",variant:"outlined",onClick:()=>this.setState({showDialog:!0})},"...")),c?M.createElement(j.DialogCron,{title:j.I18n.t("ra_Define schedule"),simple:l.simple,complex:l.complex,cron:s,onClose:()=>this.setState({showDialog:!1}),cancel:j.I18n.t("ra_Cancel"),ok:j.I18n.t("ra_Ok"),theme:this.props.oContext.theme,onOk:d=>this.setState({showDialog:!1,value:d},()=>this.onChange(v,d))}):null)}}class Ls extends K{async componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr),l=(await this.props.oContext.socket.getCertificates()).filter(v=>{const s=this.props.attr.toLowerCase();return s.includes(v.type)||v.type==="public"&&s.includes("cert")||v.type==="private"&&(s.includes("priv")||s.includes("key"))?!0:!!(v.type==="chained"&&(s.includes("chain")||s.includes("ca")))}).map(v=>({label:v.name,value:v.name}));l.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({value:n,selectOptions:l})}renderItem(n,i){var v,s;if(!this.state.selectOptions)return null;const l=(v=this.state.selectOptions)==null?void 0:v.find(c=>c.value===this.state.value);return M.createElement(N.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?M.createElement(N.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,M.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:this.state.value,renderValue:()=>this.getText(l==null?void 0:l.label,this.props.schema.noTranslation!==!1),onChange:c=>this.setState({value:c.target.value},()=>this.onChange(this.props.attr,this.state.value))},(s=this.state.selectOptions)==null?void 0:s.map(c=>M.createElement(N.MenuItem,{key:c.value,value:c.value,style:c.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(c.label,this.props.schema.noTranslation!==!1)))),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const At={fullWidth:{width:"100%"},leWidth:{width:620,marginBottom:10},certWidth:{width:200,marginRight:10}};class Is extends K{async componentDidMount(){var d;super.componentDidMount();const n=await this.props.oContext.socket.getCertificates(),i=[],l=[],v=[];let s=[];const c=await this.props.oContext.socket.getObject("system.certificates");(d=c==null?void 0:c.native)!=null&&d.collections?s=Object.keys(c.native.collections):s=null,n.forEach(o=>{o.type==="public"?i.push({label:o.name,value:o.name}):o.type==="private"?l.push({label:o.name,value:o.name}):o.type==="chained"?v.push({label:o.name,value:o.name}):(i.push({label:o.name,value:o.name}),l.push({label:o.name,value:o.name}),v.push({label:o.name,value:o.name}))}),i.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),l.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),v.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({certsPublicOptions:i,certsChainOptions:v,certsPrivateOptions:l,collectionsOptions:s})}renderItem(n,i){var e,t,r,h,a,u,f;if(!this.state.certsPublicOptions||!this.state.certsPrivateOptions||!this.state.certsChainOptions)return null;const l=(K.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString(),v=K.getValue(this.props.data,this.props.schema.certPublicName||"certPublic"),s=K.getValue(this.props.data,this.props.schema.certPrivateName||"certPrivate"),c=K.getValue(this.props.data,this.props.schema.certChainedName||"certChained"),d=(e=this.state.certsPublicOptions)==null?void 0:e.find(m=>m.value===v),o=(t=this.state.certsPrivateOptions)==null?void 0:t.find(m=>m.value===s),p=(r=this.state.certsChainOptions)==null?void 0:r.find(m=>m.value===c);return M.createElement("div",{style:At.fullWidth},this.state.collectionsOptions?M.createElement(N.FormControl,{style:At.leWidth,variant:"standard"},M.createElement(N.InputLabel,{shrink:!0},"Let's encrypt"),M.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:l,onChange:m=>this.onChange(this.props.schema.leCollectionName||"leCollection",m.target.value==="false"?!1:m.target.value==="true"?!0:m.target.value)},M.createElement(N.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},j.I18n.t("ra_Do not use let's encrypt")),M.createElement(N.MenuItem,{key:"_true",value:"true",style:{fontWeight:"bold"}},j.I18n.t("ra_Use all available let's encrypt certificates")),(h=this.state.collectionsOptions)==null?void 0:h.map(m=>M.createElement(N.MenuItem,{key:m,value:m},m)))):null,this.state.collectionsOptions?M.createElement("br",null):null,this.state.collectionsOptions&&l!=="false"?M.createElement("div",null,j.I18n.t("ra_Fallback custom certificates")):null,M.createElement(N.FormControl,{style:At.certWidth,variant:"standard"},M.createElement(N.InputLabel,{shrink:!0},j.I18n.t("ra_Public certificate")),M.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:v||"",renderValue:()=>this.getText(d==null?void 0:d.label),onChange:m=>this.onChange(this.props.schema.certPublicName||"certPublic",m.target.value)},(a=this.state.certsPublicOptions)==null?void 0:a.map((m,y)=>M.createElement(N.MenuItem,{key:`${m.value}_${y}`,value:m.value,style:m.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(m.label))))),M.createElement(N.FormControl,{style:At.certWidth,variant:"standard"},M.createElement(N.InputLabel,{shrink:!0},j.I18n.t("ra_Private certificate")),M.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:s||"",renderValue:()=>this.getText(o==null?void 0:o.label),onChange:m=>this.onChange(this.props.schema.certPrivateName||"certPrivate",m.target.value)},(u=this.state.certsPrivateOptions)==null?void 0:u.map((m,y)=>M.createElement(N.MenuItem,{key:`${m.value}_${y}`,value:m.value,style:m.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(m.label))))),M.createElement(N.FormControl,{style:At.certWidth,variant:"standard"},M.createElement(N.InputLabel,{shrink:!0},j.I18n.t("ra_Chained certificate")),M.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:c||"",renderValue:()=>this.getText(p==null?void 0:p.label),onChange:m=>this.onChange(this.props.schema.certChainedName||"certChained",m.target.value)},(f=this.state.certsChainOptions)==null?void 0:f.map((m,y)=>M.createElement(N.MenuItem,{key:`${m.value}_${y}`,value:m.value,style:m.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(m.label))))))}}class Fs extends K{async componentDidMount(){var l;super.componentDidMount();let n;const i=await this.props.oContext.socket.getObject("system.certificates");(l=i==null?void 0:i.native)!=null&&l.collections?n=Object.keys(i.native.collections):n=[],this.setState({collectionsOptions:n})}renderItem(n,i){var v;if(!this.state.collectionsOptions)return null;const l=(K.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString();return M.createElement(N.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?M.createElement(N.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,M.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:l,onChange:s=>this.onChange(this.props.schema.leCollectionName||"leCollection",s.target.value==="false"?!1:s.target.value==="true"?!0:s.target.value)},M.createElement(N.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},j.I18n.t("ra_Do not use let's encrypt")),M.createElement(N.MenuItem,{key:"_true",value:"true",style:{fontWeight:"bold"}},j.I18n.t("ra_Use all available let's encrypt certificates")),(v=this.state.collectionsOptions)==null?void 0:v.map(s=>M.createElement(N.MenuItem,{key:s,value:s},s))),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const _e={fullWidth:{width:"100%"},licLabel:{fontWeight:"bold",minWidth:100,marginRight:10,textTransform:"capitalize",display:"inline-block"},errorTitle:L=>({color:L.palette.mode==="dark"?"#e39191":"#b62020"}),okTitle:L=>({color:L.palette.mode==="dark"?"#6fd56f":"#007c00"}),errorText:L=>({color:L.palette.mode==="dark"?"#e39191":"#b62020",mb:"30px"})};class Xe extends K{componentDidMount(){super.componentDidMount(),this.setState({_error:"",running:!1,showLicenseData:null,foundSuitableLicense:!1,licenseOfflineCheck:!1,result:null,allLicenses:null,askForUpdate:!1,showLinkToProfile:!1})}renderErrorDialog(){if(this.state._error&&!this.state.showLicenseData){let n=this.state._error;return this.state.allLicenses&&(n=[M.createElement("div",{key:"error"},n)],n.push(M.createElement(N.Button,{key:"button",variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},j.I18n.t("iobroker.net"))),this.state.allLicenses.length?n.push(M.createElement(N.TableContainer,{key:"table"},M.createElement(N.Table,{size:"small"},M.createElement(N.TableHead,null,M.createElement(N.TableRow,null,M.createElement(N.TableCell,null,j.I18n.t("ra_Product")),M.createElement(N.TableCell,null,j.I18n.t("ra_Version")),M.createElement(N.TableCell,null,"UUID"),M.createElement(N.TableCell,null,j.I18n.t("ra_ValidTill")),M.createElement(N.TableCell,null,j.I18n.t("ra_Commercial")),M.createElement(N.TableCell,null,"ID"))),M.createElement(N.TableBody,null,this.state.allLicenses.map(i=>M.createElement(N.TableRow,{key:i.id},M.createElement(N.TableCell,{sx:i.validName?null:_e.errorText},i.license.product),M.createElement(N.TableCell,{sx:i.validVersion?null:_e.errorText},i.license.version),M.createElement(N.TableCell,{sx:i.validUuid?null:_e.errorText},i.license.uuid||"--"),M.createElement(N.TableCell,{sx:i.validTill?null:_e.errorText},i.license.validTill&&i.license.validTill!=="0000-00-00 00:00:00"?new Date(i.license.validTill).toLocaleDateString():"--"),M.createElement(N.TableCell,null,i.license.invoice!=="free"?i.license.invoice==="MANUALLY_CREATED"?"✓":i.license.invoice:"-"),M.createElement(N.TableCell,null,i.id))))))):(n.push(M.createElement("div",{key:"text1"},j.I18n.t("ra_No one license found in license manager"))),n.push(M.createElement("div",{key:"text2"},j.I18n.t("ra_Please create license"))))),M.createElement(N.Dialog,{open:!0,maxWidth:"xl",fullWidth:this.props.fullWidth!==void 0?this.props.fullWidth:!0,onClick:()=>this.setState({_error:"",allLicenses:null})},M.createElement(N.DialogTitle,null,j.I18n.t("ra_Error")),M.createElement(N.DialogContent,null,M.createElement(N.DialogContentText,null,n)),M.createElement(N.DialogActions,null,M.createElement(N.Button,{variant:"contained",onClick:()=>this.setState({_error:"",allLicenses:null}),color:"primary",autoFocus:!0,startIcon:M.createElement(Z.Check,null)},j.I18n.t("ra_Ok"))))}return null}renderMessageDialog(){if(this.state.showLicenseData){const n=[],i=this.state.showLicenseData;return Object.keys(i).forEach(l=>{if(!(i[l]===null||i[l]===void 0))if(typeof i[l]=="object"){const v=i[l];Object.keys(v).forEach(s=>{v[s]!==null&&v[s]!==void 0&&(typeof v[s]=="object"?n.push(M.createElement("div",{key:s},M.createElement("div",{style:_e.licLabel},s,":"),JSON.stringify(v[s],null,2))):n.push(M.createElement("div",{key:s},M.createElement("div",{style:_e.licLabel},l," -",s,":"),v[s].toString())))})}else n.push(M.createElement("div",{key:l},M.createElement("div",{style:_e.licLabel},l.replace(/_/g," "),":"),i[l].toString()))}),n.push(M.createElement("div",{key:"checked"},M.createElement("div",{style:_e.licLabel},j.I18n.t("ra_Checked"),":"),this.state.licenseOfflineCheck?j.I18n.t("ra_locally"):j.I18n.t("ra_via internet"))),M.createElement(N.Dialog,{open:!0,onClose:()=>this.setState({showLicenseData:null})},M.createElement(N.DialogTitle,null,M.createElement(N.Box,{component:"span",sx:this.state.result?_e.okTitle:_e.errorTitle},j.I18n.t("ra_License %s",this.state.result?"OK":"INVALID"))),M.createElement(N.DialogContent,null,this.state.showLinkToProfile?M.createElement(N.Button,{variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},"https://iobroker.net"):null,this.state._error?M.createElement(N.Box,{component:"div",sx:_e.errorText},this.state._error):null,n),M.createElement(N.DialogActions,null,M.createElement(N.Button,{onClick:()=>this.setState({showLicenseData:null,_error:""}),color:"primary",variant:"contained"},j.I18n.t("ra_Close"))))}return null}static parseJwt(n){const l=n.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),v=decodeURIComponent(atob(l).split("").map(s=>`%${`00${s.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));try{return JSON.parse(v)}catch{return null}}static isVersionValid(n,i,l,v){if(!i||!n)return!0;let s=!0;const[c]=n.split(".");return i.startsWith(">=")?s=parseInt(c,10)>=parseInt(i.substring(2,10)):i.startsWith("<=")?s=parseInt(c,10)<=parseInt(i.substring(2,10)):i.startsWith(">")?s=parseInt(c,10)>parseInt(i.substring(1,10)):i.startsWith("<")?s=parseInt(c,10)<parseInt(i.substring(1,10)):i.startsWith("=")?s=parseInt(c,10)===parseInt(i.substring(1,10)):i.startsWith("==")?s=parseInt(c,10)===parseInt(i.substring(2,10)):i.startsWith("===")&&(s=parseInt(c,10)===parseInt(i.substring(3,10))),!0}async findInLicenseManager(n){var v,s,c,d;const i=await this.props.oContext.socket.getObject("system.licenses"),l=[];if((s=(v=i==null?void 0:i.native)==null?void 0:v.licenses)!=null&&s.length){let o=null;const p=Date.now();let e;if(this.props.schema.uuid){const r=await this.props.oContext.socket.getObject("system.meta.uuid");e=(c=r==null?void 0:r.native)==null?void 0:c.uuid}let t;if(this.props.schema.version){const r=await this.props.oContext.socket.getObject(`system.adapter.${n}`);t=(d=r==null?void 0:r.common)==null?void 0:d.version}i.native.licenses.forEach(r=>{const h=!r.validTill||r.validTill==="0000-00-00 00:00:00"||new Date(r.validTill).getTime()>p,a=(r.product||"").split("."),u=a[1]===n||n==="vis-2"&&a[1]==="vis",f=!e||!r.uuid||r.uuid===e,m=Xe.isVersionValid(t,r.version,r.invoice,n);(!o||r.invoice!=="free")&&h&&u&&f&&m&&(o=r),l.push({id:r.id,validName:u,validUuid:f,validVersion:m,validTill:h,license:r})}),o&&(l.find(r=>r.id===o.id).used=!0)}return l}async checkLicense(n,i){var d,o,p;let l;if(this.props.schema.uuid){const e=await this.props.oContext.socket.getObject("system.meta.uuid");l=(d=e==null?void 0:e.native)==null?void 0:d.uuid}let v;if(this.props.schema.version){const e=await this.props.oContext.socket.getObject(`system.adapter.${i}`);v=(o=e==null?void 0:e.common)==null?void 0:o.version}const s=new AbortController;let c=setTimeout(()=>{c=null,s.abort()},5e3);try{const e=await window.fetch("https://iobroker.net/api/v1/public/cert/",{method:"POST",body:JSON.stringify({json:n,uuid:l}),headers:{"Content-Type":"text/plain"},signal:s.signal});c&&clearTimeout(c);const t=await e.text();let r;try{r=JSON.parse(t)}catch{}if(r!=null&&r.error)try{const h=Xe.parseJwt(n),a=j.I18n.t(`ra_${h.error||r.error||"Unknown error"}`).replace(/^ra_/,"");return this.setState({_error:a,licenseOfflineCheck:!1,showLicenseData:h,result:!1,running:!1})}catch{return console.log("Cannot parse license"),this.setState({_error:r.error,result:!1,running:!1})}else{let h=null;try{h=Xe.parseJwt(n)}catch{}if(r){const a=r.validTill||r.valid_till;if(a&&a!=="0000-00-00 00:00:00"&&new Date(a).getTime()<Date.now())return this.setState({_error:j.I18n.t("ra_License expired on %s",new Date(a).toLocaleString()),licenseOfflineCheck:!1,showLicenseData:h,result:!1,running:!1});const u=(r.name||"").split(".");return u[1]===i||u[1]==="vis"&&i==="vis-2"?l&&!r.uuid&&i==="vis-2"?this.setState({_error:j.I18n.t("ra_License must be converted",r.uuid),showLinkToProfile:!0,licenseOfflineCheck:!1,showLicenseData:h,result:!1,running:!1}):l&&r.uuid&&r.uuid!==l?this.setState({_error:j.I18n.t('ra_Serial number (UUID) "%s" in license is for other device.',r.uuid),licenseOfflineCheck:!1,showLicenseData:h,result:!1,running:!1}):Xe.isVersionValid(v,r.version,r.invoice,i)?this.setState({licenseOfflineCheck:!1,showLicenseData:h,result:!0,running:!1}):this.setState({_error:j.I18n.t("ra_License is for version %s, but required version is %s",r.version,this.props.schema.version),licenseOfflineCheck:!1,showLicenseData:h,result:!1,running:!1}):this.setState({_error:j.I18n.t('ra_License for other product "%s"',r.name),licenseOfflineCheck:!1,showLicenseData:h,result:!1,running:!1})}throw new Error("ra_Invalid answer from server")}}catch(e){if(((p=e==null?void 0:e.response)==null?void 0:p.status)===404)return this.setState({_error:j.I18n.t("ra_License does not exist"),result:!1,running:!1});try{const t=Xe.parseJwt(n),r=(t.name||"").split(".");return t.valid_till&&t.valid_till!=="0000-00-00 00:00:00"&&new Date(t.valid_till).getTime()<Date.now()?this.setState({_error:j.I18n.t("ra_License expired on %s",new Date(t.valid_till).toLocaleString()),showLicenseData:t,licenseOfflineCheck:!0,running:!1,result:!1}):r[1]===i?l&&t.uuid&&t.uuid!==l?this.setState({_error:j.I18n.t('ra_Serial number (UUID) "%s" in license is for other device.',t.uuid),showLicenseData:t,licenseOfflineCheck:!0,result:!1,running:!1}):Xe.isVersionValid(v,t.version,t.invoice,i)?this.setState({running:!1,result:!0,licenseOfflineCheck:!0,showLicenseData:t}):this.setState({_error:j.I18n.t("ra_License is for version %s, but required version is %s",t.version,this.props.schema.version),licenseOfflineCheck:!0,showLicenseData:t,result:!1,running:!1}):this.setState({_error:j.I18n.t('ra_License for other product "%s"',t.name),licenseOfflineCheck:!0,showLicenseData:t,result:!1,running:!1})}catch{return this.setState({_error:j.I18n.t("ra_Cannot decode license"),result:!1,licenseOfflineCheck:!0,running:!1})}}}renderAskForUpdate(){return this.state.askForUpdate?M.createElement(j.DialogConfirm,{text:j.I18n.t("ra_License not found in license manager. Do you want to read licenses from iobroker.net?"),ok:j.I18n.t("ra_Yes"),onClose:async n=>{if(n){this.setState({askForUpdate:!1});try{await this.props.oContext.socket.updateLicenses(null,null)}catch(i){window.alert(j.I18n.t("ra_Cannot read licenses: %s",i));return}await this._onClick(!0)}else this.setState({askForUpdate:!1,running:!1})}}):null}async _onClick(n){const i=this.props.oContext.adapterName==="vis-2"?"vis":this.props.oContext.adapterName;this.setState({running:!0});let l,v;if(this.props.data.useLicenseManager){if(v=await this.findInLicenseManager(i),l=v.find(s=>s.used),l&&(l=l.license.json),!l&&!n){this.setState({askForUpdate:!0});return}}else l=this.props.data.license;l?await this.checkLicense(l,i):this.props.data.useLicenseManager?this.setState({_error:j.I18n.t("ra_Suitable license not found in license manager"),result:!1,running:!1,allLicenses:v}):this.setState({_error:j.I18n.t("ra_Please enter the license"),result:!1,running:!1})}renderItem(){return M.createElement("div",{style:_e.fullWidth},M.createElement(N.Button,{variant:this.props.schema.variant||"outlined",color:this.props.schema.color||"primary",style:_e.fullWidth,disabled:!this.props.data.license&&!this.props.data.useLicenseManager||this.state.running,startIcon:M.createElement(Z.Send,null),onClick:()=>this._onClick()},this.state.running?M.createElement(N.CircularProgress,{size:20,style:{marginRight:8}}):null,this.getText(this.props.schema.label||"ra_Check license",this.props.schema.noTranslation)),this.renderMessageDialog(),this.renderErrorDialog(),this.renderAskForUpdate())}}class Os extends K{renderItem(n,i){const l=K.getValue(this.props.data,this.props.attr),v=Array.isArray(l);return M.createElement(N.FormControl,{style:{width:"100%"},variant:"standard"},M.createElement(N.FormControlLabel,{onClick:s=>{if(s.preventDefault(),s.stopPropagation(),!i){const c=this.onChange(this.props.attr,!l);c instanceof Promise&&c.catch(d=>console.error(`Cannot set value: ${d}`))}},control:M.createElement(N.Checkbox,{indeterminate:v,checked:!!l,onChange:s=>{let c;v?c=this.onChange(this.props.attr,!0):c=this.onChange(this.props.attr,s.target.checked),c instanceof Promise&&c.catch(d=>console.error(`Cannot set value: ${d}`))},disabled:i||this.props.schema.readOnly}),label:this.getText(this.props.schema.label)}),M.createElement(N.FormHelperText,{style:{color:"red"}},n?this.props.schema.validatorErrorText?j.I18n.t(this.props.schema.validatorErrorText):j.I18n.t("ra_Error"):null),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Rs={standard:N.Input,filled:is,outlined:N.OutlinedInput},Ns=L=>{const n=L.palette.mode==="light",i=n?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return{root:{},inputRoot:{display:"inline-flex",flexWrap:"wrap",flex:1,marginTop:0,minWidth:70,"&.mui-variant-outlined,&.mui-variant-filled":{boxSizing:"border-box"},"&.mui-variant-outlined":{paddingTop:"14px"},"&.mui-variant-filled":{paddingTop:"28px"}},input:{display:"inline-block",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",appearance:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",float:"left",flex:1},chipContainer:{display:"flex",flexFlow:"row wrap",alignItems:"center",cursor:"text",marginBottom:"-2px",minHeight:40},outlined:{"& input":{height:16,paddingTop:"4px",paddingBottom:"12px",marginTop:"4px",marginBottom:"4px"}},standard:{marginTop:"18px"},filled:{"& input":{height:22,marginBottom:"4px",marginTop:"4px",paddingTop:0},"$marginDense & input":{height:26}},labeled:{},label:{top:4,"&$outlined&:not($labelShrink)":{top:2,"$marginDense &":{top:5}},"&$filled&:not($labelShrink)":{top:15,"$marginDense &":{top:20}}},labelShrink:{top:0},helperText:{marginBottom:-20},focused:{},disabled:{},underline:{"&:after":{borderBottom:`2px solid ${L.palette.primary[n?"dark":"light"]}`,left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:L.transitions.create("transform",{duration:L.transitions.duration.shorter,easing:L.transitions.easing.easeOut}),pointerEvents:"none"},"&$focused:after":{transform:"scaleX(1)"},"&$error:after":{borderBottomColor:L.palette.error.main,transform:"scaleX(1)"},"&:before":{borderBottom:`1px solid ${i}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:L.transitions.create("border-bottom-color",{duration:L.transitions.duration.shorter}),pointerEvents:"none"},"&:hover:not($disabled):not($focused):not($error):before":{borderBottom:`2px solid ${L.palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${i}`}},"&$disabled:before":{borderBottomStyle:"dotted"}},error:{"&:after":{backgroundColor:L.palette.error.main,transform:"scaleX(1)"}},chip:{margin:"0 8px 8px 0",float:"left"},marginDense:{}}},Ht={BACKSPACE:8,DELETE:46,LEFT_ARROW:37,RIGHT_ARROW:39},Bs=({value:L,isFocused:n,isDisabled:i,isReadOnly:l,handleClick:v,handleDelete:s,style:c},d)=>M.createElement(N.Chip,{key:d,style:{...c,pointerEvents:i||l?"none":void 0,backgroundColor:n?rs[300]:void 0},onClick:v,onDelete:s,label:L});class Ps extends M.Component{labelRef;labelNode=null;input;newChipKeyCodes;newChipKeys;actualInput=null;inputBlurTimeout=null;_keyPressed;_preventChipCreation;styles={};styleTheme=null;constructor(n){super(n),this.state={chips:n.defaultValue||[],focusedChip:null,inputValue:"",isFocused:!1,chipsUpdated:!1,prevPropsValue:[],variant:this.props.variant||"standard"},this.newChipKeyCodes=n.newChipKeyCodes||[13],this.newChipKeys=n.newChipKeys||["Enter"],this.labelRef=M.createRef(),this.input=M.createRef()}componentDidMount(){this.state.variant==="outlined"&&(this.labelNode=ns.findDOMNode(this.labelRef.current),this.forceUpdate())}componentWillUnmount(){this.inputBlurTimeout&&clearTimeout(this.inputBlurTimeout)}static getDerivedStateFromProps(n,i){let l=null;return n.value&&n.value.length!==i.prevPropsValue.length&&(l={prevPropsValue:n.value},n.clearInputValueOnChange&&(l.inputValue="")),n.clearInputValueOnChange&&n.value&&n.value.length!==i.prevPropsValue.length&&(l={prevPropsValue:n.value,inputValue:""}),n.disabled&&(l={...l,focusedChip:null}),!i.chipsUpdated&&n.defaultValue&&(l={...l,chips:n.defaultValue}),l}focus=()=>{var n;(n=this.actualInput)==null||n.focus(),this.state.focusedChip&&this.setState({focusedChip:null})};handleInputBlur=n=>{this.props.onBlur&&this.props.onBlur(n),this.setState({isFocused:!1}),this.state.focusedChip&&this.setState({focusedChip:null});const i=n.target.value;let l;switch(this.props.blurBehavior||"clear"){case"add-or-clear":l={clearInputOnFail:!0};case"add":if(this.props.delayBeforeAdd){const v=(this.props.value||this.state.chips).length;this.inputBlurTimeout=setTimeout(()=>{const s=(this.props.value||this.state.chips).length;v===s?this.handleAddChip(i,l):this.clearInput()},150)}else this.handleAddChip(i,l);break;case"clear":this.clearInput();break}};handleInputFocus=n=>{this.setState({isFocused:!0}),this.props.onFocus&&this.props.onFocus(n)};handleKeyDown=n=>{const{focusedChip:i}=this.state;if(this._keyPressed=!1,this._preventChipCreation=!1,this.props.onKeyDown&&(this.props.onKeyDown(n),n.isDefaultPrevented()))return;const l=this.props.value||this.state.chips;if(this.newChipKeyCodes.includes(n.keyCode)||this.newChipKeys.includes(n.key)){this.handleAddChip(n.target.value)!==!1&&n.preventDefault();return}switch(n.keyCode){case Ht.BACKSPACE:n.target.value===""&&(i?(this.handleDeleteChip(l[i],i),i&&this.setState({focusedChip:i-1})):this.setState({focusedChip:l.length-1}));break;case Ht.DELETE:n.target.value===""&&i&&(this.handleDeleteChip(l[i],i),i<=l.length-1&&this.setState({focusedChip:i}));break;case Ht.LEFT_ARROW:i===null&&n.target.value===""&&l.length?this.setState({focusedChip:l.length-1}):i!==null&&i>0&&this.setState({focusedChip:i-1});break;case Ht.RIGHT_ARROW:i!==null&&i<l.length-1?this.setState({focusedChip:i+1}):this.setState({focusedChip:null});break;default:this.setState({focusedChip:null});break}};handleKeyUp=n=>{!this._preventChipCreation&&(this.newChipKeyCodes.includes(n.keyCode)||this.newChipKeys.includes(n.key))&&this._keyPressed?this.clearInput():this.updateInput(n.target.value),this.props.onKeyUp&&this.props.onKeyUp(n)};handleUpdateInput=n=>{(this.props.inputValue===null||this.props.inputValue===void 0)&&this.updateInput(n.target.value),this.props.onUpdateInput&&this.props.onUpdateInput(n)};handleAddChip(n,i){if(this.props.onBeforeAdd&&!this.props.onBeforeAdd(n))return this._preventChipCreation=!0,i&&i.clearInputOnFail&&this.clearInput(),!1;this.clearInput();const l=this.props.value||this.state.chips;return n.trim().length?((this.props.allowDuplicates||!l.includes(n))&&(this.props.value&&this.props.onAdd?this.props.onAdd(n):this.updateChips([...this.state.chips,n])),!0):!1}handleDeleteChip(n,i){if(this.props.value)this.props.onDelete&&this.props.onDelete(n,i);else{const l=this.state.chips.slice();if(l.splice(i,1)){let s=this.state.focusedChip;this.state.focusedChip===i?s=null:this.state.focusedChip>i&&(s=this.state.focusedChip-1),this.updateChips(l,{focusedChip:s})}}}updateChips(n,i={}){this.setState({chips:n,chipsUpdated:!0,...i}),this.props.onChange&&this.props.onChange(n)}clearInput(){this.updateInput("")}updateInput(n){this.setState({inputValue:n})}setActualInputRef=n=>{this.actualInput=n,this.props.inputRef&&this.props.inputRef(n)};render(){const{alwaysShowPlaceholder:n,chipRenderer:i=Bs,className:l,disabled:v,disableUnderline:s,error:c,FormHelperTextProps:d,fullWidth:o,fullWidthInput:p,helperText:e,id:t,InputProps:r={},InputLabelProps:h={},inputValue:a,label:u,placeholder:f,readOnly:m,required:y,rootRef:x,value:E,margin:b}=this.props,g=this.state.variant;this.styleTheme!==this.props.theme.palette.mode&&(this.styleTheme=this.props.theme.palette.mode,this.styles=j.Utils.getStyle(this.props.theme,Ns));let S=E||this.state.chips||[];Array.isArray(S)||(S=(S||"").toString().split(/[,\s]+/).map(w=>w.trim()));const k=a??this.state.inputValue,D=(this.props.value||k).length||k.length,_=typeof h.shrink=="boolean"?h.shrink:u!==null&&(D||this.state.isFocused||S.length),F=S.map((w,C)=>i({value:w,isDisabled:!!v,isReadOnly:m,isFocused:this.state.focusedChip===C,handleClick:()=>this.setState({focusedChip:C}),handleDelete:()=>this.handleDeleteChip(w,C),style:this.styles.chip},C.toString())),A={};g==="outlined"&&(A.notched=!!_,A.labelWidth=_&&this.labelNode&&this.labelNode.offsetWidth||0),g!=="standard"?A.startAdornment=F:r.disableUnderline=!0;const $=Rs[g];return M.createElement(N.FormControl,{ref:x,fullWidth:o,className:l,sx:{...this.styles.root,...b==="dense"?this.styles.marginDense:{}},error:c,required:S.length>0?void 0:y,onClick:this.focus,disabled:v,variant:g,component:"div",margin:b},u&&M.createElement(N.InputLabel,{htmlFor:t,sx:{"&.MuiInputLabel-root":this.styles.label,"&.MuiInputLabel-shrink":this.styles.labelShrink},shrink:!!_,focused:this.state.isFocused,variant:g,ref:this.labelRef,required:y,component:"label",...h},u),M.createElement(N.Box,{component:"div",id:"input-chip-container",sx:{...this.styles[g],...this.styles.chipContainer,...this.state.isFocused?this.styles.focused:void 0,...!s&&g==="standard"?this.styles.underline:void 0,...v?this.styles.disabled:void 0,...u?this.styles.labeled:void 0,...c?this.styles.error:void 0}},g==="standard"&&F,M.createElement($,{ref:this.input,className:`mui-variant-${this.styles[g]} ${u?"mui-chip-with-label":"mui-chip-no-label"}`,sx:{"&.MuiInputBase-input":{...this.styles.input,...this.styles[g]},"&.MuiInputBase-root":{...this.styles.inputRoot}},id:t,value:k,onChange:this.handleUpdateInput,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,inputRef:this.setActualInputRef,disabled:v,fullWidth:p,placeholder:!D&&(_||u===null||u===void 0)||n?f:null,readOnly:m,...r,...A})),e&&M.createElement(N.FormHelperText,{...d,className:d==null?void 0:d.className,style:this.styles.helperText},e))}}class ri extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,l=K.getValue(n,i);if(this.props.schema.delimiter&&typeof l=="string"){const v=l.split(this.props.schema.delimiter).map(s=>s.trim()).filter(s=>s);this.setState({value:v})}else this.setState({value:l||[]})}renderItem(n,i){const{attr:l,schema:v}=this.props,{value:s}=this.state;return M.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},M.createElement(Ps,{value:s,disabled:!!i,label:this.getText(v.label),error:!!n,onAdd:c=>{const d=JSON.parse(JSON.stringify(s));d.push(c),this.setState({value:d},()=>{let o;this.props.schema.delimiter?o=this.onChange(l,d.join(`${this.props.schema.delimiter} `)):o=this.onChange(l,d),o instanceof Promise&&o.catch(p=>console.error(p))})},theme:this.props.oContext.theme,onDelete:(c,d)=>{const o=JSON.parse(JSON.stringify(s));o.splice(d,1),this.setState({value:o},()=>{let p;this.props.schema.delimiter?p=this.onChange(l,o.join(`${this.props.schema.delimiter} `)):p=this.onChange(l,o),p instanceof Promise&&p.catch(e=>console.error(e))})}}),M.createElement(N.FormHelperText,null,j.I18n.t("ra_Press ENTER Key to add new item")),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class Ws extends K{renderColorDialog(){return!!this.state.showColorDialog&&M.createElement(N.Dialog,{onClose:()=>this.setState({showColorDialog:!1}),open:this.state.showColorDialog},M.createElement(qr,{color:this.state.colorDialogValue,onChange:n=>this.setState({colorDialogValue:n.hex},()=>this.onChange(this.props.attr,this.state.colorDialogValue))}))}renderItem(n,i){const l=K.getValue(this.props.data,this.props.attr);let v=j.Utils.isUseBright(l,null);return v===null&&(v=void 0),M.createElement(M.Fragment,null,this.renderColorDialog(),M.createElement(N.TextField,{variant:"standard",disabled:!!i,style:{minWidth:100,width:"calc(100% - 8px)"},label:this.getText(this.props.schema.label),value:l||"",onClick:()=>!this.props.schema.readOnly&&this.setState({showColorDialog:!0,colorDialogValue:l||""}),onChange:s=>{const c=s.target.value,d=this.onChange(this.props.attr,c);d instanceof Promise&&d.catch(o=>console.error(`Cannot set value: ${o}`))},slotProps:{htmlInput:{style:{backgroundColor:l,color:v?"#FFF":"#000"},readOnly:this.props.schema.readOnly||!1},input:{endAdornment:!this.props.schema.readOnly&&l&&!this.props.schema.noClearButton?M.createElement(N.IconButton,{tabIndex:-1,size:"small",onClick:s=>{s.stopPropagation();const c=this.onChange(this.props.attr,"");c instanceof Promise&&c.catch(d=>console.error(`Cannot set value: ${d}`))}},M.createElement(Z.Close,null)):void 0},inputLabel:{shrink:!0}}}))}}const gn={width:{width:"calc(100% - 85px)"},width50:{width:120,marginRight:5}};class zs extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n});const i={};this.props.schema.useSystemName&&(i.useSystem=!!K.getValue(this.props.data,this.props.schema.useSystemName)),this.props.schema.longitudeName&&this.props.schema.latitudeName?(i.longitude=K.getValue(this.props.data,this.props.schema.longitudeName),i.latitude=K.getValue(this.props.data,this.props.schema.latitudeName),!i.longitude&&!i.latitude&&this.props.schema.autoInit&&setTimeout(()=>this.getCoordinates(),300)):!K.getValue(this.props.data,this.props.attr)&&this.props.schema.autoInit&&setTimeout(()=>this.getCoordinates(),300),Object.keys(i).length&&setTimeout(()=>this.setState(i),50)}async getSystemCoordinates(){const n=await this.props.oContext.socket.getCompactSystemConfig();if(n!=null&&n.common&&(n.common.longitude||n.common.latitude))if(window.alert(j.I18n.t("ra_Used system settings")),this.props.schema.longitudeName&&this.props.schema.latitudeName)this.setState({longitude:n.common.longitude,latitude:n.common.latitude},async()=>{await this.onChange(this.props.schema.longitudeName,n.common.longitude),await this.onChange(this.props.schema.latitudeName,n.common.latitude)});else{const i=n.common.latitude+(this.props.schema.divider||",")+n.common.longitude;this.setState({value:i},()=>{const l=this.onChange(this.props.attr,i);l instanceof Promise&&l.catch(v=>console.error(`Cannot set value: ${v}`))})}else window.alert(j.I18n.t("ra_Cannot determine position: System settings are empty and GPS detection is disabled in browser"))}getCoordinates(){navigator.geolocation?navigator.geolocation.getCurrentPosition(async n=>{if(n!=null&&n.coords)if(this.props.schema.longitudeName&&this.props.schema.latitudeName)this.setState({longitude:n.coords.longitude,latitude:n.coords.latitude},async()=>{await this.onChange(this.props.schema.longitudeName,n.coords.longitude||""),await this.onChange(this.props.schema.latitudeName,n.coords.latitude||"")});else{const i=n.coords.latitude+(this.props.schema.divider||",")+n.coords.longitude;this.setState({value:i},()=>{const l=this.onChange(this.props.attr,i);l instanceof Promise&&l.catch(v=>console.error(`Cannot set value: ${v}`))})}else await this.getSystemCoordinates()},async n=>{console.error(`Cannot determine coordinates from browser: ${n.message}`),await this.getSystemCoordinates()}):this.getSystemCoordinates().catch(n=>{console.error(`Cannot determine coordinates: ${n}`)})}renderItem(n,i){return M.createElement(M.Fragment,null,this.props.schema.useSystemName?M.createElement(N.FormControlLabel,{control:M.createElement(N.Checkbox,{checked:!!this.state.useSystem,onChange:l=>{const v=l.target.checked;v&&this.getSystemCoordinates().catch(s=>console.error(`Cannot determine coordinates: ${s}`)),this.setState({useSystem:v},()=>this.onChange(this.props.schema.useSystemName,v))}}),label:j.I18n.t("ra_Use system settings for position")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?M.createElement(N.TextField,{variant:"standard",style:gn.width50,value:this.state.longitude??"",error:!!n,disabled:this.state.useSystem||!!i,onChange:l=>{const v=l.target.value;this.setState({longitude:v},()=>{const s=this.onChange(this.props.schema.longitudeName,(v||"").trim());s instanceof Promise&&s.catch(c=>console.error(`Cannot set value: ${c}`))})},label:j.I18n.t("ra_Longitude")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?M.createElement(N.TextField,{variant:"standard",style:gn.width50,value:this.state.latitude??"",error:!!n,disabled:this.state.useSystem||!!i,onChange:l=>{const v=l.target.value;this.setState({latitude:v},()=>this.onChange(this.props.schema.latitudeName,(v||"").trim()))},label:j.I18n.t("ra_Latitude")}):null,!this.props.schema.longitudeName||!this.props.schema.latitudeName?M.createElement(N.TextField,{variant:"standard",style:gn.width,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!n,disabled:!!i,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.state.useSystem}},onChange:l=>{const v=l.target.value;this.setState({value:v},()=>this.onChange(this.props.attr,(v||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}):null,this.state.useSystem?null:M.createElement(N.Fab,{size:"small",onClick:()=>this.getCoordinates(),title:j.I18n.t("ra_Take browser position"),style:{marginRight:4}},M.createElement(Z.LocationOn,null)),this.state.useSystem?null:M.createElement(N.Fab,{size:"small",onClick:()=>this.getSystemCoordinates(),title:j.I18n.t("ra_Take position from system settings")},M.createElement(Z.GpsFixed,null)))}}Sn.init({name:"iobroker_admin",shared:{"@iobroker/adapter-react-v5":{lib:()=>ts,version:"*"},"@mui/icons-material":{lib:()=>es,version:"*"},"@iobroker/json-config":{lib:()=>os,version:"*"}},remotes:[]});class _t extends K{static runningLoads={};constructor(n){super(n),Object.assign(this.state,{Component:null,error:""})}async componentDidMount(){if(!this.props.schema.url){console.error("URL is empty. Cannot load custom component!"),this.setState({error:"URL is empty. Cannot load custom component!"});return}let n;this.props.schema.url.startsWith("http:")||this.props.schema.url.startsWith("https:")?n=this.props.schema.url:this.props.schema.url.startsWith("./")?n=`${window.location.protocol}//${window.location.host}${this.props.schema.url.replace(/^\./,"")}`:n=`${window.location.protocol}//${window.location.host}/adapter/${this.props.oContext.adapterName}/${this.props.schema.url}`;const[i,l,...v]=this.props.schema.name.split("/"),s=v.join("/");if(!n){console.error('Cannot find URL for custom component! Please define "url" as "custom/customComponents.js" in the schema');return}if(!i||!l||!s){console.error('Invalid format of "name"! Please define "name" as "ConfigCustomBackItUpSet/Components/AdapterExist" in the schema');return}let c=_t.runningLoads[`${n}!${l}`];if(!(c instanceof Promise)){let d;if(this.props.schema.i18n===!0){const o=n.lastIndexOf("/");let p;o!==-1?p=n.substring(0,o):p=n;const e=j.I18n.getLanguage(),t=`${p}/i18n/${e}.json`;d=fetch(t).then(r=>r.json()).then(r=>j.I18n.extendTranslations(r,e)).catch(r=>{if(e!=="en"){fetch(`${p}/i18n/en.json`).then(h=>h.json()).then(h=>j.I18n.extendTranslations(h,e)).catch(h=>console.log(`Cannot load i18n "${t}": ${h}`));return}console.log(`Cannot load i18n "${t}": ${r}`)})}else if(this.props.schema.i18n&&typeof this.props.schema.i18n=="object")try{j.I18n.extendTranslations(this.props.schema.i18n)}catch(o){console.error(`Cannot import i18n: ${o}`)}try{console.log(n,i,l,s),Sn.registerRemotes([{name:i,entry:n,type:this.props.schema.bundlerType||void 0}]),c=Sn.loadRemote(`${i}/${l}`),d instanceof Promise&&(c=Promise.all([c,d]).then(o=>o[0])),_t.runningLoads[`${n}!${l}`]=c}catch(o){console.error(o),this.setState({error:`Cannot import from ${this.props.schema.url}: ${o}`})}}try{const d=(await c).default;if(d!=null&&d[s])this.setState({Component:d[s]});else{const o=Object.keys(d||{});console.error("URL is empty. Cannot load custom component!"),this.setState({error:`Component ${this.props.schema.name} not found in ${this.props.schema.url}. Found: ${o.join(", ")}`})}}catch(d){console.error(d),this.setState({error:`Cannot import from ${this.props.schema.url}: ${d}`})}}render(){const n=this.state.Component,i=this.props.schema||{},l=n?M.createElement(n,{...this.props,socket:this.props.oContext.socket,theme:this.props.oContext.theme,themeType:this.props.oContext.themeType,instance:this.props.oContext.instance,adapterName:this.props.oContext.adapterName,systemConfig:this.props.oContext.systemConfig,forceUpdate:this.props.oContext.forceUpdate}):this.state.error?M.createElement("div",null,this.state.error):M.createElement(N.LinearProgress,null);return i.newLine?M.createElement(M.Fragment,null,M.createElement("div",{style:{flexBasis:"100%",height:0}}),l):l}}class Hs extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n})}renderItem(n,i){return M.createElement(ki.DatePicker,{sx:l=>({width:"100%",borderBottom:`1px solid ${l.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${l.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:"translate(0px, -9px) scale(0.75)"}}),format:this.props.oContext.systemConfig.dateFormat.toLowerCase().replace("mm","MM"),disabled:!!i,value:this.state.value,onChange:l=>{this.setState({value:l},()=>this.onChange(this.props.attr,this.state.value))},label:this.getText(this.props.schema.label)})}}class js extends K{renderItem(){if(!this.props.schema)return null;if(this.props.oContext.DeviceManager){const i=this.props.oContext.DeviceManager;return M.createElement(i,{uploadImagesToInstance:`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,title:this.getText(this.props.schema.label),socket:this.props.oContext.socket,selectedInstance:`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,themeName:this.props.themeName,theme:this.props.oContext.theme,themeType:this.props.oContext.themeType,isFloatComma:this.props.oContext.isFloatComma,dateFormat:this.props.oContext.dateFormat})}return M.createElement("div",null,"DeviceManager not found")}}const Re={fullWidth:{width:"100%"},uploadDiv:{position:"relative",width:"100%"},uploadDivDragging:{opacity:1,background:"rgba(128,255,128,0.1)"},uploadCenterDiv:{margin:5,border:"3px dashed grey",borderRadius:5,width:"100%",height:"100%",position:"absolute",display:"flex"},uploadCenterIcon:{paddingTop:10,width:48,height:48},uploadCenterText:{fontSize:16},uploadCenterTextAndIcon:{textAlign:"center",position:"absolute",top:0,bottom:0,left:0,right:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},disabledOpacity:{opacity:.3,cursor:"default"},error:{border:"2px solid red"},deleteButton:{},selectedImage:{height:40,width:40,display:"inline-block",marginRight:8}},Vs=["jpg","jpeg","svg","png","webp","gif","apng","avif","webp"],Us=["mp3","ogg","wav","aac"],Gs=["avi","mp4","mov"],Ks=["txt","log","html","htm"],Js=["json","js","ts"];class en extends K{dropzoneRef;imagePrefix;objectID;path;constructor(n){super(n),this.dropzoneRef=M.createRef(),this.imagePrefix=this.props.oContext.imagePrefix===void 0?"./files":this.props.oContext.imagePrefix}componentDidMount(){super.componentDidMount(),this.objectID=(this.props.schema.objectID||"0_userdata.0").replace("%INSTANCE%",(this.props.oContext.instance||0).toString()),this.path=this.props.schema.upload,this.path&&(this.path==="/"?this.path="":this.path.endsWith("/")||(this.path=`${this.path}/`)),this.updateFiles().then(()=>{const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n}),this.props.oContext.socket.subscribeFiles(this.objectID,`${this.path}/*`,this.onFolderChanged).catch(i=>console.error(`Cannot subscribe: ${i}`))})}onFolderChanged=(n,i)=>{this.path&&i.startsWith(this.path)&&this.updateFiles().catch(l=>console.error(`Cannot update files: ${l}`))};componentWillUnmount(){this.props.oContext.socket.subscribeFiles(this.objectID,`${this.path}/*`,this.onFolderChanged).catch(n=>console.error(`Cannot subscribe: ${n}`)),super.componentWillUnmount()}async updateFiles(){const n=await this.readFiles(this.props.schema.pattern);await new Promise(i=>this.setState({files:n},i))}async readFolder(n,i,l){try{const v=await this.props.oContext.socket.readDir(this.objectID,n.replace(/^\//,"")||null);for(let s=0;s<v.length;s++){const c=v[s];if(c.isDir)await this.readFolder(`${n+c.file}/`,i,l);else{let d=!1;l==="*.*"&&c.file.includes(".")||!l||l==="*"||l===".*"&&c.file.startsWith(".")?d=!0:d=new RegExp(`^${l.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(c.file),d&&i.push({name:n+c.file,size:c.stats?j.Utils.formatBytes(c.stats.size):"--"})}}}catch(v){console.error(`Cannot read "${n}": ${v}`)}return i}async readFiles(n){const i=[];n=n||this.props.schema.pattern,n||(n="**/*.*");let l;const v=n.lastIndexOf("/");if(v===-1?l=n:l=n.substring(v+1),n.startsWith("**"))await this.readFolder("/",i,l);else{const s=n.lastIndexOf("/");if(s===-1)await this.readFolder("/",i,l);else{const c=n.substring(0,s+1);await this.readFolder(c,i,l)}}return i}onDrop(n){const i=n[0],l=new FileReader,v=this.props.schema.maxSize||2*1024*1024;l.onabort=()=>console.log("file reading was aborted"),l.onerror=()=>console.log("file reading has failed"),l.onload=()=>{if(i.size>v){window.alert(j.I18n.t("File is too big. Max %sk allowed. Try use SVG.",Math.round(v/1024)));return}this.props.oContext.socket.writeFile64(this.objectID,this.path+i.name,l.result).then(()=>this.updateFiles()).then(()=>this.setState({value:this.path+i.name},()=>this.onChange(this.props.attr,this.path+i.name))).catch(s=>window.alert(`Cannot upload file: ${s}`))},l.readAsArrayBuffer(i)}renderDeleteDialog(){return this.state.deleteFile?M.createElement(j.DialogConfirm,{title:j.I18n.t("ra_Are you sure?"),text:j.I18n.t("ra_File will be deleted"),ok:j.I18n.t("ra_Delete"),cancel:j.I18n.t("ra_Cancel"),onClose:n=>{const i=this.state.deleteFile;this.setState({deleteFile:""},()=>{n&&this.props.oContext.socket.deleteFile(this.objectID,i).then(()=>this.updateFiles()).catch(l=>window.alert(`Cannot delete file: ${l}`))})}}):null}static base64ToArrayBuffer(n){const i=window.atob(n),l=i.length,v=new Uint8Array(l);for(let s=0;s<l;s++)v[s]=i.charCodeAt(s);return v.buffer}loadFile(){return this.props.oContext.socket.readFile(this.objectID,this.state.value,!0)}play(){this.loadFile().then(n=>{if(typeof AudioContext<"u"){const i=new AudioContext,l=en.base64ToArrayBuffer(n.file);i.decodeAudioData(l,v=>{const s=i.createBufferSource();s.buffer=v,s.connect(i.destination),s.start(0)},v=>window.alert(`Cannot play: ${v.message}`))}})}getFileIcon(n){return n!=null&&n.extension?Vs.includes(n.extension)?M.createElement("div",{style:{...Re.selectedImage,backgroundImage:`url(${this.imagePrefix}/${this.objectID}/${n.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"}}):Us.includes(n.extension)?M.createElement(Z.MusicNote,null):Ks.includes(n.extension)?M.createElement(Z.Article,null):Gs.includes(n.extension)?M.createElement(Z.Videocam,null):Js.includes(n.extension)?M.createElement(Z.Code,null):null:null}renderItem(n,i){if(!this.state.files)return null;const l=[];this.props.schema.withFolder||this.state.files.forEach(e=>{const t=e.name.lastIndexOf("/");if(t===-1)l.includes("/")||l.push("/");else{const r=e.name.substring(0,t+1);l.includes(r)||l.push(r)}});const v=this.state.files.map(e=>({value:e.name,label:!this.props.schema.withFolder&&l.length===1?`${e.name.substring(l[0].length)}`:`${e.name}${this.props.schema.noSize?"":`(${e.size})`}`,extension:e.name.toLowerCase().split(".").pop()}));this.props.schema.noNone||v.unshift({label:j.I18n.t("ra_none"),value:""});const s=v.find(e=>e.value===this.state.value);let c=0;this.props.schema.upload&&c++,this.props.schema.refresh&&c++;const d=this.state.value&&(this.state.value.endsWith(".mp3")||this.state.value.endsWith(".ogg")||this.state.value.endsWith(".wav"));d&&c++;const o=M.createElement("div",{style:Re.fullWidth},M.createElement(N.FormControl,{variant:"standard",style:{width:`calc(100% - ${c*42}px)`}},this.props.schema.label?M.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,M.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:this.state.value||"_",renderValue:()=>M.createElement(M.Fragment,null,this.getFileIcon(s),M.createElement("span",null,(s==null?void 0:s.label)||"")),onChange:e=>{this.setState({value:e.target.value==="_"?"":e.target.value},()=>this.onChange(this.props.attr,this.state.value))}},v.map(e=>M.createElement(N.MenuItem,{key:e.value,value:e.value},M.createElement(N.ListItemIcon,null,this.getFileIcon(e)),M.createElement(N.ListItemText,null,e.label),this.props.schema.delete&&s.value?M.createElement(N.IconButton,{style:Re.deleteButton,size:"small",onClick:()=>this.setState({deleteFile:s.value})},M.createElement(Z.Delete,null)):null))),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null),this.props.schema.refresh&&M.createElement(N.IconButton,{onClick:()=>this.updateFiles()},M.createElement(Z.Refresh,null)),this.props.schema.upload&&M.createElement(N.IconButton,{onClick:()=>{var e;return(e=this.dropzoneRef.current)==null?void 0:e.open()}},M.createElement(Z.UploadFile,null)),d&&M.createElement(N.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},M.createElement(Z.PlayArrow,null)));if(!this.props.schema.upload)return M.createElement(M.Fragment,null,o,this.renderDeleteDialog());let p={"*/*":[]};if(this.props.schema.fileTypes==="image"?p={"image/*":[".png",".jpg",".svg",".gif",".apng",".avif",".webp"]}:this.props.schema.fileTypes==="audio"?p={"audio/*":[".mp3",".ogg",".wav",".mp4"]}:this.props.schema.fileTypes==="text"&&(p={"text/plain":[".txt"]}),this.props.schema.pattern){const e=this.props.schema.pattern.split("/").pop().toLowerCase().replace(/.*\./,"");e==="png"||e==="jpg"||e==="svg"||e==="gif"||e==="apng"||e==="avif"||e==="webp"?p={"image/*":[".png",".jpg",".svg",".gif",".apng",".avif",".webp"]}:e==="mp3"||e==="ogg"||e==="wav"?p={"audio/*":[".mp3",".ogg",".wav",".mp4"]}:e==="ics"?p={"text/calendar":[".ics"]}:e==="txt"?p={"text/plain":[".txt"]}:e==="pem"?p={"text/plain":[".pem"]}:p={"*/*":[`.${e}`]}}return M.createElement(_i,{ref:this.dropzoneRef,multiple:!1,accept:p,noKeyboard:!0,noClick:!0,maxSize:this.props.schema.maxSize||2*1024*1024,onDragEnter:()=>{this.setState({uploadFile:"dragging"})},onDragLeave:()=>this.setState({uploadFile:!0}),onDrop:(e,t)=>{var r,h,a;this.setState({uploadFile:!1}),e.length?this.onDrop(e):window.alert(((a=(h=(r=t==null?void 0:t[0])==null?void 0:r.errors)==null?void 0:h[0])==null?void 0:a.message)||j.I18n.t("Cannot upload"))}},({getRootProps:e,getInputProps:t})=>M.createElement("div",{style:{...Re.uploadDiv,...this.state.uploadFile==="dragging"?Re.uploadDivDragging:void 0,...i?Re.disabledOpacity:void 0},...e()},M.createElement("input",{...t()}),this.state.uploadFile==="dragging"?M.createElement("div",{style:{...Re.uploadCenterDiv,...this.state.uploadError?Re.error:void 0}},M.createElement("div",{style:Re.uploadCenterTextAndIcon},M.createElement(Z.UploadFile,{style:Re.uploadCenterIcon}),M.createElement("div",{style:Re.uploadCenterText},this.state.uploadFile==="dragging"?j.I18n.t("ra_Drop file here"):j.I18n.t("ra_Place your files here or click here to open the browse dialog")))):null,o,this.renderDeleteDialog()))}}const jt={fullWidth:{width:"100%"},fullWidthOneButton:{width:"calc(100% - 69px)",marginRight:4},fullWidthIcon:{width:"calc(100% - 119px)",marginRight:4},selectedImage:{height:40,width:40,display:"inline-block",marginRight:8}},Ys=["jpg","jpeg","svg","png","webp","gif","apng","avif","webp"],Qs=["mp3","ogg","wav","aac"],Zs=["avi","mp4","mov"],Xs=["txt","log","html","htm"],qs=["json","js","ts"];class eo extends K{imagePrefix="../..";componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.imagePrefix=this.props.oContext.imagePrefix===void 0?"./files":this.props.oContext.imagePrefix,this.setState({value:n??""})}static getDerivedStateFromProps(n,i){const l=K.getValue(n.data,n.attr);return l==null||l.toString().trim()!==(i.value||"").toString().trim()?{value:l??""}:null}loadFile(){const n=this.state.value.indexOf("/");if(n!==-1){const i=this.state.value.substring(0,n),l=this.state.value.substring(n+1);return this.props.oContext.socket.readFile(i,l,!0)}return Promise.resolve(null)}play(){this.loadFile().then(n=>{if(typeof AudioContext<"u"&&(n!=null&&n.file)){const i=new AudioContext,l=en.base64ToArrayBuffer(n.file);i.decodeAudioData(l,v=>{const s=i.createBufferSource();s.buffer=v,s.connect(i.destination),s.start(0)},v=>window.alert(`Cannot play: ${v.message}`))}})}getIcon(){const n=this.state.value.split(".").pop().toLowerCase();return Ys.includes(n)?M.createElement("div",{style:{...jt.selectedImage,backgroundImage:`url(${this.imagePrefix}/${this.state.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"}}):Qs.includes(n)?M.createElement(N.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},M.createElement(Z.PlayArrow,null)):Xs.includes(n)?M.createElement(Z.Article,null):Zs.includes(n)?M.createElement(Z.Videocam,null):qs.includes(n)?M.createElement(Z.Code,null):null}renderFileBrowser(){return this.state.showFileBrowser?M.createElement(j.DialogSelectFile,{imagePrefix:this.props.oContext.imagePrefix,socket:this.props.oContext.socket,selected:this.state.value,onClose:()=>this.setState({showFileBrowser:!1}),onOk:n=>{const i=Array.isArray(n)?n[0]:n;this.setState({value:i},()=>this.onChange(this.props.attr,this.props.schema.trim===!1?i:(i||"").trim()))},selectOnlyFolders:this.props.schema.selectOnlyFolders,allowUpload:this.props.schema.allowUpload,allowDownload:this.props.schema.allowDownload,allowCreateFolder:this.props.schema.allowCreateFolder,allowView:this.props.schema.allowView,showToolbar:this.props.schema.showToolbar,limitPath:this.props.schema.limitPath,theme:this.props.oContext.theme}):null}renderItem(n,i){const l=this.getIcon();return M.createElement("div",{style:jt.fullWidth},l,M.createElement(N.TextField,{variant:"standard",style:l?jt.fullWidthIcon:jt.fullWidthOneButton,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!n,disabled:!!i,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:!!this.props.schema.disableEdit}},onChange:v=>{const s=v.target.value;this.setState({value:s},()=>this.onChange(this.props.attr,this.props.schema.trim===!1?s:(s||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}),M.createElement(N.Button,{disabled:i,variant:"outlined",onClick:()=>this.setState({showFileBrowser:!0})},"..."),this.renderFileBrowser())}}class to extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.props.oContext.socket.getEnums("functions").then(i=>{const l=Object.keys(i).map(v=>({value:this.props.schema.short?v.replace("enum.functions.",""):v,label:this.getText(i[v].common.name),obj:i[v]}));this.props.schema.allowDeactivate!==!1&&l.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({value:n,selectOptions:l})})}renderItem(n,i){if(!this.state.selectOptions)return null;const l=this.state.selectOptions.find(v=>v.value===this.state.value);return M.createElement(N.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?M.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,M.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:this.state.value||"_",renderValue:()=>l?l.obj?M.createElement(j.TextWithIcon,{value:l.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):l.label:"",onChange:v=>{this.setState({value:v.target.value==="_"?"":v.target.value},()=>this.onChange(this.props.attr,this.state.value))}},this.state.selectOptions.map(v=>M.createElement(N.MenuItem,{key:v.value,value:v.value,style:v.value===K.DIFFERENT_VALUE?{opacity:.5}:{}},v.obj?M.createElement(j.TextWithIcon,{value:v.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):v.label))),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class no extends K{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getHostByIp(this.props.common.host).then(n=>{this.props.schema.listenOnAllPorts||(n=n.filter(i=>i.address!=="0.0.0.0"&&i.address!=="::")),this.props.schema.onlyIp4?n=n.filter(i=>i.family==="ipv4"):this.props.schema.onlyIp6&&(n=n.filter(i=>i.family==="ipv6")),this.props.schema.noInternal&&(n=n.filter(i=>!i.internal)),n.forEach(i=>{i.address==="0.0.0.0"?i.name=`[IPv4] 0.0.0.0 - ${j.I18n.t("ra_Listen on all IPs")}`:i.address==="::"&&(i.name=`[IPv6] :: - ${j.I18n.t("ra_Listen on all IPs")}`)}),this.setState({ips:n})}).catch(n=>console.error(n))}renderItem(n,i){var s,c;const l=K.getValue(this.props.data,this.props.attr),v=(s=this.state.ips)==null?void 0:s.find(d=>d.address===l);return M.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},this.state.ips&&this.props.schema.label?M.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.ips?M.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:l,renderValue:d=>(v==null?void 0:v.name)||d,onChange:d=>this.onChange(this.props.attr,d.target.value)},(c=this.state.ips)==null?void 0:c.map((d,o)=>M.createElement(N.MenuItem,{key:o,value:d.address},d.name))):M.createElement(N.TextField,{fullWidth:!0,variant:"standard",error:!!n,disabled:!!i,value:l,onChange:d=>this.onChange(this.props.attr,d.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class io extends K{initialized=!1;localContext;componentDidMount(){super.componentDidMount(),this.askInstance()}askInstance(){if(this.props.alive){let n=this.props.schema.data;if(n===void 0&&this.props.schema.jsonData){const i=this.getPattern(this.props.schema.jsonData,null,!0);if(i)try{n=JSON.parse(i)}catch{console.error(`Cannot parse json data: ${JSON.stringify(n)}`)}}n===void 0&&(n=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",n).then(i=>this.setState({image:i||""}))}}getContext(){const n={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(i=>n[i]=K.getValue(this.props.data,i)),JSON.stringify(n)}renderItem(){if(this.props.alive){const n=this.getContext();(n!==this.localContext||!this.initialized)&&(this.localContext=n,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}return this.state.image===void 0?null:M.createElement("img",{alt:"dynamic content",src:this.state.image,style:{width:this.props.schema.width||"100%",height:this.props.schema.height}})}}class ro extends K{index;constructor(n){super(n),this.index=Date.now()}componentDidMount(){if(super.componentDidMount(),this.props.schema.base64){const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n})}else this.props.oContext.socket.fileExists(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr).then(n=>n&&this.loadImage())}_getUrl(n){n&&(this.index=Date.now());let i=`files/${this.props.oContext.adapterName}.${this.props.oContext.instance}/${this.props.attr}?t=${this.index}`;return window.location.port==="3000"&&(i=`${window.location.protocol}//${window.location.hostname}:8081/${i}`),i}loadImage(){fetch(this._getUrl()).then(n=>n.blob()).then(n=>{const i=new FileReader;i.onload=()=>{this.setState({value:i.result})},i.readAsDataURL(n)}).catch(n=>console.error(n))}renderItem(n,i){return M.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?M.createElement(N.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,M.createElement(j.UploadImage,{error:!!n,disabled:i,accept:this.props.schema.accept,crop:this.props.schema.crop,maxSize:this.props.schema.maxSize||256*1024,icon:this.state.value||void 0,removeIconFunc:()=>this.setState({value:null},()=>{if(this.props.schema.base64){const l=this.onChange(this.props.attr,this.state.value);l instanceof Promise&&l.catch(v=>console.error(`Cannot set value: ${v}`))}else this.props.oContext.socket.deleteFile(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr).catch(l=>console.error(l))}),onChange:l=>this.setState({value:l},()=>{if(this.props.schema.base64){const v=this.onChange(this.props.attr,this.state.value);v instanceof Promise&&v.catch(s=>console.error(`Cannot set value: ${s}`))}else l.startsWith("data")&&(l=l.split(",")[1]);this.props.oContext.socket.writeFile64(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr,l).catch(v=>console.error(v))})}),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class so extends K{renderItem(){return M.createElement(j.InfoBox,{type:this.props.schema.boxType||"info",closeable:this.props.schema.closeable!==void 0?this.props.schema.closeable:!0,storeId:this.props.schema.closed!==void 0?void 0:`${!!this.props.oContext.adapterName} ${this.props.attr}`,closed:this.props.schema.closed,style:{width:"100%",...this.props.schema.style}},this.props.schema.title?M.createElement(N.Box,{component:"div",sx:{fontWeight:"bold",fontSize:"larger"}},this.getText(this.props.schema.title)):null,this.getText(this.props.schema.text))}}const si={icon:{width:20,height:20,marginRight:4}};class oo extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);let i=this.props.schema.adapter;i==="_dataSources"&&(i=void 0),this.props.oContext.socket.getAdapterInstances(i,!0).then(async l=>{this.props.schema.adapter==="_dataSources"?l=l.filter(s=>{var c;return(c=s==null?void 0:s.common)==null?void 0:c.getHistory}):this.props.schema.adapter?l=l.filter(s=>s==null?void 0:s._id.startsWith(`system.adapter.${this.props.schema.adapter}.`)):this.props.schema.adapters&&Array.isArray(this.props.schema.adapters)&&(l=l.filter(s=>{var c;return this.props.schema.adapters.includes((c=s==null?void 0:s.common)==null?void 0:c.name)})),this.props.schema.onlyEnabled&&(l=l.filter(s=>{var c;return(c=s==null?void 0:s.common)==null?void 0:c.enabled}));const v=l.map(s=>({value:this.props.schema.long?s._id:this.props.schema.short?s._id.split(".").pop():s._id.replace(/^system\.adapter\./,""),label:`${s.common.name} [${s._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${s.common.name}/${s.common.icon}`}));v.sort((s,c)=>s.value>c.value?1:s.value<c.value?-1:0),this.props.schema.allowDeactivate!==!1&&v.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.props.schema.all&&v.unshift({label:j.I18n.t("sch_all"),value:"*"}),this.setState({value:n||"",selectOptions:v}),await this.props.oContext.socket.subscribeObject(`system.adapter.${i?`${i}.`:""}*`,this.onInstancesUpdate)}).catch(l=>console.error(`Cannot get instances: ${l}`))}componentWillUnmount(){this.props.oContext.socket.unsubscribeObject("system.adapter.*",this.onInstancesUpdate).then(()=>{}),super.componentWillUnmount()}onInstancesUpdate=(n,i)=>{if(!n.match(/^system\.adapter\.[-_a-z\d]+\.\d+$/))return;const l=this.props.schema.long?n:this.props.schema.short?n.split(".").pop():n.replace(/^system\.adapter\./,""),v=this.state.selectOptions.findIndex(s=>s.value===l);if(i){if(this.props.schema.adapter==="_dataSources"&&(!i.common||!i.common.getHistory))return;if(v===-1){const s=JSON.parse(JSON.stringify(this.state.selectOptions)),c=typeof i.common.name=="object"?i.common.name[j.I18n.getLanguage()]||i.common.name.en:i.common.name;s.push({value:this.props.schema.long?i._id:this.props.schema.short?i._id.split(".").pop():i._id.replace(/^system\.adapter\./,""),label:`${c} [${i._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${c}/${i.common.icon}`}),s.sort((d,o)=>d.label>o.label?1:d.label<o.label?-1:0),this.setState({selectOptions:s})}}else if(v!==-1){const s=JSON.parse(JSON.stringify(this.state.selectOptions)),c={};this.state.value===s[v].value&&(c.value=K.NONE_VALUE),s.splice(v,1),c.selectOptions=s,this.setState(c)}};renderItem(n,i){var v;if(!this.state.selectOptions)return null;const l=(v=this.state.selectOptions)==null?void 0:v.find(s=>s.value===this.state.value);return M.createElement(N.FormControl,{fullWidth:!0,key:this.props.attr,variant:"standard"},this.props.schema.label?M.createElement(N.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,M.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:this.state.value,renderValue:()=>M.createElement("span",{style:{display:"flex"}},l!=null&&l.icon?M.createElement("img",{src:`./${l.icon}`,alt:l.value,style:si.icon}):null,this.getText(l==null?void 0:l.label,!0)),onChange:s=>this.setState({value:s.target.value},()=>this.onChange(this.props.attr,this.state.value))},this.state.selectOptions.map(s=>M.createElement(N.MenuItem,{key:s.value,value:s.value,style:s.value===K.NONE_VALUE?{opacity:.5}:{}},s.icon?M.createElement("img",{src:`./${s.icon}`,alt:s.value,style:si.icon}):null,this.getText(s.label,!0)))),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const oi={address:{fontSize:"smaller",opacity:.5,marginLeft:8}};class ao extends K{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getObject(`system.host.${this.props.common.host}`).then(n=>{var l,v;const i=[];if((v=(l=n==null?void 0:n.native)==null?void 0:l.hardware)!=null&&v.networkInterfaces){const s=n.native.hardware.networkInterfaces;Object.keys(s).forEach(c=>{if(this.props.schema.ignoreInternal&&!s[c].find(o=>!o.internal)||this.props.schema.ignoreLoopback&&s[c].find(o=>o.address==="127.0.0.1"||o.address==="::1"))return;let d=s[c].find(o=>o.family==="IPv4");d=d||s[c].find(o=>o.family==="IPv6"),i.push({value:c,address:d.address})})}this.setState({interfaces:i})}).catch(n=>window.alert(`Cannot read interfaces: ${n}`))}renderItem(n,i){var s,c,d;const l=K.getValue(this.props.data,this.props.attr),v=(s=this.state.interfaces)==null?void 0:s.find(o=>o.value===l);return M.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},(c=this.state.interfaces)!=null&&c.length&&this.props.schema.label?M.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,(d=this.state.interfaces)!=null&&d.length?M.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:l,renderValue:o=>v?M.createElement("span",null,v.value,M.createElement("span",{style:oi.address},v.address)):o,onChange:o=>this.onChange(this.props.attr,o.target.value)},this.state.interfaces.map((o,p)=>M.createElement(N.MenuItem,{key:p,value:o.value},M.createElement("span",null,o.value,M.createElement("span",{style:oi.address},o.address))))):M.createElement(N.TextField,{fullWidth:!0,variant:"standard",error:!!n,disabled:!!i,value:l,onChange:o=>this.onChange(this.props.attr,o.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const vt={modalDialog:{minWidth:400,maxWidth:800},overflowHidden:{display:"flex",overflow:"hidden"},titleIcon:{marginRight:5},content:{fontSize:16},languageButton:{position:"absolute",right:8,top:8},languageButtonActive:{color:"primary.main"}},lo=({toggleTranslation:L,noTranslation:n,title:i,fullWidth:l,help:v,maxWidth:s,progress:c,icon:d,applyDisabled:o,applyButton:p,onClose:e,children:t,titleButtonApply:r,titleButtonClose:h,onApply:a,textInput:u,defaultValue:f,overflowHidden:m})=>{const[y,x]=qe.useState(f);qe.useEffect(()=>{x(f)},[f]);let E=null;return d&&(E=d),M.createElement(N.Dialog,{open:!0,maxWidth:s||"md",fullWidth:!!l,disableEscapeKeyDown:!1,onClose:e,sx:{"& .MuiPaper-root":vt.modalDialog}},i&&M.createElement(N.DialogTitle,null,d?M.createElement(E,{style:vt.titleIcon}):null,i,j.I18n.getLanguage()!=="en"&&L?M.createElement(N.IconButton,{size:"large",style:{...vt.languageButton,...n?vt.languageButtonActive:{}},onClick:()=>L(),title:j.I18n.t("Disable/Enable translation")},M.createElement(Z.Language,null)):null),M.createElement(N.DialogContent,{sx:{...m?vt.overflowHidden:{},...vt.content},style:{paddingTop:8}},u&&M.createElement(N.TextField,{autoComplete:"off",fullWidth:!0,autoFocus:!0,variant:"outlined",size:"medium",multiline:!0,value:y,onChange:b=>x(b.target.value)}),t,v?M.createElement("div",null,v):null),M.createElement(N.DialogActions,null,p!==!1&&M.createElement(N.Button,{startIcon:M.createElement(Z.Check,null),disabled:c||o&&f===y,onClick:()=>a&&a(u?y:""),variant:"contained",color:"primary"},j.I18n.t(r||"Ok")),M.createElement(N.Button,{color:"grey",onClick:()=>e&&e(),disabled:c,variant:"contained",startIcon:M.createElement(Z.Close,null)},j.I18n.t(h||"Cancel"))))};var wt={},ut={},Fi={exports:{}};(function(L,n){(function(){var i="ace",l=function(){return this}();!l&&typeof window<"u"&&(l=window);var v=function(e,t,r){if(typeof e!="string"){v.original?v.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(r=t),v.modules[e]||(v.payloads[e]=r,v.modules[e]=null)};v.modules={},v.payloads={};var s=function(e,t,r){if(typeof t=="string"){var h=o(e,t);if(h!=null)return r&&r(),h}else if(Object.prototype.toString.call(t)==="[object Array]"){for(var a=[],u=0,f=t.length;u<f;++u){var m=o(e,t[u]);if(m==null&&c.original)return;a.push(m)}return r&&r.apply(null,a)||!0}},c=function(e,t){var r=s("",e,t);return r==null&&c.original?c.original.apply(this,arguments):r},d=function(e,t){if(t.indexOf("!")!==-1){var r=t.split("!");return d(e,r[0])+"!"+d(e,r[1])}if(t.charAt(0)=="."){var h=e.split("/").slice(0,-1).join("/");for(t=h+"/"+t;t.indexOf(".")!==-1&&a!=t;){var a=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return t},o=function(e,t){t=d(e,t);var r=v.modules[t];if(!r){if(r=v.payloads[t],typeof r=="function"){var h={},a={id:t,uri:"",exports:h,packaged:!0},u=function(m,y){return s(t,m,y)},f=r(u,h,a);h=f||a.exports,v.modules[t]=h,delete v.payloads[t]}r=v.modules[t]=h||r}return r};function p(e){var t=l;l[e]||(l[e]={}),t=l[e],(!t.define||!t.define.packaged)&&(v.original=t.define,t.define=v,t.define.packaged=!0),(!t.require||!t.require.packaged)&&(c.original=t.require,t.require=c,t.require.packaged=!0)}p(i)})(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(i,l,v){function s(c,d,o){Object.defineProperty(c,d,{value:o,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||s(String.prototype,"startsWith",function(c,d){return d=d||0,this.lastIndexOf(c,d)===d}),String.prototype.endsWith||s(String.prototype,"endsWith",function(c,d){var o=this;(d===void 0||d>o.length)&&(d=o.length),d-=c.length;var p=o.indexOf(c,d);return p!==-1&&p===d}),String.prototype.repeat||s(String.prototype,"repeat",function(c){for(var d="",o=this;c>0;)c&1&&(d+=o),(c>>=1)&&(o+=o);return d}),String.prototype.includes||s(String.prototype,"includes",function(c,d){return this.indexOf(c,d)!=-1}),Object.assign||(Object.assign=function(c){if(c==null)throw new TypeError("Cannot convert undefined or null to object");for(var d=Object(c),o=1;o<arguments.length;o++){var p=arguments[o];p!=null&&Object.keys(p).forEach(function(e){d[e]=p[e]})}return d}),Object.values||(Object.values=function(c){return Object.keys(c).map(function(d){return c[d]})}),Array.prototype.find||s(Array.prototype,"find",function(c){for(var d=this.length,o=arguments[1],p=0;p<d;p++){var e=this[p];if(c.call(o,e,p,this))return e}}),Array.prototype.findIndex||s(Array.prototype,"findIndex",function(c){for(var d=this.length,o=arguments[1],p=0;p<d;p++){var e=this[p];if(c.call(o,e,p,this))return p}}),Array.prototype.includes||s(Array.prototype,"includes",function(c,d){return this.indexOf(c,d)!=-1}),Array.prototype.fill||s(Array.prototype,"fill",function(c){for(var d=this,o=d.length>>>0,p=arguments[1],e=p>>0,t=e<0?Math.max(o+e,0):Math.min(e,o),r=arguments[2],h=r===void 0?o:r>>0,a=h<0?Math.max(o+h,0):Math.min(h,o);t<a;)d[t]=c,t++;return d}),Array.of||s(Array,"of",function(){return Array.prototype.slice.call(arguments)})}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(i,l,v){i("./es6-shim")}),ace.define("ace/lib/deep_copy",["require","exports","module"],function(i,l,v){l.deepCopy=function s(c){if(typeof c!="object"||!c)return c;var d;if(Array.isArray(c)){d=[];for(var o=0;o<c.length;o++)d[o]=s(c[o]);return d}if(Object.prototype.toString.call(c)!=="[object Object]")return c;d={};for(var o in c)d[o]=s(c[o]);return d}}),ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],function(i,l,v){l.last=function(d){return d[d.length-1]},l.stringReverse=function(d){return d.split("").reverse().join("")},l.stringRepeat=function(d,o){for(var p="";o>0;)o&1&&(p+=d),(o>>=1)&&(d+=d);return p};var s=/^\s\s*/,c=/\s\s*$/;l.stringTrimLeft=function(d){return d.replace(s,"")},l.stringTrimRight=function(d){return d.replace(c,"")},l.copyObject=function(d){var o={};for(var p in d)o[p]=d[p];return o},l.copyArray=function(d){for(var o=[],p=0,e=d.length;p<e;p++)d[p]&&typeof d[p]=="object"?o[p]=this.copyObject(d[p]):o[p]=d[p];return o},l.deepCopy=i("./deep_copy").deepCopy,l.arrayToMap=function(d){for(var o={},p=0;p<d.length;p++)o[d[p]]=1;return o},l.createMap=function(d){var o=Object.create(null);for(var p in d)o[p]=d[p];return o},l.arrayRemove=function(d,o){for(var p=0;p<=d.length;p++)o===d[p]&&d.splice(p,1)},l.escapeRegExp=function(d){return d.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},l.escapeHTML=function(d){return(""+d).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},l.getMatchOffsets=function(d,o){var p=[];return d.replace(o,function(e){p.push({offset:arguments[arguments.length-2],length:e.length})}),p},l.deferredCall=function(d){var o=null,p=function(){o=null,d()},e=function(t){return e.cancel(),o=setTimeout(p,t||0),e};return e.schedule=e,e.call=function(){return this.cancel(),d(),e},e.cancel=function(){return clearTimeout(o),o=null,e},e.isPending=function(){return o},e},l.delayedCall=function(d,o){var p=null,e=function(){p=null,d()},t=function(r){p==null&&(p=setTimeout(e,r||o))};return t.delay=function(r){p&&clearTimeout(p),p=setTimeout(e,r||o)},t.schedule=t,t.call=function(){this.cancel(),d()},t.cancel=function(){p&&clearTimeout(p),p=null},t.isPending=function(){return p},t},l.supportsLookbehind=function(){try{new RegExp("(?<=.)")}catch{return!1}return!0},l.skipEmptyMatch=function(d,o,p){return p&&d.codePointAt(o)>65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(i,l,v){l.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},l.getOS=function(){return l.isMac?l.OS.MAC:l.isLinux?l.OS.LINUX:l.OS.WINDOWS};var s=typeof navigator=="object"?navigator:{},c=(/mac|win|linux/i.exec(s.platform)||["other"])[0].toLowerCase(),d=s.userAgent||"",o=s.appName||"";l.isWin=c=="win",l.isMac=c=="mac",l.isLinux=c=="linux",l.isIE=o=="Microsoft Internet Explorer"||o.indexOf("MSAppHost")>=0?parseFloat((d.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((d.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),l.isOldIE=l.isIE&&l.isIE<9,l.isGecko=l.isMozilla=d.match(/ Gecko\/\d+/),l.isOpera=typeof opera=="object"&&Object.prototype.toString.call(window.opera)=="[object Opera]",l.isWebKit=parseFloat(d.split("WebKit/")[1])||void 0,l.isChrome=parseFloat(d.split(" Chrome/")[1])||void 0,l.isSafari=parseFloat(d.split(" Safari/")[1])&&!l.isChrome||void 0,l.isEdge=parseFloat(d.split(" Edge/")[1])||void 0,l.isAIR=d.indexOf("AdobeAIR")>=0,l.isAndroid=d.indexOf("Android")>=0,l.isChromeOS=d.indexOf(" CrOS ")>=0,l.isIOS=/iPad|iPhone|iPod/.test(d)&&!window.MSStream,l.isIOS&&(l.isMac=!0),l.isMobile=l.isIOS||l.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(i,l,v){var s=i("./useragent"),c="http://www.w3.org/1999/xhtml";l.buildDom=function r(h,a,u){if(typeof h=="string"&&h){var f=document.createTextNode(h);return a&&a.appendChild(f),f}if(!Array.isArray(h))return h&&h.appendChild&&a&&a.appendChild(h),h;if(typeof h[0]!="string"||!h[0]){for(var m=[],y=0;y<h.length;y++){var x=r(h[y],a,u);x&&m.push(x)}return m}var E=document.createElement(h[0]),b=h[1],g=1;b&&typeof b=="object"&&!Array.isArray(b)&&(g=2);for(var y=g;y<h.length;y++)r(h[y],E,u);return g==2&&Object.keys(b).forEach(function(S){var k=b[S];S==="class"?E.className=Array.isArray(k)?k.join(" "):k:typeof k=="function"||S=="value"||S[0]=="$"?E[S]=k:S==="ref"?u&&(u[k]=E):S==="style"?typeof k=="string"&&(E.style.cssText=k):k!=null&&E.setAttribute(S,k)}),a&&a.appendChild(E),E},l.getDocumentHead=function(r){return r||(r=document),r.head||r.getElementsByTagName("head")[0]||r.documentElement},l.createElement=function(r,h){return document.createElementNS?document.createElementNS(h||c,r):document.createElement(r)},l.removeChildren=function(r){r.innerHTML=""},l.createTextNode=function(r,h){var a=h?h.ownerDocument:document;return a.createTextNode(r)},l.createFragment=function(r){var h=r?r.ownerDocument:document;return h.createDocumentFragment()},l.hasCssClass=function(r,h){var a=(r.className+"").split(/\s+/g);return a.indexOf(h)!==-1},l.addCssClass=function(r,h){l.hasCssClass(r,h)||(r.className+=" "+h)},l.removeCssClass=function(r,h){for(var a=r.className.split(/\s+/g);;){var u=a.indexOf(h);if(u==-1)break;a.splice(u,1)}r.className=a.join(" ")},l.toggleCssClass=function(r,h){for(var a=r.className.split(/\s+/g),u=!0;;){var f=a.indexOf(h);if(f==-1)break;u=!1,a.splice(f,1)}return u&&a.push(h),r.className=a.join(" "),u},l.setCssClass=function(r,h,a){a?l.addCssClass(r,h):l.removeCssClass(r,h)},l.hasCssString=function(r,h){var a=0,u;if(h=h||document,u=h.querySelectorAll("style")){for(;a<u.length;)if(u[a++].id===r)return!0}},l.removeElementById=function(r,h){h=h||document,h.getElementById(r)&&h.getElementById(r).remove()};var d,o=[];l.useStrictCSP=function(r){d=r,r==!1?p():o||(o=[])};function p(){var r=o;o=null,r&&r.forEach(function(h){e(h[0],h[1])})}function e(r,h,a){if(!(typeof document>"u")){if(o){if(a)p();else if(a===!1)return o.push([r,h])}if(!d){var u=a;!a||!a.getRootNode?u=document:(u=a.getRootNode(),(!u||u==a)&&(u=document));var f=u.ownerDocument||u;if(h&&l.hasCssString(h,u))return null;h&&(r+=`
|
|
15
|
+
`+f+"]"}return v.pop(),s=f,y}};const bs={parse:ps,stringify:ys};var Li=bs,kn={exports:{}};function ws(L){throw new Error('Could not dynamically require "'+L+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Jt={exports:{}};const Cs={},Es=Object.freeze(Object.defineProperty({__proto__:null,default:Cs},Symbol.toStringTag,{value:"Module"})),Ss=Qr(Es);var Ds=Jt.exports,ei;function xs(){return ei||(ei=1,function(L,n){(function(i,l){L.exports=l()})(Ds,function(){var i=i||function(l,v){var s;if(typeof window<"u"&&window.crypto&&(s=window.crypto),typeof self<"u"&&self.crypto&&(s=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(s=globalThis.crypto),!s&&typeof window<"u"&&window.msCrypto&&(s=window.msCrypto),!s&&typeof ke<"u"&&ke.crypto&&(s=ke.crypto),!s&&typeof ws=="function")try{s=Ss}catch{}var c=function(){if(s){if(typeof s.getRandomValues=="function")try{return s.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof s.randomBytes=="function")try{return s.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},d=Object.create||function(){function y(){}return function(x){var E;return y.prototype=x,E=new y,y.prototype=null,E}}(),o={},p=o.lib={},e=p.Base=function(){return{extend:function(y){var x=d(this);return y&&x.mixIn(y),(!x.hasOwnProperty("init")||this.init===x.init)&&(x.init=function(){x.$super.init.apply(this,arguments)}),x.init.prototype=x,x.$super=this,x},create:function(){var y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var x in y)y.hasOwnProperty(x)&&(this[x]=y[x]);y.hasOwnProperty("toString")&&(this.toString=y.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),t=p.WordArray=e.extend({init:function(y,x){y=this.words=y||[],x!=v?this.sigBytes=x:this.sigBytes=y.length*4},toString:function(y){return(y||h).stringify(this)},concat:function(y){var x=this.words,E=y.words,w=this.sigBytes,g=y.sigBytes;if(this.clamp(),w%4)for(var S=0;S<g;S++){var k=E[S>>>2]>>>24-S%4*8&255;x[w+S>>>2]|=k<<24-(w+S)%4*8}else for(var D=0;D<g;D+=4)x[w+D>>>2]=E[D>>>2];return this.sigBytes+=g,this},clamp:function(){var y=this.words,x=this.sigBytes;y[x>>>2]&=4294967295<<32-x%4*8,y.length=l.ceil(x/4)},clone:function(){var y=e.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var x=[],E=0;E<y;E+=4)x.push(c());return new t.init(x,y)}}),r=o.enc={},h=r.Hex={stringify:function(y){for(var x=y.words,E=y.sigBytes,w=[],g=0;g<E;g++){var S=x[g>>>2]>>>24-g%4*8&255;w.push((S>>>4).toString(16)),w.push((S&15).toString(16))}return w.join("")},parse:function(y){for(var x=y.length,E=[],w=0;w<x;w+=2)E[w>>>3]|=parseInt(y.substr(w,2),16)<<24-w%8*4;return new t.init(E,x/2)}},a=r.Latin1={stringify:function(y){for(var x=y.words,E=y.sigBytes,w=[],g=0;g<E;g++){var S=x[g>>>2]>>>24-g%4*8&255;w.push(String.fromCharCode(S))}return w.join("")},parse:function(y){for(var x=y.length,E=[],w=0;w<x;w++)E[w>>>2]|=(y.charCodeAt(w)&255)<<24-w%4*8;return new t.init(E,x)}},u=r.Utf8={stringify:function(y){try{return decodeURIComponent(escape(a.stringify(y)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(y){return a.parse(unescape(encodeURIComponent(y)))}},f=p.BufferedBlockAlgorithm=e.extend({reset:function(){this._data=new t.init,this._nDataBytes=0},_append:function(y){typeof y=="string"&&(y=u.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes},_process:function(y){var x,E=this._data,w=E.words,g=E.sigBytes,S=this.blockSize,k=S*4,D=g/k;y?D=l.ceil(D):D=l.max((D|0)-this._minBufferSize,0);var _=D*S,F=l.min(_*4,g);if(_){for(var A=0;A<_;A+=S)this._doProcessBlock(w,A);x=w.splice(0,_),E.sigBytes-=F}return new t.init(x,F)},clone:function(){var y=e.clone.call(this);return y._data=this._data.clone(),y},_minBufferSize:0});p.Hasher=f.extend({cfg:e.extend(),init:function(y){this.cfg=this.cfg.extend(y),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(y){return this._append(y),this._process(),this},finalize:function(y){y&&this._append(y);var x=this._doFinalize();return x},blockSize:16,_createHelper:function(y){return function(x,E){return new y.init(E).finalize(x)}},_createHmacHelper:function(y){return function(x,E){return new m.HMAC.init(y,E).finalize(x)}}});var m=o.algo={};return o}(Math);return i})}(Jt)),Jt.exports}var As=kn.exports;(function(L,n){(function(i,l){L.exports=l(xs())})(As,function(i){return function(l){var v=i,s=v.lib,c=s.WordArray,d=s.Hasher,o=v.algo,p=[];(function(){for(var u=0;u<64;u++)p[u]=l.abs(l.sin(u+1))*4294967296|0})();var e=o.MD5=d.extend({_doReset:function(){this._hash=new c.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(u,f){for(var m=0;m<16;m++){var y=f+m,x=u[y];u[y]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360}var E=this._hash.words,w=u[f+0],g=u[f+1],S=u[f+2],k=u[f+3],D=u[f+4],_=u[f+5],F=u[f+6],A=u[f+7],$=u[f+8],C=u[f+9],b=u[f+10],T=u[f+11],I=u[f+12],O=u[f+13],N=u[f+14],P=u[f+15],B=E[0],V=E[1],W=E[2],z=E[3];B=t(B,V,W,z,w,7,p[0]),z=t(z,B,V,W,g,12,p[1]),W=t(W,z,B,V,S,17,p[2]),V=t(V,W,z,B,k,22,p[3]),B=t(B,V,W,z,D,7,p[4]),z=t(z,B,V,W,_,12,p[5]),W=t(W,z,B,V,F,17,p[6]),V=t(V,W,z,B,A,22,p[7]),B=t(B,V,W,z,$,7,p[8]),z=t(z,B,V,W,C,12,p[9]),W=t(W,z,B,V,b,17,p[10]),V=t(V,W,z,B,T,22,p[11]),B=t(B,V,W,z,I,7,p[12]),z=t(z,B,V,W,O,12,p[13]),W=t(W,z,B,V,N,17,p[14]),V=t(V,W,z,B,P,22,p[15]),B=r(B,V,W,z,g,5,p[16]),z=r(z,B,V,W,F,9,p[17]),W=r(W,z,B,V,T,14,p[18]),V=r(V,W,z,B,w,20,p[19]),B=r(B,V,W,z,_,5,p[20]),z=r(z,B,V,W,b,9,p[21]),W=r(W,z,B,V,P,14,p[22]),V=r(V,W,z,B,D,20,p[23]),B=r(B,V,W,z,C,5,p[24]),z=r(z,B,V,W,N,9,p[25]),W=r(W,z,B,V,k,14,p[26]),V=r(V,W,z,B,$,20,p[27]),B=r(B,V,W,z,O,5,p[28]),z=r(z,B,V,W,S,9,p[29]),W=r(W,z,B,V,A,14,p[30]),V=r(V,W,z,B,I,20,p[31]),B=h(B,V,W,z,_,4,p[32]),z=h(z,B,V,W,$,11,p[33]),W=h(W,z,B,V,T,16,p[34]),V=h(V,W,z,B,N,23,p[35]),B=h(B,V,W,z,g,4,p[36]),z=h(z,B,V,W,D,11,p[37]),W=h(W,z,B,V,A,16,p[38]),V=h(V,W,z,B,b,23,p[39]),B=h(B,V,W,z,O,4,p[40]),z=h(z,B,V,W,w,11,p[41]),W=h(W,z,B,V,k,16,p[42]),V=h(V,W,z,B,F,23,p[43]),B=h(B,V,W,z,C,4,p[44]),z=h(z,B,V,W,I,11,p[45]),W=h(W,z,B,V,P,16,p[46]),V=h(V,W,z,B,S,23,p[47]),B=a(B,V,W,z,w,6,p[48]),z=a(z,B,V,W,A,10,p[49]),W=a(W,z,B,V,N,15,p[50]),V=a(V,W,z,B,_,21,p[51]),B=a(B,V,W,z,I,6,p[52]),z=a(z,B,V,W,k,10,p[53]),W=a(W,z,B,V,b,15,p[54]),V=a(V,W,z,B,g,21,p[55]),B=a(B,V,W,z,$,6,p[56]),z=a(z,B,V,W,P,10,p[57]),W=a(W,z,B,V,F,15,p[58]),V=a(V,W,z,B,O,21,p[59]),B=a(B,V,W,z,D,6,p[60]),z=a(z,B,V,W,T,10,p[61]),W=a(W,z,B,V,S,15,p[62]),V=a(V,W,z,B,C,21,p[63]),E[0]=E[0]+B|0,E[1]=E[1]+V|0,E[2]=E[2]+W|0,E[3]=E[3]+z|0},_doFinalize:function(){var u=this._data,f=u.words,m=this._nDataBytes*8,y=u.sigBytes*8;f[y>>>5]|=128<<24-y%32;var x=l.floor(m/4294967296),E=m;f[(y+64>>>9<<4)+15]=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,f[(y+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,u.sigBytes=(f.length+1)*4,this._process();for(var w=this._hash,g=w.words,S=0;S<4;S++){var k=g[S];g[S]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360}return w},clone:function(){var u=d.clone.call(this);return u._hash=this._hash.clone(),u}});function t(u,f,m,y,x,E,w){var g=u+(f&m|~f&y)+x+w;return(g<<E|g>>>32-E)+f}function r(u,f,m,y,x,E,w){var g=u+(f&y|m&~y)+x+w;return(g<<E|g>>>32-E)+f}function h(u,f,m,y,x,E,w){var g=u+(f^m^y)+x+w;return(g<<E|g>>>32-E)+f}function a(u,f,m,y,x,E,w){var g=u+(m^(f|~y))+x+w;return(g<<E|g>>>32-E)+f}v.MD5=d._createHelper(e),v.HmacMD5=d._createHmacHelper(e)}(Math),i.MD5})})(kn);var $s=kn.exports;const ti=Zr($s),Ts=window.innerWidth<=600?12:void 0;function dn(L){return Object.prototype.toString.call(L)==="[object Object]"}class K extends qe.Component{static DIFFERENT_VALUE="__different__";static DIFFERENT_LABEL="ra___different__";static NONE_VALUE="";static NONE_LABEL="ra_none";defaultValue;isError;lang;defaultSendToDone;sendToTimeout;noPlaceRequired;constructor(n){super(n),this.state={confirmDialog:!1,confirmNewValue:null,confirmAttr:null,confirmData:null,confirmCallback:null},this.isError={},n.schema&&(n.custom?this.defaultValue=n.schema.defaultFunc?this.executeCustom(n.schema.defaultFunc,n.data,n.customObj,n.oContext.instanceObj,n.arrayIndex,n.globalData):n.schema.default:n.schema.type!=="state"&&(this.defaultValue=n.schema.defaultFunc?this.execute(n.schema.defaultFunc,n.schema.default,n.data,n.arrayIndex,n.globalData):n.schema.default)),this.lang=j.I18n.getLanguage()}componentDidMount(){this.props.oContext.registerOnForceUpdate&&this.props.oContext.registerOnForceUpdate(this.props.attr,this.onUpdate);const n=["select","autocomplete","autocompleteSendTo"];if(this.defaultValue!==void 0){const i=K.getValue(this.props.data,this.props.attr);(i===void 0||n.includes(this.props.schema.type)&&(i===""||i===null))&&setTimeout(()=>{this.props.custom?this.props.onChange(this.props.attr,this.defaultValue,()=>setTimeout(()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data),100)):(K.setValue(this.props.data,this.props.attr,this.defaultValue),this.props.onChange(this.props.data,void 0,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data)))},100)}else this.props.schema.defaultSendTo&&this.sendTo()}sendTo(){if(this.props.alive){this.defaultSendToDone=!0;let n=this.props.schema.data;if(n===void 0&&this.props.schema.jsonData){const i=this.getPattern(this.props.schema.jsonData,null,!0);try{n=JSON.parse(i)}catch{console.error(`Cannot parse json data: ${i}`)}}else n={attr:this.props.attr,value:K.getValue(this.props.data,this.props.attr)};n===void 0&&(n=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.defaultSendTo,n).then(i=>{i!=null&&(this.props.custom?this.props.onChange(this.props.attr,i,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data)):(K.setValue(this.props.data,this.props.attr,i),this.props.onChange(this.props.data,void 0,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data))))})}else this.defaultSendToDone=!1,this.props.schema.allowSaveWithError||this.onError(this.props.attr,j.I18n.t("ra_Instance %s is not alive",this.props.oContext.instance.toString()))}componentWillUnmount(){this.props.oContext.registerOnForceUpdate&&this.props.oContext.registerOnForceUpdate(this.props.attr),this.sendToTimeout&&(clearTimeout(this.sendToTimeout),this.sendToTimeout=null)}onUpdate=n=>{const i=K.getValue(n||this.props.data,this.props.attr)||"";this.state.value!==i?this.setState({value:i}):this.forceUpdate()};static getValue(n,i){if(typeof i=="string")return K.getValue(n,i.split("."));if(i.length===1)return n[i[0]];const l=i.shift();if(typeof l=="string"&&typeof n[l]=="object")return K.getValue(n[l],i)}static setValue(n,i,l){if(typeof i=="string"){K.setValue(n,i.split("."),l);return}if(i.length===1)l===null?delete n[i[0]]:n[i[0]]=l;else{const v=i.shift();if(typeof v!="string")return;(!n[v]||typeof n[v]=="object")&&(n[v]=n[v]||{}),K.setValue(n[v],i,l)}}getText(n,i){if(!n)return"";if(typeof n=="string"){const l=i?n:j.I18n.t(n);return l.includes("${")?this.getPattern(l,null,i):l}return dn(n)?n.func?typeof n.func=="object"?this.getPattern(n.func[this.lang]||n.func.en||"",null,!0):this.getPattern(n.func,null,i):n[this.lang]||n.en||"":n.toString()}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const n=this.state.confirmData||this.props.schema.confirm;let i=null;return n.type==="warning"?i=M.createElement(Z.Warning,null):n.type==="error"?i=M.createElement(Z.Error,null):n.type==="info"&&(i=M.createElement(Z.Info,null)),M.createElement(j.DialogConfirm,{title:this.getText(n.title)||j.I18n.t("ra_Please confirm"),text:this.getText(n.text),ok:this.getText(n.ok)||j.I18n.t("ra_Ok"),cancel:this.getText(n.cancel)||j.I18n.t("ra_Cancel"),icon:i||void 0,onClose:l=>this.setState({confirmDialog:!1},()=>{if(l){if(this.state.confirmCallback){const s=this.state.confirmCallback;this.setState({confirmCallback:null},()=>s(!0));return}const v=JSON.parse(JSON.stringify(this.props.data));this.state.confirmDepAttr&&K.setValue(v,this.state.confirmDepAttr,this.state.confirmDepNewValue),K.setValue(v,this.state.confirmAttr,this.state.confirmNewValue),this.setState({confirmDialog:!1,confirmDepAttr:null,confirmDepNewValue:null,confirmNewValue:null,confirmAttr:null,confirmData:null},()=>this.props.onChange(v))}else{const v=this.state.confirmCallback;this.setState({confirmDialog:!1,confirmDepAttr:null,confirmDepNewValue:null,confirmNewValue:null,confirmAttr:null,confirmData:null,confirmCallback:null},()=>{v&&v(!1)})}})})}getIcon(n){n=n||this.props.schema.icon;let i=null;return n==="auth"?i=M.createElement(Z.Key,null):n==="send"?i=M.createElement(Z.Send,null):n==="web"?i=M.createElement(Z.Public,null):n==="warning"?i=M.createElement(Z.Warning,null):n==="error"?i=M.createElement(Z.Error,null):n==="info"?i=M.createElement(Z.Info,null):n==="search"?i=M.createElement(Z.Search,null):n==="book"?i=M.createElement(Z.MenuBook,null):n==="help"?i=M.createElement(Z.Help,null):n==="upload"?i=M.createElement(Z.UploadFile,null):n==="edit"?i=M.createElement(Z.Edit,null):n==="user"?i=M.createElement(Z.Person,null):n==="group"?i=M.createElement(Z.Group,null):n==="delete"?i=M.createElement(Z.Delete,null):n==="refresh"?i=M.createElement(Z.Refresh,null):n==="add"?i=M.createElement(Z.Add,null):n==="unpair"?i=M.createElement(Z.LinkOff,null):n==="pair"?i=M.createElement(Z.Link,null):n==="save"?i=M.createElement(Z.Save,null):n==="open"?i=M.createElement(Z.OpenInNew,null):n&&((n.endsWith(".png")||n.endsWith(".svg")||n.endsWith(".jpg"))&&!n.startsWith("http://")&&!n.startsWith("https://")&&(n=`./adapter/${this.props.oContext.adapterName}/${n}`),i=M.createElement(j.Icon,{src:n,style:{width:22,height:22}})),i}onChangeAsync(n,i){return new Promise(l=>{const v=this.onChange(n,i,l);v instanceof Promise&&v.catch(s=>console.error(`Cannot set value: ${s}`))})}onChange(n,i,l){const v=JSON.parse(JSON.stringify(this.props.data));if(K.setValue(v,n,i),this.props.schema.confirm&&this.execute(this.props.schema.confirm.condition,!1,v,this.props.arrayIndex,this.props.globalData))return new Promise(c=>{this.setState({confirmDialog:!0,confirmNewValue:i,confirmAttr:n,confirmData:null},()=>{typeof l=="function"?l():c()})});if(this.props.schema.confirmDependsOn)for(let c=0;c<this.props.schema.confirmDependsOn.length;c++){const d=this.props.schema.confirmDependsOn[c];if(d.confirm){const o=K.getValue(v,d.attr);if(this.execute(d.confirm.condition,!1,v,this.props.arrayIndex,this.props.globalData))return new Promise(p=>{this.setState({confirmDialog:!0,confirmNewValue:i,confirmAttr:n,confirmDepNewValue:o,confirmDepAttr:d.attr,confirmData:d.confirm},()=>{typeof l=="function"?l():p()})})}}const s=[];if(this.props.schema.onChangeDependsOn)for(let c=0;c<this.props.schema.onChangeDependsOn.length;c++){const d=this.props.schema.onChangeDependsOn[c];if(d.onChange){const o=K.getValue(v,d.attr);let p;this.props.custom?p=this.executeCustom(d.onChange.calculateFunc,v,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):p=this.execute(d.onChange.calculateFunc,o,v,this.props.arrayIndex,this.props.globalData),p!==o&&(K.setValue(v,d.attr,p),s.push(d.attr))}}if(this.props.schema.hiddenDependsOn)for(let c=0;c<this.props.schema.hiddenDependsOn.length;c++){const d=this.props.schema.hiddenDependsOn[c];d.hidden&&s.push(d.attr)}if(this.props.schema.labelDependsOn)for(let c=0;c<this.props.schema.labelDependsOn.length;c++){const d=this.props.schema.labelDependsOn[c];d.hidden&&s.push(d.attr)}if(this.props.schema.helpDependsOn)for(let c=0;c<this.props.schema.helpDependsOn.length;c++){const d=this.props.schema.helpDependsOn[c];d.hidden&&s.push(d.attr)}if(this.props.schema.onChange&&!this.props.schema.onChange.ignoreOwnChanges){const c=K.getValue(v,this.props.attr),d=this.props.custom?this.executeCustom(this.props.schema.onChange.calculateFunc,v,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):this.execute(this.props.schema.onChange.calculateFunc,c,v,this.props.arrayIndex,this.props.globalData);d!==c&&K.setValue(v,this.props.attr,d)}return this.props.custom?(this.props.onChange(n,i,()=>l&&l()),s!=null&&s.length&&s.forEach((c,d)=>setTimeout(()=>this.props.onChange(c,K.getValue(v,c)),d*50))):this.props.onChange(v,void 0,()=>{s.length&&this.props.oContext.forceUpdate(s,v),l&&l()}),Promise.resolve()}execute(n,i,l,v,s){let c;if(dn(n))c=n.func;else if(typeof n=="string")c=n;else return n;if(!c)return i;try{return new Function("data","originalData","_system","_alive","_common","_socket","_instance","arrayIndex","globalData","_changed",c.includes("return")?c:`return ${c}`)(l||this.props.data,this.props.originalData,this.props.oContext.systemConfig,this.props.alive,this.props.common,this.props.oContext.socket,this.props.oContext.instance,v,s,this.props.changed)}catch(d){return console.error(`Cannot execute ${JSON.stringify(n)}: ${d}`),i}}executeCustom(n,i,l,v,s,c){let d;if(dn(n))d=n.func;else if(typeof n=="string")d=n;else return n;if(!d)return null;try{return new Function("data","originalData","_system","instanceObj","customObj","_socket","arrayIndex","globalData","_changed",d.includes("return")?d:`return ${d}`)(i||this.props.data,this.props.originalData,this.props.oContext.systemConfig,v,l,this.props.oContext.socket,s,c,this.props.changed)}catch(o){return console.error(`Cannot execute ${d}: ${o}`),null}}calculate(n){let i,l,v,s;return this.props.custom?(i=n.validator?!this.executeCustom(n.validator,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,n.disabled===!0?l=!0:l=n.disabled?this.executeCustom(n.disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,n.hidden===!0?v=!0:v=n.hidden?this.executeCustom(n.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,s=n.defaultFunc?this.executeCustom(n.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):n.default):(i=n.validator?!this.execute(n.validator,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,n.disabled===!0?l=!0:l=n.disabled?this.execute(n.disabled,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,n.hidden===!0?v=!0:v=n.hidden?this.execute(n.hidden,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,s=n.defaultFunc?this.execute(n.defaultFunc,n.default,this.props.data,this.props.arrayIndex,this.props.globalData):n.default),{error:i,disabled:l,hidden:v,defaultValue:s}}onError(n,i){i?this.isError[n]=i:delete this.isError[n],this.props.onError&&this.props.onError(n,i)}renderItem(n,i,l){return this.getText(this.props.schema.label)||this.getText(this.props.schema.text)}renderHelp(n,i,l){return i?M.createElement("a",{href:i,target:"_blank",rel:"noreferrer",style:{color:this.props.oContext.themeType==="dark"?"#a147ff":"#5b238f",textDecoration:"underline"}},this.getText(n,l)):(n=this.getText(n,l)||"",n&&(n.includes("<a ")||n.includes("<br")||n.includes("<b>")||n.includes("<i>"))?j.Utils.renderTextWithA(n):n)}static escapeString(n,i){return typeof n!="string"?"":(n=n.replace(/`/g,"\\`"),n=n.replace(/\${([^}]+)}/g,(l,v)=>{if(v&&typeof v=="string"&&v.startsWith("data.")){const s=K.getValue(i,v.replace(/^data\./,""));if(typeof s=="string"&&s.includes('"'))return`\${${v}.replace(/"/g, '\\\\"')}`}return l}),n)}getPattern(n,i,l){if(i=i||this.props.data,!n)return"";let v;typeof n=="object"?n.func?v=n.func:(console.log(`Object must be stringified: ${JSON.stringify(n)}`),v=JSON.stringify(n)):v=n;try{if(this.props.custom)return new Function("data","originalData","arrayIndex","globalData","_system","instanceObj","customObj","_socket","_changed",`return \`${K.escapeString(v,i)}\``)(i,this.props.originalData,this.props.arrayIndex,this.props.globalData,this.props.oContext.systemConfig,this.props.oContext.instanceObj,this.props.customObj,this.props.oContext.socket,this.props.changed);const c=new Function("data","originalData","arrayIndex","globalData","_system","_alive","_common","_socket","_changed",`return \`${K.escapeString(v,i)}\``)(i,this.props.originalData,this.props.arrayIndex,this.props.globalData,this.props.oContext.systemConfig,this.props.alive,this.props.common,this.props.oContext.socket,this.props.changed);return l?c:j.I18n.t(c)}catch(s){return console.error(`Cannot execute ${v}: ${s}`),v}}render(){const n=this.props.schema;if(!n||this.props.expertMode===!1&&n.expertMode)return null;this.props.alive&&this.defaultSendToDone===!1&&(this.sendToTimeout=setTimeout(()=>{this.sendToTimeout=null,this.sendTo()},200));const{error:i,disabled:l,hidden:v,defaultValue:s}=this.calculate(n);if(v){if(Object.keys(this.isError).length&&(setTimeout(o=>Object.keys(o).forEach(p=>this.props.onError(p)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}),n.hideOnlyControl){const o=M.createElement(R.Grid2,{size:{xs:n.xs||Ts,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0},style:{marginBottom:0,textAlign:"left",...n.style,...this.props.oContext.themeType==="dark"?n.darkStyle:{}}});return n.newLine?M.createElement(M.Fragment,null,M.createElement("div",{style:{flexBasis:"100%",height:0}}),o):o}return null}n.validatorNoSaveOnError&&(i&&!Object.keys(this.isError).length?(this.isError={[this.props.attr]:n.validatorErrorText?j.I18n.t(n.validatorErrorText):!0},setTimeout(o=>Object.keys(o).forEach(p=>this.props.onError(p,o[p])),100,JSON.parse(JSON.stringify(this.isError)))):!i&&Object.keys(this.isError).length&&(setTimeout(o=>Object.keys(o).forEach(p=>this.props.onError(p)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}));const c=this.renderItem(i,l||this.props.commandRunning||this.props.disabled,s);if(this.noPlaceRequired)return c;const d=M.createElement(R.Grid2,{title:this.getText(n.tooltip),size:{xs:n.xs||12,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0},style:{marginBottom:0,textAlign:"left",width:n.type==="divider"||n.type==="header"?n.width||"100%":void 0,...n.style,...this.props.oContext.themeType==="dark"?n.darkStyle:{}}},this.props.schema.defaultSendTo&&this.props.schema.button?M.createElement(R.Grid2,{container:!0,style:{width:"100%"}},M.createElement(R.Grid2,{flex:1},c),M.createElement(R.Grid2,null,M.createElement(R.Button,{disabled:l,variant:"outlined",onClick:()=>this.sendTo(),title:this.props.schema.buttonTooltip?this.getText(this.props.schema.buttonTooltip,this.props.schema.buttonTooltipNoTranslation):j.I18n.t("ra_Request data by instance")},this.getText(this.props.schema.button)))):c);return n.newLine?M.createElement(M.Fragment,null,M.createElement("div",{style:{flexBasis:"100%",height:0}}),this.renderDialogConfirm(),d):this.state.confirmDialog?M.createElement(M.Fragment,null,this.renderDialogConfirm(),d):d}}const Oe={fullWidth:{width:"100%"},accordionSummary:L=>({backgroundColor:L.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)"}),accordionTitle:{},toolbar:L=>({backgroundColor:L.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)",borderRadius:"3px"}),tooltip:{pointerEvents:"none"}};class _s extends K{typingTimer=null;constructor(n){super(n),this.props.schema.items=this.props.schema.items||[]}componentDidMount(){super.componentDidMount();let n=K.getValue(this.props.data,this.props.attr)||[];Array.isArray(n)||(n=[]),this.setState({value:n,activeIndex:-1,iteration:0})}componentWillUnmount(){this.typingTimer&&(clearTimeout(this.typingTimer),this.typingTimer=null),super.componentWillUnmount()}itemAccordion(n,i){const{value:l}=this.state,{schema:v}=this.props,s={type:"panel",items:v.items.reduce((c,d)=>(c[d.attr]=d,c),{}),style:{marginLeft:"-8px",marginTop:"10px",marginBottom:"10px"}};return M.createElement(ft,{oContext:this.props.oContext,index:i+this.state.iteration,arrayIndex:i,changed:this.props.changed,expertMode:this.props.expertMode,globalData:this.props.data,common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:n,custom:!0,schema:s,originalData:this.props.originalData,onChange:(c,d)=>{const o=JSON.parse(JSON.stringify(l));o[i][c]=d,this.setState({value:o},()=>this.onChangeWrapper(o))},onError:(c,d)=>this.onError(c,d),table:this.props.table})}onDelete=n=>()=>{const i=JSON.parse(JSON.stringify(this.state.value));i.splice(n,1),this.setState({value:i,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(i))};onClone=n=>()=>{const i=JSON.parse(JSON.stringify(this.state.value)),l=JSON.parse(JSON.stringify(i[n]));if(typeof this.props.schema.clone=="string"&&typeof l[this.props.schema.clone]=="string"){let v=1,s=l[this.props.schema.clone];const c=s.match(/(\d+)$/);for(c?(s=s.replace(c[0],""),v=parseInt(c[0],10)+1):s+="_";i.find(d=>d[this.props.schema.clone]===s+v.toString());)v++;l[this.props.schema.clone]=`${l[this.props.schema.clone]}_${v}`}i.splice(n,0,l),this.setState({value:i,activeIndex:-1,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(i))};onChangeWrapper=n=>{this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout(i=>{this.typingTimer=null;const l=this.onChange(this.props.attr,i);l instanceof Promise&&l.catch(v=>this.onError(v))},300,n)};onAdd=()=>{const{schema:n}=this.props,i=JSON.parse(JSON.stringify(this.state.value)),l=n.items&&n.items.reduce((v,s)=>{let c;return s.defaultFunc?this.props.custom?c=s.defaultFunc?this.executeCustom(s.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,i.length,this.props.data):this.props.schema.default:c=s.defaultFunc?this.execute(s.defaultFunc,this.props.schema.default,this.props.data,i.length,this.props.data):this.props.schema.default:c=s.default===void 0?null:s.default,v[s.attr]=c,v},{});i.push(l),this.setState({value:i,activeIndex:i.length-1},()=>this.onChangeWrapper(i))};onMoveUp(n){const i=JSON.parse(JSON.stringify(this.state.value)),l=i[n];i.splice(n,1),i.splice(n-1,0,l);const v=this.state.activeIndex-1;this.setState({value:i,activeIndex:v,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(i))}onMoveDown(n){const i=JSON.parse(JSON.stringify(this.state.value)),l=i[n];i.splice(n,1),i.splice(n+1,0,l);const v=this.state.activeIndex+1;this.setState({value:i,activeIndex:v,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(i))}renderItem(){const{schema:n}=this.props,{value:i}=this.state;return i?M.createElement(R.Paper,null,n.label||!n.noDelete?M.createElement(R.Toolbar,{variant:"dense"},n.label?M.createElement(R.Typography,{variant:"h6",id:"tableTitle",component:"div"},this.getText(n.label)):null,n.noDelete?null:M.createElement(R.IconButton,{size:"small",color:"primary",onClick:this.onAdd},M.createElement(Z.Add,null))):null,i.map((l,v)=>M.createElement(R.Accordion,{key:`${l}_${v}`,expanded:this.state.activeIndex===v,onChange:(s,c)=>this.setState({activeIndex:c?v:-1})},M.createElement(R.AccordionSummary,{expandIcon:M.createElement(Z.ExpandMore,null),sx:j.Utils.getStyle(this.props.oContext.theme,Oe.fullWidth,Oe.accordionSummary)},M.createElement(R.Typography,{style:Oe.accordionTitle},l[n.titleAttr])),M.createElement(R.AccordionDetails,{style:{...n.style,...this.props.oContext.themeType?n.darkStyle:void 0}},this.itemAccordion(i[v],v),M.createElement(R.Toolbar,{sx:Oe.toolbar},v?M.createElement(R.Tooltip,{title:j.I18n.t("ra_Move up"),slotProps:{popper:{sx:Oe.tooltip}}},M.createElement(R.IconButton,{size:"small",onClick:()=>this.onMoveUp(v)},M.createElement(Z.ArrowUpward,null))):M.createElement("div",{style:Oe.buttonEmpty}),v<i.length-1?M.createElement(R.Tooltip,{title:j.I18n.t("ra_Move down"),slotProps:{popper:{sx:Oe.tooltip}}},M.createElement(R.IconButton,{size:"small",onClick:()=>this.onMoveDown(v)},M.createElement(Z.ArrowDownward,null))):M.createElement("div",{style:Oe.buttonEmpty}),n.noDelete?null:M.createElement(R.Tooltip,{title:j.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:Oe.tooltip}}},M.createElement(R.IconButton,{size:"small",onClick:this.onDelete(v)},M.createElement(Z.Delete,null))),n.clone?M.createElement(R.Tooltip,{title:j.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:Oe.tooltip}}},M.createElement(R.IconButton,{size:"small",onClick:this.onClone(v)},M.createElement(Z.ContentCopy,null))):null)))),!n.noDelete&&i.length>0?M.createElement(R.Toolbar,{variant:"dense",sx:Oe.rootTool},M.createElement(R.IconButton,{size:"small",color:"primary",onClick:this.onAdd},M.createElement(Z.Add,null))):null,n.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null):null}}const ni={root:{width:"100%"},notAlive:{color:"#a30000"}};class ks extends K{componentDidMount(){super.componentDidMount();const n=this.getInstance();this.props.oContext.socket.getState(`${n}.alive`).then(i=>this.setState({alive:!!(i&&i.val),instance:n}))}getInstance(){let n=this.props.schema.instance||`${this.props.oContext.adapterName}.${this.props.oContext.instance}`;return n.includes("${")&&(n=this.getPattern(n,null,!0)),n&&!n.startsWith("system.adapter.")&&(n=`system.adapter.${n}`),n}renderItem(){if(this.getInstance()!==this.state.instance&&setTimeout(()=>{const i=this.getInstance();i?this.props.oContext.socket.getState(`${i}.alive`).then(l=>this.setState({alive:!!(l&&l.val),instance:i})):this.setState({alive:null,instance:i})},200),this.state.alive!==!1&&this.state.alive!==!0)return null;const n=this.state.instance.replace(/^system.adapter./,"");return M.createElement("div",{style:{...ni.root,...this.state.alive?void 0:ni.notAlive}},this.state.alive?this.props.schema.textAlive!==void 0?this.props.schema.textAlive?j.I18n.t(this.props.schema.textAlive,n):"":j.I18n.t("ra_Instance %s is alive",n):this.props.schema.textNotAlive!==void 0?this.props.schema.textNotAlive?j.I18n.t(this.props.schema.textNotAlive,n):"":j.I18n.t("ra_Instance %s is not alive",n))}}class Ms extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr),i=this.props.schema.options.map(l=>typeof l=="string"?{label:l,value:l}:JSON.parse(JSON.stringify(l)));Array.isArray(n)?(i.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),this.setState({value:K.DIFFERENT_VALUE,selectOptions:i})):this.setState({value:n,selectOptions:i})}renderItem(n,i){if(!this.state.selectOptions)return null;let l;const v=JSON.parse(JSON.stringify(this.state.selectOptions));return Array.isArray(this.state.value)||this.state.value===K.DIFFERENT_VALUE?([...this.state.value].filter(c=>!v.find(d=>typeof d=="object"?d.value===c:d===c)).forEach(c=>v.push({label:c.toString(),value:c})),l={label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE},v.unshift(l)):(l=this.state.value!==null&&this.state.value!==void 0&&v.find(c=>typeof c=="object"?c.value==this.state.value:c==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!l&&this.props.schema.freeSolo&&(l={value:this.state.value,label:this.state.value},v.push(l))),M.createElement(R.Autocomplete,{fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,value:l,options:v,isOptionEqualToValue:(c,d)=>c.value===d.value,filterOptions:(c,d)=>{const o=c.filter(p=>d.inputValue===""?!0:p.label.toLowerCase().includes(d.inputValue.toLowerCase())||p.value.toLowerCase().includes(d.inputValue.toLowerCase()));return this.props.schema.freeSolo&&d.inputValue!==""&&o.push({label:d.inputValue,value:d.inputValue}),o},onInputChange:c=>{if(!c||!this.props.schema.freeSolo)return;const d=c.target.value;d!==this.state.value&&this.setState({value:d},()=>this.onChange(this.props.attr,d))},onChange:(c,d)=>{const o=typeof d=="object"?d?d.value:"":d;o!==this.state.value&&this.setState({value:o},()=>this.onChange(this.props.attr,o))},getOptionLabel:c=>typeof c=="object"?(c==null?void 0:c.label)??"":"",renderInput:c=>M.createElement(R.TextField,{variant:"standard",...c,error:!!n,placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:i})})}}class Ls extends K{initialized=!1;localContext;askInstance(){const n=K.getValue(this.props.data,this.props.attr),i=this.props.schema.options?this.props.schema.options.map(l=>typeof l=="string"?{label:l,value:l}:JSON.parse(JSON.stringify(l))):[];if(this.props.alive){let l=this.props.schema.data;if(l===void 0&&this.props.schema.jsonData){const v=this.getPattern(this.props.schema.jsonData,null,!0);try{typeof v=="string"&&(l=JSON.parse(v))}catch{console.error(`Cannot parse json data: ${JSON.stringify(l)}`)}}l===void 0&&(l=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",l).then(v=>{v&&Array.isArray(v)&&v.forEach(s=>i.push(typeof s=="string"?{label:s,value:s}:JSON.parse(JSON.stringify(s)))),Array.isArray(n)?(i.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),this.setState({value:K.DIFFERENT_VALUE,selectOptions:i})):this.setState({value:n,selectOptions:i})})}else Array.isArray(n)?(i.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),this.setState({value:K.DIFFERENT_VALUE,selectOptions:i})):this.setState({value:n,selectOptions:i})}getContext(){const n={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(i=>n[i]=K.getValue(this.props.data,i)),JSON.stringify(n)}renderItem(n,i){if(this.props.alive){const c=this.getContext();(c!==this.localContext||!this.initialized)&&(this.localContext=c,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}let l;const v=this.state.selectOptions?JSON.parse(JSON.stringify(this.state.selectOptions)):[];return Array.isArray(this.state.value)||this.state.value===K.DIFFERENT_LABEL?([...this.state.value].filter(c=>!v.find(d=>d.value===c)).forEach(c=>v.push({label:c.toString(),value:c})),l={label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE},v.unshift(l)):(l=this.state.value!==null&&this.state.value!==void 0&&v.find(c=>c.value==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!l&&this.props.schema.freeSolo&&(l={value:this.state.value,label:this.state.value},v.push(l)),l=l||null),v.length?M.createElement(R.Autocomplete,{value:l,fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,options:v,isOptionEqualToValue:(c,d)=>c.value===d.value,filterOptions:(c,d)=>{const o=c.filter(p=>d.inputValue===""?!0:p.label.toLowerCase().includes(d.inputValue.toLowerCase())||p.value.toLowerCase().includes(d.inputValue.toLowerCase()));return this.props.schema.freeSolo&&d.inputValue!==""&&o.push({label:d.inputValue,value:d.inputValue}),o},getOptionLabel:c=>(c==null?void 0:c.label)??"",onInputChange:c=>{if(!c||!this.props.schema.freeSolo)return;const d=c.target.value;d!==this.state.value&&this.setState({value:d},()=>this.onChange(this.props.attr,d))},onChange:(c,d)=>{const o=typeof d=="object"?d?d.value:"":d;o!==this.state.value&&this.setState({value:o},()=>this.onChange(this.props.attr,o))},renderInput:c=>M.createElement(R.TextField,{variant:"standard",...c,error:!!n,placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:i})}):M.createElement(R.TextField,{variant:"standard",fullWidth:!0,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!n,disabled:i,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0}},onChange:c=>{const d=c.target.value;this.setState({value:d},()=>this.onChange(this.props.attr,(d||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const fn={fullWidth:{width:"100%"},flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class Is extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,l=K.getValue(n,i)||"";this.setState({value:l,showDialog:!1})}renderItem(n,i){const{schema:l,attr:v}=this.props,{value:s,showDialog:c}=this.state;return M.createElement(R.FormControl,{style:fn.fullWidth,variant:"standard"},l.label?M.createElement(R.InputLabel,{shrink:!0},this.getText(l.label)):null,M.createElement("div",{style:fn.flex},M.createElement(R.TextField,{variant:"standard",fullWidth:!0,value:s??"",error:!!n,disabled:i,placeholder:this.getText(l.placeholder),label:this.getText(l.label),helperText:this.renderHelp(l.help,l.helpLink,l.noTranslation),onChange:d=>{const o=d.target.value;this.setState({value:o},()=>this.onChange(v,o))}}),M.createElement(R.Button,{color:"grey",disabled:i,style:fn.button,size:"small",variant:"outlined",onClick:()=>this.setState({showDialog:!0})},"...")),c?M.createElement(j.DialogCron,{title:j.I18n.t("ra_Define schedule"),simple:l.simple,complex:l.complex,cron:s,onClose:()=>this.setState({showDialog:!1}),cancel:j.I18n.t("ra_Cancel"),ok:j.I18n.t("ra_Ok"),theme:this.props.oContext.theme,onOk:d=>this.setState({showDialog:!1,value:d},()=>this.onChange(v,d))}):null)}}class Fs extends K{async componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr),l=(await this.props.oContext.socket.getCertificates()).filter(v=>{const s=this.props.attr.toLowerCase();return s.includes(v.type)||v.type==="public"&&s.includes("cert")||v.type==="private"&&(s.includes("priv")||s.includes("key"))?!0:!!(v.type==="chained"&&(s.includes("chain")||s.includes("ca")))}).map(v=>({label:v.name,value:v.name}));l.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({value:n,selectOptions:l})}renderItem(n,i){var v,s;if(!this.state.selectOptions)return null;const l=(v=this.state.selectOptions)==null?void 0:v.find(c=>c.value===this.state.value);return M.createElement(R.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?M.createElement(R.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,M.createElement(R.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:this.state.value,renderValue:()=>this.getText(l==null?void 0:l.label,this.props.schema.noTranslation!==!1),onChange:c=>this.setState({value:c.target.value},()=>this.onChange(this.props.attr,this.state.value))},(s=this.state.selectOptions)==null?void 0:s.map(c=>M.createElement(R.MenuItem,{key:c.value,value:c.value,style:c.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(c.label,this.props.schema.noTranslation!==!1)))),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const At={fullWidth:{width:"100%"},leWidth:{width:620,marginBottom:10},certWidth:{width:200,marginRight:10}};class Os extends K{async componentDidMount(){var d;super.componentDidMount();const n=await this.props.oContext.socket.getCertificates(),i=[],l=[],v=[];let s=[];const c=await this.props.oContext.socket.getObject("system.certificates");(d=c==null?void 0:c.native)!=null&&d.collections?s=Object.keys(c.native.collections):s=null,n.forEach(o=>{o.type==="public"?i.push({label:o.name,value:o.name}):o.type==="private"?l.push({label:o.name,value:o.name}):o.type==="chained"?v.push({label:o.name,value:o.name}):(i.push({label:o.name,value:o.name}),l.push({label:o.name,value:o.name}),v.push({label:o.name,value:o.name}))}),i.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),l.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),v.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({certsPublicOptions:i,certsChainOptions:v,certsPrivateOptions:l,collectionsOptions:s})}renderItem(n,i){var e,t,r,h,a,u,f;if(!this.state.certsPublicOptions||!this.state.certsPrivateOptions||!this.state.certsChainOptions)return null;const l=(K.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString(),v=K.getValue(this.props.data,this.props.schema.certPublicName||"certPublic"),s=K.getValue(this.props.data,this.props.schema.certPrivateName||"certPrivate"),c=K.getValue(this.props.data,this.props.schema.certChainedName||"certChained"),d=(e=this.state.certsPublicOptions)==null?void 0:e.find(m=>m.value===v),o=(t=this.state.certsPrivateOptions)==null?void 0:t.find(m=>m.value===s),p=(r=this.state.certsChainOptions)==null?void 0:r.find(m=>m.value===c);return M.createElement("div",{style:At.fullWidth},this.state.collectionsOptions?M.createElement(R.FormControl,{style:At.leWidth,variant:"standard"},M.createElement(R.InputLabel,{shrink:!0},"Let's encrypt"),M.createElement(R.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:l,onChange:m=>this.onChange(this.props.schema.leCollectionName||"leCollection",m.target.value==="false"?!1:m.target.value==="true"?!0:m.target.value)},M.createElement(R.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},j.I18n.t("ra_Do not use let's encrypt")),M.createElement(R.MenuItem,{key:"_true",value:"true",style:{fontWeight:"bold"}},j.I18n.t("ra_Use all available let's encrypt certificates")),(h=this.state.collectionsOptions)==null?void 0:h.map(m=>M.createElement(R.MenuItem,{key:m,value:m},m)))):null,this.state.collectionsOptions?M.createElement("br",null):null,this.state.collectionsOptions&&l!=="false"?M.createElement("div",null,j.I18n.t("ra_Fallback custom certificates")):null,M.createElement(R.FormControl,{style:At.certWidth,variant:"standard"},M.createElement(R.InputLabel,{shrink:!0},j.I18n.t("ra_Public certificate")),M.createElement(R.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:v||"",renderValue:()=>this.getText(d==null?void 0:d.label),onChange:m=>this.onChange(this.props.schema.certPublicName||"certPublic",m.target.value)},(a=this.state.certsPublicOptions)==null?void 0:a.map((m,y)=>M.createElement(R.MenuItem,{key:`${m.value}_${y}`,value:m.value,style:m.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(m.label))))),M.createElement(R.FormControl,{style:At.certWidth,variant:"standard"},M.createElement(R.InputLabel,{shrink:!0},j.I18n.t("ra_Private certificate")),M.createElement(R.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:s||"",renderValue:()=>this.getText(o==null?void 0:o.label),onChange:m=>this.onChange(this.props.schema.certPrivateName||"certPrivate",m.target.value)},(u=this.state.certsPrivateOptions)==null?void 0:u.map((m,y)=>M.createElement(R.MenuItem,{key:`${m.value}_${y}`,value:m.value,style:m.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(m.label))))),M.createElement(R.FormControl,{style:At.certWidth,variant:"standard"},M.createElement(R.InputLabel,{shrink:!0},j.I18n.t("ra_Chained certificate")),M.createElement(R.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:c||"",renderValue:()=>this.getText(p==null?void 0:p.label),onChange:m=>this.onChange(this.props.schema.certChainedName||"certChained",m.target.value)},(f=this.state.certsChainOptions)==null?void 0:f.map((m,y)=>M.createElement(R.MenuItem,{key:`${m.value}_${y}`,value:m.value,style:m.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(m.label))))))}}class Rs extends K{async componentDidMount(){var l;super.componentDidMount();let n;const i=await this.props.oContext.socket.getObject("system.certificates");(l=i==null?void 0:i.native)!=null&&l.collections?n=Object.keys(i.native.collections):n=[],this.setState({collectionsOptions:n})}renderItem(n,i){var v;if(!this.state.collectionsOptions)return null;const l=(K.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString();return M.createElement(R.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?M.createElement(R.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,M.createElement(R.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:l,onChange:s=>this.onChange(this.props.schema.leCollectionName||"leCollection",s.target.value==="false"?!1:s.target.value==="true"?!0:s.target.value)},M.createElement(R.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},j.I18n.t("ra_Do not use let's encrypt")),M.createElement(R.MenuItem,{key:"_true",value:"true",style:{fontWeight:"bold"}},j.I18n.t("ra_Use all available let's encrypt certificates")),(v=this.state.collectionsOptions)==null?void 0:v.map(s=>M.createElement(R.MenuItem,{key:s,value:s},s))),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const _e={fullWidth:{width:"100%"},licLabel:{fontWeight:"bold",minWidth:100,marginRight:10,textTransform:"capitalize",display:"inline-block"},errorTitle:L=>({color:L.palette.mode==="dark"?"#e39191":"#b62020"}),okTitle:L=>({color:L.palette.mode==="dark"?"#6fd56f":"#007c00"}),errorText:L=>({color:L.palette.mode==="dark"?"#e39191":"#b62020",mb:"30px"})};class Xe extends K{componentDidMount(){super.componentDidMount(),this.setState({_error:"",running:!1,showLicenseData:null,foundSuitableLicense:!1,licenseOfflineCheck:!1,result:null,allLicenses:null,askForUpdate:!1,showLinkToProfile:!1})}renderErrorDialog(){if(this.state._error&&!this.state.showLicenseData){let n=this.state._error;return this.state.allLicenses&&(n=[M.createElement("div",{key:"error"},n)],n.push(M.createElement(R.Button,{key:"button",variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},j.I18n.t("iobroker.net"))),this.state.allLicenses.length?n.push(M.createElement(R.TableContainer,{key:"table"},M.createElement(R.Table,{size:"small"},M.createElement(R.TableHead,null,M.createElement(R.TableRow,null,M.createElement(R.TableCell,null,j.I18n.t("ra_Product")),M.createElement(R.TableCell,null,j.I18n.t("ra_Version")),M.createElement(R.TableCell,null,"UUID"),M.createElement(R.TableCell,null,j.I18n.t("ra_ValidTill")),M.createElement(R.TableCell,null,j.I18n.t("ra_Commercial")),M.createElement(R.TableCell,null,"ID"))),M.createElement(R.TableBody,null,this.state.allLicenses.map(i=>M.createElement(R.TableRow,{key:i.id},M.createElement(R.TableCell,{sx:i.validName?null:_e.errorText},i.license.product),M.createElement(R.TableCell,{sx:i.validVersion?null:_e.errorText},i.license.version),M.createElement(R.TableCell,{sx:i.validUuid?null:_e.errorText},i.license.uuid||"--"),M.createElement(R.TableCell,{sx:i.validTill?null:_e.errorText},i.license.validTill&&i.license.validTill!=="0000-00-00 00:00:00"?new Date(i.license.validTill).toLocaleDateString():"--"),M.createElement(R.TableCell,null,i.license.invoice!=="free"?i.license.invoice==="MANUALLY_CREATED"?"✓":i.license.invoice:"-"),M.createElement(R.TableCell,null,i.id))))))):(n.push(M.createElement("div",{key:"text1"},j.I18n.t("ra_No one license found in license manager"))),n.push(M.createElement("div",{key:"text2"},j.I18n.t("ra_Please create license"))))),M.createElement(R.Dialog,{open:!0,maxWidth:"xl",fullWidth:this.props.fullWidth!==void 0?this.props.fullWidth:!0,onClick:()=>this.setState({_error:"",allLicenses:null})},M.createElement(R.DialogTitle,null,j.I18n.t("ra_Error")),M.createElement(R.DialogContent,null,M.createElement(R.DialogContentText,null,n)),M.createElement(R.DialogActions,null,M.createElement(R.Button,{variant:"contained",onClick:()=>this.setState({_error:"",allLicenses:null}),color:"primary",autoFocus:!0,startIcon:M.createElement(Z.Check,null)},j.I18n.t("ra_Ok"))))}return null}renderMessageDialog(){if(this.state.showLicenseData){const n=[],i=this.state.showLicenseData;return Object.keys(i).forEach(l=>{if(!(i[l]===null||i[l]===void 0))if(typeof i[l]=="object"){const v=i[l];Object.keys(v).forEach(s=>{v[s]!==null&&v[s]!==void 0&&(typeof v[s]=="object"?n.push(M.createElement("div",{key:s},M.createElement("div",{style:_e.licLabel},s,":"),JSON.stringify(v[s],null,2))):n.push(M.createElement("div",{key:s},M.createElement("div",{style:_e.licLabel},l," -",s,":"),v[s].toString())))})}else n.push(M.createElement("div",{key:l},M.createElement("div",{style:_e.licLabel},l.replace(/_/g," "),":"),i[l].toString()))}),n.push(M.createElement("div",{key:"checked"},M.createElement("div",{style:_e.licLabel},j.I18n.t("ra_Checked"),":"),this.state.licenseOfflineCheck?j.I18n.t("ra_locally"):j.I18n.t("ra_via internet"))),M.createElement(R.Dialog,{open:!0,onClose:()=>this.setState({showLicenseData:null})},M.createElement(R.DialogTitle,null,M.createElement(R.Box,{component:"span",sx:this.state.result?_e.okTitle:_e.errorTitle},j.I18n.t("ra_License %s",this.state.result?"OK":"INVALID"))),M.createElement(R.DialogContent,null,this.state.showLinkToProfile?M.createElement(R.Button,{variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},"https://iobroker.net"):null,this.state._error?M.createElement(R.Box,{component:"div",sx:_e.errorText},this.state._error):null,n),M.createElement(R.DialogActions,null,M.createElement(R.Button,{onClick:()=>this.setState({showLicenseData:null,_error:""}),color:"primary",variant:"contained"},j.I18n.t("ra_Close"))))}return null}static parseJwt(n){const l=n.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),v=decodeURIComponent(atob(l).split("").map(s=>`%${`00${s.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));try{return JSON.parse(v)}catch{return null}}static isVersionValid(n,i,l,v){if(!i||!n)return!0;let s=!0;const[c]=n.split(".");return i.startsWith(">=")?s=parseInt(c,10)>=parseInt(i.substring(2,10)):i.startsWith("<=")?s=parseInt(c,10)<=parseInt(i.substring(2,10)):i.startsWith(">")?s=parseInt(c,10)>parseInt(i.substring(1,10)):i.startsWith("<")?s=parseInt(c,10)<parseInt(i.substring(1,10)):i.startsWith("=")?s=parseInt(c,10)===parseInt(i.substring(1,10)):i.startsWith("==")?s=parseInt(c,10)===parseInt(i.substring(2,10)):i.startsWith("===")&&(s=parseInt(c,10)===parseInt(i.substring(3,10))),!0}async findInLicenseManager(n){var v,s,c,d;const i=await this.props.oContext.socket.getObject("system.licenses"),l=[];if((s=(v=i==null?void 0:i.native)==null?void 0:v.licenses)!=null&&s.length){let o=null;const p=Date.now();let e;if(this.props.schema.uuid){const r=await this.props.oContext.socket.getObject("system.meta.uuid");e=(c=r==null?void 0:r.native)==null?void 0:c.uuid}let t;if(this.props.schema.version){const r=await this.props.oContext.socket.getObject(`system.adapter.${n}`);t=(d=r==null?void 0:r.common)==null?void 0:d.version}i.native.licenses.forEach(r=>{const h=!r.validTill||r.validTill==="0000-00-00 00:00:00"||new Date(r.validTill).getTime()>p,a=(r.product||"").split("."),u=a[1]===n||n==="vis-2"&&a[1]==="vis",f=!e||!r.uuid||r.uuid===e,m=Xe.isVersionValid(t,r.version,r.invoice,n);(!o||r.invoice!=="free")&&h&&u&&f&&m&&(o=r),l.push({id:r.id,validName:u,validUuid:f,validVersion:m,validTill:h,license:r})}),o&&(l.find(r=>r.id===o.id).used=!0)}return l}async checkLicense(n,i){var d,o,p;let l;if(this.props.schema.uuid){const e=await this.props.oContext.socket.getObject("system.meta.uuid");l=(d=e==null?void 0:e.native)==null?void 0:d.uuid}let v;if(this.props.schema.version){const e=await this.props.oContext.socket.getObject(`system.adapter.${i}`);v=(o=e==null?void 0:e.common)==null?void 0:o.version}const s=new AbortController;let c=setTimeout(()=>{c=null,s.abort()},5e3);try{const e=await window.fetch("https://iobroker.net/api/v1/public/cert/",{method:"POST",body:JSON.stringify({json:n,uuid:l}),headers:{"Content-Type":"text/plain"},signal:s.signal});c&&clearTimeout(c);const t=await e.text();let r;try{r=JSON.parse(t)}catch{}if(r!=null&&r.error)try{const h=Xe.parseJwt(n),a=j.I18n.t(`ra_${h.error||r.error||"Unknown error"}`).replace(/^ra_/,"");return this.setState({_error:a,licenseOfflineCheck:!1,showLicenseData:h,result:!1,running:!1})}catch{return console.log("Cannot parse license"),this.setState({_error:r.error,result:!1,running:!1})}else{let h=null;try{h=Xe.parseJwt(n)}catch{}if(r){const a=r.validTill||r.valid_till;if(a&&a!=="0000-00-00 00:00:00"&&new Date(a).getTime()<Date.now())return this.setState({_error:j.I18n.t("ra_License expired on %s",new Date(a).toLocaleString()),licenseOfflineCheck:!1,showLicenseData:h,result:!1,running:!1});const u=(r.name||"").split(".");return u[1]===i||u[1]==="vis"&&i==="vis-2"?l&&!r.uuid&&i==="vis-2"?this.setState({_error:j.I18n.t("ra_License must be converted",r.uuid),showLinkToProfile:!0,licenseOfflineCheck:!1,showLicenseData:h,result:!1,running:!1}):l&&r.uuid&&r.uuid!==l?this.setState({_error:j.I18n.t('ra_Serial number (UUID) "%s" in license is for other device.',r.uuid),licenseOfflineCheck:!1,showLicenseData:h,result:!1,running:!1}):Xe.isVersionValid(v,r.version,r.invoice,i)?this.setState({licenseOfflineCheck:!1,showLicenseData:h,result:!0,running:!1}):this.setState({_error:j.I18n.t("ra_License is for version %s, but required version is %s",r.version,this.props.schema.version),licenseOfflineCheck:!1,showLicenseData:h,result:!1,running:!1}):this.setState({_error:j.I18n.t('ra_License for other product "%s"',r.name),licenseOfflineCheck:!1,showLicenseData:h,result:!1,running:!1})}throw new Error("ra_Invalid answer from server")}}catch(e){if(((p=e==null?void 0:e.response)==null?void 0:p.status)===404)return this.setState({_error:j.I18n.t("ra_License does not exist"),result:!1,running:!1});try{const t=Xe.parseJwt(n),r=(t.name||"").split(".");return t.valid_till&&t.valid_till!=="0000-00-00 00:00:00"&&new Date(t.valid_till).getTime()<Date.now()?this.setState({_error:j.I18n.t("ra_License expired on %s",new Date(t.valid_till).toLocaleString()),showLicenseData:t,licenseOfflineCheck:!0,running:!1,result:!1}):r[1]===i?l&&t.uuid&&t.uuid!==l?this.setState({_error:j.I18n.t('ra_Serial number (UUID) "%s" in license is for other device.',t.uuid),showLicenseData:t,licenseOfflineCheck:!0,result:!1,running:!1}):Xe.isVersionValid(v,t.version,t.invoice,i)?this.setState({running:!1,result:!0,licenseOfflineCheck:!0,showLicenseData:t}):this.setState({_error:j.I18n.t("ra_License is for version %s, but required version is %s",t.version,this.props.schema.version),licenseOfflineCheck:!0,showLicenseData:t,result:!1,running:!1}):this.setState({_error:j.I18n.t('ra_License for other product "%s"',t.name),licenseOfflineCheck:!0,showLicenseData:t,result:!1,running:!1})}catch{return this.setState({_error:j.I18n.t("ra_Cannot decode license"),result:!1,licenseOfflineCheck:!0,running:!1})}}}renderAskForUpdate(){return this.state.askForUpdate?M.createElement(j.DialogConfirm,{text:j.I18n.t("ra_License not found in license manager. Do you want to read licenses from iobroker.net?"),ok:j.I18n.t("ra_Yes"),onClose:async n=>{if(n){this.setState({askForUpdate:!1});try{await this.props.oContext.socket.updateLicenses(null,null)}catch(i){window.alert(j.I18n.t("ra_Cannot read licenses: %s",i));return}await this._onClick(!0)}else this.setState({askForUpdate:!1,running:!1})}}):null}async _onClick(n){const i=this.props.oContext.adapterName==="vis-2"?"vis":this.props.oContext.adapterName;this.setState({running:!0});let l,v;if(this.props.data.useLicenseManager){if(v=await this.findInLicenseManager(i),l=v.find(s=>s.used),l&&(l=l.license.json),!l&&!n){this.setState({askForUpdate:!0});return}}else l=this.props.data.license;l?await this.checkLicense(l,i):this.props.data.useLicenseManager?this.setState({_error:j.I18n.t("ra_Suitable license not found in license manager"),result:!1,running:!1,allLicenses:v}):this.setState({_error:j.I18n.t("ra_Please enter the license"),result:!1,running:!1})}renderItem(){return M.createElement("div",{style:_e.fullWidth},M.createElement(R.Button,{variant:this.props.schema.variant||"outlined",color:this.props.schema.color||"primary",style:_e.fullWidth,disabled:!this.props.data.license&&!this.props.data.useLicenseManager||this.state.running,startIcon:M.createElement(Z.Send,null),onClick:()=>this._onClick()},this.state.running?M.createElement(R.CircularProgress,{size:20,style:{marginRight:8}}):null,this.getText(this.props.schema.label||"ra_Check license",this.props.schema.noTranslation)),this.renderMessageDialog(),this.renderErrorDialog(),this.renderAskForUpdate())}}class Ns extends K{renderItem(n,i){const l=K.getValue(this.props.data,this.props.attr),v=Array.isArray(l);return M.createElement(R.FormControl,{style:{width:"100%"},variant:"standard"},M.createElement(R.FormControlLabel,{onClick:s=>{if(s.preventDefault(),s.stopPropagation(),!i){const c=this.onChange(this.props.attr,!l);c instanceof Promise&&c.catch(d=>console.error(`Cannot set value: ${d}`))}},control:M.createElement(R.Checkbox,{indeterminate:v,checked:!!l,onChange:s=>{let c;v?c=this.onChange(this.props.attr,!0):c=this.onChange(this.props.attr,s.target.checked),c instanceof Promise&&c.catch(d=>console.error(`Cannot set value: ${d}`))},disabled:i||this.props.schema.readOnly}),label:this.getText(this.props.schema.label)}),M.createElement(R.FormHelperText,{style:{color:"red"}},n?this.props.schema.validatorErrorText?j.I18n.t(this.props.schema.validatorErrorText):j.I18n.t("ra_Error"):null),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Bs={standard:R.Input,filled:ns,outlined:R.OutlinedInput},Ps=L=>{const n=L.palette.mode==="light",i=n?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return{root:{},inputRoot:{display:"inline-flex",flexWrap:"wrap",flex:1,marginTop:0,minWidth:70,"&.mui-variant-outlined,&.mui-variant-filled":{boxSizing:"border-box"},"&.mui-variant-outlined":{paddingTop:"14px"},"&.mui-variant-filled":{paddingTop:"28px"}},input:{display:"inline-block",textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",appearance:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",float:"left",flex:1},chipContainer:{display:"flex",flexFlow:"row wrap",alignItems:"center",cursor:"text",marginBottom:"-2px",minHeight:40},outlined:{"& input":{height:16,paddingTop:"4px",paddingBottom:"12px",marginTop:"4px",marginBottom:"4px"}},standard:{marginTop:"18px"},filled:{"& input":{height:22,marginBottom:"4px",marginTop:"4px",paddingTop:0},"$marginDense & input":{height:26}},labeled:{},label:{top:4,"&$outlined&:not($labelShrink)":{top:2,"$marginDense &":{top:5}},"&$filled&:not($labelShrink)":{top:15,"$marginDense &":{top:20}}},labelShrink:{top:0},helperText:{marginBottom:-20},focused:{},disabled:{},underline:{"&:after":{borderBottom:`2px solid ${L.palette.primary[n?"dark":"light"]}`,left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:L.transitions.create("transform",{duration:L.transitions.duration.shorter,easing:L.transitions.easing.easeOut}),pointerEvents:"none"},"&$focused:after":{transform:"scaleX(1)"},"&$error:after":{borderBottomColor:L.palette.error.main,transform:"scaleX(1)"},"&:before":{borderBottom:`1px solid ${i}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:L.transitions.create("border-bottom-color",{duration:L.transitions.duration.shorter}),pointerEvents:"none"},"&:hover:not($disabled):not($focused):not($error):before":{borderBottom:`2px solid ${L.palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${i}`}},"&$disabled:before":{borderBottomStyle:"dotted"}},error:{"&:after":{backgroundColor:L.palette.error.main,transform:"scaleX(1)"}},chip:{margin:"0 8px 8px 0",float:"left"},marginDense:{}}},Ht={BACKSPACE:8,DELETE:46,LEFT_ARROW:37,RIGHT_ARROW:39},Ws=({value:L,isFocused:n,isDisabled:i,isReadOnly:l,handleClick:v,handleDelete:s,style:c},d)=>M.createElement(R.Chip,{key:d,style:{...c,pointerEvents:i||l?"none":void 0,backgroundColor:n?is[300]:void 0},onClick:v,onDelete:s,label:L});class zs extends M.Component{labelRef;labelNode=null;input;newChipKeyCodes;newChipKeys;actualInput=null;inputBlurTimeout=null;_keyPressed;_preventChipCreation;styles={};styleTheme=null;constructor(n){super(n),this.state={chips:n.defaultValue||[],focusedChip:null,inputValue:"",isFocused:!1,chipsUpdated:!1,prevPropsValue:[],variant:this.props.variant||"standard"},this.newChipKeyCodes=n.newChipKeyCodes||[13],this.newChipKeys=n.newChipKeys||["Enter"],this.labelRef=M.createRef(),this.input=M.createRef()}componentDidMount(){this.state.variant==="outlined"&&(this.labelNode=ts.findDOMNode(this.labelRef.current),this.forceUpdate())}componentWillUnmount(){this.inputBlurTimeout&&clearTimeout(this.inputBlurTimeout)}static getDerivedStateFromProps(n,i){let l=null;return n.value&&n.value.length!==i.prevPropsValue.length&&(l={prevPropsValue:n.value},n.clearInputValueOnChange&&(l.inputValue="")),n.clearInputValueOnChange&&n.value&&n.value.length!==i.prevPropsValue.length&&(l={prevPropsValue:n.value,inputValue:""}),n.disabled&&(l={...l,focusedChip:null}),!i.chipsUpdated&&n.defaultValue&&(l={...l,chips:n.defaultValue}),l}focus=()=>{var n;(n=this.actualInput)==null||n.focus(),this.state.focusedChip&&this.setState({focusedChip:null})};handleInputBlur=n=>{this.props.onBlur&&this.props.onBlur(n),this.setState({isFocused:!1}),this.state.focusedChip&&this.setState({focusedChip:null});const i=n.target.value;let l;switch(this.props.blurBehavior||"clear"){case"add-or-clear":l={clearInputOnFail:!0};case"add":if(this.props.delayBeforeAdd){const v=(this.props.value||this.state.chips).length;this.inputBlurTimeout=setTimeout(()=>{const s=(this.props.value||this.state.chips).length;v===s?this.handleAddChip(i,l):this.clearInput()},150)}else this.handleAddChip(i,l);break;case"clear":this.clearInput();break}};handleInputFocus=n=>{this.setState({isFocused:!0}),this.props.onFocus&&this.props.onFocus(n)};handleKeyDown=n=>{const{focusedChip:i}=this.state;if(this._keyPressed=!1,this._preventChipCreation=!1,this.props.onKeyDown&&(this.props.onKeyDown(n),n.isDefaultPrevented()))return;const l=this.props.value||this.state.chips;if(this.newChipKeyCodes.includes(n.keyCode)||this.newChipKeys.includes(n.key)){this.handleAddChip(n.target.value)!==!1&&n.preventDefault();return}switch(n.keyCode){case Ht.BACKSPACE:n.target.value===""&&(i?(this.handleDeleteChip(l[i],i),i&&this.setState({focusedChip:i-1})):this.setState({focusedChip:l.length-1}));break;case Ht.DELETE:n.target.value===""&&i&&(this.handleDeleteChip(l[i],i),i<=l.length-1&&this.setState({focusedChip:i}));break;case Ht.LEFT_ARROW:i===null&&n.target.value===""&&l.length?this.setState({focusedChip:l.length-1}):i!==null&&i>0&&this.setState({focusedChip:i-1});break;case Ht.RIGHT_ARROW:i!==null&&i<l.length-1?this.setState({focusedChip:i+1}):this.setState({focusedChip:null});break;default:this.setState({focusedChip:null});break}};handleKeyUp=n=>{!this._preventChipCreation&&(this.newChipKeyCodes.includes(n.keyCode)||this.newChipKeys.includes(n.key))&&this._keyPressed?this.clearInput():this.updateInput(n.target.value),this.props.onKeyUp&&this.props.onKeyUp(n)};handleUpdateInput=n=>{(this.props.inputValue===null||this.props.inputValue===void 0)&&this.updateInput(n.target.value),this.props.onUpdateInput&&this.props.onUpdateInput(n)};handleAddChip(n,i){if(this.props.onBeforeAdd&&!this.props.onBeforeAdd(n))return this._preventChipCreation=!0,i&&i.clearInputOnFail&&this.clearInput(),!1;this.clearInput();const l=this.props.value||this.state.chips;return n.trim().length?((this.props.allowDuplicates||!l.includes(n))&&(this.props.value&&this.props.onAdd?this.props.onAdd(n):this.updateChips([...this.state.chips,n])),!0):!1}handleDeleteChip(n,i){if(this.props.value)this.props.onDelete&&this.props.onDelete(n,i);else{const l=this.state.chips.slice();if(l.splice(i,1)){let s=this.state.focusedChip;this.state.focusedChip===i?s=null:this.state.focusedChip>i&&(s=this.state.focusedChip-1),this.updateChips(l,{focusedChip:s})}}}updateChips(n,i={}){this.setState({chips:n,chipsUpdated:!0,...i}),this.props.onChange&&this.props.onChange(n)}clearInput(){this.updateInput("")}updateInput(n){this.setState({inputValue:n})}setActualInputRef=n=>{this.actualInput=n,this.props.inputRef&&this.props.inputRef(n)};render(){const{alwaysShowPlaceholder:n,chipRenderer:i=Ws,className:l,disabled:v,disableUnderline:s,error:c,FormHelperTextProps:d,fullWidth:o,fullWidthInput:p,helperText:e,id:t,InputProps:r={},InputLabelProps:h={},inputValue:a,label:u,placeholder:f,readOnly:m,required:y,rootRef:x,value:E,margin:w}=this.props,g=this.state.variant;this.styleTheme!==this.props.theme.palette.mode&&(this.styleTheme=this.props.theme.palette.mode,this.styles=j.Utils.getStyle(this.props.theme,Ps));let S=E||this.state.chips||[];Array.isArray(S)||(S=(S||"").toString().split(/[,\s]+/).map(C=>C.trim()));const k=a??this.state.inputValue,D=(this.props.value||k).length||k.length,_=typeof h.shrink=="boolean"?h.shrink:u!==null&&(D||this.state.isFocused||S.length),F=S.map((C,b)=>i({value:C,isDisabled:!!v,isReadOnly:m,isFocused:this.state.focusedChip===b,handleClick:()=>this.setState({focusedChip:b}),handleDelete:()=>this.handleDeleteChip(C,b),style:this.styles.chip},b.toString())),A={};g==="outlined"&&(A.notched=!!_,A.labelWidth=_&&this.labelNode&&this.labelNode.offsetWidth||0),g!=="standard"?A.startAdornment=F:r.disableUnderline=!0;const $=Bs[g];return M.createElement(R.FormControl,{ref:x,fullWidth:o,className:l,sx:{...this.styles.root,...w==="dense"?this.styles.marginDense:{}},error:c,required:S.length>0?void 0:y,onClick:this.focus,disabled:v,variant:g,component:"div",margin:w},u&&M.createElement(R.InputLabel,{htmlFor:t,sx:{"&.MuiInputLabel-root":this.styles.label,"&.MuiInputLabel-shrink":this.styles.labelShrink},shrink:!!_,focused:this.state.isFocused,variant:g,ref:this.labelRef,required:y,component:"label",...h},u),M.createElement(R.Box,{component:"div",id:"input-chip-container",sx:{...this.styles[g],...this.styles.chipContainer,...this.state.isFocused?this.styles.focused:void 0,...!s&&g==="standard"?this.styles.underline:void 0,...v?this.styles.disabled:void 0,...u?this.styles.labeled:void 0,...c?this.styles.error:void 0}},g==="standard"&&F,M.createElement($,{ref:this.input,className:`mui-variant-${this.styles[g]} ${u?"mui-chip-with-label":"mui-chip-no-label"}`,sx:{"&.MuiInputBase-input":{...this.styles.input,...this.styles[g]},"&.MuiInputBase-root":{...this.styles.inputRoot}},id:t,value:k,onChange:this.handleUpdateInput,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,inputRef:this.setActualInputRef,disabled:v,fullWidth:p,placeholder:!D&&(_||u===null||u===void 0)||n?f:null,readOnly:m,...r,...A})),e&&M.createElement(R.FormHelperText,{...d,className:d==null?void 0:d.className,style:this.styles.helperText},e))}}class ii extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,l=K.getValue(n,i);if(this.props.schema.delimiter&&typeof l=="string"){const v=l.split(this.props.schema.delimiter).map(s=>s.trim()).filter(s=>s);this.setState({value:v})}else this.setState({value:l||[]})}renderItem(n,i){const{attr:l,schema:v}=this.props,{value:s}=this.state;return M.createElement(R.FormControl,{fullWidth:!0,variant:"standard"},M.createElement(zs,{value:s,disabled:!!i,label:this.getText(v.label),error:!!n,onAdd:c=>{const d=JSON.parse(JSON.stringify(s));d.push(c),this.setState({value:d},()=>{let o;this.props.schema.delimiter?o=this.onChange(l,d.join(`${this.props.schema.delimiter} `)):o=this.onChange(l,d),o instanceof Promise&&o.catch(p=>console.error(p))})},theme:this.props.oContext.theme,onDelete:(c,d)=>{const o=JSON.parse(JSON.stringify(s));o.splice(d,1),this.setState({value:o},()=>{let p;this.props.schema.delimiter?p=this.onChange(l,o.join(`${this.props.schema.delimiter} `)):p=this.onChange(l,o),p instanceof Promise&&p.catch(e=>console.error(e))})}}),M.createElement(R.FormHelperText,null,j.I18n.t("ra_Press ENTER Key to add new item")),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class Hs extends K{renderColorDialog(){return!!this.state.showColorDialog&&M.createElement(R.Dialog,{onClose:()=>this.setState({showColorDialog:!1}),open:this.state.showColorDialog},M.createElement(Xr,{color:this.state.colorDialogValue,onChange:n=>this.setState({colorDialogValue:n.hex},()=>this.onChange(this.props.attr,this.state.colorDialogValue))}))}renderItem(n,i){const l=K.getValue(this.props.data,this.props.attr);let v=j.Utils.isUseBright(l,null);return v===null&&(v=void 0),M.createElement(M.Fragment,null,this.renderColorDialog(),M.createElement(R.TextField,{variant:"standard",disabled:!!i,style:{minWidth:100,width:"calc(100% - 8px)"},label:this.getText(this.props.schema.label),value:l||"",onClick:()=>!this.props.schema.readOnly&&this.setState({showColorDialog:!0,colorDialogValue:l||""}),onChange:s=>{const c=s.target.value,d=this.onChange(this.props.attr,c);d instanceof Promise&&d.catch(o=>console.error(`Cannot set value: ${o}`))},slotProps:{htmlInput:{style:{backgroundColor:l,color:v?"#FFF":"#000"},readOnly:this.props.schema.readOnly||!1},input:{endAdornment:!this.props.schema.readOnly&&l&&!this.props.schema.noClearButton?M.createElement(R.IconButton,{tabIndex:-1,size:"small",onClick:s=>{s.stopPropagation();const c=this.onChange(this.props.attr,"");c instanceof Promise&&c.catch(d=>console.error(`Cannot set value: ${d}`))}},M.createElement(Z.Close,null)):void 0},inputLabel:{shrink:!0}}}))}}const gn={width:{width:"calc(100% - 85px)"},width50:{width:120,marginRight:5}};class js extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n});const i={};this.props.schema.useSystemName&&(i.useSystem=!!K.getValue(this.props.data,this.props.schema.useSystemName)),this.props.schema.longitudeName&&this.props.schema.latitudeName?(i.longitude=K.getValue(this.props.data,this.props.schema.longitudeName),i.latitude=K.getValue(this.props.data,this.props.schema.latitudeName),!i.longitude&&!i.latitude&&this.props.schema.autoInit&&setTimeout(()=>this.getCoordinates(),300)):!K.getValue(this.props.data,this.props.attr)&&this.props.schema.autoInit&&setTimeout(()=>this.getCoordinates(),300),Object.keys(i).length&&setTimeout(()=>this.setState(i),50)}async getSystemCoordinates(){const n=await this.props.oContext.socket.getCompactSystemConfig();if(n!=null&&n.common&&(n.common.longitude||n.common.latitude))if(window.alert(j.I18n.t("ra_Used system settings")),this.props.schema.longitudeName&&this.props.schema.latitudeName)this.setState({longitude:n.common.longitude,latitude:n.common.latitude},async()=>{await this.onChange(this.props.schema.longitudeName,n.common.longitude),await this.onChange(this.props.schema.latitudeName,n.common.latitude)});else{const i=n.common.latitude+(this.props.schema.divider||",")+n.common.longitude;this.setState({value:i},()=>{const l=this.onChange(this.props.attr,i);l instanceof Promise&&l.catch(v=>console.error(`Cannot set value: ${v}`))})}else window.alert(j.I18n.t("ra_Cannot determine position: System settings are empty and GPS detection is disabled in browser"))}getCoordinates(){navigator.geolocation?navigator.geolocation.getCurrentPosition(async n=>{if(n!=null&&n.coords)if(this.props.schema.longitudeName&&this.props.schema.latitudeName)this.setState({longitude:n.coords.longitude,latitude:n.coords.latitude},async()=>{await this.onChange(this.props.schema.longitudeName,n.coords.longitude||""),await this.onChange(this.props.schema.latitudeName,n.coords.latitude||"")});else{const i=n.coords.latitude+(this.props.schema.divider||",")+n.coords.longitude;this.setState({value:i},()=>{const l=this.onChange(this.props.attr,i);l instanceof Promise&&l.catch(v=>console.error(`Cannot set value: ${v}`))})}else await this.getSystemCoordinates()},async n=>{console.error(`Cannot determine coordinates from browser: ${n.message}`),await this.getSystemCoordinates()}):this.getSystemCoordinates().catch(n=>{console.error(`Cannot determine coordinates: ${n}`)})}renderItem(n,i){return M.createElement(M.Fragment,null,this.props.schema.useSystemName?M.createElement(R.FormControlLabel,{control:M.createElement(R.Checkbox,{checked:!!this.state.useSystem,onChange:l=>{const v=l.target.checked;v&&this.getSystemCoordinates().catch(s=>console.error(`Cannot determine coordinates: ${s}`)),this.setState({useSystem:v},()=>this.onChange(this.props.schema.useSystemName,v))}}),label:j.I18n.t("ra_Use system settings for position")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?M.createElement(R.TextField,{variant:"standard",style:gn.width50,value:this.state.longitude??"",error:!!n,disabled:this.state.useSystem||!!i,onChange:l=>{const v=l.target.value;this.setState({longitude:v},()=>{const s=this.onChange(this.props.schema.longitudeName,(v||"").trim());s instanceof Promise&&s.catch(c=>console.error(`Cannot set value: ${c}`))})},label:j.I18n.t("ra_Longitude")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?M.createElement(R.TextField,{variant:"standard",style:gn.width50,value:this.state.latitude??"",error:!!n,disabled:this.state.useSystem||!!i,onChange:l=>{const v=l.target.value;this.setState({latitude:v},()=>this.onChange(this.props.schema.latitudeName,(v||"").trim()))},label:j.I18n.t("ra_Latitude")}):null,!this.props.schema.longitudeName||!this.props.schema.latitudeName?M.createElement(R.TextField,{variant:"standard",style:gn.width,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!n,disabled:!!i,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.state.useSystem}},onChange:l=>{const v=l.target.value;this.setState({value:v},()=>this.onChange(this.props.attr,(v||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}):null,this.state.useSystem?null:M.createElement(R.Fab,{size:"small",onClick:()=>this.getCoordinates(),title:j.I18n.t("ra_Take browser position"),style:{marginRight:4}},M.createElement(Z.LocationOn,null)),this.state.useSystem?null:M.createElement(R.Fab,{size:"small",onClick:()=>this.getSystemCoordinates(),title:j.I18n.t("ra_Take position from system settings")},M.createElement(Z.GpsFixed,null)))}}os({name:"iobroker_admin",shared:{"@iobroker/adapter-react-v5":{lib:()=>es,version:"*"},"@mui/icons-material":{lib:()=>qr,version:"*"},"@iobroker/json-config":{lib:()=>ls,version:"*"}},remotes:[]});class _t extends K{static runningLoads={};constructor(n){super(n),Object.assign(this.state,{Component:null,error:""})}async componentDidMount(){if(!this.props.schema.url){console.error("URL is empty. Cannot load custom component!"),this.setState({error:"URL is empty. Cannot load custom component!"});return}let n;this.props.schema.url.startsWith("http:")||this.props.schema.url.startsWith("https:")?n=this.props.schema.url:this.props.schema.url.startsWith("./")?n=`${window.location.protocol}//${window.location.host}${this.props.schema.url.replace(/^\./,"")}`:n=`${window.location.protocol}//${window.location.host}/adapter/${this.props.oContext.adapterName}/${this.props.schema.url}`;const[i,l,...v]=this.props.schema.name.split("/"),s=v.join("/");if(!n){console.error('Cannot find URL for custom component! Please define "url" as "custom/customComponents.js" in the schema');return}if(!i||!l||!s){console.error('Invalid format of "name"! Please define "name" as "ConfigCustomBackItUpSet/Components/AdapterExist" in the schema');return}let c=_t.runningLoads[`${n}!${l}`];if(!(c instanceof Promise)){let d;if(this.props.schema.i18n===!0){const o=n.lastIndexOf("/");let p;o!==-1?p=n.substring(0,o):p=n;const e=j.I18n.getLanguage(),t=`${p}/i18n/${e}.json`;d=fetch(t).then(r=>r.json()).then(r=>j.I18n.extendTranslations(r,e)).catch(r=>{if(e!=="en"){fetch(`${p}/i18n/en.json`).then(h=>h.json()).then(h=>j.I18n.extendTranslations(h,e)).catch(h=>console.log(`Cannot load i18n "${t}": ${h}`));return}console.log(`Cannot load i18n "${t}": ${r}`)})}else if(this.props.schema.i18n&&typeof this.props.schema.i18n=="object")try{j.I18n.extendTranslations(this.props.schema.i18n)}catch(o){console.error(`Cannot import i18n: ${o}`)}try{console.log(n,i,l,s),rs([{name:i,entry:n,type:this.props.schema.bundlerType||void 0}]),c=ss(`${i}/${l}`),d instanceof Promise&&(c=Promise.all([c,d]).then(o=>o[0])),_t.runningLoads[`${n}!${l}`]=c}catch(o){console.error(o),this.setState({error:`Cannot import from ${this.props.schema.url}: ${o}`})}}try{const d=(await c).default;if(d!=null&&d[s])this.setState({Component:d[s]});else{const o=Object.keys(d||{});console.error("URL is empty. Cannot load custom component!"),this.setState({error:`Component ${this.props.schema.name} not found in ${this.props.schema.url}. Found: ${o.join(", ")}`})}}catch(d){console.error(d),this.setState({error:`Cannot import from ${this.props.schema.url}: ${d}`})}}render(){const n=this.state.Component,i=this.props.schema||{},l=n?M.createElement(n,{...this.props,socket:this.props.oContext.socket,theme:this.props.oContext.theme,themeType:this.props.oContext.themeType,instance:this.props.oContext.instance,adapterName:this.props.oContext.adapterName,systemConfig:this.props.oContext.systemConfig,forceUpdate:this.props.oContext.forceUpdate}):this.state.error?M.createElement("div",null,this.state.error):M.createElement(R.LinearProgress,null);return i.newLine?M.createElement(M.Fragment,null,M.createElement("div",{style:{flexBasis:"100%",height:0}}),l):l}}class Vs extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n})}renderItem(n,i){return M.createElement(_i.DatePicker,{sx:l=>({width:"100%",borderBottom:`1px solid ${l.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${l.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:"translate(0px, -9px) scale(0.75)"}}),format:this.props.oContext.systemConfig.dateFormat.toLowerCase().replace("mm","MM"),disabled:!!i,value:this.state.value,onChange:l=>{this.setState({value:l},()=>this.onChange(this.props.attr,this.state.value))},label:this.getText(this.props.schema.label)})}}class Us extends K{renderItem(){if(!this.props.schema)return null;if(this.props.oContext.DeviceManager){const i=this.props.oContext.DeviceManager;return M.createElement(i,{uploadImagesToInstance:`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,title:this.getText(this.props.schema.label),socket:this.props.oContext.socket,selectedInstance:`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,themeName:this.props.themeName,theme:this.props.oContext.theme,themeType:this.props.oContext.themeType,isFloatComma:this.props.oContext.isFloatComma,dateFormat:this.props.oContext.dateFormat})}return M.createElement("div",null,"DeviceManager not found")}}const Re={fullWidth:{width:"100%"},uploadDiv:{position:"relative",width:"100%"},uploadDivDragging:{opacity:1,background:"rgba(128,255,128,0.1)"},uploadCenterDiv:{margin:5,border:"3px dashed grey",borderRadius:5,width:"100%",height:"100%",position:"absolute",display:"flex"},uploadCenterIcon:{paddingTop:10,width:48,height:48},uploadCenterText:{fontSize:16},uploadCenterTextAndIcon:{textAlign:"center",position:"absolute",top:0,bottom:0,left:0,right:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},disabledOpacity:{opacity:.3,cursor:"default"},error:{border:"2px solid red"},deleteButton:{},selectedImage:{height:40,width:40,display:"inline-block",marginRight:8}},Gs=["jpg","jpeg","svg","png","webp","gif","apng","avif","webp"],Ks=["mp3","ogg","wav","aac"],Js=["avi","mp4","mov"],Ys=["txt","log","html","htm"],Qs=["json","js","ts"];class en extends K{dropzoneRef;imagePrefix;objectID;path;constructor(n){super(n),this.dropzoneRef=M.createRef(),this.imagePrefix=this.props.oContext.imagePrefix===void 0?"./files":this.props.oContext.imagePrefix}componentDidMount(){super.componentDidMount(),this.objectID=(this.props.schema.objectID||"0_userdata.0").replace("%INSTANCE%",(this.props.oContext.instance||0).toString()),this.path=this.props.schema.upload,this.path&&(this.path==="/"?this.path="":this.path.endsWith("/")||(this.path=`${this.path}/`)),this.updateFiles().then(()=>{const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n}),this.props.oContext.socket.subscribeFiles(this.objectID,`${this.path}/*`,this.onFolderChanged).catch(i=>console.error(`Cannot subscribe: ${i}`))})}onFolderChanged=(n,i)=>{this.path&&i.startsWith(this.path)&&this.updateFiles().catch(l=>console.error(`Cannot update files: ${l}`))};componentWillUnmount(){this.props.oContext.socket.subscribeFiles(this.objectID,`${this.path}/*`,this.onFolderChanged).catch(n=>console.error(`Cannot subscribe: ${n}`)),super.componentWillUnmount()}async updateFiles(){const n=await this.readFiles(this.props.schema.pattern);await new Promise(i=>this.setState({files:n},i))}async readFolder(n,i,l){try{const v=await this.props.oContext.socket.readDir(this.objectID,n.replace(/^\//,"")||null);for(let s=0;s<v.length;s++){const c=v[s];if(c.isDir)await this.readFolder(`${n+c.file}/`,i,l);else{let d=!1;l==="*.*"&&c.file.includes(".")||!l||l==="*"||l===".*"&&c.file.startsWith(".")?d=!0:d=new RegExp(`^${l.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(c.file),d&&i.push({name:n+c.file,size:c.stats?j.Utils.formatBytes(c.stats.size):"--"})}}}catch(v){console.error(`Cannot read "${n}": ${v}`)}return i}async readFiles(n){const i=[];n=n||this.props.schema.pattern,n||(n="**/*.*");let l;const v=n.lastIndexOf("/");if(v===-1?l=n:l=n.substring(v+1),n.startsWith("**"))await this.readFolder("/",i,l);else{const s=n.lastIndexOf("/");if(s===-1)await this.readFolder("/",i,l);else{const c=n.substring(0,s+1);await this.readFolder(c,i,l)}}return i}onDrop(n){const i=n[0],l=new FileReader,v=this.props.schema.maxSize||2*1024*1024;l.onabort=()=>console.log("file reading was aborted"),l.onerror=()=>console.log("file reading has failed"),l.onload=()=>{if(i.size>v){window.alert(j.I18n.t("File is too big. Max %sk allowed. Try use SVG.",Math.round(v/1024)));return}this.props.oContext.socket.writeFile64(this.objectID,this.path+i.name,l.result).then(()=>this.updateFiles()).then(()=>this.setState({value:this.path+i.name},()=>this.onChange(this.props.attr,this.path+i.name))).catch(s=>window.alert(`Cannot upload file: ${s}`))},l.readAsArrayBuffer(i)}renderDeleteDialog(){return this.state.deleteFile?M.createElement(j.DialogConfirm,{title:j.I18n.t("ra_Are you sure?"),text:j.I18n.t("ra_File will be deleted"),ok:j.I18n.t("ra_Delete"),cancel:j.I18n.t("ra_Cancel"),onClose:n=>{const i=this.state.deleteFile;this.setState({deleteFile:""},()=>{n&&this.props.oContext.socket.deleteFile(this.objectID,i).then(()=>this.updateFiles()).catch(l=>window.alert(`Cannot delete file: ${l}`))})}}):null}static base64ToArrayBuffer(n){const i=window.atob(n),l=i.length,v=new Uint8Array(l);for(let s=0;s<l;s++)v[s]=i.charCodeAt(s);return v.buffer}loadFile(){return this.props.oContext.socket.readFile(this.objectID,this.state.value,!0)}play(){this.loadFile().then(n=>{if(typeof AudioContext<"u"){const i=new AudioContext,l=en.base64ToArrayBuffer(n.file);i.decodeAudioData(l,v=>{const s=i.createBufferSource();s.buffer=v,s.connect(i.destination),s.start(0)},v=>window.alert(`Cannot play: ${v.message}`))}})}getFileIcon(n){return n!=null&&n.extension?Gs.includes(n.extension)?M.createElement("div",{style:{...Re.selectedImage,backgroundImage:`url(${this.imagePrefix}/${this.objectID}/${n.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"}}):Ks.includes(n.extension)?M.createElement(Z.MusicNote,null):Ys.includes(n.extension)?M.createElement(Z.Article,null):Js.includes(n.extension)?M.createElement(Z.Videocam,null):Qs.includes(n.extension)?M.createElement(Z.Code,null):null:null}renderItem(n,i){if(!this.state.files)return null;const l=[];this.props.schema.withFolder||this.state.files.forEach(e=>{const t=e.name.lastIndexOf("/");if(t===-1)l.includes("/")||l.push("/");else{const r=e.name.substring(0,t+1);l.includes(r)||l.push(r)}});const v=this.state.files.map(e=>({value:e.name,label:!this.props.schema.withFolder&&l.length===1?`${e.name.substring(l[0].length)}`:`${e.name}${this.props.schema.noSize?"":`(${e.size})`}`,extension:e.name.toLowerCase().split(".").pop()}));this.props.schema.noNone||v.unshift({label:j.I18n.t("ra_none"),value:""});const s=v.find(e=>e.value===this.state.value);let c=0;this.props.schema.upload&&c++,this.props.schema.refresh&&c++;const d=this.state.value&&(this.state.value.endsWith(".mp3")||this.state.value.endsWith(".ogg")||this.state.value.endsWith(".wav"));d&&c++;const o=M.createElement("div",{style:Re.fullWidth},M.createElement(R.FormControl,{variant:"standard",style:{width:`calc(100% - ${c*42}px)`}},this.props.schema.label?M.createElement(R.InputLabel,null,this.getText(this.props.schema.label)):null,M.createElement(R.Select,{variant:"standard",error:!!n,disabled:!!i,value:this.state.value||"_",renderValue:()=>M.createElement(M.Fragment,null,this.getFileIcon(s),M.createElement("span",null,(s==null?void 0:s.label)||"")),onChange:e=>{this.setState({value:e.target.value==="_"?"":e.target.value},()=>this.onChange(this.props.attr,this.state.value))}},v.map(e=>M.createElement(R.MenuItem,{key:e.value,value:e.value},M.createElement(R.ListItemIcon,null,this.getFileIcon(e)),M.createElement(R.ListItemText,null,e.label),this.props.schema.delete&&s.value?M.createElement(R.IconButton,{style:Re.deleteButton,size:"small",onClick:()=>this.setState({deleteFile:s.value})},M.createElement(Z.Delete,null)):null))),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null),this.props.schema.refresh&&M.createElement(R.IconButton,{onClick:()=>this.updateFiles()},M.createElement(Z.Refresh,null)),this.props.schema.upload&&M.createElement(R.IconButton,{onClick:()=>{var e;return(e=this.dropzoneRef.current)==null?void 0:e.open()}},M.createElement(Z.UploadFile,null)),d&&M.createElement(R.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},M.createElement(Z.PlayArrow,null)));if(!this.props.schema.upload)return M.createElement(M.Fragment,null,o,this.renderDeleteDialog());let p={"*/*":[]};if(this.props.schema.fileTypes==="image"?p={"image/*":[".png",".jpg",".svg",".gif",".apng",".avif",".webp"]}:this.props.schema.fileTypes==="audio"?p={"audio/*":[".mp3",".ogg",".wav",".mp4"]}:this.props.schema.fileTypes==="text"&&(p={"text/plain":[".txt"]}),this.props.schema.pattern){const e=this.props.schema.pattern.split("/").pop().toLowerCase().replace(/.*\./,"");e==="png"||e==="jpg"||e==="svg"||e==="gif"||e==="apng"||e==="avif"||e==="webp"?p={"image/*":[".png",".jpg",".svg",".gif",".apng",".avif",".webp"]}:e==="mp3"||e==="ogg"||e==="wav"?p={"audio/*":[".mp3",".ogg",".wav",".mp4"]}:e==="ics"?p={"text/calendar":[".ics"]}:e==="txt"?p={"text/plain":[".txt"]}:e==="pem"?p={"text/plain":[".pem"]}:p={"*/*":[`.${e}`]}}return M.createElement(Ti,{ref:this.dropzoneRef,multiple:!1,accept:p,noKeyboard:!0,noClick:!0,maxSize:this.props.schema.maxSize||2*1024*1024,onDragEnter:()=>{this.setState({uploadFile:"dragging"})},onDragLeave:()=>this.setState({uploadFile:!0}),onDrop:(e,t)=>{var r,h,a;this.setState({uploadFile:!1}),e.length?this.onDrop(e):window.alert(((a=(h=(r=t==null?void 0:t[0])==null?void 0:r.errors)==null?void 0:h[0])==null?void 0:a.message)||j.I18n.t("Cannot upload"))}},({getRootProps:e,getInputProps:t})=>M.createElement("div",{style:{...Re.uploadDiv,...this.state.uploadFile==="dragging"?Re.uploadDivDragging:void 0,...i?Re.disabledOpacity:void 0},...e()},M.createElement("input",{...t()}),this.state.uploadFile==="dragging"?M.createElement("div",{style:{...Re.uploadCenterDiv,...this.state.uploadError?Re.error:void 0}},M.createElement("div",{style:Re.uploadCenterTextAndIcon},M.createElement(Z.UploadFile,{style:Re.uploadCenterIcon}),M.createElement("div",{style:Re.uploadCenterText},this.state.uploadFile==="dragging"?j.I18n.t("ra_Drop file here"):j.I18n.t("ra_Place your files here or click here to open the browse dialog")))):null,o,this.renderDeleteDialog()))}}const jt={fullWidth:{width:"100%"},fullWidthOneButton:{width:"calc(100% - 69px)",marginRight:4},fullWidthIcon:{width:"calc(100% - 119px)",marginRight:4},selectedImage:{height:40,width:40,display:"inline-block",marginRight:8}},Zs=["jpg","jpeg","svg","png","webp","gif","apng","avif","webp"],Xs=["mp3","ogg","wav","aac"],qs=["avi","mp4","mov"],eo=["txt","log","html","htm"],to=["json","js","ts"];class no extends K{imagePrefix="../..";componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.imagePrefix=this.props.oContext.imagePrefix===void 0?"./files":this.props.oContext.imagePrefix,this.setState({value:n??""})}static getDerivedStateFromProps(n,i){const l=K.getValue(n.data,n.attr);return l==null||l.toString().trim()!==(i.value||"").toString().trim()?{value:l??""}:null}loadFile(){const n=this.state.value.indexOf("/");if(n!==-1){const i=this.state.value.substring(0,n),l=this.state.value.substring(n+1);return this.props.oContext.socket.readFile(i,l,!0)}return Promise.resolve(null)}play(){this.loadFile().then(n=>{if(typeof AudioContext<"u"&&(n!=null&&n.file)){const i=new AudioContext,l=en.base64ToArrayBuffer(n.file);i.decodeAudioData(l,v=>{const s=i.createBufferSource();s.buffer=v,s.connect(i.destination),s.start(0)},v=>window.alert(`Cannot play: ${v.message}`))}})}getIcon(){const n=this.state.value.split(".").pop().toLowerCase();return Zs.includes(n)?M.createElement("div",{style:{...jt.selectedImage,backgroundImage:`url(${this.imagePrefix}/${this.state.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"}}):Xs.includes(n)?M.createElement(R.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},M.createElement(Z.PlayArrow,null)):eo.includes(n)?M.createElement(Z.Article,null):qs.includes(n)?M.createElement(Z.Videocam,null):to.includes(n)?M.createElement(Z.Code,null):null}renderFileBrowser(){return this.state.showFileBrowser?M.createElement(j.DialogSelectFile,{imagePrefix:this.props.oContext.imagePrefix,socket:this.props.oContext.socket,selected:this.state.value,onClose:()=>this.setState({showFileBrowser:!1}),onOk:n=>{const i=Array.isArray(n)?n[0]:n;this.setState({value:i},()=>this.onChange(this.props.attr,this.props.schema.trim===!1?i:(i||"").trim()))},selectOnlyFolders:this.props.schema.selectOnlyFolders,allowUpload:this.props.schema.allowUpload,allowDownload:this.props.schema.allowDownload,allowCreateFolder:this.props.schema.allowCreateFolder,allowView:this.props.schema.allowView,showToolbar:this.props.schema.showToolbar,limitPath:this.props.schema.limitPath,theme:this.props.oContext.theme}):null}renderItem(n,i){const l=this.getIcon();return M.createElement("div",{style:jt.fullWidth},l,M.createElement(R.TextField,{variant:"standard",style:l?jt.fullWidthIcon:jt.fullWidthOneButton,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!n,disabled:!!i,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:!!this.props.schema.disableEdit}},onChange:v=>{const s=v.target.value;this.setState({value:s},()=>this.onChange(this.props.attr,this.props.schema.trim===!1?s:(s||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}),M.createElement(R.Button,{disabled:i,variant:"outlined",onClick:()=>this.setState({showFileBrowser:!0})},"..."),this.renderFileBrowser())}}class io extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.props.oContext.socket.getEnums("functions").then(i=>{const l=Object.keys(i).map(v=>({value:this.props.schema.short?v.replace("enum.functions.",""):v,label:this.getText(i[v].common.name),obj:i[v]}));this.props.schema.allowDeactivate!==!1&&l.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({value:n,selectOptions:l})})}renderItem(n,i){if(!this.state.selectOptions)return null;const l=this.state.selectOptions.find(v=>v.value===this.state.value);return M.createElement(R.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?M.createElement(R.InputLabel,null,this.getText(this.props.schema.label)):null,M.createElement(R.Select,{variant:"standard",error:!!n,disabled:!!i,value:this.state.value||"_",renderValue:()=>l?l.obj?M.createElement(j.TextWithIcon,{value:l.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):l.label:"",onChange:v=>{this.setState({value:v.target.value==="_"?"":v.target.value},()=>this.onChange(this.props.attr,this.state.value))}},this.state.selectOptions.map(v=>M.createElement(R.MenuItem,{key:v.value,value:v.value,style:v.value===K.DIFFERENT_VALUE?{opacity:.5}:{}},v.obj?M.createElement(j.TextWithIcon,{value:v.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):v.label))),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class ro extends K{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getHostByIp(this.props.common.host).then(n=>{this.props.schema.listenOnAllPorts||(n=n.filter(i=>i.address!=="0.0.0.0"&&i.address!=="::")),this.props.schema.onlyIp4?n=n.filter(i=>i.family==="ipv4"):this.props.schema.onlyIp6&&(n=n.filter(i=>i.family==="ipv6")),this.props.schema.noInternal&&(n=n.filter(i=>!i.internal)),n.forEach(i=>{i.address==="0.0.0.0"?i.name=`[IPv4] 0.0.0.0 - ${j.I18n.t("ra_Listen on all IPs")}`:i.address==="::"&&(i.name=`[IPv6] :: - ${j.I18n.t("ra_Listen on all IPs")}`)}),this.setState({ips:n})}).catch(n=>console.error(n))}renderItem(n,i){var s,c;const l=K.getValue(this.props.data,this.props.attr),v=(s=this.state.ips)==null?void 0:s.find(d=>d.address===l);return M.createElement(R.FormControl,{fullWidth:!0,variant:"standard"},this.state.ips&&this.props.schema.label?M.createElement(R.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.ips?M.createElement(R.Select,{variant:"standard",error:!!n,disabled:!!i,value:l,renderValue:d=>(v==null?void 0:v.name)||d,onChange:d=>this.onChange(this.props.attr,d.target.value)},(c=this.state.ips)==null?void 0:c.map((d,o)=>M.createElement(R.MenuItem,{key:o,value:d.address},d.name))):M.createElement(R.TextField,{fullWidth:!0,variant:"standard",error:!!n,disabled:!!i,value:l,onChange:d=>this.onChange(this.props.attr,d.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class so extends K{initialized=!1;localContext;componentDidMount(){super.componentDidMount(),this.askInstance()}askInstance(){if(this.props.alive){let n=this.props.schema.data;if(n===void 0&&this.props.schema.jsonData){const i=this.getPattern(this.props.schema.jsonData,null,!0);if(i)try{n=JSON.parse(i)}catch{console.error(`Cannot parse json data: ${JSON.stringify(n)}`)}}n===void 0&&(n=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",n).then(i=>this.setState({image:i||""}))}}getContext(){const n={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(i=>n[i]=K.getValue(this.props.data,i)),JSON.stringify(n)}renderItem(){if(this.props.alive){const n=this.getContext();(n!==this.localContext||!this.initialized)&&(this.localContext=n,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}return this.state.image===void 0?null:M.createElement("img",{alt:"dynamic content",src:this.state.image,style:{width:this.props.schema.width||"100%",height:this.props.schema.height}})}}class oo extends K{index;constructor(n){super(n),this.index=Date.now()}componentDidMount(){if(super.componentDidMount(),this.props.schema.base64){const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n})}else this.props.oContext.socket.fileExists(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr).then(n=>n&&this.loadImage())}_getUrl(n){n&&(this.index=Date.now());let i=`files/${this.props.oContext.adapterName}.${this.props.oContext.instance}/${this.props.attr}?t=${this.index}`;return window.location.port==="3000"&&(i=`${window.location.protocol}//${window.location.hostname}:8081/${i}`),i}loadImage(){fetch(this._getUrl()).then(n=>n.blob()).then(n=>{const i=new FileReader;i.onload=()=>{this.setState({value:i.result})},i.readAsDataURL(n)}).catch(n=>console.error(n))}renderItem(n,i){return M.createElement(R.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?M.createElement(R.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,M.createElement(j.UploadImage,{error:!!n,disabled:i,accept:this.props.schema.accept,crop:this.props.schema.crop,maxSize:this.props.schema.maxSize||256*1024,icon:this.state.value||void 0,removeIconFunc:()=>this.setState({value:null},()=>{if(this.props.schema.base64){const l=this.onChange(this.props.attr,this.state.value);l instanceof Promise&&l.catch(v=>console.error(`Cannot set value: ${v}`))}else this.props.oContext.socket.deleteFile(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr).catch(l=>console.error(l))}),onChange:l=>this.setState({value:l},()=>{if(this.props.schema.base64){const v=this.onChange(this.props.attr,this.state.value);v instanceof Promise&&v.catch(s=>console.error(`Cannot set value: ${s}`))}else l.startsWith("data")&&(l=l.split(",")[1]);this.props.oContext.socket.writeFile64(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr,l).catch(v=>console.error(v))})}),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class ao extends K{renderItem(){return M.createElement(j.InfoBox,{type:this.props.schema.boxType||"info",closeable:this.props.schema.closeable!==void 0?this.props.schema.closeable:!0,storeId:this.props.schema.closed!==void 0?void 0:`${!!this.props.oContext.adapterName} ${this.props.attr}`,closed:this.props.schema.closed,style:{width:"100%",...this.props.schema.style}},this.props.schema.title?M.createElement(R.Box,{component:"div",sx:{fontWeight:"bold",fontSize:"larger"}},this.getText(this.props.schema.title)):null,this.getText(this.props.schema.text))}}const ri={icon:{width:20,height:20,marginRight:4}};class lo extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);let i=this.props.schema.adapter;i==="_dataSources"&&(i=void 0),this.props.oContext.socket.getAdapterInstances(i,!0).then(async l=>{this.props.schema.adapter==="_dataSources"?l=l.filter(s=>{var c;return(c=s==null?void 0:s.common)==null?void 0:c.getHistory}):this.props.schema.adapter?l=l.filter(s=>s==null?void 0:s._id.startsWith(`system.adapter.${this.props.schema.adapter}.`)):this.props.schema.adapters&&Array.isArray(this.props.schema.adapters)&&(l=l.filter(s=>{var c;return this.props.schema.adapters.includes((c=s==null?void 0:s.common)==null?void 0:c.name)})),this.props.schema.onlyEnabled&&(l=l.filter(s=>{var c;return(c=s==null?void 0:s.common)==null?void 0:c.enabled}));const v=l.map(s=>({value:this.props.schema.long?s._id:this.props.schema.short?s._id.split(".").pop():s._id.replace(/^system\.adapter\./,""),label:`${s.common.name} [${s._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${s.common.name}/${s.common.icon}`}));v.sort((s,c)=>s.value>c.value?1:s.value<c.value?-1:0),this.props.schema.allowDeactivate!==!1&&v.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.props.schema.all&&v.unshift({label:j.I18n.t("sch_all"),value:"*"}),this.setState({value:n||"",selectOptions:v}),await this.props.oContext.socket.subscribeObject(`system.adapter.${i?`${i}.`:""}*`,this.onInstancesUpdate)}).catch(l=>console.error(`Cannot get instances: ${l}`))}componentWillUnmount(){this.props.oContext.socket.unsubscribeObject("system.adapter.*",this.onInstancesUpdate).then(()=>{}),super.componentWillUnmount()}onInstancesUpdate=(n,i)=>{if(!n.match(/^system\.adapter\.[-_a-z\d]+\.\d+$/))return;const l=this.props.schema.long?n:this.props.schema.short?n.split(".").pop():n.replace(/^system\.adapter\./,""),v=this.state.selectOptions.findIndex(s=>s.value===l);if(i){if(this.props.schema.adapter==="_dataSources"&&(!i.common||!i.common.getHistory))return;if(v===-1){const s=JSON.parse(JSON.stringify(this.state.selectOptions)),c=typeof i.common.name=="object"?i.common.name[j.I18n.getLanguage()]||i.common.name.en:i.common.name;s.push({value:this.props.schema.long?i._id:this.props.schema.short?i._id.split(".").pop():i._id.replace(/^system\.adapter\./,""),label:`${c} [${i._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${c}/${i.common.icon}`}),s.sort((d,o)=>d.label>o.label?1:d.label<o.label?-1:0),this.setState({selectOptions:s})}}else if(v!==-1){const s=JSON.parse(JSON.stringify(this.state.selectOptions)),c={};this.state.value===s[v].value&&(c.value=K.NONE_VALUE),s.splice(v,1),c.selectOptions=s,this.setState(c)}};renderItem(n,i){var v;if(!this.state.selectOptions)return null;const l=(v=this.state.selectOptions)==null?void 0:v.find(s=>s.value===this.state.value);return M.createElement(R.FormControl,{fullWidth:!0,key:this.props.attr,variant:"standard"},this.props.schema.label?M.createElement(R.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,M.createElement(R.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:this.state.value,renderValue:()=>M.createElement("span",{style:{display:"flex"}},l!=null&&l.icon?M.createElement("img",{src:`./${l.icon}`,alt:l.value,style:ri.icon}):null,this.getText(l==null?void 0:l.label,!0)),onChange:s=>this.setState({value:s.target.value},()=>this.onChange(this.props.attr,this.state.value))},this.state.selectOptions.map(s=>M.createElement(R.MenuItem,{key:s.value,value:s.value,style:s.value===K.NONE_VALUE?{opacity:.5}:{}},s.icon?M.createElement("img",{src:`./${s.icon}`,alt:s.value,style:ri.icon}):null,this.getText(s.label,!0)))),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const si={address:{fontSize:"smaller",opacity:.5,marginLeft:8}};class ho extends K{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getObject(`system.host.${this.props.common.host}`).then(n=>{var l,v;const i=[];if((v=(l=n==null?void 0:n.native)==null?void 0:l.hardware)!=null&&v.networkInterfaces){const s=n.native.hardware.networkInterfaces;Object.keys(s).forEach(c=>{if(this.props.schema.ignoreInternal&&!s[c].find(o=>!o.internal)||this.props.schema.ignoreLoopback&&s[c].find(o=>o.address==="127.0.0.1"||o.address==="::1"))return;let d=s[c].find(o=>o.family==="IPv4");d=d||s[c].find(o=>o.family==="IPv6"),i.push({value:c,address:d.address})})}this.setState({interfaces:i})}).catch(n=>window.alert(`Cannot read interfaces: ${n}`))}renderItem(n,i){var s,c,d;const l=K.getValue(this.props.data,this.props.attr),v=(s=this.state.interfaces)==null?void 0:s.find(o=>o.value===l);return M.createElement(R.FormControl,{fullWidth:!0,variant:"standard"},(c=this.state.interfaces)!=null&&c.length&&this.props.schema.label?M.createElement(R.InputLabel,null,this.getText(this.props.schema.label)):null,(d=this.state.interfaces)!=null&&d.length?M.createElement(R.Select,{variant:"standard",error:!!n,disabled:!!i,value:l,renderValue:o=>v?M.createElement("span",null,v.value,M.createElement("span",{style:si.address},v.address)):o,onChange:o=>this.onChange(this.props.attr,o.target.value)},this.state.interfaces.map((o,p)=>M.createElement(R.MenuItem,{key:p,value:o.value},M.createElement("span",null,o.value,M.createElement("span",{style:si.address},o.address))))):M.createElement(R.TextField,{fullWidth:!0,variant:"standard",error:!!n,disabled:!!i,value:l,onChange:o=>this.onChange(this.props.attr,o.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const vt={modalDialog:{minWidth:400,maxWidth:800},overflowHidden:{display:"flex",overflow:"hidden"},titleIcon:{marginRight:5},content:{fontSize:16},languageButton:{position:"absolute",right:8,top:8},languageButtonActive:{color:"primary.main"}},co=({toggleTranslation:L,noTranslation:n,title:i,fullWidth:l,help:v,maxWidth:s,progress:c,icon:d,applyDisabled:o,applyButton:p,onClose:e,children:t,titleButtonApply:r,titleButtonClose:h,onApply:a,textInput:u,defaultValue:f,overflowHidden:m})=>{const[y,x]=qe.useState(f);qe.useEffect(()=>{x(f)},[f]);let E=null;return d&&(E=d),M.createElement(R.Dialog,{open:!0,maxWidth:s||"md",fullWidth:!!l,disableEscapeKeyDown:!1,onClose:e,sx:{"& .MuiPaper-root":vt.modalDialog}},i&&M.createElement(R.DialogTitle,null,d?M.createElement(E,{style:vt.titleIcon}):null,i,j.I18n.getLanguage()!=="en"&&L?M.createElement(R.IconButton,{size:"large",style:{...vt.languageButton,...n?vt.languageButtonActive:{}},onClick:()=>L(),title:j.I18n.t("Disable/Enable translation")},M.createElement(Z.Language,null)):null),M.createElement(R.DialogContent,{sx:{...m?vt.overflowHidden:{},...vt.content},style:{paddingTop:8}},u&&M.createElement(R.TextField,{autoComplete:"off",fullWidth:!0,autoFocus:!0,variant:"outlined",size:"medium",multiline:!0,value:y,onChange:w=>x(w.target.value)}),t,v?M.createElement("div",null,v):null),M.createElement(R.DialogActions,null,p!==!1&&M.createElement(R.Button,{startIcon:M.createElement(Z.Check,null),disabled:c||o&&f===y,onClick:()=>a&&a(u?y:""),variant:"contained",color:"primary"},j.I18n.t(r||"Ok")),M.createElement(R.Button,{color:"grey",onClick:()=>e&&e(),disabled:c,variant:"contained",startIcon:M.createElement(Z.Close,null)},j.I18n.t(h||"Cancel"))))};var wt={},ut={},Ii={exports:{}};(function(L,n){(function(){var i="ace",l=function(){return this}();!l&&typeof window<"u"&&(l=window);var v=function(e,t,r){if(typeof e!="string"){v.original?v.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(r=t),v.modules[e]||(v.payloads[e]=r,v.modules[e]=null)};v.modules={},v.payloads={};var s=function(e,t,r){if(typeof t=="string"){var h=o(e,t);if(h!=null)return r&&r(),h}else if(Object.prototype.toString.call(t)==="[object Array]"){for(var a=[],u=0,f=t.length;u<f;++u){var m=o(e,t[u]);if(m==null&&c.original)return;a.push(m)}return r&&r.apply(null,a)||!0}},c=function(e,t){var r=s("",e,t);return r==null&&c.original?c.original.apply(this,arguments):r},d=function(e,t){if(t.indexOf("!")!==-1){var r=t.split("!");return d(e,r[0])+"!"+d(e,r[1])}if(t.charAt(0)=="."){var h=e.split("/").slice(0,-1).join("/");for(t=h+"/"+t;t.indexOf(".")!==-1&&a!=t;){var a=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return t},o=function(e,t){t=d(e,t);var r=v.modules[t];if(!r){if(r=v.payloads[t],typeof r=="function"){var h={},a={id:t,uri:"",exports:h,packaged:!0},u=function(m,y){return s(t,m,y)},f=r(u,h,a);h=f||a.exports,v.modules[t]=h,delete v.payloads[t]}r=v.modules[t]=h||r}return r};function p(e){var t=l;l[e]||(l[e]={}),t=l[e],(!t.define||!t.define.packaged)&&(v.original=t.define,t.define=v,t.define.packaged=!0),(!t.require||!t.require.packaged)&&(c.original=t.require,t.require=c,t.require.packaged=!0)}p(i)})(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(i,l,v){function s(c,d,o){Object.defineProperty(c,d,{value:o,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||s(String.prototype,"startsWith",function(c,d){return d=d||0,this.lastIndexOf(c,d)===d}),String.prototype.endsWith||s(String.prototype,"endsWith",function(c,d){var o=this;(d===void 0||d>o.length)&&(d=o.length),d-=c.length;var p=o.indexOf(c,d);return p!==-1&&p===d}),String.prototype.repeat||s(String.prototype,"repeat",function(c){for(var d="",o=this;c>0;)c&1&&(d+=o),(c>>=1)&&(o+=o);return d}),String.prototype.includes||s(String.prototype,"includes",function(c,d){return this.indexOf(c,d)!=-1}),Object.assign||(Object.assign=function(c){if(c==null)throw new TypeError("Cannot convert undefined or null to object");for(var d=Object(c),o=1;o<arguments.length;o++){var p=arguments[o];p!=null&&Object.keys(p).forEach(function(e){d[e]=p[e]})}return d}),Object.values||(Object.values=function(c){return Object.keys(c).map(function(d){return c[d]})}),Array.prototype.find||s(Array.prototype,"find",function(c){for(var d=this.length,o=arguments[1],p=0;p<d;p++){var e=this[p];if(c.call(o,e,p,this))return e}}),Array.prototype.findIndex||s(Array.prototype,"findIndex",function(c){for(var d=this.length,o=arguments[1],p=0;p<d;p++){var e=this[p];if(c.call(o,e,p,this))return p}}),Array.prototype.includes||s(Array.prototype,"includes",function(c,d){return this.indexOf(c,d)!=-1}),Array.prototype.fill||s(Array.prototype,"fill",function(c){for(var d=this,o=d.length>>>0,p=arguments[1],e=p>>0,t=e<0?Math.max(o+e,0):Math.min(e,o),r=arguments[2],h=r===void 0?o:r>>0,a=h<0?Math.max(o+h,0):Math.min(h,o);t<a;)d[t]=c,t++;return d}),Array.of||s(Array,"of",function(){return Array.prototype.slice.call(arguments)})}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(i,l,v){i("./es6-shim")}),ace.define("ace/lib/deep_copy",["require","exports","module"],function(i,l,v){l.deepCopy=function s(c){if(typeof c!="object"||!c)return c;var d;if(Array.isArray(c)){d=[];for(var o=0;o<c.length;o++)d[o]=s(c[o]);return d}if(Object.prototype.toString.call(c)!=="[object Object]")return c;d={};for(var o in c)d[o]=s(c[o]);return d}}),ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],function(i,l,v){l.last=function(d){return d[d.length-1]},l.stringReverse=function(d){return d.split("").reverse().join("")},l.stringRepeat=function(d,o){for(var p="";o>0;)o&1&&(p+=d),(o>>=1)&&(d+=d);return p};var s=/^\s\s*/,c=/\s\s*$/;l.stringTrimLeft=function(d){return d.replace(s,"")},l.stringTrimRight=function(d){return d.replace(c,"")},l.copyObject=function(d){var o={};for(var p in d)o[p]=d[p];return o},l.copyArray=function(d){for(var o=[],p=0,e=d.length;p<e;p++)d[p]&&typeof d[p]=="object"?o[p]=this.copyObject(d[p]):o[p]=d[p];return o},l.deepCopy=i("./deep_copy").deepCopy,l.arrayToMap=function(d){for(var o={},p=0;p<d.length;p++)o[d[p]]=1;return o},l.createMap=function(d){var o=Object.create(null);for(var p in d)o[p]=d[p];return o},l.arrayRemove=function(d,o){for(var p=0;p<=d.length;p++)o===d[p]&&d.splice(p,1)},l.escapeRegExp=function(d){return d.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},l.escapeHTML=function(d){return(""+d).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},l.getMatchOffsets=function(d,o){var p=[];return d.replace(o,function(e){p.push({offset:arguments[arguments.length-2],length:e.length})}),p},l.deferredCall=function(d){var o=null,p=function(){o=null,d()},e=function(t){return e.cancel(),o=setTimeout(p,t||0),e};return e.schedule=e,e.call=function(){return this.cancel(),d(),e},e.cancel=function(){return clearTimeout(o),o=null,e},e.isPending=function(){return o},e},l.delayedCall=function(d,o){var p=null,e=function(){p=null,d()},t=function(r){p==null&&(p=setTimeout(e,r||o))};return t.delay=function(r){p&&clearTimeout(p),p=setTimeout(e,r||o)},t.schedule=t,t.call=function(){this.cancel(),d()},t.cancel=function(){p&&clearTimeout(p),p=null},t.isPending=function(){return p},t},l.supportsLookbehind=function(){try{new RegExp("(?<=.)")}catch{return!1}return!0},l.skipEmptyMatch=function(d,o,p){return p&&d.codePointAt(o)>65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(i,l,v){l.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},l.getOS=function(){return l.isMac?l.OS.MAC:l.isLinux?l.OS.LINUX:l.OS.WINDOWS};var s=typeof navigator=="object"?navigator:{},c=(/mac|win|linux/i.exec(s.platform)||["other"])[0].toLowerCase(),d=s.userAgent||"",o=s.appName||"";l.isWin=c=="win",l.isMac=c=="mac",l.isLinux=c=="linux",l.isIE=o=="Microsoft Internet Explorer"||o.indexOf("MSAppHost")>=0?parseFloat((d.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((d.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),l.isOldIE=l.isIE&&l.isIE<9,l.isGecko=l.isMozilla=d.match(/ Gecko\/\d+/),l.isOpera=typeof opera=="object"&&Object.prototype.toString.call(window.opera)=="[object Opera]",l.isWebKit=parseFloat(d.split("WebKit/")[1])||void 0,l.isChrome=parseFloat(d.split(" Chrome/")[1])||void 0,l.isSafari=parseFloat(d.split(" Safari/")[1])&&!l.isChrome||void 0,l.isEdge=parseFloat(d.split(" Edge/")[1])||void 0,l.isAIR=d.indexOf("AdobeAIR")>=0,l.isAndroid=d.indexOf("Android")>=0,l.isChromeOS=d.indexOf(" CrOS ")>=0,l.isIOS=/iPad|iPhone|iPod/.test(d)&&!window.MSStream,l.isIOS&&(l.isMac=!0),l.isMobile=l.isIOS||l.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(i,l,v){var s=i("./useragent"),c="http://www.w3.org/1999/xhtml";l.buildDom=function r(h,a,u){if(typeof h=="string"&&h){var f=document.createTextNode(h);return a&&a.appendChild(f),f}if(!Array.isArray(h))return h&&h.appendChild&&a&&a.appendChild(h),h;if(typeof h[0]!="string"||!h[0]){for(var m=[],y=0;y<h.length;y++){var x=r(h[y],a,u);x&&m.push(x)}return m}var E=document.createElement(h[0]),w=h[1],g=1;w&&typeof w=="object"&&!Array.isArray(w)&&(g=2);for(var y=g;y<h.length;y++)r(h[y],E,u);return g==2&&Object.keys(w).forEach(function(S){var k=w[S];S==="class"?E.className=Array.isArray(k)?k.join(" "):k:typeof k=="function"||S=="value"||S[0]=="$"?E[S]=k:S==="ref"?u&&(u[k]=E):S==="style"?typeof k=="string"&&(E.style.cssText=k):k!=null&&E.setAttribute(S,k)}),a&&a.appendChild(E),E},l.getDocumentHead=function(r){return r||(r=document),r.head||r.getElementsByTagName("head")[0]||r.documentElement},l.createElement=function(r,h){return document.createElementNS?document.createElementNS(h||c,r):document.createElement(r)},l.removeChildren=function(r){r.innerHTML=""},l.createTextNode=function(r,h){var a=h?h.ownerDocument:document;return a.createTextNode(r)},l.createFragment=function(r){var h=r?r.ownerDocument:document;return h.createDocumentFragment()},l.hasCssClass=function(r,h){var a=(r.className+"").split(/\s+/g);return a.indexOf(h)!==-1},l.addCssClass=function(r,h){l.hasCssClass(r,h)||(r.className+=" "+h)},l.removeCssClass=function(r,h){for(var a=r.className.split(/\s+/g);;){var u=a.indexOf(h);if(u==-1)break;a.splice(u,1)}r.className=a.join(" ")},l.toggleCssClass=function(r,h){for(var a=r.className.split(/\s+/g),u=!0;;){var f=a.indexOf(h);if(f==-1)break;u=!1,a.splice(f,1)}return u&&a.push(h),r.className=a.join(" "),u},l.setCssClass=function(r,h,a){a?l.addCssClass(r,h):l.removeCssClass(r,h)},l.hasCssString=function(r,h){var a=0,u;if(h=h||document,u=h.querySelectorAll("style")){for(;a<u.length;)if(u[a++].id===r)return!0}},l.removeElementById=function(r,h){h=h||document,h.getElementById(r)&&h.getElementById(r).remove()};var d,o=[];l.useStrictCSP=function(r){d=r,r==!1?p():o||(o=[])};function p(){var r=o;o=null,r&&r.forEach(function(h){e(h[0],h[1])})}function e(r,h,a){if(!(typeof document>"u")){if(o){if(a)p();else if(a===!1)return o.push([r,h])}if(!d){var u=a;!a||!a.getRootNode?u=document:(u=a.getRootNode(),(!u||u==a)&&(u=document));var f=u.ownerDocument||u;if(h&&l.hasCssString(h,u))return null;h&&(r+=`
|
|
16
16
|
/*# sourceURL=ace/css/`+h+" */");var m=l.createElement("style");m.appendChild(f.createTextNode(r)),h&&(m.id=h),u==f&&(u=l.getDocumentHead(f)),u.insertBefore(m,u.firstChild)}}}if(l.importCssString=e,l.importCssStylsheet=function(r,h){l.buildDom(["link",{rel:"stylesheet",href:r}],l.getDocumentHead(h))},l.scrollbarWidth=function(r){var h=l.createElement("ace_inner");h.style.width="100%",h.style.minWidth="0px",h.style.height="200px",h.style.display="block";var a=l.createElement("ace_outer"),u=a.style;u.position="absolute",u.left="-10000px",u.overflow="hidden",u.width="200px",u.minWidth="0px",u.height="150px",u.display="block",a.appendChild(h);var f=r&&r.documentElement||document&&document.documentElement;if(!f)return 0;f.appendChild(a);var m=h.offsetWidth;u.overflow="scroll";var y=h.offsetWidth;return m===y&&(y=a.clientWidth),f.removeChild(a),m-y},l.computedStyle=function(r,h){return window.getComputedStyle(r,"")||{}},l.setStyle=function(r,h,a){r[h]!==a&&(r[h]=a)},l.HAS_CSS_ANIMATION=!1,l.HAS_CSS_TRANSFORMS=!1,l.HI_DPI=s.isWin?typeof window<"u"&&window.devicePixelRatio>=1.5:!0,s.isChromeOS&&(l.HI_DPI=!1),typeof document<"u"){var t=document.createElement("div");l.HI_DPI&&t.style.transform!==void 0&&(l.HAS_CSS_TRANSFORMS=!0),!s.isEdge&&typeof t.style.animationName<"u"&&(l.HAS_CSS_ANIMATION=!0),t=null}l.HAS_CSS_TRANSFORMS?l.translate=function(r,h,a){r.style.transform="translate("+Math.round(h)+"px, "+Math.round(a)+"px)"}:l.translate=function(r,h,a){r.style.top=Math.round(a)+"px",r.style.left=Math.round(h)+"px"}}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(i,l,v){/*
|
|
17
17
|
* based on code from:
|
|
18
18
|
*
|
|
@@ -177,57 +177,57 @@ import{C as qe,R as M}from"./ConfigCustomJavascriptSet__loadShare__react__loadSh
|
|
|
177
177
|
.ace-tm .ace_indent-guide-active {
|
|
178
178
|
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;
|
|
179
179
|
}
|
|
180
|
-
`}),ace.define("ace/theme/textmate",["require","exports","module","ace/theme/textmate-css","ace/lib/dom"],function(i,l,v){l.isDark=!1,l.cssClass="ace-tm",l.cssText=i("./textmate-css"),l.$id="ace/theme/textmate";var s=i("../lib/dom");s.importCssString(l.cssText,l.cssClass,!1)}),ace.define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/net","ace/lib/dom","ace/lib/app_config","ace/theme/textmate"],function(i,l,v){"no use strict";var s=i("./lib/lang"),c=i("./lib/net"),d=i("./lib/dom"),o=i("./lib/app_config").AppConfig;v.exports=l=new o;var p={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{},loadWorkerFromBlob:!0,sharedPopups:!1,useStrictCSP:null};l.get=function(h){if(!p.hasOwnProperty(h))throw new Error("Unknown config key: "+h);return p[h]},l.set=function(h,a){if(p.hasOwnProperty(h))p[h]=a;else if(this.setDefaultValue("",h,a)==!1)throw new Error("Unknown config key: "+h);h=="useStrictCSP"&&d.useStrictCSP(a)},l.all=function(){return s.copyObject(p)},l.$modes={},l.moduleUrl=function(h,a){if(p.$moduleUrls[h])return p.$moduleUrls[h];var u=h.split("/");a=a||u[u.length-2]||"";var f=a=="snippets"?"/":"-",m=u[u.length-1];if(a=="worker"&&f=="-"){var y=new RegExp("^"+a+"[\\-_]|[\\-_]"+a+"$","g");m=m.replace(y,"")}(!m||m==a)&&u.length>1&&(m=u[u.length-2]);var x=p[a+"Path"];return x==null?x=p.basePath:f=="/"&&(a=f=""),x&&x.slice(-1)!="/"&&(x+="/"),x+a+f+m+this.get("suffix")},l.setModuleUrl=function(h,a){return p.$moduleUrls[h]=a};var e=function(h,a){if(h==="ace/theme/textmate"||h==="./theme/textmate")return a(null,i("./theme/textmate"));if(t)return t(h,a);console.error("loader is not configured")},t;l.setLoader=function(h){t=h},l.dynamicModules=Object.create(null),l.$loading={},l.$loaded={},l.loadModule=function(h,a){var u;if(Array.isArray(h))var f=h[0],m=h[1];else if(typeof h=="string")var m=h;var y=function(x){if(x&&!l.$loading[m])return a&&a(x);if(l.$loading[m]||(l.$loading[m]=[]),l.$loading[m].push(a),!(l.$loading[m].length>1)){var E=function(){e(m,function(b,g){g&&(l.$loaded[m]=g),l._emit("load.module",{name:m,module:g});var S=l.$loading[m];l.$loading[m]=null,S.forEach(function(k){k&&k(g)})})};if(!l.get("packaged"))return E();c.loadScript(l.moduleUrl(m,f),E),r()}};if(l.dynamicModules[m])l.dynamicModules[m]().then(function(x){x.default?y(x.default):y(x)});else{try{u=this.$require(m)}catch{}y(u||l.$loaded[m])}},l.$require=function(h){if(typeof v.require=="function"){var a="require";return v[a](h)}},l.setModuleLoader=function(h,a){l.dynamicModules[h]=a};var r=function(){!p.basePath&&!p.workerPath&&!p.modePath&&!p.themePath&&!Object.keys(p.$moduleUrls).length&&(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),r=function(){})};l.version="1.43.0"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(i,l,v){i("./lib/fixoldbrowsers");var s=i("./config");s.setLoader(function(p,e){i([p],function(t){e(null,t)})});var c=function(){return this||typeof window<"u"&&window}();v.exports=function(p){s.init=d,s.$require=i,p.require=i},d(!0);function d(p){if(!(!c||!c.document)){s.set("packaged",p||i.packaged||v.packaged||c.define&&(void 0).packaged);var e={},t="",r=document.currentScript||document._currentScript,h=r&&r.ownerDocument||document;r&&r.src&&(t=r.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var a=h.getElementsByTagName("script"),u=0;u<a.length;u++){var f=a[u],m=f.src||f.getAttribute("src");if(m){for(var y=f.attributes,x=0,E=y.length;x<E;x++){var b=y[x];b.name.indexOf("data-ace-")===0&&(e[o(b.name.replace(/^data-ace-/,""))]=b.value)}var g=m.match(/^(.*)\/ace([\-.]\w+)?\.js(\?|$)/);g&&(t=g[1])}}t&&(e.base=e.base||t,e.packaged=!0),e.basePath=e.base,e.workerPath=e.workerPath||e.base,e.modePath=e.modePath||e.base,e.themePath=e.themePath||e.base,delete e.base;for(var S in e)typeof e[S]<"u"&&s.set(S,e[S])}}function o(p){return p.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}}),ace.define("ace/range",["require","exports","module"],function(i,l,v){var s=function(){function c(d,o,p,e){this.start={row:d,column:o},this.end={row:p,column:e}}return c.prototype.isEqual=function(d){return this.start.row===d.start.row&&this.end.row===d.end.row&&this.start.column===d.start.column&&this.end.column===d.end.column},c.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},c.prototype.contains=function(d,o){return this.compare(d,o)==0},c.prototype.compareRange=function(d){var o,p=d.end,e=d.start;return o=this.compare(p.row,p.column),o==1?(o=this.compare(e.row,e.column),o==1?2:o==0?1:0):o==-1?-2:(o=this.compare(e.row,e.column),o==-1?-1:o==1?42:0)},c.prototype.comparePoint=function(d){return this.compare(d.row,d.column)},c.prototype.containsRange=function(d){return this.comparePoint(d.start)==0&&this.comparePoint(d.end)==0},c.prototype.intersects=function(d){var o=this.compareRange(d);return o==-1||o==0||o==1},c.prototype.isEnd=function(d,o){return this.end.row==d&&this.end.column==o},c.prototype.isStart=function(d,o){return this.start.row==d&&this.start.column==o},c.prototype.setStart=function(d,o){typeof d=="object"?(this.start.column=d.column,this.start.row=d.row):(this.start.row=d,this.start.column=o)},c.prototype.setEnd=function(d,o){typeof d=="object"?(this.end.column=d.column,this.end.row=d.row):(this.end.row=d,this.end.column=o)},c.prototype.inside=function(d,o){return this.compare(d,o)==0?!(this.isEnd(d,o)||this.isStart(d,o)):!1},c.prototype.insideStart=function(d,o){return this.compare(d,o)==0?!this.isEnd(d,o):!1},c.prototype.insideEnd=function(d,o){return this.compare(d,o)==0?!this.isStart(d,o):!1},c.prototype.compare=function(d,o){return!this.isMultiLine()&&d===this.start.row?o<this.start.column?-1:o>this.end.column?1:0:d<this.start.row?-1:d>this.end.row?1:this.start.row===d?o>=this.start.column?0:-1:this.end.row===d?o<=this.end.column?0:1:0},c.prototype.compareStart=function(d,o){return this.start.row==d&&this.start.column==o?-1:this.compare(d,o)},c.prototype.compareEnd=function(d,o){return this.end.row==d&&this.end.column==o?1:this.compare(d,o)},c.prototype.compareInside=function(d,o){return this.end.row==d&&this.end.column==o?1:this.start.row==d&&this.start.column==o?-1:this.compare(d,o)},c.prototype.clipRows=function(d,o){if(this.end.row>o)var p={row:o+1,column:0};else if(this.end.row<d)var p={row:d,column:0};if(this.start.row>o)var e={row:o+1,column:0};else if(this.start.row<d)var e={row:d,column:0};return c.fromPoints(e||this.start,p||this.end)},c.prototype.extend=function(d,o){var p=this.compare(d,o);if(p==0)return this;if(p==-1)var e={row:d,column:o};else var t={row:d,column:o};return c.fromPoints(e||this.start,t||this.end)},c.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},c.prototype.isMultiLine=function(){return this.start.row!==this.end.row},c.prototype.clone=function(){return c.fromPoints(this.start,this.end)},c.prototype.collapseRows=function(){return this.end.column==0?new c(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new c(this.start.row,0,this.end.row,0)},c.prototype.toScreenRange=function(d){var o=d.documentToScreenPosition(this.start),p=d.documentToScreenPosition(this.end);return new c(o.row,o.column,p.row,p.column)},c.prototype.moveBy=function(d,o){this.start.row+=d,this.start.column+=o,this.end.row+=d,this.end.column+=o},c}();s.fromPoints=function(c,d){return new s(c.row,c.column,d.row,d.column)},s.comparePoints=function(c,d){return c.row-d.row||c.column-d.column},l.Range=s}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(i,l,v){for(var s=i("./oop"),c={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta",91:"MetaLeft",92:"MetaRight",93:"ContextMenu"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,super:8,meta:8,command:8,cmd:8,control:1},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete","-13":"NumpadEnter",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",59:";",61:"=",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}},d={Command:224,Backspace:8,Tab:9,Return:13,Enter:13,Pause:19,Escape:27,PageUp:33,PageDown:34,End:35,Home:36,Insert:45,Delete:46,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Backquote:192,Minus:189,Equal:187,BracketLeft:219,Backslash:220,BracketRight:221,Semicolon:186,Quote:222,Comma:188,Period:190,Slash:191,Space:32,NumpadAdd:107,NumpadDecimal:110,NumpadSubtract:109,NumpadDivide:111,NumpadMultiply:106},o=0;o<10;o++)d["Digit"+o]=48+o,d["Numpad"+o]=96+o,c.PRINTABLE_KEYS[48+o]=""+o,c.FUNCTION_KEYS[96+o]="Numpad"+o;for(var o=65;o<91;o++){var p=String.fromCharCode(o+32);d["Key"+p.toUpperCase()]=o,c.PRINTABLE_KEYS[o]=p}for(var o=1;o<13;o++)d["F"+o]=111+o,c.FUNCTION_KEYS[111+o]="F"+o;var e={Shift:16,Control:17,Alt:18,Meta:224};for(var t in e)d[t]=d[t+"Left"]=d[t+"Right"]=e[t];l.$codeToKeyCode=d,c.PRINTABLE_KEYS[173]="-";for(var r in c.FUNCTION_KEYS){var h=c.FUNCTION_KEYS[r].toLowerCase();c[h]=parseInt(r,10)}for(var r in c.PRINTABLE_KEYS){var h=c.PRINTABLE_KEYS[r].toLowerCase();c[h]=parseInt(r,10)}s.mixin(c,c.MODIFIER_KEYS),s.mixin(c,c.PRINTABLE_KEYS),s.mixin(c,c.FUNCTION_KEYS),c.enter=c.return,c.escape=c.esc,c.del=c.delete,function(){for(var a=["cmd","ctrl","alt","shift"],u=Math.pow(2,a.length);u--;)c.KEY_MODS[u]=a.filter(function(f){return u&c.KEY_MODS[f]}).join("-")+"-"}(),c.KEY_MODS[0]="",c.KEY_MODS[-1]="input-",s.mixin(l,c),l.default=l,l.keyCodeToString=function(a){var u=c[a];return typeof u!="string"&&(u=String.fromCharCode(a)),u.toLowerCase()}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(i,l,v){var s=i("./keys"),c=i("./useragent"),d=null,o=0,p;function e(){p=!1;try{document.createComment("").addEventListener("test",function(){},{get passive(){return p={passive:!1},!0}})}catch{}}function t(){return p==null&&e(),p}function r(x,E,b){this.elem=x,this.type=E,this.callback=b}r.prototype.destroy=function(){a(this.elem,this.type,this.callback),this.elem=this.type=this.callback=void 0};var h=l.addListener=function(x,E,b,g){x.addEventListener(E,b,t()),g&&g.$toDestroy.push(new r(x,E,b))},a=l.removeListener=function(x,E,b){x.removeEventListener(E,b,t())};l.stopEvent=function(x){return l.stopPropagation(x),l.preventDefault(x),!1},l.stopPropagation=function(x){x.stopPropagation&&x.stopPropagation()},l.preventDefault=function(x){x.preventDefault&&x.preventDefault()},l.getButton=function(x){return x.type=="dblclick"?0:x.type=="contextmenu"||c.isMac&&x.ctrlKey&&!x.altKey&&!x.shiftKey?2:x.button},l.capture=function(x,E,b){var g=x&&x.ownerDocument||document;function S(k){E&&E(k),b&&b(k),a(g,"mousemove",E),a(g,"mouseup",S),a(g,"dragstart",S)}return h(g,"mousemove",E),h(g,"mouseup",S),h(g,"dragstart",S),S},l.addMouseWheelListener=function(x,E,b){h(x,"wheel",function(g){var S=.15,k=g.deltaX||0,D=g.deltaY||0;switch(g.deltaMode){case g.DOM_DELTA_PIXEL:g.wheelX=k*S,g.wheelY=D*S;break;case g.DOM_DELTA_LINE:var _=15;g.wheelX=k*_,g.wheelY=D*_;break;case g.DOM_DELTA_PAGE:var F=150;g.wheelX=k*F,g.wheelY=D*F;break}E(g)},b)},l.addMultiMouseDownListener=function(x,E,b,g,S){var k=0,D,_,F,A={2:"dblclick",3:"tripleclick",4:"quadclick"};function $(w){if(l.getButton(w)!==0?k=0:w.detail>1?(k++,k>4&&(k=1)):k=1,c.isIE){var C=Math.abs(w.clientX-D)>5||Math.abs(w.clientY-_)>5;(!F||C)&&(k=1),F&&clearTimeout(F),F=setTimeout(function(){F=null},E[k-1]||600),k==1&&(D=w.clientX,_=w.clientY)}if(w._clicks=k,b[g]("mousedown",w),k>4)k=0;else if(k>1)return b[g](A[k],w)}Array.isArray(x)||(x=[x]),x.forEach(function(w){h(w,"mousedown",$,S)})};function u(x){return 0|(x.ctrlKey?1:0)|(x.altKey?2:0)|(x.shiftKey?4:0)|(x.metaKey?8:0)}l.getModifierString=function(x){return s.KEY_MODS[u(x)]};function f(x,E,b){var g=u(E);if(!b&&E.code&&(b=s.$codeToKeyCode[E.code]||b),!c.isMac&&d){if(E.getModifierState&&(E.getModifierState("OS")||E.getModifierState("Win"))&&(g|=8),d.altGr)if((3&g)!=3)d.altGr=0;else return;if(b===18||b===17){var S=E.location;if(b===17&&S===1)d[b]==1&&(o=E.timeStamp);else if(b===18&&g===3&&S===2){var k=E.timeStamp-o;k<50&&(d.altGr=!0)}}}if(b in s.MODIFIER_KEYS&&(b=-1),!(!g&&b===13&&E.location===3&&(x(E,g,-b),E.defaultPrevented))){if(c.isChromeOS&&g&8){if(x(E,g,b),E.defaultPrevented)return;g&=-9}return!g&&!(b in s.FUNCTION_KEYS)&&!(b in s.PRINTABLE_KEYS)?!1:x(E,g,b)}}l.addCommandKeyListener=function(x,E,b){var g=null;h(x,"keydown",function(S){d[S.keyCode]=(d[S.keyCode]||0)+1;var k=f(E,S,S.keyCode);return g=S.defaultPrevented,k},b),h(x,"keypress",function(S){g&&(S.ctrlKey||S.altKey||S.shiftKey||S.metaKey)&&(l.stopEvent(S),g=null)},b),h(x,"keyup",function(S){d[S.keyCode]=null},b),d||(m(),h(window,"focus",m))};function m(){d=Object.create(null)}if(typeof window=="object"&&window.postMessage&&!c.isOldIE){var y=1;l.nextTick=function(x,E){E=E||window;var b="zero-timeout-message-"+y++,g=function(S){S.data==b&&(l.stopPropagation(S),a(E,"message",g),x())};h(E,"message",g),E.postMessage(b,"*")}}l.$idleBlocked=!1,l.onIdle=function(x,E){return setTimeout(function b(){l.$idleBlocked?setTimeout(b,100):x()},E)},l.$idleBlockId=null,l.blockIdle=function(x){l.$idleBlockId&&clearTimeout(l.$idleBlockId),l.$idleBlocked=!0,l.$idleBlockId=setTimeout(function(){l.$idleBlocked=!1},x||100)},l.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),l.nextFrame?l.nextFrame=l.nextFrame.bind(window):l.nextFrame=function(x){setTimeout(x,17)}}),ace.define("ace/clipboard",["require","exports","module"],function(i,l,v){var s;v.exports={lineMode:!1,pasteCancelled:function(){return s&&s>Date.now()-50?!0:s=!1},cancel:function(){s=Date.now()}}}),ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/config","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"],function(i,l,v){var s=i("../lib/event"),c=i("../config").nls,d=i("../lib/useragent"),o=i("../lib/dom"),p=i("../lib/lang"),e=i("../clipboard"),t=d.isChrome<18,r=d.isIE,h=d.isChrome>63,a=400,u=i("../lib/keys"),f=u.KEY_MODS,m=d.isIOS,y=m?/\s/:/\n/,x=d.isMobile,E=function(){function b(g,S){var k=this;this.host=S,this.text=o.createElement("textarea"),this.text.className="ace_text-input",this.text.setAttribute("wrap","off"),this.text.setAttribute("autocorrect","off"),this.text.setAttribute("autocapitalize","off"),this.text.setAttribute("spellcheck","false"),this.text.style.opacity="0",g.insertBefore(this.text,g.firstChild),this.copied=!1,this.pasted=!1,this.inComposition=!1,this.sendingText=!1,this.tempStyle="",x||(this.text.style.fontSize="1px"),this.commandMode=!1,this.ignoreFocusEvents=!1,this.lastValue="",this.lastSelectionStart=0,this.lastSelectionEnd=0,this.lastRestoreEnd=0,this.rowStart=Number.MAX_SAFE_INTEGER,this.rowEnd=Number.MIN_SAFE_INTEGER,this.numberOfExtraLines=0;try{this.$isFocused=document.activeElement===this.text}catch{}this.cancelComposition=this.cancelComposition.bind(this),this.setAriaOptions({role:"textbox"}),s.addListener(this.text,"blur",function(D){k.ignoreFocusEvents||(S.onBlur(D),k.$isFocused=!1)},S),s.addListener(this.text,"focus",function(D){if(!k.ignoreFocusEvents){if(k.$isFocused=!0,d.isEdge)try{if(!document.hasFocus())return}catch{}S.onFocus(D),d.isEdge?setTimeout(k.resetSelection.bind(k)):k.resetSelection()}},S),this.$focusScroll=!1,S.on("beforeEndOperation",function(){var D=S.curOp,_=D&&D.command&&D.command.name;if(_!="insertstring"){var F=_&&(D.docChanged||D.selectionChanged);k.inComposition&&F&&(k.lastValue=k.text.value="",k.onCompositionEnd()),k.resetSelection()}}),S.on("changeSelection",this.setAriaLabel.bind(this)),this.resetSelection=m?this.$resetSelectionIOS:this.$resetSelection,this.$isFocused&&S.onFocus(),this.inputHandler=null,this.afterContextMenu=!1,s.addCommandKeyListener(this.text,function(D,_,F){if(!k.inComposition)return S.onCommandKey(D,_,F)},S),s.addListener(this.text,"select",this.onSelect.bind(this),S),s.addListener(this.text,"input",this.onInput.bind(this),S),s.addListener(this.text,"cut",this.onCut.bind(this),S),s.addListener(this.text,"copy",this.onCopy.bind(this),S),s.addListener(this.text,"paste",this.onPaste.bind(this),S),(!("oncut"in this.text)||!("oncopy"in this.text)||!("onpaste"in this.text))&&s.addListener(g,"keydown",function(D){if(!(d.isMac&&!D.metaKey||!D.ctrlKey))switch(D.keyCode){case 67:k.onCopy(D);break;case 86:k.onPaste(D);break;case 88:k.onCut(D);break}},S),this.syncComposition=p.delayedCall(this.onCompositionUpdate.bind(this),50).schedule.bind(null,null),s.addListener(this.text,"compositionstart",this.onCompositionStart.bind(this),S),s.addListener(this.text,"compositionupdate",this.onCompositionUpdate.bind(this),S),s.addListener(this.text,"keyup",this.onKeyup.bind(this),S),s.addListener(this.text,"keydown",this.syncComposition.bind(this),S),s.addListener(this.text,"compositionend",this.onCompositionEnd.bind(this),S),this.closeTimeout,s.addListener(this.text,"mouseup",this.$onContextMenu.bind(this),S),s.addListener(this.text,"mousedown",function(D){D.preventDefault(),k.onContextMenuClose()},S),s.addListener(S.renderer.scroller,"contextmenu",this.$onContextMenu.bind(this),S),s.addListener(this.text,"contextmenu",this.$onContextMenu.bind(this),S),m&&this.addIosSelectionHandler(g,S,this.text)}return b.prototype.addIosSelectionHandler=function(g,S,k){var D=this,_=null,F=!1;k.addEventListener("keydown",function($){_&&clearTimeout(_),F=!0},!0),k.addEventListener("keyup",function($){_=setTimeout(function(){F=!1},100)},!0);var A=function($){if(document.activeElement===k&&!(F||D.inComposition||S.$mouseHandler.isMousePressed)&&!D.copied){var w=k.selectionStart,C=k.selectionEnd,T=null,I=0;if(w==0?T=u.up:w==1?T=u.home:C>D.lastSelectionEnd&&D.lastValue[C]==`
|
|
181
|
-
`?T=u.end:
|
|
182
|
-
`).length>2?T=u.down:
|
|
183
|
-
`:A},
|
|
180
|
+
`}),ace.define("ace/theme/textmate",["require","exports","module","ace/theme/textmate-css","ace/lib/dom"],function(i,l,v){l.isDark=!1,l.cssClass="ace-tm",l.cssText=i("./textmate-css"),l.$id="ace/theme/textmate";var s=i("../lib/dom");s.importCssString(l.cssText,l.cssClass,!1)}),ace.define("ace/config",["require","exports","module","ace/lib/lang","ace/lib/net","ace/lib/dom","ace/lib/app_config","ace/theme/textmate"],function(i,l,v){"no use strict";var s=i("./lib/lang"),c=i("./lib/net"),d=i("./lib/dom"),o=i("./lib/app_config").AppConfig;v.exports=l=new o;var p={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{},loadWorkerFromBlob:!0,sharedPopups:!1,useStrictCSP:null};l.get=function(h){if(!p.hasOwnProperty(h))throw new Error("Unknown config key: "+h);return p[h]},l.set=function(h,a){if(p.hasOwnProperty(h))p[h]=a;else if(this.setDefaultValue("",h,a)==!1)throw new Error("Unknown config key: "+h);h=="useStrictCSP"&&d.useStrictCSP(a)},l.all=function(){return s.copyObject(p)},l.$modes={},l.moduleUrl=function(h,a){if(p.$moduleUrls[h])return p.$moduleUrls[h];var u=h.split("/");a=a||u[u.length-2]||"";var f=a=="snippets"?"/":"-",m=u[u.length-1];if(a=="worker"&&f=="-"){var y=new RegExp("^"+a+"[\\-_]|[\\-_]"+a+"$","g");m=m.replace(y,"")}(!m||m==a)&&u.length>1&&(m=u[u.length-2]);var x=p[a+"Path"];return x==null?x=p.basePath:f=="/"&&(a=f=""),x&&x.slice(-1)!="/"&&(x+="/"),x+a+f+m+this.get("suffix")},l.setModuleUrl=function(h,a){return p.$moduleUrls[h]=a};var e=function(h,a){if(h==="ace/theme/textmate"||h==="./theme/textmate")return a(null,i("./theme/textmate"));if(t)return t(h,a);console.error("loader is not configured")},t;l.setLoader=function(h){t=h},l.dynamicModules=Object.create(null),l.$loading={},l.$loaded={},l.loadModule=function(h,a){var u;if(Array.isArray(h))var f=h[0],m=h[1];else if(typeof h=="string")var m=h;var y=function(x){if(x&&!l.$loading[m])return a&&a(x);if(l.$loading[m]||(l.$loading[m]=[]),l.$loading[m].push(a),!(l.$loading[m].length>1)){var E=function(){e(m,function(w,g){g&&(l.$loaded[m]=g),l._emit("load.module",{name:m,module:g});var S=l.$loading[m];l.$loading[m]=null,S.forEach(function(k){k&&k(g)})})};if(!l.get("packaged"))return E();c.loadScript(l.moduleUrl(m,f),E),r()}};if(l.dynamicModules[m])l.dynamicModules[m]().then(function(x){x.default?y(x.default):y(x)});else{try{u=this.$require(m)}catch{}y(u||l.$loaded[m])}},l.$require=function(h){if(typeof v.require=="function"){var a="require";return v[a](h)}},l.setModuleLoader=function(h,a){l.dynamicModules[h]=a};var r=function(){!p.basePath&&!p.workerPath&&!p.modePath&&!p.themePath&&!Object.keys(p.$moduleUrls).length&&(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),r=function(){})};l.version="1.43.2"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(i,l,v){i("./lib/fixoldbrowsers");var s=i("./config");s.setLoader(function(p,e){i([p],function(t){e(null,t)})});var c=function(){return this||typeof window<"u"&&window}();v.exports=function(p){s.init=d,s.$require=i,p.require=i},d(!0);function d(p){if(!(!c||!c.document)){s.set("packaged",p||i.packaged||v.packaged||c.define&&(void 0).packaged);var e={},t="",r=document.currentScript||document._currentScript,h=r&&r.ownerDocument||document;r&&r.src&&(t=r.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var a=h.getElementsByTagName("script"),u=0;u<a.length;u++){var f=a[u],m=f.src||f.getAttribute("src");if(m){for(var y=f.attributes,x=0,E=y.length;x<E;x++){var w=y[x];w.name.indexOf("data-ace-")===0&&(e[o(w.name.replace(/^data-ace-/,""))]=w.value)}var g=m.match(/^(.*)\/ace([\-.]\w+)?\.js(\?|$)/);g&&(t=g[1])}}t&&(e.base=e.base||t,e.packaged=!0),e.basePath=e.base,e.workerPath=e.workerPath||e.base,e.modePath=e.modePath||e.base,e.themePath=e.themePath||e.base,delete e.base;for(var S in e)typeof e[S]<"u"&&s.set(S,e[S])}}function o(p){return p.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}}),ace.define("ace/range",["require","exports","module"],function(i,l,v){var s=function(){function c(d,o,p,e){this.start={row:d,column:o},this.end={row:p,column:e}}return c.prototype.isEqual=function(d){return this.start.row===d.start.row&&this.end.row===d.end.row&&this.start.column===d.start.column&&this.end.column===d.end.column},c.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},c.prototype.contains=function(d,o){return this.compare(d,o)==0},c.prototype.compareRange=function(d){var o,p=d.end,e=d.start;return o=this.compare(p.row,p.column),o==1?(o=this.compare(e.row,e.column),o==1?2:o==0?1:0):o==-1?-2:(o=this.compare(e.row,e.column),o==-1?-1:o==1?42:0)},c.prototype.comparePoint=function(d){return this.compare(d.row,d.column)},c.prototype.containsRange=function(d){return this.comparePoint(d.start)==0&&this.comparePoint(d.end)==0},c.prototype.intersects=function(d){var o=this.compareRange(d);return o==-1||o==0||o==1},c.prototype.isEnd=function(d,o){return this.end.row==d&&this.end.column==o},c.prototype.isStart=function(d,o){return this.start.row==d&&this.start.column==o},c.prototype.setStart=function(d,o){typeof d=="object"?(this.start.column=d.column,this.start.row=d.row):(this.start.row=d,this.start.column=o)},c.prototype.setEnd=function(d,o){typeof d=="object"?(this.end.column=d.column,this.end.row=d.row):(this.end.row=d,this.end.column=o)},c.prototype.inside=function(d,o){return this.compare(d,o)==0?!(this.isEnd(d,o)||this.isStart(d,o)):!1},c.prototype.insideStart=function(d,o){return this.compare(d,o)==0?!this.isEnd(d,o):!1},c.prototype.insideEnd=function(d,o){return this.compare(d,o)==0?!this.isStart(d,o):!1},c.prototype.compare=function(d,o){return!this.isMultiLine()&&d===this.start.row?o<this.start.column?-1:o>this.end.column?1:0:d<this.start.row?-1:d>this.end.row?1:this.start.row===d?o>=this.start.column?0:-1:this.end.row===d?o<=this.end.column?0:1:0},c.prototype.compareStart=function(d,o){return this.start.row==d&&this.start.column==o?-1:this.compare(d,o)},c.prototype.compareEnd=function(d,o){return this.end.row==d&&this.end.column==o?1:this.compare(d,o)},c.prototype.compareInside=function(d,o){return this.end.row==d&&this.end.column==o?1:this.start.row==d&&this.start.column==o?-1:this.compare(d,o)},c.prototype.clipRows=function(d,o){if(this.end.row>o)var p={row:o+1,column:0};else if(this.end.row<d)var p={row:d,column:0};if(this.start.row>o)var e={row:o+1,column:0};else if(this.start.row<d)var e={row:d,column:0};return c.fromPoints(e||this.start,p||this.end)},c.prototype.extend=function(d,o){var p=this.compare(d,o);if(p==0)return this;if(p==-1)var e={row:d,column:o};else var t={row:d,column:o};return c.fromPoints(e||this.start,t||this.end)},c.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},c.prototype.isMultiLine=function(){return this.start.row!==this.end.row},c.prototype.clone=function(){return c.fromPoints(this.start,this.end)},c.prototype.collapseRows=function(){return this.end.column==0?new c(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new c(this.start.row,0,this.end.row,0)},c.prototype.toScreenRange=function(d){var o=d.documentToScreenPosition(this.start),p=d.documentToScreenPosition(this.end);return new c(o.row,o.column,p.row,p.column)},c.prototype.moveBy=function(d,o){this.start.row+=d,this.start.column+=o,this.end.row+=d,this.end.column+=o},c}();s.fromPoints=function(c,d){return new s(c.row,c.column,d.row,d.column)},s.comparePoints=function(c,d){return c.row-d.row||c.column-d.column},l.Range=s}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(i,l,v){for(var s=i("./oop"),c={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta",91:"MetaLeft",92:"MetaRight",93:"ContextMenu"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,super:8,meta:8,command:8,cmd:8,control:1},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete","-13":"NumpadEnter",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",59:";",61:"=",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}},d={Command:224,Backspace:8,Tab:9,Return:13,Enter:13,Pause:19,Escape:27,PageUp:33,PageDown:34,End:35,Home:36,Insert:45,Delete:46,ArrowLeft:37,ArrowUp:38,ArrowRight:39,ArrowDown:40,Backquote:192,Minus:189,Equal:187,BracketLeft:219,Backslash:220,BracketRight:221,Semicolon:186,Quote:222,Comma:188,Period:190,Slash:191,Space:32,NumpadAdd:107,NumpadDecimal:110,NumpadSubtract:109,NumpadDivide:111,NumpadMultiply:106},o=0;o<10;o++)d["Digit"+o]=48+o,d["Numpad"+o]=96+o,c.PRINTABLE_KEYS[48+o]=""+o,c.FUNCTION_KEYS[96+o]="Numpad"+o;for(var o=65;o<91;o++){var p=String.fromCharCode(o+32);d["Key"+p.toUpperCase()]=o,c.PRINTABLE_KEYS[o]=p}for(var o=1;o<13;o++)d["F"+o]=111+o,c.FUNCTION_KEYS[111+o]="F"+o;var e={Shift:16,Control:17,Alt:18,Meta:224};for(var t in e)d[t]=d[t+"Left"]=d[t+"Right"]=e[t];l.$codeToKeyCode=d,c.PRINTABLE_KEYS[173]="-";for(var r in c.FUNCTION_KEYS){var h=c.FUNCTION_KEYS[r].toLowerCase();c[h]=parseInt(r,10)}for(var r in c.PRINTABLE_KEYS){var h=c.PRINTABLE_KEYS[r].toLowerCase();c[h]=parseInt(r,10)}s.mixin(c,c.MODIFIER_KEYS),s.mixin(c,c.PRINTABLE_KEYS),s.mixin(c,c.FUNCTION_KEYS),c.enter=c.return,c.escape=c.esc,c.del=c.delete,function(){for(var a=["cmd","ctrl","alt","shift"],u=Math.pow(2,a.length);u--;)c.KEY_MODS[u]=a.filter(function(f){return u&c.KEY_MODS[f]}).join("-")+"-"}(),c.KEY_MODS[0]="",c.KEY_MODS[-1]="input-",s.mixin(l,c),l.default=l,l.keyCodeToString=function(a){var u=c[a];return typeof u!="string"&&(u=String.fromCharCode(a)),u.toLowerCase()}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(i,l,v){var s=i("./keys"),c=i("./useragent"),d=null,o=0,p;function e(){p=!1;try{document.createComment("").addEventListener("test",function(){},{get passive(){return p={passive:!1},!0}})}catch{}}function t(){return p==null&&e(),p}function r(x,E,w){this.elem=x,this.type=E,this.callback=w}r.prototype.destroy=function(){a(this.elem,this.type,this.callback),this.elem=this.type=this.callback=void 0};var h=l.addListener=function(x,E,w,g){x.addEventListener(E,w,t()),g&&g.$toDestroy.push(new r(x,E,w))},a=l.removeListener=function(x,E,w){x.removeEventListener(E,w,t())};l.stopEvent=function(x){return l.stopPropagation(x),l.preventDefault(x),!1},l.stopPropagation=function(x){x.stopPropagation&&x.stopPropagation()},l.preventDefault=function(x){x.preventDefault&&x.preventDefault()},l.getButton=function(x){return x.type=="dblclick"?0:x.type=="contextmenu"||c.isMac&&x.ctrlKey&&!x.altKey&&!x.shiftKey?2:x.button},l.capture=function(x,E,w){var g=x&&x.ownerDocument||document;function S(k){E&&E(k),w&&w(k),a(g,"mousemove",E),a(g,"mouseup",S),a(g,"dragstart",S)}return h(g,"mousemove",E),h(g,"mouseup",S),h(g,"dragstart",S),S},l.addMouseWheelListener=function(x,E,w){h(x,"wheel",function(g){var S=.15,k=g.deltaX||0,D=g.deltaY||0;switch(g.deltaMode){case g.DOM_DELTA_PIXEL:g.wheelX=k*S,g.wheelY=D*S;break;case g.DOM_DELTA_LINE:var _=15;g.wheelX=k*_,g.wheelY=D*_;break;case g.DOM_DELTA_PAGE:var F=150;g.wheelX=k*F,g.wheelY=D*F;break}E(g)},w)},l.addMultiMouseDownListener=function(x,E,w,g,S){var k=0,D,_,F,A={2:"dblclick",3:"tripleclick",4:"quadclick"};function $(C){if(l.getButton(C)!==0?k=0:C.detail>1?(k++,k>4&&(k=1)):k=1,c.isIE){var b=Math.abs(C.clientX-D)>5||Math.abs(C.clientY-_)>5;(!F||b)&&(k=1),F&&clearTimeout(F),F=setTimeout(function(){F=null},E[k-1]||600),k==1&&(D=C.clientX,_=C.clientY)}if(C._clicks=k,w[g]("mousedown",C),k>4)k=0;else if(k>1)return w[g](A[k],C)}Array.isArray(x)||(x=[x]),x.forEach(function(C){h(C,"mousedown",$,S)})};function u(x){return 0|(x.ctrlKey?1:0)|(x.altKey?2:0)|(x.shiftKey?4:0)|(x.metaKey?8:0)}l.getModifierString=function(x){return s.KEY_MODS[u(x)]};function f(x,E,w){var g=u(E);if(!w&&E.code&&(w=s.$codeToKeyCode[E.code]||w),!c.isMac&&d){if(E.getModifierState&&(E.getModifierState("OS")||E.getModifierState("Win"))&&(g|=8),d.altGr)if((3&g)!=3)d.altGr=0;else return;if(w===18||w===17){var S=E.location;if(w===17&&S===1)d[w]==1&&(o=E.timeStamp);else if(w===18&&g===3&&S===2){var k=E.timeStamp-o;k<50&&(d.altGr=!0)}}}if(w in s.MODIFIER_KEYS&&(w=-1),!(!g&&w===13&&E.location===3&&(x(E,g,-w),E.defaultPrevented))){if(c.isChromeOS&&g&8){if(x(E,g,w),E.defaultPrevented)return;g&=-9}return!g&&!(w in s.FUNCTION_KEYS)&&!(w in s.PRINTABLE_KEYS)?!1:x(E,g,w)}}l.addCommandKeyListener=function(x,E,w){var g=null;h(x,"keydown",function(S){d[S.keyCode]=(d[S.keyCode]||0)+1;var k=f(E,S,S.keyCode);return g=S.defaultPrevented,k},w),h(x,"keypress",function(S){g&&(S.ctrlKey||S.altKey||S.shiftKey||S.metaKey)&&(l.stopEvent(S),g=null)},w),h(x,"keyup",function(S){d[S.keyCode]=null},w),d||(m(),h(window,"focus",m))};function m(){d=Object.create(null)}if(typeof window=="object"&&window.postMessage&&!c.isOldIE){var y=1;l.nextTick=function(x,E){E=E||window;var w="zero-timeout-message-"+y++,g=function(S){S.data==w&&(l.stopPropagation(S),a(E,"message",g),x())};h(E,"message",g),E.postMessage(w,"*")}}l.$idleBlocked=!1,l.onIdle=function(x,E){return setTimeout(function w(){l.$idleBlocked?setTimeout(w,100):x()},E)},l.$idleBlockId=null,l.blockIdle=function(x){l.$idleBlockId&&clearTimeout(l.$idleBlockId),l.$idleBlocked=!0,l.$idleBlockId=setTimeout(function(){l.$idleBlocked=!1},x||100)},l.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),l.nextFrame?l.nextFrame=l.nextFrame.bind(window):l.nextFrame=function(x){setTimeout(x,17)}}),ace.define("ace/clipboard",["require","exports","module"],function(i,l,v){var s;v.exports={lineMode:!1,pasteCancelled:function(){return s&&s>Date.now()-50?!0:s=!1},cancel:function(){s=Date.now()}}}),ace.define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/config","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"],function(i,l,v){var s=i("../lib/event"),c=i("../config").nls,d=i("../lib/useragent"),o=i("../lib/dom"),p=i("../lib/lang"),e=i("../clipboard"),t=d.isChrome<18,r=d.isIE,h=d.isChrome>63,a=400,u=i("../lib/keys"),f=u.KEY_MODS,m=d.isIOS,y=m?/\s/:/\n/,x=d.isMobile,E=function(){function w(g,S){var k=this;this.host=S,this.text=o.createElement("textarea"),this.text.className="ace_text-input",this.text.setAttribute("wrap","off"),this.text.setAttribute("autocorrect","off"),this.text.setAttribute("autocapitalize","off"),this.text.setAttribute("spellcheck","false"),this.text.style.opacity="0",g.insertBefore(this.text,g.firstChild),this.copied=!1,this.pasted=!1,this.inComposition=!1,this.sendingText=!1,this.tempStyle="",x||(this.text.style.fontSize="1px"),this.commandMode=!1,this.ignoreFocusEvents=!1,this.lastValue="",this.lastSelectionStart=0,this.lastSelectionEnd=0,this.lastRestoreEnd=0,this.rowStart=Number.MAX_SAFE_INTEGER,this.rowEnd=Number.MIN_SAFE_INTEGER,this.numberOfExtraLines=0;try{this.$isFocused=document.activeElement===this.text}catch{}this.cancelComposition=this.cancelComposition.bind(this),this.setAriaOptions({role:"textbox"}),s.addListener(this.text,"blur",function(D){k.ignoreFocusEvents||(S.onBlur(D),k.$isFocused=!1)},S),s.addListener(this.text,"focus",function(D){if(!k.ignoreFocusEvents){if(k.$isFocused=!0,d.isEdge)try{if(!document.hasFocus())return}catch{}S.onFocus(D),d.isEdge?setTimeout(k.resetSelection.bind(k)):k.resetSelection()}},S),this.$focusScroll=!1,S.on("beforeEndOperation",function(){var D=S.curOp,_=D&&D.command&&D.command.name;if(_!="insertstring"){var F=_&&(D.docChanged||D.selectionChanged);k.inComposition&&F&&(k.lastValue=k.text.value="",k.onCompositionEnd()),k.resetSelection()}}),S.on("changeSelection",this.setAriaLabel.bind(this)),this.resetSelection=m?this.$resetSelectionIOS:this.$resetSelection,this.$isFocused&&S.onFocus(),this.inputHandler=null,this.afterContextMenu=!1,s.addCommandKeyListener(this.text,function(D,_,F){if(!k.inComposition)return S.onCommandKey(D,_,F)},S),s.addListener(this.text,"select",this.onSelect.bind(this),S),s.addListener(this.text,"input",this.onInput.bind(this),S),s.addListener(this.text,"cut",this.onCut.bind(this),S),s.addListener(this.text,"copy",this.onCopy.bind(this),S),s.addListener(this.text,"paste",this.onPaste.bind(this),S),(!("oncut"in this.text)||!("oncopy"in this.text)||!("onpaste"in this.text))&&s.addListener(g,"keydown",function(D){if(!(d.isMac&&!D.metaKey||!D.ctrlKey))switch(D.keyCode){case 67:k.onCopy(D);break;case 86:k.onPaste(D);break;case 88:k.onCut(D);break}},S),this.syncComposition=p.delayedCall(this.onCompositionUpdate.bind(this),50).schedule.bind(null,null),s.addListener(this.text,"compositionstart",this.onCompositionStart.bind(this),S),s.addListener(this.text,"compositionupdate",this.onCompositionUpdate.bind(this),S),s.addListener(this.text,"keyup",this.onKeyup.bind(this),S),s.addListener(this.text,"keydown",this.syncComposition.bind(this),S),s.addListener(this.text,"compositionend",this.onCompositionEnd.bind(this),S),this.closeTimeout,s.addListener(this.text,"mouseup",this.$onContextMenu.bind(this),S),s.addListener(this.text,"mousedown",function(D){D.preventDefault(),k.onContextMenuClose()},S),s.addListener(S.renderer.scroller,"contextmenu",this.$onContextMenu.bind(this),S),s.addListener(this.text,"contextmenu",this.$onContextMenu.bind(this),S),m&&this.addIosSelectionHandler(g,S,this.text)}return w.prototype.addIosSelectionHandler=function(g,S,k){var D=this,_=null,F=!1;k.addEventListener("keydown",function($){_&&clearTimeout(_),F=!0},!0),k.addEventListener("keyup",function($){_=setTimeout(function(){F=!1},100)},!0);var A=function($){if(document.activeElement===k&&!(F||D.inComposition||S.$mouseHandler.isMousePressed)&&!D.copied){var C=k.selectionStart,b=k.selectionEnd,T=null,I=0;if(C==0?T=u.up:C==1?T=u.home:b>D.lastSelectionEnd&&D.lastValue[b]==`
|
|
181
|
+
`?T=u.end:C<D.lastSelectionStart&&D.lastValue[C-1]==" "?(T=u.left,I=f.option):C<D.lastSelectionStart||C==D.lastSelectionStart&&D.lastSelectionEnd!=D.lastSelectionStart&&C==b?T=u.left:b>D.lastSelectionEnd&&D.lastValue.slice(0,b).split(`
|
|
182
|
+
`).length>2?T=u.down:b>D.lastSelectionEnd&&D.lastValue[b-1]==" "?(T=u.right,I=f.option):(b>D.lastSelectionEnd||b==D.lastSelectionEnd&&D.lastSelectionEnd!=D.lastSelectionStart&&C==b)&&(T=u.right),C!==b&&(I|=f.shift),T){var O=S.onCommandKey({},I,T);if(!O&&S.commands){T=u.keyCodeToString(T);var N=S.commands.findKeyCommand(I,T);N&&S.execCommand(N)}D.lastSelectionStart=C,D.lastSelectionEnd=b,D.resetSelection("")}}};document.addEventListener("selectionchange",A),S.on("destroy",function(){document.removeEventListener("selectionchange",A)})},w.prototype.onContextMenuClose=function(){var g=this;clearTimeout(this.closeTimeout),this.closeTimeout=setTimeout(function(){g.tempStyle&&(g.text.style.cssText=g.tempStyle,g.tempStyle=""),g.host.renderer.$isMousePressed=!1,g.host.renderer.$keepTextAreaAtCursor&&g.host.renderer.$moveTextAreaToCursor()},0)},w.prototype.$onContextMenu=function(g){this.host.textInput.onContextMenu(g),this.onContextMenuClose()},w.prototype.onKeyup=function(g){g.keyCode==27&&this.text.value.length<this.text.selectionStart&&(this.inComposition||(this.lastValue=this.text.value),this.lastSelectionStart=this.lastSelectionEnd=-1,this.resetSelection()),this.syncComposition()},w.prototype.cancelComposition=function(){this.ignoreFocusEvents=!0,this.text.blur(),this.text.focus(),this.ignoreFocusEvents=!1},w.prototype.onCompositionStart=function(g){if(!(this.inComposition||!this.host.onCompositionStart||this.host.$readOnly)&&(this.inComposition={},!this.commandMode)){g.data&&(this.inComposition.useTextareaForIME=!1),setTimeout(this.onCompositionUpdate.bind(this),0),this.host._signal("compositionStart"),this.host.on("mousedown",this.cancelComposition);var S=this.host.getSelectionRange();S.end.row=S.start.row,S.end.column=S.start.column,this.inComposition.markerRange=S,this.inComposition.selectionStart=this.lastSelectionStart,this.host.onCompositionStart(this.inComposition),this.inComposition.useTextareaForIME?(this.lastValue=this.text.value="",this.lastSelectionStart=0,this.lastSelectionEnd=0):(this.text.msGetInputContext&&(this.inComposition.context=this.text.msGetInputContext()),this.text.getInputContext&&(this.inComposition.context=this.text.getInputContext()))}},w.prototype.onCompositionUpdate=function(){if(!(!this.inComposition||!this.host.onCompositionUpdate||this.host.$readOnly)){if(this.commandMode)return this.cancelComposition();if(this.inComposition.useTextareaForIME)this.host.onCompositionUpdate(this.text.value);else{var g=this.text.value;this.sendText(g),this.inComposition.markerRange&&(this.inComposition.context&&(this.inComposition.markerRange.start.column=this.inComposition.selectionStart=this.inComposition.context.compositionStartOffset),this.inComposition.markerRange.end.column=this.inComposition.markerRange.start.column+this.lastSelectionEnd-this.inComposition.selectionStart+this.lastRestoreEnd)}}},w.prototype.onCompositionEnd=function(g){!this.host.onCompositionEnd||this.host.$readOnly||(this.inComposition=!1,this.host.onCompositionEnd(),this.host.off("mousedown",this.cancelComposition),g&&this.onInput())},w.prototype.onCut=function(g){this.doCopy(g,!0)},w.prototype.onCopy=function(g){this.doCopy(g,!1)},w.prototype.onPaste=function(g){var S=this.handleClipboardData(g);e.pasteCancelled()||(typeof S=="string"?(S&&this.host.onPaste(S,g),d.isIE&&setTimeout(this.resetSelection),s.preventDefault(g)):(this.text.value="",this.pasted=!0))},w.prototype.doCopy=function(g,S){var k=this,D=this.host.getCopyText();if(!D)return s.preventDefault(g);this.handleClipboardData(g,D)?(m&&(this.resetSelection(D),this.copied=D,setTimeout(function(){k.copied=!1},10)),S?this.host.onCut():this.host.onCopy(),s.preventDefault(g)):(this.copied=!0,this.text.value=D,this.text.select(),setTimeout(function(){k.copied=!1,k.resetSelection(),S?k.host.onCut():k.host.onCopy()}))},w.prototype.handleClipboardData=function(g,S,k){var D=g.clipboardData||window.clipboardData;if(!(!D||t)){var _=r||k?"Text":"text/plain";try{return S?D.setData(_,S)!==!1:D.getData(_)}catch(F){if(!k)return this.handleClipboardData(F,S,!0)}}},w.prototype.onInput=function(g){if(this.inComposition)return this.onCompositionUpdate();if(g&&g.inputType){if(g.inputType=="historyUndo")return this.host.execCommand("undo");if(g.inputType=="historyRedo")return this.host.execCommand("redo")}var S=this.text.value,k=this.sendText(S,!0);(S.length>a+100||y.test(k)||x&&this.lastSelectionStart<1&&this.lastSelectionStart==this.lastSelectionEnd)&&this.resetSelection()},w.prototype.sendText=function(g,S){if(this.afterContextMenu&&(this.afterContextMenu=!1),this.pasted)return this.resetSelection(),g&&this.host.onPaste(g),this.pasted=!1,"";for(var k=this.text.selectionStart,D=this.text.selectionEnd,_=this.lastSelectionStart,F=this.lastValue.length-this.lastSelectionEnd,A=g,$=g.length-k,C=g.length-D,b=0;_>0&&this.lastValue[b]==g[b];)b++,_--;for(A=A.slice(b),b=1;F>0&&this.lastValue.length-b>this.lastSelectionStart-1&&this.lastValue[this.lastValue.length-b]==g[g.length-b];)b++,F--;$-=b-1,C-=b-1;var T=A.length-b+1;if(T<0&&(_=-T,T=0),A=A.slice(0,T),!S&&!A&&!$&&!_&&!F&&!C)return"";this.sendingText=!0;var I=!1;return d.isAndroid&&A==". "&&(A=" ",I=!0),A&&!_&&!F&&!$&&!C||this.commandMode?this.host.onTextInput(A):this.host.onTextInput(A,{extendLeft:_,extendRight:F,restoreStart:$,restoreEnd:C}),this.sendingText=!1,this.lastValue=g,this.lastSelectionStart=k,this.lastSelectionEnd=D,this.lastRestoreEnd=C,I?`
|
|
183
|
+
`:A},w.prototype.onSelect=function(g){var S=this;if(!this.inComposition){var k=function(D){return D.selectionStart===0&&D.selectionEnd>=S.lastValue.length&&D.value===S.lastValue&&S.lastValue&&D.selectionEnd!==S.lastSelectionEnd};this.copied?this.copied=!1:k(this.text)?(this.host.selectAll(),this.resetSelection()):x&&this.text.selectionStart!=this.lastSelectionStart&&this.resetSelection()}},w.prototype.$resetSelectionIOS=function(g){if(!(!this.$isFocused||this.copied&&!g||this.sendingText)){g||(g="");var S=`
|
|
184
184
|
ab`+g+`cde fg
|
|
185
|
-
`;S!=this.text.value&&(this.text.value=this.lastValue=S);var k=4,D=4+(g.length||(this.host.selection.isEmpty()?0:1));(this.lastSelectionStart!=k||this.lastSelectionEnd!=D)&&this.text.setSelectionRange(k,D),this.lastSelectionStart=k,this.lastSelectionEnd=D}},
|
|
185
|
+
`;S!=this.text.value&&(this.text.value=this.lastValue=S);var k=4,D=4+(g.length||(this.host.selection.isEmpty()?0:1));(this.lastSelectionStart!=k||this.lastSelectionEnd!=D)&&this.text.setSelectionRange(k,D),this.lastSelectionStart=k,this.lastSelectionEnd=D}},w.prototype.$resetSelection=function(){var g=this;if(!(this.inComposition||this.sendingText)&&!(!this.$isFocused&&!this.afterContextMenu)){this.inComposition=!0;var S=0,k=0,D="",_=function(N,P){for(var B=P,V=1;V<=N-g.rowStart&&V<2*g.numberOfExtraLines+1;V++)B+=g.host.session.getLine(N-V).length+1;return B};if(this.host.session){var F=this.host.selection,A=F.getRange(),$=F.cursor.row;$===this.rowEnd+1?(this.rowStart=this.rowEnd+1,this.rowEnd=this.rowStart+2*this.numberOfExtraLines):$===this.rowStart-1?(this.rowEnd=this.rowStart-1,this.rowStart=this.rowEnd-2*this.numberOfExtraLines):($<this.rowStart-1||$>this.rowEnd+1)&&(this.rowStart=$>this.numberOfExtraLines?$-this.numberOfExtraLines:0,this.rowEnd=$>this.numberOfExtraLines?$+this.numberOfExtraLines:2*this.numberOfExtraLines);for(var C=[],b=this.rowStart;b<=this.rowEnd;b++)C.push(this.host.session.getLine(b));if(D=C.join(`
|
|
186
186
|
`),S=_(A.start.row,A.start.column),k=_(A.end.row,A.end.column),A.start.row<this.rowStart){var T=this.host.session.getLine(this.rowStart-1);S=A.start.row<this.rowStart-1?0:S,k+=T.length+1,D=T+`
|
|
187
187
|
`+D}else if(A.end.row>this.rowEnd){var I=this.host.session.getLine(this.rowEnd+1);k=A.end.row>this.rowEnd+1?I.length:A.end.column,k+=D.length+1,D=D+`
|
|
188
188
|
`+I}else x&&$>0&&(D=`
|
|
189
189
|
`+D,k+=1,S+=1);D.length>a&&(S<a&&k<a?D=D.slice(0,a):(D=`
|
|
190
190
|
`,S==k?S=k=0:(S=0,k=1)));var O=D+`
|
|
191
191
|
|
|
192
|
-
`;O!=this.lastValue&&(this.text.value=this.lastValue=O,this.lastSelectionStart=this.lastSelectionEnd=O.length)}if(this.afterContextMenu&&(this.lastSelectionStart=this.text.selectionStart,this.lastSelectionEnd=this.text.selectionEnd),this.lastSelectionEnd!=k||this.lastSelectionStart!=S||this.text.selectionEnd!=this.lastSelectionEnd)try{this.text.setSelectionRange(S,k),this.lastSelectionStart=S,this.lastSelectionEnd=k}catch{}this.inComposition=!1}},b.prototype.setHost=function(g){this.host=g},b.prototype.setNumberOfExtraLines=function(g){if(this.rowStart=Number.MAX_SAFE_INTEGER,this.rowEnd=Number.MIN_SAFE_INTEGER,g<0){this.numberOfExtraLines=0;return}this.numberOfExtraLines=g},b.prototype.setAriaLabel=function(){var g="";if(this.host.$textInputAriaLabel&&(g+="".concat(this.host.$textInputAriaLabel,", ")),this.host.session){var S=this.host.session.selection.cursor.row;g+=c("text-input.aria-label","Cursor at row $0",[S+1])}this.text.setAttribute("aria-label",g)},b.prototype.setAriaOptions=function(g){g.activeDescendant?(this.text.setAttribute("aria-haspopup","true"),this.text.setAttribute("aria-autocomplete",g.inline?"both":"list"),this.text.setAttribute("aria-activedescendant",g.activeDescendant)):(this.text.setAttribute("aria-haspopup","false"),this.text.setAttribute("aria-autocomplete","both"),this.text.removeAttribute("aria-activedescendant")),g.role&&this.text.setAttribute("role",g.role),g.setLabel&&(this.text.setAttribute("aria-roledescription",c("text-input.aria-roledescription","editor")),this.setAriaLabel())},b.prototype.focus=function(){var g=this;if(this.setAriaOptions({setLabel:this.host.renderer.enableKeyboardAccessibility}),this.tempStyle||h||this.$focusScroll=="browser")return this.text.focus({preventScroll:!0});var S=this.text.style.top;this.text.style.position="fixed",this.text.style.top="0px";try{var k=this.text.getBoundingClientRect().top!=0}catch{return}var D=[];if(k)for(var _=this.text.parentElement;_&&_.nodeType==1;)D.push(_),_.setAttribute("ace_nocontext","true"),!_.parentElement&&_.getRootNode?_=_.getRootNode().host:_=_.parentElement;this.text.focus({preventScroll:!0}),k&&D.forEach(function(F){F.removeAttribute("ace_nocontext")}),setTimeout(function(){g.text.style.position="",g.text.style.top=="0px"&&(g.text.style.top=S)},0)},b.prototype.blur=function(){this.text.blur()},b.prototype.isFocused=function(){return this.$isFocused},b.prototype.setInputHandler=function(g){this.inputHandler=g},b.prototype.getInputHandler=function(){return this.inputHandler},b.prototype.getElement=function(){return this.text},b.prototype.setCommandMode=function(g){this.commandMode=g,this.text.readOnly=!1},b.prototype.setReadOnly=function(g){this.commandMode||(this.text.readOnly=g)},b.prototype.setCopyWithEmptySelection=function(g){},b.prototype.onContextMenu=function(g){this.afterContextMenu=!0,this.resetSelection(),this.host._emit("nativecontextmenu",{target:this.host,domEvent:g}),this.moveToMouse(g,!0)},b.prototype.moveToMouse=function(g,S){var k=this;this.tempStyle||(this.tempStyle=this.text.style.cssText),this.text.style.cssText=(S?"z-index:100000;":"")+(d.isIE?"opacity:0.1;":"")+"text-indent: -"+(this.lastSelectionStart+this.lastSelectionEnd)*this.host.renderer.characterWidth*.5+"px;";var D=this.host.container.getBoundingClientRect(),_=o.computedStyle(this.host.container),F=D.top+(parseInt(_.borderTopWidth)||0),A=D.left+(parseInt(_.borderLeftWidth)||0),$=D.bottom-F-this.text.clientHeight-2,w=function(C){o.translate(k.text,C.clientX-A-2,Math.min(C.clientY-F-2,$))};w(g),g.type=="mousedown"&&(this.host.renderer.$isMousePressed=!0,clearTimeout(this.closeTimeout),d.isWin&&s.capture(this.host.container,w,this.onContextMenuClose.bind(this)))},b.prototype.destroy=function(){this.text.parentElement&&this.text.parentElement.removeChild(this.text)},b}();l.TextInput=E,l.$setUserAgentForTests=function(b,g){x=b,m=g}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(i,l,v){var s=i("../lib/useragent"),c=0,d=550,o=function(){function t(r){r.$clickSelection=null;var h=r.editor;h.setDefaultHandler("mousedown",this.onMouseDown.bind(r)),h.setDefaultHandler("dblclick",this.onDoubleClick.bind(r)),h.setDefaultHandler("tripleclick",this.onTripleClick.bind(r)),h.setDefaultHandler("quadclick",this.onQuadClick.bind(r)),h.setDefaultHandler("mousewheel",this.onMouseWheel.bind(r));var a=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];a.forEach(function(u){r[u]=this[u]},this),r.selectByLines=this.extendSelectionBy.bind(r,"getLineRange"),r.selectByWords=this.extendSelectionBy.bind(r,"getWordRange")}return t.prototype.onMouseDown=function(r){var h=r.inSelection(),a=r.getDocumentPosition();this.mousedownEvent=r;var u=this.editor,f=r.getButton();if(f!==0){var m=u.getSelectionRange(),y=m.isEmpty();(y||f==1)&&u.selection.moveToPosition(a),f==2&&(u.textInput.onContextMenu(r.domEvent),s.isMozilla||r.preventDefault());return}if(this.mousedownEvent.time=Date.now(),h&&!u.isFocused()&&(u.focus(),this.$focusTimeout&&!this.$clickSelection&&!u.inMultiSelectMode)){this.setState("focusWait"),this.captureMouse(r);return}return this.captureMouse(r),this.startSelect(a,r.domEvent._clicks>1),r.preventDefault()},t.prototype.startSelect=function(r,h){r=r||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var a=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?a.selection.selectToPosition(r):h||a.selection.moveToPosition(r),h||this.select(),a.setStyle("ace_selecting"),this.setState("select"))},t.prototype.select=function(){var r,h=this.editor,a=h.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var u=this.$clickSelection.comparePoint(a);if(u==-1)r=this.$clickSelection.end;else if(u==1)r=this.$clickSelection.start;else{var f=e(this.$clickSelection,a);a=f.cursor,r=f.anchor}h.selection.setSelectionAnchor(r.row,r.column)}h.selection.selectToPosition(a),h.renderer.scrollCursorIntoView()},t.prototype.extendSelectionBy=function(r){var h,a=this.editor,u=a.renderer.screenToTextCoordinates(this.x,this.y),f=a.selection[r](u.row,u.column);if(this.$clickSelection){var m=this.$clickSelection.comparePoint(f.start),y=this.$clickSelection.comparePoint(f.end);if(m==-1&&y<=0)h=this.$clickSelection.end,(f.end.row!=u.row||f.end.column!=u.column)&&(u=f.start);else if(y==1&&m>=0)h=this.$clickSelection.start,(f.start.row!=u.row||f.start.column!=u.column)&&(u=f.end);else if(m==-1&&y==1)u=f.end,h=f.start;else{var x=e(this.$clickSelection,u);u=x.cursor,h=x.anchor}a.selection.setSelectionAnchor(h.row,h.column)}a.selection.selectToPosition(u),a.renderer.scrollCursorIntoView()},t.prototype.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting")},t.prototype.focusWait=function(){var r=p(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),h=Date.now();(r>c||h-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},t.prototype.onDoubleClick=function(r){var h=r.getDocumentPosition(),a=this.editor,u=a.session,f=u.getBracketRange(h);f?(f.isEmpty()&&(f.start.column--,f.end.column++),this.setState("select")):(f=a.selection.getWordRange(h.row,h.column),this.setState("selectByWords")),this.$clickSelection=f,this.select()},t.prototype.onTripleClick=function(r){var h=r.getDocumentPosition(),a=this.editor;this.setState("selectByLines");var u=a.getSelectionRange();u.isMultiLine()&&u.contains(h.row,h.column)?(this.$clickSelection=a.selection.getLineRange(u.start.row),this.$clickSelection.end=a.selection.getLineRange(u.end.row).end):this.$clickSelection=a.selection.getLineRange(h.row),this.select()},t.prototype.onQuadClick=function(r){var h=this.editor;h.selectAll(),this.$clickSelection=h.getSelectionRange(),this.setState("selectAll")},t.prototype.onMouseWheel=function(r){if(!r.getAccelKey()){r.getShiftKey()&&r.wheelY&&!r.wheelX&&(r.wheelX=r.wheelY,r.wheelY=0);var h=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var a=this.$lastScroll,u=r.domEvent.timeStamp,f=u-a.t,m=f?r.wheelX/f:a.vx,y=f?r.wheelY/f:a.vy;f<d&&(m=(m+a.vx)/2,y=(y+a.vy)/2);var x=Math.abs(m/y),E=!1;if(x>=1&&h.renderer.isScrollableBy(r.wheelX*r.speed,0)&&(E=!0),x<=1&&h.renderer.isScrollableBy(0,r.wheelY*r.speed)&&(E=!0),E)a.allowed=u;else if(u-a.allowed<d){var b=Math.abs(m)<=1.5*Math.abs(a.vx)&&Math.abs(y)<=1.5*Math.abs(a.vy);b?(E=!0,a.allowed=u):a.allowed=0}if(a.t=u,a.vx=m,a.vy=y,E)return h.renderer.scrollBy(r.wheelX*r.speed,r.wheelY*r.speed),r.stop()}},t}();o.prototype.selectEnd=o.prototype.selectByLinesEnd,o.prototype.selectAllEnd=o.prototype.selectByLinesEnd,o.prototype.selectByWordsEnd=o.prototype.selectByLinesEnd,l.DefaultHandlers=o;function p(t,r,h,a){return Math.sqrt(Math.pow(h-t,2)+Math.pow(a-r,2))}function e(t,r){if(t.start.row==t.end.row)var h=2*r.column-t.start.column-t.end.column;else if(t.start.row==t.end.row-1&&!t.start.column&&!t.end.column)var h=r.column-4;else var h=2*r.row-t.start.row-t.end.row;return h<0?{cursor:t.start,anchor:t.end}:{cursor:t.end,anchor:t.start}}}),ace.define("ace/lib/scroll",["require","exports","module"],function(i,l,v){l.preventParentScroll=function(c){c.stopPropagation();var d=c.currentTarget,o=d.scrollHeight>d.clientHeight;o||c.preventDefault()}}),ace.define("ace/tooltip",["require","exports","module","ace/lib/dom","ace/lib/event","ace/range","ace/lib/scroll"],function(i,l,v){var s=this&&this.__extends||function(){var u=function(f,m){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,x){y.__proto__=x}||function(y,x){for(var E in x)Object.prototype.hasOwnProperty.call(x,E)&&(y[E]=x[E])},u(f,m)};return function(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");u(f,m);function y(){this.constructor=f}f.prototype=m===null?Object.create(m):(y.prototype=m.prototype,new y)}}(),c=this&&this.__values||function(u){var f=typeof Symbol=="function"&&Symbol.iterator,m=f&&u[f],y=0;if(m)return m.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&y>=u.length&&(u=void 0),{value:u&&u[y++],done:!u}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},d=i("./lib/dom");i("./lib/event");var o=i("./range").Range,p=i("./lib/scroll").preventParentScroll,e="ace_tooltip",t=function(){function u(f){this.isOpen=!1,this.$element=null,this.$parentNode=f}return u.prototype.$init=function(){return this.$element=d.createElement("div"),this.$element.className=e,this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},u.prototype.getElement=function(){return this.$element||this.$init()},u.prototype.setText=function(f){this.getElement().textContent=f},u.prototype.setHtml=function(f){this.getElement().innerHTML=f},u.prototype.setPosition=function(f,m){this.getElement().style.left=f+"px",this.getElement().style.top=m+"px"},u.prototype.setClassName=function(f){d.addCssClass(this.getElement(),f)},u.prototype.setTheme=function(f){this.$element.className=e+" "+(f.isDark?"ace_dark ":"")+(f.cssClass||"")},u.prototype.show=function(f,m,y){f!=null&&this.setText(f),m!=null&&y!=null&&this.setPosition(m,y),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},u.prototype.hide=function(f){this.isOpen&&(this.getElement().style.display="none",this.getElement().className=e,this.isOpen=!1)},u.prototype.getHeight=function(){return this.getElement().offsetHeight},u.prototype.getWidth=function(){return this.getElement().offsetWidth},u.prototype.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)},u}(),r=function(){function u(){this.popups=[]}return u.prototype.addPopup=function(f){this.popups.push(f),this.updatePopups()},u.prototype.removePopup=function(f){var m=this.popups.indexOf(f);m!==-1&&(this.popups.splice(m,1),this.updatePopups())},u.prototype.updatePopups=function(){var f,m,y,x;this.popups.sort(function(A,$){return $.priority-A.priority});var E=[];try{for(var b=c(this.popups),g=b.next();!g.done;g=b.next()){var S=g.value,k=!0;try{for(var D=(y=void 0,c(E)),_=D.next();!_.done;_=D.next()){var F=_.value;if(this.doPopupsOverlap(F,S)){k=!1;break}}}catch(A){y={error:A}}finally{try{_&&!_.done&&(x=D.return)&&x.call(D)}finally{if(y)throw y.error}}k?E.push(S):S.hide()}}catch(A){f={error:A}}finally{try{g&&!g.done&&(m=b.return)&&m.call(b)}finally{if(f)throw f.error}}},u.prototype.doPopupsOverlap=function(f,m){var y=f.getElement().getBoundingClientRect(),x=m.getElement().getBoundingClientRect();return y.left<x.right&&y.right>x.left&&y.top<x.bottom&&y.bottom>x.top},u}(),h=new r;l.popupManager=h,l.Tooltip=t;var a=function(u){s(f,u);function f(m){m===void 0&&(m=document.body);var y=u.call(this,m)||this;y.timeout=void 0,y.lastT=0,y.idleTime=350,y.lastEvent=void 0,y.onMouseOut=y.onMouseOut.bind(y),y.onMouseMove=y.onMouseMove.bind(y),y.waitForHover=y.waitForHover.bind(y),y.hide=y.hide.bind(y);var x=y.getElement();return x.style.whiteSpace="pre-wrap",x.style.pointerEvents="auto",x.addEventListener("mouseout",y.onMouseOut),x.tabIndex=-1,x.addEventListener("blur",function(){x.contains(document.activeElement)||this.hide()}.bind(y)),x.addEventListener("wheel",p),y}return f.prototype.addToEditor=function(m){m.on("mousemove",this.onMouseMove),m.on("mousedown",this.hide),m.renderer.getMouseEventTarget().addEventListener("mouseout",this.onMouseOut,!0)},f.prototype.removeFromEditor=function(m){m.off("mousemove",this.onMouseMove),m.off("mousedown",this.hide),m.renderer.getMouseEventTarget().removeEventListener("mouseout",this.onMouseOut,!0),this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},f.prototype.onMouseMove=function(m,y){this.lastEvent=m,this.lastT=Date.now();var x=y.$mouseHandler.isMousePressed;if(this.isOpen){var E=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(E.row,E.column)||x||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||x||(this.lastEvent=m,this.timeout=setTimeout(this.waitForHover,this.idleTime))},f.prototype.waitForHover=function(){this.timeout&&clearTimeout(this.timeout);var m=Date.now()-this.lastT;if(this.idleTime-m>10){this.timeout=setTimeout(this.waitForHover,this.idleTime-m);return}this.timeout=null,this.lastEvent&&!this.isOutsideOfText(this.lastEvent)&&this.$gatherData(this.lastEvent,this.lastEvent.editor)},f.prototype.isOutsideOfText=function(m){var y=m.editor,x=m.getDocumentPosition(),E=y.session.getLine(x.row);if(x.column==E.length){var b=y.renderer.pixelToScreenCoordinates(m.clientX,m.clientY),g=y.session.documentToScreenPosition(x.row,x.column);if(g.column!=b.column||g.row!=b.row)return!0}return!1},f.prototype.setDataProvider=function(m){this.$gatherData=m},f.prototype.showForRange=function(m,y,x,E){var b=10;if(!(E&&E!=this.lastEvent)&&!(this.isOpen&&document.activeElement==this.getElement())){var g=m.renderer;this.isOpen||(h.addPopup(this),this.$registerCloseEvents(),this.setTheme(g.theme)),this.isOpen=!0,this.addMarker(y,m.session),this.range=o.fromPoints(y.start,y.end);var S=g.textToScreenCoordinates(y.start.row,y.start.column),k=g.scroller.getBoundingClientRect();S.pageX<k.left&&(S.pageX=k.left);var D=this.getElement();D.innerHTML="",D.appendChild(x),D.style.maxHeight="",D.style.display="block";var _=D.clientHeight,F=D.clientWidth,A=window.innerHeight-S.pageY-g.lineHeight,$=!0;S.pageY-_<0&&S.pageY<A&&($=!1),D.style.maxHeight=($?S.pageY:A)-b+"px",D.style.top=$?"":S.pageY+g.lineHeight+"px",D.style.bottom=$?window.innerHeight-S.pageY+"px":"",D.style.left=Math.min(S.pageX,window.innerWidth-F-b)+"px"}},f.prototype.addMarker=function(m,y){this.marker&&this.$markerSession.removeMarker(this.marker),this.$markerSession=y,this.marker=y&&y.addMarker(m,"ace_highlight-marker","text")},f.prototype.hide=function(m){!m&&document.activeElement==this.getElement()||m&&m.target&&(m.type!="keydown"||m.ctrlKey||m.metaKey)&&this.$element.contains(m.target)||(this.lastEvent=null,this.timeout&&clearTimeout(this.timeout),this.timeout=null,this.addMarker(null),this.isOpen&&(this.$removeCloseEvents(),this.getElement().style.display="none",this.isOpen=!1,h.removePopup(this)))},f.prototype.$registerCloseEvents=function(){window.addEventListener("keydown",this.hide,!0),window.addEventListener("wheel",this.hide,!0),window.addEventListener("mousedown",this.hide,!0)},f.prototype.$removeCloseEvents=function(){window.removeEventListener("keydown",this.hide,!0),window.removeEventListener("wheel",this.hide,!0),window.removeEventListener("mousedown",this.hide,!0)},f.prototype.onMouseOut=function(m){this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.lastEvent=null,this.isOpen&&(!m.relatedTarget||this.getElement().contains(m.relatedTarget)||m&&m.currentTarget.contains(m.relatedTarget)||m.relatedTarget.classList.contains("ace_content")||this.hide())},f}(t);l.HoverTooltip=a}),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/tooltip","ace/config"],function(i,l,v){var s=this&&this.__extends||function(){var u=function(f,m){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,x){y.__proto__=x}||function(y,x){for(var E in x)Object.prototype.hasOwnProperty.call(x,E)&&(y[E]=x[E])},u(f,m)};return function(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");u(f,m);function y(){this.constructor=f}f.prototype=m===null?Object.create(m):(y.prototype=m.prototype,new y)}}(),c=this&&this.__values||function(u){var f=typeof Symbol=="function"&&Symbol.iterator,m=f&&u[f],y=0;if(m)return m.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&y>=u.length&&(u=void 0),{value:u&&u[y++],done:!u}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},d=i("../lib/dom"),o=i("../lib/event"),p=i("../tooltip").Tooltip,e=i("../config").nls,t=5,r=3;l.GUTTER_TOOLTIP_LEFT_OFFSET=t,l.GUTTER_TOOLTIP_TOP_OFFSET=r;function h(u){var f=u.editor,m=f.renderer.$gutterLayer,y=new a(f,!0);u.editor.setDefaultHandler("guttermousedown",function(k){if(!(!f.isFocused()||k.getButton()!=0)){var D=m.getRegion(k);if(D!="foldWidgets"){var _=k.getDocumentPosition().row,F=f.session.selection;if(k.getShiftKey())F.selectTo(_,0);else{if(k.domEvent.detail==2)return f.selectAll(),k.preventDefault();u.$clickSelection=f.selection.getLineRange(_)}return u.setState("selectByLines"),u.captureMouse(k),k.preventDefault()}}});var x,E;function b(){var k=E.getDocumentPosition().row,D=f.session.getLength();if(k==D){var _=f.renderer.pixelToScreenCoordinates(0,E.y).row,F=E.$pos;if(_>f.session.documentToScreenRow(F.row,F.column))return g()}if(y.showTooltip(k),!!y.isOpen)if(f.on("mousewheel",g),f.on("changeSession",g),window.addEventListener("keydown",g,!0),u.$tooltipFollowsMouse)S(E);else{var A=E.getGutterRow(),$=m.$lines.get(A);if($){var w=$.element.querySelector(".ace_gutter_annotation"),C=w.getBoundingClientRect(),T=y.getElement().style;T.left=C.right-t+"px",T.top=C.bottom-r+"px"}else S(E)}}function g(k){k&&k.type==="keydown"&&(k.ctrlKey||k.metaKey)||k&&k.type==="mouseout"&&(!k.relatedTarget||y.getElement().contains(k.relatedTarget))||(x&&(x=clearTimeout(x)),y.isOpen&&(y.hideTooltip(),f.off("mousewheel",g),f.off("changeSession",g),window.removeEventListener("keydown",g,!0)))}function S(k){y.setPosition(k.x,k.y)}u.editor.setDefaultHandler("guttermousemove",function(k){var D=k.domEvent.target||k.domEvent.srcElement;if(d.hasCssClass(D,"ace_fold-widget")||d.hasCssClass(D,"ace_custom-widget"))return g();y.isOpen&&u.$tooltipFollowsMouse&&S(k),E=k,!x&&(x=setTimeout(function(){x=null,E&&!u.isMousePressed&&b()},50))}),o.addListener(f.renderer.$gutter,"mouseout",function(k){E=null,y.isOpen&&(x=setTimeout(function(){x=null,g(k)},50))},f)}l.GutterHandler=h;var a=function(u){s(f,u);function f(m,y){y===void 0&&(y=!1);var x=u.call(this,m.container)||this;x.editor=m,x.visibleTooltipRow;var E=x.getElement();return E.setAttribute("role","tooltip"),E.style.pointerEvents="auto",y&&(x.onMouseOut=x.onMouseOut.bind(x),E.addEventListener("mouseout",x.onMouseOut)),x}return f.prototype.onMouseOut=function(m){this.isOpen&&(!m.relatedTarget||this.getElement().contains(m.relatedTarget)||m&&m.currentTarget.contains(m.relatedTarget)||this.hideTooltip())},f.prototype.setPosition=function(m,y){var x=window.innerWidth||document.documentElement.clientWidth,E=window.innerHeight||document.documentElement.clientHeight,b=this.getWidth(),g=this.getHeight();m+=15,y+=15,m+b>x&&(m-=m+b-x),y+g>E&&(y-=20+g),p.prototype.setPosition.call(this,m,y)},Object.defineProperty(f,"annotationLabels",{get:function(){return{error:{singular:e("gutter-tooltip.aria-label.error.singular","error"),plural:e("gutter-tooltip.aria-label.error.plural","errors")},security:{singular:e("gutter-tooltip.aria-label.security.singular","security finding"),plural:e("gutter-tooltip.aria-label.security.plural","security findings")},warning:{singular:e("gutter-tooltip.aria-label.warning.singular","warning"),plural:e("gutter-tooltip.aria-label.warning.plural","warnings")},info:{singular:e("gutter-tooltip.aria-label.info.singular","information message"),plural:e("gutter-tooltip.aria-label.info.plural","information messages")},hint:{singular:e("gutter-tooltip.aria-label.hint.singular","suggestion"),plural:e("gutter-tooltip.aria-label.hint.plural","suggestions")}}},enumerable:!1,configurable:!0}),f.prototype.showTooltip=function(m){var y,x=this.editor.renderer.$gutterLayer,E=x.$annotations[m],b;E?b={displayText:Array.from(E.displayText),type:Array.from(E.type)}:b={displayText:[],type:[]};var g=x.session.getFoldLine(m);if(g&&x.$showFoldedAnnotations){for(var S={error:[],security:[],warning:[],info:[],hint:[]},k={error:1,security:2,warning:3,info:4,hint:5},D,_=m+1;_<=g.end.row;_++)if(x.$annotations[_])for(var F=0;F<x.$annotations[_].text.length;F++){var A=x.$annotations[_].type[F];S[A].push(x.$annotations[_].text[F]),(!D||k[A]<k[D])&&(D=A)}if(["error","security","warning"].includes(D)){var $="".concat(f.annotationsToSummaryString(S)," in folded code.");b.displayText.push($),b.type.push(D+"_fold")}}if(b.displayText.length===0)return this.hideTooltip();for(var w={error:[],security:[],warning:[],info:[],hint:[]},C=x.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",_=0;_<b.displayText.length;_++){var T=d.createElement("span"),I=d.createElement("span");(y=I.classList).add.apply(y,["ace_".concat(b.type[_]),C]),I.setAttribute("aria-label","".concat(f.annotationLabels[b.type[_].replace("_fold","")].singular)),I.setAttribute("role","img"),I.appendChild(d.createTextNode(" ")),T.appendChild(I),T.appendChild(d.createTextNode(b.displayText[_])),T.appendChild(d.createElement("br")),w[b.type[_].replace("_fold","")].push(T)}var O=this.getElement();d.removeChildren(O),w.error.forEach(function(R){return O.appendChild(R)}),w.security.forEach(function(R){return O.appendChild(R)}),w.warning.forEach(function(R){return O.appendChild(R)}),w.info.forEach(function(R){return O.appendChild(R)}),w.hint.forEach(function(R){return O.appendChild(R)}),O.setAttribute("aria-live","polite"),this.isOpen||(this.setTheme(this.editor.renderer.theme),this.setClassName("ace_gutter-tooltip")),this.show(),this.visibleTooltipRow=m,this.editor._signal("showGutterTooltip",this)},f.prototype.hideTooltip=function(){this.isOpen&&(this.$element.removeAttribute("aria-live"),this.hide(),this.visibleTooltipRow=void 0,this.editor._signal("hideGutterTooltip",this))},f.annotationsToSummaryString=function(m){var y,x,E=[],b=["error","security","warning","info","hint"];try{for(var g=c(b),S=g.next();!S.done;S=g.next()){var k=S.value;if(m[k].length){var D=m[k].length===1?f.annotationLabels[k].singular:f.annotationLabels[k].plural;E.push("".concat(m[k].length," ").concat(D))}}}catch(_){y={error:_}}finally{try{S&&!S.done&&(x=g.return)&&x.call(g)}finally{if(y)throw y.error}}return E.join(", ")},f}(p);l.GutterTooltip=a}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(i,l,v){var s=i("../lib/event"),c=i("../lib/useragent"),d=function(){function o(p,e){this.speed,this.wheelX,this.wheelY,this.domEvent=p,this.editor=e,this.x=this.clientX=p.clientX,this.y=this.clientY=p.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1}return o.prototype.stopPropagation=function(){s.stopPropagation(this.domEvent),this.propagationStopped=!0},o.prototype.preventDefault=function(){s.preventDefault(this.domEvent),this.defaultPrevented=!0},o.prototype.stop=function(){this.stopPropagation(),this.preventDefault()},o.prototype.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},o.prototype.getGutterRow=function(){var p=this.getDocumentPosition().row,e=this.editor.session.documentToScreenRow(p,0),t=this.editor.session.documentToScreenRow(this.editor.renderer.$gutterLayer.$lines.get(0).row,0);return e-t},o.prototype.inSelection=function(){if(this.$inSelection!==null)return this.$inSelection;var p=this.editor,e=p.getSelectionRange();if(e.isEmpty())this.$inSelection=!1;else{var t=this.getDocumentPosition();this.$inSelection=e.contains(t.row,t.column)}return this.$inSelection},o.prototype.getButton=function(){return s.getButton(this.domEvent)},o.prototype.getShiftKey=function(){return this.domEvent.shiftKey},o.prototype.getAccelKey=function(){return c.isMac?this.domEvent.metaKey:this.domEvent.ctrlKey},o}();l.MouseEvent=d}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(i,l,v){var s=i("../lib/dom"),c=i("../lib/event"),d=i("../lib/useragent"),o=200,p=200,e=5;function t(h){var a=h.editor,u=s.createElement("div");u.style.cssText="top:-100px;position:absolute;z-index:2147483647;opacity:0.5",u.textContent=" ";var f=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];f.forEach(function(W){h[W]=this[W]},this),a.on("mousedown",this.onMouseDown.bind(h));var m=a.container,y,x,E,b,g,S,k=0,D,_,F,A,$;this.onDragStart=function(W){if(this.cancelDrag||!m.draggable){var z=this;return setTimeout(function(){z.startSelect(),z.captureMouse(W)},0),W.preventDefault()}g=a.getSelectionRange();var U=W.dataTransfer;U.effectAllowed=a.getReadOnly()?"copy":"copyMove",a.container.appendChild(u),U.setDragImage&&U.setDragImage(u,0,0),setTimeout(function(){a.container.removeChild(u)}),U.clearData(),U.setData("Text",a.session.getTextRange()),_=!0,this.setState("drag")},this.onDragEnd=function(W){if(m.draggable=!1,_=!1,this.setState(null),!a.getReadOnly()){var z=W.dataTransfer.dropEffect;!D&&z=="move"&&a.session.remove(a.getSelectionRange()),a.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(W){if(!(a.getReadOnly()||!B(W.dataTransfer)))return x=W.clientX,E=W.clientY,y||I(),k++,W.dataTransfer.dropEffect=D=V(W),c.preventDefault(W)},this.onDragOver=function(W){if(!(a.getReadOnly()||!B(W.dataTransfer)))return x=W.clientX,E=W.clientY,y||(I(),k++),R!==null&&(R=null),W.dataTransfer.dropEffect=D=V(W),c.preventDefault(W)},this.onDragLeave=function(W){if(k--,k<=0&&y)return O(),D=null,c.preventDefault(W)},this.onDrop=function(W){if(S){var z=W.dataTransfer;if(_)switch(D){case"move":g.contains(S.row,S.column)?g={start:S,end:S}:g=a.moveText(g,S);break;case"copy":g=a.moveText(g,S,!0);break}else{var U=z.getData("Text");g={start:S,end:a.session.insert(S,U)},a.focus(),D=null}return O(),c.preventDefault(W)}},c.addListener(m,"dragstart",this.onDragStart.bind(h),a),c.addListener(m,"dragend",this.onDragEnd.bind(h),a),c.addListener(m,"dragenter",this.onDragEnter.bind(h),a),c.addListener(m,"dragover",this.onDragOver.bind(h),a),c.addListener(m,"dragleave",this.onDragLeave.bind(h),a),c.addListener(m,"drop",this.onDrop.bind(h),a);function w(W,z){var U=Date.now(),G=!z||W.row!=z.row,Y=!z||W.column!=z.column;if(!A||G||Y)a.moveCursorToPosition(W),A=U,$={x,y:E};else{var Q=r($.x,$.y,x,E);Q>e?A=null:U-A>=p&&(a.renderer.scrollCursorIntoView(),A=null)}}function C(W,z){var U=Date.now(),G=a.renderer.layerConfig.lineHeight,Y=a.renderer.layerConfig.characterWidth,Q=a.renderer.scroller.getBoundingClientRect(),q={x:{left:x-Q.left,right:Q.right-x},y:{top:E-Q.top,bottom:Q.bottom-E}},te=Math.min(q.x.left,q.x.right),re=Math.min(q.y.top,q.y.bottom),ue={row:W.row,column:W.column};te/Y<=2&&(ue.column+=q.x.left<q.x.right?-3:2),re/G<=1&&(ue.row+=q.y.top<q.y.bottom?-1:1);var me=W.row!=ue.row,Ce=W.column!=ue.column,ve=!z||W.row!=z.row;me||Ce&&!ve?F?U-F>=o&&a.renderer.scrollCursorIntoView(ue):F=U:F=null}function T(){var W=S;S=a.renderer.screenToTextCoordinates(x,E),w(S,W),C(S,W)}function I(){g=a.selection.toOrientedRange(),y=a.session.addMarker(g,"ace_selection",a.getSelectionStyle()),a.clearSelection(),a.isFocused()&&a.renderer.$cursorLayer.setBlinking(!1),clearInterval(b),T(),b=setInterval(T,20),k=0,c.addListener(document,"mousemove",P)}function O(){clearInterval(b),a.session.removeMarker(y),y=null,a.selection.fromOrientedRange(g),a.isFocused()&&!_&&a.$resetCursorStyle(),g=null,S=null,k=0,F=null,A=null,c.removeListener(document,"mousemove",P)}var R=null;function P(){R==null&&(R=setTimeout(function(){R!=null&&y&&O()},20))}function B(W){var z=W.types;return!z||Array.prototype.some.call(z,function(U){return U=="text/plain"||U=="Text"})}function V(W){var z=["copy","copymove","all","uninitialized"],U=["move","copymove","linkmove","all","uninitialized"],G=d.isMac?W.altKey:W.ctrlKey,Y="uninitialized";try{Y=W.dataTransfer.effectAllowed.toLowerCase()}catch{}var Q="none";return G&&z.indexOf(Y)>=0?Q="copy":U.indexOf(Y)>=0?Q="move":z.indexOf(Y)>=0&&(Q="copy"),Q}}(function(){this.dragWait=function(){var h=Date.now()-this.mousedownEvent.time;h>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var h=this.editor.container;h.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(h){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var h=this.editor,a=h.container;a.draggable=!0,h.renderer.$cursorLayer.setBlinking(!1),h.setStyle("ace_dragging");var u=d.isWin?"default":"move";h.renderer.setCursorStyle(u),this.setState("dragReady")},this.onMouseDrag=function(h){var a=this.editor.container;if(d.isIE&&this.state=="dragReady"){var u=r(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);u>3&&a.dragDrop()}if(this.state==="dragWait"){var u=r(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);u>0&&(a.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(h){if(this.$dragEnabled){this.mousedownEvent=h;var a=this.editor,u=h.inSelection(),f=h.getButton(),m=h.domEvent.detail||1;if(m===1&&f===0&&u){if(h.editor.inMultiSelectMode&&(h.getAccelKey()||h.getShiftKey()))return;this.mousedownEvent.time=Date.now();var y=h.domEvent.target||h.domEvent.srcElement;if("unselectable"in y&&(y.unselectable="on"),a.getDragDelay()){if(d.isWebKit){this.cancelDrag=!0;var x=a.container;x.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(h,this.onMouseDrag.bind(this)),h.defaultPrevented=!0}}}}).call(t.prototype);function r(h,a,u,f){return Math.sqrt(Math.pow(u-h,2)+Math.pow(f-a,2))}l.DragdropHandler=t}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(i,l,v){var s=i("./mouse_event").MouseEvent,c=i("../lib/event"),d=i("../lib/dom");l.addTouchListeners=function(o,p){var e="scroll",t,r,h,a,u,f,m=0,y,x=0,E=0,b=0,g,S;function k(){var w=window.navigator&&window.navigator.clipboard,C=!1,T=function(){var R=p.getCopyText(),P=p.session.getUndoManager().hasUndo();S.replaceChild(d.buildDom(C?["span",!R&&I("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],R&&I("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],R&&I("cut")&&["span",{class:"ace_mobile-button",action:"cut"},"Cut"],w&&I("paste")&&["span",{class:"ace_mobile-button",action:"paste"},"Paste"],P&&I("undo")&&["span",{class:"ace_mobile-button",action:"undo"},"Undo"],I("find")&&["span",{class:"ace_mobile-button",action:"find"},"Find"],I("openCommandPalette")&&["span",{class:"ace_mobile-button",action:"openCommandPalette"},"Palette"]]:["span"]),S.firstChild)},I=function(R){return p.commands.canExecute(R,p)},O=function(R){var P=R.target.getAttribute("action");if(P=="more"||!C)return C=!C,T();P=="paste"?w.readText().then(function(B){p.execCommand(P,B)}):P&&((P=="cut"||P=="copy")&&(w?w.writeText(p.getCopyText()):document.execCommand("copy")),p.execCommand(P)),S.firstChild.style.display="none",C=!1,P!="openCommandPalette"&&p.focus()};S=d.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(R){e="menu",R.stopPropagation(),R.preventDefault(),p.textInput.focus()},ontouchend:function(R){R.stopPropagation(),R.preventDefault(),O(R)},onclick:O},["span"],["span",{class:"ace_mobile-button",action:"more"},"..."]],p.container)}function D(){if(!p.getOption("enableMobileMenu")){S&&_();return}S||k();var w=p.selection.cursor,C=p.renderer.textToScreenCoordinates(w.row,w.column),T=p.renderer.textToScreenCoordinates(0,0).pageX,I=p.renderer.scrollLeft,O=p.container.getBoundingClientRect();S.style.top=C.pageY-O.top-3+"px",C.pageX-O.left<O.width-70?(S.style.left="",S.style.right="10px"):(S.style.right="",S.style.left=T+I-O.left+"px"),S.style.display="",S.firstChild.style.display="none",p.on("input",_)}function _(w){S&&(S.style.display="none"),p.off("input",_)}function F(){u=null,clearTimeout(u);var w=p.selection.getRange(),C=w.contains(y.row,y.column);(w.isEmpty()||!C)&&(p.selection.moveToPosition(y),p.selection.selectWord()),e="wait",D()}function A(){u=null,clearTimeout(u),p.selection.moveToPosition(y);var w=x>=2?p.selection.getLineRange(y.row):p.session.getBracketRange(y);w&&!w.isEmpty()?p.selection.setRange(w):p.selection.selectWord(),e="wait"}c.addListener(o,"contextmenu",function(w){if(g){var C=p.textInput.getElement();C.focus()}},p),c.addListener(o,"touchstart",function(w){var C=w.touches;if(u||C.length>1){clearTimeout(u),u=null,h=-1,e="zoom";return}g=p.$mouseHandler.isMousePressed=!0;var T=p.renderer.layerConfig.lineHeight,I=p.renderer.layerConfig.lineHeight,O=w.timeStamp;a=O;var R=C[0],P=R.clientX,B=R.clientY;Math.abs(t-P)+Math.abs(r-B)>T&&(h=-1),t=w.clientX=P,r=w.clientY=B,E=b=0;var V=new s(w,p);if(y=V.getDocumentPosition(),O-h<500&&C.length==1&&!m)x++,w.preventDefault(),w.button=0,A();else{x=0;var W=p.selection.cursor,z=p.selection.isEmpty()?W:p.selection.anchor,U=p.renderer.$cursorLayer.getPixelPosition(W,!0),G=p.renderer.$cursorLayer.getPixelPosition(z,!0),Y=p.renderer.scroller.getBoundingClientRect(),Q=p.renderer.layerConfig.offset,q=p.renderer.scrollLeft,te=function(me,Ce){return me=me/I,Ce=Ce/T-.75,me*me+Ce*Ce};if(w.clientX<Y.left){e="zoom";return}var re=te(w.clientX-Y.left-U.left+q,w.clientY-Y.top-U.top+Q),ue=te(w.clientX-Y.left-G.left+q,w.clientY-Y.top-G.top+Q);re<3.5&&ue<3.5&&(e=re>ue?"cursor":"anchor"),ue<3.5?e="anchor":re<3.5?e="cursor":e="scroll",u=setTimeout(F,450)}h=O},p),c.addListener(o,"touchend",function(w){g=p.$mouseHandler.isMousePressed=!1,f&&clearInterval(f),e=="zoom"?(e="",m=0):u?(p.selection.moveToPosition(y),m=0,D()):e=="scroll"?($(),_()):D(),clearTimeout(u),u=null},p),c.addListener(o,"touchmove",function(w){u&&(clearTimeout(u),u=null);var C=w.touches;if(!(C.length>1||e=="zoom")){var T=C[0],I=t-T.clientX,O=r-T.clientY;if(e=="wait")if(I*I+O*O>4)e="cursor";else return w.preventDefault();t=T.clientX,r=T.clientY,w.clientX=T.clientX,w.clientY=T.clientY;var R=w.timeStamp,P=R-a;if(a=R,e=="scroll"){var B=new s(w,p);B.speed=1,B.wheelX=I,B.wheelY=O,10*Math.abs(I)<Math.abs(O)&&(I=0),10*Math.abs(O)<Math.abs(I)&&(O=0),P!=0&&(E=I/P,b=O/P),p._emit("mousewheel",B),B.propagationStopped||(E=b=0)}else{var V=new s(w,p),W=V.getDocumentPosition();e=="cursor"?p.selection.moveCursorToPosition(W):e=="anchor"&&p.selection.setSelectionAnchor(W.row,W.column),p.renderer.scrollCursorIntoView(W),w.preventDefault()}}},p);function $(){m+=60,f=setInterval(function(){m--<=0&&(clearInterval(f),f=null),Math.abs(E)<.01&&(E=0),Math.abs(b)<.01&&(b=0),m<20&&(E=.9*E),m<20&&(b=.9*b);var w=p.session.getScrollTop();p.renderer.scrollBy(10*E,10*b),w==p.session.getScrollTop()&&(m=0)},10)}}}),ace.define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/mouse/touch_handler","ace/config"],function(i,l,v){var s=i("../lib/event"),c=i("../lib/useragent"),d=i("./default_handlers").DefaultHandlers,o=i("./default_gutter_handler").GutterHandler,p=i("./mouse_event").MouseEvent,e=i("./dragdrop_handler").DragdropHandler,t=i("./touch_handler").addTouchListeners,r=i("../config"),h=function(){function a(u){this.$dragDelay,this.$dragEnabled,this.$mouseMoved,this.mouseEvent,this.$focusTimeout;var f=this;this.editor=u,new d(this),new o(this),new e(this);var m=function(E){var b=!document.hasFocus||!document.hasFocus()||!u.isFocused()&&document.activeElement==(u.textInput&&u.textInput.getElement());b&&window.focus(),u.focus(),setTimeout(function(){u.isFocused()||u.focus()})},y=u.renderer.getMouseEventTarget();s.addListener(y,"click",this.onMouseEvent.bind(this,"click"),u),s.addListener(y,"mousemove",this.onMouseMove.bind(this,"mousemove"),u),s.addMultiMouseDownListener([y,u.renderer.scrollBarV&&u.renderer.scrollBarV.inner,u.renderer.scrollBarH&&u.renderer.scrollBarH.inner,u.textInput&&u.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent",u),s.addMouseWheelListener(u.container,this.onMouseWheel.bind(this,"mousewheel"),u),t(u.container,u);var x=u.renderer.$gutter;s.addListener(x,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),u),s.addListener(x,"click",this.onMouseEvent.bind(this,"gutterclick"),u),s.addListener(x,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),u),s.addListener(x,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),u),s.addListener(y,"mousedown",m,u),s.addListener(x,"mousedown",m,u),c.isIE&&u.renderer.scrollBarV&&(s.addListener(u.renderer.scrollBarV.element,"mousedown",m,u),s.addListener(u.renderer.scrollBarH.element,"mousedown",m,u)),u.on("mousemove",function(E){if(!(f.state||f.$dragDelay||!f.$dragEnabled)){var b=u.renderer.screenToTextCoordinates(E.x,E.y),g=u.session.selection.getRange(),S=u.renderer;!g.isEmpty()&&g.insideStart(b.row,b.column)?S.setCursorStyle("default"):S.setCursorStyle("")}},u)}return a.prototype.onMouseEvent=function(u,f){this.editor.session&&this.editor._emit(u,new p(f,this.editor))},a.prototype.onMouseMove=function(u,f){var m=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;!m||!m.length||this.editor._emit(u,new p(f,this.editor))},a.prototype.onMouseWheel=function(u,f){var m=new p(f,this.editor);m.speed=this.$scrollSpeed*2,m.wheelX=f.wheelX,m.wheelY=f.wheelY,this.editor._emit(u,m)},a.prototype.setState=function(u){this.state=u},a.prototype.captureMouse=function(u,f){this.x=u.x,this.y=u.y,this.isMousePressed=!0;var m=this.editor,y=this.editor.renderer;y.$isMousePressed=!0;var x=this,E=!0,b=function(_){if(_){if(c.isWebKit&&!_.which&&x.releaseMouse)return x.releaseMouse();x.x=_.clientX,x.y=_.clientY,f&&f(_),x.mouseEvent=new p(_,x.editor),x.$mouseMoved=!0}},g=function(_){m.off("beforeEndOperation",D),E=!1,m.session&&S(),x[x.state+"End"]&&x[x.state+"End"](_),x.state="",x.isMousePressed=y.$isMousePressed=!1,y.$keepTextAreaAtCursor&&y.$moveTextAreaToCursor(),x.$onCaptureMouseMove=x.releaseMouse=null,_&&x.onMouseEvent("mouseup",_),m.endOperation()},S=function(){x[x.state]&&x[x.state](),x.$mouseMoved=!1},k=function(){E&&(S(),s.nextFrame(k))};if(c.isOldIE&&u.domEvent.type=="dblclick")return setTimeout(function(){g(u)});var D=function(_){x.releaseMouse&&m.curOp.command.name&&m.curOp.selectionChanged&&(x[x.state+"End"]&&x[x.state+"End"](),x.state="",x.releaseMouse())};m.on("beforeEndOperation",D),m.startOperation({command:{name:"mouse"}}),x.$onCaptureMouseMove=b,x.releaseMouse=s.capture(this.editor.container,b,g),k()},a.prototype.cancelContextMenu=function(){var u=function(f){f&&f.domEvent&&f.domEvent.type!="contextmenu"||(this.editor.off("nativecontextmenu",u),f&&f.domEvent&&s.stopEvent(f.domEvent))}.bind(this);setTimeout(u,10),this.editor.on("nativecontextmenu",u)},a.prototype.destroy=function(){this.releaseMouse&&this.releaseMouse()},a}();h.prototype.releaseMouse=null,r.defineOptions(h.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:c.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),l.MouseHandler=h}),ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(i,l,v){var s=i("../lib/dom"),c=function(){function d(o){o.on("click",function(p){var e=p.getDocumentPosition(),t=o.session,r=t.getFoldAt(e.row,e.column,1);r&&(p.getAccelKey()?t.removeFold(r):t.expandFold(r),p.stop());var h=p.domEvent&&p.domEvent.target;h&&s.hasCssClass(h,"ace_inline_button")&&s.hasCssClass(h,"ace_toggle_wrap")&&(t.setOption("wrap",!t.getUseWrapMode()),o.renderer.scrollCursorIntoView())}),o.on("gutterclick",function(p){var e=o.renderer.$gutterLayer.getRegion(p);if(e=="foldWidgets"){var t=p.getDocumentPosition().row,r=o.session;r.foldWidgets&&r.foldWidgets[t]&&o.session.onFoldWidgetClick(t,p),o.isFocused()||o.focus(),p.stop()}}),o.on("gutterdblclick",function(p){var e=o.renderer.$gutterLayer.getRegion(p);if(e=="foldWidgets"){var t=p.getDocumentPosition().row,r=o.session,h=r.getParentFoldRangeData(t,!0),a=h.range||h.firstRange;if(a){t=a.start.row;var u=r.getFoldAt(t,r.getLine(t).length,1);u?r.removeFold(u):(r.addFold("...",a),o.renderer.scrollCursorIntoView({row:a.start.row,column:0}))}p.stop()}})}return d}();l.FoldHandler=c}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(i,l,v){var s=i("../lib/keys"),c=i("../lib/event"),d=function(){function o(p){this.$editor=p,this.$data={editor:p},this.$handlers=[],this.setDefaultHandler(p.commands)}return o.prototype.setDefaultHandler=function(p){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=p,this.addKeyboardHandler(p,0)},o.prototype.setKeyboardHandler=function(p){var e=this.$handlers;if(e[e.length-1]!=p){for(;e[e.length-1]&&e[e.length-1]!=this.$defaultHandler;)this.removeKeyboardHandler(e[e.length-1]);this.addKeyboardHandler(p,1)}},o.prototype.addKeyboardHandler=function(p,e){if(p){typeof p=="function"&&!p.handleKeyboard&&(p.handleKeyboard=p);var t=this.$handlers.indexOf(p);t!=-1&&this.$handlers.splice(t,1),e==null?this.$handlers.push(p):this.$handlers.splice(e,0,p),t==-1&&p.attach&&p.attach(this.$editor)}},o.prototype.removeKeyboardHandler=function(p){var e=this.$handlers.indexOf(p);return e==-1?!1:(this.$handlers.splice(e,1),p.detach&&p.detach(this.$editor),!0)},o.prototype.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},o.prototype.getStatusText=function(){var p=this.$data,e=p.editor;return this.$handlers.map(function(t){return t.getStatusText&&t.getStatusText(e,p)||""}).filter(Boolean).join(" ")},o.prototype.$callKeyboardHandlers=function(p,e,t,r){for(var h,a=!1,u=this.$editor.commands,f=this.$handlers.length;f--&&(h=this.$handlers[f].handleKeyboard(this.$data,p,e,t,r),!(!(!h||!h.command)&&(h.command=="null"?a=!0:a=u.exec(h.command,this.$editor,h.args,r),a&&r&&p!=-1&&h.passEvent!=!0&&h.command.passEvent!=!0&&c.stopEvent(r),a))););return!a&&p==-1&&(h={command:"insertstring"},a=u.exec("insertstring",this.$editor,e)),a&&this.$editor._signal&&this.$editor._signal("keyboardActivity",h),a},o.prototype.onCommandKey=function(p,e,t){var r=s.keyCodeToString(t);return this.$callKeyboardHandlers(e,r,t,p)},o.prototype.onTextInput=function(p){return this.$callKeyboardHandlers(-1,p)},o}();l.KeyBinding=d}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(i,l,v){var s=0,c=0,d=!1,o=!1,p=!1,e=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],t=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],r=0,h=1,a=0,u=1,f=2,m=3,y=4,x=5,E=6,b=7,g=8,S=9,k=10,D=11,_=12,F=13,A=14,$=15,w=16,C=17,T=18,I=[T,T,T,T,T,T,T,T,T,E,x,E,g,x,T,T,T,T,T,T,T,T,T,T,T,T,T,T,x,x,x,E,g,y,y,D,D,D,y,y,y,y,y,k,S,k,S,S,f,f,f,f,f,f,f,f,f,f,S,y,y,y,y,y,y,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,y,y,y,y,y,y,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,y,y,y,y,T,T,T,T,T,T,x,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,S,y,D,D,D,D,y,y,y,y,a,y,y,T,y,y,D,D,f,f,y,a,y,y,y,f,a,y,y,y,y,y],O=[g,g,g,g,g,g,g,g,g,g,g,T,T,T,a,u,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,g,x,F,A,$,w,C,S,D,D,D,D,D,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,S,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,g];function R(W,z,U,G){var Y=s?t:e,Q=null,q=null,te=null,re=0,ue=null,me=null,Ce=-1,ve=null,$e=null,Lt=[];if(!G)for(ve=0,G=[];ve<U;ve++)G[ve]=V(W[ve]);for(c=s,d=!1,o=!1,p=!1,$e=0;$e<U;$e++){if(Q=re,Lt[$e]=q=B(W,G,Lt,$e),re=Y[Q][q],ue=re&240,re&=15,z[$e]=te=Y[re][5],ue>0)if(ue==16){for(ve=Ce;ve<$e;ve++)z[ve]=1;Ce=-1}else Ce=-1;if(me=Y[re][6],me)Ce==-1&&(Ce=$e);else if(Ce>-1){for(ve=Ce;ve<$e;ve++)z[ve]=te;Ce=-1}G[$e]==x&&(z[$e]=0),c|=te}if(p){for(ve=0;ve<U;ve++)if(G[ve]==E){z[ve]=s;for(var gt=ve-1;gt>=0&&G[gt]==g;gt--)z[gt]=s}}}function P(W,z,U){if(!(c<W)){if(W==1&&s==h&&!o){U.reverse();return}for(var G=U.length,Y=0,Q,q,te,re;Y<G;){if(z[Y]>=W){for(Q=Y+1;Q<G&&z[Q]>=W;)Q++;for(q=Y,te=Q-1;q<te;q++,te--)re=U[q],U[q]=U[te],U[te]=re;Y=Q}Y++}}}function B(W,z,U,G){var Y=z[G],Q,q,te,re;switch(Y){case a:case u:d=!1;case y:case m:return Y;case f:return d?m:f;case b:return d=!0,u;case g:return y;case S:return G<1||G+1>=z.length||(Q=U[G-1])!=f&&Q!=m||(q=z[G+1])!=f&&q!=m?y:(d&&(q=m),q==Q?q:y);case k:return Q=G>0?U[G-1]:x,Q==f&&G+1<z.length&&z[G+1]==f?f:y;case D:if(G>0&&U[G-1]==f)return f;if(d)return y;for(re=G+1,te=z.length;re<te&&z[re]==D;)re++;return re<te&&z[re]==f?f:y;case _:for(te=z.length,re=G+1;re<te&&z[re]==_;)re++;if(re<te){var ue=W[G],me=ue>=1425&&ue<=2303||ue==64286;if(Q=z[re],me&&(Q==u||Q==b))return u}return G<1||(Q=z[G-1])==x?y:U[G-1];case x:return d=!1,o=!0,s;case E:return p=!0,y;case F:case A:case w:case C:case $:d=!1;case T:return y}}function V(W){var z=W.charCodeAt(0),U=z>>8;return U==0?z>191?a:I[z]:U==5?/[\u0591-\u05f4]/.test(W)?u:a:U==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(W)?_:/[\u0660-\u0669\u066b-\u066c]/.test(W)?m:z==1642?D:/[\u06f0-\u06f9]/.test(W)?f:b:U==32&&z<=8287?O[z&255]:U==254&&z>=65136?b:y}l.L=a,l.R=u,l.EN=f,l.ON_R=3,l.AN=4,l.R_H=5,l.B=6,l.RLE=7,l.DOT="·",l.doBidiReorder=function(W,z,U){if(W.length<2)return{};var G=W.split(""),Y=new Array(G.length),Q=new Array(G.length),q=[];s=U?h:r,R(G,q,G.length,z);for(var te=0;te<Y.length;Y[te]=te,te++);P(2,q,Y),P(1,q,Y);for(var te=0;te<Y.length-1;te++)z[te]===m?q[te]=l.AN:q[te]===u&&(z[te]>b&&z[te]<F||z[te]===y||z[te]===T)?q[te]=l.ON_R:te>0&&G[te-1]==="ل"&&/\u0622|\u0623|\u0625|\u0627/.test(G[te])&&(q[te-1]=q[te]=l.R_H,te++);G[G.length-1]===l.DOT&&(q[G.length-1]=l.B),G[0]===""&&(q[0]=l.RLE);for(var te=0;te<Y.length;te++)Q[te]=q[Y[te]];return{logicalFromVisual:Y,bidiLevels:Q}},l.hasBidiCharacters=function(W,z){for(var U=!1,G=0;G<W.length;G++)z[G]=V(W.charAt(G)),!U&&(z[G]==u||z[G]==b||z[G]==m)&&(U=!0);return U},l.getVisualFromLogicalIdx=function(W,z){for(var U=0;U<z.logicalFromVisual.length;U++)if(z.logicalFromVisual[U]==W)return U;return 0}}),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(i,l,v){var s=i("./lib/bidiutil"),c=i("./lib/lang"),d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/,o=function(){function p(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=s,this.charWidths=[],this.EOL="¬",this.showInvisibles=!0,this.isRtlDir=!1,this.$isRtl=!1,this.line="",this.wrapIndent=0,this.EOF="¶",this.RLE="",this.contentWidth=0,this.fontMetrics=null,this.rtlLineOffset=0,this.wrapOffset=0,this.isMoveLeftOperation=!1,this.seenBidi=d.test(e.getValue())}return p.prototype.isBidiRow=function(e,t,r){return this.seenBidi?(e!==this.currentRow&&(this.currentRow=e,this.updateRowLine(t,r),this.updateBidiMap()),this.bidiMap.bidiLevels):!1},p.prototype.onChange=function(e){this.seenBidi?this.currentRow=null:e.action=="insert"&&d.test(e.lines.join(`
|
|
193
|
-
`))&&(this.seenBidi=!0,this.currentRow=null)},p.prototype.getDocumentRow=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var r=this.session.$getRowCacheIndex(t,this.currentRow);r>=0&&(e=this.session.$docRowCache[r])}return e},p.prototype.getSplitIndex=function(){var e=0,t=this.session.$screenRowCache;if(t.length)for(var r,h=this.session.$getRowCacheIndex(t,this.currentRow);this.currentRow-e>0&&(r=this.session.$getRowCacheIndex(t,this.currentRow-e-1),r===h);)h=r,e++;else e=this.currentRow;return e},p.prototype.updateRowLine=function(e,t){e===void 0&&(e=this.getDocumentRow());var r=e===this.session.getLength()-1,h=r?this.EOF:this.EOL;if(this.wrapIndent=0,this.line=this.session.getLine(e),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE,this.session.$useWrapMode){var a=this.session.$wrapData[e];a&&(t===void 0&&(t=this.getSplitIndex()),t>0&&a.length?(this.wrapIndent=a.indent,this.wrapOffset=this.wrapIndent*this.charWidths[s.L],this.line=t<a.length?this.line.substring(a[t-1],a[t]):this.line.substring(a[a.length-1])):this.line=this.line.substring(0,a[t]),t==a.length&&(this.line+=this.showInvisibles?h:s.DOT))}else this.line+=this.showInvisibles?h:s.DOT;var u=this.session,f=0,m;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(y,x){return y===" "||u.isFullWidth(y.charCodeAt(0))?(m=y===" "?u.getScreenTabSize(x+f):2,f+=m-1,c.stringRepeat(s.DOT,m)):y}),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==s.DOT?this.line.substr(0,this.line.length-1):this.line,this.rtlLineOffset=this.contentWidth-this.fontMetrics.$main.getBoundingClientRect().width)},p.prototype.updateBidiMap=function(){var e=[];s.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=s.doBidiReorder(this.line,e,this.isRtlDir):this.bidiMap={}},p.prototype.markAsDirty=function(){this.currentRow=null},p.prototype.updateCharacterWidths=function(e){if(this.characterWidth!==e.$characterSize.width){this.fontMetrics=e;var t=this.characterWidth=e.$characterSize.width,r=e.$measureCharWidth("ה");this.charWidths[s.L]=this.charWidths[s.EN]=this.charWidths[s.ON_R]=t,this.charWidths[s.R]=this.charWidths[s.AN]=r,this.charWidths[s.R_H]=r*.45,this.charWidths[s.B]=this.charWidths[s.RLE]=0,this.currentRow=null}},p.prototype.setShowInvisibles=function(e){this.showInvisibles=e,this.currentRow=null},p.prototype.setEolChar=function(e){this.EOL=e},p.prototype.setContentWidth=function(e){this.contentWidth=e},p.prototype.isRtlLine=function(e){return this.$isRtl?!0:e!=null?this.session.getLine(e).charAt(0)==this.RLE:this.isRtlDir},p.prototype.setRtlDirection=function(e,t){for(var r=e.getCursorPosition(),h=e.selection.getSelectionAnchor().row;h<=r.row;h++)!t&&e.session.getLine(h).charAt(0)===e.session.$bidiHandler.RLE?e.session.doc.removeInLine(h,0,1):t&&e.session.getLine(h).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:h},e.session.$bidiHandler.RLE)},p.prototype.getPosLeft=function(e){e-=this.wrapIndent;var t=this.line.charAt(0)===this.RLE?1:0,r=e>t?this.session.getOverwrite()?e:e-1:t,h=s.getVisualFromLogicalIdx(r,this.bidiMap),a=this.bidiMap.bidiLevels,u=0;!this.session.getOverwrite()&&e<=t&&a[h]%2!==0&&h++;for(var f=0;f<h;f++)u+=this.charWidths[a[f]];return!this.session.getOverwrite()&&e>t&&a[h]%2===0&&(u+=this.charWidths[a[h]]),this.wrapIndent&&(u+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(u+=this.rtlLineOffset),u},p.prototype.getSelections=function(e,t){var r=this.bidiMap,h=r.bidiLevels,a,u=[],f=0,m=Math.min(e,t)-this.wrapIndent,y=Math.max(e,t)-this.wrapIndent,x=!1,E=!1,b=0;this.wrapIndent&&(f+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var g,S=0;S<h.length;S++)g=r.logicalFromVisual[S],a=h[S],x=g>=m&&g<y,x&&!E?b=f:!x&&E&&u.push({left:b,width:f-b}),f+=this.charWidths[a],E=x;if(x&&S===h.length&&u.push({left:b,width:f-b}),this.isRtlDir)for(var k=0;k<u.length;k++)u[k].left+=this.rtlLineOffset;return u},p.prototype.offsetToCol=function(r){this.isRtlDir&&(r-=this.rtlLineOffset);var t=0,r=Math.max(r,0),h=0,a=0,u=this.bidiMap.bidiLevels,f=this.charWidths[u[a]];for(this.wrapIndent&&(r-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);r>h+f/2;){if(h+=f,a===u.length-1){f=0;break}f=this.charWidths[u[++a]]}return a>0&&u[a-1]%2!==0&&u[a]%2===0?(r<h&&a--,t=this.bidiMap.logicalFromVisual[a]):a>0&&u[a-1]%2===0&&u[a]%2!==0?t=1+(r>h?this.bidiMap.logicalFromVisual[a]:this.bidiMap.logicalFromVisual[a-1]):this.isRtlDir&&a===u.length-1&&f===0&&u[a-1]%2===0||!this.isRtlDir&&a===0&&u[a]%2!==0?t=1+this.bidiMap.logicalFromVisual[a]:(a>0&&u[a-1]%2!==0&&f!==0&&a--,t=this.bidiMap.logicalFromVisual[a]),t===0&&this.isRtlDir&&t++,t+this.wrapIndent},p}();l.BidiHandler=o}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(i,l,v){var s=i("./lib/oop"),c=i("./lib/lang"),d=i("./lib/event_emitter").EventEmitter,o=i("./range").Range,p=function(){function e(t){this.session=t,this.doc=t.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var r=this;this.cursor.on("change",function(h){r.$cursorChanged=!0,r.$silent||r._emit("changeCursor"),!r.$isEmpty&&!r.$silent&&r._emit("changeSelection"),!r.$keepDesiredColumnOnChange&&h.old.column!=h.value.column&&(r.$desiredColumn=null)}),this.anchor.on("change",function(){r.$anchorChanged=!0,!r.$isEmpty&&!r.$silent&&r._emit("changeSelection")})}return e.prototype.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},e.prototype.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},e.prototype.getCursor=function(){return this.lead.getPosition()},e.prototype.setAnchor=function(t,r){this.$isEmpty=!1,this.anchor.setPosition(t,r)},e.prototype.getAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},e.prototype.getSelectionLead=function(){return this.lead.getPosition()},e.prototype.isBackwards=function(){var t=this.anchor,r=this.lead;return t.row>r.row||t.row==r.row&&t.column>r.column},e.prototype.getRange=function(){var t=this.anchor,r=this.lead;return this.$isEmpty?o.fromPoints(r,r):this.isBackwards()?o.fromPoints(r,t):o.fromPoints(t,r)},e.prototype.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},e.prototype.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},e.prototype.setRange=function(t,r){var h=r?t.end:t.start,a=r?t.start:t.end;this.$setSelection(h.row,h.column,a.row,a.column)},e.prototype.$setSelection=function(t,r,h,a){if(!this.$silent){var u=this.$isEmpty,f=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(t,r),this.cursor.setPosition(h,a),this.$isEmpty=!o.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||u!=this.$isEmpty||f)&&this._emit("changeSelection")}},e.prototype.$moveSelection=function(t){var r=this.lead;this.$isEmpty&&this.setSelectionAnchor(r.row,r.column),t.call(this)},e.prototype.selectTo=function(t,r){this.$moveSelection(function(){this.moveCursorTo(t,r)})},e.prototype.selectToPosition=function(t){this.$moveSelection(function(){this.moveCursorToPosition(t)})},e.prototype.moveTo=function(t,r){this.clearSelection(),this.moveCursorTo(t,r)},e.prototype.moveToPosition=function(t){this.clearSelection(),this.moveCursorToPosition(t)},e.prototype.selectUp=function(){this.$moveSelection(this.moveCursorUp)},e.prototype.selectDown=function(){this.$moveSelection(this.moveCursorDown)},e.prototype.selectRight=function(){this.$moveSelection(this.moveCursorRight)},e.prototype.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},e.prototype.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},e.prototype.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},e.prototype.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},e.prototype.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},e.prototype.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},e.prototype.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},e.prototype.getWordRange=function(t,r){if(typeof r>"u"){var h=t||this.lead;t=h.row,r=h.column}return this.session.getWordRange(t,r)},e.prototype.selectWord=function(){this.setSelectionRange(this.getWordRange())},e.prototype.selectAWord=function(){var t=this.getCursor(),r=this.session.getAWordRange(t.row,t.column);this.setSelectionRange(r)},e.prototype.getLineRange=function(t,r){var h=typeof t=="number"?t:this.lead.row,a,u=this.session.getFoldLine(h);return u?(h=u.start.row,a=u.end.row):a=h,r===!0?new o(h,0,a,this.session.getLine(a).length):new o(h,0,a+1,0)},e.prototype.selectLine=function(){this.setSelectionRange(this.getLineRange())},e.prototype.moveCursorUp=function(){this.moveCursorBy(-1,0)},e.prototype.moveCursorDown=function(){this.moveCursorBy(1,0)},e.prototype.wouldMoveIntoSoftTab=function(t,r,h){var a=t.column,u=t.column+r;return h<0&&(a=t.column-r,u=t.column),this.session.isTabStop(t)&&this.doc.getLine(t.row).slice(a,u).split(" ").length-1==r},e.prototype.moveCursorLeft=function(){var t=this.lead.getPosition(),r;if(r=this.session.getFoldAt(t.row,t.column,-1))this.moveCursorTo(r.start.row,r.start.column);else if(t.column===0)t.row>0&&this.moveCursorTo(t.row-1,this.doc.getLine(t.row-1).length);else{var h=this.session.getTabSize();this.wouldMoveIntoSoftTab(t,h,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-h):this.moveCursorBy(0,-1)}},e.prototype.moveCursorRight=function(){var t=this.lead.getPosition(),r;if(r=this.session.getFoldAt(t.row,t.column,1))this.moveCursorTo(r.end.row,r.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var h=this.session.getTabSize(),t=this.lead;this.wouldMoveIntoSoftTab(t,h,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,h):this.moveCursorBy(0,1)}},e.prototype.moveCursorLineStart=function(){var t=this.lead.row,r=this.lead.column,h=this.session.documentToScreenRow(t,r),a=this.session.screenToDocumentPosition(h,0),u=this.session.getDisplayLine(t,null,a.row,a.column),f=u.match(/^\s*/);f[0].length!=r&&!this.session.$useEmacsStyleLineStart&&(a.column+=f[0].length),this.moveCursorToPosition(a)},e.prototype.moveCursorLineEnd=function(){var t=this.lead,r=this.session.getDocumentLastRowColumnPosition(t.row,t.column);if(this.lead.column==r.column){var h=this.session.getLine(r.row);if(r.column==h.length){var a=h.search(/\s+$/);a>0&&(r.column=a)}}this.moveCursorTo(r.row,r.column)},e.prototype.moveCursorFileEnd=function(){var t=this.doc.getLength()-1,r=this.doc.getLine(t).length;this.moveCursorTo(t,r)},e.prototype.moveCursorFileStart=function(){this.moveCursorTo(0,0)},e.prototype.moveCursorLongWordRight=function(){var t=this.lead.row,r=this.lead.column,h=this.doc.getLine(t),a=h.substring(r);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var u=this.session.getFoldAt(t,r,1);if(u){this.moveCursorTo(u.end.row,u.end.column);return}if(this.session.nonTokenRe.exec(a)&&(r+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,a=h.substring(r)),r>=h.length){this.moveCursorTo(t,h.length),this.moveCursorRight(),t<this.doc.getLength()-1&&this.moveCursorWordRight();return}this.session.tokenRe.exec(a)&&(r+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,r)},e.prototype.moveCursorLongWordLeft=function(){var t=this.lead.row,r=this.lead.column,h;if(h=this.session.getFoldAt(t,r,-1)){this.moveCursorTo(h.start.row,h.start.column);return}var a=this.session.getFoldStringAt(t,r,-1);a==null&&(a=this.doc.getLine(t).substring(0,r));var u=c.stringReverse(a);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(u)&&(r-=this.session.nonTokenRe.lastIndex,u=u.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),r<=0){this.moveCursorTo(t,0),this.moveCursorLeft(),t>0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(u)&&(r-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,r)},e.prototype.$shortWordEndIndex=function(t){var r=0,h,a=/\s/,u=this.session.tokenRe;if(u.lastIndex=0,this.session.tokenRe.exec(t))r=this.session.tokenRe.lastIndex;else{for(;(h=t[r])&&a.test(h);)r++;if(r<1){for(u.lastIndex=0;(h=t[r])&&!u.test(h);)if(u.lastIndex=0,r++,a.test(h))if(r>2){r--;break}else{for(;(h=t[r])&&a.test(h);)r++;if(r>2)break}}}return u.lastIndex=0,r},e.prototype.moveCursorShortWordRight=function(){var t=this.lead.row,r=this.lead.column,h=this.doc.getLine(t),a=h.substring(r),u=this.session.getFoldAt(t,r,1);if(u)return this.moveCursorTo(u.end.row,u.end.column);if(r==h.length){var f=this.doc.getLength();do t++,a=this.doc.getLine(t);while(t<f&&/^\s*$/.test(a));/^\s+/.test(a)||(a=""),r=0}var m=this.$shortWordEndIndex(a);this.moveCursorTo(t,r+m)},e.prototype.moveCursorShortWordLeft=function(){var t=this.lead.row,r=this.lead.column,h;if(h=this.session.getFoldAt(t,r,-1))return this.moveCursorTo(h.start.row,h.start.column);var a=this.session.getLine(t).substring(0,r);if(r===0){do t--,a=this.doc.getLine(t);while(t>0&&/^\s*$/.test(a));r=a.length,/\s+$/.test(a)||(a="")}var u=c.stringReverse(a),f=this.$shortWordEndIndex(u);return this.moveCursorTo(t,r-f)},e.prototype.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},e.prototype.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},e.prototype.moveCursorBy=function(t,r){var h=this.session.documentToScreenPosition(this.lead.row,this.lead.column),a;if(r===0&&(t!==0&&(this.session.$bidiHandler.isBidiRow(h.row,this.lead.row)?(a=this.session.$bidiHandler.getPosLeft(h.column),h.column=Math.round(a/this.session.$bidiHandler.charWidths[0])):a=h.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?h.column=this.$desiredColumn:this.$desiredColumn=h.column),t!=0&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var u=this.session.lineWidgets[this.lead.row];t<0?t-=u.rowsAbove||0:t>0&&(t+=u.rowCount-(u.rowsAbove||0))}var f=this.session.screenToDocumentPosition(h.row+t,h.column,a);t!==0&&r===0&&f.row===this.lead.row&&(f.column,this.lead.column),this.moveCursorTo(f.row,f.column+r,r===0)},e.prototype.moveCursorToPosition=function(t){this.moveCursorTo(t.row,t.column)},e.prototype.moveCursorTo=function(t,r,h){var a=this.session.getFoldAt(t,r,1);a&&(t=a.start.row,r=a.start.column),this.$keepDesiredColumnOnChange=!0;var u=this.session.getLine(t);/[\uDC00-\uDFFF]/.test(u.charAt(r))&&u.charAt(r-1)&&(this.lead.row==t&&this.lead.column==r+1?r=r-1:r=r+1),this.lead.setPosition(t,r),this.$keepDesiredColumnOnChange=!1,h||(this.$desiredColumn=null)},e.prototype.moveCursorToScreen=function(t,r,h){var a=this.session.screenToDocumentPosition(t,r);this.moveCursorTo(a.row,a.column,h)},e.prototype.detach=function(){this.lead.detach(),this.anchor.detach()},e.prototype.fromOrientedRange=function(t){this.setSelectionRange(t,t.cursor==t.start),this.$desiredColumn=t.desiredColumn||this.$desiredColumn},e.prototype.toOrientedRange=function(t){var r=this.getRange();return t?(t.start.column=r.start.column,t.start.row=r.start.row,t.end.column=r.end.column,t.end.row=r.end.row):t=r,t.cursor=this.isBackwards()?t.start:t.end,t.desiredColumn=this.$desiredColumn,t},e.prototype.getRangeOfMovements=function(t){var r=this.getCursor();try{t(this);var h=this.getCursor();return o.fromPoints(r,h)}catch{return o.fromPoints(r,r)}finally{this.moveCursorToPosition(r)}},e.prototype.toJSON=function(){if(this.rangeCount)var t=this.ranges.map(function(r){var h=r.clone();return h.isBackwards=r.cursor==r.start,h});else{var t=this.getRange();t.isBackwards=this.isBackwards()}return t},e.prototype.fromJSON=function(t){if(t.start==null)if(this.rangeList&&t.length>1){this.toSingleRange(t[0]);for(var r=t.length;r--;){var h=o.fromPoints(t[r].start,t[r].end);t[r].isBackwards&&(h.cursor=h.start),this.addRange(h,!0)}return}else t=t[0];this.rangeList&&this.toSingleRange(t),this.setSelectionRange(t,t.isBackwards)},e.prototype.isEqual=function(t){if((t.length||this.rangeCount)&&t.length!=this.rangeCount)return!1;if(!t.length||!this.ranges)return this.getRange().isEqual(t);for(var r=this.ranges.length;r--;)if(!this.ranges[r].isEqual(t[r]))return!1;return!0},e}();p.prototype.setSelectionAnchor=p.prototype.setAnchor,p.prototype.getSelectionAnchor=p.prototype.getAnchor,p.prototype.setSelectionRange=p.prototype.setRange,s.implement(p.prototype,d),l.Selection=p}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(i,l,v){var s=i("./lib/report_error").reportError,c=2e3,d=function(){function o(p){this.splitRegex,this.states=p,this.regExps={},this.matchMappings={};for(var e in this.states){for(var t=this.states[e],r=[],h=0,a=this.matchMappings[e]={defaultToken:"text"},u="g",f=[],m=0;m<t.length;m++){var y=t[m];if(y.defaultToken&&(a.defaultToken=y.defaultToken),y.caseInsensitive&&u.indexOf("i")===-1&&(u+="i"),y.unicode&&u.indexOf("u")===-1&&(u+="u"),y.regex!=null){y.regex instanceof RegExp&&(y.regex=y.regex.toString().slice(1,-1));var x=y.regex,E=new RegExp("(?:("+x+")|(.))").exec("a").length-2;Array.isArray(y.token)?y.token.length==1||E==1?y.token=y.token[0]:E-1!=y.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:y,groupCount:E-1}),y.token=y.token[0]):(y.tokenArray=y.token,y.token=null,y.onMatch=this.$arrayTokens):typeof y.token=="function"&&!y.onMatch&&(E>1?y.onMatch=this.$applyToken:y.onMatch=y.token),E>1&&(/\\\d/.test(y.regex)?x=y.regex.replace(/\\([0-9]+)/g,function(b,g){return"\\"+(parseInt(g,10)+h+1)}):(E=1,x=this.removeCapturingGroups(y.regex)),!y.splitRegex&&typeof y.token!="string"&&f.push(y)),a[h]=m,h+=E,r.push(x),y.onMatch||(y.onMatch=null)}}r.length||(a[0]=0,r.push("$")),f.forEach(function(b){b.splitRegex=this.createSplitterRegexp(b.regex,u)},this),this.regExps[e]=new RegExp("("+r.join(")|(")+")|($)",u)}}return o.prototype.$setMaxTokenCount=function(p){c=p|0},o.prototype.$applyToken=function(p){var e=this.splitRegex.exec(p).slice(1),t=this.token.apply(this,e);if(typeof t=="string")return[{type:t,value:p}];for(var r=[],h=0,a=t.length;h<a;h++)e[h]&&(r[r.length]={type:t[h],value:e[h]});return r},o.prototype.$arrayTokens=function(p){if(!p)return[];var e=this.splitRegex.exec(p);if(!e)return"text";for(var t=[],r=this.tokenArray,h=0,a=r.length;h<a;h++)e[h+1]&&(t[t.length]={type:r[h],value:e[h+1]});return t},o.prototype.removeCapturingGroups=function(p){var e=p.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g,function(t,r){return r?"(?:":t});return e},o.prototype.createSplitterRegexp=function(p,e){if(p.indexOf("(?=")!=-1){var t=0,r=!1,h={};p.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(a,u,f,m,y,x){return r?r=y!="]":y?r=!0:m?(t==h.stack&&(h.end=x+1,h.stack=-1),t--):f&&(t++,f.length!=1&&(h.stack=t,h.start=x)),a}),h.end!=null&&/^\)*$/.test(p.substr(h.end))&&(p=p.substring(0,h.start)+p.substr(h.end))}return p.charAt(0)!="^"&&(p="^"+p),p.charAt(p.length-1)!="$"&&(p+="$"),new RegExp(p,(e||"").replace("g",""))},o.prototype.getLineTokens=function(p,e){if(e&&typeof e!="string"){var t=e.slice(0);e=t[0],e==="#tmp"&&(t.shift(),e=t.shift())}else var t=[];var r=e||"start",h=this.states[r];h||(r="start",h=this.states[r]);var a=this.matchMappings[r],u=this.regExps[r];u.lastIndex=0;for(var f,m=[],y=0,x=0,E={type:null,value:""};f=u.exec(p);){var b=a.defaultToken,g=null,S=f[0],k=u.lastIndex;if(k-S.length>y){var D=p.substring(y,k-S.length);E.type==b?E.value+=D:(E.type&&m.push(E),E={type:b,value:D})}for(var _=0;_<f.length-2;_++)if(f[_+1]!==void 0){g=h[a[_]],g.onMatch?b=g.onMatch(S,r,t,p):b=g.token,g.next&&(typeof g.next=="string"?r=g.next:r=g.next(r,t),h=this.states[r],h||(this.reportError("state doesn't exist",r),r="start",h=this.states[r]),a=this.matchMappings[r],y=k,u=this.regExps[r],u.lastIndex=k),g.consumeLineEnd&&(y=k);break}if(S){if(typeof b=="string")(!g||g.merge!==!1)&&E.type===b?E.value+=S:(E.type&&m.push(E),E={type:b,value:S});else if(b){E.type&&m.push(E),E={type:null,value:""};for(var _=0;_<b.length;_++)m.push(b[_])}}if(y==p.length)break;if(y=k,x++>c){for(x>2*p.length&&this.reportError("infinite loop with in ace tokenizer",{startState:e,line:p});y<p.length;)E.type&&m.push(E),E={value:p.substring(y,y+=500),type:"overflow"};r="start",t=[];break}}return E.type&&m.push(E),t.length>1&&t[0]!==r&&t.unshift("#tmp",r),{tokens:m,state:t.length?t:r}},o}();d.prototype.reportError=s,l.Tokenizer=d}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(i,l,v){var s=i("../lib/deep_copy").deepCopy,c;c=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}},function(){this.addRules=function(p,e){if(!e){for(var t in p)this.$rules[t]=p[t];return}for(var t in p){for(var r=p[t],h=0;h<r.length;h++){var a=r[h];(a.next||a.onMatch)&&(typeof a.next=="string"&&a.next.indexOf(e)!==0&&(a.next=e+a.next),a.nextState&&a.nextState.indexOf(e)!==0&&(a.nextState=e+a.nextState))}this.$rules[e+t]=r}},this.getRules=function(){return this.$rules},this.embedRules=function(p,e,t,r,h){var a=typeof p=="function"?new p().getRules():p;if(r)for(var u=0;u<r.length;u++)r[u]=e+r[u];else{r=[];for(var f in a)r.push(e+f)}if(this.addRules(a,e),t)for(var m=Array.prototype[h?"push":"unshift"],u=0;u<r.length;u++)m.apply(this.$rules[r[u]],s(t));this.$embeds||(this.$embeds=[]),this.$embeds.push(e)},this.getEmbeds=function(){return this.$embeds};var d=function(p,e){return(p!="start"||e.length)&&e.unshift(this.nextState,p),this.nextState},o=function(p,e){return e.shift(),e.shift()||"start"};this.normalizeRules=function(){var p=0,e=this.$rules;function t(r){var h=e[r];h.processed=!0;for(var a=0;a<h.length;a++){var u=h[a],f=null;Array.isArray(u)&&(f=u,u={}),!u.regex&&u.start&&(u.regex=u.start,u.next||(u.next=[]),u.next.push({defaultToken:u.token},{token:u.token+".end",regex:u.end||u.start,next:"pop"}),u.token=u.token+".start",u.push=!0);var m=u.next||u.push;if(m&&Array.isArray(m)){var y=u.stateName;y||(y=u.token,typeof y!="string"&&(y=y[0]||""),e[y]&&(y+=p++)),e[y]=m,u.next=y,t(y)}else m=="pop"&&(u.next=o);if(u.push&&(u.nextState=u.next||u.push,u.next=d,delete u.push),u.rules)for(var x in u.rules)e[x]?e[x].push&&e[x].push.apply(e[x],u.rules[x]):e[x]=u.rules[x];var E=typeof u=="string"?u:u.include;if(E&&(E==="$self"&&(E="start"),Array.isArray(E)?f=E.map(function(g){return e[g]}):f=e[E]),f){var b=[a,1].concat(f);u.noEscape&&(b=b.filter(function(g){return!g.next})),h.splice.apply(h,b),a--}u.keywordMap&&(u.token=this.createKeywordMapper(u.keywordMap,u.defaultToken||"text",u.caseInsensitive),delete u.defaultToken)}}Object.keys(e).forEach(t,this)},this.createKeywordMapper=function(p,e,t,r){var h=Object.create(null);return this.$keywordList=[],Object.keys(p).forEach(function(a){for(var u=p[a],f=u.split(r||"|"),m=f.length;m--;){var y=f[m];this.$keywordList.push(y),t&&(y=y.toLowerCase()),h[y]=a}},this),p=null,t?function(a){return h[a.toLowerCase()]||e}:function(a){return h[a]||e}},this.getKeywords=function(){return this.$keywords}}.call(c.prototype),l.TextHighlightRules=c}),ace.define("ace/mode/behaviour",["require","exports","module"],function(i,l,v){var s;s=function(){this.$behaviours={}},function(){this.add=function(c,d,o){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[c]:this.$behaviours[c]={}}this.$behaviours[c][d]=o},this.addBehaviours=function(c){for(var d in c)for(var o in c[d])this.add(d,o,c[d][o])},this.remove=function(c){this.$behaviours&&this.$behaviours[c]&&delete this.$behaviours[c]},this.inherit=function(c,d){if(typeof c=="function")var o=new c().getBehaviours(d);else var o=c.getBehaviours(d);this.addBehaviours(o)},this.getBehaviours=function(c){if(c){for(var d={},o=0;o<c.length;o++)this.$behaviours[c[o]]&&(d[c[o]]=this.$behaviours[c[o]]);return d}else return this.$behaviours}}.call(s.prototype),l.Behaviour=s}),ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(i,l,v){var s=i("./range").Range,c=function(){function d(o,p,e){this.$session=o,this.$row=p,this.$rowTokens=o.getTokens(p);var t=o.getTokenAt(p,e);this.$tokenIndex=t?t.index:-1}return d.prototype.stepBackward=function(){for(this.$tokenIndex-=1;this.$tokenIndex<0;){if(this.$row-=1,this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},d.prototype.stepForward=function(){this.$tokenIndex+=1;for(var o;this.$tokenIndex>=this.$rowTokens.length;){if(this.$row+=1,o||(o=this.$session.getLength()),this.$row>=o)return this.$row=o-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},d.prototype.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},d.prototype.getCurrentTokenRow=function(){return this.$row},d.prototype.getCurrentTokenColumn=function(){var o=this.$rowTokens,p=this.$tokenIndex,e=o[p].start;if(e!==void 0)return e;for(e=0;p>0;)p-=1,e+=o[p].value.length;return e},d.prototype.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},d.prototype.getCurrentTokenRange=function(){var o=this.$rowTokens[this.$tokenIndex],p=this.getCurrentTokenColumn();return new s(this.$row,p,this.$row,p+o.value.length)},d}();l.TokenIterator=c}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(i,l,v){var s=i("../../lib/oop"),c=i("../behaviour").Behaviour,d=i("../../token_iterator").TokenIterator,o=i("../../lib/lang"),p=["text","paren.rparen","rparen","paren","punctuation.operator"],e=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],t,r={},h={'"':'"',"'":"'"},a=function(m){var y=-1;if(m.multiSelect&&(y=m.selection.index,r.rangeCount!=m.multiSelect.rangeCount&&(r={rangeCount:m.multiSelect.rangeCount})),r[y])return t=r[y];t=r[y]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},u=function(m,y,x,E){var b=m.end.row-m.start.row;return{text:x+y+E,selection:[0,m.start.column+1,b,m.end.column+(b?0:1)]}},f;f=function(m){m=m||{},this.add("braces","insertion",function(y,x,E,b,g){var S=E.getCursorPosition(),k=b.doc.getLine(S.row);if(g=="{"){a(E);var D=E.getSelectionRange(),_=b.doc.getTextRange(D),F=b.getTokenAt(S.row,S.column);if(_!==""&&_!=="{"&&E.getWrapBehavioursEnabled())return u(D,_,"{","}");if(F&&/(?:string)\.quasi|\.xml/.test(F.type)){var A=[/tag\-(?:open|name)/,/attribute\-name/];return A.some(function(R){return R.test(F.type)})||/(string)\.quasi/.test(F.type)&&F.value[S.column-F.start-1]!=="$"?void 0:(f.recordAutoInsert(E,b,"}"),{text:"{}",selection:[1,1]})}else if(f.isSaneInsertion(E,b))return/[\]\}\)]/.test(k[S.column])||E.inMultiSelectMode||m.braces?(f.recordAutoInsert(E,b,"}"),{text:"{}",selection:[1,1]}):(f.recordMaybeInsert(E,b,"{"),{text:"{",selection:[1,1]})}else if(g=="}"){a(E);var $=k.substring(S.column,S.column+1);if($=="}"){var w=b.$findOpeningBracket("}",{column:S.column+1,row:S.row});if(w!==null&&f.isAutoInsertedClosing(S,k,g))return f.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else if(g==`
|
|
192
|
+
`;O!=this.lastValue&&(this.text.value=this.lastValue=O,this.lastSelectionStart=this.lastSelectionEnd=O.length)}if(this.afterContextMenu&&(this.lastSelectionStart=this.text.selectionStart,this.lastSelectionEnd=this.text.selectionEnd),this.lastSelectionEnd!=k||this.lastSelectionStart!=S||this.text.selectionEnd!=this.lastSelectionEnd)try{this.text.setSelectionRange(S,k),this.lastSelectionStart=S,this.lastSelectionEnd=k}catch{}this.inComposition=!1}},w.prototype.setHost=function(g){this.host=g},w.prototype.setNumberOfExtraLines=function(g){if(this.rowStart=Number.MAX_SAFE_INTEGER,this.rowEnd=Number.MIN_SAFE_INTEGER,g<0){this.numberOfExtraLines=0;return}this.numberOfExtraLines=g},w.prototype.setAriaLabel=function(){var g="";if(this.host.$textInputAriaLabel&&(g+="".concat(this.host.$textInputAriaLabel,", ")),this.host.session){var S=this.host.session.selection.cursor.row;g+=c("text-input.aria-label","Cursor at row $0",[S+1])}this.text.setAttribute("aria-label",g)},w.prototype.setAriaOptions=function(g){g.activeDescendant?(this.text.setAttribute("aria-haspopup","true"),this.text.setAttribute("aria-autocomplete",g.inline?"both":"list"),this.text.setAttribute("aria-activedescendant",g.activeDescendant)):(this.text.setAttribute("aria-haspopup","false"),this.text.setAttribute("aria-autocomplete","both"),this.text.removeAttribute("aria-activedescendant")),g.role&&this.text.setAttribute("role",g.role),g.setLabel&&(this.text.setAttribute("aria-roledescription",c("text-input.aria-roledescription","editor")),this.setAriaLabel())},w.prototype.focus=function(){var g=this;if(this.setAriaOptions({setLabel:this.host.renderer.enableKeyboardAccessibility}),this.tempStyle||h||this.$focusScroll=="browser")return this.text.focus({preventScroll:!0});var S=this.text.style.top;this.text.style.position="fixed",this.text.style.top="0px";try{var k=this.text.getBoundingClientRect().top!=0}catch{return}var D=[];if(k)for(var _=this.text.parentElement;_&&_.nodeType==1;)D.push(_),_.setAttribute("ace_nocontext","true"),!_.parentElement&&_.getRootNode?_=_.getRootNode().host:_=_.parentElement;this.text.focus({preventScroll:!0}),k&&D.forEach(function(F){F.removeAttribute("ace_nocontext")}),setTimeout(function(){g.text.style.position="",g.text.style.top=="0px"&&(g.text.style.top=S)},0)},w.prototype.blur=function(){this.text.blur()},w.prototype.isFocused=function(){return this.$isFocused},w.prototype.setInputHandler=function(g){this.inputHandler=g},w.prototype.getInputHandler=function(){return this.inputHandler},w.prototype.getElement=function(){return this.text},w.prototype.setCommandMode=function(g){this.commandMode=g,this.text.readOnly=!1},w.prototype.setReadOnly=function(g){this.commandMode||(this.text.readOnly=g)},w.prototype.setCopyWithEmptySelection=function(g){},w.prototype.onContextMenu=function(g){this.afterContextMenu=!0,this.resetSelection(),this.host._emit("nativecontextmenu",{target:this.host,domEvent:g}),this.moveToMouse(g,!0)},w.prototype.moveToMouse=function(g,S){var k=this;this.tempStyle||(this.tempStyle=this.text.style.cssText),this.text.style.cssText=(S?"z-index:100000;":"")+(d.isIE?"opacity:0.1;":"")+"text-indent: -"+(this.lastSelectionStart+this.lastSelectionEnd)*this.host.renderer.characterWidth*.5+"px;";var D=this.host.container.getBoundingClientRect(),_=o.computedStyle(this.host.container),F=D.top+(parseInt(_.borderTopWidth)||0),A=D.left+(parseInt(_.borderLeftWidth)||0),$=D.bottom-F-this.text.clientHeight-2,C=function(b){o.translate(k.text,b.clientX-A-2,Math.min(b.clientY-F-2,$))};C(g),g.type=="mousedown"&&(this.host.renderer.$isMousePressed=!0,clearTimeout(this.closeTimeout),d.isWin&&s.capture(this.host.container,C,this.onContextMenuClose.bind(this)))},w.prototype.destroy=function(){this.text.parentElement&&this.text.parentElement.removeChild(this.text)},w}();l.TextInput=E,l.$setUserAgentForTests=function(w,g){x=w,m=g}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(i,l,v){var s=i("../lib/useragent"),c=0,d=550,o=function(){function t(r){r.$clickSelection=null;var h=r.editor;h.setDefaultHandler("mousedown",this.onMouseDown.bind(r)),h.setDefaultHandler("dblclick",this.onDoubleClick.bind(r)),h.setDefaultHandler("tripleclick",this.onTripleClick.bind(r)),h.setDefaultHandler("quadclick",this.onQuadClick.bind(r)),h.setDefaultHandler("mousewheel",this.onMouseWheel.bind(r));var a=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];a.forEach(function(u){r[u]=this[u]},this),r.selectByLines=this.extendSelectionBy.bind(r,"getLineRange"),r.selectByWords=this.extendSelectionBy.bind(r,"getWordRange")}return t.prototype.onMouseDown=function(r){var h=r.inSelection(),a=r.getDocumentPosition();this.mousedownEvent=r;var u=this.editor,f=r.getButton();if(f!==0){var m=u.getSelectionRange(),y=m.isEmpty();(y||f==1)&&u.selection.moveToPosition(a),f==2&&(u.textInput.onContextMenu(r.domEvent),s.isMozilla||r.preventDefault());return}if(this.mousedownEvent.time=Date.now(),h&&!u.isFocused()&&(u.focus(),this.$focusTimeout&&!this.$clickSelection&&!u.inMultiSelectMode)){this.setState("focusWait"),this.captureMouse(r);return}return this.captureMouse(r),this.startSelect(a,r.domEvent._clicks>1),r.preventDefault()},t.prototype.startSelect=function(r,h){r=r||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var a=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?a.selection.selectToPosition(r):h||a.selection.moveToPosition(r),h||this.select(),a.setStyle("ace_selecting"),this.setState("select"))},t.prototype.select=function(){var r,h=this.editor,a=h.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var u=this.$clickSelection.comparePoint(a);if(u==-1)r=this.$clickSelection.end;else if(u==1)r=this.$clickSelection.start;else{var f=e(this.$clickSelection,a);a=f.cursor,r=f.anchor}h.selection.setSelectionAnchor(r.row,r.column)}h.selection.selectToPosition(a),h.renderer.scrollCursorIntoView()},t.prototype.extendSelectionBy=function(r){var h,a=this.editor,u=a.renderer.screenToTextCoordinates(this.x,this.y),f=a.selection[r](u.row,u.column);if(this.$clickSelection){var m=this.$clickSelection.comparePoint(f.start),y=this.$clickSelection.comparePoint(f.end);if(m==-1&&y<=0)h=this.$clickSelection.end,(f.end.row!=u.row||f.end.column!=u.column)&&(u=f.start);else if(y==1&&m>=0)h=this.$clickSelection.start,(f.start.row!=u.row||f.start.column!=u.column)&&(u=f.end);else if(m==-1&&y==1)u=f.end,h=f.start;else{var x=e(this.$clickSelection,u);u=x.cursor,h=x.anchor}a.selection.setSelectionAnchor(h.row,h.column)}a.selection.selectToPosition(u),a.renderer.scrollCursorIntoView()},t.prototype.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting")},t.prototype.focusWait=function(){var r=p(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),h=Date.now();(r>c||h-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},t.prototype.onDoubleClick=function(r){var h=r.getDocumentPosition(),a=this.editor,u=a.session,f=u.getBracketRange(h);f?(f.isEmpty()&&(f.start.column--,f.end.column++),this.setState("select")):(f=a.selection.getWordRange(h.row,h.column),this.setState("selectByWords")),this.$clickSelection=f,this.select()},t.prototype.onTripleClick=function(r){var h=r.getDocumentPosition(),a=this.editor;this.setState("selectByLines");var u=a.getSelectionRange();u.isMultiLine()&&u.contains(h.row,h.column)?(this.$clickSelection=a.selection.getLineRange(u.start.row),this.$clickSelection.end=a.selection.getLineRange(u.end.row).end):this.$clickSelection=a.selection.getLineRange(h.row),this.select()},t.prototype.onQuadClick=function(r){var h=this.editor;h.selectAll(),this.$clickSelection=h.getSelectionRange(),this.setState("selectAll")},t.prototype.onMouseWheel=function(r){if(!r.getAccelKey()){r.getShiftKey()&&r.wheelY&&!r.wheelX&&(r.wheelX=r.wheelY,r.wheelY=0);var h=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var a=this.$lastScroll,u=r.domEvent.timeStamp,f=u-a.t,m=f?r.wheelX/f:a.vx,y=f?r.wheelY/f:a.vy;f<d&&(m=(m+a.vx)/2,y=(y+a.vy)/2);var x=Math.abs(m/y),E=!1;if(x>=1&&h.renderer.isScrollableBy(r.wheelX*r.speed,0)&&(E=!0),x<=1&&h.renderer.isScrollableBy(0,r.wheelY*r.speed)&&(E=!0),E)a.allowed=u;else if(u-a.allowed<d){var w=Math.abs(m)<=1.5*Math.abs(a.vx)&&Math.abs(y)<=1.5*Math.abs(a.vy);w?(E=!0,a.allowed=u):a.allowed=0}if(a.t=u,a.vx=m,a.vy=y,E)return h.renderer.scrollBy(r.wheelX*r.speed,r.wheelY*r.speed),r.stop()}},t}();o.prototype.selectEnd=o.prototype.selectByLinesEnd,o.prototype.selectAllEnd=o.prototype.selectByLinesEnd,o.prototype.selectByWordsEnd=o.prototype.selectByLinesEnd,l.DefaultHandlers=o;function p(t,r,h,a){return Math.sqrt(Math.pow(h-t,2)+Math.pow(a-r,2))}function e(t,r){if(t.start.row==t.end.row)var h=2*r.column-t.start.column-t.end.column;else if(t.start.row==t.end.row-1&&!t.start.column&&!t.end.column)var h=r.column-4;else var h=2*r.row-t.start.row-t.end.row;return h<0?{cursor:t.start,anchor:t.end}:{cursor:t.end,anchor:t.start}}}),ace.define("ace/lib/scroll",["require","exports","module"],function(i,l,v){l.preventParentScroll=function(c){c.stopPropagation();var d=c.currentTarget,o=d.scrollHeight>d.clientHeight;o||c.preventDefault()}}),ace.define("ace/tooltip",["require","exports","module","ace/lib/dom","ace/lib/event","ace/range","ace/lib/scroll"],function(i,l,v){var s=this&&this.__extends||function(){var u=function(f,m){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,x){y.__proto__=x}||function(y,x){for(var E in x)Object.prototype.hasOwnProperty.call(x,E)&&(y[E]=x[E])},u(f,m)};return function(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");u(f,m);function y(){this.constructor=f}f.prototype=m===null?Object.create(m):(y.prototype=m.prototype,new y)}}(),c=this&&this.__values||function(u){var f=typeof Symbol=="function"&&Symbol.iterator,m=f&&u[f],y=0;if(m)return m.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&y>=u.length&&(u=void 0),{value:u&&u[y++],done:!u}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},d=i("./lib/dom");i("./lib/event");var o=i("./range").Range,p=i("./lib/scroll").preventParentScroll,e="ace_tooltip",t=function(){function u(f){this.isOpen=!1,this.$element=null,this.$parentNode=f}return u.prototype.$init=function(){return this.$element=d.createElement("div"),this.$element.className=e,this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},u.prototype.getElement=function(){return this.$element||this.$init()},u.prototype.setText=function(f){this.getElement().textContent=f},u.prototype.setHtml=function(f){this.getElement().innerHTML=f},u.prototype.setPosition=function(f,m){this.getElement().style.left=f+"px",this.getElement().style.top=m+"px"},u.prototype.setClassName=function(f){d.addCssClass(this.getElement(),f)},u.prototype.setTheme=function(f){this.$element.className=e+" "+(f.isDark?"ace_dark ":"")+(f.cssClass||"")},u.prototype.show=function(f,m,y){f!=null&&this.setText(f),m!=null&&y!=null&&this.setPosition(m,y),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},u.prototype.hide=function(f){this.isOpen&&(this.getElement().style.display="none",this.getElement().className=e,this.isOpen=!1)},u.prototype.getHeight=function(){return this.getElement().offsetHeight},u.prototype.getWidth=function(){return this.getElement().offsetWidth},u.prototype.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)},u}(),r=function(){function u(){this.popups=[]}return u.prototype.addPopup=function(f){this.popups.push(f),this.updatePopups()},u.prototype.removePopup=function(f){var m=this.popups.indexOf(f);m!==-1&&(this.popups.splice(m,1),this.updatePopups())},u.prototype.updatePopups=function(){var f,m,y,x;this.popups.sort(function(A,$){return $.priority-A.priority});var E=[];try{for(var w=c(this.popups),g=w.next();!g.done;g=w.next()){var S=g.value,k=!0;try{for(var D=(y=void 0,c(E)),_=D.next();!_.done;_=D.next()){var F=_.value;if(this.doPopupsOverlap(F,S)){k=!1;break}}}catch(A){y={error:A}}finally{try{_&&!_.done&&(x=D.return)&&x.call(D)}finally{if(y)throw y.error}}k?E.push(S):S.hide()}}catch(A){f={error:A}}finally{try{g&&!g.done&&(m=w.return)&&m.call(w)}finally{if(f)throw f.error}}},u.prototype.doPopupsOverlap=function(f,m){var y=f.getElement().getBoundingClientRect(),x=m.getElement().getBoundingClientRect();return y.left<x.right&&y.right>x.left&&y.top<x.bottom&&y.bottom>x.top},u}(),h=new r;l.popupManager=h,l.Tooltip=t;var a=function(u){s(f,u);function f(m){m===void 0&&(m=document.body);var y=u.call(this,m)||this;y.timeout=void 0,y.lastT=0,y.idleTime=350,y.lastEvent=void 0,y.onMouseOut=y.onMouseOut.bind(y),y.onMouseMove=y.onMouseMove.bind(y),y.waitForHover=y.waitForHover.bind(y),y.hide=y.hide.bind(y);var x=y.getElement();return x.style.whiteSpace="pre-wrap",x.style.pointerEvents="auto",x.addEventListener("mouseout",y.onMouseOut),x.tabIndex=-1,x.addEventListener("blur",function(){x.contains(document.activeElement)||this.hide()}.bind(y)),x.addEventListener("wheel",p),y}return f.prototype.addToEditor=function(m){m.on("mousemove",this.onMouseMove),m.on("mousedown",this.hide),m.renderer.getMouseEventTarget().addEventListener("mouseout",this.onMouseOut,!0)},f.prototype.removeFromEditor=function(m){m.off("mousemove",this.onMouseMove),m.off("mousedown",this.hide),m.renderer.getMouseEventTarget().removeEventListener("mouseout",this.onMouseOut,!0),this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},f.prototype.onMouseMove=function(m,y){this.lastEvent=m,this.lastT=Date.now();var x=y.$mouseHandler.isMousePressed;if(this.isOpen){var E=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(E.row,E.column)||x||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||x||(this.lastEvent=m,this.timeout=setTimeout(this.waitForHover,this.idleTime))},f.prototype.waitForHover=function(){this.timeout&&clearTimeout(this.timeout);var m=Date.now()-this.lastT;if(this.idleTime-m>10){this.timeout=setTimeout(this.waitForHover,this.idleTime-m);return}this.timeout=null,this.lastEvent&&!this.isOutsideOfText(this.lastEvent)&&this.$gatherData(this.lastEvent,this.lastEvent.editor)},f.prototype.isOutsideOfText=function(m){var y=m.editor,x=m.getDocumentPosition(),E=y.session.getLine(x.row);if(x.column==E.length){var w=y.renderer.pixelToScreenCoordinates(m.clientX,m.clientY),g=y.session.documentToScreenPosition(x.row,x.column);if(g.column!=w.column||g.row!=w.row)return!0}return!1},f.prototype.setDataProvider=function(m){this.$gatherData=m},f.prototype.showForRange=function(m,y,x,E){var w=10;if(!(E&&E!=this.lastEvent)&&!(this.isOpen&&document.activeElement==this.getElement())){var g=m.renderer;this.isOpen||(h.addPopup(this),this.$registerCloseEvents(),this.setTheme(g.theme)),this.isOpen=!0,this.addMarker(y,m.session),this.range=o.fromPoints(y.start,y.end);var S=g.textToScreenCoordinates(y.start.row,y.start.column),k=g.scroller.getBoundingClientRect();S.pageX<k.left&&(S.pageX=k.left);var D=this.getElement();D.innerHTML="",D.appendChild(x),D.style.maxHeight="",D.style.display="block";var _=D.clientHeight,F=D.clientWidth,A=window.innerHeight-S.pageY-g.lineHeight,$=!0;S.pageY-_<0&&S.pageY<A&&($=!1),D.style.maxHeight=($?S.pageY:A)-w+"px",D.style.top=$?"":S.pageY+g.lineHeight+"px",D.style.bottom=$?window.innerHeight-S.pageY+"px":"",D.style.left=Math.min(S.pageX,window.innerWidth-F-w)+"px"}},f.prototype.addMarker=function(m,y){this.marker&&this.$markerSession.removeMarker(this.marker),this.$markerSession=y,this.marker=y&&y.addMarker(m,"ace_highlight-marker","text")},f.prototype.hide=function(m){!m&&document.activeElement==this.getElement()||m&&m.target&&(m.type!="keydown"||m.ctrlKey||m.metaKey)&&this.$element.contains(m.target)||(this.lastEvent=null,this.timeout&&clearTimeout(this.timeout),this.timeout=null,this.addMarker(null),this.isOpen&&(this.$removeCloseEvents(),this.getElement().style.display="none",this.isOpen=!1,h.removePopup(this)))},f.prototype.$registerCloseEvents=function(){window.addEventListener("keydown",this.hide,!0),window.addEventListener("wheel",this.hide,!0),window.addEventListener("mousedown",this.hide,!0)},f.prototype.$removeCloseEvents=function(){window.removeEventListener("keydown",this.hide,!0),window.removeEventListener("wheel",this.hide,!0),window.removeEventListener("mousedown",this.hide,!0)},f.prototype.onMouseOut=function(m){this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.lastEvent=null,this.isOpen&&(!m.relatedTarget||this.getElement().contains(m.relatedTarget)||m&&m.currentTarget.contains(m.relatedTarget)||m.relatedTarget.classList.contains("ace_content")||this.hide())},f}(t);l.HoverTooltip=a}),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/tooltip","ace/config"],function(i,l,v){var s=this&&this.__extends||function(){var u=function(f,m){return u=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,x){y.__proto__=x}||function(y,x){for(var E in x)Object.prototype.hasOwnProperty.call(x,E)&&(y[E]=x[E])},u(f,m)};return function(f,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");u(f,m);function y(){this.constructor=f}f.prototype=m===null?Object.create(m):(y.prototype=m.prototype,new y)}}(),c=this&&this.__values||function(u){var f=typeof Symbol=="function"&&Symbol.iterator,m=f&&u[f],y=0;if(m)return m.call(u);if(u&&typeof u.length=="number")return{next:function(){return u&&y>=u.length&&(u=void 0),{value:u&&u[y++],done:!u}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},d=i("../lib/dom"),o=i("../lib/event"),p=i("../tooltip").Tooltip,e=i("../config").nls,t=5,r=3;l.GUTTER_TOOLTIP_LEFT_OFFSET=t,l.GUTTER_TOOLTIP_TOP_OFFSET=r;function h(u){var f=u.editor,m=f.renderer.$gutterLayer,y=new a(f,!0);u.editor.setDefaultHandler("guttermousedown",function(k){if(!(!f.isFocused()||k.getButton()!=0)){var D=m.getRegion(k);if(D!="foldWidgets"){var _=k.getDocumentPosition().row,F=f.session.selection;if(k.getShiftKey())F.selectTo(_,0);else{if(k.domEvent.detail==2)return f.selectAll(),k.preventDefault();u.$clickSelection=f.selection.getLineRange(_)}return u.setState("selectByLines"),u.captureMouse(k),k.preventDefault()}}});var x,E;function w(){var k=E.getDocumentPosition().row,D=f.session.getLength();if(k==D){var _=f.renderer.pixelToScreenCoordinates(0,E.y).row,F=E.$pos;if(_>f.session.documentToScreenRow(F.row,F.column))return g()}if(y.showTooltip(k),!!y.isOpen)if(f.on("mousewheel",g),f.on("changeSession",g),window.addEventListener("keydown",g,!0),u.$tooltipFollowsMouse)S(E);else{var A=E.getGutterRow(),$=m.$lines.get(A);if($){var C=$.element.querySelector(".ace_gutter_annotation"),b=C.getBoundingClientRect(),T=y.getElement().style;T.left=b.right-t+"px",T.top=b.bottom-r+"px"}else S(E)}}function g(k){k&&k.type==="keydown"&&(k.ctrlKey||k.metaKey)||k&&k.type==="mouseout"&&(!k.relatedTarget||y.getElement().contains(k.relatedTarget))||(x&&(x=clearTimeout(x)),y.isOpen&&(y.hideTooltip(),f.off("mousewheel",g),f.off("changeSession",g),window.removeEventListener("keydown",g,!0)))}function S(k){y.setPosition(k.x,k.y)}u.editor.setDefaultHandler("guttermousemove",function(k){var D=k.domEvent.target||k.domEvent.srcElement;if(d.hasCssClass(D,"ace_fold-widget")||d.hasCssClass(D,"ace_custom-widget"))return g();y.isOpen&&u.$tooltipFollowsMouse&&S(k),E=k,!x&&(x=setTimeout(function(){x=null,E&&!u.isMousePressed&&w()},50))}),o.addListener(f.renderer.$gutter,"mouseout",function(k){E=null,y.isOpen&&(x=setTimeout(function(){x=null,g(k)},50))},f)}l.GutterHandler=h;var a=function(u){s(f,u);function f(m,y){y===void 0&&(y=!1);var x=u.call(this,m.container)||this;x.id="gt"+ ++f.$uid,x.editor=m,x.visibleTooltipRow;var E=x.getElement();return E.setAttribute("role","tooltip"),E.setAttribute("id",x.id),E.style.pointerEvents="auto",y&&(x.onMouseOut=x.onMouseOut.bind(x),E.addEventListener("mouseout",x.onMouseOut)),x}return f.prototype.onMouseOut=function(m){this.isOpen&&(!m.relatedTarget||this.getElement().contains(m.relatedTarget)||m&&m.currentTarget.contains(m.relatedTarget)||this.hideTooltip())},f.prototype.setPosition=function(m,y){var x=window.innerWidth||document.documentElement.clientWidth,E=window.innerHeight||document.documentElement.clientHeight,w=this.getWidth(),g=this.getHeight();m+=15,y+=15,m+w>x&&(m-=m+w-x),y+g>E&&(y-=20+g),p.prototype.setPosition.call(this,m,y)},Object.defineProperty(f,"annotationLabels",{get:function(){return{error:{singular:e("gutter-tooltip.aria-label.error.singular","error"),plural:e("gutter-tooltip.aria-label.error.plural","errors")},security:{singular:e("gutter-tooltip.aria-label.security.singular","security finding"),plural:e("gutter-tooltip.aria-label.security.plural","security findings")},warning:{singular:e("gutter-tooltip.aria-label.warning.singular","warning"),plural:e("gutter-tooltip.aria-label.warning.plural","warnings")},info:{singular:e("gutter-tooltip.aria-label.info.singular","information message"),plural:e("gutter-tooltip.aria-label.info.plural","information messages")},hint:{singular:e("gutter-tooltip.aria-label.hint.singular","suggestion"),plural:e("gutter-tooltip.aria-label.hint.plural","suggestions")}}},enumerable:!1,configurable:!0}),f.prototype.showTooltip=function(m){var y,x=this.editor.renderer.$gutterLayer,E=x.$annotations[m],w;E?w={displayText:Array.from(E.displayText),type:Array.from(E.type)}:w={displayText:[],type:[]};var g=x.session.getFoldLine(m);if(g&&x.$showFoldedAnnotations){for(var S={error:[],security:[],warning:[],info:[],hint:[]},k={error:1,security:2,warning:3,info:4,hint:5},D,_=m+1;_<=g.end.row;_++)if(x.$annotations[_])for(var F=0;F<x.$annotations[_].text.length;F++){var A=x.$annotations[_].type[F];S[A].push(x.$annotations[_].text[F]),(!D||k[A]<k[D])&&(D=A)}if(["error","security","warning"].includes(D)){var $="".concat(f.annotationsToSummaryString(S)," in folded code.");w.displayText.push($),w.type.push(D+"_fold")}}if(w.displayText.length===0)return this.hideTooltip();for(var C={error:[],security:[],warning:[],info:[],hint:[]},b=x.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",_=0;_<w.displayText.length;_++){var T=d.createElement("span"),I=d.createElement("span");(y=I.classList).add.apply(y,["ace_".concat(w.type[_]),b]),I.setAttribute("aria-label","".concat(f.annotationLabels[w.type[_].replace("_fold","")].singular)),I.setAttribute("role","img"),I.appendChild(d.createTextNode(" ")),T.appendChild(I),T.appendChild(d.createTextNode(w.displayText[_])),T.appendChild(d.createElement("br")),C[w.type[_].replace("_fold","")].push(T)}var O=this.getElement();d.removeChildren(O),C.error.forEach(function(P){return O.appendChild(P)}),C.security.forEach(function(P){return O.appendChild(P)}),C.warning.forEach(function(P){return O.appendChild(P)}),C.info.forEach(function(P){return O.appendChild(P)}),C.hint.forEach(function(P){return O.appendChild(P)}),O.setAttribute("aria-live","polite"),this.isOpen||(this.setTheme(this.editor.renderer.theme),this.setClassName("ace_gutter-tooltip"));var N=this.$findLinkedAnnotationNode(m);N&&N.setAttribute("aria-describedby",this.id),this.show(),this.visibleTooltipRow=m,this.editor._signal("showGutterTooltip",this)},f.prototype.$findLinkedAnnotationNode=function(m){var y=this.$findCellByRow(m);if(y){var x=y.element;if(x.childNodes.length>2)return x.childNodes[2]}},f.prototype.$findCellByRow=function(m){return this.editor.renderer.$gutterLayer.$lines.cells.find(function(y){return y.row===m})},f.prototype.hideTooltip=function(){if(this.isOpen){if(this.$element.removeAttribute("aria-live"),this.hide(),this.visibleTooltipRow!=null){var m=this.$findLinkedAnnotationNode(this.visibleTooltipRow);m&&m.removeAttribute("aria-describedby")}this.visibleTooltipRow=void 0,this.editor._signal("hideGutterTooltip",this)}},f.annotationsToSummaryString=function(m){var y,x,E=[],w=["error","security","warning","info","hint"];try{for(var g=c(w),S=g.next();!S.done;S=g.next()){var k=S.value;if(m[k].length){var D=m[k].length===1?f.annotationLabels[k].singular:f.annotationLabels[k].plural;E.push("".concat(m[k].length," ").concat(D))}}}catch(_){y={error:_}}finally{try{S&&!S.done&&(x=g.return)&&x.call(g)}finally{if(y)throw y.error}}return E.join(", ")},f}(p);a.$uid=0,l.GutterTooltip=a}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(i,l,v){var s=i("../lib/event"),c=i("../lib/useragent"),d=function(){function o(p,e){this.speed,this.wheelX,this.wheelY,this.domEvent=p,this.editor=e,this.x=this.clientX=p.clientX,this.y=this.clientY=p.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1}return o.prototype.stopPropagation=function(){s.stopPropagation(this.domEvent),this.propagationStopped=!0},o.prototype.preventDefault=function(){s.preventDefault(this.domEvent),this.defaultPrevented=!0},o.prototype.stop=function(){this.stopPropagation(),this.preventDefault()},o.prototype.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},o.prototype.getGutterRow=function(){var p=this.getDocumentPosition().row,e=this.editor.session.documentToScreenRow(p,0),t=this.editor.session.documentToScreenRow(this.editor.renderer.$gutterLayer.$lines.get(0).row,0);return e-t},o.prototype.inSelection=function(){if(this.$inSelection!==null)return this.$inSelection;var p=this.editor,e=p.getSelectionRange();if(e.isEmpty())this.$inSelection=!1;else{var t=this.getDocumentPosition();this.$inSelection=e.contains(t.row,t.column)}return this.$inSelection},o.prototype.getButton=function(){return s.getButton(this.domEvent)},o.prototype.getShiftKey=function(){return this.domEvent.shiftKey},o.prototype.getAccelKey=function(){return c.isMac?this.domEvent.metaKey:this.domEvent.ctrlKey},o}();l.MouseEvent=d}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(i,l,v){var s=i("../lib/dom"),c=i("../lib/event"),d=i("../lib/useragent"),o=200,p=200,e=5;function t(h){var a=h.editor,u=s.createElement("div");u.style.cssText="top:-100px;position:absolute;z-index:2147483647;opacity:0.5",u.textContent=" ";var f=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];f.forEach(function(W){h[W]=this[W]},this),a.on("mousedown",this.onMouseDown.bind(h));var m=a.container,y,x,E,w,g,S,k=0,D,_,F,A,$;this.onDragStart=function(W){if(this.cancelDrag||!m.draggable){var z=this;return setTimeout(function(){z.startSelect(),z.captureMouse(W)},0),W.preventDefault()}g=a.getSelectionRange();var U=W.dataTransfer;U.effectAllowed=a.getReadOnly()?"copy":"copyMove",a.container.appendChild(u),U.setDragImage&&U.setDragImage(u,0,0),setTimeout(function(){a.container.removeChild(u)}),U.clearData(),U.setData("Text",a.session.getTextRange()),_=!0,this.setState("drag")},this.onDragEnd=function(W){if(m.draggable=!1,_=!1,this.setState(null),!a.getReadOnly()){var z=W.dataTransfer.dropEffect;!D&&z=="move"&&a.session.remove(a.getSelectionRange()),a.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(W){if(!(a.getReadOnly()||!B(W.dataTransfer)))return x=W.clientX,E=W.clientY,y||I(),k++,W.dataTransfer.dropEffect=D=V(W),c.preventDefault(W)},this.onDragOver=function(W){if(!(a.getReadOnly()||!B(W.dataTransfer)))return x=W.clientX,E=W.clientY,y||(I(),k++),N!==null&&(N=null),W.dataTransfer.dropEffect=D=V(W),c.preventDefault(W)},this.onDragLeave=function(W){if(k--,k<=0&&y)return O(),D=null,c.preventDefault(W)},this.onDrop=function(W){if(S){var z=W.dataTransfer;if(_)switch(D){case"move":g.contains(S.row,S.column)?g={start:S,end:S}:g=a.moveText(g,S);break;case"copy":g=a.moveText(g,S,!0);break}else{var U=z.getData("Text");g={start:S,end:a.session.insert(S,U)},a.focus(),D=null}return O(),c.preventDefault(W)}},c.addListener(m,"dragstart",this.onDragStart.bind(h),a),c.addListener(m,"dragend",this.onDragEnd.bind(h),a),c.addListener(m,"dragenter",this.onDragEnter.bind(h),a),c.addListener(m,"dragover",this.onDragOver.bind(h),a),c.addListener(m,"dragleave",this.onDragLeave.bind(h),a),c.addListener(m,"drop",this.onDrop.bind(h),a);function C(W,z){var U=Date.now(),G=!z||W.row!=z.row,Y=!z||W.column!=z.column;if(!A||G||Y)a.moveCursorToPosition(W),A=U,$={x,y:E};else{var Q=r($.x,$.y,x,E);Q>e?A=null:U-A>=p&&(a.renderer.scrollCursorIntoView(),A=null)}}function b(W,z){var U=Date.now(),G=a.renderer.layerConfig.lineHeight,Y=a.renderer.layerConfig.characterWidth,Q=a.renderer.scroller.getBoundingClientRect(),q={x:{left:x-Q.left,right:Q.right-x},y:{top:E-Q.top,bottom:Q.bottom-E}},te=Math.min(q.x.left,q.x.right),re=Math.min(q.y.top,q.y.bottom),ue={row:W.row,column:W.column};te/Y<=2&&(ue.column+=q.x.left<q.x.right?-3:2),re/G<=1&&(ue.row+=q.y.top<q.y.bottom?-1:1);var me=W.row!=ue.row,Ce=W.column!=ue.column,ve=!z||W.row!=z.row;me||Ce&&!ve?F?U-F>=o&&a.renderer.scrollCursorIntoView(ue):F=U:F=null}function T(){var W=S;S=a.renderer.screenToTextCoordinates(x,E),C(S,W),b(S,W)}function I(){g=a.selection.toOrientedRange(),y=a.session.addMarker(g,"ace_selection",a.getSelectionStyle()),a.clearSelection(),a.isFocused()&&a.renderer.$cursorLayer.setBlinking(!1),clearInterval(w),T(),w=setInterval(T,20),k=0,c.addListener(document,"mousemove",P)}function O(){clearInterval(w),a.session.removeMarker(y),y=null,a.selection.fromOrientedRange(g),a.isFocused()&&!_&&a.$resetCursorStyle(),g=null,S=null,k=0,F=null,A=null,c.removeListener(document,"mousemove",P)}var N=null;function P(){N==null&&(N=setTimeout(function(){N!=null&&y&&O()},20))}function B(W){var z=W.types;return!z||Array.prototype.some.call(z,function(U){return U=="text/plain"||U=="Text"})}function V(W){var z=["copy","copymove","all","uninitialized"],U=["move","copymove","linkmove","all","uninitialized"],G=d.isMac?W.altKey:W.ctrlKey,Y="uninitialized";try{Y=W.dataTransfer.effectAllowed.toLowerCase()}catch{}var Q="none";return G&&z.indexOf(Y)>=0?Q="copy":U.indexOf(Y)>=0?Q="move":z.indexOf(Y)>=0&&(Q="copy"),Q}}(function(){this.dragWait=function(){var h=Date.now()-this.mousedownEvent.time;h>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var h=this.editor.container;h.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(h){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var h=this.editor,a=h.container;a.draggable=!0,h.renderer.$cursorLayer.setBlinking(!1),h.setStyle("ace_dragging");var u=d.isWin?"default":"move";h.renderer.setCursorStyle(u),this.setState("dragReady")},this.onMouseDrag=function(h){var a=this.editor.container;if(d.isIE&&this.state=="dragReady"){var u=r(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);u>3&&a.dragDrop()}if(this.state==="dragWait"){var u=r(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);u>0&&(a.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(h){if(this.$dragEnabled){this.mousedownEvent=h;var a=this.editor,u=h.inSelection(),f=h.getButton(),m=h.domEvent.detail||1;if(m===1&&f===0&&u){if(h.editor.inMultiSelectMode&&(h.getAccelKey()||h.getShiftKey()))return;this.mousedownEvent.time=Date.now();var y=h.domEvent.target||h.domEvent.srcElement;if("unselectable"in y&&(y.unselectable="on"),a.getDragDelay()){if(d.isWebKit){this.cancelDrag=!0;var x=a.container;x.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(h,this.onMouseDrag.bind(this)),h.defaultPrevented=!0}}}}).call(t.prototype);function r(h,a,u,f){return Math.sqrt(Math.pow(u-h,2)+Math.pow(f-a,2))}l.DragdropHandler=t}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(i,l,v){var s=i("./mouse_event").MouseEvent,c=i("../lib/event"),d=i("../lib/dom");l.addTouchListeners=function(o,p){var e="scroll",t,r,h,a,u,f,m=0,y,x=0,E=0,w=0,g,S;function k(){var C=window.navigator&&window.navigator.clipboard,b=!1,T=function(){var N=p.getCopyText(),P=p.session.getUndoManager().hasUndo();S.replaceChild(d.buildDom(b?["span",!N&&I("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],N&&I("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],N&&I("cut")&&["span",{class:"ace_mobile-button",action:"cut"},"Cut"],C&&I("paste")&&["span",{class:"ace_mobile-button",action:"paste"},"Paste"],P&&I("undo")&&["span",{class:"ace_mobile-button",action:"undo"},"Undo"],I("find")&&["span",{class:"ace_mobile-button",action:"find"},"Find"],I("openCommandPalette")&&["span",{class:"ace_mobile-button",action:"openCommandPalette"},"Palette"]]:["span"]),S.firstChild)},I=function(N){return p.commands.canExecute(N,p)},O=function(N){var P=N.target.getAttribute("action");if(P=="more"||!b)return b=!b,T();P=="paste"?C.readText().then(function(B){p.execCommand(P,B)}):P&&((P=="cut"||P=="copy")&&(C?C.writeText(p.getCopyText()):document.execCommand("copy")),p.execCommand(P)),S.firstChild.style.display="none",b=!1,P!="openCommandPalette"&&p.focus()};S=d.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(N){e="menu",N.stopPropagation(),N.preventDefault(),p.textInput.focus()},ontouchend:function(N){N.stopPropagation(),N.preventDefault(),O(N)},onclick:O},["span"],["span",{class:"ace_mobile-button",action:"more"},"..."]],p.container)}function D(){if(!p.getOption("enableMobileMenu")){S&&_();return}S||k();var C=p.selection.cursor,b=p.renderer.textToScreenCoordinates(C.row,C.column),T=p.renderer.textToScreenCoordinates(0,0).pageX,I=p.renderer.scrollLeft,O=p.container.getBoundingClientRect();S.style.top=b.pageY-O.top-3+"px",b.pageX-O.left<O.width-70?(S.style.left="",S.style.right="10px"):(S.style.right="",S.style.left=T+I-O.left+"px"),S.style.display="",S.firstChild.style.display="none",p.on("input",_)}function _(C){S&&(S.style.display="none"),p.off("input",_)}function F(){u=null,clearTimeout(u);var C=p.selection.getRange(),b=C.contains(y.row,y.column);(C.isEmpty()||!b)&&(p.selection.moveToPosition(y),p.selection.selectWord()),e="wait",D()}function A(){u=null,clearTimeout(u),p.selection.moveToPosition(y);var C=x>=2?p.selection.getLineRange(y.row):p.session.getBracketRange(y);C&&!C.isEmpty()?p.selection.setRange(C):p.selection.selectWord(),e="wait"}c.addListener(o,"contextmenu",function(C){if(g){var b=p.textInput.getElement();b.focus()}},p),c.addListener(o,"touchstart",function(C){var b=C.touches;if(u||b.length>1){clearTimeout(u),u=null,h=-1,e="zoom";return}g=p.$mouseHandler.isMousePressed=!0;var T=p.renderer.layerConfig.lineHeight,I=p.renderer.layerConfig.lineHeight,O=C.timeStamp;a=O;var N=b[0],P=N.clientX,B=N.clientY;Math.abs(t-P)+Math.abs(r-B)>T&&(h=-1),t=C.clientX=P,r=C.clientY=B,E=w=0;var V=new s(C,p);if(y=V.getDocumentPosition(),O-h<500&&b.length==1&&!m)x++,C.preventDefault(),C.button=0,A();else{x=0;var W=p.selection.cursor,z=p.selection.isEmpty()?W:p.selection.anchor,U=p.renderer.$cursorLayer.getPixelPosition(W,!0),G=p.renderer.$cursorLayer.getPixelPosition(z,!0),Y=p.renderer.scroller.getBoundingClientRect(),Q=p.renderer.layerConfig.offset,q=p.renderer.scrollLeft,te=function(me,Ce){return me=me/I,Ce=Ce/T-.75,me*me+Ce*Ce};if(C.clientX<Y.left){e="zoom";return}var re=te(C.clientX-Y.left-U.left+q,C.clientY-Y.top-U.top+Q),ue=te(C.clientX-Y.left-G.left+q,C.clientY-Y.top-G.top+Q);re<3.5&&ue<3.5&&(e=re>ue?"cursor":"anchor"),ue<3.5?e="anchor":re<3.5?e="cursor":e="scroll",u=setTimeout(F,450)}h=O},p),c.addListener(o,"touchend",function(C){g=p.$mouseHandler.isMousePressed=!1,f&&clearInterval(f),e=="zoom"?(e="",m=0):u?(p.selection.moveToPosition(y),m=0,D()):e=="scroll"?($(),_()):D(),clearTimeout(u),u=null},p),c.addListener(o,"touchmove",function(C){u&&(clearTimeout(u),u=null);var b=C.touches;if(!(b.length>1||e=="zoom")){var T=b[0],I=t-T.clientX,O=r-T.clientY;if(e=="wait")if(I*I+O*O>4)e="cursor";else return C.preventDefault();t=T.clientX,r=T.clientY,C.clientX=T.clientX,C.clientY=T.clientY;var N=C.timeStamp,P=N-a;if(a=N,e=="scroll"){var B=new s(C,p);B.speed=1,B.wheelX=I,B.wheelY=O,10*Math.abs(I)<Math.abs(O)&&(I=0),10*Math.abs(O)<Math.abs(I)&&(O=0),P!=0&&(E=I/P,w=O/P),p._emit("mousewheel",B),B.propagationStopped||(E=w=0)}else{var V=new s(C,p),W=V.getDocumentPosition();e=="cursor"?p.selection.moveCursorToPosition(W):e=="anchor"&&p.selection.setSelectionAnchor(W.row,W.column),p.renderer.scrollCursorIntoView(W),C.preventDefault()}}},p);function $(){m+=60,f=setInterval(function(){m--<=0&&(clearInterval(f),f=null),Math.abs(E)<.01&&(E=0),Math.abs(w)<.01&&(w=0),m<20&&(E=.9*E),m<20&&(w=.9*w);var C=p.session.getScrollTop();p.renderer.scrollBy(10*E,10*w),C==p.session.getScrollTop()&&(m=0)},10)}}}),ace.define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/mouse/touch_handler","ace/config"],function(i,l,v){var s=i("../lib/event"),c=i("../lib/useragent"),d=i("./default_handlers").DefaultHandlers,o=i("./default_gutter_handler").GutterHandler,p=i("./mouse_event").MouseEvent,e=i("./dragdrop_handler").DragdropHandler,t=i("./touch_handler").addTouchListeners,r=i("../config"),h=function(){function a(u){this.$dragDelay,this.$dragEnabled,this.$mouseMoved,this.mouseEvent,this.$focusTimeout;var f=this;this.editor=u,new d(this),new o(this),new e(this);var m=function(E){var w=!document.hasFocus||!document.hasFocus()||!u.isFocused()&&document.activeElement==(u.textInput&&u.textInput.getElement());w&&window.focus(),u.focus(),setTimeout(function(){u.isFocused()||u.focus()})},y=u.renderer.getMouseEventTarget();s.addListener(y,"click",this.onMouseEvent.bind(this,"click"),u),s.addListener(y,"mousemove",this.onMouseMove.bind(this,"mousemove"),u),s.addMultiMouseDownListener([y,u.renderer.scrollBarV&&u.renderer.scrollBarV.inner,u.renderer.scrollBarH&&u.renderer.scrollBarH.inner,u.textInput&&u.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent",u),s.addMouseWheelListener(u.container,this.onMouseWheel.bind(this,"mousewheel"),u),t(u.container,u);var x=u.renderer.$gutter;s.addListener(x,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),u),s.addListener(x,"click",this.onMouseEvent.bind(this,"gutterclick"),u),s.addListener(x,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),u),s.addListener(x,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),u),s.addListener(y,"mousedown",m,u),s.addListener(x,"mousedown",m,u),c.isIE&&u.renderer.scrollBarV&&(s.addListener(u.renderer.scrollBarV.element,"mousedown",m,u),s.addListener(u.renderer.scrollBarH.element,"mousedown",m,u)),u.on("mousemove",function(E){if(!(f.state||f.$dragDelay||!f.$dragEnabled)){var w=u.renderer.screenToTextCoordinates(E.x,E.y),g=u.session.selection.getRange(),S=u.renderer;!g.isEmpty()&&g.insideStart(w.row,w.column)?S.setCursorStyle("default"):S.setCursorStyle("")}},u)}return a.prototype.onMouseEvent=function(u,f){this.editor.session&&this.editor._emit(u,new p(f,this.editor))},a.prototype.onMouseMove=function(u,f){var m=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;!m||!m.length||this.editor._emit(u,new p(f,this.editor))},a.prototype.onMouseWheel=function(u,f){var m=new p(f,this.editor);m.speed=this.$scrollSpeed*2,m.wheelX=f.wheelX,m.wheelY=f.wheelY,this.editor._emit(u,m)},a.prototype.setState=function(u){this.state=u},a.prototype.captureMouse=function(u,f){this.x=u.x,this.y=u.y,this.isMousePressed=!0;var m=this.editor,y=this.editor.renderer;y.$isMousePressed=!0;var x=this,E=!0,w=function(_){if(_){if(c.isWebKit&&!_.which&&x.releaseMouse)return x.releaseMouse();x.x=_.clientX,x.y=_.clientY,f&&f(_),x.mouseEvent=new p(_,x.editor),x.$mouseMoved=!0}},g=function(_){m.off("beforeEndOperation",D),E=!1,m.session&&S(),x[x.state+"End"]&&x[x.state+"End"](_),x.state="",x.isMousePressed=y.$isMousePressed=!1,y.$keepTextAreaAtCursor&&y.$moveTextAreaToCursor(),x.$onCaptureMouseMove=x.releaseMouse=null,_&&x.onMouseEvent("mouseup",_),m.endOperation()},S=function(){x[x.state]&&x[x.state](),x.$mouseMoved=!1},k=function(){E&&(S(),s.nextFrame(k))};if(c.isOldIE&&u.domEvent.type=="dblclick")return setTimeout(function(){g(u)});var D=function(_){x.releaseMouse&&m.curOp.command.name&&m.curOp.selectionChanged&&(x[x.state+"End"]&&x[x.state+"End"](),x.state="",x.releaseMouse())};m.on("beforeEndOperation",D),m.startOperation({command:{name:"mouse"}}),x.$onCaptureMouseMove=w,x.releaseMouse=s.capture(this.editor.container,w,g),k()},a.prototype.cancelContextMenu=function(){var u=function(f){f&&f.domEvent&&f.domEvent.type!="contextmenu"||(this.editor.off("nativecontextmenu",u),f&&f.domEvent&&s.stopEvent(f.domEvent))}.bind(this);setTimeout(u,10),this.editor.on("nativecontextmenu",u)},a.prototype.destroy=function(){this.releaseMouse&&this.releaseMouse()},a}();h.prototype.releaseMouse=null,r.defineOptions(h.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:c.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),l.MouseHandler=h}),ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(i,l,v){var s=i("../lib/dom"),c=function(){function d(o){o.on("click",function(p){var e=p.getDocumentPosition(),t=o.session,r=t.getFoldAt(e.row,e.column,1);r&&(p.getAccelKey()?t.removeFold(r):t.expandFold(r),p.stop());var h=p.domEvent&&p.domEvent.target;h&&s.hasCssClass(h,"ace_inline_button")&&s.hasCssClass(h,"ace_toggle_wrap")&&(t.setOption("wrap",!t.getUseWrapMode()),o.renderer.scrollCursorIntoView())}),o.on("gutterclick",function(p){var e=o.renderer.$gutterLayer.getRegion(p);if(e=="foldWidgets"){var t=p.getDocumentPosition().row,r=o.session;r.foldWidgets&&r.foldWidgets[t]&&o.session.onFoldWidgetClick(t,p),o.isFocused()||o.focus(),p.stop()}}),o.on("gutterdblclick",function(p){var e=o.renderer.$gutterLayer.getRegion(p);if(e=="foldWidgets"){var t=p.getDocumentPosition().row,r=o.session,h=r.getParentFoldRangeData(t,!0),a=h.range||h.firstRange;if(a){t=a.start.row;var u=r.getFoldAt(t,r.getLine(t).length,1);u?r.removeFold(u):(r.addFold("...",a),o.renderer.scrollCursorIntoView({row:a.start.row,column:0}))}p.stop()}})}return d}();l.FoldHandler=c}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(i,l,v){var s=i("../lib/keys"),c=i("../lib/event"),d=function(){function o(p){this.$editor=p,this.$data={editor:p},this.$handlers=[],this.setDefaultHandler(p.commands)}return o.prototype.setDefaultHandler=function(p){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=p,this.addKeyboardHandler(p,0)},o.prototype.setKeyboardHandler=function(p){var e=this.$handlers;if(e[e.length-1]!=p){for(;e[e.length-1]&&e[e.length-1]!=this.$defaultHandler;)this.removeKeyboardHandler(e[e.length-1]);this.addKeyboardHandler(p,1)}},o.prototype.addKeyboardHandler=function(p,e){if(p){typeof p=="function"&&!p.handleKeyboard&&(p.handleKeyboard=p);var t=this.$handlers.indexOf(p);t!=-1&&this.$handlers.splice(t,1),e==null?this.$handlers.push(p):this.$handlers.splice(e,0,p),t==-1&&p.attach&&p.attach(this.$editor)}},o.prototype.removeKeyboardHandler=function(p){var e=this.$handlers.indexOf(p);return e==-1?!1:(this.$handlers.splice(e,1),p.detach&&p.detach(this.$editor),!0)},o.prototype.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},o.prototype.getStatusText=function(){var p=this.$data,e=p.editor;return this.$handlers.map(function(t){return t.getStatusText&&t.getStatusText(e,p)||""}).filter(Boolean).join(" ")},o.prototype.$callKeyboardHandlers=function(p,e,t,r){for(var h,a=!1,u=this.$editor.commands,f=this.$handlers.length;f--&&(h=this.$handlers[f].handleKeyboard(this.$data,p,e,t,r),!(!(!h||!h.command)&&(h.command=="null"?a=!0:a=u.exec(h.command,this.$editor,h.args,r),a&&r&&p!=-1&&h.passEvent!=!0&&h.command.passEvent!=!0&&c.stopEvent(r),a))););return!a&&p==-1&&(h={command:"insertstring"},a=u.exec("insertstring",this.$editor,e)),a&&this.$editor._signal&&this.$editor._signal("keyboardActivity",h),a},o.prototype.onCommandKey=function(p,e,t){var r=s.keyCodeToString(t);return this.$callKeyboardHandlers(e,r,t,p)},o.prototype.onTextInput=function(p){return this.$callKeyboardHandlers(-1,p)},o}();l.KeyBinding=d}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(i,l,v){var s=0,c=0,d=!1,o=!1,p=!1,e=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],t=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],r=0,h=1,a=0,u=1,f=2,m=3,y=4,x=5,E=6,w=7,g=8,S=9,k=10,D=11,_=12,F=13,A=14,$=15,C=16,b=17,T=18,I=[T,T,T,T,T,T,T,T,T,E,x,E,g,x,T,T,T,T,T,T,T,T,T,T,T,T,T,T,x,x,x,E,g,y,y,D,D,D,y,y,y,y,y,k,S,k,S,S,f,f,f,f,f,f,f,f,f,f,S,y,y,y,y,y,y,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,y,y,y,y,y,y,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,y,y,y,y,T,T,T,T,T,T,x,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,T,S,y,D,D,D,D,y,y,y,y,a,y,y,T,y,y,D,D,f,f,y,a,y,y,y,f,a,y,y,y,y,y],O=[g,g,g,g,g,g,g,g,g,g,g,T,T,T,a,u,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,g,x,F,A,$,C,b,S,D,D,D,D,D,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,S,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,y,g];function N(W,z,U,G){var Y=s?t:e,Q=null,q=null,te=null,re=0,ue=null,me=null,Ce=-1,ve=null,$e=null,Lt=[];if(!G)for(ve=0,G=[];ve<U;ve++)G[ve]=V(W[ve]);for(c=s,d=!1,o=!1,p=!1,$e=0;$e<U;$e++){if(Q=re,Lt[$e]=q=B(W,G,Lt,$e),re=Y[Q][q],ue=re&240,re&=15,z[$e]=te=Y[re][5],ue>0)if(ue==16){for(ve=Ce;ve<$e;ve++)z[ve]=1;Ce=-1}else Ce=-1;if(me=Y[re][6],me)Ce==-1&&(Ce=$e);else if(Ce>-1){for(ve=Ce;ve<$e;ve++)z[ve]=te;Ce=-1}G[$e]==x&&(z[$e]=0),c|=te}if(p){for(ve=0;ve<U;ve++)if(G[ve]==E){z[ve]=s;for(var gt=ve-1;gt>=0&&G[gt]==g;gt--)z[gt]=s}}}function P(W,z,U){if(!(c<W)){if(W==1&&s==h&&!o){U.reverse();return}for(var G=U.length,Y=0,Q,q,te,re;Y<G;){if(z[Y]>=W){for(Q=Y+1;Q<G&&z[Q]>=W;)Q++;for(q=Y,te=Q-1;q<te;q++,te--)re=U[q],U[q]=U[te],U[te]=re;Y=Q}Y++}}}function B(W,z,U,G){var Y=z[G],Q,q,te,re;switch(Y){case a:case u:d=!1;case y:case m:return Y;case f:return d?m:f;case w:return d=!0,u;case g:return y;case S:return G<1||G+1>=z.length||(Q=U[G-1])!=f&&Q!=m||(q=z[G+1])!=f&&q!=m?y:(d&&(q=m),q==Q?q:y);case k:return Q=G>0?U[G-1]:x,Q==f&&G+1<z.length&&z[G+1]==f?f:y;case D:if(G>0&&U[G-1]==f)return f;if(d)return y;for(re=G+1,te=z.length;re<te&&z[re]==D;)re++;return re<te&&z[re]==f?f:y;case _:for(te=z.length,re=G+1;re<te&&z[re]==_;)re++;if(re<te){var ue=W[G],me=ue>=1425&&ue<=2303||ue==64286;if(Q=z[re],me&&(Q==u||Q==w))return u}return G<1||(Q=z[G-1])==x?y:U[G-1];case x:return d=!1,o=!0,s;case E:return p=!0,y;case F:case A:case C:case b:case $:d=!1;case T:return y}}function V(W){var z=W.charCodeAt(0),U=z>>8;return U==0?z>191?a:I[z]:U==5?/[\u0591-\u05f4]/.test(W)?u:a:U==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(W)?_:/[\u0660-\u0669\u066b-\u066c]/.test(W)?m:z==1642?D:/[\u06f0-\u06f9]/.test(W)?f:w:U==32&&z<=8287?O[z&255]:U==254&&z>=65136?w:y}l.L=a,l.R=u,l.EN=f,l.ON_R=3,l.AN=4,l.R_H=5,l.B=6,l.RLE=7,l.DOT="·",l.doBidiReorder=function(W,z,U){if(W.length<2)return{};var G=W.split(""),Y=new Array(G.length),Q=new Array(G.length),q=[];s=U?h:r,N(G,q,G.length,z);for(var te=0;te<Y.length;Y[te]=te,te++);P(2,q,Y),P(1,q,Y);for(var te=0;te<Y.length-1;te++)z[te]===m?q[te]=l.AN:q[te]===u&&(z[te]>w&&z[te]<F||z[te]===y||z[te]===T)?q[te]=l.ON_R:te>0&&G[te-1]==="ل"&&/\u0622|\u0623|\u0625|\u0627/.test(G[te])&&(q[te-1]=q[te]=l.R_H,te++);G[G.length-1]===l.DOT&&(q[G.length-1]=l.B),G[0]===""&&(q[0]=l.RLE);for(var te=0;te<Y.length;te++)Q[te]=q[Y[te]];return{logicalFromVisual:Y,bidiLevels:Q}},l.hasBidiCharacters=function(W,z){for(var U=!1,G=0;G<W.length;G++)z[G]=V(W.charAt(G)),!U&&(z[G]==u||z[G]==w||z[G]==m)&&(U=!0);return U},l.getVisualFromLogicalIdx=function(W,z){for(var U=0;U<z.logicalFromVisual.length;U++)if(z.logicalFromVisual[U]==W)return U;return 0}}),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(i,l,v){var s=i("./lib/bidiutil"),c=i("./lib/lang"),d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/,o=function(){function p(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=s,this.charWidths=[],this.EOL="¬",this.showInvisibles=!0,this.isRtlDir=!1,this.$isRtl=!1,this.line="",this.wrapIndent=0,this.EOF="¶",this.RLE="",this.contentWidth=0,this.fontMetrics=null,this.rtlLineOffset=0,this.wrapOffset=0,this.isMoveLeftOperation=!1,this.seenBidi=d.test(e.getValue())}return p.prototype.isBidiRow=function(e,t,r){return this.seenBidi?(e!==this.currentRow&&(this.currentRow=e,this.updateRowLine(t,r),this.updateBidiMap()),this.bidiMap.bidiLevels):!1},p.prototype.onChange=function(e){this.seenBidi?this.currentRow=null:e.action=="insert"&&d.test(e.lines.join(`
|
|
193
|
+
`))&&(this.seenBidi=!0,this.currentRow=null)},p.prototype.getDocumentRow=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var r=this.session.$getRowCacheIndex(t,this.currentRow);r>=0&&(e=this.session.$docRowCache[r])}return e},p.prototype.getSplitIndex=function(){var e=0,t=this.session.$screenRowCache;if(t.length)for(var r,h=this.session.$getRowCacheIndex(t,this.currentRow);this.currentRow-e>0&&(r=this.session.$getRowCacheIndex(t,this.currentRow-e-1),r===h);)h=r,e++;else e=this.currentRow;return e},p.prototype.updateRowLine=function(e,t){e===void 0&&(e=this.getDocumentRow());var r=e===this.session.getLength()-1,h=r?this.EOF:this.EOL;if(this.wrapIndent=0,this.line=this.session.getLine(e),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE,this.session.$useWrapMode){var a=this.session.$wrapData[e];a&&(t===void 0&&(t=this.getSplitIndex()),t>0&&a.length?(this.wrapIndent=a.indent,this.wrapOffset=this.wrapIndent*this.charWidths[s.L],this.line=t<a.length?this.line.substring(a[t-1],a[t]):this.line.substring(a[a.length-1])):this.line=this.line.substring(0,a[t]),t==a.length&&(this.line+=this.showInvisibles?h:s.DOT))}else this.line+=this.showInvisibles?h:s.DOT;var u=this.session,f=0,m;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(y,x){return y===" "||u.isFullWidth(y.charCodeAt(0))?(m=y===" "?u.getScreenTabSize(x+f):2,f+=m-1,c.stringRepeat(s.DOT,m)):y}),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==s.DOT?this.line.substr(0,this.line.length-1):this.line,this.rtlLineOffset=this.contentWidth-this.fontMetrics.$main.getBoundingClientRect().width)},p.prototype.updateBidiMap=function(){var e=[];s.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=s.doBidiReorder(this.line,e,this.isRtlDir):this.bidiMap={}},p.prototype.markAsDirty=function(){this.currentRow=null},p.prototype.updateCharacterWidths=function(e){if(this.characterWidth!==e.$characterSize.width){this.fontMetrics=e;var t=this.characterWidth=e.$characterSize.width,r=e.$measureCharWidth("ה");this.charWidths[s.L]=this.charWidths[s.EN]=this.charWidths[s.ON_R]=t,this.charWidths[s.R]=this.charWidths[s.AN]=r,this.charWidths[s.R_H]=r*.45,this.charWidths[s.B]=this.charWidths[s.RLE]=0,this.currentRow=null}},p.prototype.setShowInvisibles=function(e){this.showInvisibles=e,this.currentRow=null},p.prototype.setEolChar=function(e){this.EOL=e},p.prototype.setContentWidth=function(e){this.contentWidth=e},p.prototype.isRtlLine=function(e){return this.$isRtl?!0:e!=null?this.session.getLine(e).charAt(0)==this.RLE:this.isRtlDir},p.prototype.setRtlDirection=function(e,t){for(var r=e.getCursorPosition(),h=e.selection.getSelectionAnchor().row;h<=r.row;h++)!t&&e.session.getLine(h).charAt(0)===e.session.$bidiHandler.RLE?e.session.doc.removeInLine(h,0,1):t&&e.session.getLine(h).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:h},e.session.$bidiHandler.RLE)},p.prototype.getPosLeft=function(e){e-=this.wrapIndent;var t=this.line.charAt(0)===this.RLE?1:0,r=e>t?this.session.getOverwrite()?e:e-1:t,h=s.getVisualFromLogicalIdx(r,this.bidiMap),a=this.bidiMap.bidiLevels,u=0;!this.session.getOverwrite()&&e<=t&&a[h]%2!==0&&h++;for(var f=0;f<h;f++)u+=this.charWidths[a[f]];return!this.session.getOverwrite()&&e>t&&a[h]%2===0&&(u+=this.charWidths[a[h]]),this.wrapIndent&&(u+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(u+=this.rtlLineOffset),u},p.prototype.getSelections=function(e,t){var r=this.bidiMap,h=r.bidiLevels,a,u=[],f=0,m=Math.min(e,t)-this.wrapIndent,y=Math.max(e,t)-this.wrapIndent,x=!1,E=!1,w=0;this.wrapIndent&&(f+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var g,S=0;S<h.length;S++)g=r.logicalFromVisual[S],a=h[S],x=g>=m&&g<y,x&&!E?w=f:!x&&E&&u.push({left:w,width:f-w}),f+=this.charWidths[a],E=x;if(x&&S===h.length&&u.push({left:w,width:f-w}),this.isRtlDir)for(var k=0;k<u.length;k++)u[k].left+=this.rtlLineOffset;return u},p.prototype.offsetToCol=function(r){this.isRtlDir&&(r-=this.rtlLineOffset);var t=0,r=Math.max(r,0),h=0,a=0,u=this.bidiMap.bidiLevels,f=this.charWidths[u[a]];for(this.wrapIndent&&(r-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);r>h+f/2;){if(h+=f,a===u.length-1){f=0;break}f=this.charWidths[u[++a]]}return a>0&&u[a-1]%2!==0&&u[a]%2===0?(r<h&&a--,t=this.bidiMap.logicalFromVisual[a]):a>0&&u[a-1]%2===0&&u[a]%2!==0?t=1+(r>h?this.bidiMap.logicalFromVisual[a]:this.bidiMap.logicalFromVisual[a-1]):this.isRtlDir&&a===u.length-1&&f===0&&u[a-1]%2===0||!this.isRtlDir&&a===0&&u[a]%2!==0?t=1+this.bidiMap.logicalFromVisual[a]:(a>0&&u[a-1]%2!==0&&f!==0&&a--,t=this.bidiMap.logicalFromVisual[a]),t===0&&this.isRtlDir&&t++,t+this.wrapIndent},p}();l.BidiHandler=o}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(i,l,v){var s=i("./lib/oop"),c=i("./lib/lang"),d=i("./lib/event_emitter").EventEmitter,o=i("./range").Range,p=function(){function e(t){this.session=t,this.doc=t.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var r=this;this.cursor.on("change",function(h){r.$cursorChanged=!0,r.$silent||r._emit("changeCursor"),!r.$isEmpty&&!r.$silent&&r._emit("changeSelection"),!r.$keepDesiredColumnOnChange&&h.old.column!=h.value.column&&(r.$desiredColumn=null)}),this.anchor.on("change",function(){r.$anchorChanged=!0,!r.$isEmpty&&!r.$silent&&r._emit("changeSelection")})}return e.prototype.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},e.prototype.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},e.prototype.getCursor=function(){return this.lead.getPosition()},e.prototype.setAnchor=function(t,r){this.$isEmpty=!1,this.anchor.setPosition(t,r)},e.prototype.getAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},e.prototype.getSelectionLead=function(){return this.lead.getPosition()},e.prototype.isBackwards=function(){var t=this.anchor,r=this.lead;return t.row>r.row||t.row==r.row&&t.column>r.column},e.prototype.getRange=function(){var t=this.anchor,r=this.lead;return this.$isEmpty?o.fromPoints(r,r):this.isBackwards()?o.fromPoints(r,t):o.fromPoints(t,r)},e.prototype.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},e.prototype.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},e.prototype.setRange=function(t,r){var h=r?t.end:t.start,a=r?t.start:t.end;this.$setSelection(h.row,h.column,a.row,a.column)},e.prototype.$setSelection=function(t,r,h,a){if(!this.$silent){var u=this.$isEmpty,f=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(t,r),this.cursor.setPosition(h,a),this.$isEmpty=!o.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||u!=this.$isEmpty||f)&&this._emit("changeSelection")}},e.prototype.$moveSelection=function(t){var r=this.lead;this.$isEmpty&&this.setSelectionAnchor(r.row,r.column),t.call(this)},e.prototype.selectTo=function(t,r){this.$moveSelection(function(){this.moveCursorTo(t,r)})},e.prototype.selectToPosition=function(t){this.$moveSelection(function(){this.moveCursorToPosition(t)})},e.prototype.moveTo=function(t,r){this.clearSelection(),this.moveCursorTo(t,r)},e.prototype.moveToPosition=function(t){this.clearSelection(),this.moveCursorToPosition(t)},e.prototype.selectUp=function(){this.$moveSelection(this.moveCursorUp)},e.prototype.selectDown=function(){this.$moveSelection(this.moveCursorDown)},e.prototype.selectRight=function(){this.$moveSelection(this.moveCursorRight)},e.prototype.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},e.prototype.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},e.prototype.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},e.prototype.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},e.prototype.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},e.prototype.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},e.prototype.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},e.prototype.getWordRange=function(t,r){if(typeof r>"u"){var h=t||this.lead;t=h.row,r=h.column}return this.session.getWordRange(t,r)},e.prototype.selectWord=function(){this.setSelectionRange(this.getWordRange())},e.prototype.selectAWord=function(){var t=this.getCursor(),r=this.session.getAWordRange(t.row,t.column);this.setSelectionRange(r)},e.prototype.getLineRange=function(t,r){var h=typeof t=="number"?t:this.lead.row,a,u=this.session.getFoldLine(h);return u?(h=u.start.row,a=u.end.row):a=h,r===!0?new o(h,0,a,this.session.getLine(a).length):new o(h,0,a+1,0)},e.prototype.selectLine=function(){this.setSelectionRange(this.getLineRange())},e.prototype.moveCursorUp=function(){this.moveCursorBy(-1,0)},e.prototype.moveCursorDown=function(){this.moveCursorBy(1,0)},e.prototype.wouldMoveIntoSoftTab=function(t,r,h){var a=t.column,u=t.column+r;return h<0&&(a=t.column-r,u=t.column),this.session.isTabStop(t)&&this.doc.getLine(t.row).slice(a,u).split(" ").length-1==r},e.prototype.moveCursorLeft=function(){var t=this.lead.getPosition(),r;if(r=this.session.getFoldAt(t.row,t.column,-1))this.moveCursorTo(r.start.row,r.start.column);else if(t.column===0)t.row>0&&this.moveCursorTo(t.row-1,this.doc.getLine(t.row-1).length);else{var h=this.session.getTabSize();this.wouldMoveIntoSoftTab(t,h,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-h):this.moveCursorBy(0,-1)}},e.prototype.moveCursorRight=function(){var t=this.lead.getPosition(),r;if(r=this.session.getFoldAt(t.row,t.column,1))this.moveCursorTo(r.end.row,r.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var h=this.session.getTabSize(),t=this.lead;this.wouldMoveIntoSoftTab(t,h,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,h):this.moveCursorBy(0,1)}},e.prototype.moveCursorLineStart=function(){var t=this.lead.row,r=this.lead.column,h=this.session.documentToScreenRow(t,r),a=this.session.screenToDocumentPosition(h,0),u=this.session.getDisplayLine(t,null,a.row,a.column),f=u.match(/^\s*/);f[0].length!=r&&!this.session.$useEmacsStyleLineStart&&(a.column+=f[0].length),this.moveCursorToPosition(a)},e.prototype.moveCursorLineEnd=function(){var t=this.lead,r=this.session.getDocumentLastRowColumnPosition(t.row,t.column);if(this.lead.column==r.column){var h=this.session.getLine(r.row);if(r.column==h.length){var a=h.search(/\s+$/);a>0&&(r.column=a)}}this.moveCursorTo(r.row,r.column)},e.prototype.moveCursorFileEnd=function(){var t=this.doc.getLength()-1,r=this.doc.getLine(t).length;this.moveCursorTo(t,r)},e.prototype.moveCursorFileStart=function(){this.moveCursorTo(0,0)},e.prototype.moveCursorLongWordRight=function(){var t=this.lead.row,r=this.lead.column,h=this.doc.getLine(t),a=h.substring(r);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var u=this.session.getFoldAt(t,r,1);if(u){this.moveCursorTo(u.end.row,u.end.column);return}if(this.session.nonTokenRe.exec(a)&&(r+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,a=h.substring(r)),r>=h.length){this.moveCursorTo(t,h.length),this.moveCursorRight(),t<this.doc.getLength()-1&&this.moveCursorWordRight();return}this.session.tokenRe.exec(a)&&(r+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,r)},e.prototype.moveCursorLongWordLeft=function(){var t=this.lead.row,r=this.lead.column,h;if(h=this.session.getFoldAt(t,r,-1)){this.moveCursorTo(h.start.row,h.start.column);return}var a=this.session.getFoldStringAt(t,r,-1);a==null&&(a=this.doc.getLine(t).substring(0,r));var u=c.stringReverse(a);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(u)&&(r-=this.session.nonTokenRe.lastIndex,u=u.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),r<=0){this.moveCursorTo(t,0),this.moveCursorLeft(),t>0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(u)&&(r-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,r)},e.prototype.$shortWordEndIndex=function(t){var r=0,h,a=/\s/,u=this.session.tokenRe;if(u.lastIndex=0,this.session.tokenRe.exec(t))r=this.session.tokenRe.lastIndex;else{for(;(h=t[r])&&a.test(h);)r++;if(r<1){for(u.lastIndex=0;(h=t[r])&&!u.test(h);)if(u.lastIndex=0,r++,a.test(h))if(r>2){r--;break}else{for(;(h=t[r])&&a.test(h);)r++;if(r>2)break}}}return u.lastIndex=0,r},e.prototype.moveCursorShortWordRight=function(){var t=this.lead.row,r=this.lead.column,h=this.doc.getLine(t),a=h.substring(r),u=this.session.getFoldAt(t,r,1);if(u)return this.moveCursorTo(u.end.row,u.end.column);if(r==h.length){var f=this.doc.getLength();do t++,a=this.doc.getLine(t);while(t<f&&/^\s*$/.test(a));/^\s+/.test(a)||(a=""),r=0}var m=this.$shortWordEndIndex(a);this.moveCursorTo(t,r+m)},e.prototype.moveCursorShortWordLeft=function(){var t=this.lead.row,r=this.lead.column,h;if(h=this.session.getFoldAt(t,r,-1))return this.moveCursorTo(h.start.row,h.start.column);var a=this.session.getLine(t).substring(0,r);if(r===0){do t--,a=this.doc.getLine(t);while(t>0&&/^\s*$/.test(a));r=a.length,/\s+$/.test(a)||(a="")}var u=c.stringReverse(a),f=this.$shortWordEndIndex(u);return this.moveCursorTo(t,r-f)},e.prototype.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},e.prototype.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},e.prototype.moveCursorBy=function(t,r){var h=this.session.documentToScreenPosition(this.lead.row,this.lead.column),a;if(r===0&&(t!==0&&(this.session.$bidiHandler.isBidiRow(h.row,this.lead.row)?(a=this.session.$bidiHandler.getPosLeft(h.column),h.column=Math.round(a/this.session.$bidiHandler.charWidths[0])):a=h.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?h.column=this.$desiredColumn:this.$desiredColumn=h.column),t!=0&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var u=this.session.lineWidgets[this.lead.row];t<0?t-=u.rowsAbove||0:t>0&&(t+=u.rowCount-(u.rowsAbove||0))}var f=this.session.screenToDocumentPosition(h.row+t,h.column,a);t!==0&&r===0&&f.row===this.lead.row&&(f.column,this.lead.column),this.moveCursorTo(f.row,f.column+r,r===0)},e.prototype.moveCursorToPosition=function(t){this.moveCursorTo(t.row,t.column)},e.prototype.moveCursorTo=function(t,r,h){var a=this.session.getFoldAt(t,r,1);a&&(t=a.start.row,r=a.start.column),this.$keepDesiredColumnOnChange=!0;var u=this.session.getLine(t);/[\uDC00-\uDFFF]/.test(u.charAt(r))&&u.charAt(r-1)&&(this.lead.row==t&&this.lead.column==r+1?r=r-1:r=r+1),this.lead.setPosition(t,r),this.$keepDesiredColumnOnChange=!1,h||(this.$desiredColumn=null)},e.prototype.moveCursorToScreen=function(t,r,h){var a=this.session.screenToDocumentPosition(t,r);this.moveCursorTo(a.row,a.column,h)},e.prototype.detach=function(){this.lead.detach(),this.anchor.detach()},e.prototype.fromOrientedRange=function(t){this.setSelectionRange(t,t.cursor==t.start),this.$desiredColumn=t.desiredColumn||this.$desiredColumn},e.prototype.toOrientedRange=function(t){var r=this.getRange();return t?(t.start.column=r.start.column,t.start.row=r.start.row,t.end.column=r.end.column,t.end.row=r.end.row):t=r,t.cursor=this.isBackwards()?t.start:t.end,t.desiredColumn=this.$desiredColumn,t},e.prototype.getRangeOfMovements=function(t){var r=this.getCursor();try{t(this);var h=this.getCursor();return o.fromPoints(r,h)}catch{return o.fromPoints(r,r)}finally{this.moveCursorToPosition(r)}},e.prototype.toJSON=function(){if(this.rangeCount)var t=this.ranges.map(function(r){var h=r.clone();return h.isBackwards=r.cursor==r.start,h});else{var t=this.getRange();t.isBackwards=this.isBackwards()}return t},e.prototype.fromJSON=function(t){if(t.start==null)if(this.rangeList&&t.length>1){this.toSingleRange(t[0]);for(var r=t.length;r--;){var h=o.fromPoints(t[r].start,t[r].end);t[r].isBackwards&&(h.cursor=h.start),this.addRange(h,!0)}return}else t=t[0];this.rangeList&&this.toSingleRange(t),this.setSelectionRange(t,t.isBackwards)},e.prototype.isEqual=function(t){if((t.length||this.rangeCount)&&t.length!=this.rangeCount)return!1;if(!t.length||!this.ranges)return this.getRange().isEqual(t);for(var r=this.ranges.length;r--;)if(!this.ranges[r].isEqual(t[r]))return!1;return!0},e}();p.prototype.setSelectionAnchor=p.prototype.setAnchor,p.prototype.getSelectionAnchor=p.prototype.getAnchor,p.prototype.setSelectionRange=p.prototype.setRange,s.implement(p.prototype,d),l.Selection=p}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(i,l,v){var s=i("./lib/report_error").reportError,c=2e3,d=function(){function o(p){this.splitRegex,this.states=p,this.regExps={},this.matchMappings={};for(var e in this.states){for(var t=this.states[e],r=[],h=0,a=this.matchMappings[e]={defaultToken:"text"},u="g",f=[],m=0;m<t.length;m++){var y=t[m];if(y.defaultToken&&(a.defaultToken=y.defaultToken),y.caseInsensitive&&u.indexOf("i")===-1&&(u+="i"),y.unicode&&u.indexOf("u")===-1&&(u+="u"),y.regex!=null){y.regex instanceof RegExp&&(y.regex=y.regex.toString().slice(1,-1));var x=y.regex,E=new RegExp("(?:("+x+")|(.))").exec("a").length-2;Array.isArray(y.token)?y.token.length==1||E==1?y.token=y.token[0]:E-1!=y.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:y,groupCount:E-1}),y.token=y.token[0]):(y.tokenArray=y.token,y.token=null,y.onMatch=this.$arrayTokens):typeof y.token=="function"&&!y.onMatch&&(E>1?y.onMatch=this.$applyToken:y.onMatch=y.token),E>1&&(/\\\d/.test(y.regex)?x=y.regex.replace(/\\([0-9]+)/g,function(w,g){return"\\"+(parseInt(g,10)+h+1)}):(E=1,x=this.removeCapturingGroups(y.regex)),!y.splitRegex&&typeof y.token!="string"&&f.push(y)),a[h]=m,h+=E,r.push(x),y.onMatch||(y.onMatch=null)}}r.length||(a[0]=0,r.push("$")),f.forEach(function(w){w.splitRegex=this.createSplitterRegexp(w.regex,u)},this),this.regExps[e]=new RegExp("("+r.join(")|(")+")|($)",u)}}return o.prototype.$setMaxTokenCount=function(p){c=p|0},o.prototype.$applyToken=function(p){var e=this.splitRegex.exec(p).slice(1),t=this.token.apply(this,e);if(typeof t=="string")return[{type:t,value:p}];for(var r=[],h=0,a=t.length;h<a;h++)e[h]&&(r[r.length]={type:t[h],value:e[h]});return r},o.prototype.$arrayTokens=function(p){if(!p)return[];var e=this.splitRegex.exec(p);if(!e)return"text";for(var t=[],r=this.tokenArray,h=0,a=r.length;h<a;h++)e[h+1]&&(t[t.length]={type:r[h],value:e[h+1]});return t},o.prototype.removeCapturingGroups=function(p){var e=p.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g,function(t,r){return r?"(?:":t});return e},o.prototype.createSplitterRegexp=function(p,e){if(p.indexOf("(?=")!=-1){var t=0,r=!1,h={};p.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(a,u,f,m,y,x){return r?r=y!="]":y?r=!0:m?(t==h.stack&&(h.end=x+1,h.stack=-1),t--):f&&(t++,f.length!=1&&(h.stack=t,h.start=x)),a}),h.end!=null&&/^\)*$/.test(p.substr(h.end))&&(p=p.substring(0,h.start)+p.substr(h.end))}return p.charAt(0)!="^"&&(p="^"+p),p.charAt(p.length-1)!="$"&&(p+="$"),new RegExp(p,(e||"").replace("g",""))},o.prototype.getLineTokens=function(p,e){if(e&&typeof e!="string"){var t=e.slice(0);e=t[0],e==="#tmp"&&(t.shift(),e=t.shift())}else var t=[];var r=e||"start",h=this.states[r];h||(r="start",h=this.states[r]);var a=this.matchMappings[r],u=this.regExps[r];u.lastIndex=0;for(var f,m=[],y=0,x=0,E={type:null,value:""};f=u.exec(p);){var w=a.defaultToken,g=null,S=f[0],k=u.lastIndex;if(k-S.length>y){var D=p.substring(y,k-S.length);E.type==w?E.value+=D:(E.type&&m.push(E),E={type:w,value:D})}for(var _=0;_<f.length-2;_++)if(f[_+1]!==void 0){g=h[a[_]],g.onMatch?w=g.onMatch(S,r,t,p):w=g.token,g.next&&(typeof g.next=="string"?r=g.next:r=g.next(r,t),h=this.states[r],h||(this.reportError("state doesn't exist",r),r="start",h=this.states[r]),a=this.matchMappings[r],y=k,u=this.regExps[r],u.lastIndex=k),g.consumeLineEnd&&(y=k);break}if(S){if(typeof w=="string")(!g||g.merge!==!1)&&E.type===w?E.value+=S:(E.type&&m.push(E),E={type:w,value:S});else if(w){E.type&&m.push(E),E={type:null,value:""};for(var _=0;_<w.length;_++)m.push(w[_])}}if(y==p.length)break;if(y=k,x++>c){for(x>2*p.length&&this.reportError("infinite loop with in ace tokenizer",{startState:e,line:p});y<p.length;)E.type&&m.push(E),E={value:p.substring(y,y+=500),type:"overflow"};r="start",t=[];break}}return E.type&&m.push(E),t.length>1&&t[0]!==r&&t.unshift("#tmp",r),{tokens:m,state:t.length?t:r}},o}();d.prototype.reportError=s,l.Tokenizer=d}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(i,l,v){var s=i("../lib/deep_copy").deepCopy,c;c=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}},function(){this.addRules=function(p,e){if(!e){for(var t in p)this.$rules[t]=p[t];return}for(var t in p){for(var r=p[t],h=0;h<r.length;h++){var a=r[h];(a.next||a.onMatch)&&(typeof a.next=="string"&&a.next.indexOf(e)!==0&&(a.next=e+a.next),a.nextState&&a.nextState.indexOf(e)!==0&&(a.nextState=e+a.nextState))}this.$rules[e+t]=r}},this.getRules=function(){return this.$rules},this.embedRules=function(p,e,t,r,h){var a=typeof p=="function"?new p().getRules():p;if(r)for(var u=0;u<r.length;u++)r[u]=e+r[u];else{r=[];for(var f in a)r.push(e+f)}if(this.addRules(a,e),t)for(var m=Array.prototype[h?"push":"unshift"],u=0;u<r.length;u++)m.apply(this.$rules[r[u]],s(t));this.$embeds||(this.$embeds=[]),this.$embeds.push(e)},this.getEmbeds=function(){return this.$embeds};var d=function(p,e){return(p!="start"||e.length)&&e.unshift(this.nextState,p),this.nextState},o=function(p,e){return e.shift(),e.shift()||"start"};this.normalizeRules=function(){var p=0,e=this.$rules;function t(r){var h=e[r];h.processed=!0;for(var a=0;a<h.length;a++){var u=h[a],f=null;Array.isArray(u)&&(f=u,u={}),!u.regex&&u.start&&(u.regex=u.start,u.next||(u.next=[]),u.next.push({defaultToken:u.token},{token:u.token+".end",regex:u.end||u.start,next:"pop"}),u.token=u.token+".start",u.push=!0);var m=u.next||u.push;if(m&&Array.isArray(m)){var y=u.stateName;y||(y=u.token,typeof y!="string"&&(y=y[0]||""),e[y]&&(y+=p++)),e[y]=m,u.next=y,t(y)}else m=="pop"&&(u.next=o);if(u.push&&(u.nextState=u.next||u.push,u.next=d,delete u.push),u.rules)for(var x in u.rules)e[x]?e[x].push&&e[x].push.apply(e[x],u.rules[x]):e[x]=u.rules[x];var E=typeof u=="string"?u:u.include;if(E&&(E==="$self"&&(E="start"),Array.isArray(E)?f=E.map(function(g){return e[g]}):f=e[E]),f){var w=[a,1].concat(f);u.noEscape&&(w=w.filter(function(g){return!g.next})),h.splice.apply(h,w),a--}u.keywordMap&&(u.token=this.createKeywordMapper(u.keywordMap,u.defaultToken||"text",u.caseInsensitive),delete u.defaultToken)}}Object.keys(e).forEach(t,this)},this.createKeywordMapper=function(p,e,t,r){var h=Object.create(null);return this.$keywordList=[],Object.keys(p).forEach(function(a){for(var u=p[a],f=u.split(r||"|"),m=f.length;m--;){var y=f[m];this.$keywordList.push(y),t&&(y=y.toLowerCase()),h[y]=a}},this),p=null,t?function(a){return h[a.toLowerCase()]||e}:function(a){return h[a]||e}},this.getKeywords=function(){return this.$keywords}}.call(c.prototype),l.TextHighlightRules=c}),ace.define("ace/mode/behaviour",["require","exports","module"],function(i,l,v){var s;s=function(){this.$behaviours={}},function(){this.add=function(c,d,o){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[c]:this.$behaviours[c]={}}this.$behaviours[c][d]=o},this.addBehaviours=function(c){for(var d in c)for(var o in c[d])this.add(d,o,c[d][o])},this.remove=function(c){this.$behaviours&&this.$behaviours[c]&&delete this.$behaviours[c]},this.inherit=function(c,d){if(typeof c=="function")var o=new c().getBehaviours(d);else var o=c.getBehaviours(d);this.addBehaviours(o)},this.getBehaviours=function(c){if(c){for(var d={},o=0;o<c.length;o++)this.$behaviours[c[o]]&&(d[c[o]]=this.$behaviours[c[o]]);return d}else return this.$behaviours}}.call(s.prototype),l.Behaviour=s}),ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(i,l,v){var s=i("./range").Range,c=function(){function d(o,p,e){this.$session=o,this.$row=p,this.$rowTokens=o.getTokens(p);var t=o.getTokenAt(p,e);this.$tokenIndex=t?t.index:-1}return d.prototype.stepBackward=function(){for(this.$tokenIndex-=1;this.$tokenIndex<0;){if(this.$row-=1,this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},d.prototype.stepForward=function(){this.$tokenIndex+=1;for(var o;this.$tokenIndex>=this.$rowTokens.length;){if(this.$row+=1,o||(o=this.$session.getLength()),this.$row>=o)return this.$row=o-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},d.prototype.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},d.prototype.getCurrentTokenRow=function(){return this.$row},d.prototype.getCurrentTokenColumn=function(){var o=this.$rowTokens,p=this.$tokenIndex,e=o[p].start;if(e!==void 0)return e;for(e=0;p>0;)p-=1,e+=o[p].value.length;return e},d.prototype.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},d.prototype.getCurrentTokenRange=function(){var o=this.$rowTokens[this.$tokenIndex],p=this.getCurrentTokenColumn();return new s(this.$row,p,this.$row,p+o.value.length)},d}();l.TokenIterator=c}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(i,l,v){var s=i("../../lib/oop"),c=i("../behaviour").Behaviour,d=i("../../token_iterator").TokenIterator,o=i("../../lib/lang"),p=["text","paren.rparen","rparen","paren","punctuation.operator"],e=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],t,r={},h={'"':'"',"'":"'"},a=function(m){var y=-1;if(m.multiSelect&&(y=m.selection.index,r.rangeCount!=m.multiSelect.rangeCount&&(r={rangeCount:m.multiSelect.rangeCount})),r[y])return t=r[y];t=r[y]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},u=function(m,y,x,E){var w=m.end.row-m.start.row;return{text:x+y+E,selection:[0,m.start.column+1,w,m.end.column+(w?0:1)]}},f;f=function(m){m=m||{},this.add("braces","insertion",function(y,x,E,w,g){var S=E.getCursorPosition(),k=w.doc.getLine(S.row);if(g=="{"){a(E);var D=E.getSelectionRange(),_=w.doc.getTextRange(D),F=w.getTokenAt(S.row,S.column);if(_!==""&&_!=="{"&&E.getWrapBehavioursEnabled())return u(D,_,"{","}");if(F&&/(?:string)\.quasi|\.xml/.test(F.type)){var A=[/tag\-(?:open|name)/,/attribute\-name/];return A.some(function(N){return N.test(F.type)})||/(string)\.quasi/.test(F.type)&&F.value[S.column-F.start-1]!=="$"?void 0:(f.recordAutoInsert(E,w,"}"),{text:"{}",selection:[1,1]})}else if(f.isSaneInsertion(E,w))return/[\]\}\)]/.test(k[S.column])||E.inMultiSelectMode||m.braces?(f.recordAutoInsert(E,w,"}"),{text:"{}",selection:[1,1]}):(f.recordMaybeInsert(E,w,"{"),{text:"{",selection:[1,1]})}else if(g=="}"){a(E);var $=k.substring(S.column,S.column+1);if($=="}"){var C=w.$findOpeningBracket("}",{column:S.column+1,row:S.row});if(C!==null&&f.isAutoInsertedClosing(S,k,g))return f.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else if(g==`
|
|
194
194
|
`||g==`\r
|
|
195
|
-
`){a(E);var
|
|
195
|
+
`){a(E);var b="";f.isMaybeInsertedClosing(S,k)&&(b=o.stringRepeat("}",t.maybeInsertedBrackets),f.clearMaybeInsertedClosing());var $=k.substring(S.column,S.column+1);if($==="}"){var T=w.findMatchingBracket({row:S.row,column:S.column+1},"}");if(!T)return null;var I=this.$getIndent(w.getLine(T.row))}else if(b)var I=this.$getIndent(k);else{f.clearMaybeInsertedClosing();return}var O=I+w.getTabString();return{text:`
|
|
196
196
|
`+O+`
|
|
197
|
-
`+I+
|
|
197
|
+
`+I+b,selection:[1,O.length,1,O.length]}}else f.clearMaybeInsertedClosing()}),this.add("braces","deletion",function(y,x,E,w,g){var S=w.doc.getTextRange(g);if(!g.isMultiLine()&&S=="{"){a(E);var k=w.doc.getLine(g.start.row),D=k.substring(g.end.column,g.end.column+1);if(D=="}")return g.end.column++,g;t.maybeInsertedBrackets--}}),this.add("parens","insertion",function(y,x,E,w,g){if(g=="("){a(E);var S=E.getSelectionRange(),k=w.doc.getTextRange(S);if(k!==""&&E.getWrapBehavioursEnabled())return u(S,k,"(",")");if(f.isSaneInsertion(E,w))return f.recordAutoInsert(E,w,")"),{text:"()",selection:[1,1]}}else if(g==")"){a(E);var D=E.getCursorPosition(),_=w.doc.getLine(D.row),F=_.substring(D.column,D.column+1);if(F==")"){var A=w.$findOpeningBracket(")",{column:D.column+1,row:D.row});if(A!==null&&f.isAutoInsertedClosing(D,_,g))return f.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(y,x,E,w,g){var S=w.doc.getTextRange(g);if(!g.isMultiLine()&&S=="("){a(E);var k=w.doc.getLine(g.start.row),D=k.substring(g.start.column+1,g.start.column+2);if(D==")")return g.end.column++,g}}),this.add("brackets","insertion",function(y,x,E,w,g){if(g=="["){a(E);var S=E.getSelectionRange(),k=w.doc.getTextRange(S);if(k!==""&&E.getWrapBehavioursEnabled())return u(S,k,"[","]");if(f.isSaneInsertion(E,w))return f.recordAutoInsert(E,w,"]"),{text:"[]",selection:[1,1]}}else if(g=="]"){a(E);var D=E.getCursorPosition(),_=w.doc.getLine(D.row),F=_.substring(D.column,D.column+1);if(F=="]"){var A=w.$findOpeningBracket("]",{column:D.column+1,row:D.row});if(A!==null&&f.isAutoInsertedClosing(D,_,g))return f.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(y,x,E,w,g){var S=w.doc.getTextRange(g);if(!g.isMultiLine()&&S=="["){a(E);var k=w.doc.getLine(g.start.row),D=k.substring(g.start.column+1,g.start.column+2);if(D=="]")return g.end.column++,g}}),this.add("string_dquotes","insertion",function(y,x,E,w,g){var S=w.$mode.$quotes||h;if(g.length==1&&S[g]){if(this.lineCommentStart&&this.lineCommentStart.indexOf(g)!=-1)return;a(E);var k=g,D=E.getSelectionRange(),_=w.doc.getTextRange(D);if(_!==""&&(_.length!=1||!S[_])&&E.getWrapBehavioursEnabled())return u(D,_,k,k);if(!_){var F=E.getCursorPosition(),A=w.doc.getLine(F.row),$=A.substring(F.column-1,F.column),C=A.substring(F.column,F.column+1),b=w.getTokenAt(F.row,F.column),T=w.getTokenAt(F.row,F.column+1);if($=="\\"&&b&&/escape/.test(b.type))return null;var I=b&&/string|escape/.test(b.type),O=!T||/string|escape/.test(T.type),N;if(C==k)N=I!==O,N&&/string\.end/.test(T.type)&&(N=!1);else{if(I&&!O||I&&O)return null;var P=w.$mode.tokenRe;P.lastIndex=0;var B=P.test($);P.lastIndex=0;var V=P.test(C),W=w.$mode.$pairQuotesAfter,z=W&&W[k]&&W[k].test($);if(!z&&B||V||C&&!/[\s;,.})\]\\]/.test(C))return null;var U=A[F.column-2];if($==k&&(U==k||P.test(U)))return null;N=!0}return{text:N?k+k:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(y,x,E,w,g){var S=w.$mode.$quotes||h,k=w.doc.getTextRange(g);if(!g.isMultiLine()&&S.hasOwnProperty(k)){a(E);var D=w.doc.getLine(g.start.row),_=D.substring(g.start.column+1,g.start.column+2);if(_==k)return g.end.column++,g}}),m.closeDocComment!==!1&&this.add("doc comment end","insertion",function(y,x,E,w,g){if(y==="doc-start"&&(g===`
|
|
198
198
|
`||g===`\r
|
|
199
|
-
`)&&E.selection.isEmpty()){var S=E.getCursorPosition();if(S.column===0)return;for(var k=b.doc.getLine(S.row),D=b.doc.getLine(S.row+1),_=b.getTokens(S.row),F=0,A=0;A<_.length;A++){F+=_[A].value.length;var $=_[A];if(F>=S.column){if(F===S.column){if(!/\.doc/.test($.type))return;if(/\*\//.test($.value)){var w=_[A+1];if(!w||!/\.doc/.test(w.type))return}}var C=S.column-(F-$.value.length),T=$.value.indexOf("*/"),I=$.value.indexOf("/**",T>-1?T+2:0);if(I!==-1&&C>I&&C<I+3||T!==-1&&I!==-1&&C>=T&&C<=I||!/\.doc/.test($.type))return;break}}var O=this.$getIndent(k);if(/\s*\*/.test(D))return/^\s*\*/.test(k)?{text:g+O+"* ",selection:[1,2+O.length,1,2+O.length]}:{text:g+O+" * ",selection:[1,3+O.length,1,3+O.length]};if(/\/\*\*/.test(k.substring(0,S.column)))return{text:g+O+" * "+g+" "+O+"*/",selection:[1,4+O.length,1,4+O.length]}}})},f.isSaneInsertion=function(m,y){var x=m.getCursorPosition(),E=new d(y,x.row,x.column);if(!this.$matchTokenType(E.getCurrentToken()||"text",p)){if(/[)}\]]/.test(m.session.getLine(x.row)[x.column]))return!0;var b=new d(y,x.row,x.column+1);if(!this.$matchTokenType(b.getCurrentToken()||"text",p))return!1}return E.stepForward(),E.getCurrentTokenRow()!==x.row||this.$matchTokenType(E.getCurrentToken()||"text",e)},f.$matchTokenType=function(m,y){return y.indexOf(m.type||m)>-1},f.recordAutoInsert=function(m,y,x){var E=m.getCursorPosition(),b=y.doc.getLine(E.row);this.isAutoInsertedClosing(E,b,t.autoInsertedLineEnd[0])||(t.autoInsertedBrackets=0),t.autoInsertedRow=E.row,t.autoInsertedLineEnd=x+b.substr(E.column),t.autoInsertedBrackets++},f.recordMaybeInsert=function(m,y,x){var E=m.getCursorPosition(),b=y.doc.getLine(E.row);this.isMaybeInsertedClosing(E,b)||(t.maybeInsertedBrackets=0),t.maybeInsertedRow=E.row,t.maybeInsertedLineStart=b.substr(0,E.column)+x,t.maybeInsertedLineEnd=b.substr(E.column),t.maybeInsertedBrackets++},f.isAutoInsertedClosing=function(m,y,x){return t.autoInsertedBrackets>0&&m.row===t.autoInsertedRow&&x===t.autoInsertedLineEnd[0]&&y.substr(m.column)===t.autoInsertedLineEnd},f.isMaybeInsertedClosing=function(m,y){return t.maybeInsertedBrackets>0&&m.row===t.maybeInsertedRow&&y.substr(m.column)===t.maybeInsertedLineEnd&&y.substr(0,m.column)==t.maybeInsertedLineStart},f.popAutoInsertedClosing=function(){t.autoInsertedLineEnd=t.autoInsertedLineEnd.substr(1),t.autoInsertedBrackets--},f.clearMaybeInsertedClosing=function(){t&&(t.maybeInsertedBrackets=0,t.maybeInsertedRow=-1)},s.inherits(f,c),l.CstyleBehaviour=f}),ace.define("ace/unicode",["require","exports","module"],function(i,l,v){for(var s=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],c=0,d=[],o=0;o<s.length;o+=2)d.push(c+=s[o]),s[o+1]&&d.push(45,c+=s[o+1]);l.wordChars=String.fromCharCode.apply(null,d)}),ace.define("ace/mode/text",["require","exports","module","ace/config","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour/cstyle","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],function(i,l,v){var s=i("../config"),c=i("../tokenizer").Tokenizer,d=i("./text_highlight_rules").TextHighlightRules,o=i("./behaviour/cstyle").CstyleBehaviour,p=i("../unicode"),e=i("../lib/lang"),t=i("../token_iterator").TokenIterator,r=i("../range").Range,h;h=function(){this.HighlightRules=d},function(){this.$defaultBehaviour=new o,this.tokenRe=new RegExp("^["+p.wordChars+"\\$_]+","g"),this.nonTokenRe=new RegExp("^(?:[^"+p.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new c(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(a,u,f,m){var y=u.doc,x=!0,E=!0,b=1/0,g=u.getTabSize(),S=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var _=this.lineCommentStart.map(e.escapeRegExp).join("|"),k=this.lineCommentStart[0];else var _=e.escapeRegExp(this.lineCommentStart),k=this.lineCommentStart;_=new RegExp("^(\\s*)(?:"+_+") ?"),S=u.getUseSoftTabs();var $=function(V,W){var z=V.match(_);if(z){var U=z[1].length,G=z[0].length;!T(V,U,G)&&z[0][G-1]==" "&&G--,y.removeInLine(W,U,G)}},C=k+" ",A=function(V,W){(!x||/\S/.test(V))&&(T(V,b,b)?y.insertInLine({row:W,column:b},C):y.insertInLine({row:W,column:b},k))},w=function(V,W){return _.test(V)},T=function(V,W,z){for(var U=0;W--&&V.charAt(W)==" ";)U++;if(U%g!=0)return!1;for(var U=0;V.charAt(z++)==" ";)U++;return g>2?U%g!=g-1:U%g==0}}else{if(!this.blockComment)return!1;var k=this.blockComment.start,D=this.blockComment.end,_=new RegExp("^(\\s*)(?:"+e.escapeRegExp(k)+")"),F=new RegExp("(?:"+e.escapeRegExp(D)+")\\s*$"),A=function(R,P){w(R,P)||(!x||/\S/.test(R))&&(y.insertInLine({row:P,column:R.length},D),y.insertInLine({row:P,column:b},k))},$=function(R,P){var B;(B=R.match(F))&&y.removeInLine(P,R.length-B[0].length,R.length),(B=R.match(_))&&y.removeInLine(P,B[1].length,B[0].length)},w=function(R,P){if(_.test(R))return!0;for(var B=u.getTokens(P),V=0;V<B.length;V++)if(B[V].type==="comment")return!0}}function I(R){for(var P=f;P<=m;P++)R(y.getLine(P),P)}var O=1/0;I(function(R,P){var B=R.search(/\S/);B!==-1?(B<b&&(b=B),E&&!w(R,P)&&(E=!1)):O>R.length&&(O=R.length)}),b==1/0&&(b=O,x=!1,E=!1),S&&b%g!=0&&(b=Math.floor(b/g)*g),I(E?$:A)},this.toggleBlockComment=function(a,u,f,m){var y=this.blockComment;if(y){!y.start&&y[0]&&(y=y[0]);var x=new t(u,m.row,m.column),E=x.getCurrentToken();u.selection;var b=u.selection.toOrientedRange(),g,S;if(E&&/comment/.test(E.type)){for(var k,D;E&&/comment/.test(E.type);){var _=E.value.indexOf(y.start);if(_!=-1){var F=x.getCurrentTokenRow(),A=x.getCurrentTokenColumn()+_;k=new r(F,A,F,A+y.start.length);break}E=x.stepBackward()}for(var x=new t(u,m.row,m.column),E=x.getCurrentToken();E&&/comment/.test(E.type);){var _=E.value.indexOf(y.end);if(_!=-1){var F=x.getCurrentTokenRow(),A=x.getCurrentTokenColumn()+_;D=new r(F,A,F,A+y.end.length);break}E=x.stepForward()}D&&u.remove(D),k&&(u.remove(k),g=k.start.row,S=-y.start.length)}else S=y.start.length,g=f.start.row,u.insert(f.end,y.end),u.insert(f.start,y.start);b.start.row==g&&(b.start.column+=S),b.end.row==g&&(b.end.column+=S),u.selection.fromOrientedRange(b)}},this.getNextLineIndent=function(a,u,f){return this.$getIndent(u)},this.checkOutdent=function(a,u,f){return!1},this.autoOutdent=function(a,u,f){},this.$getIndent=function(a){return a.match(/^\s*/)[0]},this.createWorker=function(a){return null},this.createModeDelegates=function(a){this.$embeds=[],this.$modes={};for(var u in a)if(a[u]){var f=a[u],m=f.prototype.$id,y=s.$modes[m];y||(s.$modes[m]=y=new f),s.$modes[u]||(s.$modes[u]=y),this.$embeds.push(u),this.$modes[u]=y}for(var x=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],E=function(g){(function(S){var k=x[g],D=S[k];S[x[g]]=function(){return this.$delegator(k,arguments,D)}})(b)},b=this,u=0;u<x.length;u++)E(u)},this.$delegator=function(a,u,f){var m=u[0]||"start";if(typeof m!="string"){if(Array.isArray(m[2])){var y=m[2][m[2].length-1],x=this.$modes[y];if(x)return x[a].apply(x,[m[1]].concat([].slice.call(u,1)))}m=m[0]||"start"}for(var E=0;E<this.$embeds.length;E++)if(this.$modes[this.$embeds[E]]){var b=m.split(this.$embeds[E]);if(!b[0]&&b[1]){u[0]=b[1];var x=this.$modes[this.$embeds[E]];return x[a].apply(x,u)}}var g=f.apply(this,u);return f?g:void 0},this.transformAction=function(a,u,f,m,y){if(this.$behaviour){var x=this.$behaviour.getBehaviours();for(var E in x)if(x[E][u]){var b=x[E][u].apply(this,arguments);if(b)return b}}},this.getKeywords=function(a){if(!this.completionKeywords){var u=this.$tokenizer.rules,f=[];for(var m in u)for(var y=u[m],x=0,E=y.length;x<E;x++)if(typeof y[x].token=="string")/keyword|support|storage/.test(y[x].token)&&f.push(y[x].regex);else if(typeof y[x].token=="object"){for(var b=0,g=y[x].token.length;b<g;b++)if(/keyword|support|storage/.test(y[x].token[b])){var m=y[x].regex.match(/\(.+?\)/g)[b];f.push(m.substr(1,m.length-2))}}this.completionKeywords=f}return a?f.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(a,u,f,m){var y=this.$keywordList||this.$createKeywordList();return y.map(function(x){return{name:x,value:x,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}.call(h.prototype),l.Mode=h}),ace.define("ace/line_widgets",["require","exports","module","ace/lib/dom"],function(i,l,v){var s=i("./lib/dom"),c=function(){function d(o){this.session=o,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeFold",this.updateOnFold),this.session.on("changeEditor",this.$onChangeEditor)}return d.prototype.getRowLength=function(o){var p;return this.lineWidgets?p=this.lineWidgets[o]&&this.lineWidgets[o].rowCount||0:p=0,!this.$useWrapMode||!this.$wrapData[o]?1+p:this.$wrapData[o].length+1+p},d.prototype.$getWidgetScreenLength=function(){var o=0;return this.lineWidgets.forEach(function(p){p&&p.rowCount&&!p.hidden&&(o+=p.rowCount)}),o},d.prototype.$onChangeEditor=function(o){this.attach(o.editor)},d.prototype.attach=function(o){o&&o.widgetManager&&o.widgetManager!=this&&o.widgetManager.detach(),this.editor!=o&&(this.detach(),this.editor=o,o&&(o.widgetManager=this,o.renderer.on("beforeRender",this.measureWidgets),o.renderer.on("afterRender",this.renderWidgets)))},d.prototype.detach=function(o){var p=this.editor;if(p){this.editor=null,p.widgetManager=null,p.renderer.off("beforeRender",this.measureWidgets),p.renderer.off("afterRender",this.renderWidgets);var e=this.session.lineWidgets;e&&e.forEach(function(t){t&&t.el&&t.el.parentNode&&(t._inDocument=!1,t.el.parentNode.removeChild(t.el))})}},d.prototype.updateOnFold=function(o,p){var e=p.lineWidgets;if(!(!e||!o.action)){for(var t=o.data,r=t.start.row,h=t.end.row,a=o.action=="add",u=r+1;u<h;u++)e[u]&&(e[u].hidden=a);e[h]&&(a?e[r]?e[h].hidden=a:e[r]=e[h]:(e[r]==e[h]&&(e[r]=void 0),e[h].hidden=a))}},d.prototype.updateOnChange=function(o){var p=this.session.lineWidgets;if(p){var e=o.start.row,t=o.end.row-e;if(t!==0)if(o.action=="remove"){var r=p.splice(e+1,t);!p[e]&&r[r.length-1]&&(p[e]=r.pop()),r.forEach(function(a){a&&this.removeLineWidget(a)},this),this.$updateRows()}else{var h=new Array(t);p[e]&&p[e].column!=null&&o.start.column>p[e].column&&e++,h.unshift(e,0),p.splice.apply(p,h),this.$updateRows()}}},d.prototype.$updateRows=function(){var o=this.session.lineWidgets;if(o){var p=!0;o.forEach(function(e,t){if(e)for(p=!1,e.row=t;e.$oldWidget;)e.$oldWidget.row=t,e=e.$oldWidget}),p&&(this.session.lineWidgets=null)}},d.prototype.$registerLineWidget=function(o){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength()));var p=this.session.lineWidgets[o.row];return p&&(o.$oldWidget=p,p.el&&p.el.parentNode&&(p.el.parentNode.removeChild(p.el),p._inDocument=!1)),this.session.lineWidgets[o.row]=o,o},d.prototype.addLineWidget=function(o){if(this.$registerLineWidget(o),o.session=this.session,!this.editor)return o;var p=this.editor.renderer;o.html&&!o.el&&(o.el=s.createElement("div"),o.el.innerHTML=o.html),o.text&&!o.el&&(o.el=s.createElement("div"),o.el.textContent=o.text),o.el&&(s.addCssClass(o.el,"ace_lineWidgetContainer"),o.className&&s.addCssClass(o.el,o.className),o.el.style.position="absolute",o.el.style.zIndex="5",p.container.appendChild(o.el),o._inDocument=!0,o.coverGutter||(o.el.style.zIndex="3"),o.pixelHeight==null&&(o.pixelHeight=o.el.offsetHeight)),o.rowCount==null&&(o.rowCount=o.pixelHeight/p.layerConfig.lineHeight);var e=this.session.getFoldAt(o.row,0);if(o.$fold=e,e){var t=this.session.lineWidgets;o.row==e.end.row&&!t[e.start.row]?t[e.start.row]=o:o.hidden=!0}return this.session._emit("changeFold",{data:{start:{row:o.row}}}),this.$updateRows(),this.renderWidgets(null,p),this.onWidgetChanged(o),o},d.prototype.removeLineWidget=function(o){if(o._inDocument=!1,o.session=null,o.el&&o.el.parentNode&&o.el.parentNode.removeChild(o.el),o.editor&&o.editor.destroy)try{o.editor.destroy()}catch{}if(this.session.lineWidgets){var p=this.session.lineWidgets[o.row];if(p==o)this.session.lineWidgets[o.row]=o.$oldWidget,o.$oldWidget&&this.onWidgetChanged(o.$oldWidget);else for(;p;){if(p.$oldWidget==o){p.$oldWidget=o.$oldWidget;break}p=p.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:o.row}}}),this.$updateRows()},d.prototype.getWidgetsAtRow=function(o){for(var p=this.session.lineWidgets,e=p&&p[o],t=[];e;)t.push(e),e=e.$oldWidget;return t},d.prototype.onWidgetChanged=function(o){this.session._changedWidgets.push(o),this.editor&&this.editor.renderer.updateFull()},d.prototype.measureWidgets=function(o,p){var e=this.session._changedWidgets,t=p.layerConfig;if(!(!e||!e.length)){for(var r=1/0,h=0;h<e.length;h++){var a=e[h];if(!(!a||!a.el)&&a.session==this.session){if(!a._inDocument){if(this.session.lineWidgets[a.row]!=a)continue;a._inDocument=!0,p.container.appendChild(a.el)}a.h=a.el.offsetHeight,a.fixedWidth||(a.w=a.el.offsetWidth,a.screenWidth=Math.ceil(a.w/t.characterWidth));var u=a.h/t.lineHeight;a.coverLine&&(u-=this.session.getRowLineCount(a.row),u<0&&(u=0)),a.rowCount!=u&&(a.rowCount=u,a.row<r&&(r=a.row))}}r!=1/0&&(this.session._emit("changeFold",{data:{start:{row:r}}}),this.session.lineWidgetWidth=null),this.session._changedWidgets=[]}},d.prototype.renderWidgets=function(o,p){var e=p.layerConfig,t=this.session.lineWidgets;if(t){for(var r=Math.min(this.firstRow,e.firstRow),h=Math.max(this.lastRow,e.lastRow,t.length);r>0&&!t[r];)r--;this.firstRow=e.firstRow,this.lastRow=e.lastRow,p.$cursorLayer.config=e;for(var a=r;a<=h;a++){var u=t[a];if(!(!u||!u.el)){if(u.hidden){u.el.style.top=-100-(u.pixelHeight||0)+"px";continue}u._inDocument||(u._inDocument=!0,p.container.appendChild(u.el));var f=p.$cursorLayer.getPixelPosition({row:a,column:0},!0).top;u.coverLine||(f+=e.lineHeight*this.session.getRowLineCount(u.row)),u.el.style.top=f-e.offset+"px";var m=u.coverGutter?0:p.gutterWidth;u.fixedWidth||(m-=p.scrollLeft),u.el.style.left=m+"px",u.fullWidth&&u.screenWidth&&(u.el.style.minWidth=e.width+2*e.padding+"px"),u.fixedWidth?u.el.style.right=p.scrollBar.getWidth()+"px":u.el.style.right=""}}}},d}();l.LineWidgets=c}),ace.define("ace/apply_delta",["require","exports","module"],function(i,l,v){l.applyDelta=function(s,c,d){var o=c.start.row,p=c.start.column,e=s[o]||"";switch(c.action){case"insert":var t=c.lines;if(t.length===1)s[o]=e.substring(0,p)+c.lines[0]+e.substring(p);else{var r=[o,1].concat(c.lines);s.splice.apply(s,r),s[o]=e.substring(0,p)+s[o],s[o+c.lines.length-1]+=e.substring(p)}break;case"remove":var h=c.end.column,a=c.end.row;o===a?s[o]=e.substring(0,p)+e.substring(h):s.splice(o,a-o+1,e.substring(0,p)+s[a].substring(h));break}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(i,l,v){var s=i("./lib/oop"),c=i("./lib/event_emitter").EventEmitter,d=function(){function e(t,r,h){this.$onChange=this.onChange.bind(this),this.attach(t),typeof r!="number"?this.setPosition(r.row,r.column):this.setPosition(r,h)}return e.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},e.prototype.getDocument=function(){return this.document},e.prototype.onChange=function(t){if(!(t.start.row==t.end.row&&t.start.row!=this.row)&&!(t.start.row>this.row)){var r=p(t,{row:this.row,column:this.column},this.$insertRight);this.setPosition(r.row,r.column,!0)}},e.prototype.setPosition=function(t,r,h){var a;if(h?a={row:t,column:r}:a=this.$clipPositionToDocument(t,r),!(this.row==a.row&&this.column==a.column)){var u={row:this.row,column:this.column};this.row=a.row,this.column=a.column,this._signal("change",{old:u,value:a})}},e.prototype.detach=function(){this.document.off("change",this.$onChange)},e.prototype.attach=function(t){this.document=t||this.document,this.document.on("change",this.$onChange)},e.prototype.$clipPositionToDocument=function(t,r){var h={};return t>=this.document.getLength()?(h.row=Math.max(0,this.document.getLength()-1),h.column=this.document.getLine(h.row).length):t<0?(h.row=0,h.column=0):(h.row=t,h.column=Math.min(this.document.getLine(h.row).length,Math.max(0,r))),r<0&&(h.column=0),h},e}();d.prototype.$insertRight=!1,s.implement(d.prototype,c);function o(e,t,r){var h=r?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&h}function p(e,t,r){var h=e.action=="insert",a=(h?1:-1)*(e.end.row-e.start.row),u=(h?1:-1)*(e.end.column-e.start.column),f=e.start,m=h?f:e.end;return o(t,f,r)?{row:t.row,column:t.column}:o(m,t,!r)?{row:t.row+a,column:t.column+(t.row==m.row?u:0)}:{row:f.row,column:f.column}}l.Anchor=d}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(i,l,v){var s=i("./lib/oop"),c=i("./apply_delta").applyDelta,d=i("./lib/event_emitter").EventEmitter,o=i("./range").Range,p=i("./anchor").Anchor,e=function(){function t(r){this.$lines=[""],r.length===0?this.$lines=[""]:Array.isArray(r)?this.insertMergedLines({row:0,column:0},r):this.insert({row:0,column:0},r)}return t.prototype.setValue=function(r){var h=this.getLength()-1;this.remove(new o(0,0,h,this.getLine(h).length)),this.insert({row:0,column:0},r||"")},t.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},t.prototype.createAnchor=function(r,h){return new p(this,r,h)},t.prototype.$detectNewLine=function(r){var h=r.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=h?h[1]:`
|
|
199
|
+
`)&&E.selection.isEmpty()){var S=E.getCursorPosition();if(S.column===0)return;for(var k=w.doc.getLine(S.row),D=w.doc.getLine(S.row+1),_=w.getTokens(S.row),F=0,A=0;A<_.length;A++){F+=_[A].value.length;var $=_[A];if(F>=S.column){if(F===S.column){if(!/\.doc/.test($.type))return;if(/\*\//.test($.value)){var C=_[A+1];if(!C||!/\.doc/.test(C.type))return}}var b=S.column-(F-$.value.length),T=$.value.indexOf("*/"),I=$.value.indexOf("/**",T>-1?T+2:0);if(I!==-1&&b>I&&b<I+3||T!==-1&&I!==-1&&b>=T&&b<=I||!/\.doc/.test($.type))return;break}}var O=this.$getIndent(k);if(/\s*\*/.test(D))return/^\s*\*/.test(k)?{text:g+O+"* ",selection:[1,2+O.length,1,2+O.length]}:{text:g+O+" * ",selection:[1,3+O.length,1,3+O.length]};if(/\/\*\*/.test(k.substring(0,S.column)))return{text:g+O+" * "+g+" "+O+"*/",selection:[1,4+O.length,1,4+O.length]}}})},f.isSaneInsertion=function(m,y){var x=m.getCursorPosition(),E=new d(y,x.row,x.column);if(!this.$matchTokenType(E.getCurrentToken()||"text",p)){if(/[)}\]]/.test(m.session.getLine(x.row)[x.column]))return!0;var w=new d(y,x.row,x.column+1);if(!this.$matchTokenType(w.getCurrentToken()||"text",p))return!1}return E.stepForward(),E.getCurrentTokenRow()!==x.row||this.$matchTokenType(E.getCurrentToken()||"text",e)},f.$matchTokenType=function(m,y){return y.indexOf(m.type||m)>-1},f.recordAutoInsert=function(m,y,x){var E=m.getCursorPosition(),w=y.doc.getLine(E.row);this.isAutoInsertedClosing(E,w,t.autoInsertedLineEnd[0])||(t.autoInsertedBrackets=0),t.autoInsertedRow=E.row,t.autoInsertedLineEnd=x+w.substr(E.column),t.autoInsertedBrackets++},f.recordMaybeInsert=function(m,y,x){var E=m.getCursorPosition(),w=y.doc.getLine(E.row);this.isMaybeInsertedClosing(E,w)||(t.maybeInsertedBrackets=0),t.maybeInsertedRow=E.row,t.maybeInsertedLineStart=w.substr(0,E.column)+x,t.maybeInsertedLineEnd=w.substr(E.column),t.maybeInsertedBrackets++},f.isAutoInsertedClosing=function(m,y,x){return t.autoInsertedBrackets>0&&m.row===t.autoInsertedRow&&x===t.autoInsertedLineEnd[0]&&y.substr(m.column)===t.autoInsertedLineEnd},f.isMaybeInsertedClosing=function(m,y){return t.maybeInsertedBrackets>0&&m.row===t.maybeInsertedRow&&y.substr(m.column)===t.maybeInsertedLineEnd&&y.substr(0,m.column)==t.maybeInsertedLineStart},f.popAutoInsertedClosing=function(){t.autoInsertedLineEnd=t.autoInsertedLineEnd.substr(1),t.autoInsertedBrackets--},f.clearMaybeInsertedClosing=function(){t&&(t.maybeInsertedBrackets=0,t.maybeInsertedRow=-1)},s.inherits(f,c),l.CstyleBehaviour=f}),ace.define("ace/unicode",["require","exports","module"],function(i,l,v){for(var s=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],c=0,d=[],o=0;o<s.length;o+=2)d.push(c+=s[o]),s[o+1]&&d.push(45,c+=s[o+1]);l.wordChars=String.fromCharCode.apply(null,d)}),ace.define("ace/mode/text",["require","exports","module","ace/config","ace/tokenizer","ace/mode/text_highlight_rules","ace/mode/behaviour/cstyle","ace/unicode","ace/lib/lang","ace/token_iterator","ace/range"],function(i,l,v){var s=i("../config"),c=i("../tokenizer").Tokenizer,d=i("./text_highlight_rules").TextHighlightRules,o=i("./behaviour/cstyle").CstyleBehaviour,p=i("../unicode"),e=i("../lib/lang"),t=i("../token_iterator").TokenIterator,r=i("../range").Range,h;h=function(){this.HighlightRules=d},function(){this.$defaultBehaviour=new o,this.tokenRe=new RegExp("^["+p.wordChars+"\\$_]+","g"),this.nonTokenRe=new RegExp("^(?:[^"+p.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new c(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(a,u,f,m){var y=u.doc,x=!0,E=!0,w=1/0,g=u.getTabSize(),S=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var _=this.lineCommentStart.map(e.escapeRegExp).join("|"),k=this.lineCommentStart[0];else var _=e.escapeRegExp(this.lineCommentStart),k=this.lineCommentStart;_=new RegExp("^(\\s*)(?:"+_+") ?"),S=u.getUseSoftTabs();var $=function(V,W){var z=V.match(_);if(z){var U=z[1].length,G=z[0].length;!T(V,U,G)&&z[0][G-1]==" "&&G--,y.removeInLine(W,U,G)}},b=k+" ",A=function(V,W){(!x||/\S/.test(V))&&(T(V,w,w)?y.insertInLine({row:W,column:w},b):y.insertInLine({row:W,column:w},k))},C=function(V,W){return _.test(V)},T=function(V,W,z){for(var U=0;W--&&V.charAt(W)==" ";)U++;if(U%g!=0)return!1;for(var U=0;V.charAt(z++)==" ";)U++;return g>2?U%g!=g-1:U%g==0}}else{if(!this.blockComment)return!1;var k=this.blockComment.start,D=this.blockComment.end,_=new RegExp("^(\\s*)(?:"+e.escapeRegExp(k)+")"),F=new RegExp("(?:"+e.escapeRegExp(D)+")\\s*$"),A=function(N,P){C(N,P)||(!x||/\S/.test(N))&&(y.insertInLine({row:P,column:N.length},D),y.insertInLine({row:P,column:w},k))},$=function(N,P){var B;(B=N.match(F))&&y.removeInLine(P,N.length-B[0].length,N.length),(B=N.match(_))&&y.removeInLine(P,B[1].length,B[0].length)},C=function(N,P){if(_.test(N))return!0;for(var B=u.getTokens(P),V=0;V<B.length;V++)if(B[V].type==="comment")return!0}}function I(N){for(var P=f;P<=m;P++)N(y.getLine(P),P)}var O=1/0;I(function(N,P){var B=N.search(/\S/);B!==-1?(B<w&&(w=B),E&&!C(N,P)&&(E=!1)):O>N.length&&(O=N.length)}),w==1/0&&(w=O,x=!1,E=!1),S&&w%g!=0&&(w=Math.floor(w/g)*g),I(E?$:A)},this.toggleBlockComment=function(a,u,f,m){var y=this.blockComment;if(y){!y.start&&y[0]&&(y=y[0]);var x=new t(u,m.row,m.column),E=x.getCurrentToken();u.selection;var w=u.selection.toOrientedRange(),g,S;if(E&&/comment/.test(E.type)){for(var k,D;E&&/comment/.test(E.type);){var _=E.value.indexOf(y.start);if(_!=-1){var F=x.getCurrentTokenRow(),A=x.getCurrentTokenColumn()+_;k=new r(F,A,F,A+y.start.length);break}E=x.stepBackward()}for(var x=new t(u,m.row,m.column),E=x.getCurrentToken();E&&/comment/.test(E.type);){var _=E.value.indexOf(y.end);if(_!=-1){var F=x.getCurrentTokenRow(),A=x.getCurrentTokenColumn()+_;D=new r(F,A,F,A+y.end.length);break}E=x.stepForward()}D&&u.remove(D),k&&(u.remove(k),g=k.start.row,S=-y.start.length)}else S=y.start.length,g=f.start.row,u.insert(f.end,y.end),u.insert(f.start,y.start);w.start.row==g&&(w.start.column+=S),w.end.row==g&&(w.end.column+=S),u.selection.fromOrientedRange(w)}},this.getNextLineIndent=function(a,u,f){return this.$getIndent(u)},this.checkOutdent=function(a,u,f){return!1},this.autoOutdent=function(a,u,f){},this.$getIndent=function(a){return a.match(/^\s*/)[0]},this.createWorker=function(a){return null},this.createModeDelegates=function(a){this.$embeds=[],this.$modes={};for(var u in a)if(a[u]){var f=a[u],m=f.prototype.$id,y=s.$modes[m];y||(s.$modes[m]=y=new f),s.$modes[u]||(s.$modes[u]=y),this.$embeds.push(u),this.$modes[u]=y}for(var x=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],E=function(g){(function(S){var k=x[g],D=S[k];S[x[g]]=function(){return this.$delegator(k,arguments,D)}})(w)},w=this,u=0;u<x.length;u++)E(u)},this.$delegator=function(a,u,f){var m=u[0]||"start";if(typeof m!="string"){if(Array.isArray(m[2])){var y=m[2][m[2].length-1],x=this.$modes[y];if(x)return x[a].apply(x,[m[1]].concat([].slice.call(u,1)))}m=m[0]||"start"}for(var E=0;E<this.$embeds.length;E++)if(this.$modes[this.$embeds[E]]){var w=m.split(this.$embeds[E]);if(!w[0]&&w[1]){u[0]=w[1];var x=this.$modes[this.$embeds[E]];return x[a].apply(x,u)}}var g=f.apply(this,u);return f?g:void 0},this.transformAction=function(a,u,f,m,y){if(this.$behaviour){var x=this.$behaviour.getBehaviours();for(var E in x)if(x[E][u]){var w=x[E][u].apply(this,arguments);if(w)return w}}},this.getKeywords=function(a){if(!this.completionKeywords){var u=this.$tokenizer.rules,f=[];for(var m in u)for(var y=u[m],x=0,E=y.length;x<E;x++)if(typeof y[x].token=="string")/keyword|support|storage/.test(y[x].token)&&f.push(y[x].regex);else if(typeof y[x].token=="object"){for(var w=0,g=y[x].token.length;w<g;w++)if(/keyword|support|storage/.test(y[x].token[w])){var m=y[x].regex.match(/\(.+?\)/g)[w];f.push(m.substr(1,m.length-2))}}this.completionKeywords=f}return a?f.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(a,u,f,m){var y=this.$keywordList||this.$createKeywordList();return y.map(function(x){return{name:x,value:x,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}.call(h.prototype),l.Mode=h}),ace.define("ace/line_widgets",["require","exports","module","ace/lib/dom"],function(i,l,v){var s=i("./lib/dom"),c=function(){function d(o){this.session=o,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeFold",this.updateOnFold),this.session.on("changeEditor",this.$onChangeEditor)}return d.prototype.getRowLength=function(o){var p;return this.lineWidgets?p=this.lineWidgets[o]&&this.lineWidgets[o].rowCount||0:p=0,!this.$useWrapMode||!this.$wrapData[o]?1+p:this.$wrapData[o].length+1+p},d.prototype.$getWidgetScreenLength=function(){var o=0;return this.lineWidgets.forEach(function(p){p&&p.rowCount&&!p.hidden&&(o+=p.rowCount)}),o},d.prototype.$onChangeEditor=function(o){this.attach(o.editor)},d.prototype.attach=function(o){o&&o.widgetManager&&o.widgetManager!=this&&o.widgetManager.detach(),this.editor!=o&&(this.detach(),this.editor=o,o&&(o.widgetManager=this,o.renderer.on("beforeRender",this.measureWidgets),o.renderer.on("afterRender",this.renderWidgets)))},d.prototype.detach=function(o){var p=this.editor;if(p){this.editor=null,p.widgetManager=null,p.renderer.off("beforeRender",this.measureWidgets),p.renderer.off("afterRender",this.renderWidgets);var e=this.session.lineWidgets;e&&e.forEach(function(t){t&&t.el&&t.el.parentNode&&(t._inDocument=!1,t.el.parentNode.removeChild(t.el))})}},d.prototype.updateOnFold=function(o,p){var e=p.lineWidgets;if(!(!e||!o.action)){for(var t=o.data,r=t.start.row,h=t.end.row,a=o.action=="add",u=r+1;u<h;u++)e[u]&&(e[u].hidden=a);e[h]&&(a?e[r]?e[h].hidden=a:e[r]=e[h]:(e[r]==e[h]&&(e[r]=void 0),e[h].hidden=a))}},d.prototype.updateOnChange=function(o){var p=this.session.lineWidgets;if(p){var e=o.start.row,t=o.end.row-e;if(t!==0)if(o.action=="remove"){var r=p.splice(e+1,t);!p[e]&&r[r.length-1]&&(p[e]=r.pop()),r.forEach(function(a){a&&this.removeLineWidget(a)},this),this.$updateRows()}else{var h=new Array(t);p[e]&&p[e].column!=null&&o.start.column>p[e].column&&e++,h.unshift(e,0),p.splice.apply(p,h),this.$updateRows()}}},d.prototype.$updateRows=function(){var o=this.session.lineWidgets;if(o){var p=!0;o.forEach(function(e,t){if(e)for(p=!1,e.row=t;e.$oldWidget;)e.$oldWidget.row=t,e=e.$oldWidget}),p&&(this.session.lineWidgets=null)}},d.prototype.$registerLineWidget=function(o){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength()));var p=this.session.lineWidgets[o.row];return p&&(o.$oldWidget=p,p.el&&p.el.parentNode&&(p.el.parentNode.removeChild(p.el),p._inDocument=!1)),this.session.lineWidgets[o.row]=o,o},d.prototype.addLineWidget=function(o){if(this.$registerLineWidget(o),o.session=this.session,!this.editor)return o;var p=this.editor.renderer;o.html&&!o.el&&(o.el=s.createElement("div"),o.el.innerHTML=o.html),o.text&&!o.el&&(o.el=s.createElement("div"),o.el.textContent=o.text),o.el&&(s.addCssClass(o.el,"ace_lineWidgetContainer"),o.className&&s.addCssClass(o.el,o.className),o.el.style.position="absolute",o.el.style.zIndex="5",p.container.appendChild(o.el),o._inDocument=!0,o.coverGutter||(o.el.style.zIndex="3"),o.pixelHeight==null&&(o.pixelHeight=o.el.offsetHeight)),o.rowCount==null&&(o.rowCount=o.pixelHeight/p.layerConfig.lineHeight);var e=this.session.getFoldAt(o.row,0);if(o.$fold=e,e){var t=this.session.lineWidgets;o.row==e.end.row&&!t[e.start.row]?t[e.start.row]=o:o.hidden=!0}return this.session._emit("changeFold",{data:{start:{row:o.row}}}),this.$updateRows(),this.renderWidgets(null,p),this.onWidgetChanged(o),o},d.prototype.removeLineWidget=function(o){if(o._inDocument=!1,o.session=null,o.el&&o.el.parentNode&&o.el.parentNode.removeChild(o.el),o.editor&&o.editor.destroy)try{o.editor.destroy()}catch{}if(this.session.lineWidgets){var p=this.session.lineWidgets[o.row];if(p==o)this.session.lineWidgets[o.row]=o.$oldWidget,o.$oldWidget&&this.onWidgetChanged(o.$oldWidget);else for(;p;){if(p.$oldWidget==o){p.$oldWidget=o.$oldWidget;break}p=p.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:o.row}}}),this.$updateRows()},d.prototype.getWidgetsAtRow=function(o){for(var p=this.session.lineWidgets,e=p&&p[o],t=[];e;)t.push(e),e=e.$oldWidget;return t},d.prototype.onWidgetChanged=function(o){this.session._changedWidgets.push(o),this.editor&&this.editor.renderer.updateFull()},d.prototype.measureWidgets=function(o,p){var e=this.session._changedWidgets,t=p.layerConfig;if(!(!e||!e.length)){for(var r=1/0,h=0;h<e.length;h++){var a=e[h];if(!(!a||!a.el)&&a.session==this.session){if(!a._inDocument){if(this.session.lineWidgets[a.row]!=a)continue;a._inDocument=!0,p.container.appendChild(a.el)}a.h=a.el.offsetHeight,a.fixedWidth||(a.w=a.el.offsetWidth,a.screenWidth=Math.ceil(a.w/t.characterWidth));var u=a.h/t.lineHeight;a.coverLine&&(u-=this.session.getRowLineCount(a.row),u<0&&(u=0)),a.rowCount!=u&&(a.rowCount=u,a.row<r&&(r=a.row))}}r!=1/0&&(this.session._emit("changeFold",{data:{start:{row:r}}}),this.session.lineWidgetWidth=null),this.session._changedWidgets=[]}},d.prototype.renderWidgets=function(o,p){var e=p.layerConfig,t=this.session.lineWidgets;if(t){for(var r=Math.min(this.firstRow,e.firstRow),h=Math.max(this.lastRow,e.lastRow,t.length);r>0&&!t[r];)r--;this.firstRow=e.firstRow,this.lastRow=e.lastRow,p.$cursorLayer.config=e;for(var a=r;a<=h;a++){var u=t[a];if(!(!u||!u.el)){if(u.hidden){u.el.style.top=-100-(u.pixelHeight||0)+"px";continue}u._inDocument||(u._inDocument=!0,p.container.appendChild(u.el));var f=p.$cursorLayer.getPixelPosition({row:a,column:0},!0).top;u.coverLine||(f+=e.lineHeight*this.session.getRowLineCount(u.row)),u.el.style.top=f-e.offset+"px";var m=u.coverGutter?0:p.gutterWidth;u.fixedWidth||(m-=p.scrollLeft),u.el.style.left=m+"px",u.fullWidth&&u.screenWidth&&(u.el.style.minWidth=e.width+2*e.padding+"px"),u.fixedWidth?u.el.style.right=p.scrollBar.getWidth()+"px":u.el.style.right=""}}}},d}();l.LineWidgets=c}),ace.define("ace/apply_delta",["require","exports","module"],function(i,l,v){l.applyDelta=function(s,c,d){var o=c.start.row,p=c.start.column,e=s[o]||"";switch(c.action){case"insert":var t=c.lines;if(t.length===1)s[o]=e.substring(0,p)+c.lines[0]+e.substring(p);else{var r=[o,1].concat(c.lines);s.splice.apply(s,r),s[o]=e.substring(0,p)+s[o],s[o+c.lines.length-1]+=e.substring(p)}break;case"remove":var h=c.end.column,a=c.end.row;o===a?s[o]=e.substring(0,p)+e.substring(h):s.splice(o,a-o+1,e.substring(0,p)+s[a].substring(h));break}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(i,l,v){var s=i("./lib/oop"),c=i("./lib/event_emitter").EventEmitter,d=function(){function e(t,r,h){this.$onChange=this.onChange.bind(this),this.attach(t),typeof r!="number"?this.setPosition(r.row,r.column):this.setPosition(r,h)}return e.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},e.prototype.getDocument=function(){return this.document},e.prototype.onChange=function(t){if(!(t.start.row==t.end.row&&t.start.row!=this.row)&&!(t.start.row>this.row)){var r=p(t,{row:this.row,column:this.column},this.$insertRight);this.setPosition(r.row,r.column,!0)}},e.prototype.setPosition=function(t,r,h){var a;if(h?a={row:t,column:r}:a=this.$clipPositionToDocument(t,r),!(this.row==a.row&&this.column==a.column)){var u={row:this.row,column:this.column};this.row=a.row,this.column=a.column,this._signal("change",{old:u,value:a})}},e.prototype.detach=function(){this.document.off("change",this.$onChange)},e.prototype.attach=function(t){this.document=t||this.document,this.document.on("change",this.$onChange)},e.prototype.$clipPositionToDocument=function(t,r){var h={};return t>=this.document.getLength()?(h.row=Math.max(0,this.document.getLength()-1),h.column=this.document.getLine(h.row).length):t<0?(h.row=0,h.column=0):(h.row=t,h.column=Math.min(this.document.getLine(h.row).length,Math.max(0,r))),r<0&&(h.column=0),h},e}();d.prototype.$insertRight=!1,s.implement(d.prototype,c);function o(e,t,r){var h=r?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&h}function p(e,t,r){var h=e.action=="insert",a=(h?1:-1)*(e.end.row-e.start.row),u=(h?1:-1)*(e.end.column-e.start.column),f=e.start,m=h?f:e.end;return o(t,f,r)?{row:t.row,column:t.column}:o(m,t,!r)?{row:t.row+a,column:t.column+(t.row==m.row?u:0)}:{row:f.row,column:f.column}}l.Anchor=d}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(i,l,v){var s=i("./lib/oop"),c=i("./apply_delta").applyDelta,d=i("./lib/event_emitter").EventEmitter,o=i("./range").Range,p=i("./anchor").Anchor,e=function(){function t(r){this.$lines=[""],r.length===0?this.$lines=[""]:Array.isArray(r)?this.insertMergedLines({row:0,column:0},r):this.insert({row:0,column:0},r)}return t.prototype.setValue=function(r){var h=this.getLength()-1;this.remove(new o(0,0,h,this.getLine(h).length)),this.insert({row:0,column:0},r||"")},t.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},t.prototype.createAnchor=function(r,h){return new p(this,r,h)},t.prototype.$detectNewLine=function(r){var h=r.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=h?h[1]:`
|
|
200
200
|
`,this._signal("changeNewLineMode")},t.prototype.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return`\r
|
|
201
201
|
`;case"unix":return`
|
|
202
202
|
`;default:return this.$autoNewLine||`
|
|
203
203
|
`}},t.prototype.setNewLineMode=function(r){this.$newLineMode!==r&&(this.$newLineMode=r,this._signal("changeNewLineMode"))},t.prototype.getNewLineMode=function(){return this.$newLineMode},t.prototype.isNewLine=function(r){return r==`\r
|
|
204
204
|
`||r=="\r"||r==`
|
|
205
|
-
`},t.prototype.getLine=function(r){return this.$lines[r]||""},t.prototype.getLines=function(r,h){return this.$lines.slice(r,h+1)},t.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},t.prototype.getLength=function(){return this.$lines.length},t.prototype.getTextRange=function(r){return this.getLinesForRange(r).join(this.getNewLineCharacter())},t.prototype.getLinesForRange=function(r){var h;if(r.start.row===r.end.row)h=[this.getLine(r.start.row).substring(r.start.column,r.end.column)];else{h=this.getLines(r.start.row,r.end.row),h[0]=(h[0]||"").substring(r.start.column);var a=h.length-1;r.end.row-r.start.row==a&&(h[a]=h[a].substring(0,r.end.column))}return h},t.prototype.insertLines=function(r,h){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(r,h)},t.prototype.removeLines=function(r,h){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(r,h)},t.prototype.insertNewLine=function(r){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(r,["",""])},t.prototype.insert=function(r,h){return this.getLength()<=1&&this.$detectNewLine(h),this.insertMergedLines(r,this.$split(h))},t.prototype.insertInLine=function(r,h){var a=this.clippedPos(r.row,r.column),u=this.pos(r.row,r.column+h.length);return this.applyDelta({start:a,end:u,action:"insert",lines:[h]},!0),this.clonePos(u)},t.prototype.clippedPos=function(r,h){var a=this.getLength();r===void 0?r=a:r<0?r=0:r>=a&&(r=a-1,h=void 0);var u=this.getLine(r);return h==null&&(h=u.length),h=Math.min(Math.max(h,0),u.length),{row:r,column:h}},t.prototype.clonePos=function(r){return{row:r.row,column:r.column}},t.prototype.pos=function(r,h){return{row:r,column:h}},t.prototype.$clipPosition=function(r){var h=this.getLength();return r.row>=h?(r.row=Math.max(0,h-1),r.column=this.getLine(h-1).length):(r.row=Math.max(0,r.row),r.column=Math.min(Math.max(r.column,0),this.getLine(r.row).length)),r},t.prototype.insertFullLines=function(r,h){r=Math.min(Math.max(r,0),this.getLength());var a=0;r<this.getLength()?(h=h.concat([""]),a=0):(h=[""].concat(h),r--,a=this.$lines[r].length),this.insertMergedLines({row:r,column:a},h)},t.prototype.insertMergedLines=function(r,h){var a=this.clippedPos(r.row,r.column),u={row:a.row+h.length-1,column:(h.length==1?a.column:0)+h[h.length-1].length};return this.applyDelta({start:a,end:u,action:"insert",lines:h}),this.clonePos(u)},t.prototype.remove=function(r){var h=this.clippedPos(r.start.row,r.start.column),a=this.clippedPos(r.end.row,r.end.column);return this.applyDelta({start:h,end:a,action:"remove",lines:this.getLinesForRange({start:h,end:a})}),this.clonePos(h)},t.prototype.removeInLine=function(r,h,a){var u=this.clippedPos(r,h),f=this.clippedPos(r,a);return this.applyDelta({start:u,end:f,action:"remove",lines:this.getLinesForRange({start:u,end:f})},!0),this.clonePos(u)},t.prototype.removeFullLines=function(r,h){r=Math.min(Math.max(0,r),this.getLength()-1),h=Math.min(Math.max(0,h),this.getLength()-1);var a=h==this.getLength()-1&&r>0,u=h<this.getLength()-1,f=a?r-1:r,m=a?this.getLine(f).length:0,y=u?h+1:h,x=u?0:this.getLine(y).length,E=new o(f,m,y,x),b=this.$lines.slice(r,h+1);return this.applyDelta({start:E.start,end:E.end,action:"remove",lines:this.getLinesForRange(E)}),b},t.prototype.removeNewLine=function(r){r<this.getLength()-1&&r>=0&&this.applyDelta({start:this.pos(r,this.getLine(r).length),end:this.pos(r+1,0),action:"remove",lines:["",""]})},t.prototype.replace=function(r,h){if(r instanceof o||(r=o.fromPoints(r.start,r.end)),h.length===0&&r.isEmpty())return r.start;if(h==this.getTextRange(r))return r.end;this.remove(r);var a;return h?a=this.insert(r.start,h):a=r.start,a},t.prototype.applyDeltas=function(r){for(var h=0;h<r.length;h++)this.applyDelta(r[h])},t.prototype.revertDeltas=function(r){for(var h=r.length-1;h>=0;h--)this.revertDelta(r[h])},t.prototype.applyDelta=function(r,h){var a=r.action=="insert";(a?r.lines.length<=1&&!r.lines[0]:!o.comparePoints(r.start,r.end))||(a&&r.lines.length>2e4?this.$splitAndapplyLargeDelta(r,2e4):(c(this.$lines,r,h),this._signal("change",r)))},t.prototype.$safeApplyDelta=function(r){var h=this.$lines.length;(r.action=="remove"&&r.start.row<h&&r.end.row<h||r.action=="insert"&&r.start.row<=h)&&this.applyDelta(r)},t.prototype.$splitAndapplyLargeDelta=function(r,h){for(var a=r.lines,u=a.length-h+1,f=r.start.row,m=r.start.column,y=0,x=0;y<u;y=x){x+=h-1;var E=a.slice(y,x);E.push(""),this.applyDelta({start:this.pos(f+y,m),end:this.pos(f+x,m=0),action:r.action,lines:E},!0)}r.lines=a.slice(y),r.start.row=f+y,r.start.column=m,this.applyDelta(r,!0)},t.prototype.revertDelta=function(r){this.$safeApplyDelta({start:this.clonePos(r.start),end:this.clonePos(r.end),action:r.action=="insert"?"remove":"insert",lines:r.lines.slice()})},t.prototype.indexToPosition=function(r,h){for(var a=this.$lines||this.getAllLines(),u=this.getNewLineCharacter().length,f=h||0,m=a.length;f<m;f++)if(r-=a[f].length+u,r<0)return{row:f,column:r+a[f].length+u};return{row:m-1,column:r+a[m-1].length+u}},t.prototype.positionToIndex=function(r,h){for(var a=this.$lines||this.getAllLines(),u=this.getNewLineCharacter().length,f=0,m=Math.min(r.row,a.length),y=h||0;y<m;++y)f+=a[y].length+u;return f+r.column},t.prototype.$split=function(r){return r.split(/\r\n|\r|\n/)},t}();e.prototype.$autoNewLine="",e.prototype.$newLineMode="auto",s.implement(e.prototype,d),l.Document=e}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(i,l,v){var s=i("./lib/oop"),c=i("./lib/event_emitter").EventEmitter,d=function(){function o(p,e){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=p;var t=this;this.$worker=function(){if(t.running){for(var r=new Date,h=t.currentLine,a=-1,u=t.doc,f=h;t.lines[h];)h++;var m=u.getLength(),y=0;for(t.running=!1;h<m;){t.$tokenizeRow(h),a=h;do h++;while(t.lines[h]);if(y++,y%5===0&&new Date-r>20){t.running=setTimeout(t.$worker,20);break}}t.currentLine=h,a==-1&&(a=h),f<=a&&t.fireUpdateEvent(f,a)}}}return o.prototype.setTokenizer=function(p){this.tokenizer=p,this.lines=[],this.states=[],this.start(0)},o.prototype.setDocument=function(p){this.doc=p,this.lines=[],this.states=[],this.stop()},o.prototype.fireUpdateEvent=function(p,e){var t={first:p,last:e};this._signal("update",{data:t})},o.prototype.start=function(p){this.currentLine=Math.min(p||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},o.prototype.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},o.prototype.$updateOnChange=function(p){var e=p.start.row,t=p.end.row-e;if(t===0)this.lines[e]=null;else if(p.action=="remove")this.lines.splice(e,t+1,null),this.states.splice(e,t+1,null);else{var r=Array(t+1);r.unshift(e,1),this.lines.splice.apply(this.lines,r),this.states.splice.apply(this.states,r)}this.currentLine=Math.min(e,this.currentLine,this.doc.getLength()),this.stop()},o.prototype.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},o.prototype.getTokens=function(p){return this.lines[p]||this.$tokenizeRow(p)},o.prototype.getState=function(p){return this.currentLine==p&&this.$tokenizeRow(p),this.states[p]||"start"},o.prototype.$tokenizeRow=function(p){var e=this.doc.getLine(p),t=this.states[p-1],r=this.tokenizer.getLineTokens(e,t,p);return this.states[p]+""!=r.state+""?(this.states[p]=r.state,this.lines[p+1]=null,this.currentLine>p+1&&(this.currentLine=p+1)):this.currentLine==p&&(this.currentLine=p+1),this.lines[p]=r.tokens},o.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},o}();s.implement(d.prototype,c),l.BackgroundTokenizer=d}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(i,l,v){var s=i("./lib/lang"),c=i("./range").Range,d=function(){function o(p,e,t){t===void 0&&(t="text"),this.setRegexp(p),this.clazz=e,this.type=t,this.docLen=0}return o.prototype.setRegexp=function(p){this.regExp+""!=p+""&&(this.regExp=p,this.cache=[])},o.prototype.update=function(p,e,t,r){if(this.regExp){for(var h=r.firstRow,a=r.lastRow,u={},f=t.$editor&&t.$editor.$search,m=f&&f.$isMultilineSearch(t.$editor.getLastSearchOptions()),y=h;y<=a;y++){var x=this.cache[y];if(x==null||t.getValue().length!=this.docLen){if(m){x=[];var E=f.$multiLineForward(t,this.regExp,y,a);if(E){var b=E.endRow<=a?E.endRow-1:a;b>y&&(y=b),x.push(new c(E.startRow,E.startCol,E.endRow,E.endCol))}x.length>this.MAX_RANGES&&(x=x.slice(0,this.MAX_RANGES))}else x=s.getMatchOffsets(t.getLine(y),this.regExp),x.length>this.MAX_RANGES&&(x=x.slice(0,this.MAX_RANGES)),x=x.map(function(D){return new c(y,D.offset,y,D.offset+D.length)});this.cache[y]=x.length?x:""}if(x.length!==0)for(var g=x.length;g--;){var S=x[g].toScreenRange(t),k=S.toString();u[k]||(u[k]=!0,e.drawSingleLineMarker(p,S,this.clazz,r))}}this.docLen=t.getValue().length}},o}();d.prototype.MAX_RANGES=500,l.SearchHighlight=d}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(i,l,v){var s=function(){function b(){this.$keepRedoStack,this.$maxRev=0,this.$fromUndo=!1,this.$undoDepth=1/0,this.reset()}return b.prototype.addSession=function(g){this.$session=g},b.prototype.add=function(g,S,k){if(!this.$fromUndo&&g!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),S===!1||!this.lastDeltas){this.lastDeltas=[];var D=this.$undoStack.length;D>this.$undoDepth-1&&this.$undoStack.splice(0,D-this.$undoDepth+1),this.$undoStack.push(this.lastDeltas),g.id=this.$rev=++this.$maxRev}(g.action=="remove"||g.action=="insert")&&(this.$lastDelta=g),this.lastDeltas.push(g)}},b.prototype.addSelection=function(g,S){this.selections.push({value:g,rev:S||this.$rev})},b.prototype.startNewGroup=function(){return this.lastDeltas=null,this.$rev},b.prototype.markIgnored=function(g,S){S==null&&(S=this.$rev+1);for(var k=this.$undoStack,D=k.length;D--;){var _=k[D][0];if(_.id<=g)break;_.id<S&&(_.ignore=!0)}this.lastDeltas=null},b.prototype.getSelection=function(g,S){for(var k=this.selections,D=k.length;D--;){var _=k[D];if(_.rev<g)return S&&(_=k[D+1]),_}},b.prototype.getRevision=function(){return this.$rev},b.prototype.getDeltas=function(g,S){S==null&&(S=this.$rev+1);for(var k=this.$undoStack,D=null,_=0,F=k.length;F--;){var A=k[F][0];if(A.id<S&&!D&&(D=F+1),A.id<=g){_=F+1;break}}return k.slice(_,D)},b.prototype.getChangedRanges=function(g,S){S==null&&(S=this.$rev+1)},b.prototype.getChangedLines=function(g,S){S==null&&(S=this.$rev+1)},b.prototype.undo=function(g,S){this.lastDeltas=null;var k=this.$undoStack;if(c(k,k.length)){g||(g=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var D=k.pop(),_=null;return D&&(_=g.undoChanges(D,S),this.$redoStack.push(D),this.$syncRev()),this.$fromUndo=!1,_}},b.prototype.redo=function(g,S){if(this.lastDeltas=null,g||(g=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var k=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);E(this.$redoStack,k),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(F){F[0].id=++this.$maxRev},this)}var D=this.$redoStack.pop(),_=null;return D&&(_=g.redoChanges(D,S),this.$undoStack.push(D),this.$syncRev()),this.$fromUndo=!1,_},b.prototype.$syncRev=function(){var g=this.$undoStack,S=g[g.length-1],k=S&&S[0].id||0;this.$redoStackBaseRev=k,this.$rev=k},b.prototype.reset=function(){this.lastDeltas=null,this.$lastDelta=null,this.$undoStack=[],this.$redoStack=[],this.$rev=0,this.mark=0,this.$redoStackBaseRev=this.$rev,this.selections=[]},b.prototype.canUndo=function(){return this.$undoStack.length>0},b.prototype.canRedo=function(){return this.$redoStack.length>0},b.prototype.bookmark=function(g){g==null&&(g=this.$rev),this.mark=g},b.prototype.isAtBookmark=function(){return this.$rev===this.mark},b.prototype.toJSON=function(){return{$redoStack:this.$redoStack,$undoStack:this.$undoStack}},b.prototype.fromJSON=function(g){this.reset(),this.$undoStack=g.$undoStack,this.$redoStack=g.$redoStack},b.prototype.$prettyPrint=function(g){return g?t(g):t(this.$undoStack)+`
|
|
205
|
+
`},t.prototype.getLine=function(r){return this.$lines[r]||""},t.prototype.getLines=function(r,h){return this.$lines.slice(r,h+1)},t.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},t.prototype.getLength=function(){return this.$lines.length},t.prototype.getTextRange=function(r){return this.getLinesForRange(r).join(this.getNewLineCharacter())},t.prototype.getLinesForRange=function(r){var h;if(r.start.row===r.end.row)h=[this.getLine(r.start.row).substring(r.start.column,r.end.column)];else{h=this.getLines(r.start.row,r.end.row),h[0]=(h[0]||"").substring(r.start.column);var a=h.length-1;r.end.row-r.start.row==a&&(h[a]=h[a].substring(0,r.end.column))}return h},t.prototype.insertLines=function(r,h){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(r,h)},t.prototype.removeLines=function(r,h){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(r,h)},t.prototype.insertNewLine=function(r){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(r,["",""])},t.prototype.insert=function(r,h){return this.getLength()<=1&&this.$detectNewLine(h),this.insertMergedLines(r,this.$split(h))},t.prototype.insertInLine=function(r,h){var a=this.clippedPos(r.row,r.column),u=this.pos(r.row,r.column+h.length);return this.applyDelta({start:a,end:u,action:"insert",lines:[h]},!0),this.clonePos(u)},t.prototype.clippedPos=function(r,h){var a=this.getLength();r===void 0?r=a:r<0?r=0:r>=a&&(r=a-1,h=void 0);var u=this.getLine(r);return h==null&&(h=u.length),h=Math.min(Math.max(h,0),u.length),{row:r,column:h}},t.prototype.clonePos=function(r){return{row:r.row,column:r.column}},t.prototype.pos=function(r,h){return{row:r,column:h}},t.prototype.$clipPosition=function(r){var h=this.getLength();return r.row>=h?(r.row=Math.max(0,h-1),r.column=this.getLine(h-1).length):(r.row=Math.max(0,r.row),r.column=Math.min(Math.max(r.column,0),this.getLine(r.row).length)),r},t.prototype.insertFullLines=function(r,h){r=Math.min(Math.max(r,0),this.getLength());var a=0;r<this.getLength()?(h=h.concat([""]),a=0):(h=[""].concat(h),r--,a=this.$lines[r].length),this.insertMergedLines({row:r,column:a},h)},t.prototype.insertMergedLines=function(r,h){var a=this.clippedPos(r.row,r.column),u={row:a.row+h.length-1,column:(h.length==1?a.column:0)+h[h.length-1].length};return this.applyDelta({start:a,end:u,action:"insert",lines:h}),this.clonePos(u)},t.prototype.remove=function(r){var h=this.clippedPos(r.start.row,r.start.column),a=this.clippedPos(r.end.row,r.end.column);return this.applyDelta({start:h,end:a,action:"remove",lines:this.getLinesForRange({start:h,end:a})}),this.clonePos(h)},t.prototype.removeInLine=function(r,h,a){var u=this.clippedPos(r,h),f=this.clippedPos(r,a);return this.applyDelta({start:u,end:f,action:"remove",lines:this.getLinesForRange({start:u,end:f})},!0),this.clonePos(u)},t.prototype.removeFullLines=function(r,h){r=Math.min(Math.max(0,r),this.getLength()-1),h=Math.min(Math.max(0,h),this.getLength()-1);var a=h==this.getLength()-1&&r>0,u=h<this.getLength()-1,f=a?r-1:r,m=a?this.getLine(f).length:0,y=u?h+1:h,x=u?0:this.getLine(y).length,E=new o(f,m,y,x),w=this.$lines.slice(r,h+1);return this.applyDelta({start:E.start,end:E.end,action:"remove",lines:this.getLinesForRange(E)}),w},t.prototype.removeNewLine=function(r){r<this.getLength()-1&&r>=0&&this.applyDelta({start:this.pos(r,this.getLine(r).length),end:this.pos(r+1,0),action:"remove",lines:["",""]})},t.prototype.replace=function(r,h){if(r instanceof o||(r=o.fromPoints(r.start,r.end)),h.length===0&&r.isEmpty())return r.start;if(h==this.getTextRange(r))return r.end;this.remove(r);var a;return h?a=this.insert(r.start,h):a=r.start,a},t.prototype.applyDeltas=function(r){for(var h=0;h<r.length;h++)this.applyDelta(r[h])},t.prototype.revertDeltas=function(r){for(var h=r.length-1;h>=0;h--)this.revertDelta(r[h])},t.prototype.applyDelta=function(r,h){var a=r.action=="insert";(a?r.lines.length<=1&&!r.lines[0]:!o.comparePoints(r.start,r.end))||(a&&r.lines.length>2e4?this.$splitAndapplyLargeDelta(r,2e4):(c(this.$lines,r,h),this._signal("change",r)))},t.prototype.$safeApplyDelta=function(r){var h=this.$lines.length;(r.action=="remove"&&r.start.row<h&&r.end.row<h||r.action=="insert"&&r.start.row<=h)&&this.applyDelta(r)},t.prototype.$splitAndapplyLargeDelta=function(r,h){for(var a=r.lines,u=a.length-h+1,f=r.start.row,m=r.start.column,y=0,x=0;y<u;y=x){x+=h-1;var E=a.slice(y,x);E.push(""),this.applyDelta({start:this.pos(f+y,m),end:this.pos(f+x,m=0),action:r.action,lines:E},!0)}r.lines=a.slice(y),r.start.row=f+y,r.start.column=m,this.applyDelta(r,!0)},t.prototype.revertDelta=function(r){this.$safeApplyDelta({start:this.clonePos(r.start),end:this.clonePos(r.end),action:r.action=="insert"?"remove":"insert",lines:r.lines.slice()})},t.prototype.indexToPosition=function(r,h){for(var a=this.$lines||this.getAllLines(),u=this.getNewLineCharacter().length,f=h||0,m=a.length;f<m;f++)if(r-=a[f].length+u,r<0)return{row:f,column:r+a[f].length+u};return{row:m-1,column:r+a[m-1].length+u}},t.prototype.positionToIndex=function(r,h){for(var a=this.$lines||this.getAllLines(),u=this.getNewLineCharacter().length,f=0,m=Math.min(r.row,a.length),y=h||0;y<m;++y)f+=a[y].length+u;return f+r.column},t.prototype.$split=function(r){return r.split(/\r\n|\r|\n/)},t}();e.prototype.$autoNewLine="",e.prototype.$newLineMode="auto",s.implement(e.prototype,d),l.Document=e}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(i,l,v){var s=i("./lib/oop"),c=i("./lib/event_emitter").EventEmitter,d=function(){function o(p,e){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=p;var t=this;this.$worker=function(){if(t.running){for(var r=new Date,h=t.currentLine,a=-1,u=t.doc,f=h;t.lines[h];)h++;var m=u.getLength(),y=0;for(t.running=!1;h<m;){t.$tokenizeRow(h),a=h;do h++;while(t.lines[h]);if(y++,y%5===0&&new Date-r>20){t.running=setTimeout(t.$worker,20);break}}t.currentLine=h,a==-1&&(a=h),f<=a&&t.fireUpdateEvent(f,a)}}}return o.prototype.setTokenizer=function(p){this.tokenizer=p,this.lines=[],this.states=[],this.start(0)},o.prototype.setDocument=function(p){this.doc=p,this.lines=[],this.states=[],this.stop()},o.prototype.fireUpdateEvent=function(p,e){var t={first:p,last:e};this._signal("update",{data:t})},o.prototype.start=function(p){this.currentLine=Math.min(p||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},o.prototype.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},o.prototype.$updateOnChange=function(p){var e=p.start.row,t=p.end.row-e;if(t===0)this.lines[e]=null;else if(p.action=="remove")this.lines.splice(e,t+1,null),this.states.splice(e,t+1,null);else{var r=Array(t+1);r.unshift(e,1),this.lines.splice.apply(this.lines,r),this.states.splice.apply(this.states,r)}this.currentLine=Math.min(e,this.currentLine,this.doc.getLength()),this.stop()},o.prototype.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},o.prototype.getTokens=function(p){return this.lines[p]||this.$tokenizeRow(p)},o.prototype.getState=function(p){return this.currentLine==p&&this.$tokenizeRow(p),this.states[p]||"start"},o.prototype.$tokenizeRow=function(p){var e=this.doc.getLine(p),t=this.states[p-1],r=this.tokenizer.getLineTokens(e,t,p);return this.states[p]+""!=r.state+""?(this.states[p]=r.state,this.lines[p+1]=null,this.currentLine>p+1&&(this.currentLine=p+1)):this.currentLine==p&&(this.currentLine=p+1),this.lines[p]=r.tokens},o.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},o}();s.implement(d.prototype,c),l.BackgroundTokenizer=d}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(i,l,v){var s=i("./lib/lang"),c=i("./range").Range,d=function(){function o(p,e,t){t===void 0&&(t="text"),this.setRegexp(p),this.clazz=e,this.type=t,this.docLen=0}return o.prototype.setRegexp=function(p){this.regExp+""!=p+""&&(this.regExp=p,this.cache=[])},o.prototype.update=function(p,e,t,r){if(this.regExp){for(var h=r.firstRow,a=r.lastRow,u={},f=t.$editor&&t.$editor.$search,m=f&&f.$isMultilineSearch(t.$editor.getLastSearchOptions()),y=h;y<=a;y++){var x=this.cache[y];if(x==null||t.getValue().length!=this.docLen){if(m){x=[];var E=f.$multiLineForward(t,this.regExp,y,a);if(E){var w=E.endRow<=a?E.endRow-1:a;w>y&&(y=w),x.push(new c(E.startRow,E.startCol,E.endRow,E.endCol))}x.length>this.MAX_RANGES&&(x=x.slice(0,this.MAX_RANGES))}else x=s.getMatchOffsets(t.getLine(y),this.regExp),x.length>this.MAX_RANGES&&(x=x.slice(0,this.MAX_RANGES)),x=x.map(function(D){return new c(y,D.offset,y,D.offset+D.length)});this.cache[y]=x.length?x:""}if(x.length!==0)for(var g=x.length;g--;){var S=x[g].toScreenRange(t),k=S.toString();u[k]||(u[k]=!0,e.drawSingleLineMarker(p,S,this.clazz,r))}}this.docLen=t.getValue().length}},o}();d.prototype.MAX_RANGES=500,l.SearchHighlight=d}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(i,l,v){var s=function(){function w(){this.$keepRedoStack,this.$maxRev=0,this.$fromUndo=!1,this.$undoDepth=1/0,this.reset()}return w.prototype.addSession=function(g){this.$session=g},w.prototype.add=function(g,S,k){if(!this.$fromUndo&&g!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),S===!1||!this.lastDeltas){this.lastDeltas=[];var D=this.$undoStack.length;D>this.$undoDepth-1&&this.$undoStack.splice(0,D-this.$undoDepth+1),this.$undoStack.push(this.lastDeltas),g.id=this.$rev=++this.$maxRev}(g.action=="remove"||g.action=="insert")&&(this.$lastDelta=g),this.lastDeltas.push(g)}},w.prototype.addSelection=function(g,S){this.selections.push({value:g,rev:S||this.$rev})},w.prototype.startNewGroup=function(){return this.lastDeltas=null,this.$rev},w.prototype.markIgnored=function(g,S){S==null&&(S=this.$rev+1);for(var k=this.$undoStack,D=k.length;D--;){var _=k[D][0];if(_.id<=g)break;_.id<S&&(_.ignore=!0)}this.lastDeltas=null},w.prototype.getSelection=function(g,S){for(var k=this.selections,D=k.length;D--;){var _=k[D];if(_.rev<g)return S&&(_=k[D+1]),_}},w.prototype.getRevision=function(){return this.$rev},w.prototype.getDeltas=function(g,S){S==null&&(S=this.$rev+1);for(var k=this.$undoStack,D=null,_=0,F=k.length;F--;){var A=k[F][0];if(A.id<S&&!D&&(D=F+1),A.id<=g){_=F+1;break}}return k.slice(_,D)},w.prototype.getChangedRanges=function(g,S){S==null&&(S=this.$rev+1)},w.prototype.getChangedLines=function(g,S){S==null&&(S=this.$rev+1)},w.prototype.undo=function(g,S){this.lastDeltas=null;var k=this.$undoStack;if(c(k,k.length)){g||(g=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var D=k.pop(),_=null;return D&&(_=g.undoChanges(D,S),this.$redoStack.push(D),this.$syncRev()),this.$fromUndo=!1,_}},w.prototype.redo=function(g,S){if(this.lastDeltas=null,g||(g=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var k=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);E(this.$redoStack,k),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(F){F[0].id=++this.$maxRev},this)}var D=this.$redoStack.pop(),_=null;return D&&(_=g.redoChanges(D,S),this.$undoStack.push(D),this.$syncRev()),this.$fromUndo=!1,_},w.prototype.$syncRev=function(){var g=this.$undoStack,S=g[g.length-1],k=S&&S[0].id||0;this.$redoStackBaseRev=k,this.$rev=k},w.prototype.reset=function(){this.lastDeltas=null,this.$lastDelta=null,this.$undoStack=[],this.$redoStack=[],this.$rev=0,this.mark=0,this.$redoStackBaseRev=this.$rev,this.selections=[]},w.prototype.canUndo=function(){return this.$undoStack.length>0},w.prototype.canRedo=function(){return this.$redoStack.length>0},w.prototype.bookmark=function(g){g==null&&(g=this.$rev),this.mark=g},w.prototype.isAtBookmark=function(){return this.$rev===this.mark},w.prototype.toJSON=function(){return{$redoStack:this.$redoStack,$undoStack:this.$undoStack}},w.prototype.fromJSON=function(g){this.reset(),this.$undoStack=g.$undoStack,this.$redoStack=g.$redoStack},w.prototype.$prettyPrint=function(g){return g?t(g):t(this.$undoStack)+`
|
|
206
206
|
---
|
|
207
|
-
`+t(this.$redoStack)},
|
|
208
|
-
`);var g="";return
|
|
209
|
-
`):g=r(
|
|
210
|
-
`)},d.prototype.idxToPosition=function(o){for(var p=0,e=0;e<this.folds.length;e++){var t=this.folds[e];if(o-=t.start.column-p,o<0)return{row:t.start.row,column:t.start.column+o};if(o-=t.placeholder.length,o<0)return t.start;p=t.end.column}return{row:this.end.row,column:this.end.column+o}},d}();l.FoldLine=c}),ace.define("ace/range_list",["require","exports","module","ace/range"],function(i,l,v){var s=i("./range").Range,c=s.comparePoints,d=function(){function o(){this.ranges=[],this.$bias=1}return o.prototype.pointIndex=function(p,e,t){for(var r=this.ranges,h=t||0;h<r.length;h++){var a=r[h],u=c(p,a.end);if(!(u>0)){var f=c(p,a.start);return u===0?e&&f!==0?-h-2:h:f>0||f===0&&!e?h:-h-1}}return-h-1},o.prototype.add=function(p){var e=!p.isEmpty(),t=this.pointIndex(p.start,e);t<0&&(t=-t-1);var r=this.pointIndex(p.end,e,t);return r<0?r=-r-1:r++,this.ranges.splice(t,r-t,p)},o.prototype.addList=function(p){for(var e=[],t=p.length;t--;)e.push.apply(e,this.add(p[t]));return e},o.prototype.substractPoint=function(p){var e=this.pointIndex(p);if(e>=0)return this.ranges.splice(e,1)},o.prototype.merge=function(){var p=[],e=this.ranges;e=e.sort(function(u,f){return c(u.start,f.start)});for(var t=e[0],r,h=1;h<e.length;h++){r=t,t=e[h];var a=c(r.end,t.start);a<0||a==0&&!r.isEmpty()&&!t.isEmpty()||(c(r.end,t.end)<0&&(r.end.row=t.end.row,r.end.column=t.end.column),e.splice(h,1),p.push(t),t=r,h--)}return this.ranges=e,p},o.prototype.contains=function(p,e){return this.pointIndex({row:p,column:e})>=0},o.prototype.containsPoint=function(p){return this.pointIndex(p)>=0},o.prototype.rangeAtPoint=function(p){var e=this.pointIndex(p);if(e>=0)return this.ranges[e]},o.prototype.clipRows=function(p,e){var t=this.ranges;if(t[0].start.row>e||t[t.length-1].start.row<p)return[];var r=this.pointIndex({row:p,column:0});r<0&&(r=-r-1);var h=this.pointIndex({row:e,column:0},r);h<0&&(h=-h-1);for(var a=[],u=r;u<h;u++)a.push(t[u]);return a},o.prototype.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},o.prototype.attach=function(p){this.session&&this.detach(),this.session=p,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},o.prototype.detach=function(){this.session&&(this.session.removeListener("change",this.onChange),this.session=null)},o.prototype.$onChange=function(p){for(var e=p.start,t=p.end,r=e.row,h=t.row,a=this.ranges,u=0,f=a.length;u<f;u++){var m=a[u];if(m.end.row>=r)break}if(p.action=="insert")for(var y=h-r,x=-e.column+t.column;u<f;u++){var m=a[u];if(m.start.row>r)break;if(m.start.row==r&&m.start.column>=e.column&&(m.start.column==e.column&&this.$bias<=0||(m.start.column+=x,m.start.row+=y)),m.end.row==r&&m.end.column>=e.column){if(m.end.column==e.column&&this.$bias<0)continue;m.end.column==e.column&&x>0&&u<f-1&&m.end.column>m.start.column&&m.end.column==a[u+1].start.column&&(m.end.column-=x),m.end.column+=x,m.end.row+=y}}else for(var y=r-h,x=e.column-t.column;u<f;u++){var m=a[u];if(m.start.row>h)break;m.end.row<h&&(r<m.end.row||r==m.end.row&&e.column<m.end.column)?(m.end.row=r,m.end.column=e.column):m.end.row==h?m.end.column<=t.column?(y||m.end.column>e.column)&&(m.end.column=e.column,m.end.row=e.row):(m.end.column+=x,m.end.row+=y):m.end.row>h&&(m.end.row+=y),m.start.row<h&&(r<m.start.row||r==m.start.row&&e.column<m.start.column)?(m.start.row=r,m.start.column=e.column):m.start.row==h?m.start.column<=t.column?(y||m.start.column>e.column)&&(m.start.column=e.column,m.start.row=e.row):(m.start.column+=x,m.start.row+=y):m.start.row>h&&(m.start.row+=y)}if(y!=0&&u<f)for(;u<f;u++){var m=a[u];m.start.row+=y,m.end.row+=y}},o}();d.prototype.comparePoints=c,l.RangeList=d}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list"],function(i,l,v){var s=this&&this.__extends||function(){var r=function(h,a){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(u[m]=f[m])},r(h,a)};return function(h,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(h,a);function u(){this.constructor=h}h.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}}(),c=i("../range_list").RangeList,d=function(r){s(h,r);function h(a,u){var f=r.call(this)||this;return f.foldLine=null,f.placeholder=u,f.range=a,f.start=a.start,f.end=a.end,f.sameRow=a.start.row==a.end.row,f.subFolds=f.ranges=[],f}return h.prototype.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},h.prototype.setFoldLine=function(a){this.foldLine=a,this.subFolds.forEach(function(u){u.setFoldLine(a)})},h.prototype.clone=function(){var a=this.range.clone(),u=new h(a,this.placeholder);return this.subFolds.forEach(function(f){u.subFolds.push(f.clone())}),u.collapseChildren=this.collapseChildren,u},h.prototype.addSubFold=function(a){if(!this.range.isEqual(a)){p(a,this.start);for(var x=a.start.row,E=a.start.column,u=0,f=-1;u<this.subFolds.length&&(f=this.subFolds[u].range.compare(x,E),f==1);u++);var m=this.subFolds[u],y=0;if(f==0){if(m.range.containsRange(a))return m.addSubFold(a);y=1}for(var x=a.range.end.row,E=a.range.end.column,b=u,f=-1;b<this.subFolds.length&&(f=this.subFolds[b].range.compare(x,E),f==1);b++);f==0&&b++;for(var g=this.subFolds.splice(u,b-u,a),S=f==0?g.length-1:g.length,k=y;k<S;k++)a.addSubFold(g[k]);return a.setFoldLine(this.foldLine),a}},h.prototype.restoreRange=function(a){return t(a,this.start)},h}(c);function o(r,h){r.row-=h.row,r.row==0&&(r.column-=h.column)}function p(r,h){o(r.start,h),o(r.end,h)}function e(r,h){r.row==0&&(r.column+=h.column),r.row+=h.row}function t(r,h){e(r.start,h),e(r.end,h)}l.Fold=d}),ace.define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator","ace/mouse/mouse_event"],function(i,l,v){var s=i("../range").Range,c=i("./fold_line").FoldLine,d=i("./fold").Fold,o=i("../token_iterator").TokenIterator,p=i("../mouse/mouse_event").MouseEvent;function e(){this.getFoldAt=function(t,r,h){var a=this.getFoldLine(t);if(!a)return null;for(var u=a.folds,f=0;f<u.length;f++){var m=u[f].range;if(m.contains(t,r)){if(h==1&&m.isEnd(t,r)&&!m.isEmpty())continue;if(h==-1&&m.isStart(t,r)&&!m.isEmpty())continue;return u[f]}}},this.getFoldsInRange=function(t){var r=t.start,h=t.end,a=this.$foldData,u=[];r.column+=1,h.column-=1;for(var f=0;f<a.length;f++){var m=a[f].range.compareRange(t);if(m!=2){if(m==-2)break;for(var y=a[f].folds,x=0;x<y.length;x++){var E=y[x];if(m=E.range.compareRange(t),m==-2)break;if(m==2)continue;if(m==42)break;u.push(E)}}}return r.column-=1,h.column+=1,u},this.getFoldsInRangeList=function(t){if(Array.isArray(t)){var r=[];t.forEach(function(h){r=r.concat(this.getFoldsInRange(h))},this)}else var r=this.getFoldsInRange(t);return r},this.getAllFolds=function(){for(var t=[],r=this.$foldData,h=0;h<r.length;h++)for(var a=0;a<r[h].folds.length;a++)t.push(r[h].folds[a]);return t},this.getFoldStringAt=function(t,r,h,a){if(a=a||this.getFoldLine(t),!a)return null;for(var u={end:{column:0}},f,m,y=0;y<a.folds.length;y++){m=a.folds[y];var x=m.range.compareEnd(t,r);if(x==-1){f=this.getLine(m.start.row).substring(u.end.column,m.start.column);break}else if(x===0)return null;u=m}return f||(f=this.getLine(m.start.row).substring(u.end.column)),h==-1?f.substring(0,r-u.end.column):h==1?f.substring(r-u.end.column):f},this.getFoldLine=function(t,r){var h=this.$foldData,a=0;for(r&&(a=h.indexOf(r)),a==-1&&(a=0),a;a<h.length;a++){var u=h[a];if(u.start.row<=t&&u.end.row>=t)return u;if(u.end.row>t)return null}return null},this.getNextFoldLine=function(t,r){var h=this.$foldData,a=0;for(r&&(a=h.indexOf(r)),a==-1&&(a=0),a;a<h.length;a++){var u=h[a];if(u.end.row>=t)return u}return null},this.getFoldedRowCount=function(t,r){for(var h=this.$foldData,a=r-t+1,u=0;u<h.length;u++){var f=h[u],m=f.end.row,y=f.start.row;if(m>=r){y<r&&(y>=t?a-=r-y:a=0);break}else m>=t&&(y>=t?a-=m-y:a-=m-t+1)}return a},this.$addFoldLine=function(t){return this.$foldData.push(t),this.$foldData.sort(function(r,h){return r.start.row-h.start.row}),t},this.addFold=function(t,r){var h=this.$foldData,a=!1,u;t instanceof d?u=t:(u=new d(r,t),u.collapseChildren=r.collapseChildren),this.$clipRangeToDocument(u.range);var f=u.start.row,m=u.start.column,y=u.end.row,x=u.end.column,E=this.getFoldAt(f,m,1),b=this.getFoldAt(y,x,-1);if(E&&b==E)return E.addSubFold(u);E&&!E.range.isStart(f,m)&&this.removeFold(E),b&&!b.range.isEnd(y,x)&&this.removeFold(b);var g=this.getFoldsInRange(u.range);g.length>0&&(this.removeFolds(g),u.collapseChildren||g.forEach(function(_){u.addSubFold(_)}));for(var S=0;S<h.length;S++){var k=h[S];if(y==k.start.row){k.addFold(u),a=!0;break}else if(f==k.end.row){if(k.addFold(u),a=!0,!u.sameRow){var D=h[S+1];if(D&&D.start.row==y){k.merge(D);break}}break}else if(y<=k.start.row)break}return a||(k=this.$addFoldLine(new c(this.$foldData,u))),this.$useWrapMode?this.$updateWrapData(k.start.row,k.start.row):this.$updateRowLengthCache(k.start.row,k.start.row),this.$modified=!0,this._signal("changeFold",{data:u,action:"add"}),u},this.addFolds=function(t){t.forEach(function(r){this.addFold(r)},this)},this.removeFold=function(t){var r=t.foldLine,h=r.start.row,a=r.end.row,u=this.$foldData,f=r.folds;if(f.length==1)u.splice(u.indexOf(r),1);else if(r.range.isEnd(t.end.row,t.end.column))f.pop(),r.end.row=f[f.length-1].end.row,r.end.column=f[f.length-1].end.column;else if(r.range.isStart(t.start.row,t.start.column))f.shift(),r.start.row=f[0].start.row,r.start.column=f[0].start.column;else if(t.sameRow)f.splice(f.indexOf(t),1);else{var m=r.split(t.start.row,t.start.column);f=m.folds,f.shift(),m.start.row=f[0].start.row,m.start.column=f[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(h,a):this.$updateRowLengthCache(h,a)),this.$modified=!0,this._signal("changeFold",{data:t,action:"remove"})},this.removeFolds=function(t){for(var r=[],h=0;h<t.length;h++)r.push(t[h]);r.forEach(function(a){this.removeFold(a)},this),this.$modified=!0},this.expandFold=function(t){this.removeFold(t),t.subFolds.forEach(function(r){t.restoreRange(r),this.addFold(r)},this),t.collapseChildren>0&&this.foldAll(t.start.row+1,t.end.row,t.collapseChildren-1),t.subFolds=[]},this.expandFolds=function(t){t.forEach(function(r){this.expandFold(r)},this)},this.unfold=function(t,r){var h,a;if(t==null)h=new s(0,0,this.getLength(),0),r==null&&(r=!0);else if(typeof t=="number")h=new s(t,0,t,this.getLine(t).length);else if("row"in t)h=s.fromPoints(t,t);else{if(Array.isArray(t))return a=[],t.forEach(function(f){a=a.concat(this.unfold(f))},this),a;h=t}a=this.getFoldsInRangeList(h);for(var u=a;a.length==1&&s.comparePoints(a[0].start,h.start)<0&&s.comparePoints(a[0].end,h.end)>0;)this.expandFolds(a),a=this.getFoldsInRangeList(h);if(r!=!1?this.removeFolds(a):this.expandFolds(a),u.length)return u},this.isRowFolded=function(t,r){return!!this.getFoldLine(t,r)},this.getRowFoldEnd=function(t,r){var h=this.getFoldLine(t,r);return h?h.end.row:t},this.getRowFoldStart=function(t,r){var h=this.getFoldLine(t,r);return h?h.start.row:t},this.getFoldDisplayLine=function(t,r,h,a,u){a==null&&(a=t.start.row),u==null&&(u=0),r==null&&(r=t.end.row),h==null&&(h=this.getLine(r).length);var f=this.doc,m="";return t.walk(function(y,x,E,b){if(!(x<a)){if(x==a){if(E<u)return;b=Math.max(u,b)}y!=null?m+=y:m+=f.getLine(x).substring(b,E)}},r,h),m},this.getDisplayLine=function(t,r,h,a){var u=this.getFoldLine(t);if(u)return this.getFoldDisplayLine(u,t,r,h,a);var f;return f=this.doc.getLine(t),f.substring(a||0,r||f.length)},this.$cloneFoldData=function(){var t=[];return t=this.$foldData.map(function(r){var h=r.folds.map(function(a){return a.clone()});return new c(t,h)}),t},this.toggleFold=function(t){var r=this.selection,h=r.getRange(),a,u;if(h.isEmpty()){var f=h.start;if(a=this.getFoldAt(f.row,f.column),a){this.expandFold(a);return}else if(t){var m=this.getFoldLine(f.row);m&&this.expandFolds(m.folds);return}else(u=this.findMatchingBracket(f))?h.comparePoint(u)==1?h.end=u:(h.start=u,h.start.column++,h.end.column--):(u=this.findMatchingBracket({row:f.row,column:f.column+1}))?(h.comparePoint(u)==1?h.end=u:h.start=u,h.start.column++):h=this.getCommentFoldRange(f.row,f.column)||h}else{var y=this.getFoldsInRange(h);if(t&&y.length){this.expandFolds(y);return}else y.length==1&&(a=y[0])}if(a||(a=this.getFoldAt(h.start.row,h.start.column)),a&&a.range.toString()==h.toString()){this.expandFold(a);return}var x="...";if(!h.isMultiLine()){if(x=this.getTextRange(h),x.length<4)return;x=x.trim().substring(0,2)+".."}this.addFold(x,h)},this.getCommentFoldRange=function(t,r,h){var a=new o(this,t,r),u=a.getCurrentToken(),f=u&&u.type;if(u&&/^comment|string/.test(f)){f=f.match(/comment|string/)[0],f=="comment"&&(f+="|doc-start|\\.doc");var m=new RegExp(f),y=new s;if(h!=1){do u=a.stepBackward();while(u&&m.test(u.type));u=a.stepForward()}y.start.row=a.getCurrentTokenRow(),y.start.column=a.getCurrentTokenColumn()+u.value.length,a=new o(this,t,r);var x=this.getState(a.$row);if(h!=-1){var E=-1;do if(u=a.stepForward(),E==-1){var b=this.getState(a.$row);x.toString()!==b.toString()&&(E=a.$row)}else if(a.$row>E)break;while(u&&m.test(u.type));u=a.stepBackward()}else u=a.getCurrentToken();return y.end.row=a.getCurrentTokenRow(),y.end.column=a.getCurrentTokenColumn(),y.start.row==y.end.row&&y.start.column>y.end.column?void 0:y}},this.foldAll=function(t,r,h,a){h==null&&(h=1e5);var u=this.foldWidgets;if(u){r=r||this.getLength(),t=t||0;for(var f=t;f<r;f++)if(u[f]==null&&(u[f]=this.getFoldWidget(f)),u[f]=="start"&&!(a&&!a(f))){var m=this.getFoldWidgetRange(f);m&&m.isMultiLine()&&m.end.row<=r&&m.start.row>=t&&(f=m.end.row,m.collapseChildren=h,this.addFold("...",m))}}},this.foldToLevel=function(t){for(this.foldAll();t-- >0;)this.unfold(null,!1)},this.foldAllComments=function(){var t=this;this.foldAll(null,null,null,function(r){for(var h=t.getTokens(r),a=0;a<h.length;a++){var u=h[a];if(!(u.type=="text"&&/^\s+$/.test(u.value)))return!!/comment/.test(u.type)}})},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(t){if(!this.$foldStyles[t])throw new Error("invalid fold style: "+t+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle!=t){this.$foldStyle=t,t=="manual"&&this.unfold();var r=this.$foldMode;this.$setFolding(null),this.$setFolding(r)}},this.$setFolding=function(t){if(this.$foldMode!=t){if(this.$foldMode=t,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation"),!t||this.$foldStyle=="manual"){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=t.getFoldWidget.bind(t,this,this.$foldStyle),this.getFoldWidgetRange=t.getFoldWidgetRange.bind(t,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.$tokenizerUpdateFoldWidgets=this.tokenizerUpdateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),this.on("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets)}},this.getParentFoldRangeData=function(t,r){var h=this.foldWidgets;if(!h||r&&h[t])return{};for(var a=t-1,u;a>=0;){var f=h[a];if(f==null&&(f=h[a]=this.getFoldWidget(a)),f=="start"){var m=this.getFoldWidgetRange(a);if(u||(u=m),m&&m.end.row>=t)break}a--}return{range:a!==-1&&m,firstRange:u}},this.onFoldWidgetClick=function(t,r){r instanceof p&&(r=r.domEvent);var h={children:r.shiftKey,all:r.ctrlKey||r.metaKey,siblings:r.altKey},a=this.$toggleFoldWidget(t,h);if(!a){var u=r.target||r.srcElement;u&&/ace_fold-widget/.test(u.className)&&(u.className+=" ace_invalid")}},this.$toggleFoldWidget=function(t,r){if(this.getFoldWidget){var h=this.getFoldWidget(t),a=this.getLine(t),u=h==="end"?-1:1,f=this.getFoldAt(t,u===-1?0:a.length,u);if(f)return r.children||r.all?this.removeFold(f):this.expandFold(f),f;var m=this.getFoldWidgetRange(t,!0);if(m&&!m.isMultiLine()&&(f=this.getFoldAt(m.start.row,m.start.column,1),f&&m.isEqual(f.range)))return this.removeFold(f),f;if(r.siblings){var y=this.getParentFoldRangeData(t);if(y.range)var x=y.range.start.row+1,E=y.range.end.row;this.foldAll(x,E,r.all?1e4:0)}else r.children?(E=m?m.end.row:this.getLength(),this.foldAll(t+1,E,r.all?1e4:0)):m&&(r.all&&(m.collapseChildren=1e4),this.addFold("...",m));return m}},this.toggleFoldWidget=function(t){var r=this.selection.getCursor().row;r=this.getRowFoldStart(r);var h=this.$toggleFoldWidget(r,{});if(!h){var a=this.getParentFoldRangeData(r,!0);if(h=a.range||a.firstRange,h){r=h.start.row;var u=this.getFoldAt(r,this.getLine(r).length,1);u?this.removeFold(u):this.addFold("...",h)}}},this.updateFoldWidgets=function(t){var r=t.start.row,h=t.end.row-r;if(h===0)this.foldWidgets[r]=null;else if(t.action=="remove")this.foldWidgets.splice(r,h+1,null);else{var a=Array(h+1);a.unshift(r,1),this.foldWidgets.splice.apply(this.foldWidgets,a)}},this.tokenizerUpdateFoldWidgets=function(t){var r=t.data;r.first!=r.last&&this.foldWidgets.length>r.first&&this.foldWidgets.splice(r.first,this.foldWidgets.length)}}l.Folding=e}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(i,l,v){var s=i("../token_iterator").TokenIterator,c=i("../range").Range;function d(){this.findMatchingBracket=function(o,p){if(o.column==0)return null;var e=p||this.getLine(o.row).charAt(o.column-1);if(e=="")return null;var t=e.match(/([\(\[\{])|([\)\]\}])/);return t?t[1]?this.$findClosingBracket(t[1],o):this.$findOpeningBracket(t[2],o):null},this.getBracketRange=function(o){var p=this.getLine(o.row),e=!0,t,r=p.charAt(o.column-1),h=r&&r.match(/([\(\[\{])|([\)\]\}])/);if(h||(r=p.charAt(o.column),o={row:o.row,column:o.column+1},h=r&&r.match(/([\(\[\{])|([\)\]\}])/),e=!1),!h)return null;if(h[1]){var a=this.$findClosingBracket(h[1],o);if(!a)return null;t=c.fromPoints(o,a),e||(t.end.column++,t.start.column--),t.cursor=t.end}else{var a=this.$findOpeningBracket(h[2],o);if(!a)return null;t=c.fromPoints(a,o),e||(t.start.column++,t.end.column--),t.cursor=t.start}return t},this.getMatchingBracketRanges=function(o,p){var e=this.getLine(o.row),t=/([\(\[\{])|([\)\]\}])/,r=!p&&e.charAt(o.column-1),h=r&&r.match(t);if(h||(r=(p===void 0||p)&&e.charAt(o.column),o={row:o.row,column:o.column+1},h=r&&r.match(t)),!h)return null;var a=new c(o.row,o.column-1,o.row,o.column),u=h[1]?this.$findClosingBracket(h[1],o):this.$findOpeningBracket(h[2],o);if(!u)return[a];var f=new c(u.row,u.column,u.row,u.column+1);return[a,f]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(o,p,e){var t=this.$brackets[o],r=1,h=new s(this,p.row,p.column),a=h.getCurrentToken();if(a||(a=h.stepForward()),!!a){e||(e=new RegExp("(\\.?"+a.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)").replace(/-close\b/,"-(close|open)")+")+"));for(var u=p.column-h.getCurrentTokenColumn()-2,f=a.value;;){for(;u>=0;){var m=f.charAt(u);if(m==t){if(r-=1,r==0)return{row:h.getCurrentTokenRow(),column:u+h.getCurrentTokenColumn()}}else m==o&&(r+=1);u-=1}do a=h.stepBackward();while(a&&!e.test(a.type));if(a==null)break;f=a.value,u=f.length-1}return null}},this.$findClosingBracket=function(o,p,e){var t=this.$brackets[o],r=1,h=new s(this,p.row,p.column),a=h.getCurrentToken();if(a||(a=h.stepForward()),!!a){e||(e=new RegExp("(\\.?"+a.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)").replace(/-open\b/,"-(close|open)")+")+"));for(var u=p.column-h.getCurrentTokenColumn();;){for(var f=a.value,m=f.length;u<m;){var y=f.charAt(u);if(y==t){if(r-=1,r==0)return{row:h.getCurrentTokenRow(),column:u+h.getCurrentTokenColumn()}}else y==o&&(r+=1);u+=1}do a=h.stepForward();while(a&&!e.test(a.type));if(a==null)break;u=0}return null}},this.getMatchingTags=function(o){var p=new s(this,o.row,o.column),e=this.$findTagName(p);if(e){var t=p.stepBackward();return t.value==="<"?this.$findClosingTag(p,e):this.$findOpeningTag(p,e)}},this.$findTagName=function(o){var p=o.getCurrentToken(),e=!1,t=!1;if(p&&p.type.indexOf("tag-name")===-1)do t?p=o.stepBackward():p=o.stepForward(),p&&(p.value==="/>"?t=!0:p.type.indexOf("tag-name")!==-1&&(e=!0));while(p&&!e);return p},this.$findClosingTag=function(o,p){var e,t=p.value,r=p.value,h=0,a=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);p=o.stepForward();var u=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+p.value.length),f=!1;do{if(e=p,e.type.indexOf("tag-close")!==-1&&!f){var m=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);f=!0}if(p=o.stepForward(),p){if(p.value===">"&&!f){var m=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);f=!0}if(p.type.indexOf("tag-name")!==-1){if(t=p.value,r===t){if(e.value==="<")h++;else if(e.value==="</"&&(h--,h<0)){o.stepBackward();var y=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+2);p=o.stepForward();var x=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+p.value.length);if(p.type.indexOf("tag-close")===-1&&(p=o.stepForward()),p&&p.value===">")var E=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);else return}}}else if(r===t&&p.value==="/>"&&(h--,h<0))var y=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+2),x=y,E=x,m=new c(u.end.row,u.end.column,u.end.row,u.end.column+1)}}while(p&&h>=0);if(a&&m&&y&&E&&u&&x)return{openTag:new c(a.start.row,a.start.column,m.end.row,m.end.column),closeTag:new c(y.start.row,y.start.column,E.end.row,E.end.column),openTagName:u,closeTagName:x}},this.$findOpeningTag=function(o,p){var e=o.getCurrentToken(),t=p.value,r=0,h=o.getCurrentTokenRow(),a=o.getCurrentTokenColumn(),u=a+2,f=new c(h,a,h,u);o.stepForward();var m=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+p.value.length);if(p.type.indexOf("tag-close")===-1&&(p=o.stepForward()),!(!p||p.value!==">")){var y=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);o.stepBackward(),o.stepBackward();do if(p=e,h=o.getCurrentTokenRow(),a=o.getCurrentTokenColumn(),u=a+p.value.length,e=o.stepBackward(),p){if(p.type.indexOf("tag-name")!==-1){if(t===p.value)if(e.value==="<"){if(r++,r>0){var x=new c(h,a,h,u),E=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);do p=o.stepForward();while(p&&p.value!==">");var b=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1)}}else e.value==="</"&&r--}else if(p.value==="/>"){for(var g=0,S=e;S;){if(S.type.indexOf("tag-name")!==-1&&S.value===t){r--;break}else if(S.value==="<")break;S=o.stepBackward(),g++}for(var k=0;k<g;k++)o.stepForward()}}while(e&&r<=0);if(E&&b&&f&&y&&x&&m)return{openTag:new c(E.start.row,E.start.column,b.end.row,b.end.column),closeTag:new c(f.start.row,f.start.column,y.end.row,y.end.column),openTagName:x,closeTagName:m}}}}l.BracketMatch=d}),ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/bidihandler","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/line_widgets","ace/document","ace/background_tokenizer","ace/search_highlight","ace/undomanager","ace/edit_session/folding","ace/edit_session/bracket_match"],function(i,l,v){var s=i("./lib/oop"),c=i("./lib/lang"),d=i("./bidihandler").BidiHandler,o=i("./config"),p=i("./lib/event_emitter").EventEmitter,e=i("./selection").Selection,t=i("./mode/text").Mode,r=i("./range").Range,h=i("./line_widgets").LineWidgets,a=i("./document").Document,u=i("./background_tokenizer").BackgroundTokenizer,f=i("./search_highlight").SearchHighlight,m=i("./undomanager").UndoManager,y=function(){function A($,w){this.doc,this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.$editor=null,this.prevOp={},this.$foldData=[],this.id="session"+ ++A.$uid,this.$foldData.toString=function(){return this.join(`
|
|
211
|
-
`)},this.$gutterCustomWidgets={},this.bgTokenizer=new u(new t().getTokenizer(),this);var
|
|
212
|
-
`},A.prototype.getWordRange=function($,w){var C=this.getLine($),T=!1;if(w>0&&(T=!!C.charAt(w-1).match(this.tokenRe)),T||(T=!!C.charAt(w).match(this.tokenRe)),T)var I=this.tokenRe;else if(/^\s+$/.test(C.slice(w-1,w+1)))var I=/\s/;else var I=this.nonTokenRe;var O=w;if(O>0){do O--;while(O>=0&&C.charAt(O).match(I));O++}for(var R=w;R<C.length&&C.charAt(R).match(I);)R++;return new r($,O,$,R)},A.prototype.getAWordRange=function($,w){for(var C=this.getWordRange($,w),T=this.getLine(C.end.row);T.charAt(C.end.column).match(/[ \t]/);)C.end.column+=1;return C},A.prototype.setNewLineMode=function($){this.doc.setNewLineMode($)},A.prototype.getNewLineMode=function(){return this.doc.getNewLineMode()},A.prototype.setUseWorker=function($){this.setOption("useWorker",$)},A.prototype.getUseWorker=function(){return this.$useWorker},A.prototype.onReloadTokenizer=function($){var w=$.data;this.bgTokenizer.start(w.first),this._signal("tokenizerUpdate",$)},A.prototype.setMode=function($,w){if($&&typeof $=="object"){if($.getTokenizer)return this.$onChangeMode($);var C=$,T=C.path}else T=$||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new t),this.$modes[T]&&!C){this.$onChangeMode(this.$modes[T]),w&&w();return}this.$modeId=T,o.loadModule(["mode",T],function(I){if(!this.destroyed){if(this.$modeId!==T)return w&&w();this.$modes[T]&&!C?this.$onChangeMode(this.$modes[T]):I&&I.Mode&&(I=new I.Mode(C),C||(this.$modes[T]=I,I.$id=T),this.$onChangeMode(I)),w&&w()}}.bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0)},A.prototype.$onChangeMode=function($,w){if(w||(this.$modeId=$.$id),this.$mode!==$){var C=this.$mode;this.$mode=$,this.$stopWorker(),this.$useWorker&&this.$startWorker();var T=$.getTokenizer();if(T.on!==void 0){var I=this.onReloadTokenizer.bind(this);T.on("update",I)}this.bgTokenizer.setTokenizer(T),this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=$.tokenRe,this.nonTokenRe=$.nonTokenRe,w||($.attachToSession&&$.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding($.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode",{oldMode:C,mode:$}))}},A.prototype.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},A.prototype.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch($){o.warn("Could not load worker",$),this.$worker=null}},A.prototype.getMode=function(){return this.$mode},A.prototype.setScrollTop=function($){this.$scrollTop===$||isNaN($)||(this.$scrollTop=$,this._signal("changeScrollTop",$))},A.prototype.getScrollTop=function(){return this.$scrollTop},A.prototype.setScrollLeft=function($){this.$scrollLeft===$||isNaN($)||(this.$scrollLeft=$,this._signal("changeScrollLeft",$))},A.prototype.getScrollLeft=function(){return this.$scrollLeft},A.prototype.getScreenWidth=function(){return this.$computeWidth(),this.lineWidgets?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},A.prototype.getLineWidgetMaxWidth=function(){if(this.lineWidgetsWidth!=null)return this.lineWidgetsWidth;var $=0;return this.lineWidgets.forEach(function(w){w&&w.screenWidth>$&&($=w.screenWidth)}),this.lineWidgetWidth=$},A.prototype.$computeWidth=function($){if(this.$modified||$){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var w=this.doc.getAllLines(),C=this.$rowLengthCache,T=0,I=0,O=this.$foldData[I],R=O?O.start.row:1/0,P=w.length,B=0;B<P;B++){if(B>R){if(B=O.end.row+1,B>=P)break;O=this.$foldData[I++],R=O?O.start.row:1/0}C[B]==null&&(C[B]=this.$getStringScreenWidth(w[B])[0]),C[B]>T&&(T=C[B])}this.screenWidth=T}},A.prototype.getLine=function($){return this.doc.getLine($)},A.prototype.getLines=function($,w){return this.doc.getLines($,w)},A.prototype.getLength=function(){return this.doc.getLength()},A.prototype.getTextRange=function($){return this.doc.getTextRange($||this.selection.getRange())},A.prototype.insert=function($,w){return this.doc.insert($,w)},A.prototype.remove=function($){return this.doc.remove($)},A.prototype.removeFullLines=function($,w){return this.doc.removeFullLines($,w)},A.prototype.undoChanges=function($,w){if($.length){this.$fromUndo=!0;for(var C=$.length-1;C!=-1;C--){var T=$[C];T.action=="insert"||T.action=="remove"?this.doc.revertDelta(T):T.folds&&this.addFolds(T.folds)}!w&&this.$undoSelect&&($.selectionBefore?this.selection.fromJSON($.selectionBefore):this.selection.setRange(this.$getUndoSelection($,!0))),this.$fromUndo=!1}},A.prototype.redoChanges=function($,w){if($.length){this.$fromUndo=!0;for(var C=0;C<$.length;C++){var T=$[C];(T.action=="insert"||T.action=="remove")&&this.doc.$safeApplyDelta(T)}!w&&this.$undoSelect&&($.selectionAfter?this.selection.fromJSON($.selectionAfter):this.selection.setRange(this.$getUndoSelection($,!1))),this.$fromUndo=!1}},A.prototype.setUndoSelect=function($){this.$undoSelect=$},A.prototype.$getUndoSelection=function($,w){function C(P){return w?P.action!=="insert":P.action==="insert"}for(var T,I,O=0;O<$.length;O++){var R=$[O];if(R.start){if(!T){C(R)?T=r.fromPoints(R.start,R.end):T=r.fromPoints(R.start,R.start);continue}C(R)?(I=R.start,T.compare(I.row,I.column)==-1&&T.setStart(I),I=R.end,T.compare(I.row,I.column)==1&&T.setEnd(I)):(I=R.start,T.compare(I.row,I.column)==-1&&(T=r.fromPoints(R.start,R.start)))}}return T},A.prototype.replace=function($,w){return this.doc.replace($,w)},A.prototype.moveText=function($,w,C){var T=this.getTextRange($),I=this.getFoldsInRange($),O=r.fromPoints(w,w);if(!C){this.remove($);var R=$.start.row-$.end.row,P=R?-$.end.column:$.start.column-$.end.column;P&&(O.start.row==$.end.row&&O.start.column>$.end.column&&(O.start.column+=P),O.end.row==$.end.row&&O.end.column>$.end.column&&(O.end.column+=P)),R&&O.start.row>=$.end.row&&(O.start.row+=R,O.end.row+=R)}if(O.end=this.insert(O.start,T),I.length){var B=$.start,V=O.start,R=V.row-B.row,P=V.column-B.column;this.addFolds(I.map(function(U){return U=U.clone(),U.start.row==B.row&&(U.start.column+=P),U.end.row==B.row&&(U.end.column+=P),U.start.row+=R,U.end.row+=R,U}))}return O},A.prototype.indentRows=function($,w,C){C=C.replace(/\t/g,this.getTabString());for(var T=$;T<=w;T++)this.doc.insertInLine({row:T,column:0},C)},A.prototype.outdentRows=function($){for(var w=$.collapseRows(),C=new r(0,0,0,0),T=this.getTabSize(),I=w.start.row;I<=w.end.row;++I){var O=this.getLine(I);C.start.row=I,C.end.row=I;for(var R=0;R<T&&O.charAt(R)==" ";++R);R<T&&O.charAt(R)==" "?(C.start.column=R,C.end.column=R+1):(C.start.column=0,C.end.column=R),this.remove(C)}},A.prototype.$moveLines=function($,w,C){if($=this.getRowFoldStart($),w=this.getRowFoldEnd(w),C<0){var T=this.getRowFoldStart($+C);if(T<0)return 0;var I=T-$}else if(C>0){var T=this.getRowFoldEnd(w+C);if(T>this.doc.getLength()-1)return 0;var I=T-w}else{$=this.$clipRowToDocument($),w=this.$clipRowToDocument(w);var I=w-$+1}var O=new r($,0,w,Number.MAX_VALUE),R=this.getFoldsInRange(O).map(function(B){return B=B.clone(),B.start.row+=I,B.end.row+=I,B}),P=C==0?this.doc.getLines($,w):this.doc.removeFullLines($,w);return this.doc.insertFullLines($+I,P),R.length&&this.addFolds(R),I},A.prototype.moveLinesUp=function($,w){return this.$moveLines($,w,-1)},A.prototype.moveLinesDown=function($,w){return this.$moveLines($,w,1)},A.prototype.duplicateLines=function($,w){return this.$moveLines($,w,0)},A.prototype.$clipRowToDocument=function($){return Math.max(0,Math.min($,this.doc.getLength()-1))},A.prototype.$clipColumnToRow=function($,w){return w<0?0:Math.min(this.doc.getLine($).length,w)},A.prototype.$clipPositionToDocument=function($,w){if(w=Math.max(0,w),$<0)$=0,w=0;else{var C=this.doc.getLength();$>=C?($=C-1,w=this.doc.getLine(C-1).length):w=Math.min(this.doc.getLine($).length,w)}return{row:$,column:w}},A.prototype.$clipRangeToDocument=function($){$.start.row<0?($.start.row=0,$.start.column=0):$.start.column=this.$clipColumnToRow($.start.row,$.start.column);var w=this.doc.getLength()-1;return $.end.row>w?($.end.row=w,$.end.column=this.doc.getLine(w).length):$.end.column=this.$clipColumnToRow($.end.row,$.end.column),$},A.prototype.setUseWrapMode=function($){if($!=this.$useWrapMode){if(this.$useWrapMode=$,this.$modified=!0,this.$resetRowCache(0),$){var w=this.getLength();this.$wrapData=Array(w),this.$updateWrapData(0,w-1)}this._signal("changeWrapMode")}},A.prototype.getUseWrapMode=function(){return this.$useWrapMode},A.prototype.setWrapLimitRange=function($,w){(this.$wrapLimitRange.min!==$||this.$wrapLimitRange.max!==w)&&(this.$wrapLimitRange={min:$,max:w},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode"))},A.prototype.adjustWrapLimit=function($,w){var C=this.$wrapLimitRange;C.max<0&&(C={min:w,max:w});var T=this.$constrainWrapLimit($,C.min,C.max);return T!=this.$wrapLimit&&T>1?(this.$wrapLimit=T,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},A.prototype.$constrainWrapLimit=function($,w,C){return w&&($=Math.max(w,$)),C&&($=Math.min(C,$)),$},A.prototype.getWrapLimit=function(){return this.$wrapLimit},A.prototype.setWrapLimit=function($){this.setWrapLimitRange($,$)},A.prototype.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},A.prototype.$updateInternalDataOnChange=function($){var w=this.$useWrapMode,C=$.action,T=$.start,I=$.end,O=T.row,R=I.row,P=R-O,B=null;if(this.$updating=!0,P!=0)if(C==="remove"){this[w?"$wrapData":"$rowLengthCache"].splice(O,P);var V=this.$foldData;B=this.getFoldsInRange($),this.removeFolds(B);var W=this.getFoldLine(I.row),z=0;if(W){W.addRemoveChars(I.row,I.column,T.column-I.column),W.shiftRow(-P);var U=this.getFoldLine(O);U&&U!==W&&(U.merge(W),W=U),z=V.indexOf(W)+1}for(z;z<V.length;z++){var W=V[z];W.start.row>=I.row&&W.shiftRow(-P)}R=O}else{var G=Array(P);G.unshift(O,0);var Y=w?this.$wrapData:this.$rowLengthCache;Y.splice.apply(Y,G);var V=this.$foldData,W=this.getFoldLine(O),z=0;if(W){var Q=W.range.compareInside(T.row,T.column);Q==0?(W=W.split(T.row,T.column),W&&(W.shiftRow(P),W.addRemoveChars(R,0,I.column-T.column))):Q==-1&&(W.addRemoveChars(O,0,I.column-T.column),W.shiftRow(P)),z=V.indexOf(W)+1}for(z;z<V.length;z++){var W=V[z];W.start.row>=O&&W.shiftRow(P)}}else{P=Math.abs($.start.column-$.end.column),C==="remove"&&(B=this.getFoldsInRange($),this.removeFolds(B),P=-P);var W=this.getFoldLine(O);W&&W.addRemoveChars(O,T.column,P)}return w&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,w?this.$updateWrapData(O,R):this.$updateRowLengthCache(O,R),B},A.prototype.$updateRowLengthCache=function($,w){this.$rowLengthCache[$]=null,this.$rowLengthCache[w]=null},A.prototype.$updateWrapData=function($,w){var C=this.doc.getAllLines(),T=this.getTabSize(),I=this.$wrapData,O=this.$wrapLimit,R,P,B=$;for(w=Math.min(w,C.length-1);B<=w;)P=this.getFoldLine(B,P),P?(R=[],P.walk(function(V,W,z,U){var G;if(V!=null){G=this.$getDisplayTokens(V,R.length),G[0]=b;for(var Y=1;Y<G.length;Y++)G[Y]=g}else G=this.$getDisplayTokens(C[W].substring(U,z),R.length);R=R.concat(G)}.bind(this),P.end.row,C[P.end.row].length+1),I[P.start.row]=this.$computeWrapSplits(R,O,T),B=P.end.row+1):(R=this.$getDisplayTokens(C[B]),I[B]=this.$computeWrapSplits(R,O,T),B++)},A.prototype.$computeWrapSplits=function($,w,C){if($.length==0)return[];var T=[],I=$.length,O=0,R=0,P=this.$wrapAsCode,B=this.$indentedSoftWrap,V=w<=Math.max(2*C,8)||B===!1?0:Math.floor(w/2);function W(){var Q=0;if(V===0)return Q;if(B)for(var q=0;q<$.length;q++){var te=$[q];if(te==k)Q+=1;else if(te==D)Q+=C;else{if(te==_)continue;break}}return P&&B!==!1&&(Q+=C),Math.min(Q,V)}function z(Q){for(var q=Q-O,te=O;te<Q;te++){var re=$[te];(re===12||re===2)&&(q-=1)}T.length||(U=W(),T.indent=U),R+=q,T.push(R),O=Q}for(var U=0;I-O>w-U;){var G=O+w-U;if($[G-1]>=k&&$[G]>=k){z(G);continue}if($[G]==b||$[G]==g){for(G;G!=O-1&&$[G]!=b;G--);if(G>O){z(G);continue}for(G=O+w,G;G<$.length&&$[G]==g;G++);if(G==$.length)break;z(G);continue}for(var Y=Math.max(G-(w-(w>>2)),O-1);G>Y&&$[G]<b;)G--;if(P){for(;G>Y&&$[G]<b;)G--;for(;G>Y&&$[G]==S;)G--}else for(;G>Y&&$[G]<k;)G--;if(G>Y){z(++G);continue}G=O+w,$[G]==E&&G--,z(G-U)}return T},A.prototype.$getDisplayTokens=function($,w){var C=[],T;w=w||0;for(var I=0;I<$.length;I++){var O=$.charCodeAt(I);if(O==9){T=this.getScreenTabSize(C.length+w),C.push(D);for(var R=1;R<T;R++)C.push(_)}else O==32?C.push(k):O>39&&O<48||O>57&&O<64?C.push(S):O>=4352&&F(O)?C.push(x,E):C.push(x)}return C},A.prototype.$getStringScreenWidth=function($,w,C){if(w==0)return[0,0];w==null&&(w=1/0),C=C||0;var T,I;for(I=0;I<$.length&&(T=$.charCodeAt(I),T==9?C+=this.getScreenTabSize(C):T>=4352&&F(T)?C+=2:C+=1,!(C>w));I++);return[C,I]},A.prototype.getRowLength=function($){var w=1;return this.lineWidgets&&(w+=this.lineWidgets[$]&&this.lineWidgets[$].rowCount||0),!this.$useWrapMode||!this.$wrapData[$]?w:this.$wrapData[$].length+w},A.prototype.getRowLineCount=function($){return!this.$useWrapMode||!this.$wrapData[$]?1:this.$wrapData[$].length+1},A.prototype.getRowWrapIndent=function($){if(this.$useWrapMode){var w=this.screenToDocumentPosition($,Number.MAX_VALUE),C=this.$wrapData[w.row];return C.length&&C[0]<w.column?C.indent:0}else return 0},A.prototype.getScreenLastRowColumn=function($){var w=this.screenToDocumentPosition($,Number.MAX_VALUE);return this.documentToScreenColumn(w.row,w.column)},A.prototype.getDocumentLastRowColumn=function($,w){var C=this.documentToScreenRow($,w);return this.getScreenLastRowColumn(C)},A.prototype.getDocumentLastRowColumnPosition=function($,w){var C=this.documentToScreenRow($,w);return this.screenToDocumentPosition(C,Number.MAX_VALUE/10)},A.prototype.getRowSplitData=function($){if(this.$useWrapMode)return this.$wrapData[$]},A.prototype.getScreenTabSize=function($){return this.$tabSize-($%this.$tabSize|0)},A.prototype.screenToDocumentRow=function($,w){return this.screenToDocumentPosition($,w).row},A.prototype.screenToDocumentColumn=function($,w){return this.screenToDocumentPosition($,w).column},A.prototype.screenToDocumentPosition=function($,w,C){if($<0)return{row:0,column:0};var T,I=0,O=0,R,P=0,B=0,V=this.$screenRowCache,W=this.$getRowCacheIndex(V,$),z=V.length;if(z&&W>=0)var P=V[W],I=this.$docRowCache[W],U=$>V[z-1];else var U=!z;for(var G=this.getLength()-1,Y=this.getNextFoldLine(I),Q=Y?Y.start.row:1/0;P<=$&&(B=this.getRowLength(I),!(P+B>$||I>=G));)P+=B,I++,I>Q&&(I=Y.end.row+1,Y=this.getNextFoldLine(I,Y),Q=Y?Y.start.row:1/0),U&&(this.$docRowCache.push(I),this.$screenRowCache.push(P));if(Y&&Y.start.row<=I)T=this.getFoldDisplayLine(Y),I=Y.start.row;else{if(P+B<=$||I>G)return{row:G,column:this.getLine(G).length};T=this.getLine(I),Y=null}var q=0,te=Math.floor($-P);if(this.$useWrapMode){var re=this.$wrapData[I];re&&(R=re[te],te>0&&re.length&&(q=re.indent,O=re[te-1]||re[re.length-1],T=T.substring(O)))}return C!==void 0&&this.$bidiHandler.isBidiRow(P+te,I,te)&&(w=this.$bidiHandler.offsetToCol(C)),O+=this.$getStringScreenWidth(T,w-q)[1],this.$useWrapMode&&O>=R&&(O=R-1),Y?Y.idxToPosition(O):{row:I,column:O}},A.prototype.documentToScreenPosition=function($,w){if(typeof w>"u")var C=this.$clipPositionToDocument($.row,$.column);else C=this.$clipPositionToDocument($,w);$=C.row,w=C.column;var T=0,I=null,O=null;O=this.getFoldAt($,w,1),O&&($=O.start.row,w=O.start.column);var R,P=0,B=this.$docRowCache,V=this.$getRowCacheIndex(B,$),W=B.length;if(W&&V>=0)var P=B[V],T=this.$screenRowCache[V],z=$>B[W-1];else var z=!W;for(var U=this.getNextFoldLine(P),G=U?U.start.row:1/0;P<$;){if(P>=G){if(R=U.end.row+1,R>$)break;U=this.getNextFoldLine(R,U),G=U?U.start.row:1/0}else R=P+1;T+=this.getRowLength(P),P=R,z&&(this.$docRowCache.push(P),this.$screenRowCache.push(T))}var Y="";U&&P>=G?(Y=this.getFoldDisplayLine(U,$,w),I=U.start.row):(Y=this.getLine($).substring(0,w),I=$);var Q=0;if(this.$useWrapMode){var q=this.$wrapData[I];if(q){for(var te=0;Y.length>=q[te];)T++,te++;Y=Y.substring(q[te-1]||0,Y.length),Q=te>0?q.indent:0}}return this.lineWidgets&&this.lineWidgets[P]&&this.lineWidgets[P].rowsAbove&&(T+=this.lineWidgets[P].rowsAbove),{row:T,column:Q+this.$getStringScreenWidth(Y)[0]}},A.prototype.documentToScreenColumn=function($,w){return this.documentToScreenPosition($,w).column},A.prototype.documentToScreenRow=function($,w){return this.documentToScreenPosition($,w).row},A.prototype.getScreenLength=function(){var $=0,w=null;if(this.$useWrapMode)for(var I=this.$wrapData.length,O=0,T=0,w=this.$foldData[T++],R=w?w.start.row:1/0;O<I;){var P=this.$wrapData[O];$+=P?P.length+1:1,O++,O>R&&(O=w.end.row+1,w=this.$foldData[T++],R=w?w.start.row:1/0)}else{$=this.getLength();for(var C=this.$foldData,T=0;T<C.length;T++)w=C[T],$-=w.end.row-w.start.row}return this.lineWidgets&&($+=this.$getWidgetScreenLength()),$},A.prototype.$setFontMetrics=function($){this.$enableVarChar&&(this.$getStringScreenWidth=function(w,C,T){if(C===0)return[0,0];C||(C=1/0),T=T||0;var I,O;for(O=0;O<w.length&&(I=w.charAt(O),I===" "?T+=this.getScreenTabSize(T):T+=$.getCharacterWidth(I),!(T>C));O++);return[T,O]})},A.prototype.getPrecedingCharacter=function(){var $=this.selection.getCursor();if($.column===0)return $.row===0?"":this.doc.getNewLineCharacter();var w=this.getLine($.row);return w[$.column-1]},A.prototype.destroy=function(){this.destroyed||(this.bgTokenizer.setDocument(null),this.bgTokenizer.cleanup(),this.destroyed=!0),this.endOperation(),this.$stopWorker(),this.removeAllListeners(),this.doc&&this.doc.off("change",this.$onChange),this.selection&&(this.selection.off("changeCursor",this.$onSelectionChange),this.selection.off("changeSelection",this.$onSelectionChange)),this.selection.detach()},A}();y.$uid=0,y.prototype.$modes=o.$modes,y.prototype.getValue=y.prototype.toString,y.prototype.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},y.prototype.$overwrite=!1,y.prototype.$mode=null,y.prototype.$modeId=null,y.prototype.$scrollTop=0,y.prototype.$scrollLeft=0,y.prototype.$wrapLimit=80,y.prototype.$useWrapMode=!1,y.prototype.$wrapLimitRange={min:null,max:null},y.prototype.lineWidgets=null,y.prototype.isFullWidth=F,s.implement(y.prototype,p);var x=1,E=2,b=3,g=4,S=9,k=10,D=11,_=12;function F(A){return A<4352?!1:A>=4352&&A<=4447||A>=4515&&A<=4519||A>=4602&&A<=4607||A>=9001&&A<=9002||A>=11904&&A<=11929||A>=11931&&A<=12019||A>=12032&&A<=12245||A>=12272&&A<=12283||A>=12288&&A<=12350||A>=12353&&A<=12438||A>=12441&&A<=12543||A>=12549&&A<=12589||A>=12593&&A<=12686||A>=12688&&A<=12730||A>=12736&&A<=12771||A>=12784&&A<=12830||A>=12832&&A<=12871||A>=12880&&A<=13054||A>=13056&&A<=19903||A>=19968&&A<=42124||A>=42128&&A<=42182||A>=43360&&A<=43388||A>=44032&&A<=55203||A>=55216&&A<=55238||A>=55243&&A<=55291||A>=63744&&A<=64255||A>=65040&&A<=65049||A>=65072&&A<=65106||A>=65108&&A<=65126||A>=65128&&A<=65131||A>=65281&&A<=65376||A>=65504&&A<=65510}i("./edit_session/folding").Folding.call(y.prototype),i("./edit_session/bracket_match").BracketMatch.call(y.prototype),o.defineOptions(y.prototype,"session",{wrap:{set:function(A){if(!A||A=="off"?A=!1:A=="free"?A=!0:A=="printMargin"?A=-1:typeof A=="string"&&(A=parseInt(A,10)||!1),this.$wrap!=A)if(this.$wrap=A,!A)this.setUseWrapMode(!1);else{var $=typeof A=="number"?A:null;this.setWrapLimitRange($,$),this.setUseWrapMode(!0)}},get:function(){return this.getUseWrapMode()?this.$wrap==-1?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(A){A=A=="auto"?this.$mode.type!="text":A!="text",A!=this.$wrapAsCode&&(this.$wrapAsCode=A,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(A){this.$useWorker=A,this.$stopWorker(),A&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(A){A=parseInt(A),A>0&&this.$tabSize!==A&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=A,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(A){this.setFoldStyle(A)},handlesSet:!0},overwrite:{set:function(A){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(A){this.doc.setNewLineMode(A)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(A){this.setMode(A)},get:function(){return this.$modeId},handlesSet:!0}}),l.EditSession=y}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(i,l,v){var s=i("./lib/lang"),c=i("./lib/oop"),d=i("./range").Range,o=function(){function r(){this.$options={}}return r.prototype.set=function(h){return c.mixin(this.$options,h),this},r.prototype.getOptions=function(){return s.copyObject(this.$options)},r.prototype.setOptions=function(h){this.$options=h},r.prototype.find=function(h){var a=this.$options,u=this.$matchIterator(h,a);if(!u)return!1;var f=null;return u.forEach(function(m,y,x,E){return f=new d(m,y,x,E),y==E&&a.start&&a.start.start&&a.skipCurrent!=!1&&f.isEqual(a.start)?(f=null,!1):!0}),f},r.prototype.findAll=function(h){var a=this.$options;if(!a.needle)return[];this.$assembleRegExp(a);var u=a.range,f=u?h.getLines(u.start.row,u.end.row):h.doc.getAllLines(),m=[],y=a.re;if(a.$isMultiLine){var x=y.length,E=f.length-x,b;e:for(var g=y.offset||0;g<=E;g++){for(var S=0;S<x;S++)if(f[g+S].search(y[S])==-1)continue e;var k=f[g],D=f[g+x-1],_=k.length-k.match(y[0])[0].length,F=D.match(y[x-1])[0].length;b&&b.end.row===g&&b.end.column>_||(m.push(b=new d(g,_,g+x-1,F)),x>2&&(g=g+x-2))}}else for(var A,$=0;$<f.length;$++)if(this.$isMultilineSearch(a)){var w=f.length-1;if(A=this.$multiLineForward(h,y,$,w),A){var C=A.endRow<=w?A.endRow-1:w;C>$&&($=C),m.push(new d(A.startRow,A.startCol,A.endRow,A.endCol))}}else{A=s.getMatchOffsets(f[$],y);for(var S=0;S<A.length;S++){var T=A[S];m.push(new d($,T.offset,$,T.offset+T.length))}}if(u){for(var I=u.start.column,O=u.end.column,$=0,S=m.length-1;$<S&&m[$].start.column<I&&m[$].start.row==0;)$++;for(var R=u.end.row-u.start.row;$<S&&m[S].end.column>O&&m[S].end.row==R;)S--;for(m=m.slice($,S+1),$=0,S=m.length;$<S;$++)m[$].start.row+=u.start.row,m[$].end.row+=u.start.row}return m},r.prototype.parseReplaceString=function(h){for(var a={DollarSign:36,Ampersand:38,Digit0:48,Digit1:49,Digit9:57,Backslash:92,n:110,t:116},u="",f=0,m=h.length;f<m;f++){var y=h.charCodeAt(f);if(y===a.Backslash){if(f++,f>=m){u+="\\";break}var x=h.charCodeAt(f);switch(x){case a.Backslash:u+="\\";break;case a.n:u+=`
|
|
207
|
+
`+t(this.$redoStack)},w}();s.prototype.hasUndo=s.prototype.canUndo,s.prototype.hasRedo=s.prototype.canRedo,s.prototype.isClean=s.prototype.isAtBookmark,s.prototype.markClean=s.prototype.bookmark;function c(w,g){for(var S=g;S--;){var k=w[S];if(k&&!k[0].ignore){for(;S<g-1;){var D=a(w[S],w[S+1]);w[S]=D[0],w[S+1]=D[1],S++}return!0}}}var d=i("./range").Range,o=d.comparePoints;d.comparePoints;function p(w){return{row:w.row,column:w.column}}function e(w){return{start:p(w.start),end:p(w.end),action:w.action,lines:w.lines.slice()}}function t(w){if(w=w||this,Array.isArray(w))return w.map(t).join(`
|
|
208
|
+
`);var g="";return w.action?(g=w.action=="insert"?"+":"-",g+="["+w.lines+"]"):w.value&&(Array.isArray(w.value)?g=w.value.map(r).join(`
|
|
209
|
+
`):g=r(w.value)),w.start&&(g+=r(w)),(w.id||w.rev)&&(g+=" ("+(w.id||w.rev)+")"),g}function r(w){return w.start.row+":"+w.start.column+"=>"+w.end.row+":"+w.end.column}function h(w,g){var S=w.action=="insert",k=g.action=="insert";if(S&&k)if(o(g.start,w.end)>=0)f(g,w,-1);else if(o(g.start,w.start)<=0)f(w,g,1);else return null;else if(S&&!k)if(o(g.start,w.end)>=0)f(g,w,-1);else if(o(g.end,w.start)<=0)f(w,g,-1);else return null;else if(!S&&k)if(o(g.start,w.start)>=0)f(g,w,1);else if(o(g.start,w.start)<=0)f(w,g,1);else return null;else if(!S&&!k)if(o(g.start,w.start)>=0)f(g,w,1);else if(o(g.end,w.start)<=0)f(w,g,-1);else return null;return[g,w]}function a(w,g){for(var S=w.length;S--;)for(var k=0;k<g.length;k++)if(!h(w[S],g[k])){for(;S<w.length;){for(;k--;)h(g[k],w[S]);k=g.length,S++}return[w,g]}return w.selectionBefore=g.selectionBefore=w.selectionAfter=g.selectionAfter=null,[g,w]}function u(w,g){var S=w.action=="insert",k=g.action=="insert";if(S&&k)o(w.start,g.start)<0?f(g,w,1):f(w,g,1);else if(S&&!k)o(w.start,g.end)>=0?f(w,g,-1):(o(w.start,g.start)<=0||f(w,d.fromPoints(g.start,w.start),-1),f(g,w,1));else if(!S&&k)o(g.start,w.end)>=0?f(g,w,-1):(o(g.start,w.start)<=0||f(g,d.fromPoints(w.start,g.start),-1),f(w,g,1));else if(!S&&!k)if(o(g.start,w.end)>=0)f(g,w,-1);else if(o(g.end,w.start)<=0)f(w,g,-1);else{var D,_;return o(w.start,g.start)<0&&(D=w,w=y(w,g.start)),o(w.end,g.end)>0&&(_=y(w,g.end)),m(g.end,w.start,w.end,-1),_&&!D&&(w.lines=_.lines,w.start=_.start,w.end=_.end,_=w),[g,D,_].filter(Boolean)}return[g,w]}function f(w,g,S){m(w.start,g.start,g.end,S),m(w.end,g.start,g.end,S)}function m(w,g,S,k){w.row==(k==1?g:S).row&&(w.column+=k*(S.column-g.column)),w.row+=k*(S.row-g.row)}function y(w,g){var S=w.lines,k=w.end;w.end=p(g);var D=w.end.row-w.start.row,_=S.splice(D,S.length),F=D?g.column:g.column-w.start.column;S.push(_[0].substring(0,F)),_[0]=_[0].substr(F);var A={start:p(g),end:k,lines:_,action:w.action};return A}function x(w,g){g=e(g);for(var S=w.length;S--;){for(var k=w[S],D=0;D<k.length;D++){var _=k[D],F=u(_,g);g=F[0],F.length!=2&&(F[2]?(k.splice(D+1,1,F[1],F[2]),D++):F[1]||(k.splice(D,1),D--))}k.length||w.splice(S,1)}return w}function E(w,g){for(var S=0;S<g.length;S++)for(var k=g[S],D=0;D<k.length;D++)x(w,k[D])}l.UndoManager=s}),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(i,l,v){var s=i("../range").Range,c=function(){function d(o,p){this.foldData=o,Array.isArray(p)?this.folds=p:p=this.folds=[p];var e=p[p.length-1];this.range=new s(p[0].start.row,p[0].start.column,e.end.row,e.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(t){t.setFoldLine(this)},this)}return d.prototype.shiftRow=function(o){this.start.row+=o,this.end.row+=o,this.folds.forEach(function(p){p.start.row+=o,p.end.row+=o})},d.prototype.addFold=function(o){if(o.sameRow){if(o.start.row<this.startRow||o.endRow>this.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(o),this.folds.sort(function(p,e){return-p.range.compareEnd(e.start.row,e.start.column)}),this.range.compareEnd(o.start.row,o.start.column)>0?(this.end.row=o.end.row,this.end.column=o.end.column):this.range.compareStart(o.end.row,o.end.column)<0&&(this.start.row=o.start.row,this.start.column=o.start.column)}else if(o.start.row==this.end.row)this.folds.push(o),this.end.row=o.end.row,this.end.column=o.end.column;else if(o.end.row==this.start.row)this.folds.unshift(o),this.start.row=o.start.row,this.start.column=o.start.column;else throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");o.foldLine=this},d.prototype.containsRow=function(o){return o>=this.start.row&&o<=this.end.row},d.prototype.walk=function(o,p,e){var t=0,r=this.folds,h,a,u,f=!0;p==null&&(p=this.end.row,e=this.end.column);for(var m=0;m<r.length;m++){if(h=r[m],a=h.range.compareStart(p,e),a==-1){o(null,p,e,t,f);return}if(u=o(null,h.start.row,h.start.column,t,f),u=!u&&o(h.placeholder,h.start.row,h.start.column,t),u||a===0)return;f=!h.sameRow,t=h.end.column}o(null,p,e,t,f)},d.prototype.getNextFoldTo=function(o,p){for(var e,t,r=0;r<this.folds.length;r++){if(e=this.folds[r],t=e.range.compareEnd(o,p),t==-1)return{fold:e,kind:"after"};if(t===0)return{fold:e,kind:"inside"}}return null},d.prototype.addRemoveChars=function(o,p,e){var t=this.getNextFoldTo(o,p),r,h;if(t){if(r=t.fold,t.kind=="inside"&&r.start.column!=p&&r.start.row!=o)window.console&&window.console.log(o,p,r);else if(r.start.row==o){h=this.folds;var a=h.indexOf(r);for(a===0&&(this.start.column+=e),a;a<h.length;a++){if(r=h[a],r.start.column+=e,!r.sameRow)return;r.end.column+=e}this.end.column+=e}}},d.prototype.split=function(o,p){var e=this.getNextFoldTo(o,p);if(!e||e.kind=="inside")return null;var t=e.fold,r=this.folds,h=this.foldData,a=r.indexOf(t),u=r[a-1];this.end.row=u.end.row,this.end.column=u.end.column,r=r.splice(a,r.length-a);var f=new d(h,r);return h.splice(h.indexOf(this)+1,0,f),f},d.prototype.merge=function(o){for(var p=o.folds,e=0;e<p.length;e++)this.addFold(p[e]);var t=this.foldData;t.splice(t.indexOf(o),1)},d.prototype.toString=function(){var o=[this.range.toString()+": ["];return this.folds.forEach(function(p){o.push(" "+p.toString())}),o.push("]"),o.join(`
|
|
210
|
+
`)},d.prototype.idxToPosition=function(o){for(var p=0,e=0;e<this.folds.length;e++){var t=this.folds[e];if(o-=t.start.column-p,o<0)return{row:t.start.row,column:t.start.column+o};if(o-=t.placeholder.length,o<0)return t.start;p=t.end.column}return{row:this.end.row,column:this.end.column+o}},d}();l.FoldLine=c}),ace.define("ace/range_list",["require","exports","module","ace/range"],function(i,l,v){var s=i("./range").Range,c=s.comparePoints,d=function(){function o(){this.ranges=[],this.$bias=1}return o.prototype.pointIndex=function(p,e,t){for(var r=this.ranges,h=t||0;h<r.length;h++){var a=r[h],u=c(p,a.end);if(!(u>0)){var f=c(p,a.start);return u===0?e&&f!==0?-h-2:h:f>0||f===0&&!e?h:-h-1}}return-h-1},o.prototype.add=function(p){var e=!p.isEmpty(),t=this.pointIndex(p.start,e);t<0&&(t=-t-1);var r=this.pointIndex(p.end,e,t);return r<0?r=-r-1:r++,this.ranges.splice(t,r-t,p)},o.prototype.addList=function(p){for(var e=[],t=p.length;t--;)e.push.apply(e,this.add(p[t]));return e},o.prototype.substractPoint=function(p){var e=this.pointIndex(p);if(e>=0)return this.ranges.splice(e,1)},o.prototype.merge=function(){var p=[],e=this.ranges;e=e.sort(function(u,f){return c(u.start,f.start)});for(var t=e[0],r,h=1;h<e.length;h++){r=t,t=e[h];var a=c(r.end,t.start);a<0||a==0&&!r.isEmpty()&&!t.isEmpty()||(c(r.end,t.end)<0&&(r.end.row=t.end.row,r.end.column=t.end.column),e.splice(h,1),p.push(t),t=r,h--)}return this.ranges=e,p},o.prototype.contains=function(p,e){return this.pointIndex({row:p,column:e})>=0},o.prototype.containsPoint=function(p){return this.pointIndex(p)>=0},o.prototype.rangeAtPoint=function(p){var e=this.pointIndex(p);if(e>=0)return this.ranges[e]},o.prototype.clipRows=function(p,e){var t=this.ranges;if(t[0].start.row>e||t[t.length-1].start.row<p)return[];var r=this.pointIndex({row:p,column:0});r<0&&(r=-r-1);var h=this.pointIndex({row:e,column:0},r);h<0&&(h=-h-1);for(var a=[],u=r;u<h;u++)a.push(t[u]);return a},o.prototype.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},o.prototype.attach=function(p){this.session&&this.detach(),this.session=p,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},o.prototype.detach=function(){this.session&&(this.session.removeListener("change",this.onChange),this.session=null)},o.prototype.$onChange=function(p){for(var e=p.start,t=p.end,r=e.row,h=t.row,a=this.ranges,u=0,f=a.length;u<f;u++){var m=a[u];if(m.end.row>=r)break}if(p.action=="insert")for(var y=h-r,x=-e.column+t.column;u<f;u++){var m=a[u];if(m.start.row>r)break;if(m.start.row==r&&m.start.column>=e.column&&(m.start.column==e.column&&this.$bias<=0||(m.start.column+=x,m.start.row+=y)),m.end.row==r&&m.end.column>=e.column){if(m.end.column==e.column&&this.$bias<0)continue;m.end.column==e.column&&x>0&&u<f-1&&m.end.column>m.start.column&&m.end.column==a[u+1].start.column&&(m.end.column-=x),m.end.column+=x,m.end.row+=y}}else for(var y=r-h,x=e.column-t.column;u<f;u++){var m=a[u];if(m.start.row>h)break;m.end.row<h&&(r<m.end.row||r==m.end.row&&e.column<m.end.column)?(m.end.row=r,m.end.column=e.column):m.end.row==h?m.end.column<=t.column?(y||m.end.column>e.column)&&(m.end.column=e.column,m.end.row=e.row):(m.end.column+=x,m.end.row+=y):m.end.row>h&&(m.end.row+=y),m.start.row<h&&(r<m.start.row||r==m.start.row&&e.column<m.start.column)?(m.start.row=r,m.start.column=e.column):m.start.row==h?m.start.column<=t.column?(y||m.start.column>e.column)&&(m.start.column=e.column,m.start.row=e.row):(m.start.column+=x,m.start.row+=y):m.start.row>h&&(m.start.row+=y)}if(y!=0&&u<f)for(;u<f;u++){var m=a[u];m.start.row+=y,m.end.row+=y}},o}();d.prototype.comparePoints=c,l.RangeList=d}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list"],function(i,l,v){var s=this&&this.__extends||function(){var r=function(h,a){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(u[m]=f[m])},r(h,a)};return function(h,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(h,a);function u(){this.constructor=h}h.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}}(),c=i("../range_list").RangeList,d=function(r){s(h,r);function h(a,u){var f=r.call(this)||this;return f.foldLine=null,f.placeholder=u,f.range=a,f.start=a.start,f.end=a.end,f.sameRow=a.start.row==a.end.row,f.subFolds=f.ranges=[],f}return h.prototype.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},h.prototype.setFoldLine=function(a){this.foldLine=a,this.subFolds.forEach(function(u){u.setFoldLine(a)})},h.prototype.clone=function(){var a=this.range.clone(),u=new h(a,this.placeholder);return this.subFolds.forEach(function(f){u.subFolds.push(f.clone())}),u.collapseChildren=this.collapseChildren,u},h.prototype.addSubFold=function(a){if(!this.range.isEqual(a)){p(a,this.start);for(var x=a.start.row,E=a.start.column,u=0,f=-1;u<this.subFolds.length&&(f=this.subFolds[u].range.compare(x,E),f==1);u++);var m=this.subFolds[u],y=0;if(f==0){if(m.range.containsRange(a))return m.addSubFold(a);y=1}for(var x=a.range.end.row,E=a.range.end.column,w=u,f=-1;w<this.subFolds.length&&(f=this.subFolds[w].range.compare(x,E),f==1);w++);f==0&&w++;for(var g=this.subFolds.splice(u,w-u,a),S=f==0?g.length-1:g.length,k=y;k<S;k++)a.addSubFold(g[k]);return a.setFoldLine(this.foldLine),a}},h.prototype.restoreRange=function(a){return t(a,this.start)},h}(c);function o(r,h){r.row-=h.row,r.row==0&&(r.column-=h.column)}function p(r,h){o(r.start,h),o(r.end,h)}function e(r,h){r.row==0&&(r.column+=h.column),r.row+=h.row}function t(r,h){e(r.start,h),e(r.end,h)}l.Fold=d}),ace.define("ace/edit_session/folding",["require","exports","module","ace/range","ace/edit_session/fold_line","ace/edit_session/fold","ace/token_iterator","ace/mouse/mouse_event"],function(i,l,v){var s=i("../range").Range,c=i("./fold_line").FoldLine,d=i("./fold").Fold,o=i("../token_iterator").TokenIterator,p=i("../mouse/mouse_event").MouseEvent;function e(){this.getFoldAt=function(t,r,h){var a=this.getFoldLine(t);if(!a)return null;for(var u=a.folds,f=0;f<u.length;f++){var m=u[f].range;if(m.contains(t,r)){if(h==1&&m.isEnd(t,r)&&!m.isEmpty())continue;if(h==-1&&m.isStart(t,r)&&!m.isEmpty())continue;return u[f]}}},this.getFoldsInRange=function(t){var r=t.start,h=t.end,a=this.$foldData,u=[];r.column+=1,h.column-=1;for(var f=0;f<a.length;f++){var m=a[f].range.compareRange(t);if(m!=2){if(m==-2)break;for(var y=a[f].folds,x=0;x<y.length;x++){var E=y[x];if(m=E.range.compareRange(t),m==-2)break;if(m==2)continue;if(m==42)break;u.push(E)}}}return r.column-=1,h.column+=1,u},this.getFoldsInRangeList=function(t){if(Array.isArray(t)){var r=[];t.forEach(function(h){r=r.concat(this.getFoldsInRange(h))},this)}else var r=this.getFoldsInRange(t);return r},this.getAllFolds=function(){for(var t=[],r=this.$foldData,h=0;h<r.length;h++)for(var a=0;a<r[h].folds.length;a++)t.push(r[h].folds[a]);return t},this.getFoldStringAt=function(t,r,h,a){if(a=a||this.getFoldLine(t),!a)return null;for(var u={end:{column:0}},f,m,y=0;y<a.folds.length;y++){m=a.folds[y];var x=m.range.compareEnd(t,r);if(x==-1){f=this.getLine(m.start.row).substring(u.end.column,m.start.column);break}else if(x===0)return null;u=m}return f||(f=this.getLine(m.start.row).substring(u.end.column)),h==-1?f.substring(0,r-u.end.column):h==1?f.substring(r-u.end.column):f},this.getFoldLine=function(t,r){var h=this.$foldData,a=0;for(r&&(a=h.indexOf(r)),a==-1&&(a=0),a;a<h.length;a++){var u=h[a];if(u.start.row<=t&&u.end.row>=t)return u;if(u.end.row>t)return null}return null},this.getNextFoldLine=function(t,r){var h=this.$foldData,a=0;for(r&&(a=h.indexOf(r)),a==-1&&(a=0),a;a<h.length;a++){var u=h[a];if(u.end.row>=t)return u}return null},this.getFoldedRowCount=function(t,r){for(var h=this.$foldData,a=r-t+1,u=0;u<h.length;u++){var f=h[u],m=f.end.row,y=f.start.row;if(m>=r){y<r&&(y>=t?a-=r-y:a=0);break}else m>=t&&(y>=t?a-=m-y:a-=m-t+1)}return a},this.$addFoldLine=function(t){return this.$foldData.push(t),this.$foldData.sort(function(r,h){return r.start.row-h.start.row}),t},this.addFold=function(t,r){var h=this.$foldData,a=!1,u;t instanceof d?u=t:(u=new d(r,t),u.collapseChildren=r.collapseChildren),this.$clipRangeToDocument(u.range);var f=u.start.row,m=u.start.column,y=u.end.row,x=u.end.column,E=this.getFoldAt(f,m,1),w=this.getFoldAt(y,x,-1);if(E&&w==E)return E.addSubFold(u);E&&!E.range.isStart(f,m)&&this.removeFold(E),w&&!w.range.isEnd(y,x)&&this.removeFold(w);var g=this.getFoldsInRange(u.range);g.length>0&&(this.removeFolds(g),u.collapseChildren||g.forEach(function(_){u.addSubFold(_)}));for(var S=0;S<h.length;S++){var k=h[S];if(y==k.start.row){k.addFold(u),a=!0;break}else if(f==k.end.row){if(k.addFold(u),a=!0,!u.sameRow){var D=h[S+1];if(D&&D.start.row==y){k.merge(D);break}}break}else if(y<=k.start.row)break}return a||(k=this.$addFoldLine(new c(this.$foldData,u))),this.$useWrapMode?this.$updateWrapData(k.start.row,k.start.row):this.$updateRowLengthCache(k.start.row,k.start.row),this.$modified=!0,this._signal("changeFold",{data:u,action:"add"}),u},this.addFolds=function(t){t.forEach(function(r){this.addFold(r)},this)},this.removeFold=function(t){var r=t.foldLine,h=r.start.row,a=r.end.row,u=this.$foldData,f=r.folds;if(f.length==1)u.splice(u.indexOf(r),1);else if(r.range.isEnd(t.end.row,t.end.column))f.pop(),r.end.row=f[f.length-1].end.row,r.end.column=f[f.length-1].end.column;else if(r.range.isStart(t.start.row,t.start.column))f.shift(),r.start.row=f[0].start.row,r.start.column=f[0].start.column;else if(t.sameRow)f.splice(f.indexOf(t),1);else{var m=r.split(t.start.row,t.start.column);f=m.folds,f.shift(),m.start.row=f[0].start.row,m.start.column=f[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(h,a):this.$updateRowLengthCache(h,a)),this.$modified=!0,this._signal("changeFold",{data:t,action:"remove"})},this.removeFolds=function(t){for(var r=[],h=0;h<t.length;h++)r.push(t[h]);r.forEach(function(a){this.removeFold(a)},this),this.$modified=!0},this.expandFold=function(t){this.removeFold(t),t.subFolds.forEach(function(r){t.restoreRange(r),this.addFold(r)},this),t.collapseChildren>0&&this.foldAll(t.start.row+1,t.end.row,t.collapseChildren-1),t.subFolds=[]},this.expandFolds=function(t){t.forEach(function(r){this.expandFold(r)},this)},this.unfold=function(t,r){var h,a;if(t==null)h=new s(0,0,this.getLength(),0),r==null&&(r=!0);else if(typeof t=="number")h=new s(t,0,t,this.getLine(t).length);else if("row"in t)h=s.fromPoints(t,t);else{if(Array.isArray(t))return a=[],t.forEach(function(f){a=a.concat(this.unfold(f))},this),a;h=t}a=this.getFoldsInRangeList(h);for(var u=a;a.length==1&&s.comparePoints(a[0].start,h.start)<0&&s.comparePoints(a[0].end,h.end)>0;)this.expandFolds(a),a=this.getFoldsInRangeList(h);if(r!=!1?this.removeFolds(a):this.expandFolds(a),u.length)return u},this.isRowFolded=function(t,r){return!!this.getFoldLine(t,r)},this.getRowFoldEnd=function(t,r){var h=this.getFoldLine(t,r);return h?h.end.row:t},this.getRowFoldStart=function(t,r){var h=this.getFoldLine(t,r);return h?h.start.row:t},this.getFoldDisplayLine=function(t,r,h,a,u){a==null&&(a=t.start.row),u==null&&(u=0),r==null&&(r=t.end.row),h==null&&(h=this.getLine(r).length);var f=this.doc,m="";return t.walk(function(y,x,E,w){if(!(x<a)){if(x==a){if(E<u)return;w=Math.max(u,w)}y!=null?m+=y:m+=f.getLine(x).substring(w,E)}},r,h),m},this.getDisplayLine=function(t,r,h,a){var u=this.getFoldLine(t);if(u)return this.getFoldDisplayLine(u,t,r,h,a);var f;return f=this.doc.getLine(t),f.substring(a||0,r||f.length)},this.$cloneFoldData=function(){var t=[];return t=this.$foldData.map(function(r){var h=r.folds.map(function(a){return a.clone()});return new c(t,h)}),t},this.toggleFold=function(t){var r=this.selection,h=r.getRange(),a,u;if(h.isEmpty()){var f=h.start;if(a=this.getFoldAt(f.row,f.column),a){this.expandFold(a);return}else if(t){var m=this.getFoldLine(f.row);m&&this.expandFolds(m.folds);return}else(u=this.findMatchingBracket(f))?h.comparePoint(u)==1?h.end=u:(h.start=u,h.start.column++,h.end.column--):(u=this.findMatchingBracket({row:f.row,column:f.column+1}))?(h.comparePoint(u)==1?h.end=u:h.start=u,h.start.column++):h=this.getCommentFoldRange(f.row,f.column)||h}else{var y=this.getFoldsInRange(h);if(t&&y.length){this.expandFolds(y);return}else y.length==1&&(a=y[0])}if(a||(a=this.getFoldAt(h.start.row,h.start.column)),a&&a.range.toString()==h.toString()){this.expandFold(a);return}var x="...";if(!h.isMultiLine()){if(x=this.getTextRange(h),x.length<4)return;x=x.trim().substring(0,2)+".."}this.addFold(x,h)},this.getCommentFoldRange=function(t,r,h){var a=new o(this,t,r),u=a.getCurrentToken(),f=u&&u.type;if(u&&/^comment|string/.test(f)){f=f.match(/comment|string/)[0],f=="comment"&&(f+="|doc-start|\\.doc");var m=new RegExp(f),y=new s;if(h!=1){do u=a.stepBackward();while(u&&m.test(u.type));u=a.stepForward()}y.start.row=a.getCurrentTokenRow(),y.start.column=a.getCurrentTokenColumn()+u.value.length,a=new o(this,t,r);var x=this.getState(a.$row);if(h!=-1){var E=-1;do if(u=a.stepForward(),E==-1){var w=this.getState(a.$row);x.toString()!==w.toString()&&(E=a.$row)}else if(a.$row>E)break;while(u&&m.test(u.type));u=a.stepBackward()}else u=a.getCurrentToken();return y.end.row=a.getCurrentTokenRow(),y.end.column=a.getCurrentTokenColumn(),y.start.row==y.end.row&&y.start.column>y.end.column?void 0:y}},this.foldAll=function(t,r,h,a){h==null&&(h=1e5);var u=this.foldWidgets;if(u){r=r||this.getLength(),t=t||0;for(var f=t;f<r;f++)if(u[f]==null&&(u[f]=this.getFoldWidget(f)),u[f]=="start"&&!(a&&!a(f))){var m=this.getFoldWidgetRange(f);m&&m.isMultiLine()&&m.end.row<=r&&m.start.row>=t&&(f=m.end.row,m.collapseChildren=h,this.addFold("...",m))}}},this.foldToLevel=function(t){for(this.foldAll();t-- >0;)this.unfold(null,!1)},this.foldAllComments=function(){var t=this;this.foldAll(null,null,null,function(r){for(var h=t.getTokens(r),a=0;a<h.length;a++){var u=h[a];if(!(u.type=="text"&&/^\s+$/.test(u.value)))return!!/comment/.test(u.type)}})},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(t){if(!this.$foldStyles[t])throw new Error("invalid fold style: "+t+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle!=t){this.$foldStyle=t,t=="manual"&&this.unfold();var r=this.$foldMode;this.$setFolding(null),this.$setFolding(r)}},this.$setFolding=function(t){if(this.$foldMode!=t){if(this.$foldMode=t,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation"),!t||this.$foldStyle=="manual"){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=t.getFoldWidget.bind(t,this,this.$foldStyle),this.getFoldWidgetRange=t.getFoldWidgetRange.bind(t,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.$tokenizerUpdateFoldWidgets=this.tokenizerUpdateFoldWidgets.bind(this),this.on("change",this.$updateFoldWidgets),this.on("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets)}},this.getParentFoldRangeData=function(t,r){var h=this.foldWidgets;if(!h||r&&h[t])return{};for(var a=t-1,u;a>=0;){var f=h[a];if(f==null&&(f=h[a]=this.getFoldWidget(a)),f=="start"){var m=this.getFoldWidgetRange(a);if(u||(u=m),m&&m.end.row>=t)break}a--}return{range:a!==-1&&m,firstRange:u}},this.onFoldWidgetClick=function(t,r){r instanceof p&&(r=r.domEvent);var h={children:r.shiftKey,all:r.ctrlKey||r.metaKey,siblings:r.altKey},a=this.$toggleFoldWidget(t,h);if(!a){var u=r.target||r.srcElement;u&&/ace_fold-widget/.test(u.className)&&(u.className+=" ace_invalid")}},this.$toggleFoldWidget=function(t,r){if(this.getFoldWidget){var h=this.getFoldWidget(t),a=this.getLine(t),u=h==="end"?-1:1,f=this.getFoldAt(t,u===-1?0:a.length,u);if(f)return r.children||r.all?this.removeFold(f):this.expandFold(f),f;var m=this.getFoldWidgetRange(t,!0);if(m&&!m.isMultiLine()&&(f=this.getFoldAt(m.start.row,m.start.column,1),f&&m.isEqual(f.range)))return this.removeFold(f),f;if(r.siblings){var y=this.getParentFoldRangeData(t);if(y.range)var x=y.range.start.row+1,E=y.range.end.row;this.foldAll(x,E,r.all?1e4:0)}else r.children?(E=m?m.end.row:this.getLength(),this.foldAll(t+1,E,r.all?1e4:0)):m&&(r.all&&(m.collapseChildren=1e4),this.addFold("...",m));return m}},this.toggleFoldWidget=function(t){var r=this.selection.getCursor().row;r=this.getRowFoldStart(r);var h=this.$toggleFoldWidget(r,{});if(!h){var a=this.getParentFoldRangeData(r,!0);if(h=a.range||a.firstRange,h){r=h.start.row;var u=this.getFoldAt(r,this.getLine(r).length,1);u?this.removeFold(u):this.addFold("...",h)}}},this.updateFoldWidgets=function(t){var r=t.start.row,h=t.end.row-r;if(h===0)this.foldWidgets[r]=null;else if(t.action=="remove")this.foldWidgets.splice(r,h+1,null);else{var a=Array(h+1);a.unshift(r,1),this.foldWidgets.splice.apply(this.foldWidgets,a)}},this.tokenizerUpdateFoldWidgets=function(t){var r=t.data;r.first!=r.last&&this.foldWidgets.length>r.first&&this.foldWidgets.splice(r.first,this.foldWidgets.length)}}l.Folding=e}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(i,l,v){var s=i("../token_iterator").TokenIterator,c=i("../range").Range;function d(){this.findMatchingBracket=function(o,p){if(o.column==0)return null;var e=p||this.getLine(o.row).charAt(o.column-1);if(e=="")return null;var t=e.match(/([\(\[\{])|([\)\]\}])/);return t?t[1]?this.$findClosingBracket(t[1],o):this.$findOpeningBracket(t[2],o):null},this.getBracketRange=function(o){var p=this.getLine(o.row),e=!0,t,r=p.charAt(o.column-1),h=r&&r.match(/([\(\[\{])|([\)\]\}])/);if(h||(r=p.charAt(o.column),o={row:o.row,column:o.column+1},h=r&&r.match(/([\(\[\{])|([\)\]\}])/),e=!1),!h)return null;if(h[1]){var a=this.$findClosingBracket(h[1],o);if(!a)return null;t=c.fromPoints(o,a),e||(t.end.column++,t.start.column--),t.cursor=t.end}else{var a=this.$findOpeningBracket(h[2],o);if(!a)return null;t=c.fromPoints(a,o),e||(t.start.column++,t.end.column--),t.cursor=t.start}return t},this.getMatchingBracketRanges=function(o,p){var e=this.getLine(o.row),t=/([\(\[\{])|([\)\]\}])/,r=!p&&e.charAt(o.column-1),h=r&&r.match(t);if(h||(r=(p===void 0||p)&&e.charAt(o.column),o={row:o.row,column:o.column+1},h=r&&r.match(t)),!h)return null;var a=new c(o.row,o.column-1,o.row,o.column),u=h[1]?this.$findClosingBracket(h[1],o):this.$findOpeningBracket(h[2],o);if(!u)return[a];var f=new c(u.row,u.column,u.row,u.column+1);return[a,f]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(o,p,e){var t=this.$brackets[o],r=1,h=new s(this,p.row,p.column),a=h.getCurrentToken();if(a||(a=h.stepForward()),!!a){e||(e=new RegExp("(\\.?"+a.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)").replace(/-close\b/,"-(close|open)")+")+"));for(var u=p.column-h.getCurrentTokenColumn()-2,f=a.value;;){for(;u>=0;){var m=f.charAt(u);if(m==t){if(r-=1,r==0)return{row:h.getCurrentTokenRow(),column:u+h.getCurrentTokenColumn()}}else m==o&&(r+=1);u-=1}do a=h.stepBackward();while(a&&!e.test(a.type));if(a==null)break;f=a.value,u=f.length-1}return null}},this.$findClosingBracket=function(o,p,e){var t=this.$brackets[o],r=1,h=new s(this,p.row,p.column),a=h.getCurrentToken();if(a||(a=h.stepForward()),!!a){e||(e=new RegExp("(\\.?"+a.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)").replace(/-open\b/,"-(close|open)")+")+"));for(var u=p.column-h.getCurrentTokenColumn();;){for(var f=a.value,m=f.length;u<m;){var y=f.charAt(u);if(y==t){if(r-=1,r==0)return{row:h.getCurrentTokenRow(),column:u+h.getCurrentTokenColumn()}}else y==o&&(r+=1);u+=1}do a=h.stepForward();while(a&&!e.test(a.type));if(a==null)break;u=0}return null}},this.getMatchingTags=function(o){var p=new s(this,o.row,o.column),e=this.$findTagName(p);if(e){var t=p.stepBackward();return t.value==="<"?this.$findClosingTag(p,e):this.$findOpeningTag(p,e)}},this.$findTagName=function(o){var p=o.getCurrentToken(),e=!1,t=!1;if(p&&p.type.indexOf("tag-name")===-1)do t?p=o.stepBackward():p=o.stepForward(),p&&(p.value==="/>"?t=!0:p.type.indexOf("tag-name")!==-1&&(e=!0));while(p&&!e);return p},this.$findClosingTag=function(o,p){var e,t=p.value,r=p.value,h=0,a=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);p=o.stepForward();var u=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+p.value.length),f=!1;do{if(e=p,e.type.indexOf("tag-close")!==-1&&!f){var m=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);f=!0}if(p=o.stepForward(),p){if(p.value===">"&&!f){var m=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);f=!0}if(p.type.indexOf("tag-name")!==-1){if(t=p.value,r===t){if(e.value==="<")h++;else if(e.value==="</"&&(h--,h<0)){o.stepBackward();var y=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+2);p=o.stepForward();var x=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+p.value.length);if(p.type.indexOf("tag-close")===-1&&(p=o.stepForward()),p&&p.value===">")var E=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);else return}}}else if(r===t&&p.value==="/>"&&(h--,h<0))var y=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+2),x=y,E=x,m=new c(u.end.row,u.end.column,u.end.row,u.end.column+1)}}while(p&&h>=0);if(a&&m&&y&&E&&u&&x)return{openTag:new c(a.start.row,a.start.column,m.end.row,m.end.column),closeTag:new c(y.start.row,y.start.column,E.end.row,E.end.column),openTagName:u,closeTagName:x}},this.$findOpeningTag=function(o,p){var e=o.getCurrentToken(),t=p.value,r=0,h=o.getCurrentTokenRow(),a=o.getCurrentTokenColumn(),u=a+2,f=new c(h,a,h,u);o.stepForward();var m=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+p.value.length);if(p.type.indexOf("tag-close")===-1&&(p=o.stepForward()),!(!p||p.value!==">")){var y=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);o.stepBackward(),o.stepBackward();do if(p=e,h=o.getCurrentTokenRow(),a=o.getCurrentTokenColumn(),u=a+p.value.length,e=o.stepBackward(),p){if(p.type.indexOf("tag-name")!==-1){if(t===p.value)if(e.value==="<"){if(r++,r>0){var x=new c(h,a,h,u),E=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);do p=o.stepForward();while(p&&p.value!==">");var w=new c(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1)}}else e.value==="</"&&r--}else if(p.value==="/>"){for(var g=0,S=e;S;){if(S.type.indexOf("tag-name")!==-1&&S.value===t){r--;break}else if(S.value==="<")break;S=o.stepBackward(),g++}for(var k=0;k<g;k++)o.stepForward()}}while(e&&r<=0);if(E&&w&&f&&y&&x&&m)return{openTag:new c(E.start.row,E.start.column,w.end.row,w.end.column),closeTag:new c(f.start.row,f.start.column,y.end.row,y.end.column),openTagName:x,closeTagName:m}}}}l.BracketMatch=d}),ace.define("ace/edit_session",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/bidihandler","ace/config","ace/lib/event_emitter","ace/selection","ace/mode/text","ace/range","ace/line_widgets","ace/document","ace/background_tokenizer","ace/search_highlight","ace/undomanager","ace/edit_session/folding","ace/edit_session/bracket_match"],function(i,l,v){var s=i("./lib/oop"),c=i("./lib/lang"),d=i("./bidihandler").BidiHandler,o=i("./config"),p=i("./lib/event_emitter").EventEmitter,e=i("./selection").Selection,t=i("./mode/text").Mode,r=i("./range").Range,h=i("./line_widgets").LineWidgets,a=i("./document").Document,u=i("./background_tokenizer").BackgroundTokenizer,f=i("./search_highlight").SearchHighlight,m=i("./undomanager").UndoManager,y=function(){function A($,C){this.doc,this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.$editor=null,this.prevOp={},this.$foldData=[],this.id="session"+ ++A.$uid,this.$foldData.toString=function(){return this.join(`
|
|
211
|
+
`)},this.$gutterCustomWidgets={},this.bgTokenizer=new u(new t().getTokenizer(),this);var b=this;this.bgTokenizer.on("update",function(T){b._signal("tokenizerUpdate",T)}),this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this),(typeof $!="object"||!$.getLine)&&($=new a($)),this.setDocument($),this.selection=new e(this),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.selection.on("changeCursor",this.$onSelectionChange),this.$bidiHandler=new d(this),o.resetOptions(this),this.setMode(C),o._signal("session",this),this.destroyed=!1,this.$initOperationListeners()}return A.prototype.$initOperationListeners=function(){var $=this;this.curOp=null,this.on("change",function(){$.curOp||($.startOperation(),$.curOp.selectionBefore=$.$lastSel),$.curOp.docChanged=!0},!0),this.on("changeSelection",function(){$.curOp||($.startOperation(),$.curOp.selectionBefore=$.$lastSel),$.curOp.selectionChanged=!0},!0),this.$operationResetTimer=c.delayedCall(this.endOperation.bind(this,!0))},A.prototype.startOperation=function($){if(this.curOp){if(!$||this.curOp.command)return;this.prevOp=this.curOp}$||($={}),this.$operationResetTimer.schedule(),this.curOp={command:$.command||{},args:$.args},this.curOp.selectionBefore=this.selection.toJSON(),this._signal("startOperation",$)},A.prototype.endOperation=function($){if(this.curOp){if($&&$.returnValue===!1){this.curOp=null,this._signal("endOperation",$);return}if($==!0&&this.curOp.command&&this.curOp.command.name=="mouse")return;var C=this.selection.toJSON();this.curOp.selectionAfter=C,this.$lastSel=this.selection.toJSON(),this.getUndoManager().addSelection(C),this._signal("beforeEndOperation"),this.prevOp=this.curOp,this.curOp=null,this._signal("endOperation",$)}},A.prototype.setDocument=function($){this.doc&&this.doc.off("change",this.$onChange),this.doc=$,$.on("change",this.$onChange,!0),this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},A.prototype.getDocument=function(){return this.doc},Object.defineProperty(A.prototype,"widgetManager",{get:function(){var $=new h(this);return this.widgetManager=$,this.$editor&&$.attach(this.$editor),$},set:function($){Object.defineProperty(this,"widgetManager",{writable:!0,enumerable:!0,configurable:!0,value:$})},enumerable:!1,configurable:!0}),A.prototype.$resetRowCache=function($){if(!$){this.$docRowCache=[],this.$screenRowCache=[];return}var C=this.$docRowCache.length,b=this.$getRowCacheIndex(this.$docRowCache,$)+1;C>b&&(this.$docRowCache.splice(b,C),this.$screenRowCache.splice(b,C))},A.prototype.$getRowCacheIndex=function($,C){for(var b=0,T=$.length-1;b<=T;){var I=b+T>>1,O=$[I];if(C>O)b=I+1;else if(C<O)T=I-1;else return I}return b-1},A.prototype.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.destroyed||this.bgTokenizer.start(0)},A.prototype.onChangeFold=function($){var C=$.data;this.$resetRowCache(C.start.row)},A.prototype.onChange=function($){this.$modified=!0,this.$bidiHandler.onChange($),this.$resetRowCache($.start.row);var C=this.$updateInternalDataOnChange($);!this.$fromUndo&&this.$undoManager&&(C&&C.length&&(this.$undoManager.add({action:"removeFolds",folds:C},this.mergeUndoDeltas),this.mergeUndoDeltas=!0),this.$undoManager.add($,this.mergeUndoDeltas),this.mergeUndoDeltas=!0,this.$informUndoManager.schedule()),this.bgTokenizer.$updateOnChange($),this._signal("change",$)},A.prototype.onSelectionChange=function(){this._signal("changeSelection")},A.prototype.setValue=function($){this.doc.setValue($),this.selection.moveTo(0,0),this.$resetRowCache(0),this.setUndoManager(this.$undoManager),this.getUndoManager().reset()},A.fromJSON=function($){typeof $=="string"&&($=JSON.parse($));var C=new m;C.$undoStack=$.history.undo,C.$redoStack=$.history.redo,C.mark=$.history.mark,C.$rev=$.history.rev;var b=new A($.value);return $.folds.forEach(function(T){b.addFold("...",r.fromPoints(T.start,T.end))}),b.setAnnotations($.annotations),b.setBreakpoints($.breakpoints),b.setMode($.mode),b.setScrollLeft($.scrollLeft),b.setScrollTop($.scrollTop),b.setUndoManager(C),b.selection.fromJSON($.selection),b},A.prototype.toJSON=function(){return{annotations:this.$annotations,breakpoints:this.$breakpoints,folds:this.getAllFolds().map(function($){return $.range}),history:this.getUndoManager(),mode:this.$mode.$id,scrollLeft:this.$scrollLeft,scrollTop:this.$scrollTop,selection:this.selection.toJSON(),value:this.doc.getValue()}},A.prototype.toString=function(){return this.doc.getValue()},A.prototype.getSelection=function(){return this.selection},A.prototype.getState=function($){return this.bgTokenizer.getState($)},A.prototype.getTokens=function($){return this.bgTokenizer.getTokens($)},A.prototype.getTokenAt=function($,C){var b=this.bgTokenizer.getTokens($),T,I=0;if(C==null){var O=b.length-1;I=this.getLine($).length}else for(var O=0;O<b.length&&(I+=b[O].value.length,!(I>=C));O++);return T=b[O],T?(T.index=O,T.start=I-T.value.length,T):null},A.prototype.setUndoManager=function($){if(this.$undoManager=$,this.$informUndoManager&&this.$informUndoManager.cancel(),$){var C=this;$.addSession(this),this.$syncInformUndoManager=function(){C.$informUndoManager.cancel(),C.mergeUndoDeltas=!1},this.$informUndoManager=c.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},A.prototype.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},A.prototype.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},A.prototype.getTabString=function(){return this.getUseSoftTabs()?c.stringRepeat(" ",this.getTabSize()):" "},A.prototype.setUseSoftTabs=function($){this.setOption("useSoftTabs",$)},A.prototype.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},A.prototype.setTabSize=function($){this.setOption("tabSize",$)},A.prototype.getTabSize=function(){return this.$tabSize},A.prototype.isTabStop=function($){return this.$useSoftTabs&&$.column%this.$tabSize===0},A.prototype.setNavigateWithinSoftTabs=function($){this.setOption("navigateWithinSoftTabs",$)},A.prototype.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},A.prototype.setOverwrite=function($){this.setOption("overwrite",$)},A.prototype.getOverwrite=function(){return this.$overwrite},A.prototype.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},A.prototype.addGutterDecoration=function($,C){this.$decorations[$]||(this.$decorations[$]=""),this.$decorations[$]+=" "+C,this._signal("changeBreakpoint",{})},A.prototype.removeGutterCustomWidget=function($){this.$editor&&this.$editor.renderer.$gutterLayer.$removeCustomWidget($)},A.prototype.addGutterCustomWidget=function($,C){this.$editor&&this.$editor.renderer.$gutterLayer.$addCustomWidget($,C)},A.prototype.removeGutterDecoration=function($,C){this.$decorations[$]=(this.$decorations[$]||"").replace(" "+C,""),this._signal("changeBreakpoint",{})},A.prototype.getBreakpoints=function(){return this.$breakpoints},A.prototype.setBreakpoints=function($){this.$breakpoints=[];for(var C=0;C<$.length;C++)this.$breakpoints[$[C]]="ace_breakpoint";this._signal("changeBreakpoint",{})},A.prototype.clearBreakpoints=function(){this.$breakpoints=[],this._signal("changeBreakpoint",{})},A.prototype.setBreakpoint=function($,C){C===void 0&&(C="ace_breakpoint"),C?this.$breakpoints[$]=C:delete this.$breakpoints[$],this._signal("changeBreakpoint",{})},A.prototype.clearBreakpoint=function($){delete this.$breakpoints[$],this._signal("changeBreakpoint",{})},A.prototype.addMarker=function($,C,b,T){var I=this.$markerId++,O={range:$,type:b||"line",renderer:typeof b=="function"?b:null,clazz:C,inFront:!!T,id:I};return T?(this.$frontMarkers[I]=O,this._signal("changeFrontMarker")):(this.$backMarkers[I]=O,this._signal("changeBackMarker")),I},A.prototype.addDynamicMarker=function($,C){if($.update){var b=this.$markerId++;return $.id=b,$.inFront=!!C,C?(this.$frontMarkers[b]=$,this._signal("changeFrontMarker")):(this.$backMarkers[b]=$,this._signal("changeBackMarker")),$}},A.prototype.removeMarker=function($){var C=this.$frontMarkers[$]||this.$backMarkers[$];if(C){var b=C.inFront?this.$frontMarkers:this.$backMarkers;delete b[$],this._signal(C.inFront?"changeFrontMarker":"changeBackMarker")}},A.prototype.getMarkers=function($){return $?this.$frontMarkers:this.$backMarkers},A.prototype.highlight=function($){if(!this.$searchHighlight){var C=new f(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(C)}this.$searchHighlight.setRegexp($)},A.prototype.highlightLines=function($,C,b,T){typeof C!="number"&&(b=C,C=$),b||(b="ace_step");var I=new r($,0,C,1/0);return I.id=this.addMarker(I,b,"fullLine",T),I},A.prototype.setAnnotations=function($){this.$annotations=$,this._signal("changeAnnotation",{})},A.prototype.getAnnotations=function(){return this.$annotations||[]},A.prototype.clearAnnotations=function(){this.setAnnotations([])},A.prototype.$detectNewLine=function($){var C=$.match(/^.*?(\r?\n)/m);C?this.$autoNewLine=C[1]:this.$autoNewLine=`
|
|
212
|
+
`},A.prototype.getWordRange=function($,C){var b=this.getLine($),T=!1;if(C>0&&(T=!!b.charAt(C-1).match(this.tokenRe)),T||(T=!!b.charAt(C).match(this.tokenRe)),T)var I=this.tokenRe;else if(/^\s+$/.test(b.slice(C-1,C+1)))var I=/\s/;else var I=this.nonTokenRe;var O=C;if(O>0){do O--;while(O>=0&&b.charAt(O).match(I));O++}for(var N=C;N<b.length&&b.charAt(N).match(I);)N++;return new r($,O,$,N)},A.prototype.getAWordRange=function($,C){for(var b=this.getWordRange($,C),T=this.getLine(b.end.row);T.charAt(b.end.column).match(/[ \t]/);)b.end.column+=1;return b},A.prototype.setNewLineMode=function($){this.doc.setNewLineMode($)},A.prototype.getNewLineMode=function(){return this.doc.getNewLineMode()},A.prototype.setUseWorker=function($){this.setOption("useWorker",$)},A.prototype.getUseWorker=function(){return this.$useWorker},A.prototype.onReloadTokenizer=function($){var C=$.data;this.bgTokenizer.start(C.first),this._signal("tokenizerUpdate",$)},A.prototype.setMode=function($,C){if($&&typeof $=="object"){if($.getTokenizer)return this.$onChangeMode($);var b=$,T=b.path}else T=$||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new t),this.$modes[T]&&!b){this.$onChangeMode(this.$modes[T]),C&&C();return}this.$modeId=T,o.loadModule(["mode",T],function(I){if(!this.destroyed){if(this.$modeId!==T)return C&&C();this.$modes[T]&&!b?this.$onChangeMode(this.$modes[T]):I&&I.Mode&&(I=new I.Mode(b),b||(this.$modes[T]=I,I.$id=T),this.$onChangeMode(I)),C&&C()}}.bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0)},A.prototype.$onChangeMode=function($,C){if(C||(this.$modeId=$.$id),this.$mode!==$){var b=this.$mode;this.$mode=$,this.$stopWorker(),this.$useWorker&&this.$startWorker();var T=$.getTokenizer();if(T.on!==void 0){var I=this.onReloadTokenizer.bind(this);T.on("update",I)}this.bgTokenizer.setTokenizer(T),this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=$.tokenRe,this.nonTokenRe=$.nonTokenRe,C||($.attachToSession&&$.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding($.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode",{oldMode:b,mode:$}))}},A.prototype.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},A.prototype.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch($){o.warn("Could not load worker",$),this.$worker=null}},A.prototype.getMode=function(){return this.$mode},A.prototype.setScrollTop=function($){this.$scrollTop===$||isNaN($)||(this.$scrollTop=$,this._signal("changeScrollTop",$))},A.prototype.getScrollTop=function(){return this.$scrollTop},A.prototype.setScrollLeft=function($){this.$scrollLeft===$||isNaN($)||(this.$scrollLeft=$,this._signal("changeScrollLeft",$))},A.prototype.getScrollLeft=function(){return this.$scrollLeft},A.prototype.getScreenWidth=function(){return this.$computeWidth(),this.lineWidgets?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},A.prototype.getLineWidgetMaxWidth=function(){if(this.lineWidgetsWidth!=null)return this.lineWidgetsWidth;var $=0;return this.lineWidgets.forEach(function(C){C&&C.screenWidth>$&&($=C.screenWidth)}),this.lineWidgetWidth=$},A.prototype.$computeWidth=function($){if(this.$modified||$){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var C=this.doc.getAllLines(),b=this.$rowLengthCache,T=0,I=0,O=this.$foldData[I],N=O?O.start.row:1/0,P=C.length,B=0;B<P;B++){if(B>N){if(B=O.end.row+1,B>=P)break;O=this.$foldData[I++],N=O?O.start.row:1/0}b[B]==null&&(b[B]=this.$getStringScreenWidth(C[B])[0]),b[B]>T&&(T=b[B])}this.screenWidth=T}},A.prototype.getLine=function($){return this.doc.getLine($)},A.prototype.getLines=function($,C){return this.doc.getLines($,C)},A.prototype.getLength=function(){return this.doc.getLength()},A.prototype.getTextRange=function($){return this.doc.getTextRange($||this.selection.getRange())},A.prototype.insert=function($,C){return this.doc.insert($,C)},A.prototype.remove=function($){return this.doc.remove($)},A.prototype.removeFullLines=function($,C){return this.doc.removeFullLines($,C)},A.prototype.undoChanges=function($,C){if($.length){this.$fromUndo=!0;for(var b=$.length-1;b!=-1;b--){var T=$[b];T.action=="insert"||T.action=="remove"?this.doc.revertDelta(T):T.folds&&this.addFolds(T.folds)}!C&&this.$undoSelect&&($.selectionBefore?this.selection.fromJSON($.selectionBefore):this.selection.setRange(this.$getUndoSelection($,!0))),this.$fromUndo=!1}},A.prototype.redoChanges=function($,C){if($.length){this.$fromUndo=!0;for(var b=0;b<$.length;b++){var T=$[b];(T.action=="insert"||T.action=="remove")&&this.doc.$safeApplyDelta(T)}!C&&this.$undoSelect&&($.selectionAfter?this.selection.fromJSON($.selectionAfter):this.selection.setRange(this.$getUndoSelection($,!1))),this.$fromUndo=!1}},A.prototype.setUndoSelect=function($){this.$undoSelect=$},A.prototype.$getUndoSelection=function($,C){function b(P){return C?P.action!=="insert":P.action==="insert"}for(var T,I,O=0;O<$.length;O++){var N=$[O];if(N.start){if(!T){b(N)?T=r.fromPoints(N.start,N.end):T=r.fromPoints(N.start,N.start);continue}b(N)?(I=N.start,T.compare(I.row,I.column)==-1&&T.setStart(I),I=N.end,T.compare(I.row,I.column)==1&&T.setEnd(I)):(I=N.start,T.compare(I.row,I.column)==-1&&(T=r.fromPoints(N.start,N.start)))}}return T},A.prototype.replace=function($,C){return this.doc.replace($,C)},A.prototype.moveText=function($,C,b){var T=this.getTextRange($),I=this.getFoldsInRange($),O=r.fromPoints(C,C);if(!b){this.remove($);var N=$.start.row-$.end.row,P=N?-$.end.column:$.start.column-$.end.column;P&&(O.start.row==$.end.row&&O.start.column>$.end.column&&(O.start.column+=P),O.end.row==$.end.row&&O.end.column>$.end.column&&(O.end.column+=P)),N&&O.start.row>=$.end.row&&(O.start.row+=N,O.end.row+=N)}if(O.end=this.insert(O.start,T),I.length){var B=$.start,V=O.start,N=V.row-B.row,P=V.column-B.column;this.addFolds(I.map(function(U){return U=U.clone(),U.start.row==B.row&&(U.start.column+=P),U.end.row==B.row&&(U.end.column+=P),U.start.row+=N,U.end.row+=N,U}))}return O},A.prototype.indentRows=function($,C,b){b=b.replace(/\t/g,this.getTabString());for(var T=$;T<=C;T++)this.doc.insertInLine({row:T,column:0},b)},A.prototype.outdentRows=function($){for(var C=$.collapseRows(),b=new r(0,0,0,0),T=this.getTabSize(),I=C.start.row;I<=C.end.row;++I){var O=this.getLine(I);b.start.row=I,b.end.row=I;for(var N=0;N<T&&O.charAt(N)==" ";++N);N<T&&O.charAt(N)==" "?(b.start.column=N,b.end.column=N+1):(b.start.column=0,b.end.column=N),this.remove(b)}},A.prototype.$moveLines=function($,C,b){if($=this.getRowFoldStart($),C=this.getRowFoldEnd(C),b<0){var T=this.getRowFoldStart($+b);if(T<0)return 0;var I=T-$}else if(b>0){var T=this.getRowFoldEnd(C+b);if(T>this.doc.getLength()-1)return 0;var I=T-C}else{$=this.$clipRowToDocument($),C=this.$clipRowToDocument(C);var I=C-$+1}var O=new r($,0,C,Number.MAX_VALUE),N=this.getFoldsInRange(O).map(function(B){return B=B.clone(),B.start.row+=I,B.end.row+=I,B}),P=b==0?this.doc.getLines($,C):this.doc.removeFullLines($,C);return this.doc.insertFullLines($+I,P),N.length&&this.addFolds(N),I},A.prototype.moveLinesUp=function($,C){return this.$moveLines($,C,-1)},A.prototype.moveLinesDown=function($,C){return this.$moveLines($,C,1)},A.prototype.duplicateLines=function($,C){return this.$moveLines($,C,0)},A.prototype.$clipRowToDocument=function($){return Math.max(0,Math.min($,this.doc.getLength()-1))},A.prototype.$clipColumnToRow=function($,C){return C<0?0:Math.min(this.doc.getLine($).length,C)},A.prototype.$clipPositionToDocument=function($,C){if(C=Math.max(0,C),$<0)$=0,C=0;else{var b=this.doc.getLength();$>=b?($=b-1,C=this.doc.getLine(b-1).length):C=Math.min(this.doc.getLine($).length,C)}return{row:$,column:C}},A.prototype.$clipRangeToDocument=function($){$.start.row<0?($.start.row=0,$.start.column=0):$.start.column=this.$clipColumnToRow($.start.row,$.start.column);var C=this.doc.getLength()-1;return $.end.row>C?($.end.row=C,$.end.column=this.doc.getLine(C).length):$.end.column=this.$clipColumnToRow($.end.row,$.end.column),$},A.prototype.setUseWrapMode=function($){if($!=this.$useWrapMode){if(this.$useWrapMode=$,this.$modified=!0,this.$resetRowCache(0),$){var C=this.getLength();this.$wrapData=Array(C),this.$updateWrapData(0,C-1)}this._signal("changeWrapMode")}},A.prototype.getUseWrapMode=function(){return this.$useWrapMode},A.prototype.setWrapLimitRange=function($,C){(this.$wrapLimitRange.min!==$||this.$wrapLimitRange.max!==C)&&(this.$wrapLimitRange={min:$,max:C},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode"))},A.prototype.adjustWrapLimit=function($,C){var b=this.$wrapLimitRange;b.max<0&&(b={min:C,max:C});var T=this.$constrainWrapLimit($,b.min,b.max);return T!=this.$wrapLimit&&T>1?(this.$wrapLimit=T,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},A.prototype.$constrainWrapLimit=function($,C,b){return C&&($=Math.max(C,$)),b&&($=Math.min(b,$)),$},A.prototype.getWrapLimit=function(){return this.$wrapLimit},A.prototype.setWrapLimit=function($){this.setWrapLimitRange($,$)},A.prototype.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},A.prototype.$updateInternalDataOnChange=function($){var C=this.$useWrapMode,b=$.action,T=$.start,I=$.end,O=T.row,N=I.row,P=N-O,B=null;if(this.$updating=!0,P!=0)if(b==="remove"){this[C?"$wrapData":"$rowLengthCache"].splice(O,P);var V=this.$foldData;B=this.getFoldsInRange($),this.removeFolds(B);var W=this.getFoldLine(I.row),z=0;if(W){W.addRemoveChars(I.row,I.column,T.column-I.column),W.shiftRow(-P);var U=this.getFoldLine(O);U&&U!==W&&(U.merge(W),W=U),z=V.indexOf(W)+1}for(z;z<V.length;z++){var W=V[z];W.start.row>=I.row&&W.shiftRow(-P)}N=O}else{var G=Array(P);G.unshift(O,0);var Y=C?this.$wrapData:this.$rowLengthCache;Y.splice.apply(Y,G);var V=this.$foldData,W=this.getFoldLine(O),z=0;if(W){var Q=W.range.compareInside(T.row,T.column);Q==0?(W=W.split(T.row,T.column),W&&(W.shiftRow(P),W.addRemoveChars(N,0,I.column-T.column))):Q==-1&&(W.addRemoveChars(O,0,I.column-T.column),W.shiftRow(P)),z=V.indexOf(W)+1}for(z;z<V.length;z++){var W=V[z];W.start.row>=O&&W.shiftRow(P)}}else{P=Math.abs($.start.column-$.end.column),b==="remove"&&(B=this.getFoldsInRange($),this.removeFolds(B),P=-P);var W=this.getFoldLine(O);W&&W.addRemoveChars(O,T.column,P)}return C&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,C?this.$updateWrapData(O,N):this.$updateRowLengthCache(O,N),B},A.prototype.$updateRowLengthCache=function($,C){this.$rowLengthCache[$]=null,this.$rowLengthCache[C]=null},A.prototype.$updateWrapData=function($,C){var b=this.doc.getAllLines(),T=this.getTabSize(),I=this.$wrapData,O=this.$wrapLimit,N,P,B=$;for(C=Math.min(C,b.length-1);B<=C;)P=this.getFoldLine(B,P),P?(N=[],P.walk(function(V,W,z,U){var G;if(V!=null){G=this.$getDisplayTokens(V,N.length),G[0]=w;for(var Y=1;Y<G.length;Y++)G[Y]=g}else G=this.$getDisplayTokens(b[W].substring(U,z),N.length);N=N.concat(G)}.bind(this),P.end.row,b[P.end.row].length+1),I[P.start.row]=this.$computeWrapSplits(N,O,T),B=P.end.row+1):(N=this.$getDisplayTokens(b[B]),I[B]=this.$computeWrapSplits(N,O,T),B++)},A.prototype.$computeWrapSplits=function($,C,b){if($.length==0)return[];var T=[],I=$.length,O=0,N=0,P=this.$wrapAsCode,B=this.$indentedSoftWrap,V=C<=Math.max(2*b,8)||B===!1?0:Math.floor(C/2);function W(){var Q=0;if(V===0)return Q;if(B)for(var q=0;q<$.length;q++){var te=$[q];if(te==k)Q+=1;else if(te==D)Q+=b;else{if(te==_)continue;break}}return P&&B!==!1&&(Q+=b),Math.min(Q,V)}function z(Q){for(var q=Q-O,te=O;te<Q;te++){var re=$[te];(re===12||re===2)&&(q-=1)}T.length||(U=W(),T.indent=U),N+=q,T.push(N),O=Q}for(var U=0;I-O>C-U;){var G=O+C-U;if($[G-1]>=k&&$[G]>=k){z(G);continue}if($[G]==w||$[G]==g){for(G;G!=O-1&&$[G]!=w;G--);if(G>O){z(G);continue}for(G=O+C,G;G<$.length&&$[G]==g;G++);if(G==$.length)break;z(G);continue}for(var Y=Math.max(G-(C-(C>>2)),O-1);G>Y&&$[G]<w;)G--;if(P){for(;G>Y&&$[G]<w;)G--;for(;G>Y&&$[G]==S;)G--}else for(;G>Y&&$[G]<k;)G--;if(G>Y){z(++G);continue}G=O+C,$[G]==E&&G--,z(G-U)}return T},A.prototype.$getDisplayTokens=function($,C){var b=[],T;C=C||0;for(var I=0;I<$.length;I++){var O=$.charCodeAt(I);if(O==9){T=this.getScreenTabSize(b.length+C),b.push(D);for(var N=1;N<T;N++)b.push(_)}else O==32?b.push(k):O>39&&O<48||O>57&&O<64?b.push(S):O>=4352&&F(O)?b.push(x,E):b.push(x)}return b},A.prototype.$getStringScreenWidth=function($,C,b){if(C==0)return[0,0];C==null&&(C=1/0),b=b||0;var T,I;for(I=0;I<$.length&&(T=$.charCodeAt(I),T==9?b+=this.getScreenTabSize(b):T>=4352&&F(T)?b+=2:b+=1,!(b>C));I++);return[b,I]},A.prototype.getRowLength=function($){var C=1;return this.lineWidgets&&(C+=this.lineWidgets[$]&&this.lineWidgets[$].rowCount||0),!this.$useWrapMode||!this.$wrapData[$]?C:this.$wrapData[$].length+C},A.prototype.getRowLineCount=function($){return!this.$useWrapMode||!this.$wrapData[$]?1:this.$wrapData[$].length+1},A.prototype.getRowWrapIndent=function($){if(this.$useWrapMode){var C=this.screenToDocumentPosition($,Number.MAX_VALUE),b=this.$wrapData[C.row];return b.length&&b[0]<C.column?b.indent:0}else return 0},A.prototype.getScreenLastRowColumn=function($){var C=this.screenToDocumentPosition($,Number.MAX_VALUE);return this.documentToScreenColumn(C.row,C.column)},A.prototype.getDocumentLastRowColumn=function($,C){var b=this.documentToScreenRow($,C);return this.getScreenLastRowColumn(b)},A.prototype.getDocumentLastRowColumnPosition=function($,C){var b=this.documentToScreenRow($,C);return this.screenToDocumentPosition(b,Number.MAX_VALUE/10)},A.prototype.getRowSplitData=function($){if(this.$useWrapMode)return this.$wrapData[$]},A.prototype.getScreenTabSize=function($){return this.$tabSize-($%this.$tabSize|0)},A.prototype.screenToDocumentRow=function($,C){return this.screenToDocumentPosition($,C).row},A.prototype.screenToDocumentColumn=function($,C){return this.screenToDocumentPosition($,C).column},A.prototype.screenToDocumentPosition=function($,C,b){if($<0)return{row:0,column:0};var T,I=0,O=0,N,P=0,B=0,V=this.$screenRowCache,W=this.$getRowCacheIndex(V,$),z=V.length;if(z&&W>=0)var P=V[W],I=this.$docRowCache[W],U=$>V[z-1];else var U=!z;for(var G=this.getLength()-1,Y=this.getNextFoldLine(I),Q=Y?Y.start.row:1/0;P<=$&&(B=this.getRowLength(I),!(P+B>$||I>=G));)P+=B,I++,I>Q&&(I=Y.end.row+1,Y=this.getNextFoldLine(I,Y),Q=Y?Y.start.row:1/0),U&&(this.$docRowCache.push(I),this.$screenRowCache.push(P));if(Y&&Y.start.row<=I)T=this.getFoldDisplayLine(Y),I=Y.start.row;else{if(P+B<=$||I>G)return{row:G,column:this.getLine(G).length};T=this.getLine(I),Y=null}var q=0,te=Math.floor($-P);if(this.$useWrapMode){var re=this.$wrapData[I];re&&(N=re[te],te>0&&re.length&&(q=re.indent,O=re[te-1]||re[re.length-1],T=T.substring(O)))}return b!==void 0&&this.$bidiHandler.isBidiRow(P+te,I,te)&&(C=this.$bidiHandler.offsetToCol(b)),O+=this.$getStringScreenWidth(T,C-q)[1],this.$useWrapMode&&O>=N&&(O=N-1),Y?Y.idxToPosition(O):{row:I,column:O}},A.prototype.documentToScreenPosition=function($,C){if(typeof C>"u")var b=this.$clipPositionToDocument($.row,$.column);else b=this.$clipPositionToDocument($,C);$=b.row,C=b.column;var T=0,I=null,O=null;O=this.getFoldAt($,C,1),O&&($=O.start.row,C=O.start.column);var N,P=0,B=this.$docRowCache,V=this.$getRowCacheIndex(B,$),W=B.length;if(W&&V>=0)var P=B[V],T=this.$screenRowCache[V],z=$>B[W-1];else var z=!W;for(var U=this.getNextFoldLine(P),G=U?U.start.row:1/0;P<$;){if(P>=G){if(N=U.end.row+1,N>$)break;U=this.getNextFoldLine(N,U),G=U?U.start.row:1/0}else N=P+1;T+=this.getRowLength(P),P=N,z&&(this.$docRowCache.push(P),this.$screenRowCache.push(T))}var Y="";U&&P>=G?(Y=this.getFoldDisplayLine(U,$,C),I=U.start.row):(Y=this.getLine($).substring(0,C),I=$);var Q=0;if(this.$useWrapMode){var q=this.$wrapData[I];if(q){for(var te=0;Y.length>=q[te];)T++,te++;Y=Y.substring(q[te-1]||0,Y.length),Q=te>0?q.indent:0}}return this.lineWidgets&&this.lineWidgets[P]&&this.lineWidgets[P].rowsAbove&&(T+=this.lineWidgets[P].rowsAbove),{row:T,column:Q+this.$getStringScreenWidth(Y)[0]}},A.prototype.documentToScreenColumn=function($,C){return this.documentToScreenPosition($,C).column},A.prototype.documentToScreenRow=function($,C){return this.documentToScreenPosition($,C).row},A.prototype.getScreenLength=function(){var $=0,C=null;if(this.$useWrapMode)for(var I=this.$wrapData.length,O=0,T=0,C=this.$foldData[T++],N=C?C.start.row:1/0;O<I;){var P=this.$wrapData[O];$+=P?P.length+1:1,O++,O>N&&(O=C.end.row+1,C=this.$foldData[T++],N=C?C.start.row:1/0)}else{$=this.getLength();for(var b=this.$foldData,T=0;T<b.length;T++)C=b[T],$-=C.end.row-C.start.row}return this.lineWidgets&&($+=this.$getWidgetScreenLength()),$},A.prototype.$setFontMetrics=function($){this.$enableVarChar&&(this.$getStringScreenWidth=function(C,b,T){if(b===0)return[0,0];b||(b=1/0),T=T||0;var I,O;for(O=0;O<C.length&&(I=C.charAt(O),I===" "?T+=this.getScreenTabSize(T):T+=$.getCharacterWidth(I),!(T>b));O++);return[T,O]})},A.prototype.getPrecedingCharacter=function(){var $=this.selection.getCursor();if($.column===0)return $.row===0?"":this.doc.getNewLineCharacter();var C=this.getLine($.row);return C[$.column-1]},A.prototype.destroy=function(){this.destroyed||(this.bgTokenizer.setDocument(null),this.bgTokenizer.cleanup(),this.destroyed=!0),this.endOperation(),this.$stopWorker(),this.removeAllListeners(),this.doc&&this.doc.off("change",this.$onChange),this.selection&&(this.selection.off("changeCursor",this.$onSelectionChange),this.selection.off("changeSelection",this.$onSelectionChange)),this.selection.detach()},A}();y.$uid=0,y.prototype.$modes=o.$modes,y.prototype.getValue=y.prototype.toString,y.prototype.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},y.prototype.$overwrite=!1,y.prototype.$mode=null,y.prototype.$modeId=null,y.prototype.$scrollTop=0,y.prototype.$scrollLeft=0,y.prototype.$wrapLimit=80,y.prototype.$useWrapMode=!1,y.prototype.$wrapLimitRange={min:null,max:null},y.prototype.lineWidgets=null,y.prototype.isFullWidth=F,s.implement(y.prototype,p);var x=1,E=2,w=3,g=4,S=9,k=10,D=11,_=12;function F(A){return A<4352?!1:A>=4352&&A<=4447||A>=4515&&A<=4519||A>=4602&&A<=4607||A>=9001&&A<=9002||A>=11904&&A<=11929||A>=11931&&A<=12019||A>=12032&&A<=12245||A>=12272&&A<=12283||A>=12288&&A<=12350||A>=12353&&A<=12438||A>=12441&&A<=12543||A>=12549&&A<=12589||A>=12593&&A<=12686||A>=12688&&A<=12730||A>=12736&&A<=12771||A>=12784&&A<=12830||A>=12832&&A<=12871||A>=12880&&A<=13054||A>=13056&&A<=19903||A>=19968&&A<=42124||A>=42128&&A<=42182||A>=43360&&A<=43388||A>=44032&&A<=55203||A>=55216&&A<=55238||A>=55243&&A<=55291||A>=63744&&A<=64255||A>=65040&&A<=65049||A>=65072&&A<=65106||A>=65108&&A<=65126||A>=65128&&A<=65131||A>=65281&&A<=65376||A>=65504&&A<=65510}i("./edit_session/folding").Folding.call(y.prototype),i("./edit_session/bracket_match").BracketMatch.call(y.prototype),o.defineOptions(y.prototype,"session",{wrap:{set:function(A){if(!A||A=="off"?A=!1:A=="free"?A=!0:A=="printMargin"?A=-1:typeof A=="string"&&(A=parseInt(A,10)||!1),this.$wrap!=A)if(this.$wrap=A,!A)this.setUseWrapMode(!1);else{var $=typeof A=="number"?A:null;this.setWrapLimitRange($,$),this.setUseWrapMode(!0)}},get:function(){return this.getUseWrapMode()?this.$wrap==-1?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(A){A=A=="auto"?this.$mode.type!="text":A!="text",A!=this.$wrapAsCode&&(this.$wrapAsCode=A,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(A){this.$useWorker=A,this.$stopWorker(),A&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(A){A=parseInt(A),A>0&&this.$tabSize!==A&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=A,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(A){this.setFoldStyle(A)},handlesSet:!0},overwrite:{set:function(A){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(A){this.doc.setNewLineMode(A)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(A){this.setMode(A)},get:function(){return this.$modeId},handlesSet:!0}}),l.EditSession=y}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(i,l,v){var s=i("./lib/lang"),c=i("./lib/oop"),d=i("./range").Range,o=function(){function r(){this.$options={}}return r.prototype.set=function(h){return c.mixin(this.$options,h),this},r.prototype.getOptions=function(){return s.copyObject(this.$options)},r.prototype.setOptions=function(h){this.$options=h},r.prototype.find=function(h){var a=this.$options,u=this.$matchIterator(h,a);if(!u)return!1;var f=null;return u.forEach(function(m,y,x,E){return f=new d(m,y,x,E),y==E&&a.start&&a.start.start&&a.skipCurrent!=!1&&f.isEqual(a.start)?(f=null,!1):!0}),f},r.prototype.findAll=function(h){var a=this.$options;if(!a.needle)return[];this.$assembleRegExp(a);var u=a.range,f=u?h.getLines(u.start.row,u.end.row):h.doc.getAllLines(),m=[],y=a.re;if(a.$isMultiLine){var x=y.length,E=f.length-x,w;e:for(var g=y.offset||0;g<=E;g++){for(var S=0;S<x;S++)if(f[g+S].search(y[S])==-1)continue e;var k=f[g],D=f[g+x-1],_=k.length-k.match(y[0])[0].length,F=D.match(y[x-1])[0].length;w&&w.end.row===g&&w.end.column>_||(m.push(w=new d(g,_,g+x-1,F)),x>2&&(g=g+x-2))}}else for(var A,$=0;$<f.length;$++)if(this.$isMultilineSearch(a)){var C=f.length-1;if(A=this.$multiLineForward(h,y,$,C),A){var b=A.endRow<=C?A.endRow-1:C;b>$&&($=b),m.push(new d(A.startRow,A.startCol,A.endRow,A.endCol))}}else{A=s.getMatchOffsets(f[$],y);for(var S=0;S<A.length;S++){var T=A[S];m.push(new d($,T.offset,$,T.offset+T.length))}}if(u){for(var I=u.start.column,O=u.end.column,$=0,S=m.length-1;$<S&&m[$].start.column<I&&m[$].start.row==0;)$++;for(var N=u.end.row-u.start.row;$<S&&m[S].end.column>O&&m[S].end.row==N;)S--;for(m=m.slice($,S+1),$=0,S=m.length;$<S;$++)m[$].start.row+=u.start.row,m[$].end.row+=u.start.row}return m},r.prototype.parseReplaceString=function(h){for(var a={DollarSign:36,Ampersand:38,Digit0:48,Digit1:49,Digit9:57,Backslash:92,n:110,t:116},u="",f=0,m=h.length;f<m;f++){var y=h.charCodeAt(f);if(y===a.Backslash){if(f++,f>=m){u+="\\";break}var x=h.charCodeAt(f);switch(x){case a.Backslash:u+="\\";break;case a.n:u+=`
|
|
213
213
|
`;break;case a.t:u+=" ";break}continue}if(y===a.DollarSign){if(f++,f>=m){u+="$";break}var E=h.charCodeAt(f);if(E===a.DollarSign){u+="$$";continue}if(E===a.Digit0||E===a.Ampersand){u+="$&";continue}if(a.Digit1<=E&&E<=a.Digit9){u+="$"+h[f];continue}}u+=h[f]}return u||h},r.prototype.replace=function(h,a){var u=this.$options,f=this.$assembleRegExp(u);if(u.$isMultiLine)return a;if(f){var m=this.$isMultilineSearch(u);m&&(h=h.replace(/\r\n|\r|\n/g,`
|
|
214
214
|
`));var y=f.exec(h);if(!y||!m&&y[0].length!=h.length)return null;if(a=u.regExp?this.parseReplaceString(a):a.replace(/\$/g,"$$$$"),a=h.replace(f,a),u.preserveCase){a=a.split("");for(var x=Math.min(h.length,h.length);x--;){var E=h[x];E&&E.toLowerCase()!=E?a[x]=a[x].toUpperCase():a[x]=a[x].toLowerCase()}a=a.join("")}return a}},r.prototype.$assembleRegExp=function(h,a){if(h.needle instanceof RegExp)return h.re=h.needle;var u=h.needle;if(!h.needle)return h.re=!1;h.regExp||(u=s.escapeRegExp(u));var f=h.caseSensitive?"gm":"gmi";try{new RegExp(u,"u"),h.$supportsUnicodeFlag=!0,f+="u"}catch{h.$supportsUnicodeFlag=!1}if(h.wholeWord&&(u=p(u,h)),h.$isMultiLine=!a&&/[\n\r]/.test(u),h.$isMultiLine)return h.re=this.$assembleMultilineRegExp(u,f);try{var m=new RegExp(u,f)}catch{m=!1}return h.re=m},r.prototype.$assembleMultilineRegExp=function(h,a){for(var u=h.replace(/\r\n|\r|\n/g,`$
|
|
215
215
|
^`).split(`
|
|
216
|
-
`),f=[],m=0;m<u.length;m++)try{f.push(new RegExp(u[m],a))}catch{return!1}return f},r.prototype.$isMultilineSearch=function(h){return h.re&&/\\r\\n|\\r|\\n/.test(h.re.source)&&h.regExp&&!h.$isMultiLine},r.prototype.$multiLineForward=function(h,a,u,f){for(var m,y=t(h,u),x=u;x<=f;){for(var E=0;E<y&&!(x>f);E++){var
|
|
217
|
-
`+
|
|
216
|
+
`),f=[],m=0;m<u.length;m++)try{f.push(new RegExp(u[m],a))}catch{return!1}return f},r.prototype.$isMultilineSearch=function(h){return h.re&&/\\r\\n|\\r|\\n/.test(h.re.source)&&h.regExp&&!h.$isMultiLine},r.prototype.$multiLineForward=function(h,a,u,f){for(var m,y=t(h,u),x=u;x<=f;){for(var E=0;E<y&&!(x>f);E++){var w=h.getLine(x++);m=m==null?w:m+`
|
|
217
|
+
`+w}var g=a.exec(m);if(a.lastIndex=0,g){var S=m.slice(0,g.index).split(`
|
|
218
218
|
`),k=g[0].split(`
|
|
219
|
-
`),D=u+S.length-1,_=S[S.length-1].length,F=D+k.length-1,A=k.length==1?_+k[0].length:k[k.length-1].length;return{startRow:D,startCol:_,endRow:F,endCol:A}}}return null},r.prototype.$multiLineBackward=function(h,a,u,f,m){for(var y,x=t(h,f),E=h.getLine(f).length-u,
|
|
219
|
+
`),D=u+S.length-1,_=S[S.length-1].length,F=D+k.length-1,A=k.length==1?_+k[0].length:k[k.length-1].length;return{startRow:D,startCol:_,endRow:F,endCol:A}}}return null},r.prototype.$multiLineBackward=function(h,a,u,f,m){for(var y,x=t(h,f),E=h.getLine(f).length-u,w=f;w>=m;){for(var g=0;g<x&&w>=m;g++){var S=h.getLine(w--);y=y==null?S:S+`
|
|
220
220
|
`+y}var k=e(y,a,E);if(k){var D=y.slice(0,k.index).split(`
|
|
221
221
|
`),_=k[0].split(`
|
|
222
|
-
`),F=b+D.length,A=D[D.length-1].length,$=F+_.length-1,w=_.length==1?A+_[0].length:_[_.length-1].length;return{startRow:F,startCol:A,endRow:$,endCol:w}}}return null},r.prototype.$matchIterator=function(h,a){var u=this.$assembleRegExp(a);if(!u)return!1;var f=this.$isMultilineSearch(a),m=this.$multiLineForward,y=this.$multiLineBackward,x=a.backwards==!0,E=a.skipCurrent!=!1,b=u.unicode,g=a.range,S=a.start;S||(S=g?g[x?"end":"start"]:h.selection.getRange()),S.start&&(S=S[E!=x?"end":"start"]);var k=g?g.start.row:0,D=g?g.end.row:h.getLength()-1;if(x)var _=function($){var w=S.row;if(!A(w,S.column,$)){for(w--;w>=k;w--)if(A(w,Number.MAX_VALUE,$))return;if(a.wrap!=!1){for(w=D,k=S.row;w>=k;w--)if(A(w,Number.MAX_VALUE,$))return}}};else var _=function(w){var C=S.row;if(!A(C,S.column,w)){for(C=C+1;C<=D;C++)if(A(C,0,w))return;if(a.wrap!=!1){for(C=k,D=S.row;C<=D;C++)if(A(C,0,w))return}}};if(a.$isMultiLine)var F=u.length,A=function($,w,C){var T=x?$-F+1:$;if(!(T<0||T+F>h.getLength())){var I=h.getLine(T),O=I.search(u[0]);if(!(!x&&O<w||O===-1)){for(var R=1;R<F;R++)if(I=h.getLine(T+R),I.search(u[R])==-1)return;var P=I.match(u[F-1])[0].length;if(!(x&&P>w)&&C(T,O,T+F-1,P))return!0}}};else if(x)var A=function(w,C,T){if(f){var I=y(h,u,C,w,k);if(!I)return!1;if(T(I.startRow,I.startCol,I.endRow,I.endCol))return!0}else{var O=h.getLine(w),R=[],P,B=0;for(u.lastIndex=0;P=u.exec(O);){var V=P[0].length;if(B=P.index,!V){if(B>=O.length)break;u.lastIndex=B+=s.skipEmptyMatch(O,B,b)}if(P.index+V>C)break;R.push(P.index,V)}for(var W=R.length-1;W>=0;W-=2){var z=R[W-1],V=R[W];if(T(w,z,w,z+V))return!0}}};else var A=function(w,C,T){if(u.lastIndex=C,f){var I=m(h,u,w,D);if(I){var O=I.endRow<=D?I.endRow-1:D;O>w&&(w=O)}if(!I)return!1;if(T(I.startRow,I.startCol,I.endRow,I.endCol))return!0}else for(var R=h.getLine(w),P,B;B=u.exec(R);){var V=B[0].length;if(P=B.index,T(w,P,w,P+V))return!0;if(!V&&(u.lastIndex=P+=s.skipEmptyMatch(R,P,b),P>=R.length))return!1}};return{forEach:_}},r}();function p(r,h){var a=s.supportsLookbehind();function u(x,E){E===void 0&&(E=!0);var b=a&&h.$supportsUnicodeFlag?new RegExp("[\\p{L}\\p{N}_]","u"):new RegExp("\\w");return b.test(x)||h.regExp?a&&h.$supportsUnicodeFlag?E?"(?<=^|[^\\p{L}\\p{N}_])":"(?=[^\\p{L}\\p{N}_]|$)":"\\b":""}var f=Array.from(r),m=f[0],y=f[f.length-1];return u(m)+r+u(y,!1)}function e(r,h,a){for(var u=null,f=0;f<=r.length;){h.lastIndex=f;var m=h.exec(r);if(!m)break;var y=m.index+m[0].length;if(y>r.length-a)break;(!u||y>u.index+u[0].length)&&(u=m),f=m.index+1}return u}function t(r,h){var a=5e3,u={row:h,column:0},f=r.doc.positionToIndex(u),m=f+a,y=r.doc.indexToPosition(m),x=y.row;return x+1}l.Search=o}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(i,l,v){var s=this&&this.__extends||function(){var r=function(h,a){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(u[m]=f[m])},r(h,a)};return function(h,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(h,a);function u(){this.constructor=h}h.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}}(),c=i("../lib/keys"),d=i("../lib/useragent"),o=c.KEY_MODS,p=function(){function r(h,a){this.$init(h,a,!1)}return r.prototype.$init=function(h,a,u){this.platform=a||(d.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(h),this.$singleCommand=u},r.prototype.addCommand=function(h){this.commands[h.name]&&this.removeCommand(h),this.commands[h.name]=h,h.bindKey&&this._buildKeyHash(h)},r.prototype.removeCommand=function(h,a){var u=h&&(typeof h=="string"?h:h.name);h=this.commands[u],a||delete this.commands[u];var f=this.commandKeyBinding;for(var m in f){var y=f[m];if(y==h)delete f[m];else if(Array.isArray(y)){var x=y.indexOf(h);x!=-1&&(y.splice(x,1),y.length==1&&(f[m]=y[0]))}}},r.prototype.bindKey=function(h,a,u){if(typeof h=="object"&&h&&(u==null&&(u=h.position),h=h[this.platform]),!!h){if(typeof a=="function")return this.addCommand({exec:a,bindKey:h,name:a.name||h});h.split("|").forEach(function(f){var m="";if(f.indexOf(" ")!=-1){var y=f.split(/\s+/);f=y.pop(),y.forEach(function(b){var g=this.parseKeys(b),S=o[g.hashId]+g.key;m+=(m?" ":"")+S,this._addCommandToBinding(m,"chainKeys")},this),m+=" "}var x=this.parseKeys(f),E=o[x.hashId]+x.key;this._addCommandToBinding(m+E,a,u)},this)}},r.prototype._addCommandToBinding=function(h,a,u){var f=this.commandKeyBinding,m;if(!a)delete f[h];else if(!f[h]||this.$singleCommand)f[h]=a;else{Array.isArray(f[h])?(m=f[h].indexOf(a))!=-1&&f[h].splice(m,1):f[h]=[f[h]],typeof u!="number"&&(u=e(a));var y=f[h];for(m=0;m<y.length;m++){var x=y[m],E=e(x);if(E>u)break}y.splice(m,0,a)}},r.prototype.addCommands=function(h){h&&Object.keys(h).forEach(function(a){var u=h[a];if(u){if(typeof u=="string")return this.bindKey(u,a);typeof u=="function"&&(u={exec:u}),typeof u=="object"&&(u.name||(u.name=a),this.addCommand(u))}},this)},r.prototype.removeCommands=function(h){Object.keys(h).forEach(function(a){this.removeCommand(h[a])},this)},r.prototype.bindKeys=function(h){Object.keys(h).forEach(function(a){this.bindKey(a,h[a])},this)},r.prototype._buildKeyHash=function(h){this.bindKey(h.bindKey,h)},r.prototype.parseKeys=function(h){var a=h.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(E){return E}),u=a.pop(),f=c[u];if(c.FUNCTION_KEYS[f])u=c.FUNCTION_KEYS[f].toLowerCase();else if(a.length){if(a.length==1&&a[0]=="shift")return{key:u.toUpperCase(),hashId:-1}}else return{key:u,hashId:-1};for(var m=0,y=a.length;y--;){var x=c.KEY_MODS[a[y]];if(x==null)return typeof console<"u"&&console.error("invalid modifier "+a[y]+" in "+h),!1;m|=x}return{key:u,hashId:m}},r.prototype.findKeyCommand=function(h,a){var u=o[h]+a;return this.commandKeyBinding[u]},r.prototype.handleKeyboard=function(h,a,u,f){if(!(f<0)){var m=o[a]+u,y=this.commandKeyBinding[m];return h.$keyChain&&(h.$keyChain+=" "+m,y=this.commandKeyBinding[h.$keyChain]||y),y&&(y=="chainKeys"||y[y.length-1]=="chainKeys")?(h.$keyChain=h.$keyChain||m,{command:"null"}):(h.$keyChain&&((!a||a==4)&&u.length==1?h.$keyChain=h.$keyChain.slice(0,-m.length-1):(a==-1||f>0)&&(h.$keyChain="")),{command:y})}},r.prototype.getStatusText=function(h,a){return a.$keyChain||""},r}();function e(r){return typeof r=="object"&&r.bindKey&&r.bindKey.position||(r.isDefault?-100:0)}var t=function(r){s(h,r);function h(a,u){var f=r.call(this,a,u)||this;return f.$singleCommand=!0,f}return h}(p);t.call=function(r,h,a){p.prototype.$init.call(r,h,a,!0)},p.call=function(r,h,a){p.prototype.$init.call(r,h,a,!1)},l.HashHandler=t,l.MultiHashHandler=p}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(i,l,v){var s=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,a){h.__proto__=a}||function(h,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(h[u]=a[u])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function h(){this.constructor=t}t.prototype=r===null?Object.create(r):(h.prototype=r.prototype,new h)}}(),c=i("../lib/oop"),d=i("../keyboard/hash_handler").MultiHashHandler,o=i("../lib/event_emitter").EventEmitter,p=function(e){s(t,e);function t(r,h){var a=e.call(this,h,r)||this;return a.byName=a.commands,a.setDefaultHandler("exec",function(u){return u.args?u.command.exec(u.editor,u.args,u.event,!1):u.command.exec(u.editor,{},u.event,!0)}),a}return t.prototype.exec=function(r,h,a){if(Array.isArray(r)){for(var u=r.length;u--;)if(this.exec(r[u],h,a))return!0;return!1}typeof r=="string"&&(r=this.commands[r]);var f={editor:h,command:r,args:a};return this.canExecute(r,h)?(f.returnValue=this._emit("exec",f),this._signal("afterExec",f),f.returnValue!==!1):(this._signal("commandUnavailable",f),!1)},t.prototype.canExecute=function(r,h){return typeof r=="string"&&(r=this.commands[r]),!(!r||h&&h.$readOnly&&!r.readOnly||this.$checkCommandState!=!1&&r.isAvailable&&!r.isAvailable(h))},t.prototype.toggleRecording=function(r){if(!this.$inReplay)return r&&r._emit("changeStatus"),this.recording?(this.macro.pop(),this.off("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(h){this.macro.push([h.command,h.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},t.prototype.replay=function(r){if(!(this.$inReplay||!this.macro)){if(this.recording)return this.toggleRecording(r);try{this.$inReplay=!0,this.macro.forEach(function(h){typeof h=="string"?this.exec(h,r):this.exec(h[0],r,h[1])},this)}finally{this.$inReplay=!1}}},t.prototype.trimMacro=function(r){return r.map(function(h){return typeof h[0]!="string"&&(h[0]=h[0].name),h[1]||(h=h[0]),h})},t}(d);c.implement(p.prototype,o),l.CommandManager=p}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(i,l,v){var s=i("../lib/lang"),c=i("../config"),d=i("../range").Range;function o(e,t){return{win:e,mac:t}}l.commands=[{name:"showSettingsMenu",description:"Show settings menu",bindKey:o("Ctrl-,","Command-,"),exec:function(e){c.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",description:"Go to next error",bindKey:o("Alt-E","F4"),exec:function(e){c.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",description:"Go to previous error",bindKey:o("Alt-Shift-E","Shift-F4"),exec:function(e){c.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:o("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:o(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:o("Ctrl-L","Command-L"),exec:function(e,t){typeof t=="number"&&!isNaN(t)&&e.gotoLine(t),e.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:o("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:o("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",description:"Toggle fold widget",bindKey:o("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",description:"Toggle parent fold widget",bindKey:o("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:o(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldAllComments",description:"Fold all comments",bindKey:o(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAllComments()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:o("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:o("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:o("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:o("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:o("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:o("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:o("Ctrl-F","Command-F"),exec:function(e){c.loadModule("ace/ext/searchbox",function(t){t.Search(e)})},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:o("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",description:"Go to start",bindKey:o("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",description:"Select up",bindKey:o("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:o("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",description:"Select to end",bindKey:o("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",description:"Go to end",bindKey:o("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",description:"Select down",bindKey:o("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:o("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:o("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:o("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:o("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",description:"Go to line start",bindKey:o("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:o("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:o("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:o("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:o("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:o("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",description:"Go to line end",bindKey:o("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:o("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:o("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:o(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:o("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:o(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:o("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:o("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:o("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:o("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:o("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:o("Ctrl-Shift-\\|Ctrl-Shift-P","Command-Shift-\\"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:o("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",description:"Pass keys to browser",bindKey:o(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",description:"Copy",exec:function(e){},readOnly:!0},{name:"cut",description:"Cut",exec:function(e){var t=e.$copyWithEmptySelection&&e.selection.isEmpty(),r=t?e.selection.getLineRange():e.selection.getRange();e._emit("cut",r),r.isEmpty()||e.session.remove(r),e.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(e,t){e.$handlePaste(t)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:o("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:o("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:o("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:o("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:o("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:o("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:o("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:o("Ctrl-H","Command-Option-F"),exec:function(e){c.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",description:"Undo",bindKey:o("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",description:"Redo",bindKey:o("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:o("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:o("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:o("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:o("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:o("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:o("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:o("Shift-Delete",null),exec:function(e){if(e.selection.isEmpty())e.remove("left");else return!1},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:o("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:o("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:o("Ctrl-Shift-Backspace",null),exec:function(e){var t=e.selection.getRange();t.start.column=0,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:o("Ctrl-Shift-Delete",null),exec:function(e){var t=e.selection.getRange();t.end.column=Number.MAX_VALUE,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:o("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:o("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:o("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:o("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:o("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:o("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(e,t){e.insert(s.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:o(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:o("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:o("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:o("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:o(null,null),exec:function(e){e.autoIndent()},scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:o("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"openlink",bindKey:o("Ctrl+F3","F3"),exec:function(e){e.openLink()}},{name:"joinlines",description:"Join lines",bindKey:o(null,null),exec:function(e){for(var t=e.selection.isBackwards(),r=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),h=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),a=e.session.doc.getLine(r.row).length,u=e.session.doc.getTextRange(e.selection.getRange()),f=u.replace(/\n\s*/," ").length,m=e.session.doc.getLine(r.row),y=r.row+1;y<=h.row+1;y++){var x=s.stringTrimLeft(s.stringTrimRight(e.session.doc.getLine(y)));x.length!==0&&(x=" "+x),m+=x}h.row+1<e.session.doc.getLength()-1&&(m+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new d(r.row,0,h.row+2,0),m),f>0?(e.selection.moveCursorTo(r.row,r.column),e.selection.selectTo(r.row,r.column+f)):(a=e.session.doc.getLine(r.row).length>a?a+1:a,e.selection.moveCursorTo(r.row,a))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:o(null,null),exec:function(e){var t=e.session.doc.getLength()-1,r=e.session.doc.getLine(t).length,h=e.selection.rangeList.ranges,a=[];h.length<1&&(h=[e.selection.getRange()]);for(var u=0;u<h.length;u++)u==h.length-1&&(h[u].end.row===t&&h[u].end.column===r||a.push(new d(h[u].end.row,h[u].end.column,t,r))),u===0?h[u].start.row===0&&h[u].start.column===0||a.push(new d(0,0,h[u].start.row,h[u].start.column)):a.push(new d(h[u-1].end.row,h[u-1].end.column,h[u].start.row,h[u].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var u=0;u<a.length;u++)e.selection.addRange(a[u],!1)},readOnly:!0,scrollIntoView:"none"},{name:"addLineAfter",description:"Add new line after the current line",exec:function(e){e.selection.clearSelection(),e.navigateLineEnd(),e.insert(`
|
|
222
|
+
`),F=w+D.length,A=D[D.length-1].length,$=F+_.length-1,C=_.length==1?A+_[0].length:_[_.length-1].length;return{startRow:F,startCol:A,endRow:$,endCol:C}}}return null},r.prototype.$matchIterator=function(h,a){var u=this.$assembleRegExp(a);if(!u)return!1;var f=this.$isMultilineSearch(a),m=this.$multiLineForward,y=this.$multiLineBackward,x=a.backwards==!0,E=a.skipCurrent!=!1,w=u.unicode,g=a.range,S=a.start;S||(S=g?g[x?"end":"start"]:h.selection.getRange()),S.start&&(S=S[E!=x?"end":"start"]);var k=g?g.start.row:0,D=g?g.end.row:h.getLength()-1;if(x)var _=function($){var C=S.row;if(!A(C,S.column,$)){for(C--;C>=k;C--)if(A(C,Number.MAX_VALUE,$))return;if(a.wrap!=!1){for(C=D,k=S.row;C>=k;C--)if(A(C,Number.MAX_VALUE,$))return}}};else var _=function(C){var b=S.row;if(!A(b,S.column,C)){for(b=b+1;b<=D;b++)if(A(b,0,C))return;if(a.wrap!=!1){for(b=k,D=S.row;b<=D;b++)if(A(b,0,C))return}}};if(a.$isMultiLine)var F=u.length,A=function($,C,b){var T=x?$-F+1:$;if(!(T<0||T+F>h.getLength())){var I=h.getLine(T),O=I.search(u[0]);if(!(!x&&O<C||O===-1)){for(var N=1;N<F;N++)if(I=h.getLine(T+N),I.search(u[N])==-1)return;var P=I.match(u[F-1])[0].length;if(!(x&&P>C)&&b(T,O,T+F-1,P))return!0}}};else if(x)var A=function(C,b,T){if(f){var I=y(h,u,b,C,k);if(!I)return!1;if(T(I.startRow,I.startCol,I.endRow,I.endCol))return!0}else{var O=h.getLine(C),N=[],P,B=0;for(u.lastIndex=0;P=u.exec(O);){var V=P[0].length;if(B=P.index,!V){if(B>=O.length)break;u.lastIndex=B+=s.skipEmptyMatch(O,B,w)}if(P.index+V>b)break;N.push(P.index,V)}for(var W=N.length-1;W>=0;W-=2){var z=N[W-1],V=N[W];if(T(C,z,C,z+V))return!0}}};else var A=function(C,b,T){if(u.lastIndex=b,f){var I=m(h,u,C,D);if(I){var O=I.endRow<=D?I.endRow-1:D;O>C&&(C=O)}if(!I)return!1;if(T(I.startRow,I.startCol,I.endRow,I.endCol))return!0}else for(var N=h.getLine(C),P,B;B=u.exec(N);){var V=B[0].length;if(P=B.index,T(C,P,C,P+V))return!0;if(!V&&(u.lastIndex=P+=s.skipEmptyMatch(N,P,w),P>=N.length))return!1}};return{forEach:_}},r}();function p(r,h){var a=s.supportsLookbehind();function u(x,E){E===void 0&&(E=!0);var w=a&&h.$supportsUnicodeFlag?new RegExp("[\\p{L}\\p{N}_]","u"):new RegExp("\\w");return w.test(x)||h.regExp?a&&h.$supportsUnicodeFlag?E?"(?<=^|[^\\p{L}\\p{N}_])":"(?=[^\\p{L}\\p{N}_]|$)":"\\b":""}var f=Array.from(r),m=f[0],y=f[f.length-1];return u(m)+r+u(y,!1)}function e(r,h,a){for(var u=null,f=0;f<=r.length;){h.lastIndex=f;var m=h.exec(r);if(!m)break;var y=m.index+m[0].length;if(y>r.length-a)break;(!u||y>u.index+u[0].length)&&(u=m),f=m.index+1}return u}function t(r,h){var a=5e3,u={row:h,column:0},f=r.doc.positionToIndex(u),m=f+a,y=r.doc.indexToPosition(m),x=y.row;return x+1}l.Search=o}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(i,l,v){var s=this&&this.__extends||function(){var r=function(h,a){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,f){u.__proto__=f}||function(u,f){for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(u[m]=f[m])},r(h,a)};return function(h,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(h,a);function u(){this.constructor=h}h.prototype=a===null?Object.create(a):(u.prototype=a.prototype,new u)}}(),c=i("../lib/keys"),d=i("../lib/useragent"),o=c.KEY_MODS,p=function(){function r(h,a){this.$init(h,a,!1)}return r.prototype.$init=function(h,a,u){this.platform=a||(d.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(h),this.$singleCommand=u},r.prototype.addCommand=function(h){this.commands[h.name]&&this.removeCommand(h),this.commands[h.name]=h,h.bindKey&&this._buildKeyHash(h)},r.prototype.removeCommand=function(h,a){var u=h&&(typeof h=="string"?h:h.name);h=this.commands[u],a||delete this.commands[u];var f=this.commandKeyBinding;for(var m in f){var y=f[m];if(y==h)delete f[m];else if(Array.isArray(y)){var x=y.indexOf(h);x!=-1&&(y.splice(x,1),y.length==1&&(f[m]=y[0]))}}},r.prototype.bindKey=function(h,a,u){if(typeof h=="object"&&h&&(u==null&&(u=h.position),h=h[this.platform]),!!h){if(typeof a=="function")return this.addCommand({exec:a,bindKey:h,name:a.name||h});h.split("|").forEach(function(f){var m="";if(f.indexOf(" ")!=-1){var y=f.split(/\s+/);f=y.pop(),y.forEach(function(w){var g=this.parseKeys(w),S=o[g.hashId]+g.key;m+=(m?" ":"")+S,this._addCommandToBinding(m,"chainKeys")},this),m+=" "}var x=this.parseKeys(f),E=o[x.hashId]+x.key;this._addCommandToBinding(m+E,a,u)},this)}},r.prototype._addCommandToBinding=function(h,a,u){var f=this.commandKeyBinding,m;if(!a)delete f[h];else if(!f[h]||this.$singleCommand)f[h]=a;else{Array.isArray(f[h])?(m=f[h].indexOf(a))!=-1&&f[h].splice(m,1):f[h]=[f[h]],typeof u!="number"&&(u=e(a));var y=f[h];for(m=0;m<y.length;m++){var x=y[m],E=e(x);if(E>u)break}y.splice(m,0,a)}},r.prototype.addCommands=function(h){h&&Object.keys(h).forEach(function(a){var u=h[a];if(u){if(typeof u=="string")return this.bindKey(u,a);typeof u=="function"&&(u={exec:u}),typeof u=="object"&&(u.name||(u.name=a),this.addCommand(u))}},this)},r.prototype.removeCommands=function(h){Object.keys(h).forEach(function(a){this.removeCommand(h[a])},this)},r.prototype.bindKeys=function(h){Object.keys(h).forEach(function(a){this.bindKey(a,h[a])},this)},r.prototype._buildKeyHash=function(h){this.bindKey(h.bindKey,h)},r.prototype.parseKeys=function(h){var a=h.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(E){return E}),u=a.pop(),f=c[u];if(c.FUNCTION_KEYS[f])u=c.FUNCTION_KEYS[f].toLowerCase();else if(a.length){if(a.length==1&&a[0]=="shift")return{key:u.toUpperCase(),hashId:-1}}else return{key:u,hashId:-1};for(var m=0,y=a.length;y--;){var x=c.KEY_MODS[a[y]];if(x==null)return typeof console<"u"&&console.error("invalid modifier "+a[y]+" in "+h),!1;m|=x}return{key:u,hashId:m}},r.prototype.findKeyCommand=function(h,a){var u=o[h]+a;return this.commandKeyBinding[u]},r.prototype.handleKeyboard=function(h,a,u,f){if(!(f<0)){var m=o[a]+u,y=this.commandKeyBinding[m];return h.$keyChain&&(h.$keyChain+=" "+m,y=this.commandKeyBinding[h.$keyChain]||y),y&&(y=="chainKeys"||y[y.length-1]=="chainKeys")?(h.$keyChain=h.$keyChain||m,{command:"null"}):(h.$keyChain&&((!a||a==4)&&u.length==1?h.$keyChain=h.$keyChain.slice(0,-m.length-1):(a==-1||f>0)&&(h.$keyChain="")),{command:y})}},r.prototype.getStatusText=function(h,a){return a.$keyChain||""},r}();function e(r){return typeof r=="object"&&r.bindKey&&r.bindKey.position||(r.isDefault?-100:0)}var t=function(r){s(h,r);function h(a,u){var f=r.call(this,a,u)||this;return f.$singleCommand=!0,f}return h}(p);t.call=function(r,h,a){p.prototype.$init.call(r,h,a,!0)},p.call=function(r,h,a){p.prototype.$init.call(r,h,a,!1)},l.HashHandler=t,l.MultiHashHandler=p}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(i,l,v){var s=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,a){h.__proto__=a}||function(h,a){for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(h[u]=a[u])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function h(){this.constructor=t}t.prototype=r===null?Object.create(r):(h.prototype=r.prototype,new h)}}(),c=i("../lib/oop"),d=i("../keyboard/hash_handler").MultiHashHandler,o=i("../lib/event_emitter").EventEmitter,p=function(e){s(t,e);function t(r,h){var a=e.call(this,h,r)||this;return a.byName=a.commands,a.setDefaultHandler("exec",function(u){return u.args?u.command.exec(u.editor,u.args,u.event,!1):u.command.exec(u.editor,{},u.event,!0)}),a}return t.prototype.exec=function(r,h,a){if(Array.isArray(r)){for(var u=r.length;u--;)if(this.exec(r[u],h,a))return!0;return!1}typeof r=="string"&&(r=this.commands[r]);var f={editor:h,command:r,args:a};return this.canExecute(r,h)?(f.returnValue=this._emit("exec",f),this._signal("afterExec",f),f.returnValue!==!1):(this._signal("commandUnavailable",f),!1)},t.prototype.canExecute=function(r,h){return typeof r=="string"&&(r=this.commands[r]),!(!r||h&&h.$readOnly&&!r.readOnly||this.$checkCommandState!=!1&&r.isAvailable&&!r.isAvailable(h))},t.prototype.toggleRecording=function(r){if(!this.$inReplay)return r&&r._emit("changeStatus"),this.recording?(this.macro.pop(),this.off("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(h){this.macro.push([h.command,h.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},t.prototype.replay=function(r){if(!(this.$inReplay||!this.macro)){if(this.recording)return this.toggleRecording(r);try{this.$inReplay=!0,this.macro.forEach(function(h){typeof h=="string"?this.exec(h,r):this.exec(h[0],r,h[1])},this)}finally{this.$inReplay=!1}}},t.prototype.trimMacro=function(r){return r.map(function(h){return typeof h[0]!="string"&&(h[0]=h[0].name),h[1]||(h=h[0]),h})},t}(d);c.implement(p.prototype,o),l.CommandManager=p}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(i,l,v){var s=i("../lib/lang"),c=i("../config"),d=i("../range").Range;function o(e,t){return{win:e,mac:t}}l.commands=[{name:"showSettingsMenu",description:"Show settings menu",bindKey:o("Ctrl-,","Command-,"),exec:function(e){c.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",description:"Go to next error",bindKey:o("Alt-E","F4"),exec:function(e){c.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",description:"Go to previous error",bindKey:o("Alt-Shift-E","Shift-F4"),exec:function(e){c.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:o("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:o(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:o("Ctrl-L","Command-L"),exec:function(e,t){typeof t=="number"&&!isNaN(t)&&e.gotoLine(t),e.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:o("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:o("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",description:"Toggle fold widget",bindKey:o("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",description:"Toggle parent fold widget",bindKey:o("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:o(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldAllComments",description:"Fold all comments",bindKey:o(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAllComments()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:o("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:o("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:o("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:o("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:o("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:o("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:o("Ctrl-F","Command-F"),exec:function(e){c.loadModule("ace/ext/searchbox",function(t){t.Search(e)})},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:o("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",description:"Go to start",bindKey:o("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",description:"Select up",bindKey:o("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:o("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",description:"Select to end",bindKey:o("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",description:"Go to end",bindKey:o("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",description:"Select down",bindKey:o("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:o("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:o("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:o("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:o("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",description:"Go to line start",bindKey:o("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:o("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:o("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:o("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:o("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:o("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",description:"Go to line end",bindKey:o("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:o("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:o("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:o(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:o("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:o(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:o("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:o("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:o("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:o("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:o("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:o("Ctrl-Shift-\\|Ctrl-Shift-P","Command-Shift-\\"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:o("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",description:"Pass keys to browser",bindKey:o(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",description:"Copy",exec:function(e){},readOnly:!0},{name:"cut",description:"Cut",exec:function(e){var t=e.$copyWithEmptySelection&&e.selection.isEmpty(),r=t?e.selection.getLineRange():e.selection.getRange();e._emit("cut",r),r.isEmpty()||e.session.remove(r),e.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(e,t){e.$handlePaste(t)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:o("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:o("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:o("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:o("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:o("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:o("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:o("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:o("Ctrl-H","Command-Option-F"),exec:function(e){c.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",description:"Undo",bindKey:o("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",description:"Redo",bindKey:o("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:o("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:o("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:o("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:o("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:o("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:o("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:o("Shift-Delete",null),exec:function(e){if(e.selection.isEmpty())e.remove("left");else return!1},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:o("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:o("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:o("Ctrl-Shift-Backspace",null),exec:function(e){var t=e.selection.getRange();t.start.column=0,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:o("Ctrl-Shift-Delete",null),exec:function(e){var t=e.selection.getRange();t.end.column=Number.MAX_VALUE,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:o("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:o("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:o("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:o("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:o("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:o("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(e,t){e.insert(s.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:o(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:o("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:o("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:o("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:o(null,null),exec:function(e){e.autoIndent()},scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:o("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"openlink",bindKey:o("Ctrl+F3","F3"),exec:function(e){e.openLink()}},{name:"joinlines",description:"Join lines",bindKey:o(null,null),exec:function(e){for(var t=e.selection.isBackwards(),r=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),h=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),a=e.session.doc.getLine(r.row).length,u=e.session.doc.getTextRange(e.selection.getRange()),f=u.replace(/\n\s*/," ").length,m=e.session.doc.getLine(r.row),y=r.row+1;y<=h.row+1;y++){var x=s.stringTrimLeft(s.stringTrimRight(e.session.doc.getLine(y)));x.length!==0&&(x=" "+x),m+=x}h.row+1<e.session.doc.getLength()-1&&(m+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new d(r.row,0,h.row+2,0),m),f>0?(e.selection.moveCursorTo(r.row,r.column),e.selection.selectTo(r.row,r.column+f)):(a=e.session.doc.getLine(r.row).length>a?a+1:a,e.selection.moveCursorTo(r.row,a))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:o(null,null),exec:function(e){var t=e.session.doc.getLength()-1,r=e.session.doc.getLine(t).length,h=e.selection.rangeList.ranges,a=[];h.length<1&&(h=[e.selection.getRange()]);for(var u=0;u<h.length;u++)u==h.length-1&&(h[u].end.row===t&&h[u].end.column===r||a.push(new d(h[u].end.row,h[u].end.column,t,r))),u===0?h[u].start.row===0&&h[u].start.column===0||a.push(new d(0,0,h[u].start.row,h[u].start.column)):a.push(new d(h[u-1].end.row,h[u-1].end.column,h[u].start.row,h[u].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var u=0;u<a.length;u++)e.selection.addRange(a[u],!1)},readOnly:!0,scrollIntoView:"none"},{name:"addLineAfter",description:"Add new line after the current line",exec:function(e){e.selection.clearSelection(),e.navigateLineEnd(),e.insert(`
|
|
223
223
|
`)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"addLineBefore",description:"Add new line before the current line",exec:function(e){e.selection.clearSelection();var t=e.getCursorPosition();e.selection.moveTo(t.row-1,Number.MAX_VALUE),e.insert(`
|
|
224
|
-
`),t.row===0&&e.navigateUp()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"openCommandPallete",exec:function(e){console.warn("This is an obsolete command. Please use `openCommandPalette` instead."),e.prompt({$type:"commands"})},readOnly:!0},{name:"openCommandPalette",description:"Open command palette",bindKey:o("F1","F1"),exec:function(e){e.prompt({$type:"commands"})},readOnly:!0},{name:"modeSelect",description:"Change language mode...",bindKey:o(null,null),exec:function(e){e.prompt({$type:"modes"})},readOnly:!0}];for(var p=1;p<9;p++)l.commands.push({name:"foldToLevel"+p,description:"Fold To Level "+p,level:p,exec:function(e){e.session.foldToLevel(this.level)},scrollIntoView:"center",readOnly:!0})}),ace.define("ace/keyboard/gutter_handler",["require","exports","module","ace/lib/keys","ace/mouse/default_gutter_handler"],function(i,l,v){var s=i("../lib/keys"),c=i("../mouse/default_gutter_handler").GutterTooltip,d=function(){function p(e){this.editor=e,this.gutterLayer=e.renderer.$gutterLayer,this.element=e.renderer.$gutter,this.lines=e.renderer.$gutterLayer.$lines,this.activeRowIndex=null,this.activeLane=null,this.annotationTooltip=new c(this.editor)}return p.prototype.addListener=function(){this.element.addEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.addEventListener("focusout",this.$blurGutter.bind(this)),this.editor.on("mousewheel",this.$blurGutter.bind(this))},p.prototype.removeListener=function(){this.element.removeEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.removeEventListener("focusout",this.$blurGutter.bind(this)),this.editor.off("mousewheel",this.$blurGutter.bind(this))},p.prototype.$onGutterKeyDown=function(e){if(this.annotationTooltip.isOpen){e.preventDefault(),e.keyCode===s.escape&&this.annotationTooltip.hideTooltip();return}if(e.target===this.element){if(e.keyCode!=s.enter)return;e.preventDefault();var t=this.editor.getCursorPosition().row;this.editor.isRowVisible(t)||this.editor.scrollToLine(t,!0,!0),setTimeout(function(){var r=this.$rowToRowIndex(this.gutterLayer.$cursorCell.row),h=this.$findNearestFoldLaneWidget(r),a=this.$findNearestAnnotation(r);if(!(h===null&&a===null)){var u=this.$findClosestNumber(h,a,r);if(u===h)if(this.activeLane="fold",this.activeRowIndex=h,this.$isCustomWidgetVisible(h)){this.$focusCustomWidget(this.activeRowIndex);return}else{this.$focusFoldWidget(this.activeRowIndex);return}else{this.activeRowIndex=a,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}}}.bind(this),10);return}this.$handleGutterKeyboardInteraction(e),setTimeout(function(){this.editor._signal("gutterkeydown",new o(e,this))}.bind(this),10)},p.prototype.$handleGutterKeyboardInteraction=function(e){if(e.keyCode===s.tab){e.preventDefault();return}if(e.keyCode===s.escape){e.preventDefault(),this.$blurGutter(),this.element.focus(),this.lane=null;return}if(e.keyCode===s.up){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetUp();break;case"annotation":this.$moveAnnotationUp();break}return}if(e.keyCode===s.down){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetDown();break;case"annotation":this.$moveAnnotationDown();break}return}if(e.keyCode===s.left){e.preventDefault(),this.$switchLane("annotation");return}if(e.keyCode===s.right){e.preventDefault(),this.$switchLane("fold");return}if(e.keyCode===s.enter||e.keyCode===s.space){switch(e.preventDefault(),this.activeLane){case"fold":var t=this.$rowIndexToRow(this.activeRowIndex),r=this.editor.session.$gutterCustomWidgets[t];if(r)r.callbacks&&r.callbacks.onClick&&r.callbacks.onClick(e,t);else if(this.gutterLayer.session.foldWidgets[t]==="start"){this.editor.session.onFoldWidgetClick(this.$rowIndexToRow(this.activeRowIndex),e),setTimeout(function(){this.$rowIndexToRow(this.activeRowIndex)!==t&&(this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=this.$rowToRowIndex(t),this.$focusFoldWidget(this.activeRowIndex))}.bind(this),10);break}else if(this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)]==="end")break;return;case"annotation":var h=this.lines.cells[this.activeRowIndex].element.childNodes[2],a=h.getBoundingClientRect(),u=this.annotationTooltip.getElement().style;u.left=a.right+"px",u.top=a.bottom+"px",this.annotationTooltip.showTooltip(this.$rowIndexToRow(this.activeRowIndex));break}return}},p.prototype.$blurGutter=function(){if(this.activeRowIndex!==null)switch(this.activeLane){case"fold":this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex);break;case"annotation":this.$blurAnnotation(this.activeRowIndex);break}this.annotationTooltip.isOpen&&this.annotationTooltip.hideTooltip()},p.prototype.$isFoldWidgetVisible=function(e){var t=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),r=this.$getFoldWidget(e).style.display!=="none";return t&&r},p.prototype.$isCustomWidgetVisible=function(e){var t=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),r=!!this.$getCustomWidget(e);return t&&r},p.prototype.$isAnnotationVisible=function(e){var t=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),r=this.$getAnnotation(e).style.display!=="none";return t&&r},p.prototype.$getFoldWidget=function(e){var t=this.lines.get(e),r=t.element;return r.childNodes[1]},p.prototype.$getCustomWidget=function(e){var t=this.lines.get(e),r=t.element;return r.childNodes[3]},p.prototype.$getAnnotation=function(e){var t=this.lines.get(e),r=t.element;return r.childNodes[2]},p.prototype.$findNearestFoldLaneWidget=function(e){if(this.$isCustomWidgetVisible(e)||this.$isFoldWidgetVisible(e))return e;for(var t=0;e-t>0||e+t<this.lines.getLength()-1;){if(t++,e-t>=0&&this.$isCustomWidgetVisible(e-t))return e-t;if(e+t<=this.lines.getLength()-1&&this.$isCustomWidgetVisible(e+t))return e+t;if(e-t>=0&&this.$isFoldWidgetVisible(e-t))return e-t;if(e+t<=this.lines.getLength()-1&&this.$isFoldWidgetVisible(e+t))return e+t}return null},p.prototype.$findNearestAnnotation=function(e){if(this.$isAnnotationVisible(e))return e;for(var t=0;e-t>0||e+t<this.lines.getLength()-1;){if(t++,e-t>=0&&this.$isAnnotationVisible(e-t))return e-t;if(e+t<=this.lines.getLength()-1&&this.$isAnnotationVisible(e+t))return e+t}return null},p.prototype.$focusFoldWidget=function(e){if(e!=null){var t=this.$getFoldWidget(e);t.classList.add(this.editor.renderer.keyboardFocusClassName),t.focus()}},p.prototype.$focusCustomWidget=function(e){if(e!=null){var t=this.$getCustomWidget(e);t&&(t.classList.add(this.editor.renderer.keyboardFocusClassName),t.focus())}},p.prototype.$focusAnnotation=function(e){if(e!=null){var t=this.$getAnnotation(e);t.classList.add(this.editor.renderer.keyboardFocusClassName),t.focus()}},p.prototype.$blurFoldWidget=function(e){var t=this.$getFoldWidget(e);t.classList.remove(this.editor.renderer.keyboardFocusClassName),t.blur()},p.prototype.$blurCustomWidget=function(e){var t=this.$getCustomWidget(e);t&&(t.classList.remove(this.editor.renderer.keyboardFocusClassName),t.blur())},p.prototype.$blurAnnotation=function(e){var t=this.$getAnnotation(e);t.classList.remove(this.editor.renderer.keyboardFocusClassName),t.blur()},p.prototype.$moveFoldWidgetUp=function(){for(var e=this.activeRowIndex;e>0;)if(e--,this.$isFoldWidgetVisible(e)||this.$isCustomWidgetVisible(e)){this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=e,this.$isFoldWidgetVisible(e)?this.$focusFoldWidget(this.activeRowIndex):this.$focusCustomWidget(this.activeRowIndex);return}},p.prototype.$moveFoldWidgetDown=function(){for(var e=this.activeRowIndex;e<this.lines.getLength()-1;)if(e++,this.$isFoldWidgetVisible(e)||this.$isCustomWidgetVisible(e)){this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=e,this.$isFoldWidgetVisible(e)?this.$focusFoldWidget(this.activeRowIndex):this.$focusCustomWidget(this.activeRowIndex);return}},p.prototype.$moveAnnotationUp=function(){for(var e=this.activeRowIndex;e>0;)if(e--,this.$isAnnotationVisible(e)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=e,this.$focusAnnotation(this.activeRowIndex);return}},p.prototype.$moveAnnotationDown=function(){for(var e=this.activeRowIndex;e<this.lines.getLength()-1;)if(e++,this.$isAnnotationVisible(e)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=e,this.$focusAnnotation(this.activeRowIndex);return}},p.prototype.$findClosestNumber=function(e,t,r){return e===null?t:t===null||Math.abs(r-e)<=Math.abs(r-t)?e:t},p.prototype.$switchLane=function(e){switch(e){case"annotation":if(this.activeLane==="annotation")break;var t=this.$findNearestAnnotation(this.activeRowIndex);if(t==null)break;this.activeLane="annotation",this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=t,this.$focusAnnotation(this.activeRowIndex);break;case"fold":if(this.activeLane==="fold")break;var r=this.$findNearestFoldLaneWidget(this.activeRowIndex);if(r===null)break;this.activeLane="fold",this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=r,this.$isCustomWidgetVisible(r)?this.$focusCustomWidget(this.activeRowIndex):this.$focusFoldWidget(this.activeRowIndex);break}},p.prototype.$rowIndexToRow=function(e){var t=this.lines.get(e);return t?t.row:null},p.prototype.$rowToRowIndex=function(e){for(var t=0;t<this.lines.getLength();t++){var r=this.lines.get(t);if(r.row==e)return t}return null},p}();l.GutterKeyboardHandler=d;var o=function(){function p(e,t){this.gutterKeyboardHandler=t,this.domEvent=e}return p.prototype.getKey=function(){return s.keyCodeToString(this.domEvent.keyCode)},p.prototype.getRow=function(){return this.gutterKeyboardHandler.$rowIndexToRow(this.gutterKeyboardHandler.activeRowIndex)},p.prototype.isInAnnotationLane=function(){return this.gutterKeyboardHandler.activeLane==="annotation"},p.prototype.isInFoldLane=function(){return this.gutterKeyboardHandler.activeLane==="fold"},p}();l.GutterKeyboardEvent=o}),ace.define("ace/editor",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator","ace/keyboard/gutter_handler","ace/config","ace/clipboard","ace/lib/keys","ace/lib/event","ace/tooltip"],function(i,l,v){var s=this&&this.__values||function(w){var C=typeof Symbol=="function"&&Symbol.iterator,T=C&&w[C],I=0;if(T)return T.call(w);if(w&&typeof w.length=="number")return{next:function(){return w&&I>=w.length&&(w=void 0),{value:w&&w[I++],done:!w}}};throw new TypeError(C?"Object is not iterable.":"Symbol.iterator is not defined.")},c=i("./lib/oop"),d=i("./lib/dom"),o=i("./lib/lang"),p=i("./lib/useragent"),e=i("./keyboard/textinput").TextInput,t=i("./mouse/mouse_handler").MouseHandler,r=i("./mouse/fold_handler").FoldHandler,h=i("./keyboard/keybinding").KeyBinding,a=i("./edit_session").EditSession,u=i("./search").Search,f=i("./range").Range,m=i("./lib/event_emitter").EventEmitter,y=i("./commands/command_manager").CommandManager,x=i("./commands/default_commands").commands,E=i("./config"),b=i("./token_iterator").TokenIterator,g=i("./keyboard/gutter_handler").GutterKeyboardHandler,S=i("./config").nls,k=i("./clipboard"),D=i("./lib/keys"),_=i("./lib/event"),F=i("./tooltip").HoverTooltip,A=function(){function w(C,T,I){this.id="editor"+ ++w.$uid,this.session,this.$toDestroy=[];var O=C.getContainerElement();this.container=O,this.renderer=C,this.commands=new y(p.isMac?"mac":"win",x),typeof document=="object"&&(this.textInput=new e(C.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new t(this),new r(this)),this.keyBinding=new h(this),this.$search=new u().set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=o.delayedCall(function(){this._signal("input",{}),this.session&&!this.session.destroyed&&this.session.bgTokenizer.scheduleStart()}.bind(this)),this.on("change",function(R,P){P._$emitInputEvent.schedule(31)}),this.setSession(T||I&&I.session||new a("")),E.resetOptions(this),I&&this.setOptions(I),E._signal("editor",this)}return w.prototype.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0)},w.prototype.startOperation=function(C){this.session.startOperation(C)},w.prototype.endOperation=function(C){this.session.endOperation(C)},w.prototype.onStartOperation=function(C){this.curOp=this.session.curOp,this.curOp.scrollTop=this.renderer.scrollTop,this.prevOp=this.session.prevOp,C||(this.previousCommand=null)},w.prototype.onEndOperation=function(C){if(this.curOp&&this.session){if(C&&C.returnValue===!1){this.curOp=null;return}if(this._signal("beforeEndOperation"),!this.curOp)return;var T=this.curOp.command,I=T&&T.scrollIntoView;if(I){switch(I){case"center-animate":I="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var O=this.selection.getRange(),R=this.renderer.layerConfig;(O.start.row>=R.lastRow||O.end.row<=R.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break}I=="animate"&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.$lastSel=this.session.selection.toJSON(),this.prevOp=this.curOp,this.curOp=null}},w.prototype.$historyTracker=function(C){if(this.$mergeUndoDeltas){var T=this.prevOp,I=this.$mergeableCommands,O=T.command&&C.command.name==T.command.name;if(C.command.name=="insertstring"){var R=C.args;this.mergeNextCommand===void 0&&(this.mergeNextCommand=!0),O=O&&this.mergeNextCommand&&(!/\s/.test(R)||/\s/.test(T.args)),this.mergeNextCommand=!0}else O=O&&I.indexOf(C.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(O=!1),O?this.session.mergeUndoDeltas=!0:I.indexOf(C.command.name)!==-1&&(this.sequenceStartTime=Date.now())}},w.prototype.setKeyboardHandler=function(C,T){if(C&&typeof C=="string"&&C!="ace"){this.$keybindingId=C;var I=this;E.loadModule(["keybinding",C],function(O){I.$keybindingId==C&&I.keyBinding.setKeyboardHandler(O&&O.handler),T&&T()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(C),T&&T()},w.prototype.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},w.prototype.setSession=function(C){if(this.session!=C){this.curOp&&this.endOperation(),this.curOp={};var T=this.session;if(T){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange),this.session.off("startOperation",this.$onStartOperation),this.session.off("endOperation",this.$onEndOperation);var I=this.session.getSelection();I.off("changeCursor",this.$onCursorChange),I.off("changeSelection",this.$onSelectionChange)}this.session=C,C?(this.$onDocumentChange=this.onDocumentChange.bind(this),C.on("change",this.$onDocumentChange),this.renderer.setSession(C),this.$onChangeMode=this.onChangeMode.bind(this),C.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),C.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),C.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),C.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),C.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),C.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=C.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.$onStartOperation=this.onStartOperation.bind(this),this.session.on("startOperation",this.$onStartOperation),this.$onEndOperation=this.onEndOperation.bind(this),this.session.on("endOperation",this.$onEndOperation),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(C)),this._signal("changeSession",{session:C,oldSession:T}),this.curOp=null,T&&T._signal("changeEditor",{oldEditor:this}),T&&(T.$editor=null),C&&C._signal("changeEditor",{editor:this}),C&&(C.$editor=this),C&&!C.destroyed&&C.bgTokenizer.scheduleStart()}},w.prototype.getSession=function(){return this.session},w.prototype.setValue=function(C,T){return this.session.doc.setValue(C),T?T==1?this.navigateFileEnd():T==-1&&this.navigateFileStart():this.selectAll(),C},w.prototype.getValue=function(){return this.session.getValue()},w.prototype.getSelection=function(){return this.selection},w.prototype.resize=function(C){this.renderer.onResize(C)},w.prototype.setTheme=function(C,T){this.renderer.setTheme(C,T)},w.prototype.getTheme=function(){return this.renderer.getTheme()},w.prototype.setStyle=function(C,T){this.renderer.setStyle(C,T)},w.prototype.unsetStyle=function(C){this.renderer.unsetStyle(C)},w.prototype.getFontSize=function(){return this.getOption("fontSize")||d.computedStyle(this.container).fontSize},w.prototype.setFontSize=function(C){this.setOption("fontSize",C)},w.prototype.$highlightBrackets=function(){if(!this.$highlightPending){var C=this;this.$highlightPending=!0,setTimeout(function(){C.$highlightPending=!1;var T=C.session;if(!(!T||T.destroyed)){T.$bracketHighlight&&(T.$bracketHighlight.markerIds.forEach(function(U){T.removeMarker(U)}),T.$bracketHighlight=null);var I=C.getCursorPosition(),O=C.getKeyboardHandler(),R=O&&O.$getDirectionForHighlight&&O.$getDirectionForHighlight(C),P=T.getMatchingBracketRanges(I,R);if(!P){var B=new b(T,I.row,I.column),V=B.getCurrentToken();if(V&&/\b(?:tag-open|tag-name)/.test(V.type)){var W=T.getMatchingTags(I);W&&(P=[W.openTagName.isEmpty()?W.openTag:W.openTagName,W.closeTagName.isEmpty()?W.closeTag:W.closeTagName])}}if(!P&&T.$mode.getMatching&&(P=T.$mode.getMatching(C.session)),!P){C.getHighlightIndentGuides()&&C.renderer.$textLayer.$highlightIndentGuide();return}var z="ace_bracket";Array.isArray(P)?P.length==1&&(z="ace_error_bracket"):P=[P],P.length==2&&(f.comparePoints(P[0].end,P[1].start)==0?P=[f.fromPoints(P[0].start,P[1].end)]:f.comparePoints(P[0].start,P[1].end)==0&&(P=[f.fromPoints(P[1].start,P[0].end)])),T.$bracketHighlight={ranges:P,markerIds:P.map(function(U){return T.addMarker(U,z,"text")})},C.getHighlightIndentGuides()&&C.renderer.$textLayer.$highlightIndentGuide()}},50)}},w.prototype.focus=function(){this.textInput.focus()},w.prototype.isFocused=function(){return this.textInput.isFocused()},w.prototype.blur=function(){this.textInput.blur()},w.prototype.onFocus=function(C){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",C))},w.prototype.onBlur=function(C){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",C))},w.prototype.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$updateHighlightActiveLine()},w.prototype.onDocumentChange=function(C){var T=this.session.$useWrapMode,I=C.start.row==C.end.row?C.end.row:1/0;this.renderer.updateLines(C.start.row,I,T),this._signal("change",C),this.$cursorChange()},w.prototype.onTokenizerUpdate=function(C){var T=C.data;this.renderer.updateLines(T.first,T.last)},w.prototype.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},w.prototype.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},w.prototype.onCursorChange=function(){this.$cursorChange(),this._signal("changeSelection")},w.prototype.$updateHighlightActiveLine=function(){var C=this.getSession(),T;if(this.$highlightActiveLine&&((this.$selectionStyle!="line"||!this.selection.isMultiLine())&&(T=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(T=!1),this.renderer.$maxLines&&this.session.getLength()===1&&!(this.renderer.$minLines>1)&&(T=!1)),C.$highlightLineMarker&&!T)C.removeMarker(C.$highlightLineMarker.id),C.$highlightLineMarker=null;else if(!C.$highlightLineMarker&&T){var I=new f(T.row,T.column,T.row,1/0);I.id=C.addMarker(I,"ace_active-line","screenLine"),C.$highlightLineMarker=I}else T&&(C.$highlightLineMarker.start.row=T.row,C.$highlightLineMarker.end.row=T.row,C.$highlightLineMarker.start.column=T.column,C._signal("changeBackMarker"))},w.prototype.onSelectionChange=function(C){var T=this.session;if(T.$selectionMarker&&T.removeMarker(T.$selectionMarker),T.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var I=this.selection.getRange(),O=this.getSelectionStyle();T.$selectionMarker=T.addMarker(I,"ace_selection",O)}var R=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(R),this._signal("changeSelection")},w.prototype.$getSelectionHighLightRegexp=function(){var C=this.session,T=this.getSelectionRange();if(!(T.isEmpty()||T.isMultiLine())){var I=T.start.column,O=T.end.column,R=C.getLine(T.start.row),P=R.substring(I,O);if(!(P.length>5e3||!/[\w\d]/.test(P))){var B=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:P}),V=R.substring(I-1,O+1);if(B.test(V))return B}}},w.prototype.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},w.prototype.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},w.prototype.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},w.prototype.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},w.prototype.onChangeMode=function(C){this.renderer.updateText(),this._emit("changeMode",C)},w.prototype.onChangeWrapLimit=function(){this.renderer.updateFull()},w.prototype.onChangeWrapMode=function(){this.renderer.onResize(!0)},w.prototype.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},w.prototype.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},w.prototype.getCopyText=function(){var C=this.getSelectedText(),T=this.session.doc.getNewLineCharacter(),I=!1;if(!C&&this.$copyWithEmptySelection){I=!0;for(var O=this.selection.getAllRanges(),R=0;R<O.length;R++){var P=O[R];R&&O[R-1].start.row==P.start.row||(C+=this.session.getLine(P.start.row)+T)}}var B={text:C};return this._signal("copy",B),k.lineMode=I?B.text:!1,B.text},w.prototype.onCopy=function(){this.commands.exec("copy",this)},w.prototype.onCut=function(){this.commands.exec("cut",this)},w.prototype.onPaste=function(C,T){var I={text:C,event:T};this.commands.exec("paste",this,I)},w.prototype.$handlePaste=function(C){typeof C=="string"&&(C={text:C}),this._signal("paste",C);var T=C.text,I=T===k.lineMode,O=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)I?O.insert({row:this.selection.lead.row,column:0},T):this.insert(T);else if(I)this.selection.rangeList.ranges.forEach(function(z){O.insert({row:z.start.row,column:0},T)});else{var R=T.split(/\r\n|\r|\n/),P=this.selection.rangeList.ranges,B=R.length==2&&(!R[0]||!R[1]);if(R.length!=P.length||B)return this.commands.exec("insertstring",this,T);for(var V=P.length;V--;){var W=P[V];W.isEmpty()||O.remove(W),O.insert(W.start,R[V])}}},w.prototype.execCommand=function(C,T){return this.commands.exec(C,this,T)},w.prototype.insert=function(C,T){var I=this.session,O=I.getMode(),R=this.getCursorPosition();if(this.getBehavioursEnabled()&&!T){var P=O.transformAction(I.getState(R.row),"insertion",this,I,C);P&&(C!==P.text&&(this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1)),C=P.text)}if(C==" "&&(C=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&C.indexOf(`
|
|
225
|
-
`)==-1){var B=f.fromPoints(
|
|
226
|
-
`||
|
|
227
|
-
`){var U=I.getLine(
|
|
228
|
-
`){var B=I.getLine(T.end.row);/^\s+$/.test(B)&&(T.end.column=B.length)}}
|
|
229
|
-
`),this.moveCursorToPosition(C)},w.prototype.setGhostText=function(C,T){this.renderer.setGhostText(C,T)},w.prototype.removeGhostText=function(){this.renderer.removeGhostText()},w.prototype.transposeLetters=function(){if(this.selection.isEmpty()){var C=this.getCursorPosition(),T=C.column;if(T!==0){var I=this.session.getLine(C.row),O,R;T<I.length?(O=I.charAt(T)+I.charAt(T-1),R=new f(C.row,T-1,C.row,T+1)):(O=I.charAt(T-1)+I.charAt(T-2),R=new f(C.row,T-2,C.row,T)),this.session.replace(R,O),this.session.selection.moveToPosition(R.end)}}},w.prototype.toLowerCase=function(){var C=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var T=this.getSelectionRange(),I=this.session.getTextRange(T);this.session.replace(T,I.toLowerCase()),this.selection.setSelectionRange(C)},w.prototype.toUpperCase=function(){var C=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var T=this.getSelectionRange(),I=this.session.getTextRange(T);this.session.replace(T,I.toUpperCase()),this.selection.setSelectionRange(C)},w.prototype.indent=function(){var C=this.session,T=this.getSelectionRange();if(T.start.row<T.end.row){var I=this.$getSelectedRows();C.indentRows(I.first,I.last," ");return}else if(T.start.column<T.end.column){var O=C.getTextRange(T);if(!/^\s+$/.test(O)){var I=this.$getSelectedRows();C.indentRows(I.first,I.last," ");return}}var R=C.getLine(T.start.row),P=T.start,B=C.getTabSize(),V=C.documentToScreenColumn(P.row,P.column);if(this.session.getUseSoftTabs())var W=B-V%B,z=o.stringRepeat(" ",W);else{for(var W=V%B;R[T.start.column-1]==" "&&W;)T.start.column--,W--;this.selection.setSelectionRange(T),z=" "}return this.insert(z)},w.prototype.blockIndent=function(){var C=this.$getSelectedRows();this.session.indentRows(C.first,C.last," ")},w.prototype.blockOutdent=function(){var C=this.session.getSelection();this.session.outdentRows(C.getRange())},w.prototype.sortLines=function(){for(var C=this.$getSelectedRows(),T=this.session,I=[],O=C.first;O<=C.last;O++)I.push(T.getLine(O));I.sort(function(B,V){return B.toLowerCase()<V.toLowerCase()?-1:B.toLowerCase()>V.toLowerCase()?1:0});for(var R=new f(0,0,0,0),O=C.first;O<=C.last;O++){var P=T.getLine(O);R.start.row=O,R.end.row=O,R.end.column=P.length,T.replace(R,I[O-C.first])}},w.prototype.toggleCommentLines=function(){var C=this.session.getState(this.getCursorPosition().row),T=this.$getSelectedRows();this.session.getMode().toggleCommentLines(C,this.session,T.first,T.last)},w.prototype.toggleBlockComment=function(){var C=this.getCursorPosition(),T=this.session.getState(C.row),I=this.getSelectionRange();this.session.getMode().toggleBlockComment(T,this.session,I,C)},w.prototype.getNumberAt=function(C,T){var I=/[\-]?[0-9]+(?:\.[0-9]+)?/g;I.lastIndex=0;for(var O=this.session.getLine(C);I.lastIndex<T;){var R=I.exec(O);if(R.index<=T&&R.index+R[0].length>=T){var P={value:R[0],start:R.index,end:R.index+R[0].length};return P}}return null},w.prototype.modifyNumber=function(C){var T=this.selection.getCursor().row,I=this.selection.getCursor().column,O=new f(T,I-1,T,I),R=this.session.getTextRange(O);if(!isNaN(parseFloat(R))&&isFinite(R)){var P=this.getNumberAt(T,I);if(P){var B=P.value.indexOf(".")>=0?P.start+P.value.indexOf(".")+1:P.end,V=P.start+P.value.length-B,W=parseFloat(P.value);W*=Math.pow(10,V),B!==P.end&&I<B?C*=Math.pow(10,P.end-I-1):C*=Math.pow(10,P.end-I),W+=C,W/=Math.pow(10,V);var z=W.toFixed(V),U=new f(T,P.start,T,P.end);this.session.replace(U,z),this.moveCursorTo(T,Math.max(P.start+1,I+z.length-P.value.length))}}else this.toggleWord()},w.prototype.toggleWord=function(){var C=this.selection.getCursor().row,T=this.selection.getCursor().column;this.selection.selectWord();var I=this.getSelectedText(),O=this.selection.getWordRange().start.column,R=I.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),P=T-O-1;P<0&&(P=0);var B=0,V=0,W=this;I.match(/[A-Za-z0-9_]+/)&&R.forEach(function(ue,me){V=B+ue.length,P>=B&&P<=V&&(I=ue,W.selection.clearSelection(),W.moveCursorTo(C,B+O),W.selection.selectTo(C,V+O)),B=V});for(var z=this.$toggleWordPairs,U,G=0;G<z.length;G++)for(var Y=z[G],Q=0;Q<=1;Q++){var q=+!Q,te=I.match(new RegExp("^\\s?_?("+o.escapeRegExp(Y[Q])+")\\s?$","i"));if(te){var re=I.match(new RegExp("([_]|^|\\s)("+o.escapeRegExp(te[1])+")($|\\s)","g"));re&&(U=I.replace(new RegExp(o.escapeRegExp(Y[Q]),"i"),function(ue){var me=Y[q];return ue.toUpperCase()==ue?me=me.toUpperCase():ue.charAt(0).toUpperCase()==ue.charAt(0)&&(me=me.substr(0,0)+Y[q].charAt(0).toUpperCase()+me.substr(1)),me}),this.insert(U),U="")}}},w.prototype.findLinkAt=function(C,T){var I,O,R=this.session.getLine(C),P=R.split(/((?:https?|ftp):\/\/[\S]+)/),B=T;B<0&&(B=0);var V=0,W=0,z;try{for(var U=s(P),G=U.next();!G.done;G=U.next()){var Y=G.value;if(W=V+Y.length,B>=V&&B<=W&&Y.match(/((?:https?|ftp):\/\/[\S]+)/)){z=Y.replace(/[\s:.,'";}\]]+$/,"");break}V=W}}catch(Q){I={error:Q}}finally{try{G&&!G.done&&(O=U.return)&&O.call(U)}finally{if(I)throw I.error}}return z},w.prototype.openLink=function(){var C=this.selection.getCursor(),T=this.findLinkAt(C.row,C.column);return T&&window.open(T,"_blank"),T!=null},w.prototype.removeLines=function(){var C=this.$getSelectedRows();this.session.removeFullLines(C.first,C.last),this.clearSelection()},w.prototype.duplicateSelection=function(){var C=this.selection,T=this.session,I=C.getRange(),O=C.isBackwards();if(I.isEmpty()){var R=I.start.row;T.duplicateLines(R,R)}else{var P=O?I.start:I.end,B=T.insert(P,T.getTextRange(I));I.start=P,I.end=B,C.setSelectionRange(I,O)}},w.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},w.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},w.prototype.moveText=function(C,T,I){return this.session.moveText(C,T,I)},w.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},w.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},w.prototype.$moveLines=function(C,T){var I,O,R=this.selection;if(!R.inMultiSelectMode||this.inVirtualSelectionMode){var P=R.toOrientedRange();I=this.$getSelectedRows(P),O=this.session.$moveLines(I.first,I.last,T?0:C),T&&C==-1&&(O=0),P.moveBy(O,0),R.fromOrientedRange(P)}else{var B=R.rangeList.ranges;R.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var V=0,W=0,z=B.length,U=0;U<z;U++){var G=U;B[U].moveBy(V,0),I=this.$getSelectedRows(B[U]);for(var Y=I.first,Q=I.last;++U<z;){W&&B[U].moveBy(W,0);var q=this.$getSelectedRows(B[U]);if(T&&q.first!=Q)break;if(!T&&q.first>Q+1)break;Q=q.last}for(U--,V=this.session.$moveLines(Y,Q,T?0:C),T&&C==-1&&(G=U+1);G<=U;)B[G].moveBy(V,0),G++;T||(V=0),W+=V}R.fromOrientedRange(R.ranges[0]),R.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},w.prototype.$getSelectedRows=function(C){return C=(C||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(C.start.row),last:this.session.getRowFoldEnd(C.end.row)}},w.prototype.onCompositionStart=function(C){this.renderer.showComposition(C)},w.prototype.onCompositionUpdate=function(C){this.renderer.setCompositionText(C)},w.prototype.onCompositionEnd=function(){this.renderer.hideComposition()},w.prototype.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},w.prototype.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},w.prototype.isRowVisible=function(C){return C>=this.getFirstVisibleRow()&&C<=this.getLastVisibleRow()},w.prototype.isRowFullyVisible=function(C){return C>=this.renderer.getFirstFullyVisibleRow()&&C<=this.renderer.getLastFullyVisibleRow()},w.prototype.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},w.prototype.$moveByPage=function(C,T){var I=this.renderer,O=this.renderer.layerConfig,R=C*Math.floor(O.height/O.lineHeight);T===!0?this.selection.$moveSelection(function(){this.moveCursorBy(R,0)}):T===!1&&(this.selection.moveCursorBy(R,0),this.selection.clearSelection());var P=I.scrollTop;I.scrollBy(0,R*O.lineHeight),T!=null&&I.scrollCursorIntoView(null,.5),I.animateScrolling(P)},w.prototype.selectPageDown=function(){this.$moveByPage(1,!0)},w.prototype.selectPageUp=function(){this.$moveByPage(-1,!0)},w.prototype.gotoPageDown=function(){this.$moveByPage(1,!1)},w.prototype.gotoPageUp=function(){this.$moveByPage(-1,!1)},w.prototype.scrollPageDown=function(){this.$moveByPage(1)},w.prototype.scrollPageUp=function(){this.$moveByPage(-1)},w.prototype.scrollToRow=function(C){this.renderer.scrollToRow(C)},w.prototype.scrollToLine=function(C,T,I,O){this.renderer.scrollToLine(C,T,I,O)},w.prototype.centerSelection=function(){var C=this.getSelectionRange(),T={row:Math.floor(C.start.row+(C.end.row-C.start.row)/2),column:Math.floor(C.start.column+(C.end.column-C.start.column)/2)};this.renderer.alignCursor(T,.5)},w.prototype.getCursorPosition=function(){return this.selection.getCursor()},w.prototype.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},w.prototype.getSelectionRange=function(){return this.selection.getRange()},w.prototype.selectAll=function(){this.selection.selectAll()},w.prototype.clearSelection=function(){this.selection.clearSelection()},w.prototype.moveCursorTo=function(C,T){this.selection.moveCursorTo(C,T)},w.prototype.moveCursorToPosition=function(C){this.selection.moveCursorToPosition(C)},w.prototype.jumpToMatching=function(C,T){var I=this.getCursorPosition(),O=new b(this.session,I.row,I.column),R=O.getCurrentToken(),P=0;R&&R.type.indexOf("tag-name")!==-1&&(R=O.stepBackward());var B=R||O.stepForward();if(B){var V,W=!1,z={},U=I.column-B.start,G,Y={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(B.value.match(/[{}()\[\]]/g)){for(;U<B.value.length&&!W;U++)if(Y[B.value[U]])switch(G=Y[B.value[U]]+"."+B.type.replace("rparen","lparen"),isNaN(z[G])&&(z[G]=0),B.value[U]){case"(":case"[":case"{":z[G]++;break;case")":case"]":case"}":z[G]--,z[G]===-1&&(V="bracket",W=!0);break}}else B.type.indexOf("tag-name")!==-1&&(isNaN(z[B.value])&&(z[B.value]=0),R.value==="<"&&P>1?z[B.value]++:R.value==="</"&&z[B.value]--,z[B.value]===-1&&(V="tag",W=!0));W||(R=B,P++,B=O.stepForward(),U=0)}while(B&&!W);if(V){var Q,q;if(V==="bracket")Q=this.session.getBracketRange(I),Q||(Q=new f(O.getCurrentTokenRow(),O.getCurrentTokenColumn()+U-1,O.getCurrentTokenRow(),O.getCurrentTokenColumn()+U-1),q=Q.start,(T||q.row===I.row&&Math.abs(q.column-I.column)<2)&&(Q=this.session.getBracketRange(q)));else if(V==="tag"){if(!B||B.type.indexOf("tag-name")===-1)return;if(Q=new f(O.getCurrentTokenRow(),O.getCurrentTokenColumn()-2,O.getCurrentTokenRow(),O.getCurrentTokenColumn()-2),Q.compare(I.row,I.column)===0){var te=this.session.getMatchingTags(I);te&&(te.openTag.contains(I.row,I.column)?(Q=te.closeTag,q=Q.start):(Q=te.openTag,te.closeTag.start.row===I.row&&te.closeTag.start.column===I.column?q=Q.end:q=Q.start))}q=q||Q.start}q=Q&&Q.cursor||q,q&&(C?Q&&T?this.selection.setRange(Q):Q&&Q.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(q.row,q.column):this.selection.moveTo(q.row,q.column))}}},w.prototype.gotoLine=function(C,T,I){this.selection.clearSelection(),this.session.unfold({row:C-1,column:T||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(C-1,T||0),this.isRowFullyVisible(C-1)||this.scrollToLine(C-1,!0,I)},w.prototype.navigateTo=function(C,T){this.selection.moveTo(C,T)},w.prototype.navigateUp=function(C){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var T=this.selection.anchor.getPosition();return this.moveCursorToPosition(T)}this.selection.clearSelection(),this.selection.moveCursorBy(-C||-1,0)},w.prototype.navigateDown=function(C){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var T=this.selection.anchor.getPosition();return this.moveCursorToPosition(T)}this.selection.clearSelection(),this.selection.moveCursorBy(C||1,0)},w.prototype.navigateLeft=function(C){if(this.selection.isEmpty())for(C=C||1;C--;)this.selection.moveCursorLeft();else{var T=this.getSelectionRange().start;this.moveCursorToPosition(T)}this.clearSelection()},w.prototype.navigateRight=function(C){if(this.selection.isEmpty())for(C=C||1;C--;)this.selection.moveCursorRight();else{var T=this.getSelectionRange().end;this.moveCursorToPosition(T)}this.clearSelection()},w.prototype.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},w.prototype.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},w.prototype.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},w.prototype.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},w.prototype.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},w.prototype.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},w.prototype.replace=function(C,T){T&&this.$search.set(T);var I=this.$search.find(this.session),O=0;return I&&(this.$tryReplace(I,C)&&(O=1),this.selection.setSelectionRange(I),this.renderer.scrollSelectionIntoView(I.start,I.end)),O},w.prototype.replaceAll=function(C,T){T&&this.$search.set(T);var I=this.$search.findAll(this.session),O=0;if(!I.length)return O;var R=this.getSelectionRange();this.selection.moveTo(0,0);for(var P=I.length-1;P>=0;--P)this.$tryReplace(I[P],C)&&O++;return this.selection.setSelectionRange(R),O},w.prototype.$tryReplace=function(C,T){var I=this.session.getTextRange(C);return T=this.$search.replace(I,T),T!==null?(C.end=this.session.replace(C,T),C):null},w.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},w.prototype.find=function(C,T,I){T||(T={}),typeof C=="string"||C instanceof RegExp?T.needle=C:typeof C=="object"&&c.mixin(T,C);var O=this.selection.getRange();T.needle==null&&(C=this.session.getTextRange(O)||this.$search.$options.needle,C||(O=this.session.getWordRange(O.start.row,O.start.column),C=this.session.getTextRange(O)),this.$search.set({needle:C})),this.$search.set(T),T.start||this.$search.set({start:O});var R=this.$search.find(this.session);if(T.preventScroll)return R;if(R)return this.revealRange(R,I),R;T.backwards?O.start=O.end:O.end=O.start,this.selection.setRange(O)},w.prototype.findNext=function(C,T){this.find({skipCurrent:!0,backwards:!1},C,T)},w.prototype.findPrevious=function(C,T){this.find(C,{skipCurrent:!0,backwards:!0},T)},w.prototype.revealRange=function(C,T){this.session.unfold(C),this.selection.setSelectionRange(C);var I=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(C.start,C.end,.5),T!==!1&&this.renderer.animateScrolling(I)},w.prototype.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},w.prototype.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},w.prototype.destroy=function(){this.$toDestroy&&(this.$toDestroy.forEach(function(C){C.destroy()}),this.$toDestroy=null),this.$mouseHandler&&this.$mouseHandler.destroy(),this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy(),this._$emitInputEvent&&this._$emitInputEvent.cancel(),this.removeAllListeners()},w.prototype.setAutoScrollEditorIntoView=function(C){if(C){var T,I=this,O=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var R=this.$scrollAnchor;R.style.cssText="position:absolute",this.container.insertBefore(R,this.container.firstChild);var P=this.on("changeSelection",function(){O=!0}),B=this.renderer.on("beforeRender",function(){O&&(T=I.renderer.container.getBoundingClientRect())}),V=this.renderer.on("afterRender",function(){if(O&&T&&(I.isFocused()||I.searchBox&&I.searchBox.isFocused())){var W=I.renderer,z=W.$cursorLayer.$pixelPos,U=W.layerConfig,G=z.top-U.offset;z.top>=0&&G+T.top<0?O=!0:z.top<U.height&&z.top+T.top+U.lineHeight>window.innerHeight?O=!1:O=null,O!=null&&(R.style.top=G+"px",R.style.left=z.left+"px",R.style.height=U.lineHeight+"px",R.scrollIntoView(O)),O=T=null}});this.setAutoScrollEditorIntoView=function(W){W||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",P),this.renderer.off("afterRender",V),this.renderer.off("beforeRender",B))}}},w.prototype.$resetCursorStyle=function(){var C=this.$cursorStyle||"ace",T=this.renderer.$cursorLayer;T&&(T.setSmoothBlinking(/smooth/.test(C)),T.isBlinking=!this.$readOnly&&C!="wide",d.setCssClass(T.element,"ace_slim-cursors",/slim/.test(C)))},w.prototype.prompt=function(C,T,I){var O=this;E.loadModule("ace/ext/prompt",function(R){R.prompt(O,C,T,I)})},w}();A.$uid=0,A.prototype.curOp=null,A.prototype.prevOp={},A.prototype.$mergeableCommands=["backspace","del","insertstring"],A.prototype.$toggleWordPairs=[["first","last"],["true","false"],["yes","no"],["width","height"],["top","bottom"],["right","left"],["on","off"],["x","y"],["get","set"],["max","min"],["horizontal","vertical"],["show","hide"],["add","remove"],["up","down"],["before","after"],["even","odd"],["in","out"],["inside","outside"],["next","previous"],["increase","decrease"],["attach","detach"],["&&","||"],["==","!="]],c.implement(A.prototype,m),E.defineOptions(A.prototype,"editor",{selectionStyle:{set:function(w){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:w})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(w){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(w){var C=this;this.textInput.setReadOnly(w),this.$resetCursorStyle(),this.$readOnlyCallback||(this.$readOnlyCallback=function(I){var O=!1;if(I&&I.type=="keydown"){if(O=I&&I.key&&I.key.length==1&&!I.ctrlKey&&!I.metaKey,!O)return}else I&&I.type!=="exec"&&(O=!0);if(O){C.hoverTooltip||(C.hoverTooltip=new F);var R=d.createElement("div");R.textContent=S("editor.tooltip.disable-editing","Editing is disabled"),C.hoverTooltip.isOpen||C.hoverTooltip.showForRange(C,C.getSelectionRange(),R)}else C.hoverTooltip&&C.hoverTooltip.isOpen&&C.hoverTooltip.hide()});var T=this.textInput.getElement();w?(_.addListener(T,"keydown",this.$readOnlyCallback,this),this.commands.on("exec",this.$readOnlyCallback),this.commands.on("commandUnavailable",this.$readOnlyCallback)):(_.removeListener(T,"keydown",this.$readOnlyCallback),this.commands.off("exec",this.$readOnlyCallback),this.commands.off("commandUnavailable",this.$readOnlyCallback),this.hoverTooltip&&(this.hoverTooltip.destroy(),this.hoverTooltip=null))},initialValue:!1},copyWithEmptySelection:{set:function(w){this.textInput.setCopyWithEmptySelection(w)},initialValue:!1},cursorStyle:{set:function(w){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},enableAutoIndent:{initialValue:!0},autoScrollEditorIntoView:{set:function(w){this.setAutoScrollEditorIntoView(w)}},keyboardHandler:{set:function(w){this.setKeyboardHandler(w)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(w){this.session.setValue(w)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(w){this.setSession(w)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(w){this.renderer.$gutterLayer.setShowLineNumbers(w),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),w&&this.$relativeLineNumbers?$.attach(this):$.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(w){this.$showLineNumbers&&w?$.attach(this):$.detach(this)}},placeholder:{set:function(w){this.$updatePlaceholder||(this.$updatePlaceholder=function(){var C=this.session&&(this.renderer.$composition||this.session.getLength()>1||this.session.getLine(0).length>0);if(C&&this.renderer.placeholderNode)this.renderer.off("afterRender",this.$updatePlaceholder),d.removeCssClass(this.container,"ace_hasPlaceholder"),this.renderer.placeholderNode.remove(),this.renderer.placeholderNode=null;else if(!C&&!this.renderer.placeholderNode){this.renderer.on("afterRender",this.$updatePlaceholder),d.addCssClass(this.container,"ace_hasPlaceholder");var T=d.createElement("div");T.className="ace_placeholder",T.textContent=this.$placeholder||"",this.renderer.placeholderNode=T,this.renderer.content.appendChild(this.renderer.placeholderNode)}else!C&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"")}.bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},enableKeyboardAccessibility:{set:function(w){var C={name:"blurTextInput",description:"Set focus to the editor content div to allow tabbing through the page",bindKey:"Esc",exec:function(O){O.blur(),O.renderer.scroller.focus()},readOnly:!0},T=function(O){if(O.target==this.renderer.scroller&&O.keyCode===D.enter){O.preventDefault();var R=this.getCursorPosition().row;this.isRowVisible(R)||this.scrollToLine(R,!0,!0),this.focus()}},I;w?(this.renderer.enableKeyboardAccessibility=!0,this.renderer.keyboardFocusClassName="ace_keyboard-focus",this.textInput.getElement().setAttribute("tabindex",-1),this.textInput.setNumberOfExtraLines(p.isWin?3:0),this.renderer.scroller.setAttribute("tabindex",0),this.renderer.scroller.setAttribute("role","group"),this.renderer.scroller.setAttribute("aria-roledescription",S("editor.scroller.aria-roledescription","editor")),this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName),this.renderer.scroller.setAttribute("aria-label",S("editor.scroller.aria-label","Editor content, press Enter to start editing, press Escape to exit")),this.renderer.scroller.addEventListener("keyup",T.bind(this)),this.commands.addCommand(C),this.renderer.$gutter.setAttribute("tabindex",0),this.renderer.$gutter.setAttribute("aria-hidden",!1),this.renderer.$gutter.setAttribute("role","group"),this.renderer.$gutter.setAttribute("aria-roledescription",S("editor.gutter.aria-roledescription","editor gutter")),this.renderer.$gutter.setAttribute("aria-label",S("editor.gutter.aria-label","Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit")),this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName),this.renderer.content.setAttribute("aria-hidden",!0),I||(I=new g(this)),I.addListener(),this.textInput.setAriaOptions({setLabel:!0})):(this.renderer.enableKeyboardAccessibility=!1,this.textInput.getElement().setAttribute("tabindex",0),this.textInput.setNumberOfExtraLines(0),this.renderer.scroller.setAttribute("tabindex",-1),this.renderer.scroller.removeAttribute("role"),this.renderer.scroller.removeAttribute("aria-roledescription"),this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName),this.renderer.scroller.removeAttribute("aria-label"),this.renderer.scroller.removeEventListener("keyup",T.bind(this)),this.commands.removeCommand(C),this.renderer.content.removeAttribute("aria-hidden"),this.renderer.$gutter.setAttribute("tabindex",-1),this.renderer.$gutter.setAttribute("aria-hidden",!0),this.renderer.$gutter.removeAttribute("role"),this.renderer.$gutter.removeAttribute("aria-roledescription"),this.renderer.$gutter.removeAttribute("aria-label"),this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName),I&&I.removeListener())},initialValue:!1},textInputAriaLabel:{set:function(w){this.$textInputAriaLabel=w},initialValue:""},enableMobileMenu:{set:function(w){this.$enableMobileMenu=w},initialValue:!0},customScrollbar:"renderer",hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",highlightIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",useResizeObserver:"renderer",useSvgGutterIcons:"renderer",showFoldedAnnotations:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var $={getText:function(w,C){return(Math.abs(w.selection.lead.row-C)||C+1+(C<9?"·":""))+""},getWidth:function(w,C,T){return Math.max(C.toString().length,(T.lastRow+1).toString().length,2)*T.characterWidth},update:function(w,C){C.renderer.$loop.schedule(C.renderer.CHANGE_GUTTER)},attach:function(w){w.renderer.$gutterLayer.$renderer=this,w.on("changeSelection",this.update),this.update(null,w)},detach:function(w){w.renderer.$gutterLayer.$renderer==this&&(w.renderer.$gutterLayer.$renderer=null),w.off("changeSelection",this.update),this.update(null,w)}};l.Editor=A}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(i,l,v){var s=i("../lib/dom"),c=function(){function d(o,p){this.element=o,this.canvasHeight=p||5e5,this.element.style.height=this.canvasHeight*2+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0}return d.prototype.moveContainer=function(o){s.translate(this.element,0,-(o.firstRowScreen*o.lineHeight%this.canvasHeight)-o.offset*this.$offsetCoefficient)},d.prototype.pageChanged=function(o,p){return Math.floor(o.firstRowScreen*o.lineHeight/this.canvasHeight)!==Math.floor(p.firstRowScreen*p.lineHeight/this.canvasHeight)},d.prototype.computeLineTop=function(o,p,e){var t=p.firstRowScreen*p.lineHeight,r=Math.floor(t/this.canvasHeight),h=e.documentToScreenRow(o,0)*p.lineHeight;return h-r*this.canvasHeight},d.prototype.computeLineHeight=function(o,p,e){return p.lineHeight*e.getRowLineCount(o)},d.prototype.getLength=function(){return this.cells.length},d.prototype.get=function(o){return this.cells[o]},d.prototype.shift=function(){this.$cacheCell(this.cells.shift())},d.prototype.pop=function(){this.$cacheCell(this.cells.pop())},d.prototype.push=function(o){if(Array.isArray(o)){this.cells.push.apply(this.cells,o);for(var p=s.createFragment(this.element),e=0;e<o.length;e++)p.appendChild(o[e].element);this.element.appendChild(p)}else this.cells.push(o),this.element.appendChild(o.element)},d.prototype.unshift=function(o){if(Array.isArray(o)){this.cells.unshift.apply(this.cells,o);for(var p=s.createFragment(this.element),e=0;e<o.length;e++)p.appendChild(o[e].element);this.element.firstChild?this.element.insertBefore(p,this.element.firstChild):this.element.appendChild(p)}else this.cells.unshift(o),this.element.insertAdjacentElement("afterbegin",o.element)},d.prototype.last=function(){return this.cells.length?this.cells[this.cells.length-1]:null},d.prototype.$cacheCell=function(o){o&&(o.element.remove(),this.cellCache.push(o))},d.prototype.createCell=function(o,p,e,t){var r=this.cellCache.pop();if(!r){var h=s.createElement("div");t&&t(h),this.element.appendChild(h),r={element:h,text:"",row:o}}return r.row=o,r},d}();l.Lines=c}),ace.define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/layer/lines","ace/config"],function(i,l,v){var s=i("../lib/dom"),c=i("../lib/oop"),d=i("../lib/lang"),o=i("../lib/event_emitter").EventEmitter,p=i("./lines").Lines,e=i("../config").nls,t=function(){function h(a){this.element=s.createElement("div"),this.element.className="ace_layer ace_gutter-layer",a.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$lines=new p(this.element),this.$lines.$offsetCoefficient=1}return h.prototype.setSession=function(a){this.session&&this.session.off("change",this.$updateAnnotations),this.session=a,a&&a.on("change",this.$updateAnnotations)},h.prototype.addGutterDecoration=function(a,u){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(a,u)},h.prototype.removeGutterDecoration=function(a,u){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(a,u)},h.prototype.setAnnotations=function(a){this.$annotations=[];for(var u=0;u<a.length;u++){var f=a[u],m=f.row,y=this.$annotations[m];y||(y=this.$annotations[m]={text:[],type:[],displayText:[]});var x=f.text,E=f.text,b=f.type;x=x?d.escapeHTML(x):f.html||"",E=E||f.html||"",y.text.indexOf(x)===-1&&(y.text.push(x),y.type.push(b),y.displayText.push(E));var g=f.className;g?y.className=g:b==="error"?y.className=" ace_error":b==="security"&&!/\bace_error\b/.test(y.className)?y.className=" ace_security":b==="warning"&&!/\bace_(error|security)\b/.test(y.className)?y.className=" ace_warning":b==="info"&&!y.className?y.className=" ace_info":b==="hint"&&!y.className&&(y.className=" ace_hint")}},h.prototype.$updateAnnotations=function(a){if(this.$annotations.length){var u=a.start.row,f=a.end.row-u;if(f!==0)if(a.action=="remove")this.$annotations.splice(u,f+1,null);else{var m=new Array(f+1);m.unshift(u,1),this.$annotations.splice.apply(this.$annotations,m)}}},h.prototype.update=function(a){this.config=a;var u=this.session,f=a.firstRow,m=Math.min(a.lastRow+a.gutterOffset,u.getLength()-1);this.oldLastRow=m,this.config=a,this.$lines.moveContainer(a),this.$updateCursorRow();for(var y=u.getNextFoldLine(f),x=y?y.start.row:1/0,E=null,b=-1,g=f;;){if(g>x&&(g=y.end.row+1,y=u.getNextFoldLine(g,y),x=y?y.start.row:1/0),g>m){for(;this.$lines.getLength()>b+1;)this.$lines.pop();break}E=this.$lines.get(++b),E?E.row=g:(E=this.$lines.createCell(g,a,this.session,r),this.$lines.push(E)),this.$renderCell(E,a,y,g),g++}this._signal("afterRender"),this.$updateGutterWidth(a)},h.prototype.$updateGutterWidth=function(a){var u=this.session,f=u.gutterRenderer||this.$renderer,m=u.$firstLineNumber,y=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||u.$useWrapMode)&&(y=u.getLength()+m-1);var x=f?f.getWidth(u,y,a):y.toString().length*a.characterWidth,E=this.$padding||this.$computePadding();x+=E.left+E.right,x!==this.gutterWidth&&!isNaN(x)&&(this.gutterWidth=x,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",x))},h.prototype.$updateCursorRow=function(){if(this.$highlightGutterLine){var a=this.session.selection.getCursor();this.$cursorRow!==a.row&&(this.$cursorRow=a.row)}},h.prototype.updateLineHighlight=function(){if(this.$highlightGutterLine){var a=this.session.selection.cursor.row;if(this.$cursorRow=a,!(this.$cursorCell&&this.$cursorCell.row==a)){this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var u=this.$lines.cells;this.$cursorCell=null;for(var f=0;f<u.length;f++){var m=u[f];if(m.row>=this.$cursorRow){if(m.row>this.$cursorRow){var y=this.session.getFoldLine(this.$cursorRow);if(f>0&&y&&y.start.row==u[f-1].row)m=u[f-1];else break}m.element.className="ace_gutter-active-line "+m.element.className,this.$cursorCell=m;break}}}}},h.prototype.scrollLines=function(a){var u=this.config;if(this.config=a,this.$updateCursorRow(),this.$lines.pageChanged(u,a))return this.update(a);this.$lines.moveContainer(a);var f=Math.min(a.lastRow+a.gutterOffset,this.session.getLength()-1),m=this.oldLastRow;if(this.oldLastRow=f,!u||m<a.firstRow)return this.update(a);if(f<u.firstRow)return this.update(a);if(u.firstRow<a.firstRow)for(var y=this.session.getFoldedRowCount(u.firstRow,a.firstRow-1);y>0;y--)this.$lines.shift();if(m>f)for(var y=this.session.getFoldedRowCount(f+1,m);y>0;y--)this.$lines.pop();a.firstRow<u.firstRow&&this.$lines.unshift(this.$renderLines(a,a.firstRow,u.firstRow-1)),f>m&&this.$lines.push(this.$renderLines(a,m+1,f)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(a)},h.prototype.$renderLines=function(a,u,f){for(var m=[],y=u,x=this.session.getNextFoldLine(y),E=x?x.start.row:1/0;y>E&&(y=x.end.row+1,x=this.session.getNextFoldLine(y,x),E=x?x.start.row:1/0),!(y>f);){var b=this.$lines.createCell(y,a,this.session,r);this.$renderCell(b,a,x,y),m.push(b),y++}return m},h.prototype.$renderCell=function(a,u,f,m){var y=a.element,x=this.session,E=y.childNodes[0],b=y.childNodes[1],g=y.childNodes[2],S=y.childNodes[3],k=g.firstChild,D=x.$firstLineNumber,_=x.$breakpoints,F=x.$decorations,A=x.gutterRenderer||this.$renderer,$=this.$showFoldWidgets&&x.foldWidgets,w=f?f.start.row:Number.MAX_VALUE,C=u.lineHeight+"px",T=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",I=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",O=(A?A.getText(x,m):m+D).toString();if(this.$highlightGutterLine&&(m==this.$cursorRow||f&&m<this.$cursorRow&&m>=w&&this.$cursorRow<=f.end.row)&&(T+="ace_gutter-active-line ",this.$cursorCell!=a&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=a)),_[m]&&(T+=_[m]),F[m]&&(T+=F[m]),this.$annotations[m]&&m!==w&&(T+=this.$annotations[m].className),$){var R=$[m];R==null&&(R=$[m]=x.getFoldWidget(m))}if(R){var P="ace_fold-widget ace_"+R,B=R=="start"&&m==w&&m<f.end.row;if(B){P+=" ace_closed";for(var V="",W=!1,z=m+1;z<=f.end.row;z++)if(this.$annotations[z]){if(this.$annotations[z].className===" ace_error"){W=!0,V=" ace_error_fold";break}this.$annotations[z].className===" ace_security"?(W=!0,V=" ace_security_fold"):this.$annotations[z].className===" ace_warning"&&V!==" ace_security_fold"&&(W=!0,V=" ace_warning_fold")}T+=V}else P+=" ace_open";b.className!=P&&(b.className=P),s.setStyle(b.style,"height",C),s.setStyle(b.style,"display","inline-block"),b.setAttribute("role","button"),b.setAttribute("tabindex","-1");var U=x.getFoldWidgetRange(m);U?b.setAttribute("aria-label",e("gutter.code-folding.range.aria-label","Toggle code folding, rows $0 through $1",[U.start.row+1,U.end.row+1])):f?b.setAttribute("aria-label",e("gutter.code-folding.closed.aria-label","Toggle code folding, rows $0 through $1",[f.start.row+1,f.end.row+1])):b.setAttribute("aria-label",e("gutter.code-folding.open.aria-label","Toggle code folding, row $0",[m+1])),B?(b.setAttribute("aria-expanded","false"),b.setAttribute("title",e("gutter.code-folding.closed.title","Unfold code"))):(b.setAttribute("aria-expanded","true"),b.setAttribute("title",e("gutter.code-folding.open.title","Fold code")))}else b&&(s.setStyle(b.style,"display","none"),b.setAttribute("tabindex","0"),b.removeAttribute("role"),b.removeAttribute("aria-label"));var G=this.session.$gutterCustomWidgets[m];if(G?this.$addCustomWidget(m,G,a):S&&this.$removeCustomWidget(m,a),W&&this.$showFoldedAnnotations){g.className="ace_gutter_annotation",k.className=I,k.className+=V,s.setStyle(k.style,"height",C),s.setStyle(g.style,"display","block"),s.setStyle(g.style,"height",C);var Y;switch(V){case" ace_error_fold":Y=e("gutter.annotation.aria-label.error","Error, read annotations row $0",[O]);break;case" ace_security_fold":Y=e("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[O]);break;case" ace_warning_fold":Y=e("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[O]);break}g.setAttribute("aria-label",Y),g.setAttribute("tabindex","-1"),g.setAttribute("role","button")}else if(this.$annotations[m]){g.className="ace_gutter_annotation",k.className=I,this.$useSvgGutterIcons?k.className+=this.$annotations[m].className:y.classList.add(this.$annotations[m].className.replace(" ","")),s.setStyle(k.style,"height",C),s.setStyle(g.style,"display","block"),s.setStyle(g.style,"height",C);var Y;switch(this.$annotations[m].className){case" ace_error":Y=e("gutter.annotation.aria-label.error","Error, read annotations row $0",[O]);break;case" ace_security":Y=e("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[O]);break;case" ace_warning":Y=e("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[O]);break;case" ace_info":Y=e("gutter.annotation.aria-label.info","Info, read annotations row $0",[O]);break;case" ace_hint":Y=e("gutter.annotation.aria-label.hint","Suggestion, read annotations row $0",[O]);break}g.setAttribute("aria-label",Y),g.setAttribute("tabindex","-1"),g.setAttribute("role","button")}else s.setStyle(g.style,"display","none"),g.removeAttribute("aria-label"),g.removeAttribute("role"),g.setAttribute("tabindex","0");return O!==E.data&&(E.data=O),y.className!=T&&(y.className=T),s.setStyle(a.element.style,"height",this.$lines.computeLineHeight(m,u,x)+"px"),s.setStyle(a.element.style,"top",this.$lines.computeLineTop(m,u,x)+"px"),a.text=O,g.style.display==="none"&&b.style.display==="none"&&!G?a.element.setAttribute("aria-hidden",!0):a.element.setAttribute("aria-hidden",!1),a},h.prototype.setHighlightGutterLine=function(a){this.$highlightGutterLine=a},h.prototype.setShowLineNumbers=function(a){this.$renderer=!a&&{getWidth:function(){return 0},getText:function(){return""}}},h.prototype.getShowLineNumbers=function(){return this.$showLineNumbers},h.prototype.setShowFoldWidgets=function(a){a?s.addCssClass(this.element,"ace_folding-enabled"):s.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=a,this.$padding=null},h.prototype.getShowFoldWidgets=function(){return this.$showFoldWidgets},h.prototype.$hideFoldWidget=function(a,u){var f=u||this.$getGutterCell(a);if(f&&f.element){var m=f.element.childNodes[1];m&&s.setStyle(m.style,"display","none")}},h.prototype.$showFoldWidget=function(a,u){var f=u||this.$getGutterCell(a);if(f&&f.element){var m=f.element.childNodes[1];m&&this.session.foldWidgets&&this.session.foldWidgets[f.row]&&s.setStyle(m.style,"display","inline-block")}},h.prototype.$getGutterCell=function(a){var u=this.$lines.cells,f=this.session.documentToScreenRow(a,0);return u[a-this.config.firstRowScreen-(a-f)]},h.prototype.$addCustomWidget=function(a,u,f){var m=u.className,y=u.label,x=u.title,E=u.callbacks;this.session.$gutterCustomWidgets[a]={className:m,label:y,title:x,callbacks:E},this.$hideFoldWidget(a,f);var b=f||this.$getGutterCell(a);if(b&&b.element){var g=b.element.querySelector(".ace_custom-widget");g&&g.remove(),g=s.createElement("span"),g.className="ace_custom-widget ".concat(m),g.setAttribute("tabindex","-1"),g.setAttribute("role","button"),g.setAttribute("aria-label",y),g.setAttribute("title",x),s.setStyle(g.style,"display","inline-block"),s.setStyle(g.style,"height","inherit"),E&&E.onClick&&g.addEventListener("click",function(S){E.onClick(S,a),S.stopPropagation()}),b.element.appendChild(g)}},h.prototype.$removeCustomWidget=function(a,u){delete this.session.$gutterCustomWidgets[a],this.$showFoldWidget(a,u);var f=u||this.$getGutterCell(a);if(f&&f.element){var m=f.element.querySelector(".ace_custom-widget");m&&f.element.removeChild(m)}},h.prototype.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var a=s.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=(parseInt(a.borderLeftWidth)||0)+(parseInt(a.paddingLeft)||0)+1,this.$padding.right=(parseInt(a.borderRightWidth)||0)+(parseInt(a.paddingRight)||0),this.$padding},h.prototype.getRegion=function(a){var u=this.$padding||this.$computePadding(),f=this.element.getBoundingClientRect();if(a.x<u.left+f.left)return"markers";if(this.$showFoldWidgets&&a.x>f.right-u.right)return"foldWidgets"},h}();t.prototype.$fixedWidth=!1,t.prototype.$highlightGutterLine=!0,t.prototype.$renderer="",t.prototype.$showLineNumbers=!0,t.prototype.$showFoldWidgets=!0,c.implement(t.prototype,o);function r(h){var a=document.createTextNode("");h.appendChild(a);var u=s.createElement("span");h.appendChild(u);var f=s.createElement("span");h.appendChild(f);var m=s.createElement("span");return f.appendChild(m),h}l.Gutter=t}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(i,l,v){var s=i("../range").Range,c=i("../lib/dom"),d=function(){function p(e){this.element=c.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)}return p.prototype.setPadding=function(e){this.$padding=e},p.prototype.setSession=function(e){this.session=e},p.prototype.setMarkers=function(e){this.markers=e},p.prototype.elt=function(e,t){var r=this.i!=-1&&this.element.childNodes[this.i];r?this.i++:(r=document.createElement("div"),this.element.appendChild(r),this.i=-1),r.style.cssText=t,r.className=e},p.prototype.update=function(e){if(e){this.config=e,this.i=0;var t;for(var r in this.markers){var h=this.markers[r];if(!h.range){h.update(t,this,this.session,e);continue}var a=h.range.clipRows(e.firstRow,e.lastRow);if(!a.isEmpty())if(a=a.toScreenRange(this.session),h.renderer){var u=this.$getTop(a.start.row,e),f=this.$padding+a.start.column*e.characterWidth;h.renderer(t,a,f,u,e)}else h.type=="fullLine"?this.drawFullLineMarker(t,a,h.clazz,e):h.type=="screenLine"?this.drawScreenLineMarker(t,a,h.clazz,e):a.isMultiLine()?h.type=="text"?this.drawTextMarker(t,a,h.clazz,e):this.drawMultiLineMarker(t,a,h.clazz,e):this.drawSingleLineMarker(t,a,h.clazz+" ace_start ace_br15",e)}if(this.i!=-1)for(;this.i<this.element.childElementCount;)this.element.removeChild(this.element.lastChild)}},p.prototype.$getTop=function(e,t){return(e-t.firstRowScreen)*t.lineHeight},p.prototype.drawTextMarker=function(e,t,r,h,a){for(var u=this.session,f=t.start.row,m=t.end.row,y=f,x=0,E=0,b=u.getScreenLastRowColumn(y),g=new s(y,t.start.column,y,E);y<=m;y++)g.start.row=g.end.row=y,g.start.column=y==f?t.start.column:u.getRowWrapIndent(y),g.end.column=b,x=E,E=b,b=y+1<m?u.getScreenLastRowColumn(y+1):y==m?0:t.end.column,this.drawSingleLineMarker(e,g,r+(y==f?" ace_start":"")+" ace_br"+o(y==f||y==f+1&&t.start.column,x<E,E>b,y==m),h,y==m?0:1,a)},p.prototype.drawMultiLineMarker=function(e,t,r,h,a){var u=this.$padding,f=h.lineHeight,m=this.$getTop(t.start.row,h),y=u+t.start.column*h.characterWidth;if(a=a||"",this.session.$bidiHandler.isBidiRow(t.start.row)){var x=t.clone();x.end.row=x.start.row,x.end.column=this.session.getLine(x.start.row).length,this.drawBidiSingleLineMarker(e,x,r+" ace_br1 ace_start",h,null,a)}else this.elt(r+" ace_br1 ace_start","height:"+f+"px;right:"+u+"px;top:"+m+"px;left:"+y+"px;"+(a||""));if(this.session.$bidiHandler.isBidiRow(t.end.row)){var x=t.clone();x.start.row=x.end.row,x.start.column=0,this.drawBidiSingleLineMarker(e,x,r+" ace_br12",h,null,a)}else{m=this.$getTop(t.end.row,h);var E=t.end.column*h.characterWidth;this.elt(r+" ace_br12","height:"+f+"px;width:"+E+"px;top:"+m+"px;left:"+u+"px;"+(a||""))}if(f=(t.end.row-t.start.row-1)*h.lineHeight,!(f<=0)){m=this.$getTop(t.start.row+1,h);var b=(t.start.column?1:0)|(t.end.column?0:8);this.elt(r+(b?" ace_br"+b:""),"height:"+f+"px;right:"+u+"px;top:"+m+"px;left:"+u+"px;"+(a||""))}},p.prototype.drawSingleLineMarker=function(e,t,r,h,a,u){if(this.session.$bidiHandler.isBidiRow(t.start.row))return this.drawBidiSingleLineMarker(e,t,r,h,a,u);var f=h.lineHeight,m=(t.end.column+(a||0)-t.start.column)*h.characterWidth,y=this.$getTop(t.start.row,h),x=this.$padding+t.start.column*h.characterWidth;this.elt(r,"height:"+f+"px;width:"+m+"px;top:"+y+"px;left:"+x+"px;"+(u||""))},p.prototype.drawBidiSingleLineMarker=function(e,t,r,h,a,u){var f=h.lineHeight,m=this.$getTop(t.start.row,h),y=this.$padding,x=this.session.$bidiHandler.getSelections(t.start.column,t.end.column);x.forEach(function(E){this.elt(r,"height:"+f+"px;width:"+(E.width+(a||0))+"px;top:"+m+"px;left:"+(y+E.left)+"px;"+(u||""))},this)},p.prototype.drawFullLineMarker=function(e,t,r,h,a){var u=this.$getTop(t.start.row,h),f=h.lineHeight;t.start.row!=t.end.row&&(f+=this.$getTop(t.end.row,h)-u),this.elt(r,"height:"+f+"px;top:"+u+"px;left:0;right:0;"+(a||""))},p.prototype.drawScreenLineMarker=function(e,t,r,h,a){var u=this.$getTop(t.start.row,h),f=h.lineHeight;this.elt(r,"height:"+f+"px;top:"+u+"px;left:0;right:0;"+(a||""))},p}();d.prototype.$padding=0;function o(p,e,t,r){return(p?1:0)|(e?2:0)|(t?4:0)|(r?8:0)}l.Marker=d}),ace.define("ace/layer/text_util",["require","exports","module"],function(i,l,v){var s=new Set(["text","rparen","lparen"]);l.isTextToken=function(c){return s.has(c)}}),ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter","ace/config","ace/layer/text_util"],function(i,l,v){var s=i("../lib/oop"),c=i("../lib/dom"),d=i("../lib/lang"),o=i("./lines").Lines,p=i("../lib/event_emitter").EventEmitter,e=i("../config").nls,t=i("./text_util").isTextToken,r=function(){function h(a){this.dom=c,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",a.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new o(this.element)}return h.prototype.$updateEolChar=function(){var a=this.session.doc,u=a.getNewLineCharacter()==`
|
|
230
|
-
`&&a.getNewLineMode()!="windows",f=u?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=f)return this.EOL_CHAR=f,!0},h.prototype.setPadding=function(a){this.$padding=a,this.element.style.margin="0 "+a+"px"},h.prototype.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},h.prototype.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},h.prototype.$setFontMetrics=function(a){this.$fontMetrics=a,this.$fontMetrics.on("changeCharacterSize",function(u){this._signal("changeCharacterSize",u)}.bind(this)),this.$pollSizeChanges()},h.prototype.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},h.prototype.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},h.prototype.setSession=function(a){this.session=a,a&&this.$computeTabString()},h.prototype.setShowInvisibles=function(a){return this.showInvisibles==a?!1:(this.showInvisibles=a,typeof a=="string"?(this.showSpaces=/tab/i.test(a),this.showTabs=/space/i.test(a),this.showEOL=/eol/i.test(a)):this.showSpaces=this.showTabs=this.showEOL=a,this.$computeTabString(),!0)},h.prototype.setDisplayIndentGuides=function(a){return this.displayIndentGuides==a?!1:(this.displayIndentGuides=a,this.$computeTabString(),!0)},h.prototype.setHighlightIndentGuides=function(a){return this.$highlightIndentGuides===a?!1:(this.$highlightIndentGuides=a,a)},h.prototype.$computeTabString=function(){var a=this.session.getTabSize();this.tabSize=a;for(var u=this.$tabStrings=[0],f=1;f<a+1;f++)if(this.showTabs){var m=this.dom.createElement("span");m.className="ace_invisible ace_invisible_tab",m.textContent=d.stringRepeat(this.TAB_CHAR,f),u.push(m)}else u.push(this.dom.createTextNode(d.stringRepeat(" ",f),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var y="ace_indent-guide",x=this.showSpaces?" ace_invisible ace_invisible_space":"",E=this.showSpaces?d.stringRepeat(this.SPACE_CHAR,this.tabSize):d.stringRepeat(" ",this.tabSize),b=this.showTabs?" ace_invisible ace_invisible_tab":"",g=this.showTabs?d.stringRepeat(this.TAB_CHAR,this.tabSize):E,m=this.dom.createElement("span");m.className=y+x,m.textContent=E,this.$tabStrings[" "]=m;var m=this.dom.createElement("span");m.className=y+b,m.textContent=g,this.$tabStrings[" "]=m}},h.prototype.updateLines=function(a,u,f){if(this.config.lastRow!=a.lastRow||this.config.firstRow!=a.firstRow)return this.update(a);this.config=a;for(var m=Math.max(u,a.firstRow),y=Math.min(f,a.lastRow),x=this.element.childNodes,E=0,g=a.firstRow;g<m;g++){var S=this.session.getFoldLine(g);if(S)if(S.containsRow(m)){m=S.start.row;break}else g=S.end.row;E++}for(var b=!1,g=m,S=this.session.getNextFoldLine(g),k=S?S.start.row:1/0;g>k&&(g=S.end.row+1,S=this.session.getNextFoldLine(g,S),k=S?S.start.row:1/0),!(g>y);){var D=x[E++];if(D){this.dom.removeChildren(D),this.$renderLine(D,g,g==k?S:!1),b&&(D.style.top=this.$lines.computeLineTop(g,a,this.session)+"px");var _=a.lineHeight*this.session.getRowLength(g)+"px";D.style.height!=_&&(b=!0,D.style.height=_)}g++}if(b)for(;E<this.$lines.cells.length;){var F=this.$lines.cells[E++];F.element.style.top=this.$lines.computeLineTop(F.row,a,this.session)+"px"}},h.prototype.scrollLines=function(a){var u=this.config;if(this.config=a,this.$lines.pageChanged(u,a))return this.update(a);this.$lines.moveContainer(a);var f=a.lastRow,m=u?u.lastRow:-1;if(!u||m<a.firstRow)return this.update(a);if(f<u.firstRow)return this.update(a);if(!u||u.lastRow<a.firstRow)return this.update(a);if(a.lastRow<u.firstRow)return this.update(a);if(u.firstRow<a.firstRow)for(var y=this.session.getFoldedRowCount(u.firstRow,a.firstRow-1);y>0;y--)this.$lines.shift();if(u.lastRow>a.lastRow)for(var y=this.session.getFoldedRowCount(a.lastRow+1,u.lastRow);y>0;y--)this.$lines.pop();a.firstRow<u.firstRow&&this.$lines.unshift(this.$renderLinesFragment(a,a.firstRow,u.firstRow-1)),a.lastRow>u.lastRow&&this.$lines.push(this.$renderLinesFragment(a,u.lastRow+1,a.lastRow)),this.$highlightIndentGuide()},h.prototype.$renderLinesFragment=function(a,u,f){for(var m=[],y=u,x=this.session.getNextFoldLine(y),E=x?x.start.row:1/0;y>E&&(y=x.end.row+1,x=this.session.getNextFoldLine(y,x),E=x?x.start.row:1/0),!(y>f);){var b=this.$lines.createCell(y,a,this.session),g=b.element;this.dom.removeChildren(g),c.setStyle(g.style,"height",this.$lines.computeLineHeight(y,a,this.session)+"px"),c.setStyle(g.style,"top",this.$lines.computeLineTop(y,a,this.session)+"px"),this.$renderLine(g,y,y==E?x:!1),this.$useLineGroups()?g.className="ace_line_group":g.className="ace_line",m.push(b),y++}return m},h.prototype.update=function(a){this.$lines.moveContainer(a),this.config=a;for(var u=a.firstRow,f=a.lastRow,m=this.$lines;m.getLength();)m.pop();m.push(this.$renderLinesFragment(a,u,f))},h.prototype.$renderToken=function(a,u,f,m){for(var y=this,x=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069\u2060\u2061\u2062\u2063\u2064\u206A\u206B\u206B\u206C\u206D\u206E\u206F]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,E=this.dom.createFragment(this.element),b,g=0;b=x.exec(m);){var S=b[1],k=b[2],D=b[3],_=b[4],F=b[5];if(!(!y.showSpaces&&k)){var A=g!=b.index?m.slice(g,b.index):"";if(g=b.index+b[0].length,A&&E.appendChild(this.dom.createTextNode(A,this.element)),S){var $=y.session.getScreenTabSize(u+b.index);E.appendChild(y.$tabStrings[$].cloneNode(!0)),u+=$-1}else if(k)if(y.showSpaces){var w=this.dom.createElement("span");w.className="ace_invisible ace_invisible_space",w.textContent=d.stringRepeat(y.SPACE_CHAR,k.length),E.appendChild(w)}else E.appendChild(this.dom.createTextNode(k,this.element));else if(D){var w=this.dom.createElement("span");w.className="ace_invisible ace_invisible_space ace_invalid",w.textContent=d.stringRepeat(y.SPACE_CHAR,D.length),E.appendChild(w)}else if(_){u+=1;var w=this.dom.createElement("span");w.style.width=y.config.characterWidth*2+"px",w.className=y.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",w.textContent=y.showSpaces?y.SPACE_CHAR:_,E.appendChild(w)}else if(F){u+=1;var w=this.dom.createElement("span");w.style.width=y.config.characterWidth*2+"px",w.className="ace_cjk",w.textContent=F,E.appendChild(w)}}}if(E.appendChild(this.dom.createTextNode(g?m.slice(g):m,this.element)),t(f.type))a.appendChild(E);else{var C="ace_"+f.type.replace(/\./g," ace_"),w=this.dom.createElement("span");f.type=="fold"&&(w.style.width=f.value.length*this.config.characterWidth+"px",w.setAttribute("title",e("inline-fold.closed.title","Unfold code"))),w.className=C,w.appendChild(E),a.appendChild(w)}return u+m.length},h.prototype.renderIndentGuide=function(a,u,f){var m=u.search(this.$indentGuideRe);if(m<=0||m>=f)return u;if(u[0]==" "){m-=m%this.tabSize;for(var y=m/this.tabSize,x=0;x<y;x++)a.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),u.substr(m)}else if(u[0]==" "){for(var x=0;x<m;x++)a.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),u.substr(m)}return this.$highlightIndentGuide(),u},h.prototype.$highlightIndentGuide=function(){if(!(!this.$highlightIndentGuides||!this.displayIndentGuides)){this.$highlightIndentGuideMarker={indentLevel:void 0,start:void 0,end:void 0,dir:void 0};var a=this.session.doc.$lines;if(a){var u=this.session.selection.getCursor(),f=/^\s*/.exec(this.session.doc.getLine(u.row))[0].length,m=Math.floor(f/this.tabSize);this.$highlightIndentGuideMarker={indentLevel:m,start:u.row};var y=this.session.$bracketHighlight;if(y){for(var x=this.session.$bracketHighlight.ranges,E=0;E<x.length;E++)if(u.row!==x[E].start.row){this.$highlightIndentGuideMarker.end=x[E].start.row+1,u.row>x[E].start.row?this.$highlightIndentGuideMarker.dir=-1:this.$highlightIndentGuideMarker.dir=1;break}}if(!this.$highlightIndentGuideMarker.end&&a[u.row]!==""&&u.column===a[u.row].length){this.$highlightIndentGuideMarker.dir=1;for(var E=u.row+1;E<a.length;E++){var b=a[E],g=/^\s*/.exec(b)[0].length;if(b!==""&&(this.$highlightIndentGuideMarker.end=E,g<=f))break}}this.$renderHighlightIndentGuide()}}},h.prototype.$clearActiveIndentGuide=function(){for(var a=this.element.querySelectorAll(".ace_indent-guide-active"),u=0;u<a.length;u++)a[u].classList.remove("ace_indent-guide-active")},h.prototype.$setIndentGuideActive=function(a,u){var f=this.session.doc.getLine(a.row);if(f!==""){var m=a.element;if(a.element.classList&&a.element.classList.contains("ace_line_group"))if(a.element.childNodes.length>0)m=a.element.childNodes[0];else return;var y=m.childNodes;if(y){var x=y[u-1];x&&x.classList&&x.classList.contains("ace_indent-guide")&&x.classList.add("ace_indent-guide-active")}}},h.prototype.$renderHighlightIndentGuide=function(){if(this.$lines){var a=this.$lines.cells;this.$clearActiveIndentGuide();var u=this.$highlightIndentGuideMarker.indentLevel;if(u!==0)if(this.$highlightIndentGuideMarker.dir===1)for(var f=0;f<a.length;f++){var m=a[f];if(this.$highlightIndentGuideMarker.end&&m.row>=this.$highlightIndentGuideMarker.start+1){if(m.row>=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(m,u)}}else for(var f=a.length-1;f>=0;f--){var m=a[f];if(this.$highlightIndentGuideMarker.end&&m.row<this.$highlightIndentGuideMarker.start){if(m.row<this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(m,u)}}}},h.prototype.$createLineElement=function(a){var u=this.dom.createElement("div");return u.className="ace_line",u.style.height=this.config.lineHeight+"px",u},h.prototype.$renderWrappedLine=function(a,u,f){var m=0,y=0,x=f[0],E=0,b=this.$createLineElement();a.appendChild(b);for(var g=0;g<u.length;g++){var S=u[g],k=S.value;if(g==0&&this.displayIndentGuides){if(m=k.length,k=this.renderIndentGuide(b,k,x),!k)continue;m-=k.length}if(m+k.length<x)E=this.$renderToken(b,E,S,k),m+=k.length;else{for(;m+k.length>=x;)E=this.$renderToken(b,E,S,k.substring(0,x-m)),k=k.substring(x-m),m=x,b=this.$createLineElement(),a.appendChild(b),b.appendChild(this.dom.createTextNode(d.stringRepeat(" ",f.indent),this.element)),y++,E=0,x=f[y]||Number.MAX_VALUE;k.length!=0&&(m+=k.length,E=this.$renderToken(b,E,S,k))}}f[f.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(b,E,null,"",!0)},h.prototype.$renderSimpleLine=function(a,u){for(var f=0,m=0;m<u.length;m++){var y=u[m],x=y.value;if(!(m==0&&this.displayIndentGuides&&(x=this.renderIndentGuide(a,x),!x))){if(f+x.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(a,f,y,x);f=this.$renderToken(a,f,y,x)}}},h.prototype.$renderOverflowMessage=function(a,u,f,m,y){f&&this.$renderToken(a,u,f,m.slice(0,this.MAX_LINE_LENGTH-u));var x=this.dom.createElement("span");x.className="ace_inline_button ace_keyword ace_toggle_wrap",x.textContent=y?"<hide>":"<click to see more...>",a.appendChild(x)},h.prototype.$renderLine=function(a,u,f){if(!f&&f!=!1&&(f=this.session.getFoldLine(u)),f)var m=this.$getFoldLineTokens(u,f);else var m=this.session.getTokens(u);var y=a;if(m.length){var x=this.session.getRowSplitData(u);if(x&&x.length){this.$renderWrappedLine(a,m,x);var y=a.lastChild}else{var y=a;this.$useLineGroups()&&(y=this.$createLineElement(),a.appendChild(y)),this.$renderSimpleLine(y,m)}}else this.$useLineGroups()&&(y=this.$createLineElement(),a.appendChild(y));if(this.showEOL&&y){f&&(u=f.end.row);var E=this.dom.createElement("span");E.className="ace_invisible ace_invisible_eol",E.textContent=u==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,y.appendChild(E)}},h.prototype.$getFoldLineTokens=function(a,u){var f=this.session,m=[];function y(E,b,g){for(var S=0,k=0;k+E[S].value.length<b;)if(k+=E[S].value.length,S++,S==E.length)return;if(k!=b){var D=E[S].value.substring(b-k);D.length>g-b&&(D=D.substring(0,g-b)),m.push({type:E[S].type,value:D}),k=b+D.length,S+=1}for(;k<g&&S<E.length;){var D=E[S].value;D.length+k>g?m.push({type:E[S].type,value:D.substring(0,g-k)}):m.push(E[S]),k+=D.length,S+=1}}var x=f.getTokens(a);return u.walk(function(E,b,g,S,k){E!=null?m.push({type:"fold",value:E}):(k&&(x=f.getTokens(b)),x.length&&y(x,S,g))},u.end.row,this.session.getLine(u.end.row).length),m},h.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},h}();r.prototype.EOF_CHAR="¶",r.prototype.EOL_CHAR_LF="¬",r.prototype.EOL_CHAR_CRLF="¤",r.prototype.EOL_CHAR=r.prototype.EOL_CHAR_LF,r.prototype.TAB_CHAR="—",r.prototype.SPACE_CHAR="·",r.prototype.$padding=0,r.prototype.MAX_LINE_LENGTH=1e4,r.prototype.showInvisibles=!1,r.prototype.showSpaces=!1,r.prototype.showTabs=!1,r.prototype.showEOL=!1,r.prototype.displayIndentGuides=!0,r.prototype.$highlightIndentGuides=!0,r.prototype.$tabStrings=[],r.prototype.destroy={},r.prototype.onChangeTabSize=r.prototype.$computeTabString,s.implement(r.prototype,p),l.Text=r}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(i,l,v){var s=i("../lib/dom"),c=function(){function d(o){this.element=s.createElement("div"),this.element.className="ace_layer ace_cursor-layer",o.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),s.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return d.prototype.$updateOpacity=function(o){for(var p=this.cursors,e=p.length;e--;)s.setStyle(p[e].style,"opacity",o?"":"0")},d.prototype.$startCssAnimation=function(){for(var o=this.cursors,p=o.length;p--;)o[p].style.animationDuration=this.blinkInterval+"ms";this.$isAnimating=!0,setTimeout(function(){this.$isAnimating&&s.addCssClass(this.element,"ace_animate-blinking")}.bind(this))},d.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,s.removeCssClass(this.element,"ace_animate-blinking")},d.prototype.setPadding=function(o){this.$padding=o},d.prototype.setSession=function(o){this.session=o},d.prototype.setBlinking=function(o){o!=this.isBlinking&&(this.isBlinking=o,this.restartTimer())},d.prototype.setBlinkInterval=function(o){o!=this.blinkInterval&&(this.blinkInterval=o,this.restartTimer())},d.prototype.setSmoothBlinking=function(o){o!=this.smoothBlinking&&(this.smoothBlinking=o,s.setCssClass(this.element,"ace_smooth-blinking",o),this.$updateCursors(!0),this.restartTimer())},d.prototype.addCursor=function(){var o=s.createElement("div");return o.className="ace_cursor",this.element.appendChild(o),this.cursors.push(o),o},d.prototype.removeCursor=function(){if(this.cursors.length>1){var o=this.cursors.pop();return o.parentNode.removeChild(o),o}},d.prototype.hideCursor=function(){this.isVisible=!1,s.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},d.prototype.showCursor=function(){this.isVisible=!0,s.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},d.prototype.restartTimer=function(){var o=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&(this.$isSmoothBlinking=!1,s.removeCssClass(this.element,"ace_smooth-blinking")),o(!0),!this.isBlinking||!this.blinkInterval||!this.isVisible){this.$stopCssAnimation();return}if(this.smoothBlinking&&(this.$isSmoothBlinking=!0,setTimeout(function(){this.$isSmoothBlinking&&s.addCssClass(this.element,"ace_smooth-blinking")}.bind(this))),s.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var p=function(){this.timeoutId=setTimeout(function(){o(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){o(!0),p()},this.blinkInterval),p()}},d.prototype.getPixelPosition=function(o,p){if(!this.config||!this.session)return{left:0,top:0};o||(o=this.session.selection.getCursor());var e=this.session.documentToScreenPosition(o),t=this.$padding+(this.session.$bidiHandler.isBidiRow(e.row,o.row)?this.session.$bidiHandler.getPosLeft(e.column):e.column*this.config.characterWidth),r=(e.row-(p?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:t,top:r}},d.prototype.isCursorInView=function(o,p){return o.top>=0&&o.top<p.maxHeight},d.prototype.update=function(o){this.config=o;var p=this.session.$selectionMarkers,e=0,t=0;(p===void 0||p.length===0)&&(p=[{cursor:null}]);for(var e=0,r=p.length;e<r;e++){var h=this.getPixelPosition(p[e].cursor,!0);if(!((h.top>o.height+o.offset||h.top<0)&&e>1)){var a=this.cursors[t++]||this.addCursor(),u=a.style;this.drawCursor?this.drawCursor(a,h,o,p[e],this.session):this.isCursorInView(h,o)?(s.setStyle(u,"display","block"),s.translate(a,h.left,h.top),s.setStyle(u,"width",Math.round(o.characterWidth)+"px"),s.setStyle(u,"height",o.lineHeight+"px")):s.setStyle(u,"display","none")}}for(;this.cursors.length>t;)this.removeCursor();var f=this.session.getOverwrite();this.$setOverwrite(f),this.$pixelPos=h,this.restartTimer()},d.prototype.$setOverwrite=function(o){o!=this.overwrite&&(this.overwrite=o,o?s.addCssClass(this.element,"ace_overwrite-cursors"):s.removeCssClass(this.element,"ace_overwrite-cursors"))},d.prototype.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)},d}();c.prototype.$padding=0,c.prototype.drawCursor=null,l.Cursor=c}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(i,l,v){var s=this&&this.__extends||function(){var a=function(u,f){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,y){m.__proto__=y}||function(m,y){for(var x in y)Object.prototype.hasOwnProperty.call(y,x)&&(m[x]=y[x])},a(u,f)};return function(u,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");a(u,f);function m(){this.constructor=u}u.prototype=f===null?Object.create(f):(m.prototype=f.prototype,new m)}}(),c=i("./lib/oop"),d=i("./lib/dom"),o=i("./lib/event"),p=i("./lib/event_emitter").EventEmitter,e=32768,t=function(){function a(u,f){this.element=d.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+f,this.inner=d.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent=" ",this.element.appendChild(this.inner),u.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,o.addListener(this.element,"scroll",this.onScroll.bind(this)),o.addListener(this.element,"mousedown",o.preventDefault)}return a.prototype.setVisible=function(u){this.element.style.display=u?"":"none",this.isVisible=u,this.coeff=1},a}();c.implement(t.prototype,p);var r=function(a){s(u,a);function u(f,m){var y=a.call(this,f,"-v")||this;return y.scrollTop=0,y.scrollHeight=0,m.$scrollbarWidth=y.width=d.scrollbarWidth(f.ownerDocument),y.inner.style.width=y.element.style.width=(y.width||15)+5+"px",y.$minWidth=0,y}return u.prototype.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,this.coeff!=1){var f=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-f)/(this.coeff-f)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},u.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},u.prototype.setHeight=function(f){this.element.style.height=f+"px"},u.prototype.setScrollHeight=function(f){this.scrollHeight=f,f>e?(this.coeff=e/f,f=e):this.coeff!=1&&(this.coeff=1),this.inner.style.height=f+"px"},u.prototype.setScrollTop=function(f){this.scrollTop!=f&&(this.skipEvent=!0,this.scrollTop=f,this.element.scrollTop=f*this.coeff)},u}(t);r.prototype.setInnerHeight=r.prototype.setScrollHeight;var h=function(a){s(u,a);function u(f,m){var y=a.call(this,f,"-h")||this;return y.scrollLeft=0,y.height=m.$scrollbarWidth,y.inner.style.height=y.element.style.height=(y.height||15)+5+"px",y}return u.prototype.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},u.prototype.getHeight=function(){return this.isVisible?this.height:0},u.prototype.setWidth=function(f){this.element.style.width=f+"px"},u.prototype.setInnerWidth=function(f){this.inner.style.width=f+"px"},u.prototype.setScrollWidth=function(f){this.inner.style.width=f+"px"},u.prototype.setScrollLeft=function(f){this.scrollLeft!=f&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=f)},u}(t);l.ScrollBar=r,l.ScrollBarV=r,l.ScrollBarH=h,l.VScrollBar=r,l.HScrollBar=h}),ace.define("ace/scrollbar_custom",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(i,l,v){var s=this&&this.__extends||function(){var h=function(a,u){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,m){f.__proto__=m}||function(f,m){for(var y in m)Object.prototype.hasOwnProperty.call(m,y)&&(f[y]=m[y])},h(a,u)};return function(a,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");h(a,u);function f(){this.constructor=a}a.prototype=u===null?Object.create(u):(f.prototype=u.prototype,new f)}}(),c=i("./lib/oop"),d=i("./lib/dom"),o=i("./lib/event"),p=i("./lib/event_emitter").EventEmitter;d.importCssString(`.ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{
|
|
224
|
+
`),t.row===0&&e.navigateUp()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"openCommandPallete",exec:function(e){console.warn("This is an obsolete command. Please use `openCommandPalette` instead."),e.prompt({$type:"commands"})},readOnly:!0},{name:"openCommandPalette",description:"Open command palette",bindKey:o("F1","F1"),exec:function(e){e.prompt({$type:"commands"})},readOnly:!0},{name:"modeSelect",description:"Change language mode...",bindKey:o(null,null),exec:function(e){e.prompt({$type:"modes"})},readOnly:!0}];for(var p=1;p<9;p++)l.commands.push({name:"foldToLevel"+p,description:"Fold To Level "+p,level:p,exec:function(e){e.session.foldToLevel(this.level)},scrollIntoView:"center",readOnly:!0})}),ace.define("ace/keyboard/gutter_handler",["require","exports","module","ace/lib/keys","ace/mouse/default_gutter_handler"],function(i,l,v){var s=i("../lib/keys"),c=i("../mouse/default_gutter_handler").GutterTooltip,d=function(){function p(e){this.editor=e,this.gutterLayer=e.renderer.$gutterLayer,this.element=e.renderer.$gutter,this.lines=e.renderer.$gutterLayer.$lines,this.activeRowIndex=null,this.activeLane=null,this.annotationTooltip=new c(this.editor)}return p.prototype.addListener=function(){this.element.addEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.addEventListener("focusout",this.$blurGutter.bind(this)),this.editor.on("mousewheel",this.$blurGutter.bind(this))},p.prototype.removeListener=function(){this.element.removeEventListener("keydown",this.$onGutterKeyDown.bind(this)),this.element.removeEventListener("focusout",this.$blurGutter.bind(this)),this.editor.off("mousewheel",this.$blurGutter.bind(this))},p.prototype.$onGutterKeyDown=function(e){if(this.annotationTooltip.isOpen){e.preventDefault(),e.keyCode===s.escape&&this.annotationTooltip.hideTooltip();return}if(e.target===this.element){if(e.keyCode!=s.enter)return;e.preventDefault();var t=this.editor.getCursorPosition().row;this.editor.isRowVisible(t)||this.editor.scrollToLine(t,!0,!0),setTimeout(function(){var r=this.$rowToRowIndex(this.gutterLayer.$cursorCell.row),h=this.$findNearestFoldLaneWidget(r),a=this.$findNearestAnnotation(r);if(!(h===null&&a===null)){var u=this.$findClosestNumber(h,a,r);if(u===h)if(this.activeLane="fold",this.activeRowIndex=h,this.$isCustomWidgetVisible(h)){this.$focusCustomWidget(this.activeRowIndex);return}else{this.$focusFoldWidget(this.activeRowIndex);return}else{this.activeRowIndex=a,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}}}.bind(this),10);return}this.$handleGutterKeyboardInteraction(e),setTimeout(function(){this.editor._signal("gutterkeydown",new o(e,this))}.bind(this),10)},p.prototype.$handleGutterKeyboardInteraction=function(e){if(e.keyCode===s.tab){e.preventDefault();return}if(e.keyCode===s.escape){e.preventDefault(),this.$blurGutter(),this.element.focus(),this.lane=null;return}if(e.keyCode===s.up){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetUp();break;case"annotation":this.$moveAnnotationUp();break}return}if(e.keyCode===s.down){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetDown();break;case"annotation":this.$moveAnnotationDown();break}return}if(e.keyCode===s.left){e.preventDefault(),this.$switchLane("annotation");return}if(e.keyCode===s.right){e.preventDefault(),this.$switchLane("fold");return}if(e.keyCode===s.enter||e.keyCode===s.space){switch(e.preventDefault(),this.activeLane){case"fold":var t=this.$rowIndexToRow(this.activeRowIndex),r=this.editor.session.$gutterCustomWidgets[t];if(r)r.callbacks&&r.callbacks.onClick&&r.callbacks.onClick(e,t);else if(this.gutterLayer.session.foldWidgets[t]==="start"){this.editor.session.onFoldWidgetClick(this.$rowIndexToRow(this.activeRowIndex),e),setTimeout(function(){this.$rowIndexToRow(this.activeRowIndex)!==t&&(this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=this.$rowToRowIndex(t),this.$focusFoldWidget(this.activeRowIndex))}.bind(this),10);break}else if(this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)]==="end")break;return;case"annotation":var h=this.lines.cells[this.activeRowIndex].element.childNodes[2],a=h.getBoundingClientRect(),u=this.annotationTooltip.getElement().style;u.left=a.right+"px",u.top=a.bottom+"px",this.annotationTooltip.showTooltip(this.$rowIndexToRow(this.activeRowIndex));break}return}},p.prototype.$blurGutter=function(){if(this.activeRowIndex!==null)switch(this.activeLane){case"fold":this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex);break;case"annotation":this.$blurAnnotation(this.activeRowIndex);break}this.annotationTooltip.isOpen&&this.annotationTooltip.hideTooltip()},p.prototype.$isFoldWidgetVisible=function(e){var t=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),r=this.$getFoldWidget(e).style.display!=="none";return t&&r},p.prototype.$isCustomWidgetVisible=function(e){var t=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),r=!!this.$getCustomWidget(e);return t&&r},p.prototype.$isAnnotationVisible=function(e){var t=this.editor.isRowFullyVisible(this.$rowIndexToRow(e)),r=this.$getAnnotation(e).style.display!=="none";return t&&r},p.prototype.$getFoldWidget=function(e){var t=this.lines.get(e),r=t.element;return r.childNodes[1]},p.prototype.$getCustomWidget=function(e){var t=this.lines.get(e),r=t.element;return r.childNodes[3]},p.prototype.$getAnnotation=function(e){var t=this.lines.get(e),r=t.element;return r.childNodes[2]},p.prototype.$findNearestFoldLaneWidget=function(e){if(this.$isCustomWidgetVisible(e)||this.$isFoldWidgetVisible(e))return e;for(var t=0;e-t>0||e+t<this.lines.getLength()-1;){if(t++,e-t>=0&&this.$isCustomWidgetVisible(e-t))return e-t;if(e+t<=this.lines.getLength()-1&&this.$isCustomWidgetVisible(e+t))return e+t;if(e-t>=0&&this.$isFoldWidgetVisible(e-t))return e-t;if(e+t<=this.lines.getLength()-1&&this.$isFoldWidgetVisible(e+t))return e+t}return null},p.prototype.$findNearestAnnotation=function(e){if(this.$isAnnotationVisible(e))return e;for(var t=0;e-t>0||e+t<this.lines.getLength()-1;){if(t++,e-t>=0&&this.$isAnnotationVisible(e-t))return e-t;if(e+t<=this.lines.getLength()-1&&this.$isAnnotationVisible(e+t))return e+t}return null},p.prototype.$focusFoldWidget=function(e){if(e!=null){var t=this.$getFoldWidget(e);t.classList.add(this.editor.renderer.keyboardFocusClassName),t.focus()}},p.prototype.$focusCustomWidget=function(e){if(e!=null){var t=this.$getCustomWidget(e);t&&(t.classList.add(this.editor.renderer.keyboardFocusClassName),t.focus())}},p.prototype.$focusAnnotation=function(e){if(e!=null){var t=this.$getAnnotation(e);t.classList.add(this.editor.renderer.keyboardFocusClassName),t.focus()}},p.prototype.$blurFoldWidget=function(e){var t=this.$getFoldWidget(e);t.classList.remove(this.editor.renderer.keyboardFocusClassName),t.blur()},p.prototype.$blurCustomWidget=function(e){var t=this.$getCustomWidget(e);t&&(t.classList.remove(this.editor.renderer.keyboardFocusClassName),t.blur())},p.prototype.$blurAnnotation=function(e){var t=this.$getAnnotation(e);t.classList.remove(this.editor.renderer.keyboardFocusClassName),t.blur()},p.prototype.$moveFoldWidgetUp=function(){for(var e=this.activeRowIndex;e>0;)if(e--,this.$isFoldWidgetVisible(e)||this.$isCustomWidgetVisible(e)){this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=e,this.$isFoldWidgetVisible(e)?this.$focusFoldWidget(this.activeRowIndex):this.$focusCustomWidget(this.activeRowIndex);return}},p.prototype.$moveFoldWidgetDown=function(){for(var e=this.activeRowIndex;e<this.lines.getLength()-1;)if(e++,this.$isFoldWidgetVisible(e)||this.$isCustomWidgetVisible(e)){this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=e,this.$isFoldWidgetVisible(e)?this.$focusFoldWidget(this.activeRowIndex):this.$focusCustomWidget(this.activeRowIndex);return}},p.prototype.$moveAnnotationUp=function(){for(var e=this.activeRowIndex;e>0;)if(e--,this.$isAnnotationVisible(e)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=e,this.$focusAnnotation(this.activeRowIndex);return}},p.prototype.$moveAnnotationDown=function(){for(var e=this.activeRowIndex;e<this.lines.getLength()-1;)if(e++,this.$isAnnotationVisible(e)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=e,this.$focusAnnotation(this.activeRowIndex);return}},p.prototype.$findClosestNumber=function(e,t,r){return e===null?t:t===null||Math.abs(r-e)<=Math.abs(r-t)?e:t},p.prototype.$switchLane=function(e){switch(e){case"annotation":if(this.activeLane==="annotation")break;var t=this.$findNearestAnnotation(this.activeRowIndex);if(t==null)break;this.activeLane="annotation",this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=t,this.$focusAnnotation(this.activeRowIndex);break;case"fold":if(this.activeLane==="fold")break;var r=this.$findNearestFoldLaneWidget(this.activeRowIndex);if(r===null)break;this.activeLane="fold",this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=r,this.$isCustomWidgetVisible(r)?this.$focusCustomWidget(this.activeRowIndex):this.$focusFoldWidget(this.activeRowIndex);break}},p.prototype.$rowIndexToRow=function(e){var t=this.lines.get(e);return t?t.row:null},p.prototype.$rowToRowIndex=function(e){for(var t=0;t<this.lines.getLength();t++){var r=this.lines.get(t);if(r.row==e)return t}return null},p}();l.GutterKeyboardHandler=d;var o=function(){function p(e,t){this.gutterKeyboardHandler=t,this.domEvent=e}return p.prototype.getKey=function(){return s.keyCodeToString(this.domEvent.keyCode)},p.prototype.getRow=function(){return this.gutterKeyboardHandler.$rowIndexToRow(this.gutterKeyboardHandler.activeRowIndex)},p.prototype.isInAnnotationLane=function(){return this.gutterKeyboardHandler.activeLane==="annotation"},p.prototype.isInFoldLane=function(){return this.gutterKeyboardHandler.activeLane==="fold"},p}();l.GutterKeyboardEvent=o}),ace.define("ace/editor",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/useragent","ace/keyboard/textinput","ace/mouse/mouse_handler","ace/mouse/fold_handler","ace/keyboard/keybinding","ace/edit_session","ace/search","ace/range","ace/lib/event_emitter","ace/commands/command_manager","ace/commands/default_commands","ace/config","ace/token_iterator","ace/keyboard/gutter_handler","ace/config","ace/clipboard","ace/lib/keys","ace/lib/event","ace/tooltip"],function(i,l,v){var s=this&&this.__values||function(C){var b=typeof Symbol=="function"&&Symbol.iterator,T=b&&C[b],I=0;if(T)return T.call(C);if(C&&typeof C.length=="number")return{next:function(){return C&&I>=C.length&&(C=void 0),{value:C&&C[I++],done:!C}}};throw new TypeError(b?"Object is not iterable.":"Symbol.iterator is not defined.")},c=i("./lib/oop"),d=i("./lib/dom"),o=i("./lib/lang"),p=i("./lib/useragent"),e=i("./keyboard/textinput").TextInput,t=i("./mouse/mouse_handler").MouseHandler,r=i("./mouse/fold_handler").FoldHandler,h=i("./keyboard/keybinding").KeyBinding,a=i("./edit_session").EditSession,u=i("./search").Search,f=i("./range").Range,m=i("./lib/event_emitter").EventEmitter,y=i("./commands/command_manager").CommandManager,x=i("./commands/default_commands").commands,E=i("./config"),w=i("./token_iterator").TokenIterator,g=i("./keyboard/gutter_handler").GutterKeyboardHandler,S=i("./config").nls,k=i("./clipboard"),D=i("./lib/keys"),_=i("./lib/event"),F=i("./tooltip").HoverTooltip,A=function(){function C(b,T,I){this.id="editor"+ ++C.$uid,this.session,this.$toDestroy=[];var O=b.getContainerElement();this.container=O,this.renderer=b,this.commands=new y(p.isMac?"mac":"win",x),typeof document=="object"&&(this.textInput=new e(b.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new t(this),new r(this)),this.keyBinding=new h(this),this.$search=new u().set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=o.delayedCall(function(){this._signal("input",{}),this.session&&!this.session.destroyed&&this.session.bgTokenizer.scheduleStart()}.bind(this)),this.on("change",function(N,P){P._$emitInputEvent.schedule(31)}),this.setSession(T||I&&I.session||new a("")),E.resetOptions(this),I&&this.setOptions(I),E._signal("editor",this)}return C.prototype.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0)},C.prototype.startOperation=function(b){this.session.startOperation(b)},C.prototype.endOperation=function(b){this.session.endOperation(b)},C.prototype.onStartOperation=function(b){this.curOp=this.session.curOp,this.curOp.scrollTop=this.renderer.scrollTop,this.prevOp=this.session.prevOp,b||(this.previousCommand=null)},C.prototype.onEndOperation=function(b){if(this.curOp&&this.session){if(b&&b.returnValue===!1){this.curOp=null;return}if(this._signal("beforeEndOperation"),!this.curOp)return;var T=this.curOp.command,I=T&&T.scrollIntoView;if(I){switch(I){case"center-animate":I="animate";case"center":this.renderer.scrollCursorIntoView(null,.5);break;case"animate":case"cursor":this.renderer.scrollCursorIntoView();break;case"selectionPart":var O=this.selection.getRange(),N=this.renderer.layerConfig;(O.start.row>=N.lastRow||O.end.row<=N.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break}I=="animate"&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.$lastSel=this.session.selection.toJSON(),this.prevOp=this.curOp,this.curOp=null}},C.prototype.$historyTracker=function(b){if(this.$mergeUndoDeltas){var T=this.prevOp,I=this.$mergeableCommands,O=T.command&&b.command.name==T.command.name;if(b.command.name=="insertstring"){var N=b.args;this.mergeNextCommand===void 0&&(this.mergeNextCommand=!0),O=O&&this.mergeNextCommand&&(!/\s/.test(N)||/\s/.test(T.args)),this.mergeNextCommand=!0}else O=O&&I.indexOf(b.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(O=!1),O?this.session.mergeUndoDeltas=!0:I.indexOf(b.command.name)!==-1&&(this.sequenceStartTime=Date.now())}},C.prototype.setKeyboardHandler=function(b,T){if(b&&typeof b=="string"&&b!="ace"){this.$keybindingId=b;var I=this;E.loadModule(["keybinding",b],function(O){I.$keybindingId==b&&I.keyBinding.setKeyboardHandler(O&&O.handler),T&&T()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(b),T&&T()},C.prototype.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},C.prototype.setSession=function(b){if(this.session!=b){this.curOp&&this.endOperation(),this.curOp={};var T=this.session;if(T){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange),this.session.off("startOperation",this.$onStartOperation),this.session.off("endOperation",this.$onEndOperation);var I=this.session.getSelection();I.off("changeCursor",this.$onCursorChange),I.off("changeSelection",this.$onSelectionChange)}this.session=b,b?(this.$onDocumentChange=this.onDocumentChange.bind(this),b.on("change",this.$onDocumentChange),this.renderer.setSession(b),this.$onChangeMode=this.onChangeMode.bind(this),b.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),b.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),b.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),b.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),b.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),b.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=b.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.$onStartOperation=this.onStartOperation.bind(this),this.session.on("startOperation",this.$onStartOperation),this.$onEndOperation=this.onEndOperation.bind(this),this.session.on("endOperation",this.$onEndOperation),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(b)),this._signal("changeSession",{session:b,oldSession:T}),this.curOp=null,T&&T._signal("changeEditor",{oldEditor:this}),T&&(T.$editor=null),b&&b._signal("changeEditor",{editor:this}),b&&(b.$editor=this),b&&!b.destroyed&&b.bgTokenizer.scheduleStart()}},C.prototype.getSession=function(){return this.session},C.prototype.setValue=function(b,T){return this.session.doc.setValue(b),T?T==1?this.navigateFileEnd():T==-1&&this.navigateFileStart():this.selectAll(),b},C.prototype.getValue=function(){return this.session.getValue()},C.prototype.getSelection=function(){return this.selection},C.prototype.resize=function(b){this.renderer.onResize(b)},C.prototype.setTheme=function(b,T){this.renderer.setTheme(b,T)},C.prototype.getTheme=function(){return this.renderer.getTheme()},C.prototype.setStyle=function(b,T){this.renderer.setStyle(b,T)},C.prototype.unsetStyle=function(b){this.renderer.unsetStyle(b)},C.prototype.getFontSize=function(){return this.getOption("fontSize")||d.computedStyle(this.container).fontSize},C.prototype.setFontSize=function(b){this.setOption("fontSize",b)},C.prototype.$highlightBrackets=function(){if(!this.$highlightPending){var b=this;this.$highlightPending=!0,setTimeout(function(){b.$highlightPending=!1;var T=b.session;if(!(!T||T.destroyed)){T.$bracketHighlight&&(T.$bracketHighlight.markerIds.forEach(function(U){T.removeMarker(U)}),T.$bracketHighlight=null);var I=b.getCursorPosition(),O=b.getKeyboardHandler(),N=O&&O.$getDirectionForHighlight&&O.$getDirectionForHighlight(b),P=T.getMatchingBracketRanges(I,N);if(!P){var B=new w(T,I.row,I.column),V=B.getCurrentToken();if(V&&/\b(?:tag-open|tag-name)/.test(V.type)){var W=T.getMatchingTags(I);W&&(P=[W.openTagName.isEmpty()?W.openTag:W.openTagName,W.closeTagName.isEmpty()?W.closeTag:W.closeTagName])}}if(!P&&T.$mode.getMatching&&(P=T.$mode.getMatching(b.session)),!P){b.getHighlightIndentGuides()&&b.renderer.$textLayer.$highlightIndentGuide();return}var z="ace_bracket";Array.isArray(P)?P.length==1&&(z="ace_error_bracket"):P=[P],P.length==2&&(f.comparePoints(P[0].end,P[1].start)==0?P=[f.fromPoints(P[0].start,P[1].end)]:f.comparePoints(P[0].start,P[1].end)==0&&(P=[f.fromPoints(P[1].start,P[0].end)])),T.$bracketHighlight={ranges:P,markerIds:P.map(function(U){return T.addMarker(U,z,"text")})},b.getHighlightIndentGuides()&&b.renderer.$textLayer.$highlightIndentGuide()}},50)}},C.prototype.focus=function(){this.textInput.focus()},C.prototype.isFocused=function(){return this.textInput.isFocused()},C.prototype.blur=function(){this.textInput.blur()},C.prototype.onFocus=function(b){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",b))},C.prototype.onBlur=function(b){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",b))},C.prototype.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$updateHighlightActiveLine()},C.prototype.onDocumentChange=function(b){var T=this.session.$useWrapMode,I=b.start.row==b.end.row?b.end.row:1/0;this.renderer.updateLines(b.start.row,I,T),this._signal("change",b),this.$cursorChange()},C.prototype.onTokenizerUpdate=function(b){var T=b.data;this.renderer.updateLines(T.first,T.last)},C.prototype.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},C.prototype.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},C.prototype.onCursorChange=function(){this.$cursorChange(),this._signal("changeSelection")},C.prototype.$updateHighlightActiveLine=function(){var b=this.getSession(),T;if(this.$highlightActiveLine&&((this.$selectionStyle!="line"||!this.selection.isMultiLine())&&(T=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(T=!1),this.renderer.$maxLines&&this.session.getLength()===1&&!(this.renderer.$minLines>1)&&(T=!1)),b.$highlightLineMarker&&!T)b.removeMarker(b.$highlightLineMarker.id),b.$highlightLineMarker=null;else if(!b.$highlightLineMarker&&T){var I=new f(T.row,T.column,T.row,1/0);I.id=b.addMarker(I,"ace_active-line","screenLine"),b.$highlightLineMarker=I}else T&&(b.$highlightLineMarker.start.row=T.row,b.$highlightLineMarker.end.row=T.row,b.$highlightLineMarker.start.column=T.column,b._signal("changeBackMarker"))},C.prototype.onSelectionChange=function(b){var T=this.session;if(T.$selectionMarker&&T.removeMarker(T.$selectionMarker),T.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var I=this.selection.getRange(),O=this.getSelectionStyle();T.$selectionMarker=T.addMarker(I,"ace_selection",O)}var N=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(N),this._signal("changeSelection")},C.prototype.$getSelectionHighLightRegexp=function(){var b=this.session,T=this.getSelectionRange();if(!(T.isEmpty()||T.isMultiLine())){var I=T.start.column,O=T.end.column,N=b.getLine(T.start.row),P=N.substring(I,O);if(!(P.length>5e3||!/[\w\d]/.test(P))){var B=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:P}),V=N.substring(I-1,O+1);if(B.test(V))return B}}},C.prototype.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},C.prototype.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},C.prototype.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},C.prototype.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},C.prototype.onChangeMode=function(b){this.renderer.updateText(),this._emit("changeMode",b)},C.prototype.onChangeWrapLimit=function(){this.renderer.updateFull()},C.prototype.onChangeWrapMode=function(){this.renderer.onResize(!0)},C.prototype.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},C.prototype.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},C.prototype.getCopyText=function(){var b=this.getSelectedText(),T=this.session.doc.getNewLineCharacter(),I=!1;if(!b&&this.$copyWithEmptySelection){I=!0;for(var O=this.selection.getAllRanges(),N=0;N<O.length;N++){var P=O[N];N&&O[N-1].start.row==P.start.row||(b+=this.session.getLine(P.start.row)+T)}}var B={text:b};return this._signal("copy",B),k.lineMode=I?B.text:!1,B.text},C.prototype.onCopy=function(){this.commands.exec("copy",this)},C.prototype.onCut=function(){this.commands.exec("cut",this)},C.prototype.onPaste=function(b,T){var I={text:b,event:T};this.commands.exec("paste",this,I)},C.prototype.$handlePaste=function(b){typeof b=="string"&&(b={text:b}),this._signal("paste",b);var T=b.text,I=T===k.lineMode,O=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)I?O.insert({row:this.selection.lead.row,column:0},T):this.insert(T);else if(I)this.selection.rangeList.ranges.forEach(function(z){O.insert({row:z.start.row,column:0},T)});else{var N=T.split(/\r\n|\r|\n/),P=this.selection.rangeList.ranges,B=N.length==2&&(!N[0]||!N[1]);if(N.length!=P.length||B)return this.commands.exec("insertstring",this,T);for(var V=P.length;V--;){var W=P[V];W.isEmpty()||O.remove(W),O.insert(W.start,N[V])}}},C.prototype.execCommand=function(b,T){return this.commands.exec(b,this,T)},C.prototype.insert=function(b,T){var I=this.session,O=I.getMode(),N=this.getCursorPosition();if(this.getBehavioursEnabled()&&!T){var P=O.transformAction(I.getState(N.row),"insertion",this,I,b);P&&(b!==P.text&&(this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1)),b=P.text)}if(b==" "&&(b=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&b.indexOf(`
|
|
225
|
+
`)==-1){var B=f.fromPoints(N,N);B.end.column+=b.length,this.session.remove(B)}}else{var B=this.getSelectionRange();N=this.session.remove(B),this.clearSelection()}if(b==`
|
|
226
|
+
`||b==`\r
|
|
227
|
+
`){var U=I.getLine(N.row);if(N.column>U.search(/\S|$/)){var V=U.substr(N.column).search(/\S|$/);I.doc.removeInLine(N.row,N.column,N.column+V)}}this.clearSelection();var W=N.column,z=I.getState(N.row),U=I.getLine(N.row),G=O.checkOutdent(z,U,b);if(I.insert(N,b),P&&P.selection&&(P.selection.length==2?this.selection.setSelectionRange(new f(N.row,W+P.selection[0],N.row,W+P.selection[1])):this.selection.setSelectionRange(new f(N.row+P.selection[0],P.selection[1],N.row+P.selection[2],P.selection[3]))),this.$enableAutoIndent){if(I.getDocument().isNewLine(b)){var Y=O.getNextLineIndent(z,U.slice(0,N.column),I.getTabString());I.insert({row:N.row+1,column:0},Y)}G&&O.autoOutdent(z,I,N.row)}},C.prototype.autoIndent=function(){for(var b=this.session,T=b.getMode(),I=this.selection.isEmpty()?[new f(0,0,b.doc.getLength()-1,0)]:this.selection.getAllRanges(),O="",N="",P="",B=b.getTabString(),V=0;V<I.length;V++)for(var W=I[V].start.row,z=I[V].end.row,U=W;U<=z;U++){U>0&&(O=b.getState(U-1),N=b.getLine(U-1),P=T.getNextLineIndent(O,N,B));var G=b.getLine(U),Y=T.$getIndent(G);if(P!==Y){if(Y.length>0){var Q=new f(U,0,U,Y.length);b.remove(Q)}P.length>0&&b.insert({row:U,column:0},P)}T.autoOutdent(O,b,U)}},C.prototype.onTextInput=function(b,T){if(!T)return this.keyBinding.onTextInput(b);this.startOperation({command:{name:"insertstring"}});var I=this.applyComposition.bind(this,b,T);this.selection.rangeCount?this.forEachSelection(I):I(),this.endOperation()},C.prototype.applyComposition=function(b,T){if(T.extendLeft||T.extendRight){var I=this.selection.getRange();I.start.column-=T.extendLeft,I.end.column+=T.extendRight,I.start.column<0&&(I.start.row--,I.start.column+=this.session.getLine(I.start.row).length+1),this.selection.setRange(I),!b&&!I.isEmpty()&&this.remove()}if((b||!this.selection.isEmpty())&&this.insert(b,!0),T.restoreStart||T.restoreEnd){var I=this.selection.getRange();I.start.column-=T.restoreStart,I.end.column-=T.restoreEnd,this.selection.setRange(I)}},C.prototype.onCommandKey=function(b,T,I){return this.keyBinding.onCommandKey(b,T,I)},C.prototype.setOverwrite=function(b){this.session.setOverwrite(b)},C.prototype.getOverwrite=function(){return this.session.getOverwrite()},C.prototype.toggleOverwrite=function(){this.session.toggleOverwrite()},C.prototype.setScrollSpeed=function(b){this.setOption("scrollSpeed",b)},C.prototype.getScrollSpeed=function(){return this.getOption("scrollSpeed")},C.prototype.setDragDelay=function(b){this.setOption("dragDelay",b)},C.prototype.getDragDelay=function(){return this.getOption("dragDelay")},C.prototype.setSelectionStyle=function(b){this.setOption("selectionStyle",b)},C.prototype.getSelectionStyle=function(){return this.getOption("selectionStyle")},C.prototype.setHighlightActiveLine=function(b){this.setOption("highlightActiveLine",b)},C.prototype.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},C.prototype.setHighlightGutterLine=function(b){this.setOption("highlightGutterLine",b)},C.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},C.prototype.setHighlightSelectedWord=function(b){this.setOption("highlightSelectedWord",b)},C.prototype.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},C.prototype.setAnimatedScroll=function(b){this.renderer.setAnimatedScroll(b)},C.prototype.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},C.prototype.setShowInvisibles=function(b){this.renderer.setShowInvisibles(b)},C.prototype.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},C.prototype.setDisplayIndentGuides=function(b){this.renderer.setDisplayIndentGuides(b)},C.prototype.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},C.prototype.setHighlightIndentGuides=function(b){this.renderer.setHighlightIndentGuides(b)},C.prototype.getHighlightIndentGuides=function(){return this.renderer.getHighlightIndentGuides()},C.prototype.setShowPrintMargin=function(b){this.renderer.setShowPrintMargin(b)},C.prototype.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},C.prototype.setPrintMarginColumn=function(b){this.renderer.setPrintMarginColumn(b)},C.prototype.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},C.prototype.setReadOnly=function(b){this.setOption("readOnly",b)},C.prototype.getReadOnly=function(){return this.getOption("readOnly")},C.prototype.setBehavioursEnabled=function(b){this.setOption("behavioursEnabled",b)},C.prototype.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},C.prototype.setWrapBehavioursEnabled=function(b){this.setOption("wrapBehavioursEnabled",b)},C.prototype.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},C.prototype.setShowFoldWidgets=function(b){this.setOption("showFoldWidgets",b)},C.prototype.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},C.prototype.setFadeFoldWidgets=function(b){this.setOption("fadeFoldWidgets",b)},C.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},C.prototype.remove=function(b){this.selection.isEmpty()&&(b=="left"?this.selection.selectLeft():this.selection.selectRight());var T=this.getSelectionRange();if(this.getBehavioursEnabled()){var I=this.session,O=I.getState(T.start.row),N=I.getMode().transformAction(O,"deletion",this,I,T);if(T.end.column===0){var P=I.getTextRange(T);if(P[P.length-1]==`
|
|
228
|
+
`){var B=I.getLine(T.end.row);/^\s+$/.test(B)&&(T.end.column=B.length)}}N&&(T=N)}this.session.remove(T),this.clearSelection()},C.prototype.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},C.prototype.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},C.prototype.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},C.prototype.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var b=this.getSelectionRange();b.start.column==b.end.column&&b.start.row==b.end.row&&(b.end.column=0,b.end.row++),this.session.remove(b),this.clearSelection()},C.prototype.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var b=this.getCursorPosition();this.insert(`
|
|
229
|
+
`),this.moveCursorToPosition(b)},C.prototype.setGhostText=function(b,T){this.renderer.setGhostText(b,T)},C.prototype.removeGhostText=function(){this.renderer.removeGhostText()},C.prototype.transposeLetters=function(){if(this.selection.isEmpty()){var b=this.getCursorPosition(),T=b.column;if(T!==0){var I=this.session.getLine(b.row),O,N;T<I.length?(O=I.charAt(T)+I.charAt(T-1),N=new f(b.row,T-1,b.row,T+1)):(O=I.charAt(T-1)+I.charAt(T-2),N=new f(b.row,T-2,b.row,T)),this.session.replace(N,O),this.session.selection.moveToPosition(N.end)}}},C.prototype.toLowerCase=function(){var b=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var T=this.getSelectionRange(),I=this.session.getTextRange(T);this.session.replace(T,I.toLowerCase()),this.selection.setSelectionRange(b)},C.prototype.toUpperCase=function(){var b=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var T=this.getSelectionRange(),I=this.session.getTextRange(T);this.session.replace(T,I.toUpperCase()),this.selection.setSelectionRange(b)},C.prototype.indent=function(){var b=this.session,T=this.getSelectionRange();if(T.start.row<T.end.row){var I=this.$getSelectedRows();b.indentRows(I.first,I.last," ");return}else if(T.start.column<T.end.column){var O=b.getTextRange(T);if(!/^\s+$/.test(O)){var I=this.$getSelectedRows();b.indentRows(I.first,I.last," ");return}}var N=b.getLine(T.start.row),P=T.start,B=b.getTabSize(),V=b.documentToScreenColumn(P.row,P.column);if(this.session.getUseSoftTabs())var W=B-V%B,z=o.stringRepeat(" ",W);else{for(var W=V%B;N[T.start.column-1]==" "&&W;)T.start.column--,W--;this.selection.setSelectionRange(T),z=" "}return this.insert(z)},C.prototype.blockIndent=function(){var b=this.$getSelectedRows();this.session.indentRows(b.first,b.last," ")},C.prototype.blockOutdent=function(){var b=this.session.getSelection();this.session.outdentRows(b.getRange())},C.prototype.sortLines=function(){for(var b=this.$getSelectedRows(),T=this.session,I=[],O=b.first;O<=b.last;O++)I.push(T.getLine(O));I.sort(function(B,V){return B.toLowerCase()<V.toLowerCase()?-1:B.toLowerCase()>V.toLowerCase()?1:0});for(var N=new f(0,0,0,0),O=b.first;O<=b.last;O++){var P=T.getLine(O);N.start.row=O,N.end.row=O,N.end.column=P.length,T.replace(N,I[O-b.first])}},C.prototype.toggleCommentLines=function(){var b=this.session.getState(this.getCursorPosition().row),T=this.$getSelectedRows();this.session.getMode().toggleCommentLines(b,this.session,T.first,T.last)},C.prototype.toggleBlockComment=function(){var b=this.getCursorPosition(),T=this.session.getState(b.row),I=this.getSelectionRange();this.session.getMode().toggleBlockComment(T,this.session,I,b)},C.prototype.getNumberAt=function(b,T){var I=/[\-]?[0-9]+(?:\.[0-9]+)?/g;I.lastIndex=0;for(var O=this.session.getLine(b);I.lastIndex<T;){var N=I.exec(O);if(N.index<=T&&N.index+N[0].length>=T){var P={value:N[0],start:N.index,end:N.index+N[0].length};return P}}return null},C.prototype.modifyNumber=function(b){var T=this.selection.getCursor().row,I=this.selection.getCursor().column,O=new f(T,I-1,T,I),N=this.session.getTextRange(O);if(!isNaN(parseFloat(N))&&isFinite(N)){var P=this.getNumberAt(T,I);if(P){var B=P.value.indexOf(".")>=0?P.start+P.value.indexOf(".")+1:P.end,V=P.start+P.value.length-B,W=parseFloat(P.value);W*=Math.pow(10,V),B!==P.end&&I<B?b*=Math.pow(10,P.end-I-1):b*=Math.pow(10,P.end-I),W+=b,W/=Math.pow(10,V);var z=W.toFixed(V),U=new f(T,P.start,T,P.end);this.session.replace(U,z),this.moveCursorTo(T,Math.max(P.start+1,I+z.length-P.value.length))}}else this.toggleWord()},C.prototype.toggleWord=function(){var b=this.selection.getCursor().row,T=this.selection.getCursor().column;this.selection.selectWord();var I=this.getSelectedText(),O=this.selection.getWordRange().start.column,N=I.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),P=T-O-1;P<0&&(P=0);var B=0,V=0,W=this;I.match(/[A-Za-z0-9_]+/)&&N.forEach(function(ue,me){V=B+ue.length,P>=B&&P<=V&&(I=ue,W.selection.clearSelection(),W.moveCursorTo(b,B+O),W.selection.selectTo(b,V+O)),B=V});for(var z=this.$toggleWordPairs,U,G=0;G<z.length;G++)for(var Y=z[G],Q=0;Q<=1;Q++){var q=+!Q,te=I.match(new RegExp("^\\s?_?("+o.escapeRegExp(Y[Q])+")\\s?$","i"));if(te){var re=I.match(new RegExp("([_]|^|\\s)("+o.escapeRegExp(te[1])+")($|\\s)","g"));re&&(U=I.replace(new RegExp(o.escapeRegExp(Y[Q]),"i"),function(ue){var me=Y[q];return ue.toUpperCase()==ue?me=me.toUpperCase():ue.charAt(0).toUpperCase()==ue.charAt(0)&&(me=me.substr(0,0)+Y[q].charAt(0).toUpperCase()+me.substr(1)),me}),this.insert(U),U="")}}},C.prototype.findLinkAt=function(b,T){var I,O,N=this.session.getLine(b),P=N.split(/((?:https?|ftp):\/\/[\S]+)/),B=T;B<0&&(B=0);var V=0,W=0,z;try{for(var U=s(P),G=U.next();!G.done;G=U.next()){var Y=G.value;if(W=V+Y.length,B>=V&&B<=W&&Y.match(/((?:https?|ftp):\/\/[\S]+)/)){z=Y.replace(/[\s:.,'";}\]]+$/,"");break}V=W}}catch(Q){I={error:Q}}finally{try{G&&!G.done&&(O=U.return)&&O.call(U)}finally{if(I)throw I.error}}return z},C.prototype.openLink=function(){var b=this.selection.getCursor(),T=this.findLinkAt(b.row,b.column);return T&&window.open(T,"_blank"),T!=null},C.prototype.removeLines=function(){var b=this.$getSelectedRows();this.session.removeFullLines(b.first,b.last),this.clearSelection()},C.prototype.duplicateSelection=function(){var b=this.selection,T=this.session,I=b.getRange(),O=b.isBackwards();if(I.isEmpty()){var N=I.start.row;T.duplicateLines(N,N)}else{var P=O?I.start:I.end,B=T.insert(P,T.getTextRange(I));I.start=P,I.end=B,b.setSelectionRange(I,O)}},C.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},C.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},C.prototype.moveText=function(b,T,I){return this.session.moveText(b,T,I)},C.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},C.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},C.prototype.$moveLines=function(b,T){var I,O,N=this.selection;if(!N.inMultiSelectMode||this.inVirtualSelectionMode){var P=N.toOrientedRange();I=this.$getSelectedRows(P),O=this.session.$moveLines(I.first,I.last,T?0:b),T&&b==-1&&(O=0),P.moveBy(O,0),N.fromOrientedRange(P)}else{var B=N.rangeList.ranges;N.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var V=0,W=0,z=B.length,U=0;U<z;U++){var G=U;B[U].moveBy(V,0),I=this.$getSelectedRows(B[U]);for(var Y=I.first,Q=I.last;++U<z;){W&&B[U].moveBy(W,0);var q=this.$getSelectedRows(B[U]);if(T&&q.first!=Q)break;if(!T&&q.first>Q+1)break;Q=q.last}for(U--,V=this.session.$moveLines(Y,Q,T?0:b),T&&b==-1&&(G=U+1);G<=U;)B[G].moveBy(V,0),G++;T||(V=0),W+=V}N.fromOrientedRange(N.ranges[0]),N.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},C.prototype.$getSelectedRows=function(b){return b=(b||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(b.start.row),last:this.session.getRowFoldEnd(b.end.row)}},C.prototype.onCompositionStart=function(b){this.renderer.showComposition(b)},C.prototype.onCompositionUpdate=function(b){this.renderer.setCompositionText(b)},C.prototype.onCompositionEnd=function(){this.renderer.hideComposition()},C.prototype.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},C.prototype.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},C.prototype.isRowVisible=function(b){return b>=this.getFirstVisibleRow()&&b<=this.getLastVisibleRow()},C.prototype.isRowFullyVisible=function(b){return b>=this.renderer.getFirstFullyVisibleRow()&&b<=this.renderer.getLastFullyVisibleRow()},C.prototype.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},C.prototype.$moveByPage=function(b,T){var I=this.renderer,O=this.renderer.layerConfig,N=b*Math.floor(O.height/O.lineHeight);T===!0?this.selection.$moveSelection(function(){this.moveCursorBy(N,0)}):T===!1&&(this.selection.moveCursorBy(N,0),this.selection.clearSelection());var P=I.scrollTop;I.scrollBy(0,N*O.lineHeight),T!=null&&I.scrollCursorIntoView(null,.5),I.animateScrolling(P)},C.prototype.selectPageDown=function(){this.$moveByPage(1,!0)},C.prototype.selectPageUp=function(){this.$moveByPage(-1,!0)},C.prototype.gotoPageDown=function(){this.$moveByPage(1,!1)},C.prototype.gotoPageUp=function(){this.$moveByPage(-1,!1)},C.prototype.scrollPageDown=function(){this.$moveByPage(1)},C.prototype.scrollPageUp=function(){this.$moveByPage(-1)},C.prototype.scrollToRow=function(b){this.renderer.scrollToRow(b)},C.prototype.scrollToLine=function(b,T,I,O){this.renderer.scrollToLine(b,T,I,O)},C.prototype.centerSelection=function(){var b=this.getSelectionRange(),T={row:Math.floor(b.start.row+(b.end.row-b.start.row)/2),column:Math.floor(b.start.column+(b.end.column-b.start.column)/2)};this.renderer.alignCursor(T,.5)},C.prototype.getCursorPosition=function(){return this.selection.getCursor()},C.prototype.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},C.prototype.getSelectionRange=function(){return this.selection.getRange()},C.prototype.selectAll=function(){this.selection.selectAll()},C.prototype.clearSelection=function(){this.selection.clearSelection()},C.prototype.moveCursorTo=function(b,T){this.selection.moveCursorTo(b,T)},C.prototype.moveCursorToPosition=function(b){this.selection.moveCursorToPosition(b)},C.prototype.jumpToMatching=function(b,T){var I=this.getCursorPosition(),O=new w(this.session,I.row,I.column),N=O.getCurrentToken(),P=0;N&&N.type.indexOf("tag-name")!==-1&&(N=O.stepBackward());var B=N||O.stepForward();if(B){var V,W=!1,z={},U=I.column-B.start,G,Y={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(B.value.match(/[{}()\[\]]/g)){for(;U<B.value.length&&!W;U++)if(Y[B.value[U]])switch(G=Y[B.value[U]]+"."+B.type.replace("rparen","lparen"),isNaN(z[G])&&(z[G]=0),B.value[U]){case"(":case"[":case"{":z[G]++;break;case")":case"]":case"}":z[G]--,z[G]===-1&&(V="bracket",W=!0);break}}else B.type.indexOf("tag-name")!==-1&&(isNaN(z[B.value])&&(z[B.value]=0),N.value==="<"&&P>1?z[B.value]++:N.value==="</"&&z[B.value]--,z[B.value]===-1&&(V="tag",W=!0));W||(N=B,P++,B=O.stepForward(),U=0)}while(B&&!W);if(V){var Q,q;if(V==="bracket")Q=this.session.getBracketRange(I),Q||(Q=new f(O.getCurrentTokenRow(),O.getCurrentTokenColumn()+U-1,O.getCurrentTokenRow(),O.getCurrentTokenColumn()+U-1),q=Q.start,(T||q.row===I.row&&Math.abs(q.column-I.column)<2)&&(Q=this.session.getBracketRange(q)));else if(V==="tag"){if(!B||B.type.indexOf("tag-name")===-1)return;if(Q=new f(O.getCurrentTokenRow(),O.getCurrentTokenColumn()-2,O.getCurrentTokenRow(),O.getCurrentTokenColumn()-2),Q.compare(I.row,I.column)===0){var te=this.session.getMatchingTags(I);te&&(te.openTag.contains(I.row,I.column)?(Q=te.closeTag,q=Q.start):(Q=te.openTag,te.closeTag.start.row===I.row&&te.closeTag.start.column===I.column?q=Q.end:q=Q.start))}q=q||Q.start}q=Q&&Q.cursor||q,q&&(b?Q&&T?this.selection.setRange(Q):Q&&Q.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(q.row,q.column):this.selection.moveTo(q.row,q.column))}}},C.prototype.gotoLine=function(b,T,I){this.selection.clearSelection(),this.session.unfold({row:b-1,column:T||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(b-1,T||0),this.isRowFullyVisible(b-1)||this.scrollToLine(b-1,!0,I)},C.prototype.navigateTo=function(b,T){this.selection.moveTo(b,T)},C.prototype.navigateUp=function(b){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var T=this.selection.anchor.getPosition();return this.moveCursorToPosition(T)}this.selection.clearSelection(),this.selection.moveCursorBy(-b||-1,0)},C.prototype.navigateDown=function(b){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var T=this.selection.anchor.getPosition();return this.moveCursorToPosition(T)}this.selection.clearSelection(),this.selection.moveCursorBy(b||1,0)},C.prototype.navigateLeft=function(b){if(this.selection.isEmpty())for(b=b||1;b--;)this.selection.moveCursorLeft();else{var T=this.getSelectionRange().start;this.moveCursorToPosition(T)}this.clearSelection()},C.prototype.navigateRight=function(b){if(this.selection.isEmpty())for(b=b||1;b--;)this.selection.moveCursorRight();else{var T=this.getSelectionRange().end;this.moveCursorToPosition(T)}this.clearSelection()},C.prototype.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},C.prototype.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},C.prototype.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},C.prototype.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},C.prototype.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},C.prototype.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},C.prototype.replace=function(b,T){T&&this.$search.set(T);var I=this.$search.find(this.session),O=0;return I&&(this.$tryReplace(I,b)&&(O=1),this.selection.setSelectionRange(I),this.renderer.scrollSelectionIntoView(I.start,I.end)),O},C.prototype.replaceAll=function(b,T){T&&this.$search.set(T);var I=this.$search.findAll(this.session),O=0;if(!I.length)return O;var N=this.getSelectionRange();this.selection.moveTo(0,0);for(var P=I.length-1;P>=0;--P)this.$tryReplace(I[P],b)&&O++;return this.selection.setSelectionRange(N),O},C.prototype.$tryReplace=function(b,T){var I=this.session.getTextRange(b);return T=this.$search.replace(I,T),T!==null?(b.end=this.session.replace(b,T),b):null},C.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},C.prototype.find=function(b,T,I){T||(T={}),typeof b=="string"||b instanceof RegExp?T.needle=b:typeof b=="object"&&c.mixin(T,b);var O=this.selection.getRange();T.needle==null&&(b=this.session.getTextRange(O)||this.$search.$options.needle,b||(O=this.session.getWordRange(O.start.row,O.start.column),b=this.session.getTextRange(O)),this.$search.set({needle:b})),this.$search.set(T),T.start||this.$search.set({start:O});var N=this.$search.find(this.session);if(T.preventScroll)return N;if(N)return this.revealRange(N,I),N;T.backwards?O.start=O.end:O.end=O.start,this.selection.setRange(O)},C.prototype.findNext=function(b,T){this.find({skipCurrent:!0,backwards:!1},b,T)},C.prototype.findPrevious=function(b,T){this.find(b,{skipCurrent:!0,backwards:!0},T)},C.prototype.revealRange=function(b,T){this.session.unfold(b),this.selection.setSelectionRange(b);var I=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(b.start,b.end,.5),T!==!1&&this.renderer.animateScrolling(I)},C.prototype.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},C.prototype.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},C.prototype.destroy=function(){this.destroyed=!0,this.$toDestroy&&(this.$toDestroy.forEach(function(b){b.destroy()}),this.$toDestroy=[]),this.$mouseHandler&&this.$mouseHandler.destroy(),this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy(),this._$emitInputEvent&&this._$emitInputEvent.cancel(),this.removeAllListeners()},C.prototype.setAutoScrollEditorIntoView=function(b){if(b){var T,I=this,O=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var N=this.$scrollAnchor;N.style.cssText="position:absolute",this.container.insertBefore(N,this.container.firstChild);var P=this.on("changeSelection",function(){O=!0}),B=this.renderer.on("beforeRender",function(){O&&(T=I.renderer.container.getBoundingClientRect())}),V=this.renderer.on("afterRender",function(){if(O&&T&&(I.isFocused()||I.searchBox&&I.searchBox.isFocused())){var W=I.renderer,z=W.$cursorLayer.$pixelPos,U=W.layerConfig,G=z.top-U.offset;z.top>=0&&G+T.top<0?O=!0:z.top<U.height&&z.top+T.top+U.lineHeight>window.innerHeight?O=!1:O=null,O!=null&&(N.style.top=G+"px",N.style.left=z.left+"px",N.style.height=U.lineHeight+"px",N.scrollIntoView(O)),O=T=null}});this.setAutoScrollEditorIntoView=function(W){W||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",P),this.renderer.off("afterRender",V),this.renderer.off("beforeRender",B))}}},C.prototype.$resetCursorStyle=function(){var b=this.$cursorStyle||"ace",T=this.renderer.$cursorLayer;T&&(T.setSmoothBlinking(/smooth/.test(b)),T.isBlinking=!this.$readOnly&&b!="wide",d.setCssClass(T.element,"ace_slim-cursors",/slim/.test(b)))},C.prototype.prompt=function(b,T,I){var O=this;E.loadModule("ace/ext/prompt",function(N){N.prompt(O,b,T,I)})},C}();A.$uid=0,A.prototype.curOp=null,A.prototype.prevOp={},A.prototype.$mergeableCommands=["backspace","del","insertstring"],A.prototype.$toggleWordPairs=[["first","last"],["true","false"],["yes","no"],["width","height"],["top","bottom"],["right","left"],["on","off"],["x","y"],["get","set"],["max","min"],["horizontal","vertical"],["show","hide"],["add","remove"],["up","down"],["before","after"],["even","odd"],["in","out"],["inside","outside"],["next","previous"],["increase","decrease"],["attach","detach"],["&&","||"],["==","!="]],c.implement(A.prototype,m),E.defineOptions(A.prototype,"editor",{selectionStyle:{set:function(C){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:C})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(C){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(C){var b=this;if(this.textInput.setReadOnly(C),!this.destroyed){this.$resetCursorStyle(),this.$readOnlyCallback||(this.$readOnlyCallback=function(I){var O=!1;if(I&&I.type=="keydown"){if(I&&I.key&&!I.ctrlKey&&!I.metaKey&&(I.key==" "&&I.preventDefault(),O=I.key.length==1),!O)return}else I&&I.type!=="exec"&&(O=!0);if(O){b.hoverTooltip||(b.hoverTooltip=new F);var N=d.createElement("div");N.textContent=S("editor.tooltip.disable-editing","Editing is disabled"),b.hoverTooltip.isOpen||b.hoverTooltip.showForRange(b,b.getSelectionRange(),N)}else b.hoverTooltip&&b.hoverTooltip.isOpen&&b.hoverTooltip.hide()});var T=this.textInput.getElement();C?(_.addListener(T,"keydown",this.$readOnlyCallback,this),this.commands.on("exec",this.$readOnlyCallback),this.commands.on("commandUnavailable",this.$readOnlyCallback)):(_.removeListener(T,"keydown",this.$readOnlyCallback),this.commands.off("exec",this.$readOnlyCallback),this.commands.off("commandUnavailable",this.$readOnlyCallback),this.hoverTooltip&&(this.hoverTooltip.destroy(),this.hoverTooltip=null))}},initialValue:!1},copyWithEmptySelection:{set:function(C){this.textInput.setCopyWithEmptySelection(C)},initialValue:!1},cursorStyle:{set:function(C){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},enableAutoIndent:{initialValue:!0},autoScrollEditorIntoView:{set:function(C){this.setAutoScrollEditorIntoView(C)}},keyboardHandler:{set:function(C){this.setKeyboardHandler(C)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(C){this.session.setValue(C)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(C){this.setSession(C)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(C){this.renderer.$gutterLayer.setShowLineNumbers(C),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),C&&this.$relativeLineNumbers?$.attach(this):$.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(C){this.$showLineNumbers&&C?$.attach(this):$.detach(this)}},placeholder:{set:function(C){this.$updatePlaceholder||(this.$updatePlaceholder=function(){var b=this.session&&(this.renderer.$composition||this.session.getLength()>1||this.session.getLine(0).length>0);if(b&&this.renderer.placeholderNode)this.renderer.off("afterRender",this.$updatePlaceholder),d.removeCssClass(this.container,"ace_hasPlaceholder"),this.renderer.placeholderNode.remove(),this.renderer.placeholderNode=null;else if(!b&&!this.renderer.placeholderNode){this.renderer.on("afterRender",this.$updatePlaceholder),d.addCssClass(this.container,"ace_hasPlaceholder");var T=d.createElement("div");T.className="ace_placeholder",T.textContent=this.$placeholder||"",this.renderer.placeholderNode=T,this.renderer.content.appendChild(this.renderer.placeholderNode)}else!b&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"")}.bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},enableKeyboardAccessibility:{set:function(C){var b={name:"blurTextInput",description:"Set focus to the editor content div to allow tabbing through the page",bindKey:"Esc",exec:function(O){O.blur(),O.renderer.scroller.focus()},readOnly:!0},T=function(O){if(O.target==this.renderer.scroller&&O.keyCode===D.enter){O.preventDefault();var N=this.getCursorPosition().row;this.isRowVisible(N)||this.scrollToLine(N,!0,!0),this.focus()}},I;C?(this.renderer.enableKeyboardAccessibility=!0,this.renderer.keyboardFocusClassName="ace_keyboard-focus",this.textInput.getElement().setAttribute("tabindex",-1),this.textInput.setNumberOfExtraLines(p.isWin?3:0),this.renderer.scroller.setAttribute("tabindex",0),this.renderer.scroller.setAttribute("role","group"),this.renderer.scroller.setAttribute("aria-roledescription",S("editor.scroller.aria-roledescription","editor")),this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName),this.renderer.scroller.setAttribute("aria-label",S("editor.scroller.aria-label","Editor content, press Enter to start editing, press Escape to exit")),this.renderer.scroller.addEventListener("keyup",T.bind(this)),this.commands.addCommand(b),this.renderer.$gutter.setAttribute("tabindex",0),this.renderer.$gutter.setAttribute("aria-hidden",!1),this.renderer.$gutter.setAttribute("role","group"),this.renderer.$gutter.setAttribute("aria-roledescription",S("editor.gutter.aria-roledescription","editor gutter")),this.renderer.$gutter.setAttribute("aria-label",S("editor.gutter.aria-label","Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit")),this.renderer.$gutter.classList.add(this.renderer.keyboardFocusClassName),this.renderer.content.setAttribute("aria-hidden",!0),I||(I=new g(this)),I.addListener(),this.textInput.setAriaOptions({setLabel:!0})):(this.renderer.enableKeyboardAccessibility=!1,this.textInput.getElement().setAttribute("tabindex",0),this.textInput.setNumberOfExtraLines(0),this.renderer.scroller.setAttribute("tabindex",-1),this.renderer.scroller.removeAttribute("role"),this.renderer.scroller.removeAttribute("aria-roledescription"),this.renderer.scroller.classList.remove(this.renderer.keyboardFocusClassName),this.renderer.scroller.removeAttribute("aria-label"),this.renderer.scroller.removeEventListener("keyup",T.bind(this)),this.commands.removeCommand(b),this.renderer.content.removeAttribute("aria-hidden"),this.renderer.$gutter.setAttribute("tabindex",-1),this.renderer.$gutter.setAttribute("aria-hidden",!0),this.renderer.$gutter.removeAttribute("role"),this.renderer.$gutter.removeAttribute("aria-roledescription"),this.renderer.$gutter.removeAttribute("aria-label"),this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName),I&&I.removeListener())},initialValue:!1},textInputAriaLabel:{set:function(C){this.$textInputAriaLabel=C},initialValue:""},enableMobileMenu:{set:function(C){this.$enableMobileMenu=C},initialValue:!0},customScrollbar:"renderer",hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",highlightIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",useResizeObserver:"renderer",useSvgGutterIcons:"renderer",showFoldedAnnotations:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var $={getText:function(C,b){return(Math.abs(C.selection.lead.row-b)||b+1+(b<9?"·":""))+""},getWidth:function(C,b,T){return Math.max(b.toString().length,(T.lastRow+1).toString().length,2)*T.characterWidth},update:function(C,b){b.renderer.$loop.schedule(b.renderer.CHANGE_GUTTER)},attach:function(C){C.renderer.$gutterLayer.$renderer=this,C.on("changeSelection",this.update),this.update(null,C)},detach:function(C){C.renderer.$gutterLayer.$renderer==this&&(C.renderer.$gutterLayer.$renderer=null),C.off("changeSelection",this.update),this.update(null,C)}};l.Editor=A}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(i,l,v){var s=i("../lib/dom"),c=function(){function d(o,p){this.element=o,this.canvasHeight=p||5e5,this.element.style.height=this.canvasHeight*2+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0}return d.prototype.moveContainer=function(o){s.translate(this.element,0,-(o.firstRowScreen*o.lineHeight%this.canvasHeight)-o.offset*this.$offsetCoefficient)},d.prototype.pageChanged=function(o,p){return Math.floor(o.firstRowScreen*o.lineHeight/this.canvasHeight)!==Math.floor(p.firstRowScreen*p.lineHeight/this.canvasHeight)},d.prototype.computeLineTop=function(o,p,e){var t=p.firstRowScreen*p.lineHeight,r=Math.floor(t/this.canvasHeight),h=e.documentToScreenRow(o,0)*p.lineHeight;return h-r*this.canvasHeight},d.prototype.computeLineHeight=function(o,p,e){return p.lineHeight*e.getRowLineCount(o)},d.prototype.getLength=function(){return this.cells.length},d.prototype.get=function(o){return this.cells[o]},d.prototype.shift=function(){this.$cacheCell(this.cells.shift())},d.prototype.pop=function(){this.$cacheCell(this.cells.pop())},d.prototype.push=function(o){if(Array.isArray(o)){this.cells.push.apply(this.cells,o);for(var p=s.createFragment(this.element),e=0;e<o.length;e++)p.appendChild(o[e].element);this.element.appendChild(p)}else this.cells.push(o),this.element.appendChild(o.element)},d.prototype.unshift=function(o){if(Array.isArray(o)){this.cells.unshift.apply(this.cells,o);for(var p=s.createFragment(this.element),e=0;e<o.length;e++)p.appendChild(o[e].element);this.element.firstChild?this.element.insertBefore(p,this.element.firstChild):this.element.appendChild(p)}else this.cells.unshift(o),this.element.insertAdjacentElement("afterbegin",o.element)},d.prototype.last=function(){return this.cells.length?this.cells[this.cells.length-1]:null},d.prototype.$cacheCell=function(o){o&&(o.element.remove(),this.cellCache.push(o))},d.prototype.createCell=function(o,p,e,t){var r=this.cellCache.pop();if(!r){var h=s.createElement("div");t&&t(h),this.element.appendChild(h),r={element:h,text:"",row:o}}return r.row=o,r},d}();l.Lines=c}),ace.define("ace/layer/gutter",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/layer/lines","ace/config"],function(i,l,v){var s=i("../lib/dom"),c=i("../lib/oop"),d=i("../lib/lang"),o=i("../lib/event_emitter").EventEmitter,p=i("./lines").Lines,e=i("../config").nls,t=function(){function h(a){this.element=s.createElement("div"),this.element.className="ace_layer ace_gutter-layer",a.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$lines=new p(this.element),this.$lines.$offsetCoefficient=1}return h.prototype.setSession=function(a){this.session&&this.session.off("change",this.$updateAnnotations),this.session=a,a&&a.on("change",this.$updateAnnotations)},h.prototype.addGutterDecoration=function(a,u){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(a,u)},h.prototype.removeGutterDecoration=function(a,u){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(a,u)},h.prototype.setAnnotations=function(a){this.$annotations=[];for(var u=0;u<a.length;u++){var f=a[u],m=f.row,y=this.$annotations[m];y||(y=this.$annotations[m]={text:[],type:[],displayText:[]});var x=f.text,E=f.text,w=f.type;x=x?d.escapeHTML(x):f.html||"",E=E||f.html||"",y.text.indexOf(x)===-1&&(y.text.push(x),y.type.push(w),y.displayText.push(E));var g=f.className;g?y.className=g:w==="error"?y.className=" ace_error":w==="security"&&!/\bace_error\b/.test(y.className)?y.className=" ace_security":w==="warning"&&!/\bace_(error|security)\b/.test(y.className)?y.className=" ace_warning":w==="info"&&!y.className?y.className=" ace_info":w==="hint"&&!y.className&&(y.className=" ace_hint")}},h.prototype.$updateAnnotations=function(a){if(this.$annotations.length){var u=a.start.row,f=a.end.row-u;if(f!==0)if(a.action=="remove")this.$annotations.splice(u,f+1,null);else{var m=new Array(f+1);m.unshift(u,1),this.$annotations.splice.apply(this.$annotations,m)}}},h.prototype.update=function(a){this.config=a;var u=this.session,f=a.firstRow,m=Math.min(a.lastRow+a.gutterOffset,u.getLength()-1);this.oldLastRow=m,this.config=a,this.$lines.moveContainer(a),this.$updateCursorRow();for(var y=u.getNextFoldLine(f),x=y?y.start.row:1/0,E=null,w=-1,g=f;;){if(g>x&&(g=y.end.row+1,y=u.getNextFoldLine(g,y),x=y?y.start.row:1/0),g>m){for(;this.$lines.getLength()>w+1;)this.$lines.pop();break}E=this.$lines.get(++w),E?E.row=g:(E=this.$lines.createCell(g,a,this.session,r),this.$lines.push(E)),this.$renderCell(E,a,y,g),g++}this._signal("afterRender"),this.$updateGutterWidth(a)},h.prototype.$updateGutterWidth=function(a){var u=this.session,f=u.gutterRenderer||this.$renderer,m=u.$firstLineNumber,y=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||u.$useWrapMode)&&(y=u.getLength()+m-1);var x=f?f.getWidth(u,y,a):y.toString().length*a.characterWidth,E=this.$padding||this.$computePadding();x+=E.left+E.right,x!==this.gutterWidth&&!isNaN(x)&&(this.gutterWidth=x,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",x))},h.prototype.$updateCursorRow=function(){if(this.$highlightGutterLine){var a=this.session.selection.getCursor();this.$cursorRow!==a.row&&(this.$cursorRow=a.row)}},h.prototype.updateLineHighlight=function(){if(this.$highlightGutterLine){var a=this.session.selection.cursor.row;if(this.$cursorRow=a,!(this.$cursorCell&&this.$cursorCell.row==a)){this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var u=this.$lines.cells;this.$cursorCell=null;for(var f=0;f<u.length;f++){var m=u[f];if(m.row>=this.$cursorRow){if(m.row>this.$cursorRow){var y=this.session.getFoldLine(this.$cursorRow);if(f>0&&y&&y.start.row==u[f-1].row)m=u[f-1];else break}m.element.className="ace_gutter-active-line "+m.element.className,this.$cursorCell=m;break}}}}},h.prototype.scrollLines=function(a){var u=this.config;if(this.config=a,this.$updateCursorRow(),this.$lines.pageChanged(u,a))return this.update(a);this.$lines.moveContainer(a);var f=Math.min(a.lastRow+a.gutterOffset,this.session.getLength()-1),m=this.oldLastRow;if(this.oldLastRow=f,!u||m<a.firstRow)return this.update(a);if(f<u.firstRow)return this.update(a);if(u.firstRow<a.firstRow)for(var y=this.session.getFoldedRowCount(u.firstRow,a.firstRow-1);y>0;y--)this.$lines.shift();if(m>f)for(var y=this.session.getFoldedRowCount(f+1,m);y>0;y--)this.$lines.pop();a.firstRow<u.firstRow&&this.$lines.unshift(this.$renderLines(a,a.firstRow,u.firstRow-1)),f>m&&this.$lines.push(this.$renderLines(a,m+1,f)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(a)},h.prototype.$renderLines=function(a,u,f){for(var m=[],y=u,x=this.session.getNextFoldLine(y),E=x?x.start.row:1/0;y>E&&(y=x.end.row+1,x=this.session.getNextFoldLine(y,x),E=x?x.start.row:1/0),!(y>f);){var w=this.$lines.createCell(y,a,this.session,r);this.$renderCell(w,a,x,y),m.push(w),y++}return m},h.prototype.$renderCell=function(a,u,f,m){var y=a.element,x=this.session,E=y.childNodes[0],w=y.childNodes[1],g=y.childNodes[2],S=y.childNodes[3],k=g.firstChild,D=x.$firstLineNumber,_=x.$breakpoints,F=x.$decorations,A=x.gutterRenderer||this.$renderer,$=this.$showFoldWidgets&&x.foldWidgets,C=f?f.start.row:Number.MAX_VALUE,b=u.lineHeight+"px",T=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",I=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",O=(A?A.getText(x,m):m+D).toString();if(this.$highlightGutterLine&&(m==this.$cursorRow||f&&m<this.$cursorRow&&m>=C&&this.$cursorRow<=f.end.row)&&(T+="ace_gutter-active-line ",this.$cursorCell!=a&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=a)),_[m]&&(T+=_[m]),F[m]&&(T+=F[m]),this.$annotations[m]&&m!==C&&(T+=this.$annotations[m].className),$){var N=$[m];N==null&&(N=$[m]=x.getFoldWidget(m))}if(N){var P="ace_fold-widget ace_"+N,B=N=="start"&&m==C&&m<f.end.row;if(B){P+=" ace_closed";for(var V="",W=!1,z=m+1;z<=f.end.row;z++)if(this.$annotations[z]){if(this.$annotations[z].className===" ace_error"){W=!0,V=" ace_error_fold";break}this.$annotations[z].className===" ace_security"?(W=!0,V=" ace_security_fold"):this.$annotations[z].className===" ace_warning"&&V!==" ace_security_fold"&&(W=!0,V=" ace_warning_fold")}T+=V}else P+=" ace_open";w.className!=P&&(w.className=P),s.setStyle(w.style,"height",b),s.setStyle(w.style,"display","inline-block"),w.setAttribute("role","button"),w.setAttribute("tabindex","-1");var U=x.getFoldWidgetRange(m);U?w.setAttribute("aria-label",e("gutter.code-folding.range.aria-label","Toggle code folding, rows $0 through $1",[U.start.row+1,U.end.row+1])):f?w.setAttribute("aria-label",e("gutter.code-folding.closed.aria-label","Toggle code folding, rows $0 through $1",[f.start.row+1,f.end.row+1])):w.setAttribute("aria-label",e("gutter.code-folding.open.aria-label","Toggle code folding, row $0",[m+1])),B?(w.setAttribute("aria-expanded","false"),w.setAttribute("title",e("gutter.code-folding.closed.title","Unfold code"))):(w.setAttribute("aria-expanded","true"),w.setAttribute("title",e("gutter.code-folding.open.title","Fold code")))}else w&&(s.setStyle(w.style,"display","none"),w.setAttribute("tabindex","0"),w.removeAttribute("role"),w.removeAttribute("aria-label"));var G=this.session.$gutterCustomWidgets[m];if(G?this.$addCustomWidget(m,G,a):S&&this.$removeCustomWidget(m,a),W&&this.$showFoldedAnnotations){g.className="ace_gutter_annotation",k.className=I,k.className+=V,s.setStyle(k.style,"height",b),s.setStyle(g.style,"display","block"),s.setStyle(g.style,"height",b);var Y;switch(V){case" ace_error_fold":Y=e("gutter.annotation.aria-label.error","Error, read annotations row $0",[O]);break;case" ace_security_fold":Y=e("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[O]);break;case" ace_warning_fold":Y=e("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[O]);break}g.setAttribute("aria-label",Y),g.setAttribute("tabindex","-1"),g.setAttribute("role","button")}else if(this.$annotations[m]){g.className="ace_gutter_annotation",k.className=I,this.$useSvgGutterIcons?k.className+=this.$annotations[m].className:y.classList.add(this.$annotations[m].className.replace(" ","")),s.setStyle(k.style,"height",b),s.setStyle(g.style,"display","block"),s.setStyle(g.style,"height",b);var Y;switch(this.$annotations[m].className){case" ace_error":Y=e("gutter.annotation.aria-label.error","Error, read annotations row $0",[O]);break;case" ace_security":Y=e("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[O]);break;case" ace_warning":Y=e("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[O]);break;case" ace_info":Y=e("gutter.annotation.aria-label.info","Info, read annotations row $0",[O]);break;case" ace_hint":Y=e("gutter.annotation.aria-label.hint","Suggestion, read annotations row $0",[O]);break}g.setAttribute("aria-label",Y),g.setAttribute("tabindex","-1"),g.setAttribute("role","button")}else s.setStyle(g.style,"display","none"),g.removeAttribute("aria-label"),g.removeAttribute("role"),g.setAttribute("tabindex","0");return O!==E.data&&(E.data=O),y.className!=T&&(y.className=T),s.setStyle(a.element.style,"height",this.$lines.computeLineHeight(m,u,x)+"px"),s.setStyle(a.element.style,"top",this.$lines.computeLineTop(m,u,x)+"px"),a.text=O,g.style.display==="none"&&w.style.display==="none"&&!G?a.element.setAttribute("aria-hidden",!0):a.element.setAttribute("aria-hidden",!1),a},h.prototype.setHighlightGutterLine=function(a){this.$highlightGutterLine=a},h.prototype.setShowLineNumbers=function(a){this.$renderer=!a&&{getWidth:function(){return 0},getText:function(){return""}}},h.prototype.getShowLineNumbers=function(){return this.$showLineNumbers},h.prototype.setShowFoldWidgets=function(a){a?s.addCssClass(this.element,"ace_folding-enabled"):s.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=a,this.$padding=null},h.prototype.getShowFoldWidgets=function(){return this.$showFoldWidgets},h.prototype.$hideFoldWidget=function(a,u){var f=u||this.$getGutterCell(a);if(f&&f.element){var m=f.element.childNodes[1];m&&s.setStyle(m.style,"display","none")}},h.prototype.$showFoldWidget=function(a,u){var f=u||this.$getGutterCell(a);if(f&&f.element){var m=f.element.childNodes[1];m&&this.session.foldWidgets&&this.session.foldWidgets[f.row]&&s.setStyle(m.style,"display","inline-block")}},h.prototype.$getGutterCell=function(a){var u=this.$lines.cells,f=this.session.documentToScreenRow(a,0);return u[a-this.config.firstRowScreen-(a-f)]},h.prototype.$addCustomWidget=function(a,u,f){var m=u.className,y=u.label,x=u.title,E=u.callbacks;this.session.$gutterCustomWidgets[a]={className:m,label:y,title:x,callbacks:E},this.$hideFoldWidget(a,f);var w=f||this.$getGutterCell(a);if(w&&w.element){var g=w.element.querySelector(".ace_custom-widget");g&&g.remove(),g=s.createElement("span"),g.className="ace_custom-widget ".concat(m),g.setAttribute("tabindex","-1"),g.setAttribute("role","button"),g.setAttribute("aria-label",y),g.setAttribute("title",x),s.setStyle(g.style,"display","inline-block"),s.setStyle(g.style,"height","inherit"),E&&E.onClick&&g.addEventListener("click",function(S){E.onClick(S,a),S.stopPropagation()}),w.element.appendChild(g)}},h.prototype.$removeCustomWidget=function(a,u){delete this.session.$gutterCustomWidgets[a],this.$showFoldWidget(a,u);var f=u||this.$getGutterCell(a);if(f&&f.element){var m=f.element.querySelector(".ace_custom-widget");m&&f.element.removeChild(m)}},h.prototype.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var a=s.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=(parseInt(a.borderLeftWidth)||0)+(parseInt(a.paddingLeft)||0)+1,this.$padding.right=(parseInt(a.borderRightWidth)||0)+(parseInt(a.paddingRight)||0),this.$padding},h.prototype.getRegion=function(a){var u=this.$padding||this.$computePadding(),f=this.element.getBoundingClientRect();if(a.x<u.left+f.left)return"markers";if(this.$showFoldWidgets&&a.x>f.right-u.right)return"foldWidgets"},h}();t.prototype.$fixedWidth=!1,t.prototype.$highlightGutterLine=!0,t.prototype.$renderer="",t.prototype.$showLineNumbers=!0,t.prototype.$showFoldWidgets=!0,c.implement(t.prototype,o);function r(h){var a=document.createTextNode("");h.appendChild(a);var u=s.createElement("span");h.appendChild(u);var f=s.createElement("span");h.appendChild(f);var m=s.createElement("span");return f.appendChild(m),h}l.Gutter=t}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(i,l,v){var s=i("../range").Range,c=i("../lib/dom"),d=function(){function p(e){this.element=c.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)}return p.prototype.setPadding=function(e){this.$padding=e},p.prototype.setSession=function(e){this.session=e},p.prototype.setMarkers=function(e){this.markers=e},p.prototype.elt=function(e,t){var r=this.i!=-1&&this.element.childNodes[this.i];r?this.i++:(r=document.createElement("div"),this.element.appendChild(r),this.i=-1),r.style.cssText=t,r.className=e},p.prototype.update=function(e){if(e){this.config=e,this.i=0;var t;for(var r in this.markers){var h=this.markers[r];if(!h.range){h.update(t,this,this.session,e);continue}var a=h.range.clipRows(e.firstRow,e.lastRow);if(!a.isEmpty())if(a=a.toScreenRange(this.session),h.renderer){var u=this.$getTop(a.start.row,e),f=this.$padding+a.start.column*e.characterWidth;h.renderer(t,a,f,u,e)}else h.type=="fullLine"?this.drawFullLineMarker(t,a,h.clazz,e):h.type=="screenLine"?this.drawScreenLineMarker(t,a,h.clazz,e):a.isMultiLine()?h.type=="text"?this.drawTextMarker(t,a,h.clazz,e):this.drawMultiLineMarker(t,a,h.clazz,e):this.drawSingleLineMarker(t,a,h.clazz+" ace_start ace_br15",e)}if(this.i!=-1)for(;this.i<this.element.childElementCount;)this.element.removeChild(this.element.lastChild)}},p.prototype.$getTop=function(e,t){return(e-t.firstRowScreen)*t.lineHeight},p.prototype.drawTextMarker=function(e,t,r,h,a){for(var u=this.session,f=t.start.row,m=t.end.row,y=f,x=0,E=0,w=u.getScreenLastRowColumn(y),g=new s(y,t.start.column,y,E);y<=m;y++)g.start.row=g.end.row=y,g.start.column=y==f?t.start.column:u.getRowWrapIndent(y),g.end.column=w,x=E,E=w,w=y+1<m?u.getScreenLastRowColumn(y+1):y==m?0:t.end.column,this.drawSingleLineMarker(e,g,r+(y==f?" ace_start":"")+" ace_br"+o(y==f||y==f+1&&t.start.column,x<E,E>w,y==m),h,y==m?0:1,a)},p.prototype.drawMultiLineMarker=function(e,t,r,h,a){var u=this.$padding,f=h.lineHeight,m=this.$getTop(t.start.row,h),y=u+t.start.column*h.characterWidth;if(a=a||"",this.session.$bidiHandler.isBidiRow(t.start.row)){var x=t.clone();x.end.row=x.start.row,x.end.column=this.session.getLine(x.start.row).length,this.drawBidiSingleLineMarker(e,x,r+" ace_br1 ace_start",h,null,a)}else this.elt(r+" ace_br1 ace_start","height:"+f+"px;right:"+u+"px;top:"+m+"px;left:"+y+"px;"+(a||""));if(this.session.$bidiHandler.isBidiRow(t.end.row)){var x=t.clone();x.start.row=x.end.row,x.start.column=0,this.drawBidiSingleLineMarker(e,x,r+" ace_br12",h,null,a)}else{m=this.$getTop(t.end.row,h);var E=t.end.column*h.characterWidth;this.elt(r+" ace_br12","height:"+f+"px;width:"+E+"px;top:"+m+"px;left:"+u+"px;"+(a||""))}if(f=(t.end.row-t.start.row-1)*h.lineHeight,!(f<=0)){m=this.$getTop(t.start.row+1,h);var w=(t.start.column?1:0)|(t.end.column?0:8);this.elt(r+(w?" ace_br"+w:""),"height:"+f+"px;right:"+u+"px;top:"+m+"px;left:"+u+"px;"+(a||""))}},p.prototype.drawSingleLineMarker=function(e,t,r,h,a,u){if(this.session.$bidiHandler.isBidiRow(t.start.row))return this.drawBidiSingleLineMarker(e,t,r,h,a,u);var f=h.lineHeight,m=(t.end.column+(a||0)-t.start.column)*h.characterWidth,y=this.$getTop(t.start.row,h),x=this.$padding+t.start.column*h.characterWidth;this.elt(r,"height:"+f+"px;width:"+m+"px;top:"+y+"px;left:"+x+"px;"+(u||""))},p.prototype.drawBidiSingleLineMarker=function(e,t,r,h,a,u){var f=h.lineHeight,m=this.$getTop(t.start.row,h),y=this.$padding,x=this.session.$bidiHandler.getSelections(t.start.column,t.end.column);x.forEach(function(E){this.elt(r,"height:"+f+"px;width:"+(E.width+(a||0))+"px;top:"+m+"px;left:"+(y+E.left)+"px;"+(u||""))},this)},p.prototype.drawFullLineMarker=function(e,t,r,h,a){var u=this.$getTop(t.start.row,h),f=h.lineHeight;t.start.row!=t.end.row&&(f+=this.$getTop(t.end.row,h)-u),this.elt(r,"height:"+f+"px;top:"+u+"px;left:0;right:0;"+(a||""))},p.prototype.drawScreenLineMarker=function(e,t,r,h,a){var u=this.$getTop(t.start.row,h),f=h.lineHeight;this.elt(r,"height:"+f+"px;top:"+u+"px;left:0;right:0;"+(a||""))},p}();d.prototype.$padding=0;function o(p,e,t,r){return(p?1:0)|(e?2:0)|(t?4:0)|(r?8:0)}l.Marker=d}),ace.define("ace/layer/text_util",["require","exports","module"],function(i,l,v){var s=new Set(["text","rparen","lparen"]);l.isTextToken=function(c){return s.has(c)}}),ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter","ace/config","ace/layer/text_util"],function(i,l,v){var s=i("../lib/oop"),c=i("../lib/dom"),d=i("../lib/lang"),o=i("./lines").Lines,p=i("../lib/event_emitter").EventEmitter,e=i("../config").nls,t=i("./text_util").isTextToken,r=function(){function h(a){this.dom=c,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",a.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new o(this.element)}return h.prototype.$updateEolChar=function(){var a=this.session.doc,u=a.getNewLineCharacter()==`
|
|
230
|
+
`&&a.getNewLineMode()!="windows",f=u?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=f)return this.EOL_CHAR=f,!0},h.prototype.setPadding=function(a){this.$padding=a,this.element.style.margin="0 "+a+"px"},h.prototype.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},h.prototype.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},h.prototype.$setFontMetrics=function(a){this.$fontMetrics=a,this.$fontMetrics.on("changeCharacterSize",function(u){this._signal("changeCharacterSize",u)}.bind(this)),this.$pollSizeChanges()},h.prototype.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},h.prototype.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},h.prototype.setSession=function(a){this.session=a,a&&this.$computeTabString()},h.prototype.setShowInvisibles=function(a){return this.showInvisibles==a?!1:(this.showInvisibles=a,typeof a=="string"?(this.showSpaces=/tab/i.test(a),this.showTabs=/space/i.test(a),this.showEOL=/eol/i.test(a)):this.showSpaces=this.showTabs=this.showEOL=a,this.$computeTabString(),!0)},h.prototype.setDisplayIndentGuides=function(a){return this.displayIndentGuides==a?!1:(this.displayIndentGuides=a,this.$computeTabString(),!0)},h.prototype.setHighlightIndentGuides=function(a){return this.$highlightIndentGuides===a?!1:(this.$highlightIndentGuides=a,a)},h.prototype.$computeTabString=function(){var a=this.session.getTabSize();this.tabSize=a;for(var u=this.$tabStrings=[0],f=1;f<a+1;f++)if(this.showTabs){var m=this.dom.createElement("span");m.className="ace_invisible ace_invisible_tab",m.textContent=d.stringRepeat(this.TAB_CHAR,f),u.push(m)}else u.push(this.dom.createTextNode(d.stringRepeat(" ",f),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var y="ace_indent-guide",x=this.showSpaces?" ace_invisible ace_invisible_space":"",E=this.showSpaces?d.stringRepeat(this.SPACE_CHAR,this.tabSize):d.stringRepeat(" ",this.tabSize),w=this.showTabs?" ace_invisible ace_invisible_tab":"",g=this.showTabs?d.stringRepeat(this.TAB_CHAR,this.tabSize):E,m=this.dom.createElement("span");m.className=y+x,m.textContent=E,this.$tabStrings[" "]=m;var m=this.dom.createElement("span");m.className=y+w,m.textContent=g,this.$tabStrings[" "]=m}},h.prototype.updateLines=function(a,u,f){if(this.config.lastRow!=a.lastRow||this.config.firstRow!=a.firstRow)return this.update(a);this.config=a;for(var m=Math.max(u,a.firstRow),y=Math.min(f,a.lastRow),x=this.element.childNodes,E=0,g=a.firstRow;g<m;g++){var S=this.session.getFoldLine(g);if(S)if(S.containsRow(m)){m=S.start.row;break}else g=S.end.row;E++}for(var w=!1,g=m,S=this.session.getNextFoldLine(g),k=S?S.start.row:1/0;g>k&&(g=S.end.row+1,S=this.session.getNextFoldLine(g,S),k=S?S.start.row:1/0),!(g>y);){var D=x[E++];if(D){this.dom.removeChildren(D),this.$renderLine(D,g,g==k?S:!1),w&&(D.style.top=this.$lines.computeLineTop(g,a,this.session)+"px");var _=a.lineHeight*this.session.getRowLength(g)+"px";D.style.height!=_&&(w=!0,D.style.height=_)}g++}if(w)for(;E<this.$lines.cells.length;){var F=this.$lines.cells[E++];F.element.style.top=this.$lines.computeLineTop(F.row,a,this.session)+"px"}},h.prototype.scrollLines=function(a){var u=this.config;if(this.config=a,this.$lines.pageChanged(u,a))return this.update(a);this.$lines.moveContainer(a);var f=a.lastRow,m=u?u.lastRow:-1;if(!u||m<a.firstRow)return this.update(a);if(f<u.firstRow)return this.update(a);if(!u||u.lastRow<a.firstRow)return this.update(a);if(a.lastRow<u.firstRow)return this.update(a);if(u.firstRow<a.firstRow)for(var y=this.session.getFoldedRowCount(u.firstRow,a.firstRow-1);y>0;y--)this.$lines.shift();if(u.lastRow>a.lastRow)for(var y=this.session.getFoldedRowCount(a.lastRow+1,u.lastRow);y>0;y--)this.$lines.pop();a.firstRow<u.firstRow&&this.$lines.unshift(this.$renderLinesFragment(a,a.firstRow,u.firstRow-1)),a.lastRow>u.lastRow&&this.$lines.push(this.$renderLinesFragment(a,u.lastRow+1,a.lastRow)),this.$highlightIndentGuide()},h.prototype.$renderLinesFragment=function(a,u,f){for(var m=[],y=u,x=this.session.getNextFoldLine(y),E=x?x.start.row:1/0;y>E&&(y=x.end.row+1,x=this.session.getNextFoldLine(y,x),E=x?x.start.row:1/0),!(y>f);){var w=this.$lines.createCell(y,a,this.session),g=w.element;this.dom.removeChildren(g),c.setStyle(g.style,"height",this.$lines.computeLineHeight(y,a,this.session)+"px"),c.setStyle(g.style,"top",this.$lines.computeLineTop(y,a,this.session)+"px"),this.$renderLine(g,y,y==E?x:!1),this.$useLineGroups()?g.className="ace_line_group":g.className="ace_line",m.push(w),y++}return m},h.prototype.update=function(a){this.$lines.moveContainer(a),this.config=a;for(var u=a.firstRow,f=a.lastRow,m=this.$lines;m.getLength();)m.pop();m.push(this.$renderLinesFragment(a,u,f))},h.prototype.$renderToken=function(a,u,f,m){for(var y=this,x=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC\u2066\u2067\u2068\u202A\u202B\u202D\u202E\u202C\u2069\u2060\u2061\u2062\u2063\u2064\u206A\u206B\u206B\u206C\u206D\u206E\u206F]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,E=this.dom.createFragment(this.element),w,g=0;w=x.exec(m);){var S=w[1],k=w[2],D=w[3],_=w[4],F=w[5];if(!(!y.showSpaces&&k)){var A=g!=w.index?m.slice(g,w.index):"";if(g=w.index+w[0].length,A&&E.appendChild(this.dom.createTextNode(A,this.element)),S){var $=y.session.getScreenTabSize(u+w.index),C=y.$tabStrings[$].cloneNode(!0);C.charCount=1,E.appendChild(C),u+=$-1}else if(k)if(y.showSpaces){var b=this.dom.createElement("span");b.className="ace_invisible ace_invisible_space",b.textContent=d.stringRepeat(y.SPACE_CHAR,k.length),E.appendChild(b)}else E.appendChild(this.dom.createTextNode(k,this.element));else if(D){var b=this.dom.createElement("span");b.className="ace_invisible ace_invisible_space ace_invalid",b.textContent=d.stringRepeat(y.SPACE_CHAR,D.length),E.appendChild(b)}else if(_){u+=1;var b=this.dom.createElement("span");b.style.width=y.config.characterWidth*2+"px",b.className=y.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",b.textContent=y.showSpaces?y.SPACE_CHAR:_,E.appendChild(b)}else if(F){u+=1;var b=this.dom.createElement("span");b.style.width=y.config.characterWidth*2+"px",b.className="ace_cjk",b.textContent=F,E.appendChild(b)}}}if(E.appendChild(this.dom.createTextNode(g?m.slice(g):m,this.element)),t(f.type))a.appendChild(E);else{var T="ace_"+f.type.replace(/\./g," ace_"),b=this.dom.createElement("span");f.type=="fold"&&(b.style.width=f.value.length*this.config.characterWidth+"px",b.setAttribute("title",e("inline-fold.closed.title","Unfold code"))),b.className=T,b.appendChild(E),a.appendChild(b)}return u+m.length},h.prototype.renderIndentGuide=function(a,u,f){var m=u.search(this.$indentGuideRe);if(m<=0||m>=f)return u;if(u[0]==" "){m-=m%this.tabSize;for(var y=m/this.tabSize,x=0;x<y;x++)a.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),u.substr(m)}else if(u[0]==" "){for(var x=0;x<m;x++)a.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),u.substr(m)}return this.$highlightIndentGuide(),u},h.prototype.$highlightIndentGuide=function(){if(!(!this.$highlightIndentGuides||!this.displayIndentGuides)){this.$highlightIndentGuideMarker={indentLevel:void 0,start:void 0,end:void 0,dir:void 0};var a=this.session.doc.$lines;if(a){var u=this.session.selection.getCursor(),f=/^\s*/.exec(this.session.doc.getLine(u.row))[0].length,m=Math.floor(f/this.tabSize);this.$highlightIndentGuideMarker={indentLevel:m,start:u.row};var y=this.session.$bracketHighlight;if(y){for(var x=this.session.$bracketHighlight.ranges,E=0;E<x.length;E++)if(u.row!==x[E].start.row){this.$highlightIndentGuideMarker.end=x[E].start.row+1,u.row>x[E].start.row?this.$highlightIndentGuideMarker.dir=-1:this.$highlightIndentGuideMarker.dir=1;break}}if(!this.$highlightIndentGuideMarker.end&&a[u.row]!==""&&u.column===a[u.row].length){this.$highlightIndentGuideMarker.dir=1;for(var E=u.row+1;E<a.length;E++){var w=a[E],g=/^\s*/.exec(w)[0].length;if(w!==""&&(this.$highlightIndentGuideMarker.end=E,g<=f))break}}this.$renderHighlightIndentGuide()}}},h.prototype.$clearActiveIndentGuide=function(){for(var a=this.element.querySelectorAll(".ace_indent-guide-active"),u=0;u<a.length;u++)a[u].classList.remove("ace_indent-guide-active")},h.prototype.$setIndentGuideActive=function(a,u){var f=this.session.doc.getLine(a.row);if(f!==""){var m=a.element;if(a.element.classList&&a.element.classList.contains("ace_line_group"))if(a.element.childNodes.length>0)m=a.element.childNodes[0];else return;var y=m.childNodes;if(y){var x=y[u-1];x&&x.classList&&x.classList.contains("ace_indent-guide")&&x.classList.add("ace_indent-guide-active")}}},h.prototype.$renderHighlightIndentGuide=function(){if(this.$lines){var a=this.$lines.cells;this.$clearActiveIndentGuide();var u=this.$highlightIndentGuideMarker.indentLevel;if(u!==0)if(this.$highlightIndentGuideMarker.dir===1)for(var f=0;f<a.length;f++){var m=a[f];if(this.$highlightIndentGuideMarker.end&&m.row>=this.$highlightIndentGuideMarker.start+1){if(m.row>=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(m,u)}}else for(var f=a.length-1;f>=0;f--){var m=a[f];if(this.$highlightIndentGuideMarker.end&&m.row<this.$highlightIndentGuideMarker.start){if(m.row<this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(m,u)}}}},h.prototype.$createLineElement=function(a){var u=this.dom.createElement("div");return u.className="ace_line",u.style.height=this.config.lineHeight+"px",u},h.prototype.$renderWrappedLine=function(a,u,f){var m=0,y=0,x=f[0],E=0,w=this.$createLineElement();a.appendChild(w);for(var g=0;g<u.length;g++){var S=u[g],k=S.value;if(g==0&&this.displayIndentGuides){if(m=k.length,k=this.renderIndentGuide(w,k,x),!k)continue;m-=k.length}if(m+k.length<x)E=this.$renderToken(w,E,S,k),m+=k.length;else{for(;m+k.length>=x;){E=this.$renderToken(w,E,S,k.substring(0,x-m)),k=k.substring(x-m),m=x,w=this.$createLineElement(),a.appendChild(w);var D=this.dom.createTextNode(d.stringRepeat(" ",f.indent),this.element);D.charCount=0,w.appendChild(D),y++,E=0,x=f[y]||Number.MAX_VALUE}k.length!=0&&(m+=k.length,E=this.$renderToken(w,E,S,k))}}f[f.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(w,E,null,"",!0)},h.prototype.$renderSimpleLine=function(a,u){for(var f=0,m=0;m<u.length;m++){var y=u[m],x=y.value;if(!(m==0&&this.displayIndentGuides&&(x=this.renderIndentGuide(a,x),!x))){if(f+x.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(a,f,y,x);f=this.$renderToken(a,f,y,x)}}},h.prototype.$renderOverflowMessage=function(a,u,f,m,y){f&&this.$renderToken(a,u,f,m.slice(0,this.MAX_LINE_LENGTH-u));var x=this.dom.createElement("span");x.className="ace_inline_button ace_keyword ace_toggle_wrap",x.textContent=y?"<hide>":"<click to see more...>",a.appendChild(x)},h.prototype.$renderLine=function(a,u,f){if(!f&&f!=!1&&(f=this.session.getFoldLine(u)),f)var m=this.$getFoldLineTokens(u,f);else var m=this.session.getTokens(u);var y=a;if(m.length){var x=this.session.getRowSplitData(u);if(x&&x.length){this.$renderWrappedLine(a,m,x);var y=a.lastChild}else{var y=a;this.$useLineGroups()&&(y=this.$createLineElement(),a.appendChild(y)),this.$renderSimpleLine(y,m)}}else this.$useLineGroups()&&(y=this.$createLineElement(),a.appendChild(y));if(this.showEOL&&y){f&&(u=f.end.row);var E=this.dom.createElement("span");E.className="ace_invisible ace_invisible_eol",E.textContent=u==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,y.appendChild(E)}},h.prototype.$getFoldLineTokens=function(a,u){var f=this.session,m=[];function y(E,w,g){for(var S=0,k=0;k+E[S].value.length<w;)if(k+=E[S].value.length,S++,S==E.length)return;if(k!=w){var D=E[S].value.substring(w-k);D.length>g-w&&(D=D.substring(0,g-w)),m.push({type:E[S].type,value:D}),k=w+D.length,S+=1}for(;k<g&&S<E.length;){var D=E[S].value;D.length+k>g?m.push({type:E[S].type,value:D.substring(0,g-k)}):m.push(E[S]),k+=D.length,S+=1}}var x=f.getTokens(a);return u.walk(function(E,w,g,S,k){E!=null?m.push({type:"fold",value:E}):(k&&(x=f.getTokens(w)),x.length&&y(x,S,g))},u.end.row,this.session.getLine(u.end.row).length),m},h.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},h}();r.prototype.EOF_CHAR="¶",r.prototype.EOL_CHAR_LF="¬",r.prototype.EOL_CHAR_CRLF="¤",r.prototype.EOL_CHAR=r.prototype.EOL_CHAR_LF,r.prototype.TAB_CHAR="—",r.prototype.SPACE_CHAR="·",r.prototype.$padding=0,r.prototype.MAX_LINE_LENGTH=1e4,r.prototype.showInvisibles=!1,r.prototype.showSpaces=!1,r.prototype.showTabs=!1,r.prototype.showEOL=!1,r.prototype.displayIndentGuides=!0,r.prototype.$highlightIndentGuides=!0,r.prototype.$tabStrings=[],r.prototype.destroy={},r.prototype.onChangeTabSize=r.prototype.$computeTabString,s.implement(r.prototype,p),l.Text=r}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(i,l,v){var s=i("../lib/dom"),c=function(){function d(o){this.element=s.createElement("div"),this.element.className="ace_layer ace_cursor-layer",o.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),s.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return d.prototype.$updateOpacity=function(o){for(var p=this.cursors,e=p.length;e--;)s.setStyle(p[e].style,"opacity",o?"":"0")},d.prototype.$startCssAnimation=function(){for(var o=this.cursors,p=o.length;p--;)o[p].style.animationDuration=this.blinkInterval+"ms";this.$isAnimating=!0,setTimeout(function(){this.$isAnimating&&s.addCssClass(this.element,"ace_animate-blinking")}.bind(this))},d.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,s.removeCssClass(this.element,"ace_animate-blinking")},d.prototype.setPadding=function(o){this.$padding=o},d.prototype.setSession=function(o){this.session=o},d.prototype.setBlinking=function(o){o!=this.isBlinking&&(this.isBlinking=o,this.restartTimer())},d.prototype.setBlinkInterval=function(o){o!=this.blinkInterval&&(this.blinkInterval=o,this.restartTimer())},d.prototype.setSmoothBlinking=function(o){o!=this.smoothBlinking&&(this.smoothBlinking=o,s.setCssClass(this.element,"ace_smooth-blinking",o),this.$updateCursors(!0),this.restartTimer())},d.prototype.addCursor=function(){var o=s.createElement("div");return o.className="ace_cursor",this.element.appendChild(o),this.cursors.push(o),o},d.prototype.removeCursor=function(){if(this.cursors.length>1){var o=this.cursors.pop();return o.parentNode.removeChild(o),o}},d.prototype.hideCursor=function(){this.isVisible=!1,s.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},d.prototype.showCursor=function(){this.isVisible=!0,s.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},d.prototype.restartTimer=function(){var o=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&(this.$isSmoothBlinking=!1,s.removeCssClass(this.element,"ace_smooth-blinking")),o(!0),!this.isBlinking||!this.blinkInterval||!this.isVisible){this.$stopCssAnimation();return}if(this.smoothBlinking&&(this.$isSmoothBlinking=!0,setTimeout(function(){this.$isSmoothBlinking&&s.addCssClass(this.element,"ace_smooth-blinking")}.bind(this))),s.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var p=function(){this.timeoutId=setTimeout(function(){o(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){o(!0),p()},this.blinkInterval),p()}},d.prototype.getPixelPosition=function(o,p){if(!this.config||!this.session)return{left:0,top:0};o||(o=this.session.selection.getCursor());var e=this.session.documentToScreenPosition(o),t=this.$padding+(this.session.$bidiHandler.isBidiRow(e.row,o.row)?this.session.$bidiHandler.getPosLeft(e.column):e.column*this.config.characterWidth),r=(e.row-(p?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:t,top:r}},d.prototype.isCursorInView=function(o,p){return o.top>=0&&o.top<p.maxHeight},d.prototype.update=function(o){this.config=o;var p=this.session.$selectionMarkers,e=0,t=0;(p===void 0||p.length===0)&&(p=[{cursor:null}]);for(var e=0,r=p.length;e<r;e++){var h=this.getPixelPosition(p[e].cursor,!0);if(!((h.top>o.height+o.offset||h.top<0)&&e>1)){var a=this.cursors[t++]||this.addCursor(),u=a.style;this.drawCursor?this.drawCursor(a,h,o,p[e],this.session):this.isCursorInView(h,o)?(s.setStyle(u,"display","block"),s.translate(a,h.left,h.top),s.setStyle(u,"width",Math.round(o.characterWidth)+"px"),s.setStyle(u,"height",o.lineHeight+"px")):s.setStyle(u,"display","none")}}for(;this.cursors.length>t;)this.removeCursor();var f=this.session.getOverwrite();this.$setOverwrite(f),this.$pixelPos=h,this.restartTimer()},d.prototype.$setOverwrite=function(o){o!=this.overwrite&&(this.overwrite=o,o?s.addCssClass(this.element,"ace_overwrite-cursors"):s.removeCssClass(this.element,"ace_overwrite-cursors"))},d.prototype.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)},d}();c.prototype.$padding=0,c.prototype.drawCursor=null,l.Cursor=c}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(i,l,v){var s=this&&this.__extends||function(){var a=function(u,f){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,y){m.__proto__=y}||function(m,y){for(var x in y)Object.prototype.hasOwnProperty.call(y,x)&&(m[x]=y[x])},a(u,f)};return function(u,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");a(u,f);function m(){this.constructor=u}u.prototype=f===null?Object.create(f):(m.prototype=f.prototype,new m)}}(),c=i("./lib/oop"),d=i("./lib/dom"),o=i("./lib/event"),p=i("./lib/event_emitter").EventEmitter,e=32768,t=function(){function a(u,f){this.element=d.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+f,this.inner=d.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent=" ",this.element.appendChild(this.inner),u.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,o.addListener(this.element,"scroll",this.onScroll.bind(this)),o.addListener(this.element,"mousedown",o.preventDefault)}return a.prototype.setVisible=function(u){this.element.style.display=u?"":"none",this.isVisible=u,this.coeff=1},a}();c.implement(t.prototype,p);var r=function(a){s(u,a);function u(f,m){var y=a.call(this,f,"-v")||this;return y.scrollTop=0,y.scrollHeight=0,m.$scrollbarWidth=y.width=d.scrollbarWidth(f.ownerDocument),y.inner.style.width=y.element.style.width=(y.width||15)+5+"px",y.$minWidth=0,y}return u.prototype.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,this.coeff!=1){var f=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-f)/(this.coeff-f)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},u.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},u.prototype.setHeight=function(f){this.element.style.height=f+"px"},u.prototype.setScrollHeight=function(f){this.scrollHeight=f,f>e?(this.coeff=e/f,f=e):this.coeff!=1&&(this.coeff=1),this.inner.style.height=f+"px"},u.prototype.setScrollTop=function(f){this.scrollTop!=f&&(this.skipEvent=!0,this.scrollTop=f,this.element.scrollTop=f*this.coeff)},u}(t);r.prototype.setInnerHeight=r.prototype.setScrollHeight;var h=function(a){s(u,a);function u(f,m){var y=a.call(this,f,"-h")||this;return y.scrollLeft=0,y.height=m.$scrollbarWidth,y.inner.style.height=y.element.style.height=(y.height||15)+5+"px",y}return u.prototype.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},u.prototype.getHeight=function(){return this.isVisible?this.height:0},u.prototype.setWidth=function(f){this.element.style.width=f+"px"},u.prototype.setInnerWidth=function(f){this.inner.style.width=f+"px"},u.prototype.setScrollWidth=function(f){this.inner.style.width=f+"px"},u.prototype.setScrollLeft=function(f){this.scrollLeft!=f&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=f)},u}(t);l.ScrollBar=r,l.ScrollBarV=r,l.ScrollBarH=h,l.VScrollBar=r,l.HScrollBar=h}),ace.define("ace/scrollbar_custom",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(i,l,v){var s=this&&this.__extends||function(){var h=function(a,u){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(f,m){f.__proto__=m}||function(f,m){for(var y in m)Object.prototype.hasOwnProperty.call(m,y)&&(f[y]=m[y])},h(a,u)};return function(a,u){if(typeof u!="function"&&u!==null)throw new TypeError("Class extends value "+String(u)+" is not a constructor or null");h(a,u);function f(){this.constructor=a}a.prototype=u===null?Object.create(u):(f.prototype=u.prototype,new f)}}(),c=i("./lib/oop"),d=i("./lib/dom"),o=i("./lib/event"),p=i("./lib/event_emitter").EventEmitter;d.importCssString(`.ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{
|
|
231
231
|
position: absolute;
|
|
232
232
|
background: rgba(128, 128, 128, 0.6);
|
|
233
233
|
-moz-box-sizing: border-box;
|
|
@@ -265,7 +265,7 @@ import{C as qe,R as M}from"./ConfigCustomJavascriptSet__loadShare__react__loadSh
|
|
|
265
265
|
.ace_editor>.ace_sb_grabbed {
|
|
266
266
|
z-index: 8;
|
|
267
267
|
background: #000;
|
|
268
|
-
}`,"ace_scrollbar.css",!1);var e=function(){function h(a,u){this.element=d.createElement("div"),this.element.className="ace_sb"+u,this.inner=d.createElement("div"),this.inner.className="",this.element.appendChild(this.inner),this.VScrollWidth=12,this.HScrollHeight=12,a.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,o.addMultiMouseDownListener(this.element,[500,300,300],this,"onMouseDown")}return h.prototype.setVisible=function(a){this.element.style.display=a?"":"none",this.isVisible=a,this.coeff=1},h}();c.implement(e.prototype,p);var t=function(h){s(a,h);function a(u,f){var m=h.call(this,u,"-v")||this;return m.scrollTop=0,m.scrollHeight=0,m.parent=u,m.width=m.VScrollWidth,m.renderer=f,m.inner.style.width=m.element.style.width=(m.width||15)+"px",m.$minWidth=0,m}return a.prototype.onMouseDown=function(u,f){if(u==="mousedown"&&!(o.getButton(f)!==0||f.detail===2)){if(f.target===this.inner){var m=this,y=f.clientY,x=function(_){y=_.clientY},E=function(){clearInterval(k)},
|
|
268
|
+
}`,"ace_scrollbar.css",!1);var e=function(){function h(a,u){this.element=d.createElement("div"),this.element.className="ace_sb"+u,this.inner=d.createElement("div"),this.inner.className="",this.element.appendChild(this.inner),this.VScrollWidth=12,this.HScrollHeight=12,a.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,o.addMultiMouseDownListener(this.element,[500,300,300],this,"onMouseDown")}return h.prototype.setVisible=function(a){this.element.style.display=a?"":"none",this.isVisible=a,this.coeff=1},h}();c.implement(e.prototype,p);var t=function(h){s(a,h);function a(u,f){var m=h.call(this,u,"-v")||this;return m.scrollTop=0,m.scrollHeight=0,m.parent=u,m.width=m.VScrollWidth,m.renderer=f,m.inner.style.width=m.element.style.width=(m.width||15)+"px",m.$minWidth=0,m}return a.prototype.onMouseDown=function(u,f){if(u==="mousedown"&&!(o.getButton(f)!==0||f.detail===2)){if(f.target===this.inner){var m=this,y=f.clientY,x=function(_){y=_.clientY},E=function(){clearInterval(k)},w=f.clientY,g=this.thumbTop,S=function(){if(y!==void 0){var _=m.scrollTopFromThumbTop(g+y-w);_!==m.scrollTop&&m._emit("scroll",{data:_})}};o.capture(this.inner,x,E);var k=setInterval(S,20);return o.preventDefault(f)}var D=f.clientY-this.element.getBoundingClientRect().top-this.thumbHeight/2;return this._emit("scroll",{data:this.scrollTopFromThumbTop(D)}),o.preventDefault(f)}},a.prototype.getHeight=function(){return this.height},a.prototype.scrollTopFromThumbTop=function(u){var f=u*(this.pageHeight-this.viewHeight)/(this.slideHeight-this.thumbHeight);return f=f>>0,f<0?f=0:f>this.pageHeight-this.viewHeight&&(f=this.pageHeight-this.viewHeight),f},a.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},a.prototype.setHeight=function(u){this.height=Math.max(0,u),this.slideHeight=this.height,this.viewHeight=this.height,this.setScrollHeight(this.pageHeight,!0)},a.prototype.setScrollHeight=function(u,f){this.pageHeight===u&&!f||(this.pageHeight=u,this.thumbHeight=this.slideHeight*this.viewHeight/this.pageHeight,this.thumbHeight>this.slideHeight&&(this.thumbHeight=this.slideHeight),this.thumbHeight<15&&(this.thumbHeight=15),this.inner.style.height=this.thumbHeight+"px",this.scrollTop>this.pageHeight-this.viewHeight&&(this.scrollTop=this.pageHeight-this.viewHeight,this.scrollTop<0&&(this.scrollTop=0),this._emit("scroll",{data:this.scrollTop})))},a.prototype.setScrollTop=function(u){this.scrollTop=u,u<0&&(u=0),this.thumbTop=u*(this.slideHeight-this.thumbHeight)/(this.pageHeight-this.viewHeight),this.inner.style.top=this.thumbTop+"px"},a}(e);t.prototype.setInnerHeight=t.prototype.setScrollHeight;var r=function(h){s(a,h);function a(u,f){var m=h.call(this,u,"-h")||this;return m.scrollLeft=0,m.scrollWidth=0,m.height=m.HScrollHeight,m.inner.style.height=m.element.style.height=(m.height||12)+"px",m.renderer=f,m}return a.prototype.onMouseDown=function(u,f){if(u==="mousedown"&&!(o.getButton(f)!==0||f.detail===2)){if(f.target===this.inner){var m=this,y=f.clientX,x=function(_){y=_.clientX},E=function(){clearInterval(k)},w=f.clientX,g=this.thumbLeft,S=function(){if(y!==void 0){var _=m.scrollLeftFromThumbLeft(g+y-w);_!==m.scrollLeft&&m._emit("scroll",{data:_})}};o.capture(this.inner,x,E);var k=setInterval(S,20);return o.preventDefault(f)}var D=f.clientX-this.element.getBoundingClientRect().left-this.thumbWidth/2;return this._emit("scroll",{data:this.scrollLeftFromThumbLeft(D)}),o.preventDefault(f)}},a.prototype.getHeight=function(){return this.isVisible?this.height:0},a.prototype.scrollLeftFromThumbLeft=function(u){var f=u*(this.pageWidth-this.viewWidth)/(this.slideWidth-this.thumbWidth);return f=f>>0,f<0?f=0:f>this.pageWidth-this.viewWidth&&(f=this.pageWidth-this.viewWidth),f},a.prototype.setWidth=function(u){this.width=Math.max(0,u),this.element.style.width=this.width+"px",this.slideWidth=this.width,this.viewWidth=this.width,this.setScrollWidth(this.pageWidth,!0)},a.prototype.setScrollWidth=function(u,f){this.pageWidth===u&&!f||(this.pageWidth=u,this.thumbWidth=this.slideWidth*this.viewWidth/this.pageWidth,this.thumbWidth>this.slideWidth&&(this.thumbWidth=this.slideWidth),this.thumbWidth<15&&(this.thumbWidth=15),this.inner.style.width=this.thumbWidth+"px",this.scrollLeft>this.pageWidth-this.viewWidth&&(this.scrollLeft=this.pageWidth-this.viewWidth,this.scrollLeft<0&&(this.scrollLeft=0),this._emit("scroll",{data:this.scrollLeft})))},a.prototype.setScrollLeft=function(u){this.scrollLeft=u,u<0&&(u=0),this.thumbLeft=u*(this.slideWidth-this.thumbWidth)/(this.pageWidth-this.viewWidth),this.inner.style.left=this.thumbLeft+"px"},a}(e);r.prototype.setInnerWidth=r.prototype.setScrollWidth,l.ScrollBar=t,l.ScrollBarV=t,l.ScrollBarH=r,l.VScrollBar=t,l.HScrollBar=r}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(i,l,v){var s=i("./lib/event"),c=function(){function d(o,p){this.onRender=o,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=p||window;var e=this;this._flush=function(t){e.pending=!1;var r=e.changes;if(r&&(s.blockIdle(100),e.changes=0,e.onRender(r)),e.changes){if(e.$recursionLimit--<0)return;e.schedule()}else e.$recursionLimit=2}}return d.prototype.schedule=function(o){this.changes=this.changes|o,this.changes&&!this.pending&&(s.nextFrame(this._flush),this.pending=!0)},d.prototype.clear=function(o){var p=this.changes;return this.changes=0,p},d}();l.RenderLoop=c}),ace.define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"],function(i,l,v){var s=i("../lib/oop"),c=i("../lib/dom"),d=i("../lib/lang"),o=i("../lib/event"),p=i("../lib/useragent"),e=i("../lib/event_emitter").EventEmitter,t=512,r=typeof ResizeObserver=="function",h=200,a=function(){function u(f){this.el=c.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=c.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=c.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),f.appendChild(this.el),this.$measureNode.textContent=d.stringRepeat("X",t),this.$characterSize={width:0,height:0},r?this.$addObserver():this.checkForSizeChanges()}return u.prototype.$setMeasureNodeStyles=function(f,m){f.width=f.height="auto",f.left=f.top="0px",f.visibility="hidden",f.position="absolute",f.whiteSpace="pre",p.isIE<8?f["font-family"]="inherit":f.font="inherit",f.overflow=m?"hidden":"visible"},u.prototype.checkForSizeChanges=function(f){if(f===void 0&&(f=this.$measureSizes()),f&&(this.$characterSize.width!==f.width||this.$characterSize.height!==f.height)){this.$measureNode.style.fontWeight="bold";var m=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=f,this.charSizes=Object.create(null),this.allowBoldFonts=m&&m.width===f.width&&m.height===f.height,this._emit("changeCharacterSize",{data:f})}},u.prototype.$addObserver=function(){var f=this;this.$observer=new window.ResizeObserver(function(m){f.checkForSizeChanges()}),this.$observer.observe(this.$measureNode)},u.prototype.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var f=this;return this.$pollSizeChangesTimer=o.onIdle(function m(){f.checkForSizeChanges(),o.onIdle(m,500)},500)},u.prototype.setPolling=function(f){f?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},u.prototype.$measureSizes=function(f){var m={height:(f||this.$measureNode).clientHeight,width:(f||this.$measureNode).clientWidth/t};return m.width===0||m.height===0?null:m},u.prototype.$measureCharWidth=function(f){this.$main.textContent=d.stringRepeat(f,t);var m=this.$main.getBoundingClientRect();return m.width/t},u.prototype.getCharacterWidth=function(f){var m=this.charSizes[f];return m===void 0&&(m=this.charSizes[f]=this.$measureCharWidth(f)/this.$characterSize.width),m},u.prototype.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},u.prototype.$getZoom=function(f){return!f||!f.parentElement?1:(Number(window.getComputedStyle(f).zoom)||1)*this.$getZoom(f.parentElement)},u.prototype.$initTransformMeasureNodes=function(){var f=function(m,y){return["div",{style:"position: absolute;top:"+m+"px;left:"+y+"px;"}]};this.els=c.buildDom([f(0,0),f(h,0),f(0,h),f(h,h)],this.el)},u.prototype.transformCoordinates=function(f,m){if(f){var y=this.$getZoom(this.el);f=g(1/y,f)}function x(P,B,V){var W=P[1]*B[0]-P[0]*B[1];return[(-B[1]*V[0]+B[0]*V[1])/W,(+P[1]*V[0]-P[0]*V[1])/W]}function E(P,B){return[P[0]-B[0],P[1]-B[1]]}function w(P,B){return[P[0]+B[0],P[1]+B[1]]}function g(P,B){return[P*B[0],P*B[1]]}this.els||this.$initTransformMeasureNodes();function S(P){var B=P.getBoundingClientRect();return[B.left,B.top]}var k=S(this.els[0]),D=S(this.els[1]),_=S(this.els[2]),F=S(this.els[3]),A=x(E(F,D),E(F,_),E(w(D,_),w(F,k))),$=g(1+A[0],E(D,k)),C=g(1+A[1],E(_,k));if(m){var b=m,T=A[0]*b[0]/h+A[1]*b[1]/h+1,I=w(g(b[0],$),g(b[1],C));return w(g(1/T/h,I),k)}var O=E(f,k),N=x(E($,g(A[0],O)),E(C,g(A[1],O)),O);return g(h,N)},u}();a.prototype.$characterSize={width:0,height:0},s.implement(a.prototype,e),l.FontMetrics=a}),ace.define("ace/css/editor-css",["require","exports","module"],function(i,l,v){v.exports=`
|
|
269
269
|
.ace_br1 {border-top-left-radius : 3px;}
|
|
270
270
|
.ace_br2 {border-top-right-radius : 3px;}
|
|
271
271
|
.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}
|
|
@@ -961,9 +961,9 @@ import{C as qe,R as M}from"./ConfigCustomJavascriptSet__loadShare__react__loadSh
|
|
|
961
961
|
|
|
962
962
|
.ace_hidden_token {
|
|
963
963
|
display: none;
|
|
964
|
-
}`}),ace.define("ace/layer/decorators",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter"],function(i,l,v){var s=i("../lib/dom"),c=i("../lib/oop"),d=i("../lib/event_emitter").EventEmitter,o=function(){function p(e,t){this.renderer=t,this.pixelRatio=1,this.maxHeight=t.layerConfig.maxHeight,this.lineHeight=t.layerConfig.lineHeight,this.minDecorationHeight=2*this.pixelRatio|0,this.halfMinDecorationHeight=this.minDecorationHeight/2|0,this.colors={},this.colors.dark={error:"rgba(255, 18, 18, 1)",warning:"rgba(18, 136, 18, 1)",info:"rgba(18, 18, 136, 1)"},this.colors.light={error:"rgb(255,51,51)",warning:"rgb(32,133,72)",info:"rgb(35,68,138)"},this.setScrollBarV(e)}return p.prototype.$createCanvas=function(){this.canvas=s.createElement("canvas"),this.canvas.style.top="0px",this.canvas.style.right="0px",this.canvas.style.zIndex="7",this.canvas.style.position="absolute"},p.prototype.setScrollBarV=function(e){this.$createCanvas(),this.scrollbarV=e,e.element.appendChild(this.canvas),this.setDimensions()},p.prototype.$updateDecorators=function(e){if(typeof this.canvas.getContext!="function")return;var t=this.renderer.theme.isDark===!0?this.colors.dark:this.colors.light;this.setDimensions(e);var r=this.canvas.getContext("2d");function h($,w){return $.priority<w.priority?-1:$.priority>w.priority?1:0}var a=this.renderer.session.$annotations;if(r.clearRect(0,0,this.canvas.width,this.canvas.height),a){var u={info:1,warning:2,error:3};a.forEach(function($){$.priority=u[$.type]||null}),a=a.sort(h);for(var f=0;f<a.length;f++){var m=a[f].row,y=this.getVerticalOffsetForRow(m),x=y+this.lineHeight,E=Math.round(this.heightRatio*y),b=Math.round(this.heightRatio*x),g=Math.round((E+b)/2),S=b-g;S<this.halfMinDecorationHeight&&(S=this.halfMinDecorationHeight),g-S<0&&(g=S),g+S>this.canvasHeight&&(g=this.canvasHeight-S);var k=g-S,D=g+S,_=D-k;r.fillStyle=t[a[f].type]||null,r.fillRect(0,k,Math.round(this.oneZoneWidth-1),_)}}var F=this.renderer.session.selection.getCursor();if(F){var A=Math.round(this.getVerticalOffsetForRow(F.row)*this.heightRatio);r.fillStyle="rgba(0, 0, 0, 0.5)",r.fillRect(0,A,this.canvasWidth,2)}},p.prototype.getVerticalOffsetForRow=function(e){e=e|0;var t=this.renderer.session.documentToScreenRow(e,0)*this.lineHeight;return t},p.prototype.setDimensions=function(e){e=e||this.renderer.layerConfig,this.maxHeight=e.maxHeight,this.lineHeight=e.lineHeight,this.canvasHeight=e.height,this.canvasWidth=this.scrollbarV.width||this.canvasWidth,this.setZoneWidth(),this.canvas.width=this.canvasWidth,this.canvas.height=this.canvasHeight,this.maxHeight<this.canvasHeight?this.heightRatio=1:this.heightRatio=this.canvasHeight/this.maxHeight},p.prototype.setZoneWidth=function(){this.oneZoneWidth=this.canvasWidth},p.prototype.destroy=function(){this.canvas.parentNode.removeChild(this.canvas)},p}();c.implement(o.prototype,d),l.Decorator=o}),ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/scrollbar_custom","ace/scrollbar_custom","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter","ace/css/editor-css","ace/layer/decorators","ace/lib/useragent","ace/layer/text_util"],function(i,l,v){var s=i("./lib/oop"),c=i("./lib/dom"),d=i("./lib/lang"),o=i("./config"),p=i("./layer/gutter").Gutter,e=i("./layer/marker").Marker,t=i("./layer/text").Text,r=i("./layer/cursor").Cursor,h=i("./scrollbar").HScrollBar,a=i("./scrollbar").VScrollBar,u=i("./scrollbar_custom").HScrollBar,f=i("./scrollbar_custom").VScrollBar,m=i("./renderloop").RenderLoop,y=i("./layer/font_metrics").FontMetrics,x=i("./lib/event_emitter").EventEmitter,E=i("./css/editor-css"),b=i("./layer/decorators").Decorator,g=i("./lib/useragent"),S=i("./layer/text_util").isTextToken;c.importCssString(E,"ace_editor.css",!1);var k=function(){function D(_,F){var A=this;this.container=_||c.createElement("div"),c.addCssClass(this.container,"ace_editor"),c.HI_DPI&&c.addCssClass(this.container,"ace_hidpi"),this.setTheme(F),o.get("useStrictCSP")==null&&o.set("useStrictCSP",!1),this.$gutter=c.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden","true"),this.scroller=c.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=c.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new p(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new e(this.content);var $=this.$textLayer=new t(this.content);this.canvas=$.element,this.$markerFront=new e(this.content),this.$cursorLayer=new r(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new a(this.container,this),this.scrollBarH=new h(this.container,this),this.scrollBarV.on("scroll",function(w){A.$scrollAnimation||A.session.setScrollTop(w.data-A.scrollMargin.top)}),this.scrollBarH.on("scroll",function(w){A.$scrollAnimation||A.session.setScrollLeft(w.data-A.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new y(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.on("changeCharacterSize",function(w){A.updateCharacterSize(),A.onResize(!0,A.gutterWidth,A.$size.width,A.$size.height),A._signal("changeCharacterSize",w)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.margin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$keepTextAreaAtCursor=!g.isIOS,this.$loop=new m(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),this.$addResizeObserver(),o.resetOptions(this),o._signal("renderer",this)}return D.prototype.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin(),c.setStyle(this.scroller.style,"line-height",this.lineHeight+"px")},D.prototype.setSession=function(_){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=_,_&&this.scrollMargin.top&&_.getScrollTop()<=0&&_.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(_),this.$markerBack.setSession(_),this.$markerFront.setSession(_),this.$gutterLayer.setSession(_),this.$textLayer.setSession(_),_&&(this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode))},D.prototype.updateLines=function(_,F,A){if(F===void 0&&(F=1/0),this.$changedLines?(this.$changedLines.firstRow>_&&(this.$changedLines.firstRow=_),this.$changedLines.lastRow<F&&(this.$changedLines.lastRow=F)):this.$changedLines={firstRow:_,lastRow:F},this.$changedLines.lastRow<this.layerConfig.firstRow)if(A)this.$changedLines.lastRow=this.layerConfig.lastRow;else return;this.$changedLines.firstRow>this.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},D.prototype.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},D.prototype.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},D.prototype.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},D.prototype.updateFull=function(_){_?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},D.prototype.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},D.prototype.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},D.prototype.onResize=function(_,F,A,$){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=_?1:0;var w=this.container;$||($=w.clientHeight||w.scrollHeight),!$&&this.$maxLines&&this.lineHeight>1&&(!w.style.height||w.style.height=="0px")&&(w.style.height="1px",$=w.clientHeight||w.scrollHeight),A||(A=w.clientWidth||w.scrollWidth);var C=this.$updateCachedSize(_,F,A,$);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!A&&!$)return this.resizing=0;_&&(this.$gutterLayer.$padding=null),_?this.$renderChanges(C|this.$changes,!0):this.$loop.schedule(C|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.$customScrollbar&&this.$updateCustomScrollbar(!0)}},D.prototype.$updateCachedSize=function(_,F,A,$){$-=this.$extraHeight||0;var w=0,C=this.$size,T={width:C.width,height:C.height,scrollerHeight:C.scrollerHeight,scrollerWidth:C.scrollerWidth};if($&&(_||C.height!=$)&&(C.height=$,w|=this.CHANGE_SIZE,C.scrollerHeight=C.height,this.$horizScroll&&(C.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.setHeight(C.scrollerHeight),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",w=w|this.CHANGE_SCROLL),A&&(_||C.width!=A)){w|=this.CHANGE_SIZE,C.width=A,F==null&&(F=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=F,c.setStyle(this.scrollBarH.element.style,"left",F+"px"),c.setStyle(this.scroller.style,"left",F+this.margin.left+"px"),C.scrollerWidth=Math.max(0,A-F-this.scrollBarV.getWidth()-this.margin.h),c.setStyle(this.$gutter.style,"left",this.margin.left+"px");var I=this.scrollBarV.getWidth()+"px";c.setStyle(this.scrollBarH.element.style,"right",I),c.setStyle(this.scroller.style,"right",I),c.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(C.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||_)&&(w|=this.CHANGE_FULL)}return C.$dirty=!A||!$,w&&this._signal("resize",T),w},D.prototype.onGutterResize=function(_){var F=this.$showGutter?_:0;F!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,F,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()?this.$loop.schedule(this.CHANGE_FULL):this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},D.prototype.adjustWrapLimit=function(){var _=this.$size.scrollerWidth-this.$padding*2,F=Math.floor(_/this.characterWidth);return this.session.adjustWrapLimit(F,this.$showPrintMargin&&this.$printMarginColumn)},D.prototype.setAnimatedScroll=function(_){this.setOption("animatedScroll",_)},D.prototype.getAnimatedScroll=function(){return this.$animatedScroll},D.prototype.setShowInvisibles=function(_){this.setOption("showInvisibles",_),this.session.$bidiHandler.setShowInvisibles(_)},D.prototype.getShowInvisibles=function(){return this.getOption("showInvisibles")},D.prototype.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},D.prototype.setDisplayIndentGuides=function(_){this.setOption("displayIndentGuides",_)},D.prototype.getHighlightIndentGuides=function(){return this.getOption("highlightIndentGuides")},D.prototype.setHighlightIndentGuides=function(_){this.setOption("highlightIndentGuides",_)},D.prototype.setShowPrintMargin=function(_){this.setOption("showPrintMargin",_)},D.prototype.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},D.prototype.setPrintMarginColumn=function(_){this.setOption("printMarginColumn",_)},D.prototype.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},D.prototype.getShowGutter=function(){return this.getOption("showGutter")},D.prototype.setShowGutter=function(_){return this.setOption("showGutter",_)},D.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},D.prototype.setFadeFoldWidgets=function(_){this.setOption("fadeFoldWidgets",_)},D.prototype.setHighlightGutterLine=function(_){this.setOption("highlightGutterLine",_)},D.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},D.prototype.$updatePrintMargin=function(){if(!(!this.$showPrintMargin&&!this.$printMarginEl)){if(!this.$printMarginEl){var _=c.createElement("div");_.className="ace_layer ace_print-margin-layer",this.$printMarginEl=c.createElement("div"),this.$printMarginEl.className="ace_print-margin",_.appendChild(this.$printMarginEl),this.content.insertBefore(_,this.content.firstChild)}var F=this.$printMarginEl.style;F.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",F.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&this.session.$wrap==-1&&this.adjustWrapLimit()}},D.prototype.getContainerElement=function(){return this.container},D.prototype.getMouseEventTarget=function(){return this.scroller},D.prototype.getTextAreaContainer=function(){return this.container},D.prototype.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var _=this.textarea.style,F=this.$composition;if(!this.$keepTextAreaAtCursor&&!F){c.translate(this.textarea,-100,0);return}var A=this.$cursorLayer.$pixelPos;if(A){F&&F.markerRange&&(A=this.$cursorLayer.getPixelPosition(F.markerRange.start,!0));var $=this.layerConfig,w=A.top,C=A.left;w-=$.offset;var T=F&&F.useTextareaForIME||g.isMobile?this.lineHeight:1;if(w<0||w>$.height-T){c.translate(this.textarea,0,0);return}var I=1,O=this.$size.height-T;if(!F)w+=this.lineHeight;else if(F.useTextareaForIME){var R=this.textarea.value;I=this.characterWidth*this.session.$getStringScreenWidth(R)[0]}else w+=this.lineHeight+2;C-=this.scrollLeft,C>this.$size.scrollerWidth-I&&(C=this.$size.scrollerWidth-I),C+=this.gutterWidth+this.margin.left,c.setStyle(_,"height",T+"px"),c.setStyle(_,"width",I+"px"),c.translate(this.textarea,Math.min(C,this.$size.scrollerWidth-I),Math.min(w,O))}}},D.prototype.getFirstVisibleRow=function(){return this.layerConfig.firstRow},D.prototype.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},D.prototype.getLastFullyVisibleRow=function(){var _=this.layerConfig,F=_.lastRow,A=this.session.documentToScreenRow(F,0)*_.lineHeight;return A-this.session.getScrollTop()>_.height-_.lineHeight?F-1:F},D.prototype.getLastVisibleRow=function(){return this.layerConfig.lastRow},D.prototype.setPadding=function(_){this.$padding=_,this.$textLayer.setPadding(_),this.$cursorLayer.setPadding(_),this.$markerFront.setPadding(_),this.$markerBack.setPadding(_),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},D.prototype.setScrollMargin=function(_,F,A,$){var w=this.scrollMargin;w.top=_|0,w.bottom=F|0,w.right=$|0,w.left=A|0,w.v=w.top+w.bottom,w.h=w.left+w.right,w.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-w.top),this.updateFull()},D.prototype.setMargin=function(_,F,A,$){var w=this.margin;w.top=_|0,w.bottom=F|0,w.right=$|0,w.left=A|0,w.v=w.top+w.bottom,w.h=w.left+w.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},D.prototype.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},D.prototype.setHScrollBarAlwaysVisible=function(_){this.setOption("hScrollBarAlwaysVisible",_)},D.prototype.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},D.prototype.setVScrollBarAlwaysVisible=function(_){this.setOption("vScrollBarAlwaysVisible",_)},D.prototype.$updateScrollBarV=function(){var _=this.layerConfig.maxHeight,F=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(_-=(F-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>_-F&&(_=this.scrollTop+F,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(_+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},D.prototype.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},D.prototype.freeze=function(){this.$frozen=!0},D.prototype.unfreeze=function(){this.$frozen=!1},D.prototype.$renderChanges=function(_,F){if(this.$changes&&(_|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!_&&!F){this.$changes|=_;return}if(this.$size.$dirty)return this.$changes|=_,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",_),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var A=this.layerConfig;if(_&this.CHANGE_FULL||_&this.CHANGE_SIZE||_&this.CHANGE_TEXT||_&this.CHANGE_LINES||_&this.CHANGE_SCROLL||_&this.CHANGE_H_SCROLL){if(_|=this.$computeLayerConfig()|this.$loop.clear(),A.firstRow!=this.layerConfig.firstRow&&A.firstRowScreen==this.layerConfig.firstRowScreen){var $=this.scrollTop+(A.firstRow-Math.max(this.layerConfig.firstRow,0))*this.lineHeight;$>0&&(this.scrollTop=$,_=_|this.CHANGE_SCROLL,_|=this.$computeLayerConfig()|this.$loop.clear())}A=this.layerConfig,this.$updateScrollBarV(),_&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),c.translate(this.content,-this.scrollLeft,-A.offset);var w=A.width+2*this.$padding+"px",C=A.minHeight+"px";c.setStyle(this.content.style,"width",w),c.setStyle(this.content.style,"height",C)}if(_&this.CHANGE_H_SCROLL&&(c.translate(this.content,-this.scrollLeft,-A.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller ":"ace_scroller ace_scroll-left ",this.enableKeyboardAccessibility&&(this.scroller.className+=this.keyboardFocusClassName)),_&this.CHANGE_FULL){this.$changedLines=null,this.$textLayer.update(A),this.$showGutter&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A),this.$markerBack.update(A),this.$markerFront.update(A),this.$cursorLayer.update(A),this.$moveTextAreaToCursor(),this._signal("afterRender",_);return}if(_&this.CHANGE_SCROLL){this.$changedLines=null,_&this.CHANGE_TEXT||_&this.CHANGE_LINES?this.$textLayer.update(A):this.$textLayer.scrollLines(A),this.$showGutter&&(_&this.CHANGE_GUTTER||_&this.CHANGE_LINES?this.$gutterLayer.update(A):this.$gutterLayer.scrollLines(A)),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A),this.$markerBack.update(A),this.$markerFront.update(A),this.$cursorLayer.update(A),this.$moveTextAreaToCursor(),this._signal("afterRender",_);return}_&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(A),this.$showGutter&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)):_&this.CHANGE_LINES?((this.$updateLines()||_&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)):_&this.CHANGE_TEXT||_&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)):_&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)),_&this.CHANGE_CURSOR&&(this.$cursorLayer.update(A),this.$moveTextAreaToCursor()),_&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(A),_&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(A),this._signal("afterRender",_)},D.prototype.$autosize=function(){var _=this.session.getScreenLength()*this.lineHeight,F=this.$maxLines*this.lineHeight,A=Math.min(F,Math.max((this.$minLines||1)*this.lineHeight,_))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(A+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&A>this.$maxPixelHeight&&(A=this.$maxPixelHeight);var $=A<=2*this.lineHeight,w=!$&&_>F;if(A!=this.desiredHeight||this.$size.height!=this.desiredHeight||w!=this.$vScroll){w!=this.$vScroll&&(this.$vScroll=w,this.scrollBarV.setVisible(w));var C=this.container.clientWidth;this.container.style.height=A+"px",this.$updateCachedSize(!0,this.$gutterWidth,C,A),this.desiredHeight=A,this._signal("autosize")}},D.prototype.$computeLayerConfig=function(){var _=this.session,F=this.$size,A=F.height<=2*this.lineHeight,$=this.session.getScreenLength(),w=$*this.lineHeight,C=this.$getLongestLine(),T=!A&&(this.$hScrollBarAlwaysVisible||F.scrollerWidth-C-2*this.$padding<0),I=this.$horizScroll!==T;I&&(this.$horizScroll=T,this.scrollBarH.setVisible(T));var O=this.$vScroll;this.$maxLines&&this.lineHeight>1&&(this.$autosize(),A=F.height<=2*this.lineHeight);var R=F.scrollerHeight+this.lineHeight,P=!this.$maxLines&&this.$scrollPastEnd?(F.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;w+=P;var B=this.scrollMargin;this.session.setScrollTop(Math.max(-B.top,Math.min(this.scrollTop,w-F.scrollerHeight+B.bottom))),this.session.setScrollLeft(Math.max(-B.left,Math.min(this.scrollLeft,C+2*this.$padding-F.scrollerWidth+B.right)));var V=!A&&(this.$vScrollBarAlwaysVisible||F.scrollerHeight-w+P<0||this.scrollTop>B.top),W=O!==V;W&&(this.$vScroll=V,this.scrollBarV.setVisible(V));var z=this.scrollTop%this.lineHeight,U=Math.ceil(R/this.lineHeight)-1,G=Math.max(0,Math.round((this.scrollTop-z)/this.lineHeight)),Y=G+U,Q,q,te=this.lineHeight;G=_.screenToDocumentRow(G,0);var re=_.getFoldLine(G);re&&(G=re.start.row),Q=_.documentToScreenRow(G,0),q=_.getRowLength(G)*te,Y=Math.min(_.screenToDocumentRow(Y,0),_.getLength()-1),R=F.scrollerHeight+_.getRowLength(Y)*te+q,z=this.scrollTop-Q*te,z<0&&Q>0&&(Q=Math.max(0,Q+Math.floor(z/te)),z=this.scrollTop-Q*te);var ue=0;return(this.layerConfig.width!=C||I)&&(ue=this.CHANGE_H_SCROLL),(I||W)&&(ue|=this.$updateCachedSize(!0,this.gutterWidth,F.width,F.height),this._signal("scrollbarVisibilityChanged"),W&&(C=this.$getLongestLine())),this.layerConfig={width:C,padding:this.$padding,firstRow:G,firstRowScreen:Q,lastRow:Y,lineHeight:te,characterWidth:this.characterWidth,minHeight:R,maxHeight:w,offset:z,gutterOffset:te?Math.max(0,Math.ceil((z+F.height-F.scrollerHeight)/te)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(C-this.$padding),ue},D.prototype.$updateLines=function(){if(this.$changedLines){var _=this.$changedLines.firstRow,F=this.$changedLines.lastRow;this.$changedLines=null;var A=this.layerConfig;if(!(_>A.lastRow+1)&&!(F<A.firstRow)){if(F===1/0){this.$showGutter&&this.$gutterLayer.update(A),this.$textLayer.update(A);return}return this.$textLayer.updateLines(A,_,F),!0}}},D.prototype.$getLongestLine=function(){var _=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(_+=1),this.$textLayer&&_>this.$textLayer.MAX_LINE_LENGTH&&(_=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(_*this.characterWidth))},D.prototype.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},D.prototype.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},D.prototype.addGutterDecoration=function(_,F){this.$gutterLayer.addGutterDecoration(_,F)},D.prototype.removeGutterDecoration=function(_,F){this.$gutterLayer.removeGutterDecoration(_,F)},D.prototype.updateBreakpoints=function(_){this._rows=_,this.$loop.schedule(this.CHANGE_GUTTER)},D.prototype.setAnnotations=function(_){this.$gutterLayer.setAnnotations(_),this.$loop.schedule(this.CHANGE_GUTTER)},D.prototype.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},D.prototype.hideCursor=function(){this.$cursorLayer.hideCursor()},D.prototype.showCursor=function(){this.$cursorLayer.showCursor()},D.prototype.scrollSelectionIntoView=function(_,F,A){this.scrollCursorIntoView(_,A),this.scrollCursorIntoView(F,A)},D.prototype.scrollCursorIntoView=function(_,F,A){if(this.$size.scrollerHeight!==0){var $=this.$cursorLayer.getPixelPosition(_),w=$.left,C=$.top,T=A&&A.top||0,I=A&&A.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var O=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;O+T>C?(F&&O+T>C+this.lineHeight&&(C-=F*this.$size.scrollerHeight),C===0&&(C=-this.scrollMargin.top),this.session.setScrollTop(C)):O+this.$size.scrollerHeight-I<C+this.lineHeight&&(F&&O+this.$size.scrollerHeight-I<C-this.lineHeight&&(C+=F*this.$size.scrollerHeight),this.session.setScrollTop(C+this.lineHeight+I-this.$size.scrollerHeight));var R=this.scrollLeft,P=2*this.layerConfig.characterWidth;w-P<R?(w-=P,w<this.$padding+P&&(w=-this.scrollMargin.left),this.session.setScrollLeft(w)):(w+=P,R+this.$size.scrollerWidth<w+this.characterWidth?this.session.setScrollLeft(Math.round(w+this.characterWidth-this.$size.scrollerWidth)):R<=this.$padding&&w-R<this.characterWidth&&this.session.setScrollLeft(0))}},D.prototype.getScrollTop=function(){return this.session.getScrollTop()},D.prototype.getScrollLeft=function(){return this.session.getScrollLeft()},D.prototype.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},D.prototype.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},D.prototype.scrollToRow=function(_){this.session.setScrollTop(_*this.lineHeight)},D.prototype.alignCursor=function(_,F){typeof _=="number"&&(_={row:_,column:0});var A=this.$cursorLayer.getPixelPosition(_),$=this.$size.scrollerHeight-this.lineHeight,w=A.top-$*(F||0);return this.session.setScrollTop(w),w},D.prototype.$calcSteps=function(_,F){var A=0,$=this.STEPS,w=[],C=function(T,I,O){return O*(Math.pow(T-1,3)+1)+I};for(A=0;A<$;++A)w.push(C(A/this.STEPS,_,F-_));return w},D.prototype.scrollToLine=function(_,F,A,$){var w=this.$cursorLayer.getPixelPosition({row:_,column:0}),C=w.top;F&&(C-=this.$size.scrollerHeight/2);var T=this.scrollTop;this.session.setScrollTop(C),A!==!1&&this.animateScrolling(T,$)},D.prototype.animateScrolling=function(_,F){var A=this.scrollTop;if(!this.$animatedScroll)return;var $=this;if(_==A)return;if(this.$scrollAnimation){var w=this.$scrollAnimation.steps;if(w.length&&(_=w[0],_==A))return}var C=$.$calcSteps(_,A);this.$scrollAnimation={from:_,to:A,steps:C},clearInterval(this.$timer),$.session.setScrollTop(C.shift()),$.session.$scrollTop=A;function T(){$.$timer=clearInterval($.$timer),$.$scrollAnimation=null,$.$stopAnimation=!1,F&&F()}this.$timer=setInterval(function(){if($.$stopAnimation){T();return}if(!$.session)return clearInterval($.$timer);C.length?($.session.setScrollTop(C.shift()),$.session.$scrollTop=A):A!=null?($.session.$scrollTop=-1,$.session.setScrollTop(A),A=null):T()},10)},D.prototype.scrollToY=function(_){this.scrollTop!==_&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=_)},D.prototype.scrollToX=function(_){this.scrollLeft!==_&&(this.scrollLeft=_),this.$loop.schedule(this.CHANGE_H_SCROLL)},D.prototype.scrollTo=function(_,F){this.session.setScrollTop(F),this.session.setScrollLeft(_)},D.prototype.scrollBy=function(_,F){F&&this.session.setScrollTop(this.session.getScrollTop()+F),_&&this.session.setScrollLeft(this.session.getScrollLeft()+_)},D.prototype.isScrollableBy=function(_,F){if(F<0&&this.session.getScrollTop()>=1-this.scrollMargin.top||F>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||_<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||_>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},D.prototype.pixelToScreenCoordinates=function(_,F){var A;if(this.$hasCssTransforms){A={top:0,left:0};var $=this.$fontMetrics.transformCoordinates([_,F]);_=$[1]-this.gutterWidth-this.margin.left,F=$[0]}else A=this.scroller.getBoundingClientRect();var w=_+this.scrollLeft-A.left-this.$padding,C=w/this.characterWidth,T=Math.floor((F+this.scrollTop-A.top)/this.lineHeight),I=this.$blockCursor?Math.floor(C):Math.round(C);return{row:T,column:I,side:C-I>0?1:-1,offsetX:w}},D.prototype.screenToTextCoordinates=function(_,F){var A;if(this.$hasCssTransforms){A={top:0,left:0};var $=this.$fontMetrics.transformCoordinates([_,F]);_=$[1]-this.gutterWidth-this.margin.left,F=$[0]}else A=this.scroller.getBoundingClientRect();var w=_+this.scrollLeft-A.left-this.$padding,C=w/this.characterWidth,T=this.$blockCursor?Math.floor(C):Math.round(C),I=Math.floor((F+this.scrollTop-A.top)/this.lineHeight);return this.session.screenToDocumentPosition(I,Math.max(T,0),w)},D.prototype.textToScreenCoordinates=function(_,F){var A=this.scroller.getBoundingClientRect(),$=this.session.documentToScreenPosition(_,F),w=this.$padding+(this.session.$bidiHandler.isBidiRow($.row,_)?this.session.$bidiHandler.getPosLeft($.column):Math.round($.column*this.characterWidth)),C=$.row*this.lineHeight;return{pageX:A.left+w-this.scrollLeft,pageY:A.top+C-this.scrollTop}},D.prototype.visualizeFocus=function(){c.addCssClass(this.container,"ace_focus")},D.prototype.visualizeBlur=function(){c.removeCssClass(this.container,"ace_focus")},D.prototype.showComposition=function(_){this.$composition=_,_.cssText||(_.cssText=this.textarea.style.cssText),_.useTextareaForIME==null&&(_.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(c.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):_.markerId=this.session.addMarker(_.markerRange,"ace_composition_marker","text")},D.prototype.setCompositionText=function(_){var F=this.session.selection.cursor;this.addToken(_,"composition_placeholder",F.row,F.column),this.$moveTextAreaToCursor()},D.prototype.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),c.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var _=this.session.selection.cursor;this.removeExtraToken(_.row,_.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},D.prototype.setGhostText=function(_,F){var A=this.session.selection.cursor,$=F||{row:A.row,column:A.column};this.removeGhostText();var w=this.$calculateWrappedTextChunks(_,$);this.addToken(w[0].text,"ghost_text",$.row,$.column),this.$ghostText={text:_,position:{row:$.row,column:$.column}};var C=c.createElement("div");if(w.length>1){var T=this.hideTokensAfterPosition($.row,$.column),I;w.slice(1).forEach(function(W){var z=c.createElement("div"),U=c.createElement("span");U.className="ace_ghost_text",W.wrapped&&(z.className="ghost_text_line_wrapped"),W.text.length===0&&(W.text=" "),U.appendChild(c.createTextNode(W.text)),z.appendChild(U),C.appendChild(z),I=z}),T.forEach(function(W){var z=c.createElement("span");S(W.type)||(z.className="ace_"+W.type.replace(/\./g," ace_")),z.appendChild(c.createTextNode(W.value)),I.appendChild(z)}),this.$ghostTextWidget={el:C,row:$.row,column:$.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var O=this.$cursorLayer.getPixelPosition($,!0),R=this.container,P=R.getBoundingClientRect().height,B=w.length*this.lineHeight,V=B<P-O.top;if(V)return;B<P?this.scrollBy(0,(w.length-1)*this.lineHeight):this.scrollToRow($.row)}},D.prototype.$calculateWrappedTextChunks=function(_,F){var A=this.$size.scrollerWidth-this.$padding*2,$=Math.floor(A/this.characterWidth)-2;$=$<=0?60:$;for(var w=_.split(/\r?\n/),C=[],T=0;T<w.length;T++){var I=this.session.$getDisplayTokens(w[T],F.column),O=this.session.$computeWrapSplits(I,$,this.session.$tabSize);if(O.length>0){var R=0;O.push(w[T].length);for(var P=0;P<O.length;P++){var B=w[T].slice(R,O[P]);C.push({text:B,wrapped:!0}),R=O[P]}}else C.push({text:w[T],wrapped:!1})}return C},D.prototype.removeGhostText=function(){if(this.$ghostText){var _=this.$ghostText.position;this.removeExtraToken(_.row,_.column),this.$ghostTextWidget&&(this.session.widgetManager.removeLineWidget(this.$ghostTextWidget),this.$ghostTextWidget=null),this.$ghostText=null}},D.prototype.addToken=function(_,F,A,$){var w=this.session;w.bgTokenizer.lines[A]=null;var C={type:F,value:_},T=w.getTokens(A);if($==null||!T.length)T.push(C);else for(var I=0,O=0;O<T.length;O++){var R=T[O];if(I+=R.value.length,$<=I){var P=R.value.length-(I-$),B=R.value.slice(0,P),V=R.value.slice(P);T.splice(O,1,{type:R.type,value:B},C,{type:R.type,value:V});break}}this.updateLines(A,A)},D.prototype.hideTokensAfterPosition=function(_,F){for(var A=this.session.getTokens(_),$=0,w=!1,C=[],T=0;T<A.length;T++){var I=A[T];if($+=I.value.length,I.type!=="ghost_text"){if(w){C.push({type:I.type,value:I.value}),I.type="hidden_token";continue}$===F&&(w=!0)}}return this.updateLines(_,_),C},D.prototype.removeExtraToken=function(_,F){this.session.bgTokenizer.lines[_]=null,this.updateLines(_,_)},D.prototype.setTheme=function(_,F){var A=this;if(this.$themeId=_,A._dispatchEvent("themeChange",{theme:_}),!_||typeof _=="string"){var $=_||this.$options.theme.initialValue;o.loadModule(["theme",$],w)}else w(_);function w(C){if(A.$themeId!=_)return F&&F();if(!C||!C.cssClass)throw new Error("couldn't load module "+_+" or it didn't call define");C.$id&&(A.$themeId=C.$id),c.importCssString(C.cssText,C.cssClass,A.container),A.theme&&c.removeCssClass(A.container,A.theme.cssClass);var T="padding"in C?C.padding:"padding"in(A.theme||{})?4:A.$padding;A.$padding&&T!=A.$padding&&A.setPadding(T),A.$theme=C.cssClass,A.theme=C,c.addCssClass(A.container,C.cssClass),c.setCssClass(A.container,"ace_dark",C.isDark),A.$size&&(A.$size.width=0,A.$updateSizeAsync()),A._dispatchEvent("themeLoaded",{theme:C}),F&&F(),g.isSafari&&A.scroller&&(A.scroller.style.background="red",A.scroller.style.background="")}},D.prototype.getTheme=function(){return this.$themeId},D.prototype.setStyle=function(_,F){c.setCssClass(this.container,_,F!==!1)},D.prototype.unsetStyle=function(_){c.removeCssClass(this.container,_)},D.prototype.setCursorStyle=function(_){c.setStyle(this.scroller.style,"cursor",_)},D.prototype.setMouseCursor=function(_){c.setStyle(this.scroller.style,"cursor",_)},D.prototype.attachToShadowRoot=function(){c.importCssString(E,"ace_editor.css",this.container)},D.prototype.destroy=function(){this.freeze(),this.$fontMetrics.destroy(),this.$cursorLayer.destroy(),this.removeAllListeners(),this.container.textContent="",this.setOption("useResizeObserver",!1)},D.prototype.$updateCustomScrollbar=function(_){var F=this;this.$horizScroll=this.$vScroll=null,this.scrollBarV.element.remove(),this.scrollBarH.element.remove(),_===!0?(this.scrollBarV=new f(this.container,this),this.scrollBarH=new u(this.container,this),this.scrollBarV.setHeight(this.$size.scrollerHeight),this.scrollBarH.setWidth(this.$size.scrollerWidth),this.scrollBarV.addEventListener("scroll",function(A){F.$scrollAnimation||F.session.setScrollTop(A.data-F.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(A){F.$scrollAnimation||F.session.setScrollLeft(A.data-F.scrollMargin.left)}),this.$scrollDecorator?(this.$scrollDecorator.setScrollBarV(this.scrollBarV),this.$scrollDecorator.$updateDecorators()):(this.$scrollDecorator=new b(this.scrollBarV,this),this.$scrollDecorator.$updateDecorators())):(this.scrollBarV=new a(this.container,this),this.scrollBarH=new h(this.container,this),this.scrollBarV.addEventListener("scroll",function(A){F.$scrollAnimation||F.session.setScrollTop(A.data-F.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(A){F.$scrollAnimation||F.session.setScrollLeft(A.data-F.scrollMargin.left)}))},D.prototype.$addResizeObserver=function(){if(!(!window.ResizeObserver||this.$resizeObserver)){var _=this;this.$resizeTimer=d.delayedCall(function(){_.destroyed||_.onResize()},50),this.$resizeObserver=new window.ResizeObserver(function(F){var A=F[0].contentRect.width,$=F[0].contentRect.height;Math.abs(_.$size.width-A)>1||Math.abs(_.$size.height-$)>1?_.$resizeTimer.delay():_.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},D}();k.prototype.CHANGE_CURSOR=1,k.prototype.CHANGE_MARKER=2,k.prototype.CHANGE_GUTTER=4,k.prototype.CHANGE_SCROLL=8,k.prototype.CHANGE_LINES=16,k.prototype.CHANGE_TEXT=32,k.prototype.CHANGE_SIZE=64,k.prototype.CHANGE_MARKER_BACK=128,k.prototype.CHANGE_MARKER_FRONT=256,k.prototype.CHANGE_FULL=512,k.prototype.CHANGE_H_SCROLL=1024,k.prototype.$changes=0,k.prototype.$padding=null,k.prototype.$frozen=!1,k.prototype.STEPS=8,s.implement(k.prototype,x),o.defineOptions(k.prototype,"renderer",{useResizeObserver:{set:function(D){!D&&this.$resizeObserver?(this.$resizeObserver.disconnect(),this.$resizeTimer.cancel(),this.$resizeTimer=this.$resizeObserver=null):D&&!this.$resizeObserver&&this.$addResizeObserver()}},animatedScroll:{initialValue:!1},showInvisibles:{set:function(D){this.$textLayer.setShowInvisibles(D)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(D){typeof D=="number"&&(this.$printMarginColumn=D),this.$showPrintMargin=!!D,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(D){this.$gutter.style.display=D?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},useSvgGutterIcons:{set:function(D){this.$gutterLayer.$useSvgGutterIcons=D},initialValue:!1},showFoldedAnnotations:{set:function(D){this.$gutterLayer.$showFoldedAnnotations=D},initialValue:!1},fadeFoldWidgets:{set:function(D){c.setCssClass(this.$gutter,"ace_fade-fold-widgets",D)},initialValue:!1},showFoldWidgets:{set:function(D){this.$gutterLayer.setShowFoldWidgets(D),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(D){this.$textLayer.setDisplayIndentGuides(D)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightIndentGuides:{set:function(D){this.$textLayer.setHighlightIndentGuides(D)==!0?this.$textLayer.$highlightIndentGuide():this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells)},initialValue:!0},highlightGutterLine:{set:function(D){this.$gutterLayer.setHighlightGutterLine(D),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(D){(!this.$hScrollBarAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(D){(!this.$vScrollBarAlwaysVisible||!this.$vScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(D){typeof D=="number"&&(D=D+"px"),this.container.style.fontSize=D,this.updateFontSize()},initialValue:12},fontFamily:{set:function(D){this.container.style.fontFamily=D,this.updateFontSize()}},maxLines:{set:function(D){this.updateFull()}},minLines:{set:function(D){this.$minLines<562949953421311||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(D){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(D){D=+D||0,this.$scrollPastEnd!=D&&(this.$scrollPastEnd=D,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(D){this.$gutterLayer.$fixedWidth=!!D,this.$loop.schedule(this.CHANGE_GUTTER)}},customScrollbar:{set:function(D){this.$updateCustomScrollbar(D)},initialValue:!1},theme:{set:function(D){this.setTheme(D)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!g.isMobile&&!g.isIE}}),l.VirtualRenderer=k}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(i,l,v){var s=i("../lib/oop"),c=i("../lib/net"),d=i("../lib/event_emitter").EventEmitter,o=i("../config");function p(h){var a="importScripts('"+c.qualifyURL(h)+"');";try{return new Blob([a],{type:"application/javascript"})}catch{var u=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,f=new u;return f.append(a),f.getBlob("application/javascript")}}function e(h){if(typeof Worker>"u")return{postMessage:function(){},terminate:function(){}};if(o.get("loadWorkerFromBlob")){var a=p(h),u=window.URL||window.webkitURL,f=u.createObjectURL(a);return new Worker(f)}return new Worker(h)}var t=function(h){h.postMessage||(h=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=h,this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){s.implement(this,d),this.$createWorkerFromOldConfig=function(h,a,u,f,m){if(i.nameToUrl&&!i.toUrl&&(i.toUrl=i.nameToUrl),o.get("packaged")||!i.toUrl)f=f||o.moduleUrl(a,"worker");else{var y=this.$normalizePath;f=f||y(i.toUrl("ace/worker/worker.js",null,"_"));var x={};h.forEach(function(E){x[E]=y(i.toUrl(E,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=e(f),m&&this.send("importScripts",m),this.$worker.postMessage({init:!0,tlns:x,module:a,classname:u}),this.$worker},this.onMessage=function(h){var a=h.data;switch(a.type){case"event":this._signal(a.name,{data:a.data});break;case"call":var u=this.callbacks[a.id];u&&(u(a.data),delete this.callbacks[a.id]);break;case"error":this.reportError(a.data);break;case"log":window.console&&console.log&&console.log.apply(console,a.data);break}},this.reportError=function(h){window.console&&console.error&&console.error(h)},this.$normalizePath=function(h){return c.qualifyURL(h)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker.onerror=function(h){h.preventDefault()},this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(h,a){this.$worker.postMessage({command:h,args:a})},this.call=function(h,a,u){if(u){var f=this.callbackId++;this.callbacks[f]=u,a.push(f)}this.send(h,a)},this.emit=function(h,a){try{a.data&&a.data.err&&(a.data.err={message:a.data.err.message,stack:a.data.err.stack,code:a.data.err.code}),this.$worker&&this.$worker.postMessage({event:h,data:{data:a.data}})}catch(u){console.error(u.stack)}},this.attachToDocument=function(h){this.$doc&&this.terminate(),this.$doc=h,this.call("setValue",[h.getValue()]),h.on("change",this.changeListener,!0)},this.changeListener=function(h){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),h.action=="insert"?this.deltaQueue.push(h.start,h.lines):this.deltaQueue.push(h.start,h.end)},this.$sendDeltaQueue=function(){var h=this.deltaQueue;h&&(this.deltaQueue=null,h.length>50&&h.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:h}))}}).call(t.prototype);var r=function(h,a,u){var f=null,m=!1,y=Object.create(d),x=[],E=new t({messageBuffer:x,terminate:function(){},postMessage:function(g){x.push(g),f&&(m?setTimeout(b):b())}});E.setEmitSync=function(g){m=g};var b=function(){var g=x.shift();g.command?f[g.command].apply(f,g.args):g.event&&y._signal(g.event,g.data)};return y.postMessage=function(g){E.onMessage({data:g})},y.callback=function(g,S){this.postMessage({type:"call",id:S,data:g})},y.emit=function(g,S){this.postMessage({type:"event",name:g,data:S})},o.loadModule(["worker",a],function(g){for(f=new g[u](y);x.length;)b()}),E};l.UIWorkerClient=r,l.WorkerClient=t,l.createWorker=e}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(i,l,v){var s=i("./range").Range,c=i("./lib/event_emitter").EventEmitter,d=i("./lib/oop"),o=function(){function p(e,t,r,h,a,u){var f=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=a,this.othersClass=u,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=h,this.$onCursorChange=function(){setTimeout(function(){f.onCursorChange()})},this.$pos=r;var m=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=m.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)}return p.prototype.setup=function(){var e=this,t=this.doc,r=this.session;this.selectionBefore=r.selection.toJSON(),r.selection.inMultiSelectMode&&r.selection.toSingleRange(),this.pos=t.createAnchor(this.$pos.row,this.$pos.column);var h=this.pos;h.$insertRight=!0,h.detach(),h.markerId=r.addMarker(new s(h.row,h.column,h.row,h.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(a){var u=t.createAnchor(a.row,a.column);u.$insertRight=!0,u.detach(),e.others.push(u)}),r.setUndoSelect(!1)},p.prototype.showOtherMarkers=function(){if(!this.othersActive){var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(r){r.markerId=e.addMarker(new s(r.row,r.column,r.row,r.column+t.length),t.othersClass,null,!1)})}},p.prototype.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var e=0;e<this.others.length;e++)this.session.removeMarker(this.others[e].markerId)}},p.prototype.onUpdate=function(e){if(this.$updating)return this.updateAnchors(e);var t=e;if(t.start.row===t.end.row&&t.start.row===this.pos.row){this.$updating=!0;var r=e.action==="insert"?t.end.column-t.start.column:t.start.column-t.end.column,h=t.start.column>=this.pos.column&&t.start.column<=this.pos.column+this.length+1,a=t.start.column-this.pos.column;if(this.updateAnchors(e),h&&(this.length+=r),h&&!this.session.$fromUndo){if(e.action==="insert")for(var u=this.others.length-1;u>=0;u--){var f=this.others[u],m={row:f.row,column:f.column+a};this.doc.insertMergedLines(m,e.lines)}else if(e.action==="remove")for(var u=this.others.length-1;u>=0;u--){var f=this.others[u],m={row:f.row,column:f.column+a};this.doc.remove(new s(m.row,m.column,m.row,m.column-r))}}this.$updating=!1,this.updateMarkers()}},p.prototype.updateAnchors=function(e){this.pos.onChange(e);for(var t=this.others.length;t--;)this.others[t].onChange(e);this.updateMarkers()},p.prototype.updateMarkers=function(){if(!this.$updating){var e=this,t=this.session,r=function(a,u){t.removeMarker(a.markerId),a.markerId=t.addMarker(new s(a.row,a.column,a.row,a.column+e.length),u,null,!1)};r(this.pos,this.mainClass);for(var h=this.others.length;h--;)r(this.others[h],this.othersClass)}},p.prototype.onCursorChange=function(e){if(!(this.$updating||!this.session)){var t=this.session.selection.getCursor();t.row===this.pos.row&&t.column>=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))}},p.prototype.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.off("change",this.$onUpdate),this.session.selection.off("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},p.prototype.cancel=function(){if(this.$undoStackDepth!==-1){for(var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth,r=0;r<t;r++)e.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}},p}();d.implement(o.prototype,c),l.PlaceHolder=o}),ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(i,l,v){var s=i("../lib/event"),c=i("../lib/useragent");function d(p,e){return p.row==e.row&&p.column==e.column}function o(p){var e=p.domEvent,t=e.altKey,r=e.shiftKey,h=e.ctrlKey,a=p.getAccelKey(),u=p.getButton();if(h&&c.isMac&&(u=e.button),p.editor.inMultiSelectMode&&u==2){p.editor.textInput.onContextMenu(p.domEvent);return}if(!h&&!t&&!a){u===0&&p.editor.inMultiSelectMode&&p.editor.exitMultiSelectMode();return}if(u===0){var f=p.editor,m=f.selection,y=f.inMultiSelectMode,x=p.getDocumentPosition(),E=m.getCursor(),b=p.inSelection()||m.isEmpty()&&d(x,E),g=p.x,S=p.y,k=function(B){g=B.clientX,S=B.clientY},D=f.session,_=f.renderer.pixelToScreenCoordinates(g,S),F=_,A;if(f.$mouseHandler.$enableJumpToDef)h&&t||a&&t?A=r?"block":"add":t&&f.$blockSelectEnabled&&(A="block");else if(a&&!t){if(A="add",!y&&r)return}else t&&f.$blockSelectEnabled&&(A="block");if(A&&c.isMac&&e.ctrlKey&&f.$mouseHandler.cancelContextMenu(),A=="add"){if(!y&&b)return;if(!y){var $=m.toOrientedRange();f.addSelectionMarker($)}var w=m.rangeList.rangeAtPoint(x);f.inVirtualSelectionMode=!0,r&&(w=null,$=m.ranges[0]||$,f.removeSelectionMarker($)),f.once("mouseup",function(){var B=m.toOrientedRange();w&&B.isEmpty()&&d(w.cursor,B.cursor)?m.substractPoint(B.cursor):(r?m.substractPoint($.cursor):$&&(f.removeSelectionMarker($),m.addRange($)),m.addRange(B)),f.inVirtualSelectionMode=!1})}else if(A=="block"){p.stop(),f.inVirtualSelectionMode=!0;var C,T=[],I=function(){var B=f.renderer.pixelToScreenCoordinates(g,S),V=D.screenToDocumentPosition(B.row,B.column,B.offsetX);d(F,B)&&d(V,m.lead)||(F=B,f.selection.moveToPosition(V),f.renderer.scrollCursorIntoView(),f.removeSelectionMarkers(T),T=m.rectangularRangeBlock(F,_),f.$mouseHandler.$clickSelection&&T.length==1&&T[0].isEmpty()&&(T[0]=f.$mouseHandler.$clickSelection.clone()),T.forEach(f.addSelectionMarker,f),f.updateSelectionMarkers())};y&&!a?m.toSingleRange():!y&&a&&(C=m.toOrientedRange(),f.addSelectionMarker(C)),r?_=D.documentToScreenPosition(m.lead):m.moveToPosition(x),F={row:-1,column:-1};var O=function(B){I(),clearInterval(P),f.removeSelectionMarkers(T),T.length||(T=[m.toOrientedRange()]),C&&(f.removeSelectionMarker(C),m.toSingleRange(C));for(var V=0;V<T.length;V++)m.addRange(T[V]);f.inVirtualSelectionMode=!1,f.$mouseHandler.$clickSelection=null},R=I;s.capture(f.container,k,O);var P=setInterval(function(){R()},20);return p.preventDefault()}}}l.onMouseDown=o}),ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(i,l,v){l.defaultCommands=[{name:"addCursorAbove",description:"Add cursor above",exec:function(c){c.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",description:"Add cursor below",exec:function(c){c.selectMoreLines(1)},bindKey:{win:"Ctrl-Alt-Down",mac:"Ctrl-Alt-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorAboveSkipCurrent",description:"Add cursor above (skip current)",exec:function(c){c.selectMoreLines(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Up",mac:"Ctrl-Alt-Shift-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelowSkipCurrent",description:"Add cursor below (skip current)",exec:function(c){c.selectMoreLines(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Down",mac:"Ctrl-Alt-Shift-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreBefore",description:"Select more before",exec:function(c){c.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",description:"Select more after",exec:function(c){c.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",description:"Select next before",exec:function(c){c.selectMore(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Left",mac:"Ctrl-Alt-Shift-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextAfter",description:"Select next after",exec:function(c){c.selectMore(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Right",mac:"Ctrl-Alt-Shift-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"toggleSplitSelectionIntoLines",description:"Split selection into lines",exec:function(c){c.multiSelect.rangeCount>1?c.multiSelect.joinSelections():c.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(c){c.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(c){c.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(c){c.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],l.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(c){c.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(c){return c&&c.inMultiSelectMode}}];var s=i("../keyboard/hash_handler").HashHandler;l.keyboardHandler=new s(l.multiSelectCommands)}),ace.define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],function(i,l,v){var s=i("./range_list").RangeList,c=i("./range").Range,d=i("./selection").Selection,o=i("./mouse/multi_select_handler").onMouseDown,p=i("./lib/event"),e=i("./lib/lang"),t=i("./commands/multi_select_commands");l.commands=t.defaultCommands.concat(t.multiSelectCommands);var r=i("./search").Search,h=new r;function a(E,b,g){return h.$options.wrap=!0,h.$options.needle=b,h.$options.backwards=g==-1,h.find(E)}var u=i("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(u.prototype),function(){this.ranges=null,this.rangeList=null,this.addRange=function(E,b){if(E){if(!this.inMultiSelectMode&&this.rangeCount===0){var g=this.toOrientedRange();if(this.rangeList.add(g),this.rangeList.add(E),this.rangeList.ranges.length!=2)return this.rangeList.removeAll(),b||this.fromOrientedRange(E);this.rangeList.removeAll(),this.rangeList.add(g),this.$onAddRange(g)}E.cursor||(E.cursor=E.end);var S=this.rangeList.add(E);return this.$onAddRange(E),S.length&&this.$onRemoveRange(S),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),b||this.fromOrientedRange(E)}},this.toSingleRange=function(E){E=E||this.ranges[0];var b=this.rangeList.removeAll();b.length&&this.$onRemoveRange(b),E&&this.fromOrientedRange(E)},this.substractPoint=function(E){var b=this.rangeList.substractPoint(E);if(b)return this.$onRemoveRange(b),b[0]},this.mergeOverlappingRanges=function(){var E=this.rangeList.merge();E.length&&this.$onRemoveRange(E)},this.$onAddRange=function(E){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(E),this._signal("addRange",{range:E})},this.$onRemoveRange=function(E){if(this.rangeCount=this.rangeList.ranges.length,this.rangeCount==1&&this.inMultiSelectMode){var b=this.rangeList.ranges.pop();E.push(b),this.rangeCount=0}for(var g=E.length;g--;){var S=this.ranges.indexOf(E[g]);this.ranges.splice(S,1)}this._signal("removeRange",{ranges:E}),this.rangeCount===0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),b=b||this.ranges[0],b&&!b.isEqual(this.getRange())&&this.fromOrientedRange(b)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new s,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){for(var E=this.ranges.length?this.ranges:[this.getRange()],b=[],g=0;g<E.length;g++){var S=E[g],k=S.start.row,D=S.end.row;if(k===D)b.push(S.clone());else{for(b.push(new c(k,S.start.column,k,this.session.getLine(k).length));++k<D;)b.push(this.getLineRange(k,!0));b.push(new c(D,0,D,S.end.column))}g==0&&!this.isBackwards()&&(b=b.reverse())}this.toSingleRange();for(var g=b.length;g--;)this.addRange(b[g])},this.joinSelections=function(){var E=this.rangeList.ranges,b=E[E.length-1],g=c.fromPoints(E[0].start,b.end);this.toSingleRange(),this.setSelectionRange(g,b.cursor==b.start)},this.toggleBlockSelection=function(){if(this.rangeCount>1){var E=this.rangeList.ranges,b=E[E.length-1],g=c.fromPoints(E[0].start,b.end);this.toSingleRange(),this.setSelectionRange(g,b.cursor==b.start)}else{var S=this.session.documentToScreenPosition(this.cursor),k=this.session.documentToScreenPosition(this.anchor),D=this.rectangularRangeBlock(S,k);D.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(E,b,g){var S=[],k=E.column<b.column;if(k)var D=E.column,_=b.column,F=E.offsetX,A=b.offsetX;else var D=b.column,_=E.column,F=b.offsetX,A=E.offsetX;var $=E.row<b.row;if($)var w=E.row,C=b.row;else var w=b.row,C=E.row;D<0&&(D=0),w<0&&(w=0),w==C&&(g=!0);for(var T,I=w;I<=C;I++){var O=c.fromPoints(this.session.screenToDocumentPosition(I,D,F),this.session.screenToDocumentPosition(I,_,A));if(O.isEmpty()){if(T&&m(O.end,T))break;T=O.end}O.cursor=k?O.start:O.end,S.push(O)}if($&&S.reverse(),!g){for(var R=S.length-1;S[R].isEmpty()&&R>0;)R--;if(R>0)for(var P=0;S[P].isEmpty();)P++;for(var B=R;B>=P;B--)S[B].isEmpty()&&S.splice(B,1)}return S}}.call(d.prototype);var f=i("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(E){E.cursor||(E.cursor=E.end);var b=this.getSelectionStyle();return E.marker=this.session.addMarker(E,"ace_selection",b),this.session.$selectionMarkers.push(E),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,E},this.removeSelectionMarker=function(E){if(E.marker){this.session.removeMarker(E.marker);var b=this.session.$selectionMarkers.indexOf(E);b!=-1&&this.session.$selectionMarkers.splice(b,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(E){for(var b=this.session.$selectionMarkers,g=E.length;g--;){var S=E[g];if(S.marker){this.session.removeMarker(S.marker);var k=b.indexOf(S);k!=-1&&b.splice(k,1)}}this.session.selectionMarkerCount=b.length},this.$onAddRange=function(E){this.addSelectionMarker(E.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(E){this.removeSelectionMarkers(E.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(E){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(t.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(E){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(t.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(E){var b=E.command,g=E.editor;if(g.multiSelect){if(b.multiSelectAction)b.multiSelectAction=="forEach"?S=g.forEachSelection(b,E.args):b.multiSelectAction=="forEachLine"?S=g.forEachSelection(b,E.args,!0):b.multiSelectAction=="single"?(g.exitMultiSelectMode(),S=b.exec(g,E.args||{})):S=b.multiSelectAction(g,E.args||{});else{var S=b.exec(g,E.args||{});g.multiSelect.addRange(g.multiSelect.toOrientedRange()),g.multiSelect.mergeOverlappingRanges()}return S}},this.forEachSelection=function(E,b,g){if(!this.inVirtualSelectionMode){var S=g&&g.keepOrder,k=g==!0||g&&g.$byLines,D=this.session,_=this.selection,F=_.rangeList,A=(S?_:F).ranges,$;if(!A.length)return E.exec?E.exec(this,b||{}):E(this,b||{});var w=_._eventRegistry;_._eventRegistry={};var C=new d(D);this.inVirtualSelectionMode=!0;for(var T=A.length;T--;){if(k)for(;T>0&&A[T].start.row==A[T-1].end.row;)T--;C.fromOrientedRange(A[T]),C.index=T,this.selection=D.selection=C;var I=E.exec?E.exec(this,b||{}):E(this,b||{});!$&&I!==void 0&&($=I),C.toOrientedRange(A[T])}C.detach(),this.selection=D.selection=_,this.inVirtualSelectionMode=!1,_._eventRegistry=w,_.mergeOverlappingRanges(),_.ranges[0]&&_.fromOrientedRange(_.ranges[0]);var O=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),O&&O.from==O.to&&this.renderer.animateScrolling(O.from),$}},this.exitMultiSelectMode=function(){!this.inMultiSelectMode||this.inVirtualSelectionMode||this.multiSelect.toSingleRange()},this.getSelectedText=function(){var E="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var b=this.multiSelect.rangeList.ranges,g=[],S=0;S<b.length;S++)g.push(this.session.getTextRange(b[S]));var k=this.session.getDocument().getNewLineCharacter();E=g.join(k),E.length==(g.length-1)*k.length&&(E="")}else this.selection.isEmpty()||(E=this.session.getTextRange(this.getSelectionRange()));return E},this.$checkMultiselectChange=function(E,b){if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var g=this.multiSelect.ranges[0];if(this.multiSelect.isEmpty()&&b==this.multiSelect.anchor)return;var S=b==this.multiSelect.anchor?g.cursor==g.start?g.end:g.start:g.cursor;S.row!=b.row||this.session.$clipPositionToDocument(S.row,S.column).column!=b.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}},this.findAll=function(E,b,g){if(b=b||{},b.needle=E||b.needle,b.needle==null){var S=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();b.needle=this.session.getTextRange(S)}this.$search.set(b);var k=this.$search.findAll(this.session);if(!k.length)return 0;var D=this.multiSelect;g||D.toSingleRange(k[0]);for(var _=k.length;_--;)D.addRange(k[_],!0);return S&&D.rangeList.rangeAtPoint(S.start)&&D.addRange(S,!0),k.length},this.selectMoreLines=function(E,b){var g=this.selection.toOrientedRange(),S=g.cursor==g.end,k=this.session.documentToScreenPosition(g.cursor);this.selection.$desiredColumn&&(k.column=this.selection.$desiredColumn);var D=this.session.screenToDocumentPosition(k.row+E,k.column);if(g.isEmpty())var F=D;else var _=this.session.documentToScreenPosition(S?g.end:g.start),F=this.session.screenToDocumentPosition(_.row+E,_.column);if(S){var A=c.fromPoints(D,F);A.cursor=A.start}else{var A=c.fromPoints(F,D);A.cursor=A.end}if(A.desiredColumn=k.column,!this.selection.inMultiSelectMode)this.selection.addRange(g);else if(b)var $=g.cursor;this.selection.addRange(A),$&&this.selection.substractPoint($)},this.transposeSelections=function(E){for(var b=this.session,g=b.multiSelect,S=g.ranges,k=S.length;k--;){var D=S[k];if(D.isEmpty()){var _=b.getWordRange(D.start.row,D.start.column);D.start.row=_.start.row,D.start.column=_.start.column,D.end.row=_.end.row,D.end.column=_.end.column}}g.mergeOverlappingRanges();for(var F=[],k=S.length;k--;){var D=S[k];F.unshift(b.getTextRange(D))}E<0?F.unshift(F.pop()):F.push(F.shift());for(var k=S.length;k--;){var D=S[k],A=D.clone();b.replace(D,F[k]),D.start.row=A.start.row,D.start.column=A.start.column}g.fromOrientedRange(g.ranges[0])},this.selectMore=function(E,b,g){var S=this.session,k=S.multiSelect,D=k.toOrientedRange();if(!(D.isEmpty()&&(D=S.getWordRange(D.start.row,D.start.column),D.cursor=E==-1?D.start:D.end,this.multiSelect.addRange(D),g))){var _=S.getTextRange(D),F=a(S,_,E);F&&(F.cursor=E==-1?F.start:F.end,this.session.unfold(F),this.multiSelect.addRange(F),this.renderer.scrollCursorIntoView(null,.5)),b&&this.multiSelect.substractPoint(D.cursor)}},this.alignCursors=function(){var E=this.session,b=E.multiSelect,g=b.ranges,S=-1,k=g.filter(function(R){if(R.cursor.row==S)return!0;S=R.cursor.row});if(!g.length||k.length==g.length-1){var D=this.selection.getRange(),_=D.start.row,F=D.end.row,A=_==F;if(A){var $=this.session.getLength(),w;do w=this.session.getLine(F);while(/[=:]/.test(w)&&++F<$);do w=this.session.getLine(_);while(/[=:]/.test(w)&&--_>0);_<0&&(_=0),F>=$&&(F=$-1)}var C=this.session.removeFullLines(_,F);C=this.$reAlignText(C,A),this.session.insert({row:_,column:0},C.join(`
|
|
964
|
+
}`}),ace.define("ace/layer/decorators",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter"],function(i,l,v){var s=i("../lib/dom"),c=i("../lib/oop"),d=i("../lib/event_emitter").EventEmitter,o=function(){function p(e,t){this.renderer=t,this.pixelRatio=1,this.maxHeight=t.layerConfig.maxHeight,this.lineHeight=t.layerConfig.lineHeight,this.minDecorationHeight=2*this.pixelRatio|0,this.halfMinDecorationHeight=this.minDecorationHeight/2|0,this.colors={},this.colors.dark={error:"rgba(255, 18, 18, 1)",warning:"rgba(18, 136, 18, 1)",info:"rgba(18, 18, 136, 1)"},this.colors.light={error:"rgb(255,51,51)",warning:"rgb(32,133,72)",info:"rgb(35,68,138)"},this.setScrollBarV(e)}return p.prototype.$createCanvas=function(){this.canvas=s.createElement("canvas"),this.canvas.style.top="0px",this.canvas.style.right="0px",this.canvas.style.zIndex="7",this.canvas.style.position="absolute"},p.prototype.setScrollBarV=function(e){this.$createCanvas(),this.scrollbarV=e,e.element.appendChild(this.canvas),this.setDimensions()},p.prototype.$updateDecorators=function(e){if(typeof this.canvas.getContext!="function")return;var t=this.renderer.theme.isDark===!0?this.colors.dark:this.colors.light;this.setDimensions(e);var r=this.canvas.getContext("2d");function h($,C){return $.priority<C.priority?-1:$.priority>C.priority?1:0}var a=this.renderer.session.$annotations;if(r.clearRect(0,0,this.canvas.width,this.canvas.height),a){var u={info:1,warning:2,error:3};a.forEach(function($){$.priority=u[$.type]||null}),a=a.sort(h);for(var f=0;f<a.length;f++){var m=a[f].row,y=this.getVerticalOffsetForRow(m),x=y+this.lineHeight,E=Math.round(this.heightRatio*y),w=Math.round(this.heightRatio*x),g=Math.round((E+w)/2),S=w-g;S<this.halfMinDecorationHeight&&(S=this.halfMinDecorationHeight),g-S<0&&(g=S),g+S>this.canvasHeight&&(g=this.canvasHeight-S);var k=g-S,D=g+S,_=D-k;r.fillStyle=t[a[f].type]||null,r.fillRect(0,k,Math.round(this.oneZoneWidth-1),_)}}var F=this.renderer.session.selection.getCursor();if(F){var A=Math.round(this.getVerticalOffsetForRow(F.row)*this.heightRatio);r.fillStyle="rgba(0, 0, 0, 0.5)",r.fillRect(0,A,this.canvasWidth,2)}},p.prototype.getVerticalOffsetForRow=function(e){e=e|0;var t=this.renderer.session.documentToScreenRow(e,0)*this.lineHeight;return t},p.prototype.setDimensions=function(e){e=e||this.renderer.layerConfig,this.maxHeight=e.maxHeight,this.lineHeight=e.lineHeight,this.canvasHeight=e.height,this.canvasWidth=this.scrollbarV.width||this.canvasWidth,this.setZoneWidth(),this.canvas.width=this.canvasWidth,this.canvas.height=this.canvasHeight,this.maxHeight<this.canvasHeight?this.heightRatio=1:this.heightRatio=this.canvasHeight/this.maxHeight},p.prototype.setZoneWidth=function(){this.oneZoneWidth=this.canvasWidth},p.prototype.destroy=function(){this.canvas.parentNode.removeChild(this.canvas)},p}();c.implement(o.prototype,d),l.Decorator=o}),ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/scrollbar_custom","ace/scrollbar_custom","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter","ace/css/editor-css","ace/layer/decorators","ace/lib/useragent","ace/layer/text_util"],function(i,l,v){var s=i("./lib/oop"),c=i("./lib/dom"),d=i("./lib/lang"),o=i("./config"),p=i("./layer/gutter").Gutter,e=i("./layer/marker").Marker,t=i("./layer/text").Text,r=i("./layer/cursor").Cursor,h=i("./scrollbar").HScrollBar,a=i("./scrollbar").VScrollBar,u=i("./scrollbar_custom").HScrollBar,f=i("./scrollbar_custom").VScrollBar,m=i("./renderloop").RenderLoop,y=i("./layer/font_metrics").FontMetrics,x=i("./lib/event_emitter").EventEmitter,E=i("./css/editor-css"),w=i("./layer/decorators").Decorator,g=i("./lib/useragent"),S=i("./layer/text_util").isTextToken;c.importCssString(E,"ace_editor.css",!1);var k=function(){function D(_,F){var A=this;this.container=_||c.createElement("div"),c.addCssClass(this.container,"ace_editor"),c.HI_DPI&&c.addCssClass(this.container,"ace_hidpi"),this.setTheme(F),o.get("useStrictCSP")==null&&o.set("useStrictCSP",!1),this.$gutter=c.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden","true"),this.scroller=c.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=c.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new p(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new e(this.content);var $=this.$textLayer=new t(this.content);this.canvas=$.element,this.$markerFront=new e(this.content),this.$cursorLayer=new r(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new a(this.container,this),this.scrollBarH=new h(this.container,this),this.scrollBarV.on("scroll",function(C){A.$scrollAnimation||A.session.setScrollTop(C.data-A.scrollMargin.top)}),this.scrollBarH.on("scroll",function(C){A.$scrollAnimation||A.session.setScrollLeft(C.data-A.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new y(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.on("changeCharacterSize",function(C){A.updateCharacterSize(),A.onResize(!0,A.gutterWidth,A.$size.width,A.$size.height),A._signal("changeCharacterSize",C)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.margin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$keepTextAreaAtCursor=!g.isIOS,this.$loop=new m(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),this.$addResizeObserver(),o.resetOptions(this),o._signal("renderer",this)}return D.prototype.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin(),c.setStyle(this.scroller.style,"line-height",this.lineHeight+"px")},D.prototype.setSession=function(_){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=_,_&&this.scrollMargin.top&&_.getScrollTop()<=0&&_.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(_),this.$markerBack.setSession(_),this.$markerFront.setSession(_),this.$gutterLayer.setSession(_),this.$textLayer.setSession(_),_&&(this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode))},D.prototype.updateLines=function(_,F,A){if(F===void 0&&(F=1/0),this.$changedLines?(this.$changedLines.firstRow>_&&(this.$changedLines.firstRow=_),this.$changedLines.lastRow<F&&(this.$changedLines.lastRow=F)):this.$changedLines={firstRow:_,lastRow:F},this.$changedLines.lastRow<this.layerConfig.firstRow)if(A)this.$changedLines.lastRow=this.layerConfig.lastRow;else return;this.$changedLines.firstRow>this.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},D.prototype.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},D.prototype.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},D.prototype.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},D.prototype.updateFull=function(_){_?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},D.prototype.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},D.prototype.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},D.prototype.onResize=function(_,F,A,$){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=_?1:0;var C=this.container;$||($=C.clientHeight||C.scrollHeight),!$&&this.$maxLines&&this.lineHeight>1&&(!C.style.height||C.style.height=="0px")&&(C.style.height="1px",$=C.clientHeight||C.scrollHeight),A||(A=C.clientWidth||C.scrollWidth);var b=this.$updateCachedSize(_,F,A,$);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!A&&!$)return this.resizing=0;_&&(this.$gutterLayer.$padding=null),_?this.$renderChanges(b|this.$changes,!0):this.$loop.schedule(b|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.$customScrollbar&&this.$updateCustomScrollbar(!0)}},D.prototype.$updateCachedSize=function(_,F,A,$){$-=this.$extraHeight||0;var C=0,b=this.$size,T={width:b.width,height:b.height,scrollerHeight:b.scrollerHeight,scrollerWidth:b.scrollerWidth};if($&&(_||b.height!=$)&&(b.height=$,C|=this.CHANGE_SIZE,b.scrollerHeight=b.height,this.$horizScroll&&(b.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.setHeight(b.scrollerHeight),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",C=C|this.CHANGE_SCROLL),A&&(_||b.width!=A)){C|=this.CHANGE_SIZE,b.width=A,F==null&&(F=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=F,c.setStyle(this.scrollBarH.element.style,"left",F+"px"),c.setStyle(this.scroller.style,"left",F+this.margin.left+"px"),b.scrollerWidth=Math.max(0,A-F-this.scrollBarV.getWidth()-this.margin.h),c.setStyle(this.$gutter.style,"left",this.margin.left+"px");var I=this.scrollBarV.getWidth()+"px";c.setStyle(this.scrollBarH.element.style,"right",I),c.setStyle(this.scroller.style,"right",I),c.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(b.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||_)&&(C|=this.CHANGE_FULL)}return b.$dirty=!A||!$,C&&this._signal("resize",T),C},D.prototype.onGutterResize=function(_){var F=this.$showGutter?_:0;F!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,F,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()?this.$loop.schedule(this.CHANGE_FULL):this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},D.prototype.adjustWrapLimit=function(){var _=this.$size.scrollerWidth-this.$padding*2,F=Math.floor(_/this.characterWidth);return this.session.adjustWrapLimit(F,this.$showPrintMargin&&this.$printMarginColumn)},D.prototype.setAnimatedScroll=function(_){this.setOption("animatedScroll",_)},D.prototype.getAnimatedScroll=function(){return this.$animatedScroll},D.prototype.setShowInvisibles=function(_){this.setOption("showInvisibles",_),this.session.$bidiHandler.setShowInvisibles(_)},D.prototype.getShowInvisibles=function(){return this.getOption("showInvisibles")},D.prototype.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},D.prototype.setDisplayIndentGuides=function(_){this.setOption("displayIndentGuides",_)},D.prototype.getHighlightIndentGuides=function(){return this.getOption("highlightIndentGuides")},D.prototype.setHighlightIndentGuides=function(_){this.setOption("highlightIndentGuides",_)},D.prototype.setShowPrintMargin=function(_){this.setOption("showPrintMargin",_)},D.prototype.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},D.prototype.setPrintMarginColumn=function(_){this.setOption("printMarginColumn",_)},D.prototype.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},D.prototype.getShowGutter=function(){return this.getOption("showGutter")},D.prototype.setShowGutter=function(_){return this.setOption("showGutter",_)},D.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},D.prototype.setFadeFoldWidgets=function(_){this.setOption("fadeFoldWidgets",_)},D.prototype.setHighlightGutterLine=function(_){this.setOption("highlightGutterLine",_)},D.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},D.prototype.$updatePrintMargin=function(){if(!(!this.$showPrintMargin&&!this.$printMarginEl)){if(!this.$printMarginEl){var _=c.createElement("div");_.className="ace_layer ace_print-margin-layer",this.$printMarginEl=c.createElement("div"),this.$printMarginEl.className="ace_print-margin",_.appendChild(this.$printMarginEl),this.content.insertBefore(_,this.content.firstChild)}var F=this.$printMarginEl.style;F.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",F.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&this.session.$wrap==-1&&this.adjustWrapLimit()}},D.prototype.getContainerElement=function(){return this.container},D.prototype.getMouseEventTarget=function(){return this.scroller},D.prototype.getTextAreaContainer=function(){return this.container},D.prototype.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var _=this.textarea.style,F=this.$composition;if(!this.$keepTextAreaAtCursor&&!F){c.translate(this.textarea,-100,0);return}var A=this.$cursorLayer.$pixelPos;if(A){F&&F.markerRange&&(A=this.$cursorLayer.getPixelPosition(F.markerRange.start,!0));var $=this.layerConfig,C=A.top,b=A.left;C-=$.offset;var T=F&&F.useTextareaForIME||g.isMobile?this.lineHeight:1;if(C<0||C>$.height-T){c.translate(this.textarea,0,0);return}var I=1,O=this.$size.height-T;if(!F)C+=this.lineHeight;else if(F.useTextareaForIME){var N=this.textarea.value;I=this.characterWidth*this.session.$getStringScreenWidth(N)[0]}else C+=this.lineHeight+2;b-=this.scrollLeft,b>this.$size.scrollerWidth-I&&(b=this.$size.scrollerWidth-I),b+=this.gutterWidth+this.margin.left,c.setStyle(_,"height",T+"px"),c.setStyle(_,"width",I+"px"),c.translate(this.textarea,Math.min(b,this.$size.scrollerWidth-I),Math.min(C,O))}}},D.prototype.getFirstVisibleRow=function(){return this.layerConfig.firstRow},D.prototype.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},D.prototype.getLastFullyVisibleRow=function(){var _=this.layerConfig,F=_.lastRow,A=this.session.documentToScreenRow(F,0)*_.lineHeight;return A-this.session.getScrollTop()>_.height-_.lineHeight?F-1:F},D.prototype.getLastVisibleRow=function(){return this.layerConfig.lastRow},D.prototype.setPadding=function(_){this.$padding=_,this.$textLayer.setPadding(_),this.$cursorLayer.setPadding(_),this.$markerFront.setPadding(_),this.$markerBack.setPadding(_),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},D.prototype.setScrollMargin=function(_,F,A,$){var C=this.scrollMargin;C.top=_|0,C.bottom=F|0,C.right=$|0,C.left=A|0,C.v=C.top+C.bottom,C.h=C.left+C.right,C.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-C.top),this.updateFull()},D.prototype.setMargin=function(_,F,A,$){var C=this.margin;C.top=_|0,C.bottom=F|0,C.right=$|0,C.left=A|0,C.v=C.top+C.bottom,C.h=C.left+C.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},D.prototype.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},D.prototype.setHScrollBarAlwaysVisible=function(_){this.setOption("hScrollBarAlwaysVisible",_)},D.prototype.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},D.prototype.setVScrollBarAlwaysVisible=function(_){this.setOption("vScrollBarAlwaysVisible",_)},D.prototype.$updateScrollBarV=function(){var _=this.layerConfig.maxHeight,F=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(_-=(F-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>_-F&&(_=this.scrollTop+F,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(_+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},D.prototype.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},D.prototype.freeze=function(){this.$frozen=!0},D.prototype.unfreeze=function(){this.$frozen=!1},D.prototype.$renderChanges=function(_,F){if(this.$changes&&(_|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!_&&!F){this.$changes|=_;return}if(this.$size.$dirty)return this.$changes|=_,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",_),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var A=this.layerConfig;if(_&this.CHANGE_FULL||_&this.CHANGE_SIZE||_&this.CHANGE_TEXT||_&this.CHANGE_LINES||_&this.CHANGE_SCROLL||_&this.CHANGE_H_SCROLL){if(_|=this.$computeLayerConfig()|this.$loop.clear(),A.firstRow!=this.layerConfig.firstRow&&A.firstRowScreen==this.layerConfig.firstRowScreen){var $=this.scrollTop+(A.firstRow-Math.max(this.layerConfig.firstRow,0))*this.lineHeight;$>0&&(this.scrollTop=$,_=_|this.CHANGE_SCROLL,_|=this.$computeLayerConfig()|this.$loop.clear())}A=this.layerConfig,this.$updateScrollBarV(),_&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),c.translate(this.content,-this.scrollLeft,-A.offset);var C=A.width+2*this.$padding+"px",b=A.minHeight+"px";c.setStyle(this.content.style,"width",C),c.setStyle(this.content.style,"height",b)}if(_&this.CHANGE_H_SCROLL&&(c.translate(this.content,-this.scrollLeft,-A.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller ":"ace_scroller ace_scroll-left ",this.enableKeyboardAccessibility&&(this.scroller.className+=this.keyboardFocusClassName)),_&this.CHANGE_FULL){this.$changedLines=null,this.$textLayer.update(A),this.$showGutter&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A),this.$markerBack.update(A),this.$markerFront.update(A),this.$cursorLayer.update(A),this.$moveTextAreaToCursor(),this._signal("afterRender",_);return}if(_&this.CHANGE_SCROLL){this.$changedLines=null,_&this.CHANGE_TEXT||_&this.CHANGE_LINES?this.$textLayer.update(A):this.$textLayer.scrollLines(A),this.$showGutter&&(_&this.CHANGE_GUTTER||_&this.CHANGE_LINES?this.$gutterLayer.update(A):this.$gutterLayer.scrollLines(A)),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A),this.$markerBack.update(A),this.$markerFront.update(A),this.$cursorLayer.update(A),this.$moveTextAreaToCursor(),this._signal("afterRender",_);return}_&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(A),this.$showGutter&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)):_&this.CHANGE_LINES?((this.$updateLines()||_&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)):_&this.CHANGE_TEXT||_&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)):_&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)),_&this.CHANGE_CURSOR&&(this.$cursorLayer.update(A),this.$moveTextAreaToCursor()),_&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(A),_&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(A),this._signal("afterRender",_)},D.prototype.$autosize=function(){var _=this.session.getScreenLength()*this.lineHeight,F=this.$maxLines*this.lineHeight,A=Math.min(F,Math.max((this.$minLines||1)*this.lineHeight,_))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(A+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&A>this.$maxPixelHeight&&(A=this.$maxPixelHeight);var $=A<=2*this.lineHeight,C=!$&&_>F;if(A!=this.desiredHeight||this.$size.height!=this.desiredHeight||C!=this.$vScroll){C!=this.$vScroll&&(this.$vScroll=C,this.scrollBarV.setVisible(C));var b=this.container.clientWidth;this.container.style.height=A+"px",this.$updateCachedSize(!0,this.$gutterWidth,b,A),this.desiredHeight=A,this._signal("autosize")}},D.prototype.$computeLayerConfig=function(){var _=this.session,F=this.$size,A=F.height<=2*this.lineHeight,$=this.session.getScreenLength(),C=$*this.lineHeight,b=this.$getLongestLine(),T=!A&&(this.$hScrollBarAlwaysVisible||F.scrollerWidth-b-2*this.$padding<0),I=this.$horizScroll!==T;I&&(this.$horizScroll=T,this.scrollBarH.setVisible(T));var O=this.$vScroll;this.$maxLines&&this.lineHeight>1&&(this.$autosize(),A=F.height<=2*this.lineHeight);var N=F.scrollerHeight+this.lineHeight,P=!this.$maxLines&&this.$scrollPastEnd?(F.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;C+=P;var B=this.scrollMargin;this.session.setScrollTop(Math.max(-B.top,Math.min(this.scrollTop,C-F.scrollerHeight+B.bottom))),this.session.setScrollLeft(Math.max(-B.left,Math.min(this.scrollLeft,b+2*this.$padding-F.scrollerWidth+B.right)));var V=!A&&(this.$vScrollBarAlwaysVisible||F.scrollerHeight-C+P<0||this.scrollTop>B.top),W=O!==V;W&&(this.$vScroll=V,this.scrollBarV.setVisible(V));var z=this.scrollTop%this.lineHeight,U=Math.ceil(N/this.lineHeight)-1,G=Math.max(0,Math.round((this.scrollTop-z)/this.lineHeight)),Y=G+U,Q,q,te=this.lineHeight;G=_.screenToDocumentRow(G,0);var re=_.getFoldLine(G);re&&(G=re.start.row),Q=_.documentToScreenRow(G,0),q=_.getRowLength(G)*te,Y=Math.min(_.screenToDocumentRow(Y,0),_.getLength()-1),N=F.scrollerHeight+_.getRowLength(Y)*te+q,z=this.scrollTop-Q*te,z<0&&Q>0&&(Q=Math.max(0,Q+Math.floor(z/te)),z=this.scrollTop-Q*te);var ue=0;return(this.layerConfig.width!=b||I)&&(ue=this.CHANGE_H_SCROLL),(I||W)&&(ue|=this.$updateCachedSize(!0,this.gutterWidth,F.width,F.height),this._signal("scrollbarVisibilityChanged"),W&&(b=this.$getLongestLine())),this.layerConfig={width:b,padding:this.$padding,firstRow:G,firstRowScreen:Q,lastRow:Y,lineHeight:te,characterWidth:this.characterWidth,minHeight:N,maxHeight:C,offset:z,gutterOffset:te?Math.max(0,Math.ceil((z+F.height-F.scrollerHeight)/te)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(b-this.$padding),ue},D.prototype.$updateLines=function(){if(this.$changedLines){var _=this.$changedLines.firstRow,F=this.$changedLines.lastRow;this.$changedLines=null;var A=this.layerConfig;if(!(_>A.lastRow+1)&&!(F<A.firstRow)){if(F===1/0){this.$showGutter&&this.$gutterLayer.update(A),this.$textLayer.update(A);return}return this.$textLayer.updateLines(A,_,F),!0}}},D.prototype.$getLongestLine=function(){var _=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(_+=1),this.$textLayer&&_>this.$textLayer.MAX_LINE_LENGTH&&(_=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(_*this.characterWidth))},D.prototype.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},D.prototype.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},D.prototype.addGutterDecoration=function(_,F){this.$gutterLayer.addGutterDecoration(_,F)},D.prototype.removeGutterDecoration=function(_,F){this.$gutterLayer.removeGutterDecoration(_,F)},D.prototype.updateBreakpoints=function(_){this._rows=_,this.$loop.schedule(this.CHANGE_GUTTER)},D.prototype.setAnnotations=function(_){this.$gutterLayer.setAnnotations(_),this.$loop.schedule(this.CHANGE_GUTTER)},D.prototype.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},D.prototype.hideCursor=function(){this.$cursorLayer.hideCursor()},D.prototype.showCursor=function(){this.$cursorLayer.showCursor()},D.prototype.scrollSelectionIntoView=function(_,F,A){this.scrollCursorIntoView(_,A),this.scrollCursorIntoView(F,A)},D.prototype.scrollCursorIntoView=function(_,F,A){if(this.$size.scrollerHeight!==0){var $=this.$cursorLayer.getPixelPosition(_),C=$.left,b=$.top,T=A&&A.top||0,I=A&&A.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var O=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;O+T>b?(F&&O+T>b+this.lineHeight&&(b-=F*this.$size.scrollerHeight),b===0&&(b=-this.scrollMargin.top),this.session.setScrollTop(b)):O+this.$size.scrollerHeight-I<b+this.lineHeight&&(F&&O+this.$size.scrollerHeight-I<b-this.lineHeight&&(b+=F*this.$size.scrollerHeight),this.session.setScrollTop(b+this.lineHeight+I-this.$size.scrollerHeight));var N=this.scrollLeft,P=2*this.layerConfig.characterWidth;C-P<N?(C-=P,C<this.$padding+P&&(C=-this.scrollMargin.left),this.session.setScrollLeft(C)):(C+=P,N+this.$size.scrollerWidth<C+this.characterWidth?this.session.setScrollLeft(Math.round(C+this.characterWidth-this.$size.scrollerWidth)):N<=this.$padding&&C-N<this.characterWidth&&this.session.setScrollLeft(0))}},D.prototype.getScrollTop=function(){return this.session.getScrollTop()},D.prototype.getScrollLeft=function(){return this.session.getScrollLeft()},D.prototype.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},D.prototype.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},D.prototype.scrollToRow=function(_){this.session.setScrollTop(_*this.lineHeight)},D.prototype.alignCursor=function(_,F){typeof _=="number"&&(_={row:_,column:0});var A=this.$cursorLayer.getPixelPosition(_),$=this.$size.scrollerHeight-this.lineHeight,C=A.top-$*(F||0);return this.session.setScrollTop(C),C},D.prototype.$calcSteps=function(_,F){var A=0,$=this.STEPS,C=[],b=function(T,I,O){return O*(Math.pow(T-1,3)+1)+I};for(A=0;A<$;++A)C.push(b(A/this.STEPS,_,F-_));return C},D.prototype.scrollToLine=function(_,F,A,$){var C=this.$cursorLayer.getPixelPosition({row:_,column:0}),b=C.top;F&&(b-=this.$size.scrollerHeight/2);var T=this.scrollTop;this.session.setScrollTop(b),A!==!1&&this.animateScrolling(T,$)},D.prototype.animateScrolling=function(_,F){var A=this.scrollTop;if(!this.$animatedScroll)return;var $=this;if(_==A)return;if(this.$scrollAnimation){var C=this.$scrollAnimation.steps;if(C.length&&(_=C[0],_==A))return}var b=$.$calcSteps(_,A);this.$scrollAnimation={from:_,to:A,steps:b},clearInterval(this.$timer),$.session.setScrollTop(b.shift()),$.session.$scrollTop=A;function T(){$.$timer=clearInterval($.$timer),$.$scrollAnimation=null,$.$stopAnimation=!1,F&&F()}this.$timer=setInterval(function(){if($.$stopAnimation){T();return}if(!$.session)return clearInterval($.$timer);b.length?($.session.setScrollTop(b.shift()),$.session.$scrollTop=A):A!=null?($.session.$scrollTop=-1,$.session.setScrollTop(A),A=null):T()},10)},D.prototype.scrollToY=function(_){this.scrollTop!==_&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=_)},D.prototype.scrollToX=function(_){this.scrollLeft!==_&&(this.scrollLeft=_),this.$loop.schedule(this.CHANGE_H_SCROLL)},D.prototype.scrollTo=function(_,F){this.session.setScrollTop(F),this.session.setScrollLeft(_)},D.prototype.scrollBy=function(_,F){F&&this.session.setScrollTop(this.session.getScrollTop()+F),_&&this.session.setScrollLeft(this.session.getScrollLeft()+_)},D.prototype.isScrollableBy=function(_,F){if(F<0&&this.session.getScrollTop()>=1-this.scrollMargin.top||F>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||_<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||_>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},D.prototype.pixelToScreenCoordinates=function(_,F){var A;if(this.$hasCssTransforms){A={top:0,left:0};var $=this.$fontMetrics.transformCoordinates([_,F]);_=$[1]-this.gutterWidth-this.margin.left,F=$[0]}else A=this.scroller.getBoundingClientRect();var C=_+this.scrollLeft-A.left-this.$padding,b=C/this.characterWidth,T=Math.floor((F+this.scrollTop-A.top)/this.lineHeight),I=this.$blockCursor?Math.floor(b):Math.round(b);return{row:T,column:I,side:b-I>0?1:-1,offsetX:C}},D.prototype.screenToTextCoordinates=function(_,F){var A;if(this.$hasCssTransforms){A={top:0,left:0};var $=this.$fontMetrics.transformCoordinates([_,F]);_=$[1]-this.gutterWidth-this.margin.left,F=$[0]}else A=this.scroller.getBoundingClientRect();var C=_+this.scrollLeft-A.left-this.$padding,b=C/this.characterWidth,T=this.$blockCursor?Math.floor(b):Math.round(b),I=Math.floor((F+this.scrollTop-A.top)/this.lineHeight);return this.session.screenToDocumentPosition(I,Math.max(T,0),C)},D.prototype.textToScreenCoordinates=function(_,F){var A=this.scroller.getBoundingClientRect(),$=this.session.documentToScreenPosition(_,F),C=this.$padding+(this.session.$bidiHandler.isBidiRow($.row,_)?this.session.$bidiHandler.getPosLeft($.column):Math.round($.column*this.characterWidth)),b=$.row*this.lineHeight;return{pageX:A.left+C-this.scrollLeft,pageY:A.top+b-this.scrollTop}},D.prototype.visualizeFocus=function(){c.addCssClass(this.container,"ace_focus")},D.prototype.visualizeBlur=function(){c.removeCssClass(this.container,"ace_focus")},D.prototype.showComposition=function(_){this.$composition=_,_.cssText||(_.cssText=this.textarea.style.cssText),_.useTextareaForIME==null&&(_.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(c.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):_.markerId=this.session.addMarker(_.markerRange,"ace_composition_marker","text")},D.prototype.setCompositionText=function(_){var F=this.session.selection.cursor;this.addToken(_,"composition_placeholder",F.row,F.column),this.$moveTextAreaToCursor()},D.prototype.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),c.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var _=this.session.selection.cursor;this.removeExtraToken(_.row,_.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},D.prototype.setGhostText=function(_,F){var A=this.session.selection.cursor,$=F||{row:A.row,column:A.column};this.removeGhostText();var C=this.$calculateWrappedTextChunks(_,$);this.addToken(C[0].text,"ghost_text",$.row,$.column),this.$ghostText={text:_,position:{row:$.row,column:$.column}};var b=c.createElement("div");if(C.length>1){var T=this.hideTokensAfterPosition($.row,$.column),I;C.slice(1).forEach(function(W){var z=c.createElement("div"),U=c.createElement("span");U.className="ace_ghost_text",W.wrapped&&(z.className="ghost_text_line_wrapped"),W.text.length===0&&(W.text=" "),U.appendChild(c.createTextNode(W.text)),z.appendChild(U),b.appendChild(z),I=z}),T.forEach(function(W){var z=c.createElement("span");S(W.type)||(z.className="ace_"+W.type.replace(/\./g," ace_")),z.appendChild(c.createTextNode(W.value)),I.appendChild(z)}),this.$ghostTextWidget={el:b,row:$.row,column:$.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var O=this.$cursorLayer.getPixelPosition($,!0),N=this.container,P=N.getBoundingClientRect().height,B=C.length*this.lineHeight,V=B<P-O.top;if(V)return;B<P?this.scrollBy(0,(C.length-1)*this.lineHeight):this.scrollToRow($.row)}},D.prototype.$calculateWrappedTextChunks=function(_,F){var A=this.$size.scrollerWidth-this.$padding*2,$=Math.floor(A/this.characterWidth)-2;$=$<=0?60:$;for(var C=_.split(/\r?\n/),b=[],T=0;T<C.length;T++){var I=this.session.$getDisplayTokens(C[T],F.column),O=this.session.$computeWrapSplits(I,$,this.session.$tabSize);if(O.length>0){var N=0;O.push(C[T].length);for(var P=0;P<O.length;P++){var B=C[T].slice(N,O[P]);b.push({text:B,wrapped:!0}),N=O[P]}}else b.push({text:C[T],wrapped:!1})}return b},D.prototype.removeGhostText=function(){if(this.$ghostText){var _=this.$ghostText.position;this.removeExtraToken(_.row,_.column),this.$ghostTextWidget&&(this.session.widgetManager.removeLineWidget(this.$ghostTextWidget),this.$ghostTextWidget=null),this.$ghostText=null}},D.prototype.addToken=function(_,F,A,$){var C=this.session;C.bgTokenizer.lines[A]=null;var b={type:F,value:_},T=C.getTokens(A);if($==null||!T.length)T.push(b);else for(var I=0,O=0;O<T.length;O++){var N=T[O];if(I+=N.value.length,$<=I){var P=N.value.length-(I-$),B=N.value.slice(0,P),V=N.value.slice(P);T.splice(O,1,{type:N.type,value:B},b,{type:N.type,value:V});break}}this.updateLines(A,A)},D.prototype.hideTokensAfterPosition=function(_,F){for(var A=this.session.getTokens(_),$=0,C=!1,b=[],T=0;T<A.length;T++){var I=A[T];if($+=I.value.length,I.type!=="ghost_text"){if(C){b.push({type:I.type,value:I.value}),I.type="hidden_token";continue}$===F&&(C=!0)}}return this.updateLines(_,_),b},D.prototype.removeExtraToken=function(_,F){this.session.bgTokenizer.lines[_]=null,this.updateLines(_,_)},D.prototype.setTheme=function(_,F){var A=this;if(this.$themeId=_,A._dispatchEvent("themeChange",{theme:_}),!_||typeof _=="string"){var $=_||this.$options.theme.initialValue;o.loadModule(["theme",$],C)}else C(_);function C(b){if(A.$themeId!=_)return F&&F();if(!b||!b.cssClass)throw new Error("couldn't load module "+_+" or it didn't call define");b.$id&&(A.$themeId=b.$id),c.importCssString(b.cssText,b.cssClass,A.container),A.theme&&c.removeCssClass(A.container,A.theme.cssClass);var T="padding"in b?b.padding:"padding"in(A.theme||{})?4:A.$padding;A.$padding&&T!=A.$padding&&A.setPadding(T),A.$theme=b.cssClass,A.theme=b,c.addCssClass(A.container,b.cssClass),c.setCssClass(A.container,"ace_dark",b.isDark),A.$size&&(A.$size.width=0,A.$updateSizeAsync()),A._dispatchEvent("themeLoaded",{theme:b}),F&&F(),g.isSafari&&A.scroller&&(A.scroller.style.background="red",A.scroller.style.background="")}},D.prototype.getTheme=function(){return this.$themeId},D.prototype.setStyle=function(_,F){c.setCssClass(this.container,_,F!==!1)},D.prototype.unsetStyle=function(_){c.removeCssClass(this.container,_)},D.prototype.setCursorStyle=function(_){c.setStyle(this.scroller.style,"cursor",_)},D.prototype.setMouseCursor=function(_){c.setStyle(this.scroller.style,"cursor",_)},D.prototype.attachToShadowRoot=function(){c.importCssString(E,"ace_editor.css",this.container)},D.prototype.destroy=function(){this.freeze(),this.$fontMetrics.destroy(),this.$cursorLayer.destroy(),this.removeAllListeners(),this.container.textContent="",this.setOption("useResizeObserver",!1)},D.prototype.$updateCustomScrollbar=function(_){var F=this;this.$horizScroll=this.$vScroll=null,this.scrollBarV.element.remove(),this.scrollBarH.element.remove(),_===!0?(this.scrollBarV=new f(this.container,this),this.scrollBarH=new u(this.container,this),this.scrollBarV.setHeight(this.$size.scrollerHeight),this.scrollBarH.setWidth(this.$size.scrollerWidth),this.scrollBarV.addEventListener("scroll",function(A){F.$scrollAnimation||F.session.setScrollTop(A.data-F.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(A){F.$scrollAnimation||F.session.setScrollLeft(A.data-F.scrollMargin.left)}),this.$scrollDecorator?(this.$scrollDecorator.setScrollBarV(this.scrollBarV),this.$scrollDecorator.$updateDecorators()):(this.$scrollDecorator=new w(this.scrollBarV,this),this.$scrollDecorator.$updateDecorators())):(this.scrollBarV=new a(this.container,this),this.scrollBarH=new h(this.container,this),this.scrollBarV.addEventListener("scroll",function(A){F.$scrollAnimation||F.session.setScrollTop(A.data-F.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(A){F.$scrollAnimation||F.session.setScrollLeft(A.data-F.scrollMargin.left)}))},D.prototype.$addResizeObserver=function(){if(!(!window.ResizeObserver||this.$resizeObserver)){var _=this;this.$resizeTimer=d.delayedCall(function(){_.destroyed||_.onResize()},50),this.$resizeObserver=new window.ResizeObserver(function(F){var A=F[0].contentRect.width,$=F[0].contentRect.height;Math.abs(_.$size.width-A)>1||Math.abs(_.$size.height-$)>1?_.$resizeTimer.delay():_.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},D}();k.prototype.CHANGE_CURSOR=1,k.prototype.CHANGE_MARKER=2,k.prototype.CHANGE_GUTTER=4,k.prototype.CHANGE_SCROLL=8,k.prototype.CHANGE_LINES=16,k.prototype.CHANGE_TEXT=32,k.prototype.CHANGE_SIZE=64,k.prototype.CHANGE_MARKER_BACK=128,k.prototype.CHANGE_MARKER_FRONT=256,k.prototype.CHANGE_FULL=512,k.prototype.CHANGE_H_SCROLL=1024,k.prototype.$changes=0,k.prototype.$padding=null,k.prototype.$frozen=!1,k.prototype.STEPS=8,s.implement(k.prototype,x),o.defineOptions(k.prototype,"renderer",{useResizeObserver:{set:function(D){!D&&this.$resizeObserver?(this.$resizeObserver.disconnect(),this.$resizeTimer.cancel(),this.$resizeTimer=this.$resizeObserver=null):D&&!this.$resizeObserver&&this.$addResizeObserver()}},animatedScroll:{initialValue:!1},showInvisibles:{set:function(D){this.$textLayer.setShowInvisibles(D)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(D){typeof D=="number"&&(this.$printMarginColumn=D),this.$showPrintMargin=!!D,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(D){this.$gutter.style.display=D?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},useSvgGutterIcons:{set:function(D){this.$gutterLayer.$useSvgGutterIcons=D},initialValue:!1},showFoldedAnnotations:{set:function(D){this.$gutterLayer.$showFoldedAnnotations=D},initialValue:!1},fadeFoldWidgets:{set:function(D){c.setCssClass(this.$gutter,"ace_fade-fold-widgets",D)},initialValue:!1},showFoldWidgets:{set:function(D){this.$gutterLayer.setShowFoldWidgets(D),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(D){this.$textLayer.setDisplayIndentGuides(D)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightIndentGuides:{set:function(D){this.$textLayer.setHighlightIndentGuides(D)==!0?this.$textLayer.$highlightIndentGuide():this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells)},initialValue:!0},highlightGutterLine:{set:function(D){this.$gutterLayer.setHighlightGutterLine(D),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(D){(!this.$hScrollBarAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(D){(!this.$vScrollBarAlwaysVisible||!this.$vScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(D){typeof D=="number"&&(D=D+"px"),this.container.style.fontSize=D,this.updateFontSize()},initialValue:12},fontFamily:{set:function(D){this.container.style.fontFamily=D,this.updateFontSize()}},maxLines:{set:function(D){this.updateFull()}},minLines:{set:function(D){this.$minLines<562949953421311||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(D){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(D){D=+D||0,this.$scrollPastEnd!=D&&(this.$scrollPastEnd=D,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(D){this.$gutterLayer.$fixedWidth=!!D,this.$loop.schedule(this.CHANGE_GUTTER)}},customScrollbar:{set:function(D){this.$updateCustomScrollbar(D)},initialValue:!1},theme:{set:function(D){this.setTheme(D)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!g.isMobile&&!g.isIE}}),l.VirtualRenderer=k}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(i,l,v){var s=i("../lib/oop"),c=i("../lib/net"),d=i("../lib/event_emitter").EventEmitter,o=i("../config");function p(h){var a="importScripts('"+c.qualifyURL(h)+"');";try{return new Blob([a],{type:"application/javascript"})}catch{var u=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,f=new u;return f.append(a),f.getBlob("application/javascript")}}function e(h){if(typeof Worker>"u")return{postMessage:function(){},terminate:function(){}};if(o.get("loadWorkerFromBlob")){var a=p(h),u=window.URL||window.webkitURL,f=u.createObjectURL(a);return new Worker(f)}return new Worker(h)}var t=function(h){h.postMessage||(h=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=h,this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){s.implement(this,d),this.$createWorkerFromOldConfig=function(h,a,u,f,m){if(i.nameToUrl&&!i.toUrl&&(i.toUrl=i.nameToUrl),o.get("packaged")||!i.toUrl)f=f||o.moduleUrl(a,"worker");else{var y=this.$normalizePath;f=f||y(i.toUrl("ace/worker/worker.js",null,"_"));var x={};h.forEach(function(E){x[E]=y(i.toUrl(E,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=e(f),m&&this.send("importScripts",m),this.$worker.postMessage({init:!0,tlns:x,module:a,classname:u}),this.$worker},this.onMessage=function(h){var a=h.data;switch(a.type){case"event":this._signal(a.name,{data:a.data});break;case"call":var u=this.callbacks[a.id];u&&(u(a.data),delete this.callbacks[a.id]);break;case"error":this.reportError(a.data);break;case"log":window.console&&console.log&&console.log.apply(console,a.data);break}},this.reportError=function(h){window.console&&console.error&&console.error(h)},this.$normalizePath=function(h){return c.qualifyURL(h)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker.onerror=function(h){h.preventDefault()},this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(h,a){this.$worker.postMessage({command:h,args:a})},this.call=function(h,a,u){if(u){var f=this.callbackId++;this.callbacks[f]=u,a.push(f)}this.send(h,a)},this.emit=function(h,a){try{a.data&&a.data.err&&(a.data.err={message:a.data.err.message,stack:a.data.err.stack,code:a.data.err.code}),this.$worker&&this.$worker.postMessage({event:h,data:{data:a.data}})}catch(u){console.error(u.stack)}},this.attachToDocument=function(h){this.$doc&&this.terminate(),this.$doc=h,this.call("setValue",[h.getValue()]),h.on("change",this.changeListener,!0)},this.changeListener=function(h){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),h.action=="insert"?this.deltaQueue.push(h.start,h.lines):this.deltaQueue.push(h.start,h.end)},this.$sendDeltaQueue=function(){var h=this.deltaQueue;h&&(this.deltaQueue=null,h.length>50&&h.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:h}))}}).call(t.prototype);var r=function(h,a,u){var f=null,m=!1,y=Object.create(d),x=[],E=new t({messageBuffer:x,terminate:function(){},postMessage:function(g){x.push(g),f&&(m?setTimeout(w):w())}});E.setEmitSync=function(g){m=g};var w=function(){var g=x.shift();g.command?f[g.command].apply(f,g.args):g.event&&y._signal(g.event,g.data)};return y.postMessage=function(g){E.onMessage({data:g})},y.callback=function(g,S){this.postMessage({type:"call",id:S,data:g})},y.emit=function(g,S){this.postMessage({type:"event",name:g,data:S})},o.loadModule(["worker",a],function(g){for(f=new g[u](y);x.length;)w()}),E};l.UIWorkerClient=r,l.WorkerClient=t,l.createWorker=e}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(i,l,v){var s=i("./range").Range,c=i("./lib/event_emitter").EventEmitter,d=i("./lib/oop"),o=function(){function p(e,t,r,h,a,u){var f=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=a,this.othersClass=u,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=h,this.$onCursorChange=function(){setTimeout(function(){f.onCursorChange()})},this.$pos=r;var m=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=m.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)}return p.prototype.setup=function(){var e=this,t=this.doc,r=this.session;this.selectionBefore=r.selection.toJSON(),r.selection.inMultiSelectMode&&r.selection.toSingleRange(),this.pos=t.createAnchor(this.$pos.row,this.$pos.column);var h=this.pos;h.$insertRight=!0,h.detach(),h.markerId=r.addMarker(new s(h.row,h.column,h.row,h.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(a){var u=t.createAnchor(a.row,a.column);u.$insertRight=!0,u.detach(),e.others.push(u)}),r.setUndoSelect(!1)},p.prototype.showOtherMarkers=function(){if(!this.othersActive){var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(r){r.markerId=e.addMarker(new s(r.row,r.column,r.row,r.column+t.length),t.othersClass,null,!1)})}},p.prototype.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var e=0;e<this.others.length;e++)this.session.removeMarker(this.others[e].markerId)}},p.prototype.onUpdate=function(e){if(this.$updating)return this.updateAnchors(e);var t=e;if(t.start.row===t.end.row&&t.start.row===this.pos.row){this.$updating=!0;var r=e.action==="insert"?t.end.column-t.start.column:t.start.column-t.end.column,h=t.start.column>=this.pos.column&&t.start.column<=this.pos.column+this.length+1,a=t.start.column-this.pos.column;if(this.updateAnchors(e),h&&(this.length+=r),h&&!this.session.$fromUndo){if(e.action==="insert")for(var u=this.others.length-1;u>=0;u--){var f=this.others[u],m={row:f.row,column:f.column+a};this.doc.insertMergedLines(m,e.lines)}else if(e.action==="remove")for(var u=this.others.length-1;u>=0;u--){var f=this.others[u],m={row:f.row,column:f.column+a};this.doc.remove(new s(m.row,m.column,m.row,m.column-r))}}this.$updating=!1,this.updateMarkers()}},p.prototype.updateAnchors=function(e){this.pos.onChange(e);for(var t=this.others.length;t--;)this.others[t].onChange(e);this.updateMarkers()},p.prototype.updateMarkers=function(){if(!this.$updating){var e=this,t=this.session,r=function(a,u){t.removeMarker(a.markerId),a.markerId=t.addMarker(new s(a.row,a.column,a.row,a.column+e.length),u,null,!1)};r(this.pos,this.mainClass);for(var h=this.others.length;h--;)r(this.others[h],this.othersClass)}},p.prototype.onCursorChange=function(e){if(!(this.$updating||!this.session)){var t=this.session.selection.getCursor();t.row===this.pos.row&&t.column>=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))}},p.prototype.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.off("change",this.$onUpdate),this.session.selection.off("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},p.prototype.cancel=function(){if(this.$undoStackDepth!==-1){for(var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth,r=0;r<t;r++)e.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}},p}();d.implement(o.prototype,c),l.PlaceHolder=o}),ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(i,l,v){var s=i("../lib/event"),c=i("../lib/useragent");function d(p,e){return p.row==e.row&&p.column==e.column}function o(p){var e=p.domEvent,t=e.altKey,r=e.shiftKey,h=e.ctrlKey,a=p.getAccelKey(),u=p.getButton();if(h&&c.isMac&&(u=e.button),p.editor.inMultiSelectMode&&u==2){p.editor.textInput.onContextMenu(p.domEvent);return}if(!h&&!t&&!a){u===0&&p.editor.inMultiSelectMode&&p.editor.exitMultiSelectMode();return}if(u===0){var f=p.editor,m=f.selection,y=f.inMultiSelectMode,x=p.getDocumentPosition(),E=m.getCursor(),w=p.inSelection()||m.isEmpty()&&d(x,E),g=p.x,S=p.y,k=function(B){g=B.clientX,S=B.clientY},D=f.session,_=f.renderer.pixelToScreenCoordinates(g,S),F=_,A;if(f.$mouseHandler.$enableJumpToDef)h&&t||a&&t?A=r?"block":"add":t&&f.$blockSelectEnabled&&(A="block");else if(a&&!t){if(A="add",!y&&r)return}else t&&f.$blockSelectEnabled&&(A="block");if(A&&c.isMac&&e.ctrlKey&&f.$mouseHandler.cancelContextMenu(),A=="add"){if(!y&&w)return;if(!y){var $=m.toOrientedRange();f.addSelectionMarker($)}var C=m.rangeList.rangeAtPoint(x);f.inVirtualSelectionMode=!0,r&&(C=null,$=m.ranges[0]||$,f.removeSelectionMarker($)),f.once("mouseup",function(){var B=m.toOrientedRange();C&&B.isEmpty()&&d(C.cursor,B.cursor)?m.substractPoint(B.cursor):(r?m.substractPoint($.cursor):$&&(f.removeSelectionMarker($),m.addRange($)),m.addRange(B)),f.inVirtualSelectionMode=!1})}else if(A=="block"){p.stop(),f.inVirtualSelectionMode=!0;var b,T=[],I=function(){var B=f.renderer.pixelToScreenCoordinates(g,S),V=D.screenToDocumentPosition(B.row,B.column,B.offsetX);d(F,B)&&d(V,m.lead)||(F=B,f.selection.moveToPosition(V),f.renderer.scrollCursorIntoView(),f.removeSelectionMarkers(T),T=m.rectangularRangeBlock(F,_),f.$mouseHandler.$clickSelection&&T.length==1&&T[0].isEmpty()&&(T[0]=f.$mouseHandler.$clickSelection.clone()),T.forEach(f.addSelectionMarker,f),f.updateSelectionMarkers())};y&&!a?m.toSingleRange():!y&&a&&(b=m.toOrientedRange(),f.addSelectionMarker(b)),r?_=D.documentToScreenPosition(m.lead):m.moveToPosition(x),F={row:-1,column:-1};var O=function(B){I(),clearInterval(P),f.removeSelectionMarkers(T),T.length||(T=[m.toOrientedRange()]),b&&(f.removeSelectionMarker(b),m.toSingleRange(b));for(var V=0;V<T.length;V++)m.addRange(T[V]);f.inVirtualSelectionMode=!1,f.$mouseHandler.$clickSelection=null},N=I;s.capture(f.container,k,O);var P=setInterval(function(){N()},20);return p.preventDefault()}}}l.onMouseDown=o}),ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(i,l,v){l.defaultCommands=[{name:"addCursorAbove",description:"Add cursor above",exec:function(c){c.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",description:"Add cursor below",exec:function(c){c.selectMoreLines(1)},bindKey:{win:"Ctrl-Alt-Down",mac:"Ctrl-Alt-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorAboveSkipCurrent",description:"Add cursor above (skip current)",exec:function(c){c.selectMoreLines(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Up",mac:"Ctrl-Alt-Shift-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelowSkipCurrent",description:"Add cursor below (skip current)",exec:function(c){c.selectMoreLines(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Down",mac:"Ctrl-Alt-Shift-Down"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreBefore",description:"Select more before",exec:function(c){c.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",description:"Select more after",exec:function(c){c.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",description:"Select next before",exec:function(c){c.selectMore(-1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Left",mac:"Ctrl-Alt-Shift-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextAfter",description:"Select next after",exec:function(c){c.selectMore(1,!0)},bindKey:{win:"Ctrl-Alt-Shift-Right",mac:"Ctrl-Alt-Shift-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"toggleSplitSelectionIntoLines",description:"Split selection into lines",exec:function(c){c.multiSelect.rangeCount>1?c.multiSelect.joinSelections():c.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(c){c.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(c){c.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(c){c.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],l.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(c){c.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(c){return c&&c.inMultiSelectMode}}];var s=i("../keyboard/hash_handler").HashHandler;l.keyboardHandler=new s(l.multiSelectCommands)}),ace.define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],function(i,l,v){var s=i("./range_list").RangeList,c=i("./range").Range,d=i("./selection").Selection,o=i("./mouse/multi_select_handler").onMouseDown,p=i("./lib/event"),e=i("./lib/lang"),t=i("./commands/multi_select_commands");l.commands=t.defaultCommands.concat(t.multiSelectCommands);var r=i("./search").Search,h=new r;function a(E,w,g){return h.$options.wrap=!0,h.$options.needle=w,h.$options.backwards=g==-1,h.find(E)}var u=i("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(u.prototype),function(){this.ranges=null,this.rangeList=null,this.addRange=function(E,w){if(E){if(!this.inMultiSelectMode&&this.rangeCount===0){var g=this.toOrientedRange();if(this.rangeList.add(g),this.rangeList.add(E),this.rangeList.ranges.length!=2)return this.rangeList.removeAll(),w||this.fromOrientedRange(E);this.rangeList.removeAll(),this.rangeList.add(g),this.$onAddRange(g)}E.cursor||(E.cursor=E.end);var S=this.rangeList.add(E);return this.$onAddRange(E),S.length&&this.$onRemoveRange(S),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),w||this.fromOrientedRange(E)}},this.toSingleRange=function(E){E=E||this.ranges[0];var w=this.rangeList.removeAll();w.length&&this.$onRemoveRange(w),E&&this.fromOrientedRange(E)},this.substractPoint=function(E){var w=this.rangeList.substractPoint(E);if(w)return this.$onRemoveRange(w),w[0]},this.mergeOverlappingRanges=function(){var E=this.rangeList.merge();E.length&&this.$onRemoveRange(E)},this.$onAddRange=function(E){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(E),this._signal("addRange",{range:E})},this.$onRemoveRange=function(E){if(this.rangeCount=this.rangeList.ranges.length,this.rangeCount==1&&this.inMultiSelectMode){var w=this.rangeList.ranges.pop();E.push(w),this.rangeCount=0}for(var g=E.length;g--;){var S=this.ranges.indexOf(E[g]);this.ranges.splice(S,1)}this._signal("removeRange",{ranges:E}),this.rangeCount===0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),w=w||this.ranges[0],w&&!w.isEqual(this.getRange())&&this.fromOrientedRange(w)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new s,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){for(var E=this.ranges.length?this.ranges:[this.getRange()],w=[],g=0;g<E.length;g++){var S=E[g],k=S.start.row,D=S.end.row;if(k===D)w.push(S.clone());else{for(w.push(new c(k,S.start.column,k,this.session.getLine(k).length));++k<D;)w.push(this.getLineRange(k,!0));w.push(new c(D,0,D,S.end.column))}g==0&&!this.isBackwards()&&(w=w.reverse())}this.toSingleRange();for(var g=w.length;g--;)this.addRange(w[g])},this.joinSelections=function(){var E=this.rangeList.ranges,w=E[E.length-1],g=c.fromPoints(E[0].start,w.end);this.toSingleRange(),this.setSelectionRange(g,w.cursor==w.start)},this.toggleBlockSelection=function(){if(this.rangeCount>1){var E=this.rangeList.ranges,w=E[E.length-1],g=c.fromPoints(E[0].start,w.end);this.toSingleRange(),this.setSelectionRange(g,w.cursor==w.start)}else{var S=this.session.documentToScreenPosition(this.cursor),k=this.session.documentToScreenPosition(this.anchor),D=this.rectangularRangeBlock(S,k);D.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(E,w,g){var S=[],k=E.column<w.column;if(k)var D=E.column,_=w.column,F=E.offsetX,A=w.offsetX;else var D=w.column,_=E.column,F=w.offsetX,A=E.offsetX;var $=E.row<w.row;if($)var C=E.row,b=w.row;else var C=w.row,b=E.row;D<0&&(D=0),C<0&&(C=0),C==b&&(g=!0);for(var T,I=C;I<=b;I++){var O=c.fromPoints(this.session.screenToDocumentPosition(I,D,F),this.session.screenToDocumentPosition(I,_,A));if(O.isEmpty()){if(T&&m(O.end,T))break;T=O.end}O.cursor=k?O.start:O.end,S.push(O)}if($&&S.reverse(),!g){for(var N=S.length-1;S[N].isEmpty()&&N>0;)N--;if(N>0)for(var P=0;S[P].isEmpty();)P++;for(var B=N;B>=P;B--)S[B].isEmpty()&&S.splice(B,1)}return S}}.call(d.prototype);var f=i("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(E){E.cursor||(E.cursor=E.end);var w=this.getSelectionStyle();return E.marker=this.session.addMarker(E,"ace_selection",w),this.session.$selectionMarkers.push(E),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,E},this.removeSelectionMarker=function(E){if(E.marker){this.session.removeMarker(E.marker);var w=this.session.$selectionMarkers.indexOf(E);w!=-1&&this.session.$selectionMarkers.splice(w,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(E){for(var w=this.session.$selectionMarkers,g=E.length;g--;){var S=E[g];if(S.marker){this.session.removeMarker(S.marker);var k=w.indexOf(S);k!=-1&&w.splice(k,1)}}this.session.selectionMarkerCount=w.length},this.$onAddRange=function(E){this.addSelectionMarker(E.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(E){this.removeSelectionMarkers(E.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(E){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(t.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(E){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(t.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(E){var w=E.command,g=E.editor;if(g.multiSelect){if(w.multiSelectAction)w.multiSelectAction=="forEach"?S=g.forEachSelection(w,E.args):w.multiSelectAction=="forEachLine"?S=g.forEachSelection(w,E.args,!0):w.multiSelectAction=="single"?(g.exitMultiSelectMode(),S=w.exec(g,E.args||{})):S=w.multiSelectAction(g,E.args||{});else{var S=w.exec(g,E.args||{});g.multiSelect.addRange(g.multiSelect.toOrientedRange()),g.multiSelect.mergeOverlappingRanges()}return S}},this.forEachSelection=function(E,w,g){if(!this.inVirtualSelectionMode){var S=g&&g.keepOrder,k=g==!0||g&&g.$byLines,D=this.session,_=this.selection,F=_.rangeList,A=(S?_:F).ranges,$;if(!A.length)return E.exec?E.exec(this,w||{}):E(this,w||{});var C=_._eventRegistry;_._eventRegistry={};var b=new d(D);this.inVirtualSelectionMode=!0;for(var T=A.length;T--;){if(k)for(;T>0&&A[T].start.row==A[T-1].end.row;)T--;b.fromOrientedRange(A[T]),b.index=T,this.selection=D.selection=b;var I=E.exec?E.exec(this,w||{}):E(this,w||{});!$&&I!==void 0&&($=I),b.toOrientedRange(A[T])}b.detach(),this.selection=D.selection=_,this.inVirtualSelectionMode=!1,_._eventRegistry=C,_.mergeOverlappingRanges(),_.ranges[0]&&_.fromOrientedRange(_.ranges[0]);var O=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),O&&O.from==O.to&&this.renderer.animateScrolling(O.from),$}},this.exitMultiSelectMode=function(){!this.inMultiSelectMode||this.inVirtualSelectionMode||this.multiSelect.toSingleRange()},this.getSelectedText=function(){var E="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var w=this.multiSelect.rangeList.ranges,g=[],S=0;S<w.length;S++)g.push(this.session.getTextRange(w[S]));var k=this.session.getDocument().getNewLineCharacter();E=g.join(k),E.length==(g.length-1)*k.length&&(E="")}else this.selection.isEmpty()||(E=this.session.getTextRange(this.getSelectionRange()));return E},this.$checkMultiselectChange=function(E,w){if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var g=this.multiSelect.ranges[0];if(this.multiSelect.isEmpty()&&w==this.multiSelect.anchor)return;var S=w==this.multiSelect.anchor?g.cursor==g.start?g.end:g.start:g.cursor;S.row!=w.row||this.session.$clipPositionToDocument(S.row,S.column).column!=w.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}},this.findAll=function(E,w,g){if(w=w||{},w.needle=E||w.needle,w.needle==null){var S=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();w.needle=this.session.getTextRange(S)}this.$search.set(w);var k=this.$search.findAll(this.session);if(!k.length)return 0;var D=this.multiSelect;g||D.toSingleRange(k[0]);for(var _=k.length;_--;)D.addRange(k[_],!0);return S&&D.rangeList.rangeAtPoint(S.start)&&D.addRange(S,!0),k.length},this.selectMoreLines=function(E,w){var g=this.selection.toOrientedRange(),S=g.cursor==g.end,k=this.session.documentToScreenPosition(g.cursor);this.selection.$desiredColumn&&(k.column=this.selection.$desiredColumn);var D=this.session.screenToDocumentPosition(k.row+E,k.column);if(g.isEmpty())var F=D;else var _=this.session.documentToScreenPosition(S?g.end:g.start),F=this.session.screenToDocumentPosition(_.row+E,_.column);if(S){var A=c.fromPoints(D,F);A.cursor=A.start}else{var A=c.fromPoints(F,D);A.cursor=A.end}if(A.desiredColumn=k.column,!this.selection.inMultiSelectMode)this.selection.addRange(g);else if(w)var $=g.cursor;this.selection.addRange(A),$&&this.selection.substractPoint($)},this.transposeSelections=function(E){for(var w=this.session,g=w.multiSelect,S=g.ranges,k=S.length;k--;){var D=S[k];if(D.isEmpty()){var _=w.getWordRange(D.start.row,D.start.column);D.start.row=_.start.row,D.start.column=_.start.column,D.end.row=_.end.row,D.end.column=_.end.column}}g.mergeOverlappingRanges();for(var F=[],k=S.length;k--;){var D=S[k];F.unshift(w.getTextRange(D))}E<0?F.unshift(F.pop()):F.push(F.shift());for(var k=S.length;k--;){var D=S[k],A=D.clone();w.replace(D,F[k]),D.start.row=A.start.row,D.start.column=A.start.column}g.fromOrientedRange(g.ranges[0])},this.selectMore=function(E,w,g){var S=this.session,k=S.multiSelect,D=k.toOrientedRange();if(!(D.isEmpty()&&(D=S.getWordRange(D.start.row,D.start.column),D.cursor=E==-1?D.start:D.end,this.multiSelect.addRange(D),g))){var _=S.getTextRange(D),F=a(S,_,E);F&&(F.cursor=E==-1?F.start:F.end,this.session.unfold(F),this.multiSelect.addRange(F),this.renderer.scrollCursorIntoView(null,.5)),w&&this.multiSelect.substractPoint(D.cursor)}},this.alignCursors=function(){var E=this.session,w=E.multiSelect,g=w.ranges,S=-1,k=g.filter(function(N){if(N.cursor.row==S)return!0;S=N.cursor.row});if(!g.length||k.length==g.length-1){var D=this.selection.getRange(),_=D.start.row,F=D.end.row,A=_==F;if(A){var $=this.session.getLength(),C;do C=this.session.getLine(F);while(/[=:]/.test(C)&&++F<$);do C=this.session.getLine(_);while(/[=:]/.test(C)&&--_>0);_<0&&(_=0),F>=$&&(F=$-1)}var b=this.session.removeFullLines(_,F);b=this.$reAlignText(b,A),this.session.insert({row:_,column:0},b.join(`
|
|
965
965
|
`)+`
|
|
966
|
-
`),A||(D.start.column=0,D.end.column=
|
|
966
|
+
`),A||(D.start.column=0,D.end.column=b[b.length-1].length),this.selection.setRange(D)}else{k.forEach(function(N){w.substractPoint(N.cursor)});var T=0,I=1/0,O=g.map(function(N){var P=N.cursor,B=E.getLine(P.row),V=B.substr(P.column).search(/\S/g);return V==-1&&(V=0),P.column>T&&(T=P.column),V<I&&(I=V),V});g.forEach(function(N,P){var B=N.cursor,V=T-B.column,W=O[P]-I;V>W?E.insert(B,e.stringRepeat(" ",V-W)):E.remove(new c(B.row,B.column,B.row,B.column-V+W)),N.start.column=N.end.column=T,N.start.row=N.end.row=B.row,N.cursor=N.end}),w.fromOrientedRange(g[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(E,w){var g=!0,S=!0,k,D,_;return E.map(function(b){var T=b.match(/(\s*)(.*?)(\s*)([=:].*)/);return T?k==null?(k=T[1].length,D=T[2].length,_=T[3].length,T):(k+D+_!=T[1].length+T[2].length+T[3].length&&(S=!1),k!=T[1].length&&(g=!1),k>T[1].length&&(k=T[1].length),D<T[2].length&&(D=T[2].length),_>T[3].length&&(_=T[3].length),T):[b]}).map(w?A:g?S?$:A:C);function F(b){return e.stringRepeat(" ",b)}function A(b){return b[2]?F(k)+b[2]+F(D-b[2].length+_)+b[4].replace(/^([=:])\s+/,"$1 "):b[0]}function $(b){return b[2]?F(k+D-b[2].length)+b[2]+F(_)+b[4].replace(/^([=:])\s+/,"$1 "):b[0]}function C(b){return b[2]?F(k)+b[2]+F(_)+b[4].replace(/^([=:])\s+/,"$1 "):b[0]}}}).call(f.prototype);function m(E,w){return E.row==w.row&&E.column==w.column}l.onSessionChange=function(E){var w=E.session;w&&!w.multiSelect&&(w.$selectionMarkers=[],w.selection.$initRangeList(),w.multiSelect=w.selection),this.multiSelect=w&&w.multiSelect;var g=E.oldSession;g&&(g.multiSelect.off("addRange",this.$onAddRange),g.multiSelect.off("removeRange",this.$onRemoveRange),g.multiSelect.off("multiSelect",this.$onMultiSelect),g.multiSelect.off("singleSelect",this.$onSingleSelect),g.multiSelect.lead.off("change",this.$checkMultiselectChange),g.multiSelect.anchor.off("change",this.$checkMultiselectChange)),w&&(w.multiSelect.on("addRange",this.$onAddRange),w.multiSelect.on("removeRange",this.$onRemoveRange),w.multiSelect.on("multiSelect",this.$onMultiSelect),w.multiSelect.on("singleSelect",this.$onSingleSelect),w.multiSelect.lead.on("change",this.$checkMultiselectChange),w.multiSelect.anchor.on("change",this.$checkMultiselectChange)),w&&this.inMultiSelectMode!=w.selection.inMultiSelectMode&&(w.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())};function y(E){E.$multiselectOnSessionChange||(E.$onAddRange=E.$onAddRange.bind(E),E.$onRemoveRange=E.$onRemoveRange.bind(E),E.$onMultiSelect=E.$onMultiSelect.bind(E),E.$onSingleSelect=E.$onSingleSelect.bind(E),E.$multiselectOnSessionChange=l.onSessionChange.bind(E),E.$checkMultiselectChange=E.$checkMultiselectChange.bind(E),E.$multiselectOnSessionChange(E),E.on("changeSession",E.$multiselectOnSessionChange),E.on("mousedown",o),E.commands.addCommands(t.defaultCommands),x(E))}function x(E){if(!E.textInput)return;var w=E.textInput.getElement(),g=!1;p.addListener(w,"keydown",function(k){var D=k.keyCode==18&&!(k.ctrlKey||k.shiftKey||k.metaKey);E.$blockSelectEnabled&&D?g||(E.renderer.setMouseCursor("crosshair"),g=!0):g&&S()},E),p.addListener(w,"keyup",S,E),p.addListener(w,"blur",S,E);function S(k){g&&(E.renderer.setMouseCursor(""),g=!1)}}l.MultiSelect=y,i("./config").defineOptions(f.prototype,"editor",{enableMultiselect:{set:function(E){y(this),E?this.on("mousedown",o):this.off("mousedown",o)},value:!0},enableBlockSelect:{set:function(E){this.$blockSelectEnabled=E},value:!0}})}),ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(i,l,v){var s=i("../../range").Range,c=l.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(d,o,p){var e=d.getLine(p);return this.foldingStartMarker.test(e)?"start":o=="markbeginend"&&this.foldingStopMarker&&this.foldingStopMarker.test(e)?"end":""},this.getFoldWidgetRange=function(d,o,p){return null},this.indentationBlock=function(d,o,p){var e=/\S/,t=d.getLine(o),r=t.search(e);if(r!=-1){for(var h=p||t.length,a=d.getLength(),u=o,f=o;++o<a;){var m=d.getLine(o).search(e);if(m!=-1){if(m<=r){var y=d.getTokenAt(o,0);if(!y||y.type!=="string")break}f=o}}if(f>u){var x=d.getLine(f).length;return new s(u,h,f,x)}}},this.openingBracketBlock=function(d,o,p,e,t){var r={row:p,column:e+1},h=d.$findClosingBracket(o,r,t);if(h){var a=d.foldWidgets[h.row];return a==null&&(a=d.getFoldWidget(h.row)),a=="start"&&h.row>r.row&&(h.row--,h.column=d.getLine(h.row).length),s.fromPoints(r,h)}},this.closingBracketBlock=function(d,o,p,e,t){var r={row:p,column:e},h=d.$findOpeningBracket(o,r);if(h)return h.column++,r.column--,s.fromPoints(h,r)}}).call(c.prototype)}),ace.define("ace/ext/error_marker",["require","exports","module","ace/lib/dom","ace/range","ace/config"],function(i,l,v){var s=i("../lib/dom"),c=i("../range").Range,d=i("../config").nls;function o(e,t,r){for(var h=0,a=e.length-1;h<=a;){var u=h+a>>1,f=r(t,e[u]);if(f>0)h=u+1;else if(f<0)a=u-1;else return u}return-(h+1)}function p(e,t,r){var h=e.getAnnotations().sort(c.comparePoints);if(h.length){var a=o(h,{row:t,column:-1},c.comparePoints);a<0&&(a=-a-1),a>=h.length?a=r>0?0:h.length-1:a===0&&r<0&&(a=h.length-1);var u=h[a];if(!(!u||!r)){if(u.row===t){do u=h[a+=r];while(u&&u.row===t);if(!u)return h.slice()}var f=[];t=u.row;do f[r<0?"unshift":"push"](u),u=h[a+=r];while(u&&u.row==t);return f.length&&f}}}l.showErrorMarker=function(e,t){var r=e.session,h=e.getCursorPosition(),a=h.row,u=r.widgetManager.getWidgetsAtRow(a).filter(function(k){return k.type=="errorMarker"})[0];u?u.destroy():a-=t;var f=p(r,a,t),m;if(f){var y=f[0];h.column=(y.pos&&typeof y.column!="number"?y.pos.sc:y.column)||0,h.row=y.row,m=e.renderer.$gutterLayer.$annotations[h.row]}else{if(u)return;m={displayText:[d("error-marker.good-state","Looks good!")],className:"ace_ok"}}e.session.unfold(h.row),e.selection.moveToPosition(h);var x={row:h.row,fixedWidth:!0,coverGutter:!0,el:s.createElement("div"),type:"errorMarker"},E=x.el.appendChild(s.createElement("div")),w=x.el.appendChild(s.createElement("div"));w.className="error_widget_arrow "+m.className;var g=e.renderer.$cursorLayer.getPixelPosition(h).left;w.style.left=g+e.renderer.gutterWidth-5+"px",x.el.className="error_widget_wrapper",E.className="error_widget "+m.className,m.displayText.forEach(function(k,D){E.appendChild(s.createTextNode(k)),D<m.displayText.length-1&&E.appendChild(s.createElement("br"))}),E.appendChild(s.createElement("div"));var S=function(k,D,_){if(D===0&&(_==="esc"||_==="return"))return x.destroy(),{command:"null"}};x.destroy=function(){e.$mouseHandler.isMousePressed||(e.keyBinding.removeKeyboardHandler(S),r.widgetManager.removeLineWidget(x),e.off("changeSelection",x.destroy),e.off("changeSession",x.destroy),e.off("mouseup",x.destroy),e.off("change",x.destroy))},e.keyBinding.addKeyboardHandler(S),e.on("changeSelection",x.destroy),e.on("changeSession",x.destroy),e.on("mouseup",x.destroy),e.on("change",x.destroy),e.session.widgetManager.addLineWidget(x),x.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:x.el.offsetHeight})},s.importCssString(`
|
|
967
967
|
.error_widget_wrapper {
|
|
968
968
|
background: inherit;
|
|
969
969
|
color: inherit;
|
|
@@ -996,16 +996,16 @@ import{C as qe,R as M}from"./ConfigCustomJavascriptSet__loadShare__react__loadSh
|
|
|
996
996
|
border-left-color: transparent!important;
|
|
997
997
|
top: -5px;
|
|
998
998
|
}
|
|
999
|
-
`,"error_marker.css",!1)}),ace.define("ace/ace",["require","exports","module","ace/lib/dom","ace/range","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config","ace/loader_build"],function(i,l,v){i("./loader_build")(l);var s=i("./lib/dom"),c=i("./range").Range,d=i("./editor").Editor,o=i("./edit_session").EditSession,p=i("./undomanager").UndoManager,e=i("./virtual_renderer").VirtualRenderer;i("./worker/worker_client"),i("./keyboard/hash_handler"),i("./placeholder"),i("./multi_select"),i("./mode/folding/fold_mode"),i("./theme/textmate"),i("./ext/error_marker"),l.config=i("./config"),l.edit=function(r,h){if(typeof r=="string"){var a=r;if(r=document.getElementById(a),!r)throw new Error("ace.edit can't find div #"+a)}if(r&&r.env&&r.env.editor instanceof d)return r.env.editor;var u="";if(r&&/input|textarea/i.test(r.tagName)){var f=r;u=f.value,r=s.createElement("pre"),f.parentNode.replaceChild(r,f)}else r&&(u=r.textContent,r.innerHTML="");var m=l.createEditSession(u),y=new d(new e(r),m,h),x={document:m,editor:y,onResize:y.resize.bind(y,null)};return f&&(x.textarea=f),y.on("destroy",function(){x.editor.container.env=null}),y.container.env=y.env=x,y},l.createEditSession=function(r,h){var a=new o(r,h);return a.setUndoManager(new p),a},l.Range=c,l.Editor=d,l.EditSession=o,l.UndoManager=p,l.VirtualRenderer=e;var t=l.config.version;l.version=t}),function(){ace.require(["ace/ace"],function(i){i&&(i.config.init(!0),i.define=ace.define);var l=function(){return this}();!l&&typeof window<"u"&&(l=window),!l&&typeof self<"u"&&(l=self),l.ace||(l.ace=i);for(var v in i)i.hasOwnProperty(v)&&(l.ace[v]=i[v]);l.ace.default=l.ace,L&&(L.exports=l.ace)})}()})(Fi);var Xt=Fi.exports,qt={exports:{}};qt.exports;(function(L,n){var i=200,l="__lodash_hash_undefined__",v=1,s=2,c=9007199254740991,d="[object Arguments]",o="[object Array]",p="[object AsyncFunction]",e="[object Boolean]",t="[object Date]",r="[object Error]",h="[object Function]",a="[object GeneratorFunction]",u="[object Map]",f="[object Number]",m="[object Null]",y="[object Object]",x="[object Promise]",E="[object Proxy]",b="[object RegExp]",g="[object Set]",S="[object String]",k="[object Symbol]",D="[object Undefined]",_="[object WeakMap]",F="[object ArrayBuffer]",A="[object DataView]",$="[object Float32Array]",w="[object Float64Array]",C="[object Int8Array]",T="[object Int16Array]",I="[object Int32Array]",O="[object Uint8Array]",R="[object Uint8ClampedArray]",P="[object Uint16Array]",B="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,W=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,U={};U[$]=U[w]=U[C]=U[T]=U[I]=U[O]=U[R]=U[P]=U[B]=!0,U[d]=U[o]=U[F]=U[e]=U[A]=U[t]=U[r]=U[h]=U[u]=U[f]=U[y]=U[b]=U[g]=U[S]=U[_]=!1;var G=typeof ke=="object"&&ke&&ke.Object===Object&&ke,Y=typeof self=="object"&&self&&self.Object===Object&&self,Q=G||Y||Function("return this")(),q=n&&!n.nodeType&&n,te=q&&!0&&L&&!L.nodeType&&L,re=te&&te.exports===q,ue=re&&G.process,me=function(){try{return ue&&ue.binding&&ue.binding("util")}catch{}}(),Ce=me&&me.isTypedArray;function ve(H,J){for(var ee=-1,ne=H==null?0:H.length,de=0,ae=[];++ee<ne;){var be=H[ee];J(be,ee,H)&&(ae[de++]=be)}return ae}function $e(H,J){for(var ee=-1,ne=J.length,de=H.length;++ee<ne;)H[de+ee]=J[ee];return H}function Lt(H,J){for(var ee=-1,ne=H==null?0:H.length;++ee<ne;)if(J(H[ee],ee,H))return!0;return!1}function gt(H,J){for(var ee=-1,ne=Array(H);++ee<H;)ne[ee]=J(ee);return ne}function Ui(H){return function(J){return H(J)}}function Gi(H,J){return H.has(J)}function Ki(H,J){return H==null?void 0:H[J]}function Ji(H){var J=-1,ee=Array(H.size);return H.forEach(function(ne,de){ee[++J]=[de,ne]}),ee}function Yi(H,J){return function(ee){return H(J(ee))}}function Qi(H){var J=-1,ee=Array(H.size);return H.forEach(function(ne){ee[++J]=ne}),ee}var Zi=Array.prototype,Xi=Function.prototype,It=Object.prototype,rn=Q["__core-js_shared__"],Rn=Xi.toString,Pe=It.hasOwnProperty,Nn=function(){var H=/[^.]+$/.exec(rn&&rn.keys&&rn.keys.IE_PROTO||"");return H?"Symbol(src)_1."+H:""}(),Bn=It.toString,qi=RegExp("^"+Rn.call(Pe).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pn=re?Q.Buffer:void 0,Ft=Q.Symbol,Wn=Q.Uint8Array,zn=It.propertyIsEnumerable,er=Zi.splice,nt=Ft?Ft.toStringTag:void 0,Hn=Object.getOwnPropertySymbols,tr=Pn?Pn.isBuffer:void 0,nr=Yi(Object.keys,Object),sn=mt(Q,"DataView"),Et=mt(Q,"Map"),on=mt(Q,"Promise"),an=mt(Q,"Set"),ln=mt(Q,"WeakMap"),St=mt(Object,"create"),ir=st(sn),rr=st(Et),sr=st(on),or=st(an),ar=st(ln),jn=Ft?Ft.prototype:void 0,hn=jn?jn.valueOf:void 0;function it(H){var J=-1,ee=H==null?0:H.length;for(this.clear();++J<ee;){var ne=H[J];this.set(ne[0],ne[1])}}function lr(){this.__data__=St?St(null):{},this.size=0}function hr(H){var J=this.has(H)&&delete this.__data__[H];return this.size-=J?1:0,J}function cr(H){var J=this.__data__;if(St){var ee=J[H];return ee===l?void 0:ee}return Pe.call(J,H)?J[H]:void 0}function ur(H){var J=this.__data__;return St?J[H]!==void 0:Pe.call(J,H)}function pr(H,J){var ee=this.__data__;return this.size+=this.has(H)?0:1,ee[H]=St&&J===void 0?l:J,this}it.prototype.clear=lr,it.prototype.delete=hr,it.prototype.get=cr,it.prototype.has=ur,it.prototype.set=pr;function ze(H){var J=-1,ee=H==null?0:H.length;for(this.clear();++J<ee;){var ne=H[J];this.set(ne[0],ne[1])}}function dr(){this.__data__=[],this.size=0}function fr(H){var J=this.__data__,ee=Rt(J,H);if(ee<0)return!1;var ne=J.length-1;return ee==ne?J.pop():er.call(J,ee,1),--this.size,!0}function gr(H){var J=this.__data__,ee=Rt(J,H);return ee<0?void 0:J[ee][1]}function mr(H){return Rt(this.__data__,H)>-1}function vr(H,J){var ee=this.__data__,ne=Rt(ee,H);return ne<0?(++this.size,ee.push([H,J])):ee[ne][1]=J,this}ze.prototype.clear=dr,ze.prototype.delete=fr,ze.prototype.get=gr,ze.prototype.has=mr,ze.prototype.set=vr;function rt(H){var J=-1,ee=H==null?0:H.length;for(this.clear();++J<ee;){var ne=H[J];this.set(ne[0],ne[1])}}function yr(){this.size=0,this.__data__={hash:new it,map:new(Et||ze),string:new it}}function br(H){var J=Nt(this,H).delete(H);return this.size-=J?1:0,J}function wr(H){return Nt(this,H).get(H)}function Cr(H){return Nt(this,H).has(H)}function Er(H,J){var ee=Nt(this,H),ne=ee.size;return ee.set(H,J),this.size+=ee.size==ne?0:1,this}rt.prototype.clear=yr,rt.prototype.delete=br,rt.prototype.get=wr,rt.prototype.has=Cr,rt.prototype.set=Er;function Ot(H){var J=-1,ee=H==null?0:H.length;for(this.__data__=new rt;++J<ee;)this.add(H[J])}function Sr(H){return this.__data__.set(H,l),this}function Dr(H){return this.__data__.has(H)}Ot.prototype.add=Ot.prototype.push=Sr,Ot.prototype.has=Dr;function Ke(H){var J=this.__data__=new ze(H);this.size=J.size}function xr(){this.__data__=new ze,this.size=0}function Ar(H){var J=this.__data__,ee=J.delete(H);return this.size=J.size,ee}function $r(H){return this.__data__.get(H)}function Tr(H){return this.__data__.has(H)}function _r(H,J){var ee=this.__data__;if(ee instanceof ze){var ne=ee.__data__;if(!Et||ne.length<i-1)return ne.push([H,J]),this.size=++ee.size,this;ee=this.__data__=new rt(ne)}return ee.set(H,J),this.size=ee.size,this}Ke.prototype.clear=xr,Ke.prototype.delete=Ar,Ke.prototype.get=$r,Ke.prototype.has=Tr,Ke.prototype.set=_r;function kr(H,J){var ee=Bt(H),ne=!ee&&Ur(H),de=!ee&&!ne&&cn(H),ae=!ee&&!ne&&!de&&Xn(H),be=ee||ne||de||ae,Ee=be?gt(H.length,String):[],De=Ee.length;for(var ye in H)Pe.call(H,ye)&&!(be&&(ye=="length"||de&&(ye=="offset"||ye=="parent")||ae&&(ye=="buffer"||ye=="byteLength"||ye=="byteOffset")||Wr(ye,De)))&&Ee.push(ye);return Ee}function Rt(H,J){for(var ee=H.length;ee--;)if(Jn(H[ee][0],J))return ee;return-1}function Mr(H,J,ee){var ne=J(H);return Bt(H)?ne:$e(ne,ee(H))}function Dt(H){return H==null?H===void 0?D:m:nt&&nt in Object(H)?Br(H):Vr(H)}function Vn(H){return xt(H)&&Dt(H)==d}function Un(H,J,ee,ne,de){return H===J?!0:H==null||J==null||!xt(H)&&!xt(J)?H!==H&&J!==J:Lr(H,J,ee,ne,Un,de)}function Lr(H,J,ee,ne,de,ae){var be=Bt(H),Ee=Bt(J),De=be?o:Je(H),ye=Ee?o:Je(J);De=De==d?y:De,ye=ye==d?y:ye;var Te=De==y,Fe=ye==y,xe=De==ye;if(xe&&cn(H)){if(!cn(J))return!1;be=!0,Te=!1}if(xe&&!Te)return ae||(ae=new Ke),be||Xn(H)?Gn(H,J,ee,ne,de,ae):Rr(H,J,De,ee,ne,de,ae);if(!(ee&v)){var Me=Te&&Pe.call(H,"__wrapped__"),Le=Fe&&Pe.call(J,"__wrapped__");if(Me||Le){var Ye=Me?H.value():H,He=Le?J.value():J;return ae||(ae=new Ke),de(Ye,He,ee,ne,ae)}}return xe?(ae||(ae=new Ke),Nr(H,J,ee,ne,de,ae)):!1}function Ir(H){if(!Zn(H)||Hr(H))return!1;var J=Yn(H)?qi:W;return J.test(st(H))}function Fr(H){return xt(H)&&Qn(H.length)&&!!U[Dt(H)]}function Or(H){if(!jr(H))return nr(H);var J=[];for(var ee in Object(H))Pe.call(H,ee)&&ee!="constructor"&&J.push(ee);return J}function Gn(H,J,ee,ne,de,ae){var be=ee&v,Ee=H.length,De=J.length;if(Ee!=De&&!(be&&De>Ee))return!1;var ye=ae.get(H);if(ye&&ae.get(J))return ye==J;var Te=-1,Fe=!0,xe=ee&s?new Ot:void 0;for(ae.set(H,J),ae.set(J,H);++Te<Ee;){var Me=H[Te],Le=J[Te];if(ne)var Ye=be?ne(Le,Me,Te,J,H,ae):ne(Me,Le,Te,H,J,ae);if(Ye!==void 0){if(Ye)continue;Fe=!1;break}if(xe){if(!Lt(J,function(He,ot){if(!Gi(xe,ot)&&(Me===He||de(Me,He,ee,ne,ae)))return xe.push(ot)})){Fe=!1;break}}else if(!(Me===Le||de(Me,Le,ee,ne,ae))){Fe=!1;break}}return ae.delete(H),ae.delete(J),Fe}function Rr(H,J,ee,ne,de,ae,be){switch(ee){case A:if(H.byteLength!=J.byteLength||H.byteOffset!=J.byteOffset)return!1;H=H.buffer,J=J.buffer;case F:return!(H.byteLength!=J.byteLength||!ae(new Wn(H),new Wn(J)));case e:case t:case f:return Jn(+H,+J);case r:return H.name==J.name&&H.message==J.message;case b:case S:return H==J+"";case u:var Ee=Ji;case g:var De=ne&v;if(Ee||(Ee=Qi),H.size!=J.size&&!De)return!1;var ye=be.get(H);if(ye)return ye==J;ne|=s,be.set(H,J);var Te=Gn(Ee(H),Ee(J),ne,de,ae,be);return be.delete(H),Te;case k:if(hn)return hn.call(H)==hn.call(J)}return!1}function Nr(H,J,ee,ne,de,ae){var be=ee&v,Ee=Kn(H),De=Ee.length,ye=Kn(J),Te=ye.length;if(De!=Te&&!be)return!1;for(var Fe=De;Fe--;){var xe=Ee[Fe];if(!(be?xe in J:Pe.call(J,xe)))return!1}var Me=ae.get(H);if(Me&&ae.get(J))return Me==J;var Le=!0;ae.set(H,J),ae.set(J,H);for(var Ye=be;++Fe<De;){xe=Ee[Fe];var He=H[xe],ot=J[xe];if(ne)var qn=be?ne(ot,He,xe,J,H,ae):ne(He,ot,xe,H,J,ae);if(!(qn===void 0?He===ot||de(He,ot,ee,ne,ae):qn)){Le=!1;break}Ye||(Ye=xe=="constructor")}if(Le&&!Ye){var Pt=H.constructor,Wt=J.constructor;Pt!=Wt&&"constructor"in H&&"constructor"in J&&!(typeof Pt=="function"&&Pt instanceof Pt&&typeof Wt=="function"&&Wt instanceof Wt)&&(Le=!1)}return ae.delete(H),ae.delete(J),Le}function Kn(H){return Mr(H,Jr,Pr)}function Nt(H,J){var ee=H.__data__;return zr(J)?ee[typeof J=="string"?"string":"hash"]:ee.map}function mt(H,J){var ee=Ki(H,J);return Ir(ee)?ee:void 0}function Br(H){var J=Pe.call(H,nt),ee=H[nt];try{H[nt]=void 0;var ne=!0}catch{}var de=Bn.call(H);return ne&&(J?H[nt]=ee:delete H[nt]),de}var Pr=Hn?function(H){return H==null?[]:(H=Object(H),ve(Hn(H),function(J){return zn.call(H,J)}))}:Yr,Je=Dt;(sn&&Je(new sn(new ArrayBuffer(1)))!=A||Et&&Je(new Et)!=u||on&&Je(on.resolve())!=x||an&&Je(new an)!=g||ln&&Je(new ln)!=_)&&(Je=function(H){var J=Dt(H),ee=J==y?H.constructor:void 0,ne=ee?st(ee):"";if(ne)switch(ne){case ir:return A;case rr:return u;case sr:return x;case or:return g;case ar:return _}return J});function Wr(H,J){return J=J??c,!!J&&(typeof H=="number"||z.test(H))&&H>-1&&H%1==0&&H<J}function zr(H){var J=typeof H;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?H!=="__proto__":H===null}function Hr(H){return!!Nn&&Nn in H}function jr(H){var J=H&&H.constructor,ee=typeof J=="function"&&J.prototype||It;return H===ee}function Vr(H){return Bn.call(H)}function st(H){if(H!=null){try{return Rn.call(H)}catch{}try{return H+""}catch{}}return""}function Jn(H,J){return H===J||H!==H&&J!==J}var Ur=Vn(function(){return arguments}())?Vn:function(H){return xt(H)&&Pe.call(H,"callee")&&!zn.call(H,"callee")},Bt=Array.isArray;function Gr(H){return H!=null&&Qn(H.length)&&!Yn(H)}var cn=tr||Qr;function Kr(H,J){return Un(H,J)}function Yn(H){if(!Zn(H))return!1;var J=Dt(H);return J==h||J==a||J==p||J==E}function Qn(H){return typeof H=="number"&&H>-1&&H%1==0&&H<=c}function Zn(H){var J=typeof H;return H!=null&&(J=="object"||J=="function")}function xt(H){return H!=null&&typeof H=="object"}var Xn=Ce?Ui(Ce):Fr;function Jr(H){return Gr(H)?kr(H):Or(H)}function Yr(){return[]}function Qr(){return!1}L.exports=Kr})(qt,qt.exports);var Oi=qt.exports,Ne={};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.getAceInstance=Ne.debounce=Ne.editorEvents=Ne.editorOptions=void 0;var ho=["minLines","maxLines","readOnly","highlightActiveLine","tabSize","enableBasicAutocompletion","enableLiveAutocompletion","enableSnippets"];Ne.editorOptions=ho;var co=["onChange","onFocus","onInput","onBlur","onCopy","onPaste","onSelectionChange","onCursorChange","onScroll","handleOptions","updateRef"];Ne.editorEvents=co;var uo=function(){var L;return typeof window>"u"?(ke.window={},L=Xt,delete ke.window):window.ace?(L=window.ace,L.acequire=window.ace.require||window.ace.acequire):L=Xt,L};Ne.getAceInstance=uo;var po=function(L,n){var i=null;return function(){var l=this,v=arguments;clearTimeout(i),i=setTimeout(function(){L.apply(l,v)},n)}};Ne.debounce=po;var fo=ut&&ut.__extends||function(){var L=function(n,i){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,v){l.__proto__=v}||function(l,v){for(var s in v)Object.prototype.hasOwnProperty.call(v,s)&&(l[s]=v[s])},L(n,i)};return function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");L(n,i);function l(){this.constructor=n}n.prototype=i===null?Object.create(i):(l.prototype=i.prototype,new l)}}(),$n=ut&&ut.__assign||function(){return $n=Object.assign||function(L){for(var n,i=1,l=arguments.length;i<l;i++){n=arguments[i];for(var v in n)Object.prototype.hasOwnProperty.call(n,v)&&(L[v]=n[v])}return L},$n.apply(this,arguments)};Object.defineProperty(ut,"__esModule",{value:!0});var go=Xt,ie=_n,ai=qe,Vt=Oi,bt=Ne,li=(0,bt.getAceInstance)(),mo=function(L){fo(n,L);function n(i){var l=L.call(this,i)||this;return bt.editorEvents.forEach(function(v){l[v]=l[v].bind(l)}),l.debounce=bt.debounce,l}return n.prototype.isInShadow=function(i){for(var l=i&&i.parentNode;l;){if(l.toString()==="[object ShadowRoot]")return!0;l=l.parentNode}return!1},n.prototype.componentDidMount=function(){var i=this,l=this.props,v=l.className,s=l.onBeforeLoad,c=l.onValidate,d=l.mode,o=l.focus,p=l.theme,e=l.fontSize,t=l.lineHeight,r=l.value,h=l.defaultValue,a=l.showGutter,u=l.wrapEnabled,f=l.showPrintMargin,m=l.scrollMargin,y=m===void 0?[0,0,0,0]:m,x=l.keyboardHandler,E=l.onLoad,b=l.commands,g=l.annotations,S=l.markers,k=l.placeholder;this.editor=li.edit(this.refEditor),s&&s(li);for(var D=Object.keys(this.props.editorProps),_=0;_<D.length;_++)this.editor[D[_]]=this.props.editorProps[D[_]];this.props.debounceChangePeriod&&(this.onChange=this.debounce(this.onChange,this.props.debounceChangePeriod)),this.editor.renderer.setScrollMargin(y[0],y[1],y[2],y[3]),this.isInShadow(this.refEditor)&&this.editor.renderer.attachToShadowRoot(),this.editor.getSession().setMode(typeof d=="string"?"ace/mode/".concat(d):d),p&&p!==""&&this.editor.setTheme("ace/theme/".concat(p)),this.editor.setFontSize(typeof e=="number"?"".concat(e,"px"):e),t&&(this.editor.container.style.lineHeight=typeof t=="number"?"".concat(t,"px"):"".concat(t),this.editor.renderer.updateFontSize()),this.editor.getSession().setValue(h||r||""),this.props.navigateToFileEnd&&this.editor.navigateFileEnd(),this.editor.renderer.setShowGutter(a),this.editor.getSession().setUseWrapMode(u),this.editor.setShowPrintMargin(f),this.editor.on("focus",this.onFocus),this.editor.on("blur",this.onBlur),this.editor.on("copy",this.onCopy),this.editor.on("paste",this.onPaste),this.editor.on("change",this.onChange),this.editor.on("input",this.onInput),k&&this.updatePlaceholder(),this.editor.getSession().selection.on("changeSelection",this.onSelectionChange),this.editor.getSession().selection.on("changeCursor",this.onCursorChange),c&&this.editor.getSession().on("changeAnnotation",function(){var A=i.editor.getSession().getAnnotations();i.props.onValidate(A)}),this.editor.session.on("changeScrollTop",this.onScroll),this.editor.getSession().setAnnotations(g||[]),S&&S.length>0&&this.handleMarkers(S);var F=this.editor.$options;bt.editorOptions.forEach(function(A){F.hasOwnProperty(A)?i.editor.setOption(A,i.props[A]):i.props[A]&&console.warn("ReactAce: editor option ".concat(A," was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"))}),this.handleOptions(this.props),Array.isArray(b)&&b.forEach(function(A){typeof A.exec=="string"?i.editor.commands.bindKey(A.bindKey,A.exec):i.editor.commands.addCommand(A)}),x&&this.editor.setKeyboardHandler("ace/keyboard/"+x),v&&(this.refEditor.className+=" "+v),E&&E(this.editor),this.editor.resize(),o&&this.editor.focus()},n.prototype.componentDidUpdate=function(i){for(var l=i,v=this.props,s=0;s<bt.editorOptions.length;s++){var c=bt.editorOptions[s];v[c]!==l[c]&&this.editor.setOption(c,v[c])}if(v.className!==l.className){var d=this.refEditor.className,o=d.trim().split(" "),p=l.className.trim().split(" ");p.forEach(function(r){var h=o.indexOf(r);o.splice(h,1)}),this.refEditor.className=" "+v.className+" "+o.join(" ")}var e=this.editor&&v.value!=null&&this.editor.getValue()!==v.value;if(e){this.silent=!0;var t=this.editor.session.selection.toJSON();this.editor.setValue(v.value,v.cursorStart),this.editor.session.selection.fromJSON(t),this.silent=!1}v.placeholder!==l.placeholder&&this.updatePlaceholder(),v.mode!==l.mode&&this.editor.getSession().setMode(typeof v.mode=="string"?"ace/mode/".concat(v.mode):v.mode),v.theme!==l.theme&&this.editor.setTheme("ace/theme/"+v.theme),v.keyboardHandler!==l.keyboardHandler&&(v.keyboardHandler?this.editor.setKeyboardHandler("ace/keyboard/"+v.keyboardHandler):this.editor.setKeyboardHandler(null)),v.fontSize!==l.fontSize&&this.editor.setFontSize(typeof v.fontSize=="number"?"".concat(v.fontSize,"px"):v.fontSize),v.lineHeight!==l.lineHeight&&(this.editor.container.style.lineHeight=typeof v.lineHeight=="number"?"".concat(v.lineHeight,"px"):v.lineHeight,this.editor.renderer.updateFontSize()),v.wrapEnabled!==l.wrapEnabled&&this.editor.getSession().setUseWrapMode(v.wrapEnabled),v.showPrintMargin!==l.showPrintMargin&&this.editor.setShowPrintMargin(v.showPrintMargin),v.showGutter!==l.showGutter&&this.editor.renderer.setShowGutter(v.showGutter),Vt(v.setOptions,l.setOptions)||this.handleOptions(v),(e||!Vt(v.annotations,l.annotations))&&this.editor.getSession().setAnnotations(v.annotations||[]),!Vt(v.markers,l.markers)&&Array.isArray(v.markers)&&this.handleMarkers(v.markers),Vt(v.scrollMargin,l.scrollMargin)||this.handleScrollMargins(v.scrollMargin),(i.height!==this.props.height||i.width!==this.props.width)&&this.editor.resize(),this.props.focus&&!i.focus&&this.editor.focus()},n.prototype.handleScrollMargins=function(i){i===void 0&&(i=[0,0,0,0]),this.editor.renderer.setScrollMargin(i[0],i[1],i[2],i[3])},n.prototype.componentWillUnmount=function(){this.editor&&(this.editor.destroy(),this.editor=null)},n.prototype.onChange=function(i){if(this.editor&&this.props.onChange&&!this.silent){var l=this.editor.getValue();this.props.onChange(l,i)}},n.prototype.onSelectionChange=function(i){if(this.props.onSelectionChange){var l=this.editor.getSelection();this.props.onSelectionChange(l,i)}},n.prototype.onCursorChange=function(i){if(this.props.onCursorChange){var l=this.editor.getSelection();this.props.onCursorChange(l,i)}},n.prototype.onInput=function(i){this.props.onInput&&this.props.onInput(i),this.props.placeholder&&this.updatePlaceholder()},n.prototype.onFocus=function(i){this.props.onFocus&&this.props.onFocus(i,this.editor)},n.prototype.onBlur=function(i){this.props.onBlur&&this.props.onBlur(i,this.editor)},n.prototype.onCopy=function(i){var l=i.text;this.props.onCopy&&this.props.onCopy(l)},n.prototype.onPaste=function(i){var l=i.text;this.props.onPaste&&this.props.onPaste(l)},n.prototype.onScroll=function(){this.props.onScroll&&this.props.onScroll(this.editor)},n.prototype.handleOptions=function(i){for(var l=Object.keys(i.setOptions),v=0;v<l.length;v++)this.editor.setOption(l[v],i.setOptions[l[v]])},n.prototype.handleMarkers=function(i){var l=this,v=this.editor.getSession().getMarkers(!0);for(var s in v)v.hasOwnProperty(s)&&this.editor.getSession().removeMarker(v[s].id);v=this.editor.getSession().getMarkers(!1);for(var s in v)v.hasOwnProperty(s)&&v[s].clazz!=="ace_active-line"&&v[s].clazz!=="ace_selected-word"&&this.editor.getSession().removeMarker(v[s].id);i.forEach(function(c){var d=c.startRow,o=c.startCol,p=c.endRow,e=c.endCol,t=c.className,r=c.type,h=c.inFront,a=h===void 0?!1:h,u=new go.Range(d,o,p,e);l.editor.getSession().addMarker(u,t,r,a)})},n.prototype.updatePlaceholder=function(){var i=this.editor,l=this.props.placeholder,v=!i.session.getValue().length,s=i.renderer.placeholderNode;!v&&s?(i.renderer.scroller.removeChild(i.renderer.placeholderNode),i.renderer.placeholderNode=null):v&&!s?(s=i.renderer.placeholderNode=document.createElement("div"),s.textContent=l||"",s.className="ace_comment ace_placeholder",s.style.padding="0 9px",s.style.position="absolute",s.style.zIndex="3",i.renderer.scroller.appendChild(s)):v&&s&&(s.textContent=l)},n.prototype.updateRef=function(i){this.refEditor=i},n.prototype.render=function(){var i=this.props,l=i.name,v=i.width,s=i.height,c=i.style,d=$n({width:v,height:s},c);return ai.createElement("div",{ref:this.updateRef,id:l,style:d})},n.propTypes={mode:ie.oneOfType([ie.string,ie.object]),focus:ie.bool,theme:ie.string,name:ie.string,className:ie.string,height:ie.string,width:ie.string,fontSize:ie.oneOfType([ie.number,ie.string]),lineHeight:ie.oneOfType([ie.number,ie.string]),showGutter:ie.bool,onChange:ie.func,onCopy:ie.func,onPaste:ie.func,onFocus:ie.func,onInput:ie.func,onBlur:ie.func,onScroll:ie.func,value:ie.string,defaultValue:ie.string,onLoad:ie.func,onSelectionChange:ie.func,onCursorChange:ie.func,onBeforeLoad:ie.func,onValidate:ie.func,minLines:ie.number,maxLines:ie.number,readOnly:ie.bool,highlightActiveLine:ie.bool,tabSize:ie.number,showPrintMargin:ie.bool,cursorStart:ie.number,debounceChangePeriod:ie.number,editorProps:ie.object,setOptions:ie.object,style:ie.object,scrollMargin:ie.array,annotations:ie.array,markers:ie.array,keyboardHandler:ie.string,wrapEnabled:ie.bool,enableSnippets:ie.bool,enableBasicAutocompletion:ie.oneOfType([ie.bool,ie.array]),enableLiveAutocompletion:ie.oneOfType([ie.bool,ie.array]),navigateToFileEnd:ie.bool,commands:ie.array,placeholder:ie.string},n.defaultProps={name:"ace-editor",focus:!1,mode:"",theme:"",height:"500px",width:"500px",fontSize:12,enableSnippets:!1,showGutter:!0,onChange:null,onPaste:null,onLoad:null,onScroll:null,minLines:null,maxLines:null,readOnly:!1,highlightActiveLine:!0,showPrintMargin:!0,tabSize:4,cursorStart:1,editorProps:{},style:{},scrollMargin:[0,0,0,0],setOptions:{},wrapEnabled:!1,enableBasicAutocompletion:!1,enableLiveAutocompletion:!1,placeholder:null,navigateToFileEnd:!0},n}(ai.Component);ut.default=mo;var kt={},tt={},Ri={exports:{}};(function(L,n){ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"],function(i,l,v){var s=i("./lib/oop");i("./lib/lang");var c=i("./lib/event_emitter").EventEmitter,d=i("./editor").Editor,o=i("./virtual_renderer").VirtualRenderer,p=i("./edit_session").EditSession,e;e=function(t,r,h){this.BELOW=1,this.BESIDE=0,this.$container=t,this.$theme=r,this.$splits=0,this.$editorCSS="",this.$editors=[],this.$orientation=this.BESIDE,this.setSplits(h||1),this.$cEditor=this.$editors[0],this.on("focus",function(a){this.$cEditor=a}.bind(this))},function(){s.implement(this,c),this.$createEditor=function(){var t=document.createElement("div");t.className=this.$editorCSS,t.style.cssText="position: absolute; top:0px; bottom:0px",this.$container.appendChild(t);var r=new d(new o(t,this.$theme));return r.on("focus",function(){this._emit("focus",r)}.bind(this)),this.$editors.push(r),r.setFontSize(this.$fontSize),r},this.setSplits=function(t){var r;if(t<1)throw"The number of splits have to be > 0!";if(t!=this.$splits){if(t>this.$splits){for(;this.$splits<this.$editors.length&&this.$splits<t;)r=this.$editors[this.$splits],this.$container.appendChild(r.container),r.setFontSize(this.$fontSize),this.$splits++;for(;this.$splits<t;)this.$createEditor(),this.$splits++}else for(;this.$splits>t;)r=this.$editors[this.$splits-1],this.$container.removeChild(r.container),this.$splits--;this.resize()}},this.getSplits=function(){return this.$splits},this.getEditor=function(t){return this.$editors[t]},this.getCurrentEditor=function(){return this.$cEditor},this.focus=function(){this.$cEditor.focus()},this.blur=function(){this.$cEditor.blur()},this.setTheme=function(t){this.$editors.forEach(function(r){r.setTheme(t)})},this.setKeyboardHandler=function(t){this.$editors.forEach(function(r){r.setKeyboardHandler(t)})},this.forEach=function(t,r){this.$editors.forEach(t,r)},this.$fontSize="",this.setFontSize=function(t){this.$fontSize=t,this.forEach(function(r){r.setFontSize(t)})},this.$cloneSession=function(t){var r=new p(t.getDocument(),t.getMode()),h=t.getUndoManager();return r.setUndoManager(h),r.setTabSize(t.getTabSize()),r.setUseSoftTabs(t.getUseSoftTabs()),r.setOverwrite(t.getOverwrite()),r.setBreakpoints(t.getBreakpoints()),r.setUseWrapMode(t.getUseWrapMode()),r.setUseWorker(t.getUseWorker()),r.setWrapLimitRange(t.$wrapLimitRange.min,t.$wrapLimitRange.max),r.$foldData=t.$cloneFoldData(),r},this.setSession=function(t,r){var h;r==null?h=this.$cEditor:h=this.$editors[r];var a=this.$editors.some(function(u){return u.session===t});return a&&(t=this.$cloneSession(t)),h.setSession(t),t},this.getOrientation=function(){return this.$orientation},this.setOrientation=function(t){this.$orientation!=t&&(this.$orientation=t,this.resize())},this.resize=function(){var t=this.$container.clientWidth,r=this.$container.clientHeight,h;if(this.$orientation==this.BESIDE)for(var a=t/this.$splits,u=0;u<this.$splits;u++)h=this.$editors[u],h.container.style.width=a+"px",h.container.style.top="0px",h.container.style.left=u*a+"px",h.container.style.height=r+"px",h.resize();else for(var f=r/this.$splits,u=0;u<this.$splits;u++)h=this.$editors[u],h.container.style.width=t+"px",h.container.style.top=u*f+"px",h.container.style.left="0px",h.container.style.height=f+"px",h.resize()}}.call(e.prototype),l.Split=e}),ace.define("ace/ext/split",["require","exports","module","ace/ext/split","ace/split"],function(i,l,v){v.exports=i("../split")}),function(){ace.require(["ace/ext/split"],function(i){L&&(L.exports=i)})}()})(Ri);var vo=Ri.exports,yo="Expected a function",Ni="__lodash_hash_undefined__",bo="[object Function]",wo="[object GeneratorFunction]",Co="[object Symbol]",Eo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,So=/^\w*$/,Do=/^\./,xo=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ao=/[\\^$.*+?()[\]{}|]/g,$o=/\\(\\)?/g,To=/^\[object .+?Constructor\]$/,_o=typeof ke=="object"&&ke&&ke.Object===Object&&ke,ko=typeof self=="object"&&self&&self.Object===Object&&self,Ln=_o||ko||Function("return this")();function Mo(L,n){return L==null?void 0:L[n]}function Lo(L){var n=!1;if(L!=null&&typeof L.toString!="function")try{n=!!(L+"")}catch{}return n}var Io=Array.prototype,Fo=Function.prototype,Bi=Object.prototype,mn=Ln["__core-js_shared__"],hi=function(){var L=/[^.]+$/.exec(mn&&mn.keys&&mn.keys.IE_PROTO||"");return L?"Symbol(src)_1."+L:""}(),Pi=Fo.toString,In=Bi.hasOwnProperty,Wi=Bi.toString,Oo=RegExp("^"+Pi.call(In).replace(Ao,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ci=Ln.Symbol,Ro=Io.splice,No=zi(Ln,"Map"),Mt=zi(Object,"create"),ui=ci?ci.prototype:void 0,pi=ui?ui.toString:void 0;function pt(L){var n=-1,i=L?L.length:0;for(this.clear();++n<i;){var l=L[n];this.set(l[0],l[1])}}function Bo(){this.__data__=Mt?Mt(null):{}}function Po(L){return this.has(L)&&delete this.__data__[L]}function Wo(L){var n=this.__data__;if(Mt){var i=n[L];return i===Ni?void 0:i}return In.call(n,L)?n[L]:void 0}function zo(L){var n=this.__data__;return Mt?n[L]!==void 0:In.call(n,L)}function Ho(L,n){var i=this.__data__;return i[L]=Mt&&n===void 0?Ni:n,this}pt.prototype.clear=Bo;pt.prototype.delete=Po;pt.prototype.get=Wo;pt.prototype.has=zo;pt.prototype.set=Ho;function Ct(L){var n=-1,i=L?L.length:0;for(this.clear();++n<i;){var l=L[n];this.set(l[0],l[1])}}function jo(){this.__data__=[]}function Vo(L){var n=this.__data__,i=tn(n,L);if(i<0)return!1;var l=n.length-1;return i==l?n.pop():Ro.call(n,i,1),!0}function Uo(L){var n=this.__data__,i=tn(n,L);return i<0?void 0:n[i][1]}function Go(L){return tn(this.__data__,L)>-1}function Ko(L,n){var i=this.__data__,l=tn(i,L);return l<0?i.push([L,n]):i[l][1]=n,this}Ct.prototype.clear=jo;Ct.prototype.delete=Vo;Ct.prototype.get=Uo;Ct.prototype.has=Go;Ct.prototype.set=Ko;function dt(L){var n=-1,i=L?L.length:0;for(this.clear();++n<i;){var l=L[n];this.set(l[0],l[1])}}function Jo(){this.__data__={hash:new pt,map:new(No||Ct),string:new pt}}function Yo(L){return nn(this,L).delete(L)}function Qo(L){return nn(this,L).get(L)}function Zo(L){return nn(this,L).has(L)}function Xo(L,n){return nn(this,L).set(L,n),this}dt.prototype.clear=Jo;dt.prototype.delete=Yo;dt.prototype.get=Qo;dt.prototype.has=Zo;dt.prototype.set=Xo;function tn(L,n){for(var i=L.length;i--;)if(ha(L[i][0],n))return i;return-1}function qo(L,n){n=ia(n,L)?[n]:na(n);for(var i=0,l=n.length;L!=null&&i<l;)L=L[aa(n[i++])];return i&&i==l?L:void 0}function ea(L){if(!ji(L)||sa(L))return!1;var n=ca(L)||Lo(L)?Oo:To;return n.test(la(L))}function ta(L){if(typeof L=="string")return L;if(On(L))return pi?pi.call(L):"";var n=L+"";return n=="0"&&1/L==-1/0?"-0":n}function na(L){return Hi(L)?L:oa(L)}function nn(L,n){var i=L.__data__;return ra(n)?i[typeof n=="string"?"string":"hash"]:i.map}function zi(L,n){var i=Mo(L,n);return ea(i)?i:void 0}function ia(L,n){if(Hi(L))return!1;var i=typeof L;return i=="number"||i=="symbol"||i=="boolean"||L==null||On(L)?!0:So.test(L)||!Eo.test(L)||n!=null&&L in Object(n)}function ra(L){var n=typeof L;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?L!=="__proto__":L===null}function sa(L){return!!hi&&hi in L}var oa=Fn(function(L){L=pa(L);var n=[];return Do.test(L)&&n.push(""),L.replace(xo,function(i,l,v,s){n.push(v?s.replace($o,"$1"):l||i)}),n});function aa(L){if(typeof L=="string"||On(L))return L;var n=L+"";return n=="0"&&1/L==-1/0?"-0":n}function la(L){if(L!=null){try{return Pi.call(L)}catch{}try{return L+""}catch{}}return""}function Fn(L,n){if(typeof L!="function"||n&&typeof n!="function")throw new TypeError(yo);var i=function(){var l=arguments,v=n?n.apply(this,l):l[0],s=i.cache;if(s.has(v))return s.get(v);var c=L.apply(this,l);return i.cache=s.set(v,c),c};return i.cache=new(Fn.Cache||dt),i}Fn.Cache=dt;function ha(L,n){return L===n||L!==L&&n!==n}var Hi=Array.isArray;function ca(L){var n=ji(L)?Wi.call(L):"";return n==bo||n==wo}function ji(L){var n=typeof L;return!!L&&(n=="object"||n=="function")}function ua(L){return!!L&&typeof L=="object"}function On(L){return typeof L=="symbol"||ua(L)&&Wi.call(L)==Co}function pa(L){return L==null?"":ta(L)}function da(L,n,i){var l=L==null?void 0:qo(L,n);return l===void 0?i:l}var fa=da,ga=tt&&tt.__extends||function(){var L=function(n,i){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,v){l.__proto__=v}||function(l,v){for(var s in v)Object.prototype.hasOwnProperty.call(v,s)&&(l[s]=v[s])},L(n,i)};return function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");L(n,i);function l(){this.constructor=n}n.prototype=i===null?Object.create(i):(l.prototype=i.prototype,new l)}}(),Tn=tt&&tt.__assign||function(){return Tn=Object.assign||function(L){for(var n,i=1,l=arguments.length;i<l;i++){n=arguments[i];for(var v in n)Object.prototype.hasOwnProperty.call(n,v)&&(L[v]=n[v])}return L},Tn.apply(this,arguments)};Object.defineProperty(tt,"__esModule",{value:!0});var ct=Ne,vn=(0,ct.getAceInstance)(),ma=Xt,va=vo,se=_n,di=qe,yn=Oi,je=fa,ya=function(L){ga(n,L);function n(i){var l=L.call(this,i)||this;return ct.editorEvents.forEach(function(v){l[v]=l[v].bind(l)}),l.debounce=ct.debounce,l}return n.prototype.isInShadow=function(i){for(var l=i&&i.parentNode;l;){if(l.toString()==="[object ShadowRoot]")return!0;l=l.parentNode}return!1},n.prototype.componentDidMount=function(){var i=this,l=this.props,v=l.className,s=l.onBeforeLoad,c=l.mode,d=l.focus,o=l.theme,p=l.fontSize,e=l.value,t=l.defaultValue,r=l.cursorStart,h=l.showGutter,a=l.wrapEnabled,u=l.showPrintMargin,f=l.scrollMargin,m=f===void 0?[0,0,0,0]:f,y=l.keyboardHandler,x=l.onLoad,E=l.commands,b=l.annotations,g=l.markers,S=l.splits;this.editor=vn.edit(this.refEditor),this.isInShadow(this.refEditor)&&this.editor.renderer.attachToShadowRoot(),this.editor.setTheme("ace/theme/".concat(o)),s&&s(vn);var k=Object.keys(this.props.editorProps),D=new va.Split(this.editor.container,"ace/theme/".concat(o),S);this.editor.env.split=D,this.splitEditor=D.getEditor(0),this.split=D,this.editor.setShowPrintMargin(!1),this.editor.renderer.setShowGutter(!1);var _=this.splitEditor.$options;this.props.debounceChangePeriod&&(this.onChange=this.debounce(this.onChange,this.props.debounceChangePeriod)),D.forEach(function(A,$){for(var w=0;w<k.length;w++)A[k[w]]=i.props.editorProps[k[w]];var C=je(t,$),T=je(e,$,"");A.session.setUndoManager(new vn.UndoManager),A.setTheme("ace/theme/".concat(o)),A.renderer.setScrollMargin(m[0],m[1],m[2],m[3]),A.getSession().setMode("ace/mode/".concat(c)),A.setFontSize(p),A.renderer.setShowGutter(h),A.getSession().setUseWrapMode(a),A.setShowPrintMargin(u),A.on("focus",i.onFocus),A.on("blur",i.onBlur),A.on("input",i.onInput),A.on("copy",i.onCopy),A.on("paste",i.onPaste),A.on("change",i.onChange),A.getSession().selection.on("changeSelection",i.onSelectionChange),A.getSession().selection.on("changeCursor",i.onCursorChange),A.session.on("changeScrollTop",i.onScroll),A.setValue(C===void 0?T:C,r);var I=je(b,$,[]),O=je(g,$,[]);A.getSession().setAnnotations(I),O&&O.length>0&&i.handleMarkers(O,A);for(var w=0;w<ct.editorOptions.length;w++){var R=ct.editorOptions[w];_.hasOwnProperty(R)?A.setOption(R,i.props[R]):i.props[R]&&console.warn("ReaceAce: editor option ".concat(R," was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"))}i.handleOptions(i.props,A),Array.isArray(E)&&E.forEach(function(P){typeof P.exec=="string"?A.commands.bindKey(P.bindKey,P.exec):A.commands.addCommand(P)}),y&&A.setKeyboardHandler("ace/keyboard/"+y)}),v&&(this.refEditor.className+=" "+v),d&&this.splitEditor.focus();var F=this.editor.env.split;F.setOrientation(this.props.orientation==="below"?F.BELOW:F.BESIDE),F.resize(!0),x&&x(F)},n.prototype.componentDidUpdate=function(i){var l=this,v=i,s=this.props,c=this.editor.env.split;if(s.splits!==v.splits&&c.setSplits(s.splits),s.orientation!==v.orientation&&c.setOrientation(s.orientation==="below"?c.BELOW:c.BESIDE),c.forEach(function(e,t){s.mode!==v.mode&&e.getSession().setMode("ace/mode/"+s.mode),s.keyboardHandler!==v.keyboardHandler&&(s.keyboardHandler?e.setKeyboardHandler("ace/keyboard/"+s.keyboardHandler):e.setKeyboardHandler(null)),s.fontSize!==v.fontSize&&e.setFontSize(s.fontSize),s.wrapEnabled!==v.wrapEnabled&&e.getSession().setUseWrapMode(s.wrapEnabled),s.showPrintMargin!==v.showPrintMargin&&e.setShowPrintMargin(s.showPrintMargin),s.showGutter!==v.showGutter&&e.renderer.setShowGutter(s.showGutter);for(var r=0;r<ct.editorOptions.length;r++){var h=ct.editorOptions[r];s[h]!==v[h]&&e.setOption(h,s[h])}yn(s.setOptions,v.setOptions)||l.handleOptions(s,e);var a=je(s.value,t,"");if(e.getValue()!==a){l.silent=!0;var u=e.session.selection.toJSON();e.setValue(a,s.cursorStart),e.session.selection.fromJSON(u),l.silent=!1}var f=je(s.annotations,t,[]),m=je(v.annotations,t,[]);yn(f,m)||e.getSession().setAnnotations(f);var y=je(s.markers,t,[]),x=je(v.markers,t,[]);!yn(y,x)&&Array.isArray(y)&&l.handleMarkers(y,e)}),s.className!==v.className){var d=this.refEditor.className,o=d.trim().split(" "),p=v.className.trim().split(" ");p.forEach(function(e){var t=o.indexOf(e);o.splice(t,1)}),this.refEditor.className=" "+s.className+" "+o.join(" ")}s.theme!==v.theme&&c.setTheme("ace/theme/"+s.theme),s.focus&&!v.focus&&this.splitEditor.focus(),(s.height!==this.props.height||s.width!==this.props.width)&&this.editor.resize()},n.prototype.componentWillUnmount=function(){this.editor.destroy(),this.editor=null},n.prototype.onChange=function(i){if(this.props.onChange&&!this.silent){var l=[];this.editor.env.split.forEach(function(v){l.push(v.getValue())}),this.props.onChange(l,i)}},n.prototype.onSelectionChange=function(i){if(this.props.onSelectionChange){var l=[];this.editor.env.split.forEach(function(v){l.push(v.getSelection())}),this.props.onSelectionChange(l,i)}},n.prototype.onCursorChange=function(i){if(this.props.onCursorChange){var l=[];this.editor.env.split.forEach(function(v){l.push(v.getSelection())}),this.props.onCursorChange(l,i)}},n.prototype.onFocus=function(i){this.props.onFocus&&this.props.onFocus(i)},n.prototype.onInput=function(i){this.props.onInput&&this.props.onInput(i)},n.prototype.onBlur=function(i){this.props.onBlur&&this.props.onBlur(i)},n.prototype.onCopy=function(i){this.props.onCopy&&this.props.onCopy(i)},n.prototype.onPaste=function(i){this.props.onPaste&&this.props.onPaste(i)},n.prototype.onScroll=function(){this.props.onScroll&&this.props.onScroll(this.editor)},n.prototype.handleOptions=function(i,l){for(var v=Object.keys(i.setOptions),s=0;s<v.length;s++)l.setOption(v[s],i.setOptions[v[s]])},n.prototype.handleMarkers=function(i,l){var v=l.getSession().getMarkers(!0);for(var s in v)v.hasOwnProperty(s)&&l.getSession().removeMarker(v[s].id);v=l.getSession().getMarkers(!1);for(var s in v)v.hasOwnProperty(s)&&l.getSession().removeMarker(v[s].id);i.forEach(function(c){var d=c.startRow,o=c.startCol,p=c.endRow,e=c.endCol,t=c.className,r=c.type,h=c.inFront,a=h===void 0?!1:h,u=new ma.Range(d,o,p,e);l.getSession().addMarker(u,t,r,a)})},n.prototype.updateRef=function(i){this.refEditor=i},n.prototype.render=function(){var i=this.props,l=i.name,v=i.width,s=i.height,c=i.style,d=Tn({width:v,height:s},c);return di.createElement("div",{ref:this.updateRef,id:l,style:d})},n.propTypes={className:se.string,debounceChangePeriod:se.number,defaultValue:se.arrayOf(se.string),focus:se.bool,fontSize:se.oneOfType([se.number,se.string]),height:se.string,mode:se.string,name:se.string,onBlur:se.func,onChange:se.func,onCopy:se.func,onFocus:se.func,onInput:se.func,onLoad:se.func,onPaste:se.func,onScroll:se.func,orientation:se.string,showGutter:se.bool,splits:se.number,theme:se.string,value:se.arrayOf(se.string),width:se.string,onSelectionChange:se.func,onCursorChange:se.func,onBeforeLoad:se.func,minLines:se.number,maxLines:se.number,readOnly:se.bool,highlightActiveLine:se.bool,tabSize:se.number,showPrintMargin:se.bool,cursorStart:se.number,editorProps:se.object,setOptions:se.object,style:se.object,scrollMargin:se.array,annotations:se.array,markers:se.array,keyboardHandler:se.string,wrapEnabled:se.bool,enableBasicAutocompletion:se.oneOfType([se.bool,se.array]),enableLiveAutocompletion:se.oneOfType([se.bool,se.array]),commands:se.array},n.defaultProps={name:"ace-editor",focus:!1,orientation:"beside",splits:2,mode:"",theme:"",height:"500px",width:"500px",value:[],fontSize:12,showGutter:!0,onChange:null,onPaste:null,onLoad:null,onScroll:null,minLines:null,maxLines:null,readOnly:!1,highlightActiveLine:!0,showPrintMargin:!0,tabSize:4,cursorStart:1,editorProps:{},style:{},scrollMargin:[0,0,0,0],setOptions:{},wrapEnabled:!1,enableBasicAutocompletion:!1,enableLiveAutocompletion:!1},n}(di.Component);tt.default=ya;var Vi={exports:{}};(function(L){var n=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},i=-1,l=1,v=0;n.Diff=function(s,c){return[s,c]},n.prototype.diff_main=function(s,c,d,o){typeof o>"u"&&(this.Diff_Timeout<=0?o=Number.MAX_VALUE:o=new Date().getTime()+this.Diff_Timeout*1e3);var p=o;if(s==null||c==null)throw new Error("Null input. (diff_main)");if(s==c)return s?[new n.Diff(v,s)]:[];typeof d>"u"&&(d=!0);var e=d,t=this.diff_commonPrefix(s,c),r=s.substring(0,t);s=s.substring(t),c=c.substring(t),t=this.diff_commonSuffix(s,c);var h=s.substring(s.length-t);s=s.substring(0,s.length-t),c=c.substring(0,c.length-t);var a=this.diff_compute_(s,c,e,p);return r&&a.unshift(new n.Diff(v,r)),h&&a.push(new n.Diff(v,h)),this.diff_cleanupMerge(a),a},n.prototype.diff_compute_=function(s,c,d,o){var p;if(!s)return[new n.Diff(l,c)];if(!c)return[new n.Diff(i,s)];var e=s.length>c.length?s:c,t=s.length>c.length?c:s,r=e.indexOf(t);if(r!=-1)return p=[new n.Diff(l,e.substring(0,r)),new n.Diff(v,t),new n.Diff(l,e.substring(r+t.length))],s.length>c.length&&(p[0][0]=p[2][0]=i),p;if(t.length==1)return[new n.Diff(i,s),new n.Diff(l,c)];var h=this.diff_halfMatch_(s,c);if(h){var a=h[0],u=h[1],f=h[2],m=h[3],y=h[4],x=this.diff_main(a,f,d,o),E=this.diff_main(u,m,d,o);return x.concat([new n.Diff(v,y)],E)}return d&&s.length>100&&c.length>100?this.diff_lineMode_(s,c,o):this.diff_bisect_(s,c,o)},n.prototype.diff_lineMode_=function(s,c,d){var o=this.diff_linesToChars_(s,c);s=o.chars1,c=o.chars2;var p=o.lineArray,e=this.diff_main(s,c,!1,d);this.diff_charsToLines_(e,p),this.diff_cleanupSemantic(e),e.push(new n.Diff(v,""));for(var t=0,r=0,h=0,a="",u="";t<e.length;){switch(e[t][0]){case l:h++,u+=e[t][1];break;case i:r++,a+=e[t][1];break;case v:if(r>=1&&h>=1){e.splice(t-r-h,r+h),t=t-r-h;for(var f=this.diff_main(a,u,!1,d),m=f.length-1;m>=0;m--)e.splice(t,0,f[m]);t=t+f.length}h=0,r=0,a="",u="";break}t++}return e.pop(),e},n.prototype.diff_bisect_=function(s,c,d){for(var o=s.length,p=c.length,e=Math.ceil((o+p)/2),t=e,r=2*e,h=new Array(r),a=new Array(r),u=0;u<r;u++)h[u]=-1,a[u]=-1;h[t+1]=0,a[t+1]=0;for(var f=o-p,m=f%2!=0,y=0,x=0,E=0,b=0,g=0;g<e&&!(new Date().getTime()>d);g++){for(var S=-g+y;S<=g-x;S+=2){var k=t+S,D;S==-g||S!=g&&h[k-1]<h[k+1]?D=h[k+1]:D=h[k-1]+1;for(var _=D-S;D<o&&_<p&&s.charAt(D)==c.charAt(_);)D++,_++;if(h[k]=D,D>o)x+=2;else if(_>p)y+=2;else if(m){var F=t+f-S;if(F>=0&&F<r&&a[F]!=-1){var A=o-a[F];if(D>=A)return this.diff_bisectSplit_(s,c,D,_,d)}}}for(var $=-g+E;$<=g-b;$+=2){var F=t+$,A;$==-g||$!=g&&a[F-1]<a[F+1]?A=a[F+1]:A=a[F-1]+1;for(var w=A-$;A<o&&w<p&&s.charAt(o-A-1)==c.charAt(p-w-1);)A++,w++;if(a[F]=A,A>o)b+=2;else if(w>p)E+=2;else if(!m){var k=t+f-$;if(k>=0&&k<r&&h[k]!=-1){var D=h[k],_=t+D-k;if(A=o-A,D>=A)return this.diff_bisectSplit_(s,c,D,_,d)}}}}return[new n.Diff(i,s),new n.Diff(l,c)]},n.prototype.diff_bisectSplit_=function(s,c,d,o,p){var e=s.substring(0,d),t=c.substring(0,o),r=s.substring(d),h=c.substring(o),a=this.diff_main(e,t,!1,p),u=this.diff_main(r,h,!1,p);return a.concat(u)},n.prototype.diff_linesToChars_=function(s,c){var d=[],o={};d[0]="";function p(h){for(var a="",u=0,f=-1,m=d.length;f<h.length-1;){f=h.indexOf(`
|
|
1000
|
-
`,u),f==-1&&(f=h.length-1);var y=h.substring(u,f+1);(o.hasOwnProperty?o.hasOwnProperty(y):o[y]!==void 0)?a+=String.fromCharCode(o[y]):(m==e&&(y=h.substring(u),f=h.length),a+=String.fromCharCode(m),o[y]=m,d[m++]=y),u=f+1}return a}var e=4e4,t=p(s);e=65535;var r=p(c);return{chars1:t,chars2:r,lineArray:d}},n.prototype.diff_charsToLines_=function(s,c){for(var d=0;d<s.length;d++){for(var o=s[d][1],p=[],e=0;e<o.length;e++)p[e]=c[o.charCodeAt(e)];s[d][1]=p.join("")}},n.prototype.diff_commonPrefix=function(s,c){if(!s||!c||s.charAt(0)!=c.charAt(0))return 0;for(var d=0,o=Math.min(s.length,c.length),p=o,e=0;d<p;)s.substring(e,p)==c.substring(e,p)?(d=p,e=d):o=p,p=Math.floor((o-d)/2+d);return p},n.prototype.diff_commonSuffix=function(s,c){if(!s||!c||s.charAt(s.length-1)!=c.charAt(c.length-1))return 0;for(var d=0,o=Math.min(s.length,c.length),p=o,e=0;d<p;)s.substring(s.length-p,s.length-e)==c.substring(c.length-p,c.length-e)?(d=p,e=d):o=p,p=Math.floor((o-d)/2+d);return p},n.prototype.diff_commonOverlap_=function(s,c){var d=s.length,o=c.length;if(d==0||o==0)return 0;d>o?s=s.substring(d-o):d<o&&(c=c.substring(0,d));var p=Math.min(d,o);if(s==c)return p;for(var e=0,t=1;;){var r=s.substring(p-t),h=c.indexOf(r);if(h==-1)return e;t+=h,(h==0||s.substring(p-t)==c.substring(0,t))&&(e=t,t++)}},n.prototype.diff_halfMatch_=function(s,c){if(this.Diff_Timeout<=0)return null;var d=s.length>c.length?s:c,o=s.length>c.length?c:s;if(d.length<4||o.length*2<d.length)return null;var p=this;function e(x,E,b){for(var g=x.substring(b,b+Math.floor(x.length/4)),S=-1,k="",D,_,F,A;(S=E.indexOf(g,S+1))!=-1;){var $=p.diff_commonPrefix(x.substring(b),E.substring(S)),w=p.diff_commonSuffix(x.substring(0,b),E.substring(0,S));k.length<w+$&&(k=E.substring(S-w,S)+E.substring(S,S+$),D=x.substring(0,b-w),_=x.substring(b+$),F=E.substring(0,S-w),A=E.substring(S+$))}return k.length*2>=x.length?[D,_,F,A,k]:null}var t=e(d,o,Math.ceil(d.length/4)),r=e(d,o,Math.ceil(d.length/2)),h;if(!t&&!r)return null;r?t?h=t[4].length>r[4].length?t:r:h=r:h=t;var a,u,f,m;s.length>c.length?(a=h[0],u=h[1],f=h[2],m=h[3]):(f=h[0],m=h[1],a=h[2],u=h[3]);var y=h[4];return[a,u,f,m,y]},n.prototype.diff_cleanupSemantic=function(s){for(var c=!1,d=[],o=0,p=null,e=0,t=0,r=0,h=0,a=0;e<s.length;)s[e][0]==v?(d[o++]=e,t=h,r=a,h=0,a=0,p=s[e][1]):(s[e][0]==l?h+=s[e][1].length:a+=s[e][1].length,p&&p.length<=Math.max(t,r)&&p.length<=Math.max(h,a)&&(s.splice(d[o-1],0,new n.Diff(i,p)),s[d[o-1]+1][0]=l,o--,o--,e=o>0?d[o-1]:-1,t=0,r=0,h=0,a=0,p=null,c=!0)),e++;for(c&&this.diff_cleanupMerge(s),this.diff_cleanupSemanticLossless(s),e=1;e<s.length;){if(s[e-1][0]==i&&s[e][0]==l){var u=s[e-1][1],f=s[e][1],m=this.diff_commonOverlap_(u,f),y=this.diff_commonOverlap_(f,u);m>=y?(m>=u.length/2||m>=f.length/2)&&(s.splice(e,0,new n.Diff(v,f.substring(0,m))),s[e-1][1]=u.substring(0,u.length-m),s[e+1][1]=f.substring(m),e++):(y>=u.length/2||y>=f.length/2)&&(s.splice(e,0,new n.Diff(v,u.substring(0,y))),s[e-1][0]=l,s[e-1][1]=f.substring(0,f.length-y),s[e+1][0]=i,s[e+1][1]=u.substring(y),e++),e++}e++}},n.prototype.diff_cleanupSemanticLossless=function(s){function c(y,x){if(!y||!x)return 6;var E=y.charAt(y.length-1),b=x.charAt(0),g=E.match(n.nonAlphaNumericRegex_),S=b.match(n.nonAlphaNumericRegex_),k=g&&E.match(n.whitespaceRegex_),D=S&&b.match(n.whitespaceRegex_),_=k&&E.match(n.linebreakRegex_),F=D&&b.match(n.linebreakRegex_),A=_&&y.match(n.blanklineEndRegex_),$=F&&x.match(n.blanklineStartRegex_);return A||$?5:_||F?4:g&&!k&&D?3:k||D?2:g||S?1:0}for(var d=1;d<s.length-1;){if(s[d-1][0]==v&&s[d+1][0]==v){var o=s[d-1][1],p=s[d][1],e=s[d+1][1],t=this.diff_commonSuffix(o,p);if(t){var r=p.substring(p.length-t);o=o.substring(0,o.length-t),p=r+p.substring(0,p.length-t),e=r+e}for(var h=o,a=p,u=e,f=c(o,p)+c(p,e);p.charAt(0)===e.charAt(0);){o+=p.charAt(0),p=p.substring(1)+e.charAt(0),e=e.substring(1);var m=c(o,p)+c(p,e);m>=f&&(f=m,h=o,a=p,u=e)}s[d-1][1]!=h&&(h?s[d-1][1]=h:(s.splice(d-1,1),d--),s[d][1]=a,u?s[d+1][1]=u:(s.splice(d+1,1),d--))}d++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(s){for(var c=!1,d=[],o=0,p=null,e=0,t=!1,r=!1,h=!1,a=!1;e<s.length;)s[e][0]==v?(s[e][1].length<this.Diff_EditCost&&(h||a)?(d[o++]=e,t=h,r=a,p=s[e][1]):(o=0,p=null),h=a=!1):(s[e][0]==i?a=!0:h=!0,p&&(t&&r&&h&&a||p.length<this.Diff_EditCost/2&&t+r+h+a==3)&&(s.splice(d[o-1],0,new n.Diff(i,p)),s[d[o-1]+1][0]=l,o--,p=null,t&&r?(h=a=!0,o=0):(o--,e=o>0?d[o-1]:-1,h=a=!1),c=!0)),e++;c&&this.diff_cleanupMerge(s)},n.prototype.diff_cleanupMerge=function(s){s.push(new n.Diff(v,""));for(var c=0,d=0,o=0,p="",e="",t;c<s.length;)switch(s[c][0]){case l:o++,e+=s[c][1],c++;break;case i:d++,p+=s[c][1],c++;break;case v:d+o>1?(d!==0&&o!==0&&(t=this.diff_commonPrefix(e,p),t!==0&&(c-d-o>0&&s[c-d-o-1][0]==v?s[c-d-o-1][1]+=e.substring(0,t):(s.splice(0,0,new n.Diff(v,e.substring(0,t))),c++),e=e.substring(t),p=p.substring(t)),t=this.diff_commonSuffix(e,p),t!==0&&(s[c][1]=e.substring(e.length-t)+s[c][1],e=e.substring(0,e.length-t),p=p.substring(0,p.length-t))),c-=d+o,s.splice(c,d+o),p.length&&(s.splice(c,0,new n.Diff(i,p)),c++),e.length&&(s.splice(c,0,new n.Diff(l,e)),c++),c++):c!==0&&s[c-1][0]==v?(s[c-1][1]+=s[c][1],s.splice(c,1)):c++,o=0,d=0,p="",e="";break}s[s.length-1][1]===""&&s.pop();var r=!1;for(c=1;c<s.length-1;)s[c-1][0]==v&&s[c+1][0]==v&&(s[c][1].substring(s[c][1].length-s[c-1][1].length)==s[c-1][1]?(s[c][1]=s[c-1][1]+s[c][1].substring(0,s[c][1].length-s[c-1][1].length),s[c+1][1]=s[c-1][1]+s[c+1][1],s.splice(c-1,1),r=!0):s[c][1].substring(0,s[c+1][1].length)==s[c+1][1]&&(s[c-1][1]+=s[c+1][1],s[c][1]=s[c][1].substring(s[c+1][1].length)+s[c+1][1],s.splice(c+1,1),r=!0)),c++;r&&this.diff_cleanupMerge(s)},n.prototype.diff_xIndex=function(s,c){var d=0,o=0,p=0,e=0,t;for(t=0;t<s.length&&(s[t][0]!==l&&(d+=s[t][1].length),s[t][0]!==i&&(o+=s[t][1].length),!(d>c));t++)p=d,e=o;return s.length!=t&&s[t][0]===i?e:e+(c-p)},n.prototype.diff_prettyHtml=function(s){for(var c=[],d=/&/g,o=/</g,p=/>/g,e=/\n/g,t=0;t<s.length;t++){var r=s[t][0],h=s[t][1],a=h.replace(d,"&").replace(o,"<").replace(p,">").replace(e,"¶<br>");switch(r){case l:c[t]='<ins style="background:#e6ffe6;">'+a+"</ins>";break;case i:c[t]='<del style="background:#ffe6e6;">'+a+"</del>";break;case v:c[t]="<span>"+a+"</span>";break}}return c.join("")},n.prototype.diff_text1=function(s){for(var c=[],d=0;d<s.length;d++)s[d][0]!==l&&(c[d]=s[d][1]);return c.join("")},n.prototype.diff_text2=function(s){for(var c=[],d=0;d<s.length;d++)s[d][0]!==i&&(c[d]=s[d][1]);return c.join("")},n.prototype.diff_levenshtein=function(s){for(var c=0,d=0,o=0,p=0;p<s.length;p++){var e=s[p][0],t=s[p][1];switch(e){case l:d+=t.length;break;case i:o+=t.length;break;case v:c+=Math.max(d,o),d=0,o=0;break}}return c+=Math.max(d,o),c},n.prototype.diff_toDelta=function(s){for(var c=[],d=0;d<s.length;d++)switch(s[d][0]){case l:c[d]="+"+encodeURI(s[d][1]);break;case i:c[d]="-"+s[d][1].length;break;case v:c[d]="="+s[d][1].length;break}return c.join(" ").replace(/%20/g," ")},n.prototype.diff_fromDelta=function(s,c){for(var d=[],o=0,p=0,e=c.split(/\t/g),t=0;t<e.length;t++){var r=e[t].substring(1);switch(e[t].charAt(0)){case"+":try{d[o++]=new n.Diff(l,decodeURI(r))}catch{throw new Error("Illegal escape in diff_fromDelta: "+r)}break;case"-":case"=":var h=parseInt(r,10);if(isNaN(h)||h<0)throw new Error("Invalid number in diff_fromDelta: "+r);var a=s.substring(p,p+=h);e[t].charAt(0)=="="?d[o++]=new n.Diff(v,a):d[o++]=new n.Diff(i,a);break;default:if(e[t])throw new Error("Invalid diff operation in diff_fromDelta: "+e[t])}}if(p!=s.length)throw new Error("Delta length ("+p+") does not equal source text length ("+s.length+").");return d},n.prototype.match_main=function(s,c,d){if(s==null||c==null||d==null)throw new Error("Null input. (match_main)");return d=Math.max(0,Math.min(d,s.length)),s==c?0:s.length?s.substring(d,d+c.length)==c?d:this.match_bitap_(s,c,d):-1},n.prototype.match_bitap_=function(s,c,d){if(c.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var o=this.match_alphabet_(c),p=this;function e(D,_){var F=D/c.length,A=Math.abs(d-_);return p.Match_Distance?F+A/p.Match_Distance:A?1:F}var t=this.Match_Threshold,r=s.indexOf(c,d);r!=-1&&(t=Math.min(e(0,r),t),r=s.lastIndexOf(c,d+c.length),r!=-1&&(t=Math.min(e(0,r),t)));var h=1<<c.length-1;r=-1;for(var a,u,f=c.length+s.length,m,y=0;y<c.length;y++){for(a=0,u=f;a<u;)e(y,d+u)<=t?a=u:f=u,u=Math.floor((f-a)/2+a);f=u;var x=Math.max(1,d-u+1),E=Math.min(d+u,s.length)+c.length,b=Array(E+2);b[E+1]=(1<<y)-1;for(var g=E;g>=x;g--){var S=o[s.charAt(g-1)];if(y===0?b[g]=(b[g+1]<<1|1)&S:b[g]=(b[g+1]<<1|1)&S|((m[g+1]|m[g])<<1|1)|m[g+1],b[g]&h){var k=e(y,g-1);if(k<=t)if(t=k,r=g-1,r>d)x=Math.max(1,2*d-r);else break}}if(e(y+1,d)>t)break;m=b}return r},n.prototype.match_alphabet_=function(s){for(var c={},d=0;d<s.length;d++)c[s.charAt(d)]=0;for(var d=0;d<s.length;d++)c[s.charAt(d)]|=1<<s.length-d-1;return c},n.prototype.patch_addContext_=function(s,c){if(c.length!=0){if(s.start2===null)throw Error("patch not initialized");for(var d=c.substring(s.start2,s.start2+s.length1),o=0;c.indexOf(d)!=c.lastIndexOf(d)&&d.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)o+=this.Patch_Margin,d=c.substring(s.start2-o,s.start2+s.length1+o);o+=this.Patch_Margin;var p=c.substring(s.start2-o,s.start2);p&&s.diffs.unshift(new n.Diff(v,p));var e=c.substring(s.start2+s.length1,s.start2+s.length1+o);e&&s.diffs.push(new n.Diff(v,e)),s.start1-=p.length,s.start2-=p.length,s.length1+=p.length+e.length,s.length2+=p.length+e.length}},n.prototype.patch_make=function(s,c,d){var o,p;if(typeof s=="string"&&typeof c=="string"&&typeof d>"u")o=s,p=this.diff_main(o,c,!0),p.length>2&&(this.diff_cleanupSemantic(p),this.diff_cleanupEfficiency(p));else if(s&&typeof s=="object"&&typeof c>"u"&&typeof d>"u")p=s,o=this.diff_text1(p);else if(typeof s=="string"&&c&&typeof c=="object"&&typeof d>"u")o=s,p=c;else if(typeof s=="string"&&typeof c=="string"&&d&&typeof d=="object")o=s,p=d;else throw new Error("Unknown call format to patch_make.");if(p.length===0)return[];for(var e=[],t=new n.patch_obj,r=0,h=0,a=0,u=o,f=o,m=0;m<p.length;m++){var y=p[m][0],x=p[m][1];switch(!r&&y!==v&&(t.start1=h,t.start2=a),y){case l:t.diffs[r++]=p[m],t.length2+=x.length,f=f.substring(0,a)+x+f.substring(a);break;case i:t.length1+=x.length,t.diffs[r++]=p[m],f=f.substring(0,a)+f.substring(a+x.length);break;case v:x.length<=2*this.Patch_Margin&&r&&p.length!=m+1?(t.diffs[r++]=p[m],t.length1+=x.length,t.length2+=x.length):x.length>=2*this.Patch_Margin&&r&&(this.patch_addContext_(t,u),e.push(t),t=new n.patch_obj,r=0,u=f,h=a);break}y!==l&&(h+=x.length),y!==i&&(a+=x.length)}return r&&(this.patch_addContext_(t,u),e.push(t)),e},n.prototype.patch_deepCopy=function(s){for(var c=[],d=0;d<s.length;d++){var o=s[d],p=new n.patch_obj;p.diffs=[];for(var e=0;e<o.diffs.length;e++)p.diffs[e]=new n.Diff(o.diffs[e][0],o.diffs[e][1]);p.start1=o.start1,p.start2=o.start2,p.length1=o.length1,p.length2=o.length2,c[d]=p}return c},n.prototype.patch_apply=function(s,c){if(s.length==0)return[c,[]];s=this.patch_deepCopy(s);var d=this.patch_addPadding(s);c=d+c+d,this.patch_splitMax(s);for(var o=0,p=[],e=0;e<s.length;e++){var t=s[e].start2+o,r=this.diff_text1(s[e].diffs),h,a=-1;if(r.length>this.Match_MaxBits?(h=this.match_main(c,r.substring(0,this.Match_MaxBits),t),h!=-1&&(a=this.match_main(c,r.substring(r.length-this.Match_MaxBits),t+r.length-this.Match_MaxBits),(a==-1||h>=a)&&(h=-1))):h=this.match_main(c,r,t),h==-1)p[e]=!1,o-=s[e].length2-s[e].length1;else{p[e]=!0,o=h-t;var u;if(a==-1?u=c.substring(h,h+r.length):u=c.substring(h,a+this.Match_MaxBits),r==u)c=c.substring(0,h)+this.diff_text2(s[e].diffs)+c.substring(h+r.length);else{var f=this.diff_main(r,u,!1);if(r.length>this.Match_MaxBits&&this.diff_levenshtein(f)/r.length>this.Patch_DeleteThreshold)p[e]=!1;else{this.diff_cleanupSemanticLossless(f);for(var m=0,y,x=0;x<s[e].diffs.length;x++){var E=s[e].diffs[x];E[0]!==v&&(y=this.diff_xIndex(f,m)),E[0]===l?c=c.substring(0,h+y)+E[1]+c.substring(h+y):E[0]===i&&(c=c.substring(0,h+y)+c.substring(h+this.diff_xIndex(f,m+E[1].length))),E[0]!==i&&(m+=E[1].length)}}}}}return c=c.substring(d.length,c.length-d.length),[c,p]},n.prototype.patch_addPadding=function(s){for(var c=this.Patch_Margin,d="",o=1;o<=c;o++)d+=String.fromCharCode(o);for(var o=0;o<s.length;o++)s[o].start1+=c,s[o].start2+=c;var p=s[0],e=p.diffs;if(e.length==0||e[0][0]!=v)e.unshift(new n.Diff(v,d)),p.start1-=c,p.start2-=c,p.length1+=c,p.length2+=c;else if(c>e[0][1].length){var t=c-e[0][1].length;e[0][1]=d.substring(e[0][1].length)+e[0][1],p.start1-=t,p.start2-=t,p.length1+=t,p.length2+=t}if(p=s[s.length-1],e=p.diffs,e.length==0||e[e.length-1][0]!=v)e.push(new n.Diff(v,d)),p.length1+=c,p.length2+=c;else if(c>e[e.length-1][1].length){var t=c-e[e.length-1][1].length;e[e.length-1][1]+=d.substring(0,t),p.length1+=t,p.length2+=t}return d},n.prototype.patch_splitMax=function(s){for(var c=this.Match_MaxBits,d=0;d<s.length;d++)if(!(s[d].length1<=c)){var o=s[d];s.splice(d--,1);for(var p=o.start1,e=o.start2,t="";o.diffs.length!==0;){var r=new n.patch_obj,h=!0;for(r.start1=p-t.length,r.start2=e-t.length,t!==""&&(r.length1=r.length2=t.length,r.diffs.push(new n.Diff(v,t)));o.diffs.length!==0&&r.length1<c-this.Patch_Margin;){var a=o.diffs[0][0],u=o.diffs[0][1];a===l?(r.length2+=u.length,e+=u.length,r.diffs.push(o.diffs.shift()),h=!1):a===i&&r.diffs.length==1&&r.diffs[0][0]==v&&u.length>2*c?(r.length1+=u.length,p+=u.length,h=!1,r.diffs.push(new n.Diff(a,u)),o.diffs.shift()):(u=u.substring(0,c-r.length1-this.Patch_Margin),r.length1+=u.length,p+=u.length,a===v?(r.length2+=u.length,e+=u.length):h=!1,r.diffs.push(new n.Diff(a,u)),u==o.diffs[0][1]?o.diffs.shift():o.diffs[0][1]=o.diffs[0][1].substring(u.length))}t=this.diff_text2(r.diffs),t=t.substring(t.length-this.Patch_Margin);var f=this.diff_text1(o.diffs).substring(0,this.Patch_Margin);f!==""&&(r.length1+=f.length,r.length2+=f.length,r.diffs.length!==0&&r.diffs[r.diffs.length-1][0]===v?r.diffs[r.diffs.length-1][1]+=f:r.diffs.push(new n.Diff(v,f))),h||s.splice(++d,0,r)}}},n.prototype.patch_toText=function(s){for(var c=[],d=0;d<s.length;d++)c[d]=s[d];return c.join("")},n.prototype.patch_fromText=function(s){var c=[];if(!s)return c;for(var d=s.split(`
|
|
999
|
+
`,"error_marker.css",!1)}),ace.define("ace/ace",["require","exports","module","ace/lib/dom","ace/range","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config","ace/loader_build"],function(i,l,v){i("./loader_build")(l);var s=i("./lib/dom"),c=i("./range").Range,d=i("./editor").Editor,o=i("./edit_session").EditSession,p=i("./undomanager").UndoManager,e=i("./virtual_renderer").VirtualRenderer;i("./worker/worker_client"),i("./keyboard/hash_handler"),i("./placeholder"),i("./multi_select"),i("./mode/folding/fold_mode"),i("./theme/textmate"),i("./ext/error_marker"),l.config=i("./config"),l.edit=function(r,h){if(typeof r=="string"){var a=r;if(r=document.getElementById(a),!r)throw new Error("ace.edit can't find div #"+a)}if(r&&r.env&&r.env.editor instanceof d)return r.env.editor;var u="";if(r&&/input|textarea/i.test(r.tagName)){var f=r;u=f.value,r=s.createElement("pre"),f.parentNode.replaceChild(r,f)}else r&&(u=r.textContent,r.innerHTML="");var m=l.createEditSession(u),y=new d(new e(r),m,h),x={document:m,editor:y,onResize:y.resize.bind(y,null)};return f&&(x.textarea=f),y.on("destroy",function(){x.editor.container.env=null}),y.container.env=y.env=x,y},l.createEditSession=function(r,h){var a=new o(r,h);return a.setUndoManager(new p),a},l.Range=c,l.Editor=d,l.EditSession=o,l.UndoManager=p,l.VirtualRenderer=e;var t=l.config.version;l.version=t}),function(){ace.require(["ace/ace"],function(i){i&&(i.config.init(!0),i.define=ace.define);var l=function(){return this}();!l&&typeof window<"u"&&(l=window),!l&&typeof self<"u"&&(l=self),l.ace||(l.ace=i);for(var v in i)i.hasOwnProperty(v)&&(l.ace[v]=i[v]);l.ace.default=l.ace,L&&(L.exports=l.ace)})}()})(Ii);var Xt=Ii.exports,qt={exports:{}};qt.exports;(function(L,n){var i=200,l="__lodash_hash_undefined__",v=1,s=2,c=9007199254740991,d="[object Arguments]",o="[object Array]",p="[object AsyncFunction]",e="[object Boolean]",t="[object Date]",r="[object Error]",h="[object Function]",a="[object GeneratorFunction]",u="[object Map]",f="[object Number]",m="[object Null]",y="[object Object]",x="[object Promise]",E="[object Proxy]",w="[object RegExp]",g="[object Set]",S="[object String]",k="[object Symbol]",D="[object Undefined]",_="[object WeakMap]",F="[object ArrayBuffer]",A="[object DataView]",$="[object Float32Array]",C="[object Float64Array]",b="[object Int8Array]",T="[object Int16Array]",I="[object Int32Array]",O="[object Uint8Array]",N="[object Uint8ClampedArray]",P="[object Uint16Array]",B="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,W=/^\[object .+?Constructor\]$/,z=/^(?:0|[1-9]\d*)$/,U={};U[$]=U[C]=U[b]=U[T]=U[I]=U[O]=U[N]=U[P]=U[B]=!0,U[d]=U[o]=U[F]=U[e]=U[A]=U[t]=U[r]=U[h]=U[u]=U[f]=U[y]=U[w]=U[g]=U[S]=U[_]=!1;var G=typeof ke=="object"&&ke&&ke.Object===Object&&ke,Y=typeof self=="object"&&self&&self.Object===Object&&self,Q=G||Y||Function("return this")(),q=n&&!n.nodeType&&n,te=q&&!0&&L&&!L.nodeType&&L,re=te&&te.exports===q,ue=re&&G.process,me=function(){try{return ue&&ue.binding&&ue.binding("util")}catch{}}(),Ce=me&&me.isTypedArray;function ve(H,J){for(var ee=-1,ne=H==null?0:H.length,de=0,ae=[];++ee<ne;){var be=H[ee];J(be,ee,H)&&(ae[de++]=be)}return ae}function $e(H,J){for(var ee=-1,ne=J.length,de=H.length;++ee<ne;)H[de+ee]=J[ee];return H}function Lt(H,J){for(var ee=-1,ne=H==null?0:H.length;++ee<ne;)if(J(H[ee],ee,H))return!0;return!1}function gt(H,J){for(var ee=-1,ne=Array(H);++ee<H;)ne[ee]=J(ee);return ne}function Vi(H){return function(J){return H(J)}}function Ui(H,J){return H.has(J)}function Gi(H,J){return H==null?void 0:H[J]}function Ki(H){var J=-1,ee=Array(H.size);return H.forEach(function(ne,de){ee[++J]=[de,ne]}),ee}function Ji(H,J){return function(ee){return H(J(ee))}}function Yi(H){var J=-1,ee=Array(H.size);return H.forEach(function(ne){ee[++J]=ne}),ee}var Qi=Array.prototype,Zi=Function.prototype,It=Object.prototype,rn=Q["__core-js_shared__"],On=Zi.toString,Pe=It.hasOwnProperty,Rn=function(){var H=/[^.]+$/.exec(rn&&rn.keys&&rn.keys.IE_PROTO||"");return H?"Symbol(src)_1."+H:""}(),Nn=It.toString,Xi=RegExp("^"+On.call(Pe).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bn=re?Q.Buffer:void 0,Ft=Q.Symbol,Pn=Q.Uint8Array,Wn=It.propertyIsEnumerable,qi=Qi.splice,nt=Ft?Ft.toStringTag:void 0,zn=Object.getOwnPropertySymbols,er=Bn?Bn.isBuffer:void 0,tr=Ji(Object.keys,Object),sn=mt(Q,"DataView"),Et=mt(Q,"Map"),on=mt(Q,"Promise"),an=mt(Q,"Set"),ln=mt(Q,"WeakMap"),St=mt(Object,"create"),nr=st(sn),ir=st(Et),rr=st(on),sr=st(an),or=st(ln),Hn=Ft?Ft.prototype:void 0,hn=Hn?Hn.valueOf:void 0;function it(H){var J=-1,ee=H==null?0:H.length;for(this.clear();++J<ee;){var ne=H[J];this.set(ne[0],ne[1])}}function ar(){this.__data__=St?St(null):{},this.size=0}function lr(H){var J=this.has(H)&&delete this.__data__[H];return this.size-=J?1:0,J}function hr(H){var J=this.__data__;if(St){var ee=J[H];return ee===l?void 0:ee}return Pe.call(J,H)?J[H]:void 0}function cr(H){var J=this.__data__;return St?J[H]!==void 0:Pe.call(J,H)}function ur(H,J){var ee=this.__data__;return this.size+=this.has(H)?0:1,ee[H]=St&&J===void 0?l:J,this}it.prototype.clear=ar,it.prototype.delete=lr,it.prototype.get=hr,it.prototype.has=cr,it.prototype.set=ur;function ze(H){var J=-1,ee=H==null?0:H.length;for(this.clear();++J<ee;){var ne=H[J];this.set(ne[0],ne[1])}}function pr(){this.__data__=[],this.size=0}function dr(H){var J=this.__data__,ee=Rt(J,H);if(ee<0)return!1;var ne=J.length-1;return ee==ne?J.pop():qi.call(J,ee,1),--this.size,!0}function fr(H){var J=this.__data__,ee=Rt(J,H);return ee<0?void 0:J[ee][1]}function gr(H){return Rt(this.__data__,H)>-1}function mr(H,J){var ee=this.__data__,ne=Rt(ee,H);return ne<0?(++this.size,ee.push([H,J])):ee[ne][1]=J,this}ze.prototype.clear=pr,ze.prototype.delete=dr,ze.prototype.get=fr,ze.prototype.has=gr,ze.prototype.set=mr;function rt(H){var J=-1,ee=H==null?0:H.length;for(this.clear();++J<ee;){var ne=H[J];this.set(ne[0],ne[1])}}function vr(){this.size=0,this.__data__={hash:new it,map:new(Et||ze),string:new it}}function yr(H){var J=Nt(this,H).delete(H);return this.size-=J?1:0,J}function br(H){return Nt(this,H).get(H)}function wr(H){return Nt(this,H).has(H)}function Cr(H,J){var ee=Nt(this,H),ne=ee.size;return ee.set(H,J),this.size+=ee.size==ne?0:1,this}rt.prototype.clear=vr,rt.prototype.delete=yr,rt.prototype.get=br,rt.prototype.has=wr,rt.prototype.set=Cr;function Ot(H){var J=-1,ee=H==null?0:H.length;for(this.__data__=new rt;++J<ee;)this.add(H[J])}function Er(H){return this.__data__.set(H,l),this}function Sr(H){return this.__data__.has(H)}Ot.prototype.add=Ot.prototype.push=Er,Ot.prototype.has=Sr;function Ke(H){var J=this.__data__=new ze(H);this.size=J.size}function Dr(){this.__data__=new ze,this.size=0}function xr(H){var J=this.__data__,ee=J.delete(H);return this.size=J.size,ee}function Ar(H){return this.__data__.get(H)}function $r(H){return this.__data__.has(H)}function Tr(H,J){var ee=this.__data__;if(ee instanceof ze){var ne=ee.__data__;if(!Et||ne.length<i-1)return ne.push([H,J]),this.size=++ee.size,this;ee=this.__data__=new rt(ne)}return ee.set(H,J),this.size=ee.size,this}Ke.prototype.clear=Dr,Ke.prototype.delete=xr,Ke.prototype.get=Ar,Ke.prototype.has=$r,Ke.prototype.set=Tr;function _r(H,J){var ee=Bt(H),ne=!ee&&Vr(H),de=!ee&&!ne&&cn(H),ae=!ee&&!ne&&!de&&Zn(H),be=ee||ne||de||ae,Ee=be?gt(H.length,String):[],De=Ee.length;for(var ye in H)Pe.call(H,ye)&&!(be&&(ye=="length"||de&&(ye=="offset"||ye=="parent")||ae&&(ye=="buffer"||ye=="byteLength"||ye=="byteOffset")||Pr(ye,De)))&&Ee.push(ye);return Ee}function Rt(H,J){for(var ee=H.length;ee--;)if(Kn(H[ee][0],J))return ee;return-1}function kr(H,J,ee){var ne=J(H);return Bt(H)?ne:$e(ne,ee(H))}function Dt(H){return H==null?H===void 0?D:m:nt&&nt in Object(H)?Nr(H):jr(H)}function jn(H){return xt(H)&&Dt(H)==d}function Vn(H,J,ee,ne,de){return H===J?!0:H==null||J==null||!xt(H)&&!xt(J)?H!==H&&J!==J:Mr(H,J,ee,ne,Vn,de)}function Mr(H,J,ee,ne,de,ae){var be=Bt(H),Ee=Bt(J),De=be?o:Je(H),ye=Ee?o:Je(J);De=De==d?y:De,ye=ye==d?y:ye;var Te=De==y,Fe=ye==y,xe=De==ye;if(xe&&cn(H)){if(!cn(J))return!1;be=!0,Te=!1}if(xe&&!Te)return ae||(ae=new Ke),be||Zn(H)?Un(H,J,ee,ne,de,ae):Or(H,J,De,ee,ne,de,ae);if(!(ee&v)){var Me=Te&&Pe.call(H,"__wrapped__"),Le=Fe&&Pe.call(J,"__wrapped__");if(Me||Le){var Ye=Me?H.value():H,He=Le?J.value():J;return ae||(ae=new Ke),de(Ye,He,ee,ne,ae)}}return xe?(ae||(ae=new Ke),Rr(H,J,ee,ne,de,ae)):!1}function Lr(H){if(!Qn(H)||zr(H))return!1;var J=Jn(H)?Xi:W;return J.test(st(H))}function Ir(H){return xt(H)&&Yn(H.length)&&!!U[Dt(H)]}function Fr(H){if(!Hr(H))return tr(H);var J=[];for(var ee in Object(H))Pe.call(H,ee)&&ee!="constructor"&&J.push(ee);return J}function Un(H,J,ee,ne,de,ae){var be=ee&v,Ee=H.length,De=J.length;if(Ee!=De&&!(be&&De>Ee))return!1;var ye=ae.get(H);if(ye&&ae.get(J))return ye==J;var Te=-1,Fe=!0,xe=ee&s?new Ot:void 0;for(ae.set(H,J),ae.set(J,H);++Te<Ee;){var Me=H[Te],Le=J[Te];if(ne)var Ye=be?ne(Le,Me,Te,J,H,ae):ne(Me,Le,Te,H,J,ae);if(Ye!==void 0){if(Ye)continue;Fe=!1;break}if(xe){if(!Lt(J,function(He,ot){if(!Ui(xe,ot)&&(Me===He||de(Me,He,ee,ne,ae)))return xe.push(ot)})){Fe=!1;break}}else if(!(Me===Le||de(Me,Le,ee,ne,ae))){Fe=!1;break}}return ae.delete(H),ae.delete(J),Fe}function Or(H,J,ee,ne,de,ae,be){switch(ee){case A:if(H.byteLength!=J.byteLength||H.byteOffset!=J.byteOffset)return!1;H=H.buffer,J=J.buffer;case F:return!(H.byteLength!=J.byteLength||!ae(new Pn(H),new Pn(J)));case e:case t:case f:return Kn(+H,+J);case r:return H.name==J.name&&H.message==J.message;case w:case S:return H==J+"";case u:var Ee=Ki;case g:var De=ne&v;if(Ee||(Ee=Yi),H.size!=J.size&&!De)return!1;var ye=be.get(H);if(ye)return ye==J;ne|=s,be.set(H,J);var Te=Un(Ee(H),Ee(J),ne,de,ae,be);return be.delete(H),Te;case k:if(hn)return hn.call(H)==hn.call(J)}return!1}function Rr(H,J,ee,ne,de,ae){var be=ee&v,Ee=Gn(H),De=Ee.length,ye=Gn(J),Te=ye.length;if(De!=Te&&!be)return!1;for(var Fe=De;Fe--;){var xe=Ee[Fe];if(!(be?xe in J:Pe.call(J,xe)))return!1}var Me=ae.get(H);if(Me&&ae.get(J))return Me==J;var Le=!0;ae.set(H,J),ae.set(J,H);for(var Ye=be;++Fe<De;){xe=Ee[Fe];var He=H[xe],ot=J[xe];if(ne)var Xn=be?ne(ot,He,xe,J,H,ae):ne(He,ot,xe,H,J,ae);if(!(Xn===void 0?He===ot||de(He,ot,ee,ne,ae):Xn)){Le=!1;break}Ye||(Ye=xe=="constructor")}if(Le&&!Ye){var Pt=H.constructor,Wt=J.constructor;Pt!=Wt&&"constructor"in H&&"constructor"in J&&!(typeof Pt=="function"&&Pt instanceof Pt&&typeof Wt=="function"&&Wt instanceof Wt)&&(Le=!1)}return ae.delete(H),ae.delete(J),Le}function Gn(H){return kr(H,Kr,Br)}function Nt(H,J){var ee=H.__data__;return Wr(J)?ee[typeof J=="string"?"string":"hash"]:ee.map}function mt(H,J){var ee=Gi(H,J);return Lr(ee)?ee:void 0}function Nr(H){var J=Pe.call(H,nt),ee=H[nt];try{H[nt]=void 0;var ne=!0}catch{}var de=Nn.call(H);return ne&&(J?H[nt]=ee:delete H[nt]),de}var Br=zn?function(H){return H==null?[]:(H=Object(H),ve(zn(H),function(J){return Wn.call(H,J)}))}:Jr,Je=Dt;(sn&&Je(new sn(new ArrayBuffer(1)))!=A||Et&&Je(new Et)!=u||on&&Je(on.resolve())!=x||an&&Je(new an)!=g||ln&&Je(new ln)!=_)&&(Je=function(H){var J=Dt(H),ee=J==y?H.constructor:void 0,ne=ee?st(ee):"";if(ne)switch(ne){case nr:return A;case ir:return u;case rr:return x;case sr:return g;case or:return _}return J});function Pr(H,J){return J=J??c,!!J&&(typeof H=="number"||z.test(H))&&H>-1&&H%1==0&&H<J}function Wr(H){var J=typeof H;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?H!=="__proto__":H===null}function zr(H){return!!Rn&&Rn in H}function Hr(H){var J=H&&H.constructor,ee=typeof J=="function"&&J.prototype||It;return H===ee}function jr(H){return Nn.call(H)}function st(H){if(H!=null){try{return On.call(H)}catch{}try{return H+""}catch{}}return""}function Kn(H,J){return H===J||H!==H&&J!==J}var Vr=jn(function(){return arguments}())?jn:function(H){return xt(H)&&Pe.call(H,"callee")&&!Wn.call(H,"callee")},Bt=Array.isArray;function Ur(H){return H!=null&&Yn(H.length)&&!Jn(H)}var cn=er||Yr;function Gr(H,J){return Vn(H,J)}function Jn(H){if(!Qn(H))return!1;var J=Dt(H);return J==h||J==a||J==p||J==E}function Yn(H){return typeof H=="number"&&H>-1&&H%1==0&&H<=c}function Qn(H){var J=typeof H;return H!=null&&(J=="object"||J=="function")}function xt(H){return H!=null&&typeof H=="object"}var Zn=Ce?Vi(Ce):Ir;function Kr(H){return Ur(H)?_r(H):Fr(H)}function Jr(){return[]}function Yr(){return!1}L.exports=Gr})(qt,qt.exports);var Fi=qt.exports,Ne={};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.getAceInstance=Ne.debounce=Ne.editorEvents=Ne.editorOptions=void 0;var uo=["minLines","maxLines","readOnly","highlightActiveLine","tabSize","enableBasicAutocompletion","enableLiveAutocompletion","enableSnippets"];Ne.editorOptions=uo;var po=["onChange","onFocus","onInput","onBlur","onCopy","onPaste","onSelectionChange","onCursorChange","onScroll","handleOptions","updateRef"];Ne.editorEvents=po;var fo=function(){var L;return typeof window>"u"?(ke.window={},L=Xt,delete ke.window):window.ace?(L=window.ace,L.acequire=window.ace.require||window.ace.acequire):L=Xt,L};Ne.getAceInstance=fo;var go=function(L,n){var i=null;return function(){var l=this,v=arguments;clearTimeout(i),i=setTimeout(function(){L.apply(l,v)},n)}};Ne.debounce=go;var mo=ut&&ut.__extends||function(){var L=function(n,i){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,v){l.__proto__=v}||function(l,v){for(var s in v)Object.prototype.hasOwnProperty.call(v,s)&&(l[s]=v[s])},L(n,i)};return function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");L(n,i);function l(){this.constructor=n}n.prototype=i===null?Object.create(i):(l.prototype=i.prototype,new l)}}(),An=ut&&ut.__assign||function(){return An=Object.assign||function(L){for(var n,i=1,l=arguments.length;i<l;i++){n=arguments[i];for(var v in n)Object.prototype.hasOwnProperty.call(n,v)&&(L[v]=n[v])}return L},An.apply(this,arguments)};Object.defineProperty(ut,"__esModule",{value:!0});var vo=Xt,ie=Tn,oi=qe,Vt=Fi,bt=Ne,ai=(0,bt.getAceInstance)(),yo=function(L){mo(n,L);function n(i){var l=L.call(this,i)||this;return bt.editorEvents.forEach(function(v){l[v]=l[v].bind(l)}),l.debounce=bt.debounce,l}return n.prototype.isInShadow=function(i){for(var l=i&&i.parentNode;l;){if(l.toString()==="[object ShadowRoot]")return!0;l=l.parentNode}return!1},n.prototype.componentDidMount=function(){var i=this,l=this.props,v=l.className,s=l.onBeforeLoad,c=l.onValidate,d=l.mode,o=l.focus,p=l.theme,e=l.fontSize,t=l.lineHeight,r=l.value,h=l.defaultValue,a=l.showGutter,u=l.wrapEnabled,f=l.showPrintMargin,m=l.scrollMargin,y=m===void 0?[0,0,0,0]:m,x=l.keyboardHandler,E=l.onLoad,w=l.commands,g=l.annotations,S=l.markers,k=l.placeholder;this.editor=ai.edit(this.refEditor),s&&s(ai);for(var D=Object.keys(this.props.editorProps),_=0;_<D.length;_++)this.editor[D[_]]=this.props.editorProps[D[_]];this.props.debounceChangePeriod&&(this.onChange=this.debounce(this.onChange,this.props.debounceChangePeriod)),this.editor.renderer.setScrollMargin(y[0],y[1],y[2],y[3]),this.isInShadow(this.refEditor)&&this.editor.renderer.attachToShadowRoot(),this.editor.getSession().setMode(typeof d=="string"?"ace/mode/".concat(d):d),p&&p!==""&&this.editor.setTheme("ace/theme/".concat(p)),this.editor.setFontSize(typeof e=="number"?"".concat(e,"px"):e),t&&(this.editor.container.style.lineHeight=typeof t=="number"?"".concat(t,"px"):"".concat(t),this.editor.renderer.updateFontSize()),this.editor.getSession().setValue(h||r||""),this.props.navigateToFileEnd&&this.editor.navigateFileEnd(),this.editor.renderer.setShowGutter(a),this.editor.getSession().setUseWrapMode(u),this.editor.setShowPrintMargin(f),this.editor.on("focus",this.onFocus),this.editor.on("blur",this.onBlur),this.editor.on("copy",this.onCopy),this.editor.on("paste",this.onPaste),this.editor.on("change",this.onChange),this.editor.on("input",this.onInput),k&&this.updatePlaceholder(),this.editor.getSession().selection.on("changeSelection",this.onSelectionChange),this.editor.getSession().selection.on("changeCursor",this.onCursorChange),c&&this.editor.getSession().on("changeAnnotation",function(){var A=i.editor.getSession().getAnnotations();i.props.onValidate(A)}),this.editor.session.on("changeScrollTop",this.onScroll),this.editor.getSession().setAnnotations(g||[]),S&&S.length>0&&this.handleMarkers(S);var F=this.editor.$options;bt.editorOptions.forEach(function(A){F.hasOwnProperty(A)?i.editor.setOption(A,i.props[A]):i.props[A]&&console.warn("ReactAce: editor option ".concat(A," was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"))}),this.handleOptions(this.props),Array.isArray(w)&&w.forEach(function(A){typeof A.exec=="string"?i.editor.commands.bindKey(A.bindKey,A.exec):i.editor.commands.addCommand(A)}),x&&this.editor.setKeyboardHandler("ace/keyboard/"+x),v&&(this.refEditor.className+=" "+v),E&&E(this.editor),this.editor.resize(),o&&this.editor.focus()},n.prototype.componentDidUpdate=function(i){for(var l=i,v=this.props,s=0;s<bt.editorOptions.length;s++){var c=bt.editorOptions[s];v[c]!==l[c]&&this.editor.setOption(c,v[c])}if(v.className!==l.className){var d=this.refEditor.className,o=d.trim().split(" "),p=l.className.trim().split(" ");p.forEach(function(r){var h=o.indexOf(r);o.splice(h,1)}),this.refEditor.className=" "+v.className+" "+o.join(" ")}var e=this.editor&&v.value!=null&&this.editor.getValue()!==v.value;if(e){this.silent=!0;var t=this.editor.session.selection.toJSON();this.editor.setValue(v.value,v.cursorStart),this.editor.session.selection.fromJSON(t),this.silent=!1}v.placeholder!==l.placeholder&&this.updatePlaceholder(),v.mode!==l.mode&&this.editor.getSession().setMode(typeof v.mode=="string"?"ace/mode/".concat(v.mode):v.mode),v.theme!==l.theme&&this.editor.setTheme("ace/theme/"+v.theme),v.keyboardHandler!==l.keyboardHandler&&(v.keyboardHandler?this.editor.setKeyboardHandler("ace/keyboard/"+v.keyboardHandler):this.editor.setKeyboardHandler(null)),v.fontSize!==l.fontSize&&this.editor.setFontSize(typeof v.fontSize=="number"?"".concat(v.fontSize,"px"):v.fontSize),v.lineHeight!==l.lineHeight&&(this.editor.container.style.lineHeight=typeof v.lineHeight=="number"?"".concat(v.lineHeight,"px"):v.lineHeight,this.editor.renderer.updateFontSize()),v.wrapEnabled!==l.wrapEnabled&&this.editor.getSession().setUseWrapMode(v.wrapEnabled),v.showPrintMargin!==l.showPrintMargin&&this.editor.setShowPrintMargin(v.showPrintMargin),v.showGutter!==l.showGutter&&this.editor.renderer.setShowGutter(v.showGutter),Vt(v.setOptions,l.setOptions)||this.handleOptions(v),(e||!Vt(v.annotations,l.annotations))&&this.editor.getSession().setAnnotations(v.annotations||[]),!Vt(v.markers,l.markers)&&Array.isArray(v.markers)&&this.handleMarkers(v.markers),Vt(v.scrollMargin,l.scrollMargin)||this.handleScrollMargins(v.scrollMargin),(i.height!==this.props.height||i.width!==this.props.width)&&this.editor.resize(),this.props.focus&&!i.focus&&this.editor.focus()},n.prototype.handleScrollMargins=function(i){i===void 0&&(i=[0,0,0,0]),this.editor.renderer.setScrollMargin(i[0],i[1],i[2],i[3])},n.prototype.componentWillUnmount=function(){this.editor&&(this.editor.destroy(),this.editor=null)},n.prototype.onChange=function(i){if(this.editor&&this.props.onChange&&!this.silent){var l=this.editor.getValue();this.props.onChange(l,i)}},n.prototype.onSelectionChange=function(i){if(this.props.onSelectionChange){var l=this.editor.getSelection();this.props.onSelectionChange(l,i)}},n.prototype.onCursorChange=function(i){if(this.props.onCursorChange){var l=this.editor.getSelection();this.props.onCursorChange(l,i)}},n.prototype.onInput=function(i){this.props.onInput&&this.props.onInput(i),this.props.placeholder&&this.updatePlaceholder()},n.prototype.onFocus=function(i){this.props.onFocus&&this.props.onFocus(i,this.editor)},n.prototype.onBlur=function(i){this.props.onBlur&&this.props.onBlur(i,this.editor)},n.prototype.onCopy=function(i){var l=i.text;this.props.onCopy&&this.props.onCopy(l)},n.prototype.onPaste=function(i){var l=i.text;this.props.onPaste&&this.props.onPaste(l)},n.prototype.onScroll=function(){this.props.onScroll&&this.props.onScroll(this.editor)},n.prototype.handleOptions=function(i){for(var l=Object.keys(i.setOptions),v=0;v<l.length;v++)this.editor.setOption(l[v],i.setOptions[l[v]])},n.prototype.handleMarkers=function(i){var l=this,v=this.editor.getSession().getMarkers(!0);for(var s in v)v.hasOwnProperty(s)&&this.editor.getSession().removeMarker(v[s].id);v=this.editor.getSession().getMarkers(!1);for(var s in v)v.hasOwnProperty(s)&&v[s].clazz!=="ace_active-line"&&v[s].clazz!=="ace_selected-word"&&this.editor.getSession().removeMarker(v[s].id);i.forEach(function(c){var d=c.startRow,o=c.startCol,p=c.endRow,e=c.endCol,t=c.className,r=c.type,h=c.inFront,a=h===void 0?!1:h,u=new vo.Range(d,o,p,e);l.editor.getSession().addMarker(u,t,r,a)})},n.prototype.updatePlaceholder=function(){var i=this.editor,l=this.props.placeholder,v=!i.session.getValue().length,s=i.renderer.placeholderNode;!v&&s?(i.renderer.scroller.removeChild(i.renderer.placeholderNode),i.renderer.placeholderNode=null):v&&!s?(s=i.renderer.placeholderNode=document.createElement("div"),s.textContent=l||"",s.className="ace_comment ace_placeholder",s.style.padding="0 9px",s.style.position="absolute",s.style.zIndex="3",i.renderer.scroller.appendChild(s)):v&&s&&(s.textContent=l)},n.prototype.updateRef=function(i){this.refEditor=i},n.prototype.render=function(){var i=this.props,l=i.name,v=i.width,s=i.height,c=i.style,d=An({width:v,height:s},c);return oi.createElement("div",{ref:this.updateRef,id:l,style:d})},n.propTypes={mode:ie.oneOfType([ie.string,ie.object]),focus:ie.bool,theme:ie.string,name:ie.string,className:ie.string,height:ie.string,width:ie.string,fontSize:ie.oneOfType([ie.number,ie.string]),lineHeight:ie.oneOfType([ie.number,ie.string]),showGutter:ie.bool,onChange:ie.func,onCopy:ie.func,onPaste:ie.func,onFocus:ie.func,onInput:ie.func,onBlur:ie.func,onScroll:ie.func,value:ie.string,defaultValue:ie.string,onLoad:ie.func,onSelectionChange:ie.func,onCursorChange:ie.func,onBeforeLoad:ie.func,onValidate:ie.func,minLines:ie.number,maxLines:ie.number,readOnly:ie.bool,highlightActiveLine:ie.bool,tabSize:ie.number,showPrintMargin:ie.bool,cursorStart:ie.number,debounceChangePeriod:ie.number,editorProps:ie.object,setOptions:ie.object,style:ie.object,scrollMargin:ie.array,annotations:ie.array,markers:ie.array,keyboardHandler:ie.string,wrapEnabled:ie.bool,enableSnippets:ie.bool,enableBasicAutocompletion:ie.oneOfType([ie.bool,ie.array]),enableLiveAutocompletion:ie.oneOfType([ie.bool,ie.array]),navigateToFileEnd:ie.bool,commands:ie.array,placeholder:ie.string},n.defaultProps={name:"ace-editor",focus:!1,mode:"",theme:"",height:"500px",width:"500px",fontSize:12,enableSnippets:!1,showGutter:!0,onChange:null,onPaste:null,onLoad:null,onScroll:null,minLines:null,maxLines:null,readOnly:!1,highlightActiveLine:!0,showPrintMargin:!0,tabSize:4,cursorStart:1,editorProps:{},style:{},scrollMargin:[0,0,0,0],setOptions:{},wrapEnabled:!1,enableBasicAutocompletion:!1,enableLiveAutocompletion:!1,placeholder:null,navigateToFileEnd:!0},n}(oi.Component);ut.default=yo;var kt={},tt={},Oi={exports:{}};(function(L,n){ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"],function(i,l,v){var s=i("./lib/oop");i("./lib/lang");var c=i("./lib/event_emitter").EventEmitter,d=i("./editor").Editor,o=i("./virtual_renderer").VirtualRenderer,p=i("./edit_session").EditSession,e;e=function(t,r,h){this.BELOW=1,this.BESIDE=0,this.$container=t,this.$theme=r,this.$splits=0,this.$editorCSS="",this.$editors=[],this.$orientation=this.BESIDE,this.setSplits(h||1),this.$cEditor=this.$editors[0],this.on("focus",function(a){this.$cEditor=a}.bind(this))},function(){s.implement(this,c),this.$createEditor=function(){var t=document.createElement("div");t.className=this.$editorCSS,t.style.cssText="position: absolute; top:0px; bottom:0px",this.$container.appendChild(t);var r=new d(new o(t,this.$theme));return r.on("focus",function(){this._emit("focus",r)}.bind(this)),this.$editors.push(r),r.setFontSize(this.$fontSize),r},this.setSplits=function(t){var r;if(t<1)throw"The number of splits have to be > 0!";if(t!=this.$splits){if(t>this.$splits){for(;this.$splits<this.$editors.length&&this.$splits<t;)r=this.$editors[this.$splits],this.$container.appendChild(r.container),r.setFontSize(this.$fontSize),this.$splits++;for(;this.$splits<t;)this.$createEditor(),this.$splits++}else for(;this.$splits>t;)r=this.$editors[this.$splits-1],this.$container.removeChild(r.container),this.$splits--;this.resize()}},this.getSplits=function(){return this.$splits},this.getEditor=function(t){return this.$editors[t]},this.getCurrentEditor=function(){return this.$cEditor},this.focus=function(){this.$cEditor.focus()},this.blur=function(){this.$cEditor.blur()},this.setTheme=function(t){this.$editors.forEach(function(r){r.setTheme(t)})},this.setKeyboardHandler=function(t){this.$editors.forEach(function(r){r.setKeyboardHandler(t)})},this.forEach=function(t,r){this.$editors.forEach(t,r)},this.$fontSize="",this.setFontSize=function(t){this.$fontSize=t,this.forEach(function(r){r.setFontSize(t)})},this.$cloneSession=function(t){var r=new p(t.getDocument(),t.getMode()),h=t.getUndoManager();return r.setUndoManager(h),r.setTabSize(t.getTabSize()),r.setUseSoftTabs(t.getUseSoftTabs()),r.setOverwrite(t.getOverwrite()),r.setBreakpoints(t.getBreakpoints()),r.setUseWrapMode(t.getUseWrapMode()),r.setUseWorker(t.getUseWorker()),r.setWrapLimitRange(t.$wrapLimitRange.min,t.$wrapLimitRange.max),r.$foldData=t.$cloneFoldData(),r},this.setSession=function(t,r){var h;r==null?h=this.$cEditor:h=this.$editors[r];var a=this.$editors.some(function(u){return u.session===t});return a&&(t=this.$cloneSession(t)),h.setSession(t),t},this.getOrientation=function(){return this.$orientation},this.setOrientation=function(t){this.$orientation!=t&&(this.$orientation=t,this.resize())},this.resize=function(){var t=this.$container.clientWidth,r=this.$container.clientHeight,h;if(this.$orientation==this.BESIDE)for(var a=t/this.$splits,u=0;u<this.$splits;u++)h=this.$editors[u],h.container.style.width=a+"px",h.container.style.top="0px",h.container.style.left=u*a+"px",h.container.style.height=r+"px",h.resize();else for(var f=r/this.$splits,u=0;u<this.$splits;u++)h=this.$editors[u],h.container.style.width=t+"px",h.container.style.top=u*f+"px",h.container.style.left="0px",h.container.style.height=f+"px",h.resize()}}.call(e.prototype),l.Split=e}),ace.define("ace/ext/split",["require","exports","module","ace/ext/split","ace/split"],function(i,l,v){v.exports=i("../split")}),function(){ace.require(["ace/ext/split"],function(i){L&&(L.exports=i)})}()})(Oi);var bo=Oi.exports,wo="Expected a function",Ri="__lodash_hash_undefined__",Co="[object Function]",Eo="[object GeneratorFunction]",So="[object Symbol]",Do=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,xo=/^\w*$/,Ao=/^\./,$o=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,To=/[\\^$.*+?()[\]{}|]/g,_o=/\\(\\)?/g,ko=/^\[object .+?Constructor\]$/,Mo=typeof ke=="object"&&ke&&ke.Object===Object&&ke,Lo=typeof self=="object"&&self&&self.Object===Object&&self,Mn=Mo||Lo||Function("return this")();function Io(L,n){return L==null?void 0:L[n]}function Fo(L){var n=!1;if(L!=null&&typeof L.toString!="function")try{n=!!(L+"")}catch{}return n}var Oo=Array.prototype,Ro=Function.prototype,Ni=Object.prototype,mn=Mn["__core-js_shared__"],li=function(){var L=/[^.]+$/.exec(mn&&mn.keys&&mn.keys.IE_PROTO||"");return L?"Symbol(src)_1."+L:""}(),Bi=Ro.toString,Ln=Ni.hasOwnProperty,Pi=Ni.toString,No=RegExp("^"+Bi.call(Ln).replace(To,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),hi=Mn.Symbol,Bo=Oo.splice,Po=Wi(Mn,"Map"),Mt=Wi(Object,"create"),ci=hi?hi.prototype:void 0,ui=ci?ci.toString:void 0;function pt(L){var n=-1,i=L?L.length:0;for(this.clear();++n<i;){var l=L[n];this.set(l[0],l[1])}}function Wo(){this.__data__=Mt?Mt(null):{}}function zo(L){return this.has(L)&&delete this.__data__[L]}function Ho(L){var n=this.__data__;if(Mt){var i=n[L];return i===Ri?void 0:i}return Ln.call(n,L)?n[L]:void 0}function jo(L){var n=this.__data__;return Mt?n[L]!==void 0:Ln.call(n,L)}function Vo(L,n){var i=this.__data__;return i[L]=Mt&&n===void 0?Ri:n,this}pt.prototype.clear=Wo;pt.prototype.delete=zo;pt.prototype.get=Ho;pt.prototype.has=jo;pt.prototype.set=Vo;function Ct(L){var n=-1,i=L?L.length:0;for(this.clear();++n<i;){var l=L[n];this.set(l[0],l[1])}}function Uo(){this.__data__=[]}function Go(L){var n=this.__data__,i=tn(n,L);if(i<0)return!1;var l=n.length-1;return i==l?n.pop():Bo.call(n,i,1),!0}function Ko(L){var n=this.__data__,i=tn(n,L);return i<0?void 0:n[i][1]}function Jo(L){return tn(this.__data__,L)>-1}function Yo(L,n){var i=this.__data__,l=tn(i,L);return l<0?i.push([L,n]):i[l][1]=n,this}Ct.prototype.clear=Uo;Ct.prototype.delete=Go;Ct.prototype.get=Ko;Ct.prototype.has=Jo;Ct.prototype.set=Yo;function dt(L){var n=-1,i=L?L.length:0;for(this.clear();++n<i;){var l=L[n];this.set(l[0],l[1])}}function Qo(){this.__data__={hash:new pt,map:new(Po||Ct),string:new pt}}function Zo(L){return nn(this,L).delete(L)}function Xo(L){return nn(this,L).get(L)}function qo(L){return nn(this,L).has(L)}function ea(L,n){return nn(this,L).set(L,n),this}dt.prototype.clear=Qo;dt.prototype.delete=Zo;dt.prototype.get=Xo;dt.prototype.has=qo;dt.prototype.set=ea;function tn(L,n){for(var i=L.length;i--;)if(ua(L[i][0],n))return i;return-1}function ta(L,n){n=sa(n,L)?[n]:ra(n);for(var i=0,l=n.length;L!=null&&i<l;)L=L[ha(n[i++])];return i&&i==l?L:void 0}function na(L){if(!Hi(L)||aa(L))return!1;var n=pa(L)||Fo(L)?No:ko;return n.test(ca(L))}function ia(L){if(typeof L=="string")return L;if(Fn(L))return ui?ui.call(L):"";var n=L+"";return n=="0"&&1/L==-1/0?"-0":n}function ra(L){return zi(L)?L:la(L)}function nn(L,n){var i=L.__data__;return oa(n)?i[typeof n=="string"?"string":"hash"]:i.map}function Wi(L,n){var i=Io(L,n);return na(i)?i:void 0}function sa(L,n){if(zi(L))return!1;var i=typeof L;return i=="number"||i=="symbol"||i=="boolean"||L==null||Fn(L)?!0:xo.test(L)||!Do.test(L)||n!=null&&L in Object(n)}function oa(L){var n=typeof L;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?L!=="__proto__":L===null}function aa(L){return!!li&&li in L}var la=In(function(L){L=fa(L);var n=[];return Ao.test(L)&&n.push(""),L.replace($o,function(i,l,v,s){n.push(v?s.replace(_o,"$1"):l||i)}),n});function ha(L){if(typeof L=="string"||Fn(L))return L;var n=L+"";return n=="0"&&1/L==-1/0?"-0":n}function ca(L){if(L!=null){try{return Bi.call(L)}catch{}try{return L+""}catch{}}return""}function In(L,n){if(typeof L!="function"||n&&typeof n!="function")throw new TypeError(wo);var i=function(){var l=arguments,v=n?n.apply(this,l):l[0],s=i.cache;if(s.has(v))return s.get(v);var c=L.apply(this,l);return i.cache=s.set(v,c),c};return i.cache=new(In.Cache||dt),i}In.Cache=dt;function ua(L,n){return L===n||L!==L&&n!==n}var zi=Array.isArray;function pa(L){var n=Hi(L)?Pi.call(L):"";return n==Co||n==Eo}function Hi(L){var n=typeof L;return!!L&&(n=="object"||n=="function")}function da(L){return!!L&&typeof L=="object"}function Fn(L){return typeof L=="symbol"||da(L)&&Pi.call(L)==So}function fa(L){return L==null?"":ia(L)}function ga(L,n,i){var l=L==null?void 0:ta(L,n);return l===void 0?i:l}var ma=ga,va=tt&&tt.__extends||function(){var L=function(n,i){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,v){l.__proto__=v}||function(l,v){for(var s in v)Object.prototype.hasOwnProperty.call(v,s)&&(l[s]=v[s])},L(n,i)};return function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");L(n,i);function l(){this.constructor=n}n.prototype=i===null?Object.create(i):(l.prototype=i.prototype,new l)}}(),$n=tt&&tt.__assign||function(){return $n=Object.assign||function(L){for(var n,i=1,l=arguments.length;i<l;i++){n=arguments[i];for(var v in n)Object.prototype.hasOwnProperty.call(n,v)&&(L[v]=n[v])}return L},$n.apply(this,arguments)};Object.defineProperty(tt,"__esModule",{value:!0});var ct=Ne,vn=(0,ct.getAceInstance)(),ya=Xt,ba=bo,se=Tn,pi=qe,yn=Fi,je=ma,wa=function(L){va(n,L);function n(i){var l=L.call(this,i)||this;return ct.editorEvents.forEach(function(v){l[v]=l[v].bind(l)}),l.debounce=ct.debounce,l}return n.prototype.isInShadow=function(i){for(var l=i&&i.parentNode;l;){if(l.toString()==="[object ShadowRoot]")return!0;l=l.parentNode}return!1},n.prototype.componentDidMount=function(){var i=this,l=this.props,v=l.className,s=l.onBeforeLoad,c=l.mode,d=l.focus,o=l.theme,p=l.fontSize,e=l.value,t=l.defaultValue,r=l.cursorStart,h=l.showGutter,a=l.wrapEnabled,u=l.showPrintMargin,f=l.scrollMargin,m=f===void 0?[0,0,0,0]:f,y=l.keyboardHandler,x=l.onLoad,E=l.commands,w=l.annotations,g=l.markers,S=l.splits;this.editor=vn.edit(this.refEditor),this.isInShadow(this.refEditor)&&this.editor.renderer.attachToShadowRoot(),this.editor.setTheme("ace/theme/".concat(o)),s&&s(vn);var k=Object.keys(this.props.editorProps),D=new ba.Split(this.editor.container,"ace/theme/".concat(o),S);this.editor.env.split=D,this.splitEditor=D.getEditor(0),this.split=D,this.editor.setShowPrintMargin(!1),this.editor.renderer.setShowGutter(!1);var _=this.splitEditor.$options;this.props.debounceChangePeriod&&(this.onChange=this.debounce(this.onChange,this.props.debounceChangePeriod)),D.forEach(function(A,$){for(var C=0;C<k.length;C++)A[k[C]]=i.props.editorProps[k[C]];var b=je(t,$),T=je(e,$,"");A.session.setUndoManager(new vn.UndoManager),A.setTheme("ace/theme/".concat(o)),A.renderer.setScrollMargin(m[0],m[1],m[2],m[3]),A.getSession().setMode("ace/mode/".concat(c)),A.setFontSize(p),A.renderer.setShowGutter(h),A.getSession().setUseWrapMode(a),A.setShowPrintMargin(u),A.on("focus",i.onFocus),A.on("blur",i.onBlur),A.on("input",i.onInput),A.on("copy",i.onCopy),A.on("paste",i.onPaste),A.on("change",i.onChange),A.getSession().selection.on("changeSelection",i.onSelectionChange),A.getSession().selection.on("changeCursor",i.onCursorChange),A.session.on("changeScrollTop",i.onScroll),A.setValue(b===void 0?T:b,r);var I=je(w,$,[]),O=je(g,$,[]);A.getSession().setAnnotations(I),O&&O.length>0&&i.handleMarkers(O,A);for(var C=0;C<ct.editorOptions.length;C++){var N=ct.editorOptions[C];_.hasOwnProperty(N)?A.setOption(N,i.props[N]):i.props[N]&&console.warn("ReaceAce: editor option ".concat(N," was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"))}i.handleOptions(i.props,A),Array.isArray(E)&&E.forEach(function(P){typeof P.exec=="string"?A.commands.bindKey(P.bindKey,P.exec):A.commands.addCommand(P)}),y&&A.setKeyboardHandler("ace/keyboard/"+y)}),v&&(this.refEditor.className+=" "+v),d&&this.splitEditor.focus();var F=this.editor.env.split;F.setOrientation(this.props.orientation==="below"?F.BELOW:F.BESIDE),F.resize(!0),x&&x(F)},n.prototype.componentDidUpdate=function(i){var l=this,v=i,s=this.props,c=this.editor.env.split;if(s.splits!==v.splits&&c.setSplits(s.splits),s.orientation!==v.orientation&&c.setOrientation(s.orientation==="below"?c.BELOW:c.BESIDE),c.forEach(function(e,t){s.mode!==v.mode&&e.getSession().setMode("ace/mode/"+s.mode),s.keyboardHandler!==v.keyboardHandler&&(s.keyboardHandler?e.setKeyboardHandler("ace/keyboard/"+s.keyboardHandler):e.setKeyboardHandler(null)),s.fontSize!==v.fontSize&&e.setFontSize(s.fontSize),s.wrapEnabled!==v.wrapEnabled&&e.getSession().setUseWrapMode(s.wrapEnabled),s.showPrintMargin!==v.showPrintMargin&&e.setShowPrintMargin(s.showPrintMargin),s.showGutter!==v.showGutter&&e.renderer.setShowGutter(s.showGutter);for(var r=0;r<ct.editorOptions.length;r++){var h=ct.editorOptions[r];s[h]!==v[h]&&e.setOption(h,s[h])}yn(s.setOptions,v.setOptions)||l.handleOptions(s,e);var a=je(s.value,t,"");if(e.getValue()!==a){l.silent=!0;var u=e.session.selection.toJSON();e.setValue(a,s.cursorStart),e.session.selection.fromJSON(u),l.silent=!1}var f=je(s.annotations,t,[]),m=je(v.annotations,t,[]);yn(f,m)||e.getSession().setAnnotations(f);var y=je(s.markers,t,[]),x=je(v.markers,t,[]);!yn(y,x)&&Array.isArray(y)&&l.handleMarkers(y,e)}),s.className!==v.className){var d=this.refEditor.className,o=d.trim().split(" "),p=v.className.trim().split(" ");p.forEach(function(e){var t=o.indexOf(e);o.splice(t,1)}),this.refEditor.className=" "+s.className+" "+o.join(" ")}s.theme!==v.theme&&c.setTheme("ace/theme/"+s.theme),s.focus&&!v.focus&&this.splitEditor.focus(),(s.height!==this.props.height||s.width!==this.props.width)&&this.editor.resize()},n.prototype.componentWillUnmount=function(){this.editor.destroy(),this.editor=null},n.prototype.onChange=function(i){if(this.props.onChange&&!this.silent){var l=[];this.editor.env.split.forEach(function(v){l.push(v.getValue())}),this.props.onChange(l,i)}},n.prototype.onSelectionChange=function(i){if(this.props.onSelectionChange){var l=[];this.editor.env.split.forEach(function(v){l.push(v.getSelection())}),this.props.onSelectionChange(l,i)}},n.prototype.onCursorChange=function(i){if(this.props.onCursorChange){var l=[];this.editor.env.split.forEach(function(v){l.push(v.getSelection())}),this.props.onCursorChange(l,i)}},n.prototype.onFocus=function(i){this.props.onFocus&&this.props.onFocus(i)},n.prototype.onInput=function(i){this.props.onInput&&this.props.onInput(i)},n.prototype.onBlur=function(i){this.props.onBlur&&this.props.onBlur(i)},n.prototype.onCopy=function(i){this.props.onCopy&&this.props.onCopy(i)},n.prototype.onPaste=function(i){this.props.onPaste&&this.props.onPaste(i)},n.prototype.onScroll=function(){this.props.onScroll&&this.props.onScroll(this.editor)},n.prototype.handleOptions=function(i,l){for(var v=Object.keys(i.setOptions),s=0;s<v.length;s++)l.setOption(v[s],i.setOptions[v[s]])},n.prototype.handleMarkers=function(i,l){var v=l.getSession().getMarkers(!0);for(var s in v)v.hasOwnProperty(s)&&l.getSession().removeMarker(v[s].id);v=l.getSession().getMarkers(!1);for(var s in v)v.hasOwnProperty(s)&&l.getSession().removeMarker(v[s].id);i.forEach(function(c){var d=c.startRow,o=c.startCol,p=c.endRow,e=c.endCol,t=c.className,r=c.type,h=c.inFront,a=h===void 0?!1:h,u=new ya.Range(d,o,p,e);l.getSession().addMarker(u,t,r,a)})},n.prototype.updateRef=function(i){this.refEditor=i},n.prototype.render=function(){var i=this.props,l=i.name,v=i.width,s=i.height,c=i.style,d=$n({width:v,height:s},c);return pi.createElement("div",{ref:this.updateRef,id:l,style:d})},n.propTypes={className:se.string,debounceChangePeriod:se.number,defaultValue:se.arrayOf(se.string),focus:se.bool,fontSize:se.oneOfType([se.number,se.string]),height:se.string,mode:se.string,name:se.string,onBlur:se.func,onChange:se.func,onCopy:se.func,onFocus:se.func,onInput:se.func,onLoad:se.func,onPaste:se.func,onScroll:se.func,orientation:se.string,showGutter:se.bool,splits:se.number,theme:se.string,value:se.arrayOf(se.string),width:se.string,onSelectionChange:se.func,onCursorChange:se.func,onBeforeLoad:se.func,minLines:se.number,maxLines:se.number,readOnly:se.bool,highlightActiveLine:se.bool,tabSize:se.number,showPrintMargin:se.bool,cursorStart:se.number,editorProps:se.object,setOptions:se.object,style:se.object,scrollMargin:se.array,annotations:se.array,markers:se.array,keyboardHandler:se.string,wrapEnabled:se.bool,enableBasicAutocompletion:se.oneOfType([se.bool,se.array]),enableLiveAutocompletion:se.oneOfType([se.bool,se.array]),commands:se.array},n.defaultProps={name:"ace-editor",focus:!1,orientation:"beside",splits:2,mode:"",theme:"",height:"500px",width:"500px",value:[],fontSize:12,showGutter:!0,onChange:null,onPaste:null,onLoad:null,onScroll:null,minLines:null,maxLines:null,readOnly:!1,highlightActiveLine:!0,showPrintMargin:!0,tabSize:4,cursorStart:1,editorProps:{},style:{},scrollMargin:[0,0,0,0],setOptions:{},wrapEnabled:!1,enableBasicAutocompletion:!1,enableLiveAutocompletion:!1},n}(pi.Component);tt.default=wa;var ji={exports:{}};(function(L){var n=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},i=-1,l=1,v=0;n.Diff=function(s,c){return[s,c]},n.prototype.diff_main=function(s,c,d,o){typeof o>"u"&&(this.Diff_Timeout<=0?o=Number.MAX_VALUE:o=new Date().getTime()+this.Diff_Timeout*1e3);var p=o;if(s==null||c==null)throw new Error("Null input. (diff_main)");if(s==c)return s?[new n.Diff(v,s)]:[];typeof d>"u"&&(d=!0);var e=d,t=this.diff_commonPrefix(s,c),r=s.substring(0,t);s=s.substring(t),c=c.substring(t),t=this.diff_commonSuffix(s,c);var h=s.substring(s.length-t);s=s.substring(0,s.length-t),c=c.substring(0,c.length-t);var a=this.diff_compute_(s,c,e,p);return r&&a.unshift(new n.Diff(v,r)),h&&a.push(new n.Diff(v,h)),this.diff_cleanupMerge(a),a},n.prototype.diff_compute_=function(s,c,d,o){var p;if(!s)return[new n.Diff(l,c)];if(!c)return[new n.Diff(i,s)];var e=s.length>c.length?s:c,t=s.length>c.length?c:s,r=e.indexOf(t);if(r!=-1)return p=[new n.Diff(l,e.substring(0,r)),new n.Diff(v,t),new n.Diff(l,e.substring(r+t.length))],s.length>c.length&&(p[0][0]=p[2][0]=i),p;if(t.length==1)return[new n.Diff(i,s),new n.Diff(l,c)];var h=this.diff_halfMatch_(s,c);if(h){var a=h[0],u=h[1],f=h[2],m=h[3],y=h[4],x=this.diff_main(a,f,d,o),E=this.diff_main(u,m,d,o);return x.concat([new n.Diff(v,y)],E)}return d&&s.length>100&&c.length>100?this.diff_lineMode_(s,c,o):this.diff_bisect_(s,c,o)},n.prototype.diff_lineMode_=function(s,c,d){var o=this.diff_linesToChars_(s,c);s=o.chars1,c=o.chars2;var p=o.lineArray,e=this.diff_main(s,c,!1,d);this.diff_charsToLines_(e,p),this.diff_cleanupSemantic(e),e.push(new n.Diff(v,""));for(var t=0,r=0,h=0,a="",u="";t<e.length;){switch(e[t][0]){case l:h++,u+=e[t][1];break;case i:r++,a+=e[t][1];break;case v:if(r>=1&&h>=1){e.splice(t-r-h,r+h),t=t-r-h;for(var f=this.diff_main(a,u,!1,d),m=f.length-1;m>=0;m--)e.splice(t,0,f[m]);t=t+f.length}h=0,r=0,a="",u="";break}t++}return e.pop(),e},n.prototype.diff_bisect_=function(s,c,d){for(var o=s.length,p=c.length,e=Math.ceil((o+p)/2),t=e,r=2*e,h=new Array(r),a=new Array(r),u=0;u<r;u++)h[u]=-1,a[u]=-1;h[t+1]=0,a[t+1]=0;for(var f=o-p,m=f%2!=0,y=0,x=0,E=0,w=0,g=0;g<e&&!(new Date().getTime()>d);g++){for(var S=-g+y;S<=g-x;S+=2){var k=t+S,D;S==-g||S!=g&&h[k-1]<h[k+1]?D=h[k+1]:D=h[k-1]+1;for(var _=D-S;D<o&&_<p&&s.charAt(D)==c.charAt(_);)D++,_++;if(h[k]=D,D>o)x+=2;else if(_>p)y+=2;else if(m){var F=t+f-S;if(F>=0&&F<r&&a[F]!=-1){var A=o-a[F];if(D>=A)return this.diff_bisectSplit_(s,c,D,_,d)}}}for(var $=-g+E;$<=g-w;$+=2){var F=t+$,A;$==-g||$!=g&&a[F-1]<a[F+1]?A=a[F+1]:A=a[F-1]+1;for(var C=A-$;A<o&&C<p&&s.charAt(o-A-1)==c.charAt(p-C-1);)A++,C++;if(a[F]=A,A>o)w+=2;else if(C>p)E+=2;else if(!m){var k=t+f-$;if(k>=0&&k<r&&h[k]!=-1){var D=h[k],_=t+D-k;if(A=o-A,D>=A)return this.diff_bisectSplit_(s,c,D,_,d)}}}}return[new n.Diff(i,s),new n.Diff(l,c)]},n.prototype.diff_bisectSplit_=function(s,c,d,o,p){var e=s.substring(0,d),t=c.substring(0,o),r=s.substring(d),h=c.substring(o),a=this.diff_main(e,t,!1,p),u=this.diff_main(r,h,!1,p);return a.concat(u)},n.prototype.diff_linesToChars_=function(s,c){var d=[],o={};d[0]="";function p(h){for(var a="",u=0,f=-1,m=d.length;f<h.length-1;){f=h.indexOf(`
|
|
1000
|
+
`,u),f==-1&&(f=h.length-1);var y=h.substring(u,f+1);(o.hasOwnProperty?o.hasOwnProperty(y):o[y]!==void 0)?a+=String.fromCharCode(o[y]):(m==e&&(y=h.substring(u),f=h.length),a+=String.fromCharCode(m),o[y]=m,d[m++]=y),u=f+1}return a}var e=4e4,t=p(s);e=65535;var r=p(c);return{chars1:t,chars2:r,lineArray:d}},n.prototype.diff_charsToLines_=function(s,c){for(var d=0;d<s.length;d++){for(var o=s[d][1],p=[],e=0;e<o.length;e++)p[e]=c[o.charCodeAt(e)];s[d][1]=p.join("")}},n.prototype.diff_commonPrefix=function(s,c){if(!s||!c||s.charAt(0)!=c.charAt(0))return 0;for(var d=0,o=Math.min(s.length,c.length),p=o,e=0;d<p;)s.substring(e,p)==c.substring(e,p)?(d=p,e=d):o=p,p=Math.floor((o-d)/2+d);return p},n.prototype.diff_commonSuffix=function(s,c){if(!s||!c||s.charAt(s.length-1)!=c.charAt(c.length-1))return 0;for(var d=0,o=Math.min(s.length,c.length),p=o,e=0;d<p;)s.substring(s.length-p,s.length-e)==c.substring(c.length-p,c.length-e)?(d=p,e=d):o=p,p=Math.floor((o-d)/2+d);return p},n.prototype.diff_commonOverlap_=function(s,c){var d=s.length,o=c.length;if(d==0||o==0)return 0;d>o?s=s.substring(d-o):d<o&&(c=c.substring(0,d));var p=Math.min(d,o);if(s==c)return p;for(var e=0,t=1;;){var r=s.substring(p-t),h=c.indexOf(r);if(h==-1)return e;t+=h,(h==0||s.substring(p-t)==c.substring(0,t))&&(e=t,t++)}},n.prototype.diff_halfMatch_=function(s,c){if(this.Diff_Timeout<=0)return null;var d=s.length>c.length?s:c,o=s.length>c.length?c:s;if(d.length<4||o.length*2<d.length)return null;var p=this;function e(x,E,w){for(var g=x.substring(w,w+Math.floor(x.length/4)),S=-1,k="",D,_,F,A;(S=E.indexOf(g,S+1))!=-1;){var $=p.diff_commonPrefix(x.substring(w),E.substring(S)),C=p.diff_commonSuffix(x.substring(0,w),E.substring(0,S));k.length<C+$&&(k=E.substring(S-C,S)+E.substring(S,S+$),D=x.substring(0,w-C),_=x.substring(w+$),F=E.substring(0,S-C),A=E.substring(S+$))}return k.length*2>=x.length?[D,_,F,A,k]:null}var t=e(d,o,Math.ceil(d.length/4)),r=e(d,o,Math.ceil(d.length/2)),h;if(!t&&!r)return null;r?t?h=t[4].length>r[4].length?t:r:h=r:h=t;var a,u,f,m;s.length>c.length?(a=h[0],u=h[1],f=h[2],m=h[3]):(f=h[0],m=h[1],a=h[2],u=h[3]);var y=h[4];return[a,u,f,m,y]},n.prototype.diff_cleanupSemantic=function(s){for(var c=!1,d=[],o=0,p=null,e=0,t=0,r=0,h=0,a=0;e<s.length;)s[e][0]==v?(d[o++]=e,t=h,r=a,h=0,a=0,p=s[e][1]):(s[e][0]==l?h+=s[e][1].length:a+=s[e][1].length,p&&p.length<=Math.max(t,r)&&p.length<=Math.max(h,a)&&(s.splice(d[o-1],0,new n.Diff(i,p)),s[d[o-1]+1][0]=l,o--,o--,e=o>0?d[o-1]:-1,t=0,r=0,h=0,a=0,p=null,c=!0)),e++;for(c&&this.diff_cleanupMerge(s),this.diff_cleanupSemanticLossless(s),e=1;e<s.length;){if(s[e-1][0]==i&&s[e][0]==l){var u=s[e-1][1],f=s[e][1],m=this.diff_commonOverlap_(u,f),y=this.diff_commonOverlap_(f,u);m>=y?(m>=u.length/2||m>=f.length/2)&&(s.splice(e,0,new n.Diff(v,f.substring(0,m))),s[e-1][1]=u.substring(0,u.length-m),s[e+1][1]=f.substring(m),e++):(y>=u.length/2||y>=f.length/2)&&(s.splice(e,0,new n.Diff(v,u.substring(0,y))),s[e-1][0]=l,s[e-1][1]=f.substring(0,f.length-y),s[e+1][0]=i,s[e+1][1]=u.substring(y),e++),e++}e++}},n.prototype.diff_cleanupSemanticLossless=function(s){function c(y,x){if(!y||!x)return 6;var E=y.charAt(y.length-1),w=x.charAt(0),g=E.match(n.nonAlphaNumericRegex_),S=w.match(n.nonAlphaNumericRegex_),k=g&&E.match(n.whitespaceRegex_),D=S&&w.match(n.whitespaceRegex_),_=k&&E.match(n.linebreakRegex_),F=D&&w.match(n.linebreakRegex_),A=_&&y.match(n.blanklineEndRegex_),$=F&&x.match(n.blanklineStartRegex_);return A||$?5:_||F?4:g&&!k&&D?3:k||D?2:g||S?1:0}for(var d=1;d<s.length-1;){if(s[d-1][0]==v&&s[d+1][0]==v){var o=s[d-1][1],p=s[d][1],e=s[d+1][1],t=this.diff_commonSuffix(o,p);if(t){var r=p.substring(p.length-t);o=o.substring(0,o.length-t),p=r+p.substring(0,p.length-t),e=r+e}for(var h=o,a=p,u=e,f=c(o,p)+c(p,e);p.charAt(0)===e.charAt(0);){o+=p.charAt(0),p=p.substring(1)+e.charAt(0),e=e.substring(1);var m=c(o,p)+c(p,e);m>=f&&(f=m,h=o,a=p,u=e)}s[d-1][1]!=h&&(h?s[d-1][1]=h:(s.splice(d-1,1),d--),s[d][1]=a,u?s[d+1][1]=u:(s.splice(d+1,1),d--))}d++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(s){for(var c=!1,d=[],o=0,p=null,e=0,t=!1,r=!1,h=!1,a=!1;e<s.length;)s[e][0]==v?(s[e][1].length<this.Diff_EditCost&&(h||a)?(d[o++]=e,t=h,r=a,p=s[e][1]):(o=0,p=null),h=a=!1):(s[e][0]==i?a=!0:h=!0,p&&(t&&r&&h&&a||p.length<this.Diff_EditCost/2&&t+r+h+a==3)&&(s.splice(d[o-1],0,new n.Diff(i,p)),s[d[o-1]+1][0]=l,o--,p=null,t&&r?(h=a=!0,o=0):(o--,e=o>0?d[o-1]:-1,h=a=!1),c=!0)),e++;c&&this.diff_cleanupMerge(s)},n.prototype.diff_cleanupMerge=function(s){s.push(new n.Diff(v,""));for(var c=0,d=0,o=0,p="",e="",t;c<s.length;)switch(s[c][0]){case l:o++,e+=s[c][1],c++;break;case i:d++,p+=s[c][1],c++;break;case v:d+o>1?(d!==0&&o!==0&&(t=this.diff_commonPrefix(e,p),t!==0&&(c-d-o>0&&s[c-d-o-1][0]==v?s[c-d-o-1][1]+=e.substring(0,t):(s.splice(0,0,new n.Diff(v,e.substring(0,t))),c++),e=e.substring(t),p=p.substring(t)),t=this.diff_commonSuffix(e,p),t!==0&&(s[c][1]=e.substring(e.length-t)+s[c][1],e=e.substring(0,e.length-t),p=p.substring(0,p.length-t))),c-=d+o,s.splice(c,d+o),p.length&&(s.splice(c,0,new n.Diff(i,p)),c++),e.length&&(s.splice(c,0,new n.Diff(l,e)),c++),c++):c!==0&&s[c-1][0]==v?(s[c-1][1]+=s[c][1],s.splice(c,1)):c++,o=0,d=0,p="",e="";break}s[s.length-1][1]===""&&s.pop();var r=!1;for(c=1;c<s.length-1;)s[c-1][0]==v&&s[c+1][0]==v&&(s[c][1].substring(s[c][1].length-s[c-1][1].length)==s[c-1][1]?(s[c][1]=s[c-1][1]+s[c][1].substring(0,s[c][1].length-s[c-1][1].length),s[c+1][1]=s[c-1][1]+s[c+1][1],s.splice(c-1,1),r=!0):s[c][1].substring(0,s[c+1][1].length)==s[c+1][1]&&(s[c-1][1]+=s[c+1][1],s[c][1]=s[c][1].substring(s[c+1][1].length)+s[c+1][1],s.splice(c+1,1),r=!0)),c++;r&&this.diff_cleanupMerge(s)},n.prototype.diff_xIndex=function(s,c){var d=0,o=0,p=0,e=0,t;for(t=0;t<s.length&&(s[t][0]!==l&&(d+=s[t][1].length),s[t][0]!==i&&(o+=s[t][1].length),!(d>c));t++)p=d,e=o;return s.length!=t&&s[t][0]===i?e:e+(c-p)},n.prototype.diff_prettyHtml=function(s){for(var c=[],d=/&/g,o=/</g,p=/>/g,e=/\n/g,t=0;t<s.length;t++){var r=s[t][0],h=s[t][1],a=h.replace(d,"&").replace(o,"<").replace(p,">").replace(e,"¶<br>");switch(r){case l:c[t]='<ins style="background:#e6ffe6;">'+a+"</ins>";break;case i:c[t]='<del style="background:#ffe6e6;">'+a+"</del>";break;case v:c[t]="<span>"+a+"</span>";break}}return c.join("")},n.prototype.diff_text1=function(s){for(var c=[],d=0;d<s.length;d++)s[d][0]!==l&&(c[d]=s[d][1]);return c.join("")},n.prototype.diff_text2=function(s){for(var c=[],d=0;d<s.length;d++)s[d][0]!==i&&(c[d]=s[d][1]);return c.join("")},n.prototype.diff_levenshtein=function(s){for(var c=0,d=0,o=0,p=0;p<s.length;p++){var e=s[p][0],t=s[p][1];switch(e){case l:d+=t.length;break;case i:o+=t.length;break;case v:c+=Math.max(d,o),d=0,o=0;break}}return c+=Math.max(d,o),c},n.prototype.diff_toDelta=function(s){for(var c=[],d=0;d<s.length;d++)switch(s[d][0]){case l:c[d]="+"+encodeURI(s[d][1]);break;case i:c[d]="-"+s[d][1].length;break;case v:c[d]="="+s[d][1].length;break}return c.join(" ").replace(/%20/g," ")},n.prototype.diff_fromDelta=function(s,c){for(var d=[],o=0,p=0,e=c.split(/\t/g),t=0;t<e.length;t++){var r=e[t].substring(1);switch(e[t].charAt(0)){case"+":try{d[o++]=new n.Diff(l,decodeURI(r))}catch{throw new Error("Illegal escape in diff_fromDelta: "+r)}break;case"-":case"=":var h=parseInt(r,10);if(isNaN(h)||h<0)throw new Error("Invalid number in diff_fromDelta: "+r);var a=s.substring(p,p+=h);e[t].charAt(0)=="="?d[o++]=new n.Diff(v,a):d[o++]=new n.Diff(i,a);break;default:if(e[t])throw new Error("Invalid diff operation in diff_fromDelta: "+e[t])}}if(p!=s.length)throw new Error("Delta length ("+p+") does not equal source text length ("+s.length+").");return d},n.prototype.match_main=function(s,c,d){if(s==null||c==null||d==null)throw new Error("Null input. (match_main)");return d=Math.max(0,Math.min(d,s.length)),s==c?0:s.length?s.substring(d,d+c.length)==c?d:this.match_bitap_(s,c,d):-1},n.prototype.match_bitap_=function(s,c,d){if(c.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var o=this.match_alphabet_(c),p=this;function e(D,_){var F=D/c.length,A=Math.abs(d-_);return p.Match_Distance?F+A/p.Match_Distance:A?1:F}var t=this.Match_Threshold,r=s.indexOf(c,d);r!=-1&&(t=Math.min(e(0,r),t),r=s.lastIndexOf(c,d+c.length),r!=-1&&(t=Math.min(e(0,r),t)));var h=1<<c.length-1;r=-1;for(var a,u,f=c.length+s.length,m,y=0;y<c.length;y++){for(a=0,u=f;a<u;)e(y,d+u)<=t?a=u:f=u,u=Math.floor((f-a)/2+a);f=u;var x=Math.max(1,d-u+1),E=Math.min(d+u,s.length)+c.length,w=Array(E+2);w[E+1]=(1<<y)-1;for(var g=E;g>=x;g--){var S=o[s.charAt(g-1)];if(y===0?w[g]=(w[g+1]<<1|1)&S:w[g]=(w[g+1]<<1|1)&S|((m[g+1]|m[g])<<1|1)|m[g+1],w[g]&h){var k=e(y,g-1);if(k<=t)if(t=k,r=g-1,r>d)x=Math.max(1,2*d-r);else break}}if(e(y+1,d)>t)break;m=w}return r},n.prototype.match_alphabet_=function(s){for(var c={},d=0;d<s.length;d++)c[s.charAt(d)]=0;for(var d=0;d<s.length;d++)c[s.charAt(d)]|=1<<s.length-d-1;return c},n.prototype.patch_addContext_=function(s,c){if(c.length!=0){if(s.start2===null)throw Error("patch not initialized");for(var d=c.substring(s.start2,s.start2+s.length1),o=0;c.indexOf(d)!=c.lastIndexOf(d)&&d.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)o+=this.Patch_Margin,d=c.substring(s.start2-o,s.start2+s.length1+o);o+=this.Patch_Margin;var p=c.substring(s.start2-o,s.start2);p&&s.diffs.unshift(new n.Diff(v,p));var e=c.substring(s.start2+s.length1,s.start2+s.length1+o);e&&s.diffs.push(new n.Diff(v,e)),s.start1-=p.length,s.start2-=p.length,s.length1+=p.length+e.length,s.length2+=p.length+e.length}},n.prototype.patch_make=function(s,c,d){var o,p;if(typeof s=="string"&&typeof c=="string"&&typeof d>"u")o=s,p=this.diff_main(o,c,!0),p.length>2&&(this.diff_cleanupSemantic(p),this.diff_cleanupEfficiency(p));else if(s&&typeof s=="object"&&typeof c>"u"&&typeof d>"u")p=s,o=this.diff_text1(p);else if(typeof s=="string"&&c&&typeof c=="object"&&typeof d>"u")o=s,p=c;else if(typeof s=="string"&&typeof c=="string"&&d&&typeof d=="object")o=s,p=d;else throw new Error("Unknown call format to patch_make.");if(p.length===0)return[];for(var e=[],t=new n.patch_obj,r=0,h=0,a=0,u=o,f=o,m=0;m<p.length;m++){var y=p[m][0],x=p[m][1];switch(!r&&y!==v&&(t.start1=h,t.start2=a),y){case l:t.diffs[r++]=p[m],t.length2+=x.length,f=f.substring(0,a)+x+f.substring(a);break;case i:t.length1+=x.length,t.diffs[r++]=p[m],f=f.substring(0,a)+f.substring(a+x.length);break;case v:x.length<=2*this.Patch_Margin&&r&&p.length!=m+1?(t.diffs[r++]=p[m],t.length1+=x.length,t.length2+=x.length):x.length>=2*this.Patch_Margin&&r&&(this.patch_addContext_(t,u),e.push(t),t=new n.patch_obj,r=0,u=f,h=a);break}y!==l&&(h+=x.length),y!==i&&(a+=x.length)}return r&&(this.patch_addContext_(t,u),e.push(t)),e},n.prototype.patch_deepCopy=function(s){for(var c=[],d=0;d<s.length;d++){var o=s[d],p=new n.patch_obj;p.diffs=[];for(var e=0;e<o.diffs.length;e++)p.diffs[e]=new n.Diff(o.diffs[e][0],o.diffs[e][1]);p.start1=o.start1,p.start2=o.start2,p.length1=o.length1,p.length2=o.length2,c[d]=p}return c},n.prototype.patch_apply=function(s,c){if(s.length==0)return[c,[]];s=this.patch_deepCopy(s);var d=this.patch_addPadding(s);c=d+c+d,this.patch_splitMax(s);for(var o=0,p=[],e=0;e<s.length;e++){var t=s[e].start2+o,r=this.diff_text1(s[e].diffs),h,a=-1;if(r.length>this.Match_MaxBits?(h=this.match_main(c,r.substring(0,this.Match_MaxBits),t),h!=-1&&(a=this.match_main(c,r.substring(r.length-this.Match_MaxBits),t+r.length-this.Match_MaxBits),(a==-1||h>=a)&&(h=-1))):h=this.match_main(c,r,t),h==-1)p[e]=!1,o-=s[e].length2-s[e].length1;else{p[e]=!0,o=h-t;var u;if(a==-1?u=c.substring(h,h+r.length):u=c.substring(h,a+this.Match_MaxBits),r==u)c=c.substring(0,h)+this.diff_text2(s[e].diffs)+c.substring(h+r.length);else{var f=this.diff_main(r,u,!1);if(r.length>this.Match_MaxBits&&this.diff_levenshtein(f)/r.length>this.Patch_DeleteThreshold)p[e]=!1;else{this.diff_cleanupSemanticLossless(f);for(var m=0,y,x=0;x<s[e].diffs.length;x++){var E=s[e].diffs[x];E[0]!==v&&(y=this.diff_xIndex(f,m)),E[0]===l?c=c.substring(0,h+y)+E[1]+c.substring(h+y):E[0]===i&&(c=c.substring(0,h+y)+c.substring(h+this.diff_xIndex(f,m+E[1].length))),E[0]!==i&&(m+=E[1].length)}}}}}return c=c.substring(d.length,c.length-d.length),[c,p]},n.prototype.patch_addPadding=function(s){for(var c=this.Patch_Margin,d="",o=1;o<=c;o++)d+=String.fromCharCode(o);for(var o=0;o<s.length;o++)s[o].start1+=c,s[o].start2+=c;var p=s[0],e=p.diffs;if(e.length==0||e[0][0]!=v)e.unshift(new n.Diff(v,d)),p.start1-=c,p.start2-=c,p.length1+=c,p.length2+=c;else if(c>e[0][1].length){var t=c-e[0][1].length;e[0][1]=d.substring(e[0][1].length)+e[0][1],p.start1-=t,p.start2-=t,p.length1+=t,p.length2+=t}if(p=s[s.length-1],e=p.diffs,e.length==0||e[e.length-1][0]!=v)e.push(new n.Diff(v,d)),p.length1+=c,p.length2+=c;else if(c>e[e.length-1][1].length){var t=c-e[e.length-1][1].length;e[e.length-1][1]+=d.substring(0,t),p.length1+=t,p.length2+=t}return d},n.prototype.patch_splitMax=function(s){for(var c=this.Match_MaxBits,d=0;d<s.length;d++)if(!(s[d].length1<=c)){var o=s[d];s.splice(d--,1);for(var p=o.start1,e=o.start2,t="";o.diffs.length!==0;){var r=new n.patch_obj,h=!0;for(r.start1=p-t.length,r.start2=e-t.length,t!==""&&(r.length1=r.length2=t.length,r.diffs.push(new n.Diff(v,t)));o.diffs.length!==0&&r.length1<c-this.Patch_Margin;){var a=o.diffs[0][0],u=o.diffs[0][1];a===l?(r.length2+=u.length,e+=u.length,r.diffs.push(o.diffs.shift()),h=!1):a===i&&r.diffs.length==1&&r.diffs[0][0]==v&&u.length>2*c?(r.length1+=u.length,p+=u.length,h=!1,r.diffs.push(new n.Diff(a,u)),o.diffs.shift()):(u=u.substring(0,c-r.length1-this.Patch_Margin),r.length1+=u.length,p+=u.length,a===v?(r.length2+=u.length,e+=u.length):h=!1,r.diffs.push(new n.Diff(a,u)),u==o.diffs[0][1]?o.diffs.shift():o.diffs[0][1]=o.diffs[0][1].substring(u.length))}t=this.diff_text2(r.diffs),t=t.substring(t.length-this.Patch_Margin);var f=this.diff_text1(o.diffs).substring(0,this.Patch_Margin);f!==""&&(r.length1+=f.length,r.length2+=f.length,r.diffs.length!==0&&r.diffs[r.diffs.length-1][0]===v?r.diffs[r.diffs.length-1][1]+=f:r.diffs.push(new n.Diff(v,f))),h||s.splice(++d,0,r)}}},n.prototype.patch_toText=function(s){for(var c=[],d=0;d<s.length;d++)c[d]=s[d];return c.join("")},n.prototype.patch_fromText=function(s){var c=[];if(!s)return c;for(var d=s.split(`
|
|
1001
1001
|
`),o=0,p=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;o<d.length;){var e=d[o].match(p);if(!e)throw new Error("Invalid patch string: "+d[o]);var t=new n.patch_obj;for(c.push(t),t.start1=parseInt(e[1],10),e[2]===""?(t.start1--,t.length1=1):e[2]=="0"?t.length1=0:(t.start1--,t.length1=parseInt(e[2],10)),t.start2=parseInt(e[3],10),e[4]===""?(t.start2--,t.length2=1):e[4]=="0"?t.length2=0:(t.start2--,t.length2=parseInt(e[4],10)),o++;o<d.length;){var r=d[o].charAt(0);try{var h=decodeURI(d[o].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+h)}if(r=="-")t.diffs.push(new n.Diff(i,h));else if(r=="+")t.diffs.push(new n.Diff(l,h));else if(r==" ")t.diffs.push(new n.Diff(v,h));else{if(r=="@")break;if(r!=="")throw new Error('Invalid patch mode "'+r+'" in: '+h)}o++}}return c},n.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},n.patch_obj.prototype.toString=function(){var s,c;this.length1===0?s=this.start1+",0":this.length1==1?s=this.start1+1:s=this.start1+1+","+this.length1,this.length2===0?c=this.start2+",0":this.length2==1?c=this.start2+1:c=this.start2+1+","+this.length2;for(var d=["@@ -"+s+" +"+c+` @@
|
|
1002
1002
|
`],o,p=0;p<this.diffs.length;p++){switch(this.diffs[p][0]){case l:o="+";break;case i:o="-";break;case v:o=" ";break}d[p+1]=o+encodeURI(this.diffs[p][1])+`
|
|
1003
|
-
`}return d.join("").replace(/%20/g," ")},L.exports=n,L.exports.diff_match_patch=n,L.exports.DIFF_DELETE=i,L.exports.DIFF_INSERT=l,L.exports.DIFF_EQUAL=v})(
|
|
1003
|
+
`}return d.join("").replace(/%20/g," ")},L.exports=n,L.exports.diff_match_patch=n,L.exports.DIFF_DELETE=i,L.exports.DIFF_INSERT=l,L.exports.DIFF_EQUAL=v})(ji);var Ca=ji.exports,Ea=kt&&kt.__extends||function(){var L=function(n,i){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,v){l.__proto__=v}||function(l,v){for(var s in v)Object.prototype.hasOwnProperty.call(v,s)&&(l[s]=v[s])},L(n,i)};return function(n,i){if(typeof i!="function"&&i!==null)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");L(n,i);function l(){this.constructor=n}n.prototype=i===null?Object.create(i):(l.prototype=i.prototype,new l)}}();Object.defineProperty(kt,"__esModule",{value:!0});var pe=Tn,di=qe,Sa=tt,Da=Ca,xa=function(L){Ea(n,L);function n(i){var l=L.call(this,i)||this;return l.state={value:l.props.value},l.onChange=l.onChange.bind(l),l.diff=l.diff.bind(l),l}return n.prototype.componentDidUpdate=function(){var i=this.props.value;i!==this.state.value&&this.setState({value:i})},n.prototype.onChange=function(i){this.setState({value:i}),this.props.onChange&&this.props.onChange(i)},n.prototype.diff=function(){var i=new Da,l=this.state.value[0],v=this.state.value[1];if(l.length===0&&v.length===0)return[];var s=i.diff_main(l,v);i.diff_cleanupSemantic(s);var c=this.generateDiffedLines(s),d=this.setCodeMarkers(c);return d},n.prototype.generateDiffedLines=function(i){var l={DIFF_EQUAL:0,DIFF_DELETE:-1,DIFF_INSERT:1},v={left:[],right:[]},s={left:1,right:1};return i.forEach(function(c){var d=c[0],o=c[1],p=o.split(`
|
|
1004
1004
|
`).length-1;if(o.length!==0){var e=o[0],t=o[o.length-1],r=0;switch(d){case l.DIFF_EQUAL:s.left+=p,s.right+=p;break;case l.DIFF_DELETE:e===`
|
|
1005
1005
|
`&&(s.left++,p--),r=p,r===0&&v.right.push({startLine:s.right,endLine:s.right}),t===`
|
|
1006
1006
|
`&&(r-=1),v.left.push({startLine:s.left,endLine:s.left+r}),s.left+=p;break;case l.DIFF_INSERT:e===`
|
|
1007
1007
|
`&&(s.right++,p--),r=p,r===0&&v.left.push({startLine:s.left,endLine:s.left}),t===`
|
|
1008
|
-
`&&(r-=1),v.right.push({startLine:s.right,endLine:s.right+r}),s.right+=p;break;default:throw new Error("Diff type was not defined.")}}}),v},n.prototype.setCodeMarkers=function(i){i===void 0&&(i={left:[],right:[]});for(var l=[],v={left:[],right:[]},s=0;s<i.left.length;s++){var c={startRow:i.left[s].startLine-1,endRow:i.left[s].endLine,type:"text",className:"codeMarker"};v.left.push(c)}for(var s=0;s<i.right.length;s++){var c={startRow:i.right[s].startLine-1,endRow:i.right[s].endLine,type:"text",className:"codeMarker"};v.right.push(c)}return l[0]=v.left,l[1]=v.right,l},n.prototype.render=function(){var i=this.diff();return fi.createElement(Ca.default,{name:this.props.name,className:this.props.className,focus:this.props.focus,orientation:this.props.orientation,splits:this.props.splits,mode:this.props.mode,theme:this.props.theme,height:this.props.height,width:this.props.width,fontSize:this.props.fontSize,showGutter:this.props.showGutter,onChange:this.onChange,onPaste:this.props.onPaste,onLoad:this.props.onLoad,onScroll:this.props.onScroll,minLines:this.props.minLines,maxLines:this.props.maxLines,readOnly:this.props.readOnly,highlightActiveLine:this.props.highlightActiveLine,showPrintMargin:this.props.showPrintMargin,tabSize:this.props.tabSize,cursorStart:this.props.cursorStart,editorProps:this.props.editorProps,style:this.props.style,scrollMargin:this.props.scrollMargin,setOptions:this.props.setOptions,wrapEnabled:this.props.wrapEnabled,enableBasicAutocompletion:this.props.enableBasicAutocompletion,enableLiveAutocompletion:this.props.enableLiveAutocompletion,value:this.state.value,markers:i})},n.propTypes={cursorStart:pe.number,editorProps:pe.object,enableBasicAutocompletion:pe.bool,enableLiveAutocompletion:pe.bool,focus:pe.bool,fontSize:pe.number,height:pe.string,highlightActiveLine:pe.bool,maxLines:pe.number,minLines:pe.number,mode:pe.string,name:pe.string,className:pe.string,onLoad:pe.func,onPaste:pe.func,onScroll:pe.func,onChange:pe.func,orientation:pe.string,readOnly:pe.bool,scrollMargin:pe.array,setOptions:pe.object,showGutter:pe.bool,showPrintMargin:pe.bool,splits:pe.number,style:pe.object,tabSize:pe.number,theme:pe.string,value:pe.array,width:pe.string,wrapEnabled:pe.bool},n.defaultProps={cursorStart:1,editorProps:{},enableBasicAutocompletion:!1,enableLiveAutocompletion:!1,focus:!1,fontSize:12,height:"500px",highlightActiveLine:!0,maxLines:null,minLines:null,mode:"",name:"ace-editor",onLoad:null,onScroll:null,onPaste:null,onChange:null,orientation:"beside",readOnly:!1,scrollMargin:[0,0,0,0],setOptions:{},showGutter:!0,showPrintMargin:!0,splits:2,style:{},tabSize:4,theme:"github",value:["",""],width:"500px",wrapEnabled:!0},n}(fi.Component);kt.default=Sa;Object.defineProperty(wt,"__esModule",{value:!0});wt.diff=wt.split=void 0;var Da=ut,xa=kt;wt.diff=xa.default;var Aa=tt;wt.split=Aa.default;var $a=wt.default=Da.default,Ta={exports:{}};(function(L,n){ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(i,l,v){var s=i("../lib/oop"),c=i("./text_highlight_rules").TextHighlightRules,d=function(){this.$rules={start:[{token:"variable",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'},{token:"string",regex:'"',next:"string"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"text",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"comment",regex:"\\/\\/.*$"},{token:"comment.start",regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"punctuation.operator",regex:/[,]/},{token:"text",regex:"\\s+"}],string:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],comment:[{token:"comment.end",regex:"\\*\\/",next:"start"},{defaultToken:"comment"}]}};s.inherits(d,c),l.JsonHighlightRules=d}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(i,l,v){var s=i("../range").Range,c=function(){};(function(){this.checkOutdent=function(d,o){return/^\s+$/.test(d)?/^\s*\}/.test(o):!1},this.autoOutdent=function(d,o){var p=d.getLine(o),e=p.match(/^(\s*\})/);if(!e)return 0;var t=e[1].length,r=d.findMatchingBracket({row:o,column:t});if(!r||r.row==o)return 0;var h=this.$getIndent(d.getLine(r.row));d.replace(new s(o,0,o,t-1),h)},this.$getIndent=function(d){return d.match(/^\s*/)[0]}}).call(c.prototype),l.MatchingBraceOutdent=c}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(i,l,v){var s=i("../../lib/oop"),c=i("../../range").Range,d=i("./fold_mode").FoldMode,o=l.FoldMode=function(p){p&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+p.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+p.end)))};s.inherits(o,d),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(p,e,t){var r=p.getLine(t);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var h=this._getFoldWidgetBase(p,e,t);return!h&&this.startRegionRe.test(r)?"start":h},this.getFoldWidgetRange=function(p,e,t,r){var h=p.getLine(t);if(this.startRegionRe.test(h))return this.getCommentRegionBlock(p,h,t);var f=h.match(this.foldingStartMarker);if(f){var a=f.index;if(f[1])return this.openingBracketBlock(p,f[1],t,a);var u=p.getCommentFoldRange(t,a+f[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(p,t):e!="all"&&(u=null)),u}if(e!=="markbegin"){var f=h.match(this.foldingStopMarker);if(f){var a=f.index+f[0].length;return f[1]?this.closingBracketBlock(p,f[1],t,a):p.getCommentFoldRange(t,a,-1)}}},this.getSectionRange=function(p,e){var t=p.getLine(e),r=t.search(/\S/),h=e,a=t.length;e+=1;for(var u=e,f=p.getLength();++e<f;){t=p.getLine(e);var m=t.search(/\S/);if(m!==-1){if(r>m)break;var y=this.getFoldWidgetRange(p,"all",e);if(y){if(y.start.row<=h)break;if(y.isMultiLine())e=y.end.row;else if(r==m)break}u=e}}return new c(h,a,u,p.getLine(u).length)},this.getCommentRegionBlock=function(p,e,t){for(var r=e.search(/\s*$/),h=p.getLength(),a=t,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,f=1;++t<h;){e=p.getLine(t);var m=u.exec(e);if(m&&(m[1]?f--:f++,!f))break}var y=t;if(y>a)return new c(a,r,y,e.length)}}.call(o.prototype)}),ace.define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle","ace/worker/worker_client"],function(i,l,v){var s=i("../lib/oop"),c=i("./text").Mode,d=i("./json_highlight_rules").JsonHighlightRules,o=i("./matching_brace_outdent").MatchingBraceOutdent,p=i("./folding/cstyle").FoldMode,e=i("../worker/worker_client").WorkerClient,t=function(){this.HighlightRules=d,this.$outdent=new o,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new p};s.inherits(t,c),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(r,h,a){var u=this.$getIndent(h);if(r=="start"){var f=h.match(/^.*[\{\(\[]\s*$/);f&&(u+=a)}return u},this.checkOutdent=function(r,h,a){return this.$outdent.checkOutdent(h,a)},this.autoOutdent=function(r,h,a){this.$outdent.autoOutdent(h,a)},this.createWorker=function(r){var h=new e(["ace"],"ace/mode/json_worker","JsonWorker");return h.attachToDocument(r.getDocument()),h.on("annotate",function(a){r.setAnnotations(a.data)}),h.on("terminate",function(){r.clearAnnotations()}),h},this.$id="ace/mode/json"}.call(t.prototype),l.Mode=t}),function(){ace.require(["ace/mode/json"],function(i){L&&(L.exports=i)})}()})(Ta);var _a={exports:{}};(function(L,n){ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(i,l,v){var s=i("../lib/oop"),c=i("./text_highlight_rules").TextHighlightRules,d=function(){this.$rules={start:[{token:"variable",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'},{token:"string",regex:'"',next:"string"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"text",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"comment",regex:"\\/\\/.*$"},{token:"comment.start",regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"punctuation.operator",regex:/[,]/},{token:"text",regex:"\\s+"}],string:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],comment:[{token:"comment.end",regex:"\\*\\/",next:"start"},{defaultToken:"comment"}]}};s.inherits(d,c),l.JsonHighlightRules=d}),ace.define("ace/mode/json5_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/json_highlight_rules"],function(i,l,v){var s=i("../lib/oop"),c=i("./json_highlight_rules").JsonHighlightRules,d=function(){c.call(this);var o=[{token:"variable",regex:/[a-zA-Z$_\u00a1-\uffff][\w$\u00a1-\uffff]*\s*(?=:)/},{token:"variable",regex:/['](?:(?:\\.)|(?:[^'\\]))*?[']\s*(?=:)/},{token:"constant.language.boolean",regex:/(?:null)\b/},{token:"string",regex:/'/,next:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\/bfnrt]|$)/,consumeLineEnd:!0},{token:"string",regex:/'|$/,next:"start"},{defaultToken:"string"}]},{token:"string",regex:/"(?![^"]*":)/,next:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\/bfnrt]|$)/,consumeLineEnd:!0},{token:"string",regex:/"|$/,next:"start"},{defaultToken:"string"}]},{token:"constant.numeric",regex:/[+-]?(?:Infinity|NaN)\b/}];for(var p in this.$rules)this.$rules[p].unshift.apply(this.$rules[p],o);this.normalizeRules()};s.inherits(d,c),l.Json5HighlightRules=d}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(i,l,v){var s=i("../range").Range,c=function(){};(function(){this.checkOutdent=function(d,o){return/^\s+$/.test(d)?/^\s*\}/.test(o):!1},this.autoOutdent=function(d,o){var p=d.getLine(o),e=p.match(/^(\s*\})/);if(!e)return 0;var t=e[1].length,r=d.findMatchingBracket({row:o,column:t});if(!r||r.row==o)return 0;var h=this.$getIndent(d.getLine(r.row));d.replace(new s(o,0,o,t-1),h)},this.$getIndent=function(d){return d.match(/^\s*/)[0]}}).call(c.prototype),l.MatchingBraceOutdent=c}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(i,l,v){var s=i("../../lib/oop"),c=i("../../range").Range,d=i("./fold_mode").FoldMode,o=l.FoldMode=function(p){p&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+p.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+p.end)))};s.inherits(o,d),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(p,e,t){var r=p.getLine(t);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var h=this._getFoldWidgetBase(p,e,t);return!h&&this.startRegionRe.test(r)?"start":h},this.getFoldWidgetRange=function(p,e,t,r){var h=p.getLine(t);if(this.startRegionRe.test(h))return this.getCommentRegionBlock(p,h,t);var f=h.match(this.foldingStartMarker);if(f){var a=f.index;if(f[1])return this.openingBracketBlock(p,f[1],t,a);var u=p.getCommentFoldRange(t,a+f[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(p,t):e!="all"&&(u=null)),u}if(e!=="markbegin"){var f=h.match(this.foldingStopMarker);if(f){var a=f.index+f[0].length;return f[1]?this.closingBracketBlock(p,f[1],t,a):p.getCommentFoldRange(t,a,-1)}}},this.getSectionRange=function(p,e){var t=p.getLine(e),r=t.search(/\S/),h=e,a=t.length;e+=1;for(var u=e,f=p.getLength();++e<f;){t=p.getLine(e);var m=t.search(/\S/);if(m!==-1){if(r>m)break;var y=this.getFoldWidgetRange(p,"all",e);if(y){if(y.start.row<=h)break;if(y.isMultiLine())e=y.end.row;else if(r==m)break}u=e}}return new c(h,a,u,p.getLine(u).length)},this.getCommentRegionBlock=function(p,e,t){for(var r=e.search(/\s*$/),h=p.getLength(),a=t,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,f=1;++t<h;){e=p.getLine(t);var m=u.exec(e);if(m&&(m[1]?f--:f++,!f))break}var y=t;if(y>a)return new c(a,r,y,e.length)}}.call(o.prototype)}),ace.define("ace/mode/json5",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json5_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle"],function(i,l,v){var s=i("../lib/oop"),c=i("./text").Mode,d=i("./json5_highlight_rules").Json5HighlightRules,o=i("./matching_brace_outdent").MatchingBraceOutdent,p=i("./folding/cstyle").FoldMode,e=function(){this.HighlightRules=d,this.$outdent=new o,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new p};s.inherits(e,c),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.checkOutdent=function(t,r,h){return this.$outdent.checkOutdent(r,h)},this.autoOutdent=function(t,r,h){this.$outdent.autoOutdent(r,h)},this.$id="ace/mode/json5"}.call(e.prototype),l.Mode=e}),function(){ace.require(["ace/mode/json5"],function(i){L&&(L.exports=i)})}()})(_a);var ka={};(function(L){function n(v,s){for(var c=v,d="";c;){var o=s[c];if(typeof o=="string")return o+d;if(o)return o.location.replace(/\/*$/,"/")+(d||o.main||o.name);if(o===!1)return"";var p=c.lastIndexOf("/");if(p===-1)break;d=c.substr(p)+d,c=c.slice(0,p)}return v}if(!(typeof L.window<"u"&&L.document)&&!(L.require&&L.define)){L.console||(L.console=function(){var v=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:v})},L.console.error=L.console.warn=L.console.log=L.console.trace=L.console),L.window=L,L.ace=L,L.onerror=function(v,s,c,d,o){postMessage({type:"error",data:{message:v,data:o&&o.data,file:s,line:c,col:d,stack:o&&o.stack}})},L.normalizeModule=function(v,s){if(s.indexOf("!")!==-1){var c=s.split("!");return L.normalizeModule(v,c[0])+"!"+L.normalizeModule(v,c[1])}if(s.charAt(0)=="."){var d=v.split("/").slice(0,-1).join("/");for(s=(d?d+"/":"")+s;s.indexOf(".")!==-1&&o!=s;){var o=s;s=s.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return s},L.require=function(v,s){if(s||(s=v,v=null),!s.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");s=L.normalizeModule(v,s);var c=L.require.modules[s];if(c)return c.initialized||(c.initialized=!0,c.exports=c.factory().exports),c.exports;if(!L.require.tlns)return console.log("unable to load "+s);var d=n(s,L.require.tlns);return d.slice(-3)!=".js"&&(d+=".js"),L.require.id=s,L.require.modules[s]={},importScripts(d),L.require(v,s)},L.require.modules={},L.require.tlns={},L.define=function(v,s,c){if(arguments.length==2?(c=s,typeof v!="string"&&(s=v,v=L.require.id)):arguments.length==1&&(c=v,s=[],v=L.require.id),typeof c!="function"){L.require.modules[v]={exports:c,initialized:!0};return}s.length||(s=["require","exports","module"]);var d=function(o){return L.require(v,o)};L.require.modules[v]={exports:{},factory:function(){var o=this,p=c.apply(this,s.slice(0,c.length).map(function(e){switch(e){case"require":return d;case"exports":return o.exports;case"module":return o;default:return d(e)}}));return p&&(o.exports=p),o}}},L.define.amd={},L.require.tlns={},L.initBaseUrls=function(v){for(var s in v)this.require.tlns[s]=v[s]},L.initSender=function(){var v=L.require("ace/lib/event_emitter").EventEmitter,s=L.require("ace/lib/oop"),c=function(){};return function(){s.implement(this,v),this.callback=function(d,o){postMessage({type:"call",id:o,data:d})},this.emit=function(d,o){postMessage({type:"event",name:d,data:o})}}.call(c.prototype),new c};var i=L.main=null,l=L.sender=null;L.onmessage=function(v){var s=v.data;if(s.event&&l)l._signal(s.event,s.data);else if(s.command)if(i[s.command])i[s.command].apply(i,s.args);else{if(!L[s.command])throw new Error("Unknown command:"+s.command);L[s.command].apply(L,s.args)}else if(s.init){L.initBaseUrls(s.tlns),l=L.sender=L.initSender();var c=this.require(s.module)[s.classname];i=L.main=new c(l)}}}})(ka),ace.define("ace/lib/oop",[],function(L,n,i){n.inherits=function(l,v){l.super_=v,l.prototype=Object.create(v.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}})},n.mixin=function(l,v){for(var s in v)l[s]=v[s];return l},n.implement=function(l,v){n.mixin(l,v)}}),ace.define("ace/apply_delta",[],function(L,n,i){n.applyDelta=function(l,v,s){var c=v.start.row,d=v.start.column,o=l[c]||"";switch(v.action){case"insert":var p=v.lines;if(p.length===1)l[c]=o.substring(0,d)+v.lines[0]+o.substring(d);else{var e=[c,1].concat(v.lines);l.splice.apply(l,e),l[c]=o.substring(0,d)+l[c],l[c+v.lines.length-1]+=o.substring(d)}break;case"remove":var t=v.end.column,r=v.end.row;c===r?l[c]=o.substring(0,d)+o.substring(t):l.splice(c,r-c+1,o.substring(0,d)+l[r].substring(t))}}}),ace.define("ace/lib/event_emitter",[],function(L,n,i){var l={},v=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};l._emit=l._dispatchEvent=function(c,d){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var o=this._eventRegistry[c]||[],p=this._defaultHandlers[c];if(!(!o.length&&!p)){(typeof d!="object"||!d)&&(d={}),d.type||(d.type=c),d.stopPropagation||(d.stopPropagation=v),d.preventDefault||(d.preventDefault=s),o=o.slice();for(var e=0;e<o.length&&(o[e](d,this),!d.propagationStopped);e++);if(p&&!d.defaultPrevented)return p(d,this)}},l._signal=function(c,d){var o=(this._eventRegistry||{})[c];if(o){o=o.slice();for(var p=0;p<o.length;p++)o[p](d,this)}},l.once=function(c,d){var o=this;if(this.on(c,function p(){o.off(c,p),d.apply(null,arguments)}),!d)return new Promise(function(p){d=p})},l.setDefaultHandler=function(c,d){var o=this._defaultHandlers;if(o||(o=this._defaultHandlers={_disabled_:{}}),o[c]){var p=o[c],e=o._disabled_[c];e||(o._disabled_[c]=e=[]),e.push(p);var t=e.indexOf(d);t!=-1&&e.splice(t,1)}o[c]=d},l.removeDefaultHandler=function(c,d){var o=this._defaultHandlers;if(o){var p=o._disabled_[c];if(o[c]==d)p&&this.setDefaultHandler(c,p.pop());else if(p){var e=p.indexOf(d);e!=-1&&p.splice(e,1)}}},l.on=l.addEventListener=function(c,d,o){this._eventRegistry=this._eventRegistry||{};var p=this._eventRegistry[c];return p||(p=this._eventRegistry[c]=[]),p.indexOf(d)==-1&&p[o?"unshift":"push"](d),d},l.off=l.removeListener=l.removeEventListener=function(c,d){this._eventRegistry=this._eventRegistry||{};var o=this._eventRegistry[c];if(o){var p=o.indexOf(d);p!==-1&&o.splice(p,1)}},l.removeAllListeners=function(c){c||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[c]=void 0),this._defaultHandlers&&(this._defaultHandlers[c]=void 0)},n.EventEmitter=l}),ace.define("ace/range",[],function(L,n,i){var l=function(){function v(s,c,d,o){this.start={row:s,column:c},this.end={row:d,column:o}}return v.prototype.isEqual=function(s){return this.start.row===s.start.row&&this.end.row===s.end.row&&this.start.column===s.start.column&&this.end.column===s.end.column},v.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},v.prototype.contains=function(s,c){return this.compare(s,c)==0},v.prototype.compareRange=function(s){var c,d=s.end,o=s.start;return c=this.compare(d.row,d.column),c==1?(c=this.compare(o.row,o.column),c==1?2:c==0?1:0):c==-1?-2:(c=this.compare(o.row,o.column),c==-1?-1:c==1?42:0)},v.prototype.comparePoint=function(s){return this.compare(s.row,s.column)},v.prototype.containsRange=function(s){return this.comparePoint(s.start)==0&&this.comparePoint(s.end)==0},v.prototype.intersects=function(s){var c=this.compareRange(s);return c==-1||c==0||c==1},v.prototype.isEnd=function(s,c){return this.end.row==s&&this.end.column==c},v.prototype.isStart=function(s,c){return this.start.row==s&&this.start.column==c},v.prototype.setStart=function(s,c){typeof s=="object"?(this.start.column=s.column,this.start.row=s.row):(this.start.row=s,this.start.column=c)},v.prototype.setEnd=function(s,c){typeof s=="object"?(this.end.column=s.column,this.end.row=s.row):(this.end.row=s,this.end.column=c)},v.prototype.inside=function(s,c){return this.compare(s,c)==0?!(this.isEnd(s,c)||this.isStart(s,c)):!1},v.prototype.insideStart=function(s,c){return this.compare(s,c)==0?!this.isEnd(s,c):!1},v.prototype.insideEnd=function(s,c){return this.compare(s,c)==0?!this.isStart(s,c):!1},v.prototype.compare=function(s,c){return!this.isMultiLine()&&s===this.start.row?c<this.start.column?-1:c>this.end.column?1:0:s<this.start.row?-1:s>this.end.row?1:this.start.row===s?c>=this.start.column?0:-1:this.end.row===s?c<=this.end.column?0:1:0},v.prototype.compareStart=function(s,c){return this.start.row==s&&this.start.column==c?-1:this.compare(s,c)},v.prototype.compareEnd=function(s,c){return this.end.row==s&&this.end.column==c?1:this.compare(s,c)},v.prototype.compareInside=function(s,c){return this.end.row==s&&this.end.column==c?1:this.start.row==s&&this.start.column==c?-1:this.compare(s,c)},v.prototype.clipRows=function(s,c){if(this.end.row>c)var d={row:c+1,column:0};else if(this.end.row<s)var d={row:s,column:0};if(this.start.row>c)var o={row:c+1,column:0};else if(this.start.row<s)var o={row:s,column:0};return v.fromPoints(o||this.start,d||this.end)},v.prototype.extend=function(s,c){var d=this.compare(s,c);if(d==0)return this;if(d==-1)var o={row:s,column:c};else var p={row:s,column:c};return v.fromPoints(o||this.start,p||this.end)},v.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},v.prototype.isMultiLine=function(){return this.start.row!==this.end.row},v.prototype.clone=function(){return v.fromPoints(this.start,this.end)},v.prototype.collapseRows=function(){return this.end.column==0?new v(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new v(this.start.row,0,this.end.row,0)},v.prototype.toScreenRange=function(s){var c=s.documentToScreenPosition(this.start),d=s.documentToScreenPosition(this.end);return new v(c.row,c.column,d.row,d.column)},v.prototype.moveBy=function(s,c){this.start.row+=s,this.start.column+=c,this.end.row+=s,this.end.column+=c},v}();l.fromPoints=function(v,s){return new l(v.row,v.column,s.row,s.column)},l.comparePoints=function(v,s){return v.row-s.row||v.column-s.column},n.Range=l}),ace.define("ace/anchor",[],function(L,n,i){function l(o,p,e){var t=e?o.column<=p.column:o.column<p.column;return o.row<p.row||o.row==p.row&&t}function v(o,p,e){var t=o.action=="insert",r=(t?1:-1)*(o.end.row-o.start.row),h=(t?1:-1)*(o.end.column-o.start.column),a=o.start,u=t?a:o.end;return l(p,a,e)?{row:p.row,column:p.column}:l(u,p,!e)?{row:p.row+r,column:p.column+(p.row==u.row?h:0)}:{row:a.row,column:a.column}}var s=L("./lib/oop"),c=L("./lib/event_emitter").EventEmitter,d=function(){function o(p,e,t){this.$onChange=this.onChange.bind(this),this.attach(p),typeof e!="number"?this.setPosition(e.row,e.column):this.setPosition(e,t)}return o.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},o.prototype.getDocument=function(){return this.document},o.prototype.onChange=function(p){if(!(p.start.row==p.end.row&&p.start.row!=this.row)&&!(p.start.row>this.row)){var e=v(p,{row:this.row,column:this.column},this.$insertRight);this.setPosition(e.row,e.column,!0)}},o.prototype.setPosition=function(p,e,t){var r;if(t?r={row:p,column:e}:r=this.$clipPositionToDocument(p,e),!(this.row==r.row&&this.column==r.column)){var h={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:h,value:r})}},o.prototype.detach=function(){this.document.off("change",this.$onChange)},o.prototype.attach=function(p){this.document=p||this.document,this.document.on("change",this.$onChange)},o.prototype.$clipPositionToDocument=function(p,e){var t={};return p>=this.document.getLength()?(t.row=Math.max(0,this.document.getLength()-1),t.column=this.document.getLine(t.row).length):p<0?(t.row=0,t.column=0):(t.row=p,t.column=Math.min(this.document.getLine(t.row).length,Math.max(0,e))),e<0&&(t.column=0),t},o}();d.prototype.$insertRight=!1,s.implement(d.prototype,c),n.Anchor=d}),ace.define("ace/document",[],function(L,n,i){var l=L("./lib/oop"),v=L("./apply_delta").applyDelta,s=L("./lib/event_emitter").EventEmitter,c=L("./range").Range,d=L("./anchor").Anchor,o=function(){function p(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)}return p.prototype.setValue=function(e){var t=this.getLength()-1;this.remove(new c(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e||"")},p.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},p.prototype.createAnchor=function(e,t){return new d(this,e,t)},p.prototype.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:`
|
|
1008
|
+
`&&(r-=1),v.right.push({startLine:s.right,endLine:s.right+r}),s.right+=p;break;default:throw new Error("Diff type was not defined.")}}}),v},n.prototype.setCodeMarkers=function(i){i===void 0&&(i={left:[],right:[]});for(var l=[],v={left:[],right:[]},s=0;s<i.left.length;s++){var c={startRow:i.left[s].startLine-1,endRow:i.left[s].endLine,type:"text",className:"codeMarker"};v.left.push(c)}for(var s=0;s<i.right.length;s++){var c={startRow:i.right[s].startLine-1,endRow:i.right[s].endLine,type:"text",className:"codeMarker"};v.right.push(c)}return l[0]=v.left,l[1]=v.right,l},n.prototype.render=function(){var i=this.diff();return di.createElement(Sa.default,{name:this.props.name,className:this.props.className,focus:this.props.focus,orientation:this.props.orientation,splits:this.props.splits,mode:this.props.mode,theme:this.props.theme,height:this.props.height,width:this.props.width,fontSize:this.props.fontSize,showGutter:this.props.showGutter,onChange:this.onChange,onPaste:this.props.onPaste,onLoad:this.props.onLoad,onScroll:this.props.onScroll,minLines:this.props.minLines,maxLines:this.props.maxLines,readOnly:this.props.readOnly,highlightActiveLine:this.props.highlightActiveLine,showPrintMargin:this.props.showPrintMargin,tabSize:this.props.tabSize,cursorStart:this.props.cursorStart,editorProps:this.props.editorProps,style:this.props.style,scrollMargin:this.props.scrollMargin,setOptions:this.props.setOptions,wrapEnabled:this.props.wrapEnabled,enableBasicAutocompletion:this.props.enableBasicAutocompletion,enableLiveAutocompletion:this.props.enableLiveAutocompletion,value:this.state.value,markers:i})},n.propTypes={cursorStart:pe.number,editorProps:pe.object,enableBasicAutocompletion:pe.bool,enableLiveAutocompletion:pe.bool,focus:pe.bool,fontSize:pe.number,height:pe.string,highlightActiveLine:pe.bool,maxLines:pe.number,minLines:pe.number,mode:pe.string,name:pe.string,className:pe.string,onLoad:pe.func,onPaste:pe.func,onScroll:pe.func,onChange:pe.func,orientation:pe.string,readOnly:pe.bool,scrollMargin:pe.array,setOptions:pe.object,showGutter:pe.bool,showPrintMargin:pe.bool,splits:pe.number,style:pe.object,tabSize:pe.number,theme:pe.string,value:pe.array,width:pe.string,wrapEnabled:pe.bool},n.defaultProps={cursorStart:1,editorProps:{},enableBasicAutocompletion:!1,enableLiveAutocompletion:!1,focus:!1,fontSize:12,height:"500px",highlightActiveLine:!0,maxLines:null,minLines:null,mode:"",name:"ace-editor",onLoad:null,onScroll:null,onPaste:null,onChange:null,orientation:"beside",readOnly:!1,scrollMargin:[0,0,0,0],setOptions:{},showGutter:!0,showPrintMargin:!0,splits:2,style:{},tabSize:4,theme:"github",value:["",""],width:"500px",wrapEnabled:!0},n}(di.Component);kt.default=xa;Object.defineProperty(wt,"__esModule",{value:!0});wt.diff=wt.split=void 0;var Aa=ut,$a=kt;wt.diff=$a.default;var Ta=tt;wt.split=Ta.default;var _a=wt.default=Aa.default,ka={exports:{}};(function(L,n){ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(i,l,v){var s=i("../lib/oop"),c=i("./text_highlight_rules").TextHighlightRules,d=function(){this.$rules={start:[{token:"variable",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'},{token:"string",regex:'"',next:"string"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"text",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"comment",regex:"\\/\\/.*$"},{token:"comment.start",regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"punctuation.operator",regex:/[,]/},{token:"text",regex:"\\s+"}],string:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],comment:[{token:"comment.end",regex:"\\*\\/",next:"start"},{defaultToken:"comment"}]}};s.inherits(d,c),l.JsonHighlightRules=d}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(i,l,v){var s=i("../range").Range,c=function(){};(function(){this.checkOutdent=function(d,o){return/^\s+$/.test(d)?/^\s*\}/.test(o):!1},this.autoOutdent=function(d,o){var p=d.getLine(o),e=p.match(/^(\s*\})/);if(!e)return 0;var t=e[1].length,r=d.findMatchingBracket({row:o,column:t});if(!r||r.row==o)return 0;var h=this.$getIndent(d.getLine(r.row));d.replace(new s(o,0,o,t-1),h)},this.$getIndent=function(d){return d.match(/^\s*/)[0]}}).call(c.prototype),l.MatchingBraceOutdent=c}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(i,l,v){var s=i("../../lib/oop"),c=i("../../range").Range,d=i("./fold_mode").FoldMode,o=l.FoldMode=function(p){p&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+p.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+p.end)))};s.inherits(o,d),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(p,e,t){var r=p.getLine(t);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var h=this._getFoldWidgetBase(p,e,t);return!h&&this.startRegionRe.test(r)?"start":h},this.getFoldWidgetRange=function(p,e,t,r){var h=p.getLine(t);if(this.startRegionRe.test(h))return this.getCommentRegionBlock(p,h,t);var f=h.match(this.foldingStartMarker);if(f){var a=f.index;if(f[1])return this.openingBracketBlock(p,f[1],t,a);var u=p.getCommentFoldRange(t,a+f[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(p,t):e!="all"&&(u=null)),u}if(e!=="markbegin"){var f=h.match(this.foldingStopMarker);if(f){var a=f.index+f[0].length;return f[1]?this.closingBracketBlock(p,f[1],t,a):p.getCommentFoldRange(t,a,-1)}}},this.getSectionRange=function(p,e){var t=p.getLine(e),r=t.search(/\S/),h=e,a=t.length;e+=1;for(var u=e,f=p.getLength();++e<f;){t=p.getLine(e);var m=t.search(/\S/);if(m!==-1){if(r>m)break;var y=this.getFoldWidgetRange(p,"all",e);if(y){if(y.start.row<=h)break;if(y.isMultiLine())e=y.end.row;else if(r==m)break}u=e}}return new c(h,a,u,p.getLine(u).length)},this.getCommentRegionBlock=function(p,e,t){for(var r=e.search(/\s*$/),h=p.getLength(),a=t,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,f=1;++t<h;){e=p.getLine(t);var m=u.exec(e);if(m&&(m[1]?f--:f++,!f))break}var y=t;if(y>a)return new c(a,r,y,e.length)}}.call(o.prototype)}),ace.define("ace/mode/json",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle","ace/worker/worker_client"],function(i,l,v){var s=i("../lib/oop"),c=i("./text").Mode,d=i("./json_highlight_rules").JsonHighlightRules,o=i("./matching_brace_outdent").MatchingBraceOutdent,p=i("./folding/cstyle").FoldMode,e=i("../worker/worker_client").WorkerClient,t=function(){this.HighlightRules=d,this.$outdent=new o,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new p};s.inherits(t,c),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(r,h,a){var u=this.$getIndent(h);if(r=="start"){var f=h.match(/^.*[\{\(\[]\s*$/);f&&(u+=a)}return u},this.checkOutdent=function(r,h,a){return this.$outdent.checkOutdent(h,a)},this.autoOutdent=function(r,h,a){this.$outdent.autoOutdent(h,a)},this.createWorker=function(r){var h=new e(["ace"],"ace/mode/json_worker","JsonWorker");return h.attachToDocument(r.getDocument()),h.on("annotate",function(a){r.setAnnotations(a.data)}),h.on("terminate",function(){r.clearAnnotations()}),h},this.$id="ace/mode/json"}.call(t.prototype),l.Mode=t}),function(){ace.require(["ace/mode/json"],function(i){L&&(L.exports=i)})}()})(ka);var Ma={exports:{}};(function(L,n){ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(i,l,v){var s=i("../lib/oop"),c=i("./text_highlight_rules").TextHighlightRules,d=function(){this.$rules={start:[{token:"variable",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]\\s*(?=:)'},{token:"string",regex:'"',next:"string"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:"text",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"comment",regex:"\\/\\/.*$"},{token:"comment.start",regex:"\\/\\*",next:"comment"},{token:"paren.lparen",regex:"[[({]"},{token:"paren.rparen",regex:"[\\])}]"},{token:"punctuation.operator",regex:/[,]/},{token:"text",regex:"\\s+"}],string:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\\\/bfnrt])/},{token:"string",regex:'"|$',next:"start"},{defaultToken:"string"}],comment:[{token:"comment.end",regex:"\\*\\/",next:"start"},{defaultToken:"comment"}]}};s.inherits(d,c),l.JsonHighlightRules=d}),ace.define("ace/mode/json5_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/json_highlight_rules"],function(i,l,v){var s=i("../lib/oop"),c=i("./json_highlight_rules").JsonHighlightRules,d=function(){c.call(this);var o=[{token:"variable",regex:/[a-zA-Z$_\u00a1-\uffff][\w$\u00a1-\uffff]*\s*(?=:)/},{token:"variable",regex:/['](?:(?:\\.)|(?:[^'\\]))*?[']\s*(?=:)/},{token:"constant.language.boolean",regex:/(?:null)\b/},{token:"string",regex:/'/,next:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\/bfnrt]|$)/,consumeLineEnd:!0},{token:"string",regex:/'|$/,next:"start"},{defaultToken:"string"}]},{token:"string",regex:/"(?![^"]*":)/,next:[{token:"constant.language.escape",regex:/\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|["\/bfnrt]|$)/,consumeLineEnd:!0},{token:"string",regex:/"|$/,next:"start"},{defaultToken:"string"}]},{token:"constant.numeric",regex:/[+-]?(?:Infinity|NaN)\b/}];for(var p in this.$rules)this.$rules[p].unshift.apply(this.$rules[p],o);this.normalizeRules()};s.inherits(d,c),l.Json5HighlightRules=d}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(i,l,v){var s=i("../range").Range,c=function(){};(function(){this.checkOutdent=function(d,o){return/^\s+$/.test(d)?/^\s*\}/.test(o):!1},this.autoOutdent=function(d,o){var p=d.getLine(o),e=p.match(/^(\s*\})/);if(!e)return 0;var t=e[1].length,r=d.findMatchingBracket({row:o,column:t});if(!r||r.row==o)return 0;var h=this.$getIndent(d.getLine(r.row));d.replace(new s(o,0,o,t-1),h)},this.$getIndent=function(d){return d.match(/^\s*/)[0]}}).call(c.prototype),l.MatchingBraceOutdent=c}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(i,l,v){var s=i("../../lib/oop"),c=i("../../range").Range,d=i("./fold_mode").FoldMode,o=l.FoldMode=function(p){p&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+p.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+p.end)))};s.inherits(o,d),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(p,e,t){var r=p.getLine(t);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var h=this._getFoldWidgetBase(p,e,t);return!h&&this.startRegionRe.test(r)?"start":h},this.getFoldWidgetRange=function(p,e,t,r){var h=p.getLine(t);if(this.startRegionRe.test(h))return this.getCommentRegionBlock(p,h,t);var f=h.match(this.foldingStartMarker);if(f){var a=f.index;if(f[1])return this.openingBracketBlock(p,f[1],t,a);var u=p.getCommentFoldRange(t,a+f[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(p,t):e!="all"&&(u=null)),u}if(e!=="markbegin"){var f=h.match(this.foldingStopMarker);if(f){var a=f.index+f[0].length;return f[1]?this.closingBracketBlock(p,f[1],t,a):p.getCommentFoldRange(t,a,-1)}}},this.getSectionRange=function(p,e){var t=p.getLine(e),r=t.search(/\S/),h=e,a=t.length;e+=1;for(var u=e,f=p.getLength();++e<f;){t=p.getLine(e);var m=t.search(/\S/);if(m!==-1){if(r>m)break;var y=this.getFoldWidgetRange(p,"all",e);if(y){if(y.start.row<=h)break;if(y.isMultiLine())e=y.end.row;else if(r==m)break}u=e}}return new c(h,a,u,p.getLine(u).length)},this.getCommentRegionBlock=function(p,e,t){for(var r=e.search(/\s*$/),h=p.getLength(),a=t,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,f=1;++t<h;){e=p.getLine(t);var m=u.exec(e);if(m&&(m[1]?f--:f++,!f))break}var y=t;if(y>a)return new c(a,r,y,e.length)}}.call(o.prototype)}),ace.define("ace/mode/json5",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/json5_highlight_rules","ace/mode/matching_brace_outdent","ace/mode/folding/cstyle"],function(i,l,v){var s=i("../lib/oop"),c=i("./text").Mode,d=i("./json5_highlight_rules").Json5HighlightRules,o=i("./matching_brace_outdent").MatchingBraceOutdent,p=i("./folding/cstyle").FoldMode,e=function(){this.HighlightRules=d,this.$outdent=new o,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new p};s.inherits(e,c),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.checkOutdent=function(t,r,h){return this.$outdent.checkOutdent(r,h)},this.autoOutdent=function(t,r,h){this.$outdent.autoOutdent(r,h)},this.$id="ace/mode/json5"}.call(e.prototype),l.Mode=e}),function(){ace.require(["ace/mode/json5"],function(i){L&&(L.exports=i)})}()})(Ma);var La={};(function(L){function n(v,s){for(var c=v,d="";c;){var o=s[c];if(typeof o=="string")return o+d;if(o)return o.location.replace(/\/*$/,"/")+(d||o.main||o.name);if(o===!1)return"";var p=c.lastIndexOf("/");if(p===-1)break;d=c.substr(p)+d,c=c.slice(0,p)}return v}if(!(typeof L.window<"u"&&L.document)&&!(L.require&&L.define)){L.console||(L.console=function(){var v=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:v})},L.console.error=L.console.warn=L.console.log=L.console.trace=L.console),L.window=L,L.ace=L,L.onerror=function(v,s,c,d,o){postMessage({type:"error",data:{message:v,data:o&&o.data,file:s,line:c,col:d,stack:o&&o.stack}})},L.normalizeModule=function(v,s){if(s.indexOf("!")!==-1){var c=s.split("!");return L.normalizeModule(v,c[0])+"!"+L.normalizeModule(v,c[1])}if(s.charAt(0)=="."){var d=v.split("/").slice(0,-1).join("/");for(s=(d?d+"/":"")+s;s.indexOf(".")!==-1&&o!=s;){var o=s;s=s.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return s},L.require=function(v,s){if(s||(s=v,v=null),!s.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");s=L.normalizeModule(v,s);var c=L.require.modules[s];if(c)return c.initialized||(c.initialized=!0,c.exports=c.factory().exports),c.exports;if(!L.require.tlns)return console.log("unable to load "+s);var d=n(s,L.require.tlns);return d.slice(-3)!=".js"&&(d+=".js"),L.require.id=s,L.require.modules[s]={},importScripts(d),L.require(v,s)},L.require.modules={},L.require.tlns={},L.define=function(v,s,c){if(arguments.length==2?(c=s,typeof v!="string"&&(s=v,v=L.require.id)):arguments.length==1&&(c=v,s=[],v=L.require.id),typeof c!="function"){L.require.modules[v]={exports:c,initialized:!0};return}s.length||(s=["require","exports","module"]);var d=function(o){return L.require(v,o)};L.require.modules[v]={exports:{},factory:function(){var o=this,p=c.apply(this,s.slice(0,c.length).map(function(e){switch(e){case"require":return d;case"exports":return o.exports;case"module":return o;default:return d(e)}}));return p&&(o.exports=p),o}}},L.define.amd={},L.require.tlns={},L.initBaseUrls=function(v){for(var s in v)this.require.tlns[s]=v[s]},L.initSender=function(){var v=L.require("ace/lib/event_emitter").EventEmitter,s=L.require("ace/lib/oop"),c=function(){};return function(){s.implement(this,v),this.callback=function(d,o){postMessage({type:"call",id:o,data:d})},this.emit=function(d,o){postMessage({type:"event",name:d,data:o})}}.call(c.prototype),new c};var i=L.main=null,l=L.sender=null;L.onmessage=function(v){var s=v.data;if(s.event&&l)l._signal(s.event,s.data);else if(s.command)if(i[s.command])i[s.command].apply(i,s.args);else{if(!L[s.command])throw new Error("Unknown command:"+s.command);L[s.command].apply(L,s.args)}else if(s.init){L.initBaseUrls(s.tlns),l=L.sender=L.initSender();var c=this.require(s.module)[s.classname];i=L.main=new c(l)}}}})(La),ace.define("ace/lib/oop",[],function(L,n,i){n.inherits=function(l,v){l.super_=v,l.prototype=Object.create(v.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}})},n.mixin=function(l,v){for(var s in v)l[s]=v[s];return l},n.implement=function(l,v){n.mixin(l,v)}}),ace.define("ace/apply_delta",[],function(L,n,i){n.applyDelta=function(l,v,s){var c=v.start.row,d=v.start.column,o=l[c]||"";switch(v.action){case"insert":var p=v.lines;if(p.length===1)l[c]=o.substring(0,d)+v.lines[0]+o.substring(d);else{var e=[c,1].concat(v.lines);l.splice.apply(l,e),l[c]=o.substring(0,d)+l[c],l[c+v.lines.length-1]+=o.substring(d)}break;case"remove":var t=v.end.column,r=v.end.row;c===r?l[c]=o.substring(0,d)+o.substring(t):l.splice(c,r-c+1,o.substring(0,d)+l[r].substring(t))}}}),ace.define("ace/lib/event_emitter",[],function(L,n,i){var l={},v=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};l._emit=l._dispatchEvent=function(c,d){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var o=this._eventRegistry[c]||[],p=this._defaultHandlers[c];if(!(!o.length&&!p)){(typeof d!="object"||!d)&&(d={}),d.type||(d.type=c),d.stopPropagation||(d.stopPropagation=v),d.preventDefault||(d.preventDefault=s),o=o.slice();for(var e=0;e<o.length&&(o[e](d,this),!d.propagationStopped);e++);if(p&&!d.defaultPrevented)return p(d,this)}},l._signal=function(c,d){var o=(this._eventRegistry||{})[c];if(o){o=o.slice();for(var p=0;p<o.length;p++)o[p](d,this)}},l.once=function(c,d){var o=this;if(this.on(c,function p(){o.off(c,p),d.apply(null,arguments)}),!d)return new Promise(function(p){d=p})},l.setDefaultHandler=function(c,d){var o=this._defaultHandlers;if(o||(o=this._defaultHandlers={_disabled_:{}}),o[c]){var p=o[c],e=o._disabled_[c];e||(o._disabled_[c]=e=[]),e.push(p);var t=e.indexOf(d);t!=-1&&e.splice(t,1)}o[c]=d},l.removeDefaultHandler=function(c,d){var o=this._defaultHandlers;if(o){var p=o._disabled_[c];if(o[c]==d)p&&this.setDefaultHandler(c,p.pop());else if(p){var e=p.indexOf(d);e!=-1&&p.splice(e,1)}}},l.on=l.addEventListener=function(c,d,o){this._eventRegistry=this._eventRegistry||{};var p=this._eventRegistry[c];return p||(p=this._eventRegistry[c]=[]),p.indexOf(d)==-1&&p[o?"unshift":"push"](d),d},l.off=l.removeListener=l.removeEventListener=function(c,d){this._eventRegistry=this._eventRegistry||{};var o=this._eventRegistry[c];if(o){var p=o.indexOf(d);p!==-1&&o.splice(p,1)}},l.removeAllListeners=function(c){c||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[c]=void 0),this._defaultHandlers&&(this._defaultHandlers[c]=void 0)},n.EventEmitter=l}),ace.define("ace/range",[],function(L,n,i){var l=function(){function v(s,c,d,o){this.start={row:s,column:c},this.end={row:d,column:o}}return v.prototype.isEqual=function(s){return this.start.row===s.start.row&&this.end.row===s.end.row&&this.start.column===s.start.column&&this.end.column===s.end.column},v.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},v.prototype.contains=function(s,c){return this.compare(s,c)==0},v.prototype.compareRange=function(s){var c,d=s.end,o=s.start;return c=this.compare(d.row,d.column),c==1?(c=this.compare(o.row,o.column),c==1?2:c==0?1:0):c==-1?-2:(c=this.compare(o.row,o.column),c==-1?-1:c==1?42:0)},v.prototype.comparePoint=function(s){return this.compare(s.row,s.column)},v.prototype.containsRange=function(s){return this.comparePoint(s.start)==0&&this.comparePoint(s.end)==0},v.prototype.intersects=function(s){var c=this.compareRange(s);return c==-1||c==0||c==1},v.prototype.isEnd=function(s,c){return this.end.row==s&&this.end.column==c},v.prototype.isStart=function(s,c){return this.start.row==s&&this.start.column==c},v.prototype.setStart=function(s,c){typeof s=="object"?(this.start.column=s.column,this.start.row=s.row):(this.start.row=s,this.start.column=c)},v.prototype.setEnd=function(s,c){typeof s=="object"?(this.end.column=s.column,this.end.row=s.row):(this.end.row=s,this.end.column=c)},v.prototype.inside=function(s,c){return this.compare(s,c)==0?!(this.isEnd(s,c)||this.isStart(s,c)):!1},v.prototype.insideStart=function(s,c){return this.compare(s,c)==0?!this.isEnd(s,c):!1},v.prototype.insideEnd=function(s,c){return this.compare(s,c)==0?!this.isStart(s,c):!1},v.prototype.compare=function(s,c){return!this.isMultiLine()&&s===this.start.row?c<this.start.column?-1:c>this.end.column?1:0:s<this.start.row?-1:s>this.end.row?1:this.start.row===s?c>=this.start.column?0:-1:this.end.row===s?c<=this.end.column?0:1:0},v.prototype.compareStart=function(s,c){return this.start.row==s&&this.start.column==c?-1:this.compare(s,c)},v.prototype.compareEnd=function(s,c){return this.end.row==s&&this.end.column==c?1:this.compare(s,c)},v.prototype.compareInside=function(s,c){return this.end.row==s&&this.end.column==c?1:this.start.row==s&&this.start.column==c?-1:this.compare(s,c)},v.prototype.clipRows=function(s,c){if(this.end.row>c)var d={row:c+1,column:0};else if(this.end.row<s)var d={row:s,column:0};if(this.start.row>c)var o={row:c+1,column:0};else if(this.start.row<s)var o={row:s,column:0};return v.fromPoints(o||this.start,d||this.end)},v.prototype.extend=function(s,c){var d=this.compare(s,c);if(d==0)return this;if(d==-1)var o={row:s,column:c};else var p={row:s,column:c};return v.fromPoints(o||this.start,p||this.end)},v.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},v.prototype.isMultiLine=function(){return this.start.row!==this.end.row},v.prototype.clone=function(){return v.fromPoints(this.start,this.end)},v.prototype.collapseRows=function(){return this.end.column==0?new v(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new v(this.start.row,0,this.end.row,0)},v.prototype.toScreenRange=function(s){var c=s.documentToScreenPosition(this.start),d=s.documentToScreenPosition(this.end);return new v(c.row,c.column,d.row,d.column)},v.prototype.moveBy=function(s,c){this.start.row+=s,this.start.column+=c,this.end.row+=s,this.end.column+=c},v}();l.fromPoints=function(v,s){return new l(v.row,v.column,s.row,s.column)},l.comparePoints=function(v,s){return v.row-s.row||v.column-s.column},n.Range=l}),ace.define("ace/anchor",[],function(L,n,i){function l(o,p,e){var t=e?o.column<=p.column:o.column<p.column;return o.row<p.row||o.row==p.row&&t}function v(o,p,e){var t=o.action=="insert",r=(t?1:-1)*(o.end.row-o.start.row),h=(t?1:-1)*(o.end.column-o.start.column),a=o.start,u=t?a:o.end;return l(p,a,e)?{row:p.row,column:p.column}:l(u,p,!e)?{row:p.row+r,column:p.column+(p.row==u.row?h:0)}:{row:a.row,column:a.column}}var s=L("./lib/oop"),c=L("./lib/event_emitter").EventEmitter,d=function(){function o(p,e,t){this.$onChange=this.onChange.bind(this),this.attach(p),typeof e!="number"?this.setPosition(e.row,e.column):this.setPosition(e,t)}return o.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},o.prototype.getDocument=function(){return this.document},o.prototype.onChange=function(p){if(!(p.start.row==p.end.row&&p.start.row!=this.row)&&!(p.start.row>this.row)){var e=v(p,{row:this.row,column:this.column},this.$insertRight);this.setPosition(e.row,e.column,!0)}},o.prototype.setPosition=function(p,e,t){var r;if(t?r={row:p,column:e}:r=this.$clipPositionToDocument(p,e),!(this.row==r.row&&this.column==r.column)){var h={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:h,value:r})}},o.prototype.detach=function(){this.document.off("change",this.$onChange)},o.prototype.attach=function(p){this.document=p||this.document,this.document.on("change",this.$onChange)},o.prototype.$clipPositionToDocument=function(p,e){var t={};return p>=this.document.getLength()?(t.row=Math.max(0,this.document.getLength()-1),t.column=this.document.getLine(t.row).length):p<0?(t.row=0,t.column=0):(t.row=p,t.column=Math.min(this.document.getLine(t.row).length,Math.max(0,e))),e<0&&(t.column=0),t},o}();d.prototype.$insertRight=!1,s.implement(d.prototype,c),n.Anchor=d}),ace.define("ace/document",[],function(L,n,i){var l=L("./lib/oop"),v=L("./apply_delta").applyDelta,s=L("./lib/event_emitter").EventEmitter,c=L("./range").Range,d=L("./anchor").Anchor,o=function(){function p(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)}return p.prototype.setValue=function(e){var t=this.getLength()-1;this.remove(new c(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e||"")},p.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},p.prototype.createAnchor=function(e,t){return new d(this,e,t)},p.prototype.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:`
|
|
1009
1009
|
`,this._signal("changeNewLineMode")},p.prototype.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return`\r
|
|
1010
1010
|
`;case"unix":return`
|
|
1011
1011
|
`;default:return this.$autoNewLine||`
|
|
@@ -1013,7 +1013,7 @@ import{C as qe,R as M}from"./ConfigCustomJavascriptSet__loadShare__react__loadSh
|
|
|
1013
1013
|
`||e=="\r"||e==`
|
|
1014
1014
|
`},p.prototype.getLine=function(e){return this.$lines[e]||""},p.prototype.getLines=function(e,t){return this.$lines.slice(e,t+1)},p.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},p.prototype.getLength=function(){return this.$lines.length},p.prototype.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},p.prototype.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var r=t.length-1;e.end.row-e.start.row==r&&(t[r]=t[r].substring(0,e.end.column))}return t},p.prototype.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},p.prototype.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},p.prototype.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},p.prototype.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},p.prototype.insertInLine=function(e,t){var r=this.clippedPos(e.row,e.column),h=this.pos(e.row,e.column+t.length);return this.applyDelta({start:r,end:h,action:"insert",lines:[t]},!0),this.clonePos(h)},p.prototype.clippedPos=function(e,t){var r=this.getLength();e===void 0?e=r:e<0?e=0:e>=r&&(e=r-1,t=void 0);var h=this.getLine(e);return t==null&&(t=h.length),t=Math.min(Math.max(t,0),h.length),{row:e,column:t}},p.prototype.clonePos=function(e){return{row:e.row,column:e.column}},p.prototype.pos=function(e,t){return{row:e,column:t}},p.prototype.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},p.prototype.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var r=0;e<this.getLength()?(t=t.concat([""]),r=0):(t=[""].concat(t),e--,r=this.$lines[e].length),this.insertMergedLines({row:e,column:r},t)},p.prototype.insertMergedLines=function(e,t){var r=this.clippedPos(e.row,e.column),h={row:r.row+t.length-1,column:(t.length==1?r.column:0)+t[t.length-1].length};return this.applyDelta({start:r,end:h,action:"insert",lines:t}),this.clonePos(h)},p.prototype.remove=function(e){var t=this.clippedPos(e.start.row,e.start.column),r=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:t,end:r,action:"remove",lines:this.getLinesForRange({start:t,end:r})}),this.clonePos(t)},p.prototype.removeInLine=function(e,t,r){var h=this.clippedPos(e,t),a=this.clippedPos(e,r);return this.applyDelta({start:h,end:a,action:"remove",lines:this.getLinesForRange({start:h,end:a})},!0),this.clonePos(h)},p.prototype.removeFullLines=function(e,t){e=Math.min(Math.max(0,e),this.getLength()-1),t=Math.min(Math.max(0,t),this.getLength()-1);var r=t==this.getLength()-1&&e>0,h=t<this.getLength()-1,a=r?e-1:e,u=r?this.getLine(a).length:0,f=h?t+1:t,m=h?0:this.getLine(f).length,y=new c(a,u,f,m),x=this.$lines.slice(e,t+1);return this.applyDelta({start:y.start,end:y.end,action:"remove",lines:this.getLinesForRange(y)}),x},p.prototype.removeNewLine=function(e){e<this.getLength()-1&&e>=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},p.prototype.replace=function(e,t){if(e instanceof c||(e=c.fromPoints(e.start,e.end)),t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var r;return t?r=this.insert(e.start,t):r=e.start,r},p.prototype.applyDeltas=function(e){for(var t=0;t<e.length;t++)this.applyDelta(e[t])},p.prototype.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--)this.revertDelta(e[t])},p.prototype.applyDelta=function(e,t){var r=e.action=="insert";(r?e.lines.length<=1&&!e.lines[0]:!c.comparePoints(e.start,e.end))||(r&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(v(this.$lines,e,t),this._signal("change",e)))},p.prototype.$safeApplyDelta=function(e){var t=this.$lines.length;(e.action=="remove"&&e.start.row<t&&e.end.row<t||e.action=="insert"&&e.start.row<=t)&&this.applyDelta(e)},p.prototype.$splitAndapplyLargeDelta=function(e,t){for(var r=e.lines,h=r.length-t+1,a=e.start.row,u=e.start.column,f=0,m=0;f<h;f=m){m+=t-1;var y=r.slice(f,m);y.push(""),this.applyDelta({start:this.pos(a+f,u),end:this.pos(a+m,u=0),action:e.action,lines:y},!0)}e.lines=r.slice(f),e.start.row=a+f,e.start.column=u,this.applyDelta(e,!0)},p.prototype.revertDelta=function(e){this.$safeApplyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:e.action=="insert"?"remove":"insert",lines:e.lines.slice()})},p.prototype.indexToPosition=function(e,t){for(var r=this.$lines||this.getAllLines(),h=this.getNewLineCharacter().length,a=t||0,u=r.length;a<u;a++)if(e-=r[a].length+h,e<0)return{row:a,column:e+r[a].length+h};return{row:u-1,column:e+r[u-1].length+h}},p.prototype.positionToIndex=function(e,t){for(var r=this.$lines||this.getAllLines(),h=this.getNewLineCharacter().length,a=0,u=Math.min(e.row,r.length),f=t||0;f<u;++f)a+=r[f].length+h;return a+e.column},p.prototype.$split=function(e){return e.split(/\r\n|\r|\n/)},p}();o.prototype.$autoNewLine="",o.prototype.$newLineMode="auto",l.implement(o.prototype,s),n.Document=o}),ace.define("ace/lib/deep_copy",[],function(L,n,i){n.deepCopy=function l(v){if(typeof v!="object"||!v)return v;var s;if(Array.isArray(v)){s=[];for(var c=0;c<v.length;c++)s[c]=l(v[c]);return s}if(Object.prototype.toString.call(v)!=="[object Object]")return v;s={};for(var c in v)s[c]=l(v[c]);return s}}),ace.define("ace/lib/lang",[],function(L,n,i){n.last=function(s){return s[s.length-1]},n.stringReverse=function(s){return s.split("").reverse().join("")},n.stringRepeat=function(s,c){for(var d="";c>0;)c&1&&(d+=s),(c>>=1)&&(s+=s);return d};var l=/^\s\s*/,v=/\s\s*$/;n.stringTrimLeft=function(s){return s.replace(l,"")},n.stringTrimRight=function(s){return s.replace(v,"")},n.copyObject=function(s){var c={};for(var d in s)c[d]=s[d];return c},n.copyArray=function(s){for(var c=[],d=0,o=s.length;d<o;d++)s[d]&&typeof s[d]=="object"?c[d]=this.copyObject(s[d]):c[d]=s[d];return c},n.deepCopy=L("./deep_copy").deepCopy,n.arrayToMap=function(s){for(var c={},d=0;d<s.length;d++)c[s[d]]=1;return c},n.createMap=function(s){var c=Object.create(null);for(var d in s)c[d]=s[d];return c},n.arrayRemove=function(s,c){for(var d=0;d<=s.length;d++)c===s[d]&&s.splice(d,1)},n.escapeRegExp=function(s){return s.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},n.escapeHTML=function(s){return(""+s).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},n.getMatchOffsets=function(s,c){var d=[];return s.replace(c,function(o){d.push({offset:arguments[arguments.length-2],length:o.length})}),d},n.deferredCall=function(s){var c=null,d=function(){c=null,s()},o=function(p){return o.cancel(),c=setTimeout(d,p||0),o};return o.schedule=o,o.call=function(){return this.cancel(),s(),o},o.cancel=function(){return clearTimeout(c),c=null,o},o.isPending=function(){return c},o},n.delayedCall=function(s,c){var d=null,o=function(){d=null,s()},p=function(e){d==null&&(d=setTimeout(o,e||c))};return p.delay=function(e){d&&clearTimeout(d),d=setTimeout(o,e||c)},p.schedule=p,p.call=function(){this.cancel(),s()},p.cancel=function(){d&&clearTimeout(d),d=null},p.isPending=function(){return d},p},n.supportsLookbehind=function(){try{new RegExp("(?<=.)")}catch{return!1}return!0},n.skipEmptyMatch=function(s,c,d){return d&&s.codePointAt(c)>65535?2:1}}),ace.define("ace/worker/mirror",[],function(L,n,i){var l=L("../document").Document,v=L("../lib/lang"),s=n.Mirror=function(c){this.sender=c;var d=this.doc=new l(""),o=this.deferredUpdate=v.delayedCall(this.onUpdate.bind(this)),p=this;c.on("change",function(e){var t=e.data;if(t[0].start)d.applyDeltas(t);else for(var r=0;r<t.length;r+=2){var h,a;if(Array.isArray(t[r+1])?h={action:"insert",start:t[r],lines:t[r+1]}:h={action:"remove",start:t[r],end:t[r+1]},(h.action=="insert"?h.start:h.end).row>=d.$lines.length)throw a=new Error("Invalid delta"),a.data={path:p.$path,linesLength:d.$lines.length,start:h.start,end:h.end},a;d.applyDelta(h,!0)}if(p.$timeout)return o.schedule(p.$timeout);p.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(c){this.$timeout=c},this.setValue=function(c){this.doc.setValue(c),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(c){this.sender.callback(this.doc.getValue(),c)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(s.prototype)}),ace.define("ace/mode/json/json_parse",[],function(L,n,i){var l,v,s={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
1015
1015
|
`,r:"\r",t:" "},c,d=function(f){throw{name:"SyntaxError",message:f,at:l,text:c}},o=function(f){return f&&f!==v&&d("Expected '"+f+"' instead of '"+v+"'"),v=c.charAt(l),l+=1,v},p=function(){var f,m="";for(v==="-"&&(m="-",o("-"));v>="0"&&v<="9";)m+=v,o();if(v===".")for(m+=".";o()&&v>="0"&&v<="9";)m+=v;if(v==="e"||v==="E")for(m+=v,o(),(v==="-"||v==="+")&&(m+=v,o());v>="0"&&v<="9";)m+=v,o();if(f=+m,!isNaN(f))return f;d("Bad number")},e=function(){var f,m,y="",x;if(v==='"')for(;o();){if(v==='"')return o(),y;if(v==="\\")if(o(),v==="u"){for(x=0,m=0;m<4&&(f=parseInt(o(),16),!!isFinite(f));m+=1)x=x*16+f;y+=String.fromCharCode(x)}else{if(typeof s[v]!="string")break;y+=s[v]}else{if(v==`
|
|
1016
|
-
`||v=="\r")break;y+=v}}d("Bad string")},t=function(){for(;v&&v<=" ";)o()},r=function(){switch(v){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null}d("Unexpected '"+v+"'")},h,a=function(){var f=[];if(v==="["){if(o("["),t(),v==="]")return o("]"),f;for(;v;){if(f.push(h()),t(),v==="]")return o("]"),f;o(","),t()}}d("Bad array")},u=function(){var f,m={};if(v==="{"){if(o("{"),t(),v==="}")return o("}"),m;for(;v;){if(f=e(),t(),o(":"),Object.hasOwnProperty.call(m,f)&&d('Duplicate key "'+f+'"'),m[f]=h(),t(),v==="}")return o("}"),m;o(","),t()}}d("Bad object")};return h=function(){switch(t(),v){case"{":return u();case"[":return a();case'"':return e();case"-":return p();default:return v>="0"&&v<="9"?p():r()}},function(f,m){var y;return c=f,l=0,v=" ",y=h(),t(),v&&d("Syntax error"),typeof m=="function"?function x(E,
|
|
1016
|
+
`||v=="\r")break;y+=v}}d("Bad string")},t=function(){for(;v&&v<=" ";)o()},r=function(){switch(v){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null}d("Unexpected '"+v+"'")},h,a=function(){var f=[];if(v==="["){if(o("["),t(),v==="]")return o("]"),f;for(;v;){if(f.push(h()),t(),v==="]")return o("]"),f;o(","),t()}}d("Bad array")},u=function(){var f,m={};if(v==="{"){if(o("{"),t(),v==="}")return o("}"),m;for(;v;){if(f=e(),t(),o(":"),Object.hasOwnProperty.call(m,f)&&d('Duplicate key "'+f+'"'),m[f]=h(),t(),v==="}")return o("}"),m;o(","),t()}}d("Bad object")};return h=function(){switch(t(),v){case"{":return u();case"[":return a();case'"':return e();case"-":return p();default:return v>="0"&&v<="9"?p():r()}},function(f,m){var y;return c=f,l=0,v=" ",y=h(),t(),v&&d("Syntax error"),typeof m=="function"?function x(E,w){var g,S,k=E[w];if(k&&typeof k=="object")for(g in k)Object.hasOwnProperty.call(k,g)&&(S=x(k,g),S!==void 0?k[g]=S:delete k[g]);return m.call(E,w,k)}({"":y},""):y}}),ace.define("ace/mode/json_worker",[],function(L,n,i){var l=L("../lib/oop"),v=L("../worker/mirror").Mirror,s=L("./json/json_parse"),c=n.JsonWorker=function(d){v.call(this,d),this.setTimeout(200)};l.inherits(c,v),function(){this.onUpdate=function(){var d=this.doc.getValue(),o=[];try{d&&s(d)}catch(e){var p=this.doc.indexToPosition(e.at-1);o.push({row:p.row,column:p.column,text:e.message,type:"error"})}this.sender.emit("annotate",o)}}.call(c.prototype)});var Ia={exports:{}};(function(L,n){ace.define("ace/theme/clouds_midnight-css",["require","exports","module"],function(i,l,v){v.exports=`.ace-clouds-midnight .ace_gutter {
|
|
1017
1017
|
background: #232323;
|
|
1018
1018
|
color: #929292
|
|
1019
1019
|
}
|
|
@@ -1129,7 +1129,7 @@ import{C as qe,R as M}from"./ConfigCustomJavascriptSet__loadShare__react__loadSh
|
|
|
1129
1129
|
.ace-clouds-midnight .ace_indent-guide-active {
|
|
1130
1130
|
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQIW2PQ1dX9zzBz5sz/ABCcBFFentLlAAAAAElFTkSuQmCC) right repeat-y;
|
|
1131
1131
|
}
|
|
1132
|
-
`}),ace.define("ace/theme/clouds_midnight",["require","exports","module","ace/theme/clouds_midnight-css","ace/lib/dom"],function(i,l,v){l.isDark=!0,l.cssClass="ace-clouds-midnight",l.cssText=i("./clouds_midnight-css");var s=i("../lib/dom");s.importCssString(l.cssText,l.cssClass,!1)}),function(){ace.require(["ace/theme/clouds_midnight"],function(i){L&&(L.exports=i)})}()})(
|
|
1132
|
+
`}),ace.define("ace/theme/clouds_midnight",["require","exports","module","ace/theme/clouds_midnight-css","ace/lib/dom"],function(i,l,v){l.isDark=!0,l.cssClass="ace-clouds-midnight",l.cssText=i("./clouds_midnight-css");var s=i("../lib/dom");s.importCssString(l.cssText,l.cssClass,!1)}),function(){ace.require(["ace/theme/clouds_midnight"],function(i){L&&(L.exports=i)})}()})(Ia);var Fa={exports:{}};(function(L,n){ace.define("ace/theme/chrome-css",["require","exports","module"],function(i,l,v){v.exports=`.ace-chrome .ace_gutter {
|
|
1133
1133
|
background: #ebebeb;
|
|
1134
1134
|
color: #333;
|
|
1135
1135
|
overflow : hidden;
|
|
@@ -1287,21 +1287,21 @@ import{C as qe,R as M}from"./ConfigCustomJavascriptSet__loadShare__react__loadSh
|
|
|
1287
1287
|
.ace-chrome .ace_indent-guide-active {
|
|
1288
1288
|
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;
|
|
1289
1289
|
}
|
|
1290
|
-
`}),ace.define("ace/theme/chrome",["require","exports","module","ace/theme/chrome-css","ace/lib/dom"],function(i,l,v){l.isDark=!1,l.cssClass="ace-chrome",l.cssText=i("./chrome-css");var s=i("../lib/dom");s.importCssString(l.cssText,l.cssClass,!1)}),function(){ace.require(["ace/theme/chrome"],function(i){L&&(L.exports=i)})}()})(
|
|
1291
|
-
`+k+"$1"):D},CURRENT_LINE:function(g){return g.session.getLine(g.getCursorPosition().row)},PREV_LINE:function(g){return g.session.getLine(g.getCursorPosition().row-1)},LINE_INDEX:function(g){return g.getCursorPosition().row},LINE_NUMBER:function(g){return g.getCursorPosition().row+1},SOFT_TABS:function(g){return g.session.getUseSoftTabs()?"YES":"NO"},TAB_SIZE:function(g){return g.session.getTabSize()},CLIPBOARD:function(g){return a.getText&&a.getText()},FILENAME:function(g){return/[^/\\]*$/.exec(this.FILEPATH(g))[0]},FILENAME_BASE:function(g){return/[^/\\]*$/.exec(this.FILEPATH(g))[0].replace(/\.[^.]*$/,"")},DIRECTORY:function(g){return this.FILEPATH(g).replace(/[^/\\]*$/,"")},FILEPATH:function(g){return"/not implemented.txt"},WORKSPACE_NAME:function(){return"Unknown"},FULLNAME:function(){return"Unknown"},BLOCK_COMMENT_START:function(g){var S=g.session.$mode||{};return S.blockComment&&S.blockComment.start||""},BLOCK_COMMENT_END:function(g){var S=g.session.$mode||{};return S.blockComment&&S.blockComment.end||""},LINE_COMMENT:function(g){var S=g.session.$mode||{};return S.lineCommentStart||""},CURRENT_YEAR:s.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:s.bind(null,{year:"2-digit"}),CURRENT_MONTH:s.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:s.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:s.bind(null,{month:"short"}),CURRENT_DATE:s.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:s.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:s.bind(null,{weekday:"short"}),CURRENT_HOUR:s.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:s.bind(null,{minute:"2-digit"}),CURRENT_SECOND:s.bind(null,{second:"2-digit"})};u.SELECTED_TEXT=u.SELECTION;var f=function(){function g(){this.snippetMap={},this.snippetNameMap={},this.variables=u}return g.prototype.getTokenizer=function(){return g.$tokenizer||this.createTokenizer()},g.prototype.createTokenizer=function(){function S(_){return _=_.substr(1),/^\d+$/.test(_)?[{tabstopId:parseInt(_,10)}]:[{text:_}]}function k(_){return"(?:[^\\\\"+_+"]|\\\\.)"}var D={regex:"/("+k("/")+"+)/",onMatch:function(_,F,A){var $=A[0];return $.fmtString=!0,$.guard=_.slice(1,-1),$.flag="",""},next:"formatString"};return g.$tokenizer=new h({start:[{regex:/\\./,onMatch:function(_,F,A){var $=_[1];return($=="}"&&A.length||"`$\\".indexOf($)!=-1)&&(_=$),[_]}},{regex:/}/,onMatch:function(_,F,A){return[A.length?A.shift():_]}},{regex:/\$(?:\d+|\w+)/,onMatch:S},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(_,F,A){var $=S(_.substr(1));return A.unshift($[0]),$},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+k("\\|")+"*\\|",onMatch:function(_,F,A){var $=_.slice(1,-1).replace(/\\[,|\\]|,/g,function(
|
|
1292
|
-
`:$=="t"?_=" ":"ulULE".indexOf($)!=-1&&(_={changeCase:$,local:$>"a"}),[_]}},{regex:"/\\w*}",onMatch:function(_,F,A){var $=A.shift();return $&&($.flag=_.slice(1,-1)),this.next=$&&$.tabstopId?"start":"",[$||_]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(_,F,A){return[{text:_.slice(1)}]}},{regex:/\${\w+/,onMatch:function(_,F,A){var $={text:_.slice(2)};return A.unshift($),[$]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(_,F,A){var $=A.shift();return this.next=$&&$.tabstopId?"start":"",[$||_]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(_,F,A){var $=A[0];return $.formatFunction=_.slice(2,-1),[A.shift()]},next:"formatString"},D,{regex:/:[\?\-+]?/,onMatch:function(_,F,A){_[1]=="+"&&(A[0].ifEnd=A[0]),_[1]=="?"&&(A[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]}),g.$tokenizer},g.prototype.tokenizeTmSnippet=function(S,k){return this.getTokenizer().getLineTokens(S,k).tokens.map(function(D){return D.value||D})},g.prototype.getVariableValue=function(S,k,D){if(/^\d+$/.test(k))return(this.variables.__||{})[k]||"";if(/^[A-Z]\d+$/.test(k))return(this.variables[k[0]+"__"]||{})[k.substr(1)]||"";if(k=k.replace(/^TM_/,""),!this.variables.hasOwnProperty(k))return"";var _=this.variables[k];return typeof _=="function"&&(_=this.variables[k](S,k,D)),_??""},g.prototype.tmStrFormat=function(S,k,D){if(!k.fmt)return S;var _=k.flag||"",F=k.guard;F=new RegExp(F,_.replace(/[^gim]/g,""));var A=typeof k.fmt=="string"?this.tokenizeTmSnippet(k.fmt,"formatString"):k.fmt,$=this,
|
|
1293
|
-
`?(A=!0,F=""):A&&(F=/^\t*/.exec(
|
|
1294
|
-
`):
|
|
1295
|
-
`&&!k.excludeExtraIndent?G+$:typeof G=="string"?G.replace(/\t/g,A):G});var
|
|
1296
|
-
`);Y.length>1?(z=Y[Y.length-1].length,W+=Y.length-1):z+=G.length,U+=G}else G&&(G.start?G.end={row:W,column:z}:G.start={row:W,column:z})}),{text:U,tabstops:
|
|
1290
|
+
`}),ace.define("ace/theme/chrome",["require","exports","module","ace/theme/chrome-css","ace/lib/dom"],function(i,l,v){l.isDark=!1,l.cssClass="ace-chrome",l.cssText=i("./chrome-css");var s=i("../lib/dom");s.importCssString(l.cssText,l.cssClass,!1)}),function(){ace.require(["ace/theme/chrome"],function(i){L&&(L.exports=i)})}()})(Fa);var Oa={exports:{}};(function(L,n){ace.define("ace/snippets",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter","ace/lib/lang","ace/range","ace/range_list","ace/keyboard/hash_handler","ace/tokenizer","ace/clipboard","ace/editor"],function(i,l,v){function s(g){var S=new Date().toLocaleString("en-us",g);return S.length==1?"0"+S:S}var c=i("./lib/dom"),d=i("./lib/oop"),o=i("./lib/event_emitter").EventEmitter,p=i("./lib/lang"),e=i("./range").Range,t=i("./range_list").RangeList,r=i("./keyboard/hash_handler").HashHandler,h=i("./tokenizer").Tokenizer,a=i("./clipboard"),u={CURRENT_WORD:function(g){return g.session.getTextRange(g.session.getWordRange())},SELECTION:function(g,S,k){var D=g.session.getTextRange();return k?D.replace(/\n\r?([ \t]*\S)/g,`
|
|
1291
|
+
`+k+"$1"):D},CURRENT_LINE:function(g){return g.session.getLine(g.getCursorPosition().row)},PREV_LINE:function(g){return g.session.getLine(g.getCursorPosition().row-1)},LINE_INDEX:function(g){return g.getCursorPosition().row},LINE_NUMBER:function(g){return g.getCursorPosition().row+1},SOFT_TABS:function(g){return g.session.getUseSoftTabs()?"YES":"NO"},TAB_SIZE:function(g){return g.session.getTabSize()},CLIPBOARD:function(g){return a.getText&&a.getText()},FILENAME:function(g){return/[^/\\]*$/.exec(this.FILEPATH(g))[0]},FILENAME_BASE:function(g){return/[^/\\]*$/.exec(this.FILEPATH(g))[0].replace(/\.[^.]*$/,"")},DIRECTORY:function(g){return this.FILEPATH(g).replace(/[^/\\]*$/,"")},FILEPATH:function(g){return"/not implemented.txt"},WORKSPACE_NAME:function(){return"Unknown"},FULLNAME:function(){return"Unknown"},BLOCK_COMMENT_START:function(g){var S=g.session.$mode||{};return S.blockComment&&S.blockComment.start||""},BLOCK_COMMENT_END:function(g){var S=g.session.$mode||{};return S.blockComment&&S.blockComment.end||""},LINE_COMMENT:function(g){var S=g.session.$mode||{};return S.lineCommentStart||""},CURRENT_YEAR:s.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:s.bind(null,{year:"2-digit"}),CURRENT_MONTH:s.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:s.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:s.bind(null,{month:"short"}),CURRENT_DATE:s.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:s.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:s.bind(null,{weekday:"short"}),CURRENT_HOUR:s.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:s.bind(null,{minute:"2-digit"}),CURRENT_SECOND:s.bind(null,{second:"2-digit"})};u.SELECTED_TEXT=u.SELECTION;var f=function(){function g(){this.snippetMap={},this.snippetNameMap={},this.variables=u}return g.prototype.getTokenizer=function(){return g.$tokenizer||this.createTokenizer()},g.prototype.createTokenizer=function(){function S(_){return _=_.substr(1),/^\d+$/.test(_)?[{tabstopId:parseInt(_,10)}]:[{text:_}]}function k(_){return"(?:[^\\\\"+_+"]|\\\\.)"}var D={regex:"/("+k("/")+"+)/",onMatch:function(_,F,A){var $=A[0];return $.fmtString=!0,$.guard=_.slice(1,-1),$.flag="",""},next:"formatString"};return g.$tokenizer=new h({start:[{regex:/\\./,onMatch:function(_,F,A){var $=_[1];return($=="}"&&A.length||"`$\\".indexOf($)!=-1)&&(_=$),[_]}},{regex:/}/,onMatch:function(_,F,A){return[A.length?A.shift():_]}},{regex:/\$(?:\d+|\w+)/,onMatch:S},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(_,F,A){var $=S(_.substr(1));return A.unshift($[0]),$},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+k("\\|")+"*\\|",onMatch:function(_,F,A){var $=_.slice(1,-1).replace(/\\[,|\\]|,/g,function(C){return C.length==2?C[1]:"\0"}).split("\0").map(function(C){return{value:C}});return A[0].choices=$,[$[0]]},next:"start"},D,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(_,F,A){return A.length&&A[0].expectElse?(A[0].expectElse=!1,A[0].ifEnd={elseEnd:A[0]},[A[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(_,F,A){var $=_[1];return $=="}"&&A.length||"`$\\".indexOf($)!=-1?_=$:$=="n"?_=`
|
|
1292
|
+
`:$=="t"?_=" ":"ulULE".indexOf($)!=-1&&(_={changeCase:$,local:$>"a"}),[_]}},{regex:"/\\w*}",onMatch:function(_,F,A){var $=A.shift();return $&&($.flag=_.slice(1,-1)),this.next=$&&$.tabstopId?"start":"",[$||_]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(_,F,A){return[{text:_.slice(1)}]}},{regex:/\${\w+/,onMatch:function(_,F,A){var $={text:_.slice(2)};return A.unshift($),[$]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(_,F,A){var $=A.shift();return this.next=$&&$.tabstopId?"start":"",[$||_]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(_,F,A){var $=A[0];return $.formatFunction=_.slice(2,-1),[A.shift()]},next:"formatString"},D,{regex:/:[\?\-+]?/,onMatch:function(_,F,A){_[1]=="+"&&(A[0].ifEnd=A[0]),_[1]=="?"&&(A[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]}),g.$tokenizer},g.prototype.tokenizeTmSnippet=function(S,k){return this.getTokenizer().getLineTokens(S,k).tokens.map(function(D){return D.value||D})},g.prototype.getVariableValue=function(S,k,D){if(/^\d+$/.test(k))return(this.variables.__||{})[k]||"";if(/^[A-Z]\d+$/.test(k))return(this.variables[k[0]+"__"]||{})[k.substr(1)]||"";if(k=k.replace(/^TM_/,""),!this.variables.hasOwnProperty(k))return"";var _=this.variables[k];return typeof _=="function"&&(_=this.variables[k](S,k,D)),_??""},g.prototype.tmStrFormat=function(S,k,D){if(!k.fmt)return S;var _=k.flag||"",F=k.guard;F=new RegExp(F,_.replace(/[^gim]/g,""));var A=typeof k.fmt=="string"?this.tokenizeTmSnippet(k.fmt,"formatString"):k.fmt,$=this,C=S.replace(F,function(){var b=$.variables.__;$.variables.__=[].slice.call(arguments);for(var T=$.resolveVariables(A,D),I="E",O=0;O<T.length;O++){var N=T[O];if(typeof N=="object")if(T[O]="",N.changeCase&&N.local){var P=T[O+1];P&&typeof P=="string"&&(N.changeCase=="u"?T[O]=P[0].toUpperCase():T[O]=P[0].toLowerCase(),T[O+1]=P.substr(1))}else N.changeCase&&(I=N.changeCase);else I=="U"?T[O]=N.toUpperCase():I=="L"&&(T[O]=N.toLowerCase())}return $.variables.__=b,T.join("")});return C},g.prototype.tmFormatFunction=function(S,k,D){return k.formatFunction=="upcase"?S.toUpperCase():k.formatFunction=="downcase"?S.toLowerCase():S},g.prototype.resolveVariables=function(S,k){function D(I){var O=S.indexOf(I,$+1);O!=-1&&($=O)}for(var _=[],F="",A=!0,$=0;$<S.length;$++){var C=S[$];if(typeof C=="string"){_.push(C),C==`
|
|
1293
|
+
`?(A=!0,F=""):A&&(F=/^\t*/.exec(C)[0],A=/\S/.test(C));continue}if(C){if(A=!1,C.fmtString){var b=S.indexOf(C,$+1);b==-1&&(b=S.length),C.fmt=S.slice($+1,b),$=b}if(C.text){var T=this.getVariableValue(k,C.text,F)+"";C.fmtString&&(T=this.tmStrFormat(T,C,k)),C.formatFunction&&(T=this.tmFormatFunction(T,C,k)),T&&!C.ifEnd?(_.push(T),D(C)):!T&&C.ifEnd&&D(C.ifEnd)}else C.elseEnd?D(C.elseEnd):(C.tabstopId!=null||C.changeCase!=null)&&_.push(C)}}return _},g.prototype.getDisplayTextForSnippet=function(S,k){var D=m.call(this,S,k);return D.text},g.prototype.insertSnippetForSelection=function(S,k,D){D===void 0&&(D={});var _=m.call(this,S,k,D),F=S.getSelectionRange(),A=S.session.replace(F,_.text),$=new y(S),C=S.inVirtualSelectionMode&&S.selection.index;$.addTabstops(_.tabstops,F.start,A,C)},g.prototype.insertSnippet=function(S,k,D){D===void 0&&(D={});var _=this;if(S.inVirtualSelectionMode)return _.insertSnippetForSelection(S,k,D);S.forEachSelection(function(){_.insertSnippetForSelection(S,k,D)},null,{keepOrder:!0}),S.tabstopManager&&S.tabstopManager.tabNext()},g.prototype.$getScope=function(S){var k=S.session.$mode.$id||"";if(k=k.split("/").pop(),k==="html"||k==="php"){k==="php"&&!S.session.$mode.inlinePhp&&(k="html");var D=S.getCursorPosition(),_=S.session.getState(D.row);typeof _=="object"&&(_=_[0]),_.substring&&(_.substring(0,3)=="js-"?k="javascript":_.substring(0,4)=="css-"?k="css":_.substring(0,4)=="php-"&&(k="php"))}return k},g.prototype.getActiveScopes=function(S){var k=this.$getScope(S),D=[k],_=this.snippetMap;return _[k]&&_[k].includeScopes&&D.push.apply(D,_[k].includeScopes),D.push("_"),D},g.prototype.expandWithTab=function(S,k){var D=this,_=S.forEachSelection(function(){return D.expandSnippetForSelection(S,k)},null,{keepOrder:!0});return _&&S.tabstopManager&&S.tabstopManager.tabNext(),_},g.prototype.expandSnippetForSelection=function(S,k){var D=S.getCursorPosition(),_=S.session.getLine(D.row),F=_.substring(0,D.column),A=_.substr(D.column),$=this.snippetMap,C;return this.getActiveScopes(S).some(function(b){var T=$[b];return T&&(C=this.findMatchingSnippet(T,F,A)),!!C},this),C?(k&&k.dryRun||(S.session.doc.removeInLine(D.row,D.column-C.replaceBefore.length,D.column+C.replaceAfter.length),this.variables.M__=C.matchBefore,this.variables.T__=C.matchAfter,this.insertSnippetForSelection(S,C.content),this.variables.M__=this.variables.T__=null),!0):!1},g.prototype.findMatchingSnippet=function(S,k,D){for(var _=S.length;_--;){var F=S[_];if(!(F.startRe&&!F.startRe.test(k))&&!(F.endRe&&!F.endRe.test(D))&&!(!F.startRe&&!F.endRe))return F.matchBefore=F.startRe?F.startRe.exec(k):[""],F.matchAfter=F.endRe?F.endRe.exec(D):[""],F.replaceBefore=F.triggerRe?F.triggerRe.exec(k)[0]:"",F.replaceAfter=F.endTriggerRe?F.endTriggerRe.exec(D)[0]:"",F}},g.prototype.register=function(S,k){function D(b){return b&&!/^\^?\(.*\)\$?$|^\\b$/.test(b)&&(b="(?:"+b+")"),b||""}function _(b,T,I){return b=D(b),T=D(T),b=T+b,b&&b[b.length-1]!="$"&&(b+="$"),new RegExp(b)}function F(b){b.scope||(b.scope=k||"_"),k=b.scope,A[k]||(A[k]=[],$[k]={});var T=$[k];if(b.name){var I=T[b.name];I&&C.unregister(I),T[b.name]=b}A[k].push(b),b.prefix&&(b.tabTrigger=b.prefix),!b.content&&b.body&&(b.content=Array.isArray(b.body)?b.body.join(`
|
|
1294
|
+
`):b.body),b.tabTrigger&&!b.trigger&&(!b.guard&&/^\w/.test(b.tabTrigger)&&(b.guard="\\b"),b.trigger=p.escapeRegExp(b.tabTrigger)),!(!b.trigger&&!b.guard&&!b.endTrigger&&!b.endGuard)&&(b.startRe=_(b.trigger,b.guard),b.triggerRe=new RegExp(b.trigger),b.endRe=_(b.endTrigger,b.endGuard),b.endTriggerRe=new RegExp(b.endTrigger))}var A=this.snippetMap,$=this.snippetNameMap,C=this;S||(S=[]),Array.isArray(S)?S.forEach(F):Object.keys(S).forEach(function(b){F(S[b])}),this._signal("registerSnippets",{scope:k})},g.prototype.unregister=function(S,k){function D(A){var $=F[A.scope||k];if($&&$[A.name]){delete $[A.name];var C=_[A.scope||k],b=C&&C.indexOf(A);b>=0&&C.splice(b,1)}}var _=this.snippetMap,F=this.snippetNameMap;S.content?D(S):Array.isArray(S)&&S.forEach(D)},g.prototype.parseSnippetFile=function(S){S=S.replace(/\r/g,"");for(var k=[],D={},_=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm,F;F=_.exec(S);){if(F[1])try{D=JSON.parse(F[1]),k.push(D)}catch{}if(F[4])D.content=F[4].replace(/^\t/gm,""),k.push(D),D={};else{var A=F[2],$=F[3];if(A=="regex"){var C=/\/((?:[^\/\\]|\\.)*)|$/g;D.guard=C.exec($)[1],D.trigger=C.exec($)[1],D.endTrigger=C.exec($)[1],D.endGuard=C.exec($)[1]}else A=="snippet"?(D.tabTrigger=$.match(/^\S*/)[0],D.name||(D.name=$)):A&&(D[A]=$)}}return k},g.prototype.getSnippetByName=function(S,k){var D=this.snippetNameMap,_;return this.getActiveScopes(k).some(function(F){var A=D[F];return A&&(_=A[S]),!!_},this),_},g}();d.implement(f.prototype,o);var m=function(g,S,k){function D(G){for(var Y=[],Q=0;Q<G.length;Q++){var q=G[Q];if(typeof q=="object"){if(T[q.tabstopId])continue;var te=G.lastIndexOf(q,Q-1);q=Y[te]||{tabstopId:q.tabstopId}}Y[Q]=q}return Y}k===void 0&&(k={});var _=g.getCursorPosition(),F=g.session.getLine(_.row),A=g.session.getTabString(),$=F.match(/^\s*/)[0];_.column<$.length&&($=$.slice(0,_.column)),S=S.replace(/\r/g,"");var C=this.tokenizeTmSnippet(S);C=this.resolveVariables(C,g),C=C.map(function(G){return G==`
|
|
1295
|
+
`&&!k.excludeExtraIndent?G+$:typeof G=="string"?G.replace(/\t/g,A):G});var b=[];C.forEach(function(G,Y){if(typeof G=="object"){var Q=G.tabstopId,q=b[Q];if(q||(q=b[Q]=[],q.index=Q,q.value="",q.parents={}),q.indexOf(G)===-1){G.choices&&!q.choices&&(q.choices=G.choices),q.push(G);var te=C.indexOf(G,Y+1);if(te!==-1){var re=C.slice(Y+1,te),ue=re.some(function(me){return typeof me=="object"});ue&&!q.value?q.value=re:re.length&&(!q.value||typeof q.value!="string")&&(q.value=re.join(""))}}}}),b.forEach(function(G){G.length=0});for(var T={},I=0;I<C.length;I++){var O=C[I];if(typeof O=="object"){var N=O.tabstopId,P=b[N],B=C.indexOf(O,I+1);if(T[N]){T[N]===O&&(delete T[N],Object.keys(T).forEach(function(G){P.parents[G]=!0}));continue}T[N]=O;var V=P.value;typeof V!="string"?V=D(V):O.fmt&&(V=this.tmStrFormat(V,O,g)),C.splice.apply(C,[I+1,Math.max(0,B-I)].concat(V,O)),P.indexOf(O)===-1&&P.push(O)}}var W=0,z=0,U="";return C.forEach(function(G){if(typeof G=="string"){var Y=G.split(`
|
|
1296
|
+
`);Y.length>1?(z=Y[Y.length-1].length,W+=Y.length-1):z+=G.length,U+=G}else G&&(G.start?G.end={row:W,column:z}:G.start={row:W,column:z})}),{text:U,tabstops:b,tokens:C}},y=function(){function g(S){if(this.index=0,this.ranges=[],this.tabstops=[],S.tabstopManager)return S.tabstopManager;S.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=p.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(S)}return g.prototype.attach=function(S){this.$openTabstops=null,this.selectedTabstop=null,this.editor=S,this.session=S.session,this.editor.on("change",this.$onChange),this.editor.on("changeSelection",this.$onChangeSelection),this.editor.on("changeSession",this.$onChangeSession),this.editor.commands.on("afterExec",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},g.prototype.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges.length=0,this.tabstops.length=0,this.selectedTabstop=null,this.editor.off("change",this.$onChange),this.editor.off("changeSelection",this.$onChangeSelection),this.editor.off("changeSession",this.$onChangeSession),this.editor.commands.off("afterExec",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.session=null,this.editor=null},g.prototype.onChange=function(S){for(var k=S.action[0]=="r",D=this.selectedTabstop||{},_=D.parents||{},F=this.tabstops.slice(),A=0;A<F.length;A++){var $=F[A],C=$==D||_[$.index];if($.rangeList.$bias=C?0:1,S.action=="remove"&&$!==D){var b=$.parents&&$.parents[D.index],T=$.rangeList.pointIndex(S.start,b);T=T<0?-T-1:T+1;var I=$.rangeList.pointIndex(S.end,b);I=I<0?-I-1:I-1;for(var O=$.rangeList.ranges.slice(T,I),N=0;N<O.length;N++)this.removeRange(O[N])}$.rangeList.$onChange(S)}var P=this.session;!this.$inChange&&k&&P.getLength()==1&&!P.getValue()&&this.detach()},g.prototype.updateLinkedFields=function(){var S=this.selectedTabstop;if(!(!S||!S.hasLinkedRanges||!S.firstNonLinked)){this.$inChange=!0;for(var k=this.session,D=k.getTextRange(S.firstNonLinked),_=0;_<S.length;_++){var F=S[_];if(F.linked){var A=F.original,$=l.snippetManager.tmStrFormat(D,A,this.editor);k.replace(F,$)}}this.$inChange=!1}},g.prototype.onAfterExec=function(S){S.command&&!S.command.readOnly&&this.updateLinkedFields()},g.prototype.onChangeSelection=function(){if(this.editor){for(var S=this.editor.selection.lead,k=this.editor.selection.anchor,D=this.editor.selection.isEmpty(),_=0;_<this.ranges.length;_++)if(!this.ranges[_].linked){var F=this.ranges[_].contains(S.row,S.column),A=D||this.ranges[_].contains(k.row,k.column);if(F&&A)return}this.detach()}},g.prototype.onChangeSession=function(){this.detach()},g.prototype.tabNext=function(S){var k=this.tabstops.length,D=this.index+(S||1);D=Math.min(Math.max(D,1),k),D==k&&(D=0),this.selectTabstop(D),this.updateTabstopMarkers(),D===0&&this.detach()},g.prototype.selectTabstop=function(S){this.$openTabstops=null;var k=this.tabstops[this.index];if(k&&this.addTabstopMarkers(k),this.index=S,k=this.tabstops[this.index],!(!k||!k.length)){this.selectedTabstop=k;var D=k.firstNonLinked||k;if(k.choices&&(D.cursor=D.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(D);else{var _=this.editor.multiSelect;_.toSingleRange(D);for(var F=0;F<k.length;F++)k.hasLinkedRanges&&k[F].linked||_.addRange(k[F].clone(),!0)}this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler),this.selectedTabstop&&this.selectedTabstop.choices&&this.editor.execCommand("startAutocomplete",{matches:this.selectedTabstop.choices})}},g.prototype.addTabstops=function(S,k,D){var _=this.useLink||!this.editor.getOption("enableMultiselect");if(this.$openTabstops||(this.$openTabstops=[]),!S[0]){var F=e.fromPoints(D,D);E(F.start,k),E(F.end,k),S[0]=[F],S[0].index=0}var A=this.index,$=[A+1,0],C=this.ranges,b=this.snippetId=(this.snippetId||0)+1;S.forEach(function(T,I){var O=this.$openTabstops[I]||T;O.snippetId=b;for(var N=0;N<T.length;N++){var P=T[N],B=e.fromPoints(P.start,P.end||P.start);x(B.start,k),x(B.end,k),B.original=P,B.tabstop=O,C.push(B),O!=T?O.unshift(B):O[N]=B,P.fmtString||O.firstNonLinked&&_?(B.linked=!0,O.hasLinkedRanges=!0):O.firstNonLinked||(O.firstNonLinked=B)}O.firstNonLinked||(O.hasLinkedRanges=!1),O===T&&($.push(O),this.$openTabstops[I]=O),this.addTabstopMarkers(O),O.rangeList=O.rangeList||new t,O.rangeList.$bias=0,O.rangeList.addList(O)},this),$.length>2&&(this.tabstops.length&&$.push($.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,$))},g.prototype.addTabstopMarkers=function(S){var k=this.session;S.forEach(function(D){D.markerId||(D.markerId=k.addMarker(D,"ace_snippet-marker","text"))})},g.prototype.removeTabstopMarkers=function(S){var k=this.session;S.forEach(function(D){k.removeMarker(D.markerId),D.markerId=null})},g.prototype.updateTabstopMarkers=function(){if(this.selectedTabstop){var S=this.selectedTabstop.snippetId;this.selectedTabstop.index===0&&S--,this.tabstops.forEach(function(k){k.snippetId===S?this.addTabstopMarkers(k):this.removeTabstopMarkers(k)},this)}},g.prototype.removeRange=function(S){var k=S.tabstop.indexOf(S);k!=-1&&S.tabstop.splice(k,1),k=this.ranges.indexOf(S),k!=-1&&this.ranges.splice(k,1),k=S.tabstop.rangeList.ranges.indexOf(S),k!=-1&&S.tabstop.splice(k,1),this.session.removeMarker(S.markerId),S.tabstop.length||(k=this.tabstops.indexOf(S.tabstop),k!=-1&&this.tabstops.splice(k,1),this.tabstops.length||this.detach())},g}();y.prototype.keyboardHandler=new r,y.prototype.keyboardHandler.bindKeys({Tab:function(g){l.snippetManager&&l.snippetManager.expandWithTab(g)||(g.tabstopManager.tabNext(1),g.renderer.scrollCursorIntoView())},"Shift-Tab":function(g){g.tabstopManager.tabNext(-1),g.renderer.scrollCursorIntoView()},Esc:function(g){g.tabstopManager.detach()}});var x=function(g,S){g.row==0&&(g.column+=S.column),g.row+=S.row},E=function(g,S){g.row==S.row&&(g.column-=S.column),g.row-=S.row};c.importCssString(`
|
|
1297
1297
|
.ace_snippet-marker {
|
|
1298
1298
|
-moz-box-sizing: border-box;
|
|
1299
1299
|
box-sizing: border-box;
|
|
1300
1300
|
background: rgba(194, 193, 208, 0.09);
|
|
1301
1301
|
border: 1px dotted rgba(211, 208, 235, 0.62);
|
|
1302
1302
|
position: absolute;
|
|
1303
|
-
}`,"snippets.css",!1),l.snippetManager=new f;var
|
|
1304
|
-
`,
|
|
1303
|
+
}`,"snippets.css",!1),l.snippetManager=new f;var w=i("./editor").Editor;(function(){this.insertSnippet=function(g,S){return l.snippetManager.insertSnippet(this,g,S)},this.expandSnippet=function(g){return l.snippetManager.expandWithTab(this,g)}}).call(w.prototype)}),ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/config","ace/lib/useragent"],function(i,l,v){var s=i("../virtual_renderer").VirtualRenderer,c=i("../editor").Editor,d=i("../range").Range,o=i("../lib/event"),p=i("../lib/lang"),e=i("../lib/dom"),t=i("../config").nls,r=i("./../lib/useragent"),h=function(x){return"suggest-aria-id:".concat(x)},a=r.isSafari?"menu":"listbox",u=r.isSafari?"menuitem":"option",f=r.isSafari?"aria-current":"aria-selected",m=function(x){var E=new s(x);E.$maxLines=4;var w=new c(E);return w.setHighlightActiveLine(!1),w.setShowPrintMargin(!1),w.renderer.setShowGutter(!1),w.renderer.setHighlightGutterLine(!1),w.$mouseHandler.$focusTimeout=0,w.$highlightTagPending=!0,w},y=function(){function x(E){var w=e.createElement("div"),g=m(w);E&&E.appendChild(w),w.style.display="none",g.renderer.content.style.cursor="default",g.renderer.setStyle("ace_autocomplete"),g.renderer.$textLayer.element.setAttribute("role",a),g.renderer.$textLayer.element.setAttribute("aria-roledescription",t("autocomplete.popup.aria-roledescription","Autocomplete suggestions")),g.renderer.$textLayer.element.setAttribute("aria-label",t("autocomplete.popup.aria-label","Autocomplete suggestions")),g.renderer.textarea.setAttribute("aria-hidden","true"),g.setOption("displayIndentGuides",!1),g.setOption("dragDelay",150);var S=function(){};g.focus=S,g.$isFocused=!0,g.renderer.$cursorLayer.restartTimer=S,g.renderer.$cursorLayer.element.style.opacity="0",g.renderer.$maxLines=8,g.renderer.$keepTextAreaAtCursor=!1,g.setHighlightActiveLine(!1),g.session.highlight(""),g.session.$searchHighlight.clazz="ace_highlight-marker",g.on("mousedown",function(C){var b=C.getDocumentPosition();g.selection.moveToPosition(b),_.start.row=_.end.row=b.row,C.stop()});var k,D=new d(-1,0,-1,1/0),_=new d(-1,0,-1,1/0);_.id=g.session.addMarker(_,"ace_active-line","fullLine"),g.setSelectOnHover=function(C){C?D.id&&(g.session.removeMarker(D.id),D.id=null):D.id=g.session.addMarker(D,"ace_line-hover","fullLine")},g.setSelectOnHover(!1),g.on("mousemove",function(C){if(!k){k=C;return}if(!(k.x==C.x&&k.y==C.y)){k=C,k.scrollTop=g.renderer.scrollTop,g.isMouseOver=!0;var b=k.getDocumentPosition().row;D.start.row!=b&&(D.id||g.setRow(b),A(b))}}),g.renderer.on("beforeRender",function(){if(k&&D.start.row!=-1){k.$pos=null;var C=k.getDocumentPosition().row;D.id||g.setRow(C),A(C,!0)}}),g.renderer.on("afterRender",function(){for(var C=g.renderer.$textLayer,b=C.config.firstRow,T=C.config.lastRow;b<=T;b++){var I=C.element.childNodes[b-C.config.firstRow];I.setAttribute("role",u),I.setAttribute("aria-roledescription",t("autocomplete.popup.item.aria-roledescription","item")),I.setAttribute("aria-setsize",g.data.length),I.setAttribute("aria-describedby","doc-tooltip"),I.setAttribute("aria-posinset",b+1);var O=g.getData(b);if(O){var N="".concat(O.caption||O.value).concat(O.meta?", ".concat(O.meta):"");I.setAttribute("aria-label",N)}var P=I.querySelectorAll(".ace_completion-highlight");P.forEach(function(B){B.setAttribute("role","mark")})}}),g.renderer.on("afterRender",function(){var C=g.getRow(),b=g.renderer.$textLayer,T=b.element.childNodes[C-b.config.firstRow],I=document.activeElement;if(T!==g.selectedNode&&g.selectedNode&&(e.removeCssClass(g.selectedNode,"ace_selected"),g.selectedNode.removeAttribute(f),g.selectedNode.removeAttribute("id")),I.removeAttribute("aria-activedescendant"),g.selectedNode=T,T){var O=h(C);e.addCssClass(T,"ace_selected"),T.id=O,b.element.setAttribute("aria-activedescendant",O),I.setAttribute("aria-activedescendant",O),T.setAttribute(f,"true")}});var F=function(){A(-1)},A=function(C,b){C!==D.start.row&&(D.start.row=D.end.row=C,b||g.session._emit("changeBackMarker"),g._emit("changeHoverMarker"))};g.getHoveredRow=function(){return D.start.row},o.addListener(g.container,"mouseout",function(){g.isMouseOver=!1,F()}),g.on("hide",F),g.on("changeSelection",F),g.session.doc.getLength=function(){return g.data.length},g.session.doc.getLine=function(C){var b=g.data[C];return typeof b=="string"?b:b&&b.value||""};var $=g.session.bgTokenizer;return $.$tokenizeRow=function(C){function b(G,Y){G&&I.push({type:(T.className||"")+(Y||""),value:G})}var T=g.data[C],I=[];if(!T)return I;typeof T=="string"&&(T={value:T});for(var O=T.caption||T.value||T.name,N=O.toLowerCase(),P=(g.filterText||"").toLowerCase(),B=0,V=0,W=0;W<=P.length;W++)if(W!=V&&(T.matchMask&1<<W||W==P.length)){var z=P.slice(V,W);V=W;var U=N.indexOf(z,B);if(U==-1)continue;b(O.slice(B,U),""),B=U+z.length,b(O.slice(U,B),"completion-highlight")}return b(O.slice(B,O.length),""),I.push({type:"completion-spacer",value:" "}),T.meta&&I.push({type:"completion-meta",value:T.meta}),T.message&&I.push({type:"completion-message",value:T.message}),I},$.$updateOnChange=S,$.start=S,g.session.$computeWidth=function(){return this.screenWidth=0},g.isOpen=!1,g.isTopdown=!1,g.autoSelect=!0,g.filterText="",g.isMouseOver=!1,g.data=[],g.setData=function(C,b){g.filterText=b||"",g.setValue(p.stringRepeat(`
|
|
1304
|
+
`,C.length),-1),g.data=C||[],g.setRow(0)},g.getData=function(C){return g.data[C]},g.getRow=function(){return _.start.row},g.setRow=function(C){C=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,C)),_.start.row!=C&&(g.selection.clearSelection(),_.start.row=_.end.row=C||0,g.session._emit("changeBackMarker"),g.moveCursorTo(C||0,0),g.isOpen&&g._signal("select"))},g.on("changeSelection",function(){g.isOpen&&g.setRow(g.selection.lead.row),g.renderer.scrollCursorIntoView()}),g.hide=function(){this.container.style.display="none",g.anchorPos=null,g.anchor=null,g.isOpen&&(g.isOpen=!1,this._signal("hide"))},g.tryShow=function(C,b,T,I){if(!I&&g.isOpen&&g.anchorPos&&g.anchor&&g.anchorPos.top===C.top&&g.anchorPos.left===C.left&&g.anchor===T)return!0;var O=this.container,N=this.renderer.scrollBar.width||10,P=window.innerHeight-N,B=window.innerWidth-N,V=this.renderer,W=V.$maxLines*b*1.4,z={top:0,bottom:0},U=P-C.top-3*this.$borderSize-b,G=C.top-3*this.$borderSize;T||(G<=U||U>=W?T="bottom":T="top"),T==="top"?(z.bottom=C.top-this.$borderSize,z.top=z.bottom-W):T==="bottom"&&(z.top=C.top+b+this.$borderSize,z.bottom=z.top+W);var Y=z.top>=0&&z.bottom<=P;if(!I&&!Y)return!1;Y?V.$maxPixelHeight=null:T==="top"?V.$maxPixelHeight=G:V.$maxPixelHeight=U,T==="top"?(O.style.top="",O.style.bottom=P+N-z.bottom+"px",g.isTopdown=!1):(O.style.top=z.top+"px",O.style.bottom="",g.isTopdown=!0),O.style.display="";var Q=C.left;return Q+O.offsetWidth>B&&(Q=B-O.offsetWidth),O.style.left=Q+"px",O.style.right="",g.isOpen||(g.isOpen=!0,this._signal("show"),k=null),g.anchorPos=C,g.anchor=T,!0},g.show=function(C,b,T){this.tryShow(C,b,T?"bottom":void 0,!0)},g.goTo=function(C){var b=this.getRow(),T=this.session.getLength()-1;switch(C){case"up":b=b<=0?T:b-1;break;case"down":b=b>=T?-1:b+1;break;case"start":b=0;break;case"end":b=T}this.setRow(b)},g.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},g.$imageSize=0,g.$borderSize=1,g}return x}();e.importCssString(`
|
|
1305
1305
|
.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
|
|
1306
1306
|
background-color: #CAD6FA;
|
|
1307
1307
|
z-index: 1;
|
|
@@ -1393,7 +1393,7 @@ import{C as qe,R as M}from"./ConfigCustomJavascriptSet__loadShare__react__loadSh
|
|
|
1393
1393
|
animation: none;
|
|
1394
1394
|
}
|
|
1395
1395
|
}
|
|
1396
|
-
`,"autocompletion.css",!1),l.AcePopup=y,l.$singleLineEditor=m,l.getAriaId=h}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(i,l,v){var s=function(){function c(d){this.editor=d,this.screenReaderDiv=document.createElement("div"),this.screenReaderDiv.classList.add("ace_screenreader-only"),this.editor.container.appendChild(this.screenReaderDiv)}return c.prototype.setScreenReaderContent=function(d){for(!this.popup&&this.editor.completer&&this.editor.completer.popup&&(this.popup=this.editor.completer.popup,this.popup.renderer.on("afterRender",function(){var p=this.popup.getRow(),e=this.popup.renderer.$textLayer,t=e.element.childNodes[p-e.config.firstRow];if(t){for(var r="doc-tooltip ",h=0;h<this._lines.length;h++)r+="ace-inline-screenreader-line-".concat(h," ");t.setAttribute("aria-describedby",r)}}.bind(this)));this.screenReaderDiv.firstChild;)this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);this._lines=d.split(/\r\n|\r|\n/);var o=this.createCodeBlock();this.screenReaderDiv.appendChild(o)},c.prototype.destroy=function(){this.screenReaderDiv.remove()},c.prototype.createCodeBlock=function(){var d=document.createElement("pre");d.setAttribute("id","ace-inline-screenreader");for(var o=0;o<this._lines.length;o++){var p=document.createElement("code");p.setAttribute("id","ace-inline-screenreader-line-".concat(o));var e=document.createTextNode(this._lines[o]);p.appendChild(e),d.appendChild(p)}return d},c}();l.AceInlineScreenReader=s}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(i,l,v){var s=i("../snippets").snippetManager,c=i("./inline_screenreader").AceInlineScreenReader,d=function(){function o(){this.editor=null}return o.prototype.show=function(p,e,t){if(t=t||"",p&&this.editor&&this.editor!==p&&(this.hide(),this.editor=null,this.inlineScreenReader=null),!p||!e)return!1;this.inlineScreenReader||(this.inlineScreenReader=new c(p));var r=e.snippet?s.getDisplayTextForSnippet(p,e.snippet):e.value;return e.hideInlinePreview||!r||!r.startsWith(t)?!1:(this.editor=p,this.inlineScreenReader.setScreenReaderContent(r),r=r.slice(t.length),r===""?p.removeGhostText():p.setGhostText(r),!0)},o.prototype.isOpen=function(){return this.editor?!!this.editor.renderer.$ghostText:!1},o.prototype.hide=function(){return this.editor?(this.editor.removeGhostText(),!0):!1},o.prototype.destroy=function(){this.hide(),this.editor=null,this.inlineScreenReader&&(this.inlineScreenReader.destroy(),this.inlineScreenReader=null)},o}();l.AceInline=d}),ace.define("ace/autocomplete/util",["require","exports","module"],function(i,l,v){l.parForEach=function(c,d,o){var p=0,e=c.length;e===0&&o();for(var t=0;t<e;t++)d(c[t],function(r,h){p++,p===e&&o(r,h)})};var s=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;l.retrievePrecedingIdentifier=function(c,d,o){o=o||s;for(var p=[],e=d-1;e>=0&&o.test(c[e]);e--)p.push(c[e]);return p.reverse().join("")},l.retrieveFollowingIdentifier=function(c,d,o){o=o||s;for(var p=[],e=d;e<c.length&&o.test(c[e]);e++)p.push(c[e]);return p},l.getCompletionPrefix=function(c){var d=c.getCursorPosition(),o=c.session.getLine(d.row),p;return c.completers.forEach(function(e){e.identifierRegexps&&e.identifierRegexps.forEach(function(t){!p&&t&&(p=this.retrievePrecedingIdentifier(o,d.column,t))}.bind(this))}.bind(this)),p||this.retrievePrecedingIdentifier(o,d.column)},l.triggerAutocomplete=function(c,o){var o=o??c.session.getPrecedingCharacter();return c.completers.some(function(p){if(p.triggerCharacters&&Array.isArray(p.triggerCharacters))return p.triggerCharacters.includes(o)})}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/inline","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config","ace/lib/event","ace/lib/scroll"],function(i,l,v){var s=i("./keyboard/hash_handler").HashHandler,c=i("./autocomplete/popup").AcePopup,d=i("./autocomplete/inline").AceInline,o=i("./autocomplete/popup").getAriaId,p=i("./autocomplete/util"),e=i("./lib/lang"),t=i("./lib/dom"),r=i("./snippets").snippetManager,h=i("./config"),a=i("./lib/event"),u=i("./lib/scroll").preventParentScroll,f=function(E,b){b.completer&&b.completer.destroy()},m=function(){function E(){this.autoInsert=!1,this.autoSelect=!0,this.autoShown=!1,this.exactMatch=!1,this.inlineEnabled=!1,this.keyboardHandler=new s,this.keyboardHandler.bindKeys(this.commands),this.parentNode=null,this.setSelectOnHover=!1,this.hasSeen=new Set,this.showLoadingState=!1,this.stickySelectionDelay=500,this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.onLayoutChange=this.onLayoutChange.bind(this),this.changeTimer=e.delayedCall(function(){this.updateCompletions(!0)}.bind(this)),this.tooltipTimer=e.delayedCall(this.updateDocTooltip.bind(this),50),this.popupTimer=e.delayedCall(this.$updatePopupPosition.bind(this),50),this.stickySelectionTimer=e.delayedCall(function(){this.stickySelection=!0}.bind(this),this.stickySelectionDelay),this.$firstOpenTimer=e.delayedCall(function(){var b=this.completionProvider&&this.completionProvider.initialPosition;this.autoShown||this.popup&&this.popup.isOpen||!b||this.editor.completers.length===0||(this.completions=new x(E.completionsForLoading),this.openPopup(this.editor,b.prefix,!1),this.popup.renderer.setStyle("ace_loading",!0))}.bind(this),this.stickySelectionDelay)}return Object.defineProperty(E,"completionsForLoading",{get:function(){return[{caption:h.nls("autocomplete.loading","Loading..."),value:""}]},enumerable:!1,configurable:!0}),E.prototype.$init=function(){return this.popup=new c(this.parentNode||document.body||document.documentElement),this.popup.on("click",function(b){this.insertMatch(),b.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.$onPopupShow.bind(this)),this.popup.on("hide",this.$onHidePopup.bind(this)),this.popup.on("select",this.$onPopupChange.bind(this)),a.addListener(this.popup.container,"mouseout",this.mouseOutListener.bind(this)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup.renderer.on("afterRender",this.$onPopupRender.bind(this)),this.popup},E.prototype.$initInline=function(){if(!(!this.inlineEnabled||this.inlineRenderer))return this.inlineRenderer=new d,this.inlineRenderer},E.prototype.getPopup=function(){return this.popup||this.$init()},E.prototype.$onHidePopup=function(){this.inlineRenderer&&this.inlineRenderer.hide(),this.hideDocTooltip(),this.stickySelectionTimer.cancel(),this.popupTimer.cancel(),this.stickySelection=!1},E.prototype.$seen=function(b){!this.hasSeen.has(b)&&b&&b.completer&&b.completer.onSeen&&typeof b.completer.onSeen=="function"&&(b.completer.onSeen(this.editor,b),this.hasSeen.add(b))},E.prototype.$onPopupChange=function(b){if(this.inlineRenderer&&this.inlineEnabled){var g=b?null:this.popup.getData(this.popup.getRow());if(this.$updateGhostText(g),this.popup.isMouseOver&&this.setSelectOnHover){this.tooltipTimer.call(null,null);return}this.popupTimer.schedule(),this.tooltipTimer.schedule()}else this.popupTimer.call(null,null),this.tooltipTimer.call(null,null)},E.prototype.$updateGhostText=function(b){var g=this.base.row,S=this.base.column,k=this.editor.getCursorPosition().column,D=this.editor.session.getLine(g).slice(S,k);this.inlineRenderer.show(this.editor,b,D)?this.$seen(b):this.inlineRenderer.hide()},E.prototype.$onPopupRender=function(){var b=this.inlineRenderer&&this.inlineEnabled;if(this.completions&&this.completions.filtered&&this.completions.filtered.length>0)for(var g=this.popup.getFirstVisibleRow();g<=this.popup.getLastVisibleRow();g++){var S=this.popup.getData(g);S&&(!b||S.hideInlinePreview)&&this.$seen(S)}},E.prototype.$onPopupShow=function(b){this.$onPopupChange(b),this.stickySelection=!1,this.stickySelectionDelay>=0&&this.stickySelectionTimer.schedule(this.stickySelectionDelay)},E.prototype.observeLayoutChanges=function(){if(!(this.$elements||!this.editor)){window.addEventListener("resize",this.onLayoutChange,{passive:!0}),window.addEventListener("wheel",this.mousewheelListener);for(var b=this.editor.container.parentNode,g=[];b;)g.push(b),b.addEventListener("scroll",this.onLayoutChange,{passive:!0}),b=b.parentNode;this.$elements=g}},E.prototype.unObserveLayoutChanges=function(){var b=this;window.removeEventListener("resize",this.onLayoutChange,{passive:!0}),window.removeEventListener("wheel",this.mousewheelListener),this.$elements&&this.$elements.forEach(function(g){g.removeEventListener("scroll",b.onLayoutChange,{passive:!0})}),this.$elements=null},E.prototype.onLayoutChange=function(){if(!this.popup.isOpen)return this.unObserveLayoutChanges();this.$updatePopupPosition(),this.updateDocTooltip()},E.prototype.$updatePopupPosition=function(){var b=this.editor,g=b.renderer,S=g.layerConfig.lineHeight,k=g.$cursorLayer.getPixelPosition(this.base,!0);k.left-=this.popup.getTextLeftOffset();var D=b.container.getBoundingClientRect();k.top+=D.top-g.layerConfig.offset,k.left+=D.left-b.renderer.scrollLeft,k.left+=g.gutterWidth;var _={top:k.top,left:k.left};g.$ghostText&&g.$ghostTextWidget&&this.base.row===g.$ghostText.position.row&&(_.top+=g.$ghostTextWidget.el.offsetHeight);var F=b.container.getBoundingClientRect().bottom-S,A=F<_.top?{top:F,left:_.left}:_;this.popup.tryShow(A,S,"bottom")||this.popup.tryShow(k,S,"top")||this.popup.show(k,S)},E.prototype.openPopup=function(b,g,S){this.$firstOpenTimer.cancel(),this.popup||this.$init(),this.inlineEnabled&&!this.inlineRenderer&&this.$initInline(),this.popup.autoSelect=this.autoSelect,this.popup.setSelectOnHover(this.setSelectOnHover);var k=this.popup.getRow(),D=this.popup.data[k];this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions&&this.editor.textInput.setAriaOptions({activeDescendant:o(this.popup.getRow()),inline:this.inlineEnabled}),b.keyBinding.addKeyboardHandler(this.keyboardHandler);var _;this.stickySelection&&(_=this.popup.data.indexOf(D)),(!_||_===-1)&&(_=0),this.popup.setRow(this.autoSelect?_:-1),_===k&&D!==this.completions.filtered[_]&&this.$onPopupChange();var F=this.inlineRenderer&&this.inlineEnabled;if(_===k&&F){var A=this.popup.getData(this.popup.getRow());this.$updateGhostText(A)}S||(this.popup.setTheme(b.getTheme()),this.popup.setFontSize(b.getFontSize()),this.$updatePopupPosition(),this.tooltipNode&&this.updateDocTooltip()),this.changeTimer.cancel(),this.observeLayoutChanges()},E.prototype.detach=function(){this.editor&&(this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener)),this.$firstOpenTimer.cancel(),this.changeTimer.cancel(),this.hideDocTooltip(),this.completionProvider&&this.completionProvider.detach(),this.popup&&this.popup.isOpen&&this.popup.hide(),this.popup&&this.popup.renderer&&this.popup.renderer.off("afterRender",this.$onPopupRender),this.base&&this.base.detach(),this.activated=!1,this.completionProvider=this.completions=this.base=null,this.unObserveLayoutChanges()},E.prototype.changeListener=function(b){var g=this.editor.selection.lead;(g.row!=this.base.row||g.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},E.prototype.blurListener=function(b){var g=document.activeElement,S=this.editor.textInput.getElement(),k=b.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(b.relatedTarget),D=this.popup&&this.popup.container;g!=S&&g.parentNode!=D&&!k&&g!=this.tooltipNode&&b.relatedTarget!=S&&this.detach()},E.prototype.mousedownListener=function(b){this.detach()},E.prototype.mousewheelListener=function(b){this.popup&&!this.popup.isMouseOver&&this.detach()},E.prototype.mouseOutListener=function(b){this.popup.isOpen&&this.$updatePopupPosition()},E.prototype.goTo=function(b){this.popup.goTo(b)},E.prototype.insertMatch=function(b,g){if(b||(b=this.popup.getData(this.popup.getRow())),!b)return!1;if(b.value==="")return this.detach();var S=this.completions,k=this.getCompletionProvider().insertMatch(this.editor,b,S.filterText,g);return this.completions==S&&this.detach(),k},E.prototype.showPopup=function(b,g){this.editor&&this.detach(),this.activated=!0,this.editor=b,b.completer!=this&&(b.completer&&b.completer.detach(),b.completer=this),b.on("changeSelection",this.changeListener),b.on("blur",this.blurListener),b.on("mousedown",this.mousedownListener),b.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,g)},E.prototype.getCompletionProvider=function(b){return this.completionProvider||(this.completionProvider=new y(b)),this.completionProvider},E.prototype.gatherCompletions=function(b,g){return this.getCompletionProvider().gatherCompletions(b,g)},E.prototype.updateCompletions=function(b,g){if(b&&this.base&&this.completions){var k=this.editor.getCursorPosition(),D=this.editor.session.getTextRange({start:this.base,end:k});if(D==this.completions.filterText)return;if(this.completions.setFilter(D),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==D&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,D,b);return}if(g&&g.matches){var k=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(k.row,k.column),this.base.$insertRight=!0,this.completions=new x(g.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",b)}var S=this.editor.getSession(),k=this.editor.getCursorPosition(),D=p.getCompletionPrefix(this.editor);this.base=S.doc.createAnchor(k.row,k.column-D.length),this.base.$insertRight=!0;var _={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:D,pos:k}).provideCompletions(this.editor,_,function(F,A,$){var w=A.filtered,C=p.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),$){if(!w.length){var T=!this.autoShown&&this.emptyMessage;if(typeof T=="function"&&(T=this.emptyMessage(C)),T){var I=[{caption:T,value:""}];this.completions=new x(I),this.openPopup(this.editor,C,b),this.popup.renderer.setStyle("ace_loading",!1),this.popup.renderer.setStyle("ace_empty-message",!0);return}return this.detach()}if(w.length==1&&w[0].value==C&&!w[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&w.length==1)return this.insertMatch(w[0])}this.completions=!$&&this.showLoadingState?new x(E.completionsForLoading.concat(w),A.filterText):A,this.openPopup(this.editor,C,b),this.popup.renderer.setStyle("ace_empty-message",!1),this.popup.renderer.setStyle("ace_loading",!$)}.bind(this)),this.showLoadingState&&!this.autoShown&&(!this.popup||!this.popup.isOpen)&&this.$firstOpenTimer.delay(this.stickySelectionDelay/2)},E.prototype.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},E.prototype.updateDocTooltip=function(){var b=this.popup,g=this.completions&&this.completions.filtered,S=g&&(g[b.getHoveredRow()]||g[b.getRow()]),k=null;if(!S||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var D=this.editor.completers.length,_=0;_<D;_++){var F=this.editor.completers[_];if(F.getDocTooltip&&S.completerId===F.id){k=F.getDocTooltip(S);break}}if(!k&&typeof S!="string"&&(k=S),typeof k=="string"&&(k={docText:k}),!k||!k.docHTML&&!k.docText)return this.hideDocTooltip();this.showDocTooltip(k)},E.prototype.showDocTooltip=function(b){this.tooltipNode||(this.tooltipNode=t.createElement("div"),this.tooltipNode.style.margin="0",this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.style.overscrollBehavior="contain",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this),this.tooltipNode.id="doc-tooltip",this.tooltipNode.setAttribute("role","tooltip"),this.tooltipNode.addEventListener("wheel",u));var g=this.editor.renderer.theme;this.tooltipNode.className="ace_tooltip ace_doc-tooltip "+(g.isDark?"ace_dark ":"")+(g.cssClass||"");var S=this.tooltipNode;b.docHTML?S.innerHTML=b.docHTML:b.docText&&(S.textContent=b.docText),S.parentNode||this.popup.container.appendChild(this.tooltipNode);var k=this.popup,D=k.container.getBoundingClientRect(),_=400,F=300,A=k.renderer.scrollBar.width||10,$=D.left,w=window.innerWidth-D.right-A,C=k.isTopdown?D.top:window.innerHeight-A-D.bottom,T=[Math.min(w/_,1),Math.min($/_,1),Math.min(C/F*.9)],I=Math.max.apply(Math,T),O=S.style;O.display="block",I==T[0]?(O.left=D.right+1+"px",O.right="",O.maxWidth=_*I+"px",O.top=D.top+"px",O.bottom="",O.maxHeight=Math.min(window.innerHeight-A-D.top,F)+"px"):I==T[1]?(O.right=window.innerWidth-D.left+"px",O.left="",O.maxWidth=_*I+"px",O.top=D.top+"px",O.bottom="",O.maxHeight=Math.min(window.innerHeight-A-D.top,F)+"px"):I==T[2]&&(O.left=window.innerWidth-D.left+"px",O.maxWidth=Math.min(_,window.innerWidth)+"px",k.isTopdown?(O.top=D.bottom+"px",O.left=D.left+"px",O.right="",O.bottom="",O.maxHeight=Math.min(window.innerHeight-A-D.bottom,F)+"px"):(O.top=k.container.offsetTop-S.offsetHeight+"px",O.left=D.left+"px",O.right="",O.bottom="",O.maxHeight=Math.min(k.container.offsetTop,F)+"px"))},E.prototype.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),!!this.tooltipNode){var b=this.tooltipNode;!this.editor.isFocused()&&document.activeElement==b&&this.editor.focus(),this.tooltipNode=null,b.parentNode&&b.parentNode.removeChild(b)}},E.prototype.onTooltipClick=function(b){for(var g=b.target;g&&g!=this.tooltipNode;){if(g.nodeName=="A"&&g.href){g.rel="noreferrer",g.target="_blank";break}g=g.parentNode}},E.prototype.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var b=this.popup.container;b&&b.parentNode&&b.parentNode.removeChild(b)}this.editor&&this.editor.completer==this&&(this.editor.off("destroy",f),this.editor.completer=null),this.inlineRenderer=this.popup=this.editor=null},E.for=function(b){return b.completer instanceof E||(b.completer&&(b.completer.destroy(),b.completer=null),h.get("sharedPopups")?(E.$sharedInstance||(E.$sharedInstance=new E),b.completer=E.$sharedInstance):(b.completer=new E,b.once("destroy",f))),b.completer},E}();m.prototype.commands={Up:function(E){E.completer.goTo("up")},Down:function(E){E.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(E){E.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(E){E.completer.goTo("end")},Esc:function(E){E.completer.detach()},Return:function(E){return E.completer.insertMatch()},"Shift-Return":function(E){E.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(E){var b=E.completer.insertMatch();if(b||E.tabstopManager)return b;E.completer.goTo("down")},Backspace:function(E){E.execCommand("backspace");var b=p.getCompletionPrefix(E);!b&&E.completer&&E.completer.detach()},PageUp:function(E){E.completer.popup.gotoPageUp()},PageDown:function(E){E.completer.popup.gotoPageDown()}},m.startCommand={name:"startAutocomplete",exec:function(E,b){var g=m.for(E);g.autoInsert=!1,g.autoSelect=!0,g.autoShown=!1,g.showPopup(E,b),g.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var y=function(){function E(b){this.initialPosition=b,this.active=!0}return E.prototype.insertByIndex=function(b,g,S){return!this.completions||!this.completions.filtered?!1:this.insertMatch(b,this.completions.filtered[g],S)},E.prototype.insertMatch=function(b,g,S){if(!g)return!1;if(b.startOperation({command:{name:"insertMatch"}}),g.completer&&g.completer.insertMatch)g.completer.insertMatch(b,g);else{if(!this.completions)return!1;var k=this.completions.filterText.length,D=0;if(g.range&&g.range.start.row===g.range.end.row&&(k-=this.initialPosition.prefix.length,k+=this.initialPosition.pos.column-g.range.start.column,D+=g.range.end.column-this.initialPosition.pos.column),k||D){var _;b.selection.getAllRanges?_=b.selection.getAllRanges():_=[b.getSelectionRange()];for(var F=0,A;A=_[F];F++)A.start.column-=k,A.end.column+=D,b.session.remove(A)}g.snippet?r.insertSnippet(b,g.snippet):this.$insertString(b,g),g.completer&&g.completer.onInsert&&typeof g.completer.onInsert=="function"&&g.completer.onInsert(b,g),g.command&&g.command==="startAutocomplete"&&b.execCommand(g.command)}return b.endOperation(),!0},E.prototype.$insertString=function(b,g){var S=g.value||g;b.execCommand("insertstring",S)},E.prototype.gatherCompletions=function(b,g){var S=b.getSession(),k=b.getCursorPosition(),D=p.getCompletionPrefix(b),_=[];this.completers=b.completers;var F=b.completers.length;return b.completers.forEach(function(A,$){A.getCompletions(b,S,k,D,function(w,C){A.hideInlinePreview&&(C=C.map(function(T){return Object.assign(T,{hideInlinePreview:A.hideInlinePreview})})),!w&&C&&(_=_.concat(C)),g(null,{prefix:p.getCompletionPrefix(b),matches:_,finished:--F===0})})}),!0},E.prototype.provideCompletions=function(b,g,S){var k=function(A){var $=A.prefix,w=A.matches;this.completions=new x(w),g.exactMatch&&(this.completions.exactMatch=!0),g.ignoreCaption&&(this.completions.ignoreCaption=!0),this.completions.setFilter($),(A.finished||this.completions.filtered.length)&&S(null,this.completions,A.finished)}.bind(this),D=!0,_=null;if(this.gatherCompletions(b,function(A,$){if(this.active){A&&(S(A,[],!0),this.detach());var w=$.prefix;if(w.indexOf($.prefix)===0){if(D){_=$;return}k($)}}}.bind(this)),D=!1,_){var F=_;_=null,k(F)}},E.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(b){typeof b.cancel=="function"&&b.cancel()})},E}(),x=function(){function E(b,g){this.all=b,this.filtered=b,this.filterText=g||"",this.exactMatch=!1,this.ignoreCaption=!1}return E.prototype.setFilter=function(b){if(b.length>this.filterText&&b.lastIndexOf(this.filterText,0)===0)var g=this.filtered;else var g=this.all;this.filterText=b,g=this.filterCompletions(g,this.filterText),g=g.sort(function(k,D){return D.exactMatch-k.exactMatch||D.$score-k.$score||(k.caption||k.value).localeCompare(D.caption||D.value)});var S=null;g=g.filter(function(k){var D=k.snippet||k.caption||k.value;return D===S?!1:(S=D,!0)}),this.filtered=g},E.prototype.filterCompletions=function(b,g){var S=[],k=g.toUpperCase(),D=g.toLowerCase();e:for(var _=0,F;F=b[_];_++){if(F.skipFilter){F.$score=F.score,S.push(F);continue}var A=!this.ignoreCaption&&F.caption||F.value||F.snippet;if(A){var $=-1,w=0,C=0,T,I;if(this.exactMatch){if(g!==A.substr(0,g.length))continue e}else{var O=A.toLowerCase().indexOf(D);if(O>-1)C=O;else for(var R=0;R<g.length;R++){var P=A.indexOf(D[R],$+1),B=A.indexOf(k[R],$+1);if(T=P>=0&&(B<0||P<B)?P:B,T<0)continue e;I=T-$-1,I>0&&($===-1&&(C+=10),C+=I,w|=1<<R),$=T}}F.matchMask=w,F.exactMatch=C?0:1,F.$score=(F.score||0)-C,S.push(F)}}return S},E}();l.Autocomplete=m,l.CompletionProvider=y,l.FilteredList=x}),ace.define("ace/marker_group",["require","exports","module"],function(i,l,v){var s=function(){function c(d,o){o&&(this.markerType=o.markerType),this.markers=[],this.session=d,d.addDynamicMarker(this)}return c.prototype.getMarkerAtPosition=function(d){return this.markers.find(function(o){return o.range.contains(d.row,d.column)})},c.prototype.markersComparator=function(d,o){return d.range.start.row-o.range.start.row},c.prototype.setMarkers=function(d){this.markers=d.sort(this.markersComparator).slice(0,this.MAX_MARKERS),this.session._signal("changeBackMarker")},c.prototype.update=function(d,o,p,e){if(!(!this.markers||!this.markers.length))for(var t=e.firstRow,r=e.lastRow,h,a=0,u=0,f=0;f<this.markers.length;f++){var m=this.markers[f];if(!(m.range.end.row<t)&&!(m.range.start.row>r)&&(m.range.start.row===u?a++:(u=m.range.start.row,a=0),!(a>200))){var y=m.range.clipRows(t,r);if(!(y.start.row===y.end.row&&y.start.column===y.end.column)){var x=y.toScreenRange(p);if(x.isEmpty()){h=p.getNextFoldLine(y.end.row,h),h&&h.end.row>y.end.row&&(t=h.end.row);continue}this.markerType==="fullLine"?o.drawFullLineMarker(d,x,m.className,e):x.isMultiLine()?this.markerType==="line"?o.drawMultiLineMarker(d,x,m.className,e):o.drawTextMarker(d,x,m.className,e):o.drawSingleLineMarker(d,x,m.className+" ace_br15",e)}}}},c}();s.prototype.MAX_MARKERS=1e4,l.MarkerGroup=s}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(i,l,v){function s(p,e){var t=p.getTextRange(d.fromPoints({row:0,column:0},e));return t.split(o).length-1}function c(p,e){var t=s(p,e),r=p.getValue().split(o),h=Object.create(null),a=r[t];return r.forEach(function(u,f){if(!(!u||u===a)){var m=Math.abs(t-f),y=r.length-m;h[u]?h[u]=Math.max(y,h[u]):h[u]=y}}),h}var d=i("../range").Range,o=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;l.getCompletions=function(p,e,t,r,h){var a=c(e,t),u=Object.keys(a);h(null,u.map(function(f){return{caption:f,value:f,score:a[f],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/marker_group","ace/autocomplete/text_completer","ace/editor","ace/config"],function(i,l,v){var s=i("../snippets").snippetManager,c=i("../autocomplete").Autocomplete,d=i("../config"),o=i("../lib/lang"),p=i("../autocomplete/util"),e=i("../marker_group").MarkerGroup,t=i("../autocomplete/text_completer"),r={getCompletions:function(D,_,F,A,$){if(_.$mode.completer)return _.$mode.completer.getCompletions(D,_,F,A,$);var w=D.session.getState(F.row),C=_.$mode.getCompletions(w,_,F,A);C=C.map(function(T){return T.completerId=r.id,T}),$(null,C)},id:"keywordCompleter"},h=function(D){var _={};return D.replace(/\${(\d+)(:(.*?))?}/g,function(F,A,$,w){return _[A]=w||""}).replace(/\$(\d+?)/g,function(F,A){return _[A]})},a={getCompletions:function(D,_,F,A,$){var w=[],C=_.getTokenAt(F.row,F.column);C&&C.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?w.push("html-tag"):w=s.getActiveScopes(D);var T=s.snippetMap,I=[];w.forEach(function(O){for(var R=T[O]||[],P=R.length;P--;){var B=R[P],V=B.name||B.tabTrigger;V&&I.push({caption:V,snippet:B.content,meta:B.tabTrigger&&!B.name?B.tabTrigger+"⇥ ":"snippet",completerId:a.id})}},this),$(null,I)},getDocTooltip:function(D){D.snippet&&!D.docHTML&&(D.docHTML=["<b>",o.escapeHTML(D.caption),"</b>","<hr></hr>",o.escapeHTML(h(D.snippet))].join(""))},id:"snippetCompleter"},u=[a,t,r];l.setCompleters=function(D){u.length=0,D&&u.push.apply(u,D)},l.addCompleter=function(D){u.push(D)},l.textCompleter=t,l.keyWordCompleter=r,l.snippetCompleter=a;var f={name:"expandSnippet",exec:function(D){return s.expandWithTab(D)},bindKey:"Tab"},m=function(D,_){y(_.session.$mode)},y=function(D){typeof D=="string"&&(D=d.$modes[D]),D&&(s.files||(s.files={}),x(D.$id,D.snippetFileId),D.modes&&D.modes.forEach(y))},x=function(D,_){!_||!D||s.files[D]||(s.files[D]={},d.loadModule(_,function(F){F&&(s.files[D]=F,!F.snippets&&F.snippetText&&(F.snippets=s.parseSnippetFile(F.snippetText)),s.register(F.snippets||[],F.scope),F.includeScopes&&(s.snippetMap[F.scope].includeScopes=F.includeScopes,F.includeScopes.forEach(function(A){y("ace/mode/"+A)})))}))},E=function(D){var _=D.editor,F=_.completer&&_.completer.activated;if(D.command.name==="backspace")F&&!p.getCompletionPrefix(_)&&_.completer.detach();else if(D.command.name==="insertstring"&&!F){b=D;var A=D.editor.$liveAutocompletionDelay;A?g.delay(A):S(D)}},b,g=o.delayedCall(function(){S(b)},0),S=function(D){var _=D.editor,F=p.getCompletionPrefix(_),A=D.args,$=p.triggerAutocomplete(_,A);if(F&&F.length>=_.$liveAutocompletionThreshold||$){var w=c.for(_);w.autoShown=!0,w.showPopup(_)}},k=i("../editor").Editor;i("../config").defineOptions(k.prototype,"editor",{enableBasicAutocompletion:{set:function(D){D?(c.for(this),this.completers||(this.completers=Array.isArray(D)?D:u),this.commands.addCommand(c.startCommand)):this.commands.removeCommand(c.startCommand)},value:!1},enableLiveAutocompletion:{set:function(D){D?(this.completers||(this.completers=Array.isArray(D)?D:u),this.commands.on("afterExec",E)):this.commands.off("afterExec",E)},value:!1},liveAutocompletionDelay:{initialValue:0},liveAutocompletionThreshold:{initialValue:0},enableSnippets:{set:function(D){D?(this.commands.addCommand(f),this.on("changeMode",m),m(null,this)):(this.commands.removeCommand(f),this.off("changeMode",m))},value:!1}}),l.MarkerGroup=e}),function(){ace.require(["ace/ext/language_tools"],function(i){L&&(L.exports=i)})}()})(Ia);const gi={jsonError:{border:"1px solid red",minHeight:200},jsonNoError:{border:"1px solid #00000000",minHeight:200}};function Fa(L){return M.createElement($a,{style:L.error===!0?gi.jsonError:L.error===!1?gi.jsonNoError:void 0,mode:L.mode||"json",width:"100%",height:"100%",showPrintMargin:L.editValueMode,showGutter:L.editValueMode,highlightActiveLine:L.editValueMode,defaultValue:L.defaultValue,theme:L.themeType==="dark"?"clouds_midnight":"chrome",value:L.value,readOnly:!L.onChange,onChange:n=>L.onChange(n),name:L.name||"UNIQUE_ID_OF_DIV1",fontSize:L.fontSize||14,setOptions:{enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!0,showLineNumbers:L.editValueMode,tabSize:L.editValueMode?2:void 0},editorProps:{$blockScrolling:!0}})}const bn={flex:{display:"flex"},button:{height:48,minWidth:48},wrapper:{width:"calc(100vw - 40px)",height:"calc(100vh - 188px)"}};class Oa extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,l=K.getValue(n,i)||"{}";this.setState({value:l,initialized:!0,jsonError:this.validateJson(l)})}validateJson(n){let i=!1;if(this.props.schema.validateJson!==!1&&(n||!this.props.schema.allowEmpty))try{this.props.schema.json5?Ii.parse(n):JSON.parse(n)}catch(l){console.log("Error in JSON",l),i=!0}return i}renderItem(n,i){if(!this.state.initialized)return null;const{schema:l,data:v,attr:s}=this.props,{value:c,showSelectId:d}=this.state;return M.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},M.createElement("div",{style:bn.flex},M.createElement(N.Button,{color:"grey",disabled:i,style:bn.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},j.I18n.t("ra_JSON editor"))),d?M.createElement(lo,{title:this.getText(l.label),overflowHidden:!0,applyDisabled:this.state.jsonError&&this.props.schema.doNotApplyWithError,onClose:()=>this.setState({showSelectId:!1,value:K.getValue(v,s)||{}}),onApply:()=>this.setState({showSelectId:!1},()=>this.onChange(s,c))},M.createElement("div",{style:{...bn.wrapper,border:this.state.jsonError?"2px solid red":"2px solid transparent"}},M.createElement(Fa,{mode:this.props.schema.json5?"json5":"json",value:typeof c=="object"?JSON.stringify(c):c,onChange:o=>this.setState({value:o,jsonError:this.validateJson(o)}),name:"ConfigJsonEditor",themeType:this.props.oContext.themeType}))):null,l.help||this.state.jsonError?M.createElement(N.FormHelperText,null,this.state.jsonError?j.I18n.t("ra_Invalid JSON"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ra=[{value:"en",label:"English"},{value:"de",label:"Deutsch"},{value:"ru",label:"русский"},{value:"pt",label:"Portugues"},{value:"nl",label:"Nederlands"},{value:"fr",label:"français"},{value:"it",label:"Italiano"},{value:"es",label:"Espanol"},{value:"pl",label:"Polski"},{value:"uk",label:"Український"},{value:"zh-cn",label:"简体中文"}];class Na extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr),i=[...Ra];this.props.schema.system?i.unshift({value:"",label:j.I18n.t("ra_System language")}):i.unshift({value:"",label:j.I18n.t("ra_none")}),this.setState({value:this.props.schema.system?n||"":n||j.I18n.getLanguage(),selectOptions:i})}renderItem(n,i){var v,s;if(!this.state.selectOptions)return null;const l=(v=this.state.selectOptions)==null?void 0:v.find(c=>c.value===this.state.value||!c.value&&!this.state.value);return M.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?M.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,M.createElement(N.Select,{variant:"standard",error:!!n,disabled:i,value:this.state.value||"_",renderValue:()=>this.getText(l==null?void 0:l.label,this.props.schema.noTranslation),onChange:c=>{let{value:d}=c.target;d==="_"&&(d=""),this.setState({value:d},()=>{const o=this.onChange(this.props.attr,d);if(o instanceof Promise&&o.catch(p=>console.error(p)),this.props.schema.changeGuiLanguage)if(d){if(d===j.I18n.getLanguage())return;j.I18n.setLanguage(d),this.props.oContext.changeLanguage&&this.props.oContext.changeLanguage()}else this.props.oContext.socket.getSystemConfig().then(p=>{p.common.language!==j.I18n.getLanguage()&&p.common.language&&(j.I18n.setLanguage(p.common.language),this.props.oContext.changeLanguage&&this.props.oContext.changeLanguage())}).catch(p=>console.error(`Cannot read system config: ${p}`))})}},(s=this.state.selectOptions)==null?void 0:s.map(c=>M.createElement(N.MenuItem,{key:c.value,value:c.value},c.label))),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class Ba extends K{scrollRef;constructor(n){super(n),this.scrollRef=M.createRef()}scrolledDown(){return this.scrollRef.current?this.scrollRef.current.offsetHeight+this.scrollRef.current.scrollTop>=this.scrollRef.current.scrollHeight:!1}componentDidMount(){super.componentDidMount(),K.getValue(this.props.data,this.props.attr)||(this.props.schema.licenseUrl?(this.setState({showLicenseDialog:!0,loading:!0,scrolledDown:!1}),fetch(this.props.schema.licenseUrl).then(n=>n.text()).then(n=>this.setState({license:n,loading:!1})).catch(n=>this.setState({license:n.toString(),loading:!1,error:!0,scrolledDown:!1}))):this.setState({showLicenseDialog:!0,scrolledDown:!1}),setTimeout(()=>{this.scrollRef.current&&(this.scrolledDown()?this.setState({scrolledDown:!0}):this.scrollRef.current.addEventListener("scroll",()=>{!this.state.scrolledDown&&this.scrolledDown()&&this.setState({scrolledDown:!0})}))},1e3))}renderItem(n,i){return this.state.showLicenseDialog?M.createElement(N.Dialog,{maxWidth:"lg",open:!0,onClose:(l,v)=>{v!=="escapeKeyDown"&&v!=="backdropClick"&&this.setState({showLicenseDialog:!1})}},M.createElement(N.DialogTitle,null,this.props.schema.title?j.I18n.t(this.props.schema.title):j.I18n.t("ra_License agreement")),M.createElement(N.DialogContent,null,this.props.schema.licenseUrl?M.createElement(M.Fragment,null,this.state.loading?M.createElement(N.LinearProgress,null):null,M.createElement("pre",{ref:this.scrollRef,style:{width:"100%",height:"100%",overflowY:"auto",fontSize:14}},this.state.license)):null,!this.props.schema.licenseUrl&&this.props.schema.texts?M.createElement("div",{ref:this.scrollRef,style:{width:"100%",height:"100%",overflowY:"auto",fontSize:14}},this.props.schema.texts.map((l,v)=>this.props.schema.noTranslation?M.createElement("p",{key:v},l):M.createElement("p",{key:v},j.I18n.t(l)))):null),M.createElement(N.DialogActions,null,this.props.schema.checkBox?M.createElement(N.FormControlLabel,{control:M.createElement(N.Checkbox,{disabled:i,checked:!!this.state.licenseChecked,onClick:()=>this.setState({licenseChecked:!this.state.licenseChecked})}),label:j.I18n.t(this.props.schema.checkBox)}):null,M.createElement(N.Button,{disabled:i||this.state.loading||this.state.error||this.props.schema.checkBox&&!this.state.licenseChecked||!this.state.scrolledDown,onClick:()=>{this.setState({showLicenseDialog:!1});const l=this.onChange(this.props.attr,!0);l instanceof Promise&&l.catch(v=>console.error(`Cannot set value: ${v}`))},color:"primary",variant:"contained",startIcon:M.createElement(Z.Check,null)},this.props.schema.agreeText?j.I18n.t(this.props.schema.agreeText):j.I18n.t("ra_Accept license")),M.createElement(N.Button,{onClick:()=>{this.setState({showLicenseDialog:!1}),setTimeout(()=>this.setState({showLicenseDialog:!0}),2e3)},color:"grey",variant:"contained",startIcon:M.createElement(Z.Close,null)},j.I18n.t("ra_Close")))):null}}const mi={indeterminate:{opacity:.5},control:{flexDirection:"row",width:"100%"}};class Pa extends K{updateTimeout;componentDidMount(){super.componentDidMount();let n=K.getValue(this.props.data,this.props.attr);if(n==null&&(n=""),Array.isArray(n)&&this.props.oContext.multiEdit){n=K.DIFFERENT_VALUE,this.setState({_value:n,oldValue:n});return}this.setState({_value:n.toString(),oldValue:n.toString()})}static getDerivedStateFromProps(n,i){if(n.schema.min!==void 0&&n.schema.min<0||n.schema.max!==void 0&&n.schema.max<0)return null;const l=K.getValue(n.data,n.attr);return n.oContext.multiEdit&&i._value===K.DIFFERENT_VALUE?{_value:K.DIFFERENT_VALUE}:l==null||i.oldValue===null||i.oldValue===void 0||l.toString()!==parseFloat(i._value).toString()&&l.toString()!==i.oldValue.toString()?{_value:l}:null}checkValue(n){if(n==null)return null;n=n.toString().trim().replace(",",".");const i=n===""?0:parseFloat(n);return n!==""&&Number.isNaN(i)?"ra_Not a number":n!==""&&window.isFinite(i)?this.props.schema.min!==void 0&&i<this.props.schema.min?"ra_Too small":this.props.schema.max!==void 0&&i>this.props.schema.max?"ra_Too big":n===""||n==="-"||Number.isNaN(i)?"ra_Not a number":null:"ra_Not a number"}renderItem(n,i){const l=Array.isArray(this.state._value)||this.state._value===K.DIFFERENT_VALUE;if(this.state.oldValue!==null&&this.state.oldValue!==void 0?(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=void 0,this.setState({oldValue:null})},30)):this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=void 0),l){const v=K.getValue(this.props.data,this.props.attr),s=(v==null?void 0:v.filter(c=>c||c===0).map(c=>({label:c.toString(),value:c})))||[];return s.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),M.createElement(N.Autocomplete,{style:mi.indeterminate,fullWidth:!0,freeSolo:!0,value:s[0],getOptionSelected:(c,d)=>c.label===d.label,onChange:(c,d)=>{const o=this.onChange(this.props.attr,d==null?void 0:d.value,()=>{this.setState({_value:d==null?void 0:d.value,oldValue:this.state._value})});o instanceof Promise&&o.catch(p=>console.error(p))},options:s,getOptionLabel:c=>c.label,renderInput:c=>M.createElement(N.TextField,{...c,label:this.getText(this.props.schema.label),variant:"standard",slotProps:{htmlInput:{...c.inputProps,readOnly:this.props.schema.readOnly||!1},input:{endAdornment:this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):void 0}},error:!!n,placeholder:this.getText(this.props.schema.placeholder),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:!!i})})}return!n&&this.state._value!==null&&this.state._value!==void 0&&this.state._value&&(n=this.checkValue(this.state._value),n&&(n=j.I18n.t(n))),M.createElement(N.FormControl,{variant:"standard",style:mi.control},M.createElement(N.TextField,{sx:{"& .up-down":{display:"none"},"&:hover .up-down":{display:"block"}},variant:"standard",type:this.props.schema.min!==void 0&&this.props.schema.min>=0?"number":"text",fullWidth:!0,slotProps:{htmlInput:{min:this.props.schema.min,max:this.props.schema.max,step:this.props.schema.step,readOnly:this.props.schema.readOnly||!1},input:{endAdornment:this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):null}},value:this.state._value===null||this.state._value===void 0?"":this.state._value,error:!!n,disabled:!!i,onChange:v=>{const s=v.target.value,c=this.checkValue(s);c?this.onError(this.props.attr,j.I18n.t(c)):this.onError(this.props.attr),this.setState({_value:s,oldValue:this.state._value},()=>this.onChange(this.props.attr,parseFloat(s.replace(",","."))))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:n&&typeof n=="string"?n:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}))}}class Wa extends K{authWindow;oid;url;constructor(n){super(n),this.state={...this.state,accessTokens:"",success:!1,blocked:!1,running:!1,pressed:!1},this.url=`https://oauth2.iobroker.in/${n.schema.identifier}?redirect=true`,n.schema.scope&&(this.url+=`&scope=${encodeURIComponent(n.schema.scope)}`),this.oid=`${this.props.oContext.adapterName}.${this.props.oContext.instance}.${this.props.schema.saveTokenIn||"oauth2Tokens"}`}async componentDidMount(){super.componentDidMount(),window.addEventListener?window.addEventListener("message",this.onMessage,!1):window.attachEvent("onmessage",this.onMessage,!1),await this.props.oContext.socket.subscribeState(this.oid,this.onTokensUpdated);const n=await this.props.oContext.socket.getState(this.oid);if(n){const i=JSON.parse(n.val);new Date(i.access_token_expires_on).getTime()>Date.now()&&this.setState({accessTokens:n.val})}}onTokensUpdated=(n,i)=>{if(i!=null&&i.val){const l=JSON.parse(i.val);if(new Date(l.access_token_expires_on).getTime()>Date.now()){this.state.accessTokens!==i.val&&this.setState({accessTokens:i.val});return}}this.setState({accessTokens:""})};componentWillUnmount(){super.componentWillUnmount(),window.removeEventListener?window.removeEventListener("message",this.onMessage,!1):window.detachEvent("onmessage",this.onMessage,!1),this.props.oContext.socket.unsubscribeState(this.oid,this.onTokensUpdated)}saveToken(n){try{n&&!n.startsWith("{")&&(n=atob(n));const i=JSON.parse(n);i.access_token&&i.refresh_token&&i.expires_in&&(i.access_token_expires_on||=new Date(Date.now()+i.expires_in*1e3).toISOString(),this.props.oContext.socket.setState(this.oid,JSON.stringify(i),!0).catch(l=>console.log(`Error occurred: ${l.toString()}`)))}catch(i){console.warn(i)}}onMessage=n=>{var i,l,v;if(n.origin==="https://oauth2.iobroker.in"&&(typeof n.data=="string"&&n.data.startsWith(`${this.props.schema.identifier}-authentication:`)||typeof n.message=="string"&&n.message.startsWith(`${this.props.schema.identifier}-authentication:`))){const s=(n.data||n.message).split(":");s[1]==="success"?(this.setState({accessTokens:s[2],success:!0,pressed:!1},()=>this.saveToken(this.state.accessTokens)),(i=this.authWindow)==null||i.postMessage("close",n.origin),this.authWindow=null):(v=(l=this.props).onError)==null||v.call(l,s[2])}};onOpenUrl(){this.authWindow=window.open(this.url,this.props.schema.identifier),!this.authWindow||this.authWindow.closed||typeof this.authWindow.closed>"u"?this.setState({blocked:!0}):this.setState({pressed:!0})}renderItem(){let n="";if(this.state.accessTokens)try{const v=JSON.parse(this.state.accessTokens);n=new Date(v.access_token_expires_on).toLocaleString()}catch{}let i;this.state.accessTokens?i=this.props.schema.refreshLabel?this.getText(this.props.schema.refreshLabel):j.I18n.t("ra_Renew %s access",this.props.schema.identifier[0].toUpperCase()+this.props.schema.identifier.slice(1)):i=this.props.schema.label?this.getText(this.props.schema.label):j.I18n.t("ra_Get %s access",this.props.schema.identifier[0].toUpperCase()+this.props.schema.identifier.slice(1));const l=this.getIcon();return M.createElement("div",{style:{width:"100%",margin:"0 0 1rem 0"}},M.createElement(N.Button,{disabled:this.state.running,endIcon:l||M.createElement(Z.CloudUpload,null),variant:"contained",onClick:()=>this.onOpenUrl()},i),this.state.blocked?M.createElement("div",{style:{color:"red",fontSize:16,marginTop:20}},j.I18n.t("ra_Please allow popups in your browser for this page!")):null,this.state.accessTokens?M.createElement("div",{style:{color:"green",fontSize:16,marginTop:20}},this.props.alive?j.I18n.t("ra_Successfully authorized. Token valid till %s and will be automatically renewed.",n):j.I18n.t("ra_Successfully authorized. Token valid till %s but it can expire as the instance is not running.",n)):null,this.state.pressed?M.createElement(M.Fragment,null,M.createElement("div",{style:{width:"100%",margin:"1rem 0 1rem 0"}},M.createElement("span",{style:{marginRight:4}},`${j.I18n.t("ra_If the button above does not work, you can authorize manually this app by visiting this url")}`,":"),M.createElement("br",null),M.createElement("a",{target:this.props.schema.identifier,href:this.url,rel:"noreferrer"},this.url)),M.createElement(N.TextField,{value:this.state.accessTokens,label:j.I18n.t("ra_Enter the code from that page here"),variant:"standard",onChange:v=>{let s=v.target.value;s&&!s.startsWith("{")&&(s=atob(s));try{const c=JSON.parse(s);c.access_token&&(c.access_token_expires_on=new Date(Date.now()+(c.expires_in-10)*1e3).toISOString(),this.setState({accessTokens:JSON.stringify(c)},()=>this.saveToken(this.state.accessTokens)))}catch{}},fullWidth:!0})):null)}}const vi={flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class za extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,l=K.getValue(n,i)||"";this.setState({value:l,initialized:!0})}renderItem(n,i){if(!this.state.initialized)return null;const l=this.props.oContext.socket,{schema:v,attr:s}=this.props,{value:c,showSelectId:d}=this.state;return M.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},v.label?M.createElement(N.InputLabel,{shrink:!0},this.getText(v.label)):null,M.createElement("div",{style:vi.flex},M.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:c,error:!!n,disabled:i,placeholder:this.getText(v.placeholder),label:this.getText(v.label),helperText:this.renderHelp(v.help,v.helpLink,v.noTranslation),onChange:o=>{const p=o.target.value;this.setState({value:p},()=>this.onChange(s,p))}}),M.createElement(N.Button,{color:"grey",disabled:i,style:vi.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},"...")),d?M.createElement(j.DialogSelectID,{imagePrefix:this.props.oContext.imagePrefix===void 0?"../..":this.props.oContext.imagePrefix,dialogName:`admin.${this.props.oContext.adapterName}`,filterFunc:v.filterFunc,themeType:this.props.oContext.themeType,theme:this.props.oContext.theme,types:v.types?Array.isArray(v.types)?v.types:[v.types]:void 0,customFilter:v.customFilter,filters:v.filters,socket:l,selected:c,root:v.root,onClose:()=>this.setState({showSelectId:!1}),onOk:o=>this.setState({showSelectId:!1,value:o},()=>this.onChange(s,o))}):null)}}const wn={fullWidth:{width:"100%",display:"inline-block"},halfWidth1:{width:"calc(50% - 5px)",display:"inline-block",marginRight:8},halfWidth2:{width:"calc(50% - 5px)",display:"inline-block"}},Ut="____ppp____";class Ha extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({_repeat:n?Ut:"",_visible:!1,value:n?Ut:"",_notEqual:!1})}onChangePassword(n,i){n===void 0&&(n=this.state.value),i===void 0&&(i=this.state._repeat);const l=!!this.props.schema.repeat&&i!==n;this.setState({value:n,_repeat:i,_notEqual:l},()=>{if(l)this.onError(this.props.attr,j.I18n.t("ra_Passwords are not equal!"));else{this.onError(this.props.attr);const v=this.onChange(this.props.attr,n);v instanceof Promise&&v.catch(s=>this.onError(this.props.attr,s))}})}renderItem(n,i){if(this.state._notEqual===void 0)return null;const l=M.createElement(N.TextField,{variant:"standard",fullWidth:!0,type:this.state._visible&&this.state.value!==Ut?"text":"password",value:this.state.value,error:!!n||this.state._notEqual,disabled:!!i,onChange:v=>this.onChangePassword(v.target.value),label:this.getText(this.props.schema.label),slotProps:{input:{autoComplete:"new-password",endAdornment:this.state.value&&this.state.value!==Ut&&this.props.schema.visible&&!i&&!this.props.schema.readOnly?M.createElement(N.InputAdornment,{position:"end"},M.createElement(N.IconButton,{size:"large",tabIndex:-1,onClick:v=>{v.preventDefault(),v.stopPropagation(),this.setState({_visible:!this.state._visible})},edge:"end"},this.state._visible?M.createElement(Z.VisibilityOff,null):M.createElement(Z.Visibility,null))):void 0},htmlInput:{autoComplete:"new-password",form:{autoComplete:"off"},maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1}},helperText:this.state._notEqual?j.I18n.t("ra_Passwords are not equal!"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)});if(this.props.schema.repeat&&!this.props.schema.readOnly){const v=this.state._visible?null:M.createElement(N.TextField,{variant:"standard",fullWidth:!0,type:"password",value:this.state._repeat,error:!!n||this.state._notEqual,disabled:!!i,onChange:s=>this.onChangePassword(void 0,s.target.value),label:`${this.getText(this.props.schema.label)} (${j.I18n.t("ra_repeat")})`,slotProps:{input:{autoComplete:"new-password"},htmlInput:{autoComplete:"new-password",form:{autoComplete:"off"},maxLength:this.props.schema.maxLength||this.props.schema.max||void 0}},helperText:this.state._notEqual?j.I18n.t("ra_Passwords are not equal!"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)});return M.createElement("div",{style:wn.fullWidth},M.createElement("div",{style:wn.halfWidth1},l),M.createElement("div",{style:wn.halfWidth2},v))}return l}}class ja extends K{renderItem(n,i){return M.createElement(N.TextField,{variant:"standard",fullWidth:!0,disabled:!!i,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?M.createElement(N.IconButton,{tabIndex:-1,size:"small",onClick:()=>{j.Utils.copyToClipboard(this.getPattern(this.props.schema.pattern,null,this.props.schema.noTranslation)),window.alert(j.I18n.t("ra_Copied"))}},M.createElement(j.IconCopy,null)):void 0}},value:this.getPattern(this.props.schema.pattern,null,!0),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const Va={warning:{"& .Mui-error":{color:"orange"}}};class Ua extends K{updateTimeout;async componentDidMount(){super.componentDidMount();let n=K.getValue(this.props.data,this.props.attr);n==null&&(n=""),this.setState({_value:n.toString(),oldValue:n.toString()});const i=await this.props.oContext.socket.getAdapterInstances(),l=`system.adapter.${this.props.oContext.adapterName}.${this.props.oContext.instance}`,v=await this.props.oContext.socket.getObject(l),s=v==null?void 0:v.common.host,c=[];i.forEach(d=>{var p,e,t,r;if(!d||d._id===l||d.common.host!==s||!((p=d.native)!=null&&p.bind))return;if(d!=null&&d.native&&d.native.secure&&d.native.leEnabled&&d.native.leUpdate){const h=parseInt(d.native.leCheckPort||d.native.lePort,10);h&&c.push({name:`${d._id.replace("system.adapter.","")} (LE)`,port:h,v6bind:d.native.bind.includes(":")?d.native.bind:d.native.v6bind,bind:d.native.bind,enabled:!!((e=d.common)!=null&&e.enabled)})}const o=parseInt((t=d==null?void 0:d.native)==null?void 0:t.port,10);o&&c.push({name:d._id.replace("system.adapter.",""),bind:d.native.bind,v6bind:d.native.bind.includes(":")?d.native.bind:d.native.v6bind,port:o,enabled:!!((r=d.common)!=null&&r.enabled)})}),this.setState({ports:c})}static getDerivedStateFromProps(n,i){const l=K.getValue(n.data,n.attr);return l==null||i.oldValue===null||i.oldValue===void 0||l.toString()!==parseInt(i._value,10).toString()&&l.toString()!==i.oldValue.toString()?{_value:l}:null}checkValue(n){if(n==null)return null;const i=this.props.schema.min===void 0?20:this.props.schema.min,l=this.props.schema.max||65535;n=n.toString().trim();const v=n===""?0:parseInt(n,10);return n!==""&&Number.isNaN(v)?"ra_Not a number":n!==""&&window.isFinite(Number(n))?v<i?"ra_Too small":v>l?"ra_Too big":n===""||n==="-"||Number.isNaN(v)?"ra_Not a number":null:"ra_Not a number"}renderItem(n,i){this.state.oldValue!==null&&this.state.oldValue!==void 0?(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=void 0,this.setState({oldValue:null})},30)):this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=void 0);const l=this.props.schema.min===void 0?20:this.props.schema.min,v=this.props.schema.max||65535;let s;if(this.state.ports){const c=parseInt(this.state._value,10);if(c){const d=this.state.ports.filter(p=>!this.props.data.bind||this.props.data.bind===p.bind||this.props.data.bind==="0.0.0.0"||p.bind==="0.0.0.0");let o=d.findIndex(p=>p.port===c&&p.enabled);o!==-1?n=j.I18n.t("ra_Port is already used by %s",this.state.ports[o].name):(o=d.findIndex(p=>p.port===c&&!p.enabled),o!==-1&&(s=!0,n=j.I18n.t("ra_Port could be used by %s",this.state.ports[o].name)))}}return!n&&this.state._value!==null&&this.state._value!==void 0&&(n=this.checkValue(this.state._value),typeof n=="string"&&(n=j.I18n.t(n))),M.createElement(N.TextField,{variant:"standard",type:"number",fullWidth:!0,slotProps:{htmlInput:{min:l,max:v,readOnly:this.props.schema.readOnly||!1}},value:this.state._value===null||this.state._value===void 0?"":this.state._value,error:!!n,disabled:!!i,sx:s?Va.warning:void 0,onChange:c=>{const d=Number(c.target.value.toString().replace(/[^0-9]/g,"")).toString(),o=this.checkValue(d);o?this.onError(this.props.attr,j.I18n.t(o)):this.onError(this.props.attr),this.setState({_value:d,oldValue:this.state._value},()=>{if(d.trim()===parseInt(d,10).toString()){const p=this.onChange(this.props.attr,parseInt(d,10)||0);p instanceof Promise&&p.catch(e=>{console.error(`Cannot set value for ${this.props.attr}: ${e}`)})}})},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:n&&typeof n=="string"?n:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}class Ga extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.props.oContext.socket.getEnums("rooms").then(i=>{const l=Object.keys(i).map(v=>({value:this.props.schema.short?v.replace("enum.rooms.",""):v,label:this.getText(i[v].common.name),obj:i[v]}));this.props.schema.allowDeactivate!==!1&&l.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({value:n,selectOptions:l})}).catch(i=>console.error(`Cannot get enums: ${i}`))}renderItem(n,i){if(!this.state.selectOptions)return null;const l=this.state.selectOptions.find(v=>v.value===this.state.value);return M.createElement(N.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?M.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,M.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:this.state.value||"_",renderValue:()=>l?l.obj?M.createElement(j.TextWithIcon,{value:l.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):l.label:"",onChange:v=>{this.setState({value:v.target.value==="_"?"":v.target.value},()=>this.onChange(this.props.attr,this.state.value))}},this.state.selectOptions.map(v=>M.createElement(N.MenuItem,{key:v.value,value:v.value,style:v.value===K.DIFFERENT_VALUE?{opacity:.5}:{}},v.obj?M.createElement(j.TextWithIcon,{value:v.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):v.label))),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ka={noMargin:{"&>div":{marginTop:0}}};class Ja extends K{initialValue="";componentDidMount(){super.componentDidMount();let n=K.getValue(this.props.data,this.props.attr);this.props.schema.multiple&&(typeof n=="string"?n=[n]:n==null&&(n=[]));const i=[];(this.props.schema.options||[]).forEach(l=>{const v=l;Array.isArray(v.items)?(i.push({label:this.getText(l.label,this.props.schema.noTranslation),value:l.value,group:!0,color:l.color}),v.items.forEach(s=>i.push({label:this.getText(s.label,this.props.schema.noTranslation),value:s.value,hidden:s.hidden,color:l.color}))):i.push({label:this.getText(l.label,this.props.schema.noTranslation),value:l.value,hidden:l.hidden,color:l.color})}),Array.isArray(n)&&!this.props.schema.multiple?(this.initialValue=[...n],i.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),this.setState({value:K.DIFFERENT_VALUE,selectOptions:i})):this.setState({value:n,selectOptions:i})}_getValue(){let n=this.state.value===null||this.state.value===void 0?K.getValue(this.props.data,this.props.attr):this.state.value;return this.props.schema.multiple&&(typeof n=="string"?n=[n]:n==null&&(n=[])),n}renderItem(n,i){if(!this.state.selectOptions)return null;const l=(this.state.selectOptions||[]).filter(c=>c.hidden?this.props.custom?!this.executeCustom(c.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(c.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),v=this._getValue(),s=this.props.schema.multiple?null:l.find(c=>c.value==v);return M.createElement(N.FormControl,{variant:"standard",fullWidth:!0,sx:this.props.table!==void 0&&Ka.noMargin,id:`jsonSelect_${this.props.attr}_${this.props.index||this.props.index===0?this.props.index:""}`},this.props.schema.label?M.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,M.createElement(N.Select,{variant:"standard",error:!!n,multiple:this.props.schema.multiple,disabled:!!i,value:v||"_",renderValue:c=>this.props.schema.multiple?M.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:.5}},c.map(d=>{const o=l.find(p=>p.value===d);if(o||this.props.schema.showAllValues!==!1){const p=(o==null?void 0:o.label)||d;return M.createElement(N.Chip,{key:d,label:p})}return null})):s!=null&&s.color?M.createElement("div",{style:{color:s.color}},(s==null?void 0:s.label)===void 0?c:s.label):(s==null?void 0:s.label)===void 0?c:s.label,onChange:c=>{this.setState({value:c.target.value==="_"?"":c.target.value},()=>{let d;this.state.value===K.DIFFERENT_VALUE?d=this.onChange(this.props.attr,this.initialValue):d=this.onChange(this.props.attr,this.state.value),d instanceof Promise&&d.catch(o=>console.error(o))})}},l.map((c,d)=>c.group?M.createElement(N.ListSubheader,{key:d,style:{color:c.color}},c.label):M.createElement(N.MenuItem,{key:d,value:c.value,style:c.value===K.DIFFERENT_VALUE?{opacity:.5}:{}},this.props.schema.multiple?M.createElement(N.Checkbox,{checked:v.includes(c.value),onClick:()=>{const o=JSON.parse(JSON.stringify(this._getValue())),p=v.indexOf(c.value);p!==-1?o.splice(p,1):(o.push(c.value),o.sort()),this.setState({value:o},()=>this.onChange(this.props.attr,o))}}):null,M.createElement(N.ListItemText,{primary:c.label,style:{color:c.color}})))),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ya={menuPaper:{maxHeight:800}};class Qa extends K{initialized=!1;localContext;askInstance(){if(this.props.alive){let n=this.props.schema.data;if(n===void 0&&this.props.schema.jsonData){const i=this.getPattern(this.props.schema.jsonData,null,!0);try{n=JSON.parse(i)}catch{console.error(`Cannot parse json data: ${i}`)}}n===void 0&&(n=null),this.setState({running:!0},()=>{this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",n).then(i=>this.setState({list:i,running:!1})).catch(i=>{console.error(`Cannot send command: ${i}`)})})}else{const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n,running:!1})}}getContext(){const n={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(i=>n[i]=K.getValue(this.props.data,i)),JSON.stringify(n)}_getValue(){let n=this.state.value===null||this.state.value===void 0?K.getValue(this.props.data,this.props.attr):this.state.value;return this.props.schema.multiple&&(typeof n=="string"?n=[n]:n==null&&(n=[])),n}renderItem(n,i){var c;if(this.props.alive){const d=this.getContext();(d!==this.localContext||!this.initialized)&&(this.localContext=d,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}const l=this._getValue();if(!this.props.alive||!this.state.running&&!((c=this.state.list)!=null&&c.length))return this.props.schema.multiple||this.props.schema.manual===!1?j.I18n.t("ra_Cannot retrieve options, as instance is offline"):M.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:l,error:!!n,disabled:!!i,onChange:d=>{const o=d.target.value;this.setState({value:o},()=>this.onChange(this.props.attr,(o||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),slotProps:{input:{endAdornment:this.state.value&&!this.props.schema.noClearButton?M.createElement(N.InputAdornment,{position:"end"},M.createElement(N.IconButton,{tabIndex:-1,size:"small",onClick:()=>this.setState({value:""},()=>this.onChange(this.props.attr,""))},M.createElement(Z.Close,null))):null}}});if(this.state.running)return M.createElement(N.CircularProgress,{size:"24"});const v=this.state.list.filter(d=>d.hidden?this.props.custom?!this.executeCustom(d.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(d.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),s=v.find(d=>d.value===l);return M.createElement(N.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?M.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,M.createElement(N.Select,{variant:"standard",error:!!n,multiple:this.props.schema.multiple,disabled:!!i,sx:{"&.MuiSelect-paper":this.props.schema.multiple?Ya.menuPaper:void 0},value:l,renderValue:d=>this.props.schema.multiple?M.createElement(N.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.5}},d.map(o=>{const p=v.find(e=>e.value===o);if(p||this.props.schema.showAllValues!==!1){const e=(p==null?void 0:p.label)||o;return M.createElement(N.Chip,{key:o,label:e})}return null})):this.getText((s==null?void 0:s.label)||d,this.props.schema.noTranslation),onChange:d=>{const o=this.onChange(this.props.attr,d.target.value);o instanceof Promise&&o.catch(p=>console.error(`Cannot set value: ${p}`))}},v.map((d,o)=>d.group?M.createElement(N.ListSubheader,{key:o},this.getText(d.label,this.props.schema.noTranslation)):M.createElement(N.MenuItem,{key:o,value:d.value},this.props.schema.multiple?M.createElement(N.Checkbox,{checked:l.includes(d.value),onClick:()=>{const p=JSON.parse(JSON.stringify(this._getValue())),e=l.indexOf(d.value);e!==-1?p.splice(e,1):(p.push(d.value),p.sort()),this.setState({value:p},()=>this.onChange(this.props.attr,p))}}):null,M.createElement(N.ListItemText,{primary:d.label})))),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const yi={fullWidth:{width:"100%"}};function Qe(L){return L.split(".").reduce((n,i)=>(n<<8)+parseInt(i,10),0)>>>0}function Za(L,n){var v,s;const i=(s=(v=L==null?void 0:L.native)==null?void 0:v.hardware)==null?void 0:s.networkInterfaces;if(!i)return null;let l;return Object.keys(i).forEach(c=>i[c].forEach(d=>{d.internal||n.includes(":")&&d.family!=="IPv6"||n.includes(".")&&!n.match(/[^.\d]/)&&d.family!=="IPv4"||(d.family==="IPv4"&&!d.address.startsWith("172")&&(n==="127.0.0.0"||n==="localhost"||n.match(/[^.\d]/))?l=d.address:l||(d.family==="IPv4"&&n.includes(".")&&(Qe(n)&Qe(d.netmask),Qe(d.address)&Qe(d.netmask)),l=d.address))})),l||Object.keys(i).forEach(c=>i[c].forEach(d=>{d.internal||n.includes(":")&&d.family!=="IPv6"||n.includes(".")&&!n.match(/[^.\d]/)&&d.family!=="IPv4"||(d.family==="IPv6"&&(n==="127.0.0.0"||n==="localhost"||n.match(/[^.\d]/))?l=d.address:l||(d.family==="IPv4"&&n.includes(".")&&(Qe(n)&Qe(d.netmask),Qe(d.address)&Qe(d.netmask)),l=d.address))})),l||Object.keys(i).forEach(c=>{i[c].forEach(d=>{d.internal||n.includes(":")&&d.family!=="IPv6"||n.includes(".")&&!n.match(/[^.\d]/)&&d.family!=="IPv4"||(n==="127.0.0.0"||n==="localhost"||n.match(/[^.\d]/),l=d.address)})}),l||Object.keys(i).forEach(c=>{i[c].forEach(d=>{d.internal||(l=d.address)})}),l}class bi extends K{async componentDidMount(){var i;super.componentDidMount();let n=window.location.hostname;if(this.props.schema.openUrl){const l=await this.props.oContext.socket.getCurrentInstance(),v=await this.props.oContext.socket.getObject(`system.adapter.${l}`);if(v){const s=await this.props.oContext.socket.getObject(`system.host.${(i=v==null?void 0:v.common)==null?void 0:i.host}`);if(s){const c=Za(s,window.location.hostname);if(c)n=`${c}:${window.location.port}`;else{console.warn(`Cannot find suitable IP in host ${v.common.host} for ${v._id}`);return}}}}await new Promise(l=>{this.setState({_error:"",_message:"",hostname:n},l)}),this.props.schema.onLoaded&&this._onClick()}renderErrorDialog(){return this.state._error?M.createElement(j.DialogError,{text:this.state._error,onClose:()=>this.setState({_error:""})}):null}renderMessageDialog(){return this.state._message?M.createElement(j.DialogMessage,{text:this.state._message,onClose:()=>this.setState({_message:""})}):null}_onClick(){this.props.oContext.onCommandRunning(!0),this.setState({running:!0});const n=`${window.location.protocol}//${window.location.host}${window.location.pathname.replace(/\/index\.html$/,"")}`,i=`${window.location.protocol}//${this.state.hostname.split(":").length>3?`[${this.state.hostname}]`:this.state.hostname}${window.location.pathname.replace(/\/index\.html$/,"")}`;let l=this.props.schema.data;if(l===void 0&&this.props.schema.jsonData){const s=this.getPattern(this.props.schema.jsonData,{_origin:n,_originIp:i,...this.props.data},!0);try{l=JSON.parse(s)}catch{console.error(`Cannot parse json data: ${s}`)}}l===void 0&&(l=null),this.props.schema.openUrl&&!l&&(l={_origin:n,_originIp:i});let v;this.props.schema.timeout&&(v=setTimeout(()=>{this.props.oContext.onCommandRunning(!1),this.setState({_error:j.I18n.t("ra_Request timed out"),running:!1})},parseInt(this.props.schema.timeout,10)||1e4)),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",l).then(async s=>{var c,d,o,p,e;if(v&&(clearTimeout(v),v=void 0),s!=null&&s.error)if(this.props.schema.error&&this.props.schema.error[s.error]){let t=this.getText(this.props.schema.error[s.error]);(c=s.args)==null||c.forEach(r=>t=t.replace("%s",r)),this.setState({_error:t})}else this.setState({_error:s.error?typeof s.error=="string"?j.I18n.t(s.error):JSON.stringify(s.error):j.I18n.t("ra_Error")});else{if(s!=null&&s.command){(o=(d=this.props.oContext).onBackEndCommand)==null||o.call(d,s.command);return}if(s!=null&&s.reloadBrowser&&this.props.schema.reloadBrowser)window.location.reload();else if(s!=null&&s.openUrl&&this.props.schema.openUrl)window.open(s.openUrl,s.window||this.props.schema.window||"_blank");else if(s!=null&&s.result&&((p=this.props.schema.result)!=null&&p[s.result])){let t=this.getText(this.props.schema.result[s.result]);(e=s.args)==null||e.forEach(r=>t=t.replace("%s",r)),window.alert(t)}if(s!=null&&s.native&&this.props.schema.useNative){for(const[t,r]of Object.entries(s.native))await this.onChangeAsync(t,r);setTimeout(()=>this.props.oContext.forceUpdate(Object.keys(s.native),this.props.data),300)}else s!=null&&s.result?window.alert(typeof s.result=="object"?JSON.stringify(s.result):s.result):window.alert(j.I18n.t("ra_Ok"));s!=null&&s.saveConfig&&this.props.onChange(null,null,null,!0)}}).catch(s=>{this.props.schema.error&&this.props.schema.error[s.toString()]?this.setState({_error:this.getText(this.props.schema.error[s.toString()])}):this.setState({_error:j.I18n.t(s.toString())||j.I18n.t("ra_Error")})}).then(()=>{this.props.oContext.onCommandRunning(!1),this.setState({running:!1})})}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const n=this.state.confirmData||this.props.schema.confirm;let i=null;return n.type==="warning"?i=M.createElement(Z.Warning,null):n.type==="error"?i=M.createElement(Z.Error,null):n.type==="info"&&(i=M.createElement(Z.Info,null)),M.createElement(j.DialogConfirm,{title:this.getText(n.title)||j.I18n.t("ra_Please confirm"),text:this.getText(n.text),ok:this.getText(n.ok)||j.I18n.t("ra_Ok"),cancel:this.getText(n.cancel)||j.I18n.t("ra_Cancel"),icon:i||void 0,onClose:l=>this.setState({confirmDialog:!1},()=>l&&this._onClick())})}renderItem(n,i){const l=this.getIcon();return M.createElement("div",{style:yi.fullWidth},M.createElement(N.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:{...yi.fullWidth,...this.props.schema.controlStyle||void 0},disabled:i||!this.props.alive,startIcon:l,title:this.props.alive?this.getText(this.props.schema.title)||"":j.I18n.t("ra_Instance is not alive"),onClick:()=>{this.props.schema.confirm?this.setState({confirmDialog:!0}):this._onClick()}},this.props.schema.showProcess&&this.state.running?M.createElement(N.CircularProgress,{size:20,style:{marginRight:8}}):null,this.getText(this.props.schema.label,this.props.schema.noTranslation)),this.renderErrorDialog(),this.renderMessageDialog())}}const Xa={fullWidth:{width:"100%"}};class qa extends K{async _onClick(){var l,v;let n=this.props.schema.val;if(typeof n=="string"&&n.includes("${")){n=this.getPattern(n,null,!0);const s=await this.props.oContext.socket.getObject(this.props.schema.id);((l=s==null?void 0:s.common)==null?void 0:l.type)==="number"?n=parseFloat(n):((v=s==null?void 0:s.common)==null?void 0:v.type)==="boolean"&&(n=n==="true"||n===!0||n==="1"||n===1)}const i=(this.props.schema.id||"").replace(/%INSTANCE%/g,(this.props.oContext.instance||0).toString());try{await this.props.oContext.socket.setState(i,{val:n,ack:!!this.props.schema.ack}),this.props.schema.okText&&window.alert(this.getText(this.props.schema.okText))}catch(s){this.props.schema.error&&this.props.schema.error[s.toString()]?window.alert(this.getText(this.props.schema.error[s.toString()])):window.alert(j.I18n.t(s.toString())||j.I18n.t("ra_Error"))}}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const n=this.state.confirmData||this.props.schema.confirm;let i=null;return n.type==="warning"?i=M.createElement(Z.Warning,null):n.type==="error"?i=M.createElement(Z.Error,null):n.type==="info"&&(i=M.createElement(Z.Info,null)),M.createElement(j.DialogConfirm,{title:this.getText(n.title)||j.I18n.t("ra_Please confirm"),text:this.getText(n.text),ok:this.getText(n.ok)||j.I18n.t("ra_Ok"),cancel:this.getText(n.cancel)||j.I18n.t("ra_Cancel"),icon:i,onClose:l=>this.setState({confirmDialog:!1},()=>l&&this._onClick())})}renderItem(n,i){const l=this.getIcon();return M.createElement(N.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:Xa.fullWidth,disabled:i,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0}):await this._onClick()},startIcon:l||void 0},this.getText(this.props.schema.label,this.props.schema.noTranslation))}}const wi={fullWidth:{width:"100%"},slider:{marginLeft:10,marginRight:10,width:"calc(100% - 20px)"}};class el extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({_value:n})}static getDerivedStateFromProps(n,i){if(n.schema.min!==void 0&&n.schema.min<0||n.schema.max!==void 0&&n.schema.max<0)return null;const l=K.getValue(n.data,n.attr);return l==null||l.toString()!==parseFloat(i._value).toString()?{_value:l}:null}renderItem(n,i){const l=this.props.schema.min||0,v=this.props.schema.max||100,s=this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):"",c=[{value:l,label:l+s},{value:v,label:v+s}];return M.createElement(N.Box,{style:wi.fullWidth},this.props.schema.label?M.createElement(N.Typography,{gutterBottom:!0},this.getText(this.props.schema.label)):null,M.createElement(N.Slider,{style:wi.slider,value:this.state._value,getAriaValueText:d=>d+s,step:this.props.schema.step||(v-l)/100,valueLabelDisplay:"auto",marks:c,min:l,max:v,disabled:!!i,onChange:d=>{const o=d.target.value;this.setState({_value:o},()=>this.onChange(this.props.attr,o))}}),this.props.schema.help?M.createElement(N.Typography,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}function Ze(L,n){return L==="edit"||L==="rename"?M.createElement(Z.Edit,{style:n}):L==="delete"?M.createElement(Z.Delete,{style:n}):L==="refresh"?M.createElement(Z.Refresh,{style:n}):L==="newDevice"||L==="new"||L==="add"?M.createElement(Z.Add,{style:n}):L==="discover"||L==="search"?M.createElement(Z.Search,{style:n}):L==="unpairDevice"||L==="unpair"?M.createElement(Z.LinkOff,{style:n}):L==="pairDevice"||L==="pair"?M.createElement(Z.Link,{style:n}):L==="identify"?M.createElement(Z.NotListedLocation,{style:n}):L==="play"?M.createElement(Z.PlayArrow,{style:n}):L==="stop"?M.createElement(Z.Stop,{style:n}):L==="pause"?M.createElement(Z.Pause,{style:n}):L==="forward"||L==="next"?M.createElement(Z.FastForward,{style:n}):L==="rewind"||L==="previous"?M.createElement(Z.FastRewind,{style:n}):L==="lamp"||L==="light"?M.createElement(Z.Lightbulb,{style:n}):L==="backlight"?M.createElement(Z.Fluorescent,{style:n}):L==="dimmer"?M.createElement(Z.WbIncandescent,{style:n}):L==="socket"?M.createElement(Z.Power,{style:n}):L==="settings"?M.createElement(Z.Settings,{style:n}):L==="users"||L==="group"?M.createElement(Z.Group,{style:n}):L==="user"?M.createElement(Z.Person,{style:n}):L==="qrcode"?M.createElement(Z.QrCode,{style:n}):L==="connection"?M.createElement(Z.Wifi,{style:n}):L==="no-connection"?M.createElement(Z.WifiOff,{style:n}):L==="visible"?M.createElement(Z.Visibility,{style:n}):null}function tl(L,n){return typeof n=="string"?{"@keyframes newStateAnimationOnceColor":{"0%":{color:n},"100%":{color:L.palette.mode==="dark"?"#fff":"#000"}},animation:"newStateAnimationOnceColor 2s ease-in-out"}:{"@keyframes newStateAnimationOnce":{"0%":{color:"#00f900"},"80%":{color:L.palette.mode==="dark"?"#518851":"#008000"},"100%":{color:L.palette.mode==="dark"?"#fff":"#000"}},animation:"newStateAnimationOnce 2s ease-in-out"}}class nl extends K{controlTimeout=null;delayedUpdate={timer:null,value:null};getObjectID(){let n=this.props.schema.oid;return n.includes("${")&&(n=this.getPattern(n,null,!0)),this.props.schema.foreign?n:`${this.props.schema.system?"system.adapter.":""}${this.props.oContext.adapterName}.${this.props.oContext.instance||0}.${n}`}async componentDidMount(){var l,v;super.componentDidMount();const n=await this.props.oContext.socket.getObject(this.getObjectID());if((l=n==null?void 0:n.common)!=null&&l.states&&!this.props.schema.options){if(Array.isArray((v=n==null?void 0:n.common)==null?void 0:v.states)){const s={};n.common.states.forEach((c,d)=>{s[d.toString()]=c}),n.common.states=s}Object.keys(n.common.states).length||(n.common.states=void 0)}const i=this.props.schema.control||this.detectType(n);try{const s=await this.props.oContext.socket.getState(this.getObjectID());this.setState({stateValue:s?s.val:null,controlType:i,obj:n},async()=>{await this.props.oContext.socket.subscribeState(this.getObjectID(),this.onStateChanged)})}catch(s){console.error(`Cannot get state ${this.getObjectID()}: ${s}`),this.setState({controlType:i,obj:n})}}componentWillUnmount(){super.componentWillUnmount(),this.props.oContext.socket.unsubscribeState(this.getObjectID(),this.onStateChanged),this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null),this.controlTimeout&&(clearTimeout(this.controlTimeout),this.controlTimeout=null,this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1).catch(n=>console.error(`Cannot control value: ${n.toString()}`)))}onStateChanged=(n,i)=>{let l=i?i.val:null;this.state.controlType==="button"||this.state.controlType==="switch"?(l=!!l,this.state.stateValue!==l&&this.setState({stateValue:l})):l!==null&&(this.state.controlType==="slider"||this.state.controlType==="number")?(l=parseFloat(l),console.log(`${Date.now()} Received new value: ${l}`),l!==this.state.stateValue?(this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null),this.delayedUpdate.value=l,this.delayedUpdate.timer=setTimeout(()=>{this.setState({stateValue:this.delayedUpdate.value})},500)):this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null)):this.state.stateValue.toString()!==l.toString()&&this.setState({stateValue:l})};detectType(n){if(n||={},n.common||={},n.common.type==="boolean"){if(this.props.schema.controlled!==!1){if(n.common.read===!1||this.props.schema.controlled===!0)return"button";if(n.common.write||this.props.schema.controlled===!0)return"switch"}return"text"}return n.common.type==="number"&&this.props.schema.controlled!==!1?n.common.write||this.props.schema.controlled===!0?n.common.states||this.props.schema.options?"select":n.common.max!==void 0?"slider":"input":"text":n.common.write&&this.props.schema.controlled!==!1?n.common.states||this.props.schema.options?"select":"input":"text"}getNormalizedStates(){let n;return this.props.schema.options?n=this.props.schema.options.map(i=>typeof i=="string"?{value:i,label:this.getText(i,this.props.schema.noTranslation)}:{value:i.value,label:this.getText(i.label,this.props.schema.noTranslation),color:i.color}):this.state.obj.common.states?(n=[],Object.keys(this.state.obj.common.states).forEach(i=>{n.push({value:i,label:this.getText(this.state.obj.common.states[i],this.props.schema.noTranslation)})})):n=[],n}renderItem(n,i){var v,s,c,d,o;if(!this.state.obj)return null;let l;if(this.state.controlType==="select"||!this.state.controlType&&(this.state.obj.common.type==="number"||this.state.obj.common.type==="string")&&this.state.obj.common.write!==!1&&(this.props.schema.options||this.state.obj.common.states)){const p=this.getNormalizedStates(),e=p.find(t=>t.value===this.state.stateValue);l=M.createElement(N.FormControl,{fullWidth:!0},M.createElement(N.InputLabel,null,"$",this.getText(this.props.schema.label)),M.createElement(N.Select,{value:this.state.stateValue,disabled:!!this.props.schema.readOnly||i,onChange:t=>{this.setState({stateValue:t.target.value},()=>{let r=this.state.stateValue;this.state.obj.common.type==="number"&&(r=parseFloat(r.toString().replace(",","."))),this.props.oContext.socket.setState(this.getObjectID(),r,!1)})},renderValue:t=>e!=null&&e.color?M.createElement("div",{style:{color:e.color}},e.label):t},p.map(t=>M.createElement(N.MenuItem,{key:(t.value??"").toString(),value:t.value,style:{color:t.color}},"$",t.label))))}else if(this.state.controlType==="button"||!this.state.controlType&&this.state.obj.common.type==="boolean"&&(this.state.obj.common.write&&this.state.obj.common.read===!1||(v=this.state.obj.common.role)!=null&&v.includes("button"))){let p=null;this.props.schema.falseImage&&(p=Ze(this.props.schema.falseImage));const e=this.getText(this.props.schema.falseText||this.props.schema.label,this.props.schema.noTranslation);!e&&p?l=M.createElement(N.IconButton,{style:this.props.schema.falseTextStyle,disabled:!!this.props.schema.readOnly,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async t=>{t&&await this.props.oContext.socket.setState(this.getObjectID(),this.props.schema.buttonValue!==void 0?this.props.schema.buttonValue:!0,!1)}}):await this.props.oContext.socket.setState(this.getObjectID(),this.props.schema.buttonValue!==void 0?this.props.schema.buttonValue:!0,!1)}},p):l=M.createElement(N.Button,{variant:this.props.schema.variant||"contained",startIcon:p,style:this.props.schema.falseTextStyle,disabled:i||!!this.props.schema.readOnly,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async t=>{t&&await this.props.oContext.socket.setState(this.getObjectID(),this.props.schema.buttonValue!==void 0?this.props.schema.buttonValue:!0,!1)}}):await this.props.oContext.socket.setState(this.getObjectID(),this.props.schema.buttonValue!==void 0?this.props.schema.buttonValue:!0,!1)}},e||this.getObjectID().split(".").pop())}else if(this.state.controlType==="input"||!this.state.controlType&&this.state.obj.common.write&&this.state.obj.common.type==="string")l=M.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:8,alignItems:"baseline"}},M.createElement(N.TextField,{style:{flex:1},value:this.state.stateValue,variant:"standard",disabled:!!this.props.schema.readOnly||i,slotProps:{input:{endAdornment:this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||void 0},htmlInput:{readOnly:!!this.props.schema.readOnly}},onKeyUp:p=>{this.props.schema.setOnEnterKey&&p.key==="Enter"&&this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1)},onChange:p=>{this.setState({stateValue:p.target.value},()=>{this.props.schema.setOnEnterKey||this.props.schema.showEnterButton||(this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(async()=>{this.controlTimeout=null;let e=this.state.stateValue;this.state.obj.common.type==="number"&&(e=parseFloat(e.toString().replace(",","."))),await this.props.oContext.socket.setState(this.getObjectID(),e,!1)},this.props.schema.controlDelay||0))})},label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}),this.props.schema.showEnterButton&&!this.props.schema.readOnly&&M.createElement(N.Button,{variant:"outlined",disabled:i,onClick:()=>{this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1)}},this.getText(typeof this.props.schema.showEnterButton=="string"?this.props.schema.showEnterButton:"Set")));else{let p;this.props.schema.size==="normal"?p=16:this.props.schema.size==="large"?p=20:typeof this.props.schema.size=="number"&&(p=this.props.schema.size);let e=this.getText(this.props.schema.label,this.props.schema.noTranslation);const t={display:"flex",alignItems:"center",fontSize:p||"1rem",gap:8};this.props.schema.narrow||(t.width="100%",t.justifyContent="space-between"),e.trim()&&!e.trim().endsWith(":")&&this.props.schema.addColon&&(e=`${e.trim()}:`);let r;this.props.schema.blinkOnUpdate&&(r=tl(this.props.oContext.theme,this.props.schema.blinkOnUpdate));let h;this.props.schema.labelIcon&&(h=M.createElement(j.Icon,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let a;if(e&&h?a=M.createElement("div",{style:{whiteSpace:"nowrap"}},h,e):e?a=M.createElement("div",{style:{whiteSpace:"nowrap"}},e):h&&(a=h),this.state.controlType==="switch"||!this.state.controlType&&this.state.obj.common.type==="boolean"&&(this.state.obj.common.write&&this.state.obj.common.read!==!1||(s=this.state.obj.common.role)!=null&&s.includes("switch"))){let u=null;const f=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(u=Ze(this.props.schema.falseImage,f?{marginLeft:8}:void 0));let m=null;const y=this.getText(this.props.schema.trueText,this.props.schema.noTranslation);this.props.schema.trueImage&&(m=Ze(this.props.schema.trueImage,y?{marginRight:8}:void 0)),l=M.createElement(N.Switch,{checked:!!this.state.stateValue,disabled:!!this.props.schema.readOnly||i,onChange:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async x=>{x&&await this.props.oContext.socket.setState(this.getObjectID(),!this.state.stateValue,!1)}}):await this.props.oContext.socket.setState(this.getObjectID(),!this.state.stateValue,!1)}}),(f||u||y||m)&&(l=M.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:14}},M.createElement("span",{style:this.props.schema.falseTextStyle},f,u),l,M.createElement("span",{style:this.props.schema.trueTextStyle},m,y))),a&&(l=M.createElement("div",{style:t},a,l))}else if(this.state.controlType==="slider"||!this.state.controlType&&this.state.obj.common.type==="number"&&(this.state.obj.common.write&&(this.state.obj.common.max!==void 0||this.state.obj.common.unit==="%")||(c=this.state.obj.common.role)!=null&&c.includes("slider")||(d=this.state.obj.common.role)!=null&&d.includes("dimmer")||(o=this.state.obj.common.role)!=null&&o.includes("blind"))){let u=null;const f=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(u=Ze(this.props.schema.falseImage,f?{marginLeft:8}:void 0));let m=null;const y=this.getText(this.props.schema.trueText,this.props.schema.noTranslation);this.props.schema.trueImage&&(m=Ze(this.props.schema.trueImage,y?{marginRight:8}:void 0));const x=this.props.schema.min===void 0?this.state.obj.common.min||0:this.props.schema.min,E=this.props.schema.max===void 0?this.state.obj.common.max===void 0?100:this.state.obj.common.max:this.props.schema.max,b=this.props.schema.step===void 0?this.state.obj.common.step||1:this.props.schema.step;l=M.createElement(N.Slider,{style:{width:"100%",flexGrow:1},min:x,max:E,disabled:!!this.props.schema.readOnly||i,step:b,value:this.state.stateValue,valueLabelDisplay:"auto",valueLabelFormat:g=>`${g}${this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||""}`,onChange:(g,S)=>{this.setState({stateValue:S},()=>{this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(async()=>{console.log(`${Date.now()} Send new value: ${this.state.stateValue}`),this.controlTimeout=null,await this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1)},this.props.schema.controlDelay||0)})}}),(f||u||y||m)&&(l=M.createElement("div",{style:{display:"flex",width:"100%",flexGrow:1,alignItems:"center"}},M.createElement("span",{style:{marginRight:16,...this.props.schema.falseTextStyle}},f,u),l,M.createElement("span",{style:{marginLeft:16,...this.props.schema.trueTextStyle}},m,y))),a&&(l=M.createElement("div",{style:t},a,l))}else if(this.state.obj.common.type==="number"&&this.state.obj.common.write&&!this.state.controlType){const u=this.props.schema.min===void 0?this.state.obj.common.min===void 0?void 0:this.state.obj.common.min:this.props.schema.min,f=this.props.schema.max===void 0?this.state.obj.common.max===void 0?void 0:this.state.obj.common.max:this.props.schema.max,m=this.props.schema.step===void 0?this.state.obj.common.step===void 0?void 0:this.state.obj.common.step:this.props.schema.step;l=M.createElement(N.TextField,{variant:"standard",style:{width:"100%"},value:this.state.stateValue,type:"number",disabled:!!this.props.schema.readOnly||i,slotProps:{htmlInput:{min:u,max:f,step:m,readOnly:!!this.props.schema.readOnly},input:{endAdornment:this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||void 0}},onChange:y=>{this.setState({stateValue:y.target.value},()=>{this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(async()=>{this.controlTimeout=null;const x=parseFloat(this.state.stateValue);await this.props.oContext.socket.setState(this.getObjectID(),x,!1)},this.props.schema.controlDelay||0)})},label:this.getText(this.props.schema.label,this.props.schema.noTranslation),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}else if(this.state.obj.common.type==="boolean"){let u=null,f,m;this.state.stateValue?(f=this.getText(this.props.schema.trueText,this.props.schema.noTranslation),this.props.schema.trueImage&&(u=Ze(this.props.schema.falseImage,f?{marginRight:8}:void 0)),m=this.props.schema.trueTextStyle):(f=this.getText(this.props.schema.falseText,this.props.schema.noTranslation),this.props.schema.falseImage&&(u=Ze(this.props.schema.falseImage,f?{marginLeft:8}:void 0)),m=this.props.schema.falseTextStyle),m=Object.assign(t,m),l=M.createElement("div",{style:m},a,M.createElement(N.Box,{style:{display:"flex",alignItems:"center",gap:8},sx:r,key:this.props.schema.blinkOnUpdate?f:void 0},u,f||(this.state.stateValue?j.I18n.t("ra_true"):j.I18n.t("ra_false"))))}else{const u=this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit;let f=this.state.stateValue;if(f!=null&&(this.props.schema.options||this.state.obj.common.states)){const E=this.getNormalizedStates().find(b=>b.value===f);E&&(f=E.label)}let m,y;this.state.controlType==="html"?(y=(f||"").toString(),m=M.createElement("span",{dangerouslySetInnerHTML:{__html:f}})):this.state.stateValue===null?(m="null",y=m):this.state.stateValue===void 0?(m="undefined",y=m):(m=f.toString(),y=m),l=M.createElement("div",{style:t},a,M.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:4}},M.createElement(N.Box,{sx:r,key:this.props.schema.blinkOnUpdate?y:void 0},m),u?M.createElement("span",{style:{opacity:.7,fontSize:"smaller"}},u):null))}}return l}}const Cn={fullWidth:L=>({width:"100%",backgroundColor:L.palette.mode==="dark"?"#FFF":"#000",borderStyle:"hidden"}),primary:L=>({backgroundColor:L.palette.primary.main}),secondary:L=>({backgroundColor:L.palette.secondary.main})};class il extends K{renderItem(){return M.createElement(N.Box,{component:"hr",sx:j.Utils.getStyle(this.props.oContext.theme,Cn.fullWidth,this.props.schema.color==="primary"?Cn.primary:this.props.schema.color==="secondary"?Cn.secondary:{backgroundColor:this.props.schema.color||(this.props.oContext.themeType==="dark"?"#333":"#ddd")},{height:this.props.schema.color?this.props.schema.height||2:this.props.schema.height||1})})}}const rl={header:L=>({width:"100%",background:L.palette.primary.main,color:L.palette.primary.contrastText,padding:"4px !important",borderRadius:"3px",marginBlockEnd:0,marginBlockStart:0})};class sl extends K{renderItem(){let n="h5";switch((this.props.schema.size||5).toString()){case"1":n="h1";break;case"2":n="h2";break;case"3":n="h3";break;case"4":n="h4";break;case"5":default:n="h5";break}return M.createElement(N.Box,{component:n,sx:rl.header},this.getText(this.props.schema.label||this.props.schema.text,this.props.schema.noTranslation))}}class ol extends K{renderItem(){let n=this.props.schema.src;return n&&!n.startsWith(".")&&!n.startsWith("http")&&!n.startsWith(`adapter/${this.props.oContext.adapterName}/`)&&!n.startsWith(`./adapter/${this.props.oContext.adapterName}/`)&&(n=`adapter/${this.props.oContext.adapterName}/${n}`),M.createElement("img",{src:n,style:{cursor:this.props.schema.href?"pointer":void 0,width:"100%",height:"100%"},onClick:this.props.schema.href?()=>this.props.schema.href&&window.open(this.props.schema.href,"_blank"):null,alt:""})}}function Ci(L,n,i){return typeof i=="string"?{"@keyframes newValueAnimationOnceColor":{"0%":{color:n?`${i} !important`:i},"100%":{color:L.palette.mode==="dark"?n?"#fff !important":"#fff":n?"#000 !important":"#000"}},animation:"newValueAnimationOnceColor 2s ease-in-out"}:{"@keyframes newValueAnimationOnce":{"0%":{color:n?"#00f900 !important":"#00f900"},"80%":{color:L.palette.mode==="dark"?n?"#518851 !important":"#518851":n?"#008000 !important":"#008000"},"100%":{color:L.palette.mode==="dark"?n?"#fff !important":"#fff":n?"#000 !important":"#000"}},animation:"newValueAnimationOnce 2s ease-in-out"}}function Ei(L,n){return typeof n=="string"?{"@keyframes blinkAnimationColor":{"0%":{color:n},"100%":{color:L.palette.mode==="dark"?"#fff":"#000"}},animation:"blinkAnimationColor 2s ease-in-out infinite"}:{"@keyframes blinkAnimation":{"0%":{color:"#00f900"},"80%":{color:L.palette.mode==="dark"?"#518851":"#008000"},"100%":{color:L.palette.mode==="dark"?"#fff":"#000"}},animation:"blinkAnimation 2s ease-in-out infinite"}}const yt={label:{fontWeight:"bold",whiteSpace:"nowrap"},valueImage:{maxHeight:"100%"},valueAndUnit:{display:"flex",gap:4,alignItems:"baseline"},value:{},unit:{fontSize:"smaller",opacity:.7}};class al extends K{renderItem(n){let i=this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation);this.props.schema.addColon&&typeof i=="string"&&!i.trim().endsWith(":")&&(i=`${i.trim()}:`),i&&(i.includes("<a ")||i.includes("<br")||i.includes("<b>")||i.includes("<i>"))&&(i=j.Utils.renderTextWithA(i));let l;this.props.schema.size==="normal"?l=16:this.props.schema.size==="large"?l=20:typeof this.props.schema.size=="number"&&(l=this.props.schema.size);const v={width:"100%",height:"100%",display:"flex",alignItems:"center",position:"relative",fontSize:l};this.props.schema.narrow?v.gap=8:v.justifyContent="space-between";let s,c;this.props.schema.data&&typeof this.props.schema.data=="object"&&this.props.schema.data.en?c=this.getText(this.props.schema.data):typeof this.props.schema.data=="object"||this.props.schema.data===void 0||this.props.schema.data===null?c=JSON.stringify(this.props.schema.data):typeof this.props.schema.data=="number"?(c=this.props.schema.data.toString(),this.props.oContext.isFloatComma&&(c=c.replace(".",","))):(!this.props.schema.booleanAsCheckbox||typeof this.props.schema.data!="boolean")&&(c=this.props.schema.data.toString());let d=!1;if(this.props.schema.booleanAsCheckbox&&typeof this.props.schema.data=="boolean")s=M.createElement(N.Checkbox,{checked:!!s,disabled:!0,size:this.props.schema.size==="small"?"small":this.props.schema.size==="large"?"large":void 0});else if(c.startsWith("data:image/"))s=M.createElement("div",{style:{...yt.value,...yt.valueImage,...this.props.schema.styleValue||void 0}},M.createElement(j.Icon,{src:c}));else{const t={...yt.value,...this.props.schema.styleValue||void 0};this.props.schema.html?s=M.createElement("div",{style:t,dangerouslySetInnerHTML:{__html:c}}):Array.isArray(this.props.schema.data)?(d=!0,s=M.createElement("div",{style:t},this.props.schema.data.map((r,h)=>M.createElement("div",{key:h},typeof r=="object"||r===null||r===void 0?JSON.stringify(r):r)))):c.includes(`
|
|
1397
|
-
`)?(d=!0,s=M.createElement("div",{style:t},j.Utils.renderTextWithA(c))):s=M.createElement("div",{style:t},c)}if(this.props.schema.blinkOnUpdate&&this.props.schema.blink){const t=Ci(this.props.oContext.theme,!0,this.props.schema.blinkOnUpdate),r=Ei(this.props.oContext.theme,this.props.schema.blink);s=M.createElement(N.Box,{key:c,sx:{...t,...r}},s)}else if(this.props.schema.blinkOnUpdate){const t=Ci(this.props.oContext.theme,!1,this.props.schema.blinkOnUpdate);s=M.createElement(N.Box,{key:c,sx:t},s)}else if(this.props.schema.blink){const t=Ei(this.props.oContext.theme,this.props.schema.blink);s=M.createElement(N.Box,{sx:t},s)}this.props.schema.unit&&(s=M.createElement("div",{style:yt.valueAndUnit},s,M.createElement("div",{style:{...yt.unit,...this.props.schema.styleUnit||void 0}},this.getText(this.props.schema.unit,this.props.schema.noTranslation))));let o;this.props.schema.labelIcon&&(o=M.createElement(j.Icon,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let p;this.props.schema.copyToClipboard&&(p=M.createElement(Z.ContentCopy,{className:"staticCopyButton",style:{position:"absolute",top:"calc(50% - 12px)",right:0,cursor:"pointer"},onClick:()=>{j.Utils.copyToClipboard(c),window.alert(j.I18n.t("ra_Copied"))}}));const e={"& .staticCopyButton":{display:"none"},"& .staticCopyButton:action":{transform:"scale(0.9)"},"&:hover .staticCopyButton":{display:"block"}};return this.props.schema.highlight&&(e["&:hover"]={backgroundColor:this.props.oContext.themeType==="dark"?"#51515180":"#b8b8b880"}),d&&(v.alignItems="top"),M.createElement(N.Box,{component:"div",style:v,sx:e},M.createElement("div",{style:{...yt.label,...this.props.schema.styleLabel||void 0}},o,i),s,p)}}const Si={fullWidth:{height:"100%",width:"100%"},link:L=>({textDecoration:"underline",color:L.palette.mode==="dark"?"#4dabf5":"#254e72",cursor:"pointer"})};function Di(L,n,i){let l,v="";L?L.toString().startsWith("#")||L.toString().startsWith("/")?(l=n||"_self",v=L):L.startsWith("http://")||L.startsWith("https://")?(l=n||"_blank",v=L):(v=`#tab-instances/config/${i}/${L}`,l=n||"_self"):(v=`#tab-instances/config/${i}`,l=n||"_self"),l==="_self"?setTimeout(s=>{s.startsWith("#")?window.location.hash=s:s.startsWith("/")?v=`${window.location.protocol}:${window.location.host}${v}`:(s.startsWith("http://")||s.startsWith("https://"))&&(window.location.href=s)},100,v):(v.startsWith("#")?v=`${window.location.protocol}:${window.location.host}${window.location.pathname}${v}`:v.startsWith("/")&&(v=`${window.location.protocol}:${window.location.host}${v}`),window.open(v,l))}class xi extends K{renderItem(n,i){if(this.props.schema.button){const v=this.getIcon();return M.createElement(N.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:{...Si.fullWidth,...this.props.schema.controlStyle||void 0},disabled:i,startIcon:v,onClick:this.props.schema.href?()=>{const s=this.props.schema.href?this.getText(this.props.schema.href,!0):null;s&&(this.props.oContext.onBackEndCommand?this.props.oContext.onBackEndCommand({command:"link",url:s,target:this.props.schema.target,close:this.props.schema.close}):Di(s,this.props.schema.target,`${this.props.oContext.adapterName}.${this.props.oContext.instance}`))}:null},this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation))}let l=this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation);return l&&(l.includes("<a ")||l.includes("<br")||l.includes("<b>")||l.includes("<i>"))&&(l=j.Utils.renderTextWithA(l)),M.createElement(N.Box,{component:"span",style:{...this.props.schema.controlStyle||void 0},sx:this.props.schema.href?Si.link:void 0,onClick:this.props.schema.href?()=>{const v=this.props.schema.href?this.getText(this.props.schema.href,!0):null;v&&(this.props.oContext.onBackEndCommand?this.props.oContext.onBackEndCommand({command:"link",url:v,target:this.props.schema.target||"_blank",close:this.props.schema.close}):Di(v,this.props.schema.target||"_blank",`${this.props.oContext.adapterName}.${this.props.oContext.instance}`))}:null},l)}}const En=1024*1024,he={paper:{width:"100%",marginBottom:16,backgroundColor:"rgba(255, 255, 255, 0.1)"},headerText:{width:"100%"},table:{minWidth:750},label:{display:"flex",justifyContent:"space-between"},title:{flex:"1 1 100%"},rootTool:{paddingLeft:16,paddingRight:8},silver:{opacity:.2},flex:{display:"flex",alignItems:"baseline"},filteredOut:{padding:10,display:"flex",textAlign:"center"},buttonEmpty:{width:34,display:"inline-block"},buttonCell:{whiteSpace:"nowrap"},dropZone:{width:"100%",height:100,position:"relative"},dropZoneEmpty:{},uploadDiv:{position:"relative",width:"100%",minHeight:300,opacity:.9,marginTop:30,cursor:"pointer",outline:"none"},uploadDivDragging:{opacity:1,background:"rgba(128,255,128,0.1)"},uploadCenterDiv:{margin:5,border:"3px dashed grey",borderRadius:5,width:"calc(100% - 10px)",height:"calc(100% - 10px)",minHeight:300,position:"relative",display:"flex"},uploadCenterIcon:{paddingTop:10,width:48,height:48},uploadCenterText:{fontSize:16},uploadCenterTextAndIcon:{textAlign:"center",position:"absolute",top:0,bottom:0,left:0,right:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},tooltip:{pointerEvents:"none"}};function ll(L,n,i){n=n||"key";const l=[];return Object.keys(L).forEach(v=>{const s={};s[n]=v,i?(s[i]=L[v],l.push(s)):l.push(Object.assign(s,L[v]))}),l}function Ai(L,n,i){n=n||"key";const l={};return L.forEach(v=>{let s=v[n];s==null&&(s=""),delete v[n],i?l[s]=v[i]:l[s]=v}),l}function hl(L,n){let i="";for(let l=0;l<n.length;l++)i+=String.fromCharCode(L[l%L.length].charCodeAt(0)^n.charCodeAt(l));return i}function cl(L,n){let i="";for(let l=0;l<n.length;l++)i+=String.fromCharCode(L[l%L.length].charCodeAt(0)^n.charCodeAt(l));return i}class Ie extends K{filterRefs;typingTimer=null;resizeTimeout=null;secret="Zgfr56gFe87jJOM";refDiv;constructor(n){super(n),this.filterRefs={},this.props.schema.items=this.props.schema.items||[],this.props.schema.items.forEach(i=>{i.filter&&(this.filterRefs[i.attr]=qe.createRef())}),this.refDiv=M.createRef()}async componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr)||[];let i;if(this.props.schema.objKeyName?i=ll(n,this.props.schema.objKeyName,this.props.schema.objValueName):i=n,Array.isArray(i)||(i=[]),this.props.schema.encryptedAttributes){const l=await this.props.oContext.socket.getCompactSystemConfig();this.secret=(l==null?void 0:l.native.secret)||this.secret,n.forEach(v=>{this.props.schema.encryptedAttributes.forEach(s=>{v[s]&&(v[s]=cl(this.secret,v[s]))})})}this.setState({value:i,visibleValue:null,orderBy:"",order:"asc",iteration:0,filterOn:[],width:0},()=>this.validateUniqueProps())}componentWillUnmount(){this.typingTimer&&(clearTimeout(this.typingTimer),this.typingTimer=null),this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null),super.componentWillUnmount()}itemTable(n,i,l){var d;const{schema:v}=this.props,s=(d=v.items)==null?void 0:d.find(o=>o.attr===n);if(!s)return null;const c={items:{[n]:s}};return M.createElement(ft,{oContext:this.props.oContext,alive:this.props.alive,arrayIndex:l,changed:this.props.changed,common:this.props.common,expertMode:this.props.expertMode,custom:!0,data:i,globalData:this.props.data,index:l+this.state.iteration,onChange:(o,p)=>{const e=JSON.parse(JSON.stringify(this.state.value));e[l][o]=p,this.setState({value:e},()=>{this.validateUniqueProps(),this.onChangeWrapper(e,!0)})},onError:(o,p)=>this.onError(o,p),originalData:this.props.originalData,schema:c,table:!0,themeName:this.props.themeName})}validateUniqueProps(){if(this.props.schema.uniqueColumns)for(const n of this.props.schema.uniqueColumns){const i=[];this.state.value.find(v=>{const s=v[n];return i.includes(s)?(this.onError(n,"is not unique"),this.setState({errorMessage:j.I18n.t('Non-allowed duplicate entry "%s" in column "%s"',s,n)}),!0):(i.push(s),!1)})||(this.onError(n,null),this.setState({errorMessage:""}))}}static descendingComparator(n,i,l){return i[l]<n[l]?-1:i[l]>n[l]?1:0}static getComparator(n,i){return n==="desc"?(l,v)=>Ie.descendingComparator(l,v,i):(l,v)=>-Ie.descendingComparator(l,v,i)}static getFilterValue(n){var i,l,v;return(v=(l=(i=n==null?void 0:n.current)==null?void 0:i.children[0])==null?void 0:l.children[0])==null?void 0:v.value}static setFilterValue(n,i){return n.current.children[0].children[0].value=i}handleRequestSort=(n,i=!1)=>{const{order:l,orderBy:v}=this.state,c=i?l:v===n&&l==="asc"?"desc":"asc",d=this.stableSort(c,n);JSON.stringify(d)!==JSON.stringify(this.state.value)&&this.setState({value:d,order:c,orderBy:n,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,d))};stableSort=(n,i)=>{const{value:l}=this.state,v=Ie.getComparator(n,i),s=l.map((c,d)=>({el:c,index:d}));return s.sort((c,d)=>{const o=v(c.el,d.el);return o!==0?o:c.index-d.index}),s.map(c=>c.el)};renderShowHideFilter(n){return n.filter?M.createElement(N.IconButton,{title:j.I18n.t("ra_Show/hide filter input"),size:"small",onClick:()=>{const i=[...this.state.filterOn],l=this.state.filterOn.indexOf(n.attr);l===-1?i.push(n.attr):i.splice(l,1),this.setState({filterOn:i},()=>{l&&Ie.getFilterValue(this.filterRefs[n.attr])&&(Ie.setFilterValue(this.filterRefs[n.attr],""),this.applyFilter())})}},this.state.filterOn.includes(n.attr)?M.createElement(Z.FilterAltOff,null):M.createElement(Z.FilterAlt,null)):null}renderImportExportButtons(n){return M.createElement(M.Fragment,null,!n.noDelete&&n.import?M.createElement(N.Tooltip,{title:j.I18n.t("ra_Import data from %s file","CSV"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(N.IconButton,{size:"small",onClick:()=>this.setState({showImportDialog:!0})},M.createElement(Z.UploadFile,null))):null,n.export?M.createElement(N.Tooltip,{title:j.I18n.t("ra_Export data to %s file","CSV"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(N.IconButton,{size:"small",onClick:()=>this.onExport()},M.createElement(Z.Download,null))):null,n.noDelete?null:M.createElement(N.IconButton,{disabled:!0,size:"small"},M.createElement(Z.Delete,null)))}renderAddButton(n){return M.createElement(N.Tooltip,{title:n?j.I18n.t("ra_Cannot add items with set filter"):j.I18n.t("ra_Add row"),slotProps:{popper:{sx:he.tooltip}}},M.createElement("span",null,M.createElement(N.IconButton,{size:"small",color:"primary",disabled:!!n&&!this.props.schema.allowAddByFilter,onClick:this.onAdd},M.createElement(Z.Add,null))))}enhancedTableHead(n,i){var c;const{schema:l}=this.props,{order:v,orderBy:s}=this.state;return M.createElement(N.TableHead,null,M.createElement(N.TableRow,null,(c=l.items)==null?void 0:c.map((d,o)=>this.renderOneFilter({schema:l,style:{width:d.width},showAddButton:!o&&!l.noDelete,headCell:d,order:v,orderBy:s,index:o,doAnyFilterSet:i})),!l.noDelete&&M.createElement(N.TableCell,{style:{paddingLeft:20,paddingRight:20,width:n,textAlign:"right"},padding:"checkbox"},this.renderImportExportButtons(l))))}onDelete=n=>()=>{const i=JSON.parse(JSON.stringify(this.state.value));i.splice(n,1),this.setState({value:i,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))};onExport(){const{schema:n}=this.props,{value:i}=this.state,v=[n.items.map(d=>d.attr).join(";")];i.forEach(d=>{const o=[];n.items.forEach(p=>{var e;(e=d[p.attr])!=null&&e.includes(";")?o.push(`"${d[p.attr]}"`):o.push(d[p.attr]===void 0||d[p.attr]===null?"":d[p.attr])}),v.push(o.join(";"))});const s=document.createElement("a");s.setAttribute("href",`data:text/csv;charset=utf-8,${encodeURIComponent(v.join(`
|
|
1396
|
+
`,"autocompletion.css",!1),l.AcePopup=y,l.$singleLineEditor=m,l.getAriaId=h}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(i,l,v){var s=function(){function c(d){this.editor=d,this.screenReaderDiv=document.createElement("div"),this.screenReaderDiv.classList.add("ace_screenreader-only"),this.editor.container.appendChild(this.screenReaderDiv)}return c.prototype.setScreenReaderContent=function(d){for(!this.popup&&this.editor.completer&&this.editor.completer.popup&&(this.popup=this.editor.completer.popup,this.popup.renderer.on("afterRender",function(){var p=this.popup.getRow(),e=this.popup.renderer.$textLayer,t=e.element.childNodes[p-e.config.firstRow];if(t){for(var r="doc-tooltip ",h=0;h<this._lines.length;h++)r+="ace-inline-screenreader-line-".concat(h," ");t.setAttribute("aria-describedby",r)}}.bind(this)));this.screenReaderDiv.firstChild;)this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);this._lines=d.split(/\r\n|\r|\n/);var o=this.createCodeBlock();this.screenReaderDiv.appendChild(o)},c.prototype.destroy=function(){this.screenReaderDiv.remove()},c.prototype.createCodeBlock=function(){var d=document.createElement("pre");d.setAttribute("id","ace-inline-screenreader");for(var o=0;o<this._lines.length;o++){var p=document.createElement("code");p.setAttribute("id","ace-inline-screenreader-line-".concat(o));var e=document.createTextNode(this._lines[o]);p.appendChild(e),d.appendChild(p)}return d},c}();l.AceInlineScreenReader=s}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(i,l,v){var s=i("../snippets").snippetManager,c=i("./inline_screenreader").AceInlineScreenReader,d=function(){function o(){this.editor=null}return o.prototype.show=function(p,e,t){if(t=t||"",p&&this.editor&&this.editor!==p&&(this.hide(),this.editor=null,this.inlineScreenReader=null),!p||!e)return!1;this.inlineScreenReader||(this.inlineScreenReader=new c(p));var r=e.snippet?s.getDisplayTextForSnippet(p,e.snippet):e.value;return e.hideInlinePreview||!r||!r.startsWith(t)?!1:(this.editor=p,this.inlineScreenReader.setScreenReaderContent(r),r=r.slice(t.length),r===""?p.removeGhostText():p.setGhostText(r),!0)},o.prototype.isOpen=function(){return this.editor?!!this.editor.renderer.$ghostText:!1},o.prototype.hide=function(){return this.editor?(this.editor.removeGhostText(),!0):!1},o.prototype.destroy=function(){this.hide(),this.editor=null,this.inlineScreenReader&&(this.inlineScreenReader.destroy(),this.inlineScreenReader=null)},o}();l.AceInline=d}),ace.define("ace/autocomplete/util",["require","exports","module"],function(i,l,v){l.parForEach=function(c,d,o){var p=0,e=c.length;e===0&&o();for(var t=0;t<e;t++)d(c[t],function(r,h){p++,p===e&&o(r,h)})};var s=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;l.retrievePrecedingIdentifier=function(c,d,o){o=o||s;for(var p=[],e=d-1;e>=0&&o.test(c[e]);e--)p.push(c[e]);return p.reverse().join("")},l.retrieveFollowingIdentifier=function(c,d,o){o=o||s;for(var p=[],e=d;e<c.length&&o.test(c[e]);e++)p.push(c[e]);return p},l.getCompletionPrefix=function(c){var d=c.getCursorPosition(),o=c.session.getLine(d.row),p;return c.completers.forEach(function(e){e.identifierRegexps&&e.identifierRegexps.forEach(function(t){!p&&t&&(p=this.retrievePrecedingIdentifier(o,d.column,t))}.bind(this))}.bind(this)),p||this.retrievePrecedingIdentifier(o,d.column)},l.triggerAutocomplete=function(c,o){var o=o??c.session.getPrecedingCharacter();return c.completers.some(function(p){if(p.triggerCharacters&&Array.isArray(p.triggerCharacters))return p.triggerCharacters.includes(o)})}}),ace.define("ace/autocomplete",["require","exports","module","ace/keyboard/hash_handler","ace/autocomplete/popup","ace/autocomplete/inline","ace/autocomplete/popup","ace/autocomplete/util","ace/lib/lang","ace/lib/dom","ace/snippets","ace/config","ace/lib/event","ace/lib/scroll"],function(i,l,v){var s=i("./keyboard/hash_handler").HashHandler,c=i("./autocomplete/popup").AcePopup,d=i("./autocomplete/inline").AceInline,o=i("./autocomplete/popup").getAriaId,p=i("./autocomplete/util"),e=i("./lib/lang"),t=i("./lib/dom"),r=i("./snippets").snippetManager,h=i("./config"),a=i("./lib/event"),u=i("./lib/scroll").preventParentScroll,f=function(E,w){w.completer&&w.completer.destroy()},m=function(){function E(){this.autoInsert=!1,this.autoSelect=!0,this.autoShown=!1,this.exactMatch=!1,this.inlineEnabled=!1,this.keyboardHandler=new s,this.keyboardHandler.bindKeys(this.commands),this.parentNode=null,this.setSelectOnHover=!1,this.hasSeen=new Set,this.showLoadingState=!1,this.stickySelectionDelay=500,this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.onLayoutChange=this.onLayoutChange.bind(this),this.changeTimer=e.delayedCall(function(){this.updateCompletions(!0)}.bind(this)),this.tooltipTimer=e.delayedCall(this.updateDocTooltip.bind(this),50),this.popupTimer=e.delayedCall(this.$updatePopupPosition.bind(this),50),this.stickySelectionTimer=e.delayedCall(function(){this.stickySelection=!0}.bind(this),this.stickySelectionDelay),this.$firstOpenTimer=e.delayedCall(function(){var w=this.completionProvider&&this.completionProvider.initialPosition;this.autoShown||this.popup&&this.popup.isOpen||!w||this.editor.completers.length===0||(this.completions=new x(E.completionsForLoading),this.openPopup(this.editor,w.prefix,!1),this.popup.renderer.setStyle("ace_loading",!0))}.bind(this),this.stickySelectionDelay)}return Object.defineProperty(E,"completionsForLoading",{get:function(){return[{caption:h.nls("autocomplete.loading","Loading..."),value:""}]},enumerable:!1,configurable:!0}),E.prototype.$init=function(){return this.popup=new c(this.parentNode||document.body||document.documentElement),this.popup.on("click",function(w){this.insertMatch(),w.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.$onPopupShow.bind(this)),this.popup.on("hide",this.$onHidePopup.bind(this)),this.popup.on("select",this.$onPopupChange.bind(this)),a.addListener(this.popup.container,"mouseout",this.mouseOutListener.bind(this)),this.popup.on("changeHoverMarker",this.tooltipTimer.bind(null,null)),this.popup.renderer.on("afterRender",this.$onPopupRender.bind(this)),this.popup},E.prototype.$initInline=function(){if(!(!this.inlineEnabled||this.inlineRenderer))return this.inlineRenderer=new d,this.inlineRenderer},E.prototype.getPopup=function(){return this.popup||this.$init()},E.prototype.$onHidePopup=function(){this.inlineRenderer&&this.inlineRenderer.hide(),this.hideDocTooltip(),this.stickySelectionTimer.cancel(),this.popupTimer.cancel(),this.stickySelection=!1},E.prototype.$seen=function(w){!this.hasSeen.has(w)&&w&&w.completer&&w.completer.onSeen&&typeof w.completer.onSeen=="function"&&(w.completer.onSeen(this.editor,w),this.hasSeen.add(w))},E.prototype.$onPopupChange=function(w){if(this.inlineRenderer&&this.inlineEnabled){var g=w?null:this.popup.getData(this.popup.getRow());if(this.$updateGhostText(g),this.popup.isMouseOver&&this.setSelectOnHover){this.tooltipTimer.call(null,null);return}this.popupTimer.schedule(),this.tooltipTimer.schedule()}else this.popupTimer.call(null,null),this.tooltipTimer.call(null,null)},E.prototype.$updateGhostText=function(w){var g=this.base.row,S=this.base.column,k=this.editor.getCursorPosition().column,D=this.editor.session.getLine(g).slice(S,k);this.inlineRenderer.show(this.editor,w,D)?this.$seen(w):this.inlineRenderer.hide()},E.prototype.$onPopupRender=function(){var w=this.inlineRenderer&&this.inlineEnabled;if(this.completions&&this.completions.filtered&&this.completions.filtered.length>0)for(var g=this.popup.getFirstVisibleRow();g<=this.popup.getLastVisibleRow();g++){var S=this.popup.getData(g);S&&(!w||S.hideInlinePreview)&&this.$seen(S)}},E.prototype.$onPopupShow=function(w){this.$onPopupChange(w),this.stickySelection=!1,this.stickySelectionDelay>=0&&this.stickySelectionTimer.schedule(this.stickySelectionDelay)},E.prototype.observeLayoutChanges=function(){if(!(this.$elements||!this.editor)){window.addEventListener("resize",this.onLayoutChange,{passive:!0}),window.addEventListener("wheel",this.mousewheelListener);for(var w=this.editor.container.parentNode,g=[];w;)g.push(w),w.addEventListener("scroll",this.onLayoutChange,{passive:!0}),w=w.parentNode;this.$elements=g}},E.prototype.unObserveLayoutChanges=function(){var w=this;window.removeEventListener("resize",this.onLayoutChange,{passive:!0}),window.removeEventListener("wheel",this.mousewheelListener),this.$elements&&this.$elements.forEach(function(g){g.removeEventListener("scroll",w.onLayoutChange,{passive:!0})}),this.$elements=null},E.prototype.onLayoutChange=function(){if(!this.popup.isOpen)return this.unObserveLayoutChanges();this.$updatePopupPosition(),this.updateDocTooltip()},E.prototype.$updatePopupPosition=function(){var w=this.editor,g=w.renderer,S=g.layerConfig.lineHeight,k=g.$cursorLayer.getPixelPosition(this.base,!0);k.left-=this.popup.getTextLeftOffset();var D=w.container.getBoundingClientRect();k.top+=D.top-g.layerConfig.offset,k.left+=D.left-w.renderer.scrollLeft,k.left+=g.gutterWidth;var _={top:k.top,left:k.left};g.$ghostText&&g.$ghostTextWidget&&this.base.row===g.$ghostText.position.row&&(_.top+=g.$ghostTextWidget.el.offsetHeight);var F=w.container.getBoundingClientRect().bottom-S,A=F<_.top?{top:F,left:_.left}:_;this.popup.tryShow(A,S,"bottom")||this.popup.tryShow(k,S,"top")||this.popup.show(k,S)},E.prototype.openPopup=function(w,g,S){this.$firstOpenTimer.cancel(),this.popup||this.$init(),this.inlineEnabled&&!this.inlineRenderer&&this.$initInline(),this.popup.autoSelect=this.autoSelect,this.popup.setSelectOnHover(this.setSelectOnHover);var k=this.popup.getRow(),D=this.popup.data[k];this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions&&this.editor.textInput.setAriaOptions({activeDescendant:o(this.popup.getRow()),inline:this.inlineEnabled}),w.keyBinding.addKeyboardHandler(this.keyboardHandler);var _;this.stickySelection&&(_=this.popup.data.indexOf(D)),(!_||_===-1)&&(_=0),this.popup.setRow(this.autoSelect?_:-1),_===k&&D!==this.completions.filtered[_]&&this.$onPopupChange();var F=this.inlineRenderer&&this.inlineEnabled;if(_===k&&F){var A=this.popup.getData(this.popup.getRow());this.$updateGhostText(A)}S||(this.popup.setTheme(w.getTheme()),this.popup.setFontSize(w.getFontSize()),this.$updatePopupPosition(),this.tooltipNode&&this.updateDocTooltip()),this.changeTimer.cancel(),this.observeLayoutChanges()},E.prototype.detach=function(){this.editor&&(this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off("changeSelection",this.changeListener),this.editor.off("blur",this.blurListener),this.editor.off("mousedown",this.mousedownListener),this.editor.off("mousewheel",this.mousewheelListener)),this.$firstOpenTimer.cancel(),this.changeTimer.cancel(),this.hideDocTooltip(),this.completionProvider&&this.completionProvider.detach(),this.popup&&this.popup.isOpen&&this.popup.hide(),this.popup&&this.popup.renderer&&this.popup.renderer.off("afterRender",this.$onPopupRender),this.base&&this.base.detach(),this.activated=!1,this.completionProvider=this.completions=this.base=null,this.unObserveLayoutChanges()},E.prototype.changeListener=function(w){var g=this.editor.selection.lead;(g.row!=this.base.row||g.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},E.prototype.blurListener=function(w){var g=document.activeElement,S=this.editor.textInput.getElement(),k=w.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(w.relatedTarget),D=this.popup&&this.popup.container;g!=S&&g.parentNode!=D&&!k&&g!=this.tooltipNode&&w.relatedTarget!=S&&this.detach()},E.prototype.mousedownListener=function(w){this.detach()},E.prototype.mousewheelListener=function(w){this.popup&&!this.popup.isMouseOver&&this.detach()},E.prototype.mouseOutListener=function(w){this.popup.isOpen&&this.$updatePopupPosition()},E.prototype.goTo=function(w){this.popup.goTo(w)},E.prototype.insertMatch=function(w,g){if(w||(w=this.popup.getData(this.popup.getRow())),!w)return!1;if(w.value==="")return this.detach();var S=this.completions,k=this.getCompletionProvider().insertMatch(this.editor,w,S.filterText,g);return this.completions==S&&this.detach(),k},E.prototype.showPopup=function(w,g){this.editor&&this.detach(),this.activated=!0,this.editor=w,w.completer!=this&&(w.completer&&w.completer.detach(),w.completer=this),w.on("changeSelection",this.changeListener),w.on("blur",this.blurListener),w.on("mousedown",this.mousedownListener),w.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,g)},E.prototype.getCompletionProvider=function(w){return this.completionProvider||(this.completionProvider=new y(w)),this.completionProvider},E.prototype.gatherCompletions=function(w,g){return this.getCompletionProvider().gatherCompletions(w,g)},E.prototype.updateCompletions=function(w,g){if(w&&this.base&&this.completions){var k=this.editor.getCursorPosition(),D=this.editor.session.getTextRange({start:this.base,end:k});if(D==this.completions.filterText)return;if(this.completions.setFilter(D),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==D&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,D,w);return}if(g&&g.matches){var k=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(k.row,k.column),this.base.$insertRight=!0,this.completions=new x(g.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",w)}var S=this.editor.getSession(),k=this.editor.getCursorPosition(),D=p.getCompletionPrefix(this.editor);this.base=S.doc.createAnchor(k.row,k.column-D.length),this.base.$insertRight=!0;var _={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:D,pos:k}).provideCompletions(this.editor,_,function(F,A,$){var C=A.filtered,b=p.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),$){if(!C.length){var T=!this.autoShown&&this.emptyMessage;if(typeof T=="function"&&(T=this.emptyMessage(b)),T){var I=[{caption:T,value:""}];this.completions=new x(I),this.openPopup(this.editor,b,w),this.popup.renderer.setStyle("ace_loading",!1),this.popup.renderer.setStyle("ace_empty-message",!0);return}return this.detach()}if(C.length==1&&C[0].value==b&&!C[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&C.length==1)return this.insertMatch(C[0])}this.completions=!$&&this.showLoadingState?new x(E.completionsForLoading.concat(C),A.filterText):A,this.openPopup(this.editor,b,w),this.popup.renderer.setStyle("ace_empty-message",!1),this.popup.renderer.setStyle("ace_loading",!$)}.bind(this)),this.showLoadingState&&!this.autoShown&&(!this.popup||!this.popup.isOpen)&&this.$firstOpenTimer.delay(this.stickySelectionDelay/2)},E.prototype.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},E.prototype.updateDocTooltip=function(){var w=this.popup,g=this.completions&&this.completions.filtered,S=g&&(g[w.getHoveredRow()]||g[w.getRow()]),k=null;if(!S||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var D=this.editor.completers.length,_=0;_<D;_++){var F=this.editor.completers[_];if(F.getDocTooltip&&S.completerId===F.id){k=F.getDocTooltip(S);break}}if(!k&&typeof S!="string"&&(k=S),typeof k=="string"&&(k={docText:k}),!k||!k.docHTML&&!k.docText)return this.hideDocTooltip();this.showDocTooltip(k)},E.prototype.showDocTooltip=function(w){this.tooltipNode||(this.tooltipNode=t.createElement("div"),this.tooltipNode.style.margin="0",this.tooltipNode.style.pointerEvents="auto",this.tooltipNode.style.overscrollBehavior="contain",this.tooltipNode.tabIndex=-1,this.tooltipNode.onblur=this.blurListener.bind(this),this.tooltipNode.onclick=this.onTooltipClick.bind(this),this.tooltipNode.id="doc-tooltip",this.tooltipNode.setAttribute("role","tooltip"),this.tooltipNode.addEventListener("wheel",u));var g=this.editor.renderer.theme;this.tooltipNode.className="ace_tooltip ace_doc-tooltip "+(g.isDark?"ace_dark ":"")+(g.cssClass||"");var S=this.tooltipNode;w.docHTML?S.innerHTML=w.docHTML:w.docText&&(S.textContent=w.docText),S.parentNode||this.popup.container.appendChild(this.tooltipNode);var k=this.popup,D=k.container.getBoundingClientRect(),_=400,F=300,A=k.renderer.scrollBar.width||10,$=D.left,C=window.innerWidth-D.right-A,b=k.isTopdown?D.top:window.innerHeight-A-D.bottom,T=[Math.min(C/_,1),Math.min($/_,1),Math.min(b/F*.9)],I=Math.max.apply(Math,T),O=S.style;O.display="block",I==T[0]?(O.left=D.right+1+"px",O.right="",O.maxWidth=_*I+"px",O.top=D.top+"px",O.bottom="",O.maxHeight=Math.min(window.innerHeight-A-D.top,F)+"px"):I==T[1]?(O.right=window.innerWidth-D.left+"px",O.left="",O.maxWidth=_*I+"px",O.top=D.top+"px",O.bottom="",O.maxHeight=Math.min(window.innerHeight-A-D.top,F)+"px"):I==T[2]&&(O.left=window.innerWidth-D.left+"px",O.maxWidth=Math.min(_,window.innerWidth)+"px",k.isTopdown?(O.top=D.bottom+"px",O.left=D.left+"px",O.right="",O.bottom="",O.maxHeight=Math.min(window.innerHeight-A-D.bottom,F)+"px"):(O.top=k.container.offsetTop-S.offsetHeight+"px",O.left=D.left+"px",O.right="",O.bottom="",O.maxHeight=Math.min(k.container.offsetTop,F)+"px"))},E.prototype.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),!!this.tooltipNode){var w=this.tooltipNode;!this.editor.isFocused()&&document.activeElement==w&&this.editor.focus(),this.tooltipNode=null,w.parentNode&&w.parentNode.removeChild(w)}},E.prototype.onTooltipClick=function(w){for(var g=w.target;g&&g!=this.tooltipNode;){if(g.nodeName=="A"&&g.href){g.rel="noreferrer",g.target="_blank";break}g=g.parentNode}},E.prototype.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var w=this.popup.container;w&&w.parentNode&&w.parentNode.removeChild(w)}this.editor&&this.editor.completer==this&&(this.editor.off("destroy",f),this.editor.completer=null),this.inlineRenderer=this.popup=this.editor=null},E.for=function(w){return w.completer instanceof E||(w.completer&&(w.completer.destroy(),w.completer=null),h.get("sharedPopups")?(E.$sharedInstance||(E.$sharedInstance=new E),w.completer=E.$sharedInstance):(w.completer=new E,w.once("destroy",f))),w.completer},E}();m.prototype.commands={Up:function(E){E.completer.goTo("up")},Down:function(E){E.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(E){E.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(E){E.completer.goTo("end")},Esc:function(E){E.completer.detach()},Return:function(E){return E.completer.insertMatch()},"Shift-Return":function(E){E.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(E){var w=E.completer.insertMatch();if(w||E.tabstopManager)return w;E.completer.goTo("down")},Backspace:function(E){E.execCommand("backspace");var w=p.getCompletionPrefix(E);!w&&E.completer&&E.completer.detach()},PageUp:function(E){E.completer.popup.gotoPageUp()},PageDown:function(E){E.completer.popup.gotoPageDown()}},m.startCommand={name:"startAutocomplete",exec:function(E,w){var g=m.for(E);g.autoInsert=!1,g.autoSelect=!0,g.autoShown=!1,g.showPopup(E,w),g.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var y=function(){function E(w){this.initialPosition=w,this.active=!0}return E.prototype.insertByIndex=function(w,g,S){return!this.completions||!this.completions.filtered?!1:this.insertMatch(w,this.completions.filtered[g],S)},E.prototype.insertMatch=function(w,g,S){if(!g)return!1;if(w.startOperation({command:{name:"insertMatch"}}),g.completer&&g.completer.insertMatch)g.completer.insertMatch(w,g);else{if(!this.completions)return!1;var k=this.completions.filterText.length,D=0;if(g.range&&g.range.start.row===g.range.end.row&&(k-=this.initialPosition.prefix.length,k+=this.initialPosition.pos.column-g.range.start.column,D+=g.range.end.column-this.initialPosition.pos.column),k||D){var _;w.selection.getAllRanges?_=w.selection.getAllRanges():_=[w.getSelectionRange()];for(var F=0,A;A=_[F];F++)A.start.column-=k,A.end.column+=D,w.session.remove(A)}g.snippet?r.insertSnippet(w,g.snippet):this.$insertString(w,g),g.completer&&g.completer.onInsert&&typeof g.completer.onInsert=="function"&&g.completer.onInsert(w,g),g.command&&g.command==="startAutocomplete"&&w.execCommand(g.command)}return w.endOperation(),!0},E.prototype.$insertString=function(w,g){var S=g.value||g;w.execCommand("insertstring",S)},E.prototype.gatherCompletions=function(w,g){var S=w.getSession(),k=w.getCursorPosition(),D=p.getCompletionPrefix(w),_=[];this.completers=w.completers;var F=w.completers.length;return w.completers.forEach(function(A,$){A.getCompletions(w,S,k,D,function(C,b){A.hideInlinePreview&&(b=b.map(function(T){return Object.assign(T,{hideInlinePreview:A.hideInlinePreview})})),!C&&b&&(_=_.concat(b)),g(null,{prefix:p.getCompletionPrefix(w),matches:_,finished:--F===0})})}),!0},E.prototype.provideCompletions=function(w,g,S){var k=function(A){var $=A.prefix,C=A.matches;this.completions=new x(C),g.exactMatch&&(this.completions.exactMatch=!0),g.ignoreCaption&&(this.completions.ignoreCaption=!0),this.completions.setFilter($),(A.finished||this.completions.filtered.length)&&S(null,this.completions,A.finished)}.bind(this),D=!0,_=null;if(this.gatherCompletions(w,function(A,$){if(this.active){A&&(S(A,[],!0),this.detach());var C=$.prefix;if(C.indexOf($.prefix)===0){if(D){_=$;return}k($)}}}.bind(this)),D=!1,_){var F=_;_=null,k(F)}},E.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(w){typeof w.cancel=="function"&&w.cancel()})},E}(),x=function(){function E(w,g){this.all=w,this.filtered=w,this.filterText=g||"",this.exactMatch=!1,this.ignoreCaption=!1}return E.prototype.setFilter=function(w){if(w.length>this.filterText&&w.lastIndexOf(this.filterText,0)===0)var g=this.filtered;else var g=this.all;this.filterText=w,g=this.filterCompletions(g,this.filterText),g=g.sort(function(k,D){return D.exactMatch-k.exactMatch||D.$score-k.$score||(k.caption||k.value).localeCompare(D.caption||D.value)});var S=null;g=g.filter(function(k){var D=k.snippet||k.caption||k.value;return D===S?!1:(S=D,!0)}),this.filtered=g},E.prototype.filterCompletions=function(w,g){var S=[],k=g.toUpperCase(),D=g.toLowerCase();e:for(var _=0,F;F=w[_];_++){if(F.skipFilter){F.$score=F.score,S.push(F);continue}var A=!this.ignoreCaption&&F.caption||F.value||F.snippet;if(A){var $=-1,C=0,b=0,T,I;if(this.exactMatch){if(g!==A.substr(0,g.length))continue e}else{var O=A.toLowerCase().indexOf(D);if(O>-1)b=O;else for(var N=0;N<g.length;N++){var P=A.indexOf(D[N],$+1),B=A.indexOf(k[N],$+1);if(T=P>=0&&(B<0||P<B)?P:B,T<0)continue e;I=T-$-1,I>0&&($===-1&&(b+=10),b+=I,C|=1<<N),$=T}}F.matchMask=C,F.exactMatch=b?0:1,F.$score=(F.score||0)-b,S.push(F)}}return S},E}();l.Autocomplete=m,l.CompletionProvider=y,l.FilteredList=x}),ace.define("ace/marker_group",["require","exports","module"],function(i,l,v){var s=function(){function c(d,o){o&&(this.markerType=o.markerType),this.markers=[],this.session=d,d.addDynamicMarker(this)}return c.prototype.getMarkerAtPosition=function(d){return this.markers.find(function(o){return o.range.contains(d.row,d.column)})},c.prototype.markersComparator=function(d,o){return d.range.start.row-o.range.start.row},c.prototype.setMarkers=function(d){this.markers=d.sort(this.markersComparator).slice(0,this.MAX_MARKERS),this.session._signal("changeBackMarker")},c.prototype.update=function(d,o,p,e){if(!(!this.markers||!this.markers.length))for(var t=e.firstRow,r=e.lastRow,h,a=0,u=0,f=0;f<this.markers.length;f++){var m=this.markers[f];if(!(m.range.end.row<t)&&!(m.range.start.row>r)&&(m.range.start.row===u?a++:(u=m.range.start.row,a=0),!(a>200))){var y=m.range.clipRows(t,r);if(!(y.start.row===y.end.row&&y.start.column===y.end.column)){var x=y.toScreenRange(p);if(x.isEmpty()){h=p.getNextFoldLine(y.end.row,h),h&&h.end.row>y.end.row&&(t=h.end.row);continue}this.markerType==="fullLine"?o.drawFullLineMarker(d,x,m.className,e):x.isMultiLine()?this.markerType==="line"?o.drawMultiLineMarker(d,x,m.className,e):o.drawTextMarker(d,x,m.className,e):o.drawSingleLineMarker(d,x,m.className+" ace_br15",e)}}}},c}();s.prototype.MAX_MARKERS=1e4,l.MarkerGroup=s}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(i,l,v){function s(p,e){var t=p.getTextRange(d.fromPoints({row:0,column:0},e));return t.split(o).length-1}function c(p,e){var t=s(p,e),r=p.getValue().split(o),h=Object.create(null),a=r[t];return r.forEach(function(u,f){if(!(!u||u===a)){var m=Math.abs(t-f),y=r.length-m;h[u]?h[u]=Math.max(y,h[u]):h[u]=y}}),h}var d=i("../range").Range,o=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;l.getCompletions=function(p,e,t,r,h){var a=c(e,t),u=Object.keys(a);h(null,u.map(function(f){return{caption:f,value:f,score:a[f],meta:"local"}}))}}),ace.define("ace/ext/language_tools",["require","exports","module","ace/snippets","ace/autocomplete","ace/config","ace/lib/lang","ace/autocomplete/util","ace/marker_group","ace/autocomplete/text_completer","ace/editor","ace/config"],function(i,l,v){var s=i("../snippets").snippetManager,c=i("../autocomplete").Autocomplete,d=i("../config"),o=i("../lib/lang"),p=i("../autocomplete/util"),e=i("../marker_group").MarkerGroup,t=i("../autocomplete/text_completer"),r={getCompletions:function(D,_,F,A,$){if(_.$mode.completer)return _.$mode.completer.getCompletions(D,_,F,A,$);var C=D.session.getState(F.row),b=_.$mode.getCompletions(C,_,F,A);b=b.map(function(T){return T.completerId=r.id,T}),$(null,b)},id:"keywordCompleter"},h=function(D){var _={};return D.replace(/\${(\d+)(:(.*?))?}/g,function(F,A,$,C){return _[A]=C||""}).replace(/\$(\d+?)/g,function(F,A){return _[A]})},a={getCompletions:function(D,_,F,A,$){var C=[],b=_.getTokenAt(F.row,F.column);b&&b.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?C.push("html-tag"):C=s.getActiveScopes(D);var T=s.snippetMap,I=[];C.forEach(function(O){for(var N=T[O]||[],P=N.length;P--;){var B=N[P],V=B.name||B.tabTrigger;V&&I.push({caption:V,snippet:B.content,meta:B.tabTrigger&&!B.name?B.tabTrigger+"⇥ ":"snippet",completerId:a.id})}},this),$(null,I)},getDocTooltip:function(D){D.snippet&&!D.docHTML&&(D.docHTML=["<b>",o.escapeHTML(D.caption),"</b>","<hr></hr>",o.escapeHTML(h(D.snippet))].join(""))},id:"snippetCompleter"},u=[a,t,r];l.setCompleters=function(D){u.length=0,D&&u.push.apply(u,D)},l.addCompleter=function(D){u.push(D)},l.textCompleter=t,l.keyWordCompleter=r,l.snippetCompleter=a;var f={name:"expandSnippet",exec:function(D){return s.expandWithTab(D)},bindKey:"Tab"},m=function(D,_){y(_.session.$mode)},y=function(D){typeof D=="string"&&(D=d.$modes[D]),D&&(s.files||(s.files={}),x(D.$id,D.snippetFileId),D.modes&&D.modes.forEach(y))},x=function(D,_){!_||!D||s.files[D]||(s.files[D]={},d.loadModule(_,function(F){F&&(s.files[D]=F,!F.snippets&&F.snippetText&&(F.snippets=s.parseSnippetFile(F.snippetText)),s.register(F.snippets||[],F.scope),F.includeScopes&&(s.snippetMap[F.scope].includeScopes=F.includeScopes,F.includeScopes.forEach(function(A){y("ace/mode/"+A)})))}))},E=function(D){var _=D.editor,F=_.completer&&_.completer.activated;if(D.command.name==="backspace")F&&!p.getCompletionPrefix(_)&&_.completer.detach();else if(D.command.name==="insertstring"&&!F){w=D;var A=D.editor.$liveAutocompletionDelay;A?g.delay(A):S(D)}},w,g=o.delayedCall(function(){S(w)},0),S=function(D){var _=D.editor,F=p.getCompletionPrefix(_),A=D.args,$=p.triggerAutocomplete(_,A);if(F&&F.length>=_.$liveAutocompletionThreshold||$){var C=c.for(_);C.autoShown=!0,C.showPopup(_)}},k=i("../editor").Editor;i("../config").defineOptions(k.prototype,"editor",{enableBasicAutocompletion:{set:function(D){D?(c.for(this),this.completers||(this.completers=Array.isArray(D)?D:u),this.commands.addCommand(c.startCommand)):this.commands.removeCommand(c.startCommand)},value:!1},enableLiveAutocompletion:{set:function(D){D?(this.completers||(this.completers=Array.isArray(D)?D:u),this.commands.on("afterExec",E)):this.commands.off("afterExec",E)},value:!1},liveAutocompletionDelay:{initialValue:0},liveAutocompletionThreshold:{initialValue:0},enableSnippets:{set:function(D){D?(this.commands.addCommand(f),this.on("changeMode",m),m(null,this)):(this.commands.removeCommand(f),this.off("changeMode",m))},value:!1}}),l.MarkerGroup=e}),function(){ace.require(["ace/ext/language_tools"],function(i){L&&(L.exports=i)})}()})(Oa);const fi={jsonError:{border:"1px solid red",minHeight:200},jsonNoError:{border:"1px solid #00000000",minHeight:200}};function Ra(L){return M.createElement(_a,{style:L.error===!0?fi.jsonError:L.error===!1?fi.jsonNoError:void 0,mode:L.mode||"json",width:"100%",height:"100%",showPrintMargin:L.editValueMode,showGutter:L.editValueMode,highlightActiveLine:L.editValueMode,defaultValue:L.defaultValue,theme:L.themeType==="dark"?"clouds_midnight":"chrome",value:L.value,readOnly:!L.onChange,onChange:n=>L.onChange(n),name:L.name||"UNIQUE_ID_OF_DIV1",fontSize:L.fontSize||14,setOptions:{enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!0,showLineNumbers:L.editValueMode,tabSize:L.editValueMode?2:void 0},editorProps:{$blockScrolling:!0}})}const bn={flex:{display:"flex"},button:{height:48,minWidth:48},wrapper:{width:"calc(100vw - 40px)",height:"calc(100vh - 188px)"}};class Na extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,l=K.getValue(n,i)||"{}";this.setState({value:l,initialized:!0,jsonError:this.validateJson(l)})}validateJson(n){let i=!1;if(this.props.schema.validateJson!==!1&&(n||!this.props.schema.allowEmpty))try{this.props.schema.json5?Li.parse(n):JSON.parse(n)}catch(l){console.log("Error in JSON",l),i=!0}return i}renderItem(n,i){if(!this.state.initialized)return null;const{schema:l,data:v,attr:s}=this.props,{value:c,showSelectId:d}=this.state;return M.createElement(R.FormControl,{fullWidth:!0,variant:"standard"},M.createElement("div",{style:bn.flex},M.createElement(R.Button,{color:"grey",disabled:i,style:bn.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},j.I18n.t("ra_JSON editor"))),d?M.createElement(co,{title:this.getText(l.label),overflowHidden:!0,applyDisabled:this.state.jsonError&&this.props.schema.doNotApplyWithError,onClose:()=>this.setState({showSelectId:!1,value:K.getValue(v,s)||{}}),onApply:()=>this.setState({showSelectId:!1},()=>this.onChange(s,c))},M.createElement("div",{style:{...bn.wrapper,border:this.state.jsonError?"2px solid red":"2px solid transparent"}},M.createElement(Ra,{mode:this.props.schema.json5?"json5":"json",value:typeof c=="object"?JSON.stringify(c):c,onChange:o=>this.setState({value:o,jsonError:this.validateJson(o)}),name:"ConfigJsonEditor",themeType:this.props.oContext.themeType}))):null,l.help||this.state.jsonError?M.createElement(R.FormHelperText,null,this.state.jsonError?j.I18n.t("ra_Invalid JSON"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ba=[{value:"en",label:"English"},{value:"de",label:"Deutsch"},{value:"ru",label:"русский"},{value:"pt",label:"Portugues"},{value:"nl",label:"Nederlands"},{value:"fr",label:"français"},{value:"it",label:"Italiano"},{value:"es",label:"Espanol"},{value:"pl",label:"Polski"},{value:"uk",label:"Український"},{value:"zh-cn",label:"简体中文"}];class Pa extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr),i=[...Ba];this.props.schema.system?i.unshift({value:"",label:j.I18n.t("ra_System language")}):i.unshift({value:"",label:j.I18n.t("ra_none")}),this.setState({value:this.props.schema.system?n||"":n||j.I18n.getLanguage(),selectOptions:i})}renderItem(n,i){var v,s;if(!this.state.selectOptions)return null;const l=(v=this.state.selectOptions)==null?void 0:v.find(c=>c.value===this.state.value||!c.value&&!this.state.value);return M.createElement(R.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?M.createElement(R.InputLabel,null,this.getText(this.props.schema.label)):null,M.createElement(R.Select,{variant:"standard",error:!!n,disabled:i,value:this.state.value||"_",renderValue:()=>this.getText(l==null?void 0:l.label,this.props.schema.noTranslation),onChange:c=>{let{value:d}=c.target;d==="_"&&(d=""),this.setState({value:d},()=>{const o=this.onChange(this.props.attr,d);if(o instanceof Promise&&o.catch(p=>console.error(p)),this.props.schema.changeGuiLanguage)if(d){if(d===j.I18n.getLanguage())return;j.I18n.setLanguage(d),this.props.oContext.changeLanguage&&this.props.oContext.changeLanguage()}else this.props.oContext.socket.getSystemConfig().then(p=>{p.common.language!==j.I18n.getLanguage()&&p.common.language&&(j.I18n.setLanguage(p.common.language),this.props.oContext.changeLanguage&&this.props.oContext.changeLanguage())}).catch(p=>console.error(`Cannot read system config: ${p}`))})}},(s=this.state.selectOptions)==null?void 0:s.map(c=>M.createElement(R.MenuItem,{key:c.value,value:c.value},c.label))),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class Wa extends K{scrollRef;constructor(n){super(n),this.scrollRef=M.createRef()}scrolledDown(){return this.scrollRef.current?this.scrollRef.current.offsetHeight+this.scrollRef.current.scrollTop>=this.scrollRef.current.scrollHeight:!1}componentDidMount(){super.componentDidMount(),K.getValue(this.props.data,this.props.attr)||(this.props.schema.licenseUrl?(this.setState({showLicenseDialog:!0,loading:!0,scrolledDown:!1}),fetch(this.props.schema.licenseUrl).then(n=>n.text()).then(n=>this.setState({license:n,loading:!1})).catch(n=>this.setState({license:n.toString(),loading:!1,error:!0,scrolledDown:!1}))):this.setState({showLicenseDialog:!0,scrolledDown:!1}),setTimeout(()=>{this.scrollRef.current&&(this.scrolledDown()?this.setState({scrolledDown:!0}):this.scrollRef.current.addEventListener("scroll",()=>{!this.state.scrolledDown&&this.scrolledDown()&&this.setState({scrolledDown:!0})}))},1e3))}renderItem(n,i){return this.state.showLicenseDialog?M.createElement(R.Dialog,{maxWidth:"lg",open:!0,onClose:(l,v)=>{v!=="escapeKeyDown"&&v!=="backdropClick"&&this.setState({showLicenseDialog:!1})}},M.createElement(R.DialogTitle,null,this.props.schema.title?j.I18n.t(this.props.schema.title):j.I18n.t("ra_License agreement")),M.createElement(R.DialogContent,null,this.props.schema.licenseUrl?M.createElement(M.Fragment,null,this.state.loading?M.createElement(R.LinearProgress,null):null,M.createElement("pre",{ref:this.scrollRef,style:{width:"100%",height:"100%",overflowY:"auto",fontSize:14}},this.state.license)):null,!this.props.schema.licenseUrl&&this.props.schema.texts?M.createElement("div",{ref:this.scrollRef,style:{width:"100%",height:"100%",overflowY:"auto",fontSize:14}},this.props.schema.texts.map((l,v)=>this.props.schema.noTranslation?M.createElement("p",{key:v},l):M.createElement("p",{key:v},j.I18n.t(l)))):null),M.createElement(R.DialogActions,null,this.props.schema.checkBox?M.createElement(R.FormControlLabel,{control:M.createElement(R.Checkbox,{disabled:i,checked:!!this.state.licenseChecked,onClick:()=>this.setState({licenseChecked:!this.state.licenseChecked})}),label:j.I18n.t(this.props.schema.checkBox)}):null,M.createElement(R.Button,{disabled:i||this.state.loading||this.state.error||this.props.schema.checkBox&&!this.state.licenseChecked||!this.state.scrolledDown,onClick:()=>{this.setState({showLicenseDialog:!1});const l=this.onChange(this.props.attr,!0);l instanceof Promise&&l.catch(v=>console.error(`Cannot set value: ${v}`))},color:"primary",variant:"contained",startIcon:M.createElement(Z.Check,null)},this.props.schema.agreeText?j.I18n.t(this.props.schema.agreeText):j.I18n.t("ra_Accept license")),M.createElement(R.Button,{onClick:()=>{this.setState({showLicenseDialog:!1}),setTimeout(()=>this.setState({showLicenseDialog:!0}),2e3)},color:"grey",variant:"contained",startIcon:M.createElement(Z.Close,null)},j.I18n.t("ra_Close")))):null}}const gi={indeterminate:{opacity:.5},control:{flexDirection:"row",width:"100%"}};class za extends K{updateTimeout;componentDidMount(){super.componentDidMount();let n=K.getValue(this.props.data,this.props.attr);if(n==null&&(n=""),Array.isArray(n)&&this.props.oContext.multiEdit){n=K.DIFFERENT_VALUE,this.setState({_value:n,oldValue:n});return}this.setState({_value:n.toString(),oldValue:n.toString()})}static getDerivedStateFromProps(n,i){if(n.schema.min!==void 0&&n.schema.min<0||n.schema.max!==void 0&&n.schema.max<0)return null;const l=K.getValue(n.data,n.attr);return n.oContext.multiEdit&&i._value===K.DIFFERENT_VALUE?{_value:K.DIFFERENT_VALUE}:l==null||i.oldValue===null||i.oldValue===void 0||l.toString()!==parseFloat(i._value).toString()&&l.toString()!==i.oldValue.toString()?{_value:l}:null}checkValue(n){if(n==null)return null;n=n.toString().trim().replace(",",".");const i=n===""?0:parseFloat(n);return n!==""&&Number.isNaN(i)?"ra_Not a number":n!==""&&window.isFinite(i)?this.props.schema.min!==void 0&&i<this.props.schema.min?"ra_Too small":this.props.schema.max!==void 0&&i>this.props.schema.max?"ra_Too big":n===""||n==="-"||Number.isNaN(i)?"ra_Not a number":null:"ra_Not a number"}renderItem(n,i){const l=Array.isArray(this.state._value)||this.state._value===K.DIFFERENT_VALUE;if(this.state.oldValue!==null&&this.state.oldValue!==void 0?(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=void 0,this.setState({oldValue:null})},30)):this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=void 0),l){const v=K.getValue(this.props.data,this.props.attr),s=(v==null?void 0:v.filter(c=>c||c===0).map(c=>({label:c.toString(),value:c})))||[];return s.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),M.createElement(R.Autocomplete,{style:gi.indeterminate,fullWidth:!0,freeSolo:!0,value:s[0],getOptionSelected:(c,d)=>c.label===d.label,onChange:(c,d)=>{const o=this.onChange(this.props.attr,d==null?void 0:d.value,()=>{this.setState({_value:d==null?void 0:d.value,oldValue:this.state._value})});o instanceof Promise&&o.catch(p=>console.error(p))},options:s,getOptionLabel:c=>c.label,renderInput:c=>M.createElement(R.TextField,{...c,label:this.getText(this.props.schema.label),variant:"standard",slotProps:{htmlInput:{...c.inputProps,readOnly:this.props.schema.readOnly||!1},input:{endAdornment:this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):void 0}},error:!!n,placeholder:this.getText(this.props.schema.placeholder),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:!!i})})}return!n&&this.state._value!==null&&this.state._value!==void 0&&this.state._value&&(n=this.checkValue(this.state._value),n&&(n=j.I18n.t(n))),M.createElement(R.FormControl,{variant:"standard",style:gi.control},M.createElement(R.TextField,{sx:{"& .up-down":{display:"none"},"&:hover .up-down":{display:"block"}},variant:"standard",type:this.props.schema.min!==void 0&&this.props.schema.min>=0?"number":"text",fullWidth:!0,slotProps:{htmlInput:{min:this.props.schema.min,max:this.props.schema.max,step:this.props.schema.step,readOnly:this.props.schema.readOnly||!1},input:{endAdornment:this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):null}},value:this.state._value===null||this.state._value===void 0?"":this.state._value,error:!!n,disabled:!!i,onChange:v=>{const s=v.target.value,c=this.checkValue(s);c?this.onError(this.props.attr,j.I18n.t(c)):this.onError(this.props.attr),this.setState({_value:s,oldValue:this.state._value},()=>this.onChange(this.props.attr,parseFloat(s.replace(",","."))))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:n&&typeof n=="string"?n:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}))}}class Ha extends K{authWindow;oid;url;constructor(n){super(n),this.state={...this.state,accessTokens:"",success:!1,blocked:!1,running:!1,pressed:!1},this.url=`https://oauth2.iobroker.in/${n.schema.identifier}?redirect=true`,n.schema.scope&&(this.url+=`&scope=${encodeURIComponent(n.schema.scope)}`),this.oid=`${this.props.oContext.adapterName}.${this.props.oContext.instance}.${this.props.schema.saveTokenIn||"oauth2Tokens"}`}async componentDidMount(){super.componentDidMount(),window.addEventListener?window.addEventListener("message",this.onMessage,!1):window.attachEvent("onmessage",this.onMessage,!1),await this.props.oContext.socket.subscribeState(this.oid,this.onTokensUpdated);const n=await this.props.oContext.socket.getState(this.oid);if(n){const i=JSON.parse(n.val);new Date(i.access_token_expires_on).getTime()>Date.now()&&this.setState({accessTokens:n.val})}}onTokensUpdated=(n,i)=>{if(i!=null&&i.val){const l=JSON.parse(i.val);if(new Date(l.access_token_expires_on).getTime()>Date.now()){this.state.accessTokens!==i.val&&this.setState({accessTokens:i.val});return}}this.setState({accessTokens:""})};componentWillUnmount(){super.componentWillUnmount(),window.removeEventListener?window.removeEventListener("message",this.onMessage,!1):window.detachEvent("onmessage",this.onMessage,!1),this.props.oContext.socket.unsubscribeState(this.oid,this.onTokensUpdated)}saveToken(n){try{n&&!n.startsWith("{")&&(n=atob(n));const i=JSON.parse(n);i.access_token&&i.refresh_token&&i.expires_in&&(i.access_token_expires_on||=new Date(Date.now()+i.expires_in*1e3).toISOString(),this.props.oContext.socket.setState(this.oid,JSON.stringify(i),!0).catch(l=>console.log(`Error occurred: ${l.toString()}`)))}catch(i){console.warn(i)}}onMessage=n=>{var i,l,v;if(n.origin==="https://oauth2.iobroker.in"&&(typeof n.data=="string"&&n.data.startsWith(`${this.props.schema.identifier}-authentication:`)||typeof n.message=="string"&&n.message.startsWith(`${this.props.schema.identifier}-authentication:`))){const s=(n.data||n.message).split(":");s[1]==="success"?(this.setState({accessTokens:s[2],success:!0,pressed:!1},()=>this.saveToken(this.state.accessTokens)),(i=this.authWindow)==null||i.postMessage("close",n.origin),this.authWindow=null):(v=(l=this.props).onError)==null||v.call(l,s[2])}};onOpenUrl(){this.authWindow=window.open(this.url,this.props.schema.identifier),!this.authWindow||this.authWindow.closed||typeof this.authWindow.closed>"u"?this.setState({blocked:!0}):this.setState({pressed:!0})}renderItem(){let n="";if(this.state.accessTokens)try{const v=JSON.parse(this.state.accessTokens);n=new Date(v.access_token_expires_on).toLocaleString()}catch{}let i;this.state.accessTokens?i=this.props.schema.refreshLabel?this.getText(this.props.schema.refreshLabel):j.I18n.t("ra_Renew %s access",this.props.schema.identifier[0].toUpperCase()+this.props.schema.identifier.slice(1)):i=this.props.schema.label?this.getText(this.props.schema.label):j.I18n.t("ra_Get %s access",this.props.schema.identifier[0].toUpperCase()+this.props.schema.identifier.slice(1));const l=this.getIcon();return M.createElement("div",{style:{width:"100%",margin:"0 0 1rem 0"}},M.createElement(R.Button,{disabled:this.state.running,endIcon:l||M.createElement(Z.CloudUpload,null),variant:"contained",onClick:()=>this.onOpenUrl()},i),this.state.blocked?M.createElement("div",{style:{color:"red",fontSize:16,marginTop:20}},j.I18n.t("ra_Please allow popups in your browser for this page!")):null,this.state.accessTokens?M.createElement("div",{style:{color:"green",fontSize:16,marginTop:20}},this.props.alive?j.I18n.t("ra_Successfully authorized. Token valid till %s and will be automatically renewed.",n):j.I18n.t("ra_Successfully authorized. Token valid till %s but it can expire as the instance is not running.",n)):null,this.state.pressed?M.createElement(M.Fragment,null,M.createElement("div",{style:{width:"100%",margin:"1rem 0 1rem 0"}},M.createElement("span",{style:{marginRight:4}},`${j.I18n.t("ra_If the button above does not work, you can authorize manually this app by visiting this url")}`,":"),M.createElement("br",null),M.createElement("a",{target:this.props.schema.identifier,href:this.url,rel:"noreferrer"},this.url)),M.createElement(R.TextField,{value:this.state.accessTokens,label:j.I18n.t("ra_Enter the code from that page here"),variant:"standard",onChange:v=>{let s=v.target.value;s&&!s.startsWith("{")&&(s=atob(s));try{const c=JSON.parse(s);c.access_token&&(c.access_token_expires_on=new Date(Date.now()+(c.expires_in-10)*1e3).toISOString(),this.setState({accessTokens:JSON.stringify(c)},()=>this.saveToken(this.state.accessTokens)))}catch{}},fullWidth:!0})):null)}}const mi={flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class ja extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,l=K.getValue(n,i)||"";this.setState({value:l,initialized:!0})}renderItem(n,i){if(!this.state.initialized)return null;const l=this.props.oContext.socket,{schema:v,attr:s}=this.props,{value:c,showSelectId:d}=this.state;return M.createElement(R.FormControl,{fullWidth:!0,variant:"standard"},v.label?M.createElement(R.InputLabel,{shrink:!0},this.getText(v.label)):null,M.createElement("div",{style:mi.flex},M.createElement(R.TextField,{variant:"standard",fullWidth:!0,value:c,error:!!n,disabled:i,placeholder:this.getText(v.placeholder),label:this.getText(v.label),helperText:this.renderHelp(v.help,v.helpLink,v.noTranslation),onChange:o=>{const p=o.target.value;this.setState({value:p},()=>this.onChange(s,p))}}),M.createElement(R.Button,{color:"grey",disabled:i,style:mi.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},"...")),d?M.createElement(j.DialogSelectID,{imagePrefix:this.props.oContext.imagePrefix===void 0?"../..":this.props.oContext.imagePrefix,dialogName:`admin.${this.props.oContext.adapterName}`,filterFunc:v.filterFunc,themeType:this.props.oContext.themeType,theme:this.props.oContext.theme,types:v.types?Array.isArray(v.types)?v.types:[v.types]:void 0,customFilter:v.customFilter,filters:v.filters,socket:l,selected:c,root:v.root,onClose:()=>this.setState({showSelectId:!1}),onOk:o=>this.setState({showSelectId:!1,value:o},()=>this.onChange(s,o))}):null)}}const wn={fullWidth:{width:"100%",display:"inline-block"},halfWidth1:{width:"calc(50% - 5px)",display:"inline-block",marginRight:8},halfWidth2:{width:"calc(50% - 5px)",display:"inline-block"}},Ut="____ppp____";class Va extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({_repeat:n?Ut:"",_visible:!1,value:n?Ut:"",_notEqual:!1})}onChangePassword(n,i){n===void 0&&(n=this.state.value),i===void 0&&(i=this.state._repeat);const l=!!this.props.schema.repeat&&i!==n;this.setState({value:n,_repeat:i,_notEqual:l},()=>{if(l)this.onError(this.props.attr,j.I18n.t("ra_Passwords are not equal!"));else{this.onError(this.props.attr);const v=this.onChange(this.props.attr,n);v instanceof Promise&&v.catch(s=>this.onError(this.props.attr,s))}})}renderItem(n,i){if(this.state._notEqual===void 0)return null;const l=M.createElement(R.TextField,{variant:"standard",fullWidth:!0,type:this.state._visible&&this.state.value!==Ut?"text":"password",value:this.state.value,error:!!n||this.state._notEqual,disabled:!!i,onChange:v=>this.onChangePassword(v.target.value),label:this.getText(this.props.schema.label),slotProps:{input:{autoComplete:"new-password",endAdornment:this.state.value&&this.state.value!==Ut&&this.props.schema.visible&&!i&&!this.props.schema.readOnly?M.createElement(R.InputAdornment,{position:"end"},M.createElement(R.IconButton,{size:"large",tabIndex:-1,onClick:v=>{v.preventDefault(),v.stopPropagation(),this.setState({_visible:!this.state._visible})},edge:"end"},this.state._visible?M.createElement(Z.VisibilityOff,null):M.createElement(Z.Visibility,null))):void 0},htmlInput:{autoComplete:"new-password",form:{autoComplete:"off"},maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1}},helperText:this.state._notEqual?j.I18n.t("ra_Passwords are not equal!"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)});if(this.props.schema.repeat&&!this.props.schema.readOnly){const v=this.state._visible?null:M.createElement(R.TextField,{variant:"standard",fullWidth:!0,type:"password",value:this.state._repeat,error:!!n||this.state._notEqual,disabled:!!i,onChange:s=>this.onChangePassword(void 0,s.target.value),label:`${this.getText(this.props.schema.label)} (${j.I18n.t("ra_repeat")})`,slotProps:{input:{autoComplete:"new-password"},htmlInput:{autoComplete:"new-password",form:{autoComplete:"off"},maxLength:this.props.schema.maxLength||this.props.schema.max||void 0}},helperText:this.state._notEqual?j.I18n.t("ra_Passwords are not equal!"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)});return M.createElement("div",{style:wn.fullWidth},M.createElement("div",{style:wn.halfWidth1},l),M.createElement("div",{style:wn.halfWidth2},v))}return l}}class Ua extends K{renderItem(n,i){return M.createElement(R.TextField,{variant:"standard",fullWidth:!0,disabled:!!i,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?M.createElement(R.IconButton,{tabIndex:-1,size:"small",onClick:()=>{j.Utils.copyToClipboard(this.getPattern(this.props.schema.pattern,null,this.props.schema.noTranslation)),window.alert(j.I18n.t("ra_Copied"))}},M.createElement(j.IconCopy,null)):void 0}},value:this.getPattern(this.props.schema.pattern,null,!0),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const Ga={warning:{"& .Mui-error":{color:"orange"}}};class Ka extends K{updateTimeout;async componentDidMount(){super.componentDidMount();let n=K.getValue(this.props.data,this.props.attr);n==null&&(n=""),this.setState({_value:n.toString(),oldValue:n.toString()});const i=await this.props.oContext.socket.getAdapterInstances(),l=`system.adapter.${this.props.oContext.adapterName}.${this.props.oContext.instance}`,v=await this.props.oContext.socket.getObject(l),s=v==null?void 0:v.common.host,c=[];i.forEach(d=>{var p,e,t,r;if(!d||d._id===l||d.common.host!==s||!((p=d.native)!=null&&p.bind))return;if(d!=null&&d.native&&d.native.secure&&d.native.leEnabled&&d.native.leUpdate){const h=parseInt(d.native.leCheckPort||d.native.lePort,10);h&&c.push({name:`${d._id.replace("system.adapter.","")} (LE)`,port:h,v6bind:d.native.bind.includes(":")?d.native.bind:d.native.v6bind,bind:d.native.bind,enabled:!!((e=d.common)!=null&&e.enabled)})}const o=parseInt((t=d==null?void 0:d.native)==null?void 0:t.port,10);o&&c.push({name:d._id.replace("system.adapter.",""),bind:d.native.bind,v6bind:d.native.bind.includes(":")?d.native.bind:d.native.v6bind,port:o,enabled:!!((r=d.common)!=null&&r.enabled)})}),this.setState({ports:c})}static getDerivedStateFromProps(n,i){const l=K.getValue(n.data,n.attr);return l==null||i.oldValue===null||i.oldValue===void 0||l.toString()!==parseInt(i._value,10).toString()&&l.toString()!==i.oldValue.toString()?{_value:l}:null}checkValue(n){if(n==null)return null;const i=this.props.schema.min===void 0?20:this.props.schema.min,l=this.props.schema.max||65535;n=n.toString().trim();const v=n===""?0:parseInt(n,10);return n!==""&&Number.isNaN(v)?"ra_Not a number":n!==""&&window.isFinite(Number(n))?v<i?"ra_Too small":v>l?"ra_Too big":n===""||n==="-"||Number.isNaN(v)?"ra_Not a number":null:"ra_Not a number"}renderItem(n,i){this.state.oldValue!==null&&this.state.oldValue!==void 0?(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=void 0,this.setState({oldValue:null})},30)):this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=void 0);const l=this.props.schema.min===void 0?20:this.props.schema.min,v=this.props.schema.max||65535;let s;if(this.state.ports){const c=parseInt(this.state._value,10);if(c){const d=this.state.ports.filter(p=>!this.props.data.bind||this.props.data.bind===p.bind||this.props.data.bind==="0.0.0.0"||p.bind==="0.0.0.0");let o=d.findIndex(p=>p.port===c&&p.enabled);o!==-1?n=j.I18n.t("ra_Port is already used by %s",this.state.ports[o].name):(o=d.findIndex(p=>p.port===c&&!p.enabled),o!==-1&&(s=!0,n=j.I18n.t("ra_Port could be used by %s",this.state.ports[o].name)))}}return!n&&this.state._value!==null&&this.state._value!==void 0&&(n=this.checkValue(this.state._value),typeof n=="string"&&(n=j.I18n.t(n))),M.createElement(R.TextField,{variant:"standard",type:"number",fullWidth:!0,slotProps:{htmlInput:{min:l,max:v,readOnly:this.props.schema.readOnly||!1}},value:this.state._value===null||this.state._value===void 0?"":this.state._value,error:!!n,disabled:!!i,sx:s?Ga.warning:void 0,onChange:c=>{const d=Number(c.target.value.toString().replace(/[^0-9]/g,"")).toString(),o=this.checkValue(d);o?this.onError(this.props.attr,j.I18n.t(o)):this.onError(this.props.attr),this.setState({_value:d,oldValue:this.state._value},()=>{if(d.trim()===parseInt(d,10).toString()){const p=this.onChange(this.props.attr,parseInt(d,10)||0);p instanceof Promise&&p.catch(e=>{console.error(`Cannot set value for ${this.props.attr}: ${e}`)})}})},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:n&&typeof n=="string"?n:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}class Ja extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.props.oContext.socket.getEnums("rooms").then(i=>{const l=Object.keys(i).map(v=>({value:this.props.schema.short?v.replace("enum.rooms.",""):v,label:this.getText(i[v].common.name),obj:i[v]}));this.props.schema.allowDeactivate!==!1&&l.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({value:n,selectOptions:l})}).catch(i=>console.error(`Cannot get enums: ${i}`))}renderItem(n,i){if(!this.state.selectOptions)return null;const l=this.state.selectOptions.find(v=>v.value===this.state.value);return M.createElement(R.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?M.createElement(R.InputLabel,null,this.getText(this.props.schema.label)):null,M.createElement(R.Select,{variant:"standard",error:!!n,disabled:!!i,value:this.state.value||"_",renderValue:()=>l?l.obj?M.createElement(j.TextWithIcon,{value:l.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):l.label:"",onChange:v=>{this.setState({value:v.target.value==="_"?"":v.target.value},()=>this.onChange(this.props.attr,this.state.value))}},this.state.selectOptions.map(v=>M.createElement(R.MenuItem,{key:v.value,value:v.value,style:v.value===K.DIFFERENT_VALUE?{opacity:.5}:{}},v.obj?M.createElement(j.TextWithIcon,{value:v.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):v.label))),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ya={noMargin:{"&>div":{marginTop:0}}};class Qa extends K{initialValue="";componentDidMount(){super.componentDidMount();let n=K.getValue(this.props.data,this.props.attr);this.props.schema.multiple&&(typeof n=="string"?n=[n]:n==null&&(n=[]));const i=[];(this.props.schema.options||[]).forEach(l=>{const v=l;Array.isArray(v.items)?(i.push({label:this.getText(l.label,this.props.schema.noTranslation),value:l.value,group:!0,color:l.color}),v.items.forEach(s=>i.push({label:this.getText(s.label,this.props.schema.noTranslation),value:s.value,hidden:s.hidden,color:l.color}))):i.push({label:this.getText(l.label,this.props.schema.noTranslation),value:l.value,hidden:l.hidden,color:l.color})}),Array.isArray(n)&&!this.props.schema.multiple?(this.initialValue=[...n],i.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),this.setState({value:K.DIFFERENT_VALUE,selectOptions:i})):this.setState({value:n,selectOptions:i})}_getValue(){let n=this.state.value===null||this.state.value===void 0?K.getValue(this.props.data,this.props.attr):this.state.value;return this.props.schema.multiple&&(typeof n=="string"?n=[n]:n==null&&(n=[])),n}renderItem(n,i){if(!this.state.selectOptions)return null;const l=(this.state.selectOptions||[]).filter(c=>c.hidden?this.props.custom?!this.executeCustom(c.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(c.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),v=this._getValue(),s=this.props.schema.multiple?null:l.find(c=>c.value==v);return M.createElement(R.FormControl,{variant:"standard",fullWidth:!0,sx:this.props.table!==void 0&&Ya.noMargin,id:`jsonSelect_${this.props.attr}_${this.props.index||this.props.index===0?this.props.index:""}`},this.props.schema.label?M.createElement(R.InputLabel,null,this.getText(this.props.schema.label)):null,M.createElement(R.Select,{variant:"standard",error:!!n,multiple:this.props.schema.multiple,disabled:!!i,value:v||"_",renderValue:c=>this.props.schema.multiple?M.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:.5}},c.map(d=>{const o=l.find(p=>p.value===d);if(o||this.props.schema.showAllValues!==!1){const p=(o==null?void 0:o.label)||d;return M.createElement(R.Chip,{key:d,label:p})}return null})):s!=null&&s.color?M.createElement("div",{style:{color:s.color}},(s==null?void 0:s.label)===void 0?c:s.label):(s==null?void 0:s.label)===void 0?c:s.label,onChange:c=>{this.setState({value:c.target.value==="_"?"":c.target.value},()=>{let d;this.state.value===K.DIFFERENT_VALUE?d=this.onChange(this.props.attr,this.initialValue):d=this.onChange(this.props.attr,this.state.value),d instanceof Promise&&d.catch(o=>console.error(o))})}},l.map((c,d)=>c.group?M.createElement(R.ListSubheader,{key:d,style:{color:c.color}},c.label):M.createElement(R.MenuItem,{key:d,value:c.value,style:c.value===K.DIFFERENT_VALUE?{opacity:.5}:{}},this.props.schema.multiple?M.createElement(R.Checkbox,{checked:v.includes(c.value),onClick:()=>{const o=JSON.parse(JSON.stringify(this._getValue())),p=v.indexOf(c.value);p!==-1?o.splice(p,1):(o.push(c.value),o.sort()),this.setState({value:o},()=>this.onChange(this.props.attr,o))}}):null,M.createElement(R.ListItemText,{primary:c.label,style:{color:c.color}})))),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Za={menuPaper:{maxHeight:800}};class Xa extends K{initialized=!1;localContext;askInstance(){if(this.props.alive){let n=this.props.schema.data;if(n===void 0&&this.props.schema.jsonData){const i=this.getPattern(this.props.schema.jsonData,null,!0);try{n=JSON.parse(i)}catch{console.error(`Cannot parse json data: ${i}`)}}n===void 0&&(n=null),this.setState({running:!0},()=>{this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",n).then(i=>this.setState({list:i,running:!1})).catch(i=>{console.error(`Cannot send command: ${i}`)})})}else{const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n,running:!1})}}getContext(){const n={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(i=>n[i]=K.getValue(this.props.data,i)),JSON.stringify(n)}_getValue(){let n=this.state.value===null||this.state.value===void 0?K.getValue(this.props.data,this.props.attr):this.state.value;return this.props.schema.multiple&&(typeof n=="string"?n=[n]:n==null&&(n=[])),n}renderItem(n,i){var c;if(this.props.alive){const d=this.getContext();(d!==this.localContext||!this.initialized)&&(this.localContext=d,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}const l=this._getValue();if(!this.props.alive||!this.state.running&&!((c=this.state.list)!=null&&c.length))return this.props.schema.multiple||this.props.schema.manual===!1?j.I18n.t("ra_Cannot retrieve options, as instance is offline"):M.createElement(R.TextField,{variant:"standard",fullWidth:!0,value:l,error:!!n,disabled:!!i,onChange:d=>{const o=d.target.value;this.setState({value:o},()=>this.onChange(this.props.attr,(o||"").trim()))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),slotProps:{input:{endAdornment:this.state.value&&!this.props.schema.noClearButton?M.createElement(R.InputAdornment,{position:"end"},M.createElement(R.IconButton,{tabIndex:-1,size:"small",onClick:()=>this.setState({value:""},()=>this.onChange(this.props.attr,""))},M.createElement(Z.Close,null))):null}}});if(this.state.running)return M.createElement(R.CircularProgress,{size:"24"});const v=this.state.list.filter(d=>d.hidden?this.props.custom?!this.executeCustom(d.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(d.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),s=v.find(d=>d.value===l);return M.createElement(R.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?M.createElement(R.InputLabel,null,this.getText(this.props.schema.label)):null,M.createElement(R.Select,{variant:"standard",error:!!n,multiple:this.props.schema.multiple,disabled:!!i,sx:{"&.MuiSelect-paper":this.props.schema.multiple?Za.menuPaper:void 0},value:l,renderValue:d=>this.props.schema.multiple?M.createElement(R.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.5}},d.map(o=>{const p=v.find(e=>e.value===o);if(p||this.props.schema.showAllValues!==!1){const e=(p==null?void 0:p.label)||o;return M.createElement(R.Chip,{key:o,label:e})}return null})):this.getText((s==null?void 0:s.label)||d,this.props.schema.noTranslation),onChange:d=>{const o=this.onChange(this.props.attr,d.target.value);o instanceof Promise&&o.catch(p=>console.error(`Cannot set value: ${p}`))}},v.map((d,o)=>d.group?M.createElement(R.ListSubheader,{key:o},this.getText(d.label,this.props.schema.noTranslation)):M.createElement(R.MenuItem,{key:o,value:d.value},this.props.schema.multiple?M.createElement(R.Checkbox,{checked:l.includes(d.value),onClick:()=>{const p=JSON.parse(JSON.stringify(this._getValue())),e=l.indexOf(d.value);e!==-1?p.splice(e,1):(p.push(d.value),p.sort()),this.setState({value:p},()=>this.onChange(this.props.attr,p))}}):null,M.createElement(R.ListItemText,{primary:d.label})))),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const vi={fullWidth:{width:"100%"}};function Qe(L){return L.split(".").reduce((n,i)=>(n<<8)+parseInt(i,10),0)>>>0}function qa(L,n){var v,s;const i=(s=(v=L==null?void 0:L.native)==null?void 0:v.hardware)==null?void 0:s.networkInterfaces;if(!i)return null;let l;return Object.keys(i).forEach(c=>i[c].forEach(d=>{d.internal||n.includes(":")&&d.family!=="IPv6"||n.includes(".")&&!n.match(/[^.\d]/)&&d.family!=="IPv4"||(d.family==="IPv4"&&!d.address.startsWith("172")&&(n==="127.0.0.0"||n==="localhost"||n.match(/[^.\d]/))?l=d.address:l||(d.family==="IPv4"&&n.includes(".")&&(Qe(n)&Qe(d.netmask),Qe(d.address)&Qe(d.netmask)),l=d.address))})),l||Object.keys(i).forEach(c=>i[c].forEach(d=>{d.internal||n.includes(":")&&d.family!=="IPv6"||n.includes(".")&&!n.match(/[^.\d]/)&&d.family!=="IPv4"||(d.family==="IPv6"&&(n==="127.0.0.0"||n==="localhost"||n.match(/[^.\d]/))?l=d.address:l||(d.family==="IPv4"&&n.includes(".")&&(Qe(n)&Qe(d.netmask),Qe(d.address)&Qe(d.netmask)),l=d.address))})),l||Object.keys(i).forEach(c=>{i[c].forEach(d=>{d.internal||n.includes(":")&&d.family!=="IPv6"||n.includes(".")&&!n.match(/[^.\d]/)&&d.family!=="IPv4"||(n==="127.0.0.0"||n==="localhost"||n.match(/[^.\d]/),l=d.address)})}),l||Object.keys(i).forEach(c=>{i[c].forEach(d=>{d.internal||(l=d.address)})}),l}class yi extends K{async componentDidMount(){var i;super.componentDidMount();let n=window.location.hostname;if(this.props.schema.openUrl){const l=await this.props.oContext.socket.getCurrentInstance(),v=await this.props.oContext.socket.getObject(`system.adapter.${l}`);if(v){const s=await this.props.oContext.socket.getObject(`system.host.${(i=v==null?void 0:v.common)==null?void 0:i.host}`);if(s){const c=qa(s,window.location.hostname);if(c)n=`${c}:${window.location.port}`;else{console.warn(`Cannot find suitable IP in host ${v.common.host} for ${v._id}`);return}}}}await new Promise(l=>{this.setState({_error:"",_message:"",hostname:n},l)}),this.props.schema.onLoaded&&this._onClick()}renderErrorDialog(){return this.state._error?M.createElement(j.DialogError,{text:this.state._error,onClose:()=>this.setState({_error:""})}):null}renderMessageDialog(){return this.state._message?M.createElement(j.DialogMessage,{text:this.state._message,onClose:()=>this.setState({_message:""})}):null}_onClick(){this.props.oContext.onCommandRunning(!0),this.setState({running:!0});const n=`${window.location.protocol}//${window.location.host}${window.location.pathname.replace(/\/index\.html$/,"")}`,i=`${window.location.protocol}//${this.state.hostname.split(":").length>3?`[${this.state.hostname}]`:this.state.hostname}${window.location.pathname.replace(/\/index\.html$/,"")}`;let l=this.props.schema.data;if(l===void 0&&this.props.schema.jsonData){const s=this.getPattern(this.props.schema.jsonData,{_origin:n,_originIp:i,...this.props.data},!0);try{l=JSON.parse(s)}catch{console.error(`Cannot parse json data: ${s}`)}}l===void 0&&(l=null),this.props.schema.openUrl&&!l&&(l={_origin:n,_originIp:i});let v;this.props.schema.timeout&&(v=setTimeout(()=>{this.props.oContext.onCommandRunning(!1),this.setState({_error:j.I18n.t("ra_Request timed out"),running:!1})},parseInt(this.props.schema.timeout,10)||1e4)),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",l).then(async s=>{var c,d,o,p,e;if(v&&(clearTimeout(v),v=void 0),s!=null&&s.error)if(this.props.schema.error&&this.props.schema.error[s.error]){let t=this.getText(this.props.schema.error[s.error]);(c=s.args)==null||c.forEach(r=>t=t.replace("%s",r)),this.setState({_error:t})}else this.setState({_error:s.error?typeof s.error=="string"?j.I18n.t(s.error):JSON.stringify(s.error):j.I18n.t("ra_Error")});else{if(s!=null&&s.command){(o=(d=this.props.oContext).onBackEndCommand)==null||o.call(d,s.command);return}if(s!=null&&s.reloadBrowser&&this.props.schema.reloadBrowser)window.location.reload();else if(s!=null&&s.openUrl&&this.props.schema.openUrl)window.open(s.openUrl,s.window||this.props.schema.window||"_blank");else if(s!=null&&s.result&&((p=this.props.schema.result)!=null&&p[s.result])){let t=this.getText(this.props.schema.result[s.result]);(e=s.args)==null||e.forEach(r=>t=t.replace("%s",r)),window.alert(t)}if(s!=null&&s.native&&this.props.schema.useNative){for(const[t,r]of Object.entries(s.native))await this.onChangeAsync(t,r);setTimeout(()=>this.props.oContext.forceUpdate(Object.keys(s.native),this.props.data),300)}else s!=null&&s.result?window.alert(typeof s.result=="object"?JSON.stringify(s.result):s.result):window.alert(j.I18n.t("ra_Ok"));s!=null&&s.saveConfig&&this.props.onChange(null,null,null,!0)}}).catch(s=>{this.props.schema.error&&this.props.schema.error[s.toString()]?this.setState({_error:this.getText(this.props.schema.error[s.toString()])}):this.setState({_error:j.I18n.t(s.toString())||j.I18n.t("ra_Error")})}).then(()=>{this.props.oContext.onCommandRunning(!1),this.setState({running:!1})})}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const n=this.state.confirmData||this.props.schema.confirm;let i=null;return n.type==="warning"?i=M.createElement(Z.Warning,null):n.type==="error"?i=M.createElement(Z.Error,null):n.type==="info"&&(i=M.createElement(Z.Info,null)),M.createElement(j.DialogConfirm,{title:this.getText(n.title)||j.I18n.t("ra_Please confirm"),text:this.getText(n.text),ok:this.getText(n.ok)||j.I18n.t("ra_Ok"),cancel:this.getText(n.cancel)||j.I18n.t("ra_Cancel"),icon:i||void 0,onClose:l=>this.setState({confirmDialog:!1},()=>l&&this._onClick())})}renderItem(n,i){const l=this.getIcon();return M.createElement("div",{style:vi.fullWidth},M.createElement(R.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:{...vi.fullWidth,...this.props.schema.controlStyle||void 0},disabled:i||!this.props.alive,startIcon:l,title:this.props.alive?this.getText(this.props.schema.title)||"":j.I18n.t("ra_Instance is not alive"),onClick:()=>{this.props.schema.confirm?this.setState({confirmDialog:!0}):this._onClick()}},this.props.schema.showProcess&&this.state.running?M.createElement(R.CircularProgress,{size:20,style:{marginRight:8}}):null,this.getText(this.props.schema.label,this.props.schema.noTranslation)),this.renderErrorDialog(),this.renderMessageDialog())}}const el={fullWidth:{width:"100%"}};class tl extends K{async _onClick(){var l,v;let n=this.props.schema.val;if(typeof n=="string"&&n.includes("${")){n=this.getPattern(n,null,!0);const s=await this.props.oContext.socket.getObject(this.props.schema.id);((l=s==null?void 0:s.common)==null?void 0:l.type)==="number"?n=parseFloat(n):((v=s==null?void 0:s.common)==null?void 0:v.type)==="boolean"&&(n=n==="true"||n===!0||n==="1"||n===1)}const i=(this.props.schema.id||"").replace(/%INSTANCE%/g,(this.props.oContext.instance||0).toString());try{await this.props.oContext.socket.setState(i,{val:n,ack:!!this.props.schema.ack}),this.props.schema.okText&&window.alert(this.getText(this.props.schema.okText))}catch(s){this.props.schema.error&&this.props.schema.error[s.toString()]?window.alert(this.getText(this.props.schema.error[s.toString()])):window.alert(j.I18n.t(s.toString())||j.I18n.t("ra_Error"))}}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const n=this.state.confirmData||this.props.schema.confirm;let i=null;return n.type==="warning"?i=M.createElement(Z.Warning,null):n.type==="error"?i=M.createElement(Z.Error,null):n.type==="info"&&(i=M.createElement(Z.Info,null)),M.createElement(j.DialogConfirm,{title:this.getText(n.title)||j.I18n.t("ra_Please confirm"),text:this.getText(n.text),ok:this.getText(n.ok)||j.I18n.t("ra_Ok"),cancel:this.getText(n.cancel)||j.I18n.t("ra_Cancel"),icon:i,onClose:l=>this.setState({confirmDialog:!1},()=>l&&this._onClick())})}renderItem(n,i){const l=this.getIcon();return M.createElement(R.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:el.fullWidth,disabled:i,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0}):await this._onClick()},startIcon:l||void 0},this.getText(this.props.schema.label,this.props.schema.noTranslation))}}const bi={fullWidth:{width:"100%"},slider:{marginLeft:10,marginRight:10,width:"calc(100% - 20px)"}};class nl extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({_value:n})}static getDerivedStateFromProps(n,i){if(n.schema.min!==void 0&&n.schema.min<0||n.schema.max!==void 0&&n.schema.max<0)return null;const l=K.getValue(n.data,n.attr);return l==null||l.toString()!==parseFloat(i._value).toString()?{_value:l}:null}renderItem(n,i){const l=this.props.schema.min||0,v=this.props.schema.max||100,s=this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):"",c=[{value:l,label:l+s},{value:v,label:v+s}];return M.createElement(R.Box,{style:bi.fullWidth},this.props.schema.label?M.createElement(R.Typography,{gutterBottom:!0},this.getText(this.props.schema.label)):null,M.createElement(R.Slider,{style:bi.slider,value:this.state._value,getAriaValueText:d=>d+s,step:this.props.schema.step||(v-l)/100,valueLabelDisplay:"auto",marks:c,min:l,max:v,disabled:!!i,onChange:d=>{const o=d.target.value;this.setState({_value:o},()=>this.onChange(this.props.attr,o))}}),this.props.schema.help?M.createElement(R.Typography,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}function Ze(L,n){return L==="edit"||L==="rename"?M.createElement(Z.Edit,{style:n}):L==="delete"?M.createElement(Z.Delete,{style:n}):L==="refresh"?M.createElement(Z.Refresh,{style:n}):L==="newDevice"||L==="new"||L==="add"?M.createElement(Z.Add,{style:n}):L==="discover"||L==="search"?M.createElement(Z.Search,{style:n}):L==="unpairDevice"||L==="unpair"?M.createElement(Z.LinkOff,{style:n}):L==="pairDevice"||L==="pair"?M.createElement(Z.Link,{style:n}):L==="identify"?M.createElement(Z.NotListedLocation,{style:n}):L==="play"?M.createElement(Z.PlayArrow,{style:n}):L==="stop"?M.createElement(Z.Stop,{style:n}):L==="pause"?M.createElement(Z.Pause,{style:n}):L==="forward"||L==="next"?M.createElement(Z.FastForward,{style:n}):L==="rewind"||L==="previous"?M.createElement(Z.FastRewind,{style:n}):L==="lamp"||L==="light"?M.createElement(Z.Lightbulb,{style:n}):L==="backlight"?M.createElement(Z.Fluorescent,{style:n}):L==="dimmer"?M.createElement(Z.WbIncandescent,{style:n}):L==="socket"?M.createElement(Z.Power,{style:n}):L==="settings"?M.createElement(Z.Settings,{style:n}):L==="users"||L==="group"?M.createElement(Z.Group,{style:n}):L==="user"?M.createElement(Z.Person,{style:n}):L==="qrcode"?M.createElement(Z.QrCode,{style:n}):L==="connection"?M.createElement(Z.Wifi,{style:n}):L==="no-connection"?M.createElement(Z.WifiOff,{style:n}):L==="visible"?M.createElement(Z.Visibility,{style:n}):null}function il(L,n){return typeof n=="string"?{"@keyframes newStateAnimationOnceColor":{"0%":{color:n},"100%":{color:L.palette.mode==="dark"?"#fff":"#000"}},animation:"newStateAnimationOnceColor 2s ease-in-out"}:{"@keyframes newStateAnimationOnce":{"0%":{color:"#00f900"},"80%":{color:L.palette.mode==="dark"?"#518851":"#008000"},"100%":{color:L.palette.mode==="dark"?"#fff":"#000"}},animation:"newStateAnimationOnce 2s ease-in-out"}}class rl extends K{controlTimeout=null;delayedUpdate={timer:null,value:null};getObjectID(){let n=this.props.schema.oid;return n.includes("${")&&(n=this.getPattern(n,null,!0)),this.props.schema.foreign?n:`${this.props.schema.system?"system.adapter.":""}${this.props.oContext.adapterName}.${this.props.oContext.instance||0}.${n}`}async componentDidMount(){var l,v;super.componentDidMount();const n=await this.props.oContext.socket.getObject(this.getObjectID());if((l=n==null?void 0:n.common)!=null&&l.states&&!this.props.schema.options){if(Array.isArray((v=n==null?void 0:n.common)==null?void 0:v.states)){const s={};n.common.states.forEach((c,d)=>{s[d.toString()]=c}),n.common.states=s}Object.keys(n.common.states).length||(n.common.states=void 0)}const i=this.props.schema.control||this.detectType(n);try{const s=await this.props.oContext.socket.getState(this.getObjectID());this.setState({stateValue:s?s.val:null,controlType:i,obj:n},async()=>{await this.props.oContext.socket.subscribeState(this.getObjectID(),this.onStateChanged)})}catch(s){console.error(`Cannot get state ${this.getObjectID()}: ${s}`),this.setState({controlType:i,obj:n})}}componentWillUnmount(){super.componentWillUnmount(),this.props.oContext.socket.unsubscribeState(this.getObjectID(),this.onStateChanged),this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null),this.controlTimeout&&(clearTimeout(this.controlTimeout),this.controlTimeout=null,this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1).catch(n=>console.error(`Cannot control value: ${n.toString()}`)))}onStateChanged=(n,i)=>{let l=i?i.val:null;this.state.controlType==="button"||this.state.controlType==="switch"?(l=!!l,this.state.stateValue!==l&&this.setState({stateValue:l})):l!==null&&(this.state.controlType==="slider"||this.state.controlType==="number")?(l=parseFloat(l),console.log(`${Date.now()} Received new value: ${l}`),l!==this.state.stateValue?(this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null),this.delayedUpdate.value=l,this.delayedUpdate.timer=setTimeout(()=>{this.setState({stateValue:this.delayedUpdate.value})},500)):this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null)):this.state.stateValue.toString()!==l.toString()&&this.setState({stateValue:l})};detectType(n){if(n||={},n.common||={},n.common.type==="boolean"){if(this.props.schema.controlled!==!1){if(n.common.read===!1||this.props.schema.controlled===!0)return"button";if(n.common.write||this.props.schema.controlled===!0)return"switch"}return"text"}return n.common.type==="number"&&this.props.schema.controlled!==!1?n.common.write||this.props.schema.controlled===!0?n.common.states||this.props.schema.options?"select":n.common.max!==void 0?"slider":"input":"text":n.common.write&&this.props.schema.controlled!==!1?n.common.states||this.props.schema.options?"select":"input":"text"}getNormalizedStates(){let n;return this.props.schema.options?n=this.props.schema.options.map(i=>typeof i=="string"?{value:i,label:this.getText(i,this.props.schema.noTranslation)}:{value:i.value,label:this.getText(i.label,this.props.schema.noTranslation),color:i.color}):this.state.obj.common.states?(n=[],Object.keys(this.state.obj.common.states).forEach(i=>{n.push({value:i,label:this.getText(this.state.obj.common.states[i],this.props.schema.noTranslation)})})):n=[],n}renderItem(n,i){var v,s,c,d,o;if(!this.state.obj)return null;let l;if(this.state.controlType==="select"||!this.state.controlType&&(this.state.obj.common.type==="number"||this.state.obj.common.type==="string")&&this.state.obj.common.write!==!1&&(this.props.schema.options||this.state.obj.common.states)){const p=this.getNormalizedStates(),e=p.find(t=>t.value===this.state.stateValue);l=M.createElement(R.FormControl,{fullWidth:!0},M.createElement(R.InputLabel,null,"$",this.getText(this.props.schema.label)),M.createElement(R.Select,{value:this.state.stateValue,disabled:!!this.props.schema.readOnly||i,onChange:t=>{this.setState({stateValue:t.target.value},()=>{let r=this.state.stateValue;this.state.obj.common.type==="number"&&(r=parseFloat(r.toString().replace(",","."))),this.props.oContext.socket.setState(this.getObjectID(),r,!1)})},renderValue:t=>e!=null&&e.color?M.createElement("div",{style:{color:e.color}},e.label):t},p.map(t=>M.createElement(R.MenuItem,{key:(t.value??"").toString(),value:t.value,style:{color:t.color}},"$",t.label))))}else if(this.state.controlType==="button"||!this.state.controlType&&this.state.obj.common.type==="boolean"&&(this.state.obj.common.write&&this.state.obj.common.read===!1||(v=this.state.obj.common.role)!=null&&v.includes("button"))){let p=null;this.props.schema.falseImage&&(p=Ze(this.props.schema.falseImage));const e=this.getText(this.props.schema.falseText||this.props.schema.label,this.props.schema.noTranslation);!e&&p?l=M.createElement(R.IconButton,{style:this.props.schema.falseTextStyle,disabled:!!this.props.schema.readOnly,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async t=>{t&&await this.props.oContext.socket.setState(this.getObjectID(),this.props.schema.buttonValue!==void 0?this.props.schema.buttonValue:!0,!1)}}):await this.props.oContext.socket.setState(this.getObjectID(),this.props.schema.buttonValue!==void 0?this.props.schema.buttonValue:!0,!1)}},p):l=M.createElement(R.Button,{variant:this.props.schema.variant||"contained",startIcon:p,style:this.props.schema.falseTextStyle,disabled:i||!!this.props.schema.readOnly,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async t=>{t&&await this.props.oContext.socket.setState(this.getObjectID(),this.props.schema.buttonValue!==void 0?this.props.schema.buttonValue:!0,!1)}}):await this.props.oContext.socket.setState(this.getObjectID(),this.props.schema.buttonValue!==void 0?this.props.schema.buttonValue:!0,!1)}},e||this.getObjectID().split(".").pop())}else if(this.state.controlType==="input"||!this.state.controlType&&this.state.obj.common.write&&this.state.obj.common.type==="string")l=M.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:8,alignItems:"baseline"}},M.createElement(R.TextField,{style:{flex:1},value:this.state.stateValue,variant:"standard",disabled:!!this.props.schema.readOnly||i,slotProps:{input:{endAdornment:this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||void 0},htmlInput:{readOnly:!!this.props.schema.readOnly}},onKeyUp:p=>{this.props.schema.setOnEnterKey&&p.key==="Enter"&&this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1)},onChange:p=>{this.setState({stateValue:p.target.value},()=>{this.props.schema.setOnEnterKey||this.props.schema.showEnterButton||(this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(async()=>{this.controlTimeout=null;let e=this.state.stateValue;this.state.obj.common.type==="number"&&(e=parseFloat(e.toString().replace(",","."))),await this.props.oContext.socket.setState(this.getObjectID(),e,!1)},this.props.schema.controlDelay||0))})},label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}),this.props.schema.showEnterButton&&!this.props.schema.readOnly&&M.createElement(R.Button,{variant:"outlined",disabled:i,onClick:()=>{this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1)}},this.getText(typeof this.props.schema.showEnterButton=="string"?this.props.schema.showEnterButton:"Set")));else{let p;this.props.schema.size==="normal"?p=16:this.props.schema.size==="large"?p=20:typeof this.props.schema.size=="number"&&(p=this.props.schema.size);let e=this.getText(this.props.schema.label,this.props.schema.noTranslation);const t={display:"flex",alignItems:"center",fontSize:p||"1rem",gap:8};this.props.schema.narrow||(t.width="100%",t.justifyContent="space-between"),e.trim()&&!e.trim().endsWith(":")&&this.props.schema.addColon&&(e=`${e.trim()}:`);let r;this.props.schema.blinkOnUpdate&&(r=il(this.props.oContext.theme,this.props.schema.blinkOnUpdate));let h;this.props.schema.labelIcon&&(h=M.createElement(j.Icon,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let a;if(e&&h?a=M.createElement("div",{style:{whiteSpace:"nowrap"}},h,e):e?a=M.createElement("div",{style:{whiteSpace:"nowrap"}},e):h&&(a=h),this.state.controlType==="switch"||!this.state.controlType&&this.state.obj.common.type==="boolean"&&(this.state.obj.common.write&&this.state.obj.common.read!==!1||(s=this.state.obj.common.role)!=null&&s.includes("switch"))){let u=null;const f=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(u=Ze(this.props.schema.falseImage,f?{marginLeft:8}:void 0));let m=null;const y=this.getText(this.props.schema.trueText,this.props.schema.noTranslation);this.props.schema.trueImage&&(m=Ze(this.props.schema.trueImage,y?{marginRight:8}:void 0)),l=M.createElement(R.Switch,{checked:!!this.state.stateValue,disabled:!!this.props.schema.readOnly||i,onChange:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async x=>{x&&await this.props.oContext.socket.setState(this.getObjectID(),!this.state.stateValue,!1)}}):await this.props.oContext.socket.setState(this.getObjectID(),!this.state.stateValue,!1)}}),(f||u||y||m)&&(l=M.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:14}},M.createElement("span",{style:this.props.schema.falseTextStyle},f,u),l,M.createElement("span",{style:this.props.schema.trueTextStyle},m,y))),a&&(l=M.createElement("div",{style:t},a,l))}else if(this.state.controlType==="slider"||!this.state.controlType&&this.state.obj.common.type==="number"&&(this.state.obj.common.write&&(this.state.obj.common.max!==void 0||this.state.obj.common.unit==="%")||(c=this.state.obj.common.role)!=null&&c.includes("slider")||(d=this.state.obj.common.role)!=null&&d.includes("dimmer")||(o=this.state.obj.common.role)!=null&&o.includes("blind"))){let u=null;const f=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(u=Ze(this.props.schema.falseImage,f?{marginLeft:8}:void 0));let m=null;const y=this.getText(this.props.schema.trueText,this.props.schema.noTranslation);this.props.schema.trueImage&&(m=Ze(this.props.schema.trueImage,y?{marginRight:8}:void 0));const x=this.props.schema.min===void 0?this.state.obj.common.min||0:this.props.schema.min,E=this.props.schema.max===void 0?this.state.obj.common.max===void 0?100:this.state.obj.common.max:this.props.schema.max,w=this.props.schema.step===void 0?this.state.obj.common.step||1:this.props.schema.step;l=M.createElement(R.Slider,{style:{width:"100%",flexGrow:1},min:x,max:E,disabled:!!this.props.schema.readOnly||i,step:w,value:this.state.stateValue,valueLabelDisplay:"auto",valueLabelFormat:g=>`${g}${this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||""}`,onChange:(g,S)=>{this.setState({stateValue:S},()=>{this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(async()=>{console.log(`${Date.now()} Send new value: ${this.state.stateValue}`),this.controlTimeout=null,await this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1)},this.props.schema.controlDelay||0)})}}),(f||u||y||m)&&(l=M.createElement("div",{style:{display:"flex",width:"100%",flexGrow:1,alignItems:"center"}},M.createElement("span",{style:{marginRight:16,...this.props.schema.falseTextStyle}},f,u),l,M.createElement("span",{style:{marginLeft:16,...this.props.schema.trueTextStyle}},m,y))),a&&(l=M.createElement("div",{style:t},a,l))}else if(this.state.obj.common.type==="number"&&this.state.obj.common.write&&!this.state.controlType){const u=this.props.schema.min===void 0?this.state.obj.common.min===void 0?void 0:this.state.obj.common.min:this.props.schema.min,f=this.props.schema.max===void 0?this.state.obj.common.max===void 0?void 0:this.state.obj.common.max:this.props.schema.max,m=this.props.schema.step===void 0?this.state.obj.common.step===void 0?void 0:this.state.obj.common.step:this.props.schema.step;l=M.createElement(R.TextField,{variant:"standard",style:{width:"100%"},value:this.state.stateValue,type:"number",disabled:!!this.props.schema.readOnly||i,slotProps:{htmlInput:{min:u,max:f,step:m,readOnly:!!this.props.schema.readOnly},input:{endAdornment:this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||void 0}},onChange:y=>{this.setState({stateValue:y.target.value},()=>{this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(async()=>{this.controlTimeout=null;const x=parseFloat(this.state.stateValue);await this.props.oContext.socket.setState(this.getObjectID(),x,!1)},this.props.schema.controlDelay||0)})},label:this.getText(this.props.schema.label,this.props.schema.noTranslation),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}else if(this.state.obj.common.type==="boolean"){let u=null,f,m;this.state.stateValue?(f=this.getText(this.props.schema.trueText,this.props.schema.noTranslation),this.props.schema.trueImage&&(u=Ze(this.props.schema.falseImage,f?{marginRight:8}:void 0)),m=this.props.schema.trueTextStyle):(f=this.getText(this.props.schema.falseText,this.props.schema.noTranslation),this.props.schema.falseImage&&(u=Ze(this.props.schema.falseImage,f?{marginLeft:8}:void 0)),m=this.props.schema.falseTextStyle),m=Object.assign(t,m),l=M.createElement("div",{style:m},a,M.createElement(R.Box,{style:{display:"flex",alignItems:"center",gap:8},sx:r,key:this.props.schema.blinkOnUpdate?f:void 0},u,f||(this.state.stateValue?j.I18n.t("ra_true"):j.I18n.t("ra_false"))))}else{const u=this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit;let f=this.state.stateValue;if(f!=null&&(this.props.schema.options||this.state.obj.common.states)){const E=this.getNormalizedStates().find(w=>w.value===f);E&&(f=E.label)}let m,y;this.state.controlType==="html"?(y=(f||"").toString(),m=M.createElement("span",{dangerouslySetInnerHTML:{__html:f}})):this.state.stateValue===null?(m="null",y=m):this.state.stateValue===void 0?(m="undefined",y=m):(m=f.toString(),y=m),l=M.createElement("div",{style:t},a,M.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:4}},M.createElement(R.Box,{sx:r,key:this.props.schema.blinkOnUpdate?y:void 0},m),u?M.createElement("span",{style:{opacity:.7,fontSize:"smaller"}},u):null))}}return l}}const Cn={fullWidth:L=>({width:"100%",backgroundColor:L.palette.mode==="dark"?"#FFF":"#000",borderStyle:"hidden"}),primary:L=>({backgroundColor:L.palette.primary.main}),secondary:L=>({backgroundColor:L.palette.secondary.main})};class sl extends K{renderItem(){return M.createElement(R.Box,{component:"hr",sx:j.Utils.getStyle(this.props.oContext.theme,Cn.fullWidth,this.props.schema.color==="primary"?Cn.primary:this.props.schema.color==="secondary"?Cn.secondary:{backgroundColor:this.props.schema.color||(this.props.oContext.themeType==="dark"?"#333":"#ddd")},{height:this.props.schema.color?this.props.schema.height||2:this.props.schema.height||1})})}}const ol={header:L=>({width:"100%",background:L.palette.primary.main,color:L.palette.primary.contrastText,padding:"4px !important",borderRadius:"3px",marginBlockEnd:0,marginBlockStart:0})};class al extends K{renderItem(){let n="h5";switch((this.props.schema.size||5).toString()){case"1":n="h1";break;case"2":n="h2";break;case"3":n="h3";break;case"4":n="h4";break;case"5":default:n="h5";break}return M.createElement(R.Box,{component:n,sx:ol.header},this.getText(this.props.schema.label||this.props.schema.text,this.props.schema.noTranslation))}}class ll extends K{renderItem(){let n=this.props.schema.src;return n&&!n.startsWith(".")&&!n.startsWith("http")&&!n.startsWith(`adapter/${this.props.oContext.adapterName}/`)&&!n.startsWith(`./adapter/${this.props.oContext.adapterName}/`)&&(n=`adapter/${this.props.oContext.adapterName}/${n}`),M.createElement("img",{src:n,style:{cursor:this.props.schema.href?"pointer":void 0,width:"100%",height:"100%"},onClick:this.props.schema.href?()=>this.props.schema.href&&window.open(this.props.schema.href,"_blank"):null,alt:""})}}function wi(L,n,i){return typeof i=="string"?{"@keyframes newValueAnimationOnceColor":{"0%":{color:n?`${i} !important`:i},"100%":{color:L.palette.mode==="dark"?n?"#fff !important":"#fff":n?"#000 !important":"#000"}},animation:"newValueAnimationOnceColor 2s ease-in-out"}:{"@keyframes newValueAnimationOnce":{"0%":{color:n?"#00f900 !important":"#00f900"},"80%":{color:L.palette.mode==="dark"?n?"#518851 !important":"#518851":n?"#008000 !important":"#008000"},"100%":{color:L.palette.mode==="dark"?n?"#fff !important":"#fff":n?"#000 !important":"#000"}},animation:"newValueAnimationOnce 2s ease-in-out"}}function Ci(L,n){return typeof n=="string"?{"@keyframes blinkAnimationColor":{"0%":{color:n},"100%":{color:L.palette.mode==="dark"?"#fff":"#000"}},animation:"blinkAnimationColor 2s ease-in-out infinite"}:{"@keyframes blinkAnimation":{"0%":{color:"#00f900"},"80%":{color:L.palette.mode==="dark"?"#518851":"#008000"},"100%":{color:L.palette.mode==="dark"?"#fff":"#000"}},animation:"blinkAnimation 2s ease-in-out infinite"}}const yt={label:{fontWeight:"bold",whiteSpace:"nowrap"},valueImage:{maxHeight:"100%"},valueAndUnit:{display:"flex",gap:4,alignItems:"baseline"},value:{},unit:{fontSize:"smaller",opacity:.7}};class hl extends K{renderItem(n){let i=this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation);this.props.schema.addColon&&typeof i=="string"&&!i.trim().endsWith(":")&&(i=`${i.trim()}:`),i&&(i.includes("<a ")||i.includes("<br")||i.includes("<b>")||i.includes("<i>"))&&(i=j.Utils.renderTextWithA(i));let l;this.props.schema.size==="normal"?l=16:this.props.schema.size==="large"?l=20:typeof this.props.schema.size=="number"&&(l=this.props.schema.size);const v={width:"100%",height:"100%",display:"flex",alignItems:"center",position:"relative",fontSize:l};this.props.schema.narrow?v.gap=8:v.justifyContent="space-between";let s,c;this.props.schema.data&&typeof this.props.schema.data=="object"&&this.props.schema.data.en?c=this.getText(this.props.schema.data):typeof this.props.schema.data=="object"||this.props.schema.data===void 0||this.props.schema.data===null?c=JSON.stringify(this.props.schema.data):typeof this.props.schema.data=="number"?(c=this.props.schema.data.toString(),this.props.oContext.isFloatComma&&(c=c.replace(".",","))):(!this.props.schema.booleanAsCheckbox||typeof this.props.schema.data!="boolean")&&(c=this.props.schema.data.toString());let d=!1;if(this.props.schema.booleanAsCheckbox&&typeof this.props.schema.data=="boolean")s=M.createElement(R.Checkbox,{checked:!!s,disabled:!0,size:this.props.schema.size==="small"?"small":this.props.schema.size==="large"?"large":void 0});else if(c.startsWith("data:image/"))s=M.createElement("div",{style:{...yt.value,...yt.valueImage,...this.props.schema.styleValue||void 0}},M.createElement(j.Icon,{src:c}));else{const t={...yt.value,...this.props.schema.styleValue||void 0};this.props.schema.html?s=M.createElement("div",{style:t,dangerouslySetInnerHTML:{__html:c}}):Array.isArray(this.props.schema.data)?(d=!0,s=M.createElement("div",{style:t},this.props.schema.data.map((r,h)=>M.createElement("div",{key:h},typeof r=="object"||r===null||r===void 0?JSON.stringify(r):r)))):c.includes(`
|
|
1397
|
+
`)?(d=!0,s=M.createElement("div",{style:t},j.Utils.renderTextWithA(c))):s=M.createElement("div",{style:t},c)}if(this.props.schema.blinkOnUpdate&&this.props.schema.blink){const t=wi(this.props.oContext.theme,!0,this.props.schema.blinkOnUpdate),r=Ci(this.props.oContext.theme,this.props.schema.blink);s=M.createElement(R.Box,{key:c,sx:{...t,...r}},s)}else if(this.props.schema.blinkOnUpdate){const t=wi(this.props.oContext.theme,!1,this.props.schema.blinkOnUpdate);s=M.createElement(R.Box,{key:c,sx:t},s)}else if(this.props.schema.blink){const t=Ci(this.props.oContext.theme,this.props.schema.blink);s=M.createElement(R.Box,{sx:t},s)}this.props.schema.unit&&(s=M.createElement("div",{style:yt.valueAndUnit},s,M.createElement("div",{style:{...yt.unit,...this.props.schema.styleUnit||void 0}},this.getText(this.props.schema.unit,this.props.schema.noTranslation))));let o;this.props.schema.labelIcon&&(o=M.createElement(j.Icon,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let p;this.props.schema.copyToClipboard&&(p=M.createElement(Z.ContentCopy,{className:"staticCopyButton",style:{position:"absolute",top:"calc(50% - 12px)",right:0,cursor:"pointer"},onClick:()=>{j.Utils.copyToClipboard(c),window.alert(j.I18n.t("ra_Copied"))}}));const e={"& .staticCopyButton":{display:"none"},"& .staticCopyButton:action":{transform:"scale(0.9)"},"&:hover .staticCopyButton":{display:"block"}};return this.props.schema.highlight&&(e["&:hover"]={backgroundColor:this.props.oContext.themeType==="dark"?"#51515180":"#b8b8b880"}),d&&(v.alignItems="top"),M.createElement(R.Box,{component:"div",style:v,sx:e},M.createElement("div",{style:{...yt.label,...this.props.schema.styleLabel||void 0}},o,i),s,p)}}const Ei={fullWidth:{height:"100%",width:"100%"},link:L=>({textDecoration:"underline",color:L.palette.mode==="dark"?"#4dabf5":"#254e72",cursor:"pointer"})};function Si(L,n,i){let l,v="";L?L.toString().startsWith("#")||L.toString().startsWith("/")?(l=n||"_self",v=L):L.startsWith("http://")||L.startsWith("https://")?(l=n||"_blank",v=L):(v=`#tab-instances/config/${i}/${L}`,l=n||"_self"):(v=`#tab-instances/config/${i}`,l=n||"_self"),l==="_self"?setTimeout(s=>{s.startsWith("#")?window.location.hash=s:s.startsWith("/")?v=`${window.location.protocol}:${window.location.host}${v}`:(s.startsWith("http://")||s.startsWith("https://"))&&(window.location.href=s)},100,v):(v.startsWith("#")?v=`${window.location.protocol}:${window.location.host}${window.location.pathname}${v}`:v.startsWith("/")&&(v=`${window.location.protocol}:${window.location.host}${v}`),window.open(v,l))}class Di extends K{renderItem(n,i){if(this.props.schema.button){const v=this.getIcon();return M.createElement(R.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:{...Ei.fullWidth,...this.props.schema.controlStyle||void 0},disabled:i,startIcon:v,onClick:this.props.schema.href?()=>{const s=this.props.schema.href?this.getText(this.props.schema.href,!0):null;s&&(this.props.oContext.onBackEndCommand?this.props.oContext.onBackEndCommand({command:"link",url:s,target:this.props.schema.target,close:this.props.schema.close}):Si(s,this.props.schema.target,`${this.props.oContext.adapterName}.${this.props.oContext.instance}`))}:null},this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation))}let l=this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation);return l&&(l.includes("<a ")||l.includes("<br")||l.includes("<b>")||l.includes("<i>"))&&(l=j.Utils.renderTextWithA(l)),M.createElement(R.Box,{component:"span",style:{...this.props.schema.controlStyle||void 0},sx:this.props.schema.href?Ei.link:void 0,onClick:this.props.schema.href?()=>{const v=this.props.schema.href?this.getText(this.props.schema.href,!0):null;v&&(this.props.oContext.onBackEndCommand?this.props.oContext.onBackEndCommand({command:"link",url:v,target:this.props.schema.target||"_blank",close:this.props.schema.close}):Si(v,this.props.schema.target||"_blank",`${this.props.oContext.adapterName}.${this.props.oContext.instance}`))}:null},l)}}const En=1024*1024,he={paper:{width:"100%",marginBottom:16,backgroundColor:"rgba(255, 255, 255, 0.1)"},headerText:{width:"100%"},table:{minWidth:750},label:{display:"flex",justifyContent:"space-between"},title:{flex:"1 1 100%"},rootTool:{paddingLeft:16,paddingRight:8},silver:{opacity:.2},flex:{display:"flex",alignItems:"baseline"},filteredOut:{padding:10,display:"flex",textAlign:"center"},buttonEmpty:{width:34,display:"inline-block"},buttonCell:{whiteSpace:"nowrap"},dropZone:{width:"100%",height:100,position:"relative"},dropZoneEmpty:{},uploadDiv:{position:"relative",width:"100%",minHeight:300,opacity:.9,marginTop:30,cursor:"pointer",outline:"none"},uploadDivDragging:{opacity:1,background:"rgba(128,255,128,0.1)"},uploadCenterDiv:{margin:5,border:"3px dashed grey",borderRadius:5,width:"calc(100% - 10px)",height:"calc(100% - 10px)",minHeight:300,position:"relative",display:"flex"},uploadCenterIcon:{paddingTop:10,width:48,height:48},uploadCenterText:{fontSize:16},uploadCenterTextAndIcon:{textAlign:"center",position:"absolute",top:0,bottom:0,left:0,right:0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},tooltip:{pointerEvents:"none"}};function cl(L,n,i){n=n||"key";const l=[];return Object.keys(L).forEach(v=>{const s={};s[n]=v,i?(s[i]=L[v],l.push(s)):l.push(Object.assign(s,L[v]))}),l}function xi(L,n,i){n=n||"key";const l={};return L.forEach(v=>{let s=v[n];s==null&&(s=""),delete v[n],i?l[s]=v[i]:l[s]=v}),l}function ul(L,n){let i="";for(let l=0;l<n.length;l++)i+=String.fromCharCode(L[l%L.length].charCodeAt(0)^n.charCodeAt(l));return i}function pl(L,n){let i="";for(let l=0;l<n.length;l++)i+=String.fromCharCode(L[l%L.length].charCodeAt(0)^n.charCodeAt(l));return i}class Ie extends K{filterRefs;typingTimer=null;resizeTimeout=null;secret="Zgfr56gFe87jJOM";refDiv;constructor(n){super(n),this.filterRefs={},this.props.schema.items=this.props.schema.items||[],this.props.schema.items.forEach(i=>{i.filter&&(this.filterRefs[i.attr]=qe.createRef())}),this.refDiv=M.createRef()}async componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr)||[];let i;if(this.props.schema.objKeyName?i=cl(n,this.props.schema.objKeyName,this.props.schema.objValueName):i=n,Array.isArray(i)||(i=[]),this.props.schema.encryptedAttributes){const l=await this.props.oContext.socket.getCompactSystemConfig();this.secret=(l==null?void 0:l.native.secret)||this.secret,n.forEach(v=>{this.props.schema.encryptedAttributes.forEach(s=>{v[s]&&(v[s]=pl(this.secret,v[s]))})})}this.setState({value:i,visibleValue:null,orderBy:"",order:"asc",iteration:0,filterOn:[],width:0},()=>this.validateUniqueProps())}componentWillUnmount(){this.typingTimer&&(clearTimeout(this.typingTimer),this.typingTimer=null),this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null),super.componentWillUnmount()}itemTable(n,i,l){var d;const{schema:v}=this.props,s=(d=v.items)==null?void 0:d.find(o=>o.attr===n);if(!s)return null;const c={items:{[n]:s}};return M.createElement(ft,{oContext:this.props.oContext,alive:this.props.alive,arrayIndex:l,changed:this.props.changed,common:this.props.common,expertMode:this.props.expertMode,custom:!0,data:i,globalData:this.props.data,index:l+this.state.iteration,onChange:(o,p)=>{const e=JSON.parse(JSON.stringify(this.state.value));e[l][o]=p,this.setState({value:e},()=>{this.validateUniqueProps(),this.onChangeWrapper(e,!0)})},onError:(o,p)=>this.onError(o,p),originalData:this.props.originalData,schema:c,table:!0,themeName:this.props.themeName})}validateUniqueProps(){if(this.props.schema.uniqueColumns)for(const n of this.props.schema.uniqueColumns){const i=[];this.state.value.find(v=>{const s=v[n];return i.includes(s)?(this.onError(n,"is not unique"),this.setState({errorMessage:j.I18n.t('Non-allowed duplicate entry "%s" in column "%s"',s,n)}),!0):(i.push(s),!1)})||(this.onError(n,null),this.setState({errorMessage:""}))}}static descendingComparator(n,i,l){return i[l]<n[l]?-1:i[l]>n[l]?1:0}static getComparator(n,i){return n==="desc"?(l,v)=>Ie.descendingComparator(l,v,i):(l,v)=>-Ie.descendingComparator(l,v,i)}static getFilterValue(n){var i,l,v;return(v=(l=(i=n==null?void 0:n.current)==null?void 0:i.children[0])==null?void 0:l.children[0])==null?void 0:v.value}static setFilterValue(n,i){return n.current.children[0].children[0].value=i}handleRequestSort=(n,i=!1)=>{const{order:l,orderBy:v}=this.state,c=i?l:v===n&&l==="asc"?"desc":"asc",d=this.stableSort(c,n);JSON.stringify(d)!==JSON.stringify(this.state.value)&&this.setState({value:d,order:c,orderBy:n,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,d))};stableSort=(n,i)=>{const{value:l}=this.state,v=Ie.getComparator(n,i),s=l.map((c,d)=>({el:c,index:d}));return s.sort((c,d)=>{const o=v(c.el,d.el);return o!==0?o:c.index-d.index}),s.map(c=>c.el)};renderShowHideFilter(n){return n.filter?M.createElement(R.IconButton,{title:j.I18n.t("ra_Show/hide filter input"),size:"small",onClick:()=>{const i=[...this.state.filterOn],l=this.state.filterOn.indexOf(n.attr);l===-1?i.push(n.attr):i.splice(l,1),this.setState({filterOn:i},()=>{l&&Ie.getFilterValue(this.filterRefs[n.attr])&&(Ie.setFilterValue(this.filterRefs[n.attr],""),this.applyFilter())})}},this.state.filterOn.includes(n.attr)?M.createElement(Z.FilterAltOff,null):M.createElement(Z.FilterAlt,null)):null}renderImportExportButtons(n){return M.createElement(M.Fragment,null,!n.noDelete&&n.import?M.createElement(R.Tooltip,{title:j.I18n.t("ra_Import data from %s file","CSV"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(R.IconButton,{size:"small",onClick:()=>this.setState({showImportDialog:!0})},M.createElement(Z.UploadFile,null))):null,n.export?M.createElement(R.Tooltip,{title:j.I18n.t("ra_Export data to %s file","CSV"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(R.IconButton,{size:"small",onClick:()=>this.onExport()},M.createElement(Z.Download,null))):null,n.noDelete?null:M.createElement(R.IconButton,{disabled:!0,size:"small"},M.createElement(Z.Delete,null)))}renderAddButton(n){return M.createElement(R.Tooltip,{title:n?j.I18n.t("ra_Cannot add items with set filter"):j.I18n.t("ra_Add row"),slotProps:{popper:{sx:he.tooltip}}},M.createElement("span",null,M.createElement(R.IconButton,{size:"small",color:"primary",disabled:!!n&&!this.props.schema.allowAddByFilter,onClick:this.onAdd},M.createElement(Z.Add,null))))}enhancedTableHead(n,i){var c;const{schema:l}=this.props,{order:v,orderBy:s}=this.state;return M.createElement(R.TableHead,null,M.createElement(R.TableRow,null,(c=l.items)==null?void 0:c.map((d,o)=>this.renderOneFilter({schema:l,style:{width:d.width},showAddButton:!o&&!l.noDelete,headCell:d,order:v,orderBy:s,index:o,doAnyFilterSet:i})),!l.noDelete&&M.createElement(R.TableCell,{style:{paddingLeft:20,paddingRight:20,width:n,textAlign:"right"},padding:"checkbox"},this.renderImportExportButtons(l))))}onDelete=n=>()=>{const i=JSON.parse(JSON.stringify(this.state.value));i.splice(n,1),this.setState({value:i,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))};onExport(){const{schema:n}=this.props,{value:i}=this.state,v=[n.items.map(d=>d.attr).join(";")];i.forEach(d=>{const o=[];n.items.forEach(p=>{var e;(e=d[p.attr])!=null&&e.includes(";")?o.push(`"${d[p.attr]}"`):o.push(d[p.attr]===void 0||d[p.attr]===null?"":d[p.attr])}),v.push(o.join(";"))});const s=document.createElement("a");s.setAttribute("href",`data:text/csv;charset=utf-8,${encodeURIComponent(v.join(`
|
|
1398
1398
|
`))}`);const c=new Date;s.setAttribute("download",`${c.getFullYear()}_${(c.getMonth()+1).toString().padStart(2,"0")}_${c.getDate().toString().padStart(2,"0")}_${this.props.oContext.adapterName}.${this.props.oContext.instance}_${this.props.attr}.csv`),s.style.display="none",document.body.appendChild(s),s.click(),document.body.removeChild(s)}onImport(n){var c;const i=n.split(`
|
|
1399
|
-
`).map(d=>d.replace("\r","").trim()),{schema:l}=this.props,v=i.shift().split(";").filter(d=>d&&l.items.find(o=>o.attr===d)),s=[];i.forEach(d=>{const o=d.split(";"),p={};for(let e=0;e<o.length;e++){let t=o[e];if(t.startsWith('"')){for(t=t.substring(1);e<o.length&&!t.endsWith('"');)t+=`;${o[++e]}`;t=t.substring(0,t.length-1)}let r=t;if(t==="true")r=!0;else if(t==="false")r=!1;else if(window.isFinite(t)){const h=this.props.schema.items.find(a=>a.attr===v[e]);h&&h.type==="number"?r=parseFloat(t):r=t}else r=t;p[v[e]]=r}s.push(p)}),s.length?(c=this.state.value)!=null&&c.length?this.setState({showTypeOfImportDialog:s,showImportDialog:!1}):this.setState({value:s,showImportDialog:!1}):window.alert("ra_No data found in file")}onClone=n=>()=>{const i=JSON.parse(JSON.stringify(this.state.value)),l=JSON.parse(JSON.stringify(i[n]));if(typeof this.props.schema.clone=="string"&&typeof l[this.props.schema.clone]=="string"){let v=1,s=l[this.props.schema.clone];const c=s.match(/(\d+)$/);for(c?(s=s.replace(c[0],""),v=parseInt(c[0],10)+1):s+="_";i.find(d=>d[this.props.schema.clone]===s+v.toString());)v++;l[this.props.schema.clone]=`${l[this.props.schema.clone]}_${v}`}i.splice(n,0,l),this.setState({value:i,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))};onChangeWrapper=(n,i)=>{this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout((l,v)=>{this.typingTimer=null;let s;if(this.props.schema.encryptedAttributes){const c=JSON.parse(JSON.stringify(l));if(c.forEach(d=>{this.props.schema.encryptedAttributes.forEach(o=>{d[o]&&(d[o]=hl(this.secret,d[o]))})}),this.props.schema.objKeyName){const d=Ai(c,this.props.schema.objKeyName,this.props.schema.objValueName);s=this.onChange(this.props.attr,d)}else s=this.onChange(this.props.attr,c)}else if(this.props.schema.objKeyName){const c=Ai(JSON.parse(JSON.stringify(l)),this.props.schema.objKeyName,this.props.schema.objValueName);s=this.onChange(this.props.attr,c)}else s=this.onChange(this.props.attr,l);s instanceof Promise&&s.catch(c=>console.error(`Cannot save: ${c}`)),v&&(this.applyFilter(!1,l),this.handleRequestSort(this.state.orderBy,!0))},300,n,i)};onAdd=()=>{var v;const{schema:n}=this.props,i=JSON.parse(JSON.stringify(this.state.value)),l=(v=n.items)==null?void 0:v.reduce((s,c)=>{let d;return c.defaultFunc?this.props.custom?d=c.defaultFunc?this.executeCustom(c.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,i.length,this.props.data):this.props.schema.default:d=c.defaultFunc?this.execute(c.defaultFunc,this.props.schema.default,this.props.data,i.length,this.props.data):this.props.schema.default:d=c.default===void 0?null:c.default,s[c.attr]=d,s},{});i.push(l),this.setState({value:i},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))};isAnyFilterSet(){return!!Object.keys(this.filterRefs).find(n=>Ie.getFilterValue(this.filterRefs[n]))}applyFilter=(n,i,l)=>{i=i||this.state.value;let v=i.map((s,c)=>c);if(Object.keys(this.filterRefs).forEach(s=>{let c=Ie.getFilterValue(this.filterRefs[s]);!n&&c?(c=c.toLowerCase(),v=v.filter(d=>i[d]&&i[d][s]&&i[d][s].toLowerCase().includes(c))):this.filterRefs[s].current&&Ie.setFilterValue(this.filterRefs[s],"")}),v.length===i.length&&(v=null),v===null&&this.state.visibleValue===null){l&&l();return}JSON.stringify(v)!==JSON.stringify(this.state.visibleValue)?this.setState({visibleValue:v},()=>l&&l()):l&&l()};onMoveUp(n){const i=JSON.parse(JSON.stringify(this.state.value)),l=i[n];i.splice(n,1),i.splice(n-1,0,l),this.setState({value:i,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))}onMoveDown(n){const i=JSON.parse(JSON.stringify(this.state.value)),l=i[n];i.splice(n,1),i.splice(n+1,0,l),this.setState({value:i,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))}onDrop(n){const i=n[0],l=new FileReader;l.onabort=()=>console.log("file reading was aborted"),l.onerror=()=>console.log("file reading has failed"),l.onload=()=>{if(i.size>En){window.alert(j.I18n.t("ra_File is too big. Max %sk allowed. Try use SVG.",Math.round(En/1024)));return}const v=new Uint8Array(l.result).reduce((s,c)=>s+String.fromCharCode(c),"");this.onImport(v)},l.readAsArrayBuffer(i)}showTypeOfImportDialog(){return this.state.showTypeOfImportDialog?M.createElement(N.Dialog,{open:!0,onClose:()=>this.setState({showTypeOfImportDialog:!1}),maxWidth:"md"},M.createElement(N.DialogTitle,null,j.I18n.t("ra_Append or replace?")),M.createElement(N.DialogContent,null,j.I18n.t("ra_Append %s entries or replace existing?",this.state.showTypeOfImportDialog.length)),M.createElement(N.DialogActions,null,M.createElement(N.Button,{variant:"contained",color:"primary",autoFocus:!0,onClick:()=>{const n=JSON.parse(JSON.stringify(this.state.value));this.state.showTypeOfImportDialog.forEach(i=>n.push(i)),this.setState({value:n,iteration:this.state.iteration+1e4,showTypeOfImportDialog:!1},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(n)))}},j.I18n.t("ra_Append")),M.createElement(N.Button,{variant:"contained",color:"secondary",autoFocus:!0,onClick:()=>{const n=this.state.showTypeOfImportDialog;this.setState({value:n,iteration:this.state.iteration+1e4,showTypeOfImportDialog:!1},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(n)))}},j.I18n.t("ra_Replace")))):null}showImportDialog(){return this.state.showImportDialog?M.createElement(N.Dialog,{open:!0,onClose:()=>this.setState({showImportDialog:!1}),sx:{"& .MuiDialog-paper":{minHeight:500}},maxWidth:"md",fullWidth:!0},M.createElement(N.DialogTitle,null,j.I18n.t("ra_Import from %s","CSV")),M.createElement(N.DialogContent,null,M.createElement(_i,{multiple:!1,accept:{"text/csv":[".csv"]},maxSize:En,onDragEnter:()=>this.setState({uploadFile:"dragging"}),onDragLeave:()=>this.setState({uploadFile:!0}),onDrop:(n,i)=>{this.setState({uploadFile:!1}),n.length?this.onDrop(n):window.alert(i&&i[0]&&i[0].errors&&i[0].errors[0]&&i[0].errors[0].message||j.I18n.t("ra_Cannot upload"))}},({getRootProps:n,getInputProps:i})=>M.createElement("div",{style:{...he.uploadDiv,...this.state.uploadFile==="dragging"?he.uploadDivDragging:void 0,...he.dropZone,...this.state.icon?void 0:he.dropZoneEmpty},...n()},M.createElement("input",{...i()}),M.createElement("div",{style:he.uploadCenterDiv},M.createElement("div",{style:he.uploadCenterTextAndIcon},M.createElement(Z.UploadFile,{style:he.uploadCenterIcon}),M.createElement("div",{style:he.uploadCenterText},this.state.uploadFile==="dragging"?j.I18n.t("ra_Drop file here"):j.I18n.t("ra_Place your files here or click here to open the browse dialog"))))))),M.createElement(N.DialogActions,null,M.createElement(N.Button,{variant:"contained",onClick:()=>this.setState({showImportDialog:!1}),color:"primary",startIcon:M.createElement(Z.Close,null)},j.I18n.t("Cancel")))):null}renderOneFilter(n){return M.createElement(N.TableCell,{key:`${n.headCell.attr}_${n.index}`,style:n.style,align:"left",sortDirection:n.orderBy===n.headCell.attr?n.order:!1},M.createElement("div",{style:{...he.flex,...n.schema.showFirstAddOnTop?{flexDirection:"column"}:void 0}},n.showAddButton?this.renderAddButton(n.doAnyFilterSet):null,n.headCell.sort&&M.createElement(N.TableSortLabel,{active:!0,style:n.orderBy!==n.headCell.attr?he.silver:void 0,direction:n.orderBy===n.headCell.attr?n.order:"asc",onClick:()=>this.handleRequestSort(n.headCell.attr)}),n.headCell.filter&&this.state.filterOn.includes(n.headCell.attr)?M.createElement(N.TextField,{variant:"standard",ref:this.filterRefs[n.headCell.attr],onChange:()=>this.applyFilter(),title:j.I18n.t("ra_You can filter entries by entering here some text"),slotProps:{input:{endAdornment:Ie.getFilterValue(this.filterRefs[n.headCell.attr])&&M.createElement(N.InputAdornment,{position:"end"},M.createElement(N.IconButton,{size:"small",tabIndex:-1,onClick:()=>{Ie.setFilterValue(this.filterRefs[n.headCell.attr],""),this.applyFilter()}},M.createElement(Z.Close,null)))}},fullWidth:!0,placeholder:this.getText(n.headCell.title)}):M.createElement("span",{style:he.headerText},this.getText(n.headCell.title)),this.renderShowHideFilter(n.headCell)))}enhancedFilterCard(){var c;const{schema:n}=this.props,{order:i,orderBy:l}=this.state;let v;this.props.schema.compact&&(v={paddingTop:1,paddingBottom:1});const s=!n.noDelete&&n.import||n.export;return s||n.items.find(d=>d.sort||d.filter)?M.createElement(N.Grid2,{size:{xs:n.xs||12,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0}},M.createElement(N.Card,null,M.createElement(N.Paper,{style:he.paper},M.createElement(N.Accordion,{style:he.paper},M.createElement(N.AccordionSummary,{expandIcon:M.createElement(Z.ExpandMore,null)},M.createElement(N.Typography,null,j.I18n.t("ra_Filter and Data Actions"))),M.createElement(N.AccordionDetails,null,M.createElement(N.Table,null,M.createElement(N.TableBody,null,((c=n.items)==null?void 0:c.find(d=>d.sort||d.filter))&&n.items.map((d,o)=>M.createElement(N.TableRow,{key:`${d.attr}_${o}`},this.renderOneFilter({schema:n,style:v,showAddButton:!1,headCell:d,order:i,orderBy:l,index:o,doAnyFilterSet:!1}))),s?M.createElement(N.TableRow,null,M.createElement(N.TableCell,{align:"left",style:v},M.createElement("span",{style:he.headerText},j.I18n.t("ra_Actions"))),M.createElement(N.TableCell,{style:v},this.renderImportExportButtons(n))):null))))))):null}enhancedBottomCard(){const{schema:n}=this.props;let i;this.props.schema.compact&&(i={paddingTop:1,paddingBottom:1});const l=this.isAnyFilterSet();return M.createElement(N.Grid2,{size:{xs:n.xs||12,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0}},M.createElement(N.Card,null,M.createElement(N.Paper,{style:he.paper},M.createElement(N.Table,null,M.createElement(N.TableBody,null,M.createElement(N.TableRow,null,M.createElement(N.TableCell,{colSpan:n.items.length+1,style:i},this.renderAddButton(l))))))))}renderCards(){const{schema:n}=this.props;let{visibleValue:i}=this.state,l;this.props.schema.compact&&(l={paddingTop:1,paddingBottom:1}),i||=this.state.value.map((s,c)=>c);const v=this.isAnyFilterSet();return M.createElement(N.Grid2,{container:!0},this.showImportDialog(),this.showTypeOfImportDialog(),this.enhancedFilterCard(),i.map((s,c)=>{var d;return M.createElement(N.Grid2,{key:`${s}_${c}`,size:{xs:n.xs||12,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0}},M.createElement(N.Card,null,M.createElement(N.Paper,{style:he.paper},M.createElement(N.Table,null,M.createElement(N.TableBody,null,(d=n.items)==null?void 0:d.map(o=>M.createElement(N.TableRow,{key:`${o.attr}_${s}`},M.createElement(N.TableCell,{align:"left",style:l},M.createElement("span",{style:he.headerText},this.getText(o.title))),M.createElement(N.TableCell,{align:"left",style:l},this.itemTable(o.attr,this.state.value[s],s)))),!n.noDelete&&M.createElement(N.TableRow,null,M.createElement(N.TableCell,{align:"left",style:l},M.createElement("span",{style:he.headerText},this.getText("Actions"))),M.createElement(N.TableCell,{align:"left",style:l},!v&&!this.state.orderBy?M.createElement(N.Tooltip,{title:j.I18n.t("ra_Move up"),slotProps:{popper:{sx:he.tooltip}}},M.createElement("span",null,M.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveUp(s),disabled:c===0},M.createElement(Z.ArrowUpward,null)))):null,!v&&!this.state.orderBy?M.createElement(N.Tooltip,{title:j.I18n.t("ra_Move down"),slotProps:{popper:{sx:he.tooltip}}},M.createElement("span",null,M.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveDown(s),disabled:c===i.length-1},M.createElement(Z.ArrowDownward,null)))):null,M.createElement(N.Tooltip,{title:j.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(N.IconButton,{size:"small",onClick:this.onDelete(s)},M.createElement(Z.Delete,null))),this.props.schema.clone?M.createElement(N.Tooltip,{title:j.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(N.IconButton,{size:"small",onClick:this.onClone(s)},M.createElement(Z.ContentCopy,null))):null)))))))}),this.enhancedBottomCard())}renderTable(){const{schema:n}=this.props;let{visibleValue:i}=this.state;i=i||this.state.value.map((s,c)=>c);const l=this.isAnyFilterSet();let v;return this.props.schema.compact&&(v={paddingTop:1,paddingBottom:1}),M.createElement(N.Paper,{style:he.paper},this.showImportDialog(),this.showTypeOfImportDialog(),n.label?M.createElement("div",{style:he.label},M.createElement(N.Toolbar,{variant:"dense",style:he.rootTool},M.createElement(N.Typography,{style:he.title,variant:"h6",id:"tableTitle",component:"div"},this.getText(n.label)))):null,M.createElement(N.TableContainer,null,M.createElement(N.Table,{style:he.table,size:"small"},this.enhancedTableHead(!l&&!this.state.orderBy?120:64,l),M.createElement(N.TableBody,null,i.map((s,c)=>{var d;return M.createElement(N.TableRow,{hover:!0,key:`${s}_${c}`},(d=n.items)==null?void 0:d.map(o=>M.createElement(N.TableCell,{key:`${o.attr}_${s}`,align:"left",style:v},this.itemTable(o.attr,this.state.value[s],s))),!n.noDelete&&M.createElement(N.TableCell,{align:"left",style:{...v,...he.buttonCell}},!l&&!this.state.orderBy?c?M.createElement(N.Tooltip,{title:j.I18n.t("ra_Move up"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveUp(s)},M.createElement(Z.ArrowUpward,null))):M.createElement("div",{style:he.buttonEmpty}):null,!l&&!this.state.orderBy?c<i.length-1?M.createElement(N.Tooltip,{title:j.I18n.t("ra_Move down"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveDown(s)},M.createElement(Z.ArrowDownward,null))):M.createElement("div",{style:he.buttonEmpty}):null,M.createElement(N.Tooltip,{title:j.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(N.IconButton,{size:"small",onClick:this.onDelete(s)},M.createElement(Z.Delete,null))),this.props.schema.clone?M.createElement(N.Tooltip,{title:j.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(N.IconButton,{size:"small",onClick:this.onClone(s)},M.createElement(Z.ContentCopy,null))):null))}),!n.noDelete&&i.length>=(n.showSecondAddAt||5)?M.createElement(N.TableRow,null,M.createElement(N.TableCell,{colSpan:n.items.length+1,style:{...v}},this.renderAddButton(l))):null)),!i.length&&this.state.value.length?M.createElement("div",{style:he.filteredOut},M.createElement(N.Typography,{style:he.title,variant:"h6",id:"tableTitle",component:"div"},j.I18n.t("ra_All items are filtered out"),M.createElement(N.IconButton,{size:"small",onClick:()=>this.applyFilter(!0)},M.createElement(Z.Close,null)))):null),n.help?M.createElement(N.FormHelperText,{style:{paddingLeft:16}},this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null,this.state.errorMessage?M.createElement("div",{style:{display:"flex",padding:"5px"}},M.createElement(Z.Warning,{color:"error"}),M.createElement("span",{style:{color:"red",alignSelf:"center"}},this.state.errorMessage)):null)}componentDidUpdate(){var n;(n=this.refDiv.current)!=null&&n.clientWidth&&this.refDiv.current.clientWidth!==this.state.width&&(this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{var i;this.resizeTimeout=null,this.setState({width:(i=this.refDiv.current)==null?void 0:i.clientWidth})},50))}getCurrentBreakpoint(){return this.state.width?this.state.width<600?"xs":this.state.width<900?"sm":this.state.width<1200?"md":this.state.width<1536?"lg":"xl":"md"}renderItem(){const{schema:n}=this.props;if(!this.state.value||!Array.isArray(this.state.value))return null;const i=this.getCurrentBreakpoint();let l;return i&&(n.useCardFor||["xs"]).includes(i)?l=this.renderCards():l=this.renderTable(),M.createElement("div",{ref:this.refDiv,style:{width:"100%"}},l)}}const Gt={indeterminate:{opacity:.5},label:{width:"100%",fontSize:14,marginBottom:2},helper:{width:"100%",fontSize:12},error:{width:"100%",fontSize:12,color:"#FF0000"}};class ul extends K{updateTimeout=null;componentDidMount(){super.componentDidMount();let n=K.getValue(this.props.data,this.props.attr);if(Array.isArray(n)&&this.props.oContext.multiEdit){n=K.DIFFERENT_VALUE,this.setState({value:n,oldValue:n,jsonError:!1});return}this.setState({value:n,oldValue:n,jsonError:this.validateJson(n)})}validateJson(n){let i=!1;if(this.props.schema.validateJson&&(n||!this.props.schema.allowEmpty))try{JSON.parse(n)}catch(l){console.log("Error in JSON",l),i=!0}return i}static getDerivedStateFromProps(n,i){if(n.oContext.multiEdit&&i.value===K.DIFFERENT_VALUE)return{value:K.DIFFERENT_VALUE};let l=K.getValue(n.data,n.attr);return l!=null&&(l=l.toString()),l==null||l!==i.value&&l!==i.oldValue?{value:l}:null}renderItem(n,i){const l=Array.isArray(this.state.value)||this.state.value===K.DIFFERENT_VALUE;if(this.props.schema.time){let c="";return typeof this.state.value=="number"?this.state.value&&this.state.value<9466596e5?c=new Date(this.state.value*1e3).toLocaleString():c=new Date(this.state.value).toLocaleString():typeof this.state.value=="string"&&(c=new Date(this.state.value).toLocaleString()),M.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:c,error:!!n||!!this.state.jsonError,disabled:!!i,slotProps:{htmlInput:{readOnly:!0}},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}if(this.state.oldValue!==null&&this.state.oldValue!==void 0?(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=null,this.setState({oldValue:null})},30)):this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=null),l){const c=K.getValue(this.props.data,this.props.attr),d=(c==null?void 0:c.filter(o=>o||o===0).map(o=>({label:o.toString()||"",value:o})))||[];return d.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),M.createElement(N.Autocomplete,{style:Gt.indeterminate,fullWidth:!0,value:d[0],onChange:(o,p)=>{const e=p?p.value:"",t=this.onChange(this.props.attr,e,()=>{this.setState({value:e,oldValue:e,jsonError:this.validateJson(p)})});t instanceof Promise&&t.catch(r=>console.error(`Cannot set value: ${r}`))},options:d,getOptionLabel:o=>o.label,renderInput:o=>M.createElement(N.TextField,{variant:"standard",...o,error:!!n,placeholder:this.getText(this.props.schema.placeholder),slotProps:{htmlInput:{...o.inputProps,maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1}},label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:!!i})})}let v,s;if((this.props.schema.readOnly||i)&&this.props.schema.copyToClipboard?(this.props.schema.minRows>1&&(s={position:"absolute",right:3,top:20,zIndex:1e3}),v=M.createElement(N.IconButton,{tabIndex:-1,style:s,size:"small",onClick:()=>{j.Utils.copyToClipboard(this.state.value),window.alert(j.I18n.t("ra_Copied"))}},M.createElement(j.IconCopy,null))):!this.props.schema.readOnly&&!i&&this.state.value&&!this.props.schema.noClearButton&&(this.props.schema.minRows>1&&(s={position:"absolute",right:3,top:20,zIndex:1e3}),v=M.createElement(N.IconButton,{style:s,size:"small",tabIndex:-1,onClick:()=>this.setState({value:"",oldValue:this.state.value},()=>this.onChange(this.props.attr,""))},M.createElement(Z.Close,null)),this.props.schema.minRows<=1&&(v=M.createElement(N.InputAdornment,{position:"end"},v))),this.props.schema.minRows>1){const c=this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation);return M.createElement("div",{style:{width:"100%",position:"relative"}},this.props.schema.label?M.createElement("div",{style:Gt.label},this.getText(this.props.schema.label)):null,M.createElement(N.TextareaAutosize,{style:{width:"100%",resize:"vertical",backgroundColor:this.props.oContext.themeType==="dark"?"#363636":"#cccccc",color:this.props.oContext.themeType==="dark"?"#fff":"#111"},minRows:this.props.schema.minRows,maxRows:this.props.schema.maxRows,value:this.state.value===null||this.state.value===void 0?"":this.state.value,disabled:!!i,readOnly:this.props.schema.readOnly||!1,onChange:d=>{const o=d.target.value;this.setState({value:o,oldValue:this.state.value,jsonError:this.validateJson(o)},()=>this.onChange(this.props.attr,o||""))},placeholder:this.getText(this.props.schema.placeholder)}),c||n||this.state.jsonError?M.createElement("div",{style:n?Gt.error:Gt.helper},n||(this.state.jsonError?j.I18n.t("ra_Invalid JSON"):c)):null)}return M.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!n||!!this.state.jsonError,disabled:!!i,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1},input:{endAdornment:v}},onChange:c=>{const d=c.target.value;this.setState({value:d,oldValue:this.state.value,jsonError:this.validateJson(d)},()=>this.onChange(this.props.attr,d))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.state.jsonError?j.I18n.t("ra_Invalid JSON"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const pl={fullWidth:{width:"100%"}};class dl extends K{initialized=!1;localContext;askInstance(){if(this.props.alive){let n=this.props.schema.data;if(n===void 0&&this.props.schema.jsonData){const i=this.getPattern(this.props.schema.jsonData,null,!0);try{n=JSON.parse(i)}catch{console.error(`Cannot parse json data: ${i}`)}}n===void 0&&(n=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",n).then(i=>{if(typeof i=="object"){const l=i;this.setState({text:l.text||"",style:l.style,icon:l.icon,iconStyle:l.iconStyle})}else typeof i=="string"&&this.setState({text:i||""})}).catch(i=>console.error(`Cannot send command: ${i}`))}}getLocalContext(){const n={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(i=>n[i]=K.getValue(this.props.data,i)),JSON.stringify(n)}renderItem(){if(this.props.alive){const i=this.getLocalContext();(i!==this.localContext||!this.initialized)&&(this.localContext=i,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}if(this.state.text===void 0)return null;let n=null;return this.state.icon&&(n=Ze(this.state.icon,{marginRight:this.state.text?8:void 0,...this.state.iconStyle||void 0}),n||(n=M.createElement(j.Icon,{src:this.state.icon,style:{marginRight:this.state.text?8:void 0,...this.state.iconStyle||void 0}}))),this.props.schema.container==="text"?M.createElement(N.TextField,{variant:"standard",fullWidth:!0,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?M.createElement(N.IconButton,{tabIndex:-1,size:"small",onClick:()=>{j.Utils.copyToClipboard(this.state.text),window.alert(j.I18n.t("ra_Copied"))}},M.createElement(j.IconCopy,null)):void 0}},value:this.state.text,label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}):M.createElement("div",{style:{...pl.fullWidth,...this.state.style||void 0}},n,this.props.schema.container==="html"?M.createElement("span",{dangerouslySetInnerHTML:{__html:this.state.text||""}}):this.state.text)}}class fl extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n})}renderItem(n,i){const l=this.props.schema.returnFormat!=="HH:mm:ss",v=new Date(Date.parse(`Thu, 01 Jan 1970 ${this.state.value||"00:00:00"}`));return M.createElement(ki.TimePicker,{sx:s=>({width:"100%",borderBottom:`1px solid ${s.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${s.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:"translate(0px, -9px) scale(0.75)"}}),ampm:this.props.oContext.systemConfig.dateFormat.includes("/"),timeSteps:this.props.schema.timeSteps||this.props.schema.timesteps||{hours:1,minutes:5,seconds:5},format:this.props.schema.format||"HH:mm:ss",disabled:!!i,value:v,onChange:s=>{let c;c=s instanceof Date?s.toTimeString().split(" ")[0]:s.toTimeString(),l&&(c=c.split(":").slice(0,2).join(":")),this.setState({value:c},()=>this.onChange(this.props.attr,this.state.value))},views:this.props.schema.views||["hours","minutes","seconds"],label:this.getText(this.props.schema.label)})}}function gl(L,n){let i;return n&&L.substring(0,n.length)===n?i=L.substring(n.length+1):i=L,i=i.replace(/\./g,"/").replace(/_/g," "),i}class ml extends K{componentDidMount(){var i;super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);if(!n&&((i=this.props.customObj)!=null&&i._id)){const l=gl(this.props.customObj._id,`${this.props.oContext.adapterName}.${this.props.oContext.instance}`);this.setState({value:l})}else this.setState({value:n||""})}renderItem(n,i){return M.createElement(N.TextField,{variant:"standard",fullWidth:!0,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0}},value:this.state.value,error:!!n,disabled:i,placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),onChange:l=>{const v=l.target.value;this.setState({value:v},()=>this.onChange(this.props.attr,v))}})}}class vl extends K{async componentDidMount(){var i;super.componentDidMount();const n=await this.props.oContext.socket.getObject("system.meta.uuid");this.setState({uuid:((i=n==null?void 0:n.native)==null?void 0:i.uuid)||"unknown"})}renderItem(n,i){return M.createElement(N.TextField,{variant:"standard",fullWidth:!0,error:!!n,disabled:!!i,slotProps:{htmlInput:{readOnly:!0},input:{endAdornment:M.createElement(N.IconButton,{tabIndex:-1,onClick:()=>{j.Utils.copyToClipboard(this.state.uuid),window.alert(j.I18n.t("ra_Copied %s",this.state.uuid))}},M.createElement(Z.ContentCopy,null))}},value:this.state.uuid||"",label:this.getText(this.props.schema.label)||j.I18n.t("ra_Serial number (UUID)"),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const $i={icon:{width:16,height:16,marginRight:8}};class yl extends K{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getUsers().then(n=>{const i={},l=j.I18n.getLanguage();this.props.schema.short?n.forEach(v=>{var s,c;return i[v._id]={color:(s=v.common)==null?void 0:s.color,icon:(c=v.common)==null?void 0:c.icon,name:j.Utils.getObjectNameFromObj(v,l)}}):n.forEach(v=>{var s,c;return i[v._id.replace(/^system\.user\./,"")]={color:(s=v.common)==null?void 0:s.color,icon:(c=v.common)==null?void 0:c.icon,name:j.Utils.getObjectNameFromObj(v,l)}}),this.setState({users:i})}).catch(n=>console.error(`Cannot get users: ${n}`))}renderItem(n,i){var v,s;const l=K.getValue(this.props.data,this.props.attr);return M.createElement(N.FormControl,{variant:"standard",fullWidth:!0},this.state.users&&this.props.schema.label?M.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.users?M.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:l,renderValue:c=>{var d,o,p;return M.createElement("span",null,this.state.users&&((d=this.state.users[c])!=null&&d.icon)?M.createElement(j.Icon,{src:this.state.users&&((o=this.state.users[c])==null?void 0:o.icon),style:$i.icon}):null,this.state.users&&((p=this.state.users[c])==null?void 0:p.name)||c||"")},style:{color:this.state.users&&((v=this.state.users[l])==null?void 0:v.color)||void 0,backgroundColor:j.Utils.getInvertedColor(this.state.users&&((s=this.state.users[l])==null?void 0:s.color),this.props.oContext.themeType)},onChange:c=>this.onChange(this.props.attr,c.target.value)},this.state.users&&Object.keys(this.state.users).map(c=>M.createElement(N.MenuItem,{style:{color:this.state.users[c].color||void 0,backgroundColor:j.Utils.getInvertedColor(this.state.users[c].color,this.props.oContext.themeType)},key:c,value:c},this.state.users[c].icon?M.createElement(j.Icon,{src:this.state.users[c].icon,style:$i.icon}):null,this.state.users[c].name))):M.createElement(N.TextField,{variant:"standard",error:!!n,disabled:!!i,value:l,onChange:c=>this.onChange(this.props.attr,c.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?M.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class bl extends K{async componentDidMount(){super.componentDidMount();const n=await ss(()=>import("./index-CttBOMyq.js").then(i=>i.i),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url);this.setState({QRCode:n.default})}renderItem(){const n=this.state.QRCode;return n?M.createElement(n,{value:this.props.schema.data,size:this.props.schema.size,fgColor:this.props.schema.fgColor,bgColor:this.props.schema.bgColor,level:this.props.schema.level}):null}}const wl={accordion:$s,alive:Ts,autocomplete:_s,autocompleteSendTo:ks,certCollection:Fs,certificate:Ls,certificates:Is,checkbox:Os,checkLicense:Xe,chip:ri,chips:ri,color:Ws,coordinates:zs,cron:Ms,custom:_t,datePicker:Hs,deviceManager:js,divider:il,file:eo,fileSelector:en,func:to,header:sl,image:ro,imageSendTo:io,infoBox:so,instance:oo,interface:ao,ip:no,jsonEditor:Oa,language:Na,license:Ba,number:Pa,oauth2:Wa,objectId:za,password:Ha,pattern:ja,port:Ua,qrCode:bl,room:Ga,select:Ja,selectSendTo:Qa,sendto:bi,sendTo:bi,setState:qa,slider:el,state:nl,staticImage:ol,staticInfo:al,staticLink:xi,staticText:xi,table:Ie,text:ul,textSendTo:dl,timePicker:fl,topic:ml,uuid:vl,user:yl},We={fullWidth:{width:"100%"},paper:{margin:1,width:"auto !important",overflowY:"auto",paddingBottom:1},paperWithIcons:{height:"calc(100vh - 259px) !important"},paperWithoutIcons:{height:"calc(100vh - 235px) !important"},padding:{padding:"10px"},heading:{},primary:L=>({backgroundColor:L.palette.primary.main,color:L.palette.mode==="dark"?"inherit":"#FFF"}),secondary:L=>({backgroundColor:L.palette.secondary.main})};class ft extends K{componentDidMount(){var n;super.componentDidMount(),(n=this.props.schema)!=null&&n.collapsable&&this.setState({expanded:(window._localStorage||window.localStorage).getItem(`${this.props.oContext.adapterName}.${this.props.attr}`)==="true"})}renderItems(n,i){return n?Object.keys(n).map(l=>{if(this.props.oContext.multiEdit&&n[l].noMultiEdit)return null;const v=n[l].type||"panel";let s,c="Use this.props.oContext.socket!";return v==="custom"?(n[l].url?s=_t:this.props.oContext.customs&&this.props.oContext.customs[n[l].component]?s=this.props.oContext.customs[n[l].component]:(console.error(`Cannot find custom component: ${n[l].component}`),s=K),c=this.props.oContext.socket):v==="panel"?s=ft:s=wl[v]||K,M.createElement(s,{socket:c,globalData:this.props.globalData,oContext:this.props.oContext,key:`${l}_${this.props.index===void 0?"":this.props.index}`,index:this.props.index,changed:this.props.changed,arrayIndex:this.props.arrayIndex,expertMode:this.props.expertMode,commandRunning:this.props.commandRunning,style:We.panel,common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,onError:this.props.onError,onChange:this.props.onChange,disabled:i,customObj:this.props.customObj,custom:this.props.custom,schema:n[l],attr:l,table:this.props.table})}):null}render(){const n=this.props.schema;if(!n)return null;const{disabled:i,hidden:l}=this.calculate(n),v=this.props.schema.items,s=this.props.schema.style||{};if(l){if(n.hideOnlyControl){const d=M.createElement(N.Grid2,{size:{xs:n.xs||void 0,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0},sx:j.Utils.getStyle(this.props.oContext.theme,{marginBottom:0,textAlign:"left"},s,this.props.oContext.themeType==="dark"&&n.darkStyle)});return n.newLine?M.createElement(M.Fragment,null,M.createElement("div",{style:{flexBasis:"100%",height:0}}),d):d}return null}if(this.props.table)return this.renderItems(v,i);if(this.props.custom)return M.createElement(N.Grid2,{key:`${this.props.attr}_${this.props.index}`,container:!0,style:We.fullWidth,columnSpacing:2,rowSpacing:1,sx:s},this.renderItems(v,i));let c;if(n.collapsable)c=M.createElement(N.Accordion,{key:`${this.props.attr}_${this.props.index}`,style:We.fullWidth,expanded:!!this.state.expanded,onChange:()=>{(window._localStorage||window.localStorage).setItem(`${this.props.oContext.adapterName}.${this.props.attr}`,this.state.expanded?"false":"true"),this.setState({expanded:!this.state.expanded})}},M.createElement(N.AccordionSummary,{expandIcon:M.createElement(Z.ExpandMore,null),sx:j.Utils.getStyle(this.props.oContext.theme,s,this.props.oContext.themeType&&n.darkStyle,n.color==="primary"?We.primary:n.color==="secondary"&&We.secondary,{width:"100%"})},M.createElement(N.Typography,{style:We.heading},this.getText(n.label))),M.createElement(N.AccordionDetails,null,M.createElement(N.Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:{...s,width:"100%",padding:"10px"}},this.renderItems(v,i))));else{const d=j.Utils.getStyle(this.props.oContext.theme,this.props.style,s,{width:"100%"},this.props.isParentTab&&We.paper,this.props.isParentTab&&(this.props.withoutSaveButtons?this.props.withIcons?{height:"calc(100% - 88px) !important"}:{height:"calc(100% - 64px) !important"}:this.props.withIcons?We.paperWithIcons:We.paperWithoutIcons));c=M.createElement(N.Box,{component:"div",key:`${this.props.attr}_${this.props.index}`,className:this.props.className,sx:d},M.createElement(N.Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:j.Utils.getStyle(this.props.oContext.theme,{width:"100%"},this.props.isParentTab&&We.padding,this.props.schema.innerStyle)},this.renderItems(v,i)))}if(!this.props.isParentTab){const d=M.createElement(N.Grid2,{title:this.getText(n.tooltip),size:{xs:n.xs||void 0,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0},sx:{marginBottom:0,textAlign:"left",...s}},c);return n.newLine?M.createElement(M.Fragment,null,M.createElement("div",{style:{flexBasis:"100%",height:0}}),d):d}return c}}const Kt={tabs:{height:"100%",width:"100%"},panel:{width:"100%",display:"block"},panelWithIcons:{height:"calc(100% - 72px)"},panelWithoutIcons:{height:"calc(100% - 48px)"}};class Cl extends K{resizeTimeout=null;refDiv;constructor(n){super(n);let i;if(this.props.root){const l=(window.location.hash||"").replace(/^#/,"").split("/");if(l.length>=3&&l[1]==="config"){const v=l[3],s=parseInt(v,10);v&&s.toString()===v?s>=0&&s<Object.keys(this.props.schema.items).length&&(i=Object.keys(this.props.schema.items)[s]):v&&Object.keys(this.props.schema.items).includes(v)&&(i=v),window.addEventListener("hashchange",this.onHashTabsChanged,!1)}}i===void 0&&(i=(window._localStorage||window.localStorage).getItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`)||Object.keys(this.props.schema.items)[0],Object.keys(this.props.schema.items).includes(i)||(i=Object.keys(this.props.schema.items)[0])),this.refDiv=M.createRef(),Object.assign(this.state,{tab:i,width:0,openMenu:null})}componentWillUnmount(){this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null),window.removeEventListener("hashchange",this.onHashTabsChanged,!1),super.componentWillUnmount()}onHashTabsChanged=()=>{const n=(window.location.hash||"").replace(/^#/,"").split("/");if(n.length>3&&n[1]==="config"){const i=n[3],l=parseInt(i,10);let v;l.toString()===i?l>=0&&l<Object.keys(this.props.schema.items).length&&(v=Object.keys(this.props.schema.items)[l]):Object.keys(this.props.schema.items).includes(i)&&(v=i),v!==void 0&&v!==this.state.tab&&((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,v),this.setState({tab:v}))}};getCurrentBreakpoint(){if(!this.state.width)return"md";if(!this.state.initialBreakpoint){let n;return this.state.width<600?n="xs":this.state.width<900?n="sm":this.state.width<1200?n="md":this.state.width<1536?n="lg":n="xl",setTimeout(()=>{this.setState({initialBreakpoint:n})},50),n}return this.state.initialBreakpoint}componentDidUpdate(){var n;!this.state.initialBreakpoint&&((n=this.refDiv.current)!=null&&n.clientWidth)&&this.refDiv.current.clientWidth!==this.state.width&&(this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{var i;this.resizeTimeout=null,this.setState({width:(i=this.refDiv.current)==null?void 0:i.clientWidth})},50))}onMenuChange(n){(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,n),this.setState({tab:n},()=>{if(this.props.root){const i=(window.location.hash||"").split("/");i.length>=3&&i[1]==="config"&&(i[3]=this.state.tab,window.location.hash=i.join("/"))}})}render(){const n=this.props.schema.items;let i=!1;const l=[];Object.keys(n).map(c=>{let d;if(n[c].expertMode&&!this.props.expertMode)return;if(this.props.custom){if(this.executeCustom(n[c].hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData))return;d=this.executeCustom(n[c].disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData)}else{if(this.execute(n[c].hidden,!1,this.props.data,this.props.index,this.props.globalData))return;d=this.execute(n[c].disabled,!1,this.props.data,this.props.index,this.props.globalData)}const o=this.getIcon(n[c].icon);i=i||!!o,l.push({icon:o,disabled:d,label:this.getText(n[c].label),name:c})}),l.find(c=>c.name===this.state.tab)||setTimeout(()=>this.setState({tab:l[0].name}),50);const v=this.getCurrentBreakpoint();let s;return v==="xs"&&l.length>2?s=M.createElement(N.Toolbar,{style:{top:2,backgroundColor:this.props.oContext.themeType==="dark"?"#222":"#DDD"},variant:"dense"},M.createElement(N.IconButton,{onClick:c=>this.setState({openMenu:c.currentTarget})},M.createElement(Z.Menu,null)),this.state.openMenu?M.createElement(N.Menu,{open:!0,anchorEl:this.state.openMenu,onClose:()=>this.setState({openMenu:null})},l.map(c=>M.createElement(N.MenuItem,{disabled:c.disabled,key:c.name,onClick:()=>{this.setState({openMenu:null},()=>this.onMenuChange(c.name))},selected:c.name===this.state.tab},i?M.createElement(N.ListItemIcon,null,c.icon):null,c.label))):null):s=M.createElement(N.Tabs,{variant:"scrollable",scrollButtons:"auto",style:this.props.schema.tabsStyle,value:this.state.tab,onChange:(c,d)=>this.onMenuChange(d)},l.map(c=>M.createElement(N.Tab,{id:c.name,wrapped:!0,disabled:c.disabled,key:c.name,value:c.name,iconPosition:this.props.schema.iconPosition||"start",icon:c.icon,label:c.label}))),M.createElement("div",{style:Kt.tabs,ref:this.refDiv},s,M.createElement(ft,{oContext:this.props.oContext,withoutSaveButtons:this.props.withoutSaveButtons,isParentTab:!0,changed:this.props.changed,key:this.state.tab,expertMode:this.props.expertMode,index:1001,arrayIndex:this.props.arrayIndex,globalData:this.props.globalData,commandRunning:this.props.commandRunning,style:{...Kt.panel,...i?Kt.panelWithIcons:Kt.panelWithoutIcons},common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,onChange:this.props.onChange,onError:this.props.onError,customObj:this.props.customObj,custom:this.props.custom,schema:n[this.state.tab],table:this.props.table,withIcons:i}))}}const El={root:{width:"100%",height:"100%"}};class Yt extends qe.Component{forceUpdateHandlers;errorTimeout=null;errorCached=null;oContext;constructor(n){super(n),this.state={originalData:JSON.stringify(this.props.data),changed:!1,errors:{},updateData:this.props.updateData||0,systemConfig:null,alive:!1,commandRunning:!1,schema:JSON.parse(JSON.stringify(this.props.schema))},this.forceUpdateHandlers={},this.buildDependencies(this.state.schema),this.readData()}static getDerivedStateFromProps(n,i){return n.updateData!==i.updateData?{updateData:n.updateData,originalData:JSON.stringify(n.data),schema:JSON.parse(JSON.stringify(n.schema))}:null}static async loadI18n(n,i,l){if(i===!0||i&&typeof i=="string"){const v=j.I18n.getLanguage(),s=typeof i=="string"?i:"i18n";let c=await n.fileExists(`${l}.admin`,`${s}/${v}.json`),d;if(c?d=`${s}/${v}.json`:(c=await n.fileExists(`${l}.admin`,`${s}/${v}/translations.json`),c?d=`${s}/${v}/translations.json`:v!=="en"&&(c=await n.fileExists(`${l}.admin`,`${s}/en.json`),c?d=`${s}/en.json`:(c=await n.fileExists(`${l}.admin`,`${s}/en/translations.json`),c&&(d=`${s}/en/translations.json`)))),d){const o=await n.readFile(`${l}.admin`,d);let p;o.file!==void 0?p=o.file:p=o;try{const e=JSON.parse(p);j.I18n.extendTranslations(e,v)}catch(e){return console.error(`Cannot parse language file "${l}.admin/${d}: ${e}`),""}return d}return console.warn(`Cannot find i18n for ${l} / ${d}`),""}return i&&typeof i=="object"&&j.I18n.extendTranslations(i),""}onCommandRunning=n=>this.setState({commandRunning:n});readData(){this.props.socket.getCompactSystemConfig().then(n=>this.props.socket.getState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`).then(i=>this.setState({systemConfig:n.common,alive:!!(i&&i.val)},()=>{this.updateContext(!0),this.props.custom||this.props.socket.subscribeState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,this.onAlive)}))).catch(n=>console.error(`Cannot read system config: ${n}`))}onAlive=(n,i)=>{!!(i!=null&&i.val)!==this.state.alive&&this.setState({alive:!!(i!=null&&i.val)})};onChange=(n,i,l,v)=>{if(this.props.onValueChange)this.props.onValueChange(n,i,v),l&&l();else if(n&&this.props.onChange){const s={changed:JSON.stringify(n)!==this.state.originalData};this.setState(s,()=>{this.props.onChange(n,s.changed,v),l&&l()})}else v&&this.props.onChange(null,null,v)};onError=(n,i)=>{this.errorCached=this.errorCached||JSON.parse(JSON.stringify(this.state.errors));const l=this.errorCached;i?l[n]=i:delete l[n],this.errorTimeout&&clearTimeout(this.errorTimeout),JSON.stringify(l)!==JSON.stringify(this.state.errors)?this.errorTimeout=setTimeout(()=>this.setState({errors:this.errorCached},()=>{this.errorTimeout=null,this.errorCached=null,this.props.onError(!!Object.keys(this.state.errors).length)}),50):this.errorCached=null};flatten(n,i){return i=i||{},n.items&&Object.keys(n.items).forEach(l=>{i[l]=n.items[l],this.flatten(n.items[l],i)}),i}buildDependencies(n){const i=this.flatten(n);Object.keys(i).forEach(l=>{var v,s,c,d,o,p,e,t,r,h;(v=i[l].confirm)!=null&&v.alsoDependsOn&&((s=i[l].confirm)==null||s.alsoDependsOn.forEach(a=>{if(!i[a])console.error(`[JsonConfigComponent] Attribute ${a} does not exist!`),a.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${a.replace(/^data\./,"")}" instead of "${a}"`);else{i[a].confirmDependsOn=i[a].confirmDependsOn||[];const u={...i[l],attr:l};u.confirm&&(u.confirm.cancel="Undo"),i[a].confirmDependsOn.push(u)}})),(c=i[l].onChange)!=null&&c.alsoDependsOn&&((d=i[l].onChange)==null||d.alsoDependsOn.forEach(a=>{if(!i[a])console.error(`[JsonConfigComponent] Attribute ${a} does not exist!`),a.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${a.replace(/^data\./,"")}" instead of "${a}"`);else{i[a].onChangeDependsOn=i[a].onChangeDependsOn||[];const u={...i[l],attr:l};i[a].onChangeDependsOn.push(u)}})),(o=i[l].hidden)!=null&&o.alsoDependsOn&&((p=i[l].hidden)==null||p.alsoDependsOn.forEach(a=>{if(!i[a])console.error(`[JsonConfigComponent] Attribute ${a} does not exist!`),a.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${a.replace(/^data\./,"")}" instead of "${a}"`);else{i[a].hiddenDependsOn=i[a].hiddenDependsOn||[];const u={...i[l],attr:l};i[a].hiddenDependsOn.push(u)}})),(e=i[l].label)!=null&&e.alsoDependsOn&&((t=i[l].label)==null||t.alsoDependsOn.forEach(a=>{if(!i[a])console.error(`[JsonConfigComponent] Attribute ${a} does not exist!`),a.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${a.replace(/^data\./,"")}" instead of "${a}"`);else{i[a].labelDependsOn=i[a].labelDependsOn||[];const u={...i[l],attr:l};i[a].labelDependsOn.push(u)}})),(r=i[l].help)!=null&&r.alsoDependsOn&&((h=i[l].help)==null||h.alsoDependsOn.forEach(a=>{if(!i[a])console.error(`[JsonConfigComponent] Attribute ${a} does not exist!`),a.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${a.replace(/^data\./,"")}" instead of "${a}"`);else{i[a].helpDependsOn=i[a].helpDependsOn||[];const u={...i[l],attr:l};i[a].helpDependsOn.push(u)}}))})}updateContext(n){this.oContext={DeviceManager:this.props.DeviceManager,adapterName:this.props.adapterName,changeLanguage:this.changeLanguage,common:this.props.common,customs:this.props.customs,dateFormat:this.props.dateFormat,embedded:this.props.embedded,forceUpdate:this.forceAttrUpdate,imagePrefix:this.props.imagePrefix,instance:this.props.instance,instanceObj:this.props.instanceObj,isFloatComma:this.props.isFloatComma,multiEdit:this.props.multiEdit,onBackEndCommand:this.props.onBackEndCommand,onCommandRunning:this.onCommandRunning,onValueChange:this.props.onValueChange,registerOnForceUpdate:this.registerOnForceUpdate,socket:this.props.socket,systemConfig:this.state.systemConfig,theme:this.props.theme,themeType:this.props.themeType,_themeName:this.props.themeName,updateData:this.state.updateData},n&&this.forceUpdate()}renderItem(n){return n.type==="tabs"?M.createElement(Cl,{withoutSaveButtons:this.props.withoutSaveButtons,oContext:this.oContext,alive:this.state.alive,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,data:this.props.data,onChange:this.onChange,onError:(i,l)=>this.onError(i,l),originalData:JSON.parse(this.state.originalData),root:!0,schema:n,expertMode:this.props.expertMode,themeName:this.props.themeName}):n.type==="panel"||!n.type?M.createElement(ft,{withoutSaveButtons:this.props.withoutSaveButtons,oContext:this.oContext,alive:this.state.alive,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,data:this.props.data,expertMode:this.props.expertMode,index:1e3,isParentTab:!this.props.embedded&&!this.props.withoutSaveButtons,onChange:this.onChange,onError:(i,l)=>this.onError(i,l),originalData:JSON.parse(this.state.originalData),root:!0,schema:n,themeName:this.props.themeName}):(console.error(`Unknown item type in root: ${JSON.stringify(n)}`),null)}changeLanguage=()=>{this.forceUpdate()};forceAttrUpdate=(n,i)=>{Array.isArray(n)?n.forEach(l=>this.forceUpdateHandlers[l]&&this.forceUpdateHandlers[l](i)):this.forceUpdateHandlers[n]&&this.forceUpdateHandlers[n](i)};registerOnForceUpdate=(n,i)=>{i?this.forceUpdateHandlers[n]=i:this.forceUpdateHandlers[n]&&delete this.forceUpdateHandlers[n]};render(){return!this.state.systemConfig||!this.oContext?M.createElement(N.LinearProgress,null):(this.oContext._themeName!==this.props.themeName&&(this.oContext._themeName=this.props.themeName,setTimeout(()=>this.updateContext(!0),0)),M.createElement("div",{style:{...!this.props.embedded||this.props.withoutSaveButtons?El.root:void 0,...this.props.style,...this.state.schema.style}},this.renderItem(this.state.schema)))}}const ht={root:{width:"100%",height:"100%",overflow:"hidden",position:"relative"},scroll:{height:"calc(100% - 48px)",overflowY:"auto"},exportImportButtons:{position:"absolute",top:5,right:0,zIndex:3},button:{marginRight:"5px"},tooltip:{pointerEvents:"none"}};function Sl(L,n){let i="";for(let l=0;l<n.length;l++)i+=String.fromCharCode(L[l%L.length].charCodeAt(0)^n.charCodeAt(l));return i}function Dl(L,n){let i="";for(let l=0;l<n.length;l++)i+=String.fromCharCode(L[l%L.length].charCodeAt(0)^n.charCodeAt(l));return i}function xl(L,n){if(typeof n!="string")return n;if(!n.startsWith("$/aes-192-cbc:")||!/^[0-9a-f]{48}$/.test(L))return Sl(L,n);const i=n.split(":",3),l=window.CryptoJS.enc.Hex.parse(L),v=window.CryptoJS.enc.Hex.parse(i[1]),s=window.CryptoJS.lib.CipherParams.create({ciphertext:window.CryptoJS.enc.Hex.parse(i[2])}),c=window.CryptoJS.AES.decrypt(s,l,{iv:v});return window.CryptoJS.enc.Utf8.stringify(c)}function Al(L,n,i){if(typeof n!="string")return n;if(!/^[0-9a-f]{48}$/.test(L))return Dl(L,n);let l;l=window.CryptoJS.lib.WordArray.random(128/8);const v=window.CryptoJS.enc.Hex.parse(L),s=window.CryptoJS.AES.encrypt(n,v,{iv:l}).ciphertext;return`$/aes-192-cbc:${window.CryptoJS.enc.Hex.stringify(l)}:${s}`}function Ti(L,n){var i;return document.getElementById(n)?(i=document.getElementById(n))==null?void 0:i.onload:new Promise(l=>{const v=document.createElement("script");v.setAttribute("id",n),v.onload=l,v.src=L,document.getElementsByTagName("head")[0].appendChild(v)})}let $l=class extends j.Router{fileSubscribed=[];fileLangSubscribed="";secret;constructor(n){super(n),this.state={updateData:0,changed:!1,confirmDialog:!1,theme:j.Theme(n.themeName),saveConfigDialog:!1,hash:"_"},this.secret=n.secret||"",this.getInstanceObject().then(i=>this.getConfigFile().then(l=>Yt.loadI18n(this.props.socket,l==null?void 0:l.i18n,this.props.adapterName).then(v=>{v&&(this.fileLangSubscribed||(this.fileLangSubscribed=v,this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange))),i?this.setState({schema:l,data:i.native,common:i.common,hash:ni(JSON.stringify(l)).toString()}):window.alert(`Instance system.adapter.${this.props.adapterName}.${this.props.instance} not found!`)})))}componentWillUnmount(){super.componentWillUnmount(),this.fileSubscribed.length&&(this.props.socket.unsubscribeFiles(`${this.props.adapterName}.admin`,this.fileSubscribed,this.onFileChange),this.fileSubscribed=[]),this.fileLangSubscribed&&(this.props.socket.unsubscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange),this.fileLangSubscribed="")}handleFileSelect=n=>{const i=n.target.files[0];if(i){const l=new FileReader;l.onload=v=>{if(!v.target)return;const s=v.target.result;try{const c=JSON.parse(s);this.setState({data:c,changed:JSON.stringify(c)!==JSON.stringify(this.state.originalData)})}catch{window.alert(j.I18n.t("[JsonConfig] Failed to parse JSON file"))}},l.readAsText(i)}else window.alert(j.I18n.t("[JsonConfig] Failed to open JSON File"))};getExportImportButtons(){return M.createElement("div",{style:ht.exportImportButtons},M.createElement(N.Tooltip,{title:this.props.t("Import settings from JSON file"),slotProps:{popper:{sx:ht.tooltip}}},M.createElement(N.Fab,{size:"small",sx:{"&.MuiFab-root":ht.button},onClick:()=>{const n=document.createElement("input");n.setAttribute("type","file"),n.setAttribute("id","files"),n.setAttribute("opacity",0),n.addEventListener("change",i=>this.handleFileSelect(i),!1),n.click()}},M.createElement(Z.Publish,null))),M.createElement(N.Tooltip,{title:this.props.t("Export setting to JSON file"),slotProps:{popper:{sx:ht.tooltip}}},M.createElement(N.Fab,{size:"small",sx:{"&.MuiFab-root":ht.button},onClick:()=>{this.state.data&&j.Utils.generateFile(`${this.props.adapterName}.${this.props.instance}.json`,this.state.data)}},M.createElement(Z.Publish,{style:{transform:"rotate(180deg)"}}))))}onFileChange=async(n,i,l)=>{var v;if(n===`${this.props.adapterName}.admin`&&l){if(i===this.fileLangSubscribed)try{await Yt.loadI18n(this.props.socket,(v=this.state.schema)==null?void 0:v.i18n,this.props.adapterName),this.setState({hash:`${this.state.hash}1`})}catch{}else if(this.fileSubscribed.includes(i))try{const s=await this.getConfigFile(this.fileSubscribed[0]);this.setState({schema:s,hash:ni(JSON.stringify(s)).toString()})}catch{}}};async getInstanceObject(){var n;try{const i=await this.props.socket.getObject(`system.adapter.${this.props.adapterName}.${this.props.instance}`);if(Array.isArray(i.encryptedNative)){if(!this.secret){const l=await this.props.socket.getSystemConfig();await Ti("../../lib/js/crypto-js/crypto-js.js","crypto-js"),this.secret=l.native.secret}return(n=i.encryptedNative)==null||n.forEach(l=>{i.native[l]&&(i.native[l]=xl(this.secret,i.native[l]))}),i}return i}catch(i){window.alert(`[JsonConfig] Cannot read instance object: ${i}`)}return null}renderDialogConfirm(){return this.state.confirmDialog?M.createElement(j.DialogConfirm,{title:j.I18n.t("ra_Please confirm"),text:j.I18n.t("ra_Some data are not stored. Discard?"),ok:j.I18n.t("ra_Discard"),cancel:j.I18n.t("ra_Cancel"),onClose:n=>this.setState({confirmDialog:!1},()=>n&&j.Router.doNavigate(null))}):null}async scanForInclude(n,i){if(typeof n["#include"]=="string"){const v=await this._getConfigFile(n["#include"],[...i]);return delete n["#include"],v&&(n={...n,...v}),n}const l=Object.keys(n);for(let v=0;v<l.length;v++)n[l[v]]&&typeof n[l[v]]=="object"&&(n[l[v]]=await this.scanForInclude(n[l[v]],i));return n}async getConfigFile(n){return this._getConfigFile(n)}async _getConfigFile(n,i){if(n=n||"jsonConfig.json5",i=i||[],i.includes(n))return window.alert(`[JsonConfig] Circular reference in file: ${n} => ${i.join(" => ")}`),null;i.push(n);try{await this.props.socket.fileExists(`${this.props.adapterName}.admin`,n)||(n="jsonConfig.json");const v=await this.props.socket.readFile(`${this.props.adapterName}.admin`,n);let s="",c="";if(v.file!==void 0&&(c=v.file),typeof c=="string")s=c;else if(c.type==="Buffer"){let d="";const o=new Uint8Array(c.data),p=o.byteLength;for(let e=0;e<p;e++)d+=String.fromCharCode(o[e]);s=d}this.fileSubscribed.includes(n)||(this.fileSubscribed.push(n),await this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,n,this.onFileChange));try{return await this.scanForInclude(Ii.parse(s),i)}catch(d){window.alert("[JsonConfig] Cannot parse json5 config!"),console.log(d)}}catch(l){this.state.schema||window.alert(`[JsonConfig] Cannot read file "${n}: ${l}`)}return null}renderSaveConfigDialog(){return this.state.saveConfigDialog?M.createElement(j.DialogConfirm,{title:j.I18n.t("ra_Please confirm"),text:j.I18n.t("Save configuration?"),ok:j.I18n.t("ra_Save"),cancel:j.I18n.t("ra_Cancel"),onClose:n=>this.setState({saveConfigDialog:!1},()=>n&&this.onSave(!0))}):null}findAttr(n,i){if(i=i||this.state.schema,i!=null&&i.items){if(n in i.items)return i.items[n];for(const l of Object.values(i.items)){const v=this.findAttr(n,l);if(v)return v}}return null}postProcessing(n,i,l){if(l=l||this.state.schema,!n){console.error(`Data is empty in postProcessing: ${i}, ${JSON.stringify(l)}`);return}const v=n[i];if(l.items)if(l.type==="table"){const s=v;if(!Array.isArray(s))return;for(const c of s)for(const d of l.items)this.postProcessing(c,d.attr,d)}else for(const[s,c]of Object.entries(l.items)){if(c.type==="panel"||c.type==="tabs"||c.type==="accordion")return;this.postProcessing(n,s,c)}else if(i&&typeof v=="string")if(l.type==="text")l.trim!==!1&&(n[i]=v.trim());else if(l.type==="ip")n[i]=v.trim();else if(l.type==="number"){const s=parseFloat(v.toString().replace(",","."));l.min!==void 0&&s<l.min?n[i]=l.min:l.max!==void 0&&s>l.max?n[i]=l.max:n[i]=s}else if(l.type==="port"){const s=parseInt(v.toString(),10);l.min!==void 0&&s<l.min?n[i]=l.min:l.max!==void 0&&s>l.max&&(n[i]=l.max),n[i]!==0&&s<20?n[i]=20:s>65535?n[i]=65535:n[i]=s}else l.type==="checkbox"&&(n[i]=n[i]===!0||n[i]==="true"||n[i]==="on"||n[i]===1||n[i]==="1")}async onSave(n,i){if(n){const l=await this.getInstanceObject();if(!l){console.error("Something went wrong: may be no connection?"),window.alert("Something went wrong: may be no connection?");return}if(!this.state.data||!this.state.schema)return;const v={};for(const c of Object.keys(this.state.data)){const d=this.findAttr(c);(!d||!d.doNotSave||d.type==="state")&&!c.startsWith("_")?K.setValue(l.native,c,this.state.data[c]):(K.setValue(l.native,c,null),v[c]=this.state.data[c])}try{const c=JSON.parse(JSON.stringify(l));if(Array.isArray(c.encryptedNative)){await Ti("../../lib/js/crypto-js/crypto-js.js","crypto-js");for(const d of c.encryptedNative)c.native[d]&&(c.native[d]=Al(this.secret,c.native[d]))}await this.props.socket.setObject(c._id,c)}catch(c){window.alert(`[JsonConfig] Cannot set object: ${c}`)}const s={...l.native,...v};console.log(s),this.setState({changed:!1,data:s,updateData:this.state.updateData+1,originalData:s},()=>i&&j.Router.doNavigate(null))}else this.state.changed?this.setState({confirmDialog:!0}):j.Router.doNavigate(null)}componentDidUpdate(n,i){i.changed!==this.state.changed&&this.props.configStored(!this.state.changed)}async componentDidMount(){const n=`${window.location.protocol}//${window.location.host}${window.location.pathname}validate_config/${this.props.adapterName}`;console.log(`fetch ${n}`),await fetch(n)}render(){return!this.state.data||!this.state.schema?M.createElement(N.LinearProgress,null):M.createElement("div",{style:ht.root},this.renderDialogConfirm(),this.getExportImportButtons(),this.renderSaveConfigDialog(),M.createElement(Yt,{key:this.state.hash,style:ht.scroll,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,adapterName:this.props.adapterName,instance:this.props.instance,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat,schema:this.state.schema,common:this.state.common,expertMode:this.props.expertMode,data:this.state.data,updateData:this.state.updateData,onError:n=>this.setState({error:n}),onChange:(n,i,l)=>{l&&this.state.error&&(window.alert(j.I18n.t("Cannot save configuration because of error in configuration")),l=!1),l&&!this.state.changed&&!i&&(l=!1),n?this.setState({data:n,changed:i,saveConfigDialog:l}):l!==void 0&&this.setState({saveConfigDialog:l})},DeviceManager:this.props.DeviceManager,theme:this.state.theme}),M.createElement(j.SaveCloseButtons,{isIFrame:!1,dense:!0,paddingLeft:0,newReact:!0,theme:this.state.theme,noTextOnButtons:this.props.width==="xs"||this.props.width==="sm"||this.props.width==="md",changed:!!(this.state.error||this.state.changed),error:!!this.state.error,onSave:n=>this.onSave(!0,n),onClose:()=>this.onSave(!1)}))}};export{K as ConfigGeneric,ft as ConfigPanel,$l as JsonConfig,Yt as JsonConfigComponent};
|
|
1399
|
+
`).map(d=>d.replace("\r","").trim()),{schema:l}=this.props,v=i.shift().split(";").filter(d=>d&&l.items.find(o=>o.attr===d)),s=[];i.forEach(d=>{const o=d.split(";"),p={};for(let e=0;e<o.length;e++){let t=o[e];if(t.startsWith('"')){for(t=t.substring(1);e<o.length&&!t.endsWith('"');)t+=`;${o[++e]}`;t=t.substring(0,t.length-1)}let r=t;if(t==="true")r=!0;else if(t==="false")r=!1;else if(window.isFinite(t)){const h=this.props.schema.items.find(a=>a.attr===v[e]);h&&h.type==="number"?r=parseFloat(t):r=t}else r=t;p[v[e]]=r}s.push(p)}),s.length?(c=this.state.value)!=null&&c.length?this.setState({showTypeOfImportDialog:s,showImportDialog:!1}):this.setState({value:s,showImportDialog:!1}):window.alert("ra_No data found in file")}onClone=n=>()=>{const i=JSON.parse(JSON.stringify(this.state.value)),l=JSON.parse(JSON.stringify(i[n]));if(typeof this.props.schema.clone=="string"&&typeof l[this.props.schema.clone]=="string"){let v=1,s=l[this.props.schema.clone];const c=s.match(/(\d+)$/);for(c?(s=s.replace(c[0],""),v=parseInt(c[0],10)+1):s+="_";i.find(d=>d[this.props.schema.clone]===s+v.toString());)v++;l[this.props.schema.clone]=`${l[this.props.schema.clone]}_${v}`}i.splice(n,0,l),this.setState({value:i,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))};onChangeWrapper=(n,i)=>{this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout((l,v)=>{this.typingTimer=null;let s;if(this.props.schema.encryptedAttributes){const c=JSON.parse(JSON.stringify(l));if(c.forEach(d=>{this.props.schema.encryptedAttributes.forEach(o=>{d[o]&&(d[o]=ul(this.secret,d[o]))})}),this.props.schema.objKeyName){const d=xi(c,this.props.schema.objKeyName,this.props.schema.objValueName);s=this.onChange(this.props.attr,d)}else s=this.onChange(this.props.attr,c)}else if(this.props.schema.objKeyName){const c=xi(JSON.parse(JSON.stringify(l)),this.props.schema.objKeyName,this.props.schema.objValueName);s=this.onChange(this.props.attr,c)}else s=this.onChange(this.props.attr,l);s instanceof Promise&&s.catch(c=>console.error(`Cannot save: ${c}`)),v&&(this.applyFilter(!1,l),this.handleRequestSort(this.state.orderBy,!0))},300,n,i)};onAdd=()=>{var v;const{schema:n}=this.props,i=JSON.parse(JSON.stringify(this.state.value)),l=(v=n.items)==null?void 0:v.reduce((s,c)=>{let d;return c.defaultFunc?this.props.custom?d=c.defaultFunc?this.executeCustom(c.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,i.length,this.props.data):this.props.schema.default:d=c.defaultFunc?this.execute(c.defaultFunc,this.props.schema.default,this.props.data,i.length,this.props.data):this.props.schema.default:d=c.default===void 0?null:c.default,s[c.attr]=d,s},{});i.push(l),this.setState({value:i},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))};isAnyFilterSet(){return!!Object.keys(this.filterRefs).find(n=>Ie.getFilterValue(this.filterRefs[n]))}applyFilter=(n,i,l)=>{i=i||this.state.value;let v=i.map((s,c)=>c);if(Object.keys(this.filterRefs).forEach(s=>{let c=Ie.getFilterValue(this.filterRefs[s]);!n&&c?(c=c.toLowerCase(),v=v.filter(d=>i[d]&&i[d][s]&&i[d][s].toLowerCase().includes(c))):this.filterRefs[s].current&&Ie.setFilterValue(this.filterRefs[s],"")}),v.length===i.length&&(v=null),v===null&&this.state.visibleValue===null){l&&l();return}JSON.stringify(v)!==JSON.stringify(this.state.visibleValue)?this.setState({visibleValue:v},()=>l&&l()):l&&l()};onMoveUp(n){const i=JSON.parse(JSON.stringify(this.state.value)),l=i[n];i.splice(n,1),i.splice(n-1,0,l),this.setState({value:i,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))}onMoveDown(n){const i=JSON.parse(JSON.stringify(this.state.value)),l=i[n];i.splice(n,1),i.splice(n+1,0,l),this.setState({value:i,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))}onDrop(n){const i=n[0],l=new FileReader;l.onabort=()=>console.log("file reading was aborted"),l.onerror=()=>console.log("file reading has failed"),l.onload=()=>{if(i.size>En){window.alert(j.I18n.t("ra_File is too big. Max %sk allowed. Try use SVG.",Math.round(En/1024)));return}const v=new Uint8Array(l.result).reduce((s,c)=>s+String.fromCharCode(c),"");this.onImport(v)},l.readAsArrayBuffer(i)}showTypeOfImportDialog(){return this.state.showTypeOfImportDialog?M.createElement(R.Dialog,{open:!0,onClose:()=>this.setState({showTypeOfImportDialog:!1}),maxWidth:"md"},M.createElement(R.DialogTitle,null,j.I18n.t("ra_Append or replace?")),M.createElement(R.DialogContent,null,j.I18n.t("ra_Append %s entries or replace existing?",this.state.showTypeOfImportDialog.length)),M.createElement(R.DialogActions,null,M.createElement(R.Button,{variant:"contained",color:"primary",autoFocus:!0,onClick:()=>{const n=JSON.parse(JSON.stringify(this.state.value));this.state.showTypeOfImportDialog.forEach(i=>n.push(i)),this.setState({value:n,iteration:this.state.iteration+1e4,showTypeOfImportDialog:!1},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(n)))}},j.I18n.t("ra_Append")),M.createElement(R.Button,{variant:"contained",color:"secondary",autoFocus:!0,onClick:()=>{const n=this.state.showTypeOfImportDialog;this.setState({value:n,iteration:this.state.iteration+1e4,showTypeOfImportDialog:!1},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(n)))}},j.I18n.t("ra_Replace")))):null}showImportDialog(){return this.state.showImportDialog?M.createElement(R.Dialog,{open:!0,onClose:()=>this.setState({showImportDialog:!1}),sx:{"& .MuiDialog-paper":{minHeight:500}},maxWidth:"md",fullWidth:!0},M.createElement(R.DialogTitle,null,j.I18n.t("ra_Import from %s","CSV")),M.createElement(R.DialogContent,null,M.createElement(Ti,{multiple:!1,accept:{"text/csv":[".csv"]},maxSize:En,onDragEnter:()=>this.setState({uploadFile:"dragging"}),onDragLeave:()=>this.setState({uploadFile:!0}),onDrop:(n,i)=>{this.setState({uploadFile:!1}),n.length?this.onDrop(n):window.alert(i&&i[0]&&i[0].errors&&i[0].errors[0]&&i[0].errors[0].message||j.I18n.t("ra_Cannot upload"))}},({getRootProps:n,getInputProps:i})=>M.createElement("div",{style:{...he.uploadDiv,...this.state.uploadFile==="dragging"?he.uploadDivDragging:void 0,...he.dropZone,...this.state.icon?void 0:he.dropZoneEmpty},...n()},M.createElement("input",{...i()}),M.createElement("div",{style:he.uploadCenterDiv},M.createElement("div",{style:he.uploadCenterTextAndIcon},M.createElement(Z.UploadFile,{style:he.uploadCenterIcon}),M.createElement("div",{style:he.uploadCenterText},this.state.uploadFile==="dragging"?j.I18n.t("ra_Drop file here"):j.I18n.t("ra_Place your files here or click here to open the browse dialog"))))))),M.createElement(R.DialogActions,null,M.createElement(R.Button,{variant:"contained",onClick:()=>this.setState({showImportDialog:!1}),color:"primary",startIcon:M.createElement(Z.Close,null)},j.I18n.t("Cancel")))):null}renderOneFilter(n){return M.createElement(R.TableCell,{key:`${n.headCell.attr}_${n.index}`,style:n.style,align:"left",sortDirection:n.orderBy===n.headCell.attr?n.order:!1},M.createElement("div",{style:{...he.flex,...n.schema.showFirstAddOnTop?{flexDirection:"column"}:void 0}},n.showAddButton?this.renderAddButton(n.doAnyFilterSet):null,n.headCell.sort&&M.createElement(R.TableSortLabel,{active:!0,style:n.orderBy!==n.headCell.attr?he.silver:void 0,direction:n.orderBy===n.headCell.attr?n.order:"asc",onClick:()=>this.handleRequestSort(n.headCell.attr)}),n.headCell.filter&&this.state.filterOn.includes(n.headCell.attr)?M.createElement(R.TextField,{variant:"standard",ref:this.filterRefs[n.headCell.attr],onChange:()=>this.applyFilter(),title:j.I18n.t("ra_You can filter entries by entering here some text"),slotProps:{input:{endAdornment:Ie.getFilterValue(this.filterRefs[n.headCell.attr])&&M.createElement(R.InputAdornment,{position:"end"},M.createElement(R.IconButton,{size:"small",tabIndex:-1,onClick:()=>{Ie.setFilterValue(this.filterRefs[n.headCell.attr],""),this.applyFilter()}},M.createElement(Z.Close,null)))}},fullWidth:!0,placeholder:this.getText(n.headCell.title)}):M.createElement("span",{style:he.headerText},this.getText(n.headCell.title)),this.renderShowHideFilter(n.headCell)))}enhancedFilterCard(){var c;const{schema:n}=this.props,{order:i,orderBy:l}=this.state;let v;this.props.schema.compact&&(v={paddingTop:1,paddingBottom:1});const s=!n.noDelete&&n.import||n.export;return s||n.items.find(d=>d.sort||d.filter)?M.createElement(R.Grid2,{size:{xs:n.xs||12,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0}},M.createElement(R.Card,null,M.createElement(R.Paper,{style:he.paper},M.createElement(R.Accordion,{style:he.paper},M.createElement(R.AccordionSummary,{expandIcon:M.createElement(Z.ExpandMore,null)},M.createElement(R.Typography,null,j.I18n.t("ra_Filter and Data Actions"))),M.createElement(R.AccordionDetails,null,M.createElement(R.Table,null,M.createElement(R.TableBody,null,((c=n.items)==null?void 0:c.find(d=>d.sort||d.filter))&&n.items.map((d,o)=>M.createElement(R.TableRow,{key:`${d.attr}_${o}`},this.renderOneFilter({schema:n,style:v,showAddButton:!1,headCell:d,order:i,orderBy:l,index:o,doAnyFilterSet:!1}))),s?M.createElement(R.TableRow,null,M.createElement(R.TableCell,{align:"left",style:v},M.createElement("span",{style:he.headerText},j.I18n.t("ra_Actions"))),M.createElement(R.TableCell,{style:v},this.renderImportExportButtons(n))):null))))))):null}enhancedBottomCard(){const{schema:n}=this.props;let i;this.props.schema.compact&&(i={paddingTop:1,paddingBottom:1});const l=this.isAnyFilterSet();return M.createElement(R.Grid2,{size:{xs:n.xs||12,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0}},M.createElement(R.Card,null,M.createElement(R.Paper,{style:he.paper},M.createElement(R.Table,null,M.createElement(R.TableBody,null,M.createElement(R.TableRow,null,M.createElement(R.TableCell,{colSpan:n.items.length+1,style:i},this.renderAddButton(l))))))))}renderCards(){const{schema:n}=this.props;let{visibleValue:i}=this.state,l;this.props.schema.compact&&(l={paddingTop:1,paddingBottom:1}),i||=this.state.value.map((s,c)=>c);const v=this.isAnyFilterSet();return M.createElement(R.Grid2,{container:!0},this.showImportDialog(),this.showTypeOfImportDialog(),this.enhancedFilterCard(),i.map((s,c)=>{var d;return M.createElement(R.Grid2,{key:`${s}_${c}`,size:{xs:n.xs||12,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0}},M.createElement(R.Card,null,M.createElement(R.Paper,{style:he.paper},M.createElement(R.Table,null,M.createElement(R.TableBody,null,(d=n.items)==null?void 0:d.map(o=>M.createElement(R.TableRow,{key:`${o.attr}_${s}`},M.createElement(R.TableCell,{align:"left",style:l},M.createElement("span",{style:he.headerText},this.getText(o.title))),M.createElement(R.TableCell,{align:"left",style:l},this.itemTable(o.attr,this.state.value[s],s)))),!n.noDelete&&M.createElement(R.TableRow,null,M.createElement(R.TableCell,{align:"left",style:l},M.createElement("span",{style:he.headerText},this.getText("Actions"))),M.createElement(R.TableCell,{align:"left",style:l},!v&&!this.state.orderBy?M.createElement(R.Tooltip,{title:j.I18n.t("ra_Move up"),slotProps:{popper:{sx:he.tooltip}}},M.createElement("span",null,M.createElement(R.IconButton,{size:"small",onClick:()=>this.onMoveUp(s),disabled:c===0},M.createElement(Z.ArrowUpward,null)))):null,!v&&!this.state.orderBy?M.createElement(R.Tooltip,{title:j.I18n.t("ra_Move down"),slotProps:{popper:{sx:he.tooltip}}},M.createElement("span",null,M.createElement(R.IconButton,{size:"small",onClick:()=>this.onMoveDown(s),disabled:c===i.length-1},M.createElement(Z.ArrowDownward,null)))):null,M.createElement(R.Tooltip,{title:j.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(R.IconButton,{size:"small",onClick:this.onDelete(s)},M.createElement(Z.Delete,null))),this.props.schema.clone?M.createElement(R.Tooltip,{title:j.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(R.IconButton,{size:"small",onClick:this.onClone(s)},M.createElement(Z.ContentCopy,null))):null)))))))}),this.enhancedBottomCard())}renderTable(){const{schema:n}=this.props;let{visibleValue:i}=this.state;i=i||this.state.value.map((s,c)=>c);const l=this.isAnyFilterSet();let v;return this.props.schema.compact&&(v={paddingTop:1,paddingBottom:1}),M.createElement(R.Paper,{style:he.paper},this.showImportDialog(),this.showTypeOfImportDialog(),n.label?M.createElement("div",{style:he.label},M.createElement(R.Toolbar,{variant:"dense",style:he.rootTool},M.createElement(R.Typography,{style:he.title,variant:"h6",id:"tableTitle",component:"div"},this.getText(n.label)))):null,M.createElement(R.TableContainer,null,M.createElement(R.Table,{style:he.table,size:"small"},this.enhancedTableHead(!l&&!this.state.orderBy?120:64,l),M.createElement(R.TableBody,null,i.map((s,c)=>{var d;return M.createElement(R.TableRow,{hover:!0,key:`${s}_${c}`},(d=n.items)==null?void 0:d.map(o=>M.createElement(R.TableCell,{key:`${o.attr}_${s}`,align:"left",style:v},this.itemTable(o.attr,this.state.value[s],s))),!n.noDelete&&M.createElement(R.TableCell,{align:"left",style:{...v,...he.buttonCell}},!l&&!this.state.orderBy?c?M.createElement(R.Tooltip,{title:j.I18n.t("ra_Move up"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(R.IconButton,{size:"small",onClick:()=>this.onMoveUp(s)},M.createElement(Z.ArrowUpward,null))):M.createElement("div",{style:he.buttonEmpty}):null,!l&&!this.state.orderBy?c<i.length-1?M.createElement(R.Tooltip,{title:j.I18n.t("ra_Move down"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(R.IconButton,{size:"small",onClick:()=>this.onMoveDown(s)},M.createElement(Z.ArrowDownward,null))):M.createElement("div",{style:he.buttonEmpty}):null,M.createElement(R.Tooltip,{title:j.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(R.IconButton,{size:"small",onClick:this.onDelete(s)},M.createElement(Z.Delete,null))),this.props.schema.clone?M.createElement(R.Tooltip,{title:j.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:he.tooltip}}},M.createElement(R.IconButton,{size:"small",onClick:this.onClone(s)},M.createElement(Z.ContentCopy,null))):null))}),!n.noDelete&&i.length>=(n.showSecondAddAt||5)?M.createElement(R.TableRow,null,M.createElement(R.TableCell,{colSpan:n.items.length+1,style:{...v}},this.renderAddButton(l))):null)),!i.length&&this.state.value.length?M.createElement("div",{style:he.filteredOut},M.createElement(R.Typography,{style:he.title,variant:"h6",id:"tableTitle",component:"div"},j.I18n.t("ra_All items are filtered out"),M.createElement(R.IconButton,{size:"small",onClick:()=>this.applyFilter(!0)},M.createElement(Z.Close,null)))):null),n.help?M.createElement(R.FormHelperText,{style:{paddingLeft:16}},this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null,this.state.errorMessage?M.createElement("div",{style:{display:"flex",padding:"5px"}},M.createElement(Z.Warning,{color:"error"}),M.createElement("span",{style:{color:"red",alignSelf:"center"}},this.state.errorMessage)):null)}componentDidUpdate(){var n;(n=this.refDiv.current)!=null&&n.clientWidth&&this.refDiv.current.clientWidth!==this.state.width&&(this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{var i;this.resizeTimeout=null,this.setState({width:(i=this.refDiv.current)==null?void 0:i.clientWidth})},50))}getCurrentBreakpoint(){return this.state.width?this.state.width<600?"xs":this.state.width<900?"sm":this.state.width<1200?"md":this.state.width<1536?"lg":"xl":"md"}renderItem(){const{schema:n}=this.props;if(!this.state.value||!Array.isArray(this.state.value))return null;const i=this.getCurrentBreakpoint();let l;return i&&(n.useCardFor||["xs"]).includes(i)?l=this.renderCards():l=this.renderTable(),M.createElement("div",{ref:this.refDiv,style:{width:"100%"}},l)}}const Gt={indeterminate:{opacity:.5},label:{width:"100%",fontSize:14,marginBottom:2},helper:{width:"100%",fontSize:12},error:{width:"100%",fontSize:12,color:"#FF0000"}};class dl extends K{updateTimeout=null;componentDidMount(){super.componentDidMount();let n=K.getValue(this.props.data,this.props.attr);if(Array.isArray(n)&&this.props.oContext.multiEdit){n=K.DIFFERENT_VALUE,this.setState({value:n,oldValue:n,jsonError:!1});return}this.setState({value:n,oldValue:n,jsonError:this.validateJson(n)})}validateJson(n){let i=!1;if(this.props.schema.validateJson&&(n||!this.props.schema.allowEmpty))try{JSON.parse(n)}catch(l){console.log("Error in JSON",l),i=!0}return i}static getDerivedStateFromProps(n,i){if(n.oContext.multiEdit&&i.value===K.DIFFERENT_VALUE)return{value:K.DIFFERENT_VALUE};let l=K.getValue(n.data,n.attr);return l!=null&&(l=l.toString()),l==null||l!==i.value&&l!==i.oldValue?{value:l}:null}renderItem(n,i){const l=Array.isArray(this.state.value)||this.state.value===K.DIFFERENT_VALUE;if(this.props.schema.time){let c="";return typeof this.state.value=="number"?this.state.value&&this.state.value<9466596e5?c=new Date(this.state.value*1e3).toLocaleString():c=new Date(this.state.value).toLocaleString():typeof this.state.value=="string"&&(c=new Date(this.state.value).toLocaleString()),M.createElement(R.TextField,{variant:"standard",fullWidth:!0,value:c,error:!!n||!!this.state.jsonError,disabled:!!i,slotProps:{htmlInput:{readOnly:!0}},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}if(this.state.oldValue!==null&&this.state.oldValue!==void 0?(this.updateTimeout&&clearTimeout(this.updateTimeout),this.updateTimeout=setTimeout(()=>{this.updateTimeout=null,this.setState({oldValue:null})},30)):this.updateTimeout&&(clearTimeout(this.updateTimeout),this.updateTimeout=null),l){const c=K.getValue(this.props.data,this.props.attr),d=(c==null?void 0:c.filter(o=>o||o===0).map(o=>({label:o.toString()||"",value:o})))||[];return d.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),M.createElement(R.Autocomplete,{style:Gt.indeterminate,fullWidth:!0,value:d[0],onChange:(o,p)=>{const e=p?p.value:"",t=this.onChange(this.props.attr,e,()=>{this.setState({value:e,oldValue:e,jsonError:this.validateJson(p)})});t instanceof Promise&&t.catch(r=>console.error(`Cannot set value: ${r}`))},options:d,getOptionLabel:o=>o.label,renderInput:o=>M.createElement(R.TextField,{variant:"standard",...o,error:!!n,placeholder:this.getText(this.props.schema.placeholder),slotProps:{htmlInput:{...o.inputProps,maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1}},label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:!!i})})}let v,s;if((this.props.schema.readOnly||i)&&this.props.schema.copyToClipboard?(this.props.schema.minRows>1&&(s={position:"absolute",right:3,top:20,zIndex:1e3}),v=M.createElement(R.IconButton,{tabIndex:-1,style:s,size:"small",onClick:()=>{j.Utils.copyToClipboard(this.state.value),window.alert(j.I18n.t("ra_Copied"))}},M.createElement(j.IconCopy,null))):!this.props.schema.readOnly&&!i&&this.state.value&&!this.props.schema.noClearButton&&(this.props.schema.minRows>1&&(s={position:"absolute",right:3,top:20,zIndex:1e3}),v=M.createElement(R.IconButton,{style:s,size:"small",tabIndex:-1,onClick:()=>this.setState({value:"",oldValue:this.state.value},()=>this.onChange(this.props.attr,""))},M.createElement(Z.Close,null)),this.props.schema.minRows<=1&&(v=M.createElement(R.InputAdornment,{position:"end"},v))),this.props.schema.minRows>1){const c=this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation);return M.createElement("div",{style:{width:"100%",position:"relative"}},this.props.schema.label?M.createElement("div",{style:Gt.label},this.getText(this.props.schema.label)):null,M.createElement(R.TextareaAutosize,{style:{width:"100%",resize:"vertical",backgroundColor:this.props.oContext.themeType==="dark"?"#363636":"#cccccc",color:this.props.oContext.themeType==="dark"?"#fff":"#111"},minRows:this.props.schema.minRows,maxRows:this.props.schema.maxRows,value:this.state.value===null||this.state.value===void 0?"":this.state.value,disabled:!!i,readOnly:this.props.schema.readOnly||!1,onChange:d=>{const o=d.target.value;this.setState({value:o,oldValue:this.state.value,jsonError:this.validateJson(o)},()=>this.onChange(this.props.attr,o||""))},placeholder:this.getText(this.props.schema.placeholder)}),c||n||this.state.jsonError?M.createElement("div",{style:n?Gt.error:Gt.helper},n||(this.state.jsonError?j.I18n.t("ra_Invalid JSON"):c)):null)}return M.createElement(R.TextField,{variant:"standard",fullWidth:!0,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!n||!!this.state.jsonError,disabled:!!i,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1},input:{endAdornment:v}},onChange:c=>{const d=c.target.value;this.setState({value:d,oldValue:this.state.value,jsonError:this.validateJson(d)},()=>this.onChange(this.props.attr,d))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.state.jsonError?j.I18n.t("ra_Invalid JSON"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const fl={fullWidth:{width:"100%"}};class gl extends K{initialized=!1;localContext;askInstance(){if(this.props.alive){let n=this.props.schema.data;if(n===void 0&&this.props.schema.jsonData){const i=this.getPattern(this.props.schema.jsonData,null,!0);try{n=JSON.parse(i)}catch{console.error(`Cannot parse json data: ${i}`)}}n===void 0&&(n=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",n).then(i=>{if(typeof i=="object"){const l=i;this.setState({text:l.text||"",style:l.style,icon:l.icon,iconStyle:l.iconStyle})}else typeof i=="string"&&this.setState({text:i||""})}).catch(i=>console.error(`Cannot send command: ${i}`))}}getLocalContext(){const n={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(i=>n[i]=K.getValue(this.props.data,i)),JSON.stringify(n)}renderItem(){if(this.props.alive){const i=this.getLocalContext();(i!==this.localContext||!this.initialized)&&(this.localContext=i,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}if(this.state.text===void 0)return null;let n=null;return this.state.icon&&(n=Ze(this.state.icon,{marginRight:this.state.text?8:void 0,...this.state.iconStyle||void 0}),n||(n=M.createElement(j.Icon,{src:this.state.icon,style:{marginRight:this.state.text?8:void 0,...this.state.iconStyle||void 0}}))),this.props.schema.container==="text"?M.createElement(R.TextField,{variant:"standard",fullWidth:!0,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?M.createElement(R.IconButton,{tabIndex:-1,size:"small",onClick:()=>{j.Utils.copyToClipboard(this.state.text),window.alert(j.I18n.t("ra_Copied"))}},M.createElement(j.IconCopy,null)):void 0}},value:this.state.text,label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}):M.createElement("div",{style:{...fl.fullWidth,...this.state.style||void 0}},n,this.props.schema.container==="html"?M.createElement("span",{dangerouslySetInnerHTML:{__html:this.state.text||""}}):this.state.text)}}class ml extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n})}renderItem(n,i){const l=this.props.schema.returnFormat!=="HH:mm:ss",v=new Date(Date.parse(`Thu, 01 Jan 1970 ${this.state.value||"00:00:00"}`));return M.createElement(_i.TimePicker,{sx:s=>({width:"100%",borderBottom:`1px solid ${s.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${s.spacing(1.5)} 0 4px 0`},"& .MuiInputAdornment-root":{marginLeft:0,marginTop:1},"& label":{transform:"translate(0px, -9px) scale(0.75)"}}),ampm:this.props.oContext.systemConfig.dateFormat.includes("/"),timeSteps:this.props.schema.timeSteps||this.props.schema.timesteps||{hours:1,minutes:5,seconds:5},format:this.props.schema.format||"HH:mm:ss",disabled:!!i,value:v,onChange:s=>{let c;c=s instanceof Date?s.toTimeString().split(" ")[0]:s.toTimeString(),l&&(c=c.split(":").slice(0,2).join(":")),this.setState({value:c},()=>this.onChange(this.props.attr,this.state.value))},views:this.props.schema.views||["hours","minutes","seconds"],label:this.getText(this.props.schema.label)})}}function vl(L,n){let i;return n&&L.substring(0,n.length)===n?i=L.substring(n.length+1):i=L,i=i.replace(/\./g,"/").replace(/_/g," "),i}class yl extends K{componentDidMount(){var i;super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);if(!n&&((i=this.props.customObj)!=null&&i._id)){const l=vl(this.props.customObj._id,`${this.props.oContext.adapterName}.${this.props.oContext.instance}`);this.setState({value:l})}else this.setState({value:n||""})}renderItem(n,i){return M.createElement(R.TextField,{variant:"standard",fullWidth:!0,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0}},value:this.state.value,error:!!n,disabled:i,placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),onChange:l=>{const v=l.target.value;this.setState({value:v},()=>this.onChange(this.props.attr,v))}})}}class bl extends K{async componentDidMount(){var i;super.componentDidMount();const n=await this.props.oContext.socket.getObject("system.meta.uuid");this.setState({uuid:((i=n==null?void 0:n.native)==null?void 0:i.uuid)||"unknown"})}renderItem(n,i){return M.createElement(R.TextField,{variant:"standard",fullWidth:!0,error:!!n,disabled:!!i,slotProps:{htmlInput:{readOnly:!0},input:{endAdornment:M.createElement(R.IconButton,{tabIndex:-1,onClick:()=>{j.Utils.copyToClipboard(this.state.uuid),window.alert(j.I18n.t("ra_Copied %s",this.state.uuid))}},M.createElement(Z.ContentCopy,null))}},value:this.state.uuid||"",label:this.getText(this.props.schema.label)||j.I18n.t("ra_Serial number (UUID)"),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const Ai={icon:{width:16,height:16,marginRight:8}};class wl extends K{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getUsers().then(n=>{const i={},l=j.I18n.getLanguage();this.props.schema.short?n.forEach(v=>{var s,c;return i[v._id]={color:(s=v.common)==null?void 0:s.color,icon:(c=v.common)==null?void 0:c.icon,name:j.Utils.getObjectNameFromObj(v,l)}}):n.forEach(v=>{var s,c;return i[v._id.replace(/^system\.user\./,"")]={color:(s=v.common)==null?void 0:s.color,icon:(c=v.common)==null?void 0:c.icon,name:j.Utils.getObjectNameFromObj(v,l)}}),this.setState({users:i})}).catch(n=>console.error(`Cannot get users: ${n}`))}renderItem(n,i){var v,s;const l=K.getValue(this.props.data,this.props.attr);return M.createElement(R.FormControl,{variant:"standard",fullWidth:!0},this.state.users&&this.props.schema.label?M.createElement(R.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.users?M.createElement(R.Select,{variant:"standard",error:!!n,disabled:!!i,value:l,renderValue:c=>{var d,o,p;return M.createElement("span",null,this.state.users&&((d=this.state.users[c])!=null&&d.icon)?M.createElement(j.Icon,{src:this.state.users&&((o=this.state.users[c])==null?void 0:o.icon),style:Ai.icon}):null,this.state.users&&((p=this.state.users[c])==null?void 0:p.name)||c||"")},style:{color:this.state.users&&((v=this.state.users[l])==null?void 0:v.color)||void 0,backgroundColor:j.Utils.getInvertedColor(this.state.users&&((s=this.state.users[l])==null?void 0:s.color),this.props.oContext.themeType)},onChange:c=>this.onChange(this.props.attr,c.target.value)},this.state.users&&Object.keys(this.state.users).map(c=>M.createElement(R.MenuItem,{style:{color:this.state.users[c].color||void 0,backgroundColor:j.Utils.getInvertedColor(this.state.users[c].color,this.props.oContext.themeType)},key:c,value:c},this.state.users[c].icon?M.createElement(j.Icon,{src:this.state.users[c].icon,style:Ai.icon}):null,this.state.users[c].name))):M.createElement(R.TextField,{variant:"standard",error:!!n,disabled:!!i,value:l,onChange:c=>this.onChange(this.props.attr,c.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?M.createElement(R.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class Cl extends K{async componentDidMount(){super.componentDidMount();const n=await as(()=>import("./index-DOnIDI_a.js").then(i=>i.i),__vite__mapDeps([0,1,2,3,4]),import.meta.url);this.setState({QRCode:n.default})}renderItem(){const n=this.state.QRCode;return n?M.createElement(n,{value:this.props.schema.data,size:this.props.schema.size,fgColor:this.props.schema.fgColor,bgColor:this.props.schema.bgColor,level:this.props.schema.level}):null}}const El={accordion:_s,alive:ks,autocomplete:Ms,autocompleteSendTo:Ls,certCollection:Rs,certificate:Fs,certificates:Os,checkbox:Ns,checkLicense:Xe,chip:ii,chips:ii,color:Hs,coordinates:js,cron:Is,custom:_t,datePicker:Vs,deviceManager:Us,divider:sl,file:no,fileSelector:en,func:io,header:al,image:oo,imageSendTo:so,infoBox:ao,instance:lo,interface:ho,ip:ro,jsonEditor:Na,language:Pa,license:Wa,number:za,oauth2:Ha,objectId:ja,password:Va,pattern:Ua,port:Ka,qrCode:Cl,room:Ja,select:Qa,selectSendTo:Xa,sendto:yi,sendTo:yi,setState:tl,slider:nl,state:rl,staticImage:ll,staticInfo:hl,staticLink:Di,staticText:Di,table:Ie,text:dl,textSendTo:gl,timePicker:ml,topic:yl,uuid:bl,user:wl},We={fullWidth:{width:"100%"},paper:{margin:1,width:"auto !important",overflowY:"auto",paddingBottom:1},paperWithIcons:{height:"calc(100vh - 259px) !important"},paperWithoutIcons:{height:"calc(100vh - 235px) !important"},padding:{padding:"10px"},heading:{},primary:L=>({backgroundColor:L.palette.primary.main,color:L.palette.mode==="dark"?"inherit":"#FFF"}),secondary:L=>({backgroundColor:L.palette.secondary.main})};class ft extends K{componentDidMount(){var n;super.componentDidMount(),(n=this.props.schema)!=null&&n.collapsable&&this.setState({expanded:(window._localStorage||window.localStorage).getItem(`${this.props.oContext.adapterName}.${this.props.attr}`)==="true"})}renderItems(n,i){return n?Object.keys(n).map(l=>{if(this.props.oContext.multiEdit&&n[l].noMultiEdit)return null;const v=n[l].type||"panel";let s,c="Use this.props.oContext.socket!";return v==="custom"?(n[l].url?s=_t:this.props.oContext.customs&&this.props.oContext.customs[n[l].component]?s=this.props.oContext.customs[n[l].component]:(console.error(`Cannot find custom component: ${n[l].component}`),s=K),c=this.props.oContext.socket):v==="panel"?s=ft:s=El[v]||K,M.createElement(s,{socket:c,globalData:this.props.globalData,oContext:this.props.oContext,key:`${l}_${this.props.index===void 0?"":this.props.index}`,index:this.props.index,changed:this.props.changed,arrayIndex:this.props.arrayIndex,expertMode:this.props.expertMode,commandRunning:this.props.commandRunning,style:We.panel,common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,onError:this.props.onError,onChange:this.props.onChange,disabled:i,customObj:this.props.customObj,custom:this.props.custom,schema:n[l],attr:l,table:this.props.table})}):null}render(){const n=this.props.schema;if(!n)return null;const{disabled:i,hidden:l}=this.calculate(n),v=this.props.schema.items,s=this.props.schema.style||{};if(l){if(n.hideOnlyControl){const d=M.createElement(R.Grid2,{size:{xs:n.xs||void 0,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0},sx:j.Utils.getStyle(this.props.oContext.theme,{marginBottom:0,textAlign:"left"},s,this.props.oContext.themeType==="dark"&&n.darkStyle)});return n.newLine?M.createElement(M.Fragment,null,M.createElement("div",{style:{flexBasis:"100%",height:0}}),d):d}return null}if(this.props.table)return this.renderItems(v,i);if(this.props.custom)return M.createElement(R.Grid2,{key:`${this.props.attr}_${this.props.index}`,container:!0,style:We.fullWidth,columnSpacing:2,rowSpacing:1,sx:s},this.renderItems(v,i));let c;if(n.collapsable)c=M.createElement(R.Accordion,{key:`${this.props.attr}_${this.props.index}`,style:We.fullWidth,expanded:!!this.state.expanded,onChange:()=>{(window._localStorage||window.localStorage).setItem(`${this.props.oContext.adapterName}.${this.props.attr}`,this.state.expanded?"false":"true"),this.setState({expanded:!this.state.expanded})}},M.createElement(R.AccordionSummary,{expandIcon:M.createElement(Z.ExpandMore,null),sx:j.Utils.getStyle(this.props.oContext.theme,s,this.props.oContext.themeType&&n.darkStyle,n.color==="primary"?We.primary:n.color==="secondary"&&We.secondary,{width:"100%"})},M.createElement(R.Typography,{style:We.heading},this.getText(n.label))),M.createElement(R.AccordionDetails,null,M.createElement(R.Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:{...s,width:"100%",padding:"10px"}},this.renderItems(v,i))));else{const d=j.Utils.getStyle(this.props.oContext.theme,this.props.style,s,{width:"100%"},this.props.isParentTab&&We.paper,this.props.isParentTab&&(this.props.withoutSaveButtons?this.props.withIcons?{height:"calc(100% - 88px) !important"}:{height:"calc(100% - 64px) !important"}:this.props.withIcons?We.paperWithIcons:We.paperWithoutIcons));c=M.createElement(R.Box,{component:"div",key:`${this.props.attr}_${this.props.index}`,className:this.props.className,sx:d},M.createElement(R.Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:j.Utils.getStyle(this.props.oContext.theme,{width:"100%"},this.props.isParentTab&&We.padding,this.props.schema.innerStyle)},this.renderItems(v,i)))}if(!this.props.isParentTab){const d=M.createElement(R.Grid2,{title:this.getText(n.tooltip),size:{xs:n.xs||void 0,sm:n.sm||void 0,md:n.md||void 0,lg:n.lg||void 0,xl:n.xl||void 0},sx:{marginBottom:0,textAlign:"left",...s}},c);return n.newLine?M.createElement(M.Fragment,null,M.createElement("div",{style:{flexBasis:"100%",height:0}}),d):d}return c}}const Kt={tabs:{height:"100%",width:"100%"},panel:{width:"100%",display:"block"},panelWithIcons:{height:"calc(100% - 72px)"},panelWithoutIcons:{height:"calc(100% - 48px)"}};class Sl extends K{resizeTimeout=null;refDiv;constructor(n){super(n);let i;if(this.props.root){const l=(window.location.hash||"").replace(/^#/,"").split("/");if(l.length>=3&&l[1]==="config"){const v=l[3],s=parseInt(v,10);v&&s.toString()===v?s>=0&&s<Object.keys(this.props.schema.items).length&&(i=Object.keys(this.props.schema.items)[s]):v&&Object.keys(this.props.schema.items).includes(v)&&(i=v),window.addEventListener("hashchange",this.onHashTabsChanged,!1)}}i===void 0&&(i=(window._localStorage||window.localStorage).getItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`)||Object.keys(this.props.schema.items)[0],Object.keys(this.props.schema.items).includes(i)||(i=Object.keys(this.props.schema.items)[0])),this.refDiv=M.createRef(),Object.assign(this.state,{tab:i,width:0,openMenu:null})}componentWillUnmount(){this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null),window.removeEventListener("hashchange",this.onHashTabsChanged,!1),super.componentWillUnmount()}onHashTabsChanged=()=>{const n=(window.location.hash||"").replace(/^#/,"").split("/");if(n.length>3&&n[1]==="config"){const i=n[3],l=parseInt(i,10);let v;l.toString()===i?l>=0&&l<Object.keys(this.props.schema.items).length&&(v=Object.keys(this.props.schema.items)[l]):Object.keys(this.props.schema.items).includes(i)&&(v=i),v!==void 0&&v!==this.state.tab&&((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,v),this.setState({tab:v}))}};getCurrentBreakpoint(){if(!this.state.width)return"md";if(!this.state.initialBreakpoint){let n;return this.state.width<600?n="xs":this.state.width<900?n="sm":this.state.width<1200?n="md":this.state.width<1536?n="lg":n="xl",setTimeout(()=>{this.setState({initialBreakpoint:n})},50),n}return this.state.initialBreakpoint}componentDidUpdate(){var n;!this.state.initialBreakpoint&&((n=this.refDiv.current)!=null&&n.clientWidth)&&this.refDiv.current.clientWidth!==this.state.width&&(this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{var i;this.resizeTimeout=null,this.setState({width:(i=this.refDiv.current)==null?void 0:i.clientWidth})},50))}onMenuChange(n){(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,n),this.setState({tab:n},()=>{if(this.props.root){const i=(window.location.hash||"").split("/");i.length>=3&&i[1]==="config"&&(i[3]=this.state.tab,window.location.hash=i.join("/"))}})}render(){const n=this.props.schema.items;let i=!1;const l=[];Object.keys(n).map(c=>{let d;if(n[c].expertMode&&!this.props.expertMode)return;if(this.props.custom){if(this.executeCustom(n[c].hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData))return;d=this.executeCustom(n[c].disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData)}else{if(this.execute(n[c].hidden,!1,this.props.data,this.props.index,this.props.globalData))return;d=this.execute(n[c].disabled,!1,this.props.data,this.props.index,this.props.globalData)}const o=this.getIcon(n[c].icon);i=i||!!o,l.push({icon:o,disabled:d,label:this.getText(n[c].label),name:c})}),l.find(c=>c.name===this.state.tab)||setTimeout(()=>this.setState({tab:l[0].name}),50);const v=this.getCurrentBreakpoint();let s;return v==="xs"&&l.length>2?s=M.createElement(R.Toolbar,{style:{top:2,backgroundColor:this.props.oContext.themeType==="dark"?"#222":"#DDD"},variant:"dense"},M.createElement(R.IconButton,{onClick:c=>this.setState({openMenu:c.currentTarget})},M.createElement(Z.Menu,null)),this.state.openMenu?M.createElement(R.Menu,{open:!0,anchorEl:this.state.openMenu,onClose:()=>this.setState({openMenu:null})},l.map(c=>M.createElement(R.MenuItem,{disabled:c.disabled,key:c.name,onClick:()=>{this.setState({openMenu:null},()=>this.onMenuChange(c.name))},selected:c.name===this.state.tab},i?M.createElement(R.ListItemIcon,null,c.icon):null,c.label))):null):s=M.createElement(R.Tabs,{variant:"scrollable",scrollButtons:"auto",style:this.props.schema.tabsStyle,value:this.state.tab,onChange:(c,d)=>this.onMenuChange(d)},l.map(c=>M.createElement(R.Tab,{id:c.name,wrapped:!0,disabled:c.disabled,key:c.name,value:c.name,iconPosition:this.props.schema.iconPosition||"start",icon:c.icon,label:c.label}))),M.createElement("div",{style:Kt.tabs,ref:this.refDiv},s,M.createElement(ft,{oContext:this.props.oContext,withoutSaveButtons:this.props.withoutSaveButtons,isParentTab:!0,changed:this.props.changed,key:this.state.tab,expertMode:this.props.expertMode,index:1001,arrayIndex:this.props.arrayIndex,globalData:this.props.globalData,commandRunning:this.props.commandRunning,style:{...Kt.panel,...i?Kt.panelWithIcons:Kt.panelWithoutIcons},common:this.props.common,alive:this.props.alive,themeName:this.props.themeName,data:this.props.data,originalData:this.props.originalData,onChange:this.props.onChange,onError:this.props.onError,customObj:this.props.customObj,custom:this.props.custom,schema:n[this.state.tab],table:this.props.table,withIcons:i}))}}const Dl={root:{width:"100%",height:"100%"}};class Yt extends qe.Component{forceUpdateHandlers;errorTimeout=null;errorCached=null;oContext;constructor(n){super(n),this.state={originalData:JSON.stringify(this.props.data),changed:!1,errors:{},updateData:this.props.updateData||0,systemConfig:null,alive:!1,commandRunning:!1,schema:JSON.parse(JSON.stringify(this.props.schema))},this.forceUpdateHandlers={},this.buildDependencies(this.state.schema),this.readData()}static getDerivedStateFromProps(n,i){return n.updateData!==i.updateData?{updateData:n.updateData,originalData:JSON.stringify(n.data),schema:JSON.parse(JSON.stringify(n.schema))}:null}static async loadI18n(n,i,l){if(i===!0||i&&typeof i=="string"){const v=j.I18n.getLanguage(),s=typeof i=="string"?i:"i18n";let c=await n.fileExists(`${l}.admin`,`${s}/${v}.json`),d;if(c?d=`${s}/${v}.json`:(c=await n.fileExists(`${l}.admin`,`${s}/${v}/translations.json`),c?d=`${s}/${v}/translations.json`:v!=="en"&&(c=await n.fileExists(`${l}.admin`,`${s}/en.json`),c?d=`${s}/en.json`:(c=await n.fileExists(`${l}.admin`,`${s}/en/translations.json`),c&&(d=`${s}/en/translations.json`)))),d){const o=await n.readFile(`${l}.admin`,d);let p;o.file!==void 0?p=o.file:p=o;try{const e=JSON.parse(p);j.I18n.extendTranslations(e,v)}catch(e){return console.error(`Cannot parse language file "${l}.admin/${d}: ${e}`),""}return d}return console.warn(`Cannot find i18n for ${l} / ${d}`),""}return i&&typeof i=="object"&&j.I18n.extendTranslations(i),""}onCommandRunning=n=>this.setState({commandRunning:n});readData(){this.props.socket.getCompactSystemConfig().then(n=>this.props.socket.getState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`).then(i=>this.setState({systemConfig:n.common,alive:!!(i&&i.val)},()=>{this.updateContext(!0),this.props.custom||this.props.socket.subscribeState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,this.onAlive)}))).catch(n=>console.error(`Cannot read system config: ${n}`))}onAlive=(n,i)=>{!!(i!=null&&i.val)!==this.state.alive&&this.setState({alive:!!(i!=null&&i.val)})};onChange=(n,i,l,v)=>{if(this.props.onValueChange)this.props.onValueChange(n,i,v),l&&l();else if(n&&this.props.onChange){const s={changed:JSON.stringify(n)!==this.state.originalData};this.setState(s,()=>{this.props.onChange(n,s.changed,v),l&&l()})}else v&&this.props.onChange(null,null,v)};onError=(n,i)=>{this.errorCached=this.errorCached||JSON.parse(JSON.stringify(this.state.errors));const l=this.errorCached;i?l[n]=i:delete l[n],this.errorTimeout&&clearTimeout(this.errorTimeout),JSON.stringify(l)!==JSON.stringify(this.state.errors)?this.errorTimeout=setTimeout(()=>this.setState({errors:this.errorCached},()=>{this.errorTimeout=null,this.errorCached=null,this.props.onError(!!Object.keys(this.state.errors).length)}),50):this.errorCached=null};flatten(n,i){return i=i||{},n.items&&Object.keys(n.items).forEach(l=>{i[l]=n.items[l],this.flatten(n.items[l],i)}),i}buildDependencies(n){const i=this.flatten(n);Object.keys(i).forEach(l=>{var v,s,c,d,o,p,e,t,r,h;(v=i[l].confirm)!=null&&v.alsoDependsOn&&((s=i[l].confirm)==null||s.alsoDependsOn.forEach(a=>{if(!i[a])console.error(`[JsonConfigComponent] Attribute ${a} does not exist!`),a.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${a.replace(/^data\./,"")}" instead of "${a}"`);else{i[a].confirmDependsOn=i[a].confirmDependsOn||[];const u={...i[l],attr:l};u.confirm&&(u.confirm.cancel="Undo"),i[a].confirmDependsOn.push(u)}})),(c=i[l].onChange)!=null&&c.alsoDependsOn&&((d=i[l].onChange)==null||d.alsoDependsOn.forEach(a=>{if(!i[a])console.error(`[JsonConfigComponent] Attribute ${a} does not exist!`),a.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${a.replace(/^data\./,"")}" instead of "${a}"`);else{i[a].onChangeDependsOn=i[a].onChangeDependsOn||[];const u={...i[l],attr:l};i[a].onChangeDependsOn.push(u)}})),(o=i[l].hidden)!=null&&o.alsoDependsOn&&((p=i[l].hidden)==null||p.alsoDependsOn.forEach(a=>{if(!i[a])console.error(`[JsonConfigComponent] Attribute ${a} does not exist!`),a.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${a.replace(/^data\./,"")}" instead of "${a}"`);else{i[a].hiddenDependsOn=i[a].hiddenDependsOn||[];const u={...i[l],attr:l};i[a].hiddenDependsOn.push(u)}})),(e=i[l].label)!=null&&e.alsoDependsOn&&((t=i[l].label)==null||t.alsoDependsOn.forEach(a=>{if(!i[a])console.error(`[JsonConfigComponent] Attribute ${a} does not exist!`),a.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${a.replace(/^data\./,"")}" instead of "${a}"`);else{i[a].labelDependsOn=i[a].labelDependsOn||[];const u={...i[l],attr:l};i[a].labelDependsOn.push(u)}})),(r=i[l].help)!=null&&r.alsoDependsOn&&((h=i[l].help)==null||h.alsoDependsOn.forEach(a=>{if(!i[a])console.error(`[JsonConfigComponent] Attribute ${a} does not exist!`),a.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${a.replace(/^data\./,"")}" instead of "${a}"`);else{i[a].helpDependsOn=i[a].helpDependsOn||[];const u={...i[l],attr:l};i[a].helpDependsOn.push(u)}}))})}updateContext(n){this.oContext={DeviceManager:this.props.DeviceManager,adapterName:this.props.adapterName,changeLanguage:this.changeLanguage,common:this.props.common,customs:this.props.customs,dateFormat:this.props.dateFormat,embedded:this.props.embedded,forceUpdate:this.forceAttrUpdate,imagePrefix:this.props.imagePrefix,instance:this.props.instance,instanceObj:this.props.instanceObj,isFloatComma:this.props.isFloatComma,multiEdit:this.props.multiEdit,onBackEndCommand:this.props.onBackEndCommand,onCommandRunning:this.onCommandRunning,onValueChange:this.props.onValueChange,registerOnForceUpdate:this.registerOnForceUpdate,socket:this.props.socket,systemConfig:this.state.systemConfig,theme:this.props.theme,themeType:this.props.themeType,_themeName:this.props.themeName,updateData:this.state.updateData},n&&this.forceUpdate()}renderItem(n){return n.type==="tabs"?M.createElement(Sl,{withoutSaveButtons:this.props.withoutSaveButtons,oContext:this.oContext,alive:this.state.alive,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,data:this.props.data,onChange:this.onChange,onError:(i,l)=>this.onError(i,l),originalData:JSON.parse(this.state.originalData),root:!0,schema:n,expertMode:this.props.expertMode,themeName:this.props.themeName}):n.type==="panel"||!n.type?M.createElement(ft,{withoutSaveButtons:this.props.withoutSaveButtons,oContext:this.oContext,alive:this.state.alive,changed:this.state.changed,commandRunning:this.state.commandRunning,common:this.props.common,custom:this.props.custom,customObj:this.props.customObj,data:this.props.data,expertMode:this.props.expertMode,index:1e3,isParentTab:!this.props.embedded&&!this.props.withoutSaveButtons,onChange:this.onChange,onError:(i,l)=>this.onError(i,l),originalData:JSON.parse(this.state.originalData),root:!0,schema:n,themeName:this.props.themeName}):(console.error(`Unknown item type in root: ${JSON.stringify(n)}`),null)}changeLanguage=()=>{this.forceUpdate()};forceAttrUpdate=(n,i)=>{Array.isArray(n)?n.forEach(l=>this.forceUpdateHandlers[l]&&this.forceUpdateHandlers[l](i)):this.forceUpdateHandlers[n]&&this.forceUpdateHandlers[n](i)};registerOnForceUpdate=(n,i)=>{i?this.forceUpdateHandlers[n]=i:this.forceUpdateHandlers[n]&&delete this.forceUpdateHandlers[n]};render(){return!this.state.systemConfig||!this.oContext?M.createElement(R.LinearProgress,null):(this.oContext._themeName!==this.props.themeName&&(this.oContext._themeName=this.props.themeName,setTimeout(()=>this.updateContext(!0),0)),M.createElement("div",{style:{...!this.props.embedded||this.props.withoutSaveButtons?Dl.root:void 0,...this.props.style,...this.state.schema.style}},this.renderItem(this.state.schema)))}}const ht={root:{width:"100%",height:"100%",overflow:"hidden",position:"relative"},scroll:{height:"calc(100% - 48px)",overflowY:"auto"},exportImportButtons:{position:"absolute",top:5,right:0,zIndex:3},button:{marginRight:"5px"},tooltip:{pointerEvents:"none"}};function xl(L,n){let i="";for(let l=0;l<n.length;l++)i+=String.fromCharCode(L[l%L.length].charCodeAt(0)^n.charCodeAt(l));return i}function Al(L,n){let i="";for(let l=0;l<n.length;l++)i+=String.fromCharCode(L[l%L.length].charCodeAt(0)^n.charCodeAt(l));return i}function $l(L,n){if(typeof n!="string")return n;if(!n.startsWith("$/aes-192-cbc:")||!/^[0-9a-f]{48}$/.test(L))return xl(L,n);const i=n.split(":",3),l=window.CryptoJS.enc.Hex.parse(L),v=window.CryptoJS.enc.Hex.parse(i[1]),s=window.CryptoJS.lib.CipherParams.create({ciphertext:window.CryptoJS.enc.Hex.parse(i[2])}),c=window.CryptoJS.AES.decrypt(s,l,{iv:v});return window.CryptoJS.enc.Utf8.stringify(c)}function Tl(L,n,i){if(typeof n!="string")return n;if(!/^[0-9a-f]{48}$/.test(L))return Al(L,n);let l;l=window.CryptoJS.lib.WordArray.random(128/8);const v=window.CryptoJS.enc.Hex.parse(L),s=window.CryptoJS.AES.encrypt(n,v,{iv:l}).ciphertext;return`$/aes-192-cbc:${window.CryptoJS.enc.Hex.stringify(l)}:${s}`}function $i(L,n){var i;return document.getElementById(n)?(i=document.getElementById(n))==null?void 0:i.onload:new Promise(l=>{const v=document.createElement("script");v.setAttribute("id",n),v.onload=l,v.src=L,document.getElementsByTagName("head")[0].appendChild(v)})}let _l=class extends j.Router{fileSubscribed=[];fileLangSubscribed="";secret;constructor(n){super(n),this.state={updateData:0,changed:!1,confirmDialog:!1,theme:j.Theme(n.themeName),saveConfigDialog:!1,hash:"_"},this.secret=n.secret||"",this.getInstanceObject().then(i=>this.getConfigFile().then(l=>Yt.loadI18n(this.props.socket,l==null?void 0:l.i18n,this.props.adapterName).then(v=>{v&&(this.fileLangSubscribed||(this.fileLangSubscribed=v,this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange))),i?this.setState({schema:l,data:i.native,common:i.common,hash:ti(JSON.stringify(l)).toString()}):window.alert(`Instance system.adapter.${this.props.adapterName}.${this.props.instance} not found!`)})))}componentWillUnmount(){super.componentWillUnmount(),this.fileSubscribed.length&&(this.props.socket.unsubscribeFiles(`${this.props.adapterName}.admin`,this.fileSubscribed,this.onFileChange),this.fileSubscribed=[]),this.fileLangSubscribed&&(this.props.socket.unsubscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange),this.fileLangSubscribed="")}handleFileSelect=n=>{const i=n.target.files[0];if(i){const l=new FileReader;l.onload=v=>{if(!v.target)return;const s=v.target.result;try{const c=JSON.parse(s);this.setState({data:c,changed:JSON.stringify(c)!==JSON.stringify(this.state.originalData)})}catch{window.alert(j.I18n.t("[JsonConfig] Failed to parse JSON file"))}},l.readAsText(i)}else window.alert(j.I18n.t("[JsonConfig] Failed to open JSON File"))};getExportImportButtons(){return M.createElement("div",{style:ht.exportImportButtons},M.createElement(R.Tooltip,{title:this.props.t("Import settings from JSON file"),slotProps:{popper:{sx:ht.tooltip}}},M.createElement(R.Fab,{size:"small",sx:{"&.MuiFab-root":ht.button},onClick:()=>{const n=document.createElement("input");n.setAttribute("type","file"),n.setAttribute("id","files"),n.setAttribute("opacity",0),n.addEventListener("change",i=>this.handleFileSelect(i),!1),n.click()}},M.createElement(Z.Publish,null))),M.createElement(R.Tooltip,{title:this.props.t("Export setting to JSON file"),slotProps:{popper:{sx:ht.tooltip}}},M.createElement(R.Fab,{size:"small",sx:{"&.MuiFab-root":ht.button},onClick:()=>{this.state.data&&j.Utils.generateFile(`${this.props.adapterName}.${this.props.instance}.json`,this.state.data)}},M.createElement(Z.Publish,{style:{transform:"rotate(180deg)"}}))))}onFileChange=async(n,i,l)=>{var v;if(n===`${this.props.adapterName}.admin`&&l){if(i===this.fileLangSubscribed)try{await Yt.loadI18n(this.props.socket,(v=this.state.schema)==null?void 0:v.i18n,this.props.adapterName),this.setState({hash:`${this.state.hash}1`})}catch{}else if(this.fileSubscribed.includes(i))try{const s=await this.getConfigFile(this.fileSubscribed[0]);this.setState({schema:s,hash:ti(JSON.stringify(s)).toString()})}catch{}}};async getInstanceObject(){var n;try{const i=await this.props.socket.getObject(`system.adapter.${this.props.adapterName}.${this.props.instance}`);if(Array.isArray(i.encryptedNative)){if(!this.secret){const l=await this.props.socket.getSystemConfig();await $i("../../lib/js/crypto-js/crypto-js.js","crypto-js"),this.secret=l.native.secret}return(n=i.encryptedNative)==null||n.forEach(l=>{i.native[l]&&(i.native[l]=$l(this.secret,i.native[l]))}),i}return i}catch(i){window.alert(`[JsonConfig] Cannot read instance object: ${i}`)}return null}renderDialogConfirm(){return this.state.confirmDialog?M.createElement(j.DialogConfirm,{title:j.I18n.t("ra_Please confirm"),text:j.I18n.t("ra_Some data are not stored. Discard?"),ok:j.I18n.t("ra_Discard"),cancel:j.I18n.t("ra_Cancel"),onClose:n=>this.setState({confirmDialog:!1},()=>n&&j.Router.doNavigate(null))}):null}async scanForInclude(n,i){if(typeof n["#include"]=="string"){const v=await this._getConfigFile(n["#include"],[...i]);return delete n["#include"],v&&(n={...n,...v}),n}const l=Object.keys(n);for(let v=0;v<l.length;v++)n[l[v]]&&typeof n[l[v]]=="object"&&(n[l[v]]=await this.scanForInclude(n[l[v]],i));return n}async getConfigFile(n){return this._getConfigFile(n)}async _getConfigFile(n,i){if(n=n||"jsonConfig.json5",i=i||[],i.includes(n))return window.alert(`[JsonConfig] Circular reference in file: ${n} => ${i.join(" => ")}`),null;i.push(n);try{await this.props.socket.fileExists(`${this.props.adapterName}.admin`,n)||(n="jsonConfig.json");const v=await this.props.socket.readFile(`${this.props.adapterName}.admin`,n);let s="",c="";if(v.file!==void 0&&(c=v.file),typeof c=="string")s=c;else if(c.type==="Buffer"){let d="";const o=new Uint8Array(c.data),p=o.byteLength;for(let e=0;e<p;e++)d+=String.fromCharCode(o[e]);s=d}this.fileSubscribed.includes(n)||(this.fileSubscribed.push(n),await this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,n,this.onFileChange));try{return await this.scanForInclude(Li.parse(s),i)}catch(d){window.alert("[JsonConfig] Cannot parse json5 config!"),console.log(d)}}catch(l){this.state.schema||window.alert(`[JsonConfig] Cannot read file "${n}: ${l}`)}return null}renderSaveConfigDialog(){return this.state.saveConfigDialog?M.createElement(j.DialogConfirm,{title:j.I18n.t("ra_Please confirm"),text:j.I18n.t("Save configuration?"),ok:j.I18n.t("ra_Save"),cancel:j.I18n.t("ra_Cancel"),onClose:n=>this.setState({saveConfigDialog:!1},()=>n&&this.onSave(!0))}):null}findAttr(n,i){if(i=i||this.state.schema,i!=null&&i.items){if(n in i.items)return i.items[n];for(const l of Object.values(i.items)){const v=this.findAttr(n,l);if(v)return v}}return null}postProcessing(n,i,l){if(l=l||this.state.schema,!n){console.error(`Data is empty in postProcessing: ${i}, ${JSON.stringify(l)}`);return}const v=n[i];if(l.items)if(l.type==="table"){const s=v;if(!Array.isArray(s))return;for(const c of s)for(const d of l.items)this.postProcessing(c,d.attr,d)}else for(const[s,c]of Object.entries(l.items)){if(c.type==="panel"||c.type==="tabs"||c.type==="accordion")return;this.postProcessing(n,s,c)}else if(i&&typeof v=="string")if(l.type==="text")l.trim!==!1&&(n[i]=v.trim());else if(l.type==="ip")n[i]=v.trim();else if(l.type==="number"){const s=parseFloat(v.toString().replace(",","."));l.min!==void 0&&s<l.min?n[i]=l.min:l.max!==void 0&&s>l.max?n[i]=l.max:n[i]=s}else if(l.type==="port"){const s=parseInt(v.toString(),10);l.min!==void 0&&s<l.min?n[i]=l.min:l.max!==void 0&&s>l.max&&(n[i]=l.max),n[i]!==0&&s<20?n[i]=20:s>65535?n[i]=65535:n[i]=s}else l.type==="checkbox"&&(n[i]=n[i]===!0||n[i]==="true"||n[i]==="on"||n[i]===1||n[i]==="1")}async onSave(n,i){if(n){const l=await this.getInstanceObject();if(!l){console.error("Something went wrong: may be no connection?"),window.alert("Something went wrong: may be no connection?");return}if(!this.state.data||!this.state.schema)return;const v={};for(const c of Object.keys(this.state.data)){const d=this.findAttr(c);(!d||!d.doNotSave||d.type==="state")&&!c.startsWith("_")?K.setValue(l.native,c,this.state.data[c]):(K.setValue(l.native,c,null),v[c]=this.state.data[c])}try{const c=JSON.parse(JSON.stringify(l));if(Array.isArray(c.encryptedNative)){await $i("../../lib/js/crypto-js/crypto-js.js","crypto-js");for(const d of c.encryptedNative)c.native[d]&&(c.native[d]=Tl(this.secret,c.native[d]))}await this.props.socket.setObject(c._id,c)}catch(c){window.alert(`[JsonConfig] Cannot set object: ${c}`)}const s={...l.native,...v};console.log(s),this.setState({changed:!1,data:s,updateData:this.state.updateData+1,originalData:s},()=>i&&j.Router.doNavigate(null))}else this.state.changed?this.setState({confirmDialog:!0}):j.Router.doNavigate(null)}componentDidUpdate(n,i){i.changed!==this.state.changed&&this.props.configStored(!this.state.changed)}async componentDidMount(){const n=`${window.location.protocol}//${window.location.host}${window.location.pathname}validate_config/${this.props.adapterName}`;console.log(`fetch ${n}`),await fetch(n)}render(){return!this.state.data||!this.state.schema?M.createElement(R.LinearProgress,null):M.createElement("div",{style:ht.root},this.renderDialogConfirm(),this.getExportImportButtons(),this.renderSaveConfigDialog(),M.createElement(Yt,{key:this.state.hash,style:ht.scroll,socket:this.props.socket,themeName:this.props.themeName,themeType:this.props.themeType,adapterName:this.props.adapterName,instance:this.props.instance,isFloatComma:this.props.isFloatComma,dateFormat:this.props.dateFormat,schema:this.state.schema,common:this.state.common,expertMode:this.props.expertMode,data:this.state.data,updateData:this.state.updateData,onError:n=>this.setState({error:n}),onChange:(n,i,l)=>{l&&this.state.error&&(window.alert(j.I18n.t("Cannot save configuration because of error in configuration")),l=!1),l&&!this.state.changed&&!i&&(l=!1),n?this.setState({data:n,changed:i,saveConfigDialog:l}):l!==void 0&&this.setState({saveConfigDialog:l})},DeviceManager:this.props.DeviceManager,theme:this.state.theme}),M.createElement(j.SaveCloseButtons,{isIFrame:!1,dense:!0,paddingLeft:0,newReact:!0,theme:this.state.theme,noTextOnButtons:this.props.width==="xs"||this.props.width==="sm"||this.props.width==="md",changed:!!(this.state.error||this.state.changed),error:!!this.state.error,onSave:n=>this.onSave(!0,n),onClose:()=>this.onSave(!1)}))}};export{K as ConfigGeneric,ft as ConfigPanel,_l as JsonConfig,Yt as JsonConfigComponent};
|