iobroker.javascript 9.0.3 → 9.0.5
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 +8 -9
- package/admin/assets/OpenAiDialog-B5PG4z2f.js +34 -0
- package/admin/assets/Save-BKC3BS3x.js +1 -0
- package/admin/assets/ScriptEditor-CzccdGxE.js +2 -0
- package/admin/assets/ScriptEditorVanillaMonaco-NQqW_Tkm.js +1 -0
- package/admin/assets/{index-C3f8WSiz.js → index-CTFVTNbj.js} +35 -35
- package/admin/assets/index-CWSymef2.js +1294 -0
- package/admin/assets/index-DUBaHZ92.css +1 -0
- package/admin/assets/index-Dm1jc4t6.js +1 -0
- package/admin/assets/index-DnqHzUyv.js +5 -0
- package/admin/assets/index-Dr_ZFwru.css +1 -0
- package/admin/assets/index-DyVKKqMg.js +27 -0
- package/admin/assets/index-KXl04Hyb.js +16 -0
- package/admin/custom/assets/{index-DQRrNJnQ.js → index-CEFrj8jA.js} +35 -35
- package/admin/custom/assets/{index-sawv1cUe.js → index-Coei6-WB.js} +64 -64
- package/admin/custom/customComponents.js +2 -2
- package/admin/mf-manifest.json +1 -1
- package/admin/remoteEntry.js +2 -2
- package/admin/tab.html +3 -3
- package/admin/vs/configure.js +10 -9
- package/build-backend/lib/convert.js +11 -10
- package/build-backend/lib/convert.js.map +1 -1
- package/build-backend/main.js +5 -7
- package/build-backend/main.js.map +1 -1
- package/io-package.json +27 -27
- package/package.json +3 -3
- package/admin/assets/index-B2hdKtuj.js +0 -1329
- package/admin/assets/index-CEoeyJnt.css +0 -1
- package/admin/assets/index-CuCs5aLs.js +0 -5
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CttBOMyq.js","./useTheme-MELayQMj.js","./_commonjsHelpers-D6-XlEtG.js","./createTheme-BwMO3rTt.js","./ConfigCustomJavascriptSet__loadShare__react__loadShare__-CzzIM-HW.js","./ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-BaLGCXMi.js","./useThemeWithoutDefault-C-hl_s0Z.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{C as pt,R as k}from"./ConfigCustomJavascriptSet__loadShare__react__loadShare__-CzzIM-HW.js";import{a as Xr,c as He,g as Zr}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 Pi}from"./index-B8sZ2j0S.js";import{C as j,A as ts,a as Wi}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 Pn}from"./ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-BaLGCXMi.js";import{p as Un}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 $t},get JsonConfig(){return xl},get JsonConfigComponent(){return cn}},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]/,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]/,$n={Space_Separator:as,ID_Start:ls,ID_Continue:us},Me={isSpaceSeparator(L){return typeof L=="string"&&$n.Space_Separator.test(L)},isIdStartChar(L){return typeof L=="string"&&(L>="a"&&L<="z"||L>="A"&&L<="Z"||L==="$"||L==="_"||$n.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===""||$n.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 Wn,Be,it,pn,dt,Ye,Ie,Gn,Vt;var hs=function(n,i){Wn=String(n),Be="start",it=[],pn=0,dt=1,Ye=0,Ie=void 0,Gn=void 0,Vt=void 0;do Ie=cs(),fs[Be]();while(Ie.type!=="eof");return typeof i=="function"?Hn({"":Vt},"",i):Vt};function Hn(L,n,i){const u=L[n];if(u!=null&&typeof u=="object")if(Array.isArray(u))for(let v=0;v<u.length;v++){const o=String(v),h=Hn(u,o,i);h===void 0?delete u[o]:Object.defineProperty(u,o,{value:h,writable:!0,enumerable:!0,configurable:!0})}else for(const v in u){const o=Hn(u,v,i);o===void 0?delete u[v]:Object.defineProperty(u,v,{value:o,writable:!0,enumerable:!0,configurable:!0})}return i.call(L,n,u)}let pe,ue,jt,nt,me;function cs(){for(pe="default",ue="",jt=!1,nt=1;;){me=rt();const L=Hi[pe]();if(L)return L}}function rt(){if(Wn[pn])return String.fromCodePoint(Wn.codePointAt(pn))}function q(){const L=rt();return L===`
|
|
2
|
+
import{C as pt,R as k}from"./ConfigCustomJavascriptSet__loadShare__react__loadShare__-CzzIM-HW.js";import{a as Xr,c as He,g as Zr}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 Pi}from"./index-B8sZ2j0S.js";import{C as j,A as ts,a as Wi}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 Pn}from"./ConfigCustomJavascriptSet__mf_v__runtimeInit__mf_v__-BaLGCXMi.js";import{p as Un}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 $t},get JsonConfig(){return $l},get JsonConfigComponent(){return cn}},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]/,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]/,$n={Space_Separator:as,ID_Start:ls,ID_Continue:us},Me={isSpaceSeparator(L){return typeof L=="string"&&$n.Space_Separator.test(L)},isIdStartChar(L){return typeof L=="string"&&(L>="a"&&L<="z"||L>="A"&&L<="Z"||L==="$"||L==="_"||$n.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===""||$n.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 Wn,Be,it,pn,dt,Ye,Ie,Gn,Vt;var hs=function(n,i){Wn=String(n),Be="start",it=[],pn=0,dt=1,Ye=0,Ie=void 0,Gn=void 0,Vt=void 0;do Ie=cs(),fs[Be]();while(Ie.type!=="eof");return typeof i=="function"?Hn({"":Vt},"",i):Vt};function Hn(L,n,i){const u=L[n];if(u!=null&&typeof u=="object")if(Array.isArray(u))for(let v=0;v<u.length;v++){const s=String(v),h=Hn(u,s,i);h===void 0?delete u[s]:Object.defineProperty(u,s,{value:h,writable:!0,enumerable:!0,configurable:!0})}else for(const v in u){const s=Hn(u,v,i);s===void 0?delete u[v]:Object.defineProperty(u,v,{value:s,writable:!0,enumerable:!0,configurable:!0})}return i.call(L,n,u)}let pe,ue,jt,nt,me;function cs(){for(pe="default",ue="",jt=!1,nt=1;;){me=rt();const L=Hi[pe]();if(L)return L}}function rt(){if(Wn[pn])return String.fromCodePoint(Wn.codePointAt(pn))}function q(){const L=rt();return L===`
|
|
3
3
|
`?(dt++,Ye=0):L?Ye+=L.length:Ye++,L&&(pn+=L.length),L}const Hi={default(){switch(me){case" ":case"\v":case"\f":case" ":case" ":case"\uFEFF":case`
|
|
4
4
|
`:case"\r":case"\u2028":case"\u2029":q();return;case"/":q(),pe="comment";return;case void 0:return q(),De("eof")}if(Me.isSpaceSeparator(me)){q();return}return Hi[Be]()},comment(){switch(me){case"*":q(),pe="multiLineComment";return;case"/":q(),pe="singleLineComment";return}throw Ae(q())},multiLineComment(){switch(me){case"*":q(),pe="multiLineCommentAsterisk";return;case void 0:throw Ae(q())}q()},multiLineCommentAsterisk(){switch(me){case"*":q();return;case"/":q(),pe="default";return;case void 0:throw Ae(q())}q(),pe="multiLineComment"},singleLineComment(){switch(me){case`
|
|
5
5
|
`:case"\r":case"\u2028":case"\u2029":q(),pe="default";return;case void 0:return q(),De("eof")}q()},value(){switch(me){case"{":case"[":return De("punctuator",q());case"n":return q(),wt("ull"),De("null",null);case"t":return q(),wt("rue"),De("boolean",!0);case"f":return q(),wt("alse"),De("boolean",!1);case"-":case"+":q()==="-"&&(nt=-1),pe="sign";return;case".":ue=q(),pe="decimalPointLeading";return;case"0":ue=q(),pe="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":ue=q(),pe="decimalInteger";return;case"I":return q(),wt("nfinity"),De("numeric",1/0);case"N":return q(),wt("aN"),De("numeric",NaN);case'"':case"'":jt=q()==='"',ue="",pe="string";return}throw Ae(q())},identifierNameStartEscape(){if(me!=="u")throw Ae(q());q();const L=zn();switch(L){case"$":case"_":break;default:if(!Me.isIdStartChar(L))throw hi();break}ue+=L,pe="identifierName"},identifierName(){switch(me){case"$":case"_":case"":case"":ue+=q();return;case"\\":q(),pe="identifierNameEscape";return}if(Me.isIdContinueChar(me)){ue+=q();return}return De("identifier",ue)},identifierNameEscape(){if(me!=="u")throw Ae(q());q();const L=zn();switch(L){case"$":case"_":case"":case"":break;default:if(!Me.isIdContinueChar(L))throw hi();break}ue+=L,pe="identifierName"},sign(){switch(me){case".":ue=q(),pe="decimalPointLeading";return;case"0":ue=q(),pe="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":ue=q(),pe="decimalInteger";return;case"I":return q(),wt("nfinity"),De("numeric",nt*(1/0));case"N":return q(),wt("aN"),De("numeric",NaN)}throw Ae(q())},zero(){switch(me){case".":ue+=q(),pe="decimalPoint";return;case"e":case"E":ue+=q(),pe="decimalExponent";return;case"x":case"X":ue+=q(),pe="hexadecimal";return}return De("numeric",nt*0)},decimalInteger(){switch(me){case".":ue+=q(),pe="decimalPoint";return;case"e":case"E":ue+=q(),pe="decimalExponent";return}if(Me.isDigit(me)){ue+=q();return}return De("numeric",nt*Number(ue))},decimalPointLeading(){if(Me.isDigit(me)){ue+=q(),pe="decimalFraction";return}throw Ae(q())},decimalPoint(){switch(me){case"e":case"E":ue+=q(),pe="decimalExponent";return}if(Me.isDigit(me)){ue+=q(),pe="decimalFraction";return}return De("numeric",nt*Number(ue))},decimalFraction(){switch(me){case"e":case"E":ue+=q(),pe="decimalExponent";return}if(Me.isDigit(me)){ue+=q();return}return De("numeric",nt*Number(ue))},decimalExponent(){switch(me){case"+":case"-":ue+=q(),pe="decimalExponentSign";return}if(Me.isDigit(me)){ue+=q(),pe="decimalExponentInteger";return}throw Ae(q())},decimalExponentSign(){if(Me.isDigit(me)){ue+=q(),pe="decimalExponentInteger";return}throw Ae(q())},decimalExponentInteger(){if(Me.isDigit(me)){ue+=q();return}return De("numeric",nt*Number(ue))},hexadecimal(){if(Me.isHexDigit(me)){ue+=q(),pe="hexadecimalInteger";return}throw Ae(q())},hexadecimalInteger(){if(Me.isHexDigit(me)){ue+=q();return}return De("numeric",nt*Number(ue))},string(){switch(me){case"\\":q(),ue+=ps();return;case'"':if(jt)return q(),De("string",ue);ue+=q();return;case"'":if(!jt)return q(),De("string",ue);ue+=q();return;case`
|
|
6
6
|
`:case"\r":throw Ae(q());case"\u2028":case"\u2029":gs(me);break;case void 0:throw Ae(q())}ue+=q()},start(){switch(me){case"{":case"[":return De("punctuator",q())}pe="value"},beforePropertyName(){switch(me){case"$":case"_":ue=q(),pe="identifierName";return;case"\\":q(),pe="identifierNameStartEscape";return;case"}":return De("punctuator",q());case'"':case"'":jt=q()==='"',pe="string";return}if(Me.isIdStartChar(me)){ue+=q(),pe="identifierName";return}throw Ae(q())},afterPropertyName(){if(me===":")return De("punctuator",q());throw Ae(q())},beforePropertyValue(){pe="value"},afterPropertyValue(){switch(me){case",":case"}":return De("punctuator",q())}throw Ae(q())},beforeArrayValue(){if(me==="]")return De("punctuator",q());pe="value"},afterArrayValue(){switch(me){case",":case"]":return De("punctuator",q())}throw Ae(q())},end(){throw Ae(q())}};function De(L,n){return{type:L,value:n,line:dt,column:Ye}}function wt(L){for(const n of L){if(rt()!==n)throw Ae(q());q()}}function ps(){switch(rt()){case"b":return q(),"\b";case"f":return q(),"\f";case"n":return q(),`
|
|
7
7
|
`;case"r":return q(),"\r";case"t":return q()," ";case"v":return q(),"\v";case"0":if(q(),Me.isDigit(rt()))throw Ae(q());return"\0";case"x":return q(),ds();case"u":return q(),zn();case`
|
|
8
8
|
`:case"\u2028":case"\u2029":return q(),"";case"\r":return q(),rt()===`
|
|
9
|
-
`&&q(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw Ae(q());case void 0:throw Ae(q())}return q()}function ds(){let L="",n=rt();if(!Me.isHexDigit(n)||(L+=q(),n=rt(),!Me.isHexDigit(n)))throw Ae(q());return L+=q(),String.fromCodePoint(parseInt(L,16))}function zn(){let L="",n=4;for(;n-- >0;){const i=rt();if(!Me.isHexDigit(i))throw Ae(q());L+=q()}return String.fromCodePoint(parseInt(L,16))}const fs={start(){if(Ie.type==="eof")throw Ct();Tn()},beforePropertyName(){switch(Ie.type){case"identifier":case"string":Gn=Ie.value,Be="afterPropertyName";return;case"punctuator":nn();return;case"eof":throw Ct()}},afterPropertyName(){if(Ie.type==="eof")throw Ct();Be="beforePropertyValue"},beforePropertyValue(){if(Ie.type==="eof")throw Ct();Tn()},beforeArrayValue(){if(Ie.type==="eof")throw Ct();if(Ie.type==="punctuator"&&Ie.value==="]"){nn();return}Tn()},afterPropertyValue(){if(Ie.type==="eof")throw Ct();switch(Ie.value){case",":Be="beforePropertyName";return;case"}":nn()}},afterArrayValue(){if(Ie.type==="eof")throw Ct();switch(Ie.value){case",":Be="beforeArrayValue";return;case"]":nn()}},end(){}};function Tn(){let L;switch(Ie.type){case"punctuator":switch(Ie.value){case"{":L={};break;case"[":L=[];break}break;case"null":case"boolean":case"numeric":case"string":L=Ie.value;break}if(Vt===void 0)Vt=L;else{const n=it[it.length-1];Array.isArray(n)?n.push(L):Object.defineProperty(n,Gn,{value:L,writable:!0,enumerable:!0,configurable:!0})}if(L!==null&&typeof L=="object")it.push(L),Array.isArray(L)?Be="beforeArrayValue":Be="beforePropertyName";else{const n=it[it.length-1];n==null?Be="end":Array.isArray(n)?Be="afterArrayValue":Be="afterPropertyValue"}}function nn(){it.pop();const L=it[it.length-1];L==null?Be="end":Array.isArray(L)?Be="afterArrayValue":Be="afterPropertyValue"}function Ae(L){return dn(L===void 0?`JSON5: invalid end of input at ${dt}:${Ye}`:`JSON5: invalid character '${zi(L)}' at ${dt}:${Ye}`)}function Ct(){return dn(`JSON5: invalid end of input at ${dt}:${Ye}`)}function hi(){return Ye-=5,dn(`JSON5: invalid identifier character at ${dt}:${Ye}`)}function gs(L){console.warn(`JSON5: '${zi(L)}' in strings is not valid ECMAScript; consider escaping`)}function zi(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 dn(L){const n=new SyntaxError(L);return n.lineNumber=dt,n.columnNumber=Ye,n}var ms=function(n,i,u){const v=[];let
|
|
10
|
-
`+
|
|
11
|
-
`+
|
|
12
|
-
`+f+"}"}}return v.pop(),
|
|
13
|
-
`+
|
|
14
|
-
`+
|
|
15
|
-
`+f+"]"}return v.pop(),o=f,y}};const vs={parse:hs,stringify:ms};var ji=vs,Kn={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 hn={exports:{}};const bs={},ws=Object.freeze(Object.defineProperty({__proto__:null,default:bs},Symbol.toStringTag,{value:"Module"})),Cs=Xr(ws);var Es=hn.exports,ci;function Ss(){return ci||(ci=1,function(L,n){(function(i,u){L.exports=u()})(Es,function(){var i=i||function(u,v){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof He<"u"&&He.crypto&&(o=He.crypto),!o&&typeof ys=="function")try{o=Cs}catch{}var h=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.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(D){var E;return y.prototype=D,E=new y,y.prototype=null,E}}(),s={},p=s.lib={},e=p.Base=function(){return{extend:function(y){var D=d(this);return y&&D.mixIn(y),(!D.hasOwnProperty("init")||this.init===D.init)&&(D.init=function(){D.$super.init.apply(this,arguments)}),D.init.prototype=D,D.$super=this,D},create:function(){var y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var D in y)y.hasOwnProperty(D)&&(this[D]=y[D]);y.hasOwnProperty("toString")&&(this.toString=y.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),t=p.WordArray=e.extend({init:function(y,D){y=this.words=y||[],D!=v?this.sigBytes=D:this.sigBytes=y.length*4},toString:function(y){return(y||l).stringify(this)},concat:function(y){var D=this.words,E=y.words,b=this.sigBytes,g=y.sigBytes;if(this.clamp(),b%4)for(var S=0;S<g;S++){var M=E[S>>>2]>>>24-S%4*8&255;D[b+S>>>2]|=M<<24-(b+S)%4*8}else for(var _=0;_<g;_+=4)D[b+_>>>2]=E[_>>>2];return this.sigBytes+=g,this},clamp:function(){var y=this.words,D=this.sigBytes;y[D>>>2]&=4294967295<<32-D%4*8,y.length=u.ceil(D/4)},clone:function(){var y=e.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var D=[],E=0;E<y;E+=4)D.push(h());return new t.init(D,y)}}),r=s.enc={},l=r.Hex={stringify:function(y){for(var D=y.words,E=y.sigBytes,b=[],g=0;g<E;g++){var S=D[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 D=y.length,E=[],b=0;b<D;b+=2)E[b>>>3]|=parseInt(y.substr(b,2),16)<<24-b%8*4;return new t.init(E,D/2)}},a=r.Latin1={stringify:function(y){for(var D=y.words,E=y.sigBytes,b=[],g=0;g<E;g++){var S=D[g>>>2]>>>24-g%4*8&255;b.push(String.fromCharCode(S))}return b.join("")},parse:function(y){for(var D=y.length,E=[],b=0;b<D;b++)E[b>>>2]|=(y.charCodeAt(b)&255)<<24-b%4*8;return new t.init(E,D)}},c=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=c.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes},_process:function(y){var D,E=this._data,b=E.words,g=E.sigBytes,S=this.blockSize,M=S*4,_=g/M;y?_=u.ceil(_):_=u.max((_|0)-this._minBufferSize,0);var T=_*S,F=u.min(T*4,g);if(T){for(var A=0;A<T;A+=S)this._doProcessBlock(b,A);D=b.splice(0,T),E.sigBytes-=F}return new t.init(D,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 D=this._doFinalize();return D},blockSize:16,_createHelper:function(y){return function(D,E){return new y.init(E).finalize(D)}},_createHmacHelper:function(y){return function(D,E){return new m.HMAC.init(y,E).finalize(D)}}});var m=s.algo={};return s}(Math);return i})}(hn)),hn.exports}var Ds=Kn.exports;(function(L,n){(function(i,u){L.exports=u(Ss())})(Ds,function(i){return function(u){var v=i,o=v.lib,h=o.WordArray,d=o.Hasher,s=v.algo,p=[];(function(){for(var c=0;c<64;c++)p[c]=u.abs(u.sin(c+1))*4294967296|0})();var e=s.MD5=d.extend({_doReset:function(){this._hash=new h.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(c,f){for(var m=0;m<16;m++){var y=f+m,D=c[y];c[y]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360}var E=this._hash.words,b=c[f+0],g=c[f+1],S=c[f+2],M=c[f+3],_=c[f+4],T=c[f+5],F=c[f+6],A=c[f+7],$=c[f+8],C=c[f+9],w=c[f+10],x=c[f+11],I=c[f+12],R=c[f+13],O=c[f+14],P=c[f+15],B=E[0],V=E[1],W=E[2],H=E[3];B=t(B,V,W,H,b,7,p[0]),H=t(H,B,V,W,g,12,p[1]),W=t(W,H,B,V,S,17,p[2]),V=t(V,W,H,B,M,22,p[3]),B=t(B,V,W,H,_,7,p[4]),H=t(H,B,V,W,T,12,p[5]),W=t(W,H,B,V,F,17,p[6]),V=t(V,W,H,B,A,22,p[7]),B=t(B,V,W,H,$,7,p[8]),H=t(H,B,V,W,C,12,p[9]),W=t(W,H,B,V,w,17,p[10]),V=t(V,W,H,B,x,22,p[11]),B=t(B,V,W,H,I,7,p[12]),H=t(H,B,V,W,R,12,p[13]),W=t(W,H,B,V,O,17,p[14]),V=t(V,W,H,B,P,22,p[15]),B=r(B,V,W,H,g,5,p[16]),H=r(H,B,V,W,F,9,p[17]),W=r(W,H,B,V,x,14,p[18]),V=r(V,W,H,B,b,20,p[19]),B=r(B,V,W,H,T,5,p[20]),H=r(H,B,V,W,w,9,p[21]),W=r(W,H,B,V,P,14,p[22]),V=r(V,W,H,B,_,20,p[23]),B=r(B,V,W,H,C,5,p[24]),H=r(H,B,V,W,O,9,p[25]),W=r(W,H,B,V,M,14,p[26]),V=r(V,W,H,B,$,20,p[27]),B=r(B,V,W,H,R,5,p[28]),H=r(H,B,V,W,S,9,p[29]),W=r(W,H,B,V,A,14,p[30]),V=r(V,W,H,B,I,20,p[31]),B=l(B,V,W,H,T,4,p[32]),H=l(H,B,V,W,$,11,p[33]),W=l(W,H,B,V,x,16,p[34]),V=l(V,W,H,B,O,23,p[35]),B=l(B,V,W,H,g,4,p[36]),H=l(H,B,V,W,_,11,p[37]),W=l(W,H,B,V,A,16,p[38]),V=l(V,W,H,B,w,23,p[39]),B=l(B,V,W,H,R,4,p[40]),H=l(H,B,V,W,b,11,p[41]),W=l(W,H,B,V,M,16,p[42]),V=l(V,W,H,B,F,23,p[43]),B=l(B,V,W,H,C,4,p[44]),H=l(H,B,V,W,I,11,p[45]),W=l(W,H,B,V,P,16,p[46]),V=l(V,W,H,B,S,23,p[47]),B=a(B,V,W,H,b,6,p[48]),H=a(H,B,V,W,A,10,p[49]),W=a(W,H,B,V,O,15,p[50]),V=a(V,W,H,B,T,21,p[51]),B=a(B,V,W,H,I,6,p[52]),H=a(H,B,V,W,M,10,p[53]),W=a(W,H,B,V,w,15,p[54]),V=a(V,W,H,B,g,21,p[55]),B=a(B,V,W,H,$,6,p[56]),H=a(H,B,V,W,P,10,p[57]),W=a(W,H,B,V,F,15,p[58]),V=a(V,W,H,B,R,21,p[59]),B=a(B,V,W,H,_,6,p[60]),H=a(H,B,V,W,x,10,p[61]),W=a(W,H,B,V,S,15,p[62]),V=a(V,W,H,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]+H|0},_doFinalize:function(){var c=this._data,f=c.words,m=this._nDataBytes*8,y=c.sigBytes*8;f[y>>>5]|=128<<24-y%32;var D=u.floor(m/4294967296),E=m;f[(y+64>>>9<<4)+15]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,f[(y+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,c.sigBytes=(f.length+1)*4,this._process();for(var b=this._hash,g=b.words,S=0;S<4;S++){var M=g[S];g[S]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return b},clone:function(){var c=d.clone.call(this);return c._hash=this._hash.clone(),c}});function t(c,f,m,y,D,E,b){var g=c+(f&m|~f&y)+D+b;return(g<<E|g>>>32-E)+f}function r(c,f,m,y,D,E,b){var g=c+(f&y|m&~y)+D+b;return(g<<E|g>>>32-E)+f}function l(c,f,m,y,D,E,b){var g=c+(f^m^y)+D+b;return(g<<E|g>>>32-E)+f}function a(c,f,m,y,D,E,b){var g=c+(m^(f|~y))+D+b;return(g<<E|g>>>32-E)+f}v.MD5=d._createHelper(e),v.HmacMD5=d._createHmacHelper(e)}(Math),i.MD5})})(Kn);var As=Kn.exports;const pi=Zr(As),xs=window.innerWidth<=600?12:void 0;function _n(L){return Object.prototype.toString.call(L)==="[object Object]"}class K extends pt.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 u=i.shift();if(typeof u=="string"&&typeof n[u]=="object")return K.getValue(n[u],i)}static setValue(n,i,u){if(typeof i=="string"){K.setValue(n,i.split("."),u);return}if(i.length===1)u===null?delete n[i[0]]:n[i[0]]=u;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,u)}}getText(n,i){if(!n)return"";if(typeof n=="string"){const u=i?n:j.I18n.t(n);return u.includes("${")?this.getPattern(u,null,i):u}return _n(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=k.createElement(Z.Warning,null):n.type==="error"?i=k.createElement(Z.Error,null):n.type==="info"&&(i=k.createElement(Z.Info,null)),k.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:u=>this.setState({confirmDialog:!1},()=>{if(u){if(this.state.confirmCallback){const o=this.state.confirmCallback;this.setState({confirmCallback:null},()=>o(!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=k.createElement(Z.Key,null):n==="send"?i=k.createElement(Z.Send,null):n==="web"?i=k.createElement(Z.Public,null):n==="warning"?i=k.createElement(Z.Warning,null):n==="error"?i=k.createElement(Z.Error,null):n==="info"?i=k.createElement(Z.Info,null):n==="search"?i=k.createElement(Z.Search,null):n==="book"?i=k.createElement(Z.MenuBook,null):n==="help"?i=k.createElement(Z.Help,null):n==="upload"?i=k.createElement(Z.UploadFile,null):n==="edit"?i=k.createElement(Z.Edit,null):n==="user"?i=k.createElement(Z.Person,null):n==="group"?i=k.createElement(Z.Group,null):n==="delete"?i=k.createElement(Z.Delete,null):n==="refresh"?i=k.createElement(Z.Refresh,null):n==="add"?i=k.createElement(Z.Add,null):n==="unpair"?i=k.createElement(Z.LinkOff,null):n==="pair"?i=k.createElement(Z.Link,null):n==="save"?i=k.createElement(Z.Save,null):n==="open"?i=k.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=k.createElement(j.Icon,{src:n,style:{width:22,height:22}})),i}onChangeAsync(n,i){return new Promise(u=>{const v=this.onChange(n,i,u);v instanceof Promise&&v.catch(o=>console.error(`Cannot set value: ${o}`))})}onChange(n,i,u){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(h=>{this.setState({confirmDialog:!0,confirmNewValue:i,confirmAttr:n,confirmData:null},()=>{typeof u=="function"?u():h()})});if(this.props.schema.confirmDependsOn)for(let h=0;h<this.props.schema.confirmDependsOn.length;h++){const d=this.props.schema.confirmDependsOn[h];if(d.confirm){const s=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:s,confirmDepAttr:d.attr,confirmData:d.confirm},()=>{typeof u=="function"?u():p()})})}}const o=[];if(this.props.schema.onChangeDependsOn)for(let h=0;h<this.props.schema.onChangeDependsOn.length;h++){const d=this.props.schema.onChangeDependsOn[h];if(d.onChange){const s=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,s,v,this.props.arrayIndex,this.props.globalData),p!==s&&(K.setValue(v,d.attr,p),o.push(d.attr))}}if(this.props.schema.hiddenDependsOn)for(let h=0;h<this.props.schema.hiddenDependsOn.length;h++){const d=this.props.schema.hiddenDependsOn[h];d.hidden&&o.push(d.attr)}if(this.props.schema.labelDependsOn)for(let h=0;h<this.props.schema.labelDependsOn.length;h++){const d=this.props.schema.labelDependsOn[h];d.hidden&&o.push(d.attr)}if(this.props.schema.helpDependsOn)for(let h=0;h<this.props.schema.helpDependsOn.length;h++){const d=this.props.schema.helpDependsOn[h];d.hidden&&o.push(d.attr)}if(this.props.schema.onChange&&!this.props.schema.onChange.ignoreOwnChanges){const h=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,h,v,this.props.arrayIndex,this.props.globalData);d!==h&&K.setValue(v,this.props.attr,d)}return this.props.custom?(this.props.onChange(n,i,()=>u&&u()),o!=null&&o.length&&o.forEach((h,d)=>setTimeout(()=>this.props.onChange(h,K.getValue(v,h)),d*50))):this.props.onChange(v,void 0,()=>{o.length&&this.props.oContext.forceUpdate(o,v),u&&u()}),Promise.resolve()}execute(n,i,u,v,o){let h;if(_n(n))h=n.func;else if(typeof n=="string")h=n;else return n;if(!h)return i;try{return new Function("data","originalData","_system","_alive","_common","_socket","_instance","arrayIndex","globalData","_changed",h.includes("return")?h:`return ${h}`)(u||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,o,this.props.changed)}catch(d){return console.error(`Cannot execute ${JSON.stringify(n)}: ${d}`),i}}executeCustom(n,i,u,v,o,h){let d;if(_n(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,u,this.props.oContext.socket,o,h,this.props.changed)}catch(s){return console.error(`Cannot execute ${d}: ${s}`),null}}calculate(n){let i,u,v,o;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?u=!0:u=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,o=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?u=!0:u=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,o=n.defaultFunc?this.execute(n.defaultFunc,n.default,this.props.data,this.props.arrayIndex,this.props.globalData):n.default),{error:i,disabled:u,hidden:v,defaultValue:o}}onError(n,i){i?this.isError[n]=i:delete this.isError[n],this.props.onError&&this.props.onError(n,i)}renderItem(n,i,u){return this.getText(this.props.schema.label)||this.getText(this.props.schema.text)}renderHelp(n,i,u){return i?k.createElement("a",{href:i,target:"_blank",rel:"noreferrer",style:{color:this.props.oContext.themeType==="dark"?"#a147ff":"#5b238f",textDecoration:"underline"}},this.getText(n,u)):(n=this.getText(n,u)||"",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,(u,v)=>{if(v&&typeof v=="string"&&v.startsWith("data.")){const o=K.getValue(i,v.replace(/^data\./,""));if(typeof o=="string"&&o.includes('"'))return`\${${v}.replace(/"/g, '\\\\"')}`}return u}),n)}getPattern(n,i,u){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 h=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 u?h:j.I18n.t(h)}catch(o){return console.error(`Cannot execute ${v}: ${o}`),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:u,hidden:v,defaultValue:o}=this.calculate(n);if(v){if(Object.keys(this.isError).length&&(setTimeout(s=>Object.keys(s).forEach(p=>this.props.onError(p)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}),n.hideOnlyControl){const s=k.createElement(N.Grid2,{size:{xs:n.xs||xs,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?k.createElement(k.Fragment,null,k.createElement("div",{style:{flexBasis:"100%",height:0}}),s):s}return null}n.validatorNoSaveOnError&&(i&&!Object.keys(this.isError).length?(this.isError={[this.props.attr]:n.validatorErrorText?j.I18n.t(n.validatorErrorText):!0},setTimeout(s=>Object.keys(s).forEach(p=>this.props.onError(p,s[p])),100,JSON.parse(JSON.stringify(this.isError)))):!i&&Object.keys(this.isError).length&&(setTimeout(s=>Object.keys(s).forEach(p=>this.props.onError(p)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}));const h=this.renderItem(i,u||this.props.commandRunning||this.props.disabled,o);if(this.noPlaceRequired)return h;const d=k.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?k.createElement(N.Grid2,{container:!0,style:{width:"100%"}},k.createElement(N.Grid2,{flex:1},h),k.createElement(N.Grid2,null,k.createElement(N.Button,{disabled:u,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)))):h);return n.newLine?k.createElement(k.Fragment,null,k.createElement("div",{style:{flexBasis:"100%",height:0}}),this.renderDialogConfirm(),d):this.state.confirmDialog?k.createElement(k.Fragment,null,this.renderDialogConfirm(),d):d}}const Ge={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:u}=this.state,{schema:v}=this.props,o={type:"panel",items:v.items.reduce((h,d)=>(h[d.attr]=d,h),{}),style:{marginLeft:"-8px",marginTop:"10px",marginBottom:"10px"}};return k.createElement($t,{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:o,originalData:this.props.originalData,onChange:(h,d)=>{const s=JSON.parse(JSON.stringify(u));s[i][h]=d,this.setState({value:s},()=>this.onChangeWrapper(s))},onError:(h,d)=>this.onError(h,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)),u=JSON.parse(JSON.stringify(i[n]));if(typeof this.props.schema.clone=="string"&&typeof u[this.props.schema.clone]=="string"){let v=1,o=u[this.props.schema.clone];const h=o.match(/(\d+)$/);for(h?(o=o.replace(h[0],""),v=parseInt(h[0],10)+1):o+="_";i.find(d=>d[this.props.schema.clone]===o+v.toString());)v++;u[this.props.schema.clone]=`${u[this.props.schema.clone]}_${v}`}i.splice(n,0,u),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 u=this.onChange(this.props.attr,i);u instanceof Promise&&u.catch(v=>this.onError(v))},300,n)};onAdd=()=>{const{schema:n}=this.props,i=JSON.parse(JSON.stringify(this.state.value)),u=n.items&&n.items.reduce((v,o)=>{let h;return o.defaultFunc?this.props.custom?h=o.defaultFunc?this.executeCustom(o.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,i.length,this.props.data):this.props.schema.default:h=o.defaultFunc?this.execute(o.defaultFunc,this.props.schema.default,this.props.data,i.length,this.props.data):this.props.schema.default:h=o.default===void 0?null:o.default,v[o.attr]=h,v},{});i.push(u),this.setState({value:i,activeIndex:i.length-1},()=>this.onChangeWrapper(i))};onMoveUp(n){const i=JSON.parse(JSON.stringify(this.state.value)),u=i[n];i.splice(n,1),i.splice(n-1,0,u);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)),u=i[n];i.splice(n,1),i.splice(n+1,0,u);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?k.createElement(N.Paper,null,n.label||!n.noDelete?k.createElement(N.Toolbar,{variant:"dense"},n.label?k.createElement(N.Typography,{variant:"h6",id:"tableTitle",component:"div"},this.getText(n.label)):null,n.noDelete?null:k.createElement(N.IconButton,{size:"small",color:"primary",onClick:this.onAdd},k.createElement(Z.Add,null))):null,i.map((u,v)=>k.createElement(N.Accordion,{key:`${u}_${v}`,expanded:this.state.activeIndex===v,onChange:(o,h)=>this.setState({activeIndex:h?v:-1})},k.createElement(N.AccordionSummary,{expandIcon:k.createElement(Z.ExpandMore,null),sx:j.Utils.getStyle(this.props.oContext.theme,Ge.fullWidth,Ge.accordionSummary)},k.createElement(N.Typography,{style:Ge.accordionTitle},u[n.titleAttr])),k.createElement(N.AccordionDetails,{style:{...n.style,...this.props.oContext.themeType?n.darkStyle:void 0}},this.itemAccordion(i[v],v),k.createElement(N.Toolbar,{sx:Ge.toolbar},v?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Move up"),slotProps:{popper:{sx:Ge.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveUp(v)},k.createElement(Z.ArrowUpward,null))):k.createElement("div",{style:Ge.buttonEmpty}),v<i.length-1?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Move down"),slotProps:{popper:{sx:Ge.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveDown(v)},k.createElement(Z.ArrowDownward,null))):k.createElement("div",{style:Ge.buttonEmpty}),n.noDelete?null:k.createElement(N.Tooltip,{title:j.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:Ge.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:this.onDelete(v)},k.createElement(Z.Delete,null))),n.clone?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:Ge.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:this.onClone(v)},k.createElement(Z.ContentCopy,null))):null)))),!n.noDelete&&i.length>0?k.createElement(N.Toolbar,{variant:"dense",sx:Ge.rootTool},k.createElement(N.IconButton,{size:"small",color:"primary",onClick:this.onAdd},k.createElement(Z.Add,null))):null,n.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null):null}}const di={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(u=>this.setState({alive:!!(u&&u.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 k.createElement("div",{style:{...di.root,...this.state.alive?void 0:di.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(u=>typeof u=="string"?{label:u,value:u}:JSON.parse(JSON.stringify(u)));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 u;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(h=>!v.find(d=>typeof d=="object"?d.value===h:d===h)).forEach(h=>v.push({label:h.toString(),value:h})),u={label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE},v.unshift(u)):(u=this.state.value!==null&&this.state.value!==void 0&&v.find(h=>typeof h=="object"?h.value==this.state.value:h==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!u&&this.props.schema.freeSolo&&(u={value:this.state.value,label:this.state.value},v.push(u))),k.createElement(N.Autocomplete,{fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,value:u,options:v,isOptionEqualToValue:(h,d)=>h.value===d.value,filterOptions:(h,d)=>{const s=h.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!==""&&s.push({label:d.inputValue,value:d.inputValue}),s},onInputChange:h=>{if(!h||!this.props.schema.freeSolo)return;const d=h.target.value;d!==this.state.value&&this.setState({value:d},()=>this.onChange(this.props.attr,d))},onChange:(h,d)=>{const s=typeof d=="object"?d?d.value:"":d;s!==this.state.value&&this.setState({value:s},()=>this.onChange(this.props.attr,s))},getOptionLabel:h=>typeof h=="object"?(h==null?void 0:h.label)??"":"",renderInput:h=>k.createElement(N.TextField,{variant:"standard",...h,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(u=>typeof u=="string"?{label:u,value:u}:JSON.parse(JSON.stringify(u))):[];if(this.props.alive){let u=this.props.schema.data;if(u===void 0&&this.props.schema.jsonData){const v=this.getPattern(this.props.schema.jsonData,null,!0);try{typeof v=="string"&&(u=JSON.parse(v))}catch{console.error(`Cannot parse json data: ${JSON.stringify(u)}`)}}u===void 0&&(u=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",u).then(v=>{v&&Array.isArray(v)&&v.forEach(o=>i.push(typeof o=="string"?{label:o,value:o}:JSON.parse(JSON.stringify(o)))),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 h=this.getContext();(h!==this.localContext||!this.initialized)&&(this.localContext=h,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}let u;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(h=>!v.find(d=>d.value===h)).forEach(h=>v.push({label:h.toString(),value:h})),u={label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE},v.unshift(u)):(u=this.state.value!==null&&this.state.value!==void 0&&v.find(h=>h.value==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!u&&this.props.schema.freeSolo&&(u={value:this.state.value,label:this.state.value},v.push(u)),u=u||null),v.length?k.createElement(N.Autocomplete,{value:u,fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,options:v,isOptionEqualToValue:(h,d)=>h.value===d.value,filterOptions:(h,d)=>{const s=h.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!==""&&s.push({label:d.inputValue,value:d.inputValue}),s},getOptionLabel:h=>(h==null?void 0:h.label)??"",onInputChange:h=>{if(!h||!this.props.schema.freeSolo)return;const d=h.target.value;d!==this.state.value&&this.setState({value:d},()=>this.onChange(this.props.attr,d))},onChange:(h,d)=>{const s=typeof d=="object"?d?d.value:"":d;s!==this.state.value&&this.setState({value:s},()=>this.onChange(this.props.attr,s))},renderInput:h=>k.createElement(N.TextField,{variant:"standard",...h,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})}):k.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:h=>{const d=h.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 kn={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,u=K.getValue(n,i)||"";this.setState({value:u,showDialog:!1})}renderItem(n,i){const{schema:u,attr:v}=this.props,{value:o,showDialog:h}=this.state;return k.createElement(N.FormControl,{style:kn.fullWidth,variant:"standard"},u.label?k.createElement(N.InputLabel,{shrink:!0},this.getText(u.label)):null,k.createElement("div",{style:kn.flex},k.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:o??"",error:!!n,disabled:i,placeholder:this.getText(u.placeholder),label:this.getText(u.label),helperText:this.renderHelp(u.help,u.helpLink,u.noTranslation),onChange:d=>{const s=d.target.value;this.setState({value:s},()=>this.onChange(v,s))}}),k.createElement(N.Button,{color:"grey",disabled:i,style:kn.button,size:"small",variant:"outlined",onClick:()=>this.setState({showDialog:!0})},"...")),h?k.createElement(j.DialogCron,{title:j.I18n.t("ra_Define schedule"),simple:u.simple,complex:u.complex,cron:o,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),u=(await this.props.oContext.socket.getCertificates()).filter(v=>{const o=this.props.attr.toLowerCase();return o.includes(v.type)||v.type==="public"&&o.includes("cert")||v.type==="private"&&(o.includes("priv")||o.includes("key"))?!0:!!(v.type==="chained"&&(o.includes("chain")||o.includes("ca")))}).map(v=>({label:v.name,value:v.name}));u.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({value:n,selectOptions:u})}renderItem(n,i){var v,o;if(!this.state.selectOptions)return null;const u=(v=this.state.selectOptions)==null?void 0:v.find(h=>h.value===this.state.value);return k.createElement(N.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?k.createElement(N.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:this.state.value,renderValue:()=>this.getText(u==null?void 0:u.label,this.props.schema.noTranslation!==!1),onChange:h=>this.setState({value:h.target.value},()=>this.onChange(this.props.attr,this.state.value))},(o=this.state.selectOptions)==null?void 0:o.map(h=>k.createElement(N.MenuItem,{key:h.value,value:h.value,style:h.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(h.label,this.props.schema.noTranslation!==!1)))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const zt={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=[],u=[],v=[];let o=[];const h=await this.props.oContext.socket.getObject("system.certificates");(d=h==null?void 0:h.native)!=null&&d.collections?o=Object.keys(h.native.collections):o=null,n.forEach(s=>{s.type==="public"?i.push({label:s.name,value:s.name}):s.type==="private"?u.push({label:s.name,value:s.name}):s.type==="chained"?v.push({label:s.name,value:s.name}):(i.push({label:s.name,value:s.name}),u.push({label:s.name,value:s.name}),v.push({label:s.name,value:s.name}))}),i.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),u.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:u,collectionsOptions:o})}renderItem(n,i){var e,t,r,l,a,c,f;if(!this.state.certsPublicOptions||!this.state.certsPrivateOptions||!this.state.certsChainOptions)return null;const u=(K.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString(),v=K.getValue(this.props.data,this.props.schema.certPublicName||"certPublic"),o=K.getValue(this.props.data,this.props.schema.certPrivateName||"certPrivate"),h=K.getValue(this.props.data,this.props.schema.certChainedName||"certChained"),d=(e=this.state.certsPublicOptions)==null?void 0:e.find(m=>m.value===v),s=(t=this.state.certsPrivateOptions)==null?void 0:t.find(m=>m.value===o),p=(r=this.state.certsChainOptions)==null?void 0:r.find(m=>m.value===h);return k.createElement("div",{style:zt.fullWidth},this.state.collectionsOptions?k.createElement(N.FormControl,{style:zt.leWidth,variant:"standard"},k.createElement(N.InputLabel,{shrink:!0},"Let's encrypt"),k.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:u,onChange:m=>this.onChange(this.props.schema.leCollectionName||"leCollection",m.target.value==="false"?!1:m.target.value==="true"?!0:m.target.value)},k.createElement(N.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},j.I18n.t("ra_Do not use let's encrypt")),k.createElement(N.MenuItem,{key:"_true",value:"true",style:{fontWeight:"bold"}},j.I18n.t("ra_Use all available let's encrypt certificates")),(l=this.state.collectionsOptions)==null?void 0:l.map(m=>k.createElement(N.MenuItem,{key:m,value:m},m)))):null,this.state.collectionsOptions?k.createElement("br",null):null,this.state.collectionsOptions&&u!=="false"?k.createElement("div",null,j.I18n.t("ra_Fallback custom certificates")):null,k.createElement(N.FormControl,{style:zt.certWidth,variant:"standard"},k.createElement(N.InputLabel,{shrink:!0},j.I18n.t("ra_Public certificate")),k.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)=>k.createElement(N.MenuItem,{key:`${m.value}_${y}`,value:m.value,style:m.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(m.label))))),k.createElement(N.FormControl,{style:zt.certWidth,variant:"standard"},k.createElement(N.InputLabel,{shrink:!0},j.I18n.t("ra_Private certificate")),k.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:o||"",renderValue:()=>this.getText(s==null?void 0:s.label),onChange:m=>this.onChange(this.props.schema.certPrivateName||"certPrivate",m.target.value)},(c=this.state.certsPrivateOptions)==null?void 0:c.map((m,y)=>k.createElement(N.MenuItem,{key:`${m.value}_${y}`,value:m.value,style:m.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(m.label))))),k.createElement(N.FormControl,{style:zt.certWidth,variant:"standard"},k.createElement(N.InputLabel,{shrink:!0},j.I18n.t("ra_Chained certificate")),k.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:h||"",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)=>k.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 u;super.componentDidMount();let n;const i=await this.props.oContext.socket.getObject("system.certificates");(u=i==null?void 0:i.native)!=null&&u.collections?n=Object.keys(i.native.collections):n=[],this.setState({collectionsOptions:n})}renderItem(n,i){var v;if(!this.state.collectionsOptions)return null;const u=(K.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString();return k.createElement(N.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?k.createElement(N.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:u,onChange:o=>this.onChange(this.props.schema.leCollectionName||"leCollection",o.target.value==="false"?!1:o.target.value==="true"?!0:o.target.value)},k.createElement(N.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},j.I18n.t("ra_Do not use let's encrypt")),k.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(o=>k.createElement(N.MenuItem,{key:o,value:o},o))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const We={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 ct 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=[k.createElement("div",{key:"error"},n)],n.push(k.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(k.createElement(N.TableContainer,{key:"table"},k.createElement(N.Table,{size:"small"},k.createElement(N.TableHead,null,k.createElement(N.TableRow,null,k.createElement(N.TableCell,null,j.I18n.t("ra_Product")),k.createElement(N.TableCell,null,j.I18n.t("ra_Version")),k.createElement(N.TableCell,null,"UUID"),k.createElement(N.TableCell,null,j.I18n.t("ra_ValidTill")),k.createElement(N.TableCell,null,j.I18n.t("ra_Commercial")),k.createElement(N.TableCell,null,"ID"))),k.createElement(N.TableBody,null,this.state.allLicenses.map(i=>k.createElement(N.TableRow,{key:i.id},k.createElement(N.TableCell,{sx:i.validName?null:We.errorText},i.license.product),k.createElement(N.TableCell,{sx:i.validVersion?null:We.errorText},i.license.version),k.createElement(N.TableCell,{sx:i.validUuid?null:We.errorText},i.license.uuid||"--"),k.createElement(N.TableCell,{sx:i.validTill?null:We.errorText},i.license.validTill&&i.license.validTill!=="0000-00-00 00:00:00"?new Date(i.license.validTill).toLocaleDateString():"--"),k.createElement(N.TableCell,null,i.license.invoice!=="free"?i.license.invoice==="MANUALLY_CREATED"?"✓":i.license.invoice:"-"),k.createElement(N.TableCell,null,i.id))))))):(n.push(k.createElement("div",{key:"text1"},j.I18n.t("ra_No one license found in license manager"))),n.push(k.createElement("div",{key:"text2"},j.I18n.t("ra_Please create license"))))),k.createElement(N.Dialog,{open:!0,maxWidth:"xl",fullWidth:this.props.fullWidth!==void 0?this.props.fullWidth:!0,onClick:()=>this.setState({_error:"",allLicenses:null})},k.createElement(N.DialogTitle,null,j.I18n.t("ra_Error")),k.createElement(N.DialogContent,null,k.createElement(N.DialogContentText,null,n)),k.createElement(N.DialogActions,null,k.createElement(N.Button,{variant:"contained",onClick:()=>this.setState({_error:"",allLicenses:null}),color:"primary",autoFocus:!0,startIcon:k.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(u=>{if(!(i[u]===null||i[u]===void 0))if(typeof i[u]=="object"){const v=i[u];Object.keys(v).forEach(o=>{v[o]!==null&&v[o]!==void 0&&(typeof v[o]=="object"?n.push(k.createElement("div",{key:o},k.createElement("div",{style:We.licLabel},o,":"),JSON.stringify(v[o],null,2))):n.push(k.createElement("div",{key:o},k.createElement("div",{style:We.licLabel},u," -",o,":"),v[o].toString())))})}else n.push(k.createElement("div",{key:u},k.createElement("div",{style:We.licLabel},u.replace(/_/g," "),":"),i[u].toString()))}),n.push(k.createElement("div",{key:"checked"},k.createElement("div",{style:We.licLabel},j.I18n.t("ra_Checked"),":"),this.state.licenseOfflineCheck?j.I18n.t("ra_locally"):j.I18n.t("ra_via internet"))),k.createElement(N.Dialog,{open:!0,onClose:()=>this.setState({showLicenseData:null})},k.createElement(N.DialogTitle,null,k.createElement(N.Box,{component:"span",sx:this.state.result?We.okTitle:We.errorTitle},j.I18n.t("ra_License %s",this.state.result?"OK":"INVALID"))),k.createElement(N.DialogContent,null,this.state.showLinkToProfile?k.createElement(N.Button,{variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},"https://iobroker.net"):null,this.state._error?k.createElement(N.Box,{component:"div",sx:We.errorText},this.state._error):null,n),k.createElement(N.DialogActions,null,k.createElement(N.Button,{onClick:()=>this.setState({showLicenseData:null,_error:""}),color:"primary",variant:"contained"},j.I18n.t("ra_Close"))))}return null}static parseJwt(n){const u=n.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),v=decodeURIComponent(atob(u).split("").map(o=>`%${`00${o.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));try{return JSON.parse(v)}catch{return null}}static isVersionValid(n,i,u,v){if(!i||!n)return!0;let o=!0;const[h]=n.split(".");return i.startsWith(">=")?o=parseInt(h,10)>=parseInt(i.substring(2,10)):i.startsWith("<=")?o=parseInt(h,10)<=parseInt(i.substring(2,10)):i.startsWith(">")?o=parseInt(h,10)>parseInt(i.substring(1,10)):i.startsWith("<")?o=parseInt(h,10)<parseInt(i.substring(1,10)):i.startsWith("=")?o=parseInt(h,10)===parseInt(i.substring(1,10)):i.startsWith("==")?o=parseInt(h,10)===parseInt(i.substring(2,10)):i.startsWith("===")&&(o=parseInt(h,10)===parseInt(i.substring(3,10))),!0}async findInLicenseManager(n){var v,o,h,d;const i=await this.props.oContext.socket.getObject("system.licenses"),u=[];if((o=(v=i==null?void 0:i.native)==null?void 0:v.licenses)!=null&&o.length){let s=null;const p=Date.now();let e;if(this.props.schema.uuid){const r=await this.props.oContext.socket.getObject("system.meta.uuid");e=(h=r==null?void 0:r.native)==null?void 0:h.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 l=!r.validTill||r.validTill==="0000-00-00 00:00:00"||new Date(r.validTill).getTime()>p,a=(r.product||"").split("."),c=a[1]===n||n==="vis-2"&&a[1]==="vis",f=!e||!r.uuid||r.uuid===e,m=ct.isVersionValid(t,r.version,r.invoice,n);(!s||r.invoice!=="free")&&l&&c&&f&&m&&(s=r),u.push({id:r.id,validName:c,validUuid:f,validVersion:m,validTill:l,license:r})}),s&&(u.find(r=>r.id===s.id).used=!0)}return u}async checkLicense(n,i){var d,s,p;let u;if(this.props.schema.uuid){const e=await this.props.oContext.socket.getObject("system.meta.uuid");u=(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=(s=e==null?void 0:e.common)==null?void 0:s.version}const o=new AbortController;let h=setTimeout(()=>{h=null,o.abort()},5e3);try{const e=await window.fetch("https://iobroker.net/api/v1/public/cert/",{method:"POST",body:JSON.stringify({json:n,uuid:u}),headers:{"Content-Type":"text/plain"},signal:o.signal});h&&clearTimeout(h);const t=await e.text();let r;try{r=JSON.parse(t)}catch{}if(r!=null&&r.error)try{const l=ct.parseJwt(n),a=j.I18n.t(`ra_${l.error||r.error||"Unknown error"}`).replace(/^ra_/,"");return this.setState({_error:a,licenseOfflineCheck:!1,showLicenseData:l,result:!1,running:!1})}catch{return console.log("Cannot parse license"),this.setState({_error:r.error,result:!1,running:!1})}else{let l=null;try{l=ct.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:l,result:!1,running:!1});const c=(r.name||"").split(".");return c[1]===i||c[1]==="vis"&&i==="vis-2"?u&&!r.uuid&&i==="vis-2"?this.setState({_error:j.I18n.t("ra_License must be converted",r.uuid),showLinkToProfile:!0,licenseOfflineCheck:!1,showLicenseData:l,result:!1,running:!1}):u&&r.uuid&&r.uuid!==u?this.setState({_error:j.I18n.t('ra_Serial number (UUID) "%s" in license is for other device.',r.uuid),licenseOfflineCheck:!1,showLicenseData:l,result:!1,running:!1}):ct.isVersionValid(v,r.version,r.invoice,i)?this.setState({licenseOfflineCheck:!1,showLicenseData:l,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:l,result:!1,running:!1}):this.setState({_error:j.I18n.t('ra_License for other product "%s"',r.name),licenseOfflineCheck:!1,showLicenseData:l,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=ct.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?u&&t.uuid&&t.uuid!==u?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}):ct.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?k.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 u,v;if(this.props.data.useLicenseManager){if(v=await this.findInLicenseManager(i),u=v.find(o=>o.used),u&&(u=u.license.json),!u&&!n){this.setState({askForUpdate:!0});return}}else u=this.props.data.license;u?await this.checkLicense(u,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 k.createElement("div",{style:We.fullWidth},k.createElement(N.Button,{variant:this.props.schema.variant||"outlined",color:this.props.schema.color||"primary",style:We.fullWidth,disabled:!this.props.data.license&&!this.props.data.useLicenseManager||this.state.running,startIcon:k.createElement(Z.Send,null),onClick:()=>this._onClick()},this.state.running?k.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 Rs extends K{renderItem(n,i){const u=K.getValue(this.props.data,this.props.attr),v=Array.isArray(u);return k.createElement(N.FormControl,{style:{width:"100%"},variant:"standard"},k.createElement(N.FormControlLabel,{onClick:o=>{if(o.preventDefault(),o.stopPropagation(),!i){const h=this.onChange(this.props.attr,!u);h instanceof Promise&&h.catch(d=>console.error(`Cannot set value: ${d}`))}},control:k.createElement(N.Checkbox,{indeterminate:v,checked:!!u,onChange:o=>{let h;v?h=this.onChange(this.props.attr,!0):h=this.onChange(this.props.attr,o.target.checked),h instanceof Promise&&h.catch(d=>console.error(`Cannot set value: ${d}`))},disabled:i||this.props.schema.readOnly}),label:this.getText(this.props.schema.label)}),k.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?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Os={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:{}}},rn={BACKSPACE:8,DELETE:46,LEFT_ARROW:37,RIGHT_ARROW:39},Bs=({value:L,isFocused:n,isDisabled:i,isReadOnly:u,handleClick:v,handleDelete:o,style:h},d)=>k.createElement(N.Chip,{key:d,style:{...h,pointerEvents:i||u?"none":void 0,backgroundColor:n?rs[300]:void 0},onClick:v,onDelete:o,label:L});class Ps extends k.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=k.createRef(),this.input=k.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 u=null;return n.value&&n.value.length!==i.prevPropsValue.length&&(u={prevPropsValue:n.value},n.clearInputValueOnChange&&(u.inputValue="")),n.clearInputValueOnChange&&n.value&&n.value.length!==i.prevPropsValue.length&&(u={prevPropsValue:n.value,inputValue:""}),n.disabled&&(u={...u,focusedChip:null}),!i.chipsUpdated&&n.defaultValue&&(u={...u,chips:n.defaultValue}),u}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 u;switch(this.props.blurBehavior||"clear"){case"add-or-clear":u={clearInputOnFail:!0};case"add":if(this.props.delayBeforeAdd){const v=(this.props.value||this.state.chips).length;this.inputBlurTimeout=setTimeout(()=>{const o=(this.props.value||this.state.chips).length;v===o?this.handleAddChip(i,u):this.clearInput()},150)}else this.handleAddChip(i,u);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 u=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 rn.BACKSPACE:n.target.value===""&&(i?(this.handleDeleteChip(u[i],i),i&&this.setState({focusedChip:i-1})):this.setState({focusedChip:u.length-1}));break;case rn.DELETE:n.target.value===""&&i&&(this.handleDeleteChip(u[i],i),i<=u.length-1&&this.setState({focusedChip:i}));break;case rn.LEFT_ARROW:i===null&&n.target.value===""&&u.length?this.setState({focusedChip:u.length-1}):i!==null&&i>0&&this.setState({focusedChip:i-1});break;case rn.RIGHT_ARROW:i!==null&&i<u.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 u=this.props.value||this.state.chips;return n.trim().length?((this.props.allowDuplicates||!u.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 u=this.state.chips.slice();if(u.splice(i,1)){let o=this.state.focusedChip;this.state.focusedChip===i?o=null:this.state.focusedChip>i&&(o=this.state.focusedChip-1),this.updateChips(u,{focusedChip:o})}}}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:u,disabled:v,disableUnderline:o,error:h,FormHelperTextProps:d,fullWidth:s,fullWidthInput:p,helperText:e,id:t,InputProps:r={},InputLabelProps:l={},inputValue:a,label:c,placeholder:f,readOnly:m,required:y,rootRef:D,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(C=>C.trim()));const M=a??this.state.inputValue,_=(this.props.value||M).length||M.length,T=typeof l.shrink=="boolean"?l.shrink:c!==null&&(_||this.state.isFocused||S.length),F=S.map((C,w)=>i({value:C,isDisabled:!!v,isReadOnly:m,isFocused:this.state.focusedChip===w,handleClick:()=>this.setState({focusedChip:w}),handleDelete:()=>this.handleDeleteChip(C,w),style:this.styles.chip},w.toString())),A={};g==="outlined"&&(A.notched=!!T,A.labelWidth=T&&this.labelNode&&this.labelNode.offsetWidth||0),g!=="standard"?A.startAdornment=F:r.disableUnderline=!0;const $=Os[g];return k.createElement(N.FormControl,{ref:D,fullWidth:s,className:u,sx:{...this.styles.root,...b==="dense"?this.styles.marginDense:{}},error:h,required:S.length>0?void 0:y,onClick:this.focus,disabled:v,variant:g,component:"div",margin:b},c&&k.createElement(N.InputLabel,{htmlFor:t,sx:{"&.MuiInputLabel-root":this.styles.label,"&.MuiInputLabel-shrink":this.styles.labelShrink},shrink:!!T,focused:this.state.isFocused,variant:g,ref:this.labelRef,required:y,component:"label",...l},c),k.createElement(N.Box,{component:"div",id:"input-chip-container",sx:{...this.styles[g],...this.styles.chipContainer,...this.state.isFocused?this.styles.focused:void 0,...!o&&g==="standard"?this.styles.underline:void 0,...v?this.styles.disabled:void 0,...c?this.styles.labeled:void 0,...h?this.styles.error:void 0}},g==="standard"&&F,k.createElement($,{ref:this.input,className:`mui-variant-${this.styles[g]} ${c?"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:M,onChange:this.handleUpdateInput,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,inputRef:this.setActualInputRef,disabled:v,fullWidth:p,placeholder:!_&&(T||c===null||c===void 0)||n?f:null,readOnly:m,...r,...A})),e&&k.createElement(N.FormHelperText,{...d,className:d==null?void 0:d.className,style:this.styles.helperText},e))}}class fi extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,u=K.getValue(n,i);if(this.props.schema.delimiter&&typeof u=="string"){const v=u.split(this.props.schema.delimiter).map(o=>o.trim()).filter(o=>o);this.setState({value:v})}else this.setState({value:u||[]})}renderItem(n,i){const{attr:u,schema:v}=this.props,{value:o}=this.state;return k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},k.createElement(Ps,{value:o,disabled:!!i,label:this.getText(v.label),error:!!n,onAdd:h=>{const d=JSON.parse(JSON.stringify(o));d.push(h),this.setState({value:d},()=>{let s;this.props.schema.delimiter?s=this.onChange(u,d.join(`${this.props.schema.delimiter} `)):s=this.onChange(u,d),s instanceof Promise&&s.catch(p=>console.error(p))})},theme:this.props.oContext.theme,onDelete:(h,d)=>{const s=JSON.parse(JSON.stringify(o));s.splice(d,1),this.setState({value:s},()=>{let p;this.props.schema.delimiter?p=this.onChange(u,s.join(`${this.props.schema.delimiter} `)):p=this.onChange(u,s),p instanceof Promise&&p.catch(e=>console.error(e))})}}),k.createElement(N.FormHelperText,null,j.I18n.t("ra_Press ENTER Key to add new item")),this.props.schema.help?k.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&&k.createElement(N.Dialog,{onClose:()=>this.setState({showColorDialog:!1}),open:this.state.showColorDialog},k.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 u=K.getValue(this.props.data,this.props.attr);let v=j.Utils.isUseBright(u,null);return v===null&&(v=void 0),k.createElement(k.Fragment,null,this.renderColorDialog(),k.createElement(N.TextField,{variant:"standard",disabled:!!i,style:{minWidth:100,width:"calc(100% - 8px)"},label:this.getText(this.props.schema.label),value:u||"",onClick:()=>!this.props.schema.readOnly&&this.setState({showColorDialog:!0,colorDialogValue:u||""}),onChange:o=>{const h=o.target.value,d=this.onChange(this.props.attr,h);d instanceof Promise&&d.catch(s=>console.error(`Cannot set value: ${s}`))},slotProps:{htmlInput:{style:{backgroundColor:u,color:v?"#FFF":"#000"},readOnly:this.props.schema.readOnly||!1},input:{endAdornment:!this.props.schema.readOnly&&u&&!this.props.schema.noClearButton?k.createElement(N.IconButton,{tabIndex:-1,size:"small",onClick:o=>{o.stopPropagation();const h=this.onChange(this.props.attr,"");h instanceof Promise&&h.catch(d=>console.error(`Cannot set value: ${d}`))}},k.createElement(Z.Close,null)):void 0},inputLabel:{shrink:!0}}}))}}const Mn={width:{width:"calc(100% - 85px)"},width50:{width:120,marginRight:5}};class Hs 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 u=this.onChange(this.props.attr,i);u instanceof Promise&&u.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 u=this.onChange(this.props.attr,i);u instanceof Promise&&u.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 k.createElement(k.Fragment,null,this.props.schema.useSystemName?k.createElement(N.FormControlLabel,{control:k.createElement(N.Checkbox,{checked:!!this.state.useSystem,onChange:u=>{const v=u.target.checked;v&&this.getSystemCoordinates().catch(o=>console.error(`Cannot determine coordinates: ${o}`)),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?k.createElement(N.TextField,{variant:"standard",style:Mn.width50,value:this.state.longitude??"",error:!!n,disabled:this.state.useSystem||!!i,onChange:u=>{const v=u.target.value;this.setState({longitude:v},()=>{const o=this.onChange(this.props.schema.longitudeName,(v||"").trim());o instanceof Promise&&o.catch(h=>console.error(`Cannot set value: ${h}`))})},label:j.I18n.t("ra_Longitude")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?k.createElement(N.TextField,{variant:"standard",style:Mn.width50,value:this.state.latitude??"",error:!!n,disabled:this.state.useSystem||!!i,onChange:u=>{const v=u.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?k.createElement(N.TextField,{variant:"standard",style:Mn.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:u=>{const v=u.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:k.createElement(N.Fab,{size:"small",onClick:()=>this.getCoordinates(),title:j.I18n.t("ra_Take browser position"),style:{marginRight:4}},k.createElement(Z.LocationOn,null)),this.state.useSystem?null:k.createElement(N.Fab,{size:"small",onClick:()=>this.getSystemCoordinates(),title:j.I18n.t("ra_Take position from system settings")},k.createElement(Z.GpsFixed,null)))}}Pn.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 Ut 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,u,...v]=this.props.schema.name.split("/"),o=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||!u||!o){console.error('Invalid format of "name"! Please define "name" as "ConfigCustomBackItUpSet/Components/AdapterExist" in the schema');return}let h=Ut.runningLoads[`${n}!${u}`];if(!(h instanceof Promise)){let d;if(this.props.schema.i18n===!0){const s=n.lastIndexOf("/");let p;s!==-1?p=n.substring(0,s):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(l=>l.json()).then(l=>j.I18n.extendTranslations(l,e)).catch(l=>console.log(`Cannot load i18n "${t}": ${l}`));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(s){console.error(`Cannot import i18n: ${s}`)}try{console.log(n,i,u,o),Pn.registerRemotes([{name:i,entry:n,type:this.props.schema.bundlerType||void 0}]),h=Pn.loadRemote(`${i}/${u}`),d instanceof Promise&&(h=Promise.all([h,d]).then(s=>s[0])),Ut.runningLoads[`${n}!${u}`]=h}catch(s){console.error(s),this.setState({error:`Cannot import from ${this.props.schema.url}: ${s}`})}}try{const d=(await h).default;if(d!=null&&d[o])this.setState({Component:d[o]});else{const s=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: ${s.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||{};let u=n?k.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?k.createElement("div",null,this.state.error):k.createElement(N.LinearProgress,null);return i.newLine?k.createElement(k.Fragment,null,k.createElement("div",{style:{flexBasis:"100%",height:0}}),u):u}}class zs extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n})}renderItem(n,i){return k.createElement(Wi.DatePicker,{sx:u=>({width:"100%",borderBottom:`1px solid ${u.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${u.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:u=>{this.setState({value:u},()=>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 k.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 k.createElement("div",null,"DeviceManager not found")}}const Ke={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 mn extends K{dropzoneRef;imagePrefix;objectID;path;constructor(n){super(n),this.dropzoneRef=k.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(u=>console.error(`Cannot update files: ${u}`))};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,u){try{const v=await this.props.oContext.socket.readDir(this.objectID,n.replace(/^\//,"")||null);for(let o=0;o<v.length;o++){const h=v[o];if(h.isDir)await this.readFolder(`${n+h.file}/`,i,u);else{let d=!1;u==="*.*"&&h.file.includes(".")||!u||u==="*"||u===".*"&&h.file.startsWith(".")?d=!0:d=new RegExp(`^${u.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(h.file),d&&i.push({name:n+h.file,size:h.stats?j.Utils.formatBytes(h.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 u;const v=n.lastIndexOf("/");if(v===-1?u=n:u=n.substring(v+1),n.startsWith("**"))await this.readFolder("/",i,u);else{const o=n.lastIndexOf("/");if(o===-1)await this.readFolder("/",i,u);else{const h=n.substring(0,o+1);await this.readFolder(h,i,u)}}return i}onDrop(n){const i=n[0],u=new FileReader,v=this.props.schema.maxSize||2*1024*1024;u.onabort=()=>console.log("file reading was aborted"),u.onerror=()=>console.log("file reading has failed"),u.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,u.result).then(()=>this.updateFiles()).then(()=>this.setState({value:this.path+i.name},()=>this.onChange(this.props.attr,this.path+i.name))).catch(o=>window.alert(`Cannot upload file: ${o}`))},u.readAsArrayBuffer(i)}renderDeleteDialog(){return this.state.deleteFile?k.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(u=>window.alert(`Cannot delete file: ${u}`))})}}):null}static base64ToArrayBuffer(n){const i=window.atob(n),u=i.length,v=new Uint8Array(u);for(let o=0;o<u;o++)v[o]=i.charCodeAt(o);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,u=mn.base64ToArrayBuffer(n.file);i.decodeAudioData(u,v=>{const o=i.createBufferSource();o.buffer=v,o.connect(i.destination),o.start(0)},v=>window.alert(`Cannot play: ${v.message}`))}})}getFileIcon(n){return n!=null&&n.extension?Vs.includes(n.extension)?k.createElement("div",{style:{...Ke.selectedImage,backgroundImage:`url(${this.imagePrefix}/${this.objectID}/${n.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"}}):Us.includes(n.extension)?k.createElement(Z.MusicNote,null):Ks.includes(n.extension)?k.createElement(Z.Article,null):Gs.includes(n.extension)?k.createElement(Z.Videocam,null):Js.includes(n.extension)?k.createElement(Z.Code,null):null:null}renderItem(n,i){if(!this.state.files)return null;const u=[];this.props.schema.withFolder||this.state.files.forEach(e=>{const t=e.name.lastIndexOf("/");if(t===-1)u.includes("/")||u.push("/");else{const r=e.name.substring(0,t+1);u.includes(r)||u.push(r)}});const v=this.state.files.map(e=>({value:e.name,label:!this.props.schema.withFolder&&u.length===1?`${e.name.substring(u[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 o=v.find(e=>e.value===this.state.value);let h=0;this.props.schema.upload&&h++,this.props.schema.refresh&&h++;const d=this.state.value&&(this.state.value.endsWith(".mp3")||this.state.value.endsWith(".ogg")||this.state.value.endsWith(".wav"));d&&h++;const s=k.createElement("div",{style:Ke.fullWidth},k.createElement(N.FormControl,{variant:"standard",style:{width:`calc(100% - ${h*42}px)`}},this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:this.state.value||"_",renderValue:()=>k.createElement(k.Fragment,null,this.getFileIcon(o),k.createElement("span",null,(o==null?void 0:o.label)||"")),onChange:e=>{this.setState({value:e.target.value==="_"?"":e.target.value},()=>this.onChange(this.props.attr,this.state.value))}},v.map(e=>k.createElement(N.MenuItem,{key:e.value,value:e.value},k.createElement(N.ListItemIcon,null,this.getFileIcon(e)),k.createElement(N.ListItemText,null,e.label),this.props.schema.delete&&o.value?k.createElement(N.IconButton,{style:Ke.deleteButton,size:"small",onClick:()=>this.setState({deleteFile:o.value})},k.createElement(Z.Delete,null)):null))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null),this.props.schema.refresh&&k.createElement(N.IconButton,{onClick:()=>this.updateFiles()},k.createElement(Z.Refresh,null)),this.props.schema.upload&&k.createElement(N.IconButton,{onClick:()=>{var e;return(e=this.dropzoneRef.current)==null?void 0:e.open()}},k.createElement(Z.UploadFile,null)),d&&k.createElement(N.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},k.createElement(Z.PlayArrow,null)));if(!this.props.schema.upload)return k.createElement(k.Fragment,null,s,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 k.createElement(Pi,{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,l,a;this.setState({uploadFile:!1}),e.length?this.onDrop(e):window.alert(((a=(l=(r=t==null?void 0:t[0])==null?void 0:r.errors)==null?void 0:l[0])==null?void 0:a.message)||j.I18n.t("Cannot upload"))}},({getRootProps:e,getInputProps:t})=>k.createElement("div",{style:{...Ke.uploadDiv,...this.state.uploadFile==="dragging"?Ke.uploadDivDragging:void 0,...i?Ke.disabledOpacity:void 0},...e()},k.createElement("input",{...t()}),this.state.uploadFile==="dragging"?k.createElement("div",{style:{...Ke.uploadCenterDiv,...this.state.uploadError?Ke.error:void 0}},k.createElement("div",{style:Ke.uploadCenterTextAndIcon},k.createElement(Z.UploadFile,{style:Ke.uploadCenterIcon}),k.createElement("div",{style:Ke.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,s,this.renderDeleteDialog()))}}const sn={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"],Xs=["avi","mp4","mov"],Zs=["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 u=K.getValue(n.data,n.attr);return u==null||u.toString().trim()!==(i.value||"").toString().trim()?{value:u??""}:null}loadFile(){const n=this.state.value.indexOf("/");if(n!==-1){const i=this.state.value.substring(0,n),u=this.state.value.substring(n+1);return this.props.oContext.socket.readFile(i,u,!0)}return Promise.resolve(null)}play(){this.loadFile().then(n=>{if(typeof AudioContext<"u"&&(n!=null&&n.file)){const i=new AudioContext,u=mn.base64ToArrayBuffer(n.file);i.decodeAudioData(u,v=>{const o=i.createBufferSource();o.buffer=v,o.connect(i.destination),o.start(0)},v=>window.alert(`Cannot play: ${v.message}`))}})}getIcon(){const n=this.state.value.split(".").pop().toLowerCase();return Ys.includes(n)?k.createElement("div",{style:{...sn.selectedImage,backgroundImage:`url(${this.imagePrefix}/${this.state.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"}}):Qs.includes(n)?k.createElement(N.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},k.createElement(Z.PlayArrow,null)):Zs.includes(n)?k.createElement(Z.Article,null):Xs.includes(n)?k.createElement(Z.Videocam,null):qs.includes(n)?k.createElement(Z.Code,null):null}renderFileBrowser(){return this.state.showFileBrowser?k.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 u=this.getIcon();return k.createElement("div",{style:sn.fullWidth},u,k.createElement(N.TextField,{variant:"standard",style:u?sn.fullWidthIcon:sn.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 o=v.target.value;this.setState({value:o},()=>this.onChange(this.props.attr,this.props.schema.trim===!1?o:(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)}),k.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 u=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&&u.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({value:n,selectOptions:u})})}renderItem(n,i){if(!this.state.selectOptions)return null;const u=this.state.selectOptions.find(v=>v.value===this.state.value);return k.createElement(N.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:this.state.value||"_",renderValue:()=>u?u.obj?k.createElement(j.TextWithIcon,{value:u.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):u.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=>k.createElement(N.MenuItem,{key:v.value,value:v.value,style:v.value===K.DIFFERENT_VALUE?{opacity:.5}:{}},v.obj?k.createElement(j.TextWithIcon,{value:v.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):v.label))),this.props.schema.help?k.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 o,h;const u=K.getValue(this.props.data,this.props.attr),v=(o=this.state.ips)==null?void 0:o.find(d=>d.address===u);return k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},this.state.ips&&this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.ips?k.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:u,renderValue:d=>(v==null?void 0:v.name)||d,onChange:d=>this.onChange(this.props.attr,d.target.value)},(h=this.state.ips)==null?void 0:h.map((d,s)=>k.createElement(N.MenuItem,{key:s,value:d.address},d.name))):k.createElement(N.TextField,{fullWidth:!0,variant:"standard",error:!!n,disabled:!!i,value:u,onChange:d=>this.onChange(this.props.attr,d.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?k.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:k.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 k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?k.createElement(N.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,k.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 u=this.onChange(this.props.attr,this.state.value);u instanceof Promise&&u.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(u=>console.error(u))}),onChange:u=>this.setState({value:u},()=>{if(this.props.schema.base64){const v=this.onChange(this.props.attr,this.state.value);v instanceof Promise&&v.catch(o=>console.error(`Cannot set value: ${o}`))}else u.startsWith("data")&&(u=u.split(",")[1]);this.props.oContext.socket.writeFile64(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr,u).catch(v=>console.error(v))})}),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const gi={icon:{width:20,height:20,marginRight:4}};class so 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 u=>{this.props.schema.adapter==="_dataSources"?u=u.filter(o=>{var h;return(h=o==null?void 0:o.common)==null?void 0:h.getHistory}):this.props.schema.adapter?u=u.filter(o=>o==null?void 0:o._id.startsWith(`system.adapter.${this.props.schema.adapter}.`)):this.props.schema.adapters&&Array.isArray(this.props.schema.adapters)&&(u=u.filter(o=>{var h;return this.props.schema.adapters.includes((h=o==null?void 0:o.common)==null?void 0:h.name)})),this.props.schema.onlyEnabled&&(u=u.filter(o=>{var h;return(h=o==null?void 0:o.common)==null?void 0:h.enabled}));const v=u.map(o=>({value:this.props.schema.long?o._id:this.props.schema.short?o._id.split(".").pop():o._id.replace(/^system\.adapter\./,""),label:`${o.common.name} [${o._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${o.common.name}/${o.common.icon}`}));v.sort((o,h)=>o.value>h.value?1:o.value<h.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(u=>console.error(`Cannot get instances: ${u}`))}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 u=this.props.schema.long?n:this.props.schema.short?n.split(".").pop():n.replace(/^system\.adapter\./,""),v=this.state.selectOptions.findIndex(o=>o.value===u);if(i){if(this.props.schema.adapter==="_dataSources"&&(!i.common||!i.common.getHistory))return;if(v===-1){const o=JSON.parse(JSON.stringify(this.state.selectOptions)),h=typeof i.common.name=="object"?i.common.name[j.I18n.getLanguage()]||i.common.name.en:i.common.name;o.push({value:this.props.schema.long?i._id:this.props.schema.short?i._id.split(".").pop():i._id.replace(/^system\.adapter\./,""),label:`${h} [${i._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${h}/${i.common.icon}`}),o.sort((d,s)=>d.label>s.label?1:d.label<s.label?-1:0),this.setState({selectOptions:o})}}else if(v!==-1){const o=JSON.parse(JSON.stringify(this.state.selectOptions)),h={};this.state.value===o[v].value&&(h.value=K.NONE_VALUE),o.splice(v,1),h.selectOptions=o,this.setState(h)}};renderItem(n,i){var v;if(!this.state.selectOptions)return null;const u=(v=this.state.selectOptions)==null?void 0:v.find(o=>o.value===this.state.value);return k.createElement(N.FormControl,{fullWidth:!0,key:this.props.attr,variant:"standard"},this.props.schema.label?k.createElement(N.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:this.state.value,renderValue:()=>k.createElement("span",{style:{display:"flex"}},u!=null&&u.icon?k.createElement("img",{src:`./${u.icon}`,alt:u.value,style:gi.icon}):null,this.getText(u==null?void 0:u.label,!0)),onChange:o=>this.setState({value:o.target.value},()=>this.onChange(this.props.attr,this.state.value))},this.state.selectOptions.map(o=>k.createElement(N.MenuItem,{key:o.value,value:o.value,style:o.value===K.NONE_VALUE?{opacity:.5}:{}},o.icon?k.createElement("img",{src:`./${o.icon}`,alt:o.value,style:gi.icon}):null,this.getText(o.label,!0)))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const mi={address:{fontSize:"smaller",opacity:.5,marginLeft:8}};class oo extends K{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getObject(`system.host.${this.props.common.host}`).then(n=>{var u,v;const i=[];if((v=(u=n==null?void 0:n.native)==null?void 0:u.hardware)!=null&&v.networkInterfaces){const o=n.native.hardware.networkInterfaces;Object.keys(o).forEach(h=>{if(this.props.schema.ignoreInternal&&!o[h].find(s=>!s.internal)||this.props.schema.ignoreLoopback&&o[h].find(s=>s.address==="127.0.0.1"||s.address==="::1"))return;let d=o[h].find(s=>s.family==="IPv4");d=d||o[h].find(s=>s.family==="IPv6"),i.push({value:h,address:d.address})})}this.setState({interfaces:i})}).catch(n=>window.alert(`Cannot read interfaces: ${n}`))}renderItem(n,i){var o,h,d;const u=K.getValue(this.props.data,this.props.attr),v=(o=this.state.interfaces)==null?void 0:o.find(s=>s.value===u);return k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},(h=this.state.interfaces)!=null&&h.length&&this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,(d=this.state.interfaces)!=null&&d.length?k.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:u,renderValue:s=>v?k.createElement("span",null,v.value,k.createElement("span",{style:mi.address},v.address)):s,onChange:s=>this.onChange(this.props.attr,s.target.value)},this.state.interfaces.map((s,p)=>k.createElement(N.MenuItem,{key:p,value:s.value},k.createElement("span",null,s.value,k.createElement("span",{style:mi.address},s.address))))):k.createElement(N.TextField,{fullWidth:!0,variant:"standard",error:!!n,disabled:!!i,value:u,onChange:s=>this.onChange(this.props.attr,s.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const kt={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"}},ao=({toggleTranslation:L,noTranslation:n,title:i,fullWidth:u,help:v,maxWidth:o,progress:h,icon:d,applyDisabled:s,applyButton:p,onClose:e,children:t,titleButtonApply:r,titleButtonClose:l,onApply:a,textInput:c,defaultValue:f,overflowHidden:m})=>{const[y,D]=pt.useState(f);pt.useEffect(()=>{D(f)},[f]);let E=null;return d&&(E=d),k.createElement(N.Dialog,{open:!0,maxWidth:o||"md",fullWidth:!!u,disableEscapeKeyDown:!1,onClose:e,sx:{"& .MuiPaper-root":kt.modalDialog}},i&&k.createElement(N.DialogTitle,null,d?k.createElement(E,{style:kt.titleIcon}):null,i,j.I18n.getLanguage()!=="en"&&L?k.createElement(N.IconButton,{size:"large",style:{...kt.languageButton,...n?kt.languageButtonActive:{}},onClick:()=>L(),title:j.I18n.t("Disable/Enable translation")},k.createElement(Z.Language,null)):null),k.createElement(N.DialogContent,{sx:{...m?kt.overflowHidden:{},...kt.content},style:{paddingTop:8}},c&&k.createElement(N.TextField,{autoComplete:"off",fullWidth:!0,autoFocus:!0,variant:"outlined",size:"medium",multiline:!0,value:y,onChange:b=>D(b.target.value)}),t,v?k.createElement("div",null,v):null),k.createElement(N.DialogActions,null,p!==!1&&k.createElement(N.Button,{startIcon:k.createElement(Z.Check,null),disabled:h||s&&f===y,onClick:()=>a&&a(c?y:""),variant:"contained",color:"primary"},j.I18n.t(r||"Ok")),k.createElement(N.Button,{color:"grey",onClick:()=>e&&e(),disabled:h,variant:"contained",startIcon:k.createElement(Z.Close,null)},j.I18n.t(l||"Cancel"))))};var It={},Dt={},Vi={exports:{}};(function(L,n){(function(){var i="ace",u=function(){return this}();!u&&typeof window<"u"&&(u=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 o=function(e,t,r){if(typeof t=="string"){var l=s(e,t);if(l!=null)return r&&r(),l}else if(Object.prototype.toString.call(t)==="[object Array]"){for(var a=[],c=0,f=t.length;c<f;++c){var m=s(e,t[c]);if(m==null&&h.original)return;a.push(m)}return r&&r.apply(null,a)||!0}},h=function(e,t){var r=o("",e,t);return r==null&&h.original?h.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 l=e.split("/").slice(0,-1).join("/");for(t=l+"/"+t;t.indexOf(".")!==-1&&a!=t;){var a=t;t=t.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return t},s=function(e,t){t=d(e,t);var r=v.modules[t];if(!r){if(r=v.payloads[t],typeof r=="function"){var l={},a={id:t,uri:"",exports:l,packaged:!0},c=function(m,y){return o(t,m,y)},f=r(c,l,a);l=f||a.exports,v.modules[t]=l,delete v.payloads[t]}r=v.modules[t]=l||r}return r};function p(e){var t=u;u[e]||(u[e]={}),t=u[e],(!t.define||!t.define.packaged)&&(v.original=t.define,t.define=v,t.define.packaged=!0),(!t.require||!t.require.packaged)&&(h.original=t.require,t.require=h,t.require.packaged=!0)}p(i)})(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(i,u,v){function o(h,d,s){Object.defineProperty(h,d,{value:s,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||o(String.prototype,"startsWith",function(h,d){return d=d||0,this.lastIndexOf(h,d)===d}),String.prototype.endsWith||o(String.prototype,"endsWith",function(h,d){var s=this;(d===void 0||d>s.length)&&(d=s.length),d-=h.length;var p=s.indexOf(h,d);return p!==-1&&p===d}),String.prototype.repeat||o(String.prototype,"repeat",function(h){for(var d="",s=this;h>0;)h&1&&(d+=s),(h>>=1)&&(s+=s);return d}),String.prototype.includes||o(String.prototype,"includes",function(h,d){return this.indexOf(h,d)!=-1}),Object.assign||(Object.assign=function(h){if(h==null)throw new TypeError("Cannot convert undefined or null to object");for(var d=Object(h),s=1;s<arguments.length;s++){var p=arguments[s];p!=null&&Object.keys(p).forEach(function(e){d[e]=p[e]})}return d}),Object.values||(Object.values=function(h){return Object.keys(h).map(function(d){return h[d]})}),Array.prototype.find||o(Array.prototype,"find",function(h){for(var d=this.length,s=arguments[1],p=0;p<d;p++){var e=this[p];if(h.call(s,e,p,this))return e}}),Array.prototype.findIndex||o(Array.prototype,"findIndex",function(h){for(var d=this.length,s=arguments[1],p=0;p<d;p++){var e=this[p];if(h.call(s,e,p,this))return p}}),Array.prototype.includes||o(Array.prototype,"includes",function(h,d){return this.indexOf(h,d)!=-1}),Array.prototype.fill||o(Array.prototype,"fill",function(h){for(var d=this,s=d.length>>>0,p=arguments[1],e=p>>0,t=e<0?Math.max(s+e,0):Math.min(e,s),r=arguments[2],l=r===void 0?s:r>>0,a=l<0?Math.max(s+l,0):Math.min(l,s);t<a;)d[t]=h,t++;return d}),Array.of||o(Array,"of",function(){return Array.prototype.slice.call(arguments)})}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(i,u,v){i("./es6-shim")}),ace.define("ace/lib/deep_copy",["require","exports","module"],function(i,u,v){u.deepCopy=function o(h){if(typeof h!="object"||!h)return h;var d;if(Array.isArray(h)){d=[];for(var s=0;s<h.length;s++)d[s]=o(h[s]);return d}if(Object.prototype.toString.call(h)!=="[object Object]")return h;d={};for(var s in h)d[s]=o(h[s]);return d}}),ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],function(i,u,v){u.last=function(d){return d[d.length-1]},u.stringReverse=function(d){return d.split("").reverse().join("")},u.stringRepeat=function(d,s){for(var p="";s>0;)s&1&&(p+=d),(s>>=1)&&(d+=d);return p};var o=/^\s\s*/,h=/\s\s*$/;u.stringTrimLeft=function(d){return d.replace(o,"")},u.stringTrimRight=function(d){return d.replace(h,"")},u.copyObject=function(d){var s={};for(var p in d)s[p]=d[p];return s},u.copyArray=function(d){for(var s=[],p=0,e=d.length;p<e;p++)d[p]&&typeof d[p]=="object"?s[p]=this.copyObject(d[p]):s[p]=d[p];return s},u.deepCopy=i("./deep_copy").deepCopy,u.arrayToMap=function(d){for(var s={},p=0;p<d.length;p++)s[d[p]]=1;return s},u.createMap=function(d){var s=Object.create(null);for(var p in d)s[p]=d[p];return s},u.arrayRemove=function(d,s){for(var p=0;p<=d.length;p++)s===d[p]&&d.splice(p,1)},u.escapeRegExp=function(d){return d.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},u.escapeHTML=function(d){return(""+d).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},u.getMatchOffsets=function(d,s){var p=[];return d.replace(s,function(e){p.push({offset:arguments[arguments.length-2],length:e.length})}),p},u.deferredCall=function(d){var s=null,p=function(){s=null,d()},e=function(t){return e.cancel(),s=setTimeout(p,t||0),e};return e.schedule=e,e.call=function(){return this.cancel(),d(),e},e.cancel=function(){return clearTimeout(s),s=null,e},e.isPending=function(){return s},e},u.delayedCall=function(d,s){var p=null,e=function(){p=null,d()},t=function(r){p==null&&(p=setTimeout(e,r||s))};return t.delay=function(r){p&&clearTimeout(p),p=setTimeout(e,r||s)},t.schedule=t,t.call=function(){this.cancel(),d()},t.cancel=function(){p&&clearTimeout(p),p=null},t.isPending=function(){return p},t},u.supportsLookbehind=function(){try{new RegExp("(?<=.)")}catch{return!1}return!0},u.skipEmptyMatch=function(d,s,p){return p&&d.codePointAt(s)>65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(i,u,v){u.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},u.getOS=function(){return u.isMac?u.OS.MAC:u.isLinux?u.OS.LINUX:u.OS.WINDOWS};var o=typeof navigator=="object"?navigator:{},h=(/mac|win|linux/i.exec(o.platform)||["other"])[0].toLowerCase(),d=o.userAgent||"",s=o.appName||"";u.isWin=h=="win",u.isMac=h=="mac",u.isLinux=h=="linux",u.isIE=s=="Microsoft Internet Explorer"||s.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]),u.isOldIE=u.isIE&&u.isIE<9,u.isGecko=u.isMozilla=d.match(/ Gecko\/\d+/),u.isOpera=typeof opera=="object"&&Object.prototype.toString.call(window.opera)=="[object Opera]",u.isWebKit=parseFloat(d.split("WebKit/")[1])||void 0,u.isChrome=parseFloat(d.split(" Chrome/")[1])||void 0,u.isSafari=parseFloat(d.split(" Safari/")[1])&&!u.isChrome||void 0,u.isEdge=parseFloat(d.split(" Edge/")[1])||void 0,u.isAIR=d.indexOf("AdobeAIR")>=0,u.isAndroid=d.indexOf("Android")>=0,u.isChromeOS=d.indexOf(" CrOS ")>=0,u.isIOS=/iPad|iPhone|iPod/.test(d)&&!window.MSStream,u.isIOS&&(u.isMac=!0),u.isMobile=u.isIOS||u.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(i,u,v){var o=i("./useragent"),h="http://www.w3.org/1999/xhtml";u.buildDom=function r(l,a,c){if(typeof l=="string"&&l){var f=document.createTextNode(l);return a&&a.appendChild(f),f}if(!Array.isArray(l))return l&&l.appendChild&&a&&a.appendChild(l),l;if(typeof l[0]!="string"||!l[0]){for(var m=[],y=0;y<l.length;y++){var D=r(l[y],a,c);D&&m.push(D)}return m}var E=document.createElement(l[0]),b=l[1],g=1;b&&typeof b=="object"&&!Array.isArray(b)&&(g=2);for(var y=g;y<l.length;y++)r(l[y],E,c);return g==2&&Object.keys(b).forEach(function(S){var M=b[S];S==="class"?E.className=Array.isArray(M)?M.join(" "):M:typeof M=="function"||S=="value"||S[0]=="$"?E[S]=M:S==="ref"?c&&(c[M]=E):S==="style"?typeof M=="string"&&(E.style.cssText=M):M!=null&&E.setAttribute(S,M)}),a&&a.appendChild(E),E},u.getDocumentHead=function(r){return r||(r=document),r.head||r.getElementsByTagName("head")[0]||r.documentElement},u.createElement=function(r,l){return document.createElementNS?document.createElementNS(l||h,r):document.createElement(r)},u.removeChildren=function(r){r.innerHTML=""},u.createTextNode=function(r,l){var a=l?l.ownerDocument:document;return a.createTextNode(r)},u.createFragment=function(r){var l=r?r.ownerDocument:document;return l.createDocumentFragment()},u.hasCssClass=function(r,l){var a=(r.className+"").split(/\s+/g);return a.indexOf(l)!==-1},u.addCssClass=function(r,l){u.hasCssClass(r,l)||(r.className+=" "+l)},u.removeCssClass=function(r,l){for(var a=r.className.split(/\s+/g);;){var c=a.indexOf(l);if(c==-1)break;a.splice(c,1)}r.className=a.join(" ")},u.toggleCssClass=function(r,l){for(var a=r.className.split(/\s+/g),c=!0;;){var f=a.indexOf(l);if(f==-1)break;c=!1,a.splice(f,1)}return c&&a.push(l),r.className=a.join(" "),c},u.setCssClass=function(r,l,a){a?u.addCssClass(r,l):u.removeCssClass(r,l)},u.hasCssString=function(r,l){var a=0,c;if(l=l||document,c=l.querySelectorAll("style")){for(;a<c.length;)if(c[a++].id===r)return!0}},u.removeElementById=function(r,l){l=l||document,l.getElementById(r)&&l.getElementById(r).remove()};var d,s=[];u.useStrictCSP=function(r){d=r,r==!1?p():s||(s=[])};function p(){var r=s;s=null,r&&r.forEach(function(l){e(l[0],l[1])})}function e(r,l,a){if(!(typeof document>"u")){if(s){if(a)p();else if(a===!1)return s.push([r,l])}if(!d){var c=a;!a||!a.getRootNode?c=document:(c=a.getRootNode(),(!c||c==a)&&(c=document));var f=c.ownerDocument||c;if(l&&u.hasCssString(l,c))return null;l&&(r+=`
|
|
16
|
-
/*# sourceURL=ace/css/`+l+" */");var m=u.createElement("style");m.appendChild(f.createTextNode(r)),l&&(m.id=l),c==f&&(c=u.getDocumentHead(f)),c.insertBefore(m,c.firstChild)}}}if(u.importCssString=e,u.importCssStylsheet=function(r,l){u.buildDom(["link",{rel:"stylesheet",href:r}],u.getDocumentHead(l))},u.scrollbarWidth=function(r){var l=u.createElement("ace_inner");l.style.width="100%",l.style.minWidth="0px",l.style.height="200px",l.style.display="block";var a=u.createElement("ace_outer"),c=a.style;c.position="absolute",c.left="-10000px",c.overflow="hidden",c.width="200px",c.minWidth="0px",c.height="150px",c.display="block",a.appendChild(l);var f=r&&r.documentElement||document&&document.documentElement;if(!f)return 0;f.appendChild(a);var m=l.offsetWidth;c.overflow="scroll";var y=l.offsetWidth;return m===y&&(y=a.clientWidth),f.removeChild(a),m-y},u.computedStyle=function(r,l){return window.getComputedStyle(r,"")||{}},u.setStyle=function(r,l,a){r[l]!==a&&(r[l]=a)},u.HAS_CSS_ANIMATION=!1,u.HAS_CSS_TRANSFORMS=!1,u.HI_DPI=
|
|
9
|
+
`&&q(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw Ae(q());case void 0:throw Ae(q())}return q()}function ds(){let L="",n=rt();if(!Me.isHexDigit(n)||(L+=q(),n=rt(),!Me.isHexDigit(n)))throw Ae(q());return L+=q(),String.fromCodePoint(parseInt(L,16))}function zn(){let L="",n=4;for(;n-- >0;){const i=rt();if(!Me.isHexDigit(i))throw Ae(q());L+=q()}return String.fromCodePoint(parseInt(L,16))}const fs={start(){if(Ie.type==="eof")throw Ct();Tn()},beforePropertyName(){switch(Ie.type){case"identifier":case"string":Gn=Ie.value,Be="afterPropertyName";return;case"punctuator":nn();return;case"eof":throw Ct()}},afterPropertyName(){if(Ie.type==="eof")throw Ct();Be="beforePropertyValue"},beforePropertyValue(){if(Ie.type==="eof")throw Ct();Tn()},beforeArrayValue(){if(Ie.type==="eof")throw Ct();if(Ie.type==="punctuator"&&Ie.value==="]"){nn();return}Tn()},afterPropertyValue(){if(Ie.type==="eof")throw Ct();switch(Ie.value){case",":Be="beforePropertyName";return;case"}":nn()}},afterArrayValue(){if(Ie.type==="eof")throw Ct();switch(Ie.value){case",":Be="beforeArrayValue";return;case"]":nn()}},end(){}};function Tn(){let L;switch(Ie.type){case"punctuator":switch(Ie.value){case"{":L={};break;case"[":L=[];break}break;case"null":case"boolean":case"numeric":case"string":L=Ie.value;break}if(Vt===void 0)Vt=L;else{const n=it[it.length-1];Array.isArray(n)?n.push(L):Object.defineProperty(n,Gn,{value:L,writable:!0,enumerable:!0,configurable:!0})}if(L!==null&&typeof L=="object")it.push(L),Array.isArray(L)?Be="beforeArrayValue":Be="beforePropertyName";else{const n=it[it.length-1];n==null?Be="end":Array.isArray(n)?Be="afterArrayValue":Be="afterPropertyValue"}}function nn(){it.pop();const L=it[it.length-1];L==null?Be="end":Array.isArray(L)?Be="afterArrayValue":Be="afterPropertyValue"}function Ae(L){return dn(L===void 0?`JSON5: invalid end of input at ${dt}:${Ye}`:`JSON5: invalid character '${zi(L)}' at ${dt}:${Ye}`)}function Ct(){return dn(`JSON5: invalid end of input at ${dt}:${Ye}`)}function hi(){return Ye-=5,dn(`JSON5: invalid identifier character at ${dt}:${Ye}`)}function gs(L){console.warn(`JSON5: '${zi(L)}' in strings is not valid ECMAScript; consider escaping`)}function zi(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 dn(L){const n=new SyntaxError(L);return n.lineNumber=dt,n.columnNumber=Ye,n}var ms=function(n,i,u){const v=[];let s="",h,d,o="",p;if(i!=null&&typeof i=="object"&&!Array.isArray(i)&&(u=i.space,p=i.quote,i=i.replacer),typeof i=="function")d=i;else if(Array.isArray(i)){h=[];for(const c of i){let f;typeof c=="string"?f=c:(typeof c=="number"||c instanceof String||c instanceof Number)&&(f=String(c)),f!==void 0&&h.indexOf(f)<0&&h.push(f)}}return u instanceof Number?u=Number(u):u instanceof String&&(u=String(u)),typeof u=="number"?u>0&&(u=Math.min(10,Math.floor(u)),o=" ".substr(0,u)):typeof u=="string"&&(o=u.substr(0,10)),e("",{"":n});function e(c,f){let m=f[c];switch(m!=null&&(typeof m.toJSON5=="function"?m=m.toJSON5(c):typeof m.toJSON=="function"&&(m=m.toJSON(c))),d&&(m=d.call(f,c,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(c){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<c.length;E++){const b=c[E];switch(b){case"'":case'"':f[b]++,y+=b;continue;case"\0":if(Me.isDigit(c[E+1])){y+="\\x00";continue}}if(m[b]){y+=m[b];continue}if(b<" "){let g=b.charCodeAt(0).toString(16);y+="\\x"+("00"+g).substring(g.length);continue}y+=b}const D=p||Object.keys(f).reduce((E,b)=>f[E]<f[b]?E:b);return y=y.replace(new RegExp(D,"g"),m[D]),D+y+D}function r(c){if(v.indexOf(c)>=0)throw TypeError("Converting circular structure to JSON5");v.push(c);let f=s;s=s+o;let m=h||Object.keys(c),y=[];for(const E of m){const b=e(E,c);if(b!==void 0){let g=l(E)+":";o!==""&&(g+=" "),g+=b,y.push(g)}}let D;if(y.length===0)D="{}";else{let E;if(o==="")E=y.join(","),D="{"+E+"}";else{let b=`,
|
|
10
|
+
`+s;E=y.join(b),D=`{
|
|
11
|
+
`+s+E+`,
|
|
12
|
+
`+f+"}"}}return v.pop(),s=f,D}function l(c){if(c.length===0)return t(c);const f=String.fromCodePoint(c.codePointAt(0));if(!Me.isIdStartChar(f))return t(c);for(let m=f.length;m<c.length;m++)if(!Me.isIdContinueChar(String.fromCodePoint(c.codePointAt(m))))return t(c);return c}function a(c){if(v.indexOf(c)>=0)throw TypeError("Converting circular structure to JSON5");v.push(c);let f=s;s=s+o;let m=[];for(let D=0;D<c.length;D++){const E=e(String(D),c);m.push(E!==void 0?E:"null")}let y;if(m.length===0)y="[]";else if(o==="")y="["+m.join(",")+"]";else{let D=`,
|
|
13
|
+
`+s,E=m.join(D);y=`[
|
|
14
|
+
`+s+E+`,
|
|
15
|
+
`+f+"]"}return v.pop(),s=f,y}};const vs={parse:hs,stringify:ms};var ji=vs,Kn={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 hn={exports:{}};const bs={},ws=Object.freeze(Object.defineProperty({__proto__:null,default:bs},Symbol.toStringTag,{value:"Module"})),Cs=Xr(ws);var Es=hn.exports,ci;function Ss(){return ci||(ci=1,function(L,n){(function(i,u){L.exports=u()})(Es,function(){var i=i||function(u,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 He<"u"&&He.crypto&&(s=He.crypto),!s&&typeof ys=="function")try{s=Cs}catch{}var h=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(D){var E;return y.prototype=D,E=new y,y.prototype=null,E}}(),o={},p=o.lib={},e=p.Base=function(){return{extend:function(y){var D=d(this);return y&&D.mixIn(y),(!D.hasOwnProperty("init")||this.init===D.init)&&(D.init=function(){D.$super.init.apply(this,arguments)}),D.init.prototype=D,D.$super=this,D},create:function(){var y=this.extend();return y.init.apply(y,arguments),y},init:function(){},mixIn:function(y){for(var D in y)y.hasOwnProperty(D)&&(this[D]=y[D]);y.hasOwnProperty("toString")&&(this.toString=y.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),t=p.WordArray=e.extend({init:function(y,D){y=this.words=y||[],D!=v?this.sigBytes=D:this.sigBytes=y.length*4},toString:function(y){return(y||l).stringify(this)},concat:function(y){var D=this.words,E=y.words,b=this.sigBytes,g=y.sigBytes;if(this.clamp(),b%4)for(var S=0;S<g;S++){var M=E[S>>>2]>>>24-S%4*8&255;D[b+S>>>2]|=M<<24-(b+S)%4*8}else for(var _=0;_<g;_+=4)D[b+_>>>2]=E[_>>>2];return this.sigBytes+=g,this},clamp:function(){var y=this.words,D=this.sigBytes;y[D>>>2]&=4294967295<<32-D%4*8,y.length=u.ceil(D/4)},clone:function(){var y=e.clone.call(this);return y.words=this.words.slice(0),y},random:function(y){for(var D=[],E=0;E<y;E+=4)D.push(h());return new t.init(D,y)}}),r=o.enc={},l=r.Hex={stringify:function(y){for(var D=y.words,E=y.sigBytes,b=[],g=0;g<E;g++){var S=D[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 D=y.length,E=[],b=0;b<D;b+=2)E[b>>>3]|=parseInt(y.substr(b,2),16)<<24-b%8*4;return new t.init(E,D/2)}},a=r.Latin1={stringify:function(y){for(var D=y.words,E=y.sigBytes,b=[],g=0;g<E;g++){var S=D[g>>>2]>>>24-g%4*8&255;b.push(String.fromCharCode(S))}return b.join("")},parse:function(y){for(var D=y.length,E=[],b=0;b<D;b++)E[b>>>2]|=(y.charCodeAt(b)&255)<<24-b%4*8;return new t.init(E,D)}},c=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=c.parse(y)),this._data.concat(y),this._nDataBytes+=y.sigBytes},_process:function(y){var D,E=this._data,b=E.words,g=E.sigBytes,S=this.blockSize,M=S*4,_=g/M;y?_=u.ceil(_):_=u.max((_|0)-this._minBufferSize,0);var T=_*S,F=u.min(T*4,g);if(T){for(var A=0;A<T;A+=S)this._doProcessBlock(b,A);D=b.splice(0,T),E.sigBytes-=F}return new t.init(D,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 D=this._doFinalize();return D},blockSize:16,_createHelper:function(y){return function(D,E){return new y.init(E).finalize(D)}},_createHmacHelper:function(y){return function(D,E){return new m.HMAC.init(y,E).finalize(D)}}});var m=o.algo={};return o}(Math);return i})}(hn)),hn.exports}var Ds=Kn.exports;(function(L,n){(function(i,u){L.exports=u(Ss())})(Ds,function(i){return function(u){var v=i,s=v.lib,h=s.WordArray,d=s.Hasher,o=v.algo,p=[];(function(){for(var c=0;c<64;c++)p[c]=u.abs(u.sin(c+1))*4294967296|0})();var e=o.MD5=d.extend({_doReset:function(){this._hash=new h.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(c,f){for(var m=0;m<16;m++){var y=f+m,D=c[y];c[y]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360}var E=this._hash.words,b=c[f+0],g=c[f+1],S=c[f+2],M=c[f+3],_=c[f+4],T=c[f+5],F=c[f+6],A=c[f+7],$=c[f+8],C=c[f+9],w=c[f+10],x=c[f+11],I=c[f+12],O=c[f+13],R=c[f+14],P=c[f+15],B=E[0],V=E[1],W=E[2],H=E[3];B=t(B,V,W,H,b,7,p[0]),H=t(H,B,V,W,g,12,p[1]),W=t(W,H,B,V,S,17,p[2]),V=t(V,W,H,B,M,22,p[3]),B=t(B,V,W,H,_,7,p[4]),H=t(H,B,V,W,T,12,p[5]),W=t(W,H,B,V,F,17,p[6]),V=t(V,W,H,B,A,22,p[7]),B=t(B,V,W,H,$,7,p[8]),H=t(H,B,V,W,C,12,p[9]),W=t(W,H,B,V,w,17,p[10]),V=t(V,W,H,B,x,22,p[11]),B=t(B,V,W,H,I,7,p[12]),H=t(H,B,V,W,O,12,p[13]),W=t(W,H,B,V,R,17,p[14]),V=t(V,W,H,B,P,22,p[15]),B=r(B,V,W,H,g,5,p[16]),H=r(H,B,V,W,F,9,p[17]),W=r(W,H,B,V,x,14,p[18]),V=r(V,W,H,B,b,20,p[19]),B=r(B,V,W,H,T,5,p[20]),H=r(H,B,V,W,w,9,p[21]),W=r(W,H,B,V,P,14,p[22]),V=r(V,W,H,B,_,20,p[23]),B=r(B,V,W,H,C,5,p[24]),H=r(H,B,V,W,R,9,p[25]),W=r(W,H,B,V,M,14,p[26]),V=r(V,W,H,B,$,20,p[27]),B=r(B,V,W,H,O,5,p[28]),H=r(H,B,V,W,S,9,p[29]),W=r(W,H,B,V,A,14,p[30]),V=r(V,W,H,B,I,20,p[31]),B=l(B,V,W,H,T,4,p[32]),H=l(H,B,V,W,$,11,p[33]),W=l(W,H,B,V,x,16,p[34]),V=l(V,W,H,B,R,23,p[35]),B=l(B,V,W,H,g,4,p[36]),H=l(H,B,V,W,_,11,p[37]),W=l(W,H,B,V,A,16,p[38]),V=l(V,W,H,B,w,23,p[39]),B=l(B,V,W,H,O,4,p[40]),H=l(H,B,V,W,b,11,p[41]),W=l(W,H,B,V,M,16,p[42]),V=l(V,W,H,B,F,23,p[43]),B=l(B,V,W,H,C,4,p[44]),H=l(H,B,V,W,I,11,p[45]),W=l(W,H,B,V,P,16,p[46]),V=l(V,W,H,B,S,23,p[47]),B=a(B,V,W,H,b,6,p[48]),H=a(H,B,V,W,A,10,p[49]),W=a(W,H,B,V,R,15,p[50]),V=a(V,W,H,B,T,21,p[51]),B=a(B,V,W,H,I,6,p[52]),H=a(H,B,V,W,M,10,p[53]),W=a(W,H,B,V,w,15,p[54]),V=a(V,W,H,B,g,21,p[55]),B=a(B,V,W,H,$,6,p[56]),H=a(H,B,V,W,P,10,p[57]),W=a(W,H,B,V,F,15,p[58]),V=a(V,W,H,B,O,21,p[59]),B=a(B,V,W,H,_,6,p[60]),H=a(H,B,V,W,x,10,p[61]),W=a(W,H,B,V,S,15,p[62]),V=a(V,W,H,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]+H|0},_doFinalize:function(){var c=this._data,f=c.words,m=this._nDataBytes*8,y=c.sigBytes*8;f[y>>>5]|=128<<24-y%32;var D=u.floor(m/4294967296),E=m;f[(y+64>>>9<<4)+15]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,f[(y+64>>>9<<4)+14]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,c.sigBytes=(f.length+1)*4,this._process();for(var b=this._hash,g=b.words,S=0;S<4;S++){var M=g[S];g[S]=(M<<8|M>>>24)&16711935|(M<<24|M>>>8)&4278255360}return b},clone:function(){var c=d.clone.call(this);return c._hash=this._hash.clone(),c}});function t(c,f,m,y,D,E,b){var g=c+(f&m|~f&y)+D+b;return(g<<E|g>>>32-E)+f}function r(c,f,m,y,D,E,b){var g=c+(f&y|m&~y)+D+b;return(g<<E|g>>>32-E)+f}function l(c,f,m,y,D,E,b){var g=c+(f^m^y)+D+b;return(g<<E|g>>>32-E)+f}function a(c,f,m,y,D,E,b){var g=c+(m^(f|~y))+D+b;return(g<<E|g>>>32-E)+f}v.MD5=d._createHelper(e),v.HmacMD5=d._createHmacHelper(e)}(Math),i.MD5})})(Kn);var As=Kn.exports;const pi=Zr(As),xs=window.innerWidth<=600?12:void 0;function _n(L){return Object.prototype.toString.call(L)==="[object Object]"}class K extends pt.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 u=i.shift();if(typeof u=="string"&&typeof n[u]=="object")return K.getValue(n[u],i)}static setValue(n,i,u){if(typeof i=="string"){K.setValue(n,i.split("."),u);return}if(i.length===1)u===null?delete n[i[0]]:n[i[0]]=u;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,u)}}getText(n,i){if(!n)return"";if(typeof n=="string"){const u=i?n:j.I18n.t(n);return u.includes("${")?this.getPattern(u,null,i):u}return _n(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=k.createElement(Z.Warning,null):n.type==="error"?i=k.createElement(Z.Error,null):n.type==="info"&&(i=k.createElement(Z.Info,null)),k.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:u=>this.setState({confirmDialog:!1},()=>{if(u){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=k.createElement(Z.Key,null):n==="send"?i=k.createElement(Z.Send,null):n==="web"?i=k.createElement(Z.Public,null):n==="warning"?i=k.createElement(Z.Warning,null):n==="error"?i=k.createElement(Z.Error,null):n==="info"?i=k.createElement(Z.Info,null):n==="search"?i=k.createElement(Z.Search,null):n==="book"?i=k.createElement(Z.MenuBook,null):n==="help"?i=k.createElement(Z.Help,null):n==="upload"?i=k.createElement(Z.UploadFile,null):n==="edit"?i=k.createElement(Z.Edit,null):n==="user"?i=k.createElement(Z.Person,null):n==="group"?i=k.createElement(Z.Group,null):n==="delete"?i=k.createElement(Z.Delete,null):n==="refresh"?i=k.createElement(Z.Refresh,null):n==="add"?i=k.createElement(Z.Add,null):n==="unpair"?i=k.createElement(Z.LinkOff,null):n==="pair"?i=k.createElement(Z.Link,null):n==="save"?i=k.createElement(Z.Save,null):n==="open"?i=k.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=k.createElement(j.Icon,{src:n,style:{width:22,height:22}})),i}onChangeAsync(n,i){return new Promise(u=>{const v=this.onChange(n,i,u);v instanceof Promise&&v.catch(s=>console.error(`Cannot set value: ${s}`))})}onChange(n,i,u){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(h=>{this.setState({confirmDialog:!0,confirmNewValue:i,confirmAttr:n,confirmData:null},()=>{typeof u=="function"?u():h()})});if(this.props.schema.confirmDependsOn)for(let h=0;h<this.props.schema.confirmDependsOn.length;h++){const d=this.props.schema.confirmDependsOn[h];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 u=="function"?u():p()})})}}const s=[];if(this.props.schema.onChangeDependsOn)for(let h=0;h<this.props.schema.onChangeDependsOn.length;h++){const d=this.props.schema.onChangeDependsOn[h];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 h=0;h<this.props.schema.hiddenDependsOn.length;h++){const d=this.props.schema.hiddenDependsOn[h];d.hidden&&s.push(d.attr)}if(this.props.schema.labelDependsOn)for(let h=0;h<this.props.schema.labelDependsOn.length;h++){const d=this.props.schema.labelDependsOn[h];d.hidden&&s.push(d.attr)}if(this.props.schema.helpDependsOn)for(let h=0;h<this.props.schema.helpDependsOn.length;h++){const d=this.props.schema.helpDependsOn[h];d.hidden&&s.push(d.attr)}if(this.props.schema.onChange&&!this.props.schema.onChange.ignoreOwnChanges){const h=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,h,v,this.props.arrayIndex,this.props.globalData);d!==h&&K.setValue(v,this.props.attr,d)}return this.props.custom?(this.props.onChange(n,i,()=>u&&u()),s!=null&&s.length&&s.forEach((h,d)=>setTimeout(()=>this.props.onChange(h,K.getValue(v,h)),d*50))):this.props.onChange(v,void 0,()=>{s.length&&this.props.oContext.forceUpdate(s,v),u&&u()}),Promise.resolve()}execute(n,i,u,v,s){let h;if(_n(n))h=n.func;else if(typeof n=="string")h=n;else return n;if(!h)return i;try{return new Function("data","originalData","_system","_alive","_common","_socket","_instance","arrayIndex","globalData","_changed",h.includes("return")?h:`return ${h}`)(u||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,u,v,s,h){let d;if(_n(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,u,this.props.oContext.socket,s,h,this.props.changed)}catch(o){return console.error(`Cannot execute ${d}: ${o}`),null}}calculate(n){let i,u,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?u=!0:u=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?u=!0:u=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:u,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,u){return this.getText(this.props.schema.label)||this.getText(this.props.schema.text)}renderHelp(n,i,u){return i?k.createElement("a",{href:i,target:"_blank",rel:"noreferrer",style:{color:this.props.oContext.themeType==="dark"?"#a147ff":"#5b238f",textDecoration:"underline"}},this.getText(n,u)):(n=this.getText(n,u)||"",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,(u,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 u}),n)}getPattern(n,i,u){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 h=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 u?h:j.I18n.t(h)}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:u,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=k.createElement(N.Grid2,{size:{xs:n.xs||xs,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?k.createElement(k.Fragment,null,k.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 h=this.renderItem(i,u||this.props.commandRunning||this.props.disabled,s);if(this.noPlaceRequired)return h;const d=k.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?k.createElement(N.Grid2,{container:!0,style:{width:"100%"}},k.createElement(N.Grid2,{flex:1},h),k.createElement(N.Grid2,null,k.createElement(N.Button,{disabled:u,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)))):h);return n.newLine?k.createElement(k.Fragment,null,k.createElement("div",{style:{flexBasis:"100%",height:0}}),this.renderDialogConfirm(),d):this.state.confirmDialog?k.createElement(k.Fragment,null,this.renderDialogConfirm(),d):d}}const Ge={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:u}=this.state,{schema:v}=this.props,s={type:"panel",items:v.items.reduce((h,d)=>(h[d.attr]=d,h),{}),style:{marginLeft:"-8px",marginTop:"10px",marginBottom:"10px"}};return k.createElement($t,{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:(h,d)=>{const o=JSON.parse(JSON.stringify(u));o[i][h]=d,this.setState({value:o},()=>this.onChangeWrapper(o))},onError:(h,d)=>this.onError(h,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)),u=JSON.parse(JSON.stringify(i[n]));if(typeof this.props.schema.clone=="string"&&typeof u[this.props.schema.clone]=="string"){let v=1,s=u[this.props.schema.clone];const h=s.match(/(\d+)$/);for(h?(s=s.replace(h[0],""),v=parseInt(h[0],10)+1):s+="_";i.find(d=>d[this.props.schema.clone]===s+v.toString());)v++;u[this.props.schema.clone]=`${u[this.props.schema.clone]}_${v}`}i.splice(n,0,u),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 u=this.onChange(this.props.attr,i);u instanceof Promise&&u.catch(v=>this.onError(v))},300,n)};onAdd=()=>{const{schema:n}=this.props,i=JSON.parse(JSON.stringify(this.state.value)),u=n.items&&n.items.reduce((v,s)=>{let h;return s.defaultFunc?this.props.custom?h=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:h=s.defaultFunc?this.execute(s.defaultFunc,this.props.schema.default,this.props.data,i.length,this.props.data):this.props.schema.default:h=s.default===void 0?null:s.default,v[s.attr]=h,v},{});i.push(u),this.setState({value:i,activeIndex:i.length-1},()=>this.onChangeWrapper(i))};onMoveUp(n){const i=JSON.parse(JSON.stringify(this.state.value)),u=i[n];i.splice(n,1),i.splice(n-1,0,u);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)),u=i[n];i.splice(n,1),i.splice(n+1,0,u);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?k.createElement(N.Paper,null,n.label||!n.noDelete?k.createElement(N.Toolbar,{variant:"dense"},n.label?k.createElement(N.Typography,{variant:"h6",id:"tableTitle",component:"div"},this.getText(n.label)):null,n.noDelete?null:k.createElement(N.IconButton,{size:"small",color:"primary",onClick:this.onAdd},k.createElement(Z.Add,null))):null,i.map((u,v)=>k.createElement(N.Accordion,{key:`${u}_${v}`,expanded:this.state.activeIndex===v,onChange:(s,h)=>this.setState({activeIndex:h?v:-1})},k.createElement(N.AccordionSummary,{expandIcon:k.createElement(Z.ExpandMore,null),sx:j.Utils.getStyle(this.props.oContext.theme,Ge.fullWidth,Ge.accordionSummary)},k.createElement(N.Typography,{style:Ge.accordionTitle},u[n.titleAttr])),k.createElement(N.AccordionDetails,{style:{...n.style,...this.props.oContext.themeType?n.darkStyle:void 0}},this.itemAccordion(i[v],v),k.createElement(N.Toolbar,{sx:Ge.toolbar},v?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Move up"),slotProps:{popper:{sx:Ge.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveUp(v)},k.createElement(Z.ArrowUpward,null))):k.createElement("div",{style:Ge.buttonEmpty}),v<i.length-1?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Move down"),slotProps:{popper:{sx:Ge.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveDown(v)},k.createElement(Z.ArrowDownward,null))):k.createElement("div",{style:Ge.buttonEmpty}),n.noDelete?null:k.createElement(N.Tooltip,{title:j.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:Ge.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:this.onDelete(v)},k.createElement(Z.Delete,null))),n.clone?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:Ge.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:this.onClone(v)},k.createElement(Z.ContentCopy,null))):null)))),!n.noDelete&&i.length>0?k.createElement(N.Toolbar,{variant:"dense",sx:Ge.rootTool},k.createElement(N.IconButton,{size:"small",color:"primary",onClick:this.onAdd},k.createElement(Z.Add,null))):null,n.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null):null}}const di={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(u=>this.setState({alive:!!(u&&u.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 k.createElement("div",{style:{...di.root,...this.state.alive?void 0:di.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(u=>typeof u=="string"?{label:u,value:u}:JSON.parse(JSON.stringify(u)));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 u;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(h=>!v.find(d=>typeof d=="object"?d.value===h:d===h)).forEach(h=>v.push({label:h.toString(),value:h})),u={label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE},v.unshift(u)):(u=this.state.value!==null&&this.state.value!==void 0&&v.find(h=>typeof h=="object"?h.value==this.state.value:h==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!u&&this.props.schema.freeSolo&&(u={value:this.state.value,label:this.state.value},v.push(u))),k.createElement(N.Autocomplete,{fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,value:u,options:v,isOptionEqualToValue:(h,d)=>h.value===d.value,filterOptions:(h,d)=>{const o=h.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:h=>{if(!h||!this.props.schema.freeSolo)return;const d=h.target.value;d!==this.state.value&&this.setState({value:d},()=>this.onChange(this.props.attr,d))},onChange:(h,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:h=>typeof h=="object"?(h==null?void 0:h.label)??"":"",renderInput:h=>k.createElement(N.TextField,{variant:"standard",...h,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(u=>typeof u=="string"?{label:u,value:u}:JSON.parse(JSON.stringify(u))):[];if(this.props.alive){let u=this.props.schema.data;if(u===void 0&&this.props.schema.jsonData){const v=this.getPattern(this.props.schema.jsonData,null,!0);try{typeof v=="string"&&(u=JSON.parse(v))}catch{console.error(`Cannot parse json data: ${JSON.stringify(u)}`)}}u===void 0&&(u=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",u).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 h=this.getContext();(h!==this.localContext||!this.initialized)&&(this.localContext=h,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}let u;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(h=>!v.find(d=>d.value===h)).forEach(h=>v.push({label:h.toString(),value:h})),u={label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE},v.unshift(u)):(u=this.state.value!==null&&this.state.value!==void 0&&v.find(h=>h.value==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!u&&this.props.schema.freeSolo&&(u={value:this.state.value,label:this.state.value},v.push(u)),u=u||null),v.length?k.createElement(N.Autocomplete,{value:u,fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,options:v,isOptionEqualToValue:(h,d)=>h.value===d.value,filterOptions:(h,d)=>{const o=h.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:h=>(h==null?void 0:h.label)??"",onInputChange:h=>{if(!h||!this.props.schema.freeSolo)return;const d=h.target.value;d!==this.state.value&&this.setState({value:d},()=>this.onChange(this.props.attr,d))},onChange:(h,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:h=>k.createElement(N.TextField,{variant:"standard",...h,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})}):k.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:h=>{const d=h.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 kn={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,u=K.getValue(n,i)||"";this.setState({value:u,showDialog:!1})}renderItem(n,i){const{schema:u,attr:v}=this.props,{value:s,showDialog:h}=this.state;return k.createElement(N.FormControl,{style:kn.fullWidth,variant:"standard"},u.label?k.createElement(N.InputLabel,{shrink:!0},this.getText(u.label)):null,k.createElement("div",{style:kn.flex},k.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:s??"",error:!!n,disabled:i,placeholder:this.getText(u.placeholder),label:this.getText(u.label),helperText:this.renderHelp(u.help,u.helpLink,u.noTranslation),onChange:d=>{const o=d.target.value;this.setState({value:o},()=>this.onChange(v,o))}}),k.createElement(N.Button,{color:"grey",disabled:i,style:kn.button,size:"small",variant:"outlined",onClick:()=>this.setState({showDialog:!0})},"...")),h?k.createElement(j.DialogCron,{title:j.I18n.t("ra_Define schedule"),simple:u.simple,complex:u.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),u=(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}));u.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({value:n,selectOptions:u})}renderItem(n,i){var v,s;if(!this.state.selectOptions)return null;const u=(v=this.state.selectOptions)==null?void 0:v.find(h=>h.value===this.state.value);return k.createElement(N.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?k.createElement(N.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:this.state.value,renderValue:()=>this.getText(u==null?void 0:u.label,this.props.schema.noTranslation!==!1),onChange:h=>this.setState({value:h.target.value},()=>this.onChange(this.props.attr,this.state.value))},(s=this.state.selectOptions)==null?void 0:s.map(h=>k.createElement(N.MenuItem,{key:h.value,value:h.value,style:h.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(h.label,this.props.schema.noTranslation!==!1)))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const zt={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=[],u=[],v=[];let s=[];const h=await this.props.oContext.socket.getObject("system.certificates");(d=h==null?void 0:h.native)!=null&&d.collections?s=Object.keys(h.native.collections):s=null,n.forEach(o=>{o.type==="public"?i.push({label:o.name,value:o.name}):o.type==="private"?u.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}),u.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}),u.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:u,collectionsOptions:s})}renderItem(n,i){var e,t,r,l,a,c,f;if(!this.state.certsPublicOptions||!this.state.certsPrivateOptions||!this.state.certsChainOptions)return null;const u=(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"),h=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===h);return k.createElement("div",{style:zt.fullWidth},this.state.collectionsOptions?k.createElement(N.FormControl,{style:zt.leWidth,variant:"standard"},k.createElement(N.InputLabel,{shrink:!0},"Let's encrypt"),k.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:u,onChange:m=>this.onChange(this.props.schema.leCollectionName||"leCollection",m.target.value==="false"?!1:m.target.value==="true"?!0:m.target.value)},k.createElement(N.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},j.I18n.t("ra_Do not use let's encrypt")),k.createElement(N.MenuItem,{key:"_true",value:"true",style:{fontWeight:"bold"}},j.I18n.t("ra_Use all available let's encrypt certificates")),(l=this.state.collectionsOptions)==null?void 0:l.map(m=>k.createElement(N.MenuItem,{key:m,value:m},m)))):null,this.state.collectionsOptions?k.createElement("br",null):null,this.state.collectionsOptions&&u!=="false"?k.createElement("div",null,j.I18n.t("ra_Fallback custom certificates")):null,k.createElement(N.FormControl,{style:zt.certWidth,variant:"standard"},k.createElement(N.InputLabel,{shrink:!0},j.I18n.t("ra_Public certificate")),k.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)=>k.createElement(N.MenuItem,{key:`${m.value}_${y}`,value:m.value,style:m.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(m.label))))),k.createElement(N.FormControl,{style:zt.certWidth,variant:"standard"},k.createElement(N.InputLabel,{shrink:!0},j.I18n.t("ra_Private certificate")),k.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)},(c=this.state.certsPrivateOptions)==null?void 0:c.map((m,y)=>k.createElement(N.MenuItem,{key:`${m.value}_${y}`,value:m.value,style:m.value===K.NONE_VALUE?{opacity:.5}:{}},this.getText(m.label))))),k.createElement(N.FormControl,{style:zt.certWidth,variant:"standard"},k.createElement(N.InputLabel,{shrink:!0},j.I18n.t("ra_Chained certificate")),k.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:h||"",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)=>k.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 u;super.componentDidMount();let n;const i=await this.props.oContext.socket.getObject("system.certificates");(u=i==null?void 0:i.native)!=null&&u.collections?n=Object.keys(i.native.collections):n=[],this.setState({collectionsOptions:n})}renderItem(n,i){var v;if(!this.state.collectionsOptions)return null;const u=(K.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString();return k.createElement(N.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?k.createElement(N.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:u,onChange:s=>this.onChange(this.props.schema.leCollectionName||"leCollection",s.target.value==="false"?!1:s.target.value==="true"?!0:s.target.value)},k.createElement(N.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},j.I18n.t("ra_Do not use let's encrypt")),k.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=>k.createElement(N.MenuItem,{key:s,value:s},s))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const We={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 ct 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=[k.createElement("div",{key:"error"},n)],n.push(k.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(k.createElement(N.TableContainer,{key:"table"},k.createElement(N.Table,{size:"small"},k.createElement(N.TableHead,null,k.createElement(N.TableRow,null,k.createElement(N.TableCell,null,j.I18n.t("ra_Product")),k.createElement(N.TableCell,null,j.I18n.t("ra_Version")),k.createElement(N.TableCell,null,"UUID"),k.createElement(N.TableCell,null,j.I18n.t("ra_ValidTill")),k.createElement(N.TableCell,null,j.I18n.t("ra_Commercial")),k.createElement(N.TableCell,null,"ID"))),k.createElement(N.TableBody,null,this.state.allLicenses.map(i=>k.createElement(N.TableRow,{key:i.id},k.createElement(N.TableCell,{sx:i.validName?null:We.errorText},i.license.product),k.createElement(N.TableCell,{sx:i.validVersion?null:We.errorText},i.license.version),k.createElement(N.TableCell,{sx:i.validUuid?null:We.errorText},i.license.uuid||"--"),k.createElement(N.TableCell,{sx:i.validTill?null:We.errorText},i.license.validTill&&i.license.validTill!=="0000-00-00 00:00:00"?new Date(i.license.validTill).toLocaleDateString():"--"),k.createElement(N.TableCell,null,i.license.invoice!=="free"?i.license.invoice==="MANUALLY_CREATED"?"✓":i.license.invoice:"-"),k.createElement(N.TableCell,null,i.id))))))):(n.push(k.createElement("div",{key:"text1"},j.I18n.t("ra_No one license found in license manager"))),n.push(k.createElement("div",{key:"text2"},j.I18n.t("ra_Please create license"))))),k.createElement(N.Dialog,{open:!0,maxWidth:"xl",fullWidth:this.props.fullWidth!==void 0?this.props.fullWidth:!0,onClick:()=>this.setState({_error:"",allLicenses:null})},k.createElement(N.DialogTitle,null,j.I18n.t("ra_Error")),k.createElement(N.DialogContent,null,k.createElement(N.DialogContentText,null,n)),k.createElement(N.DialogActions,null,k.createElement(N.Button,{variant:"contained",onClick:()=>this.setState({_error:"",allLicenses:null}),color:"primary",autoFocus:!0,startIcon:k.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(u=>{if(!(i[u]===null||i[u]===void 0))if(typeof i[u]=="object"){const v=i[u];Object.keys(v).forEach(s=>{v[s]!==null&&v[s]!==void 0&&(typeof v[s]=="object"?n.push(k.createElement("div",{key:s},k.createElement("div",{style:We.licLabel},s,":"),JSON.stringify(v[s],null,2))):n.push(k.createElement("div",{key:s},k.createElement("div",{style:We.licLabel},u," -",s,":"),v[s].toString())))})}else n.push(k.createElement("div",{key:u},k.createElement("div",{style:We.licLabel},u.replace(/_/g," "),":"),i[u].toString()))}),n.push(k.createElement("div",{key:"checked"},k.createElement("div",{style:We.licLabel},j.I18n.t("ra_Checked"),":"),this.state.licenseOfflineCheck?j.I18n.t("ra_locally"):j.I18n.t("ra_via internet"))),k.createElement(N.Dialog,{open:!0,onClose:()=>this.setState({showLicenseData:null})},k.createElement(N.DialogTitle,null,k.createElement(N.Box,{component:"span",sx:this.state.result?We.okTitle:We.errorTitle},j.I18n.t("ra_License %s",this.state.result?"OK":"INVALID"))),k.createElement(N.DialogContent,null,this.state.showLinkToProfile?k.createElement(N.Button,{variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},"https://iobroker.net"):null,this.state._error?k.createElement(N.Box,{component:"div",sx:We.errorText},this.state._error):null,n),k.createElement(N.DialogActions,null,k.createElement(N.Button,{onClick:()=>this.setState({showLicenseData:null,_error:""}),color:"primary",variant:"contained"},j.I18n.t("ra_Close"))))}return null}static parseJwt(n){const u=n.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),v=decodeURIComponent(atob(u).split("").map(s=>`%${`00${s.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));try{return JSON.parse(v)}catch{return null}}static isVersionValid(n,i,u,v){if(!i||!n)return!0;let s=!0;const[h]=n.split(".");return i.startsWith(">=")?s=parseInt(h,10)>=parseInt(i.substring(2,10)):i.startsWith("<=")?s=parseInt(h,10)<=parseInt(i.substring(2,10)):i.startsWith(">")?s=parseInt(h,10)>parseInt(i.substring(1,10)):i.startsWith("<")?s=parseInt(h,10)<parseInt(i.substring(1,10)):i.startsWith("=")?s=parseInt(h,10)===parseInt(i.substring(1,10)):i.startsWith("==")?s=parseInt(h,10)===parseInt(i.substring(2,10)):i.startsWith("===")&&(s=parseInt(h,10)===parseInt(i.substring(3,10))),!0}async findInLicenseManager(n){var v,s,h,d;const i=await this.props.oContext.socket.getObject("system.licenses"),u=[];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=(h=r==null?void 0:r.native)==null?void 0:h.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 l=!r.validTill||r.validTill==="0000-00-00 00:00:00"||new Date(r.validTill).getTime()>p,a=(r.product||"").split("."),c=a[1]===n||n==="vis-2"&&a[1]==="vis",f=!e||!r.uuid||r.uuid===e,m=ct.isVersionValid(t,r.version,r.invoice,n);(!o||r.invoice!=="free")&&l&&c&&f&&m&&(o=r),u.push({id:r.id,validName:c,validUuid:f,validVersion:m,validTill:l,license:r})}),o&&(u.find(r=>r.id===o.id).used=!0)}return u}async checkLicense(n,i){var d,o,p;let u;if(this.props.schema.uuid){const e=await this.props.oContext.socket.getObject("system.meta.uuid");u=(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 h=setTimeout(()=>{h=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:u}),headers:{"Content-Type":"text/plain"},signal:s.signal});h&&clearTimeout(h);const t=await e.text();let r;try{r=JSON.parse(t)}catch{}if(r!=null&&r.error)try{const l=ct.parseJwt(n),a=j.I18n.t(`ra_${l.error||r.error||"Unknown error"}`).replace(/^ra_/,"");return this.setState({_error:a,licenseOfflineCheck:!1,showLicenseData:l,result:!1,running:!1})}catch{return console.log("Cannot parse license"),this.setState({_error:r.error,result:!1,running:!1})}else{let l=null;try{l=ct.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:l,result:!1,running:!1});const c=(r.name||"").split(".");return c[1]===i||c[1]==="vis"&&i==="vis-2"?u&&!r.uuid&&i==="vis-2"?this.setState({_error:j.I18n.t("ra_License must be converted",r.uuid),showLinkToProfile:!0,licenseOfflineCheck:!1,showLicenseData:l,result:!1,running:!1}):u&&r.uuid&&r.uuid!==u?this.setState({_error:j.I18n.t('ra_Serial number (UUID) "%s" in license is for other device.',r.uuid),licenseOfflineCheck:!1,showLicenseData:l,result:!1,running:!1}):ct.isVersionValid(v,r.version,r.invoice,i)?this.setState({licenseOfflineCheck:!1,showLicenseData:l,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:l,result:!1,running:!1}):this.setState({_error:j.I18n.t('ra_License for other product "%s"',r.name),licenseOfflineCheck:!1,showLicenseData:l,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=ct.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?u&&t.uuid&&t.uuid!==u?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}):ct.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?k.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 u,v;if(this.props.data.useLicenseManager){if(v=await this.findInLicenseManager(i),u=v.find(s=>s.used),u&&(u=u.license.json),!u&&!n){this.setState({askForUpdate:!0});return}}else u=this.props.data.license;u?await this.checkLicense(u,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 k.createElement("div",{style:We.fullWidth},k.createElement(N.Button,{variant:this.props.schema.variant||"outlined",color:this.props.schema.color||"primary",style:We.fullWidth,disabled:!this.props.data.license&&!this.props.data.useLicenseManager||this.state.running,startIcon:k.createElement(Z.Send,null),onClick:()=>this._onClick()},this.state.running?k.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 u=K.getValue(this.props.data,this.props.attr),v=Array.isArray(u);return k.createElement(N.FormControl,{style:{width:"100%"},variant:"standard"},k.createElement(N.FormControlLabel,{onClick:s=>{if(s.preventDefault(),s.stopPropagation(),!i){const h=this.onChange(this.props.attr,!u);h instanceof Promise&&h.catch(d=>console.error(`Cannot set value: ${d}`))}},control:k.createElement(N.Checkbox,{indeterminate:v,checked:!!u,onChange:s=>{let h;v?h=this.onChange(this.props.attr,!0):h=this.onChange(this.props.attr,s.target.checked),h instanceof Promise&&h.catch(d=>console.error(`Cannot set value: ${d}`))},disabled:i||this.props.schema.readOnly}),label:this.getText(this.props.schema.label)}),k.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?k.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:{}}},rn={BACKSPACE:8,DELETE:46,LEFT_ARROW:37,RIGHT_ARROW:39},Bs=({value:L,isFocused:n,isDisabled:i,isReadOnly:u,handleClick:v,handleDelete:s,style:h},d)=>k.createElement(N.Chip,{key:d,style:{...h,pointerEvents:i||u?"none":void 0,backgroundColor:n?rs[300]:void 0},onClick:v,onDelete:s,label:L});class Ps extends k.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=k.createRef(),this.input=k.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 u=null;return n.value&&n.value.length!==i.prevPropsValue.length&&(u={prevPropsValue:n.value},n.clearInputValueOnChange&&(u.inputValue="")),n.clearInputValueOnChange&&n.value&&n.value.length!==i.prevPropsValue.length&&(u={prevPropsValue:n.value,inputValue:""}),n.disabled&&(u={...u,focusedChip:null}),!i.chipsUpdated&&n.defaultValue&&(u={...u,chips:n.defaultValue}),u}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 u;switch(this.props.blurBehavior||"clear"){case"add-or-clear":u={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,u):this.clearInput()},150)}else this.handleAddChip(i,u);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 u=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 rn.BACKSPACE:n.target.value===""&&(i?(this.handleDeleteChip(u[i],i),i&&this.setState({focusedChip:i-1})):this.setState({focusedChip:u.length-1}));break;case rn.DELETE:n.target.value===""&&i&&(this.handleDeleteChip(u[i],i),i<=u.length-1&&this.setState({focusedChip:i}));break;case rn.LEFT_ARROW:i===null&&n.target.value===""&&u.length?this.setState({focusedChip:u.length-1}):i!==null&&i>0&&this.setState({focusedChip:i-1});break;case rn.RIGHT_ARROW:i!==null&&i<u.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 u=this.props.value||this.state.chips;return n.trim().length?((this.props.allowDuplicates||!u.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 u=this.state.chips.slice();if(u.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(u,{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:u,disabled:v,disableUnderline:s,error:h,FormHelperTextProps:d,fullWidth:o,fullWidthInput:p,helperText:e,id:t,InputProps:r={},InputLabelProps:l={},inputValue:a,label:c,placeholder:f,readOnly:m,required:y,rootRef:D,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(C=>C.trim()));const M=a??this.state.inputValue,_=(this.props.value||M).length||M.length,T=typeof l.shrink=="boolean"?l.shrink:c!==null&&(_||this.state.isFocused||S.length),F=S.map((C,w)=>i({value:C,isDisabled:!!v,isReadOnly:m,isFocused:this.state.focusedChip===w,handleClick:()=>this.setState({focusedChip:w}),handleDelete:()=>this.handleDeleteChip(C,w),style:this.styles.chip},w.toString())),A={};g==="outlined"&&(A.notched=!!T,A.labelWidth=T&&this.labelNode&&this.labelNode.offsetWidth||0),g!=="standard"?A.startAdornment=F:r.disableUnderline=!0;const $=Rs[g];return k.createElement(N.FormControl,{ref:D,fullWidth:o,className:u,sx:{...this.styles.root,...b==="dense"?this.styles.marginDense:{}},error:h,required:S.length>0?void 0:y,onClick:this.focus,disabled:v,variant:g,component:"div",margin:b},c&&k.createElement(N.InputLabel,{htmlFor:t,sx:{"&.MuiInputLabel-root":this.styles.label,"&.MuiInputLabel-shrink":this.styles.labelShrink},shrink:!!T,focused:this.state.isFocused,variant:g,ref:this.labelRef,required:y,component:"label",...l},c),k.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,...c?this.styles.labeled:void 0,...h?this.styles.error:void 0}},g==="standard"&&F,k.createElement($,{ref:this.input,className:`mui-variant-${this.styles[g]} ${c?"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:M,onChange:this.handleUpdateInput,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,inputRef:this.setActualInputRef,disabled:v,fullWidth:p,placeholder:!_&&(T||c===null||c===void 0)||n?f:null,readOnly:m,...r,...A})),e&&k.createElement(N.FormHelperText,{...d,className:d==null?void 0:d.className,style:this.styles.helperText},e))}}class fi extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,u=K.getValue(n,i);if(this.props.schema.delimiter&&typeof u=="string"){const v=u.split(this.props.schema.delimiter).map(s=>s.trim()).filter(s=>s);this.setState({value:v})}else this.setState({value:u||[]})}renderItem(n,i){const{attr:u,schema:v}=this.props,{value:s}=this.state;return k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},k.createElement(Ps,{value:s,disabled:!!i,label:this.getText(v.label),error:!!n,onAdd:h=>{const d=JSON.parse(JSON.stringify(s));d.push(h),this.setState({value:d},()=>{let o;this.props.schema.delimiter?o=this.onChange(u,d.join(`${this.props.schema.delimiter} `)):o=this.onChange(u,d),o instanceof Promise&&o.catch(p=>console.error(p))})},theme:this.props.oContext.theme,onDelete:(h,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(u,o.join(`${this.props.schema.delimiter} `)):p=this.onChange(u,o),p instanceof Promise&&p.catch(e=>console.error(e))})}}),k.createElement(N.FormHelperText,null,j.I18n.t("ra_Press ENTER Key to add new item")),this.props.schema.help?k.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&&k.createElement(N.Dialog,{onClose:()=>this.setState({showColorDialog:!1}),open:this.state.showColorDialog},k.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 u=K.getValue(this.props.data,this.props.attr);let v=j.Utils.isUseBright(u,null);return v===null&&(v=void 0),k.createElement(k.Fragment,null,this.renderColorDialog(),k.createElement(N.TextField,{variant:"standard",disabled:!!i,style:{minWidth:100,width:"calc(100% - 8px)"},label:this.getText(this.props.schema.label),value:u||"",onClick:()=>!this.props.schema.readOnly&&this.setState({showColorDialog:!0,colorDialogValue:u||""}),onChange:s=>{const h=s.target.value,d=this.onChange(this.props.attr,h);d instanceof Promise&&d.catch(o=>console.error(`Cannot set value: ${o}`))},slotProps:{htmlInput:{style:{backgroundColor:u,color:v?"#FFF":"#000"},readOnly:this.props.schema.readOnly||!1},input:{endAdornment:!this.props.schema.readOnly&&u&&!this.props.schema.noClearButton?k.createElement(N.IconButton,{tabIndex:-1,size:"small",onClick:s=>{s.stopPropagation();const h=this.onChange(this.props.attr,"");h instanceof Promise&&h.catch(d=>console.error(`Cannot set value: ${d}`))}},k.createElement(Z.Close,null)):void 0},inputLabel:{shrink:!0}}}))}}const Mn={width:{width:"calc(100% - 85px)"},width50:{width:120,marginRight:5}};class Hs 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 u=this.onChange(this.props.attr,i);u instanceof Promise&&u.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 u=this.onChange(this.props.attr,i);u instanceof Promise&&u.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 k.createElement(k.Fragment,null,this.props.schema.useSystemName?k.createElement(N.FormControlLabel,{control:k.createElement(N.Checkbox,{checked:!!this.state.useSystem,onChange:u=>{const v=u.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?k.createElement(N.TextField,{variant:"standard",style:Mn.width50,value:this.state.longitude??"",error:!!n,disabled:this.state.useSystem||!!i,onChange:u=>{const v=u.target.value;this.setState({longitude:v},()=>{const s=this.onChange(this.props.schema.longitudeName,(v||"").trim());s instanceof Promise&&s.catch(h=>console.error(`Cannot set value: ${h}`))})},label:j.I18n.t("ra_Longitude")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?k.createElement(N.TextField,{variant:"standard",style:Mn.width50,value:this.state.latitude??"",error:!!n,disabled:this.state.useSystem||!!i,onChange:u=>{const v=u.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?k.createElement(N.TextField,{variant:"standard",style:Mn.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:u=>{const v=u.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:k.createElement(N.Fab,{size:"small",onClick:()=>this.getCoordinates(),title:j.I18n.t("ra_Take browser position"),style:{marginRight:4}},k.createElement(Z.LocationOn,null)),this.state.useSystem?null:k.createElement(N.Fab,{size:"small",onClick:()=>this.getSystemCoordinates(),title:j.I18n.t("ra_Take position from system settings")},k.createElement(Z.GpsFixed,null)))}}Pn.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 Ut 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,u,...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||!u||!s){console.error('Invalid format of "name"! Please define "name" as "ConfigCustomBackItUpSet/Components/AdapterExist" in the schema');return}let h=Ut.runningLoads[`${n}!${u}`];if(!(h 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(l=>l.json()).then(l=>j.I18n.extendTranslations(l,e)).catch(l=>console.log(`Cannot load i18n "${t}": ${l}`));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,u,s),Pn.registerRemotes([{name:i,entry:n,type:this.props.schema.bundlerType||void 0}]),h=Pn.loadRemote(`${i}/${u}`),d instanceof Promise&&(h=Promise.all([h,d]).then(o=>o[0])),Ut.runningLoads[`${n}!${u}`]=h}catch(o){console.error(o),this.setState({error:`Cannot import from ${this.props.schema.url}: ${o}`})}}try{const d=(await h).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||{},u=n?k.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?k.createElement("div",null,this.state.error):k.createElement(N.LinearProgress,null);return i.newLine?k.createElement(k.Fragment,null,k.createElement("div",{style:{flexBasis:"100%",height:0}}),u):u}}class zs extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n})}renderItem(n,i){return k.createElement(Wi.DatePicker,{sx:u=>({width:"100%",borderBottom:`1px solid ${u.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${u.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:u=>{this.setState({value:u},()=>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 k.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 k.createElement("div",null,"DeviceManager not found")}}const Ke={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 mn extends K{dropzoneRef;imagePrefix;objectID;path;constructor(n){super(n),this.dropzoneRef=k.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(u=>console.error(`Cannot update files: ${u}`))};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,u){try{const v=await this.props.oContext.socket.readDir(this.objectID,n.replace(/^\//,"")||null);for(let s=0;s<v.length;s++){const h=v[s];if(h.isDir)await this.readFolder(`${n+h.file}/`,i,u);else{let d=!1;u==="*.*"&&h.file.includes(".")||!u||u==="*"||u===".*"&&h.file.startsWith(".")?d=!0:d=new RegExp(`^${u.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(h.file),d&&i.push({name:n+h.file,size:h.stats?j.Utils.formatBytes(h.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 u;const v=n.lastIndexOf("/");if(v===-1?u=n:u=n.substring(v+1),n.startsWith("**"))await this.readFolder("/",i,u);else{const s=n.lastIndexOf("/");if(s===-1)await this.readFolder("/",i,u);else{const h=n.substring(0,s+1);await this.readFolder(h,i,u)}}return i}onDrop(n){const i=n[0],u=new FileReader,v=this.props.schema.maxSize||2*1024*1024;u.onabort=()=>console.log("file reading was aborted"),u.onerror=()=>console.log("file reading has failed"),u.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,u.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}`))},u.readAsArrayBuffer(i)}renderDeleteDialog(){return this.state.deleteFile?k.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(u=>window.alert(`Cannot delete file: ${u}`))})}}):null}static base64ToArrayBuffer(n){const i=window.atob(n),u=i.length,v=new Uint8Array(u);for(let s=0;s<u;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,u=mn.base64ToArrayBuffer(n.file);i.decodeAudioData(u,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)?k.createElement("div",{style:{...Ke.selectedImage,backgroundImage:`url(${this.imagePrefix}/${this.objectID}/${n.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"}}):Us.includes(n.extension)?k.createElement(Z.MusicNote,null):Ks.includes(n.extension)?k.createElement(Z.Article,null):Gs.includes(n.extension)?k.createElement(Z.Videocam,null):Js.includes(n.extension)?k.createElement(Z.Code,null):null:null}renderItem(n,i){if(!this.state.files)return null;const u=[];this.props.schema.withFolder||this.state.files.forEach(e=>{const t=e.name.lastIndexOf("/");if(t===-1)u.includes("/")||u.push("/");else{const r=e.name.substring(0,t+1);u.includes(r)||u.push(r)}});const v=this.state.files.map(e=>({value:e.name,label:!this.props.schema.withFolder&&u.length===1?`${e.name.substring(u[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 h=0;this.props.schema.upload&&h++,this.props.schema.refresh&&h++;const d=this.state.value&&(this.state.value.endsWith(".mp3")||this.state.value.endsWith(".ogg")||this.state.value.endsWith(".wav"));d&&h++;const o=k.createElement("div",{style:Ke.fullWidth},k.createElement(N.FormControl,{variant:"standard",style:{width:`calc(100% - ${h*42}px)`}},this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:this.state.value||"_",renderValue:()=>k.createElement(k.Fragment,null,this.getFileIcon(s),k.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=>k.createElement(N.MenuItem,{key:e.value,value:e.value},k.createElement(N.ListItemIcon,null,this.getFileIcon(e)),k.createElement(N.ListItemText,null,e.label),this.props.schema.delete&&s.value?k.createElement(N.IconButton,{style:Ke.deleteButton,size:"small",onClick:()=>this.setState({deleteFile:s.value})},k.createElement(Z.Delete,null)):null))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null),this.props.schema.refresh&&k.createElement(N.IconButton,{onClick:()=>this.updateFiles()},k.createElement(Z.Refresh,null)),this.props.schema.upload&&k.createElement(N.IconButton,{onClick:()=>{var e;return(e=this.dropzoneRef.current)==null?void 0:e.open()}},k.createElement(Z.UploadFile,null)),d&&k.createElement(N.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},k.createElement(Z.PlayArrow,null)));if(!this.props.schema.upload)return k.createElement(k.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 k.createElement(Pi,{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,l,a;this.setState({uploadFile:!1}),e.length?this.onDrop(e):window.alert(((a=(l=(r=t==null?void 0:t[0])==null?void 0:r.errors)==null?void 0:l[0])==null?void 0:a.message)||j.I18n.t("Cannot upload"))}},({getRootProps:e,getInputProps:t})=>k.createElement("div",{style:{...Ke.uploadDiv,...this.state.uploadFile==="dragging"?Ke.uploadDivDragging:void 0,...i?Ke.disabledOpacity:void 0},...e()},k.createElement("input",{...t()}),this.state.uploadFile==="dragging"?k.createElement("div",{style:{...Ke.uploadCenterDiv,...this.state.uploadError?Ke.error:void 0}},k.createElement("div",{style:Ke.uploadCenterTextAndIcon},k.createElement(Z.UploadFile,{style:Ke.uploadCenterIcon}),k.createElement("div",{style:Ke.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 sn={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"],Xs=["avi","mp4","mov"],Zs=["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 u=K.getValue(n.data,n.attr);return u==null||u.toString().trim()!==(i.value||"").toString().trim()?{value:u??""}:null}loadFile(){const n=this.state.value.indexOf("/");if(n!==-1){const i=this.state.value.substring(0,n),u=this.state.value.substring(n+1);return this.props.oContext.socket.readFile(i,u,!0)}return Promise.resolve(null)}play(){this.loadFile().then(n=>{if(typeof AudioContext<"u"&&(n!=null&&n.file)){const i=new AudioContext,u=mn.base64ToArrayBuffer(n.file);i.decodeAudioData(u,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)?k.createElement("div",{style:{...sn.selectedImage,backgroundImage:`url(${this.imagePrefix}/${this.state.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"}}):Qs.includes(n)?k.createElement(N.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},k.createElement(Z.PlayArrow,null)):Zs.includes(n)?k.createElement(Z.Article,null):Xs.includes(n)?k.createElement(Z.Videocam,null):qs.includes(n)?k.createElement(Z.Code,null):null}renderFileBrowser(){return this.state.showFileBrowser?k.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 u=this.getIcon();return k.createElement("div",{style:sn.fullWidth},u,k.createElement(N.TextField,{variant:"standard",style:u?sn.fullWidthIcon:sn.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)}),k.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 u=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&&u.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({value:n,selectOptions:u})})}renderItem(n,i){if(!this.state.selectOptions)return null;const u=this.state.selectOptions.find(v=>v.value===this.state.value);return k.createElement(N.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:this.state.value||"_",renderValue:()=>u?u.obj?k.createElement(j.TextWithIcon,{value:u.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):u.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=>k.createElement(N.MenuItem,{key:v.value,value:v.value,style:v.value===K.DIFFERENT_VALUE?{opacity:.5}:{}},v.obj?k.createElement(j.TextWithIcon,{value:v.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):v.label))),this.props.schema.help?k.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,h;const u=K.getValue(this.props.data,this.props.attr),v=(s=this.state.ips)==null?void 0:s.find(d=>d.address===u);return k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},this.state.ips&&this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.ips?k.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:u,renderValue:d=>(v==null?void 0:v.name)||d,onChange:d=>this.onChange(this.props.attr,d.target.value)},(h=this.state.ips)==null?void 0:h.map((d,o)=>k.createElement(N.MenuItem,{key:o,value:d.address},d.name))):k.createElement(N.TextField,{fullWidth:!0,variant:"standard",error:!!n,disabled:!!i,value:u,onChange:d=>this.onChange(this.props.attr,d.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?k.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:k.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 k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?k.createElement(N.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,k.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 u=this.onChange(this.props.attr,this.state.value);u instanceof Promise&&u.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(u=>console.error(u))}),onChange:u=>this.setState({value:u},()=>{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 u.startsWith("data")&&(u=u.split(",")[1]);this.props.oContext.socket.writeFile64(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr,u).catch(v=>console.error(v))})}),this.props.schema.help?k.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 k.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?k.createElement(N.Box,{component:"div",sx:{fontWeight:"bold",fontSize:"larger"}},this.getText(this.props.schema.title)):null,this.getText(this.props.schema.text))}}const gi={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 u=>{this.props.schema.adapter==="_dataSources"?u=u.filter(s=>{var h;return(h=s==null?void 0:s.common)==null?void 0:h.getHistory}):this.props.schema.adapter?u=u.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)&&(u=u.filter(s=>{var h;return this.props.schema.adapters.includes((h=s==null?void 0:s.common)==null?void 0:h.name)})),this.props.schema.onlyEnabled&&(u=u.filter(s=>{var h;return(h=s==null?void 0:s.common)==null?void 0:h.enabled}));const v=u.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,h)=>s.value>h.value?1:s.value<h.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(u=>console.error(`Cannot get instances: ${u}`))}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 u=this.props.schema.long?n:this.props.schema.short?n.split(".").pop():n.replace(/^system\.adapter\./,""),v=this.state.selectOptions.findIndex(s=>s.value===u);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)),h=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:`${h} [${i._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${h}/${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)),h={};this.state.value===s[v].value&&(h.value=K.NONE_VALUE),s.splice(v,1),h.selectOptions=s,this.setState(h)}};renderItem(n,i){var v;if(!this.state.selectOptions)return null;const u=(v=this.state.selectOptions)==null?void 0:v.find(s=>s.value===this.state.value);return k.createElement(N.FormControl,{fullWidth:!0,key:this.props.attr,variant:"standard"},this.props.schema.label?k.createElement(N.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,displayEmpty:!0,disabled:!!i,value:this.state.value,renderValue:()=>k.createElement("span",{style:{display:"flex"}},u!=null&&u.icon?k.createElement("img",{src:`./${u.icon}`,alt:u.value,style:gi.icon}):null,this.getText(u==null?void 0:u.label,!0)),onChange:s=>this.setState({value:s.target.value},()=>this.onChange(this.props.attr,this.state.value))},this.state.selectOptions.map(s=>k.createElement(N.MenuItem,{key:s.value,value:s.value,style:s.value===K.NONE_VALUE?{opacity:.5}:{}},s.icon?k.createElement("img",{src:`./${s.icon}`,alt:s.value,style:gi.icon}):null,this.getText(s.label,!0)))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const mi={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 u,v;const i=[];if((v=(u=n==null?void 0:n.native)==null?void 0:u.hardware)!=null&&v.networkInterfaces){const s=n.native.hardware.networkInterfaces;Object.keys(s).forEach(h=>{if(this.props.schema.ignoreInternal&&!s[h].find(o=>!o.internal)||this.props.schema.ignoreLoopback&&s[h].find(o=>o.address==="127.0.0.1"||o.address==="::1"))return;let d=s[h].find(o=>o.family==="IPv4");d=d||s[h].find(o=>o.family==="IPv6"),i.push({value:h,address:d.address})})}this.setState({interfaces:i})}).catch(n=>window.alert(`Cannot read interfaces: ${n}`))}renderItem(n,i){var s,h,d;const u=K.getValue(this.props.data,this.props.attr),v=(s=this.state.interfaces)==null?void 0:s.find(o=>o.value===u);return k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},(h=this.state.interfaces)!=null&&h.length&&this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,(d=this.state.interfaces)!=null&&d.length?k.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:u,renderValue:o=>v?k.createElement("span",null,v.value,k.createElement("span",{style:mi.address},v.address)):o,onChange:o=>this.onChange(this.props.attr,o.target.value)},this.state.interfaces.map((o,p)=>k.createElement(N.MenuItem,{key:p,value:o.value},k.createElement("span",null,o.value,k.createElement("span",{style:mi.address},o.address))))):k.createElement(N.TextField,{fullWidth:!0,variant:"standard",error:!!n,disabled:!!i,value:u,onChange:o=>this.onChange(this.props.attr,o.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const kt={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:u,help:v,maxWidth:s,progress:h,icon:d,applyDisabled:o,applyButton:p,onClose:e,children:t,titleButtonApply:r,titleButtonClose:l,onApply:a,textInput:c,defaultValue:f,overflowHidden:m})=>{const[y,D]=pt.useState(f);pt.useEffect(()=>{D(f)},[f]);let E=null;return d&&(E=d),k.createElement(N.Dialog,{open:!0,maxWidth:s||"md",fullWidth:!!u,disableEscapeKeyDown:!1,onClose:e,sx:{"& .MuiPaper-root":kt.modalDialog}},i&&k.createElement(N.DialogTitle,null,d?k.createElement(E,{style:kt.titleIcon}):null,i,j.I18n.getLanguage()!=="en"&&L?k.createElement(N.IconButton,{size:"large",style:{...kt.languageButton,...n?kt.languageButtonActive:{}},onClick:()=>L(),title:j.I18n.t("Disable/Enable translation")},k.createElement(Z.Language,null)):null),k.createElement(N.DialogContent,{sx:{...m?kt.overflowHidden:{},...kt.content},style:{paddingTop:8}},c&&k.createElement(N.TextField,{autoComplete:"off",fullWidth:!0,autoFocus:!0,variant:"outlined",size:"medium",multiline:!0,value:y,onChange:b=>D(b.target.value)}),t,v?k.createElement("div",null,v):null),k.createElement(N.DialogActions,null,p!==!1&&k.createElement(N.Button,{startIcon:k.createElement(Z.Check,null),disabled:h||o&&f===y,onClick:()=>a&&a(c?y:""),variant:"contained",color:"primary"},j.I18n.t(r||"Ok")),k.createElement(N.Button,{color:"grey",onClick:()=>e&&e(),disabled:h,variant:"contained",startIcon:k.createElement(Z.Close,null)},j.I18n.t(l||"Cancel"))))};var It={},Dt={},Vi={exports:{}};(function(L,n){(function(){var i="ace",u=function(){return this}();!u&&typeof window<"u"&&(u=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 l=o(e,t);if(l!=null)return r&&r(),l}else if(Object.prototype.toString.call(t)==="[object Array]"){for(var a=[],c=0,f=t.length;c<f;++c){var m=o(e,t[c]);if(m==null&&h.original)return;a.push(m)}return r&&r.apply(null,a)||!0}},h=function(e,t){var r=s("",e,t);return r==null&&h.original?h.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 l=e.split("/").slice(0,-1).join("/");for(t=l+"/"+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 l={},a={id:t,uri:"",exports:l,packaged:!0},c=function(m,y){return s(t,m,y)},f=r(c,l,a);l=f||a.exports,v.modules[t]=l,delete v.payloads[t]}r=v.modules[t]=l||r}return r};function p(e){var t=u;u[e]||(u[e]={}),t=u[e],(!t.define||!t.define.packaged)&&(v.original=t.define,t.define=v,t.define.packaged=!0),(!t.require||!t.require.packaged)&&(h.original=t.require,t.require=h,t.require.packaged=!0)}p(i)})(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(i,u,v){function s(h,d,o){Object.defineProperty(h,d,{value:o,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||s(String.prototype,"startsWith",function(h,d){return d=d||0,this.lastIndexOf(h,d)===d}),String.prototype.endsWith||s(String.prototype,"endsWith",function(h,d){var o=this;(d===void 0||d>o.length)&&(d=o.length),d-=h.length;var p=o.indexOf(h,d);return p!==-1&&p===d}),String.prototype.repeat||s(String.prototype,"repeat",function(h){for(var d="",o=this;h>0;)h&1&&(d+=o),(h>>=1)&&(o+=o);return d}),String.prototype.includes||s(String.prototype,"includes",function(h,d){return this.indexOf(h,d)!=-1}),Object.assign||(Object.assign=function(h){if(h==null)throw new TypeError("Cannot convert undefined or null to object");for(var d=Object(h),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(h){return Object.keys(h).map(function(d){return h[d]})}),Array.prototype.find||s(Array.prototype,"find",function(h){for(var d=this.length,o=arguments[1],p=0;p<d;p++){var e=this[p];if(h.call(o,e,p,this))return e}}),Array.prototype.findIndex||s(Array.prototype,"findIndex",function(h){for(var d=this.length,o=arguments[1],p=0;p<d;p++){var e=this[p];if(h.call(o,e,p,this))return p}}),Array.prototype.includes||s(Array.prototype,"includes",function(h,d){return this.indexOf(h,d)!=-1}),Array.prototype.fill||s(Array.prototype,"fill",function(h){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],l=r===void 0?o:r>>0,a=l<0?Math.max(o+l,0):Math.min(l,o);t<a;)d[t]=h,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,u,v){i("./es6-shim")}),ace.define("ace/lib/deep_copy",["require","exports","module"],function(i,u,v){u.deepCopy=function s(h){if(typeof h!="object"||!h)return h;var d;if(Array.isArray(h)){d=[];for(var o=0;o<h.length;o++)d[o]=s(h[o]);return d}if(Object.prototype.toString.call(h)!=="[object Object]")return h;d={};for(var o in h)d[o]=s(h[o]);return d}}),ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],function(i,u,v){u.last=function(d){return d[d.length-1]},u.stringReverse=function(d){return d.split("").reverse().join("")},u.stringRepeat=function(d,o){for(var p="";o>0;)o&1&&(p+=d),(o>>=1)&&(d+=d);return p};var s=/^\s\s*/,h=/\s\s*$/;u.stringTrimLeft=function(d){return d.replace(s,"")},u.stringTrimRight=function(d){return d.replace(h,"")},u.copyObject=function(d){var o={};for(var p in d)o[p]=d[p];return o},u.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},u.deepCopy=i("./deep_copy").deepCopy,u.arrayToMap=function(d){for(var o={},p=0;p<d.length;p++)o[d[p]]=1;return o},u.createMap=function(d){var o=Object.create(null);for(var p in d)o[p]=d[p];return o},u.arrayRemove=function(d,o){for(var p=0;p<=d.length;p++)o===d[p]&&d.splice(p,1)},u.escapeRegExp=function(d){return d.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},u.escapeHTML=function(d){return(""+d).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},u.getMatchOffsets=function(d,o){var p=[];return d.replace(o,function(e){p.push({offset:arguments[arguments.length-2],length:e.length})}),p},u.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},u.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},u.supportsLookbehind=function(){try{new RegExp("(?<=.)")}catch{return!1}return!0},u.skipEmptyMatch=function(d,o,p){return p&&d.codePointAt(o)>65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(i,u,v){u.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},u.getOS=function(){return u.isMac?u.OS.MAC:u.isLinux?u.OS.LINUX:u.OS.WINDOWS};var s=typeof navigator=="object"?navigator:{},h=(/mac|win|linux/i.exec(s.platform)||["other"])[0].toLowerCase(),d=s.userAgent||"",o=s.appName||"";u.isWin=h=="win",u.isMac=h=="mac",u.isLinux=h=="linux",u.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]),u.isOldIE=u.isIE&&u.isIE<9,u.isGecko=u.isMozilla=d.match(/ Gecko\/\d+/),u.isOpera=typeof opera=="object"&&Object.prototype.toString.call(window.opera)=="[object Opera]",u.isWebKit=parseFloat(d.split("WebKit/")[1])||void 0,u.isChrome=parseFloat(d.split(" Chrome/")[1])||void 0,u.isSafari=parseFloat(d.split(" Safari/")[1])&&!u.isChrome||void 0,u.isEdge=parseFloat(d.split(" Edge/")[1])||void 0,u.isAIR=d.indexOf("AdobeAIR")>=0,u.isAndroid=d.indexOf("Android")>=0,u.isChromeOS=d.indexOf(" CrOS ")>=0,u.isIOS=/iPad|iPhone|iPod/.test(d)&&!window.MSStream,u.isIOS&&(u.isMac=!0),u.isMobile=u.isIOS||u.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(i,u,v){var s=i("./useragent"),h="http://www.w3.org/1999/xhtml";u.buildDom=function r(l,a,c){if(typeof l=="string"&&l){var f=document.createTextNode(l);return a&&a.appendChild(f),f}if(!Array.isArray(l))return l&&l.appendChild&&a&&a.appendChild(l),l;if(typeof l[0]!="string"||!l[0]){for(var m=[],y=0;y<l.length;y++){var D=r(l[y],a,c);D&&m.push(D)}return m}var E=document.createElement(l[0]),b=l[1],g=1;b&&typeof b=="object"&&!Array.isArray(b)&&(g=2);for(var y=g;y<l.length;y++)r(l[y],E,c);return g==2&&Object.keys(b).forEach(function(S){var M=b[S];S==="class"?E.className=Array.isArray(M)?M.join(" "):M:typeof M=="function"||S=="value"||S[0]=="$"?E[S]=M:S==="ref"?c&&(c[M]=E):S==="style"?typeof M=="string"&&(E.style.cssText=M):M!=null&&E.setAttribute(S,M)}),a&&a.appendChild(E),E},u.getDocumentHead=function(r){return r||(r=document),r.head||r.getElementsByTagName("head")[0]||r.documentElement},u.createElement=function(r,l){return document.createElementNS?document.createElementNS(l||h,r):document.createElement(r)},u.removeChildren=function(r){r.innerHTML=""},u.createTextNode=function(r,l){var a=l?l.ownerDocument:document;return a.createTextNode(r)},u.createFragment=function(r){var l=r?r.ownerDocument:document;return l.createDocumentFragment()},u.hasCssClass=function(r,l){var a=(r.className+"").split(/\s+/g);return a.indexOf(l)!==-1},u.addCssClass=function(r,l){u.hasCssClass(r,l)||(r.className+=" "+l)},u.removeCssClass=function(r,l){for(var a=r.className.split(/\s+/g);;){var c=a.indexOf(l);if(c==-1)break;a.splice(c,1)}r.className=a.join(" ")},u.toggleCssClass=function(r,l){for(var a=r.className.split(/\s+/g),c=!0;;){var f=a.indexOf(l);if(f==-1)break;c=!1,a.splice(f,1)}return c&&a.push(l),r.className=a.join(" "),c},u.setCssClass=function(r,l,a){a?u.addCssClass(r,l):u.removeCssClass(r,l)},u.hasCssString=function(r,l){var a=0,c;if(l=l||document,c=l.querySelectorAll("style")){for(;a<c.length;)if(c[a++].id===r)return!0}},u.removeElementById=function(r,l){l=l||document,l.getElementById(r)&&l.getElementById(r).remove()};var d,o=[];u.useStrictCSP=function(r){d=r,r==!1?p():o||(o=[])};function p(){var r=o;o=null,r&&r.forEach(function(l){e(l[0],l[1])})}function e(r,l,a){if(!(typeof document>"u")){if(o){if(a)p();else if(a===!1)return o.push([r,l])}if(!d){var c=a;!a||!a.getRootNode?c=document:(c=a.getRootNode(),(!c||c==a)&&(c=document));var f=c.ownerDocument||c;if(l&&u.hasCssString(l,c))return null;l&&(r+=`
|
|
16
|
+
/*# sourceURL=ace/css/`+l+" */");var m=u.createElement("style");m.appendChild(f.createTextNode(r)),l&&(m.id=l),c==f&&(c=u.getDocumentHead(f)),c.insertBefore(m,c.firstChild)}}}if(u.importCssString=e,u.importCssStylsheet=function(r,l){u.buildDom(["link",{rel:"stylesheet",href:r}],u.getDocumentHead(l))},u.scrollbarWidth=function(r){var l=u.createElement("ace_inner");l.style.width="100%",l.style.minWidth="0px",l.style.height="200px",l.style.display="block";var a=u.createElement("ace_outer"),c=a.style;c.position="absolute",c.left="-10000px",c.overflow="hidden",c.width="200px",c.minWidth="0px",c.height="150px",c.display="block",a.appendChild(l);var f=r&&r.documentElement||document&&document.documentElement;if(!f)return 0;f.appendChild(a);var m=l.offsetWidth;c.overflow="scroll";var y=l.offsetWidth;return m===y&&(y=a.clientWidth),f.removeChild(a),m-y},u.computedStyle=function(r,l){return window.getComputedStyle(r,"")||{}},u.setStyle=function(r,l,a){r[l]!==a&&(r[l]=a)},u.HAS_CSS_ANIMATION=!1,u.HAS_CSS_TRANSFORMS=!1,u.HI_DPI=s.isWin?typeof window<"u"&&window.devicePixelRatio>=1.5:!0,s.isChromeOS&&(u.HI_DPI=!1),typeof document<"u"){var t=document.createElement("div");u.HI_DPI&&t.style.transform!==void 0&&(u.HAS_CSS_TRANSFORMS=!0),!s.isEdge&&typeof t.style.animationName<"u"&&(u.HAS_CSS_ANIMATION=!0),t=null}u.HAS_CSS_TRANSFORMS?u.translate=function(r,l,a){r.style.transform="translate("+Math.round(l)+"px, "+Math.round(a)+"px)"}:u.translate=function(r,l,a){r.style.top=Math.round(a)+"px",r.style.left=Math.round(l)+"px"}}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(i,u,v){/*
|
|
17
17
|
* based on code from:
|
|
18
18
|
*
|
|
19
19
|
* @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
|
20
20
|
* Available via the MIT or new BSD license.
|
|
21
21
|
* see: http://github.com/jrburke/requirejs for details
|
|
22
|
-
*/var
|
|
22
|
+
*/var s=i("./dom");u.get=function(h,d){var o=new XMLHttpRequest;o.open("GET",h,!0),o.onreadystatechange=function(){o.readyState===4&&d(o.responseText)},o.send(null)},u.loadScript=function(h,d){var o=s.getDocumentHead(),p=document.createElement("script");p.src=h,o.appendChild(p),p.onload=p.onreadystatechange=function(e,t){(t||!p.readyState||p.readyState=="loaded"||p.readyState=="complete")&&(p=p.onload=p.onreadystatechange=null,t||d())}},u.qualifyURL=function(h){var d=document.createElement("a");return d.href=h,d.href}}),ace.define("ace/lib/oop",["require","exports","module"],function(i,u,v){u.inherits=function(s,h){s.super_=h,s.prototype=Object.create(h.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}})},u.mixin=function(s,h){for(var d in h)s[d]=h[d];return s},u.implement=function(s,h){u.mixin(s,h)}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(i,u,v){var s={},h=function(){this.propagationStopped=!0},d=function(){this.defaultPrevented=!0};s._emit=s._dispatchEvent=function(o,p){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var e=this._eventRegistry[o]||[],t=this._defaultHandlers[o];if(!(!e.length&&!t)){(typeof p!="object"||!p)&&(p={}),p.type||(p.type=o),p.stopPropagation||(p.stopPropagation=h),p.preventDefault||(p.preventDefault=d),e=e.slice();for(var r=0;r<e.length&&(e[r](p,this),!p.propagationStopped);r++);if(t&&!p.defaultPrevented)return t(p,this)}},s._signal=function(o,p){var e=(this._eventRegistry||{})[o];if(e){e=e.slice();for(var t=0;t<e.length;t++)e[t](p,this)}},s.once=function(o,p){var e=this;if(this.on(o,function t(){e.off(o,t),p.apply(null,arguments)}),!p)return new Promise(function(t){p=t})},s.setDefaultHandler=function(o,p){var e=this._defaultHandlers;if(e||(e=this._defaultHandlers={_disabled_:{}}),e[o]){var t=e[o],r=e._disabled_[o];r||(e._disabled_[o]=r=[]),r.push(t);var l=r.indexOf(p);l!=-1&&r.splice(l,1)}e[o]=p},s.removeDefaultHandler=function(o,p){var e=this._defaultHandlers;if(e){var t=e._disabled_[o];if(e[o]==p)t&&this.setDefaultHandler(o,t.pop());else if(t){var r=t.indexOf(p);r!=-1&&t.splice(r,1)}}},s.on=s.addEventListener=function(o,p,e){this._eventRegistry=this._eventRegistry||{};var t=this._eventRegistry[o];return t||(t=this._eventRegistry[o]=[]),t.indexOf(p)==-1&&t[e?"unshift":"push"](p),p},s.off=s.removeListener=s.removeEventListener=function(o,p){this._eventRegistry=this._eventRegistry||{};var e=this._eventRegistry[o];if(e){var t=e.indexOf(p);t!==-1&&e.splice(t,1)}},s.removeAllListeners=function(o){o||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[o]=void 0),this._defaultHandlers&&(this._defaultHandlers[o]=void 0)},u.EventEmitter=s}),ace.define("ace/lib/report_error",["require","exports","module"],function(i,u,v){u.reportError=function(h,d){var o=new Error(h);o.data=d,typeof console=="object"&&console.error&&console.error(o),setTimeout(function(){throw o})}}),ace.define("ace/lib/default_english_messages",["require","exports","module"],function(i,u,v){var s={"autocomplete.popup.aria-roledescription":"Autocomplete suggestions","autocomplete.popup.aria-label":"Autocomplete suggestions","autocomplete.popup.item.aria-roledescription":"item","autocomplete.loading":"Loading...","editor.scroller.aria-roledescription":"editor","editor.scroller.aria-label":"Editor content, press Enter to start editing, press Escape to exit","editor.gutter.aria-roledescription":"editor gutter","editor.gutter.aria-label":"Editor gutter, press Enter to interact with controls using arrow keys, press Escape to exit","error-marker.good-state":"Looks good!","prompt.recently-used":"Recently used","prompt.other-commands":"Other commands","prompt.no-matching-commands":"No matching commands","search-box.find.placeholder":"Search for","search-box.find-all.text":"All","search-box.replace.placeholder":"Replace with","search-box.replace-next.text":"Replace","search-box.replace-all.text":"All","search-box.toggle-replace.title":"Toggle Replace mode","search-box.toggle-regexp.title":"RegExp Search","search-box.toggle-case.title":"CaseSensitive Search","search-box.toggle-whole-word.title":"Whole Word Search","search-box.toggle-in-selection.title":"Search In Selection","search-box.search-counter":"$0 of $1","text-input.aria-roledescription":"editor","text-input.aria-label":"Cursor at row $0","gutter.code-folding.range.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.closed.aria-label":"Toggle code folding, rows $0 through $1","gutter.code-folding.open.aria-label":"Toggle code folding, row $0","gutter.code-folding.closed.title":"Unfold code","gutter.code-folding.open.title":"Fold code","gutter.annotation.aria-label.error":"Error, read annotations row $0","gutter.annotation.aria-label.warning":"Warning, read annotations row $0","gutter.annotation.aria-label.info":"Info, read annotations row $0","inline-fold.closed.title":"Unfold code","gutter-tooltip.aria-label.error.singular":"error","gutter-tooltip.aria-label.error.plural":"errors","gutter-tooltip.aria-label.warning.singular":"warning","gutter-tooltip.aria-label.warning.plural":"warnings","gutter-tooltip.aria-label.info.singular":"information message","gutter-tooltip.aria-label.info.plural":"information messages","gutter.annotation.aria-label.security":"Security finding, read annotations row $0","gutter.annotation.aria-label.hint":"Suggestion, read annotations row $0","gutter-tooltip.aria-label.security.singular":"security finding","gutter-tooltip.aria-label.security.plural":"security findings","gutter-tooltip.aria-label.hint.singular":"suggestion","gutter-tooltip.aria-label.hint.plural":"suggestions","editor.tooltip.disable-editing":"Editing is disabled"};u.defaultEnglishMessages=s}),ace.define("ace/lib/app_config",["require","exports","module","ace/lib/oop","ace/lib/event_emitter","ace/lib/report_error","ace/lib/default_english_messages"],function(i,u,v){"no use strict";var s=i("./oop"),h=i("./event_emitter").EventEmitter,d=i("./report_error").reportError,o=i("./default_english_messages").defaultEnglishMessages,p={setOptions:function(a){Object.keys(a).forEach(function(c){this.setOption(c,a[c])},this)},getOptions:function(a){var c={};if(a)Array.isArray(a)||(a=Object.keys(a));else{var f=this.$options;a=Object.keys(f).filter(function(m){return!f[m].hidden})}return a.forEach(function(m){c[m]=this.getOption(m)},this),c},setOption:function(a,c){if(this["$"+a]!==c){var f=this.$options[a];if(!f)return e('misspelled option "'+a+'"');if(f.forwardTo)return this[f.forwardTo]&&this[f.forwardTo].setOption(a,c);f.handlesSet||(this["$"+a]=c),f&&f.set&&f.set.call(this,c)}},getOption:function(a){var c=this.$options[a];return c?c.forwardTo?this[c.forwardTo]&&this[c.forwardTo].getOption(a):c&&c.get?c.get.call(this):this["$"+a]:e('misspelled option "'+a+'"')}};function e(a){typeof console<"u"&&console.warn&&console.warn.apply(console,arguments)}var t,r,l=function(){function a(){this.$defaultOptions={},t=o,r="dollarSigns"}return a.prototype.defineOptions=function(c,f,m){return c.$options||(this.$defaultOptions[f]=c.$options={}),Object.keys(m).forEach(function(y){var D=m[y];typeof D=="string"&&(D={forwardTo:D}),D.name||(D.name=y),c.$options[D.name]=D,"initialValue"in D&&(c["$"+D.name]=D.initialValue)}),s.implement(c,p),this},a.prototype.resetOptions=function(c){Object.keys(c.$options).forEach(function(f){var m=c.$options[f];"value"in m&&c.setOption(f,m.value)})},a.prototype.setDefaultValue=function(c,f,m){if(!c){for(c in this.$defaultOptions)if(this.$defaultOptions[c][f])break;if(!this.$defaultOptions[c][f])return!1}var y=this.$defaultOptions[c]||(this.$defaultOptions[c]={});y[f]&&(y.forwardTo?this.setDefaultValue(y.forwardTo,f,m):y[f].value=m)},a.prototype.setDefaultValues=function(c,f){Object.keys(f).forEach(function(m){this.setDefaultValue(c,m,f[m])},this)},a.prototype.setMessages=function(c,f){t=c,f&&f.placeholders&&(r=f.placeholders)},a.prototype.nls=function(c,f,m){t[c]||(e("No message found for the key '"+c+"' in messages with id "+t.$id+", trying to find a translation for the default string '"+f+"'."),t[f]||e("No message found for the default string '"+f+"' in the provided messages. Falling back to the default English message."));var y=t[c]||t[f]||f;return m&&(r==="dollarSigns"&&(y=y.replace(/\$(\$|[\d]+)/g,function(D,E){return E=="$"?"$":m[E]})),r==="curlyBrackets"&&(y=y.replace(/\{([^\}]+)\}/g,function(D,E){return m[E]}))),y},a}();l.prototype.warn=e,l.prototype.reportError=d,s.implement(l.prototype,h),u.AppConfig=l}),ace.define("ace/theme/textmate-css",["require","exports","module"],function(i,u,v){v.exports=`.ace-tm .ace_gutter {
|
|
23
23
|
background: #f0f0f0;
|
|
24
24
|
color: #333;
|
|
25
25
|
}
|
|
@@ -177,41 +177,41 @@ import{C as pt,R as k}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,u,v){u.isDark=!1,u.cssClass="ace-tm",u.cssText=i("./textmate-css"),u.$id="ace/theme/textmate";var o=i("../lib/dom");o.importCssString(u.cssText,u.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,u,v){"no use strict";var o=i("./lib/lang"),h=i("./lib/net"),d=i("./lib/dom"),s=i("./lib/app_config").AppConfig;v.exports=u=new s;var p={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{},loadWorkerFromBlob:!0,sharedPopups:!1,useStrictCSP:null};u.get=function(l){if(!p.hasOwnProperty(l))throw new Error("Unknown config key: "+l);return p[l]},u.set=function(l,a){if(p.hasOwnProperty(l))p[l]=a;else if(this.setDefaultValue("",l,a)==!1)throw new Error("Unknown config key: "+l);l=="useStrictCSP"&&d.useStrictCSP(a)},u.all=function(){return o.copyObject(p)},u.$modes={},u.moduleUrl=function(l,a){if(p.$moduleUrls[l])return p.$moduleUrls[l];var c=l.split("/");a=a||c[c.length-2]||"";var f=a=="snippets"?"/":"-",m=c[c.length-1];if(a=="worker"&&f=="-"){var y=new RegExp("^"+a+"[\\-_]|[\\-_]"+a+"$","g");m=m.replace(y,"")}(!m||m==a)&&c.length>1&&(m=c[c.length-2]);var D=p[a+"Path"];return D==null?D=p.basePath:f=="/"&&(a=f=""),D&&D.slice(-1)!="/"&&(D+="/"),D+a+f+m+this.get("suffix")},u.setModuleUrl=function(l,a){return p.$moduleUrls[l]=a};var e=function(l,a){if(l==="ace/theme/textmate"||l==="./theme/textmate")return a(null,i("./theme/textmate"));if(t)return t(l,a);console.error("loader is not configured")},t;u.setLoader=function(l){t=l},u.dynamicModules=Object.create(null),u.$loading={},u.$loaded={},u.loadModule=function(l,a){var c;if(Array.isArray(l))var f=l[0],m=l[1];else if(typeof l=="string")var m=l;var y=function(D){if(D&&!u.$loading[m])return a&&a(D);if(u.$loading[m]||(u.$loading[m]=[]),u.$loading[m].push(a),!(u.$loading[m].length>1)){var E=function(){e(m,function(b,g){g&&(u.$loaded[m]=g),u._emit("load.module",{name:m,module:g});var S=u.$loading[m];u.$loading[m]=null,S.forEach(function(M){M&&M(g)})})};if(!u.get("packaged"))return E();h.loadScript(u.moduleUrl(m,f),E),r()}};if(u.dynamicModules[m])u.dynamicModules[m]().then(function(D){D.default?y(D.default):y(D)});else{try{c=this.$require(m)}catch{}y(c||u.$loaded[m])}},u.$require=function(l){if(typeof v.require=="function"){var a="require";return v[a](l)}},u.setModuleLoader=function(l,a){u.dynamicModules[l]=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(){})};u.version="1.42.0"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(i,u,v){i("./lib/fixoldbrowsers");var o=i("./config");o.setLoader(function(p,e){i([p],function(t){e(null,t)})});var h=function(){return this||typeof window<"u"&&window}();v.exports=function(p){o.init=d,o.$require=i,p.require=i},d(!0);function d(p){if(!(!h||!h.document)){o.set("packaged",p||i.packaged||v.packaged||h.define&&(void 0).packaged);var e={},t="",r=document.currentScript||document._currentScript,l=r&&r.ownerDocument||document;r&&r.src&&(t=r.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var a=l.getElementsByTagName("script"),c=0;c<a.length;c++){var f=a[c],m=f.src||f.getAttribute("src");if(m){for(var y=f.attributes,D=0,E=y.length;D<E;D++){var b=y[D];b.name.indexOf("data-ace-")===0&&(e[s(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"&&o.set(S,e[S])}}function s(p){return p.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}}),ace.define("ace/range",["require","exports","module"],function(i,u,v){var o=function(){function h(d,s,p,e){this.start={row:d,column:s},this.end={row:p,column:e}}return h.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},h.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},h.prototype.contains=function(d,s){return this.compare(d,s)==0},h.prototype.compareRange=function(d){var s,p=d.end,e=d.start;return s=this.compare(p.row,p.column),s==1?(s=this.compare(e.row,e.column),s==1?2:s==0?1:0):s==-1?-2:(s=this.compare(e.row,e.column),s==-1?-1:s==1?42:0)},h.prototype.comparePoint=function(d){return this.compare(d.row,d.column)},h.prototype.containsRange=function(d){return this.comparePoint(d.start)==0&&this.comparePoint(d.end)==0},h.prototype.intersects=function(d){var s=this.compareRange(d);return s==-1||s==0||s==1},h.prototype.isEnd=function(d,s){return this.end.row==d&&this.end.column==s},h.prototype.isStart=function(d,s){return this.start.row==d&&this.start.column==s},h.prototype.setStart=function(d,s){typeof d=="object"?(this.start.column=d.column,this.start.row=d.row):(this.start.row=d,this.start.column=s)},h.prototype.setEnd=function(d,s){typeof d=="object"?(this.end.column=d.column,this.end.row=d.row):(this.end.row=d,this.end.column=s)},h.prototype.inside=function(d,s){return this.compare(d,s)==0?!(this.isEnd(d,s)||this.isStart(d,s)):!1},h.prototype.insideStart=function(d,s){return this.compare(d,s)==0?!this.isEnd(d,s):!1},h.prototype.insideEnd=function(d,s){return this.compare(d,s)==0?!this.isStart(d,s):!1},h.prototype.compare=function(d,s){return!this.isMultiLine()&&d===this.start.row?s<this.start.column?-1:s>this.end.column?1:0:d<this.start.row?-1:d>this.end.row?1:this.start.row===d?s>=this.start.column?0:-1:this.end.row===d?s<=this.end.column?0:1:0},h.prototype.compareStart=function(d,s){return this.start.row==d&&this.start.column==s?-1:this.compare(d,s)},h.prototype.compareEnd=function(d,s){return this.end.row==d&&this.end.column==s?1:this.compare(d,s)},h.prototype.compareInside=function(d,s){return this.end.row==d&&this.end.column==s?1:this.start.row==d&&this.start.column==s?-1:this.compare(d,s)},h.prototype.clipRows=function(d,s){if(this.end.row>s)var p={row:s+1,column:0};else if(this.end.row<d)var p={row:d,column:0};if(this.start.row>s)var e={row:s+1,column:0};else if(this.start.row<d)var e={row:d,column:0};return h.fromPoints(e||this.start,p||this.end)},h.prototype.extend=function(d,s){var p=this.compare(d,s);if(p==0)return this;if(p==-1)var e={row:d,column:s};else var t={row:d,column:s};return h.fromPoints(e||this.start,t||this.end)},h.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},h.prototype.isMultiLine=function(){return this.start.row!==this.end.row},h.prototype.clone=function(){return h.fromPoints(this.start,this.end)},h.prototype.collapseRows=function(){return this.end.column==0?new h(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new h(this.start.row,0,this.end.row,0)},h.prototype.toScreenRange=function(d){var s=d.documentToScreenPosition(this.start),p=d.documentToScreenPosition(this.end);return new h(s.row,s.column,p.row,p.column)},h.prototype.moveBy=function(d,s){this.start.row+=d,this.start.column+=s,this.end.row+=d,this.end.column+=s},h}();o.fromPoints=function(h,d){return new o(h.row,h.column,d.row,d.column)},o.comparePoints=function(h,d){return h.row-d.row||h.column-d.column},u.Range=o}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(i,u,v){for(var o=i("./oop"),h={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},s=0;s<10;s++)d["Digit"+s]=48+s,d["Numpad"+s]=96+s,h.PRINTABLE_KEYS[48+s]=""+s,h.FUNCTION_KEYS[96+s]="Numpad"+s;for(var s=65;s<91;s++){var p=String.fromCharCode(s+32);d["Key"+p.toUpperCase()]=s,h.PRINTABLE_KEYS[s]=p}for(var s=1;s<13;s++)d["F"+s]=111+s,h.FUNCTION_KEYS[111+s]="F"+s;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];u.$codeToKeyCode=d,h.PRINTABLE_KEYS[173]="-";for(var r in h.FUNCTION_KEYS){var l=h.FUNCTION_KEYS[r].toLowerCase();h[l]=parseInt(r,10)}for(var r in h.PRINTABLE_KEYS){var l=h.PRINTABLE_KEYS[r].toLowerCase();h[l]=parseInt(r,10)}o.mixin(h,h.MODIFIER_KEYS),o.mixin(h,h.PRINTABLE_KEYS),o.mixin(h,h.FUNCTION_KEYS),h.enter=h.return,h.escape=h.esc,h.del=h.delete,function(){for(var a=["cmd","ctrl","alt","shift"],c=Math.pow(2,a.length);c--;)h.KEY_MODS[c]=a.filter(function(f){return c&h.KEY_MODS[f]}).join("-")+"-"}(),h.KEY_MODS[0]="",h.KEY_MODS[-1]="input-",o.mixin(u,h),u.default=u,u.keyCodeToString=function(a){var c=h[a];return typeof c!="string"&&(c=String.fromCharCode(a)),c.toLowerCase()}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(i,u,v){var o=i("./keys"),h=i("./useragent"),d=null,s=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(D,E,b){this.elem=D,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 l=u.addListener=function(D,E,b,g){D.addEventListener(E,b,t()),g&&g.$toDestroy.push(new r(D,E,b))},a=u.removeListener=function(D,E,b){D.removeEventListener(E,b,t())};u.stopEvent=function(D){return u.stopPropagation(D),u.preventDefault(D),!1},u.stopPropagation=function(D){D.stopPropagation&&D.stopPropagation()},u.preventDefault=function(D){D.preventDefault&&D.preventDefault()},u.getButton=function(D){return D.type=="dblclick"?0:D.type=="contextmenu"||h.isMac&&D.ctrlKey&&!D.altKey&&!D.shiftKey?2:D.button},u.capture=function(D,E,b){var g=D&&D.ownerDocument||document;function S(M){E&&E(M),b&&b(M),a(g,"mousemove",E),a(g,"mouseup",S),a(g,"dragstart",S)}return l(g,"mousemove",E),l(g,"mouseup",S),l(g,"dragstart",S),S},u.addMouseWheelListener=function(D,E,b){l(D,"wheel",function(g){var S=.15,M=g.deltaX||0,_=g.deltaY||0;switch(g.deltaMode){case g.DOM_DELTA_PIXEL:g.wheelX=M*S,g.wheelY=_*S;break;case g.DOM_DELTA_LINE:var T=15;g.wheelX=M*T,g.wheelY=_*T;break;case g.DOM_DELTA_PAGE:var F=150;g.wheelX=M*F,g.wheelY=_*F;break}E(g)},b)},u.addMultiMouseDownListener=function(D,E,b,g,S){var M=0,_,T,F,A={2:"dblclick",3:"tripleclick",4:"quadclick"};function $(C){if(u.getButton(C)!==0?M=0:C.detail>1?(M++,M>4&&(M=1)):M=1,h.isIE){var w=Math.abs(C.clientX-_)>5||Math.abs(C.clientY-T)>5;(!F||w)&&(M=1),F&&clearTimeout(F),F=setTimeout(function(){F=null},E[M-1]||600),M==1&&(_=C.clientX,T=C.clientY)}if(C._clicks=M,b[g]("mousedown",C),M>4)M=0;else if(M>1)return b[g](A[M],C)}Array.isArray(D)||(D=[D]),D.forEach(function(C){l(C,"mousedown",$,S)})};function c(D){return 0|(D.ctrlKey?1:0)|(D.altKey?2:0)|(D.shiftKey?4:0)|(D.metaKey?8:0)}u.getModifierString=function(D){return o.KEY_MODS[c(D)]};function f(D,E,b){var g=c(E);if(!b&&E.code&&(b=o.$codeToKeyCode[E.code]||b),!h.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&&(s=E.timeStamp);else if(b===18&&g===3&&S===2){var M=E.timeStamp-s;M<50&&(d.altGr=!0)}}}if(b in o.MODIFIER_KEYS&&(b=-1),!(!g&&b===13&&E.location===3&&(D(E,g,-b),E.defaultPrevented))){if(h.isChromeOS&&g&8){if(D(E,g,b),E.defaultPrevented)return;g&=-9}return!g&&!(b in o.FUNCTION_KEYS)&&!(b in o.PRINTABLE_KEYS)?!1:D(E,g,b)}}u.addCommandKeyListener=function(D,E,b){var g=null;l(D,"keydown",function(S){d[S.keyCode]=(d[S.keyCode]||0)+1;var M=f(E,S,S.keyCode);return g=S.defaultPrevented,M},b),l(D,"keypress",function(S){g&&(S.ctrlKey||S.altKey||S.shiftKey||S.metaKey)&&(u.stopEvent(S),g=null)},b),l(D,"keyup",function(S){d[S.keyCode]=null},b),d||(m(),l(window,"focus",m))};function m(){d=Object.create(null)}if(typeof window=="object"&&window.postMessage&&!h.isOldIE){var y=1;u.nextTick=function(D,E){E=E||window;var b="zero-timeout-message-"+y++,g=function(S){S.data==b&&(u.stopPropagation(S),a(E,"message",g),D())};l(E,"message",g),E.postMessage(b,"*")}}u.$idleBlocked=!1,u.onIdle=function(D,E){return setTimeout(function b(){u.$idleBlocked?setTimeout(b,100):D()},E)},u.$idleBlockId=null,u.blockIdle=function(D){u.$idleBlockId&&clearTimeout(u.$idleBlockId),u.$idleBlocked=!0,u.$idleBlockId=setTimeout(function(){u.$idleBlocked=!1},D||100)},u.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),u.nextFrame?u.nextFrame=u.nextFrame.bind(window):u.nextFrame=function(D){setTimeout(D,17)}}),ace.define("ace/clipboard",["require","exports","module"],function(i,u,v){var o;v.exports={lineMode:!1,pasteCancelled:function(){return o&&o>Date.now()-50?!0:o=!1},cancel:function(){o=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,u,v){var o=i("../lib/event"),h=i("../config").nls,d=i("../lib/useragent"),s=i("../lib/dom"),p=i("../lib/lang"),e=i("../clipboard"),t=d.isChrome<18,r=d.isIE,l=d.isChrome>63,a=400,c=i("../lib/keys"),f=c.KEY_MODS,m=d.isIOS,y=m?/\s/:/\n/,D=d.isMobile,E;E=function(b,g){var S=s.createElement("textarea");S.className="ace_text-input",S.setAttribute("wrap","off"),S.setAttribute("autocorrect","off"),S.setAttribute("autocapitalize","off"),S.setAttribute("spellcheck","false"),S.style.opacity="0",b.insertBefore(S,b.firstChild),this.setHost=function(X){g=X};var M=!1,_=!1,T=!1,F=!1,A="";D||(S.style.fontSize="1px");var $=!1,C=!1,w="",x=0,I=0,R=0,O=Number.MAX_SAFE_INTEGER,P=Number.MIN_SAFE_INTEGER,B=0;try{var V=document.activeElement===S}catch{}this.setNumberOfExtraLines=function(X){if(O=Number.MAX_SAFE_INTEGER,P=Number.MIN_SAFE_INTEGER,X<0){B=0;return}B=X},this.setAriaLabel=function(){var X="";if(g.$textInputAriaLabel&&(X+="".concat(g.$textInputAriaLabel,", ")),g.session){var re=g.session.selection.cursor.row;X+=h("text-input.aria-label","Cursor at row $0",[re+1])}S.setAttribute("aria-label",X)},this.setAriaOptions=function(X){X.activeDescendant?(S.setAttribute("aria-haspopup","true"),S.setAttribute("aria-autocomplete",X.inline?"both":"list"),S.setAttribute("aria-activedescendant",X.activeDescendant)):(S.setAttribute("aria-haspopup","false"),S.setAttribute("aria-autocomplete","both"),S.removeAttribute("aria-activedescendant")),X.role&&S.setAttribute("role",X.role),X.setLabel&&(S.setAttribute("aria-roledescription",h("text-input.aria-roledescription","editor")),this.setAriaLabel())},this.setAriaOptions({role:"textbox"}),o.addListener(S,"blur",function(X){C||(g.onBlur(X),V=!1)},g),o.addListener(S,"focus",function(X){if(!C){if(V=!0,d.isEdge)try{if(!document.hasFocus())return}catch{}g.onFocus(X),d.isEdge?setTimeout(H):H()}},g),this.$focusScroll=!1,this.focus=function(){if(this.setAriaOptions({setLabel:g.renderer.enableKeyboardAccessibility}),A||l||this.$focusScroll=="browser")return S.focus({preventScroll:!0});var X=S.style.top;S.style.position="fixed",S.style.top="0px";try{var re=S.getBoundingClientRect().top!=0}catch{return}var ae=[];if(re)for(var de=S.parentElement;de&&de.nodeType==1;)ae.push(de),de.setAttribute("ace_nocontext","true"),!de.parentElement&&de.getRootNode?de=de.getRootNode().host:de=de.parentElement;S.focus({preventScroll:!0}),re&&ae.forEach(function(ce){ce.removeAttribute("ace_nocontext")}),setTimeout(function(){S.style.position="",S.style.top=="0px"&&(S.style.top=X)},0)},this.blur=function(){S.blur()},this.isFocused=function(){return V},g.on("beforeEndOperation",function(){var X=g.curOp,re=X&&X.command&&X.command.name;if(re!="insertstring"){var ae=re&&(X.docChanged||X.selectionChanged);T&&ae&&(w=S.value="",Ze()),H()}}),g.on("changeSelection",this.setAriaLabel);var W=function(X,re){for(var ae=re,de=1;de<=X-O&&de<2*B+1;de++)ae+=g.session.getLine(X-de).length+1;return ae},H=m?function(X){if(!(!V||M&&!X||F)){X||(X="");var re=`
|
|
180
|
+
`}),ace.define("ace/theme/textmate",["require","exports","module","ace/theme/textmate-css","ace/lib/dom"],function(i,u,v){u.isDark=!1,u.cssClass="ace-tm",u.cssText=i("./textmate-css"),u.$id="ace/theme/textmate";var s=i("../lib/dom");s.importCssString(u.cssText,u.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,u,v){"no use strict";var s=i("./lib/lang"),h=i("./lib/net"),d=i("./lib/dom"),o=i("./lib/app_config").AppConfig;v.exports=u=new o;var p={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{},loadWorkerFromBlob:!0,sharedPopups:!1,useStrictCSP:null};u.get=function(l){if(!p.hasOwnProperty(l))throw new Error("Unknown config key: "+l);return p[l]},u.set=function(l,a){if(p.hasOwnProperty(l))p[l]=a;else if(this.setDefaultValue("",l,a)==!1)throw new Error("Unknown config key: "+l);l=="useStrictCSP"&&d.useStrictCSP(a)},u.all=function(){return s.copyObject(p)},u.$modes={},u.moduleUrl=function(l,a){if(p.$moduleUrls[l])return p.$moduleUrls[l];var c=l.split("/");a=a||c[c.length-2]||"";var f=a=="snippets"?"/":"-",m=c[c.length-1];if(a=="worker"&&f=="-"){var y=new RegExp("^"+a+"[\\-_]|[\\-_]"+a+"$","g");m=m.replace(y,"")}(!m||m==a)&&c.length>1&&(m=c[c.length-2]);var D=p[a+"Path"];return D==null?D=p.basePath:f=="/"&&(a=f=""),D&&D.slice(-1)!="/"&&(D+="/"),D+a+f+m+this.get("suffix")},u.setModuleUrl=function(l,a){return p.$moduleUrls[l]=a};var e=function(l,a){if(l==="ace/theme/textmate"||l==="./theme/textmate")return a(null,i("./theme/textmate"));if(t)return t(l,a);console.error("loader is not configured")},t;u.setLoader=function(l){t=l},u.dynamicModules=Object.create(null),u.$loading={},u.$loaded={},u.loadModule=function(l,a){var c;if(Array.isArray(l))var f=l[0],m=l[1];else if(typeof l=="string")var m=l;var y=function(D){if(D&&!u.$loading[m])return a&&a(D);if(u.$loading[m]||(u.$loading[m]=[]),u.$loading[m].push(a),!(u.$loading[m].length>1)){var E=function(){e(m,function(b,g){g&&(u.$loaded[m]=g),u._emit("load.module",{name:m,module:g});var S=u.$loading[m];u.$loading[m]=null,S.forEach(function(M){M&&M(g)})})};if(!u.get("packaged"))return E();h.loadScript(u.moduleUrl(m,f),E),r()}};if(u.dynamicModules[m])u.dynamicModules[m]().then(function(D){D.default?y(D.default):y(D)});else{try{c=this.$require(m)}catch{}y(c||u.$loaded[m])}},u.$require=function(l){if(typeof v.require=="function"){var a="require";return v[a](l)}},u.setModuleLoader=function(l,a){u.dynamicModules[l]=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(){})};u.version="1.42.0"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(i,u,v){i("./lib/fixoldbrowsers");var s=i("./config");s.setLoader(function(p,e){i([p],function(t){e(null,t)})});var h=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(!(!h||!h.document)){s.set("packaged",p||i.packaged||v.packaged||h.define&&(void 0).packaged);var e={},t="",r=document.currentScript||document._currentScript,l=r&&r.ownerDocument||document;r&&r.src&&(t=r.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var a=l.getElementsByTagName("script"),c=0;c<a.length;c++){var f=a[c],m=f.src||f.getAttribute("src");if(m){for(var y=f.attributes,D=0,E=y.length;D<E;D++){var b=y[D];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,u,v){var s=function(){function h(d,o,p,e){this.start={row:d,column:o},this.end={row:p,column:e}}return h.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},h.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},h.prototype.contains=function(d,o){return this.compare(d,o)==0},h.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)},h.prototype.comparePoint=function(d){return this.compare(d.row,d.column)},h.prototype.containsRange=function(d){return this.comparePoint(d.start)==0&&this.comparePoint(d.end)==0},h.prototype.intersects=function(d){var o=this.compareRange(d);return o==-1||o==0||o==1},h.prototype.isEnd=function(d,o){return this.end.row==d&&this.end.column==o},h.prototype.isStart=function(d,o){return this.start.row==d&&this.start.column==o},h.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)},h.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)},h.prototype.inside=function(d,o){return this.compare(d,o)==0?!(this.isEnd(d,o)||this.isStart(d,o)):!1},h.prototype.insideStart=function(d,o){return this.compare(d,o)==0?!this.isEnd(d,o):!1},h.prototype.insideEnd=function(d,o){return this.compare(d,o)==0?!this.isStart(d,o):!1},h.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},h.prototype.compareStart=function(d,o){return this.start.row==d&&this.start.column==o?-1:this.compare(d,o)},h.prototype.compareEnd=function(d,o){return this.end.row==d&&this.end.column==o?1:this.compare(d,o)},h.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)},h.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 h.fromPoints(e||this.start,p||this.end)},h.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 h.fromPoints(e||this.start,t||this.end)},h.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},h.prototype.isMultiLine=function(){return this.start.row!==this.end.row},h.prototype.clone=function(){return h.fromPoints(this.start,this.end)},h.prototype.collapseRows=function(){return this.end.column==0?new h(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new h(this.start.row,0,this.end.row,0)},h.prototype.toScreenRange=function(d){var o=d.documentToScreenPosition(this.start),p=d.documentToScreenPosition(this.end);return new h(o.row,o.column,p.row,p.column)},h.prototype.moveBy=function(d,o){this.start.row+=d,this.start.column+=o,this.end.row+=d,this.end.column+=o},h}();s.fromPoints=function(h,d){return new s(h.row,h.column,d.row,d.column)},s.comparePoints=function(h,d){return h.row-d.row||h.column-d.column},u.Range=s}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(i,u,v){for(var s=i("./oop"),h={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,h.PRINTABLE_KEYS[48+o]=""+o,h.FUNCTION_KEYS[96+o]="Numpad"+o;for(var o=65;o<91;o++){var p=String.fromCharCode(o+32);d["Key"+p.toUpperCase()]=o,h.PRINTABLE_KEYS[o]=p}for(var o=1;o<13;o++)d["F"+o]=111+o,h.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];u.$codeToKeyCode=d,h.PRINTABLE_KEYS[173]="-";for(var r in h.FUNCTION_KEYS){var l=h.FUNCTION_KEYS[r].toLowerCase();h[l]=parseInt(r,10)}for(var r in h.PRINTABLE_KEYS){var l=h.PRINTABLE_KEYS[r].toLowerCase();h[l]=parseInt(r,10)}s.mixin(h,h.MODIFIER_KEYS),s.mixin(h,h.PRINTABLE_KEYS),s.mixin(h,h.FUNCTION_KEYS),h.enter=h.return,h.escape=h.esc,h.del=h.delete,function(){for(var a=["cmd","ctrl","alt","shift"],c=Math.pow(2,a.length);c--;)h.KEY_MODS[c]=a.filter(function(f){return c&h.KEY_MODS[f]}).join("-")+"-"}(),h.KEY_MODS[0]="",h.KEY_MODS[-1]="input-",s.mixin(u,h),u.default=u,u.keyCodeToString=function(a){var c=h[a];return typeof c!="string"&&(c=String.fromCharCode(a)),c.toLowerCase()}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(i,u,v){var s=i("./keys"),h=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(D,E,b){this.elem=D,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 l=u.addListener=function(D,E,b,g){D.addEventListener(E,b,t()),g&&g.$toDestroy.push(new r(D,E,b))},a=u.removeListener=function(D,E,b){D.removeEventListener(E,b,t())};u.stopEvent=function(D){return u.stopPropagation(D),u.preventDefault(D),!1},u.stopPropagation=function(D){D.stopPropagation&&D.stopPropagation()},u.preventDefault=function(D){D.preventDefault&&D.preventDefault()},u.getButton=function(D){return D.type=="dblclick"?0:D.type=="contextmenu"||h.isMac&&D.ctrlKey&&!D.altKey&&!D.shiftKey?2:D.button},u.capture=function(D,E,b){var g=D&&D.ownerDocument||document;function S(M){E&&E(M),b&&b(M),a(g,"mousemove",E),a(g,"mouseup",S),a(g,"dragstart",S)}return l(g,"mousemove",E),l(g,"mouseup",S),l(g,"dragstart",S),S},u.addMouseWheelListener=function(D,E,b){l(D,"wheel",function(g){var S=.15,M=g.deltaX||0,_=g.deltaY||0;switch(g.deltaMode){case g.DOM_DELTA_PIXEL:g.wheelX=M*S,g.wheelY=_*S;break;case g.DOM_DELTA_LINE:var T=15;g.wheelX=M*T,g.wheelY=_*T;break;case g.DOM_DELTA_PAGE:var F=150;g.wheelX=M*F,g.wheelY=_*F;break}E(g)},b)},u.addMultiMouseDownListener=function(D,E,b,g,S){var M=0,_,T,F,A={2:"dblclick",3:"tripleclick",4:"quadclick"};function $(C){if(u.getButton(C)!==0?M=0:C.detail>1?(M++,M>4&&(M=1)):M=1,h.isIE){var w=Math.abs(C.clientX-_)>5||Math.abs(C.clientY-T)>5;(!F||w)&&(M=1),F&&clearTimeout(F),F=setTimeout(function(){F=null},E[M-1]||600),M==1&&(_=C.clientX,T=C.clientY)}if(C._clicks=M,b[g]("mousedown",C),M>4)M=0;else if(M>1)return b[g](A[M],C)}Array.isArray(D)||(D=[D]),D.forEach(function(C){l(C,"mousedown",$,S)})};function c(D){return 0|(D.ctrlKey?1:0)|(D.altKey?2:0)|(D.shiftKey?4:0)|(D.metaKey?8:0)}u.getModifierString=function(D){return s.KEY_MODS[c(D)]};function f(D,E,b){var g=c(E);if(!b&&E.code&&(b=s.$codeToKeyCode[E.code]||b),!h.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 M=E.timeStamp-o;M<50&&(d.altGr=!0)}}}if(b in s.MODIFIER_KEYS&&(b=-1),!(!g&&b===13&&E.location===3&&(D(E,g,-b),E.defaultPrevented))){if(h.isChromeOS&&g&8){if(D(E,g,b),E.defaultPrevented)return;g&=-9}return!g&&!(b in s.FUNCTION_KEYS)&&!(b in s.PRINTABLE_KEYS)?!1:D(E,g,b)}}u.addCommandKeyListener=function(D,E,b){var g=null;l(D,"keydown",function(S){d[S.keyCode]=(d[S.keyCode]||0)+1;var M=f(E,S,S.keyCode);return g=S.defaultPrevented,M},b),l(D,"keypress",function(S){g&&(S.ctrlKey||S.altKey||S.shiftKey||S.metaKey)&&(u.stopEvent(S),g=null)},b),l(D,"keyup",function(S){d[S.keyCode]=null},b),d||(m(),l(window,"focus",m))};function m(){d=Object.create(null)}if(typeof window=="object"&&window.postMessage&&!h.isOldIE){var y=1;u.nextTick=function(D,E){E=E||window;var b="zero-timeout-message-"+y++,g=function(S){S.data==b&&(u.stopPropagation(S),a(E,"message",g),D())};l(E,"message",g),E.postMessage(b,"*")}}u.$idleBlocked=!1,u.onIdle=function(D,E){return setTimeout(function b(){u.$idleBlocked?setTimeout(b,100):D()},E)},u.$idleBlockId=null,u.blockIdle=function(D){u.$idleBlockId&&clearTimeout(u.$idleBlockId),u.$idleBlocked=!0,u.$idleBlockId=setTimeout(function(){u.$idleBlocked=!1},D||100)},u.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),u.nextFrame?u.nextFrame=u.nextFrame.bind(window):u.nextFrame=function(D){setTimeout(D,17)}}),ace.define("ace/clipboard",["require","exports","module"],function(i,u,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,u,v){var s=i("../lib/event"),h=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,l=d.isChrome>63,a=400,c=i("../lib/keys"),f=c.KEY_MODS,m=d.isIOS,y=m?/\s/:/\n/,D=d.isMobile,E;E=function(b,g){var S=o.createElement("textarea");S.className="ace_text-input",S.setAttribute("wrap","off"),S.setAttribute("autocorrect","off"),S.setAttribute("autocapitalize","off"),S.setAttribute("spellcheck","false"),S.style.opacity="0",b.insertBefore(S,b.firstChild),this.setHost=function(X){g=X};var M=!1,_=!1,T=!1,F=!1,A="";D||(S.style.fontSize="1px");var $=!1,C=!1,w="",x=0,I=0,O=0,R=Number.MAX_SAFE_INTEGER,P=Number.MIN_SAFE_INTEGER,B=0;try{var V=document.activeElement===S}catch{}this.setNumberOfExtraLines=function(X){if(R=Number.MAX_SAFE_INTEGER,P=Number.MIN_SAFE_INTEGER,X<0){B=0;return}B=X},this.setAriaLabel=function(){var X="";if(g.$textInputAriaLabel&&(X+="".concat(g.$textInputAriaLabel,", ")),g.session){var re=g.session.selection.cursor.row;X+=h("text-input.aria-label","Cursor at row $0",[re+1])}S.setAttribute("aria-label",X)},this.setAriaOptions=function(X){X.activeDescendant?(S.setAttribute("aria-haspopup","true"),S.setAttribute("aria-autocomplete",X.inline?"both":"list"),S.setAttribute("aria-activedescendant",X.activeDescendant)):(S.setAttribute("aria-haspopup","false"),S.setAttribute("aria-autocomplete","both"),S.removeAttribute("aria-activedescendant")),X.role&&S.setAttribute("role",X.role),X.setLabel&&(S.setAttribute("aria-roledescription",h("text-input.aria-roledescription","editor")),this.setAriaLabel())},this.setAriaOptions({role:"textbox"}),s.addListener(S,"blur",function(X){C||(g.onBlur(X),V=!1)},g),s.addListener(S,"focus",function(X){if(!C){if(V=!0,d.isEdge)try{if(!document.hasFocus())return}catch{}g.onFocus(X),d.isEdge?setTimeout(H):H()}},g),this.$focusScroll=!1,this.focus=function(){if(this.setAriaOptions({setLabel:g.renderer.enableKeyboardAccessibility}),A||l||this.$focusScroll=="browser")return S.focus({preventScroll:!0});var X=S.style.top;S.style.position="fixed",S.style.top="0px";try{var re=S.getBoundingClientRect().top!=0}catch{return}var ae=[];if(re)for(var de=S.parentElement;de&&de.nodeType==1;)ae.push(de),de.setAttribute("ace_nocontext","true"),!de.parentElement&&de.getRootNode?de=de.getRootNode().host:de=de.parentElement;S.focus({preventScroll:!0}),re&&ae.forEach(function(ce){ce.removeAttribute("ace_nocontext")}),setTimeout(function(){S.style.position="",S.style.top=="0px"&&(S.style.top=X)},0)},this.blur=function(){S.blur()},this.isFocused=function(){return V},g.on("beforeEndOperation",function(){var X=g.curOp,re=X&&X.command&&X.command.name;if(re!="insertstring"){var ae=re&&(X.docChanged||X.selectionChanged);T&&ae&&(w=S.value="",Ze()),H()}}),g.on("changeSelection",this.setAriaLabel);var W=function(X,re){for(var ae=re,de=1;de<=X-R&&de<2*B+1;de++)ae+=g.session.getLine(X-de).length+1;return ae},H=m?function(X){if(!(!V||M&&!X||F)){X||(X="");var re=`
|
|
181
181
|
ab`+X+`cde fg
|
|
182
|
-
`;re!=S.value&&(S.value=w=re);var ae=4,de=4+(X.length||(g.selection.isEmpty()?0:1));(x!=ae||I!=de)&&S.setSelectionRange(ae,de),x=ae,I=de}}:function(){if(!(T||F)&&!(!V&&!Q)){T=!0;var X=0,re=0,ae="";if(g.session){var de=g.selection,ce=de.getRange(),Ee=de.cursor.row;Ee===P+1?(
|
|
183
|
-
`),X=W(ce.start.row,ce.start.column),re=W(ce.end.row,ce.end.column),ce.start.row<
|
|
182
|
+
`;re!=S.value&&(S.value=w=re);var ae=4,de=4+(X.length||(g.selection.isEmpty()?0:1));(x!=ae||I!=de)&&S.setSelectionRange(ae,de),x=ae,I=de}}:function(){if(!(T||F)&&!(!V&&!Q)){T=!0;var X=0,re=0,ae="";if(g.session){var de=g.selection,ce=de.getRange(),Ee=de.cursor.row;Ee===P+1?(R=P+1,P=R+2*B):Ee===R-1?(P=R-1,R=P-2*B):(Ee<R-1||Ee>P+1)&&(R=Ee>B?Ee-B:0,P=Ee>B?Ee+B:2*B);for(var $e=[],xe=R;xe<=P;xe++)$e.push(g.session.getLine(xe));if(ae=$e.join(`
|
|
183
|
+
`),X=W(ce.start.row,ce.start.column),re=W(ce.end.row,ce.end.column),ce.start.row<R){var we=g.session.getLine(R-1);X=ce.start.row<R-1?0:X,re+=we.length+1,ae=we+`
|
|
184
184
|
`+ae}else if(ce.end.row>P){var ve=g.session.getLine(P+1);re=ce.end.row>P+1?ve.length:ce.end.column,re+=ae.length+1,ae=ae+`
|
|
185
185
|
`+ve}else D&&Ee>0&&(ae=`
|
|
186
186
|
`+ae,re+=1,X+=1);ae.length>a&&(X<a&&re<a?ae=ae.slice(0,a):(ae=`
|
|
187
187
|
`,X==re?X=re=0:(X=0,re=1)));var Fe=ae+`
|
|
188
188
|
|
|
189
|
-
`;Fe!=w&&(S.value=w=Fe,x=I=Fe.length)}if(Q&&(x=S.selectionStart,I=S.selectionEnd),I!=re||x!=X||S.selectionEnd!=I)try{S.setSelectionRange(X,re),x=X,I=re}catch{}T=!1}};this.resetSelection=H,V&&g.onFocus();var U=function(X){return X.selectionStart===0&&X.selectionEnd>=w.length&&X.value===w&&w&&X.selectionEnd!==I},G=function(X){T||(M?M=!1:U(S)?(g.selectAll(),H()):D&&S.selectionStart!=x&&H())},Y=null;this.setInputHandler=function(X){Y=X},this.getInputHandler=function(){return Y};var Q=!1,ee=function(X,re){if(Q&&(Q=!1),_)return H(),X&&g.onPaste(X),_=!1,"";for(var ae=S.selectionStart,de=S.selectionEnd,ce=x,Ee=w.length-I,$e=X,xe=X.length-ae,we=X.length-de,ve=0;ce>0&&w[ve]==X[ve];)ve++,ce--;for($e=$e.slice(ve),ve=1;Ee>0&&w.length-ve>x-1&&w[w.length-ve]==X[X.length-ve];)ve++,Ee--;xe-=ve-1,we-=ve-1;var Fe=$e.length-ve+1;if(Fe<0&&(ce=-Fe,Fe=0),$e=$e.slice(0,Fe),!re&&!$e&&!xe&&!ce&&!Ee&&!we)return"";F=!0;var st=!1;return d.isAndroid&&$e==". "&&($e=" ",st=!0),$e&&!ce&&!Ee&&!xe&&!we||$?g.onTextInput($e):g.onTextInput($e,{extendLeft:ce,extendRight:Ee,restoreStart:xe,restoreEnd:we}),F=!1,w=X,x=ae,I=de,
|
|
190
|
-
`:$e},ne=function(X){if(T)return Xe();if(X&&X.inputType){if(X.inputType=="historyUndo")return g.execCommand("undo");if(X.inputType=="historyRedo")return g.execCommand("redo")}var re=S.value,ae=ee(re,!0);(re.length>a+100||y.test(ae)||D&&x<1&&x==I)&&H()},se=function(X,re,ae){var de=X.clipboardData||window.clipboardData;if(!(!de||t)){var ce=r||ae?"Text":"text/plain";try{return re?de.setData(ce,re)!==!1:de.getData(ce)}catch(Ee){if(!ae)return se(Ee,re,!0)}}},ge=function(X,re){var ae=g.getCopyText();if(!ae)return
|
|
189
|
+
`;Fe!=w&&(S.value=w=Fe,x=I=Fe.length)}if(Q&&(x=S.selectionStart,I=S.selectionEnd),I!=re||x!=X||S.selectionEnd!=I)try{S.setSelectionRange(X,re),x=X,I=re}catch{}T=!1}};this.resetSelection=H,V&&g.onFocus();var U=function(X){return X.selectionStart===0&&X.selectionEnd>=w.length&&X.value===w&&w&&X.selectionEnd!==I},G=function(X){T||(M?M=!1:U(S)?(g.selectAll(),H()):D&&S.selectionStart!=x&&H())},Y=null;this.setInputHandler=function(X){Y=X},this.getInputHandler=function(){return Y};var Q=!1,ee=function(X,re){if(Q&&(Q=!1),_)return H(),X&&g.onPaste(X),_=!1,"";for(var ae=S.selectionStart,de=S.selectionEnd,ce=x,Ee=w.length-I,$e=X,xe=X.length-ae,we=X.length-de,ve=0;ce>0&&w[ve]==X[ve];)ve++,ce--;for($e=$e.slice(ve),ve=1;Ee>0&&w.length-ve>x-1&&w[w.length-ve]==X[X.length-ve];)ve++,Ee--;xe-=ve-1,we-=ve-1;var Fe=$e.length-ve+1;if(Fe<0&&(ce=-Fe,Fe=0),$e=$e.slice(0,Fe),!re&&!$e&&!xe&&!ce&&!Ee&&!we)return"";F=!0;var st=!1;return d.isAndroid&&$e==". "&&($e=" ",st=!0),$e&&!ce&&!Ee&&!xe&&!we||$?g.onTextInput($e):g.onTextInput($e,{extendLeft:ce,extendRight:Ee,restoreStart:xe,restoreEnd:we}),F=!1,w=X,x=ae,I=de,O=we,st?`
|
|
190
|
+
`:$e},ne=function(X){if(T)return Xe();if(X&&X.inputType){if(X.inputType=="historyUndo")return g.execCommand("undo");if(X.inputType=="historyRedo")return g.execCommand("redo")}var re=S.value,ae=ee(re,!0);(re.length>a+100||y.test(ae)||D&&x<1&&x==I)&&H()},se=function(X,re,ae){var de=X.clipboardData||window.clipboardData;if(!(!de||t)){var ce=r||ae?"Text":"text/plain";try{return re?de.setData(ce,re)!==!1:de.getData(ce)}catch(Ee){if(!ae)return se(Ee,re,!0)}}},ge=function(X,re){var ae=g.getCopyText();if(!ae)return s.preventDefault(X);se(X,ae)?(m&&(H(ae),M=ae,setTimeout(function(){M=!1},10)),re?g.onCut():g.onCopy(),s.preventDefault(X)):(M=!0,S.value=ae,S.select(),setTimeout(function(){M=!1,H(),re?g.onCut():g.onCopy()}))},be=function(X){ge(X,!0)},ke=function(X){ge(X,!1)},Ce=function(X){var re=se(X);e.pasteCancelled()||(typeof re=="string"?(re&&g.onPaste(re,X),d.isIE&&setTimeout(H),s.preventDefault(X)):(S.value="",_=!0))};s.addCommandKeyListener(S,function(X,re,ae){if(!T)return g.onCommandKey(X,re,ae)},g),s.addListener(S,"select",G,g),s.addListener(S,"input",ne,g),s.addListener(S,"cut",be,g),s.addListener(S,"copy",ke,g),s.addListener(S,"paste",Ce,g),(!("oncut"in S)||!("oncopy"in S)||!("onpaste"in S))&&s.addListener(b,"keydown",function(X){if(!(d.isMac&&!X.metaKey||!X.ctrlKey))switch(X.keyCode){case 67:ke(X);break;case 86:Ce(X);break;case 88:be(X);break}},g);var Ne=function(X){if(!(T||!g.onCompositionStart||g.$readOnly)&&(T={},!$)){X.data&&(T.useTextareaForIME=!1),setTimeout(Xe,0),g._signal("compositionStart"),g.on("mousedown",Ot);var re=g.getSelectionRange();re.end.row=re.start.row,re.end.column=re.start.column,T.markerRange=re,T.selectionStart=x,g.onCompositionStart(T),T.useTextareaForIME?(w=S.value="",x=0,I=0):(S.msGetInputContext&&(T.context=S.msGetInputContext()),S.getInputContext&&(T.context=S.getInputContext()))}},Xe=function(){if(!(!T||!g.onCompositionUpdate||g.$readOnly)){if($)return Ot();if(T.useTextareaForIME)g.onCompositionUpdate(S.value);else{var X=S.value;ee(X),T.markerRange&&(T.context&&(T.markerRange.start.column=T.selectionStart=T.context.compositionStartOffset),T.markerRange.end.column=T.markerRange.start.column+I-T.selectionStart+O)}}},Ze=function(X){!g.onCompositionEnd||g.$readOnly||(T=!1,g.onCompositionEnd(),g.off("mousedown",Ot),X&&ne())};function Ot(){C=!0,S.blur(),S.focus(),C=!1}var Jt=p.delayedCall(Xe,50).schedule.bind(null,null);function bn(X){X.keyCode==27&&S.value.length<S.selectionStart&&(T||(w=S.value),x=I=-1,H()),Jt()}s.addListener(S,"compositionstart",Ne,g),s.addListener(S,"compositionupdate",Xe,g),s.addListener(S,"keyup",bn,g),s.addListener(S,"keydown",Jt,g),s.addListener(S,"compositionend",Ze,g),this.getElement=function(){return S},this.setCommandMode=function(X){$=X,S.readOnly=!1},this.setReadOnly=function(X){$||(S.readOnly=X)},this.setCopyWithEmptySelection=function(X){},this.onContextMenu=function(X){Q=!0,H(),g._emit("nativecontextmenu",{target:g,domEvent:X}),this.moveToMouse(X,!0)},this.moveToMouse=function(X,re){A||(A=S.style.cssText),S.style.cssText=(re?"z-index:100000;":"")+(d.isIE?"opacity:0.1;":"")+"text-indent: -"+(x+I)*g.renderer.characterWidth*.5+"px;";var ae=g.container.getBoundingClientRect(),de=o.computedStyle(g.container),ce=ae.top+(parseInt(de.borderTopWidth)||0),Ee=ae.left+(parseInt(de.borderLeftWidth)||0),$e=ae.bottom-ce-S.clientHeight-2,xe=function(we){o.translate(S,we.clientX-Ee-2,Math.min(we.clientY-ce-2,$e))};xe(X),X.type=="mousedown"&&(g.renderer.$isMousePressed=!0,clearTimeout(Rt),d.isWin&&s.capture(g.container,xe,Tt))},this.onContextMenuClose=Tt;var Rt;function Tt(){clearTimeout(Rt),Rt=setTimeout(function(){A&&(S.style.cssText=A,A=""),g.renderer.$isMousePressed=!1,g.renderer.$keepTextAreaAtCursor&&g.renderer.$moveTextAreaToCursor()},0)}var Nt=function(X){g.textInput.onContextMenu(X),Tt()};s.addListener(S,"mouseup",Nt,g),s.addListener(S,"mousedown",function(X){X.preventDefault(),Tt()},g),s.addListener(g.renderer.scroller,"contextmenu",Nt,g),s.addListener(S,"contextmenu",Nt,g),m&&wn(b,g,S);function wn(X,re,ae){var de=null,ce=!1;ae.addEventListener("keydown",function($e){de&&clearTimeout(de),ce=!0},!0),ae.addEventListener("keyup",function($e){de=setTimeout(function(){ce=!1},100)},!0);var Ee=function($e){if(document.activeElement===ae&&!(ce||T||re.$mouseHandler.isMousePressed)&&!M){var xe=ae.selectionStart,we=ae.selectionEnd,ve=null,Fe=0;if(xe==0?ve=c.up:xe==1?ve=c.home:we>I&&w[we]==`
|
|
191
191
|
`?ve=c.end:xe<x&&w[xe-1]==" "?(ve=c.left,Fe=f.option):xe<x||xe==x&&I!=x&&xe==we?ve=c.left:we>I&&w.slice(0,we).split(`
|
|
192
|
-
`).length>2?ve=c.down:we>I&&w[we-1]==" "?(ve=c.right,Fe=f.option):(we>I||we==I&&I!=x&&xe==we)&&(ve=c.right),xe!==we&&(Fe|=f.shift),ve){var st=re.onCommandKey({},Fe,ve);if(!st&&re.commands){ve=c.keyCodeToString(ve);var Yt=re.commands.findKeyCommand(Fe,ve);Yt&&re.execCommand(Yt)}x=xe,I=we,H("")}}};document.addEventListener("selectionchange",Ee),re.on("destroy",function(){document.removeEventListener("selectionchange",Ee)})}this.destroy=function(){S.parentElement&&S.parentElement.removeChild(S)}},u.TextInput=E,u.$setUserAgentForTests=function(b,g){D=b,m=g}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(i,u,v){var o=i("../lib/useragent"),h=0,d=550,s=function(){function t(r){r.$clickSelection=null;var l=r.editor;l.setDefaultHandler("mousedown",this.onMouseDown.bind(r)),l.setDefaultHandler("dblclick",this.onDoubleClick.bind(r)),l.setDefaultHandler("tripleclick",this.onTripleClick.bind(r)),l.setDefaultHandler("quadclick",this.onQuadClick.bind(r)),l.setDefaultHandler("mousewheel",this.onMouseWheel.bind(r));var a=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];a.forEach(function(c){r[c]=this[c]},this),r.selectByLines=this.extendSelectionBy.bind(r,"getLineRange"),r.selectByWords=this.extendSelectionBy.bind(r,"getWordRange")}return t.prototype.onMouseDown=function(r){var l=r.inSelection(),a=r.getDocumentPosition();this.mousedownEvent=r;var c=this.editor,f=r.getButton();if(f!==0){var m=c.getSelectionRange(),y=m.isEmpty();(y||f==1)&&c.selection.moveToPosition(a),f==2&&(c.textInput.onContextMenu(r.domEvent),o.isMozilla||r.preventDefault());return}if(this.mousedownEvent.time=Date.now(),l&&!c.isFocused()&&(c.focus(),this.$focusTimeout&&!this.$clickSelection&&!c.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,l){r=r||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var a=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?a.selection.selectToPosition(r):l||a.selection.moveToPosition(r),l||this.select(),a.setStyle("ace_selecting"),this.setState("select"))},t.prototype.select=function(){var r,l=this.editor,a=l.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var c=this.$clickSelection.comparePoint(a);if(c==-1)r=this.$clickSelection.end;else if(c==1)r=this.$clickSelection.start;else{var f=e(this.$clickSelection,a);a=f.cursor,r=f.anchor}l.selection.setSelectionAnchor(r.row,r.column)}l.selection.selectToPosition(a),l.renderer.scrollCursorIntoView()},t.prototype.extendSelectionBy=function(r){var l,a=this.editor,c=a.renderer.screenToTextCoordinates(this.x,this.y),f=a.selection[r](c.row,c.column);if(this.$clickSelection){var m=this.$clickSelection.comparePoint(f.start),y=this.$clickSelection.comparePoint(f.end);if(m==-1&&y<=0)l=this.$clickSelection.end,(f.end.row!=c.row||f.end.column!=c.column)&&(c=f.start);else if(y==1&&m>=0)l=this.$clickSelection.start,(f.start.row!=c.row||f.start.column!=c.column)&&(c=f.end);else if(m==-1&&y==1)c=f.end,l=f.start;else{var D=e(this.$clickSelection,c);c=D.cursor,l=D.anchor}a.selection.setSelectionAnchor(l.row,l.column)}a.selection.selectToPosition(c),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),l=Date.now();(r>h||l-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},t.prototype.onDoubleClick=function(r){var l=r.getDocumentPosition(),a=this.editor,c=a.session,f=c.getBracketRange(l);f?(f.isEmpty()&&(f.start.column--,f.end.column++),this.setState("select")):(f=a.selection.getWordRange(l.row,l.column),this.setState("selectByWords")),this.$clickSelection=f,this.select()},t.prototype.onTripleClick=function(r){var l=r.getDocumentPosition(),a=this.editor;this.setState("selectByLines");var c=a.getSelectionRange();c.isMultiLine()&&c.contains(l.row,l.column)?(this.$clickSelection=a.selection.getLineRange(c.start.row),this.$clickSelection.end=a.selection.getLineRange(c.end.row).end):this.$clickSelection=a.selection.getLineRange(l.row),this.select()},t.prototype.onQuadClick=function(r){var l=this.editor;l.selectAll(),this.$clickSelection=l.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 l=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var a=this.$lastScroll,c=r.domEvent.timeStamp,f=c-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 D=Math.abs(m/y),E=!1;if(D>=1&&l.renderer.isScrollableBy(r.wheelX*r.speed,0)&&(E=!0),D<=1&&l.renderer.isScrollableBy(0,r.wheelY*r.speed)&&(E=!0),E)a.allowed=c;else if(c-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=c):a.allowed=0}if(a.t=c,a.vx=m,a.vy=y,E)return l.renderer.scrollBy(r.wheelX*r.speed,r.wheelY*r.speed),r.stop()}},t}();s.prototype.selectEnd=s.prototype.selectByLinesEnd,s.prototype.selectAllEnd=s.prototype.selectByLinesEnd,s.prototype.selectByWordsEnd=s.prototype.selectByLinesEnd,u.DefaultHandlers=s;function p(t,r,l,a){return Math.sqrt(Math.pow(l-t,2)+Math.pow(a-r,2))}function e(t,r){if(t.start.row==t.end.row)var l=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 l=r.column-4;else var l=2*r.row-t.start.row-t.end.row;return l<0?{cursor:t.start,anchor:t.end}:{cursor:t.end,anchor:t.start}}}),ace.define("ace/lib/scroll",["require","exports","module"],function(i,u,v){u.preventParentScroll=function(h){h.stopPropagation();var d=h.currentTarget,s=d.scrollHeight>d.clientHeight;s||h.preventDefault()}}),ace.define("ace/tooltip",["require","exports","module","ace/lib/dom","ace/lib/event","ace/range","ace/lib/scroll"],function(i,u,v){var o=this&&this.__extends||function(){var c=function(f,m){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,D){y.__proto__=D}||function(y,D){for(var E in D)Object.prototype.hasOwnProperty.call(D,E)&&(y[E]=D[E])},c(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");c(f,m);function y(){this.constructor=f}f.prototype=m===null?Object.create(m):(y.prototype=m.prototype,new y)}}(),h=this&&this.__values||function(c){var f=typeof Symbol=="function"&&Symbol.iterator,m=f&&c[f],y=0;if(m)return m.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&y>=c.length&&(c=void 0),{value:c&&c[y++],done:!c}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},d=i("./lib/dom");i("./lib/event");var s=i("./range").Range,p=i("./lib/scroll").preventParentScroll,e="ace_tooltip",t=function(){function c(f){this.isOpen=!1,this.$element=null,this.$parentNode=f}return c.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},c.prototype.getElement=function(){return this.$element||this.$init()},c.prototype.setText=function(f){this.getElement().textContent=f},c.prototype.setHtml=function(f){this.getElement().innerHTML=f},c.prototype.setPosition=function(f,m){this.getElement().style.left=f+"px",this.getElement().style.top=m+"px"},c.prototype.setClassName=function(f){d.addCssClass(this.getElement(),f)},c.prototype.setTheme=function(f){this.$element.className=e+" "+(f.isDark?"ace_dark ":"")+(f.cssClass||"")},c.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)},c.prototype.hide=function(f){this.isOpen&&(this.getElement().style.display="none",this.getElement().className=e,this.isOpen=!1)},c.prototype.getHeight=function(){return this.getElement().offsetHeight},c.prototype.getWidth=function(){return this.getElement().offsetWidth},c.prototype.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)},c}(),r=function(){function c(){this.popups=[]}return c.prototype.addPopup=function(f){this.popups.push(f),this.updatePopups()},c.prototype.removePopup=function(f){var m=this.popups.indexOf(f);m!==-1&&(this.popups.splice(m,1),this.updatePopups())},c.prototype.updatePopups=function(){var f,m,y,D;this.popups.sort(function(A,$){return $.priority-A.priority});var E=[];try{for(var b=h(this.popups),g=b.next();!g.done;g=b.next()){var S=g.value,M=!0;try{for(var _=(y=void 0,h(E)),T=_.next();!T.done;T=_.next()){var F=T.value;if(this.doPopupsOverlap(F,S)){M=!1;break}}}catch(A){y={error:A}}finally{try{T&&!T.done&&(D=_.return)&&D.call(_)}finally{if(y)throw y.error}}M?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}}},c.prototype.doPopupsOverlap=function(f,m){var y=f.getElement().getBoundingClientRect(),D=m.getElement().getBoundingClientRect();return y.left<D.right&&y.right>D.left&&y.top<D.bottom&&y.bottom>D.top},c}(),l=new r;u.popupManager=l,u.Tooltip=t;var a=function(c){o(f,c);function f(m){m===void 0&&(m=document.body);var y=c.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 D=y.getElement();return D.style.whiteSpace="pre-wrap",D.style.pointerEvents="auto",D.addEventListener("mouseout",y.onMouseOut),D.tabIndex=-1,D.addEventListener("blur",function(){D.contains(document.activeElement)||this.hide()}.bind(y)),D.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 D=y.$mouseHandler.isMousePressed;if(this.isOpen){var E=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(E.row,E.column)||D||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||D||(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,D=m.getDocumentPosition(),E=y.session.getLine(D.row);if(D.column==E.length){var b=y.renderer.pixelToScreenCoordinates(m.clientX,m.clientY),g=y.session.documentToScreenPosition(D.row,D.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,D,E){var b=10;if(!(E&&E!=this.lastEvent)&&!(this.isOpen&&document.activeElement==this.getElement())){var g=m.renderer;this.isOpen||(l.addPopup(this),this.$registerCloseEvents(),this.setTheme(g.theme)),this.isOpen=!0,this.addMarker(y,m.session),this.range=s.fromPoints(y.start,y.end);var S=g.textToScreenCoordinates(y.start.row,y.start.column),M=g.scroller.getBoundingClientRect();S.pageX<M.left&&(S.pageX=M.left);var _=this.getElement();_.innerHTML="",_.appendChild(D),_.style.maxHeight="",_.style.display="block";var T=_.clientHeight,F=_.clientWidth,A=window.innerHeight-S.pageY-g.lineHeight,$=!0;S.pageY-T<0&&S.pageY<A&&($=!1),_.style.maxHeight=($?S.pageY:A)-b+"px",_.style.top=$?"":S.pageY+g.lineHeight+"px",_.style.bottom=$?window.innerHeight-S.pageY+"px":"",_.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,l.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);u.HoverTooltip=a}),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/tooltip","ace/config"],function(i,u,v){var o=this&&this.__extends||function(){var c=function(f,m){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,D){y.__proto__=D}||function(y,D){for(var E in D)Object.prototype.hasOwnProperty.call(D,E)&&(y[E]=D[E])},c(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");c(f,m);function y(){this.constructor=f}f.prototype=m===null?Object.create(m):(y.prototype=m.prototype,new y)}}(),h=this&&this.__values||function(c){var f=typeof Symbol=="function"&&Symbol.iterator,m=f&&c[f],y=0;if(m)return m.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&y>=c.length&&(c=void 0),{value:c&&c[y++],done:!c}}};throw new TypeError(f?"Object is not iterable.":"Symbol.iterator is not defined.")},d=i("../lib/dom"),s=i("../lib/event"),p=i("../tooltip").Tooltip,e=i("../config").nls,t=5,r=3;u.GUTTER_TOOLTIP_LEFT_OFFSET=t,u.GUTTER_TOOLTIP_TOP_OFFSET=r;function l(c){var f=c.editor,m=f.renderer.$gutterLayer,y=new a(f,!0);c.editor.setDefaultHandler("guttermousedown",function(M){if(!(!f.isFocused()||M.getButton()!=0)){var _=m.getRegion(M);if(_!="foldWidgets"){var T=M.getDocumentPosition().row,F=f.session.selection;if(M.getShiftKey())F.selectTo(T,0);else{if(M.domEvent.detail==2)return f.selectAll(),M.preventDefault();c.$clickSelection=f.selection.getLineRange(T)}return c.setState("selectByLines"),c.captureMouse(M),M.preventDefault()}}});var D,E;function b(){var M=E.getDocumentPosition().row,_=f.session.getLength();if(M==_){var T=f.renderer.pixelToScreenCoordinates(0,E.y).row,F=E.$pos;if(T>f.session.documentToScreenRow(F.row,F.column))return g()}if(y.showTooltip(M),!!y.isOpen)if(f.on("mousewheel",g),f.on("changeSession",g),window.addEventListener("keydown",g,!0),c.$tooltipFollowsMouse)S(E);else{var A=E.getGutterRow(),$=m.$lines.get(A);if($){var C=$.element.querySelector(".ace_gutter_annotation"),w=C.getBoundingClientRect(),x=y.getElement().style;x.left=w.right-t+"px",x.top=w.bottom-r+"px"}else S(E)}}function g(M){M&&M.type==="keydown"&&(M.ctrlKey||M.metaKey)||M&&M.type==="mouseout"&&(!M.relatedTarget||y.getElement().contains(M.relatedTarget))||(D&&(D=clearTimeout(D)),y.isOpen&&(y.hideTooltip(),f.off("mousewheel",g),f.off("changeSession",g),window.removeEventListener("keydown",g,!0)))}function S(M){y.setPosition(M.x,M.y)}c.editor.setDefaultHandler("guttermousemove",function(M){var _=M.domEvent.target||M.domEvent.srcElement;if(d.hasCssClass(_,"ace_fold-widget")||d.hasCssClass(_,"ace_custom-widget"))return g();y.isOpen&&c.$tooltipFollowsMouse&&S(M),E=M,!D&&(D=setTimeout(function(){D=null,E&&!c.isMousePressed&&b()},50))}),s.addListener(f.renderer.$gutter,"mouseout",function(M){E=null,y.isOpen&&(D=setTimeout(function(){D=null,g(M)},50))},f)}u.GutterHandler=l;var a=function(c){o(f,c);function f(m,y){y===void 0&&(y=!1);var D=c.call(this,m.container)||this;D.editor=m,D.visibleTooltipRow;var E=D.getElement();return E.setAttribute("role","tooltip"),E.style.pointerEvents="auto",y&&(D.onMouseOut=D.onMouseOut.bind(D),E.addEventListener("mouseout",D.onMouseOut)),D}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 D=window.innerWidth||document.documentElement.clientWidth,E=window.innerHeight||document.documentElement.clientHeight,b=this.getWidth(),g=this.getHeight();m+=15,y+=15,m+b>D&&(m-=m+b-D),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,D=this.editor.renderer.$gutterLayer,E=D.$annotations[m],b;E?b={displayText:Array.from(E.displayText),type:Array.from(E.type)}:b={displayText:[],type:[]};var g=D.session.getFoldLine(m);if(g&&D.$showFoldedAnnotations){for(var S={error:[],security:[],warning:[],info:[],hint:[]},M={error:1,security:2,warning:3,info:4,hint:5},_,T=m+1;T<=g.end.row;T++)if(D.$annotations[T])for(var F=0;F<D.$annotations[T].text.length;F++){var A=D.$annotations[T].type[F];S[A].push(D.$annotations[T].text[F]),(!_||M[A]<M[_])&&(_=A)}if(["error","security","warning"].includes(_)){var $="".concat(f.annotationsToSummaryString(S)," in folded code.");b.displayText.push($),b.type.push(_+"_fold")}}if(b.displayText.length===0)return this.hideTooltip();for(var C={error:[],security:[],warning:[],info:[],hint:[]},w=D.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",T=0;T<b.displayText.length;T++){var x=d.createElement("span"),I=d.createElement("span");(y=I.classList).add.apply(y,["ace_".concat(b.type[T]),w]),I.setAttribute("aria-label","".concat(f.annotationLabels[b.type[T].replace("_fold","")].singular)),I.setAttribute("role","img"),I.appendChild(d.createTextNode(" ")),x.appendChild(I),x.appendChild(d.createTextNode(b.displayText[T])),x.appendChild(d.createElement("br")),C[b.type[T].replace("_fold","")].push(x)}var R=this.getElement();d.removeChildren(R),C.error.forEach(function(O){return R.appendChild(O)}),C.security.forEach(function(O){return R.appendChild(O)}),C.warning.forEach(function(O){return R.appendChild(O)}),C.info.forEach(function(O){return R.appendChild(O)}),C.hint.forEach(function(O){return R.appendChild(O)}),R.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,D,E=[],b=["error","security","warning","info","hint"];try{for(var g=h(b),S=g.next();!S.done;S=g.next()){var M=S.value;if(m[M].length){var _=m[M].length===1?f.annotationLabels[M].singular:f.annotationLabels[M].plural;E.push("".concat(m[M].length," ").concat(_))}}}catch(T){y={error:T}}finally{try{S&&!S.done&&(D=g.return)&&D.call(g)}finally{if(y)throw y.error}}return E.join(", ")},f}(p);u.GutterTooltip=a}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(i,u,v){var o=i("../lib/event"),h=i("../lib/useragent"),d=function(){function s(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 s.prototype.stopPropagation=function(){o.stopPropagation(this.domEvent),this.propagationStopped=!0},s.prototype.preventDefault=function(){o.preventDefault(this.domEvent),this.defaultPrevented=!0},s.prototype.stop=function(){this.stopPropagation(),this.preventDefault()},s.prototype.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},s.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},s.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},s.prototype.getButton=function(){return o.getButton(this.domEvent)},s.prototype.getShiftKey=function(){return this.domEvent.shiftKey},s.prototype.getAccelKey=function(){return h.isMac?this.domEvent.metaKey:this.domEvent.ctrlKey},s}();u.MouseEvent=d}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(i,u,v){var o=i("../lib/dom"),h=i("../lib/event"),d=i("../lib/useragent"),s=200,p=200,e=5;function t(l){var a=l.editor,c=o.createElement("div");c.style.cssText="top:-100px;position:absolute;z-index:2147483647;opacity:0.5",c.textContent=" ";var f=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];f.forEach(function(W){l[W]=this[W]},this),a.on("mousedown",this.onMouseDown.bind(l));var m=a.container,y,D,E,b,g,S,M=0,_,T,F,A,$;this.onDragStart=function(W){if(this.cancelDrag||!m.draggable){var H=this;return setTimeout(function(){H.startSelect(),H.captureMouse(W)},0),W.preventDefault()}g=a.getSelectionRange();var U=W.dataTransfer;U.effectAllowed=a.getReadOnly()?"copy":"copyMove",a.container.appendChild(c),U.setDragImage&&U.setDragImage(c,0,0),setTimeout(function(){a.container.removeChild(c)}),U.clearData(),U.setData("Text",a.session.getTextRange()),T=!0,this.setState("drag")},this.onDragEnd=function(W){if(m.draggable=!1,T=!1,this.setState(null),!a.getReadOnly()){var H=W.dataTransfer.dropEffect;!_&&H=="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 D=W.clientX,E=W.clientY,y||I(),M++,W.dataTransfer.dropEffect=_=V(W),h.preventDefault(W)},this.onDragOver=function(W){if(!(a.getReadOnly()||!B(W.dataTransfer)))return D=W.clientX,E=W.clientY,y||(I(),M++),O!==null&&(O=null),W.dataTransfer.dropEffect=_=V(W),h.preventDefault(W)},this.onDragLeave=function(W){if(M--,M<=0&&y)return R(),_=null,h.preventDefault(W)},this.onDrop=function(W){if(S){var H=W.dataTransfer;if(T)switch(_){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=H.getData("Text");g={start:S,end:a.session.insert(S,U)},a.focus(),_=null}return R(),h.preventDefault(W)}},h.addListener(m,"dragstart",this.onDragStart.bind(l),a),h.addListener(m,"dragend",this.onDragEnd.bind(l),a),h.addListener(m,"dragenter",this.onDragEnter.bind(l),a),h.addListener(m,"dragover",this.onDragOver.bind(l),a),h.addListener(m,"dragleave",this.onDragLeave.bind(l),a),h.addListener(m,"drop",this.onDrop.bind(l),a);function C(W,H){var U=Date.now(),G=!H||W.row!=H.row,Y=!H||W.column!=H.column;if(!A||G||Y)a.moveCursorToPosition(W),A=U,$={x:D,y:E};else{var Q=r($.x,$.y,D,E);Q>e?A=null:U-A>=p&&(a.renderer.scrollCursorIntoView(),A=null)}}function w(W,H){var U=Date.now(),G=a.renderer.layerConfig.lineHeight,Y=a.renderer.layerConfig.characterWidth,Q=a.renderer.scroller.getBoundingClientRect(),ee={x:{left:D-Q.left,right:Q.right-D},y:{top:E-Q.top,bottom:Q.bottom-E}},ne=Math.min(ee.x.left,ee.x.right),se=Math.min(ee.y.top,ee.y.bottom),ge={row:W.row,column:W.column};ne/Y<=2&&(ge.column+=ee.x.left<ee.x.right?-3:2),se/G<=1&&(ge.row+=ee.y.top<ee.y.bottom?-1:1);var be=W.row!=ge.row,ke=W.column!=ge.column,Ce=!H||W.row!=H.row;be||ke&&!Ce?F?U-F>=s&&a.renderer.scrollCursorIntoView(ge):F=U:F=null}function x(){var W=S;S=a.renderer.screenToTextCoordinates(D,E),C(S,W),w(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),x(),b=setInterval(x,20),M=0,h.addListener(document,"mousemove",P)}function R(){clearInterval(b),a.session.removeMarker(y),y=null,a.selection.fromOrientedRange(g),a.isFocused()&&!T&&a.$resetCursorStyle(),g=null,S=null,M=0,F=null,A=null,h.removeListener(document,"mousemove",P)}var O=null;function P(){O==null&&(O=setTimeout(function(){O!=null&&y&&R()},20))}function B(W){var H=W.types;return!H||Array.prototype.some.call(H,function(U){return U=="text/plain"||U=="Text"})}function V(W){var H=["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&&H.indexOf(Y)>=0?Q="copy":U.indexOf(Y)>=0?Q="move":H.indexOf(Y)>=0&&(Q="copy"),Q}}(function(){this.dragWait=function(){var l=Date.now()-this.mousedownEvent.time;l>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var l=this.editor.container;l.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(l){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var l=this.editor,a=l.container;a.draggable=!0,l.renderer.$cursorLayer.setBlinking(!1),l.setStyle("ace_dragging");var c=d.isWin?"default":"move";l.renderer.setCursorStyle(c),this.setState("dragReady")},this.onMouseDrag=function(l){var a=this.editor.container;if(d.isIE&&this.state=="dragReady"){var c=r(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);c>3&&a.dragDrop()}if(this.state==="dragWait"){var c=r(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);c>0&&(a.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(l){if(this.$dragEnabled){this.mousedownEvent=l;var a=this.editor,c=l.inSelection(),f=l.getButton(),m=l.domEvent.detail||1;if(m===1&&f===0&&c){if(l.editor.inMultiSelectMode&&(l.getAccelKey()||l.getShiftKey()))return;this.mousedownEvent.time=Date.now();var y=l.domEvent.target||l.domEvent.srcElement;if("unselectable"in y&&(y.unselectable="on"),a.getDragDelay()){if(d.isWebKit){this.cancelDrag=!0;var D=a.container;D.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(l,this.onMouseDrag.bind(this)),l.defaultPrevented=!0}}}}).call(t.prototype);function r(l,a,c,f){return Math.sqrt(Math.pow(c-l,2)+Math.pow(f-a,2))}u.DragdropHandler=t}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(i,u,v){var o=i("./mouse_event").MouseEvent,h=i("../lib/event"),d=i("../lib/dom");u.addTouchListeners=function(s,p){var e="scroll",t,r,l,a,c,f,m=0,y,D=0,E=0,b=0,g,S;function M(){var C=window.navigator&&window.navigator.clipboard,w=!1,x=function(){var O=p.getCopyText(),P=p.session.getUndoManager().hasUndo();S.replaceChild(d.buildDom(w?["span",!O&&I("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],O&&I("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],O&&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(O){return p.commands.canExecute(O,p)},R=function(O){var P=O.target.getAttribute("action");if(P=="more"||!w)return w=!w,x();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",w=!1,P!="openCommandPalette"&&p.focus()};S=d.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(O){e="menu",O.stopPropagation(),O.preventDefault(),p.textInput.focus()},ontouchend:function(O){O.stopPropagation(),O.preventDefault(),R(O)},onclick:R},["span"],["span",{class:"ace_mobile-button",action:"more"},"..."]],p.container)}function _(){if(!p.getOption("enableMobileMenu")){S&&T();return}S||M();var C=p.selection.cursor,w=p.renderer.textToScreenCoordinates(C.row,C.column),x=p.renderer.textToScreenCoordinates(0,0).pageX,I=p.renderer.scrollLeft,R=p.container.getBoundingClientRect();S.style.top=w.pageY-R.top-3+"px",w.pageX-R.left<R.width-70?(S.style.left="",S.style.right="10px"):(S.style.right="",S.style.left=x+I-R.left+"px"),S.style.display="",S.firstChild.style.display="none",p.on("input",T)}function T(C){S&&(S.style.display="none"),p.off("input",T)}function F(){c=null,clearTimeout(c);var C=p.selection.getRange(),w=C.contains(y.row,y.column);(C.isEmpty()||!w)&&(p.selection.moveToPosition(y),p.selection.selectWord()),e="wait",_()}function A(){c=null,clearTimeout(c),p.selection.moveToPosition(y);var C=D>=2?p.selection.getLineRange(y.row):p.session.getBracketRange(y);C&&!C.isEmpty()?p.selection.setRange(C):p.selection.selectWord(),e="wait"}h.addListener(s,"contextmenu",function(C){if(g){var w=p.textInput.getElement();w.focus()}},p),h.addListener(s,"touchstart",function(C){var w=C.touches;if(c||w.length>1){clearTimeout(c),c=null,l=-1,e="zoom";return}g=p.$mouseHandler.isMousePressed=!0;var x=p.renderer.layerConfig.lineHeight,I=p.renderer.layerConfig.lineHeight,R=C.timeStamp;a=R;var O=w[0],P=O.clientX,B=O.clientY;Math.abs(t-P)+Math.abs(r-B)>x&&(l=-1),t=C.clientX=P,r=C.clientY=B,E=b=0;var V=new o(C,p);if(y=V.getDocumentPosition(),R-l<500&&w.length==1&&!m)D++,C.preventDefault(),C.button=0,A();else{D=0;var W=p.selection.cursor,H=p.selection.isEmpty()?W:p.selection.anchor,U=p.renderer.$cursorLayer.getPixelPosition(W,!0),G=p.renderer.$cursorLayer.getPixelPosition(H,!0),Y=p.renderer.scroller.getBoundingClientRect(),Q=p.renderer.layerConfig.offset,ee=p.renderer.scrollLeft,ne=function(be,ke){return be=be/I,ke=ke/x-.75,be*be+ke*ke};if(C.clientX<Y.left){e="zoom";return}var se=ne(C.clientX-Y.left-U.left+ee,C.clientY-Y.top-U.top+Q),ge=ne(C.clientX-Y.left-G.left+ee,C.clientY-Y.top-G.top+Q);se<3.5&&ge<3.5&&(e=se>ge?"cursor":"anchor"),ge<3.5?e="anchor":se<3.5?e="cursor":e="scroll",c=setTimeout(F,450)}l=R},p),h.addListener(s,"touchend",function(C){g=p.$mouseHandler.isMousePressed=!1,f&&clearInterval(f),e=="zoom"?(e="",m=0):c?(p.selection.moveToPosition(y),m=0,_()):e=="scroll"?($(),T()):_(),clearTimeout(c),c=null},p),h.addListener(s,"touchmove",function(C){c&&(clearTimeout(c),c=null);var w=C.touches;if(!(w.length>1||e=="zoom")){var x=w[0],I=t-x.clientX,R=r-x.clientY;if(e=="wait")if(I*I+R*R>4)e="cursor";else return C.preventDefault();t=x.clientX,r=x.clientY,C.clientX=x.clientX,C.clientY=x.clientY;var O=C.timeStamp,P=O-a;if(a=O,e=="scroll"){var B=new o(C,p);B.speed=1,B.wheelX=I,B.wheelY=R,10*Math.abs(I)<Math.abs(R)&&(I=0),10*Math.abs(R)<Math.abs(I)&&(R=0),P!=0&&(E=I/P,b=R/P),p._emit("mousewheel",B),B.propagationStopped||(E=b=0)}else{var V=new o(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(b)<.01&&(b=0),m<20&&(E=.9*E),m<20&&(b=.9*b);var C=p.session.getScrollTop();p.renderer.scrollBy(10*E,10*b),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,u,v){var o=i("../lib/event"),h=i("../lib/useragent"),d=i("./default_handlers").DefaultHandlers,s=i("./default_gutter_handler").GutterHandler,p=i("./mouse_event").MouseEvent,e=i("./dragdrop_handler").DragdropHandler,t=i("./touch_handler").addTouchListeners,r=i("../config"),l=function(){function a(c){this.$dragDelay,this.$dragEnabled,this.$mouseMoved,this.mouseEvent,this.$focusTimeout;var f=this;this.editor=c,new d(this),new s(this),new e(this);var m=function(E){var b=!document.hasFocus||!document.hasFocus()||!c.isFocused()&&document.activeElement==(c.textInput&&c.textInput.getElement());b&&window.focus(),c.focus(),setTimeout(function(){c.isFocused()||c.focus()})},y=c.renderer.getMouseEventTarget();o.addListener(y,"click",this.onMouseEvent.bind(this,"click"),c),o.addListener(y,"mousemove",this.onMouseMove.bind(this,"mousemove"),c),o.addMultiMouseDownListener([y,c.renderer.scrollBarV&&c.renderer.scrollBarV.inner,c.renderer.scrollBarH&&c.renderer.scrollBarH.inner,c.textInput&&c.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent",c),o.addMouseWheelListener(c.container,this.onMouseWheel.bind(this,"mousewheel"),c),t(c.container,c);var D=c.renderer.$gutter;o.addListener(D,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),c),o.addListener(D,"click",this.onMouseEvent.bind(this,"gutterclick"),c),o.addListener(D,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),c),o.addListener(D,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),c),o.addListener(y,"mousedown",m,c),o.addListener(D,"mousedown",m,c),h.isIE&&c.renderer.scrollBarV&&(o.addListener(c.renderer.scrollBarV.element,"mousedown",m,c),o.addListener(c.renderer.scrollBarH.element,"mousedown",m,c)),c.on("mousemove",function(E){if(!(f.state||f.$dragDelay||!f.$dragEnabled)){var b=c.renderer.screenToTextCoordinates(E.x,E.y),g=c.session.selection.getRange(),S=c.renderer;!g.isEmpty()&&g.insideStart(b.row,b.column)?S.setCursorStyle("default"):S.setCursorStyle("")}},c)}return a.prototype.onMouseEvent=function(c,f){this.editor.session&&this.editor._emit(c,new p(f,this.editor))},a.prototype.onMouseMove=function(c,f){var m=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;!m||!m.length||this.editor._emit(c,new p(f,this.editor))},a.prototype.onMouseWheel=function(c,f){var m=new p(f,this.editor);m.speed=this.$scrollSpeed*2,m.wheelX=f.wheelX,m.wheelY=f.wheelY,this.editor._emit(c,m)},a.prototype.setState=function(c){this.state=c},a.prototype.captureMouse=function(c,f){this.x=c.x,this.y=c.y,this.isMousePressed=!0;var m=this.editor,y=this.editor.renderer;y.$isMousePressed=!0;var D=this,E=!0,b=function(T){if(T){if(h.isWebKit&&!T.which&&D.releaseMouse)return D.releaseMouse();D.x=T.clientX,D.y=T.clientY,f&&f(T),D.mouseEvent=new p(T,D.editor),D.$mouseMoved=!0}},g=function(T){m.off("beforeEndOperation",_),E=!1,m.session&&S(),D[D.state+"End"]&&D[D.state+"End"](T),D.state="",D.isMousePressed=y.$isMousePressed=!1,y.$keepTextAreaAtCursor&&y.$moveTextAreaToCursor(),D.$onCaptureMouseMove=D.releaseMouse=null,T&&D.onMouseEvent("mouseup",T),m.endOperation()},S=function(){D[D.state]&&D[D.state](),D.$mouseMoved=!1},M=function(){E&&(S(),o.nextFrame(M))};if(h.isOldIE&&c.domEvent.type=="dblclick")return setTimeout(function(){g(c)});var _=function(T){D.releaseMouse&&m.curOp.command.name&&m.curOp.selectionChanged&&(D[D.state+"End"]&&D[D.state+"End"](),D.state="",D.releaseMouse())};m.on("beforeEndOperation",_),m.startOperation({command:{name:"mouse"}}),D.$onCaptureMouseMove=b,D.releaseMouse=o.capture(this.editor.container,b,g),M()},a.prototype.cancelContextMenu=function(){var c=function(f){f&&f.domEvent&&f.domEvent.type!="contextmenu"||(this.editor.off("nativecontextmenu",c),f&&f.domEvent&&o.stopEvent(f.domEvent))}.bind(this);setTimeout(c,10),this.editor.on("nativecontextmenu",c)},a.prototype.destroy=function(){this.releaseMouse&&this.releaseMouse()},a}();l.prototype.releaseMouse=null,r.defineOptions(l.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:h.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),u.MouseHandler=l}),ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(i,u,v){var o=i("../lib/dom"),h=function(){function d(s){s.on("click",function(p){var e=p.getDocumentPosition(),t=s.session,r=t.getFoldAt(e.row,e.column,1);r&&(p.getAccelKey()?t.removeFold(r):t.expandFold(r),p.stop());var l=p.domEvent&&p.domEvent.target;l&&o.hasCssClass(l,"ace_inline_button")&&o.hasCssClass(l,"ace_toggle_wrap")&&(t.setOption("wrap",!t.getUseWrapMode()),s.renderer.scrollCursorIntoView())}),s.on("gutterclick",function(p){var e=s.renderer.$gutterLayer.getRegion(p);if(e=="foldWidgets"){var t=p.getDocumentPosition().row,r=s.session;r.foldWidgets&&r.foldWidgets[t]&&s.session.onFoldWidgetClick(t,p),s.isFocused()||s.focus(),p.stop()}}),s.on("gutterdblclick",function(p){var e=s.renderer.$gutterLayer.getRegion(p);if(e=="foldWidgets"){var t=p.getDocumentPosition().row,r=s.session,l=r.getParentFoldRangeData(t,!0),a=l.range||l.firstRange;if(a){t=a.start.row;var c=r.getFoldAt(t,r.getLine(t).length,1);c?r.removeFold(c):(r.addFold("...",a),s.renderer.scrollCursorIntoView({row:a.start.row,column:0}))}p.stop()}})}return d}();u.FoldHandler=h}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(i,u,v){var o=i("../lib/keys"),h=i("../lib/event"),d=function(){function s(p){this.$editor=p,this.$data={editor:p},this.$handlers=[],this.setDefaultHandler(p.commands)}return s.prototype.setDefaultHandler=function(p){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=p,this.addKeyboardHandler(p,0)},s.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)}},s.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)}},s.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)},s.prototype.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},s.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(" ")},s.prototype.$callKeyboardHandlers=function(p,e,t,r){for(var l,a=!1,c=this.$editor.commands,f=this.$handlers.length;f--&&(l=this.$handlers[f].handleKeyboard(this.$data,p,e,t,r),!(!(!l||!l.command)&&(l.command=="null"?a=!0:a=c.exec(l.command,this.$editor,l.args,r),a&&r&&p!=-1&&l.passEvent!=!0&&l.command.passEvent!=!0&&h.stopEvent(r),a))););return!a&&p==-1&&(l={command:"insertstring"},a=c.exec("insertstring",this.$editor,e)),a&&this.$editor._signal&&this.$editor._signal("keyboardActivity",l),a},s.prototype.onCommandKey=function(p,e,t){var r=o.keyCodeToString(t);return this.$callKeyboardHandlers(e,r,t,p)},s.prototype.onTextInput=function(p){return this.$callKeyboardHandlers(-1,p)},s}();u.KeyBinding=d}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(i,u,v){var o=0,h=0,d=!1,s=!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,l=1,a=0,c=1,f=2,m=3,y=4,D=5,E=6,b=7,g=8,S=9,M=10,_=11,T=12,F=13,A=14,$=15,C=16,w=17,x=18,I=[x,x,x,x,x,x,x,x,x,E,D,E,g,D,x,x,x,x,x,x,x,x,x,x,x,x,x,x,D,D,D,E,g,y,y,_,_,_,y,y,y,y,y,M,S,M,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,x,x,x,x,x,x,D,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,S,y,_,_,_,_,y,y,y,y,a,y,y,x,y,y,_,_,f,f,y,a,y,y,y,f,a,y,y,y,y,y],R=[g,g,g,g,g,g,g,g,g,g,g,x,x,x,a,c,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,D,F,A,$,C,w,S,_,_,_,_,_,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 O(W,H,U,G){var Y=o?t:e,Q=null,ee=null,ne=null,se=0,ge=null,be=null,ke=-1,Ce=null,Ne=null,Xe=[];if(!G)for(Ce=0,G=[];Ce<U;Ce++)G[Ce]=V(W[Ce]);for(h=o,d=!1,s=!1,p=!1,Ne=0;Ne<U;Ne++){if(Q=se,Xe[Ne]=ee=B(W,G,Xe,Ne),se=Y[Q][ee],ge=se&240,se&=15,H[Ne]=ne=Y[se][5],ge>0)if(ge==16){for(Ce=ke;Ce<Ne;Ce++)H[Ce]=1;ke=-1}else ke=-1;if(be=Y[se][6],be)ke==-1&&(ke=Ne);else if(ke>-1){for(Ce=ke;Ce<Ne;Ce++)H[Ce]=ne;ke=-1}G[Ne]==D&&(H[Ne]=0),h|=ne}if(p){for(Ce=0;Ce<U;Ce++)if(G[Ce]==E){H[Ce]=o;for(var Ze=Ce-1;Ze>=0&&G[Ze]==g;Ze--)H[Ze]=o}}}function P(W,H,U){if(!(h<W)){if(W==1&&o==l&&!s){U.reverse();return}for(var G=U.length,Y=0,Q,ee,ne,se;Y<G;){if(H[Y]>=W){for(Q=Y+1;Q<G&&H[Q]>=W;)Q++;for(ee=Y,ne=Q-1;ee<ne;ee++,ne--)se=U[ee],U[ee]=U[ne],U[ne]=se;Y=Q}Y++}}}function B(W,H,U,G){var Y=H[G],Q,ee,ne,se;switch(Y){case a:case c:d=!1;case y:case m:return Y;case f:return d?m:f;case b:return d=!0,c;case g:return y;case S:return G<1||G+1>=H.length||(Q=U[G-1])!=f&&Q!=m||(ee=H[G+1])!=f&&ee!=m?y:(d&&(ee=m),ee==Q?ee:y);case M:return Q=G>0?U[G-1]:D,Q==f&&G+1<H.length&&H[G+1]==f?f:y;case _:if(G>0&&U[G-1]==f)return f;if(d)return y;for(se=G+1,ne=H.length;se<ne&&H[se]==_;)se++;return se<ne&&H[se]==f?f:y;case T:for(ne=H.length,se=G+1;se<ne&&H[se]==T;)se++;if(se<ne){var ge=W[G],be=ge>=1425&&ge<=2303||ge==64286;if(Q=H[se],be&&(Q==c||Q==b))return c}return G<1||(Q=H[G-1])==D?y:U[G-1];case D:return d=!1,s=!0,o;case E:return p=!0,y;case F:case A:case C:case w:case $:d=!1;case x:return y}}function V(W){var H=W.charCodeAt(0),U=H>>8;return U==0?H>191?a:I[H]:U==5?/[\u0591-\u05f4]/.test(W)?c:a:U==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(W)?T:/[\u0660-\u0669\u066b-\u066c]/.test(W)?m:H==1642?_:/[\u06f0-\u06f9]/.test(W)?f:b:U==32&&H<=8287?R[H&255]:U==254&&H>=65136?b:y}u.L=a,u.R=c,u.EN=f,u.ON_R=3,u.AN=4,u.R_H=5,u.B=6,u.RLE=7,u.DOT="·",u.doBidiReorder=function(W,H,U){if(W.length<2)return{};var G=W.split(""),Y=new Array(G.length),Q=new Array(G.length),ee=[];o=U?l:r,O(G,ee,G.length,H);for(var ne=0;ne<Y.length;Y[ne]=ne,ne++);P(2,ee,Y),P(1,ee,Y);for(var ne=0;ne<Y.length-1;ne++)H[ne]===m?ee[ne]=u.AN:ee[ne]===c&&(H[ne]>b&&H[ne]<F||H[ne]===y||H[ne]===x)?ee[ne]=u.ON_R:ne>0&&G[ne-1]==="ل"&&/\u0622|\u0623|\u0625|\u0627/.test(G[ne])&&(ee[ne-1]=ee[ne]=u.R_H,ne++);G[G.length-1]===u.DOT&&(ee[G.length-1]=u.B),G[0]===""&&(ee[0]=u.RLE);for(var ne=0;ne<Y.length;ne++)Q[ne]=ee[Y[ne]];return{logicalFromVisual:Y,bidiLevels:Q}},u.hasBidiCharacters=function(W,H){for(var U=!1,G=0;G<W.length;G++)H[G]=V(W.charAt(G)),!U&&(H[G]==c||H[G]==b||H[G]==m)&&(U=!0);return U},u.getVisualFromLogicalIdx=function(W,H){for(var U=0;U<H.logicalFromVisual.length;U++)if(H.logicalFromVisual[U]==W)return U;return 0}}),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(i,u,v){var o=i("./lib/bidiutil"),h=i("./lib/lang"),d=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/,s=function(){function p(e){this.session=e,this.bidiMap={},this.currentRow=null,this.bidiUtil=o,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,l=this.session.$getRowCacheIndex(t,this.currentRow);this.currentRow-e>0&&(r=this.session.$getRowCacheIndex(t,this.currentRow-e-1),r===l);)l=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,l=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[o.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?l:o.DOT))}else this.line+=this.showInvisibles?l:o.DOT;var c=this.session,f=0,m;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(y,D){return y===" "||c.isFullWidth(y.charCodeAt(0))?(m=y===" "?c.getScreenTabSize(D+f):2,f+=m-1,h.stringRepeat(o.DOT,m)):y}),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==o.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=[];o.hasBidiCharacters(this.line,e)||this.isRtlDir?this.bidiMap=o.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[o.L]=this.charWidths[o.EN]=this.charWidths[o.ON_R]=t,this.charWidths[o.R]=this.charWidths[o.AN]=r,this.charWidths[o.R_H]=r*.45,this.charWidths[o.B]=this.charWidths[o.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(),l=e.selection.getSelectionAnchor().row;l<=r.row;l++)!t&&e.session.getLine(l).charAt(0)===e.session.$bidiHandler.RLE?e.session.doc.removeInLine(l,0,1):t&&e.session.getLine(l).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:l},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,l=o.getVisualFromLogicalIdx(r,this.bidiMap),a=this.bidiMap.bidiLevels,c=0;!this.session.getOverwrite()&&e<=t&&a[l]%2!==0&&l++;for(var f=0;f<l;f++)c+=this.charWidths[a[f]];return!this.session.getOverwrite()&&e>t&&a[l]%2===0&&(c+=this.charWidths[a[l]]),this.wrapIndent&&(c+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(c+=this.rtlLineOffset),c},p.prototype.getSelections=function(e,t){var r=this.bidiMap,l=r.bidiLevels,a,c=[],f=0,m=Math.min(e,t)-this.wrapIndent,y=Math.max(e,t)-this.wrapIndent,D=!1,E=!1,b=0;this.wrapIndent&&(f+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var g,S=0;S<l.length;S++)g=r.logicalFromVisual[S],a=l[S],D=g>=m&&g<y,D&&!E?b=f:!D&&E&&c.push({left:b,width:f-b}),f+=this.charWidths[a],E=D;if(D&&S===l.length&&c.push({left:b,width:f-b}),this.isRtlDir)for(var M=0;M<c.length;M++)c[M].left+=this.rtlLineOffset;return c},p.prototype.offsetToCol=function(r){this.isRtlDir&&(r-=this.rtlLineOffset);var t=0,r=Math.max(r,0),l=0,a=0,c=this.bidiMap.bidiLevels,f=this.charWidths[c[a]];for(this.wrapIndent&&(r-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);r>l+f/2;){if(l+=f,a===c.length-1){f=0;break}f=this.charWidths[c[++a]]}return a>0&&c[a-1]%2!==0&&c[a]%2===0?(r<l&&a--,t=this.bidiMap.logicalFromVisual[a]):a>0&&c[a-1]%2===0&&c[a]%2!==0?t=1+(r>l?this.bidiMap.logicalFromVisual[a]:this.bidiMap.logicalFromVisual[a-1]):this.isRtlDir&&a===c.length-1&&f===0&&c[a-1]%2===0||!this.isRtlDir&&a===0&&c[a]%2!==0?t=1+this.bidiMap.logicalFromVisual[a]:(a>0&&c[a-1]%2!==0&&f!==0&&a--,t=this.bidiMap.logicalFromVisual[a]),t===0&&this.isRtlDir&&t++,t+this.wrapIndent},p}();u.BidiHandler=s}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(i,u,v){var o=i("./lib/oop"),h=i("./lib/lang"),d=i("./lib/event_emitter").EventEmitter,s=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(l){r.$cursorChanged=!0,r.$silent||r._emit("changeCursor"),!r.$isEmpty&&!r.$silent&&r._emit("changeSelection"),!r.$keepDesiredColumnOnChange&&l.old.column!=l.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?s.fromPoints(r,r):this.isBackwards()?s.fromPoints(r,t):s.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 l=r?t.end:t.start,a=r?t.start:t.end;this.$setSelection(l.row,l.column,a.row,a.column)},e.prototype.$setSelection=function(t,r,l,a){if(!this.$silent){var c=this.$isEmpty,f=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(t,r),this.cursor.setPosition(l,a),this.$isEmpty=!s.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||c!=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 l=t||this.lead;t=l.row,r=l.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 l=typeof t=="number"?t:this.lead.row,a,c=this.session.getFoldLine(l);return c?(l=c.start.row,a=c.end.row):a=l,r===!0?new s(l,0,a,this.session.getLine(a).length):new s(l,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,l){var a=t.column,c=t.column+r;return l<0&&(a=t.column-r,c=t.column),this.session.isTabStop(t)&&this.doc.getLine(t.row).slice(a,c).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 l=this.session.getTabSize();this.wouldMoveIntoSoftTab(t,l,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-l):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 l=this.session.getTabSize(),t=this.lead;this.wouldMoveIntoSoftTab(t,l,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,l):this.moveCursorBy(0,1)}},e.prototype.moveCursorLineStart=function(){var t=this.lead.row,r=this.lead.column,l=this.session.documentToScreenRow(t,r),a=this.session.screenToDocumentPosition(l,0),c=this.session.getDisplayLine(t,null,a.row,a.column),f=c.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 l=this.session.getLine(r.row);if(r.column==l.length){var a=l.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,l=this.doc.getLine(t),a=l.substring(r);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var c=this.session.getFoldAt(t,r,1);if(c){this.moveCursorTo(c.end.row,c.end.column);return}if(this.session.nonTokenRe.exec(a)&&(r+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,a=l.substring(r)),r>=l.length){this.moveCursorTo(t,l.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,l;if(l=this.session.getFoldAt(t,r,-1)){this.moveCursorTo(l.start.row,l.start.column);return}var a=this.session.getFoldStringAt(t,r,-1);a==null&&(a=this.doc.getLine(t).substring(0,r));var c=h.stringReverse(a);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(c)&&(r-=this.session.nonTokenRe.lastIndex,c=c.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(c)&&(r-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,r)},e.prototype.$shortWordEndIndex=function(t){var r=0,l,a=/\s/,c=this.session.tokenRe;if(c.lastIndex=0,this.session.tokenRe.exec(t))r=this.session.tokenRe.lastIndex;else{for(;(l=t[r])&&a.test(l);)r++;if(r<1){for(c.lastIndex=0;(l=t[r])&&!c.test(l);)if(c.lastIndex=0,r++,a.test(l))if(r>2){r--;break}else{for(;(l=t[r])&&a.test(l);)r++;if(r>2)break}}}return c.lastIndex=0,r},e.prototype.moveCursorShortWordRight=function(){var t=this.lead.row,r=this.lead.column,l=this.doc.getLine(t),a=l.substring(r),c=this.session.getFoldAt(t,r,1);if(c)return this.moveCursorTo(c.end.row,c.end.column);if(r==l.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,l;if(l=this.session.getFoldAt(t,r,-1))return this.moveCursorTo(l.start.row,l.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 c=h.stringReverse(a),f=this.$shortWordEndIndex(c);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 l=this.session.documentToScreenPosition(this.lead.row,this.lead.column),a;if(r===0&&(t!==0&&(this.session.$bidiHandler.isBidiRow(l.row,this.lead.row)?(a=this.session.$bidiHandler.getPosLeft(l.column),l.column=Math.round(a/this.session.$bidiHandler.charWidths[0])):a=l.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?l.column=this.$desiredColumn:this.$desiredColumn=l.column),t!=0&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var c=this.session.lineWidgets[this.lead.row];t<0?t-=c.rowsAbove||0:t>0&&(t+=c.rowCount-(c.rowsAbove||0))}var f=this.session.screenToDocumentPosition(l.row+t,l.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,l){var a=this.session.getFoldAt(t,r,1);a&&(t=a.start.row,r=a.start.column),this.$keepDesiredColumnOnChange=!0;var c=this.session.getLine(t);/[\uDC00-\uDFFF]/.test(c.charAt(r))&&c.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,l||(this.$desiredColumn=null)},e.prototype.moveCursorToScreen=function(t,r,l){var a=this.session.screenToDocumentPosition(t,r);this.moveCursorTo(a.row,a.column,l)},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 l=this.getCursor();return s.fromPoints(r,l)}catch{return s.fromPoints(r,r)}finally{this.moveCursorToPosition(r)}},e.prototype.toJSON=function(){if(this.rangeCount)var t=this.ranges.map(function(r){var l=r.clone();return l.isBackwards=r.cursor==r.start,l});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 l=s.fromPoints(t[r].start,t[r].end);t[r].isBackwards&&(l.cursor=l.start),this.addRange(l,!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,o.implement(p.prototype,d),u.Selection=p}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(i,u,v){var o=i("./lib/report_error").reportError,h=2e3,d=function(){function s(p){this.splitRegex,this.states=p,this.regExps={},this.matchMappings={};for(var e in this.states){for(var t=this.states[e],r=[],l=0,a=this.matchMappings[e]={defaultToken:"text"},c="g",f=[],m=0;m<t.length;m++){var y=t[m];if(y.defaultToken&&(a.defaultToken=y.defaultToken),y.caseInsensitive&&c.indexOf("i")===-1&&(c+="i"),y.unicode&&c.indexOf("u")===-1&&(c+="u"),y.regex!=null){y.regex instanceof RegExp&&(y.regex=y.regex.toString().slice(1,-1));var D=y.regex,E=new RegExp("(?:("+D+")|(.))").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)?D=y.regex.replace(/\\([0-9]+)/g,function(b,g){return"\\"+(parseInt(g,10)+l+1)}):(E=1,D=this.removeCapturingGroups(y.regex)),!y.splitRegex&&typeof y.token!="string"&&f.push(y)),a[l]=m,l+=E,r.push(D),y.onMatch||(y.onMatch=null)}}r.length||(a[0]=0,r.push("$")),f.forEach(function(b){b.splitRegex=this.createSplitterRegexp(b.regex,c)},this),this.regExps[e]=new RegExp("("+r.join(")|(")+")|($)",c)}}return s.prototype.$setMaxTokenCount=function(p){h=p|0},s.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=[],l=0,a=t.length;l<a;l++)e[l]&&(r[r.length]={type:t[l],value:e[l]});return r},s.prototype.$arrayTokens=function(p){if(!p)return[];var e=this.splitRegex.exec(p);if(!e)return"text";for(var t=[],r=this.tokenArray,l=0,a=r.length;l<a;l++)e[l+1]&&(t[t.length]={type:r[l],value:e[l+1]});return t},s.prototype.removeCapturingGroups=function(p){var e=p.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g,function(t,r){return r?"(?:":t});return e},s.prototype.createSplitterRegexp=function(p,e){if(p.indexOf("(?=")!=-1){var t=0,r=!1,l={};p.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(a,c,f,m,y,D){return r?r=y!="]":y?r=!0:m?(t==l.stack&&(l.end=D+1,l.stack=-1),t--):f&&(t++,f.length!=1&&(l.stack=t,l.start=D)),a}),l.end!=null&&/^\)*$/.test(p.substr(l.end))&&(p=p.substring(0,l.start)+p.substr(l.end))}return p.charAt(0)!="^"&&(p="^"+p),p.charAt(p.length-1)!="$"&&(p+="$"),new RegExp(p,(e||"").replace("g",""))},s.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",l=this.states[r];l||(r="start",l=this.states[r]);var a=this.matchMappings[r],c=this.regExps[r];c.lastIndex=0;for(var f,m=[],y=0,D=0,E={type:null,value:""};f=c.exec(p);){var b=a.defaultToken,g=null,S=f[0],M=c.lastIndex;if(M-S.length>y){var _=p.substring(y,M-S.length);E.type==b?E.value+=_:(E.type&&m.push(E),E={type:b,value:_})}for(var T=0;T<f.length-2;T++)if(f[T+1]!==void 0){g=l[a[T]],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),l=this.states[r],l||(this.reportError("state doesn't exist",r),r="start",l=this.states[r]),a=this.matchMappings[r],y=M,c=this.regExps[r],c.lastIndex=M),g.consumeLineEnd&&(y=M);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 T=0;T<b.length;T++)m.push(b[T])}}if(y==p.length)break;if(y=M,D++>h){for(D>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}},s}();d.prototype.reportError=o,u.Tokenizer=d}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(i,u,v){var o=i("../lib/deep_copy").deepCopy,h;h=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],l=0;l<r.length;l++){var a=r[l];(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,l){var a=typeof p=="function"?new p().getRules():p;if(r)for(var c=0;c<r.length;c++)r[c]=e+r[c];else{r=[];for(var f in a)r.push(e+f)}if(this.addRules(a,e),t)for(var m=Array.prototype[l?"push":"unshift"],c=0;c<r.length;c++)m.apply(this.$rules[r[c]],o(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},s=function(p,e){return e.shift(),e.shift()||"start"};this.normalizeRules=function(){var p=0,e=this.$rules;function t(r){var l=e[r];l.processed=!0;for(var a=0;a<l.length;a++){var c=l[a],f=null;Array.isArray(c)&&(f=c,c={}),!c.regex&&c.start&&(c.regex=c.start,c.next||(c.next=[]),c.next.push({defaultToken:c.token},{token:c.token+".end",regex:c.end||c.start,next:"pop"}),c.token=c.token+".start",c.push=!0);var m=c.next||c.push;if(m&&Array.isArray(m)){var y=c.stateName;y||(y=c.token,typeof y!="string"&&(y=y[0]||""),e[y]&&(y+=p++)),e[y]=m,c.next=y,t(y)}else m=="pop"&&(c.next=s);if(c.push&&(c.nextState=c.next||c.push,c.next=d,delete c.push),c.rules)for(var D in c.rules)e[D]?e[D].push&&e[D].push.apply(e[D],c.rules[D]):e[D]=c.rules[D];var E=typeof c=="string"?c:c.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);c.noEscape&&(b=b.filter(function(g){return!g.next})),l.splice.apply(l,b),a--}c.keywordMap&&(c.token=this.createKeywordMapper(c.keywordMap,c.defaultToken||"text",c.caseInsensitive),delete c.defaultToken)}}Object.keys(e).forEach(t,this)},this.createKeywordMapper=function(p,e,t,r){var l=Object.create(null);return this.$keywordList=[],Object.keys(p).forEach(function(a){for(var c=p[a],f=c.split(r||"|"),m=f.length;m--;){var y=f[m];this.$keywordList.push(y),t&&(y=y.toLowerCase()),l[y]=a}},this),p=null,t?function(a){return l[a.toLowerCase()]||e}:function(a){return l[a]||e}},this.getKeywords=function(){return this.$keywords}}.call(h.prototype),u.TextHighlightRules=h}),ace.define("ace/mode/behaviour",["require","exports","module"],function(i,u,v){var o;o=function(){this.$behaviours={}},function(){this.add=function(h,d,s){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[h]:this.$behaviours[h]={}}this.$behaviours[h][d]=s},this.addBehaviours=function(h){for(var d in h)for(var s in h[d])this.add(d,s,h[d][s])},this.remove=function(h){this.$behaviours&&this.$behaviours[h]&&delete this.$behaviours[h]},this.inherit=function(h,d){if(typeof h=="function")var s=new h().getBehaviours(d);else var s=h.getBehaviours(d);this.addBehaviours(s)},this.getBehaviours=function(h){if(h){for(var d={},s=0;s<h.length;s++)this.$behaviours[h[s]]&&(d[h[s]]=this.$behaviours[h[s]]);return d}else return this.$behaviours}}.call(o.prototype),u.Behaviour=o}),ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(i,u,v){var o=i("./range").Range,h=function(){function d(s,p,e){this.$session=s,this.$row=p,this.$rowTokens=s.getTokens(p);var t=s.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 s;this.$tokenIndex>=this.$rowTokens.length;){if(this.$row+=1,s||(s=this.$session.getLength()),this.$row>=s)return this.$row=s-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 s=this.$rowTokens,p=this.$tokenIndex,e=s[p].start;if(e!==void 0)return e;for(e=0;p>0;)p-=1,e+=s[p].value.length;return e},d.prototype.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},d.prototype.getCurrentTokenRange=function(){var s=this.$rowTokens[this.$tokenIndex],p=this.getCurrentTokenColumn();return new o(this.$row,p,this.$row,p+s.value.length)},d}();u.TokenIterator=h}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(i,u,v){var o=i("../../lib/oop"),h=i("../behaviour").Behaviour,d=i("../../token_iterator").TokenIterator,s=i("../../lib/lang"),p=["text","paren.rparen","rparen","paren","punctuation.operator"],e=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],t,r={},l={'"':'"',"'":"'"},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:""}},c=function(m,y,D,E){var b=m.end.row-m.start.row;return{text:D+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,D,E,b,g){var S=E.getCursorPosition(),M=b.doc.getLine(S.row);if(g=="{"){a(E);var _=E.getSelectionRange(),T=b.doc.getTextRange(_),F=b.getTokenAt(S.row,S.column);if(T!==""&&T!=="{"&&E.getWrapBehavioursEnabled())return c(_,T,"{","}");if(F&&/(?:string)\.quasi|\.xml/.test(F.type)){var A=[/tag\-(?:open|name)/,/attribute\-name/];return A.some(function(O){return O.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(M[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 $=M.substring(S.column,S.column+1);if($=="}"){var C=b.$findOpeningBracket("}",{column:S.column+1,row:S.row});if(C!==null&&f.isAutoInsertedClosing(S,M,g))return f.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else if(g==`
|
|
192
|
+
`).length>2?ve=c.down:we>I&&w[we-1]==" "?(ve=c.right,Fe=f.option):(we>I||we==I&&I!=x&&xe==we)&&(ve=c.right),xe!==we&&(Fe|=f.shift),ve){var st=re.onCommandKey({},Fe,ve);if(!st&&re.commands){ve=c.keyCodeToString(ve);var Yt=re.commands.findKeyCommand(Fe,ve);Yt&&re.execCommand(Yt)}x=xe,I=we,H("")}}};document.addEventListener("selectionchange",Ee),re.on("destroy",function(){document.removeEventListener("selectionchange",Ee)})}this.destroy=function(){S.parentElement&&S.parentElement.removeChild(S)}},u.TextInput=E,u.$setUserAgentForTests=function(b,g){D=b,m=g}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(i,u,v){var s=i("../lib/useragent"),h=0,d=550,o=function(){function t(r){r.$clickSelection=null;var l=r.editor;l.setDefaultHandler("mousedown",this.onMouseDown.bind(r)),l.setDefaultHandler("dblclick",this.onDoubleClick.bind(r)),l.setDefaultHandler("tripleclick",this.onTripleClick.bind(r)),l.setDefaultHandler("quadclick",this.onQuadClick.bind(r)),l.setDefaultHandler("mousewheel",this.onMouseWheel.bind(r));var a=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];a.forEach(function(c){r[c]=this[c]},this),r.selectByLines=this.extendSelectionBy.bind(r,"getLineRange"),r.selectByWords=this.extendSelectionBy.bind(r,"getWordRange")}return t.prototype.onMouseDown=function(r){var l=r.inSelection(),a=r.getDocumentPosition();this.mousedownEvent=r;var c=this.editor,f=r.getButton();if(f!==0){var m=c.getSelectionRange(),y=m.isEmpty();(y||f==1)&&c.selection.moveToPosition(a),f==2&&(c.textInput.onContextMenu(r.domEvent),s.isMozilla||r.preventDefault());return}if(this.mousedownEvent.time=Date.now(),l&&!c.isFocused()&&(c.focus(),this.$focusTimeout&&!this.$clickSelection&&!c.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,l){r=r||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var a=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?a.selection.selectToPosition(r):l||a.selection.moveToPosition(r),l||this.select(),a.setStyle("ace_selecting"),this.setState("select"))},t.prototype.select=function(){var r,l=this.editor,a=l.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var c=this.$clickSelection.comparePoint(a);if(c==-1)r=this.$clickSelection.end;else if(c==1)r=this.$clickSelection.start;else{var f=e(this.$clickSelection,a);a=f.cursor,r=f.anchor}l.selection.setSelectionAnchor(r.row,r.column)}l.selection.selectToPosition(a),l.renderer.scrollCursorIntoView()},t.prototype.extendSelectionBy=function(r){var l,a=this.editor,c=a.renderer.screenToTextCoordinates(this.x,this.y),f=a.selection[r](c.row,c.column);if(this.$clickSelection){var m=this.$clickSelection.comparePoint(f.start),y=this.$clickSelection.comparePoint(f.end);if(m==-1&&y<=0)l=this.$clickSelection.end,(f.end.row!=c.row||f.end.column!=c.column)&&(c=f.start);else if(y==1&&m>=0)l=this.$clickSelection.start,(f.start.row!=c.row||f.start.column!=c.column)&&(c=f.end);else if(m==-1&&y==1)c=f.end,l=f.start;else{var D=e(this.$clickSelection,c);c=D.cursor,l=D.anchor}a.selection.setSelectionAnchor(l.row,l.column)}a.selection.selectToPosition(c),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),l=Date.now();(r>h||l-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},t.prototype.onDoubleClick=function(r){var l=r.getDocumentPosition(),a=this.editor,c=a.session,f=c.getBracketRange(l);f?(f.isEmpty()&&(f.start.column--,f.end.column++),this.setState("select")):(f=a.selection.getWordRange(l.row,l.column),this.setState("selectByWords")),this.$clickSelection=f,this.select()},t.prototype.onTripleClick=function(r){var l=r.getDocumentPosition(),a=this.editor;this.setState("selectByLines");var c=a.getSelectionRange();c.isMultiLine()&&c.contains(l.row,l.column)?(this.$clickSelection=a.selection.getLineRange(c.start.row),this.$clickSelection.end=a.selection.getLineRange(c.end.row).end):this.$clickSelection=a.selection.getLineRange(l.row),this.select()},t.prototype.onQuadClick=function(r){var l=this.editor;l.selectAll(),this.$clickSelection=l.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 l=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var a=this.$lastScroll,c=r.domEvent.timeStamp,f=c-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 D=Math.abs(m/y),E=!1;if(D>=1&&l.renderer.isScrollableBy(r.wheelX*r.speed,0)&&(E=!0),D<=1&&l.renderer.isScrollableBy(0,r.wheelY*r.speed)&&(E=!0),E)a.allowed=c;else if(c-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=c):a.allowed=0}if(a.t=c,a.vx=m,a.vy=y,E)return l.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,u.DefaultHandlers=o;function p(t,r,l,a){return Math.sqrt(Math.pow(l-t,2)+Math.pow(a-r,2))}function e(t,r){if(t.start.row==t.end.row)var l=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 l=r.column-4;else var l=2*r.row-t.start.row-t.end.row;return l<0?{cursor:t.start,anchor:t.end}:{cursor:t.end,anchor:t.start}}}),ace.define("ace/lib/scroll",["require","exports","module"],function(i,u,v){u.preventParentScroll=function(h){h.stopPropagation();var d=h.currentTarget,o=d.scrollHeight>d.clientHeight;o||h.preventDefault()}}),ace.define("ace/tooltip",["require","exports","module","ace/lib/dom","ace/lib/event","ace/range","ace/lib/scroll"],function(i,u,v){var s=this&&this.__extends||function(){var c=function(f,m){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,D){y.__proto__=D}||function(y,D){for(var E in D)Object.prototype.hasOwnProperty.call(D,E)&&(y[E]=D[E])},c(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");c(f,m);function y(){this.constructor=f}f.prototype=m===null?Object.create(m):(y.prototype=m.prototype,new y)}}(),h=this&&this.__values||function(c){var f=typeof Symbol=="function"&&Symbol.iterator,m=f&&c[f],y=0;if(m)return m.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&y>=c.length&&(c=void 0),{value:c&&c[y++],done:!c}}};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 c(f){this.isOpen=!1,this.$element=null,this.$parentNode=f}return c.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},c.prototype.getElement=function(){return this.$element||this.$init()},c.prototype.setText=function(f){this.getElement().textContent=f},c.prototype.setHtml=function(f){this.getElement().innerHTML=f},c.prototype.setPosition=function(f,m){this.getElement().style.left=f+"px",this.getElement().style.top=m+"px"},c.prototype.setClassName=function(f){d.addCssClass(this.getElement(),f)},c.prototype.setTheme=function(f){this.$element.className=e+" "+(f.isDark?"ace_dark ":"")+(f.cssClass||"")},c.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)},c.prototype.hide=function(f){this.isOpen&&(this.getElement().style.display="none",this.getElement().className=e,this.isOpen=!1)},c.prototype.getHeight=function(){return this.getElement().offsetHeight},c.prototype.getWidth=function(){return this.getElement().offsetWidth},c.prototype.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)},c}(),r=function(){function c(){this.popups=[]}return c.prototype.addPopup=function(f){this.popups.push(f),this.updatePopups()},c.prototype.removePopup=function(f){var m=this.popups.indexOf(f);m!==-1&&(this.popups.splice(m,1),this.updatePopups())},c.prototype.updatePopups=function(){var f,m,y,D;this.popups.sort(function(A,$){return $.priority-A.priority});var E=[];try{for(var b=h(this.popups),g=b.next();!g.done;g=b.next()){var S=g.value,M=!0;try{for(var _=(y=void 0,h(E)),T=_.next();!T.done;T=_.next()){var F=T.value;if(this.doPopupsOverlap(F,S)){M=!1;break}}}catch(A){y={error:A}}finally{try{T&&!T.done&&(D=_.return)&&D.call(_)}finally{if(y)throw y.error}}M?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}}},c.prototype.doPopupsOverlap=function(f,m){var y=f.getElement().getBoundingClientRect(),D=m.getElement().getBoundingClientRect();return y.left<D.right&&y.right>D.left&&y.top<D.bottom&&y.bottom>D.top},c}(),l=new r;u.popupManager=l,u.Tooltip=t;var a=function(c){s(f,c);function f(m){m===void 0&&(m=document.body);var y=c.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 D=y.getElement();return D.style.whiteSpace="pre-wrap",D.style.pointerEvents="auto",D.addEventListener("mouseout",y.onMouseOut),D.tabIndex=-1,D.addEventListener("blur",function(){D.contains(document.activeElement)||this.hide()}.bind(y)),D.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 D=y.$mouseHandler.isMousePressed;if(this.isOpen){var E=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(E.row,E.column)||D||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||D||(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,D=m.getDocumentPosition(),E=y.session.getLine(D.row);if(D.column==E.length){var b=y.renderer.pixelToScreenCoordinates(m.clientX,m.clientY),g=y.session.documentToScreenPosition(D.row,D.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,D,E){var b=10;if(!(E&&E!=this.lastEvent)&&!(this.isOpen&&document.activeElement==this.getElement())){var g=m.renderer;this.isOpen||(l.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),M=g.scroller.getBoundingClientRect();S.pageX<M.left&&(S.pageX=M.left);var _=this.getElement();_.innerHTML="",_.appendChild(D),_.style.maxHeight="",_.style.display="block";var T=_.clientHeight,F=_.clientWidth,A=window.innerHeight-S.pageY-g.lineHeight,$=!0;S.pageY-T<0&&S.pageY<A&&($=!1),_.style.maxHeight=($?S.pageY:A)-b+"px",_.style.top=$?"":S.pageY+g.lineHeight+"px",_.style.bottom=$?window.innerHeight-S.pageY+"px":"",_.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,l.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);u.HoverTooltip=a}),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/tooltip","ace/config"],function(i,u,v){var s=this&&this.__extends||function(){var c=function(f,m){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,D){y.__proto__=D}||function(y,D){for(var E in D)Object.prototype.hasOwnProperty.call(D,E)&&(y[E]=D[E])},c(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");c(f,m);function y(){this.constructor=f}f.prototype=m===null?Object.create(m):(y.prototype=m.prototype,new y)}}(),h=this&&this.__values||function(c){var f=typeof Symbol=="function"&&Symbol.iterator,m=f&&c[f],y=0;if(m)return m.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&y>=c.length&&(c=void 0),{value:c&&c[y++],done:!c}}};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;u.GUTTER_TOOLTIP_LEFT_OFFSET=t,u.GUTTER_TOOLTIP_TOP_OFFSET=r;function l(c){var f=c.editor,m=f.renderer.$gutterLayer,y=new a(f,!0);c.editor.setDefaultHandler("guttermousedown",function(M){if(!(!f.isFocused()||M.getButton()!=0)){var _=m.getRegion(M);if(_!="foldWidgets"){var T=M.getDocumentPosition().row,F=f.session.selection;if(M.getShiftKey())F.selectTo(T,0);else{if(M.domEvent.detail==2)return f.selectAll(),M.preventDefault();c.$clickSelection=f.selection.getLineRange(T)}return c.setState("selectByLines"),c.captureMouse(M),M.preventDefault()}}});var D,E;function b(){var M=E.getDocumentPosition().row,_=f.session.getLength();if(M==_){var T=f.renderer.pixelToScreenCoordinates(0,E.y).row,F=E.$pos;if(T>f.session.documentToScreenRow(F.row,F.column))return g()}if(y.showTooltip(M),!!y.isOpen)if(f.on("mousewheel",g),f.on("changeSession",g),window.addEventListener("keydown",g,!0),c.$tooltipFollowsMouse)S(E);else{var A=E.getGutterRow(),$=m.$lines.get(A);if($){var C=$.element.querySelector(".ace_gutter_annotation"),w=C.getBoundingClientRect(),x=y.getElement().style;x.left=w.right-t+"px",x.top=w.bottom-r+"px"}else S(E)}}function g(M){M&&M.type==="keydown"&&(M.ctrlKey||M.metaKey)||M&&M.type==="mouseout"&&(!M.relatedTarget||y.getElement().contains(M.relatedTarget))||(D&&(D=clearTimeout(D)),y.isOpen&&(y.hideTooltip(),f.off("mousewheel",g),f.off("changeSession",g),window.removeEventListener("keydown",g,!0)))}function S(M){y.setPosition(M.x,M.y)}c.editor.setDefaultHandler("guttermousemove",function(M){var _=M.domEvent.target||M.domEvent.srcElement;if(d.hasCssClass(_,"ace_fold-widget")||d.hasCssClass(_,"ace_custom-widget"))return g();y.isOpen&&c.$tooltipFollowsMouse&&S(M),E=M,!D&&(D=setTimeout(function(){D=null,E&&!c.isMousePressed&&b()},50))}),o.addListener(f.renderer.$gutter,"mouseout",function(M){E=null,y.isOpen&&(D=setTimeout(function(){D=null,g(M)},50))},f)}u.GutterHandler=l;var a=function(c){s(f,c);function f(m,y){y===void 0&&(y=!1);var D=c.call(this,m.container)||this;D.editor=m,D.visibleTooltipRow;var E=D.getElement();return E.setAttribute("role","tooltip"),E.style.pointerEvents="auto",y&&(D.onMouseOut=D.onMouseOut.bind(D),E.addEventListener("mouseout",D.onMouseOut)),D}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 D=window.innerWidth||document.documentElement.clientWidth,E=window.innerHeight||document.documentElement.clientHeight,b=this.getWidth(),g=this.getHeight();m+=15,y+=15,m+b>D&&(m-=m+b-D),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,D=this.editor.renderer.$gutterLayer,E=D.$annotations[m],b;E?b={displayText:Array.from(E.displayText),type:Array.from(E.type)}:b={displayText:[],type:[]};var g=D.session.getFoldLine(m);if(g&&D.$showFoldedAnnotations){for(var S={error:[],security:[],warning:[],info:[],hint:[]},M={error:1,security:2,warning:3,info:4,hint:5},_,T=m+1;T<=g.end.row;T++)if(D.$annotations[T])for(var F=0;F<D.$annotations[T].text.length;F++){var A=D.$annotations[T].type[F];S[A].push(D.$annotations[T].text[F]),(!_||M[A]<M[_])&&(_=A)}if(["error","security","warning"].includes(_)){var $="".concat(f.annotationsToSummaryString(S)," in folded code.");b.displayText.push($),b.type.push(_+"_fold")}}if(b.displayText.length===0)return this.hideTooltip();for(var C={error:[],security:[],warning:[],info:[],hint:[]},w=D.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",T=0;T<b.displayText.length;T++){var x=d.createElement("span"),I=d.createElement("span");(y=I.classList).add.apply(y,["ace_".concat(b.type[T]),w]),I.setAttribute("aria-label","".concat(f.annotationLabels[b.type[T].replace("_fold","")].singular)),I.setAttribute("role","img"),I.appendChild(d.createTextNode(" ")),x.appendChild(I),x.appendChild(d.createTextNode(b.displayText[T])),x.appendChild(d.createElement("br")),C[b.type[T].replace("_fold","")].push(x)}var O=this.getElement();d.removeChildren(O),C.error.forEach(function(R){return O.appendChild(R)}),C.security.forEach(function(R){return O.appendChild(R)}),C.warning.forEach(function(R){return O.appendChild(R)}),C.info.forEach(function(R){return O.appendChild(R)}),C.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,D,E=[],b=["error","security","warning","info","hint"];try{for(var g=h(b),S=g.next();!S.done;S=g.next()){var M=S.value;if(m[M].length){var _=m[M].length===1?f.annotationLabels[M].singular:f.annotationLabels[M].plural;E.push("".concat(m[M].length," ").concat(_))}}}catch(T){y={error:T}}finally{try{S&&!S.done&&(D=g.return)&&D.call(g)}finally{if(y)throw y.error}}return E.join(", ")},f}(p);u.GutterTooltip=a}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(i,u,v){var s=i("../lib/event"),h=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 h.isMac?this.domEvent.metaKey:this.domEvent.ctrlKey},o}();u.MouseEvent=d}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(i,u,v){var s=i("../lib/dom"),h=i("../lib/event"),d=i("../lib/useragent"),o=200,p=200,e=5;function t(l){var a=l.editor,c=s.createElement("div");c.style.cssText="top:-100px;position:absolute;z-index:2147483647;opacity:0.5",c.textContent=" ";var f=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];f.forEach(function(W){l[W]=this[W]},this),a.on("mousedown",this.onMouseDown.bind(l));var m=a.container,y,D,E,b,g,S,M=0,_,T,F,A,$;this.onDragStart=function(W){if(this.cancelDrag||!m.draggable){var H=this;return setTimeout(function(){H.startSelect(),H.captureMouse(W)},0),W.preventDefault()}g=a.getSelectionRange();var U=W.dataTransfer;U.effectAllowed=a.getReadOnly()?"copy":"copyMove",a.container.appendChild(c),U.setDragImage&&U.setDragImage(c,0,0),setTimeout(function(){a.container.removeChild(c)}),U.clearData(),U.setData("Text",a.session.getTextRange()),T=!0,this.setState("drag")},this.onDragEnd=function(W){if(m.draggable=!1,T=!1,this.setState(null),!a.getReadOnly()){var H=W.dataTransfer.dropEffect;!_&&H=="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 D=W.clientX,E=W.clientY,y||I(),M++,W.dataTransfer.dropEffect=_=V(W),h.preventDefault(W)},this.onDragOver=function(W){if(!(a.getReadOnly()||!B(W.dataTransfer)))return D=W.clientX,E=W.clientY,y||(I(),M++),R!==null&&(R=null),W.dataTransfer.dropEffect=_=V(W),h.preventDefault(W)},this.onDragLeave=function(W){if(M--,M<=0&&y)return O(),_=null,h.preventDefault(W)},this.onDrop=function(W){if(S){var H=W.dataTransfer;if(T)switch(_){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=H.getData("Text");g={start:S,end:a.session.insert(S,U)},a.focus(),_=null}return O(),h.preventDefault(W)}},h.addListener(m,"dragstart",this.onDragStart.bind(l),a),h.addListener(m,"dragend",this.onDragEnd.bind(l),a),h.addListener(m,"dragenter",this.onDragEnter.bind(l),a),h.addListener(m,"dragover",this.onDragOver.bind(l),a),h.addListener(m,"dragleave",this.onDragLeave.bind(l),a),h.addListener(m,"drop",this.onDrop.bind(l),a);function C(W,H){var U=Date.now(),G=!H||W.row!=H.row,Y=!H||W.column!=H.column;if(!A||G||Y)a.moveCursorToPosition(W),A=U,$={x:D,y:E};else{var Q=r($.x,$.y,D,E);Q>e?A=null:U-A>=p&&(a.renderer.scrollCursorIntoView(),A=null)}}function w(W,H){var U=Date.now(),G=a.renderer.layerConfig.lineHeight,Y=a.renderer.layerConfig.characterWidth,Q=a.renderer.scroller.getBoundingClientRect(),ee={x:{left:D-Q.left,right:Q.right-D},y:{top:E-Q.top,bottom:Q.bottom-E}},ne=Math.min(ee.x.left,ee.x.right),se=Math.min(ee.y.top,ee.y.bottom),ge={row:W.row,column:W.column};ne/Y<=2&&(ge.column+=ee.x.left<ee.x.right?-3:2),se/G<=1&&(ge.row+=ee.y.top<ee.y.bottom?-1:1);var be=W.row!=ge.row,ke=W.column!=ge.column,Ce=!H||W.row!=H.row;be||ke&&!Ce?F?U-F>=o&&a.renderer.scrollCursorIntoView(ge):F=U:F=null}function x(){var W=S;S=a.renderer.screenToTextCoordinates(D,E),C(S,W),w(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),x(),b=setInterval(x,20),M=0,h.addListener(document,"mousemove",P)}function O(){clearInterval(b),a.session.removeMarker(y),y=null,a.selection.fromOrientedRange(g),a.isFocused()&&!T&&a.$resetCursorStyle(),g=null,S=null,M=0,F=null,A=null,h.removeListener(document,"mousemove",P)}var R=null;function P(){R==null&&(R=setTimeout(function(){R!=null&&y&&O()},20))}function B(W){var H=W.types;return!H||Array.prototype.some.call(H,function(U){return U=="text/plain"||U=="Text"})}function V(W){var H=["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&&H.indexOf(Y)>=0?Q="copy":U.indexOf(Y)>=0?Q="move":H.indexOf(Y)>=0&&(Q="copy"),Q}}(function(){this.dragWait=function(){var l=Date.now()-this.mousedownEvent.time;l>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var l=this.editor.container;l.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(l){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var l=this.editor,a=l.container;a.draggable=!0,l.renderer.$cursorLayer.setBlinking(!1),l.setStyle("ace_dragging");var c=d.isWin?"default":"move";l.renderer.setCursorStyle(c),this.setState("dragReady")},this.onMouseDrag=function(l){var a=this.editor.container;if(d.isIE&&this.state=="dragReady"){var c=r(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);c>3&&a.dragDrop()}if(this.state==="dragWait"){var c=r(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);c>0&&(a.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(l){if(this.$dragEnabled){this.mousedownEvent=l;var a=this.editor,c=l.inSelection(),f=l.getButton(),m=l.domEvent.detail||1;if(m===1&&f===0&&c){if(l.editor.inMultiSelectMode&&(l.getAccelKey()||l.getShiftKey()))return;this.mousedownEvent.time=Date.now();var y=l.domEvent.target||l.domEvent.srcElement;if("unselectable"in y&&(y.unselectable="on"),a.getDragDelay()){if(d.isWebKit){this.cancelDrag=!0;var D=a.container;D.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(l,this.onMouseDrag.bind(this)),l.defaultPrevented=!0}}}}).call(t.prototype);function r(l,a,c,f){return Math.sqrt(Math.pow(c-l,2)+Math.pow(f-a,2))}u.DragdropHandler=t}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(i,u,v){var s=i("./mouse_event").MouseEvent,h=i("../lib/event"),d=i("../lib/dom");u.addTouchListeners=function(o,p){var e="scroll",t,r,l,a,c,f,m=0,y,D=0,E=0,b=0,g,S;function M(){var C=window.navigator&&window.navigator.clipboard,w=!1,x=function(){var R=p.getCopyText(),P=p.session.getUndoManager().hasUndo();S.replaceChild(d.buildDom(w?["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"],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(R){return p.commands.canExecute(R,p)},O=function(R){var P=R.target.getAttribute("action");if(P=="more"||!w)return w=!w,x();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",w=!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 _(){if(!p.getOption("enableMobileMenu")){S&&T();return}S||M();var C=p.selection.cursor,w=p.renderer.textToScreenCoordinates(C.row,C.column),x=p.renderer.textToScreenCoordinates(0,0).pageX,I=p.renderer.scrollLeft,O=p.container.getBoundingClientRect();S.style.top=w.pageY-O.top-3+"px",w.pageX-O.left<O.width-70?(S.style.left="",S.style.right="10px"):(S.style.right="",S.style.left=x+I-O.left+"px"),S.style.display="",S.firstChild.style.display="none",p.on("input",T)}function T(C){S&&(S.style.display="none"),p.off("input",T)}function F(){c=null,clearTimeout(c);var C=p.selection.getRange(),w=C.contains(y.row,y.column);(C.isEmpty()||!w)&&(p.selection.moveToPosition(y),p.selection.selectWord()),e="wait",_()}function A(){c=null,clearTimeout(c),p.selection.moveToPosition(y);var C=D>=2?p.selection.getLineRange(y.row):p.session.getBracketRange(y);C&&!C.isEmpty()?p.selection.setRange(C):p.selection.selectWord(),e="wait"}h.addListener(o,"contextmenu",function(C){if(g){var w=p.textInput.getElement();w.focus()}},p),h.addListener(o,"touchstart",function(C){var w=C.touches;if(c||w.length>1){clearTimeout(c),c=null,l=-1,e="zoom";return}g=p.$mouseHandler.isMousePressed=!0;var x=p.renderer.layerConfig.lineHeight,I=p.renderer.layerConfig.lineHeight,O=C.timeStamp;a=O;var R=w[0],P=R.clientX,B=R.clientY;Math.abs(t-P)+Math.abs(r-B)>x&&(l=-1),t=C.clientX=P,r=C.clientY=B,E=b=0;var V=new s(C,p);if(y=V.getDocumentPosition(),O-l<500&&w.length==1&&!m)D++,C.preventDefault(),C.button=0,A();else{D=0;var W=p.selection.cursor,H=p.selection.isEmpty()?W:p.selection.anchor,U=p.renderer.$cursorLayer.getPixelPosition(W,!0),G=p.renderer.$cursorLayer.getPixelPosition(H,!0),Y=p.renderer.scroller.getBoundingClientRect(),Q=p.renderer.layerConfig.offset,ee=p.renderer.scrollLeft,ne=function(be,ke){return be=be/I,ke=ke/x-.75,be*be+ke*ke};if(C.clientX<Y.left){e="zoom";return}var se=ne(C.clientX-Y.left-U.left+ee,C.clientY-Y.top-U.top+Q),ge=ne(C.clientX-Y.left-G.left+ee,C.clientY-Y.top-G.top+Q);se<3.5&&ge<3.5&&(e=se>ge?"cursor":"anchor"),ge<3.5?e="anchor":se<3.5?e="cursor":e="scroll",c=setTimeout(F,450)}l=O},p),h.addListener(o,"touchend",function(C){g=p.$mouseHandler.isMousePressed=!1,f&&clearInterval(f),e=="zoom"?(e="",m=0):c?(p.selection.moveToPosition(y),m=0,_()):e=="scroll"?($(),T()):_(),clearTimeout(c),c=null},p),h.addListener(o,"touchmove",function(C){c&&(clearTimeout(c),c=null);var w=C.touches;if(!(w.length>1||e=="zoom")){var x=w[0],I=t-x.clientX,O=r-x.clientY;if(e=="wait")if(I*I+O*O>4)e="cursor";else return C.preventDefault();t=x.clientX,r=x.clientY,C.clientX=x.clientX,C.clientY=x.clientY;var R=C.timeStamp,P=R-a;if(a=R,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,b=O/P),p._emit("mousewheel",B),B.propagationStopped||(E=b=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(b)<.01&&(b=0),m<20&&(E=.9*E),m<20&&(b=.9*b);var C=p.session.getScrollTop();p.renderer.scrollBy(10*E,10*b),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,u,v){var s=i("../lib/event"),h=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"),l=function(){function a(c){this.$dragDelay,this.$dragEnabled,this.$mouseMoved,this.mouseEvent,this.$focusTimeout;var f=this;this.editor=c,new d(this),new o(this),new e(this);var m=function(E){var b=!document.hasFocus||!document.hasFocus()||!c.isFocused()&&document.activeElement==(c.textInput&&c.textInput.getElement());b&&window.focus(),c.focus(),setTimeout(function(){c.isFocused()||c.focus()})},y=c.renderer.getMouseEventTarget();s.addListener(y,"click",this.onMouseEvent.bind(this,"click"),c),s.addListener(y,"mousemove",this.onMouseMove.bind(this,"mousemove"),c),s.addMultiMouseDownListener([y,c.renderer.scrollBarV&&c.renderer.scrollBarV.inner,c.renderer.scrollBarH&&c.renderer.scrollBarH.inner,c.textInput&&c.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent",c),s.addMouseWheelListener(c.container,this.onMouseWheel.bind(this,"mousewheel"),c),t(c.container,c);var D=c.renderer.$gutter;s.addListener(D,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),c),s.addListener(D,"click",this.onMouseEvent.bind(this,"gutterclick"),c),s.addListener(D,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),c),s.addListener(D,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),c),s.addListener(y,"mousedown",m,c),s.addListener(D,"mousedown",m,c),h.isIE&&c.renderer.scrollBarV&&(s.addListener(c.renderer.scrollBarV.element,"mousedown",m,c),s.addListener(c.renderer.scrollBarH.element,"mousedown",m,c)),c.on("mousemove",function(E){if(!(f.state||f.$dragDelay||!f.$dragEnabled)){var b=c.renderer.screenToTextCoordinates(E.x,E.y),g=c.session.selection.getRange(),S=c.renderer;!g.isEmpty()&&g.insideStart(b.row,b.column)?S.setCursorStyle("default"):S.setCursorStyle("")}},c)}return a.prototype.onMouseEvent=function(c,f){this.editor.session&&this.editor._emit(c,new p(f,this.editor))},a.prototype.onMouseMove=function(c,f){var m=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;!m||!m.length||this.editor._emit(c,new p(f,this.editor))},a.prototype.onMouseWheel=function(c,f){var m=new p(f,this.editor);m.speed=this.$scrollSpeed*2,m.wheelX=f.wheelX,m.wheelY=f.wheelY,this.editor._emit(c,m)},a.prototype.setState=function(c){this.state=c},a.prototype.captureMouse=function(c,f){this.x=c.x,this.y=c.y,this.isMousePressed=!0;var m=this.editor,y=this.editor.renderer;y.$isMousePressed=!0;var D=this,E=!0,b=function(T){if(T){if(h.isWebKit&&!T.which&&D.releaseMouse)return D.releaseMouse();D.x=T.clientX,D.y=T.clientY,f&&f(T),D.mouseEvent=new p(T,D.editor),D.$mouseMoved=!0}},g=function(T){m.off("beforeEndOperation",_),E=!1,m.session&&S(),D[D.state+"End"]&&D[D.state+"End"](T),D.state="",D.isMousePressed=y.$isMousePressed=!1,y.$keepTextAreaAtCursor&&y.$moveTextAreaToCursor(),D.$onCaptureMouseMove=D.releaseMouse=null,T&&D.onMouseEvent("mouseup",T),m.endOperation()},S=function(){D[D.state]&&D[D.state](),D.$mouseMoved=!1},M=function(){E&&(S(),s.nextFrame(M))};if(h.isOldIE&&c.domEvent.type=="dblclick")return setTimeout(function(){g(c)});var _=function(T){D.releaseMouse&&m.curOp.command.name&&m.curOp.selectionChanged&&(D[D.state+"End"]&&D[D.state+"End"](),D.state="",D.releaseMouse())};m.on("beforeEndOperation",_),m.startOperation({command:{name:"mouse"}}),D.$onCaptureMouseMove=b,D.releaseMouse=s.capture(this.editor.container,b,g),M()},a.prototype.cancelContextMenu=function(){var c=function(f){f&&f.domEvent&&f.domEvent.type!="contextmenu"||(this.editor.off("nativecontextmenu",c),f&&f.domEvent&&s.stopEvent(f.domEvent))}.bind(this);setTimeout(c,10),this.editor.on("nativecontextmenu",c)},a.prototype.destroy=function(){this.releaseMouse&&this.releaseMouse()},a}();l.prototype.releaseMouse=null,r.defineOptions(l.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:h.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),u.MouseHandler=l}),ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(i,u,v){var s=i("../lib/dom"),h=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 l=p.domEvent&&p.domEvent.target;l&&s.hasCssClass(l,"ace_inline_button")&&s.hasCssClass(l,"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,l=r.getParentFoldRangeData(t,!0),a=l.range||l.firstRange;if(a){t=a.start.row;var c=r.getFoldAt(t,r.getLine(t).length,1);c?r.removeFold(c):(r.addFold("...",a),o.renderer.scrollCursorIntoView({row:a.start.row,column:0}))}p.stop()}})}return d}();u.FoldHandler=h}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(i,u,v){var s=i("../lib/keys"),h=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 l,a=!1,c=this.$editor.commands,f=this.$handlers.length;f--&&(l=this.$handlers[f].handleKeyboard(this.$data,p,e,t,r),!(!(!l||!l.command)&&(l.command=="null"?a=!0:a=c.exec(l.command,this.$editor,l.args,r),a&&r&&p!=-1&&l.passEvent!=!0&&l.command.passEvent!=!0&&h.stopEvent(r),a))););return!a&&p==-1&&(l={command:"insertstring"},a=c.exec("insertstring",this.$editor,e)),a&&this.$editor._signal&&this.$editor._signal("keyboardActivity",l),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}();u.KeyBinding=d}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(i,u,v){var s=0,h=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,l=1,a=0,c=1,f=2,m=3,y=4,D=5,E=6,b=7,g=8,S=9,M=10,_=11,T=12,F=13,A=14,$=15,C=16,w=17,x=18,I=[x,x,x,x,x,x,x,x,x,E,D,E,g,D,x,x,x,x,x,x,x,x,x,x,x,x,x,x,D,D,D,E,g,y,y,_,_,_,y,y,y,y,y,M,S,M,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,x,x,x,x,x,x,D,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x,S,y,_,_,_,_,y,y,y,y,a,y,y,x,y,y,_,_,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,x,x,x,a,c,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,D,F,A,$,C,w,S,_,_,_,_,_,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,H,U,G){var Y=s?t:e,Q=null,ee=null,ne=null,se=0,ge=null,be=null,ke=-1,Ce=null,Ne=null,Xe=[];if(!G)for(Ce=0,G=[];Ce<U;Ce++)G[Ce]=V(W[Ce]);for(h=s,d=!1,o=!1,p=!1,Ne=0;Ne<U;Ne++){if(Q=se,Xe[Ne]=ee=B(W,G,Xe,Ne),se=Y[Q][ee],ge=se&240,se&=15,H[Ne]=ne=Y[se][5],ge>0)if(ge==16){for(Ce=ke;Ce<Ne;Ce++)H[Ce]=1;ke=-1}else ke=-1;if(be=Y[se][6],be)ke==-1&&(ke=Ne);else if(ke>-1){for(Ce=ke;Ce<Ne;Ce++)H[Ce]=ne;ke=-1}G[Ne]==D&&(H[Ne]=0),h|=ne}if(p){for(Ce=0;Ce<U;Ce++)if(G[Ce]==E){H[Ce]=s;for(var Ze=Ce-1;Ze>=0&&G[Ze]==g;Ze--)H[Ze]=s}}}function P(W,H,U){if(!(h<W)){if(W==1&&s==l&&!o){U.reverse();return}for(var G=U.length,Y=0,Q,ee,ne,se;Y<G;){if(H[Y]>=W){for(Q=Y+1;Q<G&&H[Q]>=W;)Q++;for(ee=Y,ne=Q-1;ee<ne;ee++,ne--)se=U[ee],U[ee]=U[ne],U[ne]=se;Y=Q}Y++}}}function B(W,H,U,G){var Y=H[G],Q,ee,ne,se;switch(Y){case a:case c:d=!1;case y:case m:return Y;case f:return d?m:f;case b:return d=!0,c;case g:return y;case S:return G<1||G+1>=H.length||(Q=U[G-1])!=f&&Q!=m||(ee=H[G+1])!=f&&ee!=m?y:(d&&(ee=m),ee==Q?ee:y);case M:return Q=G>0?U[G-1]:D,Q==f&&G+1<H.length&&H[G+1]==f?f:y;case _:if(G>0&&U[G-1]==f)return f;if(d)return y;for(se=G+1,ne=H.length;se<ne&&H[se]==_;)se++;return se<ne&&H[se]==f?f:y;case T:for(ne=H.length,se=G+1;se<ne&&H[se]==T;)se++;if(se<ne){var ge=W[G],be=ge>=1425&&ge<=2303||ge==64286;if(Q=H[se],be&&(Q==c||Q==b))return c}return G<1||(Q=H[G-1])==D?y:U[G-1];case D:return d=!1,o=!0,s;case E:return p=!0,y;case F:case A:case C:case w:case $:d=!1;case x:return y}}function V(W){var H=W.charCodeAt(0),U=H>>8;return U==0?H>191?a:I[H]:U==5?/[\u0591-\u05f4]/.test(W)?c:a:U==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(W)?T:/[\u0660-\u0669\u066b-\u066c]/.test(W)?m:H==1642?_:/[\u06f0-\u06f9]/.test(W)?f:b:U==32&&H<=8287?O[H&255]:U==254&&H>=65136?b:y}u.L=a,u.R=c,u.EN=f,u.ON_R=3,u.AN=4,u.R_H=5,u.B=6,u.RLE=7,u.DOT="·",u.doBidiReorder=function(W,H,U){if(W.length<2)return{};var G=W.split(""),Y=new Array(G.length),Q=new Array(G.length),ee=[];s=U?l:r,R(G,ee,G.length,H);for(var ne=0;ne<Y.length;Y[ne]=ne,ne++);P(2,ee,Y),P(1,ee,Y);for(var ne=0;ne<Y.length-1;ne++)H[ne]===m?ee[ne]=u.AN:ee[ne]===c&&(H[ne]>b&&H[ne]<F||H[ne]===y||H[ne]===x)?ee[ne]=u.ON_R:ne>0&&G[ne-1]==="ل"&&/\u0622|\u0623|\u0625|\u0627/.test(G[ne])&&(ee[ne-1]=ee[ne]=u.R_H,ne++);G[G.length-1]===u.DOT&&(ee[G.length-1]=u.B),G[0]===""&&(ee[0]=u.RLE);for(var ne=0;ne<Y.length;ne++)Q[ne]=ee[Y[ne]];return{logicalFromVisual:Y,bidiLevels:Q}},u.hasBidiCharacters=function(W,H){for(var U=!1,G=0;G<W.length;G++)H[G]=V(W.charAt(G)),!U&&(H[G]==c||H[G]==b||H[G]==m)&&(U=!0);return U},u.getVisualFromLogicalIdx=function(W,H){for(var U=0;U<H.logicalFromVisual.length;U++)if(H.logicalFromVisual[U]==W)return U;return 0}}),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(i,u,v){var s=i("./lib/bidiutil"),h=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,l=this.session.$getRowCacheIndex(t,this.currentRow);this.currentRow-e>0&&(r=this.session.$getRowCacheIndex(t,this.currentRow-e-1),r===l);)l=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,l=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?l:s.DOT))}else this.line+=this.showInvisibles?l:s.DOT;var c=this.session,f=0,m;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(y,D){return y===" "||c.isFullWidth(y.charCodeAt(0))?(m=y===" "?c.getScreenTabSize(D+f):2,f+=m-1,h.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(),l=e.selection.getSelectionAnchor().row;l<=r.row;l++)!t&&e.session.getLine(l).charAt(0)===e.session.$bidiHandler.RLE?e.session.doc.removeInLine(l,0,1):t&&e.session.getLine(l).charAt(0)!==e.session.$bidiHandler.RLE&&e.session.doc.insert({column:0,row:l},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,l=s.getVisualFromLogicalIdx(r,this.bidiMap),a=this.bidiMap.bidiLevels,c=0;!this.session.getOverwrite()&&e<=t&&a[l]%2!==0&&l++;for(var f=0;f<l;f++)c+=this.charWidths[a[f]];return!this.session.getOverwrite()&&e>t&&a[l]%2===0&&(c+=this.charWidths[a[l]]),this.wrapIndent&&(c+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(c+=this.rtlLineOffset),c},p.prototype.getSelections=function(e,t){var r=this.bidiMap,l=r.bidiLevels,a,c=[],f=0,m=Math.min(e,t)-this.wrapIndent,y=Math.max(e,t)-this.wrapIndent,D=!1,E=!1,b=0;this.wrapIndent&&(f+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var g,S=0;S<l.length;S++)g=r.logicalFromVisual[S],a=l[S],D=g>=m&&g<y,D&&!E?b=f:!D&&E&&c.push({left:b,width:f-b}),f+=this.charWidths[a],E=D;if(D&&S===l.length&&c.push({left:b,width:f-b}),this.isRtlDir)for(var M=0;M<c.length;M++)c[M].left+=this.rtlLineOffset;return c},p.prototype.offsetToCol=function(r){this.isRtlDir&&(r-=this.rtlLineOffset);var t=0,r=Math.max(r,0),l=0,a=0,c=this.bidiMap.bidiLevels,f=this.charWidths[c[a]];for(this.wrapIndent&&(r-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);r>l+f/2;){if(l+=f,a===c.length-1){f=0;break}f=this.charWidths[c[++a]]}return a>0&&c[a-1]%2!==0&&c[a]%2===0?(r<l&&a--,t=this.bidiMap.logicalFromVisual[a]):a>0&&c[a-1]%2===0&&c[a]%2!==0?t=1+(r>l?this.bidiMap.logicalFromVisual[a]:this.bidiMap.logicalFromVisual[a-1]):this.isRtlDir&&a===c.length-1&&f===0&&c[a-1]%2===0||!this.isRtlDir&&a===0&&c[a]%2!==0?t=1+this.bidiMap.logicalFromVisual[a]:(a>0&&c[a-1]%2!==0&&f!==0&&a--,t=this.bidiMap.logicalFromVisual[a]),t===0&&this.isRtlDir&&t++,t+this.wrapIndent},p}();u.BidiHandler=o}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(i,u,v){var s=i("./lib/oop"),h=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(l){r.$cursorChanged=!0,r.$silent||r._emit("changeCursor"),!r.$isEmpty&&!r.$silent&&r._emit("changeSelection"),!r.$keepDesiredColumnOnChange&&l.old.column!=l.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 l=r?t.end:t.start,a=r?t.start:t.end;this.$setSelection(l.row,l.column,a.row,a.column)},e.prototype.$setSelection=function(t,r,l,a){if(!this.$silent){var c=this.$isEmpty,f=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(t,r),this.cursor.setPosition(l,a),this.$isEmpty=!o.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||c!=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 l=t||this.lead;t=l.row,r=l.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 l=typeof t=="number"?t:this.lead.row,a,c=this.session.getFoldLine(l);return c?(l=c.start.row,a=c.end.row):a=l,r===!0?new o(l,0,a,this.session.getLine(a).length):new o(l,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,l){var a=t.column,c=t.column+r;return l<0&&(a=t.column-r,c=t.column),this.session.isTabStop(t)&&this.doc.getLine(t.row).slice(a,c).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 l=this.session.getTabSize();this.wouldMoveIntoSoftTab(t,l,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-l):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 l=this.session.getTabSize(),t=this.lead;this.wouldMoveIntoSoftTab(t,l,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,l):this.moveCursorBy(0,1)}},e.prototype.moveCursorLineStart=function(){var t=this.lead.row,r=this.lead.column,l=this.session.documentToScreenRow(t,r),a=this.session.screenToDocumentPosition(l,0),c=this.session.getDisplayLine(t,null,a.row,a.column),f=c.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 l=this.session.getLine(r.row);if(r.column==l.length){var a=l.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,l=this.doc.getLine(t),a=l.substring(r);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var c=this.session.getFoldAt(t,r,1);if(c){this.moveCursorTo(c.end.row,c.end.column);return}if(this.session.nonTokenRe.exec(a)&&(r+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,a=l.substring(r)),r>=l.length){this.moveCursorTo(t,l.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,l;if(l=this.session.getFoldAt(t,r,-1)){this.moveCursorTo(l.start.row,l.start.column);return}var a=this.session.getFoldStringAt(t,r,-1);a==null&&(a=this.doc.getLine(t).substring(0,r));var c=h.stringReverse(a);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(c)&&(r-=this.session.nonTokenRe.lastIndex,c=c.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(c)&&(r-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(t,r)},e.prototype.$shortWordEndIndex=function(t){var r=0,l,a=/\s/,c=this.session.tokenRe;if(c.lastIndex=0,this.session.tokenRe.exec(t))r=this.session.tokenRe.lastIndex;else{for(;(l=t[r])&&a.test(l);)r++;if(r<1){for(c.lastIndex=0;(l=t[r])&&!c.test(l);)if(c.lastIndex=0,r++,a.test(l))if(r>2){r--;break}else{for(;(l=t[r])&&a.test(l);)r++;if(r>2)break}}}return c.lastIndex=0,r},e.prototype.moveCursorShortWordRight=function(){var t=this.lead.row,r=this.lead.column,l=this.doc.getLine(t),a=l.substring(r),c=this.session.getFoldAt(t,r,1);if(c)return this.moveCursorTo(c.end.row,c.end.column);if(r==l.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,l;if(l=this.session.getFoldAt(t,r,-1))return this.moveCursorTo(l.start.row,l.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 c=h.stringReverse(a),f=this.$shortWordEndIndex(c);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 l=this.session.documentToScreenPosition(this.lead.row,this.lead.column),a;if(r===0&&(t!==0&&(this.session.$bidiHandler.isBidiRow(l.row,this.lead.row)?(a=this.session.$bidiHandler.getPosLeft(l.column),l.column=Math.round(a/this.session.$bidiHandler.charWidths[0])):a=l.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?l.column=this.$desiredColumn:this.$desiredColumn=l.column),t!=0&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var c=this.session.lineWidgets[this.lead.row];t<0?t-=c.rowsAbove||0:t>0&&(t+=c.rowCount-(c.rowsAbove||0))}var f=this.session.screenToDocumentPosition(l.row+t,l.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,l){var a=this.session.getFoldAt(t,r,1);a&&(t=a.start.row,r=a.start.column),this.$keepDesiredColumnOnChange=!0;var c=this.session.getLine(t);/[\uDC00-\uDFFF]/.test(c.charAt(r))&&c.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,l||(this.$desiredColumn=null)},e.prototype.moveCursorToScreen=function(t,r,l){var a=this.session.screenToDocumentPosition(t,r);this.moveCursorTo(a.row,a.column,l)},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 l=this.getCursor();return o.fromPoints(r,l)}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 l=r.clone();return l.isBackwards=r.cursor==r.start,l});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 l=o.fromPoints(t[r].start,t[r].end);t[r].isBackwards&&(l.cursor=l.start),this.addRange(l,!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),u.Selection=p}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(i,u,v){var s=i("./lib/report_error").reportError,h=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=[],l=0,a=this.matchMappings[e]={defaultToken:"text"},c="g",f=[],m=0;m<t.length;m++){var y=t[m];if(y.defaultToken&&(a.defaultToken=y.defaultToken),y.caseInsensitive&&c.indexOf("i")===-1&&(c+="i"),y.unicode&&c.indexOf("u")===-1&&(c+="u"),y.regex!=null){y.regex instanceof RegExp&&(y.regex=y.regex.toString().slice(1,-1));var D=y.regex,E=new RegExp("(?:("+D+")|(.))").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)?D=y.regex.replace(/\\([0-9]+)/g,function(b,g){return"\\"+(parseInt(g,10)+l+1)}):(E=1,D=this.removeCapturingGroups(y.regex)),!y.splitRegex&&typeof y.token!="string"&&f.push(y)),a[l]=m,l+=E,r.push(D),y.onMatch||(y.onMatch=null)}}r.length||(a[0]=0,r.push("$")),f.forEach(function(b){b.splitRegex=this.createSplitterRegexp(b.regex,c)},this),this.regExps[e]=new RegExp("("+r.join(")|(")+")|($)",c)}}return o.prototype.$setMaxTokenCount=function(p){h=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=[],l=0,a=t.length;l<a;l++)e[l]&&(r[r.length]={type:t[l],value:e[l]});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,l=0,a=r.length;l<a;l++)e[l+1]&&(t[t.length]={type:r[l],value:e[l+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,l={};p.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(a,c,f,m,y,D){return r?r=y!="]":y?r=!0:m?(t==l.stack&&(l.end=D+1,l.stack=-1),t--):f&&(t++,f.length!=1&&(l.stack=t,l.start=D)),a}),l.end!=null&&/^\)*$/.test(p.substr(l.end))&&(p=p.substring(0,l.start)+p.substr(l.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",l=this.states[r];l||(r="start",l=this.states[r]);var a=this.matchMappings[r],c=this.regExps[r];c.lastIndex=0;for(var f,m=[],y=0,D=0,E={type:null,value:""};f=c.exec(p);){var b=a.defaultToken,g=null,S=f[0],M=c.lastIndex;if(M-S.length>y){var _=p.substring(y,M-S.length);E.type==b?E.value+=_:(E.type&&m.push(E),E={type:b,value:_})}for(var T=0;T<f.length-2;T++)if(f[T+1]!==void 0){g=l[a[T]],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),l=this.states[r],l||(this.reportError("state doesn't exist",r),r="start",l=this.states[r]),a=this.matchMappings[r],y=M,c=this.regExps[r],c.lastIndex=M),g.consumeLineEnd&&(y=M);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 T=0;T<b.length;T++)m.push(b[T])}}if(y==p.length)break;if(y=M,D++>h){for(D>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,u.Tokenizer=d}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(i,u,v){var s=i("../lib/deep_copy").deepCopy,h;h=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],l=0;l<r.length;l++){var a=r[l];(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,l){var a=typeof p=="function"?new p().getRules():p;if(r)for(var c=0;c<r.length;c++)r[c]=e+r[c];else{r=[];for(var f in a)r.push(e+f)}if(this.addRules(a,e),t)for(var m=Array.prototype[l?"push":"unshift"],c=0;c<r.length;c++)m.apply(this.$rules[r[c]],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 l=e[r];l.processed=!0;for(var a=0;a<l.length;a++){var c=l[a],f=null;Array.isArray(c)&&(f=c,c={}),!c.regex&&c.start&&(c.regex=c.start,c.next||(c.next=[]),c.next.push({defaultToken:c.token},{token:c.token+".end",regex:c.end||c.start,next:"pop"}),c.token=c.token+".start",c.push=!0);var m=c.next||c.push;if(m&&Array.isArray(m)){var y=c.stateName;y||(y=c.token,typeof y!="string"&&(y=y[0]||""),e[y]&&(y+=p++)),e[y]=m,c.next=y,t(y)}else m=="pop"&&(c.next=o);if(c.push&&(c.nextState=c.next||c.push,c.next=d,delete c.push),c.rules)for(var D in c.rules)e[D]?e[D].push&&e[D].push.apply(e[D],c.rules[D]):e[D]=c.rules[D];var E=typeof c=="string"?c:c.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);c.noEscape&&(b=b.filter(function(g){return!g.next})),l.splice.apply(l,b),a--}c.keywordMap&&(c.token=this.createKeywordMapper(c.keywordMap,c.defaultToken||"text",c.caseInsensitive),delete c.defaultToken)}}Object.keys(e).forEach(t,this)},this.createKeywordMapper=function(p,e,t,r){var l=Object.create(null);return this.$keywordList=[],Object.keys(p).forEach(function(a){for(var c=p[a],f=c.split(r||"|"),m=f.length;m--;){var y=f[m];this.$keywordList.push(y),t&&(y=y.toLowerCase()),l[y]=a}},this),p=null,t?function(a){return l[a.toLowerCase()]||e}:function(a){return l[a]||e}},this.getKeywords=function(){return this.$keywords}}.call(h.prototype),u.TextHighlightRules=h}),ace.define("ace/mode/behaviour",["require","exports","module"],function(i,u,v){var s;s=function(){this.$behaviours={}},function(){this.add=function(h,d,o){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[h]:this.$behaviours[h]={}}this.$behaviours[h][d]=o},this.addBehaviours=function(h){for(var d in h)for(var o in h[d])this.add(d,o,h[d][o])},this.remove=function(h){this.$behaviours&&this.$behaviours[h]&&delete this.$behaviours[h]},this.inherit=function(h,d){if(typeof h=="function")var o=new h().getBehaviours(d);else var o=h.getBehaviours(d);this.addBehaviours(o)},this.getBehaviours=function(h){if(h){for(var d={},o=0;o<h.length;o++)this.$behaviours[h[o]]&&(d[h[o]]=this.$behaviours[h[o]]);return d}else return this.$behaviours}}.call(s.prototype),u.Behaviour=s}),ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(i,u,v){var s=i("./range").Range,h=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}();u.TokenIterator=h}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(i,u,v){var s=i("../../lib/oop"),h=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={},l={'"':'"',"'":"'"},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:""}},c=function(m,y,D,E){var b=m.end.row-m.start.row;return{text:D+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,D,E,b,g){var S=E.getCursorPosition(),M=b.doc.getLine(S.row);if(g=="{"){a(E);var _=E.getSelectionRange(),T=b.doc.getTextRange(_),F=b.getTokenAt(S.row,S.column);if(T!==""&&T!=="{"&&E.getWrapBehavioursEnabled())return c(_,T,"{","}");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(M[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 $=M.substring(S.column,S.column+1);if($=="}"){var C=b.$findOpeningBracket("}",{column:S.column+1,row:S.row});if(C!==null&&f.isAutoInsertedClosing(S,M,g))return f.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else if(g==`
|
|
194
194
|
`||g==`\r
|
|
195
|
-
`){a(E);var w="";f.isMaybeInsertedClosing(S,M)&&(w=
|
|
196
|
-
`+
|
|
197
|
-
`+I+w,selection:[1,
|
|
195
|
+
`){a(E);var w="";f.isMaybeInsertedClosing(S,M)&&(w=o.stringRepeat("}",t.maybeInsertedBrackets),f.clearMaybeInsertedClosing());var $=M.substring(S.column,S.column+1);if($==="}"){var x=b.findMatchingBracket({row:S.row,column:S.column+1},"}");if(!x)return null;var I=this.$getIndent(b.getLine(x.row))}else if(w)var I=this.$getIndent(M);else{f.clearMaybeInsertedClosing();return}var O=I+b.getTabString();return{text:`
|
|
196
|
+
`+O+`
|
|
197
|
+
`+I+w,selection:[1,O.length,1,O.length]}}else f.clearMaybeInsertedClosing()}),this.add("braces","deletion",function(y,D,E,b,g){var S=b.doc.getTextRange(g);if(!g.isMultiLine()&&S=="{"){a(E);var M=b.doc.getLine(g.start.row),_=M.substring(g.end.column,g.end.column+1);if(_=="}")return g.end.column++,g;t.maybeInsertedBrackets--}}),this.add("parens","insertion",function(y,D,E,b,g){if(g=="("){a(E);var S=E.getSelectionRange(),M=b.doc.getTextRange(S);if(M!==""&&E.getWrapBehavioursEnabled())return c(S,M,"(",")");if(f.isSaneInsertion(E,b))return f.recordAutoInsert(E,b,")"),{text:"()",selection:[1,1]}}else if(g==")"){a(E);var _=E.getCursorPosition(),T=b.doc.getLine(_.row),F=T.substring(_.column,_.column+1);if(F==")"){var A=b.$findOpeningBracket(")",{column:_.column+1,row:_.row});if(A!==null&&f.isAutoInsertedClosing(_,T,g))return f.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(y,D,E,b,g){var S=b.doc.getTextRange(g);if(!g.isMultiLine()&&S=="("){a(E);var M=b.doc.getLine(g.start.row),_=M.substring(g.start.column+1,g.start.column+2);if(_==")")return g.end.column++,g}}),this.add("brackets","insertion",function(y,D,E,b,g){if(g=="["){a(E);var S=E.getSelectionRange(),M=b.doc.getTextRange(S);if(M!==""&&E.getWrapBehavioursEnabled())return c(S,M,"[","]");if(f.isSaneInsertion(E,b))return f.recordAutoInsert(E,b,"]"),{text:"[]",selection:[1,1]}}else if(g=="]"){a(E);var _=E.getCursorPosition(),T=b.doc.getLine(_.row),F=T.substring(_.column,_.column+1);if(F=="]"){var A=b.$findOpeningBracket("]",{column:_.column+1,row:_.row});if(A!==null&&f.isAutoInsertedClosing(_,T,g))return f.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(y,D,E,b,g){var S=b.doc.getTextRange(g);if(!g.isMultiLine()&&S=="["){a(E);var M=b.doc.getLine(g.start.row),_=M.substring(g.start.column+1,g.start.column+2);if(_=="]")return g.end.column++,g}}),this.add("string_dquotes","insertion",function(y,D,E,b,g){var S=b.$mode.$quotes||l;if(g.length==1&&S[g]){if(this.lineCommentStart&&this.lineCommentStart.indexOf(g)!=-1)return;a(E);var M=g,_=E.getSelectionRange(),T=b.doc.getTextRange(_);if(T!==""&&(T.length!=1||!S[T])&&E.getWrapBehavioursEnabled())return c(_,T,M,M);if(!T){var F=E.getCursorPosition(),A=b.doc.getLine(F.row),$=A.substring(F.column-1,F.column),C=A.substring(F.column,F.column+1),w=b.getTokenAt(F.row,F.column),x=b.getTokenAt(F.row,F.column+1);if($=="\\"&&w&&/escape/.test(w.type))return null;var I=w&&/string|escape/.test(w.type),O=!x||/string|escape/.test(x.type),R;if(C==M)R=I!==O,R&&/string\.end/.test(x.type)&&(R=!1);else{if(I&&!O||I&&O)return null;var P=b.$mode.tokenRe;P.lastIndex=0;var B=P.test($);P.lastIndex=0;var V=P.test(C),W=b.$mode.$pairQuotesAfter,H=W&&W[M]&&W[M].test($);if(!H&&B||V||C&&!/[\s;,.})\]\\]/.test(C))return null;var U=A[F.column-2];if($==M&&(U==M||P.test(U)))return null;R=!0}return{text:R?M+M:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(y,D,E,b,g){var S=b.$mode.$quotes||l,M=b.doc.getTextRange(g);if(!g.isMultiLine()&&S.hasOwnProperty(M)){a(E);var _=b.doc.getLine(g.start.row),T=_.substring(g.start.column+1,g.start.column+2);if(T==M)return g.end.column++,g}}),m.closeDocComment!==!1&&this.add("doc comment end","insertion",function(y,D,E,b,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 M=b.doc.getLine(S.row),_=b.doc.getLine(S.row+1),T=b.getTokens(S.row),F=0,A=0;A<T.length;A++){F+=T[A].value.length;var $=T[A];if(F>=S.column){if(F===S.column){if(!/\.doc/.test($.type))return;if(/\*\//.test($.value)){var C=T[A+1];if(!C||!/\.doc/.test(C.type))return}}var w=S.column-(F-$.value.length),x=$.value.indexOf("*/"),I=$.value.indexOf("/**",x>-1?x+2:0);if(I!==-1&&w>I&&w<I+3||x!==-1&&I!==-1&&w>=x&&w<=I||!/\.doc/.test($.type))return;break}}var R=this.$getIndent(M);if(/\s*\*/.test(_))return/^\s*\*/.test(M)?{text:g+R+"* ",selection:[1,2+R.length,1,2+R.length]}:{text:g+R+" * ",selection:[1,3+R.length,1,3+R.length]};if(/\/\*\*/.test(M.substring(0,S.column)))return{text:g+R+" * "+g+" "+R+"*/",selection:[1,4+R.length,1,4+R.length]}}})},f.isSaneInsertion=function(m,y){var D=m.getCursorPosition(),E=new d(y,D.row,D.column);if(!this.$matchTokenType(E.getCurrentToken()||"text",p)){if(/[)}\]]/.test(m.session.getLine(D.row)[D.column]))return!0;var b=new d(y,D.row,D.column+1);if(!this.$matchTokenType(b.getCurrentToken()||"text",p))return!1}return E.stepForward(),E.getCurrentTokenRow()!==D.row||this.$matchTokenType(E.getCurrentToken()||"text",e)},f.$matchTokenType=function(m,y){return y.indexOf(m.type||m)>-1},f.recordAutoInsert=function(m,y,D){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=D+b.substr(E.column),t.autoInsertedBrackets++},f.recordMaybeInsert=function(m,y,D){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)+D,t.maybeInsertedLineEnd=b.substr(E.column),t.maybeInsertedBrackets++},f.isAutoInsertedClosing=function(m,y,D){return t.autoInsertedBrackets>0&&m.row===t.autoInsertedRow&&D===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)},o.inherits(f,h),u.CstyleBehaviour=f}),ace.define("ace/unicode",["require","exports","module"],function(i,u,v){for(var o=[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],h=0,d=[],s=0;s<o.length;s+=2)d.push(h+=o[s]),o[s+1]&&d.push(45,h+=o[s+1]);u.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,u,v){var o=i("../config"),h=i("../tokenizer").Tokenizer,d=i("./text_highlight_rules").TextHighlightRules,s=i("./behaviour/cstyle").CstyleBehaviour,p=i("../unicode"),e=i("../lib/lang"),t=i("../token_iterator").TokenIterator,r=i("../range").Range,l;l=function(){this.HighlightRules=d},function(){this.$defaultBehaviour=new s,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 h(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(a,c,f,m){var y=c.doc,D=!0,E=!0,b=1/0,g=c.getTabSize(),S=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var T=this.lineCommentStart.map(e.escapeRegExp).join("|"),M=this.lineCommentStart[0];else var T=e.escapeRegExp(this.lineCommentStart),M=this.lineCommentStart;T=new RegExp("^(\\s*)(?:"+T+") ?"),S=c.getUseSoftTabs();var $=function(V,W){var H=V.match(T);if(H){var U=H[1].length,G=H[0].length;!x(V,U,G)&&H[0][G-1]==" "&&G--,y.removeInLine(W,U,G)}},w=M+" ",A=function(V,W){(!D||/\S/.test(V))&&(x(V,b,b)?y.insertInLine({row:W,column:b},w):y.insertInLine({row:W,column:b},M))},C=function(V,W){return T.test(V)},x=function(V,W,H){for(var U=0;W--&&V.charAt(W)==" ";)U++;if(U%g!=0)return!1;for(var U=0;V.charAt(H++)==" ";)U++;return g>2?U%g!=g-1:U%g==0}}else{if(!this.blockComment)return!1;var M=this.blockComment.start,_=this.blockComment.end,T=new RegExp("^(\\s*)(?:"+e.escapeRegExp(M)+")"),F=new RegExp("(?:"+e.escapeRegExp(_)+")\\s*$"),A=function(O,P){C(O,P)||(!D||/\S/.test(O))&&(y.insertInLine({row:P,column:O.length},_),y.insertInLine({row:P,column:b},M))},$=function(O,P){var B;(B=O.match(F))&&y.removeInLine(P,O.length-B[0].length,O.length),(B=O.match(T))&&y.removeInLine(P,B[1].length,B[0].length)},C=function(O,P){if(T.test(O))return!0;for(var B=c.getTokens(P),V=0;V<B.length;V++)if(B[V].type==="comment")return!0}}function I(O){for(var P=f;P<=m;P++)O(y.getLine(P),P)}var R=1/0;I(function(O,P){var B=O.search(/\S/);B!==-1?(B<b&&(b=B),E&&!C(O,P)&&(E=!1)):R>O.length&&(R=O.length)}),b==1/0&&(b=R,D=!1,E=!1),S&&b%g!=0&&(b=Math.floor(b/g)*g),I(E?$:A)},this.toggleBlockComment=function(a,c,f,m){var y=this.blockComment;if(y){!y.start&&y[0]&&(y=y[0]);var D=new t(c,m.row,m.column),E=D.getCurrentToken();c.selection;var b=c.selection.toOrientedRange(),g,S;if(E&&/comment/.test(E.type)){for(var M,_;E&&/comment/.test(E.type);){var T=E.value.indexOf(y.start);if(T!=-1){var F=D.getCurrentTokenRow(),A=D.getCurrentTokenColumn()+T;M=new r(F,A,F,A+y.start.length);break}E=D.stepBackward()}for(var D=new t(c,m.row,m.column),E=D.getCurrentToken();E&&/comment/.test(E.type);){var T=E.value.indexOf(y.end);if(T!=-1){var F=D.getCurrentTokenRow(),A=D.getCurrentTokenColumn()+T;_=new r(F,A,F,A+y.end.length);break}E=D.stepForward()}_&&c.remove(_),M&&(c.remove(M),g=M.start.row,S=-y.start.length)}else S=y.start.length,g=f.start.row,c.insert(f.end,y.end),c.insert(f.start,y.start);b.start.row==g&&(b.start.column+=S),b.end.row==g&&(b.end.column+=S),c.selection.fromOrientedRange(b)}},this.getNextLineIndent=function(a,c,f){return this.$getIndent(c)},this.checkOutdent=function(a,c,f){return!1},this.autoOutdent=function(a,c,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 c in a)if(a[c]){var f=a[c],m=f.prototype.$id,y=o.$modes[m];y||(o.$modes[m]=y=new f),o.$modes[c]||(o.$modes[c]=y),this.$embeds.push(c),this.$modes[c]=y}for(var D=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],E=function(g){(function(S){var M=D[g],_=S[M];S[D[g]]=function(){return this.$delegator(M,arguments,_)}})(b)},b=this,c=0;c<D.length;c++)E(c)},this.$delegator=function(a,c,f){var m=c[0]||"start";if(typeof m!="string"){if(Array.isArray(m[2])){var y=m[2][m[2].length-1],D=this.$modes[y];if(D)return D[a].apply(D,[m[1]].concat([].slice.call(c,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]){c[0]=b[1];var D=this.$modes[this.$embeds[E]];return D[a].apply(D,c)}}var g=f.apply(this,c);return f?g:void 0},this.transformAction=function(a,c,f,m,y){if(this.$behaviour){var D=this.$behaviour.getBehaviours();for(var E in D)if(D[E][c]){var b=D[E][c].apply(this,arguments);if(b)return b}}},this.getKeywords=function(a){if(!this.completionKeywords){var c=this.$tokenizer.rules,f=[];for(var m in c)for(var y=c[m],D=0,E=y.length;D<E;D++)if(typeof y[D].token=="string")/keyword|support|storage/.test(y[D].token)&&f.push(y[D].regex);else if(typeof y[D].token=="object"){for(var b=0,g=y[D].token.length;b<g;b++)if(/keyword|support|storage/.test(y[D].token[b])){var m=y[D].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,c,f,m){var y=this.$keywordList||this.$createKeywordList();return y.map(function(D){return{name:D,value:D,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}.call(l.prototype),u.Mode=l}),ace.define("ace/line_widgets",["require","exports","module","ace/lib/dom"],function(i,u,v){var o=i("./lib/dom"),h=function(){function d(s){this.session=s,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(s){var p;return this.lineWidgets?p=this.lineWidgets[s]&&this.lineWidgets[s].rowCount||0:p=0,!this.$useWrapMode||!this.$wrapData[s]?1+p:this.$wrapData[s].length+1+p},d.prototype.$getWidgetScreenLength=function(){var s=0;return this.lineWidgets.forEach(function(p){p&&p.rowCount&&!p.hidden&&(s+=p.rowCount)}),s},d.prototype.$onChangeEditor=function(s){this.attach(s.editor)},d.prototype.attach=function(s){s&&s.widgetManager&&s.widgetManager!=this&&s.widgetManager.detach(),this.editor!=s&&(this.detach(),this.editor=s,s&&(s.widgetManager=this,s.renderer.on("beforeRender",this.measureWidgets),s.renderer.on("afterRender",this.renderWidgets)))},d.prototype.detach=function(s){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(s,p){var e=p.lineWidgets;if(!(!e||!s.action)){for(var t=s.data,r=t.start.row,l=t.end.row,a=s.action=="add",c=r+1;c<l;c++)e[c]&&(e[c].hidden=a);e[l]&&(a?e[r]?e[l].hidden=a:e[r]=e[l]:(e[r]==e[l]&&(e[r]=void 0),e[l].hidden=a))}},d.prototype.updateOnChange=function(s){var p=this.session.lineWidgets;if(p){var e=s.start.row,t=s.end.row-e;if(t!==0)if(s.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 l=new Array(t);p[e]&&p[e].column!=null&&s.start.column>p[e].column&&e++,l.unshift(e,0),p.splice.apply(p,l),this.$updateRows()}}},d.prototype.$updateRows=function(){var s=this.session.lineWidgets;if(s){var p=!0;s.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(s){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength()));var p=this.session.lineWidgets[s.row];return p&&(s.$oldWidget=p,p.el&&p.el.parentNode&&(p.el.parentNode.removeChild(p.el),p._inDocument=!1)),this.session.lineWidgets[s.row]=s,s},d.prototype.addLineWidget=function(s){if(this.$registerLineWidget(s),s.session=this.session,!this.editor)return s;var p=this.editor.renderer;s.html&&!s.el&&(s.el=o.createElement("div"),s.el.innerHTML=s.html),s.text&&!s.el&&(s.el=o.createElement("div"),s.el.textContent=s.text),s.el&&(o.addCssClass(s.el,"ace_lineWidgetContainer"),s.className&&o.addCssClass(s.el,s.className),s.el.style.position="absolute",s.el.style.zIndex="5",p.container.appendChild(s.el),s._inDocument=!0,s.coverGutter||(s.el.style.zIndex="3"),s.pixelHeight==null&&(s.pixelHeight=s.el.offsetHeight)),s.rowCount==null&&(s.rowCount=s.pixelHeight/p.layerConfig.lineHeight);var e=this.session.getFoldAt(s.row,0);if(s.$fold=e,e){var t=this.session.lineWidgets;s.row==e.end.row&&!t[e.start.row]?t[e.start.row]=s:s.hidden=!0}return this.session._emit("changeFold",{data:{start:{row:s.row}}}),this.$updateRows(),this.renderWidgets(null,p),this.onWidgetChanged(s),s},d.prototype.removeLineWidget=function(s){if(s._inDocument=!1,s.session=null,s.el&&s.el.parentNode&&s.el.parentNode.removeChild(s.el),s.editor&&s.editor.destroy)try{s.editor.destroy()}catch{}if(this.session.lineWidgets){var p=this.session.lineWidgets[s.row];if(p==s)this.session.lineWidgets[s.row]=s.$oldWidget,s.$oldWidget&&this.onWidgetChanged(s.$oldWidget);else for(;p;){if(p.$oldWidget==s){p.$oldWidget=s.$oldWidget;break}p=p.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:s.row}}}),this.$updateRows()},d.prototype.getWidgetsAtRow=function(s){for(var p=this.session.lineWidgets,e=p&&p[s],t=[];e;)t.push(e),e=e.$oldWidget;return t},d.prototype.onWidgetChanged=function(s){this.session._changedWidgets.push(s),this.editor&&this.editor.renderer.updateFull()},d.prototype.measureWidgets=function(s,p){var e=this.session._changedWidgets,t=p.layerConfig;if(!(!e||!e.length)){for(var r=1/0,l=0;l<e.length;l++){var a=e[l];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 c=a.h/t.lineHeight;a.coverLine&&(c-=this.session.getRowLineCount(a.row),c<0&&(c=0)),a.rowCount!=c&&(a.rowCount=c,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(s,p){var e=p.layerConfig,t=this.session.lineWidgets;if(t){for(var r=Math.min(this.firstRow,e.firstRow),l=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<=l;a++){var c=t[a];if(!(!c||!c.el)){if(c.hidden){c.el.style.top=-100-(c.pixelHeight||0)+"px";continue}c._inDocument||(c._inDocument=!0,p.container.appendChild(c.el));var f=p.$cursorLayer.getPixelPosition({row:a,column:0},!0).top;c.coverLine||(f+=e.lineHeight*this.session.getRowLineCount(c.row)),c.el.style.top=f-e.offset+"px";var m=c.coverGutter?0:p.gutterWidth;c.fixedWidth||(m-=p.scrollLeft),c.el.style.left=m+"px",c.fullWidth&&c.screenWidth&&(c.el.style.minWidth=e.width+2*e.padding+"px"),c.fixedWidth?c.el.style.right=p.scrollBar.getWidth()+"px":c.el.style.right=""}}}},d}();u.LineWidgets=h}),ace.define("ace/apply_delta",["require","exports","module"],function(i,u,v){u.applyDelta=function(o,h,d){var s=h.start.row,p=h.start.column,e=o[s]||"";switch(h.action){case"insert":var t=h.lines;if(t.length===1)o[s]=e.substring(0,p)+h.lines[0]+e.substring(p);else{var r=[s,1].concat(h.lines);o.splice.apply(o,r),o[s]=e.substring(0,p)+o[s],o[s+h.lines.length-1]+=e.substring(p)}break;case"remove":var l=h.end.column,a=h.end.row;s===a?o[s]=e.substring(0,p)+e.substring(l):o.splice(s,a-s+1,e.substring(0,p)+o[a].substring(l));break}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(i,u,v){var o=i("./lib/oop"),h=i("./lib/event_emitter").EventEmitter,d=function(){function e(t,r,l){this.$onChange=this.onChange.bind(this),this.attach(t),typeof r!="number"?this.setPosition(r.row,r.column):this.setPosition(r,l)}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,l){var a;if(l?a={row:t,column:r}:a=this.$clipPositionToDocument(t,r),!(this.row==a.row&&this.column==a.column)){var c={row:this.row,column:this.column};this.row=a.row,this.column=a.column,this._signal("change",{old:c,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 l={};return t>=this.document.getLength()?(l.row=Math.max(0,this.document.getLength()-1),l.column=this.document.getLine(l.row).length):t<0?(l.row=0,l.column=0):(l.row=t,l.column=Math.min(this.document.getLine(l.row).length,Math.max(0,r))),r<0&&(l.column=0),l},e}();d.prototype.$insertRight=!1,o.implement(d.prototype,h);function s(e,t,r){var l=r?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&l}function p(e,t,r){var l=e.action=="insert",a=(l?1:-1)*(e.end.row-e.start.row),c=(l?1:-1)*(e.end.column-e.start.column),f=e.start,m=l?f:e.end;return s(t,f,r)?{row:t.row,column:t.column}:s(m,t,!r)?{row:t.row+a,column:t.column+(t.row==m.row?c:0)}:{row:f.row,column:f.column}}u.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,u,v){var o=i("./lib/oop"),h=i("./apply_delta").applyDelta,d=i("./lib/event_emitter").EventEmitter,s=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 l=this.getLength()-1;this.remove(new s(0,0,l,this.getLine(l).length)),this.insert({row:0,column:0},r||"")},t.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},t.prototype.createAnchor=function(r,l){return new p(this,r,l)},t.prototype.$detectNewLine=function(r){var l=r.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=l?l[1]:`
|
|
199
|
+
`)&&E.selection.isEmpty()){var S=E.getCursorPosition();if(S.column===0)return;for(var M=b.doc.getLine(S.row),_=b.doc.getLine(S.row+1),T=b.getTokens(S.row),F=0,A=0;A<T.length;A++){F+=T[A].value.length;var $=T[A];if(F>=S.column){if(F===S.column){if(!/\.doc/.test($.type))return;if(/\*\//.test($.value)){var C=T[A+1];if(!C||!/\.doc/.test(C.type))return}}var w=S.column-(F-$.value.length),x=$.value.indexOf("*/"),I=$.value.indexOf("/**",x>-1?x+2:0);if(I!==-1&&w>I&&w<I+3||x!==-1&&I!==-1&&w>=x&&w<=I||!/\.doc/.test($.type))return;break}}var O=this.$getIndent(M);if(/\s*\*/.test(_))return/^\s*\*/.test(M)?{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(M.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 D=m.getCursorPosition(),E=new d(y,D.row,D.column);if(!this.$matchTokenType(E.getCurrentToken()||"text",p)){if(/[)}\]]/.test(m.session.getLine(D.row)[D.column]))return!0;var b=new d(y,D.row,D.column+1);if(!this.$matchTokenType(b.getCurrentToken()||"text",p))return!1}return E.stepForward(),E.getCurrentTokenRow()!==D.row||this.$matchTokenType(E.getCurrentToken()||"text",e)},f.$matchTokenType=function(m,y){return y.indexOf(m.type||m)>-1},f.recordAutoInsert=function(m,y,D){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=D+b.substr(E.column),t.autoInsertedBrackets++},f.recordMaybeInsert=function(m,y,D){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)+D,t.maybeInsertedLineEnd=b.substr(E.column),t.maybeInsertedBrackets++},f.isAutoInsertedClosing=function(m,y,D){return t.autoInsertedBrackets>0&&m.row===t.autoInsertedRow&&D===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,h),u.CstyleBehaviour=f}),ace.define("ace/unicode",["require","exports","module"],function(i,u,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],h=0,d=[],o=0;o<s.length;o+=2)d.push(h+=s[o]),s[o+1]&&d.push(45,h+=s[o+1]);u.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,u,v){var s=i("../config"),h=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,l;l=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 h(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(a,c,f,m){var y=c.doc,D=!0,E=!0,b=1/0,g=c.getTabSize(),S=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var T=this.lineCommentStart.map(e.escapeRegExp).join("|"),M=this.lineCommentStart[0];else var T=e.escapeRegExp(this.lineCommentStart),M=this.lineCommentStart;T=new RegExp("^(\\s*)(?:"+T+") ?"),S=c.getUseSoftTabs();var $=function(V,W){var H=V.match(T);if(H){var U=H[1].length,G=H[0].length;!x(V,U,G)&&H[0][G-1]==" "&&G--,y.removeInLine(W,U,G)}},w=M+" ",A=function(V,W){(!D||/\S/.test(V))&&(x(V,b,b)?y.insertInLine({row:W,column:b},w):y.insertInLine({row:W,column:b},M))},C=function(V,W){return T.test(V)},x=function(V,W,H){for(var U=0;W--&&V.charAt(W)==" ";)U++;if(U%g!=0)return!1;for(var U=0;V.charAt(H++)==" ";)U++;return g>2?U%g!=g-1:U%g==0}}else{if(!this.blockComment)return!1;var M=this.blockComment.start,_=this.blockComment.end,T=new RegExp("^(\\s*)(?:"+e.escapeRegExp(M)+")"),F=new RegExp("(?:"+e.escapeRegExp(_)+")\\s*$"),A=function(R,P){C(R,P)||(!D||/\S/.test(R))&&(y.insertInLine({row:P,column:R.length},_),y.insertInLine({row:P,column:b},M))},$=function(R,P){var B;(B=R.match(F))&&y.removeInLine(P,R.length-B[0].length,R.length),(B=R.match(T))&&y.removeInLine(P,B[1].length,B[0].length)},C=function(R,P){if(T.test(R))return!0;for(var B=c.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&&!C(R,P)&&(E=!1)):O>R.length&&(O=R.length)}),b==1/0&&(b=O,D=!1,E=!1),S&&b%g!=0&&(b=Math.floor(b/g)*g),I(E?$:A)},this.toggleBlockComment=function(a,c,f,m){var y=this.blockComment;if(y){!y.start&&y[0]&&(y=y[0]);var D=new t(c,m.row,m.column),E=D.getCurrentToken();c.selection;var b=c.selection.toOrientedRange(),g,S;if(E&&/comment/.test(E.type)){for(var M,_;E&&/comment/.test(E.type);){var T=E.value.indexOf(y.start);if(T!=-1){var F=D.getCurrentTokenRow(),A=D.getCurrentTokenColumn()+T;M=new r(F,A,F,A+y.start.length);break}E=D.stepBackward()}for(var D=new t(c,m.row,m.column),E=D.getCurrentToken();E&&/comment/.test(E.type);){var T=E.value.indexOf(y.end);if(T!=-1){var F=D.getCurrentTokenRow(),A=D.getCurrentTokenColumn()+T;_=new r(F,A,F,A+y.end.length);break}E=D.stepForward()}_&&c.remove(_),M&&(c.remove(M),g=M.start.row,S=-y.start.length)}else S=y.start.length,g=f.start.row,c.insert(f.end,y.end),c.insert(f.start,y.start);b.start.row==g&&(b.start.column+=S),b.end.row==g&&(b.end.column+=S),c.selection.fromOrientedRange(b)}},this.getNextLineIndent=function(a,c,f){return this.$getIndent(c)},this.checkOutdent=function(a,c,f){return!1},this.autoOutdent=function(a,c,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 c in a)if(a[c]){var f=a[c],m=f.prototype.$id,y=s.$modes[m];y||(s.$modes[m]=y=new f),s.$modes[c]||(s.$modes[c]=y),this.$embeds.push(c),this.$modes[c]=y}for(var D=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],E=function(g){(function(S){var M=D[g],_=S[M];S[D[g]]=function(){return this.$delegator(M,arguments,_)}})(b)},b=this,c=0;c<D.length;c++)E(c)},this.$delegator=function(a,c,f){var m=c[0]||"start";if(typeof m!="string"){if(Array.isArray(m[2])){var y=m[2][m[2].length-1],D=this.$modes[y];if(D)return D[a].apply(D,[m[1]].concat([].slice.call(c,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]){c[0]=b[1];var D=this.$modes[this.$embeds[E]];return D[a].apply(D,c)}}var g=f.apply(this,c);return f?g:void 0},this.transformAction=function(a,c,f,m,y){if(this.$behaviour){var D=this.$behaviour.getBehaviours();for(var E in D)if(D[E][c]){var b=D[E][c].apply(this,arguments);if(b)return b}}},this.getKeywords=function(a){if(!this.completionKeywords){var c=this.$tokenizer.rules,f=[];for(var m in c)for(var y=c[m],D=0,E=y.length;D<E;D++)if(typeof y[D].token=="string")/keyword|support|storage/.test(y[D].token)&&f.push(y[D].regex);else if(typeof y[D].token=="object"){for(var b=0,g=y[D].token.length;b<g;b++)if(/keyword|support|storage/.test(y[D].token[b])){var m=y[D].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,c,f,m){var y=this.$keywordList||this.$createKeywordList();return y.map(function(D){return{name:D,value:D,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}.call(l.prototype),u.Mode=l}),ace.define("ace/line_widgets",["require","exports","module","ace/lib/dom"],function(i,u,v){var s=i("./lib/dom"),h=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,l=t.end.row,a=o.action=="add",c=r+1;c<l;c++)e[c]&&(e[c].hidden=a);e[l]&&(a?e[r]?e[l].hidden=a:e[r]=e[l]:(e[r]==e[l]&&(e[r]=void 0),e[l].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 l=new Array(t);p[e]&&p[e].column!=null&&o.start.column>p[e].column&&e++,l.unshift(e,0),p.splice.apply(p,l),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,l=0;l<e.length;l++){var a=e[l];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 c=a.h/t.lineHeight;a.coverLine&&(c-=this.session.getRowLineCount(a.row),c<0&&(c=0)),a.rowCount!=c&&(a.rowCount=c,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),l=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<=l;a++){var c=t[a];if(!(!c||!c.el)){if(c.hidden){c.el.style.top=-100-(c.pixelHeight||0)+"px";continue}c._inDocument||(c._inDocument=!0,p.container.appendChild(c.el));var f=p.$cursorLayer.getPixelPosition({row:a,column:0},!0).top;c.coverLine||(f+=e.lineHeight*this.session.getRowLineCount(c.row)),c.el.style.top=f-e.offset+"px";var m=c.coverGutter?0:p.gutterWidth;c.fixedWidth||(m-=p.scrollLeft),c.el.style.left=m+"px",c.fullWidth&&c.screenWidth&&(c.el.style.minWidth=e.width+2*e.padding+"px"),c.fixedWidth?c.el.style.right=p.scrollBar.getWidth()+"px":c.el.style.right=""}}}},d}();u.LineWidgets=h}),ace.define("ace/apply_delta",["require","exports","module"],function(i,u,v){u.applyDelta=function(s,h,d){var o=h.start.row,p=h.start.column,e=s[o]||"";switch(h.action){case"insert":var t=h.lines;if(t.length===1)s[o]=e.substring(0,p)+h.lines[0]+e.substring(p);else{var r=[o,1].concat(h.lines);s.splice.apply(s,r),s[o]=e.substring(0,p)+s[o],s[o+h.lines.length-1]+=e.substring(p)}break;case"remove":var l=h.end.column,a=h.end.row;o===a?s[o]=e.substring(0,p)+e.substring(l):s.splice(o,a-o+1,e.substring(0,p)+s[a].substring(l));break}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(i,u,v){var s=i("./lib/oop"),h=i("./lib/event_emitter").EventEmitter,d=function(){function e(t,r,l){this.$onChange=this.onChange.bind(this),this.attach(t),typeof r!="number"?this.setPosition(r.row,r.column):this.setPosition(r,l)}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,l){var a;if(l?a={row:t,column:r}:a=this.$clipPositionToDocument(t,r),!(this.row==a.row&&this.column==a.column)){var c={row:this.row,column:this.column};this.row=a.row,this.column=a.column,this._signal("change",{old:c,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 l={};return t>=this.document.getLength()?(l.row=Math.max(0,this.document.getLength()-1),l.column=this.document.getLine(l.row).length):t<0?(l.row=0,l.column=0):(l.row=t,l.column=Math.min(this.document.getLine(l.row).length,Math.max(0,r))),r<0&&(l.column=0),l},e}();d.prototype.$insertRight=!1,s.implement(d.prototype,h);function o(e,t,r){var l=r?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&l}function p(e,t,r){var l=e.action=="insert",a=(l?1:-1)*(e.end.row-e.start.row),c=(l?1:-1)*(e.end.column-e.start.column),f=e.start,m=l?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?c:0)}:{row:f.row,column:f.column}}u.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,u,v){var s=i("./lib/oop"),h=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 l=this.getLength()-1;this.remove(new o(0,0,l,this.getLine(l).length)),this.insert({row:0,column:0},r||"")},t.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},t.prototype.createAnchor=function(r,l){return new p(this,r,l)},t.prototype.$detectNewLine=function(r){var l=r.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=l?l[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,l){return this.$lines.slice(r,l+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 l;if(r.start.row===r.end.row)l=[this.getLine(r.start.row).substring(r.start.column,r.end.column)];else{l=this.getLines(r.start.row,r.end.row),l[0]=(l[0]||"").substring(r.start.column);var a=l.length-1;r.end.row-r.start.row==a&&(l[a]=l[a].substring(0,r.end.column))}return l},t.prototype.insertLines=function(r,l){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(r,l)},t.prototype.removeLines=function(r,l){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(r,l)},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,l){return this.getLength()<=1&&this.$detectNewLine(l),this.insertMergedLines(r,this.$split(l))},t.prototype.insertInLine=function(r,l){var a=this.clippedPos(r.row,r.column),c=this.pos(r.row,r.column+l.length);return this.applyDelta({start:a,end:c,action:"insert",lines:[l]},!0),this.clonePos(c)},t.prototype.clippedPos=function(r,l){var a=this.getLength();r===void 0?r=a:r<0?r=0:r>=a&&(r=a-1,l=void 0);var c=this.getLine(r);return l==null&&(l=c.length),l=Math.min(Math.max(l,0),c.length),{row:r,column:l}},t.prototype.clonePos=function(r){return{row:r.row,column:r.column}},t.prototype.pos=function(r,l){return{row:r,column:l}},t.prototype.$clipPosition=function(r){var l=this.getLength();return r.row>=l?(r.row=Math.max(0,l-1),r.column=this.getLine(l-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,l){r=Math.min(Math.max(r,0),this.getLength());var a=0;r<this.getLength()?(l=l.concat([""]),a=0):(l=[""].concat(l),r--,a=this.$lines[r].length),this.insertMergedLines({row:r,column:a},l)},t.prototype.insertMergedLines=function(r,l){var a=this.clippedPos(r.row,r.column),c={row:a.row+l.length-1,column:(l.length==1?a.column:0)+l[l.length-1].length};return this.applyDelta({start:a,end:c,action:"insert",lines:l}),this.clonePos(c)},t.prototype.remove=function(r){var l=this.clippedPos(r.start.row,r.start.column),a=this.clippedPos(r.end.row,r.end.column);return this.applyDelta({start:l,end:a,action:"remove",lines:this.getLinesForRange({start:l,end:a})}),this.clonePos(l)},t.prototype.removeInLine=function(r,l,a){var c=this.clippedPos(r,l),f=this.clippedPos(r,a);return this.applyDelta({start:c,end:f,action:"remove",lines:this.getLinesForRange({start:c,end:f})},!0),this.clonePos(c)},t.prototype.removeFullLines=function(r,l){r=Math.min(Math.max(0,r),this.getLength()-1),l=Math.min(Math.max(0,l),this.getLength()-1);var a=l==this.getLength()-1&&r>0,c=l<this.getLength()-1,f=a?r-1:r,m=a?this.getLine(f).length:0,y=c?l+1:l,D=c?0:this.getLine(y).length,E=new s(f,m,y,D),b=this.$lines.slice(r,l+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,l){if(r instanceof s||(r=s.fromPoints(r.start,r.end)),l.length===0&&r.isEmpty())return r.start;if(l==this.getTextRange(r))return r.end;this.remove(r);var a;return l?a=this.insert(r.start,l):a=r.start,a},t.prototype.applyDeltas=function(r){for(var l=0;l<r.length;l++)this.applyDelta(r[l])},t.prototype.revertDeltas=function(r){for(var l=r.length-1;l>=0;l--)this.revertDelta(r[l])},t.prototype.applyDelta=function(r,l){var a=r.action=="insert";(a?r.lines.length<=1&&!r.lines[0]:!s.comparePoints(r.start,r.end))||(a&&r.lines.length>2e4?this.$splitAndapplyLargeDelta(r,2e4):(h(this.$lines,r,l),this._signal("change",r)))},t.prototype.$safeApplyDelta=function(r){var l=this.$lines.length;(r.action=="remove"&&r.start.row<l&&r.end.row<l||r.action=="insert"&&r.start.row<=l)&&this.applyDelta(r)},t.prototype.$splitAndapplyLargeDelta=function(r,l){for(var a=r.lines,c=a.length-l+1,f=r.start.row,m=r.start.column,y=0,D=0;y<c;y=D){D+=l-1;var E=a.slice(y,D);E.push(""),this.applyDelta({start:this.pos(f+y,m),end:this.pos(f+D,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,l){for(var a=this.$lines||this.getAllLines(),c=this.getNewLineCharacter().length,f=l||0,m=a.length;f<m;f++)if(r-=a[f].length+c,r<0)return{row:f,column:r+a[f].length+c};return{row:m-1,column:r+a[m-1].length+c}},t.prototype.positionToIndex=function(r,l){for(var a=this.$lines||this.getAllLines(),c=this.getNewLineCharacter().length,f=0,m=Math.min(r.row,a.length),y=l||0;y<m;++y)f+=a[y].length+c;return f+r.column},t.prototype.$split=function(r){return r.split(/\r\n|\r|\n/)},t}();e.prototype.$autoNewLine="",e.prototype.$newLineMode="auto",o.implement(e.prototype,d),u.Document=e}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(i,u,v){var o=i("./lib/oop"),h=i("./lib/event_emitter").EventEmitter,d=function(){function s(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,l=t.currentLine,a=-1,c=t.doc,f=l;t.lines[l];)l++;var m=c.getLength(),y=0;for(t.running=!1;l<m;){t.$tokenizeRow(l),a=l;do l++;while(t.lines[l]);if(y++,y%5===0&&new Date-r>20){t.running=setTimeout(t.$worker,20);break}}t.currentLine=l,a==-1&&(a=l),f<=a&&t.fireUpdateEvent(f,a)}}}return s.prototype.setTokenizer=function(p){this.tokenizer=p,this.lines=[],this.states=[],this.start(0)},s.prototype.setDocument=function(p){this.doc=p,this.lines=[],this.states=[],this.stop()},s.prototype.fireUpdateEvent=function(p,e){var t={first:p,last:e};this._signal("update",{data:t})},s.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)},s.prototype.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},s.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()},s.prototype.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},s.prototype.getTokens=function(p){return this.lines[p]||this.$tokenizeRow(p)},s.prototype.getState=function(p){return this.currentLine==p&&this.$tokenizeRow(p),this.states[p]||"start"},s.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},s.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},s}();o.implement(d.prototype,h),u.BackgroundTokenizer=d}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(i,u,v){var o=i("./lib/lang"),h=i("./range").Range,d=function(){function s(p,e,t){t===void 0&&(t="text"),this.setRegexp(p),this.clazz=e,this.type=t,this.docLen=0}return s.prototype.setRegexp=function(p){this.regExp+""!=p+""&&(this.regExp=p,this.cache=[])},s.prototype.update=function(p,e,t,r){if(this.regExp){for(var l=r.firstRow,a=r.lastRow,c={},f=t.$editor&&t.$editor.$search,m=f&&f.$isMultilineSearch(t.$editor.getLastSearchOptions()),y=l;y<=a;y++){var D=this.cache[y];if(D==null||t.getValue().length!=this.docLen){if(m){D=[];var E=f.$multiLineForward(t,this.regExp,y,a);if(E){var b=E.endRow<=a?E.endRow-1:a;b>y&&(y=b),D.push(new h(E.startRow,E.startCol,E.endRow,E.endCol))}D.length>this.MAX_RANGES&&(D=D.slice(0,this.MAX_RANGES))}else D=o.getMatchOffsets(t.getLine(y),this.regExp),D.length>this.MAX_RANGES&&(D=D.slice(0,this.MAX_RANGES)),D=D.map(function(_){return new h(y,_.offset,y,_.offset+_.length)});this.cache[y]=D.length?D:""}if(D.length!==0)for(var g=D.length;g--;){var S=D[g].toScreenRange(t),M=S.toString();c[M]||(c[M]=!0,e.drawSingleLineMarker(p,S,this.clazz,r))}}this.docLen=t.getValue().length}},s}();d.prototype.MAX_RANGES=500,u.SearchHighlight=d}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(i,u,v){var o=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,M){if(!this.$fromUndo&&g!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),S===!1||!this.lastDeltas){this.lastDeltas=[];var _=this.$undoStack.length;_>this.$undoDepth-1&&this.$undoStack.splice(0,_-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 M=this.$undoStack,_=M.length;_--;){var T=M[_][0];if(T.id<=g)break;T.id<S&&(T.ignore=!0)}this.lastDeltas=null},b.prototype.getSelection=function(g,S){for(var M=this.selections,_=M.length;_--;){var T=M[_];if(T.rev<g)return S&&(T=M[_+1]),T}},b.prototype.getRevision=function(){return this.$rev},b.prototype.getDeltas=function(g,S){S==null&&(S=this.$rev+1);for(var M=this.$undoStack,_=null,T=0,F=M.length;F--;){var A=M[F][0];if(A.id<S&&!_&&(_=F+1),A.id<=g){T=F+1;break}}return M.slice(T,_)},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 M=this.$undoStack;if(h(M,M.length)){g||(g=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var _=M.pop(),T=null;return _&&(T=g.undoChanges(_,S),this.$redoStack.push(_),this.$syncRev()),this.$fromUndo=!1,T}},b.prototype.redo=function(g,S){if(this.lastDeltas=null,g||(g=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var M=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);E(this.$redoStack,M),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(F){F[0].id=++this.$maxRev},this)}var _=this.$redoStack.pop(),T=null;return _&&(T=g.redoChanges(_,S),this.$undoStack.push(_),this.$syncRev()),this.$fromUndo=!1,T},b.prototype.$syncRev=function(){var g=this.$undoStack,S=g[g.length-1],M=S&&S[0].id||0;this.$redoStackBaseRev=M,this.$rev=M},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,l){return this.$lines.slice(r,l+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 l;if(r.start.row===r.end.row)l=[this.getLine(r.start.row).substring(r.start.column,r.end.column)];else{l=this.getLines(r.start.row,r.end.row),l[0]=(l[0]||"").substring(r.start.column);var a=l.length-1;r.end.row-r.start.row==a&&(l[a]=l[a].substring(0,r.end.column))}return l},t.prototype.insertLines=function(r,l){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(r,l)},t.prototype.removeLines=function(r,l){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(r,l)},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,l){return this.getLength()<=1&&this.$detectNewLine(l),this.insertMergedLines(r,this.$split(l))},t.prototype.insertInLine=function(r,l){var a=this.clippedPos(r.row,r.column),c=this.pos(r.row,r.column+l.length);return this.applyDelta({start:a,end:c,action:"insert",lines:[l]},!0),this.clonePos(c)},t.prototype.clippedPos=function(r,l){var a=this.getLength();r===void 0?r=a:r<0?r=0:r>=a&&(r=a-1,l=void 0);var c=this.getLine(r);return l==null&&(l=c.length),l=Math.min(Math.max(l,0),c.length),{row:r,column:l}},t.prototype.clonePos=function(r){return{row:r.row,column:r.column}},t.prototype.pos=function(r,l){return{row:r,column:l}},t.prototype.$clipPosition=function(r){var l=this.getLength();return r.row>=l?(r.row=Math.max(0,l-1),r.column=this.getLine(l-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,l){r=Math.min(Math.max(r,0),this.getLength());var a=0;r<this.getLength()?(l=l.concat([""]),a=0):(l=[""].concat(l),r--,a=this.$lines[r].length),this.insertMergedLines({row:r,column:a},l)},t.prototype.insertMergedLines=function(r,l){var a=this.clippedPos(r.row,r.column),c={row:a.row+l.length-1,column:(l.length==1?a.column:0)+l[l.length-1].length};return this.applyDelta({start:a,end:c,action:"insert",lines:l}),this.clonePos(c)},t.prototype.remove=function(r){var l=this.clippedPos(r.start.row,r.start.column),a=this.clippedPos(r.end.row,r.end.column);return this.applyDelta({start:l,end:a,action:"remove",lines:this.getLinesForRange({start:l,end:a})}),this.clonePos(l)},t.prototype.removeInLine=function(r,l,a){var c=this.clippedPos(r,l),f=this.clippedPos(r,a);return this.applyDelta({start:c,end:f,action:"remove",lines:this.getLinesForRange({start:c,end:f})},!0),this.clonePos(c)},t.prototype.removeFullLines=function(r,l){r=Math.min(Math.max(0,r),this.getLength()-1),l=Math.min(Math.max(0,l),this.getLength()-1);var a=l==this.getLength()-1&&r>0,c=l<this.getLength()-1,f=a?r-1:r,m=a?this.getLine(f).length:0,y=c?l+1:l,D=c?0:this.getLine(y).length,E=new o(f,m,y,D),b=this.$lines.slice(r,l+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,l){if(r instanceof o||(r=o.fromPoints(r.start,r.end)),l.length===0&&r.isEmpty())return r.start;if(l==this.getTextRange(r))return r.end;this.remove(r);var a;return l?a=this.insert(r.start,l):a=r.start,a},t.prototype.applyDeltas=function(r){for(var l=0;l<r.length;l++)this.applyDelta(r[l])},t.prototype.revertDeltas=function(r){for(var l=r.length-1;l>=0;l--)this.revertDelta(r[l])},t.prototype.applyDelta=function(r,l){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):(h(this.$lines,r,l),this._signal("change",r)))},t.prototype.$safeApplyDelta=function(r){var l=this.$lines.length;(r.action=="remove"&&r.start.row<l&&r.end.row<l||r.action=="insert"&&r.start.row<=l)&&this.applyDelta(r)},t.prototype.$splitAndapplyLargeDelta=function(r,l){for(var a=r.lines,c=a.length-l+1,f=r.start.row,m=r.start.column,y=0,D=0;y<c;y=D){D+=l-1;var E=a.slice(y,D);E.push(""),this.applyDelta({start:this.pos(f+y,m),end:this.pos(f+D,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,l){for(var a=this.$lines||this.getAllLines(),c=this.getNewLineCharacter().length,f=l||0,m=a.length;f<m;f++)if(r-=a[f].length+c,r<0)return{row:f,column:r+a[f].length+c};return{row:m-1,column:r+a[m-1].length+c}},t.prototype.positionToIndex=function(r,l){for(var a=this.$lines||this.getAllLines(),c=this.getNewLineCharacter().length,f=0,m=Math.min(r.row,a.length),y=l||0;y<m;++y)f+=a[y].length+c;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),u.Document=e}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(i,u,v){var s=i("./lib/oop"),h=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,l=t.currentLine,a=-1,c=t.doc,f=l;t.lines[l];)l++;var m=c.getLength(),y=0;for(t.running=!1;l<m;){t.$tokenizeRow(l),a=l;do l++;while(t.lines[l]);if(y++,y%5===0&&new Date-r>20){t.running=setTimeout(t.$worker,20);break}}t.currentLine=l,a==-1&&(a=l),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,h),u.BackgroundTokenizer=d}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(i,u,v){var s=i("./lib/lang"),h=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 l=r.firstRow,a=r.lastRow,c={},f=t.$editor&&t.$editor.$search,m=f&&f.$isMultilineSearch(t.$editor.getLastSearchOptions()),y=l;y<=a;y++){var D=this.cache[y];if(D==null||t.getValue().length!=this.docLen){if(m){D=[];var E=f.$multiLineForward(t,this.regExp,y,a);if(E){var b=E.endRow<=a?E.endRow-1:a;b>y&&(y=b),D.push(new h(E.startRow,E.startCol,E.endRow,E.endCol))}D.length>this.MAX_RANGES&&(D=D.slice(0,this.MAX_RANGES))}else D=s.getMatchOffsets(t.getLine(y),this.regExp),D.length>this.MAX_RANGES&&(D=D.slice(0,this.MAX_RANGES)),D=D.map(function(_){return new h(y,_.offset,y,_.offset+_.length)});this.cache[y]=D.length?D:""}if(D.length!==0)for(var g=D.length;g--;){var S=D[g].toScreenRange(t),M=S.toString();c[M]||(c[M]=!0,e.drawSingleLineMarker(p,S,this.clazz,r))}}this.docLen=t.getValue().length}},o}();d.prototype.MAX_RANGES=500,u.SearchHighlight=d}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(i,u,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,M){if(!this.$fromUndo&&g!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),S===!1||!this.lastDeltas){this.lastDeltas=[];var _=this.$undoStack.length;_>this.$undoDepth-1&&this.$undoStack.splice(0,_-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 M=this.$undoStack,_=M.length;_--;){var T=M[_][0];if(T.id<=g)break;T.id<S&&(T.ignore=!0)}this.lastDeltas=null},b.prototype.getSelection=function(g,S){for(var M=this.selections,_=M.length;_--;){var T=M[_];if(T.rev<g)return S&&(T=M[_+1]),T}},b.prototype.getRevision=function(){return this.$rev},b.prototype.getDeltas=function(g,S){S==null&&(S=this.$rev+1);for(var M=this.$undoStack,_=null,T=0,F=M.length;F--;){var A=M[F][0];if(A.id<S&&!_&&(_=F+1),A.id<=g){T=F+1;break}}return M.slice(T,_)},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 M=this.$undoStack;if(h(M,M.length)){g||(g=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var _=M.pop(),T=null;return _&&(T=g.undoChanges(_,S),this.$redoStack.push(_),this.$syncRev()),this.$fromUndo=!1,T}},b.prototype.redo=function(g,S){if(this.lastDeltas=null,g||(g=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var M=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);E(this.$redoStack,M),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(F){F[0].id=++this.$maxRev},this)}var _=this.$redoStack.pop(),T=null;return _&&(T=g.redoChanges(_,S),this.$undoStack.push(_),this.$syncRev()),this.$fromUndo=!1,T},b.prototype.$syncRev=function(){var g=this.$undoStack,S=g[g.length-1],M=S&&S[0].id||0;this.$redoStackBaseRev=M,this.$rev=M},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)+`
|
|
206
206
|
---
|
|
207
|
-
`+t(this.$redoStack)},b}();
|
|
207
|
+
`+t(this.$redoStack)},b}();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 h(b,g){for(var S=g;S--;){var M=b[S];if(M&&!M[0].ignore){for(;S<g-1;){var _=a(b[S],b[S+1]);b[S]=_[0],b[S+1]=_[1],S++}return!0}}}var d=i("./range").Range,o=d.comparePoints;d.comparePoints;function p(b){return{row:b.row,column:b.column}}function e(b){return{start:p(b.start),end:p(b.end),action:b.action,lines:b.lines.slice()}}function t(b){if(b=b||this,Array.isArray(b))return b.map(t).join(`
|
|
208
208
|
`);var g="";return b.action?(g=b.action=="insert"?"+":"-",g+="["+b.lines+"]"):b.value&&(Array.isArray(b.value)?g=b.value.map(r).join(`
|
|
209
|
-
`):g=r(b.value)),b.start&&(g+=r(b)),(b.id||b.rev)&&(g+=" ("+(b.id||b.rev)+")"),g}function r(b){return b.start.row+":"+b.start.column+"=>"+b.end.row+":"+b.end.column}function l(b,g){var S=b.action=="insert",M=g.action=="insert";if(S&&M)if(
|
|
210
|
-
`)},d.prototype.idxToPosition=function(s){for(var p=0,e=0;e<this.folds.length;e++){var t=this.folds[e];if(s-=t.start.column-p,s<0)return{row:t.start.row,column:t.start.column+s};if(s-=t.placeholder.length,s<0)return t.start;p=t.end.column}return{row:this.end.row,column:this.end.column+s}},d}();u.FoldLine=h}),ace.define("ace/range_list",["require","exports","module","ace/range"],function(i,u,v){var o=i("./range").Range,h=o.comparePoints,d=function(){function s(){this.ranges=[],this.$bias=1}return s.prototype.pointIndex=function(p,e,t){for(var r=this.ranges,l=t||0;l<r.length;l++){var a=r[l],c=h(p,a.end);if(!(c>0)){var f=h(p,a.start);return c===0?e&&f!==0?-l-2:l:f>0||f===0&&!e?l:-l-1}}return-l-1},s.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)},s.prototype.addList=function(p){for(var e=[],t=p.length;t--;)e.push.apply(e,this.add(p[t]));return e},s.prototype.substractPoint=function(p){var e=this.pointIndex(p);if(e>=0)return this.ranges.splice(e,1)},s.prototype.merge=function(){var p=[],e=this.ranges;e=e.sort(function(c,f){return h(c.start,f.start)});for(var t=e[0],r,l=1;l<e.length;l++){r=t,t=e[l];var a=h(r.end,t.start);a<0||a==0&&!r.isEmpty()&&!t.isEmpty()||(h(r.end,t.end)<0&&(r.end.row=t.end.row,r.end.column=t.end.column),e.splice(l,1),p.push(t),t=r,l--)}return this.ranges=e,p},s.prototype.contains=function(p,e){return this.pointIndex({row:p,column:e})>=0},s.prototype.containsPoint=function(p){return this.pointIndex(p)>=0},s.prototype.rangeAtPoint=function(p){var e=this.pointIndex(p);if(e>=0)return this.ranges[e]},s.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 l=this.pointIndex({row:e,column:0},r);l<0&&(l=-l-1);for(var a=[],c=r;c<l;c++)a.push(t[c]);return a},s.prototype.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},s.prototype.attach=function(p){this.session&&this.detach(),this.session=p,this.onChange=this.$onChange.bind(this),this.session.on("change",this.onChange)},s.prototype.detach=function(){this.session&&(this.session.removeListener("change",this.onChange),this.session=null)},s.prototype.$onChange=function(p){for(var e=p.start,t=p.end,r=e.row,l=t.row,a=this.ranges,c=0,f=a.length;c<f;c++){var m=a[c];if(m.end.row>=r)break}if(p.action=="insert")for(var y=l-r,D=-e.column+t.column;c<f;c++){var m=a[c];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+=D,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&&D>0&&c<f-1&&m.end.column>m.start.column&&m.end.column==a[c+1].start.column&&(m.end.column-=D),m.end.column+=D,m.end.row+=y}}else for(var y=r-l,D=e.column-t.column;c<f;c++){var m=a[c];if(m.start.row>l)break;m.end.row<l&&(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==l?m.end.column<=t.column?(y||m.end.column>e.column)&&(m.end.column=e.column,m.end.row=e.row):(m.end.column+=D,m.end.row+=y):m.end.row>l&&(m.end.row+=y),m.start.row<l&&(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==l?m.start.column<=t.column?(y||m.start.column>e.column)&&(m.start.column=e.column,m.start.row=e.row):(m.start.column+=D,m.start.row+=y):m.start.row>l&&(m.start.row+=y)}if(y!=0&&c<f)for(;c<f;c++){var m=a[c];m.start.row+=y,m.end.row+=y}},s}();d.prototype.comparePoints=h,u.RangeList=d}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list"],function(i,u,v){var o=this&&this.__extends||function(){var r=function(l,a){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,f){c.__proto__=f}||function(c,f){for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(c[m]=f[m])},r(l,a)};return function(l,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(l,a);function c(){this.constructor=l}l.prototype=a===null?Object.create(a):(c.prototype=a.prototype,new c)}}(),h=i("../range_list").RangeList,d=function(r){o(l,r);function l(a,c){var f=r.call(this)||this;return f.foldLine=null,f.placeholder=c,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 l.prototype.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},l.prototype.setFoldLine=function(a){this.foldLine=a,this.subFolds.forEach(function(c){c.setFoldLine(a)})},l.prototype.clone=function(){var a=this.range.clone(),c=new l(a,this.placeholder);return this.subFolds.forEach(function(f){c.subFolds.push(f.clone())}),c.collapseChildren=this.collapseChildren,c},l.prototype.addSubFold=function(a){if(!this.range.isEqual(a)){p(a,this.start);for(var D=a.start.row,E=a.start.column,c=0,f=-1;c<this.subFolds.length&&(f=this.subFolds[c].range.compare(D,E),f==1);c++);var m=this.subFolds[c],y=0;if(f==0){if(m.range.containsRange(a))return m.addSubFold(a);y=1}for(var D=a.range.end.row,E=a.range.end.column,b=c,f=-1;b<this.subFolds.length&&(f=this.subFolds[b].range.compare(D,E),f==1);b++);f==0&&b++;for(var g=this.subFolds.splice(c,b-c,a),S=f==0?g.length-1:g.length,M=y;M<S;M++)a.addSubFold(g[M]);return a.setFoldLine(this.foldLine),a}},l.prototype.restoreRange=function(a){return t(a,this.start)},l}(h);function s(r,l){r.row-=l.row,r.row==0&&(r.column-=l.column)}function p(r,l){s(r.start,l),s(r.end,l)}function e(r,l){r.row==0&&(r.column+=l.column),r.row+=l.row}function t(r,l){e(r.start,l),e(r.end,l)}u.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,u,v){var o=i("../range").Range,h=i("./fold_line").FoldLine,d=i("./fold").Fold,s=i("../token_iterator").TokenIterator,p=i("../mouse/mouse_event").MouseEvent;function e(){this.getFoldAt=function(t,r,l){var a=this.getFoldLine(t);if(!a)return null;for(var c=a.folds,f=0;f<c.length;f++){var m=c[f].range;if(m.contains(t,r)){if(l==1&&m.isEnd(t,r)&&!m.isEmpty())continue;if(l==-1&&m.isStart(t,r)&&!m.isEmpty())continue;return c[f]}}},this.getFoldsInRange=function(t){var r=t.start,l=t.end,a=this.$foldData,c=[];r.column+=1,l.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,D=0;D<y.length;D++){var E=y[D];if(m=E.range.compareRange(t),m==-2)break;if(m==2)continue;if(m==42)break;c.push(E)}}}return r.column-=1,l.column+=1,c},this.getFoldsInRangeList=function(t){if(Array.isArray(t)){var r=[];t.forEach(function(l){r=r.concat(this.getFoldsInRange(l))},this)}else var r=this.getFoldsInRange(t);return r},this.getAllFolds=function(){for(var t=[],r=this.$foldData,l=0;l<r.length;l++)for(var a=0;a<r[l].folds.length;a++)t.push(r[l].folds[a]);return t},this.getFoldStringAt=function(t,r,l,a){if(a=a||this.getFoldLine(t),!a)return null;for(var c={end:{column:0}},f,m,y=0;y<a.folds.length;y++){m=a.folds[y];var D=m.range.compareEnd(t,r);if(D==-1){f=this.getLine(m.start.row).substring(c.end.column,m.start.column);break}else if(D===0)return null;c=m}return f||(f=this.getLine(m.start.row).substring(c.end.column)),l==-1?f.substring(0,r-c.end.column):l==1?f.substring(r-c.end.column):f},this.getFoldLine=function(t,r){var l=this.$foldData,a=0;for(r&&(a=l.indexOf(r)),a==-1&&(a=0),a;a<l.length;a++){var c=l[a];if(c.start.row<=t&&c.end.row>=t)return c;if(c.end.row>t)return null}return null},this.getNextFoldLine=function(t,r){var l=this.$foldData,a=0;for(r&&(a=l.indexOf(r)),a==-1&&(a=0),a;a<l.length;a++){var c=l[a];if(c.end.row>=t)return c}return null},this.getFoldedRowCount=function(t,r){for(var l=this.$foldData,a=r-t+1,c=0;c<l.length;c++){var f=l[c],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,l){return r.start.row-l.start.row}),t},this.addFold=function(t,r){var l=this.$foldData,a=!1,c;t instanceof d?c=t:(c=new d(r,t),c.collapseChildren=r.collapseChildren),this.$clipRangeToDocument(c.range);var f=c.start.row,m=c.start.column,y=c.end.row,D=c.end.column,E=this.getFoldAt(f,m,1),b=this.getFoldAt(y,D,-1);if(E&&b==E)return E.addSubFold(c);E&&!E.range.isStart(f,m)&&this.removeFold(E),b&&!b.range.isEnd(y,D)&&this.removeFold(b);var g=this.getFoldsInRange(c.range);g.length>0&&(this.removeFolds(g),c.collapseChildren||g.forEach(function(T){c.addSubFold(T)}));for(var S=0;S<l.length;S++){var M=l[S];if(y==M.start.row){M.addFold(c),a=!0;break}else if(f==M.end.row){if(M.addFold(c),a=!0,!c.sameRow){var _=l[S+1];if(_&&_.start.row==y){M.merge(_);break}}break}else if(y<=M.start.row)break}return a||(M=this.$addFoldLine(new h(this.$foldData,c))),this.$useWrapMode?this.$updateWrapData(M.start.row,M.start.row):this.$updateRowLengthCache(M.start.row,M.start.row),this.$modified=!0,this._signal("changeFold",{data:c,action:"add"}),c},this.addFolds=function(t){t.forEach(function(r){this.addFold(r)},this)},this.removeFold=function(t){var r=t.foldLine,l=r.start.row,a=r.end.row,c=this.$foldData,f=r.folds;if(f.length==1)c.splice(c.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(l,a):this.$updateRowLengthCache(l,a)),this.$modified=!0,this._signal("changeFold",{data:t,action:"remove"})},this.removeFolds=function(t){for(var r=[],l=0;l<t.length;l++)r.push(t[l]);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 l,a;if(t==null)l=new o(0,0,this.getLength(),0),r==null&&(r=!0);else if(typeof t=="number")l=new o(t,0,t,this.getLine(t).length);else if("row"in t)l=o.fromPoints(t,t);else{if(Array.isArray(t))return a=[],t.forEach(function(f){a=a.concat(this.unfold(f))},this),a;l=t}a=this.getFoldsInRangeList(l);for(var c=a;a.length==1&&o.comparePoints(a[0].start,l.start)<0&&o.comparePoints(a[0].end,l.end)>0;)this.expandFolds(a),a=this.getFoldsInRangeList(l);if(r!=!1?this.removeFolds(a):this.expandFolds(a),c.length)return c},this.isRowFolded=function(t,r){return!!this.getFoldLine(t,r)},this.getRowFoldEnd=function(t,r){var l=this.getFoldLine(t,r);return l?l.end.row:t},this.getRowFoldStart=function(t,r){var l=this.getFoldLine(t,r);return l?l.start.row:t},this.getFoldDisplayLine=function(t,r,l,a,c){a==null&&(a=t.start.row),c==null&&(c=0),r==null&&(r=t.end.row),l==null&&(l=this.getLine(r).length);var f=this.doc,m="";return t.walk(function(y,D,E,b){if(!(D<a)){if(D==a){if(E<c)return;b=Math.max(c,b)}y!=null?m+=y:m+=f.getLine(D).substring(b,E)}},r,l),m},this.getDisplayLine=function(t,r,l,a){var c=this.getFoldLine(t);if(c)return this.getFoldDisplayLine(c,t,r,l,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 l=r.folds.map(function(a){return a.clone()});return new h(t,l)}),t},this.toggleFold=function(t){var r=this.selection,l=r.getRange(),a,c;if(l.isEmpty()){var f=l.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(c=this.findMatchingBracket(f))?l.comparePoint(c)==1?l.end=c:(l.start=c,l.start.column++,l.end.column--):(c=this.findMatchingBracket({row:f.row,column:f.column+1}))?(l.comparePoint(c)==1?l.end=c:l.start=c,l.start.column++):l=this.getCommentFoldRange(f.row,f.column)||l}else{var y=this.getFoldsInRange(l);if(t&&y.length){this.expandFolds(y);return}else y.length==1&&(a=y[0])}if(a||(a=this.getFoldAt(l.start.row,l.start.column)),a&&a.range.toString()==l.toString()){this.expandFold(a);return}var D="...";if(!l.isMultiLine()){if(D=this.getTextRange(l),D.length<4)return;D=D.trim().substring(0,2)+".."}this.addFold(D,l)},this.getCommentFoldRange=function(t,r,l){var a=new s(this,t,r),c=a.getCurrentToken(),f=c&&c.type;if(c&&/^comment|string/.test(f)){f=f.match(/comment|string/)[0],f=="comment"&&(f+="|doc-start|\\.doc");var m=new RegExp(f),y=new o;if(l!=1){do c=a.stepBackward();while(c&&m.test(c.type));c=a.stepForward()}y.start.row=a.getCurrentTokenRow(),y.start.column=a.getCurrentTokenColumn()+c.value.length,a=new s(this,t,r);var D=this.getState(a.$row);if(l!=-1){var E=-1;do if(c=a.stepForward(),E==-1){var b=this.getState(a.$row);D.toString()!==b.toString()&&(E=a.$row)}else if(a.$row>E)break;while(c&&m.test(c.type));c=a.stepBackward()}else c=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,l,a){l==null&&(l=1e5);var c=this.foldWidgets;if(c){r=r||this.getLength(),t=t||0;for(var f=t;f<r;f++)if(c[f]==null&&(c[f]=this.getFoldWidget(f)),c[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=l,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 l=t.getTokens(r),a=0;a<l.length;a++){var c=l[a];if(!(c.type=="text"&&/^\s+$/.test(c.value)))return!!/comment/.test(c.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 l=this.foldWidgets;if(!l||r&&l[t])return{};for(var a=t-1,c;a>=0;){var f=l[a];if(f==null&&(f=l[a]=this.getFoldWidget(a)),f=="start"){var m=this.getFoldWidgetRange(a);if(c||(c=m),m&&m.end.row>=t)break}a--}return{range:a!==-1&&m,firstRange:c}},this.onFoldWidgetClick=function(t,r){r instanceof p&&(r=r.domEvent);var l={children:r.shiftKey,all:r.ctrlKey||r.metaKey,siblings:r.altKey},a=this.$toggleFoldWidget(t,l);if(!a){var c=r.target||r.srcElement;c&&/ace_fold-widget/.test(c.className)&&(c.className+=" ace_invalid")}},this.$toggleFoldWidget=function(t,r){if(this.getFoldWidget){var l=this.getFoldWidget(t),a=this.getLine(t),c=l==="end"?-1:1,f=this.getFoldAt(t,c===-1?0:a.length,c);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 D=y.range.start.row+1,E=y.range.end.row;this.foldAll(D,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 l=this.$toggleFoldWidget(r,{});if(!l){var a=this.getParentFoldRangeData(r,!0);if(l=a.range||a.firstRange,l){r=l.start.row;var c=this.getFoldAt(r,this.getLine(r).length,1);c?this.removeFold(c):this.addFold("...",l)}}},this.updateFoldWidgets=function(t){var r=t.start.row,l=t.end.row-r;if(l===0)this.foldWidgets[r]=null;else if(t.action=="remove")this.foldWidgets.splice(r,l+1,null);else{var a=Array(l+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)}}u.Folding=e}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(i,u,v){var o=i("../token_iterator").TokenIterator,h=i("../range").Range;function d(){this.findMatchingBracket=function(s,p){if(s.column==0)return null;var e=p||this.getLine(s.row).charAt(s.column-1);if(e=="")return null;var t=e.match(/([\(\[\{])|([\)\]\}])/);return t?t[1]?this.$findClosingBracket(t[1],s):this.$findOpeningBracket(t[2],s):null},this.getBracketRange=function(s){var p=this.getLine(s.row),e=!0,t,r=p.charAt(s.column-1),l=r&&r.match(/([\(\[\{])|([\)\]\}])/);if(l||(r=p.charAt(s.column),s={row:s.row,column:s.column+1},l=r&&r.match(/([\(\[\{])|([\)\]\}])/),e=!1),!l)return null;if(l[1]){var a=this.$findClosingBracket(l[1],s);if(!a)return null;t=h.fromPoints(s,a),e||(t.end.column++,t.start.column--),t.cursor=t.end}else{var a=this.$findOpeningBracket(l[2],s);if(!a)return null;t=h.fromPoints(a,s),e||(t.start.column++,t.end.column--),t.cursor=t.start}return t},this.getMatchingBracketRanges=function(s,p){var e=this.getLine(s.row),t=/([\(\[\{])|([\)\]\}])/,r=!p&&e.charAt(s.column-1),l=r&&r.match(t);if(l||(r=(p===void 0||p)&&e.charAt(s.column),s={row:s.row,column:s.column+1},l=r&&r.match(t)),!l)return null;var a=new h(s.row,s.column-1,s.row,s.column),c=l[1]?this.$findClosingBracket(l[1],s):this.$findOpeningBracket(l[2],s);if(!c)return[a];var f=new h(c.row,c.column,c.row,c.column+1);return[a,f]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(s,p,e){var t=this.$brackets[s],r=1,l=new o(this,p.row,p.column),a=l.getCurrentToken();if(a||(a=l.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 c=p.column-l.getCurrentTokenColumn()-2,f=a.value;;){for(;c>=0;){var m=f.charAt(c);if(m==t){if(r-=1,r==0)return{row:l.getCurrentTokenRow(),column:c+l.getCurrentTokenColumn()}}else m==s&&(r+=1);c-=1}do a=l.stepBackward();while(a&&!e.test(a.type));if(a==null)break;f=a.value,c=f.length-1}return null}},this.$findClosingBracket=function(s,p,e){var t=this.$brackets[s],r=1,l=new o(this,p.row,p.column),a=l.getCurrentToken();if(a||(a=l.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 c=p.column-l.getCurrentTokenColumn();;){for(var f=a.value,m=f.length;c<m;){var y=f.charAt(c);if(y==t){if(r-=1,r==0)return{row:l.getCurrentTokenRow(),column:c+l.getCurrentTokenColumn()}}else y==s&&(r+=1);c+=1}do a=l.stepForward();while(a&&!e.test(a.type));if(a==null)break;c=0}return null}},this.getMatchingTags=function(s){var p=new o(this,s.row,s.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(s){var p=s.getCurrentToken(),e=!1,t=!1;if(p&&p.type.indexOf("tag-name")===-1)do t?p=s.stepBackward():p=s.stepForward(),p&&(p.value==="/>"?t=!0:p.type.indexOf("tag-name")!==-1&&(e=!0));while(p&&!e);return p},this.$findClosingTag=function(s,p){var e,t=p.value,r=p.value,l=0,a=new h(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1);p=s.stepForward();var c=new h(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+p.value.length),f=!1;do{if(e=p,e.type.indexOf("tag-close")!==-1&&!f){var m=new h(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1);f=!0}if(p=s.stepForward(),p){if(p.value===">"&&!f){var m=new h(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1);f=!0}if(p.type.indexOf("tag-name")!==-1){if(t=p.value,r===t){if(e.value==="<")l++;else if(e.value==="</"&&(l--,l<0)){s.stepBackward();var y=new h(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+2);p=s.stepForward();var D=new h(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+p.value.length);if(p.type.indexOf("tag-close")===-1&&(p=s.stepForward()),p&&p.value===">")var E=new h(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1);else return}}}else if(r===t&&p.value==="/>"&&(l--,l<0))var y=new h(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+2),D=y,E=D,m=new h(c.end.row,c.end.column,c.end.row,c.end.column+1)}}while(p&&l>=0);if(a&&m&&y&&E&&c&&D)return{openTag:new h(a.start.row,a.start.column,m.end.row,m.end.column),closeTag:new h(y.start.row,y.start.column,E.end.row,E.end.column),openTagName:c,closeTagName:D}},this.$findOpeningTag=function(s,p){var e=s.getCurrentToken(),t=p.value,r=0,l=s.getCurrentTokenRow(),a=s.getCurrentTokenColumn(),c=a+2,f=new h(l,a,l,c);s.stepForward();var m=new h(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+p.value.length);if(p.type.indexOf("tag-close")===-1&&(p=s.stepForward()),!(!p||p.value!==">")){var y=new h(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1);s.stepBackward(),s.stepBackward();do if(p=e,l=s.getCurrentTokenRow(),a=s.getCurrentTokenColumn(),c=a+p.value.length,e=s.stepBackward(),p){if(p.type.indexOf("tag-name")!==-1){if(t===p.value)if(e.value==="<"){if(r++,r>0){var D=new h(l,a,l,c),E=new h(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1);do p=s.stepForward();while(p&&p.value!==">");var b=new h(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.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=s.stepBackward(),g++}for(var M=0;M<g;M++)s.stepForward()}}while(e&&r<=0);if(E&&b&&f&&y&&D&&m)return{openTag:new h(E.start.row,E.start.column,b.end.row,b.end.column),closeTag:new h(f.start.row,f.start.column,y.end.row,y.end.column),openTagName:D,closeTagName:m}}}}u.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,u,v){var o=i("./lib/oop"),h=i("./lib/lang"),d=i("./bidihandler").BidiHandler,s=i("./config"),p=i("./lib/event_emitter").EventEmitter,e=i("./selection").Selection,t=i("./mode/text").Mode,r=i("./range").Range,l=i("./line_widgets").LineWidgets,a=i("./document").Document,c=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 c(new t().getTokenizer(),this);var w=this;this.bgTokenizer.on("update",function(x){w._signal("tokenizerUpdate",x)}),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),
|
|
212
|
-
`},A.prototype.getWordRange=function($,C){var w=this.getLine($),x=!1;if(C>0&&(x=!!w.charAt(C-1).match(this.tokenRe)),x||(x=!!w.charAt(C).match(this.tokenRe)),x)var I=this.tokenRe;else if(/^\s+$/.test(w.slice(C-1,C+1)))var I=/\s/;else var I=this.nonTokenRe;var R=C;if(R>0){do R--;while(R>=0&&w.charAt(R).match(I));R++}for(var O=C;O<w.length&&w.charAt(O).match(I);)O++;return new r($,R,$,O)},A.prototype.getAWordRange=function($,C){for(var w=this.getWordRange($,C),x=this.getLine(w.end.row);x.charAt(w.end.column).match(/[ \t]/);)w.end.column+=1;return w},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 w=$,x=w.path}else x=$||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new t),this.$modes[x]&&!w){this.$onChangeMode(this.$modes[x]),C&&C();return}this.$modeId=x,s.loadModule(["mode",x],function(I){if(!this.destroyed){if(this.$modeId!==x)return C&&C();this.$modes[x]&&!w?this.$onChangeMode(this.$modes[x]):I&&I.Mode&&(I=new I.Mode(w),w||(this.$modes[x]=I,I.$id=x),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 w=this.$mode;this.$mode=$,this.$stopWorker(),this.$useWorker&&this.$startWorker();var x=$.getTokenizer();if(x.on!==void 0){var I=this.onReloadTokenizer.bind(this);x.on("update",I)}this.bgTokenizer.setTokenizer(x),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:w,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($){s.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(),w=this.$rowLengthCache,x=0,I=0,R=this.$foldData[I],O=R?R.start.row:1/0,P=C.length,B=0;B<P;B++){if(B>O){if(B=R.end.row+1,B>=P)break;R=this.$foldData[I++],O=R?R.start.row:1/0}w[B]==null&&(w[B]=this.$getStringScreenWidth(C[B])[0]),w[B]>x&&(x=w[B])}this.screenWidth=x}},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 w=$.length-1;w!=-1;w--){var x=$[w];x.action=="insert"||x.action=="remove"?this.doc.revertDelta(x):x.folds&&this.addFolds(x.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 w=0;w<$.length;w++){var x=$[w];(x.action=="insert"||x.action=="remove")&&this.doc.$safeApplyDelta(x)}!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 w(P){return C?P.action!=="insert":P.action==="insert"}for(var x,I,R=0;R<$.length;R++){var O=$[R];if(O.start){if(!x){w(O)?x=r.fromPoints(O.start,O.end):x=r.fromPoints(O.start,O.start);continue}w(O)?(I=O.start,x.compare(I.row,I.column)==-1&&x.setStart(I),I=O.end,x.compare(I.row,I.column)==1&&x.setEnd(I)):(I=O.start,x.compare(I.row,I.column)==-1&&(x=r.fromPoints(O.start,O.start)))}}return x},A.prototype.replace=function($,C){return this.doc.replace($,C)},A.prototype.moveText=function($,C,w){var x=this.getTextRange($),I=this.getFoldsInRange($),R=r.fromPoints(C,C);if(!w){this.remove($);var O=$.start.row-$.end.row,P=O?-$.end.column:$.start.column-$.end.column;P&&(R.start.row==$.end.row&&R.start.column>$.end.column&&(R.start.column+=P),R.end.row==$.end.row&&R.end.column>$.end.column&&(R.end.column+=P)),O&&R.start.row>=$.end.row&&(R.start.row+=O,R.end.row+=O)}if(R.end=this.insert(R.start,x),I.length){var B=$.start,V=R.start,O=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+=O,U.end.row+=O,U}))}return R},A.prototype.indentRows=function($,C,w){w=w.replace(/\t/g,this.getTabString());for(var x=$;x<=C;x++)this.doc.insertInLine({row:x,column:0},w)},A.prototype.outdentRows=function($){for(var C=$.collapseRows(),w=new r(0,0,0,0),x=this.getTabSize(),I=C.start.row;I<=C.end.row;++I){var R=this.getLine(I);w.start.row=I,w.end.row=I;for(var O=0;O<x&&R.charAt(O)==" ";++O);O<x&&R.charAt(O)==" "?(w.start.column=O,w.end.column=O+1):(w.start.column=0,w.end.column=O),this.remove(w)}},A.prototype.$moveLines=function($,C,w){if($=this.getRowFoldStart($),C=this.getRowFoldEnd(C),w<0){var x=this.getRowFoldStart($+w);if(x<0)return 0;var I=x-$}else if(w>0){var x=this.getRowFoldEnd(C+w);if(x>this.doc.getLength()-1)return 0;var I=x-C}else{$=this.$clipRowToDocument($),C=this.$clipRowToDocument(C);var I=C-$+1}var R=new r($,0,C,Number.MAX_VALUE),O=this.getFoldsInRange(R).map(function(B){return B=B.clone(),B.start.row+=I,B.end.row+=I,B}),P=w==0?this.doc.getLines($,C):this.doc.removeFullLines($,C);return this.doc.insertFullLines($+I,P),O.length&&this.addFolds(O),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 w=this.doc.getLength();$>=w?($=w-1,C=this.doc.getLine(w-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 w=this.$wrapLimitRange;w.max<0&&(w={min:C,max:C});var x=this.$constrainWrapLimit($,w.min,w.max);return x!=this.$wrapLimit&&x>1?(this.$wrapLimit=x,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},A.prototype.$constrainWrapLimit=function($,C,w){return C&&($=Math.max(C,$)),w&&($=Math.min(w,$)),$},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,w=$.action,x=$.start,I=$.end,R=x.row,O=I.row,P=O-R,B=null;if(this.$updating=!0,P!=0)if(w==="remove"){this[C?"$wrapData":"$rowLengthCache"].splice(R,P);var V=this.$foldData;B=this.getFoldsInRange($),this.removeFolds(B);var W=this.getFoldLine(I.row),H=0;if(W){W.addRemoveChars(I.row,I.column,x.column-I.column),W.shiftRow(-P);var U=this.getFoldLine(R);U&&U!==W&&(U.merge(W),W=U),H=V.indexOf(W)+1}for(H;H<V.length;H++){var W=V[H];W.start.row>=I.row&&W.shiftRow(-P)}O=R}else{var G=Array(P);G.unshift(R,0);var Y=C?this.$wrapData:this.$rowLengthCache;Y.splice.apply(Y,G);var V=this.$foldData,W=this.getFoldLine(R),H=0;if(W){var Q=W.range.compareInside(x.row,x.column);Q==0?(W=W.split(x.row,x.column),W&&(W.shiftRow(P),W.addRemoveChars(O,0,I.column-x.column))):Q==-1&&(W.addRemoveChars(R,0,I.column-x.column),W.shiftRow(P)),H=V.indexOf(W)+1}for(H;H<V.length;H++){var W=V[H];W.start.row>=R&&W.shiftRow(P)}}else{P=Math.abs($.start.column-$.end.column),w==="remove"&&(B=this.getFoldsInRange($),this.removeFolds(B),P=-P);var W=this.getFoldLine(R);W&&W.addRemoveChars(R,x.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(R,O):this.$updateRowLengthCache(R,O),B},A.prototype.$updateRowLengthCache=function($,C){this.$rowLengthCache[$]=null,this.$rowLengthCache[C]=null},A.prototype.$updateWrapData=function($,C){var w=this.doc.getAllLines(),x=this.getTabSize(),I=this.$wrapData,R=this.$wrapLimit,O,P,B=$;for(C=Math.min(C,w.length-1);B<=C;)P=this.getFoldLine(B,P),P?(O=[],P.walk(function(V,W,H,U){var G;if(V!=null){G=this.$getDisplayTokens(V,O.length),G[0]=b;for(var Y=1;Y<G.length;Y++)G[Y]=g}else G=this.$getDisplayTokens(w[W].substring(U,H),O.length);O=O.concat(G)}.bind(this),P.end.row,w[P.end.row].length+1),I[P.start.row]=this.$computeWrapSplits(O,R,x),B=P.end.row+1):(O=this.$getDisplayTokens(w[B]),I[B]=this.$computeWrapSplits(O,R,x),B++)},A.prototype.$computeWrapSplits=function($,C,w){if($.length==0)return[];var x=[],I=$.length,R=0,O=0,P=this.$wrapAsCode,B=this.$indentedSoftWrap,V=C<=Math.max(2*w,8)||B===!1?0:Math.floor(C/2);function W(){var Q=0;if(V===0)return Q;if(B)for(var ee=0;ee<$.length;ee++){var ne=$[ee];if(ne==M)Q+=1;else if(ne==_)Q+=w;else{if(ne==T)continue;break}}return P&&B!==!1&&(Q+=w),Math.min(Q,V)}function H(Q){for(var ee=Q-R,ne=R;ne<Q;ne++){var se=$[ne];(se===12||se===2)&&(ee-=1)}x.length||(U=W(),x.indent=U),O+=ee,x.push(O),R=Q}for(var U=0;I-R>C-U;){var G=R+C-U;if($[G-1]>=M&&$[G]>=M){H(G);continue}if($[G]==b||$[G]==g){for(G;G!=R-1&&$[G]!=b;G--);if(G>R){H(G);continue}for(G=R+C,G;G<$.length&&$[G]==g;G++);if(G==$.length)break;H(G);continue}for(var Y=Math.max(G-(C-(C>>2)),R-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]<M;)G--;if(G>Y){H(++G);continue}G=R+C,$[G]==E&&G--,H(G-U)}return x},A.prototype.$getDisplayTokens=function($,C){var w=[],x;C=C||0;for(var I=0;I<$.length;I++){var R=$.charCodeAt(I);if(R==9){x=this.getScreenTabSize(w.length+C),w.push(_);for(var O=1;O<x;O++)w.push(T)}else R==32?w.push(M):R>39&&R<48||R>57&&R<64?w.push(S):R>=4352&&F(R)?w.push(D,E):w.push(D)}return w},A.prototype.$getStringScreenWidth=function($,C,w){if(C==0)return[0,0];C==null&&(C=1/0),w=w||0;var x,I;for(I=0;I<$.length&&(x=$.charCodeAt(I),x==9?w+=this.getScreenTabSize(w):x>=4352&&F(x)?w+=2:w+=1,!(w>C));I++);return[w,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),w=this.$wrapData[C.row];return w.length&&w[0]<C.column?w.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 w=this.documentToScreenRow($,C);return this.getScreenLastRowColumn(w)},A.prototype.getDocumentLastRowColumnPosition=function($,C){var w=this.documentToScreenRow($,C);return this.screenToDocumentPosition(w,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,w){if($<0)return{row:0,column:0};var x,I=0,R=0,O,P=0,B=0,V=this.$screenRowCache,W=this.$getRowCacheIndex(V,$),H=V.length;if(H&&W>=0)var P=V[W],I=this.$docRowCache[W],U=$>V[H-1];else var U=!H;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)x=this.getFoldDisplayLine(Y),I=Y.start.row;else{if(P+B<=$||I>G)return{row:G,column:this.getLine(G).length};x=this.getLine(I),Y=null}var ee=0,ne=Math.floor($-P);if(this.$useWrapMode){var se=this.$wrapData[I];se&&(O=se[ne],ne>0&&se.length&&(ee=se.indent,R=se[ne-1]||se[se.length-1],x=x.substring(R)))}return w!==void 0&&this.$bidiHandler.isBidiRow(P+ne,I,ne)&&(C=this.$bidiHandler.offsetToCol(w)),R+=this.$getStringScreenWidth(x,C-ee)[1],this.$useWrapMode&&R>=O&&(R=O-1),Y?Y.idxToPosition(R):{row:I,column:R}},A.prototype.documentToScreenPosition=function($,C){if(typeof C>"u")var w=this.$clipPositionToDocument($.row,$.column);else w=this.$clipPositionToDocument($,C);$=w.row,C=w.column;var x=0,I=null,R=null;R=this.getFoldAt($,C,1),R&&($=R.start.row,C=R.start.column);var O,P=0,B=this.$docRowCache,V=this.$getRowCacheIndex(B,$),W=B.length;if(W&&V>=0)var P=B[V],x=this.$screenRowCache[V],H=$>B[W-1];else var H=!W;for(var U=this.getNextFoldLine(P),G=U?U.start.row:1/0;P<$;){if(P>=G){if(O=U.end.row+1,O>$)break;U=this.getNextFoldLine(O,U),G=U?U.start.row:1/0}else O=P+1;x+=this.getRowLength(P),P=O,H&&(this.$docRowCache.push(P),this.$screenRowCache.push(x))}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 ee=this.$wrapData[I];if(ee){for(var ne=0;Y.length>=ee[ne];)x++,ne++;Y=Y.substring(ee[ne-1]||0,Y.length),Q=ne>0?ee.indent:0}}return this.lineWidgets&&this.lineWidgets[P]&&this.lineWidgets[P].rowsAbove&&(x+=this.lineWidgets[P].rowsAbove),{row:x,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,R=0,x=0,C=this.$foldData[x++],O=C?C.start.row:1/0;R<I;){var P=this.$wrapData[R];$+=P?P.length+1:1,R++,R>O&&(R=C.end.row+1,C=this.$foldData[x++],O=C?C.start.row:1/0)}else{$=this.getLength();for(var w=this.$foldData,x=0;x<w.length;x++)C=w[x],$-=C.end.row-C.start.row}return this.lineWidgets&&($+=this.$getWidgetScreenLength()),$},A.prototype.$setFontMetrics=function($){this.$enableVarChar&&(this.$getStringScreenWidth=function(C,w,x){if(w===0)return[0,0];w||(w=1/0),x=x||0;var I,R;for(R=0;R<C.length&&(I=C.charAt(R),I===" "?x+=this.getScreenTabSize(x):x+=$.getCharacterWidth(I),!(x>w));R++);return[x,R]})},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=s.$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,o.implement(y.prototype,p);var D=1,E=2,b=3,g=4,S=9,M=10,_=11,T=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),s.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}}),u.EditSession=y}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(i,u,v){var o=i("./lib/lang"),h=i("./lib/oop"),d=i("./range").Range,s=function(){function r(){this.$options={}}return r.prototype.set=function(l){return h.mixin(this.$options,l),this},r.prototype.getOptions=function(){return o.copyObject(this.$options)},r.prototype.setOptions=function(l){this.$options=l},r.prototype.find=function(l){var a=this.$options,c=this.$matchIterator(l,a);if(!c)return!1;var f=null;return c.forEach(function(m,y,D,E){return f=new d(m,y,D,E),y==E&&a.start&&a.start.start&&a.skipCurrent!=!1&&f.isEqual(a.start)?(f=null,!1):!0}),f},r.prototype.findAll=function(l){var a=this.$options;if(!a.needle)return[];this.$assembleRegExp(a);var c=a.range,f=c?l.getLines(c.start.row,c.end.row):l.doc.getAllLines(),m=[],y=a.re;if(a.$isMultiLine){var D=y.length,E=f.length-D,b;e:for(var g=y.offset||0;g<=E;g++){for(var S=0;S<D;S++)if(f[g+S].search(y[S])==-1)continue e;var M=f[g],_=f[g+D-1],T=M.length-M.match(y[0])[0].length,F=_.match(y[D-1])[0].length;b&&b.end.row===g&&b.end.column>T||(m.push(b=new d(g,T,g+D-1,F)),D>2&&(g=g+D-2))}}else for(var A,$=0;$<f.length;$++)if(this.$isMultilineSearch(a)){var C=f.length-1;if(A=this.$multiLineForward(l,y,$,C),A){var w=A.endRow<=C?A.endRow-1:C;w>$&&($=w),m.push(new d(A.startRow,A.startCol,A.endRow,A.endCol))}}else{A=o.getMatchOffsets(f[$],y);for(var S=0;S<A.length;S++){var x=A[S];m.push(new d($,x.offset,$,x.offset+x.length))}}if(c){for(var I=c.start.column,R=c.end.column,$=0,S=m.length-1;$<S&&m[$].start.column<I&&m[$].start.row==0;)$++;for(var O=c.end.row-c.start.row;$<S&&m[S].end.column>R&&m[S].end.row==O;)S--;for(m=m.slice($,S+1),$=0,S=m.length;$<S;$++)m[$].start.row+=c.start.row,m[$].end.row+=c.start.row}return m},r.prototype.parseReplaceString=function(l){for(var a={DollarSign:36,Ampersand:38,Digit0:48,Digit1:49,Digit9:57,Backslash:92,n:110,t:116},c="",f=0,m=l.length;f<m;f++){var y=l.charCodeAt(f);if(y===a.Backslash){if(f++,f>=m){c+="\\";break}var D=l.charCodeAt(f);switch(D){case a.Backslash:c+="\\";break;case a.n:c+=`
|
|
209
|
+
`):g=r(b.value)),b.start&&(g+=r(b)),(b.id||b.rev)&&(g+=" ("+(b.id||b.rev)+")"),g}function r(b){return b.start.row+":"+b.start.column+"=>"+b.end.row+":"+b.end.column}function l(b,g){var S=b.action=="insert",M=g.action=="insert";if(S&&M)if(o(g.start,b.end)>=0)f(g,b,-1);else if(o(g.start,b.start)<=0)f(b,g,1);else return null;else if(S&&!M)if(o(g.start,b.end)>=0)f(g,b,-1);else if(o(g.end,b.start)<=0)f(b,g,-1);else return null;else if(!S&&M)if(o(g.start,b.start)>=0)f(g,b,1);else if(o(g.start,b.start)<=0)f(b,g,1);else return null;else if(!S&&!M)if(o(g.start,b.start)>=0)f(g,b,1);else if(o(g.end,b.start)<=0)f(b,g,-1);else return null;return[g,b]}function a(b,g){for(var S=b.length;S--;)for(var M=0;M<g.length;M++)if(!l(b[S],g[M])){for(;S<b.length;){for(;M--;)l(g[M],b[S]);M=g.length,S++}return[b,g]}return b.selectionBefore=g.selectionBefore=b.selectionAfter=g.selectionAfter=null,[g,b]}function c(b,g){var S=b.action=="insert",M=g.action=="insert";if(S&&M)o(b.start,g.start)<0?f(g,b,1):f(b,g,1);else if(S&&!M)o(b.start,g.end)>=0?f(b,g,-1):(o(b.start,g.start)<=0||f(b,d.fromPoints(g.start,b.start),-1),f(g,b,1));else if(!S&&M)o(g.start,b.end)>=0?f(g,b,-1):(o(g.start,b.start)<=0||f(g,d.fromPoints(b.start,g.start),-1),f(b,g,1));else if(!S&&!M)if(o(g.start,b.end)>=0)f(g,b,-1);else if(o(g.end,b.start)<=0)f(b,g,-1);else{var _,T;return o(b.start,g.start)<0&&(_=b,b=y(b,g.start)),o(b.end,g.end)>0&&(T=y(b,g.end)),m(g.end,b.start,b.end,-1),T&&!_&&(b.lines=T.lines,b.start=T.start,b.end=T.end,T=b),[g,_,T].filter(Boolean)}return[g,b]}function f(b,g,S){m(b.start,g.start,g.end,S),m(b.end,g.start,g.end,S)}function m(b,g,S,M){b.row==(M==1?g:S).row&&(b.column+=M*(S.column-g.column)),b.row+=M*(S.row-g.row)}function y(b,g){var S=b.lines,M=b.end;b.end=p(g);var _=b.end.row-b.start.row,T=S.splice(_,S.length),F=_?g.column:g.column-b.start.column;S.push(T[0].substring(0,F)),T[0]=T[0].substr(F);var A={start:p(g),end:M,lines:T,action:b.action};return A}function D(b,g){g=e(g);for(var S=b.length;S--;){for(var M=b[S],_=0;_<M.length;_++){var T=M[_],F=c(T,g);g=F[0],F.length!=2&&(F[2]?(M.splice(_+1,1,F[1],F[2]),_++):F[1]||(M.splice(_,1),_--))}M.length||b.splice(S,1)}return b}function E(b,g){for(var S=0;S<g.length;S++)for(var M=g[S],_=0;_<M.length;_++)D(b,M[_])}u.UndoManager=s}),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(i,u,v){var s=i("../range").Range,h=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,l,a,c,f=!0;p==null&&(p=this.end.row,e=this.end.column);for(var m=0;m<r.length;m++){if(l=r[m],a=l.range.compareStart(p,e),a==-1){o(null,p,e,t,f);return}if(c=o(null,l.start.row,l.start.column,t,f),c=!c&&o(l.placeholder,l.start.row,l.start.column,t),c||a===0)return;f=!l.sameRow,t=l.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,l;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){l=this.folds;var a=l.indexOf(r);for(a===0&&(this.start.column+=e),a;a<l.length;a++){if(r=l[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,l=this.foldData,a=r.indexOf(t),c=r[a-1];this.end.row=c.end.row,this.end.column=c.end.column,r=r.splice(a,r.length-a);var f=new d(l,r);return l.splice(l.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}();u.FoldLine=h}),ace.define("ace/range_list",["require","exports","module","ace/range"],function(i,u,v){var s=i("./range").Range,h=s.comparePoints,d=function(){function o(){this.ranges=[],this.$bias=1}return o.prototype.pointIndex=function(p,e,t){for(var r=this.ranges,l=t||0;l<r.length;l++){var a=r[l],c=h(p,a.end);if(!(c>0)){var f=h(p,a.start);return c===0?e&&f!==0?-l-2:l:f>0||f===0&&!e?l:-l-1}}return-l-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(c,f){return h(c.start,f.start)});for(var t=e[0],r,l=1;l<e.length;l++){r=t,t=e[l];var a=h(r.end,t.start);a<0||a==0&&!r.isEmpty()&&!t.isEmpty()||(h(r.end,t.end)<0&&(r.end.row=t.end.row,r.end.column=t.end.column),e.splice(l,1),p.push(t),t=r,l--)}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 l=this.pointIndex({row:e,column:0},r);l<0&&(l=-l-1);for(var a=[],c=r;c<l;c++)a.push(t[c]);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,l=t.row,a=this.ranges,c=0,f=a.length;c<f;c++){var m=a[c];if(m.end.row>=r)break}if(p.action=="insert")for(var y=l-r,D=-e.column+t.column;c<f;c++){var m=a[c];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+=D,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&&D>0&&c<f-1&&m.end.column>m.start.column&&m.end.column==a[c+1].start.column&&(m.end.column-=D),m.end.column+=D,m.end.row+=y}}else for(var y=r-l,D=e.column-t.column;c<f;c++){var m=a[c];if(m.start.row>l)break;m.end.row<l&&(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==l?m.end.column<=t.column?(y||m.end.column>e.column)&&(m.end.column=e.column,m.end.row=e.row):(m.end.column+=D,m.end.row+=y):m.end.row>l&&(m.end.row+=y),m.start.row<l&&(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==l?m.start.column<=t.column?(y||m.start.column>e.column)&&(m.start.column=e.column,m.start.row=e.row):(m.start.column+=D,m.start.row+=y):m.start.row>l&&(m.start.row+=y)}if(y!=0&&c<f)for(;c<f;c++){var m=a[c];m.start.row+=y,m.end.row+=y}},o}();d.prototype.comparePoints=h,u.RangeList=d}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list"],function(i,u,v){var s=this&&this.__extends||function(){var r=function(l,a){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,f){c.__proto__=f}||function(c,f){for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(c[m]=f[m])},r(l,a)};return function(l,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(l,a);function c(){this.constructor=l}l.prototype=a===null?Object.create(a):(c.prototype=a.prototype,new c)}}(),h=i("../range_list").RangeList,d=function(r){s(l,r);function l(a,c){var f=r.call(this)||this;return f.foldLine=null,f.placeholder=c,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 l.prototype.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},l.prototype.setFoldLine=function(a){this.foldLine=a,this.subFolds.forEach(function(c){c.setFoldLine(a)})},l.prototype.clone=function(){var a=this.range.clone(),c=new l(a,this.placeholder);return this.subFolds.forEach(function(f){c.subFolds.push(f.clone())}),c.collapseChildren=this.collapseChildren,c},l.prototype.addSubFold=function(a){if(!this.range.isEqual(a)){p(a,this.start);for(var D=a.start.row,E=a.start.column,c=0,f=-1;c<this.subFolds.length&&(f=this.subFolds[c].range.compare(D,E),f==1);c++);var m=this.subFolds[c],y=0;if(f==0){if(m.range.containsRange(a))return m.addSubFold(a);y=1}for(var D=a.range.end.row,E=a.range.end.column,b=c,f=-1;b<this.subFolds.length&&(f=this.subFolds[b].range.compare(D,E),f==1);b++);f==0&&b++;for(var g=this.subFolds.splice(c,b-c,a),S=f==0?g.length-1:g.length,M=y;M<S;M++)a.addSubFold(g[M]);return a.setFoldLine(this.foldLine),a}},l.prototype.restoreRange=function(a){return t(a,this.start)},l}(h);function o(r,l){r.row-=l.row,r.row==0&&(r.column-=l.column)}function p(r,l){o(r.start,l),o(r.end,l)}function e(r,l){r.row==0&&(r.column+=l.column),r.row+=l.row}function t(r,l){e(r.start,l),e(r.end,l)}u.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,u,v){var s=i("../range").Range,h=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,l){var a=this.getFoldLine(t);if(!a)return null;for(var c=a.folds,f=0;f<c.length;f++){var m=c[f].range;if(m.contains(t,r)){if(l==1&&m.isEnd(t,r)&&!m.isEmpty())continue;if(l==-1&&m.isStart(t,r)&&!m.isEmpty())continue;return c[f]}}},this.getFoldsInRange=function(t){var r=t.start,l=t.end,a=this.$foldData,c=[];r.column+=1,l.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,D=0;D<y.length;D++){var E=y[D];if(m=E.range.compareRange(t),m==-2)break;if(m==2)continue;if(m==42)break;c.push(E)}}}return r.column-=1,l.column+=1,c},this.getFoldsInRangeList=function(t){if(Array.isArray(t)){var r=[];t.forEach(function(l){r=r.concat(this.getFoldsInRange(l))},this)}else var r=this.getFoldsInRange(t);return r},this.getAllFolds=function(){for(var t=[],r=this.$foldData,l=0;l<r.length;l++)for(var a=0;a<r[l].folds.length;a++)t.push(r[l].folds[a]);return t},this.getFoldStringAt=function(t,r,l,a){if(a=a||this.getFoldLine(t),!a)return null;for(var c={end:{column:0}},f,m,y=0;y<a.folds.length;y++){m=a.folds[y];var D=m.range.compareEnd(t,r);if(D==-1){f=this.getLine(m.start.row).substring(c.end.column,m.start.column);break}else if(D===0)return null;c=m}return f||(f=this.getLine(m.start.row).substring(c.end.column)),l==-1?f.substring(0,r-c.end.column):l==1?f.substring(r-c.end.column):f},this.getFoldLine=function(t,r){var l=this.$foldData,a=0;for(r&&(a=l.indexOf(r)),a==-1&&(a=0),a;a<l.length;a++){var c=l[a];if(c.start.row<=t&&c.end.row>=t)return c;if(c.end.row>t)return null}return null},this.getNextFoldLine=function(t,r){var l=this.$foldData,a=0;for(r&&(a=l.indexOf(r)),a==-1&&(a=0),a;a<l.length;a++){var c=l[a];if(c.end.row>=t)return c}return null},this.getFoldedRowCount=function(t,r){for(var l=this.$foldData,a=r-t+1,c=0;c<l.length;c++){var f=l[c],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,l){return r.start.row-l.start.row}),t},this.addFold=function(t,r){var l=this.$foldData,a=!1,c;t instanceof d?c=t:(c=new d(r,t),c.collapseChildren=r.collapseChildren),this.$clipRangeToDocument(c.range);var f=c.start.row,m=c.start.column,y=c.end.row,D=c.end.column,E=this.getFoldAt(f,m,1),b=this.getFoldAt(y,D,-1);if(E&&b==E)return E.addSubFold(c);E&&!E.range.isStart(f,m)&&this.removeFold(E),b&&!b.range.isEnd(y,D)&&this.removeFold(b);var g=this.getFoldsInRange(c.range);g.length>0&&(this.removeFolds(g),c.collapseChildren||g.forEach(function(T){c.addSubFold(T)}));for(var S=0;S<l.length;S++){var M=l[S];if(y==M.start.row){M.addFold(c),a=!0;break}else if(f==M.end.row){if(M.addFold(c),a=!0,!c.sameRow){var _=l[S+1];if(_&&_.start.row==y){M.merge(_);break}}break}else if(y<=M.start.row)break}return a||(M=this.$addFoldLine(new h(this.$foldData,c))),this.$useWrapMode?this.$updateWrapData(M.start.row,M.start.row):this.$updateRowLengthCache(M.start.row,M.start.row),this.$modified=!0,this._signal("changeFold",{data:c,action:"add"}),c},this.addFolds=function(t){t.forEach(function(r){this.addFold(r)},this)},this.removeFold=function(t){var r=t.foldLine,l=r.start.row,a=r.end.row,c=this.$foldData,f=r.folds;if(f.length==1)c.splice(c.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(l,a):this.$updateRowLengthCache(l,a)),this.$modified=!0,this._signal("changeFold",{data:t,action:"remove"})},this.removeFolds=function(t){for(var r=[],l=0;l<t.length;l++)r.push(t[l]);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 l,a;if(t==null)l=new s(0,0,this.getLength(),0),r==null&&(r=!0);else if(typeof t=="number")l=new s(t,0,t,this.getLine(t).length);else if("row"in t)l=s.fromPoints(t,t);else{if(Array.isArray(t))return a=[],t.forEach(function(f){a=a.concat(this.unfold(f))},this),a;l=t}a=this.getFoldsInRangeList(l);for(var c=a;a.length==1&&s.comparePoints(a[0].start,l.start)<0&&s.comparePoints(a[0].end,l.end)>0;)this.expandFolds(a),a=this.getFoldsInRangeList(l);if(r!=!1?this.removeFolds(a):this.expandFolds(a),c.length)return c},this.isRowFolded=function(t,r){return!!this.getFoldLine(t,r)},this.getRowFoldEnd=function(t,r){var l=this.getFoldLine(t,r);return l?l.end.row:t},this.getRowFoldStart=function(t,r){var l=this.getFoldLine(t,r);return l?l.start.row:t},this.getFoldDisplayLine=function(t,r,l,a,c){a==null&&(a=t.start.row),c==null&&(c=0),r==null&&(r=t.end.row),l==null&&(l=this.getLine(r).length);var f=this.doc,m="";return t.walk(function(y,D,E,b){if(!(D<a)){if(D==a){if(E<c)return;b=Math.max(c,b)}y!=null?m+=y:m+=f.getLine(D).substring(b,E)}},r,l),m},this.getDisplayLine=function(t,r,l,a){var c=this.getFoldLine(t);if(c)return this.getFoldDisplayLine(c,t,r,l,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 l=r.folds.map(function(a){return a.clone()});return new h(t,l)}),t},this.toggleFold=function(t){var r=this.selection,l=r.getRange(),a,c;if(l.isEmpty()){var f=l.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(c=this.findMatchingBracket(f))?l.comparePoint(c)==1?l.end=c:(l.start=c,l.start.column++,l.end.column--):(c=this.findMatchingBracket({row:f.row,column:f.column+1}))?(l.comparePoint(c)==1?l.end=c:l.start=c,l.start.column++):l=this.getCommentFoldRange(f.row,f.column)||l}else{var y=this.getFoldsInRange(l);if(t&&y.length){this.expandFolds(y);return}else y.length==1&&(a=y[0])}if(a||(a=this.getFoldAt(l.start.row,l.start.column)),a&&a.range.toString()==l.toString()){this.expandFold(a);return}var D="...";if(!l.isMultiLine()){if(D=this.getTextRange(l),D.length<4)return;D=D.trim().substring(0,2)+".."}this.addFold(D,l)},this.getCommentFoldRange=function(t,r,l){var a=new o(this,t,r),c=a.getCurrentToken(),f=c&&c.type;if(c&&/^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(l!=1){do c=a.stepBackward();while(c&&m.test(c.type));c=a.stepForward()}y.start.row=a.getCurrentTokenRow(),y.start.column=a.getCurrentTokenColumn()+c.value.length,a=new o(this,t,r);var D=this.getState(a.$row);if(l!=-1){var E=-1;do if(c=a.stepForward(),E==-1){var b=this.getState(a.$row);D.toString()!==b.toString()&&(E=a.$row)}else if(a.$row>E)break;while(c&&m.test(c.type));c=a.stepBackward()}else c=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,l,a){l==null&&(l=1e5);var c=this.foldWidgets;if(c){r=r||this.getLength(),t=t||0;for(var f=t;f<r;f++)if(c[f]==null&&(c[f]=this.getFoldWidget(f)),c[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=l,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 l=t.getTokens(r),a=0;a<l.length;a++){var c=l[a];if(!(c.type=="text"&&/^\s+$/.test(c.value)))return!!/comment/.test(c.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 l=this.foldWidgets;if(!l||r&&l[t])return{};for(var a=t-1,c;a>=0;){var f=l[a];if(f==null&&(f=l[a]=this.getFoldWidget(a)),f=="start"){var m=this.getFoldWidgetRange(a);if(c||(c=m),m&&m.end.row>=t)break}a--}return{range:a!==-1&&m,firstRange:c}},this.onFoldWidgetClick=function(t,r){r instanceof p&&(r=r.domEvent);var l={children:r.shiftKey,all:r.ctrlKey||r.metaKey,siblings:r.altKey},a=this.$toggleFoldWidget(t,l);if(!a){var c=r.target||r.srcElement;c&&/ace_fold-widget/.test(c.className)&&(c.className+=" ace_invalid")}},this.$toggleFoldWidget=function(t,r){if(this.getFoldWidget){var l=this.getFoldWidget(t),a=this.getLine(t),c=l==="end"?-1:1,f=this.getFoldAt(t,c===-1?0:a.length,c);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 D=y.range.start.row+1,E=y.range.end.row;this.foldAll(D,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 l=this.$toggleFoldWidget(r,{});if(!l){var a=this.getParentFoldRangeData(r,!0);if(l=a.range||a.firstRange,l){r=l.start.row;var c=this.getFoldAt(r,this.getLine(r).length,1);c?this.removeFold(c):this.addFold("...",l)}}},this.updateFoldWidgets=function(t){var r=t.start.row,l=t.end.row-r;if(l===0)this.foldWidgets[r]=null;else if(t.action=="remove")this.foldWidgets.splice(r,l+1,null);else{var a=Array(l+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)}}u.Folding=e}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(i,u,v){var s=i("../token_iterator").TokenIterator,h=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),l=r&&r.match(/([\(\[\{])|([\)\]\}])/);if(l||(r=p.charAt(o.column),o={row:o.row,column:o.column+1},l=r&&r.match(/([\(\[\{])|([\)\]\}])/),e=!1),!l)return null;if(l[1]){var a=this.$findClosingBracket(l[1],o);if(!a)return null;t=h.fromPoints(o,a),e||(t.end.column++,t.start.column--),t.cursor=t.end}else{var a=this.$findOpeningBracket(l[2],o);if(!a)return null;t=h.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),l=r&&r.match(t);if(l||(r=(p===void 0||p)&&e.charAt(o.column),o={row:o.row,column:o.column+1},l=r&&r.match(t)),!l)return null;var a=new h(o.row,o.column-1,o.row,o.column),c=l[1]?this.$findClosingBracket(l[1],o):this.$findOpeningBracket(l[2],o);if(!c)return[a];var f=new h(c.row,c.column,c.row,c.column+1);return[a,f]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(o,p,e){var t=this.$brackets[o],r=1,l=new s(this,p.row,p.column),a=l.getCurrentToken();if(a||(a=l.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 c=p.column-l.getCurrentTokenColumn()-2,f=a.value;;){for(;c>=0;){var m=f.charAt(c);if(m==t){if(r-=1,r==0)return{row:l.getCurrentTokenRow(),column:c+l.getCurrentTokenColumn()}}else m==o&&(r+=1);c-=1}do a=l.stepBackward();while(a&&!e.test(a.type));if(a==null)break;f=a.value,c=f.length-1}return null}},this.$findClosingBracket=function(o,p,e){var t=this.$brackets[o],r=1,l=new s(this,p.row,p.column),a=l.getCurrentToken();if(a||(a=l.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 c=p.column-l.getCurrentTokenColumn();;){for(var f=a.value,m=f.length;c<m;){var y=f.charAt(c);if(y==t){if(r-=1,r==0)return{row:l.getCurrentTokenRow(),column:c+l.getCurrentTokenColumn()}}else y==o&&(r+=1);c+=1}do a=l.stepForward();while(a&&!e.test(a.type));if(a==null)break;c=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,l=0,a=new h(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);p=o.stepForward();var c=new h(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 h(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);f=!0}if(p=o.stepForward(),p){if(p.value===">"&&!f){var m=new h(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==="<")l++;else if(e.value==="</"&&(l--,l<0)){o.stepBackward();var y=new h(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+2);p=o.stepForward();var D=new h(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 h(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);else return}}}else if(r===t&&p.value==="/>"&&(l--,l<0))var y=new h(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+2),D=y,E=D,m=new h(c.end.row,c.end.column,c.end.row,c.end.column+1)}}while(p&&l>=0);if(a&&m&&y&&E&&c&&D)return{openTag:new h(a.start.row,a.start.column,m.end.row,m.end.column),closeTag:new h(y.start.row,y.start.column,E.end.row,E.end.column),openTagName:c,closeTagName:D}},this.$findOpeningTag=function(o,p){var e=o.getCurrentToken(),t=p.value,r=0,l=o.getCurrentTokenRow(),a=o.getCurrentTokenColumn(),c=a+2,f=new h(l,a,l,c);o.stepForward();var m=new h(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 h(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);o.stepBackward(),o.stepBackward();do if(p=e,l=o.getCurrentTokenRow(),a=o.getCurrentTokenColumn(),c=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 D=new h(l,a,l,c),E=new h(o.getCurrentTokenRow(),o.getCurrentTokenColumn(),o.getCurrentTokenRow(),o.getCurrentTokenColumn()+1);do p=o.stepForward();while(p&&p.value!==">");var b=new h(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 M=0;M<g;M++)o.stepForward()}}while(e&&r<=0);if(E&&b&&f&&y&&D&&m)return{openTag:new h(E.start.row,E.start.column,b.end.row,b.end.column),closeTag:new h(f.start.row,f.start.column,y.end.row,y.end.column),openTagName:D,closeTagName:m}}}}u.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,u,v){var s=i("./lib/oop"),h=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,l=i("./line_widgets").LineWidgets,a=i("./document").Document,c=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 c(new t().getTokenizer(),this);var w=this;this.bgTokenizer.on("update",function(x){w._signal("tokenizerUpdate",x)}),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=h.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 l(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,w=this.$getRowCacheIndex(this.$docRowCache,$)+1;C>w&&(this.$docRowCache.splice(w,C),this.$screenRowCache.splice(w,C))},A.prototype.$getRowCacheIndex=function($,C){for(var w=0,x=$.length-1;w<=x;){var I=w+x>>1,O=$[I];if(C>O)w=I+1;else if(C<O)x=I-1;else return I}return w-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 w=new A($.value);return $.folds.forEach(function(x){w.addFold("...",r.fromPoints(x.start,x.end))}),w.setAnnotations($.annotations),w.setBreakpoints($.breakpoints),w.setMode($.mode),w.setScrollLeft($.scrollLeft),w.setScrollTop($.scrollTop),w.setUndoManager(C),w.selection.fromJSON($.selection),w},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 w=this.bgTokenizer.getTokens($),x,I=0;if(C==null){var O=w.length-1;I=this.getLine($).length}else for(var O=0;O<w.length&&(I+=w[O].value.length,!(I>=C));O++);return x=w[O],x?(x.index=O,x.start=I-x.value.length,x):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=h.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()?h.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,w,x){var I=this.$markerId++,O={range:$,type:w||"line",renderer:typeof w=="function"?w:null,clazz:C,inFront:!!x,id:I};return x?(this.$frontMarkers[I]=O,this._signal("changeFrontMarker")):(this.$backMarkers[I]=O,this._signal("changeBackMarker")),I},A.prototype.addDynamicMarker=function($,C){if($.update){var w=this.$markerId++;return $.id=w,$.inFront=!!C,C?(this.$frontMarkers[w]=$,this._signal("changeFrontMarker")):(this.$backMarkers[w]=$,this._signal("changeBackMarker")),$}},A.prototype.removeMarker=function($){var C=this.$frontMarkers[$]||this.$backMarkers[$];if(C){var w=C.inFront?this.$frontMarkers:this.$backMarkers;delete w[$],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,w,x){typeof C!="number"&&(w=C,C=$),w||(w="ace_step");var I=new r($,0,C,1/0);return I.id=this.addMarker(I,w,"fullLine",x),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 w=this.getLine($),x=!1;if(C>0&&(x=!!w.charAt(C-1).match(this.tokenRe)),x||(x=!!w.charAt(C).match(this.tokenRe)),x)var I=this.tokenRe;else if(/^\s+$/.test(w.slice(C-1,C+1)))var I=/\s/;else var I=this.nonTokenRe;var O=C;if(O>0){do O--;while(O>=0&&w.charAt(O).match(I));O++}for(var R=C;R<w.length&&w.charAt(R).match(I);)R++;return new r($,O,$,R)},A.prototype.getAWordRange=function($,C){for(var w=this.getWordRange($,C),x=this.getLine(w.end.row);x.charAt(w.end.column).match(/[ \t]/);)w.end.column+=1;return w},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 w=$,x=w.path}else x=$||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new t),this.$modes[x]&&!w){this.$onChangeMode(this.$modes[x]),C&&C();return}this.$modeId=x,o.loadModule(["mode",x],function(I){if(!this.destroyed){if(this.$modeId!==x)return C&&C();this.$modes[x]&&!w?this.$onChangeMode(this.$modes[x]):I&&I.Mode&&(I=new I.Mode(w),w||(this.$modes[x]=I,I.$id=x),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 w=this.$mode;this.$mode=$,this.$stopWorker(),this.$useWorker&&this.$startWorker();var x=$.getTokenizer();if(x.on!==void 0){var I=this.onReloadTokenizer.bind(this);x.on("update",I)}this.bgTokenizer.setTokenizer(x),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:w,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(),w=this.$rowLengthCache,x=0,I=0,O=this.$foldData[I],R=O?O.start.row:1/0,P=C.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}w[B]==null&&(w[B]=this.$getStringScreenWidth(C[B])[0]),w[B]>x&&(x=w[B])}this.screenWidth=x}},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 w=$.length-1;w!=-1;w--){var x=$[w];x.action=="insert"||x.action=="remove"?this.doc.revertDelta(x):x.folds&&this.addFolds(x.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 w=0;w<$.length;w++){var x=$[w];(x.action=="insert"||x.action=="remove")&&this.doc.$safeApplyDelta(x)}!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 w(P){return C?P.action!=="insert":P.action==="insert"}for(var x,I,O=0;O<$.length;O++){var R=$[O];if(R.start){if(!x){w(R)?x=r.fromPoints(R.start,R.end):x=r.fromPoints(R.start,R.start);continue}w(R)?(I=R.start,x.compare(I.row,I.column)==-1&&x.setStart(I),I=R.end,x.compare(I.row,I.column)==1&&x.setEnd(I)):(I=R.start,x.compare(I.row,I.column)==-1&&(x=r.fromPoints(R.start,R.start)))}}return x},A.prototype.replace=function($,C){return this.doc.replace($,C)},A.prototype.moveText=function($,C,w){var x=this.getTextRange($),I=this.getFoldsInRange($),O=r.fromPoints(C,C);if(!w){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,x),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($,C,w){w=w.replace(/\t/g,this.getTabString());for(var x=$;x<=C;x++)this.doc.insertInLine({row:x,column:0},w)},A.prototype.outdentRows=function($){for(var C=$.collapseRows(),w=new r(0,0,0,0),x=this.getTabSize(),I=C.start.row;I<=C.end.row;++I){var O=this.getLine(I);w.start.row=I,w.end.row=I;for(var R=0;R<x&&O.charAt(R)==" ";++R);R<x&&O.charAt(R)==" "?(w.start.column=R,w.end.column=R+1):(w.start.column=0,w.end.column=R),this.remove(w)}},A.prototype.$moveLines=function($,C,w){if($=this.getRowFoldStart($),C=this.getRowFoldEnd(C),w<0){var x=this.getRowFoldStart($+w);if(x<0)return 0;var I=x-$}else if(w>0){var x=this.getRowFoldEnd(C+w);if(x>this.doc.getLength()-1)return 0;var I=x-C}else{$=this.$clipRowToDocument($),C=this.$clipRowToDocument(C);var I=C-$+1}var O=new r($,0,C,Number.MAX_VALUE),R=this.getFoldsInRange(O).map(function(B){return B=B.clone(),B.start.row+=I,B.end.row+=I,B}),P=w==0?this.doc.getLines($,C):this.doc.removeFullLines($,C);return this.doc.insertFullLines($+I,P),R.length&&this.addFolds(R),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 w=this.doc.getLength();$>=w?($=w-1,C=this.doc.getLine(w-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 w=this.$wrapLimitRange;w.max<0&&(w={min:C,max:C});var x=this.$constrainWrapLimit($,w.min,w.max);return x!=this.$wrapLimit&&x>1?(this.$wrapLimit=x,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},A.prototype.$constrainWrapLimit=function($,C,w){return C&&($=Math.max(C,$)),w&&($=Math.min(w,$)),$},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,w=$.action,x=$.start,I=$.end,O=x.row,R=I.row,P=R-O,B=null;if(this.$updating=!0,P!=0)if(w==="remove"){this[C?"$wrapData":"$rowLengthCache"].splice(O,P);var V=this.$foldData;B=this.getFoldsInRange($),this.removeFolds(B);var W=this.getFoldLine(I.row),H=0;if(W){W.addRemoveChars(I.row,I.column,x.column-I.column),W.shiftRow(-P);var U=this.getFoldLine(O);U&&U!==W&&(U.merge(W),W=U),H=V.indexOf(W)+1}for(H;H<V.length;H++){var W=V[H];W.start.row>=I.row&&W.shiftRow(-P)}R=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),H=0;if(W){var Q=W.range.compareInside(x.row,x.column);Q==0?(W=W.split(x.row,x.column),W&&(W.shiftRow(P),W.addRemoveChars(R,0,I.column-x.column))):Q==-1&&(W.addRemoveChars(O,0,I.column-x.column),W.shiftRow(P)),H=V.indexOf(W)+1}for(H;H<V.length;H++){var W=V[H];W.start.row>=O&&W.shiftRow(P)}}else{P=Math.abs($.start.column-$.end.column),w==="remove"&&(B=this.getFoldsInRange($),this.removeFolds(B),P=-P);var W=this.getFoldLine(O);W&&W.addRemoveChars(O,x.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,R):this.$updateRowLengthCache(O,R),B},A.prototype.$updateRowLengthCache=function($,C){this.$rowLengthCache[$]=null,this.$rowLengthCache[C]=null},A.prototype.$updateWrapData=function($,C){var w=this.doc.getAllLines(),x=this.getTabSize(),I=this.$wrapData,O=this.$wrapLimit,R,P,B=$;for(C=Math.min(C,w.length-1);B<=C;)P=this.getFoldLine(B,P),P?(R=[],P.walk(function(V,W,H,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(w[W].substring(U,H),R.length);R=R.concat(G)}.bind(this),P.end.row,w[P.end.row].length+1),I[P.start.row]=this.$computeWrapSplits(R,O,x),B=P.end.row+1):(R=this.$getDisplayTokens(w[B]),I[B]=this.$computeWrapSplits(R,O,x),B++)},A.prototype.$computeWrapSplits=function($,C,w){if($.length==0)return[];var x=[],I=$.length,O=0,R=0,P=this.$wrapAsCode,B=this.$indentedSoftWrap,V=C<=Math.max(2*w,8)||B===!1?0:Math.floor(C/2);function W(){var Q=0;if(V===0)return Q;if(B)for(var ee=0;ee<$.length;ee++){var ne=$[ee];if(ne==M)Q+=1;else if(ne==_)Q+=w;else{if(ne==T)continue;break}}return P&&B!==!1&&(Q+=w),Math.min(Q,V)}function H(Q){for(var ee=Q-O,ne=O;ne<Q;ne++){var se=$[ne];(se===12||se===2)&&(ee-=1)}x.length||(U=W(),x.indent=U),R+=ee,x.push(R),O=Q}for(var U=0;I-O>C-U;){var G=O+C-U;if($[G-1]>=M&&$[G]>=M){H(G);continue}if($[G]==b||$[G]==g){for(G;G!=O-1&&$[G]!=b;G--);if(G>O){H(G);continue}for(G=O+C,G;G<$.length&&$[G]==g;G++);if(G==$.length)break;H(G);continue}for(var Y=Math.max(G-(C-(C>>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]<M;)G--;if(G>Y){H(++G);continue}G=O+C,$[G]==E&&G--,H(G-U)}return x},A.prototype.$getDisplayTokens=function($,C){var w=[],x;C=C||0;for(var I=0;I<$.length;I++){var O=$.charCodeAt(I);if(O==9){x=this.getScreenTabSize(w.length+C),w.push(_);for(var R=1;R<x;R++)w.push(T)}else O==32?w.push(M):O>39&&O<48||O>57&&O<64?w.push(S):O>=4352&&F(O)?w.push(D,E):w.push(D)}return w},A.prototype.$getStringScreenWidth=function($,C,w){if(C==0)return[0,0];C==null&&(C=1/0),w=w||0;var x,I;for(I=0;I<$.length&&(x=$.charCodeAt(I),x==9?w+=this.getScreenTabSize(w):x>=4352&&F(x)?w+=2:w+=1,!(w>C));I++);return[w,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),w=this.$wrapData[C.row];return w.length&&w[0]<C.column?w.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 w=this.documentToScreenRow($,C);return this.getScreenLastRowColumn(w)},A.prototype.getDocumentLastRowColumnPosition=function($,C){var w=this.documentToScreenRow($,C);return this.screenToDocumentPosition(w,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,w){if($<0)return{row:0,column:0};var x,I=0,O=0,R,P=0,B=0,V=this.$screenRowCache,W=this.$getRowCacheIndex(V,$),H=V.length;if(H&&W>=0)var P=V[W],I=this.$docRowCache[W],U=$>V[H-1];else var U=!H;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)x=this.getFoldDisplayLine(Y),I=Y.start.row;else{if(P+B<=$||I>G)return{row:G,column:this.getLine(G).length};x=this.getLine(I),Y=null}var ee=0,ne=Math.floor($-P);if(this.$useWrapMode){var se=this.$wrapData[I];se&&(R=se[ne],ne>0&&se.length&&(ee=se.indent,O=se[ne-1]||se[se.length-1],x=x.substring(O)))}return w!==void 0&&this.$bidiHandler.isBidiRow(P+ne,I,ne)&&(C=this.$bidiHandler.offsetToCol(w)),O+=this.$getStringScreenWidth(x,C-ee)[1],this.$useWrapMode&&O>=R&&(O=R-1),Y?Y.idxToPosition(O):{row:I,column:O}},A.prototype.documentToScreenPosition=function($,C){if(typeof C>"u")var w=this.$clipPositionToDocument($.row,$.column);else w=this.$clipPositionToDocument($,C);$=w.row,C=w.column;var x=0,I=null,O=null;O=this.getFoldAt($,C,1),O&&($=O.start.row,C=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],x=this.$screenRowCache[V],H=$>B[W-1];else var H=!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;x+=this.getRowLength(P),P=R,H&&(this.$docRowCache.push(P),this.$screenRowCache.push(x))}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 ee=this.$wrapData[I];if(ee){for(var ne=0;Y.length>=ee[ne];)x++,ne++;Y=Y.substring(ee[ne-1]||0,Y.length),Q=ne>0?ee.indent:0}}return this.lineWidgets&&this.lineWidgets[P]&&this.lineWidgets[P].rowsAbove&&(x+=this.lineWidgets[P].rowsAbove),{row:x,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,x=0,C=this.$foldData[x++],R=C?C.start.row:1/0;O<I;){var P=this.$wrapData[O];$+=P?P.length+1:1,O++,O>R&&(O=C.end.row+1,C=this.$foldData[x++],R=C?C.start.row:1/0)}else{$=this.getLength();for(var w=this.$foldData,x=0;x<w.length;x++)C=w[x],$-=C.end.row-C.start.row}return this.lineWidgets&&($+=this.$getWidgetScreenLength()),$},A.prototype.$setFontMetrics=function($){this.$enableVarChar&&(this.$getStringScreenWidth=function(C,w,x){if(w===0)return[0,0];w||(w=1/0),x=x||0;var I,O;for(O=0;O<C.length&&(I=C.charAt(O),I===" "?x+=this.getScreenTabSize(x):x+=$.getCharacterWidth(I),!(x>w));O++);return[x,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 D=1,E=2,b=3,g=4,S=9,M=10,_=11,T=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}}),u.EditSession=y}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(i,u,v){var s=i("./lib/lang"),h=i("./lib/oop"),d=i("./range").Range,o=function(){function r(){this.$options={}}return r.prototype.set=function(l){return h.mixin(this.$options,l),this},r.prototype.getOptions=function(){return s.copyObject(this.$options)},r.prototype.setOptions=function(l){this.$options=l},r.prototype.find=function(l){var a=this.$options,c=this.$matchIterator(l,a);if(!c)return!1;var f=null;return c.forEach(function(m,y,D,E){return f=new d(m,y,D,E),y==E&&a.start&&a.start.start&&a.skipCurrent!=!1&&f.isEqual(a.start)?(f=null,!1):!0}),f},r.prototype.findAll=function(l){var a=this.$options;if(!a.needle)return[];this.$assembleRegExp(a);var c=a.range,f=c?l.getLines(c.start.row,c.end.row):l.doc.getAllLines(),m=[],y=a.re;if(a.$isMultiLine){var D=y.length,E=f.length-D,b;e:for(var g=y.offset||0;g<=E;g++){for(var S=0;S<D;S++)if(f[g+S].search(y[S])==-1)continue e;var M=f[g],_=f[g+D-1],T=M.length-M.match(y[0])[0].length,F=_.match(y[D-1])[0].length;b&&b.end.row===g&&b.end.column>T||(m.push(b=new d(g,T,g+D-1,F)),D>2&&(g=g+D-2))}}else for(var A,$=0;$<f.length;$++)if(this.$isMultilineSearch(a)){var C=f.length-1;if(A=this.$multiLineForward(l,y,$,C),A){var w=A.endRow<=C?A.endRow-1:C;w>$&&($=w),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 x=A[S];m.push(new d($,x.offset,$,x.offset+x.length))}}if(c){for(var I=c.start.column,O=c.end.column,$=0,S=m.length-1;$<S&&m[$].start.column<I&&m[$].start.row==0;)$++;for(var R=c.end.row-c.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+=c.start.row,m[$].end.row+=c.start.row}return m},r.prototype.parseReplaceString=function(l){for(var a={DollarSign:36,Ampersand:38,Digit0:48,Digit1:49,Digit9:57,Backslash:92,n:110,t:116},c="",f=0,m=l.length;f<m;f++){var y=l.charCodeAt(f);if(y===a.Backslash){if(f++,f>=m){c+="\\";break}var D=l.charCodeAt(f);switch(D){case a.Backslash:c+="\\";break;case a.n:c+=`
|
|
213
213
|
`;break;case a.t:c+=" ";break}continue}if(y===a.DollarSign){if(f++,f>=m){c+="$";break}var E=l.charCodeAt(f);if(E===a.DollarSign){c+="$$";continue}if(E===a.Digit0||E===a.Ampersand){c+="$&";continue}if(a.Digit1<=E&&E<=a.Digit9){c+="$"+l[f];continue}}c+=l[f]}return c||l},r.prototype.replace=function(l,a){var c=this.$options,f=this.$assembleRegExp(c);if(c.$isMultiLine)return a;if(f){var m=this.$isMultilineSearch(c);m&&(l=l.replace(/\r\n|\r|\n/g,`
|
|
214
|
-
`));var y=f.exec(l);if(!y||!m&&y[0].length!=l.length)return null;if(a=c.regExp?this.parseReplaceString(a):a.replace(/\$/g,"$$$$"),a=l.replace(f,a),c.preserveCase){a=a.split("");for(var D=Math.min(l.length,l.length);D--;){var E=l[D];E&&E.toLowerCase()!=E?a[D]=a[D].toUpperCase():a[D]=a[D].toLowerCase()}a=a.join("")}return a}},r.prototype.$assembleRegExp=function(l,a){if(l.needle instanceof RegExp)return l.re=l.needle;var c=l.needle;if(!l.needle)return l.re=!1;l.regExp||(c=
|
|
214
|
+
`));var y=f.exec(l);if(!y||!m&&y[0].length!=l.length)return null;if(a=c.regExp?this.parseReplaceString(a):a.replace(/\$/g,"$$$$"),a=l.replace(f,a),c.preserveCase){a=a.split("");for(var D=Math.min(l.length,l.length);D--;){var E=l[D];E&&E.toLowerCase()!=E?a[D]=a[D].toUpperCase():a[D]=a[D].toLowerCase()}a=a.join("")}return a}},r.prototype.$assembleRegExp=function(l,a){if(l.needle instanceof RegExp)return l.re=l.needle;var c=l.needle;if(!l.needle)return l.re=!1;l.regExp||(c=s.escapeRegExp(c));var f=l.caseSensitive?"gm":"gmi";try{new RegExp(c,"u"),l.$supportsUnicodeFlag=!0,f+="u"}catch{l.$supportsUnicodeFlag=!1}if(l.wholeWord&&(c=p(c,l)),l.$isMultiLine=!a&&/[\n\r]/.test(c),l.$isMultiLine)return l.re=this.$assembleMultilineRegExp(c,f);try{var m=new RegExp(c,f)}catch{m=!1}return l.re=m},r.prototype.$assembleMultilineRegExp=function(l,a){for(var c=l.replace(/\r\n|\r|\n/g,`$
|
|
215
215
|
^`).split(`
|
|
216
216
|
`),f=[],m=0;m<c.length;m++)try{f.push(new RegExp(c[m],a))}catch{return!1}return f},r.prototype.$isMultilineSearch=function(l){return l.re&&/\\r\\n|\\r|\\n/.test(l.re.source)&&l.regExp&&!l.$isMultiLine},r.prototype.$multiLineForward=function(l,a,c,f){for(var m,y=t(l,c),D=c;D<=f;){for(var E=0;E<y&&!(D>f);E++){var b=l.getLine(D++);m=m==null?b:m+`
|
|
217
217
|
`+b}var g=a.exec(m);if(a.lastIndex=0,g){var S=m.slice(0,g.index).split(`
|
|
@@ -219,15 +219,15 @@ import{C as pt,R as k}from"./ConfigCustomJavascriptSet__loadShare__react__loadSh
|
|
|
219
219
|
`),_=c+S.length-1,T=S[S.length-1].length,F=_+M.length-1,A=M.length==1?T+M[0].length:M[M.length-1].length;return{startRow:_,startCol:T,endRow:F,endCol:A}}}return null},r.prototype.$multiLineBackward=function(l,a,c,f,m){for(var y,D=t(l,f),E=l.getLine(f).length-c,b=f;b>=m;){for(var g=0;g<D&&b>=m;g++){var S=l.getLine(b--);y=y==null?S:S+`
|
|
220
220
|
`+y}var M=e(y,a,E);if(M){var _=y.slice(0,M.index).split(`
|
|
221
221
|
`),T=M[0].split(`
|
|
222
|
-
`),F=b+_.length,A=_[_.length-1].length,$=F+T.length-1,C=T.length==1?A+T[0].length:T[T.length-1].length;return{startRow:F,startCol:A,endRow:$,endCol:C}}}return null},r.prototype.$matchIterator=function(l,a){var c=this.$assembleRegExp(a);if(!c)return!1;var f=this.$isMultilineSearch(a),m=this.$multiLineForward,y=this.$multiLineBackward,D=a.backwards==!0,E=a.skipCurrent!=!1,b=c.unicode,g=a.range,S=a.start;S||(S=g?g[D?"end":"start"]:l.selection.getRange()),S.start&&(S=S[E!=D?"end":"start"]);var M=g?g.start.row:0,_=g?g.end.row:l.getLength()-1;if(D)var T=function($){var C=S.row;if(!A(C,S.column,$)){for(C--;C>=M;C--)if(A(C,Number.MAX_VALUE,$))return;if(a.wrap!=!1){for(C=_,M=S.row;C>=M;C--)if(A(C,Number.MAX_VALUE,$))return}}};else var T=function(C){var w=S.row;if(!A(w,S.column,C)){for(w=w+1;w<=_;w++)if(A(w,0,C))return;if(a.wrap!=!1){for(w=M,_=S.row;w<=_;w++)if(A(w,0,C))return}}};if(a.$isMultiLine)var F=c.length,A=function($,C,w){var x=D?$-F+1:$;if(!(x<0||x+F>l.getLength())){var I=l.getLine(x),R=I.search(c[0]);if(!(!D&&R<C||R===-1)){for(var O=1;O<F;O++)if(I=l.getLine(x+O),I.search(c[O])==-1)return;var P=I.match(c[F-1])[0].length;if(!(D&&P>C)&&w(x,R,x+F-1,P))return!0}}};else if(D)var A=function(C,w,x){if(f){var I=y(l,c,w,C,M);if(!I)return!1;if(x(I.startRow,I.startCol,I.endRow,I.endCol))return!0}else{var R=l.getLine(C),O=[],P,B=0;for(c.lastIndex=0;P=c.exec(R);){var V=P[0].length;if(B=P.index,!V){if(B>=R.length)break;c.lastIndex=B+=o.skipEmptyMatch(R,B,b)}if(P.index+V>w)break;O.push(P.index,V)}for(var W=O.length-1;W>=0;W-=2){var H=O[W-1],V=O[W];if(x(C,H,C,H+V))return!0}}};else var A=function(C,w,x){if(c.lastIndex=w,f){var I=m(l,c,C,_);if(I){var R=I.endRow<=_?I.endRow-1:_;R>C&&(C=R)}if(!I)return!1;if(x(I.startRow,I.startCol,I.endRow,I.endCol))return!0}else for(var O=l.getLine(C),P,B;B=c.exec(O);){var V=B[0].length;if(P=B.index,x(C,P,C,P+V))return!0;if(!V&&(c.lastIndex=P+=o.skipEmptyMatch(O,P,b),P>=O.length))return!1}};return{forEach:T}},r}();function p(r,l){var a=o.supportsLookbehind();function c(D,E){E===void 0&&(E=!0);var b=a&&l.$supportsUnicodeFlag?new RegExp("[\\p{L}\\p{N}_]","u"):new RegExp("\\w");return b.test(D)||l.regExp?a&&l.$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 c(m)+r+c(y,!1)}function e(r,l,a){for(var c=null,f=0;f<=r.length;){l.lastIndex=f;var m=l.exec(r);if(!m)break;var y=m.index+m[0].length;if(y>r.length-a)break;(!c||y>c.index+c[0].length)&&(c=m),f=m.index+1}return c}function t(r,l){var a=5e3,c={row:l,column:0},f=r.doc.positionToIndex(c),m=f+a,y=r.doc.indexToPosition(m),D=y.row;return D+1}u.Search=s}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(i,u,v){var o=this&&this.__extends||function(){var r=function(l,a){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,f){c.__proto__=f}||function(c,f){for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(c[m]=f[m])},r(l,a)};return function(l,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(l,a);function c(){this.constructor=l}l.prototype=a===null?Object.create(a):(c.prototype=a.prototype,new c)}}(),h=i("../lib/keys"),d=i("../lib/useragent"),s=h.KEY_MODS,p=function(){function r(l,a){this.$init(l,a,!1)}return r.prototype.$init=function(l,a,c){this.platform=a||(d.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(l),this.$singleCommand=c},r.prototype.addCommand=function(l){this.commands[l.name]&&this.removeCommand(l),this.commands[l.name]=l,l.bindKey&&this._buildKeyHash(l)},r.prototype.removeCommand=function(l,a){var c=l&&(typeof l=="string"?l:l.name);l=this.commands[c],a||delete this.commands[c];var f=this.commandKeyBinding;for(var m in f){var y=f[m];if(y==l)delete f[m];else if(Array.isArray(y)){var D=y.indexOf(l);D!=-1&&(y.splice(D,1),y.length==1&&(f[m]=y[0]))}}},r.prototype.bindKey=function(l,a,c){if(typeof l=="object"&&l&&(c==null&&(c=l.position),l=l[this.platform]),!!l){if(typeof a=="function")return this.addCommand({exec:a,bindKey:l,name:a.name||l});l.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=s[g.hashId]+g.key;m+=(m?" ":"")+S,this._addCommandToBinding(m,"chainKeys")},this),m+=" "}var D=this.parseKeys(f),E=s[D.hashId]+D.key;this._addCommandToBinding(m+E,a,c)},this)}},r.prototype._addCommandToBinding=function(l,a,c){var f=this.commandKeyBinding,m;if(!a)delete f[l];else if(!f[l]||this.$singleCommand)f[l]=a;else{Array.isArray(f[l])?(m=f[l].indexOf(a))!=-1&&f[l].splice(m,1):f[l]=[f[l]],typeof c!="number"&&(c=e(a));var y=f[l];for(m=0;m<y.length;m++){var D=y[m],E=e(D);if(E>c)break}y.splice(m,0,a)}},r.prototype.addCommands=function(l){l&&Object.keys(l).forEach(function(a){var c=l[a];if(c){if(typeof c=="string")return this.bindKey(c,a);typeof c=="function"&&(c={exec:c}),typeof c=="object"&&(c.name||(c.name=a),this.addCommand(c))}},this)},r.prototype.removeCommands=function(l){Object.keys(l).forEach(function(a){this.removeCommand(l[a])},this)},r.prototype.bindKeys=function(l){Object.keys(l).forEach(function(a){this.bindKey(a,l[a])},this)},r.prototype._buildKeyHash=function(l){this.bindKey(l.bindKey,l)},r.prototype.parseKeys=function(l){var a=l.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(E){return E}),c=a.pop(),f=h[c];if(h.FUNCTION_KEYS[f])c=h.FUNCTION_KEYS[f].toLowerCase();else if(a.length){if(a.length==1&&a[0]=="shift")return{key:c.toUpperCase(),hashId:-1}}else return{key:c,hashId:-1};for(var m=0,y=a.length;y--;){var D=h.KEY_MODS[a[y]];if(D==null)return typeof console<"u"&&console.error("invalid modifier "+a[y]+" in "+l),!1;m|=D}return{key:c,hashId:m}},r.prototype.findKeyCommand=function(l,a){var c=s[l]+a;return this.commandKeyBinding[c]},r.prototype.handleKeyboard=function(l,a,c,f){if(!(f<0)){var m=s[a]+c,y=this.commandKeyBinding[m];return l.$keyChain&&(l.$keyChain+=" "+m,y=this.commandKeyBinding[l.$keyChain]||y),y&&(y=="chainKeys"||y[y.length-1]=="chainKeys")?(l.$keyChain=l.$keyChain||m,{command:"null"}):(l.$keyChain&&((!a||a==4)&&c.length==1?l.$keyChain=l.$keyChain.slice(0,-m.length-1):(a==-1||f>0)&&(l.$keyChain="")),{command:y})}},r.prototype.getStatusText=function(l,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){o(l,r);function l(a,c){var f=r.call(this,a,c)||this;return f.$singleCommand=!0,f}return l}(p);t.call=function(r,l,a){p.prototype.$init.call(r,l,a,!0)},p.call=function(r,l,a){p.prototype.$init.call(r,l,a,!1)},u.HashHandler=t,u.MultiHashHandler=p}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(i,u,v){var o=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,a){l.__proto__=a}||function(l,a){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(l[c]=a[c])},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 l(){this.constructor=t}t.prototype=r===null?Object.create(r):(l.prototype=r.prototype,new l)}}(),h=i("../lib/oop"),d=i("../keyboard/hash_handler").MultiHashHandler,s=i("../lib/event_emitter").EventEmitter,p=function(e){o(t,e);function t(r,l){var a=e.call(this,l,r)||this;return a.byName=a.commands,a.setDefaultHandler("exec",function(c){return c.args?c.command.exec(c.editor,c.args,c.event,!1):c.command.exec(c.editor,{},c.event,!0)}),a}return t.prototype.exec=function(r,l,a){if(Array.isArray(r)){for(var c=r.length;c--;)if(this.exec(r[c],l,a))return!0;return!1}typeof r=="string"&&(r=this.commands[r]);var f={editor:l,command:r,args:a};return this.canExecute(r,l)?(f.returnValue=this._emit("exec",f),this._signal("afterExec",f),f.returnValue!==!1):(this._signal("commandUnavailable",f),!1)},t.prototype.canExecute=function(r,l){return typeof r=="string"&&(r=this.commands[r]),!(!r||l&&l.$readOnly&&!r.readOnly||this.$checkCommandState!=!1&&r.isAvailable&&!r.isAvailable(l))},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(l){this.macro.push([l.command,l.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(l){typeof l=="string"?this.exec(l,r):this.exec(l[0],r,l[1])},this)}finally{this.$inReplay=!1}}},t.prototype.trimMacro=function(r){return r.map(function(l){return typeof l[0]!="string"&&(l[0]=l[0].name),l[1]||(l=l[0]),l})},t}(d);h.implement(p.prototype,s),u.CommandManager=p}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(i,u,v){var o=i("../lib/lang"),h=i("../config"),d=i("../range").Range;function s(e,t){return{win:e,mac:t}}u.commands=[{name:"showSettingsMenu",description:"Show settings menu",bindKey:s("Ctrl-,","Command-,"),exec:function(e){h.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",description:"Go to next error",bindKey:s("Alt-E","F4"),exec:function(e){h.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",description:"Go to previous error",bindKey:s("Alt-Shift-E","Shift-F4"),exec:function(e){h.loadModule("ace/ext/error_marker",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:s("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:s(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:s("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:s("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:s("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:s("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",description:"Toggle parent fold widget",bindKey:s("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:s(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldAllComments",description:"Fold all comments",bindKey:s(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAllComments()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:s("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:s("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:s("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:s("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:s("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:s("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:s("Ctrl-F","Command-F"),exec:function(e){h.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:s("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:s("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:s("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:s("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:s("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:s("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:s("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:s("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:s("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:s("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:s("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:s("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:s("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:s("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:s("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:s("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:s("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:s("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:s("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:s("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:s(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:s("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:s(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:s("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:s("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:s("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:s("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:s("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:s("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:s("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:s(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:s("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:s("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:s("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:s("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:s("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:s("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:s("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:s("Ctrl-H","Command-Option-F"),exec:function(e){h.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",description:"Undo",bindKey:s("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",description:"Redo",bindKey:s("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:s("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:s("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:s("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:s("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:s("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:s("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:s("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:s("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:s("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:s("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:s("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:s("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:s("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:s("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:s("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:s("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:s("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(o.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:s(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:s("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:s("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:s("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:s(null,null),exec:function(e){e.autoIndent()},scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:s("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:s("Ctrl+F3","F3"),exec:function(e){e.openLink()}},{name:"joinlines",description:"Join lines",bindKey:s(null,null),exec:function(e){for(var t=e.selection.isBackwards(),r=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),l=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),a=e.session.doc.getLine(r.row).length,c=e.session.doc.getTextRange(e.selection.getRange()),f=c.replace(/\n\s*/," ").length,m=e.session.doc.getLine(r.row),y=r.row+1;y<=l.row+1;y++){var D=o.stringTrimLeft(o.stringTrimRight(e.session.doc.getLine(y)));D.length!==0&&(D=" "+D),m+=D}l.row+1<e.session.doc.getLength()-1&&(m+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new d(r.row,0,l.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:s(null,null),exec:function(e){var t=e.session.doc.getLength()-1,r=e.session.doc.getLine(t).length,l=e.selection.rangeList.ranges,a=[];l.length<1&&(l=[e.selection.getRange()]);for(var c=0;c<l.length;c++)c==l.length-1&&(l[c].end.row===t&&l[c].end.column===r||a.push(new d(l[c].end.row,l[c].end.column,t,r))),c===0?l[c].start.row===0&&l[c].start.column===0||a.push(new d(0,0,l[c].start.row,l[c].start.column)):a.push(new d(l[c-1].end.row,l[c-1].end.column,l[c].start.row,l[c].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var c=0;c<a.length;c++)e.selection.addRange(a[c],!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=b+_.length,A=_[_.length-1].length,$=F+T.length-1,C=T.length==1?A+T[0].length:T[T.length-1].length;return{startRow:F,startCol:A,endRow:$,endCol:C}}}return null},r.prototype.$matchIterator=function(l,a){var c=this.$assembleRegExp(a);if(!c)return!1;var f=this.$isMultilineSearch(a),m=this.$multiLineForward,y=this.$multiLineBackward,D=a.backwards==!0,E=a.skipCurrent!=!1,b=c.unicode,g=a.range,S=a.start;S||(S=g?g[D?"end":"start"]:l.selection.getRange()),S.start&&(S=S[E!=D?"end":"start"]);var M=g?g.start.row:0,_=g?g.end.row:l.getLength()-1;if(D)var T=function($){var C=S.row;if(!A(C,S.column,$)){for(C--;C>=M;C--)if(A(C,Number.MAX_VALUE,$))return;if(a.wrap!=!1){for(C=_,M=S.row;C>=M;C--)if(A(C,Number.MAX_VALUE,$))return}}};else var T=function(C){var w=S.row;if(!A(w,S.column,C)){for(w=w+1;w<=_;w++)if(A(w,0,C))return;if(a.wrap!=!1){for(w=M,_=S.row;w<=_;w++)if(A(w,0,C))return}}};if(a.$isMultiLine)var F=c.length,A=function($,C,w){var x=D?$-F+1:$;if(!(x<0||x+F>l.getLength())){var I=l.getLine(x),O=I.search(c[0]);if(!(!D&&O<C||O===-1)){for(var R=1;R<F;R++)if(I=l.getLine(x+R),I.search(c[R])==-1)return;var P=I.match(c[F-1])[0].length;if(!(D&&P>C)&&w(x,O,x+F-1,P))return!0}}};else if(D)var A=function(C,w,x){if(f){var I=y(l,c,w,C,M);if(!I)return!1;if(x(I.startRow,I.startCol,I.endRow,I.endCol))return!0}else{var O=l.getLine(C),R=[],P,B=0;for(c.lastIndex=0;P=c.exec(O);){var V=P[0].length;if(B=P.index,!V){if(B>=O.length)break;c.lastIndex=B+=s.skipEmptyMatch(O,B,b)}if(P.index+V>w)break;R.push(P.index,V)}for(var W=R.length-1;W>=0;W-=2){var H=R[W-1],V=R[W];if(x(C,H,C,H+V))return!0}}};else var A=function(C,w,x){if(c.lastIndex=w,f){var I=m(l,c,C,_);if(I){var O=I.endRow<=_?I.endRow-1:_;O>C&&(C=O)}if(!I)return!1;if(x(I.startRow,I.startCol,I.endRow,I.endCol))return!0}else for(var R=l.getLine(C),P,B;B=c.exec(R);){var V=B[0].length;if(P=B.index,x(C,P,C,P+V))return!0;if(!V&&(c.lastIndex=P+=s.skipEmptyMatch(R,P,b),P>=R.length))return!1}};return{forEach:T}},r}();function p(r,l){var a=s.supportsLookbehind();function c(D,E){E===void 0&&(E=!0);var b=a&&l.$supportsUnicodeFlag?new RegExp("[\\p{L}\\p{N}_]","u"):new RegExp("\\w");return b.test(D)||l.regExp?a&&l.$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 c(m)+r+c(y,!1)}function e(r,l,a){for(var c=null,f=0;f<=r.length;){l.lastIndex=f;var m=l.exec(r);if(!m)break;var y=m.index+m[0].length;if(y>r.length-a)break;(!c||y>c.index+c[0].length)&&(c=m),f=m.index+1}return c}function t(r,l){var a=5e3,c={row:l,column:0},f=r.doc.positionToIndex(c),m=f+a,y=r.doc.indexToPosition(m),D=y.row;return D+1}u.Search=o}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(i,u,v){var s=this&&this.__extends||function(){var r=function(l,a){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(c,f){c.__proto__=f}||function(c,f){for(var m in f)Object.prototype.hasOwnProperty.call(f,m)&&(c[m]=f[m])},r(l,a)};return function(l,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(l,a);function c(){this.constructor=l}l.prototype=a===null?Object.create(a):(c.prototype=a.prototype,new c)}}(),h=i("../lib/keys"),d=i("../lib/useragent"),o=h.KEY_MODS,p=function(){function r(l,a){this.$init(l,a,!1)}return r.prototype.$init=function(l,a,c){this.platform=a||(d.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(l),this.$singleCommand=c},r.prototype.addCommand=function(l){this.commands[l.name]&&this.removeCommand(l),this.commands[l.name]=l,l.bindKey&&this._buildKeyHash(l)},r.prototype.removeCommand=function(l,a){var c=l&&(typeof l=="string"?l:l.name);l=this.commands[c],a||delete this.commands[c];var f=this.commandKeyBinding;for(var m in f){var y=f[m];if(y==l)delete f[m];else if(Array.isArray(y)){var D=y.indexOf(l);D!=-1&&(y.splice(D,1),y.length==1&&(f[m]=y[0]))}}},r.prototype.bindKey=function(l,a,c){if(typeof l=="object"&&l&&(c==null&&(c=l.position),l=l[this.platform]),!!l){if(typeof a=="function")return this.addCommand({exec:a,bindKey:l,name:a.name||l});l.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 D=this.parseKeys(f),E=o[D.hashId]+D.key;this._addCommandToBinding(m+E,a,c)},this)}},r.prototype._addCommandToBinding=function(l,a,c){var f=this.commandKeyBinding,m;if(!a)delete f[l];else if(!f[l]||this.$singleCommand)f[l]=a;else{Array.isArray(f[l])?(m=f[l].indexOf(a))!=-1&&f[l].splice(m,1):f[l]=[f[l]],typeof c!="number"&&(c=e(a));var y=f[l];for(m=0;m<y.length;m++){var D=y[m],E=e(D);if(E>c)break}y.splice(m,0,a)}},r.prototype.addCommands=function(l){l&&Object.keys(l).forEach(function(a){var c=l[a];if(c){if(typeof c=="string")return this.bindKey(c,a);typeof c=="function"&&(c={exec:c}),typeof c=="object"&&(c.name||(c.name=a),this.addCommand(c))}},this)},r.prototype.removeCommands=function(l){Object.keys(l).forEach(function(a){this.removeCommand(l[a])},this)},r.prototype.bindKeys=function(l){Object.keys(l).forEach(function(a){this.bindKey(a,l[a])},this)},r.prototype._buildKeyHash=function(l){this.bindKey(l.bindKey,l)},r.prototype.parseKeys=function(l){var a=l.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(E){return E}),c=a.pop(),f=h[c];if(h.FUNCTION_KEYS[f])c=h.FUNCTION_KEYS[f].toLowerCase();else if(a.length){if(a.length==1&&a[0]=="shift")return{key:c.toUpperCase(),hashId:-1}}else return{key:c,hashId:-1};for(var m=0,y=a.length;y--;){var D=h.KEY_MODS[a[y]];if(D==null)return typeof console<"u"&&console.error("invalid modifier "+a[y]+" in "+l),!1;m|=D}return{key:c,hashId:m}},r.prototype.findKeyCommand=function(l,a){var c=o[l]+a;return this.commandKeyBinding[c]},r.prototype.handleKeyboard=function(l,a,c,f){if(!(f<0)){var m=o[a]+c,y=this.commandKeyBinding[m];return l.$keyChain&&(l.$keyChain+=" "+m,y=this.commandKeyBinding[l.$keyChain]||y),y&&(y=="chainKeys"||y[y.length-1]=="chainKeys")?(l.$keyChain=l.$keyChain||m,{command:"null"}):(l.$keyChain&&((!a||a==4)&&c.length==1?l.$keyChain=l.$keyChain.slice(0,-m.length-1):(a==-1||f>0)&&(l.$keyChain="")),{command:y})}},r.prototype.getStatusText=function(l,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(l,r);function l(a,c){var f=r.call(this,a,c)||this;return f.$singleCommand=!0,f}return l}(p);t.call=function(r,l,a){p.prototype.$init.call(r,l,a,!0)},p.call=function(r,l,a){p.prototype.$init.call(r,l,a,!1)},u.HashHandler=t,u.MultiHashHandler=p}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(i,u,v){var s=this&&this.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(l,a){l.__proto__=a}||function(l,a){for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&(l[c]=a[c])},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 l(){this.constructor=t}t.prototype=r===null?Object.create(r):(l.prototype=r.prototype,new l)}}(),h=i("../lib/oop"),d=i("../keyboard/hash_handler").MultiHashHandler,o=i("../lib/event_emitter").EventEmitter,p=function(e){s(t,e);function t(r,l){var a=e.call(this,l,r)||this;return a.byName=a.commands,a.setDefaultHandler("exec",function(c){return c.args?c.command.exec(c.editor,c.args,c.event,!1):c.command.exec(c.editor,{},c.event,!0)}),a}return t.prototype.exec=function(r,l,a){if(Array.isArray(r)){for(var c=r.length;c--;)if(this.exec(r[c],l,a))return!0;return!1}typeof r=="string"&&(r=this.commands[r]);var f={editor:l,command:r,args:a};return this.canExecute(r,l)?(f.returnValue=this._emit("exec",f),this._signal("afterExec",f),f.returnValue!==!1):(this._signal("commandUnavailable",f),!1)},t.prototype.canExecute=function(r,l){return typeof r=="string"&&(r=this.commands[r]),!(!r||l&&l.$readOnly&&!r.readOnly||this.$checkCommandState!=!1&&r.isAvailable&&!r.isAvailable(l))},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(l){this.macro.push([l.command,l.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(l){typeof l=="string"?this.exec(l,r):this.exec(l[0],r,l[1])},this)}finally{this.$inReplay=!1}}},t.prototype.trimMacro=function(r){return r.map(function(l){return typeof l[0]!="string"&&(l[0]=l[0].name),l[1]||(l=l[0]),l})},t}(d);h.implement(p.prototype,o),u.CommandManager=p}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(i,u,v){var s=i("../lib/lang"),h=i("../config"),d=i("../range").Range;function o(e,t){return{win:e,mac:t}}u.commands=[{name:"showSettingsMenu",description:"Show settings menu",bindKey:o("Ctrl-,","Command-,"),exec:function(e){h.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){h.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){h.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){h.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){h.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(),l=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),a=e.session.doc.getLine(r.row).length,c=e.session.doc.getTextRange(e.selection.getRange()),f=c.replace(/\n\s*/," ").length,m=e.session.doc.getLine(r.row),y=r.row+1;y<=l.row+1;y++){var D=s.stringTrimLeft(s.stringTrimRight(e.session.doc.getLine(y)));D.length!==0&&(D=" "+D),m+=D}l.row+1<e.session.doc.getLength()-1&&(m+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new d(r.row,0,l.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,l=e.selection.rangeList.ranges,a=[];l.length<1&&(l=[e.selection.getRange()]);for(var c=0;c<l.length;c++)c==l.length-1&&(l[c].end.row===t&&l[c].end.column===r||a.push(new d(l[c].end.row,l[c].end.column,t,r))),c===0?l[c].start.row===0&&l[c].start.column===0||a.push(new d(0,0,l[c].start.row,l[c].start.column)):a.push(new d(l[c-1].end.row,l[c-1].end.column,l[c].start.row,l[c].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var c=0;c<a.length;c++)e.selection.addRange(a[c],!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:s("F1","F1"),exec:function(e){e.prompt({$type:"commands"})},readOnly:!0},{name:"modeSelect",description:"Change language mode...",bindKey:s(null,null),exec:function(e){e.prompt({$type:"modes"})},readOnly:!0}];for(var p=1;p<9;p++)u.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,u,v){var o=i("../lib/keys"),h=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 h(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===o.escape&&this.annotationTooltip.hideTooltip();return}if(e.target===this.element){if(e.keyCode!=o.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),l=this.$findNearestFoldLaneWidget(r),a=this.$findNearestAnnotation(r);if(!(l===null&&a===null)){var c=this.$findClosestNumber(l,a,r);if(c===l)if(this.activeLane="fold",this.activeRowIndex=l,this.$isCustomWidgetVisible(l)){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 s(e,this))}.bind(this),10)},p.prototype.$handleGutterKeyboardInteraction=function(e){if(e.keyCode===o.tab){e.preventDefault();return}if(e.keyCode===o.escape){e.preventDefault(),this.$blurGutter(),this.element.focus(),this.lane=null;return}if(e.keyCode===o.up){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetUp();break;case"annotation":this.$moveAnnotationUp();break}return}if(e.keyCode===o.down){switch(e.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetDown();break;case"annotation":this.$moveAnnotationDown();break}return}if(e.keyCode===o.left){e.preventDefault(),this.$switchLane("annotation");return}if(e.keyCode===o.right){e.preventDefault(),this.$switchLane("fold");return}if(e.keyCode===o.enter||e.keyCode===o.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 l=this.lines.cells[this.activeRowIndex].element.childNodes[2],a=l.getBoundingClientRect(),c=this.annotationTooltip.getElement().style;c.left=a.right+"px",c.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}();u.GutterKeyboardHandler=d;var s=function(){function p(e,t){this.gutterKeyboardHandler=t,this.domEvent=e}return p.prototype.getKey=function(){return o.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}();u.GutterKeyboardEvent=s}),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,u,v){var o=this&&this.__values||function(C){var w=typeof Symbol=="function"&&Symbol.iterator,x=w&&C[w],I=0;if(x)return x.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(w?"Object is not iterable.":"Symbol.iterator is not defined.")},h=i("./lib/oop"),d=i("./lib/dom"),s=i("./lib/lang"),p=i("./lib/useragent"),e=i("./keyboard/textinput").TextInput,t=i("./mouse/mouse_handler").MouseHandler,r=i("./mouse/fold_handler").FoldHandler,l=i("./keyboard/keybinding").KeyBinding,a=i("./edit_session").EditSession,c=i("./search").Search,f=i("./range").Range,m=i("./lib/event_emitter").EventEmitter,y=i("./commands/command_manager").CommandManager,D=i("./commands/default_commands").commands,E=i("./config"),b=i("./token_iterator").TokenIterator,g=i("./keyboard/gutter_handler").GutterKeyboardHandler,S=i("./config").nls,M=i("./clipboard"),_=i("./lib/keys"),T=i("./lib/event"),F=i("./tooltip").HoverTooltip,A=function(){function C(w,x,I){this.id="editor"+ ++C.$uid,this.session,this.$toDestroy=[];var R=w.getContainerElement();this.container=R,this.renderer=w,this.commands=new y(p.isMac?"mac":"win",D),typeof document=="object"&&(this.textInput=new e(w.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new t(this),new r(this)),this.keyBinding=new l(this),this.$search=new c().set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on("exec",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=s.delayedCall(function(){this._signal("input",{}),this.session&&!this.session.destroyed&&this.session.bgTokenizer.scheduleStart()}.bind(this)),this.on("change",function(O,P){P._$emitInputEvent.schedule(31)}),this.setSession(x||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(w){this.session.startOperation(w)},C.prototype.endOperation=function(w){this.session.endOperation(w)},C.prototype.onStartOperation=function(w){this.curOp=this.session.curOp,this.curOp.scrollTop=this.renderer.scrollTop,this.prevOp=this.session.prevOp,w||(this.previousCommand=null)},C.prototype.onEndOperation=function(w){if(this.curOp&&this.session){if(w&&w.returnValue===!1){this.curOp=null;return}if(this._signal("beforeEndOperation"),!this.curOp)return;var x=this.curOp.command,I=x&&x.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 R=this.selection.getRange(),O=this.renderer.layerConfig;(R.start.row>=O.lastRow||R.end.row<=O.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(w){if(this.$mergeUndoDeltas){var x=this.prevOp,I=this.$mergeableCommands,R=x.command&&w.command.name==x.command.name;if(w.command.name=="insertstring"){var O=w.args;this.mergeNextCommand===void 0&&(this.mergeNextCommand=!0),R=R&&this.mergeNextCommand&&(!/\s/.test(O)||/\s/.test(x.args)),this.mergeNextCommand=!0}else R=R&&I.indexOf(w.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(R=!1),R?this.session.mergeUndoDeltas=!0:I.indexOf(w.command.name)!==-1&&(this.sequenceStartTime=Date.now())}},C.prototype.setKeyboardHandler=function(w,x){if(w&&typeof w=="string"&&w!="ace"){this.$keybindingId=w;var I=this;E.loadModule(["keybinding",w],function(R){I.$keybindingId==w&&I.keyBinding.setKeyboardHandler(R&&R.handler),x&&x()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(w),x&&x()},C.prototype.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},C.prototype.setSession=function(w){if(this.session!=w){this.curOp&&this.endOperation(),this.curOp={};var x=this.session;if(x){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=w,w?(this.$onDocumentChange=this.onDocumentChange.bind(this),w.on("change",this.$onDocumentChange),this.renderer.setSession(w),this.$onChangeMode=this.onChangeMode.bind(this),w.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),w.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),w.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),w.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),w.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),w.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=w.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(w)),this._signal("changeSession",{session:w,oldSession:x}),this.curOp=null,x&&x._signal("changeEditor",{oldEditor:this}),x&&(x.$editor=null),w&&w._signal("changeEditor",{editor:this}),w&&(w.$editor=this),w&&!w.destroyed&&w.bgTokenizer.scheduleStart()}},C.prototype.getSession=function(){return this.session},C.prototype.setValue=function(w,x){return this.session.doc.setValue(w),x?x==1?this.navigateFileEnd():x==-1&&this.navigateFileStart():this.selectAll(),w},C.prototype.getValue=function(){return this.session.getValue()},C.prototype.getSelection=function(){return this.selection},C.prototype.resize=function(w){this.renderer.onResize(w)},C.prototype.setTheme=function(w,x){this.renderer.setTheme(w,x)},C.prototype.getTheme=function(){return this.renderer.getTheme()},C.prototype.setStyle=function(w,x){this.renderer.setStyle(w,x)},C.prototype.unsetStyle=function(w){this.renderer.unsetStyle(w)},C.prototype.getFontSize=function(){return this.getOption("fontSize")||d.computedStyle(this.container).fontSize},C.prototype.setFontSize=function(w){this.setOption("fontSize",w)},C.prototype.$highlightBrackets=function(){if(!this.$highlightPending){var w=this;this.$highlightPending=!0,setTimeout(function(){w.$highlightPending=!1;var x=w.session;if(!(!x||x.destroyed)){x.$bracketHighlight&&(x.$bracketHighlight.markerIds.forEach(function(U){x.removeMarker(U)}),x.$bracketHighlight=null);var I=w.getCursorPosition(),R=w.getKeyboardHandler(),O=R&&R.$getDirectionForHighlight&&R.$getDirectionForHighlight(w),P=x.getMatchingBracketRanges(I,O);if(!P){var B=new b(x,I.row,I.column),V=B.getCurrentToken();if(V&&/\b(?:tag-open|tag-name)/.test(V.type)){var W=x.getMatchingTags(I);W&&(P=[W.openTagName.isEmpty()?W.openTag:W.openTagName,W.closeTagName.isEmpty()?W.closeTag:W.closeTagName])}}if(!P&&x.$mode.getMatching&&(P=x.$mode.getMatching(w.session)),!P){w.getHighlightIndentGuides()&&w.renderer.$textLayer.$highlightIndentGuide();return}var H="ace_bracket";Array.isArray(P)?P.length==1&&(H="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)])),x.$bracketHighlight={ranges:P,markerIds:P.map(function(U){return x.addMarker(U,H,"text")})},w.getHighlightIndentGuides()&&w.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(w){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",w))},C.prototype.onBlur=function(w){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",w))},C.prototype.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$updateHighlightActiveLine()},C.prototype.onDocumentChange=function(w){var x=this.session.$useWrapMode,I=w.start.row==w.end.row?w.end.row:1/0;this.renderer.updateLines(w.start.row,I,x),this._signal("change",w),this.$cursorChange()},C.prototype.onTokenizerUpdate=function(w){var x=w.data;this.renderer.updateLines(x.first,x.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 w=this.getSession(),x;if(this.$highlightActiveLine&&((this.$selectionStyle!="line"||!this.selection.isMultiLine())&&(x=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(x=!1),this.renderer.$maxLines&&this.session.getLength()===1&&!(this.renderer.$minLines>1)&&(x=!1)),w.$highlightLineMarker&&!x)w.removeMarker(w.$highlightLineMarker.id),w.$highlightLineMarker=null;else if(!w.$highlightLineMarker&&x){var I=new f(x.row,x.column,x.row,1/0);I.id=w.addMarker(I,"ace_active-line","screenLine"),w.$highlightLineMarker=I}else x&&(w.$highlightLineMarker.start.row=x.row,w.$highlightLineMarker.end.row=x.row,w.$highlightLineMarker.start.column=x.column,w._signal("changeBackMarker"))},C.prototype.onSelectionChange=function(w){var x=this.session;if(x.$selectionMarker&&x.removeMarker(x.$selectionMarker),x.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var I=this.selection.getRange(),R=this.getSelectionStyle();x.$selectionMarker=x.addMarker(I,"ace_selection",R)}var O=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(O),this._signal("changeSelection")},C.prototype.$getSelectionHighLightRegexp=function(){var w=this.session,x=this.getSelectionRange();if(!(x.isEmpty()||x.isMultiLine())){var I=x.start.column,R=x.end.column,O=w.getLine(x.start.row),P=O.substring(I,R);if(!(P.length>5e3||!/[\w\d]/.test(P))){var B=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:P}),V=O.substring(I-1,R+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(w){this.renderer.updateText(),this._emit("changeMode",w)},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 w=this.getSelectedText(),x=this.session.doc.getNewLineCharacter(),I=!1;if(!w&&this.$copyWithEmptySelection){I=!0;for(var R=this.selection.getAllRanges(),O=0;O<R.length;O++){var P=R[O];O&&R[O-1].start.row==P.start.row||(w+=this.session.getLine(P.start.row)+x)}}var B={text:w};return this._signal("copy",B),M.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(w,x){var I={text:w,event:x};this.commands.exec("paste",this,I)},C.prototype.$handlePaste=function(w){typeof w=="string"&&(w={text:w}),this._signal("paste",w);var x=w.text,I=x===M.lineMode,R=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)I?R.insert({row:this.selection.lead.row,column:0},x):this.insert(x);else if(I)this.selection.rangeList.ranges.forEach(function(H){R.insert({row:H.start.row,column:0},x)});else{var O=x.split(/\r\n|\r|\n/),P=this.selection.rangeList.ranges,B=O.length==2&&(!O[0]||!O[1]);if(O.length!=P.length||B)return this.commands.exec("insertstring",this,x);for(var V=P.length;V--;){var W=P[V];W.isEmpty()||R.remove(W),R.insert(W.start,O[V])}}},C.prototype.execCommand=function(w,x){return this.commands.exec(w,this,x)},C.prototype.insert=function(w,x){var I=this.session,R=I.getMode(),O=this.getCursorPosition();if(this.getBehavioursEnabled()&&!x){var P=R.transformAction(I.getState(O.row),"insertion",this,I,w);P&&(w!==P.text&&(this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1)),w=P.text)}if(w==" "&&(w=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&w.indexOf(`
|
|
225
|
-
`)==-1){var B=f.fromPoints(
|
|
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++)u.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,u,v){var s=i("../lib/keys"),h=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 h(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),l=this.$findNearestFoldLaneWidget(r),a=this.$findNearestAnnotation(r);if(!(l===null&&a===null)){var c=this.$findClosestNumber(l,a,r);if(c===l)if(this.activeLane="fold",this.activeRowIndex=l,this.$isCustomWidgetVisible(l)){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 l=this.lines.cells[this.activeRowIndex].element.childNodes[2],a=l.getBoundingClientRect(),c=this.annotationTooltip.getElement().style;c.left=a.right+"px",c.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}();u.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}();u.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,u,v){var s=this&&this.__values||function(C){var w=typeof Symbol=="function"&&Symbol.iterator,x=w&&C[w],I=0;if(x)return x.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(w?"Object is not iterable.":"Symbol.iterator is not defined.")},h=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,l=i("./keyboard/keybinding").KeyBinding,a=i("./edit_session").EditSession,c=i("./search").Search,f=i("./range").Range,m=i("./lib/event_emitter").EventEmitter,y=i("./commands/command_manager").CommandManager,D=i("./commands/default_commands").commands,E=i("./config"),b=i("./token_iterator").TokenIterator,g=i("./keyboard/gutter_handler").GutterKeyboardHandler,S=i("./config").nls,M=i("./clipboard"),_=i("./lib/keys"),T=i("./lib/event"),F=i("./tooltip").HoverTooltip,A=function(){function C(w,x,I){this.id="editor"+ ++C.$uid,this.session,this.$toDestroy=[];var O=w.getContainerElement();this.container=O,this.renderer=w,this.commands=new y(p.isMac?"mac":"win",D),typeof document=="object"&&(this.textInput=new e(w.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new t(this),new r(this)),this.keyBinding=new l(this),this.$search=new c().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(x||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(w){this.session.startOperation(w)},C.prototype.endOperation=function(w){this.session.endOperation(w)},C.prototype.onStartOperation=function(w){this.curOp=this.session.curOp,this.curOp.scrollTop=this.renderer.scrollTop,this.prevOp=this.session.prevOp,w||(this.previousCommand=null)},C.prototype.onEndOperation=function(w){if(this.curOp&&this.session){if(w&&w.returnValue===!1){this.curOp=null;return}if(this._signal("beforeEndOperation"),!this.curOp)return;var x=this.curOp.command,I=x&&x.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}},C.prototype.$historyTracker=function(w){if(this.$mergeUndoDeltas){var x=this.prevOp,I=this.$mergeableCommands,O=x.command&&w.command.name==x.command.name;if(w.command.name=="insertstring"){var R=w.args;this.mergeNextCommand===void 0&&(this.mergeNextCommand=!0),O=O&&this.mergeNextCommand&&(!/\s/.test(R)||/\s/.test(x.args)),this.mergeNextCommand=!0}else O=O&&I.indexOf(w.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(O=!1),O?this.session.mergeUndoDeltas=!0:I.indexOf(w.command.name)!==-1&&(this.sequenceStartTime=Date.now())}},C.prototype.setKeyboardHandler=function(w,x){if(w&&typeof w=="string"&&w!="ace"){this.$keybindingId=w;var I=this;E.loadModule(["keybinding",w],function(O){I.$keybindingId==w&&I.keyBinding.setKeyboardHandler(O&&O.handler),x&&x()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(w),x&&x()},C.prototype.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},C.prototype.setSession=function(w){if(this.session!=w){this.curOp&&this.endOperation(),this.curOp={};var x=this.session;if(x){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=w,w?(this.$onDocumentChange=this.onDocumentChange.bind(this),w.on("change",this.$onDocumentChange),this.renderer.setSession(w),this.$onChangeMode=this.onChangeMode.bind(this),w.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),w.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),w.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),w.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),w.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),w.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=w.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(w)),this._signal("changeSession",{session:w,oldSession:x}),this.curOp=null,x&&x._signal("changeEditor",{oldEditor:this}),x&&(x.$editor=null),w&&w._signal("changeEditor",{editor:this}),w&&(w.$editor=this),w&&!w.destroyed&&w.bgTokenizer.scheduleStart()}},C.prototype.getSession=function(){return this.session},C.prototype.setValue=function(w,x){return this.session.doc.setValue(w),x?x==1?this.navigateFileEnd():x==-1&&this.navigateFileStart():this.selectAll(),w},C.prototype.getValue=function(){return this.session.getValue()},C.prototype.getSelection=function(){return this.selection},C.prototype.resize=function(w){this.renderer.onResize(w)},C.prototype.setTheme=function(w,x){this.renderer.setTheme(w,x)},C.prototype.getTheme=function(){return this.renderer.getTheme()},C.prototype.setStyle=function(w,x){this.renderer.setStyle(w,x)},C.prototype.unsetStyle=function(w){this.renderer.unsetStyle(w)},C.prototype.getFontSize=function(){return this.getOption("fontSize")||d.computedStyle(this.container).fontSize},C.prototype.setFontSize=function(w){this.setOption("fontSize",w)},C.prototype.$highlightBrackets=function(){if(!this.$highlightPending){var w=this;this.$highlightPending=!0,setTimeout(function(){w.$highlightPending=!1;var x=w.session;if(!(!x||x.destroyed)){x.$bracketHighlight&&(x.$bracketHighlight.markerIds.forEach(function(U){x.removeMarker(U)}),x.$bracketHighlight=null);var I=w.getCursorPosition(),O=w.getKeyboardHandler(),R=O&&O.$getDirectionForHighlight&&O.$getDirectionForHighlight(w),P=x.getMatchingBracketRanges(I,R);if(!P){var B=new b(x,I.row,I.column),V=B.getCurrentToken();if(V&&/\b(?:tag-open|tag-name)/.test(V.type)){var W=x.getMatchingTags(I);W&&(P=[W.openTagName.isEmpty()?W.openTag:W.openTagName,W.closeTagName.isEmpty()?W.closeTag:W.closeTagName])}}if(!P&&x.$mode.getMatching&&(P=x.$mode.getMatching(w.session)),!P){w.getHighlightIndentGuides()&&w.renderer.$textLayer.$highlightIndentGuide();return}var H="ace_bracket";Array.isArray(P)?P.length==1&&(H="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)])),x.$bracketHighlight={ranges:P,markerIds:P.map(function(U){return x.addMarker(U,H,"text")})},w.getHighlightIndentGuides()&&w.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(w){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",w))},C.prototype.onBlur=function(w){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",w))},C.prototype.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$updateHighlightActiveLine()},C.prototype.onDocumentChange=function(w){var x=this.session.$useWrapMode,I=w.start.row==w.end.row?w.end.row:1/0;this.renderer.updateLines(w.start.row,I,x),this._signal("change",w),this.$cursorChange()},C.prototype.onTokenizerUpdate=function(w){var x=w.data;this.renderer.updateLines(x.first,x.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 w=this.getSession(),x;if(this.$highlightActiveLine&&((this.$selectionStyle!="line"||!this.selection.isMultiLine())&&(x=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(x=!1),this.renderer.$maxLines&&this.session.getLength()===1&&!(this.renderer.$minLines>1)&&(x=!1)),w.$highlightLineMarker&&!x)w.removeMarker(w.$highlightLineMarker.id),w.$highlightLineMarker=null;else if(!w.$highlightLineMarker&&x){var I=new f(x.row,x.column,x.row,1/0);I.id=w.addMarker(I,"ace_active-line","screenLine"),w.$highlightLineMarker=I}else x&&(w.$highlightLineMarker.start.row=x.row,w.$highlightLineMarker.end.row=x.row,w.$highlightLineMarker.start.column=x.column,w._signal("changeBackMarker"))},C.prototype.onSelectionChange=function(w){var x=this.session;if(x.$selectionMarker&&x.removeMarker(x.$selectionMarker),x.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var I=this.selection.getRange(),O=this.getSelectionStyle();x.$selectionMarker=x.addMarker(I,"ace_selection",O)}var R=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(R),this._signal("changeSelection")},C.prototype.$getSelectionHighLightRegexp=function(){var w=this.session,x=this.getSelectionRange();if(!(x.isEmpty()||x.isMultiLine())){var I=x.start.column,O=x.end.column,R=w.getLine(x.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}}},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(w){this.renderer.updateText(),this._emit("changeMode",w)},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 w=this.getSelectedText(),x=this.session.doc.getNewLineCharacter(),I=!1;if(!w&&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||(w+=this.session.getLine(P.start.row)+x)}}var B={text:w};return this._signal("copy",B),M.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(w,x){var I={text:w,event:x};this.commands.exec("paste",this,I)},C.prototype.$handlePaste=function(w){typeof w=="string"&&(w={text:w}),this._signal("paste",w);var x=w.text,I=x===M.lineMode,O=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)I?O.insert({row:this.selection.lead.row,column:0},x):this.insert(x);else if(I)this.selection.rangeList.ranges.forEach(function(H){O.insert({row:H.start.row,column:0},x)});else{var R=x.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,x);for(var V=P.length;V--;){var W=P[V];W.isEmpty()||O.remove(W),O.insert(W.start,R[V])}}},C.prototype.execCommand=function(w,x){return this.commands.exec(w,this,x)},C.prototype.insert=function(w,x){var I=this.session,O=I.getMode(),R=this.getCursorPosition();if(this.getBehavioursEnabled()&&!x){var P=O.transformAction(I.getState(R.row),"insertion",this,I,w);P&&(w!==P.text&&(this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1)),w=P.text)}if(w==" "&&(w=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&w.indexOf(`
|
|
225
|
+
`)==-1){var B=f.fromPoints(R,R);B.end.column+=w.length,this.session.remove(B)}}else{var B=this.getSelectionRange();R=this.session.remove(B),this.clearSelection()}if(w==`
|
|
226
226
|
`||w==`\r
|
|
227
|
-
`){var U=I.getLine(
|
|
228
|
-
`){var B=I.getLine(x.end.row);/^\s+$/.test(B)&&(x.end.column=B.length)}}
|
|
229
|
-
`),this.moveCursorToPosition(w)},C.prototype.setGhostText=function(w,x){this.renderer.setGhostText(w,x)},C.prototype.removeGhostText=function(){this.renderer.removeGhostText()},C.prototype.transposeLetters=function(){if(this.selection.isEmpty()){var w=this.getCursorPosition(),x=w.column;if(x!==0){var I=this.session.getLine(w.row),R,O;x<I.length?(R=I.charAt(x)+I.charAt(x-1),O=new f(w.row,x-1,w.row,x+1)):(R=I.charAt(x-1)+I.charAt(x-2),O=new f(w.row,x-2,w.row,x)),this.session.replace(O,R),this.session.selection.moveToPosition(O.end)}}},C.prototype.toLowerCase=function(){var w=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var x=this.getSelectionRange(),I=this.session.getTextRange(x);this.session.replace(x,I.toLowerCase()),this.selection.setSelectionRange(w)},C.prototype.toUpperCase=function(){var w=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var x=this.getSelectionRange(),I=this.session.getTextRange(x);this.session.replace(x,I.toUpperCase()),this.selection.setSelectionRange(w)},C.prototype.indent=function(){var w=this.session,x=this.getSelectionRange();if(x.start.row<x.end.row){var I=this.$getSelectedRows();w.indentRows(I.first,I.last," ");return}else if(x.start.column<x.end.column){var R=w.getTextRange(x);if(!/^\s+$/.test(R)){var I=this.$getSelectedRows();w.indentRows(I.first,I.last," ");return}}var O=w.getLine(x.start.row),P=x.start,B=w.getTabSize(),V=w.documentToScreenColumn(P.row,P.column);if(this.session.getUseSoftTabs())var W=B-V%B,H=s.stringRepeat(" ",W);else{for(var W=V%B;O[x.start.column-1]==" "&&W;)x.start.column--,W--;this.selection.setSelectionRange(x),H=" "}return this.insert(H)},C.prototype.blockIndent=function(){var w=this.$getSelectedRows();this.session.indentRows(w.first,w.last," ")},C.prototype.blockOutdent=function(){var w=this.session.getSelection();this.session.outdentRows(w.getRange())},C.prototype.sortLines=function(){for(var w=this.$getSelectedRows(),x=this.session,I=[],R=w.first;R<=w.last;R++)I.push(x.getLine(R));I.sort(function(B,V){return B.toLowerCase()<V.toLowerCase()?-1:B.toLowerCase()>V.toLowerCase()?1:0});for(var O=new f(0,0,0,0),R=w.first;R<=w.last;R++){var P=x.getLine(R);O.start.row=R,O.end.row=R,O.end.column=P.length,x.replace(O,I[R-w.first])}},C.prototype.toggleCommentLines=function(){var w=this.session.getState(this.getCursorPosition().row),x=this.$getSelectedRows();this.session.getMode().toggleCommentLines(w,this.session,x.first,x.last)},C.prototype.toggleBlockComment=function(){var w=this.getCursorPosition(),x=this.session.getState(w.row),I=this.getSelectionRange();this.session.getMode().toggleBlockComment(x,this.session,I,w)},C.prototype.getNumberAt=function(w,x){var I=/[\-]?[0-9]+(?:\.[0-9]+)?/g;I.lastIndex=0;for(var R=this.session.getLine(w);I.lastIndex<x;){var O=I.exec(R);if(O.index<=x&&O.index+O[0].length>=x){var P={value:O[0],start:O.index,end:O.index+O[0].length};return P}}return null},C.prototype.modifyNumber=function(w){var x=this.selection.getCursor().row,I=this.selection.getCursor().column,R=new f(x,I-1,x,I),O=this.session.getTextRange(R);if(!isNaN(parseFloat(O))&&isFinite(O)){var P=this.getNumberAt(x,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?w*=Math.pow(10,P.end-I-1):w*=Math.pow(10,P.end-I),W+=w,W/=Math.pow(10,V);var H=W.toFixed(V),U=new f(x,P.start,x,P.end);this.session.replace(U,H),this.moveCursorTo(x,Math.max(P.start+1,I+H.length-P.value.length))}}else this.toggleWord()},C.prototype.toggleWord=function(){var w=this.selection.getCursor().row,x=this.selection.getCursor().column;this.selection.selectWord();var I=this.getSelectedText(),R=this.selection.getWordRange().start.column,O=I.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),P=x-R-1;P<0&&(P=0);var B=0,V=0,W=this;I.match(/[A-Za-z0-9_]+/)&&O.forEach(function(ge,be){V=B+ge.length,P>=B&&P<=V&&(I=ge,W.selection.clearSelection(),W.moveCursorTo(w,B+R),W.selection.selectTo(w,V+R)),B=V});for(var H=this.$toggleWordPairs,U,G=0;G<H.length;G++)for(var Y=H[G],Q=0;Q<=1;Q++){var ee=+!Q,ne=I.match(new RegExp("^\\s?_?("+s.escapeRegExp(Y[Q])+")\\s?$","i"));if(ne){var se=I.match(new RegExp("([_]|^|\\s)("+s.escapeRegExp(ne[1])+")($|\\s)","g"));se&&(U=I.replace(new RegExp(s.escapeRegExp(Y[Q]),"i"),function(ge){var be=Y[ee];return ge.toUpperCase()==ge?be=be.toUpperCase():ge.charAt(0).toUpperCase()==ge.charAt(0)&&(be=be.substr(0,0)+Y[ee].charAt(0).toUpperCase()+be.substr(1)),be}),this.insert(U),U="")}}},C.prototype.findLinkAt=function(w,x){var I,R,O=this.session.getLine(w),P=O.split(/((?:https?|ftp):\/\/[\S]+)/),B=x;B<0&&(B=0);var V=0,W=0,H;try{for(var U=o(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]+)/)){H=Y.replace(/[\s:.,'";}\]]+$/,"");break}V=W}}catch(Q){I={error:Q}}finally{try{G&&!G.done&&(R=U.return)&&R.call(U)}finally{if(I)throw I.error}}return H},C.prototype.openLink=function(){var w=this.selection.getCursor(),x=this.findLinkAt(w.row,w.column);return x&&window.open(x,"_blank"),x!=null},C.prototype.removeLines=function(){var w=this.$getSelectedRows();this.session.removeFullLines(w.first,w.last),this.clearSelection()},C.prototype.duplicateSelection=function(){var w=this.selection,x=this.session,I=w.getRange(),R=w.isBackwards();if(I.isEmpty()){var O=I.start.row;x.duplicateLines(O,O)}else{var P=R?I.start:I.end,B=x.insert(P,x.getTextRange(I));I.start=P,I.end=B,w.setSelectionRange(I,R)}},C.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},C.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},C.prototype.moveText=function(w,x,I){return this.session.moveText(w,x,I)},C.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},C.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},C.prototype.$moveLines=function(w,x){var I,R,O=this.selection;if(!O.inMultiSelectMode||this.inVirtualSelectionMode){var P=O.toOrientedRange();I=this.$getSelectedRows(P),R=this.session.$moveLines(I.first,I.last,x?0:w),x&&w==-1&&(R=0),P.moveBy(R,0),O.fromOrientedRange(P)}else{var B=O.rangeList.ranges;O.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var V=0,W=0,H=B.length,U=0;U<H;U++){var G=U;B[U].moveBy(V,0),I=this.$getSelectedRows(B[U]);for(var Y=I.first,Q=I.last;++U<H;){W&&B[U].moveBy(W,0);var ee=this.$getSelectedRows(B[U]);if(x&&ee.first!=Q)break;if(!x&&ee.first>Q+1)break;Q=ee.last}for(U--,V=this.session.$moveLines(Y,Q,x?0:w),x&&w==-1&&(G=U+1);G<=U;)B[G].moveBy(V,0),G++;x||(V=0),W+=V}O.fromOrientedRange(O.ranges[0]),O.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},C.prototype.$getSelectedRows=function(w){return w=(w||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(w.start.row),last:this.session.getRowFoldEnd(w.end.row)}},C.prototype.onCompositionStart=function(w){this.renderer.showComposition(w)},C.prototype.onCompositionUpdate=function(w){this.renderer.setCompositionText(w)},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(w){return w>=this.getFirstVisibleRow()&&w<=this.getLastVisibleRow()},C.prototype.isRowFullyVisible=function(w){return w>=this.renderer.getFirstFullyVisibleRow()&&w<=this.renderer.getLastFullyVisibleRow()},C.prototype.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},C.prototype.$moveByPage=function(w,x){var I=this.renderer,R=this.renderer.layerConfig,O=w*Math.floor(R.height/R.lineHeight);x===!0?this.selection.$moveSelection(function(){this.moveCursorBy(O,0)}):x===!1&&(this.selection.moveCursorBy(O,0),this.selection.clearSelection());var P=I.scrollTop;I.scrollBy(0,O*R.lineHeight),x!=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(w){this.renderer.scrollToRow(w)},C.prototype.scrollToLine=function(w,x,I,R){this.renderer.scrollToLine(w,x,I,R)},C.prototype.centerSelection=function(){var w=this.getSelectionRange(),x={row:Math.floor(w.start.row+(w.end.row-w.start.row)/2),column:Math.floor(w.start.column+(w.end.column-w.start.column)/2)};this.renderer.alignCursor(x,.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(w,x){this.selection.moveCursorTo(w,x)},C.prototype.moveCursorToPosition=function(w){this.selection.moveCursorToPosition(w)},C.prototype.jumpToMatching=function(w,x){var I=this.getCursorPosition(),R=new b(this.session,I.row,I.column),O=R.getCurrentToken(),P=0;O&&O.type.indexOf("tag-name")!==-1&&(O=R.stepBackward());var B=O||R.stepForward();if(B){var V,W=!1,H={},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(H[G])&&(H[G]=0),B.value[U]){case"(":case"[":case"{":H[G]++;break;case")":case"]":case"}":H[G]--,H[G]===-1&&(V="bracket",W=!0);break}}else B.type.indexOf("tag-name")!==-1&&(isNaN(H[B.value])&&(H[B.value]=0),O.value==="<"&&P>1?H[B.value]++:O.value==="</"&&H[B.value]--,H[B.value]===-1&&(V="tag",W=!0));W||(O=B,P++,B=R.stepForward(),U=0)}while(B&&!W);if(V){var Q,ee;if(V==="bracket")Q=this.session.getBracketRange(I),Q||(Q=new f(R.getCurrentTokenRow(),R.getCurrentTokenColumn()+U-1,R.getCurrentTokenRow(),R.getCurrentTokenColumn()+U-1),ee=Q.start,(x||ee.row===I.row&&Math.abs(ee.column-I.column)<2)&&(Q=this.session.getBracketRange(ee)));else if(V==="tag"){if(!B||B.type.indexOf("tag-name")===-1)return;if(Q=new f(R.getCurrentTokenRow(),R.getCurrentTokenColumn()-2,R.getCurrentTokenRow(),R.getCurrentTokenColumn()-2),Q.compare(I.row,I.column)===0){var ne=this.session.getMatchingTags(I);ne&&(ne.openTag.contains(I.row,I.column)?(Q=ne.closeTag,ee=Q.start):(Q=ne.openTag,ne.closeTag.start.row===I.row&&ne.closeTag.start.column===I.column?ee=Q.end:ee=Q.start))}ee=ee||Q.start}ee=Q&&Q.cursor||ee,ee&&(w?Q&&x?this.selection.setRange(Q):Q&&Q.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(ee.row,ee.column):this.selection.moveTo(ee.row,ee.column))}}},C.prototype.gotoLine=function(w,x,I){this.selection.clearSelection(),this.session.unfold({row:w-1,column:x||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(w-1,x||0),this.isRowFullyVisible(w-1)||this.scrollToLine(w-1,!0,I)},C.prototype.navigateTo=function(w,x){this.selection.moveTo(w,x)},C.prototype.navigateUp=function(w){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var x=this.selection.anchor.getPosition();return this.moveCursorToPosition(x)}this.selection.clearSelection(),this.selection.moveCursorBy(-w||-1,0)},C.prototype.navigateDown=function(w){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var x=this.selection.anchor.getPosition();return this.moveCursorToPosition(x)}this.selection.clearSelection(),this.selection.moveCursorBy(w||1,0)},C.prototype.navigateLeft=function(w){if(this.selection.isEmpty())for(w=w||1;w--;)this.selection.moveCursorLeft();else{var x=this.getSelectionRange().start;this.moveCursorToPosition(x)}this.clearSelection()},C.prototype.navigateRight=function(w){if(this.selection.isEmpty())for(w=w||1;w--;)this.selection.moveCursorRight();else{var x=this.getSelectionRange().end;this.moveCursorToPosition(x)}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(w,x){x&&this.$search.set(x);var I=this.$search.find(this.session),R=0;return I&&(this.$tryReplace(I,w)&&(R=1),this.selection.setSelectionRange(I),this.renderer.scrollSelectionIntoView(I.start,I.end)),R},C.prototype.replaceAll=function(w,x){x&&this.$search.set(x);var I=this.$search.findAll(this.session),R=0;if(!I.length)return R;var O=this.getSelectionRange();this.selection.moveTo(0,0);for(var P=I.length-1;P>=0;--P)this.$tryReplace(I[P],w)&&R++;return this.selection.setSelectionRange(O),R},C.prototype.$tryReplace=function(w,x){var I=this.session.getTextRange(w);return x=this.$search.replace(I,x),x!==null?(w.end=this.session.replace(w,x),w):null},C.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},C.prototype.find=function(w,x,I){x||(x={}),typeof w=="string"||w instanceof RegExp?x.needle=w:typeof w=="object"&&h.mixin(x,w);var R=this.selection.getRange();x.needle==null&&(w=this.session.getTextRange(R)||this.$search.$options.needle,w||(R=this.session.getWordRange(R.start.row,R.start.column),w=this.session.getTextRange(R)),this.$search.set({needle:w})),this.$search.set(x),x.start||this.$search.set({start:R});var O=this.$search.find(this.session);if(x.preventScroll)return O;if(O)return this.revealRange(O,I),O;x.backwards?R.start=R.end:R.end=R.start,this.selection.setRange(R)},C.prototype.findNext=function(w,x){this.find({skipCurrent:!0,backwards:!1},w,x)},C.prototype.findPrevious=function(w,x){this.find(w,{skipCurrent:!0,backwards:!0},x)},C.prototype.revealRange=function(w,x){this.session.unfold(w),this.selection.setSelectionRange(w);var I=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(w.start,w.end,.5),x!==!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.$toDestroy&&(this.$toDestroy.forEach(function(w){w.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()},C.prototype.setAutoScrollEditorIntoView=function(w){if(w){var x,I=this,R=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var O=this.$scrollAnchor;O.style.cssText="position:absolute",this.container.insertBefore(O,this.container.firstChild);var P=this.on("changeSelection",function(){R=!0}),B=this.renderer.on("beforeRender",function(){R&&(x=I.renderer.container.getBoundingClientRect())}),V=this.renderer.on("afterRender",function(){if(R&&x&&(I.isFocused()||I.searchBox&&I.searchBox.isFocused())){var W=I.renderer,H=W.$cursorLayer.$pixelPos,U=W.layerConfig,G=H.top-U.offset;H.top>=0&&G+x.top<0?R=!0:H.top<U.height&&H.top+x.top+U.lineHeight>window.innerHeight?R=!1:R=null,R!=null&&(O.style.top=G+"px",O.style.left=H.left+"px",O.style.height=U.lineHeight+"px",O.scrollIntoView(R)),R=x=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 w=this.$cursorStyle||"ace",x=this.renderer.$cursorLayer;x&&(x.setSmoothBlinking(/smooth/.test(w)),x.isBlinking=!this.$readOnly&&w!="wide",d.setCssClass(x.element,"ace_slim-cursors",/slim/.test(w)))},C.prototype.prompt=function(w,x,I){var R=this;E.loadModule("ace/ext/prompt",function(O){O.prompt(R,w,x,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"],["&&","||"],["==","!="]],h.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 w=this;this.textInput.setReadOnly(C),this.$resetCursorStyle(),this.$readOnlyCallback||(this.$readOnlyCallback=function(I){var R=!1;if(I&&I.type=="keydown"){if(R=I&&I.key&&I.key.length==1&&!I.ctrlKey&&!I.metaKey,!R)return}else I&&I.type!=="exec"&&(R=!0);if(R){w.hoverTooltip||(w.hoverTooltip=new F);var O=d.createElement("div");O.textContent=S("editor.tooltip.disable-editing","Editing is disabled"),w.hoverTooltip.isOpen||w.hoverTooltip.showForRange(w,w.getSelectionRange(),O)}else w.hoverTooltip&&w.hoverTooltip.isOpen&&w.hoverTooltip.hide()});var x=this.textInput.getElement();C?(T.addListener(x,"keydown",this.$readOnlyCallback,this),this.commands.on("exec",this.$readOnlyCallback),this.commands.on("commandUnavailable",this.$readOnlyCallback)):(T.removeListener(x,"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 w=this.session&&(this.renderer.$composition||this.session.getLength()>1||this.session.getLine(0).length>0);if(w&&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(!w&&!this.renderer.placeholderNode){this.renderer.on("afterRender",this.$updatePlaceholder),d.addCssClass(this.container,"ace_hasPlaceholder");var x=d.createElement("div");x.className="ace_placeholder",x.textContent=this.$placeholder||"",this.renderer.placeholderNode=x,this.renderer.content.appendChild(this.renderer.placeholderNode)}else!w&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"")}.bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},enableKeyboardAccessibility:{set:function(C){var w={name:"blurTextInput",description:"Set focus to the editor content div to allow tabbing through the page",bindKey:"Esc",exec:function(R){R.blur(),R.renderer.scroller.focus()},readOnly:!0},x=function(R){if(R.target==this.renderer.scroller&&R.keyCode===_.enter){R.preventDefault();var O=this.getCursorPosition().row;this.isRowVisible(O)||this.scrollToLine(O,!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",x.bind(this)),this.commands.addCommand(w),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",x.bind(this)),this.commands.removeCommand(w),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,w){return(Math.abs(C.selection.lead.row-w)||w+1+(w<9?"·":""))+""},getWidth:function(C,w,x){return Math.max(w.toString().length,(x.lastRow+1).toString().length,2)*x.characterWidth},update:function(C,w){w.renderer.$loop.schedule(w.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)}};u.Editor=A}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(i,u,v){var o=i("../lib/dom"),h=function(){function d(s,p){this.element=s,this.canvasHeight=p||5e5,this.element.style.height=this.canvasHeight*2+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0}return d.prototype.moveContainer=function(s){o.translate(this.element,0,-(s.firstRowScreen*s.lineHeight%this.canvasHeight)-s.offset*this.$offsetCoefficient)},d.prototype.pageChanged=function(s,p){return Math.floor(s.firstRowScreen*s.lineHeight/this.canvasHeight)!==Math.floor(p.firstRowScreen*p.lineHeight/this.canvasHeight)},d.prototype.computeLineTop=function(s,p,e){var t=p.firstRowScreen*p.lineHeight,r=Math.floor(t/this.canvasHeight),l=e.documentToScreenRow(s,0)*p.lineHeight;return l-r*this.canvasHeight},d.prototype.computeLineHeight=function(s,p,e){return p.lineHeight*e.getRowLineCount(s)},d.prototype.getLength=function(){return this.cells.length},d.prototype.get=function(s){return this.cells[s]},d.prototype.shift=function(){this.$cacheCell(this.cells.shift())},d.prototype.pop=function(){this.$cacheCell(this.cells.pop())},d.prototype.push=function(s){if(Array.isArray(s)){this.cells.push.apply(this.cells,s);for(var p=o.createFragment(this.element),e=0;e<s.length;e++)p.appendChild(s[e].element);this.element.appendChild(p)}else this.cells.push(s),this.element.appendChild(s.element)},d.prototype.unshift=function(s){if(Array.isArray(s)){this.cells.unshift.apply(this.cells,s);for(var p=o.createFragment(this.element),e=0;e<s.length;e++)p.appendChild(s[e].element);this.element.firstChild?this.element.insertBefore(p,this.element.firstChild):this.element.appendChild(p)}else this.cells.unshift(s),this.element.insertAdjacentElement("afterbegin",s.element)},d.prototype.last=function(){return this.cells.length?this.cells[this.cells.length-1]:null},d.prototype.$cacheCell=function(s){s&&(s.element.remove(),this.cellCache.push(s))},d.prototype.createCell=function(s,p,e,t){var r=this.cellCache.pop();if(!r){var l=o.createElement("div");t&&t(l),this.element.appendChild(l),r={element:l,text:"",row:s}}return r.row=s,r},d}();u.Lines=h}),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,u,v){var o=i("../lib/dom"),h=i("../lib/oop"),d=i("../lib/lang"),s=i("../lib/event_emitter").EventEmitter,p=i("./lines").Lines,e=i("../config").nls,t=function(){function l(a){this.element=o.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 l.prototype.setSession=function(a){this.session&&this.session.off("change",this.$updateAnnotations),this.session=a,a&&a.on("change",this.$updateAnnotations)},l.prototype.addGutterDecoration=function(a,c){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(a,c)},l.prototype.removeGutterDecoration=function(a,c){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(a,c)},l.prototype.setAnnotations=function(a){this.$annotations=[];for(var c=0;c<a.length;c++){var f=a[c],m=f.row,y=this.$annotations[m];y||(y=this.$annotations[m]={text:[],type:[],displayText:[]});var D=f.text,E=f.text,b=f.type;D=D?d.escapeHTML(D):f.html||"",E=E||f.html||"",y.text.indexOf(D)===-1&&(y.text.push(D),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")}},l.prototype.$updateAnnotations=function(a){if(this.$annotations.length){var c=a.start.row,f=a.end.row-c;if(f!==0)if(a.action=="remove")this.$annotations.splice(c,f+1,null);else{var m=new Array(f+1);m.unshift(c,1),this.$annotations.splice.apply(this.$annotations,m)}}},l.prototype.update=function(a){this.config=a;var c=this.session,f=a.firstRow,m=Math.min(a.lastRow+a.gutterOffset,c.getLength()-1);this.oldLastRow=m,this.config=a,this.$lines.moveContainer(a),this.$updateCursorRow();for(var y=c.getNextFoldLine(f),D=y?y.start.row:1/0,E=null,b=-1,g=f;;){if(g>D&&(g=y.end.row+1,y=c.getNextFoldLine(g,y),D=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)},l.prototype.$updateGutterWidth=function(a){var c=this.session,f=c.gutterRenderer||this.$renderer,m=c.$firstLineNumber,y=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||c.$useWrapMode)&&(y=c.getLength()+m-1);var D=f?f.getWidth(c,y,a):y.toString().length*a.characterWidth,E=this.$padding||this.$computePadding();D+=E.left+E.right,D!==this.gutterWidth&&!isNaN(D)&&(this.gutterWidth=D,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",D))},l.prototype.$updateCursorRow=function(){if(this.$highlightGutterLine){var a=this.session.selection.getCursor();this.$cursorRow!==a.row&&(this.$cursorRow=a.row)}},l.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 c=this.$lines.cells;this.$cursorCell=null;for(var f=0;f<c.length;f++){var m=c[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==c[f-1].row)m=c[f-1];else break}m.element.className="ace_gutter-active-line "+m.element.className,this.$cursorCell=m;break}}}}},l.prototype.scrollLines=function(a){var c=this.config;if(this.config=a,this.$updateCursorRow(),this.$lines.pageChanged(c,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,!c||m<a.firstRow)return this.update(a);if(f<c.firstRow)return this.update(a);if(c.firstRow<a.firstRow)for(var y=this.session.getFoldedRowCount(c.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<c.firstRow&&this.$lines.unshift(this.$renderLines(a,a.firstRow,c.firstRow-1)),f>m&&this.$lines.push(this.$renderLines(a,m+1,f)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(a)},l.prototype.$renderLines=function(a,c,f){for(var m=[],y=c,D=this.session.getNextFoldLine(y),E=D?D.start.row:1/0;y>E&&(y=D.end.row+1,D=this.session.getNextFoldLine(y,D),E=D?D.start.row:1/0),!(y>f);){var b=this.$lines.createCell(y,a,this.session,r);this.$renderCell(b,a,D,y),m.push(b),y++}return m},l.prototype.$renderCell=function(a,c,f,m){var y=a.element,D=this.session,E=y.childNodes[0],b=y.childNodes[1],g=y.childNodes[2],S=y.childNodes[3],M=g.firstChild,_=D.$firstLineNumber,T=D.$breakpoints,F=D.$decorations,A=D.gutterRenderer||this.$renderer,$=this.$showFoldWidgets&&D.foldWidgets,C=f?f.start.row:Number.MAX_VALUE,w=c.lineHeight+"px",x=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",I=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",R=(A?A.getText(D,m):m+_).toString();if(this.$highlightGutterLine&&(m==this.$cursorRow||f&&m<this.$cursorRow&&m>=C&&this.$cursorRow<=f.end.row)&&(x+="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)),T[m]&&(x+=T[m]),F[m]&&(x+=F[m]),this.$annotations[m]&&m!==C&&(x+=this.$annotations[m].className),$){var O=$[m];O==null&&(O=$[m]=D.getFoldWidget(m))}if(O){var P="ace_fold-widget ace_"+O,B=O=="start"&&m==C&&m<f.end.row;if(B){P+=" ace_closed";for(var V="",W=!1,H=m+1;H<=f.end.row;H++)if(this.$annotations[H]){if(this.$annotations[H].className===" ace_error"){W=!0,V=" ace_error_fold";break}this.$annotations[H].className===" ace_security"?(W=!0,V=" ace_security_fold"):this.$annotations[H].className===" ace_warning"&&V!==" ace_security_fold"&&(W=!0,V=" ace_warning_fold")}x+=V}else P+=" ace_open";b.className!=P&&(b.className=P),o.setStyle(b.style,"height",w),o.setStyle(b.style,"display","inline-block"),b.setAttribute("role","button"),b.setAttribute("tabindex","-1");var U=D.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&&(o.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",M.className=I,M.className+=V,o.setStyle(M.style,"height",w),o.setStyle(g.style,"display","block"),o.setStyle(g.style,"height",w);var Y;switch(V){case" ace_error_fold":Y=e("gutter.annotation.aria-label.error","Error, read annotations row $0",[R]);break;case" ace_security_fold":Y=e("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[R]);break;case" ace_warning_fold":Y=e("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[R]);break}g.setAttribute("aria-label",Y),g.setAttribute("tabindex","-1"),g.setAttribute("role","button")}else if(this.$annotations[m]){g.className="ace_gutter_annotation",M.className=I,this.$useSvgGutterIcons?M.className+=this.$annotations[m].className:y.classList.add(this.$annotations[m].className.replace(" ","")),o.setStyle(M.style,"height",w),o.setStyle(g.style,"display","block"),o.setStyle(g.style,"height",w);var Y;switch(this.$annotations[m].className){case" ace_error":Y=e("gutter.annotation.aria-label.error","Error, read annotations row $0",[R]);break;case" ace_security":Y=e("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[R]);break;case" ace_warning":Y=e("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[R]);break;case" ace_info":Y=e("gutter.annotation.aria-label.info","Info, read annotations row $0",[R]);break;case" ace_hint":Y=e("gutter.annotation.aria-label.hint","Suggestion, read annotations row $0",[R]);break}g.setAttribute("aria-label",Y),g.setAttribute("tabindex","-1"),g.setAttribute("role","button")}else o.setStyle(g.style,"display","none"),g.removeAttribute("aria-label"),g.removeAttribute("role"),g.setAttribute("tabindex","0");return R!==E.data&&(E.data=R),y.className!=x&&(y.className=x),o.setStyle(a.element.style,"height",this.$lines.computeLineHeight(m,c,D)+"px"),o.setStyle(a.element.style,"top",this.$lines.computeLineTop(m,c,D)+"px"),a.text=R,g.style.display==="none"&&b.style.display==="none"&&!G?a.element.setAttribute("aria-hidden",!0):a.element.setAttribute("aria-hidden",!1),a},l.prototype.setHighlightGutterLine=function(a){this.$highlightGutterLine=a},l.prototype.setShowLineNumbers=function(a){this.$renderer=!a&&{getWidth:function(){return 0},getText:function(){return""}}},l.prototype.getShowLineNumbers=function(){return this.$showLineNumbers},l.prototype.setShowFoldWidgets=function(a){a?o.addCssClass(this.element,"ace_folding-enabled"):o.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=a,this.$padding=null},l.prototype.getShowFoldWidgets=function(){return this.$showFoldWidgets},l.prototype.$hideFoldWidget=function(a,c){var f=c||this.$getGutterCell(a);if(f&&f.element){var m=f.element.childNodes[1];m&&o.setStyle(m.style,"display","none")}},l.prototype.$showFoldWidget=function(a,c){var f=c||this.$getGutterCell(a);if(f&&f.element){var m=f.element.childNodes[1];m&&this.session.foldWidgets&&this.session.foldWidgets[f.row]&&o.setStyle(m.style,"display","inline-block")}},l.prototype.$getGutterCell=function(a){var c=this.$lines.cells,f=this.session.documentToScreenRow(a,0);return c[a-this.config.firstRowScreen-(a-f)]},l.prototype.$addCustomWidget=function(a,c,f){var m=c.className,y=c.label,D=c.title,E=c.callbacks;this.session.$gutterCustomWidgets[a]={className:m,label:y,title:D,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=o.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",D),o.setStyle(g.style,"display","inline-block"),o.setStyle(g.style,"height","inherit"),E&&E.onClick&&g.addEventListener("click",function(S){E.onClick(S,a),S.stopPropagation()}),b.element.appendChild(g)}},l.prototype.$removeCustomWidget=function(a,c){delete this.session.$gutterCustomWidgets[a],this.$showFoldWidget(a,c);var f=c||this.$getGutterCell(a);if(f&&f.element){var m=f.element.querySelector(".ace_custom-widget");m&&f.element.removeChild(m)}},l.prototype.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var a=o.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},l.prototype.getRegion=function(a){var c=this.$padding||this.$computePadding(),f=this.element.getBoundingClientRect();if(a.x<c.left+f.left)return"markers";if(this.$showFoldWidgets&&a.x>f.right-c.right)return"foldWidgets"},l}();t.prototype.$fixedWidth=!1,t.prototype.$highlightGutterLine=!0,t.prototype.$renderer="",t.prototype.$showLineNumbers=!0,t.prototype.$showFoldWidgets=!0,h.implement(t.prototype,s);function r(l){var a=document.createTextNode("");l.appendChild(a);var c=o.createElement("span");l.appendChild(c);var f=o.createElement("span");l.appendChild(f);var m=o.createElement("span");return f.appendChild(m),l}u.Gutter=t}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(i,u,v){var o=i("../range").Range,h=i("../lib/dom"),d=function(){function p(e){this.element=h.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 l=this.markers[r];if(!l.range){l.update(t,this,this.session,e);continue}var a=l.range.clipRows(e.firstRow,e.lastRow);if(!a.isEmpty())if(a=a.toScreenRange(this.session),l.renderer){var c=this.$getTop(a.start.row,e),f=this.$padding+a.start.column*e.characterWidth;l.renderer(t,a,f,c,e)}else l.type=="fullLine"?this.drawFullLineMarker(t,a,l.clazz,e):l.type=="screenLine"?this.drawScreenLineMarker(t,a,l.clazz,e):a.isMultiLine()?l.type=="text"?this.drawTextMarker(t,a,l.clazz,e):this.drawMultiLineMarker(t,a,l.clazz,e):this.drawSingleLineMarker(t,a,l.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,l,a){for(var c=this.session,f=t.start.row,m=t.end.row,y=f,D=0,E=0,b=c.getScreenLastRowColumn(y),g=new o(y,t.start.column,y,E);y<=m;y++)g.start.row=g.end.row=y,g.start.column=y==f?t.start.column:c.getRowWrapIndent(y),g.end.column=b,D=E,E=b,b=y+1<m?c.getScreenLastRowColumn(y+1):y==m?0:t.end.column,this.drawSingleLineMarker(e,g,r+(y==f?" ace_start":"")+" ace_br"+s(y==f||y==f+1&&t.start.column,D<E,E>b,y==m),l,y==m?0:1,a)},p.prototype.drawMultiLineMarker=function(e,t,r,l,a){var c=this.$padding,f=l.lineHeight,m=this.$getTop(t.start.row,l),y=c+t.start.column*l.characterWidth;if(a=a||"",this.session.$bidiHandler.isBidiRow(t.start.row)){var D=t.clone();D.end.row=D.start.row,D.end.column=this.session.getLine(D.start.row).length,this.drawBidiSingleLineMarker(e,D,r+" ace_br1 ace_start",l,null,a)}else this.elt(r+" ace_br1 ace_start","height:"+f+"px;right:"+c+"px;top:"+m+"px;left:"+y+"px;"+(a||""));if(this.session.$bidiHandler.isBidiRow(t.end.row)){var D=t.clone();D.start.row=D.end.row,D.start.column=0,this.drawBidiSingleLineMarker(e,D,r+" ace_br12",l,null,a)}else{m=this.$getTop(t.end.row,l);var E=t.end.column*l.characterWidth;this.elt(r+" ace_br12","height:"+f+"px;width:"+E+"px;top:"+m+"px;left:"+c+"px;"+(a||""))}if(f=(t.end.row-t.start.row-1)*l.lineHeight,!(f<=0)){m=this.$getTop(t.start.row+1,l);var b=(t.start.column?1:0)|(t.end.column?0:8);this.elt(r+(b?" ace_br"+b:""),"height:"+f+"px;right:"+c+"px;top:"+m+"px;left:"+c+"px;"+(a||""))}},p.prototype.drawSingleLineMarker=function(e,t,r,l,a,c){if(this.session.$bidiHandler.isBidiRow(t.start.row))return this.drawBidiSingleLineMarker(e,t,r,l,a,c);var f=l.lineHeight,m=(t.end.column+(a||0)-t.start.column)*l.characterWidth,y=this.$getTop(t.start.row,l),D=this.$padding+t.start.column*l.characterWidth;this.elt(r,"height:"+f+"px;width:"+m+"px;top:"+y+"px;left:"+D+"px;"+(c||""))},p.prototype.drawBidiSingleLineMarker=function(e,t,r,l,a,c){var f=l.lineHeight,m=this.$getTop(t.start.row,l),y=this.$padding,D=this.session.$bidiHandler.getSelections(t.start.column,t.end.column);D.forEach(function(E){this.elt(r,"height:"+f+"px;width:"+(E.width+(a||0))+"px;top:"+m+"px;left:"+(y+E.left)+"px;"+(c||""))},this)},p.prototype.drawFullLineMarker=function(e,t,r,l,a){var c=this.$getTop(t.start.row,l),f=l.lineHeight;t.start.row!=t.end.row&&(f+=this.$getTop(t.end.row,l)-c),this.elt(r,"height:"+f+"px;top:"+c+"px;left:0;right:0;"+(a||""))},p.prototype.drawScreenLineMarker=function(e,t,r,l,a){var c=this.$getTop(t.start.row,l),f=l.lineHeight;this.elt(r,"height:"+f+"px;top:"+c+"px;left:0;right:0;"+(a||""))},p}();d.prototype.$padding=0;function s(p,e,t,r){return(p?1:0)|(e?2:0)|(t?4:0)|(r?8:0)}u.Marker=d}),ace.define("ace/layer/text_util",["require","exports","module"],function(i,u,v){var o=new Set(["text","rparen","lparen"]);u.isTextToken=function(h){return o.has(h)}}),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,u,v){var o=i("../lib/oop"),h=i("../lib/dom"),d=i("../lib/lang"),s=i("./lines").Lines,p=i("../lib/event_emitter").EventEmitter,e=i("../config").nls,t=i("./text_util").isTextToken,r=function(){function l(a){this.dom=h,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 s(this.element)}return l.prototype.$updateEolChar=function(){var a=this.session.doc,c=a.getNewLineCharacter()==`
|
|
230
|
-
`&&a.getNewLineMode()!="windows",f=c?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=f)return this.EOL_CHAR=f,!0},l.prototype.setPadding=function(a){this.$padding=a,this.element.style.margin="0 "+a+"px"},l.prototype.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},l.prototype.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},l.prototype.$setFontMetrics=function(a){this.$fontMetrics=a,this.$fontMetrics.on("changeCharacterSize",function(c){this._signal("changeCharacterSize",c)}.bind(this)),this.$pollSizeChanges()},l.prototype.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},l.prototype.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},l.prototype.setSession=function(a){this.session=a,a&&this.$computeTabString()},l.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)},l.prototype.setDisplayIndentGuides=function(a){return this.displayIndentGuides==a?!1:(this.displayIndentGuides=a,this.$computeTabString(),!0)},l.prototype.setHighlightIndentGuides=function(a){return this.$highlightIndentGuides===a?!1:(this.$highlightIndentGuides=a,a)},l.prototype.$computeTabString=function(){var a=this.session.getTabSize();this.tabSize=a;for(var c=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),c.push(m)}else c.push(this.dom.createTextNode(d.stringRepeat(" ",f),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var y="ace_indent-guide",D=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+D,m.textContent=E,this.$tabStrings[" "]=m;var m=this.dom.createElement("span");m.className=y+b,m.textContent=g,this.$tabStrings[" "]=m}},l.prototype.updateLines=function(a,c,f){if(this.config.lastRow!=a.lastRow||this.config.firstRow!=a.firstRow)return this.update(a);this.config=a;for(var m=Math.max(c,a.firstRow),y=Math.min(f,a.lastRow),D=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),M=S?S.start.row:1/0;g>M&&(g=S.end.row+1,S=this.session.getNextFoldLine(g,S),M=S?S.start.row:1/0),!(g>y);){var _=D[E++];if(_){this.dom.removeChildren(_),this.$renderLine(_,g,g==M?S:!1),b&&(_.style.top=this.$lines.computeLineTop(g,a,this.session)+"px");var T=a.lineHeight*this.session.getRowLength(g)+"px";_.style.height!=T&&(b=!0,_.style.height=T)}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"}},l.prototype.scrollLines=function(a){var c=this.config;if(this.config=a,this.$lines.pageChanged(c,a))return this.update(a);this.$lines.moveContainer(a);var f=a.lastRow,m=c?c.lastRow:-1;if(!c||m<a.firstRow)return this.update(a);if(f<c.firstRow)return this.update(a);if(!c||c.lastRow<a.firstRow)return this.update(a);if(a.lastRow<c.firstRow)return this.update(a);if(c.firstRow<a.firstRow)for(var y=this.session.getFoldedRowCount(c.firstRow,a.firstRow-1);y>0;y--)this.$lines.shift();if(c.lastRow>a.lastRow)for(var y=this.session.getFoldedRowCount(a.lastRow+1,c.lastRow);y>0;y--)this.$lines.pop();a.firstRow<c.firstRow&&this.$lines.unshift(this.$renderLinesFragment(a,a.firstRow,c.firstRow-1)),a.lastRow>c.lastRow&&this.$lines.push(this.$renderLinesFragment(a,c.lastRow+1,a.lastRow)),this.$highlightIndentGuide()},l.prototype.$renderLinesFragment=function(a,c,f){for(var m=[],y=c,D=this.session.getNextFoldLine(y),E=D?D.start.row:1/0;y>E&&(y=D.end.row+1,D=this.session.getNextFoldLine(y,D),E=D?D.start.row:1/0),!(y>f);){var b=this.$lines.createCell(y,a,this.session),g=b.element;this.dom.removeChildren(g),h.setStyle(g.style,"height",this.$lines.computeLineHeight(y,a,this.session)+"px"),h.setStyle(g.style,"top",this.$lines.computeLineTop(y,a,this.session)+"px"),this.$renderLine(g,y,y==E?D:!1),this.$useLineGroups()?g.className="ace_line_group":g.className="ace_line",m.push(b),y++}return m},l.prototype.update=function(a){this.$lines.moveContainer(a),this.config=a;for(var c=a.firstRow,f=a.lastRow,m=this.$lines;m.getLength();)m.pop();m.push(this.$renderLinesFragment(a,c,f))},l.prototype.$renderToken=function(a,c,f,m){for(var y=this,D=/(\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=D.exec(m);){var S=b[1],M=b[2],_=b[3],T=b[4],F=b[5];if(!(!y.showSpaces&&M)){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(c+b.index);E.appendChild(y.$tabStrings[$].cloneNode(!0)),c+=$-1}else if(M)if(y.showSpaces){var C=this.dom.createElement("span");C.className="ace_invisible ace_invisible_space",C.textContent=d.stringRepeat(y.SPACE_CHAR,M.length),E.appendChild(C)}else E.appendChild(this.dom.createTextNode(M,this.element));else if(_){var C=this.dom.createElement("span");C.className="ace_invisible ace_invisible_space ace_invalid",C.textContent=d.stringRepeat(y.SPACE_CHAR,_.length),E.appendChild(C)}else if(T){c+=1;var C=this.dom.createElement("span");C.style.width=y.config.characterWidth*2+"px",C.className=y.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",C.textContent=y.showSpaces?y.SPACE_CHAR:T,E.appendChild(C)}else if(F){c+=1;var C=this.dom.createElement("span");C.style.width=y.config.characterWidth*2+"px",C.className="ace_cjk",C.textContent=F,E.appendChild(C)}}}if(E.appendChild(this.dom.createTextNode(g?m.slice(g):m,this.element)),t(f.type))a.appendChild(E);else{var w="ace_"+f.type.replace(/\./g," ace_"),C=this.dom.createElement("span");f.type=="fold"&&(C.style.width=f.value.length*this.config.characterWidth+"px",C.setAttribute("title",e("inline-fold.closed.title","Unfold code"))),C.className=w,C.appendChild(E),a.appendChild(C)}return c+m.length},l.prototype.renderIndentGuide=function(a,c,f){var m=c.search(this.$indentGuideRe);if(m<=0||m>=f)return c;if(c[0]==" "){m-=m%this.tabSize;for(var y=m/this.tabSize,D=0;D<y;D++)a.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),c.substr(m)}else if(c[0]==" "){for(var D=0;D<m;D++)a.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),c.substr(m)}return this.$highlightIndentGuide(),c},l.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 c=this.session.selection.getCursor(),f=/^\s*/.exec(this.session.doc.getLine(c.row))[0].length,m=Math.floor(f/this.tabSize);this.$highlightIndentGuideMarker={indentLevel:m,start:c.row};var y=this.session.$bracketHighlight;if(y){for(var D=this.session.$bracketHighlight.ranges,E=0;E<D.length;E++)if(c.row!==D[E].start.row){this.$highlightIndentGuideMarker.end=D[E].start.row+1,c.row>D[E].start.row?this.$highlightIndentGuideMarker.dir=-1:this.$highlightIndentGuideMarker.dir=1;break}}if(!this.$highlightIndentGuideMarker.end&&a[c.row]!==""&&c.column===a[c.row].length){this.$highlightIndentGuideMarker.dir=1;for(var E=c.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()}}},l.prototype.$clearActiveIndentGuide=function(){for(var a=this.element.querySelectorAll(".ace_indent-guide-active"),c=0;c<a.length;c++)a[c].classList.remove("ace_indent-guide-active")},l.prototype.$setIndentGuideActive=function(a,c){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 D=y[c-1];D&&D.classList&&D.classList.contains("ace_indent-guide")&&D.classList.add("ace_indent-guide-active")}}},l.prototype.$renderHighlightIndentGuide=function(){if(this.$lines){var a=this.$lines.cells;this.$clearActiveIndentGuide();var c=this.$highlightIndentGuideMarker.indentLevel;if(c!==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,c)}}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,c)}}}},l.prototype.$createLineElement=function(a){var c=this.dom.createElement("div");return c.className="ace_line",c.style.height=this.config.lineHeight+"px",c},l.prototype.$renderWrappedLine=function(a,c,f){var m=0,y=0,D=f[0],E=0,b=this.$createLineElement();a.appendChild(b);for(var g=0;g<c.length;g++){var S=c[g],M=S.value;if(g==0&&this.displayIndentGuides){if(m=M.length,M=this.renderIndentGuide(b,M,D),!M)continue;m-=M.length}if(m+M.length<D)E=this.$renderToken(b,E,S,M),m+=M.length;else{for(;m+M.length>=D;)E=this.$renderToken(b,E,S,M.substring(0,D-m)),M=M.substring(D-m),m=D,b=this.$createLineElement(),a.appendChild(b),b.appendChild(this.dom.createTextNode(d.stringRepeat(" ",f.indent),this.element)),y++,E=0,D=f[y]||Number.MAX_VALUE;M.length!=0&&(m+=M.length,E=this.$renderToken(b,E,S,M))}}f[f.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(b,E,null,"",!0)},l.prototype.$renderSimpleLine=function(a,c){for(var f=0,m=0;m<c.length;m++){var y=c[m],D=y.value;if(!(m==0&&this.displayIndentGuides&&(D=this.renderIndentGuide(a,D),!D))){if(f+D.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(a,f,y,D);f=this.$renderToken(a,f,y,D)}}},l.prototype.$renderOverflowMessage=function(a,c,f,m,y){f&&this.$renderToken(a,c,f,m.slice(0,this.MAX_LINE_LENGTH-c));var D=this.dom.createElement("span");D.className="ace_inline_button ace_keyword ace_toggle_wrap",D.textContent=y?"<hide>":"<click to see more...>",a.appendChild(D)},l.prototype.$renderLine=function(a,c,f){if(!f&&f!=!1&&(f=this.session.getFoldLine(c)),f)var m=this.$getFoldLineTokens(c,f);else var m=this.session.getTokens(c);var y=a;if(m.length){var D=this.session.getRowSplitData(c);if(D&&D.length){this.$renderWrappedLine(a,m,D);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&&(c=f.end.row);var E=this.dom.createElement("span");E.className="ace_invisible ace_invisible_eol",E.textContent=c==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,y.appendChild(E)}},l.prototype.$getFoldLineTokens=function(a,c){var f=this.session,m=[];function y(E,b,g){for(var S=0,M=0;M+E[S].value.length<b;)if(M+=E[S].value.length,S++,S==E.length)return;if(M!=b){var _=E[S].value.substring(b-M);_.length>g-b&&(_=_.substring(0,g-b)),m.push({type:E[S].type,value:_}),M=b+_.length,S+=1}for(;M<g&&S<E.length;){var _=E[S].value;_.length+M>g?m.push({type:E[S].type,value:_.substring(0,g-M)}):m.push(E[S]),M+=_.length,S+=1}}var D=f.getTokens(a);return c.walk(function(E,b,g,S,M){E!=null?m.push({type:"fold",value:E}):(M&&(D=f.getTokens(b)),D.length&&y(D,S,g))},c.end.row,this.session.getLine(c.end.row).length),m},l.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},l}();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,o.implement(r.prototype,p),u.Text=r}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(i,u,v){var o=i("../lib/dom"),h=function(){function d(s){this.element=o.createElement("div"),this.element.className="ace_layer ace_cursor-layer",s.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),o.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return d.prototype.$updateOpacity=function(s){for(var p=this.cursors,e=p.length;e--;)o.setStyle(p[e].style,"opacity",s?"":"0")},d.prototype.$startCssAnimation=function(){for(var s=this.cursors,p=s.length;p--;)s[p].style.animationDuration=this.blinkInterval+"ms";this.$isAnimating=!0,setTimeout(function(){this.$isAnimating&&o.addCssClass(this.element,"ace_animate-blinking")}.bind(this))},d.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,o.removeCssClass(this.element,"ace_animate-blinking")},d.prototype.setPadding=function(s){this.$padding=s},d.prototype.setSession=function(s){this.session=s},d.prototype.setBlinking=function(s){s!=this.isBlinking&&(this.isBlinking=s,this.restartTimer())},d.prototype.setBlinkInterval=function(s){s!=this.blinkInterval&&(this.blinkInterval=s,this.restartTimer())},d.prototype.setSmoothBlinking=function(s){s!=this.smoothBlinking&&(this.smoothBlinking=s,o.setCssClass(this.element,"ace_smooth-blinking",s),this.$updateCursors(!0),this.restartTimer())},d.prototype.addCursor=function(){var s=o.createElement("div");return s.className="ace_cursor",this.element.appendChild(s),this.cursors.push(s),s},d.prototype.removeCursor=function(){if(this.cursors.length>1){var s=this.cursors.pop();return s.parentNode.removeChild(s),s}},d.prototype.hideCursor=function(){this.isVisible=!1,o.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},d.prototype.showCursor=function(){this.isVisible=!0,o.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},d.prototype.restartTimer=function(){var s=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&(this.$isSmoothBlinking=!1,o.removeCssClass(this.element,"ace_smooth-blinking")),s(!0),!this.isBlinking||!this.blinkInterval||!this.isVisible){this.$stopCssAnimation();return}if(this.smoothBlinking&&(this.$isSmoothBlinking=!0,setTimeout(function(){this.$isSmoothBlinking&&o.addCssClass(this.element,"ace_smooth-blinking")}.bind(this))),o.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var p=function(){this.timeoutId=setTimeout(function(){s(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){s(!0),p()},this.blinkInterval),p()}},d.prototype.getPixelPosition=function(s,p){if(!this.config||!this.session)return{left:0,top:0};s||(s=this.session.selection.getCursor());var e=this.session.documentToScreenPosition(s),t=this.$padding+(this.session.$bidiHandler.isBidiRow(e.row,s.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(s,p){return s.top>=0&&s.top<p.maxHeight},d.prototype.update=function(s){this.config=s;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 l=this.getPixelPosition(p[e].cursor,!0);if(!((l.top>s.height+s.offset||l.top<0)&&e>1)){var a=this.cursors[t++]||this.addCursor(),c=a.style;this.drawCursor?this.drawCursor(a,l,s,p[e],this.session):this.isCursorInView(l,s)?(o.setStyle(c,"display","block"),o.translate(a,l.left,l.top),o.setStyle(c,"width",Math.round(s.characterWidth)+"px"),o.setStyle(c,"height",s.lineHeight+"px")):o.setStyle(c,"display","none")}}for(;this.cursors.length>t;)this.removeCursor();var f=this.session.getOverwrite();this.$setOverwrite(f),this.$pixelPos=l,this.restartTimer()},d.prototype.$setOverwrite=function(s){s!=this.overwrite&&(this.overwrite=s,s?o.addCssClass(this.element,"ace_overwrite-cursors"):o.removeCssClass(this.element,"ace_overwrite-cursors"))},d.prototype.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)},d}();h.prototype.$padding=0,h.prototype.drawCursor=null,u.Cursor=h}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(i,u,v){var o=this&&this.__extends||function(){var a=function(c,f){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,y){m.__proto__=y}||function(m,y){for(var D in y)Object.prototype.hasOwnProperty.call(y,D)&&(m[D]=y[D])},a(c,f)};return function(c,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");a(c,f);function m(){this.constructor=c}c.prototype=f===null?Object.create(f):(m.prototype=f.prototype,new m)}}(),h=i("./lib/oop"),d=i("./lib/dom"),s=i("./lib/event"),p=i("./lib/event_emitter").EventEmitter,e=32768,t=function(){function a(c,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),c.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addListener(this.element,"scroll",this.onScroll.bind(this)),s.addListener(this.element,"mousedown",s.preventDefault)}return a.prototype.setVisible=function(c){this.element.style.display=c?"":"none",this.isVisible=c,this.coeff=1},a}();h.implement(t.prototype,p);var r=function(a){o(c,a);function c(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 c.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},c.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},c.prototype.setHeight=function(f){this.element.style.height=f+"px"},c.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"},c.prototype.setScrollTop=function(f){this.scrollTop!=f&&(this.skipEvent=!0,this.scrollTop=f,this.element.scrollTop=f*this.coeff)},c}(t);r.prototype.setInnerHeight=r.prototype.setScrollHeight;var l=function(a){o(c,a);function c(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 c.prototype.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},c.prototype.getHeight=function(){return this.isVisible?this.height:0},c.prototype.setWidth=function(f){this.element.style.width=f+"px"},c.prototype.setInnerWidth=function(f){this.inner.style.width=f+"px"},c.prototype.setScrollWidth=function(f){this.inner.style.width=f+"px"},c.prototype.setScrollLeft=function(f){this.scrollLeft!=f&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=f)},c}(t);u.ScrollBar=r,u.ScrollBarV=r,u.ScrollBarH=l,u.VScrollBar=r,u.HScrollBar=l}),ace.define("ace/scrollbar_custom",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(i,u,v){var o=this&&this.__extends||function(){var l=function(a,c){return l=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])},l(a,c)};return function(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");l(a,c);function f(){this.constructor=a}a.prototype=c===null?Object.create(c):(f.prototype=c.prototype,new f)}}(),h=i("./lib/oop"),d=i("./lib/dom"),s=i("./lib/event"),p=i("./lib/event_emitter").EventEmitter;d.importCssString(`.ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{
|
|
227
|
+
`){var U=I.getLine(R.row);if(R.column>U.search(/\S|$/)){var V=U.substr(R.column).search(/\S|$/);I.doc.removeInLine(R.row,R.column,R.column+V)}}this.clearSelection();var W=R.column,H=I.getState(R.row),U=I.getLine(R.row),G=O.checkOutdent(H,U,w);if(I.insert(R,w),P&&P.selection&&(P.selection.length==2?this.selection.setSelectionRange(new f(R.row,W+P.selection[0],R.row,W+P.selection[1])):this.selection.setSelectionRange(new f(R.row+P.selection[0],P.selection[1],R.row+P.selection[2],P.selection[3]))),this.$enableAutoIndent){if(I.getDocument().isNewLine(w)){var Y=O.getNextLineIndent(H,U.slice(0,R.column),I.getTabString());I.insert({row:R.row+1,column:0},Y)}G&&O.autoOutdent(H,I,R.row)}},C.prototype.autoIndent=function(){for(var w=this.session,x=w.getMode(),I=this.selection.isEmpty()?[new f(0,0,w.doc.getLength()-1,0)]:this.selection.getAllRanges(),O="",R="",P="",B=w.getTabString(),V=0;V<I.length;V++)for(var W=I[V].start.row,H=I[V].end.row,U=W;U<=H;U++){U>0&&(O=w.getState(U-1),R=w.getLine(U-1),P=x.getNextLineIndent(O,R,B));var G=w.getLine(U),Y=x.$getIndent(G);if(P!==Y){if(Y.length>0){var Q=new f(U,0,U,Y.length);w.remove(Q)}P.length>0&&w.insert({row:U,column:0},P)}x.autoOutdent(O,w,U)}},C.prototype.onTextInput=function(w,x){if(!x)return this.keyBinding.onTextInput(w);this.startOperation({command:{name:"insertstring"}});var I=this.applyComposition.bind(this,w,x);this.selection.rangeCount?this.forEachSelection(I):I(),this.endOperation()},C.prototype.applyComposition=function(w,x){if(x.extendLeft||x.extendRight){var I=this.selection.getRange();I.start.column-=x.extendLeft,I.end.column+=x.extendRight,I.start.column<0&&(I.start.row--,I.start.column+=this.session.getLine(I.start.row).length+1),this.selection.setRange(I),!w&&!I.isEmpty()&&this.remove()}if((w||!this.selection.isEmpty())&&this.insert(w,!0),x.restoreStart||x.restoreEnd){var I=this.selection.getRange();I.start.column-=x.restoreStart,I.end.column-=x.restoreEnd,this.selection.setRange(I)}},C.prototype.onCommandKey=function(w,x,I){return this.keyBinding.onCommandKey(w,x,I)},C.prototype.setOverwrite=function(w){this.session.setOverwrite(w)},C.prototype.getOverwrite=function(){return this.session.getOverwrite()},C.prototype.toggleOverwrite=function(){this.session.toggleOverwrite()},C.prototype.setScrollSpeed=function(w){this.setOption("scrollSpeed",w)},C.prototype.getScrollSpeed=function(){return this.getOption("scrollSpeed")},C.prototype.setDragDelay=function(w){this.setOption("dragDelay",w)},C.prototype.getDragDelay=function(){return this.getOption("dragDelay")},C.prototype.setSelectionStyle=function(w){this.setOption("selectionStyle",w)},C.prototype.getSelectionStyle=function(){return this.getOption("selectionStyle")},C.prototype.setHighlightActiveLine=function(w){this.setOption("highlightActiveLine",w)},C.prototype.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},C.prototype.setHighlightGutterLine=function(w){this.setOption("highlightGutterLine",w)},C.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},C.prototype.setHighlightSelectedWord=function(w){this.setOption("highlightSelectedWord",w)},C.prototype.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},C.prototype.setAnimatedScroll=function(w){this.renderer.setAnimatedScroll(w)},C.prototype.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},C.prototype.setShowInvisibles=function(w){this.renderer.setShowInvisibles(w)},C.prototype.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},C.prototype.setDisplayIndentGuides=function(w){this.renderer.setDisplayIndentGuides(w)},C.prototype.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},C.prototype.setHighlightIndentGuides=function(w){this.renderer.setHighlightIndentGuides(w)},C.prototype.getHighlightIndentGuides=function(){return this.renderer.getHighlightIndentGuides()},C.prototype.setShowPrintMargin=function(w){this.renderer.setShowPrintMargin(w)},C.prototype.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},C.prototype.setPrintMarginColumn=function(w){this.renderer.setPrintMarginColumn(w)},C.prototype.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},C.prototype.setReadOnly=function(w){this.setOption("readOnly",w)},C.prototype.getReadOnly=function(){return this.getOption("readOnly")},C.prototype.setBehavioursEnabled=function(w){this.setOption("behavioursEnabled",w)},C.prototype.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},C.prototype.setWrapBehavioursEnabled=function(w){this.setOption("wrapBehavioursEnabled",w)},C.prototype.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},C.prototype.setShowFoldWidgets=function(w){this.setOption("showFoldWidgets",w)},C.prototype.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},C.prototype.setFadeFoldWidgets=function(w){this.setOption("fadeFoldWidgets",w)},C.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},C.prototype.remove=function(w){this.selection.isEmpty()&&(w=="left"?this.selection.selectLeft():this.selection.selectRight());var x=this.getSelectionRange();if(this.getBehavioursEnabled()){var I=this.session,O=I.getState(x.start.row),R=I.getMode().transformAction(O,"deletion",this,I,x);if(x.end.column===0){var P=I.getTextRange(x);if(P[P.length-1]==`
|
|
228
|
+
`){var B=I.getLine(x.end.row);/^\s+$/.test(B)&&(x.end.column=B.length)}}R&&(x=R)}this.session.remove(x),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 w=this.getSelectionRange();w.start.column==w.end.column&&w.start.row==w.end.row&&(w.end.column=0,w.end.row++),this.session.remove(w),this.clearSelection()},C.prototype.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var w=this.getCursorPosition();this.insert(`
|
|
229
|
+
`),this.moveCursorToPosition(w)},C.prototype.setGhostText=function(w,x){this.renderer.setGhostText(w,x)},C.prototype.removeGhostText=function(){this.renderer.removeGhostText()},C.prototype.transposeLetters=function(){if(this.selection.isEmpty()){var w=this.getCursorPosition(),x=w.column;if(x!==0){var I=this.session.getLine(w.row),O,R;x<I.length?(O=I.charAt(x)+I.charAt(x-1),R=new f(w.row,x-1,w.row,x+1)):(O=I.charAt(x-1)+I.charAt(x-2),R=new f(w.row,x-2,w.row,x)),this.session.replace(R,O),this.session.selection.moveToPosition(R.end)}}},C.prototype.toLowerCase=function(){var w=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var x=this.getSelectionRange(),I=this.session.getTextRange(x);this.session.replace(x,I.toLowerCase()),this.selection.setSelectionRange(w)},C.prototype.toUpperCase=function(){var w=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var x=this.getSelectionRange(),I=this.session.getTextRange(x);this.session.replace(x,I.toUpperCase()),this.selection.setSelectionRange(w)},C.prototype.indent=function(){var w=this.session,x=this.getSelectionRange();if(x.start.row<x.end.row){var I=this.$getSelectedRows();w.indentRows(I.first,I.last," ");return}else if(x.start.column<x.end.column){var O=w.getTextRange(x);if(!/^\s+$/.test(O)){var I=this.$getSelectedRows();w.indentRows(I.first,I.last," ");return}}var R=w.getLine(x.start.row),P=x.start,B=w.getTabSize(),V=w.documentToScreenColumn(P.row,P.column);if(this.session.getUseSoftTabs())var W=B-V%B,H=o.stringRepeat(" ",W);else{for(var W=V%B;R[x.start.column-1]==" "&&W;)x.start.column--,W--;this.selection.setSelectionRange(x),H=" "}return this.insert(H)},C.prototype.blockIndent=function(){var w=this.$getSelectedRows();this.session.indentRows(w.first,w.last," ")},C.prototype.blockOutdent=function(){var w=this.session.getSelection();this.session.outdentRows(w.getRange())},C.prototype.sortLines=function(){for(var w=this.$getSelectedRows(),x=this.session,I=[],O=w.first;O<=w.last;O++)I.push(x.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=w.first;O<=w.last;O++){var P=x.getLine(O);R.start.row=O,R.end.row=O,R.end.column=P.length,x.replace(R,I[O-w.first])}},C.prototype.toggleCommentLines=function(){var w=this.session.getState(this.getCursorPosition().row),x=this.$getSelectedRows();this.session.getMode().toggleCommentLines(w,this.session,x.first,x.last)},C.prototype.toggleBlockComment=function(){var w=this.getCursorPosition(),x=this.session.getState(w.row),I=this.getSelectionRange();this.session.getMode().toggleBlockComment(x,this.session,I,w)},C.prototype.getNumberAt=function(w,x){var I=/[\-]?[0-9]+(?:\.[0-9]+)?/g;I.lastIndex=0;for(var O=this.session.getLine(w);I.lastIndex<x;){var R=I.exec(O);if(R.index<=x&&R.index+R[0].length>=x){var P={value:R[0],start:R.index,end:R.index+R[0].length};return P}}return null},C.prototype.modifyNumber=function(w){var x=this.selection.getCursor().row,I=this.selection.getCursor().column,O=new f(x,I-1,x,I),R=this.session.getTextRange(O);if(!isNaN(parseFloat(R))&&isFinite(R)){var P=this.getNumberAt(x,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?w*=Math.pow(10,P.end-I-1):w*=Math.pow(10,P.end-I),W+=w,W/=Math.pow(10,V);var H=W.toFixed(V),U=new f(x,P.start,x,P.end);this.session.replace(U,H),this.moveCursorTo(x,Math.max(P.start+1,I+H.length-P.value.length))}}else this.toggleWord()},C.prototype.toggleWord=function(){var w=this.selection.getCursor().row,x=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=x-O-1;P<0&&(P=0);var B=0,V=0,W=this;I.match(/[A-Za-z0-9_]+/)&&R.forEach(function(ge,be){V=B+ge.length,P>=B&&P<=V&&(I=ge,W.selection.clearSelection(),W.moveCursorTo(w,B+O),W.selection.selectTo(w,V+O)),B=V});for(var H=this.$toggleWordPairs,U,G=0;G<H.length;G++)for(var Y=H[G],Q=0;Q<=1;Q++){var ee=+!Q,ne=I.match(new RegExp("^\\s?_?("+o.escapeRegExp(Y[Q])+")\\s?$","i"));if(ne){var se=I.match(new RegExp("([_]|^|\\s)("+o.escapeRegExp(ne[1])+")($|\\s)","g"));se&&(U=I.replace(new RegExp(o.escapeRegExp(Y[Q]),"i"),function(ge){var be=Y[ee];return ge.toUpperCase()==ge?be=be.toUpperCase():ge.charAt(0).toUpperCase()==ge.charAt(0)&&(be=be.substr(0,0)+Y[ee].charAt(0).toUpperCase()+be.substr(1)),be}),this.insert(U),U="")}}},C.prototype.findLinkAt=function(w,x){var I,O,R=this.session.getLine(w),P=R.split(/((?:https?|ftp):\/\/[\S]+)/),B=x;B<0&&(B=0);var V=0,W=0,H;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]+)/)){H=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 H},C.prototype.openLink=function(){var w=this.selection.getCursor(),x=this.findLinkAt(w.row,w.column);return x&&window.open(x,"_blank"),x!=null},C.prototype.removeLines=function(){var w=this.$getSelectedRows();this.session.removeFullLines(w.first,w.last),this.clearSelection()},C.prototype.duplicateSelection=function(){var w=this.selection,x=this.session,I=w.getRange(),O=w.isBackwards();if(I.isEmpty()){var R=I.start.row;x.duplicateLines(R,R)}else{var P=O?I.start:I.end,B=x.insert(P,x.getTextRange(I));I.start=P,I.end=B,w.setSelectionRange(I,O)}},C.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},C.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},C.prototype.moveText=function(w,x,I){return this.session.moveText(w,x,I)},C.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},C.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},C.prototype.$moveLines=function(w,x){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,x?0:w),x&&w==-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,H=B.length,U=0;U<H;U++){var G=U;B[U].moveBy(V,0),I=this.$getSelectedRows(B[U]);for(var Y=I.first,Q=I.last;++U<H;){W&&B[U].moveBy(W,0);var ee=this.$getSelectedRows(B[U]);if(x&&ee.first!=Q)break;if(!x&&ee.first>Q+1)break;Q=ee.last}for(U--,V=this.session.$moveLines(Y,Q,x?0:w),x&&w==-1&&(G=U+1);G<=U;)B[G].moveBy(V,0),G++;x||(V=0),W+=V}R.fromOrientedRange(R.ranges[0]),R.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},C.prototype.$getSelectedRows=function(w){return w=(w||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(w.start.row),last:this.session.getRowFoldEnd(w.end.row)}},C.prototype.onCompositionStart=function(w){this.renderer.showComposition(w)},C.prototype.onCompositionUpdate=function(w){this.renderer.setCompositionText(w)},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(w){return w>=this.getFirstVisibleRow()&&w<=this.getLastVisibleRow()},C.prototype.isRowFullyVisible=function(w){return w>=this.renderer.getFirstFullyVisibleRow()&&w<=this.renderer.getLastFullyVisibleRow()},C.prototype.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},C.prototype.$moveByPage=function(w,x){var I=this.renderer,O=this.renderer.layerConfig,R=w*Math.floor(O.height/O.lineHeight);x===!0?this.selection.$moveSelection(function(){this.moveCursorBy(R,0)}):x===!1&&(this.selection.moveCursorBy(R,0),this.selection.clearSelection());var P=I.scrollTop;I.scrollBy(0,R*O.lineHeight),x!=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(w){this.renderer.scrollToRow(w)},C.prototype.scrollToLine=function(w,x,I,O){this.renderer.scrollToLine(w,x,I,O)},C.prototype.centerSelection=function(){var w=this.getSelectionRange(),x={row:Math.floor(w.start.row+(w.end.row-w.start.row)/2),column:Math.floor(w.start.column+(w.end.column-w.start.column)/2)};this.renderer.alignCursor(x,.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(w,x){this.selection.moveCursorTo(w,x)},C.prototype.moveCursorToPosition=function(w){this.selection.moveCursorToPosition(w)},C.prototype.jumpToMatching=function(w,x){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,H={},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(H[G])&&(H[G]=0),B.value[U]){case"(":case"[":case"{":H[G]++;break;case")":case"]":case"}":H[G]--,H[G]===-1&&(V="bracket",W=!0);break}}else B.type.indexOf("tag-name")!==-1&&(isNaN(H[B.value])&&(H[B.value]=0),R.value==="<"&&P>1?H[B.value]++:R.value==="</"&&H[B.value]--,H[B.value]===-1&&(V="tag",W=!0));W||(R=B,P++,B=O.stepForward(),U=0)}while(B&&!W);if(V){var Q,ee;if(V==="bracket")Q=this.session.getBracketRange(I),Q||(Q=new f(O.getCurrentTokenRow(),O.getCurrentTokenColumn()+U-1,O.getCurrentTokenRow(),O.getCurrentTokenColumn()+U-1),ee=Q.start,(x||ee.row===I.row&&Math.abs(ee.column-I.column)<2)&&(Q=this.session.getBracketRange(ee)));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 ne=this.session.getMatchingTags(I);ne&&(ne.openTag.contains(I.row,I.column)?(Q=ne.closeTag,ee=Q.start):(Q=ne.openTag,ne.closeTag.start.row===I.row&&ne.closeTag.start.column===I.column?ee=Q.end:ee=Q.start))}ee=ee||Q.start}ee=Q&&Q.cursor||ee,ee&&(w?Q&&x?this.selection.setRange(Q):Q&&Q.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(ee.row,ee.column):this.selection.moveTo(ee.row,ee.column))}}},C.prototype.gotoLine=function(w,x,I){this.selection.clearSelection(),this.session.unfold({row:w-1,column:x||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(w-1,x||0),this.isRowFullyVisible(w-1)||this.scrollToLine(w-1,!0,I)},C.prototype.navigateTo=function(w,x){this.selection.moveTo(w,x)},C.prototype.navigateUp=function(w){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var x=this.selection.anchor.getPosition();return this.moveCursorToPosition(x)}this.selection.clearSelection(),this.selection.moveCursorBy(-w||-1,0)},C.prototype.navigateDown=function(w){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var x=this.selection.anchor.getPosition();return this.moveCursorToPosition(x)}this.selection.clearSelection(),this.selection.moveCursorBy(w||1,0)},C.prototype.navigateLeft=function(w){if(this.selection.isEmpty())for(w=w||1;w--;)this.selection.moveCursorLeft();else{var x=this.getSelectionRange().start;this.moveCursorToPosition(x)}this.clearSelection()},C.prototype.navigateRight=function(w){if(this.selection.isEmpty())for(w=w||1;w--;)this.selection.moveCursorRight();else{var x=this.getSelectionRange().end;this.moveCursorToPosition(x)}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(w,x){x&&this.$search.set(x);var I=this.$search.find(this.session),O=0;return I&&(this.$tryReplace(I,w)&&(O=1),this.selection.setSelectionRange(I),this.renderer.scrollSelectionIntoView(I.start,I.end)),O},C.prototype.replaceAll=function(w,x){x&&this.$search.set(x);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],w)&&O++;return this.selection.setSelectionRange(R),O},C.prototype.$tryReplace=function(w,x){var I=this.session.getTextRange(w);return x=this.$search.replace(I,x),x!==null?(w.end=this.session.replace(w,x),w):null},C.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},C.prototype.find=function(w,x,I){x||(x={}),typeof w=="string"||w instanceof RegExp?x.needle=w:typeof w=="object"&&h.mixin(x,w);var O=this.selection.getRange();x.needle==null&&(w=this.session.getTextRange(O)||this.$search.$options.needle,w||(O=this.session.getWordRange(O.start.row,O.start.column),w=this.session.getTextRange(O)),this.$search.set({needle:w})),this.$search.set(x),x.start||this.$search.set({start:O});var R=this.$search.find(this.session);if(x.preventScroll)return R;if(R)return this.revealRange(R,I),R;x.backwards?O.start=O.end:O.end=O.start,this.selection.setRange(O)},C.prototype.findNext=function(w,x){this.find({skipCurrent:!0,backwards:!1},w,x)},C.prototype.findPrevious=function(w,x){this.find(w,{skipCurrent:!0,backwards:!0},x)},C.prototype.revealRange=function(w,x){this.session.unfold(w),this.selection.setSelectionRange(w);var I=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(w.start,w.end,.5),x!==!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.$toDestroy&&(this.$toDestroy.forEach(function(w){w.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()},C.prototype.setAutoScrollEditorIntoView=function(w){if(w){var x,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&&(x=I.renderer.container.getBoundingClientRect())}),V=this.renderer.on("afterRender",function(){if(O&&x&&(I.isFocused()||I.searchBox&&I.searchBox.isFocused())){var W=I.renderer,H=W.$cursorLayer.$pixelPos,U=W.layerConfig,G=H.top-U.offset;H.top>=0&&G+x.top<0?O=!0:H.top<U.height&&H.top+x.top+U.lineHeight>window.innerHeight?O=!1:O=null,O!=null&&(R.style.top=G+"px",R.style.left=H.left+"px",R.style.height=U.lineHeight+"px",R.scrollIntoView(O)),O=x=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 w=this.$cursorStyle||"ace",x=this.renderer.$cursorLayer;x&&(x.setSmoothBlinking(/smooth/.test(w)),x.isBlinking=!this.$readOnly&&w!="wide",d.setCssClass(x.element,"ace_slim-cursors",/slim/.test(w)))},C.prototype.prompt=function(w,x,I){var O=this;E.loadModule("ace/ext/prompt",function(R){R.prompt(O,w,x,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"],["&&","||"],["==","!="]],h.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 w=this;this.textInput.setReadOnly(C),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){w.hoverTooltip||(w.hoverTooltip=new F);var R=d.createElement("div");R.textContent=S("editor.tooltip.disable-editing","Editing is disabled"),w.hoverTooltip.isOpen||w.hoverTooltip.showForRange(w,w.getSelectionRange(),R)}else w.hoverTooltip&&w.hoverTooltip.isOpen&&w.hoverTooltip.hide()});var x=this.textInput.getElement();C?(T.addListener(x,"keydown",this.$readOnlyCallback,this),this.commands.on("exec",this.$readOnlyCallback),this.commands.on("commandUnavailable",this.$readOnlyCallback)):(T.removeListener(x,"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 w=this.session&&(this.renderer.$composition||this.session.getLength()>1||this.session.getLine(0).length>0);if(w&&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(!w&&!this.renderer.placeholderNode){this.renderer.on("afterRender",this.$updatePlaceholder),d.addCssClass(this.container,"ace_hasPlaceholder");var x=d.createElement("div");x.className="ace_placeholder",x.textContent=this.$placeholder||"",this.renderer.placeholderNode=x,this.renderer.content.appendChild(this.renderer.placeholderNode)}else!w&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"")}.bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},enableKeyboardAccessibility:{set:function(C){var w={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},x=function(O){if(O.target==this.renderer.scroller&&O.keyCode===_.enter){O.preventDefault();var R=this.getCursorPosition().row;this.isRowVisible(R)||this.scrollToLine(R,!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",x.bind(this)),this.commands.addCommand(w),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",x.bind(this)),this.commands.removeCommand(w),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,w){return(Math.abs(C.selection.lead.row-w)||w+1+(w<9?"·":""))+""},getWidth:function(C,w,x){return Math.max(w.toString().length,(x.lastRow+1).toString().length,2)*x.characterWidth},update:function(C,w){w.renderer.$loop.schedule(w.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)}};u.Editor=A}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(i,u,v){var s=i("../lib/dom"),h=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),l=e.documentToScreenRow(o,0)*p.lineHeight;return l-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 l=s.createElement("div");t&&t(l),this.element.appendChild(l),r={element:l,text:"",row:o}}return r.row=o,r},d}();u.Lines=h}),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,u,v){var s=i("../lib/dom"),h=i("../lib/oop"),d=i("../lib/lang"),o=i("../lib/event_emitter").EventEmitter,p=i("./lines").Lines,e=i("../config").nls,t=function(){function l(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 l.prototype.setSession=function(a){this.session&&this.session.off("change",this.$updateAnnotations),this.session=a,a&&a.on("change",this.$updateAnnotations)},l.prototype.addGutterDecoration=function(a,c){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(a,c)},l.prototype.removeGutterDecoration=function(a,c){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(a,c)},l.prototype.setAnnotations=function(a){this.$annotations=[];for(var c=0;c<a.length;c++){var f=a[c],m=f.row,y=this.$annotations[m];y||(y=this.$annotations[m]={text:[],type:[],displayText:[]});var D=f.text,E=f.text,b=f.type;D=D?d.escapeHTML(D):f.html||"",E=E||f.html||"",y.text.indexOf(D)===-1&&(y.text.push(D),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")}},l.prototype.$updateAnnotations=function(a){if(this.$annotations.length){var c=a.start.row,f=a.end.row-c;if(f!==0)if(a.action=="remove")this.$annotations.splice(c,f+1,null);else{var m=new Array(f+1);m.unshift(c,1),this.$annotations.splice.apply(this.$annotations,m)}}},l.prototype.update=function(a){this.config=a;var c=this.session,f=a.firstRow,m=Math.min(a.lastRow+a.gutterOffset,c.getLength()-1);this.oldLastRow=m,this.config=a,this.$lines.moveContainer(a),this.$updateCursorRow();for(var y=c.getNextFoldLine(f),D=y?y.start.row:1/0,E=null,b=-1,g=f;;){if(g>D&&(g=y.end.row+1,y=c.getNextFoldLine(g,y),D=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)},l.prototype.$updateGutterWidth=function(a){var c=this.session,f=c.gutterRenderer||this.$renderer,m=c.$firstLineNumber,y=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||c.$useWrapMode)&&(y=c.getLength()+m-1);var D=f?f.getWidth(c,y,a):y.toString().length*a.characterWidth,E=this.$padding||this.$computePadding();D+=E.left+E.right,D!==this.gutterWidth&&!isNaN(D)&&(this.gutterWidth=D,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",D))},l.prototype.$updateCursorRow=function(){if(this.$highlightGutterLine){var a=this.session.selection.getCursor();this.$cursorRow!==a.row&&(this.$cursorRow=a.row)}},l.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 c=this.$lines.cells;this.$cursorCell=null;for(var f=0;f<c.length;f++){var m=c[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==c[f-1].row)m=c[f-1];else break}m.element.className="ace_gutter-active-line "+m.element.className,this.$cursorCell=m;break}}}}},l.prototype.scrollLines=function(a){var c=this.config;if(this.config=a,this.$updateCursorRow(),this.$lines.pageChanged(c,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,!c||m<a.firstRow)return this.update(a);if(f<c.firstRow)return this.update(a);if(c.firstRow<a.firstRow)for(var y=this.session.getFoldedRowCount(c.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<c.firstRow&&this.$lines.unshift(this.$renderLines(a,a.firstRow,c.firstRow-1)),f>m&&this.$lines.push(this.$renderLines(a,m+1,f)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(a)},l.prototype.$renderLines=function(a,c,f){for(var m=[],y=c,D=this.session.getNextFoldLine(y),E=D?D.start.row:1/0;y>E&&(y=D.end.row+1,D=this.session.getNextFoldLine(y,D),E=D?D.start.row:1/0),!(y>f);){var b=this.$lines.createCell(y,a,this.session,r);this.$renderCell(b,a,D,y),m.push(b),y++}return m},l.prototype.$renderCell=function(a,c,f,m){var y=a.element,D=this.session,E=y.childNodes[0],b=y.childNodes[1],g=y.childNodes[2],S=y.childNodes[3],M=g.firstChild,_=D.$firstLineNumber,T=D.$breakpoints,F=D.$decorations,A=D.gutterRenderer||this.$renderer,$=this.$showFoldWidgets&&D.foldWidgets,C=f?f.start.row:Number.MAX_VALUE,w=c.lineHeight+"px",x=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",I=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",O=(A?A.getText(D,m):m+_).toString();if(this.$highlightGutterLine&&(m==this.$cursorRow||f&&m<this.$cursorRow&&m>=C&&this.$cursorRow<=f.end.row)&&(x+="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)),T[m]&&(x+=T[m]),F[m]&&(x+=F[m]),this.$annotations[m]&&m!==C&&(x+=this.$annotations[m].className),$){var R=$[m];R==null&&(R=$[m]=D.getFoldWidget(m))}if(R){var P="ace_fold-widget ace_"+R,B=R=="start"&&m==C&&m<f.end.row;if(B){P+=" ace_closed";for(var V="",W=!1,H=m+1;H<=f.end.row;H++)if(this.$annotations[H]){if(this.$annotations[H].className===" ace_error"){W=!0,V=" ace_error_fold";break}this.$annotations[H].className===" ace_security"?(W=!0,V=" ace_security_fold"):this.$annotations[H].className===" ace_warning"&&V!==" ace_security_fold"&&(W=!0,V=" ace_warning_fold")}x+=V}else P+=" ace_open";b.className!=P&&(b.className=P),s.setStyle(b.style,"height",w),s.setStyle(b.style,"display","inline-block"),b.setAttribute("role","button"),b.setAttribute("tabindex","-1");var U=D.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",M.className=I,M.className+=V,s.setStyle(M.style,"height",w),s.setStyle(g.style,"display","block"),s.setStyle(g.style,"height",w);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",M.className=I,this.$useSvgGutterIcons?M.className+=this.$annotations[m].className:y.classList.add(this.$annotations[m].className.replace(" ","")),s.setStyle(M.style,"height",w),s.setStyle(g.style,"display","block"),s.setStyle(g.style,"height",w);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!=x&&(y.className=x),s.setStyle(a.element.style,"height",this.$lines.computeLineHeight(m,c,D)+"px"),s.setStyle(a.element.style,"top",this.$lines.computeLineTop(m,c,D)+"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},l.prototype.setHighlightGutterLine=function(a){this.$highlightGutterLine=a},l.prototype.setShowLineNumbers=function(a){this.$renderer=!a&&{getWidth:function(){return 0},getText:function(){return""}}},l.prototype.getShowLineNumbers=function(){return this.$showLineNumbers},l.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},l.prototype.getShowFoldWidgets=function(){return this.$showFoldWidgets},l.prototype.$hideFoldWidget=function(a,c){var f=c||this.$getGutterCell(a);if(f&&f.element){var m=f.element.childNodes[1];m&&s.setStyle(m.style,"display","none")}},l.prototype.$showFoldWidget=function(a,c){var f=c||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")}},l.prototype.$getGutterCell=function(a){var c=this.$lines.cells,f=this.session.documentToScreenRow(a,0);return c[a-this.config.firstRowScreen-(a-f)]},l.prototype.$addCustomWidget=function(a,c,f){var m=c.className,y=c.label,D=c.title,E=c.callbacks;this.session.$gutterCustomWidgets[a]={className:m,label:y,title:D,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",D),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)}},l.prototype.$removeCustomWidget=function(a,c){delete this.session.$gutterCustomWidgets[a],this.$showFoldWidget(a,c);var f=c||this.$getGutterCell(a);if(f&&f.element){var m=f.element.querySelector(".ace_custom-widget");m&&f.element.removeChild(m)}},l.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},l.prototype.getRegion=function(a){var c=this.$padding||this.$computePadding(),f=this.element.getBoundingClientRect();if(a.x<c.left+f.left)return"markers";if(this.$showFoldWidgets&&a.x>f.right-c.right)return"foldWidgets"},l}();t.prototype.$fixedWidth=!1,t.prototype.$highlightGutterLine=!0,t.prototype.$renderer="",t.prototype.$showLineNumbers=!0,t.prototype.$showFoldWidgets=!0,h.implement(t.prototype,o);function r(l){var a=document.createTextNode("");l.appendChild(a);var c=s.createElement("span");l.appendChild(c);var f=s.createElement("span");l.appendChild(f);var m=s.createElement("span");return f.appendChild(m),l}u.Gutter=t}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(i,u,v){var s=i("../range").Range,h=i("../lib/dom"),d=function(){function p(e){this.element=h.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 l=this.markers[r];if(!l.range){l.update(t,this,this.session,e);continue}var a=l.range.clipRows(e.firstRow,e.lastRow);if(!a.isEmpty())if(a=a.toScreenRange(this.session),l.renderer){var c=this.$getTop(a.start.row,e),f=this.$padding+a.start.column*e.characterWidth;l.renderer(t,a,f,c,e)}else l.type=="fullLine"?this.drawFullLineMarker(t,a,l.clazz,e):l.type=="screenLine"?this.drawScreenLineMarker(t,a,l.clazz,e):a.isMultiLine()?l.type=="text"?this.drawTextMarker(t,a,l.clazz,e):this.drawMultiLineMarker(t,a,l.clazz,e):this.drawSingleLineMarker(t,a,l.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,l,a){for(var c=this.session,f=t.start.row,m=t.end.row,y=f,D=0,E=0,b=c.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:c.getRowWrapIndent(y),g.end.column=b,D=E,E=b,b=y+1<m?c.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,D<E,E>b,y==m),l,y==m?0:1,a)},p.prototype.drawMultiLineMarker=function(e,t,r,l,a){var c=this.$padding,f=l.lineHeight,m=this.$getTop(t.start.row,l),y=c+t.start.column*l.characterWidth;if(a=a||"",this.session.$bidiHandler.isBidiRow(t.start.row)){var D=t.clone();D.end.row=D.start.row,D.end.column=this.session.getLine(D.start.row).length,this.drawBidiSingleLineMarker(e,D,r+" ace_br1 ace_start",l,null,a)}else this.elt(r+" ace_br1 ace_start","height:"+f+"px;right:"+c+"px;top:"+m+"px;left:"+y+"px;"+(a||""));if(this.session.$bidiHandler.isBidiRow(t.end.row)){var D=t.clone();D.start.row=D.end.row,D.start.column=0,this.drawBidiSingleLineMarker(e,D,r+" ace_br12",l,null,a)}else{m=this.$getTop(t.end.row,l);var E=t.end.column*l.characterWidth;this.elt(r+" ace_br12","height:"+f+"px;width:"+E+"px;top:"+m+"px;left:"+c+"px;"+(a||""))}if(f=(t.end.row-t.start.row-1)*l.lineHeight,!(f<=0)){m=this.$getTop(t.start.row+1,l);var b=(t.start.column?1:0)|(t.end.column?0:8);this.elt(r+(b?" ace_br"+b:""),"height:"+f+"px;right:"+c+"px;top:"+m+"px;left:"+c+"px;"+(a||""))}},p.prototype.drawSingleLineMarker=function(e,t,r,l,a,c){if(this.session.$bidiHandler.isBidiRow(t.start.row))return this.drawBidiSingleLineMarker(e,t,r,l,a,c);var f=l.lineHeight,m=(t.end.column+(a||0)-t.start.column)*l.characterWidth,y=this.$getTop(t.start.row,l),D=this.$padding+t.start.column*l.characterWidth;this.elt(r,"height:"+f+"px;width:"+m+"px;top:"+y+"px;left:"+D+"px;"+(c||""))},p.prototype.drawBidiSingleLineMarker=function(e,t,r,l,a,c){var f=l.lineHeight,m=this.$getTop(t.start.row,l),y=this.$padding,D=this.session.$bidiHandler.getSelections(t.start.column,t.end.column);D.forEach(function(E){this.elt(r,"height:"+f+"px;width:"+(E.width+(a||0))+"px;top:"+m+"px;left:"+(y+E.left)+"px;"+(c||""))},this)},p.prototype.drawFullLineMarker=function(e,t,r,l,a){var c=this.$getTop(t.start.row,l),f=l.lineHeight;t.start.row!=t.end.row&&(f+=this.$getTop(t.end.row,l)-c),this.elt(r,"height:"+f+"px;top:"+c+"px;left:0;right:0;"+(a||""))},p.prototype.drawScreenLineMarker=function(e,t,r,l,a){var c=this.$getTop(t.start.row,l),f=l.lineHeight;this.elt(r,"height:"+f+"px;top:"+c+"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)}u.Marker=d}),ace.define("ace/layer/text_util",["require","exports","module"],function(i,u,v){var s=new Set(["text","rparen","lparen"]);u.isTextToken=function(h){return s.has(h)}}),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,u,v){var s=i("../lib/oop"),h=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 l(a){this.dom=h,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 l.prototype.$updateEolChar=function(){var a=this.session.doc,c=a.getNewLineCharacter()==`
|
|
230
|
+
`&&a.getNewLineMode()!="windows",f=c?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=f)return this.EOL_CHAR=f,!0},l.prototype.setPadding=function(a){this.$padding=a,this.element.style.margin="0 "+a+"px"},l.prototype.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},l.prototype.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},l.prototype.$setFontMetrics=function(a){this.$fontMetrics=a,this.$fontMetrics.on("changeCharacterSize",function(c){this._signal("changeCharacterSize",c)}.bind(this)),this.$pollSizeChanges()},l.prototype.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},l.prototype.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},l.prototype.setSession=function(a){this.session=a,a&&this.$computeTabString()},l.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)},l.prototype.setDisplayIndentGuides=function(a){return this.displayIndentGuides==a?!1:(this.displayIndentGuides=a,this.$computeTabString(),!0)},l.prototype.setHighlightIndentGuides=function(a){return this.$highlightIndentGuides===a?!1:(this.$highlightIndentGuides=a,a)},l.prototype.$computeTabString=function(){var a=this.session.getTabSize();this.tabSize=a;for(var c=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),c.push(m)}else c.push(this.dom.createTextNode(d.stringRepeat(" ",f),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var y="ace_indent-guide",D=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+D,m.textContent=E,this.$tabStrings[" "]=m;var m=this.dom.createElement("span");m.className=y+b,m.textContent=g,this.$tabStrings[" "]=m}},l.prototype.updateLines=function(a,c,f){if(this.config.lastRow!=a.lastRow||this.config.firstRow!=a.firstRow)return this.update(a);this.config=a;for(var m=Math.max(c,a.firstRow),y=Math.min(f,a.lastRow),D=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),M=S?S.start.row:1/0;g>M&&(g=S.end.row+1,S=this.session.getNextFoldLine(g,S),M=S?S.start.row:1/0),!(g>y);){var _=D[E++];if(_){this.dom.removeChildren(_),this.$renderLine(_,g,g==M?S:!1),b&&(_.style.top=this.$lines.computeLineTop(g,a,this.session)+"px");var T=a.lineHeight*this.session.getRowLength(g)+"px";_.style.height!=T&&(b=!0,_.style.height=T)}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"}},l.prototype.scrollLines=function(a){var c=this.config;if(this.config=a,this.$lines.pageChanged(c,a))return this.update(a);this.$lines.moveContainer(a);var f=a.lastRow,m=c?c.lastRow:-1;if(!c||m<a.firstRow)return this.update(a);if(f<c.firstRow)return this.update(a);if(!c||c.lastRow<a.firstRow)return this.update(a);if(a.lastRow<c.firstRow)return this.update(a);if(c.firstRow<a.firstRow)for(var y=this.session.getFoldedRowCount(c.firstRow,a.firstRow-1);y>0;y--)this.$lines.shift();if(c.lastRow>a.lastRow)for(var y=this.session.getFoldedRowCount(a.lastRow+1,c.lastRow);y>0;y--)this.$lines.pop();a.firstRow<c.firstRow&&this.$lines.unshift(this.$renderLinesFragment(a,a.firstRow,c.firstRow-1)),a.lastRow>c.lastRow&&this.$lines.push(this.$renderLinesFragment(a,c.lastRow+1,a.lastRow)),this.$highlightIndentGuide()},l.prototype.$renderLinesFragment=function(a,c,f){for(var m=[],y=c,D=this.session.getNextFoldLine(y),E=D?D.start.row:1/0;y>E&&(y=D.end.row+1,D=this.session.getNextFoldLine(y,D),E=D?D.start.row:1/0),!(y>f);){var b=this.$lines.createCell(y,a,this.session),g=b.element;this.dom.removeChildren(g),h.setStyle(g.style,"height",this.$lines.computeLineHeight(y,a,this.session)+"px"),h.setStyle(g.style,"top",this.$lines.computeLineTop(y,a,this.session)+"px"),this.$renderLine(g,y,y==E?D:!1),this.$useLineGroups()?g.className="ace_line_group":g.className="ace_line",m.push(b),y++}return m},l.prototype.update=function(a){this.$lines.moveContainer(a),this.config=a;for(var c=a.firstRow,f=a.lastRow,m=this.$lines;m.getLength();)m.pop();m.push(this.$renderLinesFragment(a,c,f))},l.prototype.$renderToken=function(a,c,f,m){for(var y=this,D=/(\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=D.exec(m);){var S=b[1],M=b[2],_=b[3],T=b[4],F=b[5];if(!(!y.showSpaces&&M)){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(c+b.index);E.appendChild(y.$tabStrings[$].cloneNode(!0)),c+=$-1}else if(M)if(y.showSpaces){var C=this.dom.createElement("span");C.className="ace_invisible ace_invisible_space",C.textContent=d.stringRepeat(y.SPACE_CHAR,M.length),E.appendChild(C)}else E.appendChild(this.dom.createTextNode(M,this.element));else if(_){var C=this.dom.createElement("span");C.className="ace_invisible ace_invisible_space ace_invalid",C.textContent=d.stringRepeat(y.SPACE_CHAR,_.length),E.appendChild(C)}else if(T){c+=1;var C=this.dom.createElement("span");C.style.width=y.config.characterWidth*2+"px",C.className=y.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",C.textContent=y.showSpaces?y.SPACE_CHAR:T,E.appendChild(C)}else if(F){c+=1;var C=this.dom.createElement("span");C.style.width=y.config.characterWidth*2+"px",C.className="ace_cjk",C.textContent=F,E.appendChild(C)}}}if(E.appendChild(this.dom.createTextNode(g?m.slice(g):m,this.element)),t(f.type))a.appendChild(E);else{var w="ace_"+f.type.replace(/\./g," ace_"),C=this.dom.createElement("span");f.type=="fold"&&(C.style.width=f.value.length*this.config.characterWidth+"px",C.setAttribute("title",e("inline-fold.closed.title","Unfold code"))),C.className=w,C.appendChild(E),a.appendChild(C)}return c+m.length},l.prototype.renderIndentGuide=function(a,c,f){var m=c.search(this.$indentGuideRe);if(m<=0||m>=f)return c;if(c[0]==" "){m-=m%this.tabSize;for(var y=m/this.tabSize,D=0;D<y;D++)a.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),c.substr(m)}else if(c[0]==" "){for(var D=0;D<m;D++)a.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),c.substr(m)}return this.$highlightIndentGuide(),c},l.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 c=this.session.selection.getCursor(),f=/^\s*/.exec(this.session.doc.getLine(c.row))[0].length,m=Math.floor(f/this.tabSize);this.$highlightIndentGuideMarker={indentLevel:m,start:c.row};var y=this.session.$bracketHighlight;if(y){for(var D=this.session.$bracketHighlight.ranges,E=0;E<D.length;E++)if(c.row!==D[E].start.row){this.$highlightIndentGuideMarker.end=D[E].start.row+1,c.row>D[E].start.row?this.$highlightIndentGuideMarker.dir=-1:this.$highlightIndentGuideMarker.dir=1;break}}if(!this.$highlightIndentGuideMarker.end&&a[c.row]!==""&&c.column===a[c.row].length){this.$highlightIndentGuideMarker.dir=1;for(var E=c.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()}}},l.prototype.$clearActiveIndentGuide=function(){for(var a=this.element.querySelectorAll(".ace_indent-guide-active"),c=0;c<a.length;c++)a[c].classList.remove("ace_indent-guide-active")},l.prototype.$setIndentGuideActive=function(a,c){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 D=y[c-1];D&&D.classList&&D.classList.contains("ace_indent-guide")&&D.classList.add("ace_indent-guide-active")}}},l.prototype.$renderHighlightIndentGuide=function(){if(this.$lines){var a=this.$lines.cells;this.$clearActiveIndentGuide();var c=this.$highlightIndentGuideMarker.indentLevel;if(c!==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,c)}}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,c)}}}},l.prototype.$createLineElement=function(a){var c=this.dom.createElement("div");return c.className="ace_line",c.style.height=this.config.lineHeight+"px",c},l.prototype.$renderWrappedLine=function(a,c,f){var m=0,y=0,D=f[0],E=0,b=this.$createLineElement();a.appendChild(b);for(var g=0;g<c.length;g++){var S=c[g],M=S.value;if(g==0&&this.displayIndentGuides){if(m=M.length,M=this.renderIndentGuide(b,M,D),!M)continue;m-=M.length}if(m+M.length<D)E=this.$renderToken(b,E,S,M),m+=M.length;else{for(;m+M.length>=D;)E=this.$renderToken(b,E,S,M.substring(0,D-m)),M=M.substring(D-m),m=D,b=this.$createLineElement(),a.appendChild(b),b.appendChild(this.dom.createTextNode(d.stringRepeat(" ",f.indent),this.element)),y++,E=0,D=f[y]||Number.MAX_VALUE;M.length!=0&&(m+=M.length,E=this.$renderToken(b,E,S,M))}}f[f.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(b,E,null,"",!0)},l.prototype.$renderSimpleLine=function(a,c){for(var f=0,m=0;m<c.length;m++){var y=c[m],D=y.value;if(!(m==0&&this.displayIndentGuides&&(D=this.renderIndentGuide(a,D),!D))){if(f+D.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(a,f,y,D);f=this.$renderToken(a,f,y,D)}}},l.prototype.$renderOverflowMessage=function(a,c,f,m,y){f&&this.$renderToken(a,c,f,m.slice(0,this.MAX_LINE_LENGTH-c));var D=this.dom.createElement("span");D.className="ace_inline_button ace_keyword ace_toggle_wrap",D.textContent=y?"<hide>":"<click to see more...>",a.appendChild(D)},l.prototype.$renderLine=function(a,c,f){if(!f&&f!=!1&&(f=this.session.getFoldLine(c)),f)var m=this.$getFoldLineTokens(c,f);else var m=this.session.getTokens(c);var y=a;if(m.length){var D=this.session.getRowSplitData(c);if(D&&D.length){this.$renderWrappedLine(a,m,D);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&&(c=f.end.row);var E=this.dom.createElement("span");E.className="ace_invisible ace_invisible_eol",E.textContent=c==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,y.appendChild(E)}},l.prototype.$getFoldLineTokens=function(a,c){var f=this.session,m=[];function y(E,b,g){for(var S=0,M=0;M+E[S].value.length<b;)if(M+=E[S].value.length,S++,S==E.length)return;if(M!=b){var _=E[S].value.substring(b-M);_.length>g-b&&(_=_.substring(0,g-b)),m.push({type:E[S].type,value:_}),M=b+_.length,S+=1}for(;M<g&&S<E.length;){var _=E[S].value;_.length+M>g?m.push({type:E[S].type,value:_.substring(0,g-M)}):m.push(E[S]),M+=_.length,S+=1}}var D=f.getTokens(a);return c.walk(function(E,b,g,S,M){E!=null?m.push({type:"fold",value:E}):(M&&(D=f.getTokens(b)),D.length&&y(D,S,g))},c.end.row,this.session.getLine(c.end.row).length),m},l.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},l}();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),u.Text=r}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(i,u,v){var s=i("../lib/dom"),h=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 l=this.getPixelPosition(p[e].cursor,!0);if(!((l.top>o.height+o.offset||l.top<0)&&e>1)){var a=this.cursors[t++]||this.addCursor(),c=a.style;this.drawCursor?this.drawCursor(a,l,o,p[e],this.session):this.isCursorInView(l,o)?(s.setStyle(c,"display","block"),s.translate(a,l.left,l.top),s.setStyle(c,"width",Math.round(o.characterWidth)+"px"),s.setStyle(c,"height",o.lineHeight+"px")):s.setStyle(c,"display","none")}}for(;this.cursors.length>t;)this.removeCursor();var f=this.session.getOverwrite();this.$setOverwrite(f),this.$pixelPos=l,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}();h.prototype.$padding=0,h.prototype.drawCursor=null,u.Cursor=h}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(i,u,v){var s=this&&this.__extends||function(){var a=function(c,f){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,y){m.__proto__=y}||function(m,y){for(var D in y)Object.prototype.hasOwnProperty.call(y,D)&&(m[D]=y[D])},a(c,f)};return function(c,f){if(typeof f!="function"&&f!==null)throw new TypeError("Class extends value "+String(f)+" is not a constructor or null");a(c,f);function m(){this.constructor=c}c.prototype=f===null?Object.create(f):(m.prototype=f.prototype,new m)}}(),h=i("./lib/oop"),d=i("./lib/dom"),o=i("./lib/event"),p=i("./lib/event_emitter").EventEmitter,e=32768,t=function(){function a(c,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),c.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(c){this.element.style.display=c?"":"none",this.isVisible=c,this.coeff=1},a}();h.implement(t.prototype,p);var r=function(a){s(c,a);function c(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 c.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},c.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},c.prototype.setHeight=function(f){this.element.style.height=f+"px"},c.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"},c.prototype.setScrollTop=function(f){this.scrollTop!=f&&(this.skipEvent=!0,this.scrollTop=f,this.element.scrollTop=f*this.coeff)},c}(t);r.prototype.setInnerHeight=r.prototype.setScrollHeight;var l=function(a){s(c,a);function c(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 c.prototype.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},c.prototype.getHeight=function(){return this.isVisible?this.height:0},c.prototype.setWidth=function(f){this.element.style.width=f+"px"},c.prototype.setInnerWidth=function(f){this.inner.style.width=f+"px"},c.prototype.setScrollWidth=function(f){this.inner.style.width=f+"px"},c.prototype.setScrollLeft=function(f){this.scrollLeft!=f&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=f)},c}(t);u.ScrollBar=r,u.ScrollBarV=r,u.ScrollBarH=l,u.VScrollBar=r,u.HScrollBar=l}),ace.define("ace/scrollbar_custom",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(i,u,v){var s=this&&this.__extends||function(){var l=function(a,c){return l=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])},l(a,c)};return function(a,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");l(a,c);function f(){this.constructor=a}a.prototype=c===null?Object.create(c):(f.prototype=c.prototype,new f)}}(),h=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 pt,R as k}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 l(a,c){this.element=d.createElement("div"),this.element.className="ace_sb"+c,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,
|
|
268
|
+
}`,"ace_scrollbar.css",!1);var e=function(){function l(a,c){this.element=d.createElement("div"),this.element.className="ace_sb"+c,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 l.prototype.setVisible=function(a){this.element.style.display=a?"":"none",this.isVisible=a,this.coeff=1},l}();h.implement(e.prototype,p);var t=function(l){s(a,l);function a(c,f){var m=l.call(this,c,"-v")||this;return m.scrollTop=0,m.scrollHeight=0,m.parent=c,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(c,f){if(c==="mousedown"&&!(o.getButton(f)!==0||f.detail===2)){if(f.target===this.inner){var m=this,y=f.clientY,D=function(T){y=T.clientY},E=function(){clearInterval(M)},b=f.clientY,g=this.thumbTop,S=function(){if(y!==void 0){var T=m.scrollTopFromThumbTop(g+y-b);T!==m.scrollTop&&m._emit("scroll",{data:T})}};o.capture(this.inner,D,E);var M=setInterval(S,20);return o.preventDefault(f)}var _=f.clientY-this.element.getBoundingClientRect().top-this.thumbHeight/2;return this._emit("scroll",{data:this.scrollTopFromThumbTop(_)}),o.preventDefault(f)}},a.prototype.getHeight=function(){return this.height},a.prototype.scrollTopFromThumbTop=function(c){var f=c*(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(c){this.height=Math.max(0,c),this.slideHeight=this.height,this.viewHeight=this.height,this.setScrollHeight(this.pageHeight,!0)},a.prototype.setScrollHeight=function(c,f){this.pageHeight===c&&!f||(this.pageHeight=c,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(c){this.scrollTop=c,c<0&&(c=0),this.thumbTop=c*(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(l){s(a,l);function a(c,f){var m=l.call(this,c,"-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(c,f){if(c==="mousedown"&&!(o.getButton(f)!==0||f.detail===2)){if(f.target===this.inner){var m=this,y=f.clientX,D=function(T){y=T.clientX},E=function(){clearInterval(M)},b=f.clientX,g=this.thumbLeft,S=function(){if(y!==void 0){var T=m.scrollLeftFromThumbLeft(g+y-b);T!==m.scrollLeft&&m._emit("scroll",{data:T})}};o.capture(this.inner,D,E);var M=setInterval(S,20);return o.preventDefault(f)}var _=f.clientX-this.element.getBoundingClientRect().left-this.thumbWidth/2;return this._emit("scroll",{data:this.scrollLeftFromThumbLeft(_)}),o.preventDefault(f)}},a.prototype.getHeight=function(){return this.isVisible?this.height:0},a.prototype.scrollLeftFromThumbLeft=function(c){var f=c*(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(c){this.width=Math.max(0,c),this.element.style.width=this.width+"px",this.slideWidth=this.width,this.viewWidth=this.width,this.setScrollWidth(this.pageWidth,!0)},a.prototype.setScrollWidth=function(c,f){this.pageWidth===c&&!f||(this.pageWidth=c,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(c){this.scrollLeft=c,c<0&&(c=0),this.thumbLeft=c*(this.slideWidth-this.thumbWidth)/(this.pageWidth-this.viewWidth),this.inner.style.left=this.thumbLeft+"px"},a}(e);r.prototype.setInnerWidth=r.prototype.setScrollWidth,u.ScrollBar=t,u.ScrollBarV=t,u.ScrollBarH=r,u.VScrollBar=t,u.HScrollBar=r}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(i,u,v){var s=i("./lib/event"),h=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}();u.RenderLoop=h}),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,u,v){var s=i("../lib/oop"),h=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",l=200,a=function(){function c(f){this.el=h.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=h.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=h.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 c.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"},c.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})}},c.prototype.$addObserver=function(){var f=this;this.$observer=new window.ResizeObserver(function(m){f.checkForSizeChanges()}),this.$observer.observe(this.$measureNode)},c.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)},c.prototype.setPolling=function(f){f?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},c.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},c.prototype.$measureCharWidth=function(f){this.$main.textContent=d.stringRepeat(f,t);var m=this.$main.getBoundingClientRect();return m.width/t},c.prototype.getCharacterWidth=function(f){var m=this.charSizes[f];return m===void 0&&(m=this.charSizes[f]=this.$measureCharWidth(f)/this.$characterSize.width),m},c.prototype.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},c.prototype.$getZoom=function(f){return!f||!f.parentElement?1:(Number(window.getComputedStyle(f).zoom)||1)*this.$getZoom(f.parentElement)},c.prototype.$initTransformMeasureNodes=function(){var f=function(m,y){return["div",{style:"position: absolute;top:"+m+"px;left:"+y+"px;"}]};this.els=h.buildDom([f(0,0),f(l,0),f(0,l),f(l,l)],this.el)},c.prototype.transformCoordinates=function(f,m){if(f){var y=this.$getZoom(this.el);f=g(1/y,f)}function D(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 b(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 M=S(this.els[0]),_=S(this.els[1]),T=S(this.els[2]),F=S(this.els[3]),A=D(E(F,_),E(F,T),E(b(_,T),b(F,M))),$=g(1+A[0],E(_,M)),C=g(1+A[1],E(T,M));if(m){var w=m,x=A[0]*w[0]/l+A[1]*w[1]/l+1,I=b(g(w[0],$),g(w[1],C));return b(g(1/x/l,I),M)}var O=E(f,M),R=D(E($,g(A[0],O)),E(C,g(A[1],O)),O);return g(l,R)},c}();a.prototype.$characterSize={width:0,height:0},s.implement(a.prototype,e),u.FontMetrics=a}),ace.define("ace/css/editor-css",["require","exports","module"],function(i,u,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 pt,R as k}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,u,v){var o=i("../lib/dom"),h=i("../lib/oop"),d=i("../lib/event_emitter").EventEmitter,s=function(){function p(e,t){this.parentEl=e,this.canvas=o.createElement("canvas"),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.canvas.style.top="0px",this.canvas.style.right="0px",this.canvas.style.zIndex="7px",this.canvas.style.position="absolute",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.setDimensions(),e.element.appendChild(this.canvas)}return p.prototype.$updateDecorators=function(e){var t=this.renderer.theme.isDark===!0?this.colors.dark:this.colors.light;this.setDimensions(e);var r=this.canvas.getContext("2d");function l(_,T){return _.priority<T.priority?-1:_.priority>T.priority?1:0}var a=this.renderer.session.$annotations;if(r.clearRect(0,0,this.canvas.width,this.canvas.height),a){var c={info:1,warning:2,error:3};a.forEach(function(_){_.priority=c[_.type]||null}),a=a.sort(l);for(var f=0;f<a.length;f++){var m=a[f].row,y=this.compensateFoldRows(m),D=Math.round((m-y)*this.lineHeight*this.heightRatio),E=Math.round((m-y)*this.lineHeight*this.heightRatio),b=Math.round(((m-y)*this.lineHeight+this.lineHeight)*this.heightRatio),g=b-E;if(g<this.minDecorationHeight){var S=(E+b)/2|0;S<this.halfMinDecorationHeight?S=this.halfMinDecorationHeight:S+this.halfMinDecorationHeight>this.canvasHeight&&(S=this.canvasHeight-this.halfMinDecorationHeight),E=Math.round(S-this.halfMinDecorationHeight),b=Math.round(S+this.halfMinDecorationHeight)}r.fillStyle=t[a[f].type]||null,r.fillRect(0,D,this.canvasWidth,b-E)}}var M=this.renderer.session.selection.getCursor();if(M){var y=this.compensateFoldRows(M.row),D=Math.round((M.row-y)*this.lineHeight*this.heightRatio);r.fillStyle="rgba(0, 0, 0, 0.5)",r.fillRect(0,D,this.canvasWidth,2)}},p.prototype.compensateFoldRows=function(e){var t=this.renderer.session.$foldData,r=0;if(t&&t.length>0)for(var l=0;l<t.length;l++)e>t[l].start.row&&e<t[l].end.row?r+=e-t[l].start.row:e>=t[l].end.row&&(r+=t[l].end.row-t[l].start.row);return r},p.prototype.compensateLineWidgets=function(e){var t=this.renderer.session.widgetManager;if(t){var r=0;return t.lineWidgets.forEach(function(l,a){e>a&&(r+=l.rowCount||0)}),r-1}return 0},p.prototype.setDimensions=function(e){e?(this.maxHeight=e.maxHeight,this.lineHeight=e.lineHeight,this.canvasHeight=e.height,this.maxHeight<this.canvasHeight?this.heightRatio=1:this.heightRatio=this.canvasHeight/this.maxHeight):(this.canvasHeight=this.parentEl.parent.scrollHeight||this.canvasHeight,this.canvasWidth=this.parentEl.width||this.canvasWidth,this.heightRatio=this.canvasHeight/this.maxHeight,this.canvas.width=this.canvasWidth,this.canvas.height=this.canvasHeight)},p}();h.implement(s.prototype,d),u.Decorator=s}),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,u,v){var o=i("./lib/oop"),h=i("./lib/dom"),d=i("./lib/lang"),s=i("./config"),p=i("./layer/gutter").Gutter,e=i("./layer/marker").Marker,t=i("./layer/text").Text,r=i("./layer/cursor").Cursor,l=i("./scrollbar").HScrollBar,a=i("./scrollbar").VScrollBar,c=i("./scrollbar_custom").HScrollBar,f=i("./scrollbar_custom").VScrollBar,m=i("./renderloop").RenderLoop,y=i("./layer/font_metrics").FontMetrics,D=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;h.importCssString(E,"ace_editor.css",!1);var M=function(){function _(T,F){var A=this;this.container=T||h.createElement("div"),h.addCssClass(this.container,"ace_editor"),h.HI_DPI&&h.addCssClass(this.container,"ace_hidpi"),this.setTheme(F),s.get("useStrictCSP")==null&&s.set("useStrictCSP",!1),this.$gutter=h.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden","true"),this.scroller=h.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=h.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 l(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(),s.resetOptions(this),s._signal("renderer",this)}return _.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(),h.setStyle(this.scroller.style,"line-height",this.lineHeight+"px")},_.prototype.setSession=function(T){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=T,T&&this.scrollMargin.top&&T.getScrollTop()<=0&&T.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(T),this.$markerBack.setSession(T),this.$markerFront.setSession(T),this.$gutterLayer.setSession(T),this.$textLayer.setSession(T),T&&(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))},_.prototype.updateLines=function(T,F,A){if(F===void 0&&(F=1/0),this.$changedLines?(this.$changedLines.firstRow>T&&(this.$changedLines.firstRow=T),this.$changedLines.lastRow<F&&(this.$changedLines.lastRow=F)):this.$changedLines={firstRow:T,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)},_.prototype.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},_.prototype.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},_.prototype.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},_.prototype.updateFull=function(T){T?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},_.prototype.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},_.prototype.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},_.prototype.onResize=function(T,F,A,$){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=T?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 w=this.$updateCachedSize(T,F,A,$);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!A&&!$)return this.resizing=0;T&&(this.$gutterLayer.$padding=null),T?this.$renderChanges(w|this.$changes,!0):this.$loop.schedule(w|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.$customScrollbar&&this.$updateCustomScrollbar(!0)}},_.prototype.$updateCachedSize=function(T,F,A,$){$-=this.$extraHeight||0;var C=0,w=this.$size,x={width:w.width,height:w.height,scrollerHeight:w.scrollerHeight,scrollerWidth:w.scrollerWidth};if($&&(T||w.height!=$)&&(w.height=$,C|=this.CHANGE_SIZE,w.scrollerHeight=w.height,this.$horizScroll&&(w.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.setHeight(w.scrollerHeight),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",C=C|this.CHANGE_SCROLL),A&&(T||w.width!=A)){C|=this.CHANGE_SIZE,w.width=A,F==null&&(F=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=F,h.setStyle(this.scrollBarH.element.style,"left",F+"px"),h.setStyle(this.scroller.style,"left",F+this.margin.left+"px"),w.scrollerWidth=Math.max(0,A-F-this.scrollBarV.getWidth()-this.margin.h),h.setStyle(this.$gutter.style,"left",this.margin.left+"px");var I=this.scrollBarV.getWidth()+"px";h.setStyle(this.scrollBarH.element.style,"right",I),h.setStyle(this.scroller.style,"right",I),h.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(w.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||T)&&(C|=this.CHANGE_FULL)}return w.$dirty=!A||!$,C&&this._signal("resize",x),C},_.prototype.onGutterResize=function(T){var F=this.$showGutter?T: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()},_.prototype.adjustWrapLimit=function(){var T=this.$size.scrollerWidth-this.$padding*2,F=Math.floor(T/this.characterWidth);return this.session.adjustWrapLimit(F,this.$showPrintMargin&&this.$printMarginColumn)},_.prototype.setAnimatedScroll=function(T){this.setOption("animatedScroll",T)},_.prototype.getAnimatedScroll=function(){return this.$animatedScroll},_.prototype.setShowInvisibles=function(T){this.setOption("showInvisibles",T),this.session.$bidiHandler.setShowInvisibles(T)},_.prototype.getShowInvisibles=function(){return this.getOption("showInvisibles")},_.prototype.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},_.prototype.setDisplayIndentGuides=function(T){this.setOption("displayIndentGuides",T)},_.prototype.getHighlightIndentGuides=function(){return this.getOption("highlightIndentGuides")},_.prototype.setHighlightIndentGuides=function(T){this.setOption("highlightIndentGuides",T)},_.prototype.setShowPrintMargin=function(T){this.setOption("showPrintMargin",T)},_.prototype.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},_.prototype.setPrintMarginColumn=function(T){this.setOption("printMarginColumn",T)},_.prototype.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},_.prototype.getShowGutter=function(){return this.getOption("showGutter")},_.prototype.setShowGutter=function(T){return this.setOption("showGutter",T)},_.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},_.prototype.setFadeFoldWidgets=function(T){this.setOption("fadeFoldWidgets",T)},_.prototype.setHighlightGutterLine=function(T){this.setOption("highlightGutterLine",T)},_.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},_.prototype.$updatePrintMargin=function(){if(!(!this.$showPrintMargin&&!this.$printMarginEl)){if(!this.$printMarginEl){var T=h.createElement("div");T.className="ace_layer ace_print-margin-layer",this.$printMarginEl=h.createElement("div"),this.$printMarginEl.className="ace_print-margin",T.appendChild(this.$printMarginEl),this.content.insertBefore(T,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()}},_.prototype.getContainerElement=function(){return this.container},_.prototype.getMouseEventTarget=function(){return this.scroller},_.prototype.getTextAreaContainer=function(){return this.container},_.prototype.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var T=this.textarea.style,F=this.$composition;if(!this.$keepTextAreaAtCursor&&!F){h.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,w=A.left;C-=$.offset;var x=F&&F.useTextareaForIME||g.isMobile?this.lineHeight:1;if(C<0||C>$.height-x){h.translate(this.textarea,0,0);return}var I=1,R=this.$size.height-x;if(!F)C+=this.lineHeight;else if(F.useTextareaForIME){var O=this.textarea.value;I=this.characterWidth*this.session.$getStringScreenWidth(O)[0]}else C+=this.lineHeight+2;w-=this.scrollLeft,w>this.$size.scrollerWidth-I&&(w=this.$size.scrollerWidth-I),w+=this.gutterWidth+this.margin.left,h.setStyle(T,"height",x+"px"),h.setStyle(T,"width",I+"px"),h.translate(this.textarea,Math.min(w,this.$size.scrollerWidth-I),Math.min(C,R))}}},_.prototype.getFirstVisibleRow=function(){return this.layerConfig.firstRow},_.prototype.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},_.prototype.getLastFullyVisibleRow=function(){var T=this.layerConfig,F=T.lastRow,A=this.session.documentToScreenRow(F,0)*T.lineHeight;return A-this.session.getScrollTop()>T.height-T.lineHeight?F-1:F},_.prototype.getLastVisibleRow=function(){return this.layerConfig.lastRow},_.prototype.setPadding=function(T){this.$padding=T,this.$textLayer.setPadding(T),this.$cursorLayer.setPadding(T),this.$markerFront.setPadding(T),this.$markerBack.setPadding(T),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},_.prototype.setScrollMargin=function(T,F,A,$){var C=this.scrollMargin;C.top=T|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()},_.prototype.setMargin=function(T,F,A,$){var C=this.margin;C.top=T|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()},_.prototype.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},_.prototype.setHScrollBarAlwaysVisible=function(T){this.setOption("hScrollBarAlwaysVisible",T)},_.prototype.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},_.prototype.setVScrollBarAlwaysVisible=function(T){this.setOption("vScrollBarAlwaysVisible",T)},_.prototype.$updateScrollBarV=function(){var T=this.layerConfig.maxHeight,F=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(T-=(F-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>T-F&&(T=this.scrollTop+F,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(T+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},_.prototype.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},_.prototype.freeze=function(){this.$frozen=!0},_.prototype.unfreeze=function(){this.$frozen=!1},_.prototype.$renderChanges=function(T,F){if(this.$changes&&(T|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!T&&!F){this.$changes|=T;return}if(this.$size.$dirty)return this.$changes|=T,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",T),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var A=this.layerConfig;if(T&this.CHANGE_FULL||T&this.CHANGE_SIZE||T&this.CHANGE_TEXT||T&this.CHANGE_LINES||T&this.CHANGE_SCROLL||T&this.CHANGE_H_SCROLL){if(T|=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=$,T=T|this.CHANGE_SCROLL,T|=this.$computeLayerConfig()|this.$loop.clear())}A=this.layerConfig,this.$updateScrollBarV(),T&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),h.translate(this.content,-this.scrollLeft,-A.offset);var C=A.width+2*this.$padding+"px",w=A.minHeight+"px";h.setStyle(this.content.style,"width",C),h.setStyle(this.content.style,"height",w)}if(T&this.CHANGE_H_SCROLL&&(h.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)),T&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",T);return}if(T&this.CHANGE_SCROLL){this.$changedLines=null,T&this.CHANGE_TEXT||T&this.CHANGE_LINES?this.$textLayer.update(A):this.$textLayer.scrollLines(A),this.$showGutter&&(T&this.CHANGE_GUTTER||T&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",T);return}T&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(A),this.$showGutter&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)):T&this.CHANGE_LINES?((this.$updateLines()||T&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)):T&this.CHANGE_TEXT||T&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)):T&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)),T&this.CHANGE_CURSOR&&(this.$cursorLayer.update(A),this.$moveTextAreaToCursor()),T&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(A),T&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(A),this._signal("afterRender",T)},_.prototype.$autosize=function(){var T=this.session.getScreenLength()*this.lineHeight,F=this.$maxLines*this.lineHeight,A=Math.min(F,Math.max((this.$minLines||1)*this.lineHeight,T))+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=!$&&T>F;if(A!=this.desiredHeight||this.$size.height!=this.desiredHeight||C!=this.$vScroll){C!=this.$vScroll&&(this.$vScroll=C,this.scrollBarV.setVisible(C));var w=this.container.clientWidth;this.container.style.height=A+"px",this.$updateCachedSize(!0,this.$gutterWidth,w,A),this.desiredHeight=A,this._signal("autosize")}},_.prototype.$computeLayerConfig=function(){var T=this.session,F=this.$size,A=F.height<=2*this.lineHeight,$=this.session.getScreenLength(),C=$*this.lineHeight,w=this.$getLongestLine(),x=!A&&(this.$hScrollBarAlwaysVisible||F.scrollerWidth-w-2*this.$padding<0),I=this.$horizScroll!==x;I&&(this.$horizScroll=x,this.scrollBarH.setVisible(x));var R=this.$vScroll;this.$maxLines&&this.lineHeight>1&&(this.$autosize(),A=F.height<=2*this.lineHeight);var O=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,w+2*this.$padding-F.scrollerWidth+B.right)));var V=!A&&(this.$vScrollBarAlwaysVisible||F.scrollerHeight-C+P<0||this.scrollTop>B.top),W=R!==V;W&&(this.$vScroll=V,this.scrollBarV.setVisible(V));var H=this.scrollTop%this.lineHeight,U=Math.ceil(O/this.lineHeight)-1,G=Math.max(0,Math.round((this.scrollTop-H)/this.lineHeight)),Y=G+U,Q,ee,ne=this.lineHeight;G=T.screenToDocumentRow(G,0);var se=T.getFoldLine(G);se&&(G=se.start.row),Q=T.documentToScreenRow(G,0),ee=T.getRowLength(G)*ne,Y=Math.min(T.screenToDocumentRow(Y,0),T.getLength()-1),O=F.scrollerHeight+T.getRowLength(Y)*ne+ee,H=this.scrollTop-Q*ne,H<0&&Q>0&&(Q=Math.max(0,Q+Math.floor(H/ne)),H=this.scrollTop-Q*ne);var ge=0;return(this.layerConfig.width!=w||I)&&(ge=this.CHANGE_H_SCROLL),(I||W)&&(ge|=this.$updateCachedSize(!0,this.gutterWidth,F.width,F.height),this._signal("scrollbarVisibilityChanged"),W&&(w=this.$getLongestLine())),this.layerConfig={width:w,padding:this.$padding,firstRow:G,firstRowScreen:Q,lastRow:Y,lineHeight:ne,characterWidth:this.characterWidth,minHeight:O,maxHeight:C,offset:H,gutterOffset:ne?Math.max(0,Math.ceil((H+F.height-F.scrollerHeight)/ne)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(w-this.$padding),ge},_.prototype.$updateLines=function(){if(this.$changedLines){var T=this.$changedLines.firstRow,F=this.$changedLines.lastRow;this.$changedLines=null;var A=this.layerConfig;if(!(T>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,T,F),!0}}},_.prototype.$getLongestLine=function(){var T=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(T+=1),this.$textLayer&&T>this.$textLayer.MAX_LINE_LENGTH&&(T=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(T*this.characterWidth))},_.prototype.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},_.prototype.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},_.prototype.addGutterDecoration=function(T,F){this.$gutterLayer.addGutterDecoration(T,F)},_.prototype.removeGutterDecoration=function(T,F){this.$gutterLayer.removeGutterDecoration(T,F)},_.prototype.updateBreakpoints=function(T){this._rows=T,this.$loop.schedule(this.CHANGE_GUTTER)},_.prototype.setAnnotations=function(T){this.$gutterLayer.setAnnotations(T),this.$loop.schedule(this.CHANGE_GUTTER)},_.prototype.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},_.prototype.hideCursor=function(){this.$cursorLayer.hideCursor()},_.prototype.showCursor=function(){this.$cursorLayer.showCursor()},_.prototype.scrollSelectionIntoView=function(T,F,A){this.scrollCursorIntoView(T,A),this.scrollCursorIntoView(F,A)},_.prototype.scrollCursorIntoView=function(T,F,A){if(this.$size.scrollerHeight!==0){var $=this.$cursorLayer.getPixelPosition(T),C=$.left,w=$.top,x=A&&A.top||0,I=A&&A.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var R=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;R+x>w?(F&&R+x>w+this.lineHeight&&(w-=F*this.$size.scrollerHeight),w===0&&(w=-this.scrollMargin.top),this.session.setScrollTop(w)):R+this.$size.scrollerHeight-I<w+this.lineHeight&&(F&&R+this.$size.scrollerHeight-I<w-this.lineHeight&&(w+=F*this.$size.scrollerHeight),this.session.setScrollTop(w+this.lineHeight+I-this.$size.scrollerHeight));var O=this.scrollLeft,P=2*this.layerConfig.characterWidth;C-P<O?(C-=P,C<this.$padding+P&&(C=-this.scrollMargin.left),this.session.setScrollLeft(C)):(C+=P,O+this.$size.scrollerWidth<C+this.characterWidth?this.session.setScrollLeft(Math.round(C+this.characterWidth-this.$size.scrollerWidth)):O<=this.$padding&&C-O<this.characterWidth&&this.session.setScrollLeft(0))}},_.prototype.getScrollTop=function(){return this.session.getScrollTop()},_.prototype.getScrollLeft=function(){return this.session.getScrollLeft()},_.prototype.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},_.prototype.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},_.prototype.scrollToRow=function(T){this.session.setScrollTop(T*this.lineHeight)},_.prototype.alignCursor=function(T,F){typeof T=="number"&&(T={row:T,column:0});var A=this.$cursorLayer.getPixelPosition(T),$=this.$size.scrollerHeight-this.lineHeight,C=A.top-$*(F||0);return this.session.setScrollTop(C),C},_.prototype.$calcSteps=function(T,F){var A=0,$=this.STEPS,C=[],w=function(x,I,R){return R*(Math.pow(x-1,3)+1)+I};for(A=0;A<$;++A)C.push(w(A/this.STEPS,T,F-T));return C},_.prototype.scrollToLine=function(T,F,A,$){var C=this.$cursorLayer.getPixelPosition({row:T,column:0}),w=C.top;F&&(w-=this.$size.scrollerHeight/2);var x=this.scrollTop;this.session.setScrollTop(w),A!==!1&&this.animateScrolling(x,$)},_.prototype.animateScrolling=function(T,F){var A=this.scrollTop;if(!this.$animatedScroll)return;var $=this;if(T==A)return;if(this.$scrollAnimation){var C=this.$scrollAnimation.steps;if(C.length&&(T=C[0],T==A))return}var w=$.$calcSteps(T,A);this.$scrollAnimation={from:T,to:A,steps:w},clearInterval(this.$timer),$.session.setScrollTop(w.shift()),$.session.$scrollTop=A;function x(){$.$timer=clearInterval($.$timer),$.$scrollAnimation=null,$.$stopAnimation=!1,F&&F()}this.$timer=setInterval(function(){if($.$stopAnimation){x();return}if(!$.session)return clearInterval($.$timer);w.length?($.session.setScrollTop(w.shift()),$.session.$scrollTop=A):A!=null?($.session.$scrollTop=-1,$.session.setScrollTop(A),A=null):x()},10)},_.prototype.scrollToY=function(T){this.scrollTop!==T&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=T)},_.prototype.scrollToX=function(T){this.scrollLeft!==T&&(this.scrollLeft=T),this.$loop.schedule(this.CHANGE_H_SCROLL)},_.prototype.scrollTo=function(T,F){this.session.setScrollTop(F),this.session.setScrollLeft(T)},_.prototype.scrollBy=function(T,F){F&&this.session.setScrollTop(this.session.getScrollTop()+F),T&&this.session.setScrollLeft(this.session.getScrollLeft()+T)},_.prototype.isScrollableBy=function(T,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||T<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||T>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},_.prototype.pixelToScreenCoordinates=function(T,F){var A;if(this.$hasCssTransforms){A={top:0,left:0};var $=this.$fontMetrics.transformCoordinates([T,F]);T=$[1]-this.gutterWidth-this.margin.left,F=$[0]}else A=this.scroller.getBoundingClientRect();var C=T+this.scrollLeft-A.left-this.$padding,w=C/this.characterWidth,x=Math.floor((F+this.scrollTop-A.top)/this.lineHeight),I=this.$blockCursor?Math.floor(w):Math.round(w);return{row:x,column:I,side:w-I>0?1:-1,offsetX:C}},_.prototype.screenToTextCoordinates=function(T,F){var A;if(this.$hasCssTransforms){A={top:0,left:0};var $=this.$fontMetrics.transformCoordinates([T,F]);T=$[1]-this.gutterWidth-this.margin.left,F=$[0]}else A=this.scroller.getBoundingClientRect();var C=T+this.scrollLeft-A.left-this.$padding,w=C/this.characterWidth,x=this.$blockCursor?Math.floor(w):Math.round(w),I=Math.floor((F+this.scrollTop-A.top)/this.lineHeight);return this.session.screenToDocumentPosition(I,Math.max(x,0),C)},_.prototype.textToScreenCoordinates=function(T,F){var A=this.scroller.getBoundingClientRect(),$=this.session.documentToScreenPosition(T,F),C=this.$padding+(this.session.$bidiHandler.isBidiRow($.row,T)?this.session.$bidiHandler.getPosLeft($.column):Math.round($.column*this.characterWidth)),w=$.row*this.lineHeight;return{pageX:A.left+C-this.scrollLeft,pageY:A.top+w-this.scrollTop}},_.prototype.visualizeFocus=function(){h.addCssClass(this.container,"ace_focus")},_.prototype.visualizeBlur=function(){h.removeCssClass(this.container,"ace_focus")},_.prototype.showComposition=function(T){this.$composition=T,T.cssText||(T.cssText=this.textarea.style.cssText),T.useTextareaForIME==null&&(T.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(h.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):T.markerId=this.session.addMarker(T.markerRange,"ace_composition_marker","text")},_.prototype.setCompositionText=function(T){var F=this.session.selection.cursor;this.addToken(T,"composition_placeholder",F.row,F.column),this.$moveTextAreaToCursor()},_.prototype.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),h.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var T=this.session.selection.cursor;this.removeExtraToken(T.row,T.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},_.prototype.setGhostText=function(T,F){var A=this.session.selection.cursor,$=F||{row:A.row,column:A.column};this.removeGhostText();var C=this.$calculateWrappedTextChunks(T,$);this.addToken(C[0].text,"ghost_text",$.row,$.column),this.$ghostText={text:T,position:{row:$.row,column:$.column}};var w=h.createElement("div");if(C.length>1){var x=this.hideTokensAfterPosition($.row,$.column),I;C.slice(1).forEach(function(W){var H=h.createElement("div"),U=h.createElement("span");U.className="ace_ghost_text",W.wrapped&&(H.className="ghost_text_line_wrapped"),W.text.length===0&&(W.text=" "),U.appendChild(h.createTextNode(W.text)),H.appendChild(U),w.appendChild(H),I=H}),x.forEach(function(W){var H=h.createElement("span");S(W.type)||(H.className="ace_"+W.type.replace(/\./g," ace_")),H.appendChild(h.createTextNode(W.value)),I.appendChild(H)}),this.$ghostTextWidget={el:w,row:$.row,column:$.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var R=this.$cursorLayer.getPixelPosition($,!0),O=this.container,P=O.getBoundingClientRect().height,B=C.length*this.lineHeight,V=B<P-R.top;if(V)return;B<P?this.scrollBy(0,(C.length-1)*this.lineHeight):this.scrollToRow($.row)}},_.prototype.$calculateWrappedTextChunks=function(T,F){var A=this.$size.scrollerWidth-this.$padding*2,$=Math.floor(A/this.characterWidth)-2;$=$<=0?60:$;for(var C=T.split(/\r?\n/),w=[],x=0;x<C.length;x++){var I=this.session.$getDisplayTokens(C[x],F.column),R=this.session.$computeWrapSplits(I,$,this.session.$tabSize);if(R.length>0){var O=0;R.push(C[x].length);for(var P=0;P<R.length;P++){var B=C[x].slice(O,R[P]);w.push({text:B,wrapped:!0}),O=R[P]}}else w.push({text:C[x],wrapped:!1})}return w},_.prototype.removeGhostText=function(){if(this.$ghostText){var T=this.$ghostText.position;this.removeExtraToken(T.row,T.column),this.$ghostTextWidget&&(this.session.widgetManager.removeLineWidget(this.$ghostTextWidget),this.$ghostTextWidget=null),this.$ghostText=null}},_.prototype.addToken=function(T,F,A,$){var C=this.session;C.bgTokenizer.lines[A]=null;var w={type:F,value:T},x=C.getTokens(A);if($==null||!x.length)x.push(w);else for(var I=0,R=0;R<x.length;R++){var O=x[R];if(I+=O.value.length,$<=I){var P=O.value.length-(I-$),B=O.value.slice(0,P),V=O.value.slice(P);x.splice(R,1,{type:O.type,value:B},w,{type:O.type,value:V});break}}this.updateLines(A,A)},_.prototype.hideTokensAfterPosition=function(T,F){for(var A=this.session.getTokens(T),$=0,C=!1,w=[],x=0;x<A.length;x++){var I=A[x];if($+=I.value.length,I.type!=="ghost_text"){if(C){w.push({type:I.type,value:I.value}),I.type="hidden_token";continue}$===F&&(C=!0)}}return this.updateLines(T,T),w},_.prototype.removeExtraToken=function(T,F){this.session.bgTokenizer.lines[T]=null,this.updateLines(T,T)},_.prototype.setTheme=function(T,F){var A=this;if(this.$themeId=T,A._dispatchEvent("themeChange",{theme:T}),!T||typeof T=="string"){var $=T||this.$options.theme.initialValue;s.loadModule(["theme",$],C)}else C(T);function C(w){if(A.$themeId!=T)return F&&F();if(!w||!w.cssClass)throw new Error("couldn't load module "+T+" or it didn't call define");w.$id&&(A.$themeId=w.$id),h.importCssString(w.cssText,w.cssClass,A.container),A.theme&&h.removeCssClass(A.container,A.theme.cssClass);var x="padding"in w?w.padding:"padding"in(A.theme||{})?4:A.$padding;A.$padding&&x!=A.$padding&&A.setPadding(x),A.$theme=w.cssClass,A.theme=w,h.addCssClass(A.container,w.cssClass),h.setCssClass(A.container,"ace_dark",w.isDark),A.$size&&(A.$size.width=0,A.$updateSizeAsync()),A._dispatchEvent("themeLoaded",{theme:w}),F&&F(),g.isSafari&&A.scroller&&(A.scroller.style.background="red",A.scroller.style.background="")}},_.prototype.getTheme=function(){return this.$themeId},_.prototype.setStyle=function(T,F){h.setCssClass(this.container,T,F!==!1)},_.prototype.unsetStyle=function(T){h.removeCssClass(this.container,T)},_.prototype.setCursorStyle=function(T){h.setStyle(this.scroller.style,"cursor",T)},_.prototype.setMouseCursor=function(T){h.setStyle(this.scroller.style,"cursor",T)},_.prototype.attachToShadowRoot=function(){h.importCssString(E,"ace_editor.css",this.container)},_.prototype.destroy=function(){this.freeze(),this.$fontMetrics.destroy(),this.$cursorLayer.destroy(),this.removeAllListeners(),this.container.textContent="",this.setOption("useResizeObserver",!1)},_.prototype.$updateCustomScrollbar=function(T){var F=this;this.$horizScroll=this.$vScroll=null,this.scrollBarV.element.remove(),this.scrollBarH.element.remove(),this.$scrollDecorator&&delete this.$scrollDecorator,T===!0?(this.scrollBarV=new f(this.container,this),this.scrollBarH=new c(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=new b(this.scrollBarV,this),this.$scrollDecorator.$updateDecorators()):(this.scrollBarV=new a(this.container,this),this.scrollBarH=new l(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)}))},_.prototype.$addResizeObserver=function(){if(!(!window.ResizeObserver||this.$resizeObserver)){var T=this;this.$resizeTimer=d.delayedCall(function(){T.destroyed||T.onResize()},50),this.$resizeObserver=new window.ResizeObserver(function(F){var A=F[0].contentRect.width,$=F[0].contentRect.height;Math.abs(T.$size.width-A)>1||Math.abs(T.$size.height-$)>1?T.$resizeTimer.delay():T.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},_}();M.prototype.CHANGE_CURSOR=1,M.prototype.CHANGE_MARKER=2,M.prototype.CHANGE_GUTTER=4,M.prototype.CHANGE_SCROLL=8,M.prototype.CHANGE_LINES=16,M.prototype.CHANGE_TEXT=32,M.prototype.CHANGE_SIZE=64,M.prototype.CHANGE_MARKER_BACK=128,M.prototype.CHANGE_MARKER_FRONT=256,M.prototype.CHANGE_FULL=512,M.prototype.CHANGE_H_SCROLL=1024,M.prototype.$changes=0,M.prototype.$padding=null,M.prototype.$frozen=!1,M.prototype.STEPS=8,o.implement(M.prototype,D),s.defineOptions(M.prototype,"renderer",{useResizeObserver:{set:function(_){!_&&this.$resizeObserver?(this.$resizeObserver.disconnect(),this.$resizeTimer.cancel(),this.$resizeTimer=this.$resizeObserver=null):_&&!this.$resizeObserver&&this.$addResizeObserver()}},animatedScroll:{initialValue:!1},showInvisibles:{set:function(_){this.$textLayer.setShowInvisibles(_)&&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(_){typeof _=="number"&&(this.$printMarginColumn=_),this.$showPrintMargin=!!_,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(_){this.$gutter.style.display=_?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},useSvgGutterIcons:{set:function(_){this.$gutterLayer.$useSvgGutterIcons=_},initialValue:!1},showFoldedAnnotations:{set:function(_){this.$gutterLayer.$showFoldedAnnotations=_},initialValue:!1},fadeFoldWidgets:{set:function(_){h.setCssClass(this.$gutter,"ace_fade-fold-widgets",_)},initialValue:!1},showFoldWidgets:{set:function(_){this.$gutterLayer.setShowFoldWidgets(_),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(_){this.$textLayer.setDisplayIndentGuides(_)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightIndentGuides:{set:function(_){this.$textLayer.setHighlightIndentGuides(_)==!0?this.$textLayer.$highlightIndentGuide():this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells)},initialValue:!0},highlightGutterLine:{set:function(_){this.$gutterLayer.setHighlightGutterLine(_),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(_){(!this.$hScrollBarAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(_){(!this.$vScrollBarAlwaysVisible||!this.$vScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(_){typeof _=="number"&&(_=_+"px"),this.container.style.fontSize=_,this.updateFontSize()},initialValue:12},fontFamily:{set:function(_){this.container.style.fontFamily=_,this.updateFontSize()}},maxLines:{set:function(_){this.updateFull()}},minLines:{set:function(_){this.$minLines<562949953421311||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(_){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(_){_=+_||0,this.$scrollPastEnd!=_&&(this.$scrollPastEnd=_,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(_){this.$gutterLayer.$fixedWidth=!!_,this.$loop.schedule(this.CHANGE_GUTTER)}},customScrollbar:{set:function(_){this.$updateCustomScrollbar(_)},initialValue:!1},theme:{set:function(_){this.setTheme(_)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!g.isMobile&&!g.isIE}}),u.VirtualRenderer=M}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(i,u,v){var o=i("../lib/oop"),h=i("../lib/net"),d=i("../lib/event_emitter").EventEmitter,s=i("../config");function p(l){var a="importScripts('"+h.qualifyURL(l)+"');";try{return new Blob([a],{type:"application/javascript"})}catch{var c=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,f=new c;return f.append(a),f.getBlob("application/javascript")}}function e(l){if(typeof Worker>"u")return{postMessage:function(){},terminate:function(){}};if(s.get("loadWorkerFromBlob")){var a=p(l),c=window.URL||window.webkitURL,f=c.createObjectURL(a);return new Worker(f)}return new Worker(l)}var t=function(l){l.postMessage||(l=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=l,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(){o.implement(this,d),this.$createWorkerFromOldConfig=function(l,a,c,f,m){if(i.nameToUrl&&!i.toUrl&&(i.toUrl=i.nameToUrl),s.get("packaged")||!i.toUrl)f=f||s.moduleUrl(a,"worker");else{var y=this.$normalizePath;f=f||y(i.toUrl("ace/worker/worker.js",null,"_"));var D={};l.forEach(function(E){D[E]=y(i.toUrl(E,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=e(f),m&&this.send("importScripts",m),this.$worker.postMessage({init:!0,tlns:D,module:a,classname:c}),this.$worker},this.onMessage=function(l){var a=l.data;switch(a.type){case"event":this._signal(a.name,{data:a.data});break;case"call":var c=this.callbacks[a.id];c&&(c(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(l){window.console&&console.error&&console.error(l)},this.$normalizePath=function(l){return h.qualifyURL(l)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker.onerror=function(l){l.preventDefault()},this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(l,a){this.$worker.postMessage({command:l,args:a})},this.call=function(l,a,c){if(c){var f=this.callbackId++;this.callbacks[f]=c,a.push(f)}this.send(l,a)},this.emit=function(l,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:l,data:{data:a.data}})}catch(c){console.error(c.stack)}},this.attachToDocument=function(l){this.$doc&&this.terminate(),this.$doc=l,this.call("setValue",[l.getValue()]),l.on("change",this.changeListener,!0)},this.changeListener=function(l){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),l.action=="insert"?this.deltaQueue.push(l.start,l.lines):this.deltaQueue.push(l.start,l.end)},this.$sendDeltaQueue=function(){var l=this.deltaQueue;l&&(this.deltaQueue=null,l.length>50&&l.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:l}))}}).call(t.prototype);var r=function(l,a,c){var f=null,m=!1,y=Object.create(d),D=[],E=new t({messageBuffer:D,terminate:function(){},postMessage:function(g){D.push(g),f&&(m?setTimeout(b):b())}});E.setEmitSync=function(g){m=g};var b=function(){var g=D.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})},s.loadModule(["worker",a],function(g){for(f=new g[c](y);D.length;)b()}),E};u.UIWorkerClient=r,u.WorkerClient=t,u.createWorker=e}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(i,u,v){var o=i("./range").Range,h=i("./lib/event_emitter").EventEmitter,d=i("./lib/oop"),s=function(){function p(e,t,r,l,a,c){var f=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=a,this.othersClass=c,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=l,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 l=this.pos;l.$insertRight=!0,l.detach(),l.markerId=r.addMarker(new o(l.row,l.column,l.row,l.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(a){var c=t.createAnchor(a.row,a.column);c.$insertRight=!0,c.detach(),e.others.push(c)}),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 o(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,l=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),l&&(this.length+=r),l&&!this.session.$fromUndo){if(e.action==="insert")for(var c=this.others.length-1;c>=0;c--){var f=this.others[c],m={row:f.row,column:f.column+a};this.doc.insertMergedLines(m,e.lines)}else if(e.action==="remove")for(var c=this.others.length-1;c>=0;c--){var f=this.others[c],m={row:f.row,column:f.column+a};this.doc.remove(new o(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,c){t.removeMarker(a.markerId),a.markerId=t.addMarker(new o(a.row,a.column,a.row,a.column+e.length),c,null,!1)};r(this.pos,this.mainClass);for(var l=this.others.length;l--;)r(this.others[l],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(s.prototype,h),u.PlaceHolder=s}),ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(i,u,v){var o=i("../lib/event"),h=i("../lib/useragent");function d(p,e){return p.row==e.row&&p.column==e.column}function s(p){var e=p.domEvent,t=e.altKey,r=e.shiftKey,l=e.ctrlKey,a=p.getAccelKey(),c=p.getButton();if(l&&h.isMac&&(c=e.button),p.editor.inMultiSelectMode&&c==2){p.editor.textInput.onContextMenu(p.domEvent);return}if(!l&&!t&&!a){c===0&&p.editor.inMultiSelectMode&&p.editor.exitMultiSelectMode();return}if(c===0){var f=p.editor,m=f.selection,y=f.inMultiSelectMode,D=p.getDocumentPosition(),E=m.getCursor(),b=p.inSelection()||m.isEmpty()&&d(D,E),g=p.x,S=p.y,M=function(B){g=B.clientX,S=B.clientY},_=f.session,T=f.renderer.pixelToScreenCoordinates(g,S),F=T,A;if(f.$mouseHandler.$enableJumpToDef)l&&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&&h.isMac&&e.ctrlKey&&f.$mouseHandler.cancelContextMenu(),A=="add"){if(!y&&b)return;if(!y){var $=m.toOrientedRange();f.addSelectionMarker($)}var C=m.rangeList.rangeAtPoint(D);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 w,x=[],I=function(){var B=f.renderer.pixelToScreenCoordinates(g,S),V=_.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(x),x=m.rectangularRangeBlock(F,T),f.$mouseHandler.$clickSelection&&x.length==1&&x[0].isEmpty()&&(x[0]=f.$mouseHandler.$clickSelection.clone()),x.forEach(f.addSelectionMarker,f),f.updateSelectionMarkers())};y&&!a?m.toSingleRange():!y&&a&&(w=m.toOrientedRange(),f.addSelectionMarker(w)),r?T=_.documentToScreenPosition(m.lead):m.moveToPosition(D),F={row:-1,column:-1};var R=function(B){I(),clearInterval(P),f.removeSelectionMarkers(x),x.length||(x=[m.toOrientedRange()]),w&&(f.removeSelectionMarker(w),m.toSingleRange(w));for(var V=0;V<x.length;V++)m.addRange(x[V]);f.inVirtualSelectionMode=!1,f.$mouseHandler.$clickSelection=null},O=I;o.capture(f.container,M,R);var P=setInterval(function(){O()},20);return p.preventDefault()}}}u.onMouseDown=s}),ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(i,u,v){u.defaultCommands=[{name:"addCursorAbove",description:"Add cursor above",exec:function(h){h.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",description:"Add cursor below",exec:function(h){h.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(h){h.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(h){h.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(h){h.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",description:"Select more after",exec:function(h){h.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",description:"Select next before",exec:function(h){h.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(h){h.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(h){h.multiSelect.rangeCount>1?h.multiSelect.joinSelections():h.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(h){h.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(h){h.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(h){h.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],u.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(h){h.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(h){return h&&h.inMultiSelectMode}}];var o=i("../keyboard/hash_handler").HashHandler;u.keyboardHandler=new o(u.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,u,v){var o=i("./range_list").RangeList,h=i("./range").Range,d=i("./selection").Selection,s=i("./mouse/multi_select_handler").onMouseDown,p=i("./lib/event"),e=i("./lib/lang"),t=i("./commands/multi_select_commands");u.commands=t.defaultCommands.concat(t.multiSelectCommands);var r=i("./search").Search,l=new r;function a(E,b,g){return l.$options.wrap=!0,l.$options.needle=b,l.$options.backwards=g==-1,l.find(E)}var c=i("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(c.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 o,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],M=S.start.row,_=S.end.row;if(M===_)b.push(S.clone());else{for(b.push(new h(M,S.start.column,M,this.session.getLine(M).length));++M<_;)b.push(this.getLineRange(M,!0));b.push(new h(_,0,_,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=h.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=h.fromPoints(E[0].start,b.end);this.toSingleRange(),this.setSelectionRange(g,b.cursor==b.start)}else{var S=this.session.documentToScreenPosition(this.cursor),M=this.session.documentToScreenPosition(this.anchor),_=this.rectangularRangeBlock(S,M);_.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(E,b,g){var S=[],M=E.column<b.column;if(M)var _=E.column,T=b.column,F=E.offsetX,A=b.offsetX;else var _=b.column,T=E.column,F=b.offsetX,A=E.offsetX;var $=E.row<b.row;if($)var C=E.row,w=b.row;else var C=b.row,w=E.row;_<0&&(_=0),C<0&&(C=0),C==w&&(g=!0);for(var x,I=C;I<=w;I++){var R=h.fromPoints(this.session.screenToDocumentPosition(I,_,F),this.session.screenToDocumentPosition(I,T,A));if(R.isEmpty()){if(x&&m(R.end,x))break;x=R.end}R.cursor=M?R.start:R.end,S.push(R)}if($&&S.reverse(),!g){for(var O=S.length-1;S[O].isEmpty()&&O>0;)O--;if(O>0)for(var P=0;S[P].isEmpty();)P++;for(var B=O;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 M=b.indexOf(S);M!=-1&&b.splice(M,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,M=g==!0||g&&g.$byLines,_=this.session,T=this.selection,F=T.rangeList,A=(S?T:F).ranges,$;if(!A.length)return E.exec?E.exec(this,b||{}):E(this,b||{});var C=T._eventRegistry;T._eventRegistry={};var w=new d(_);this.inVirtualSelectionMode=!0;for(var x=A.length;x--;){if(M)for(;x>0&&A[x].start.row==A[x-1].end.row;)x--;w.fromOrientedRange(A[x]),w.index=x,this.selection=_.selection=w;var I=E.exec?E.exec(this,b||{}):E(this,b||{});!$&&I!==void 0&&($=I),w.toOrientedRange(A[x])}w.detach(),this.selection=_.selection=T,this.inVirtualSelectionMode=!1,T._eventRegistry=C,T.mergeOverlappingRanges(),T.ranges[0]&&T.fromOrientedRange(T.ranges[0]);var R=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),R&&R.from==R.to&&this.renderer.animateScrolling(R.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 M=this.session.getDocument().getNewLineCharacter();E=g.join(M),E.length==(g.length-1)*M.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 M=this.$search.findAll(this.session);if(!M.length)return 0;var _=this.multiSelect;g||_.toSingleRange(M[0]);for(var T=M.length;T--;)_.addRange(M[T],!0);return S&&_.rangeList.rangeAtPoint(S.start)&&_.addRange(S,!0),M.length},this.selectMoreLines=function(E,b){var g=this.selection.toOrientedRange(),S=g.cursor==g.end,M=this.session.documentToScreenPosition(g.cursor);this.selection.$desiredColumn&&(M.column=this.selection.$desiredColumn);var _=this.session.screenToDocumentPosition(M.row+E,M.column);if(g.isEmpty())var F=_;else var T=this.session.documentToScreenPosition(S?g.end:g.start),F=this.session.screenToDocumentPosition(T.row+E,T.column);if(S){var A=h.fromPoints(_,F);A.cursor=A.start}else{var A=h.fromPoints(F,_);A.cursor=A.end}if(A.desiredColumn=M.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,M=S.length;M--;){var _=S[M];if(_.isEmpty()){var T=b.getWordRange(_.start.row,_.start.column);_.start.row=T.start.row,_.start.column=T.start.column,_.end.row=T.end.row,_.end.column=T.end.column}}g.mergeOverlappingRanges();for(var F=[],M=S.length;M--;){var _=S[M];F.unshift(b.getTextRange(_))}E<0?F.unshift(F.pop()):F.push(F.shift());for(var M=S.length;M--;){var _=S[M],A=_.clone();b.replace(_,F[M]),_.start.row=A.start.row,_.start.column=A.start.column}g.fromOrientedRange(g.ranges[0])},this.selectMore=function(E,b,g){var S=this.session,M=S.multiSelect,_=M.toOrientedRange();if(!(_.isEmpty()&&(_=S.getWordRange(_.start.row,_.start.column),_.cursor=E==-1?_.start:_.end,this.multiSelect.addRange(_),g))){var T=S.getTextRange(_),F=a(S,T,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(_.cursor)}},this.alignCursors=function(){var E=this.session,b=E.multiSelect,g=b.ranges,S=-1,M=g.filter(function(O){if(O.cursor.row==S)return!0;S=O.cursor.row});if(!g.length||M.length==g.length-1){var _=this.selection.getRange(),T=_.start.row,F=_.end.row,A=T==F;if(A){var $=this.session.getLength(),C;do C=this.session.getLine(F);while(/[=:]/.test(C)&&++F<$);do C=this.session.getLine(T);while(/[=:]/.test(C)&&--T>0);T<0&&(T=0),F>=$&&(F=$-1)}var w=this.session.removeFullLines(T,F);w=this.$reAlignText(w,A),this.session.insert({row:T,column:0},w.join(`
|
|
964
|
+
}`}),ace.define("ace/layer/decorators",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter"],function(i,u,v){var s=i("../lib/dom"),h=i("../lib/oop"),d=i("../lib/event_emitter").EventEmitter,o=function(){function p(e,t){this.parentEl=e,this.canvas=s.createElement("canvas"),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.canvas.style.top="0px",this.canvas.style.right="0px",this.canvas.style.zIndex="7px",this.canvas.style.position="absolute",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.setDimensions(),e.element.appendChild(this.canvas)}return p.prototype.$updateDecorators=function(e){var t=this.renderer.theme.isDark===!0?this.colors.dark:this.colors.light;this.setDimensions(e);var r=this.canvas.getContext("2d");function l(_,T){return _.priority<T.priority?-1:_.priority>T.priority?1:0}var a=this.renderer.session.$annotations;if(r.clearRect(0,0,this.canvas.width,this.canvas.height),a){var c={info:1,warning:2,error:3};a.forEach(function(_){_.priority=c[_.type]||null}),a=a.sort(l);for(var f=0;f<a.length;f++){var m=a[f].row,y=this.compensateFoldRows(m),D=Math.round((m-y)*this.lineHeight*this.heightRatio),E=Math.round((m-y)*this.lineHeight*this.heightRatio),b=Math.round(((m-y)*this.lineHeight+this.lineHeight)*this.heightRatio),g=b-E;if(g<this.minDecorationHeight){var S=(E+b)/2|0;S<this.halfMinDecorationHeight?S=this.halfMinDecorationHeight:S+this.halfMinDecorationHeight>this.canvasHeight&&(S=this.canvasHeight-this.halfMinDecorationHeight),E=Math.round(S-this.halfMinDecorationHeight),b=Math.round(S+this.halfMinDecorationHeight)}r.fillStyle=t[a[f].type]||null,r.fillRect(0,D,this.canvasWidth,b-E)}}var M=this.renderer.session.selection.getCursor();if(M){var y=this.compensateFoldRows(M.row),D=Math.round((M.row-y)*this.lineHeight*this.heightRatio);r.fillStyle="rgba(0, 0, 0, 0.5)",r.fillRect(0,D,this.canvasWidth,2)}},p.prototype.compensateFoldRows=function(e){var t=this.renderer.session.$foldData,r=0;if(t&&t.length>0)for(var l=0;l<t.length;l++)e>t[l].start.row&&e<t[l].end.row?r+=e-t[l].start.row:e>=t[l].end.row&&(r+=t[l].end.row-t[l].start.row);return r},p.prototype.compensateLineWidgets=function(e){var t=this.renderer.session.widgetManager;if(t){var r=0;return t.lineWidgets.forEach(function(l,a){e>a&&(r+=l.rowCount||0)}),r-1}return 0},p.prototype.setDimensions=function(e){e?(this.maxHeight=e.maxHeight,this.lineHeight=e.lineHeight,this.canvasHeight=e.height,this.maxHeight<this.canvasHeight?this.heightRatio=1:this.heightRatio=this.canvasHeight/this.maxHeight):(this.canvasHeight=this.parentEl.parent.scrollHeight||this.canvasHeight,this.canvasWidth=this.parentEl.width||this.canvasWidth,this.heightRatio=this.canvasHeight/this.maxHeight,this.canvas.width=this.canvasWidth,this.canvas.height=this.canvasHeight)},p}();h.implement(o.prototype,d),u.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,u,v){var s=i("./lib/oop"),h=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,l=i("./scrollbar").HScrollBar,a=i("./scrollbar").VScrollBar,c=i("./scrollbar_custom").HScrollBar,f=i("./scrollbar_custom").VScrollBar,m=i("./renderloop").RenderLoop,y=i("./layer/font_metrics").FontMetrics,D=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;h.importCssString(E,"ace_editor.css",!1);var M=function(){function _(T,F){var A=this;this.container=T||h.createElement("div"),h.addCssClass(this.container,"ace_editor"),h.HI_DPI&&h.addCssClass(this.container,"ace_hidpi"),this.setTheme(F),o.get("useStrictCSP")==null&&o.set("useStrictCSP",!1),this.$gutter=h.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden","true"),this.scroller=h.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=h.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 l(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 _.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(),h.setStyle(this.scroller.style,"line-height",this.lineHeight+"px")},_.prototype.setSession=function(T){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=T,T&&this.scrollMargin.top&&T.getScrollTop()<=0&&T.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(T),this.$markerBack.setSession(T),this.$markerFront.setSession(T),this.$gutterLayer.setSession(T),this.$textLayer.setSession(T),T&&(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))},_.prototype.updateLines=function(T,F,A){if(F===void 0&&(F=1/0),this.$changedLines?(this.$changedLines.firstRow>T&&(this.$changedLines.firstRow=T),this.$changedLines.lastRow<F&&(this.$changedLines.lastRow=F)):this.$changedLines={firstRow:T,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)},_.prototype.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},_.prototype.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},_.prototype.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},_.prototype.updateFull=function(T){T?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},_.prototype.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},_.prototype.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},_.prototype.onResize=function(T,F,A,$){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=T?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 w=this.$updateCachedSize(T,F,A,$);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!A&&!$)return this.resizing=0;T&&(this.$gutterLayer.$padding=null),T?this.$renderChanges(w|this.$changes,!0):this.$loop.schedule(w|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.$customScrollbar&&this.$updateCustomScrollbar(!0)}},_.prototype.$updateCachedSize=function(T,F,A,$){$-=this.$extraHeight||0;var C=0,w=this.$size,x={width:w.width,height:w.height,scrollerHeight:w.scrollerHeight,scrollerWidth:w.scrollerWidth};if($&&(T||w.height!=$)&&(w.height=$,C|=this.CHANGE_SIZE,w.scrollerHeight=w.height,this.$horizScroll&&(w.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.setHeight(w.scrollerHeight),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",C=C|this.CHANGE_SCROLL),A&&(T||w.width!=A)){C|=this.CHANGE_SIZE,w.width=A,F==null&&(F=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=F,h.setStyle(this.scrollBarH.element.style,"left",F+"px"),h.setStyle(this.scroller.style,"left",F+this.margin.left+"px"),w.scrollerWidth=Math.max(0,A-F-this.scrollBarV.getWidth()-this.margin.h),h.setStyle(this.$gutter.style,"left",this.margin.left+"px");var I=this.scrollBarV.getWidth()+"px";h.setStyle(this.scrollBarH.element.style,"right",I),h.setStyle(this.scroller.style,"right",I),h.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(w.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||T)&&(C|=this.CHANGE_FULL)}return w.$dirty=!A||!$,C&&this._signal("resize",x),C},_.prototype.onGutterResize=function(T){var F=this.$showGutter?T: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()},_.prototype.adjustWrapLimit=function(){var T=this.$size.scrollerWidth-this.$padding*2,F=Math.floor(T/this.characterWidth);return this.session.adjustWrapLimit(F,this.$showPrintMargin&&this.$printMarginColumn)},_.prototype.setAnimatedScroll=function(T){this.setOption("animatedScroll",T)},_.prototype.getAnimatedScroll=function(){return this.$animatedScroll},_.prototype.setShowInvisibles=function(T){this.setOption("showInvisibles",T),this.session.$bidiHandler.setShowInvisibles(T)},_.prototype.getShowInvisibles=function(){return this.getOption("showInvisibles")},_.prototype.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},_.prototype.setDisplayIndentGuides=function(T){this.setOption("displayIndentGuides",T)},_.prototype.getHighlightIndentGuides=function(){return this.getOption("highlightIndentGuides")},_.prototype.setHighlightIndentGuides=function(T){this.setOption("highlightIndentGuides",T)},_.prototype.setShowPrintMargin=function(T){this.setOption("showPrintMargin",T)},_.prototype.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},_.prototype.setPrintMarginColumn=function(T){this.setOption("printMarginColumn",T)},_.prototype.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},_.prototype.getShowGutter=function(){return this.getOption("showGutter")},_.prototype.setShowGutter=function(T){return this.setOption("showGutter",T)},_.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},_.prototype.setFadeFoldWidgets=function(T){this.setOption("fadeFoldWidgets",T)},_.prototype.setHighlightGutterLine=function(T){this.setOption("highlightGutterLine",T)},_.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},_.prototype.$updatePrintMargin=function(){if(!(!this.$showPrintMargin&&!this.$printMarginEl)){if(!this.$printMarginEl){var T=h.createElement("div");T.className="ace_layer ace_print-margin-layer",this.$printMarginEl=h.createElement("div"),this.$printMarginEl.className="ace_print-margin",T.appendChild(this.$printMarginEl),this.content.insertBefore(T,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()}},_.prototype.getContainerElement=function(){return this.container},_.prototype.getMouseEventTarget=function(){return this.scroller},_.prototype.getTextAreaContainer=function(){return this.container},_.prototype.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var T=this.textarea.style,F=this.$composition;if(!this.$keepTextAreaAtCursor&&!F){h.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,w=A.left;C-=$.offset;var x=F&&F.useTextareaForIME||g.isMobile?this.lineHeight:1;if(C<0||C>$.height-x){h.translate(this.textarea,0,0);return}var I=1,O=this.$size.height-x;if(!F)C+=this.lineHeight;else if(F.useTextareaForIME){var R=this.textarea.value;I=this.characterWidth*this.session.$getStringScreenWidth(R)[0]}else C+=this.lineHeight+2;w-=this.scrollLeft,w>this.$size.scrollerWidth-I&&(w=this.$size.scrollerWidth-I),w+=this.gutterWidth+this.margin.left,h.setStyle(T,"height",x+"px"),h.setStyle(T,"width",I+"px"),h.translate(this.textarea,Math.min(w,this.$size.scrollerWidth-I),Math.min(C,O))}}},_.prototype.getFirstVisibleRow=function(){return this.layerConfig.firstRow},_.prototype.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},_.prototype.getLastFullyVisibleRow=function(){var T=this.layerConfig,F=T.lastRow,A=this.session.documentToScreenRow(F,0)*T.lineHeight;return A-this.session.getScrollTop()>T.height-T.lineHeight?F-1:F},_.prototype.getLastVisibleRow=function(){return this.layerConfig.lastRow},_.prototype.setPadding=function(T){this.$padding=T,this.$textLayer.setPadding(T),this.$cursorLayer.setPadding(T),this.$markerFront.setPadding(T),this.$markerBack.setPadding(T),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},_.prototype.setScrollMargin=function(T,F,A,$){var C=this.scrollMargin;C.top=T|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()},_.prototype.setMargin=function(T,F,A,$){var C=this.margin;C.top=T|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()},_.prototype.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},_.prototype.setHScrollBarAlwaysVisible=function(T){this.setOption("hScrollBarAlwaysVisible",T)},_.prototype.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},_.prototype.setVScrollBarAlwaysVisible=function(T){this.setOption("vScrollBarAlwaysVisible",T)},_.prototype.$updateScrollBarV=function(){var T=this.layerConfig.maxHeight,F=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(T-=(F-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>T-F&&(T=this.scrollTop+F,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(T+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},_.prototype.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},_.prototype.freeze=function(){this.$frozen=!0},_.prototype.unfreeze=function(){this.$frozen=!1},_.prototype.$renderChanges=function(T,F){if(this.$changes&&(T|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!T&&!F){this.$changes|=T;return}if(this.$size.$dirty)return this.$changes|=T,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",T),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var A=this.layerConfig;if(T&this.CHANGE_FULL||T&this.CHANGE_SIZE||T&this.CHANGE_TEXT||T&this.CHANGE_LINES||T&this.CHANGE_SCROLL||T&this.CHANGE_H_SCROLL){if(T|=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=$,T=T|this.CHANGE_SCROLL,T|=this.$computeLayerConfig()|this.$loop.clear())}A=this.layerConfig,this.$updateScrollBarV(),T&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),h.translate(this.content,-this.scrollLeft,-A.offset);var C=A.width+2*this.$padding+"px",w=A.minHeight+"px";h.setStyle(this.content.style,"width",C),h.setStyle(this.content.style,"height",w)}if(T&this.CHANGE_H_SCROLL&&(h.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)),T&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",T);return}if(T&this.CHANGE_SCROLL){this.$changedLines=null,T&this.CHANGE_TEXT||T&this.CHANGE_LINES?this.$textLayer.update(A):this.$textLayer.scrollLines(A),this.$showGutter&&(T&this.CHANGE_GUTTER||T&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",T);return}T&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(A),this.$showGutter&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)):T&this.CHANGE_LINES?((this.$updateLines()||T&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)):T&this.CHANGE_TEXT||T&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)):T&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(A),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(A)),T&this.CHANGE_CURSOR&&(this.$cursorLayer.update(A),this.$moveTextAreaToCursor()),T&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(A),T&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(A),this._signal("afterRender",T)},_.prototype.$autosize=function(){var T=this.session.getScreenLength()*this.lineHeight,F=this.$maxLines*this.lineHeight,A=Math.min(F,Math.max((this.$minLines||1)*this.lineHeight,T))+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=!$&&T>F;if(A!=this.desiredHeight||this.$size.height!=this.desiredHeight||C!=this.$vScroll){C!=this.$vScroll&&(this.$vScroll=C,this.scrollBarV.setVisible(C));var w=this.container.clientWidth;this.container.style.height=A+"px",this.$updateCachedSize(!0,this.$gutterWidth,w,A),this.desiredHeight=A,this._signal("autosize")}},_.prototype.$computeLayerConfig=function(){var T=this.session,F=this.$size,A=F.height<=2*this.lineHeight,$=this.session.getScreenLength(),C=$*this.lineHeight,w=this.$getLongestLine(),x=!A&&(this.$hScrollBarAlwaysVisible||F.scrollerWidth-w-2*this.$padding<0),I=this.$horizScroll!==x;I&&(this.$horizScroll=x,this.scrollBarH.setVisible(x));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;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,w+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 H=this.scrollTop%this.lineHeight,U=Math.ceil(R/this.lineHeight)-1,G=Math.max(0,Math.round((this.scrollTop-H)/this.lineHeight)),Y=G+U,Q,ee,ne=this.lineHeight;G=T.screenToDocumentRow(G,0);var se=T.getFoldLine(G);se&&(G=se.start.row),Q=T.documentToScreenRow(G,0),ee=T.getRowLength(G)*ne,Y=Math.min(T.screenToDocumentRow(Y,0),T.getLength()-1),R=F.scrollerHeight+T.getRowLength(Y)*ne+ee,H=this.scrollTop-Q*ne,H<0&&Q>0&&(Q=Math.max(0,Q+Math.floor(H/ne)),H=this.scrollTop-Q*ne);var ge=0;return(this.layerConfig.width!=w||I)&&(ge=this.CHANGE_H_SCROLL),(I||W)&&(ge|=this.$updateCachedSize(!0,this.gutterWidth,F.width,F.height),this._signal("scrollbarVisibilityChanged"),W&&(w=this.$getLongestLine())),this.layerConfig={width:w,padding:this.$padding,firstRow:G,firstRowScreen:Q,lastRow:Y,lineHeight:ne,characterWidth:this.characterWidth,minHeight:R,maxHeight:C,offset:H,gutterOffset:ne?Math.max(0,Math.ceil((H+F.height-F.scrollerHeight)/ne)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(w-this.$padding),ge},_.prototype.$updateLines=function(){if(this.$changedLines){var T=this.$changedLines.firstRow,F=this.$changedLines.lastRow;this.$changedLines=null;var A=this.layerConfig;if(!(T>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,T,F),!0}}},_.prototype.$getLongestLine=function(){var T=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(T+=1),this.$textLayer&&T>this.$textLayer.MAX_LINE_LENGTH&&(T=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(T*this.characterWidth))},_.prototype.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},_.prototype.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},_.prototype.addGutterDecoration=function(T,F){this.$gutterLayer.addGutterDecoration(T,F)},_.prototype.removeGutterDecoration=function(T,F){this.$gutterLayer.removeGutterDecoration(T,F)},_.prototype.updateBreakpoints=function(T){this._rows=T,this.$loop.schedule(this.CHANGE_GUTTER)},_.prototype.setAnnotations=function(T){this.$gutterLayer.setAnnotations(T),this.$loop.schedule(this.CHANGE_GUTTER)},_.prototype.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},_.prototype.hideCursor=function(){this.$cursorLayer.hideCursor()},_.prototype.showCursor=function(){this.$cursorLayer.showCursor()},_.prototype.scrollSelectionIntoView=function(T,F,A){this.scrollCursorIntoView(T,A),this.scrollCursorIntoView(F,A)},_.prototype.scrollCursorIntoView=function(T,F,A){if(this.$size.scrollerHeight!==0){var $=this.$cursorLayer.getPixelPosition(T),C=$.left,w=$.top,x=A&&A.top||0,I=A&&A.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var O=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;O+x>w?(F&&O+x>w+this.lineHeight&&(w-=F*this.$size.scrollerHeight),w===0&&(w=-this.scrollMargin.top),this.session.setScrollTop(w)):O+this.$size.scrollerHeight-I<w+this.lineHeight&&(F&&O+this.$size.scrollerHeight-I<w-this.lineHeight&&(w+=F*this.$size.scrollerHeight),this.session.setScrollTop(w+this.lineHeight+I-this.$size.scrollerHeight));var R=this.scrollLeft,P=2*this.layerConfig.characterWidth;C-P<R?(C-=P,C<this.$padding+P&&(C=-this.scrollMargin.left),this.session.setScrollLeft(C)):(C+=P,R+this.$size.scrollerWidth<C+this.characterWidth?this.session.setScrollLeft(Math.round(C+this.characterWidth-this.$size.scrollerWidth)):R<=this.$padding&&C-R<this.characterWidth&&this.session.setScrollLeft(0))}},_.prototype.getScrollTop=function(){return this.session.getScrollTop()},_.prototype.getScrollLeft=function(){return this.session.getScrollLeft()},_.prototype.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},_.prototype.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},_.prototype.scrollToRow=function(T){this.session.setScrollTop(T*this.lineHeight)},_.prototype.alignCursor=function(T,F){typeof T=="number"&&(T={row:T,column:0});var A=this.$cursorLayer.getPixelPosition(T),$=this.$size.scrollerHeight-this.lineHeight,C=A.top-$*(F||0);return this.session.setScrollTop(C),C},_.prototype.$calcSteps=function(T,F){var A=0,$=this.STEPS,C=[],w=function(x,I,O){return O*(Math.pow(x-1,3)+1)+I};for(A=0;A<$;++A)C.push(w(A/this.STEPS,T,F-T));return C},_.prototype.scrollToLine=function(T,F,A,$){var C=this.$cursorLayer.getPixelPosition({row:T,column:0}),w=C.top;F&&(w-=this.$size.scrollerHeight/2);var x=this.scrollTop;this.session.setScrollTop(w),A!==!1&&this.animateScrolling(x,$)},_.prototype.animateScrolling=function(T,F){var A=this.scrollTop;if(!this.$animatedScroll)return;var $=this;if(T==A)return;if(this.$scrollAnimation){var C=this.$scrollAnimation.steps;if(C.length&&(T=C[0],T==A))return}var w=$.$calcSteps(T,A);this.$scrollAnimation={from:T,to:A,steps:w},clearInterval(this.$timer),$.session.setScrollTop(w.shift()),$.session.$scrollTop=A;function x(){$.$timer=clearInterval($.$timer),$.$scrollAnimation=null,$.$stopAnimation=!1,F&&F()}this.$timer=setInterval(function(){if($.$stopAnimation){x();return}if(!$.session)return clearInterval($.$timer);w.length?($.session.setScrollTop(w.shift()),$.session.$scrollTop=A):A!=null?($.session.$scrollTop=-1,$.session.setScrollTop(A),A=null):x()},10)},_.prototype.scrollToY=function(T){this.scrollTop!==T&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=T)},_.prototype.scrollToX=function(T){this.scrollLeft!==T&&(this.scrollLeft=T),this.$loop.schedule(this.CHANGE_H_SCROLL)},_.prototype.scrollTo=function(T,F){this.session.setScrollTop(F),this.session.setScrollLeft(T)},_.prototype.scrollBy=function(T,F){F&&this.session.setScrollTop(this.session.getScrollTop()+F),T&&this.session.setScrollLeft(this.session.getScrollLeft()+T)},_.prototype.isScrollableBy=function(T,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||T<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||T>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},_.prototype.pixelToScreenCoordinates=function(T,F){var A;if(this.$hasCssTransforms){A={top:0,left:0};var $=this.$fontMetrics.transformCoordinates([T,F]);T=$[1]-this.gutterWidth-this.margin.left,F=$[0]}else A=this.scroller.getBoundingClientRect();var C=T+this.scrollLeft-A.left-this.$padding,w=C/this.characterWidth,x=Math.floor((F+this.scrollTop-A.top)/this.lineHeight),I=this.$blockCursor?Math.floor(w):Math.round(w);return{row:x,column:I,side:w-I>0?1:-1,offsetX:C}},_.prototype.screenToTextCoordinates=function(T,F){var A;if(this.$hasCssTransforms){A={top:0,left:0};var $=this.$fontMetrics.transformCoordinates([T,F]);T=$[1]-this.gutterWidth-this.margin.left,F=$[0]}else A=this.scroller.getBoundingClientRect();var C=T+this.scrollLeft-A.left-this.$padding,w=C/this.characterWidth,x=this.$blockCursor?Math.floor(w):Math.round(w),I=Math.floor((F+this.scrollTop-A.top)/this.lineHeight);return this.session.screenToDocumentPosition(I,Math.max(x,0),C)},_.prototype.textToScreenCoordinates=function(T,F){var A=this.scroller.getBoundingClientRect(),$=this.session.documentToScreenPosition(T,F),C=this.$padding+(this.session.$bidiHandler.isBidiRow($.row,T)?this.session.$bidiHandler.getPosLeft($.column):Math.round($.column*this.characterWidth)),w=$.row*this.lineHeight;return{pageX:A.left+C-this.scrollLeft,pageY:A.top+w-this.scrollTop}},_.prototype.visualizeFocus=function(){h.addCssClass(this.container,"ace_focus")},_.prototype.visualizeBlur=function(){h.removeCssClass(this.container,"ace_focus")},_.prototype.showComposition=function(T){this.$composition=T,T.cssText||(T.cssText=this.textarea.style.cssText),T.useTextareaForIME==null&&(T.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(h.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):T.markerId=this.session.addMarker(T.markerRange,"ace_composition_marker","text")},_.prototype.setCompositionText=function(T){var F=this.session.selection.cursor;this.addToken(T,"composition_placeholder",F.row,F.column),this.$moveTextAreaToCursor()},_.prototype.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),h.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var T=this.session.selection.cursor;this.removeExtraToken(T.row,T.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},_.prototype.setGhostText=function(T,F){var A=this.session.selection.cursor,$=F||{row:A.row,column:A.column};this.removeGhostText();var C=this.$calculateWrappedTextChunks(T,$);this.addToken(C[0].text,"ghost_text",$.row,$.column),this.$ghostText={text:T,position:{row:$.row,column:$.column}};var w=h.createElement("div");if(C.length>1){var x=this.hideTokensAfterPosition($.row,$.column),I;C.slice(1).forEach(function(W){var H=h.createElement("div"),U=h.createElement("span");U.className="ace_ghost_text",W.wrapped&&(H.className="ghost_text_line_wrapped"),W.text.length===0&&(W.text=" "),U.appendChild(h.createTextNode(W.text)),H.appendChild(U),w.appendChild(H),I=H}),x.forEach(function(W){var H=h.createElement("span");S(W.type)||(H.className="ace_"+W.type.replace(/\./g," ace_")),H.appendChild(h.createTextNode(W.value)),I.appendChild(H)}),this.$ghostTextWidget={el:w,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=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)}},_.prototype.$calculateWrappedTextChunks=function(T,F){var A=this.$size.scrollerWidth-this.$padding*2,$=Math.floor(A/this.characterWidth)-2;$=$<=0?60:$;for(var C=T.split(/\r?\n/),w=[],x=0;x<C.length;x++){var I=this.session.$getDisplayTokens(C[x],F.column),O=this.session.$computeWrapSplits(I,$,this.session.$tabSize);if(O.length>0){var R=0;O.push(C[x].length);for(var P=0;P<O.length;P++){var B=C[x].slice(R,O[P]);w.push({text:B,wrapped:!0}),R=O[P]}}else w.push({text:C[x],wrapped:!1})}return w},_.prototype.removeGhostText=function(){if(this.$ghostText){var T=this.$ghostText.position;this.removeExtraToken(T.row,T.column),this.$ghostTextWidget&&(this.session.widgetManager.removeLineWidget(this.$ghostTextWidget),this.$ghostTextWidget=null),this.$ghostText=null}},_.prototype.addToken=function(T,F,A,$){var C=this.session;C.bgTokenizer.lines[A]=null;var w={type:F,value:T},x=C.getTokens(A);if($==null||!x.length)x.push(w);else for(var I=0,O=0;O<x.length;O++){var R=x[O];if(I+=R.value.length,$<=I){var P=R.value.length-(I-$),B=R.value.slice(0,P),V=R.value.slice(P);x.splice(O,1,{type:R.type,value:B},w,{type:R.type,value:V});break}}this.updateLines(A,A)},_.prototype.hideTokensAfterPosition=function(T,F){for(var A=this.session.getTokens(T),$=0,C=!1,w=[],x=0;x<A.length;x++){var I=A[x];if($+=I.value.length,I.type!=="ghost_text"){if(C){w.push({type:I.type,value:I.value}),I.type="hidden_token";continue}$===F&&(C=!0)}}return this.updateLines(T,T),w},_.prototype.removeExtraToken=function(T,F){this.session.bgTokenizer.lines[T]=null,this.updateLines(T,T)},_.prototype.setTheme=function(T,F){var A=this;if(this.$themeId=T,A._dispatchEvent("themeChange",{theme:T}),!T||typeof T=="string"){var $=T||this.$options.theme.initialValue;o.loadModule(["theme",$],C)}else C(T);function C(w){if(A.$themeId!=T)return F&&F();if(!w||!w.cssClass)throw new Error("couldn't load module "+T+" or it didn't call define");w.$id&&(A.$themeId=w.$id),h.importCssString(w.cssText,w.cssClass,A.container),A.theme&&h.removeCssClass(A.container,A.theme.cssClass);var x="padding"in w?w.padding:"padding"in(A.theme||{})?4:A.$padding;A.$padding&&x!=A.$padding&&A.setPadding(x),A.$theme=w.cssClass,A.theme=w,h.addCssClass(A.container,w.cssClass),h.setCssClass(A.container,"ace_dark",w.isDark),A.$size&&(A.$size.width=0,A.$updateSizeAsync()),A._dispatchEvent("themeLoaded",{theme:w}),F&&F(),g.isSafari&&A.scroller&&(A.scroller.style.background="red",A.scroller.style.background="")}},_.prototype.getTheme=function(){return this.$themeId},_.prototype.setStyle=function(T,F){h.setCssClass(this.container,T,F!==!1)},_.prototype.unsetStyle=function(T){h.removeCssClass(this.container,T)},_.prototype.setCursorStyle=function(T){h.setStyle(this.scroller.style,"cursor",T)},_.prototype.setMouseCursor=function(T){h.setStyle(this.scroller.style,"cursor",T)},_.prototype.attachToShadowRoot=function(){h.importCssString(E,"ace_editor.css",this.container)},_.prototype.destroy=function(){this.freeze(),this.$fontMetrics.destroy(),this.$cursorLayer.destroy(),this.removeAllListeners(),this.container.textContent="",this.setOption("useResizeObserver",!1)},_.prototype.$updateCustomScrollbar=function(T){var F=this;this.$horizScroll=this.$vScroll=null,this.scrollBarV.element.remove(),this.scrollBarH.element.remove(),this.$scrollDecorator&&delete this.$scrollDecorator,T===!0?(this.scrollBarV=new f(this.container,this),this.scrollBarH=new c(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=new b(this.scrollBarV,this),this.$scrollDecorator.$updateDecorators()):(this.scrollBarV=new a(this.container,this),this.scrollBarH=new l(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)}))},_.prototype.$addResizeObserver=function(){if(!(!window.ResizeObserver||this.$resizeObserver)){var T=this;this.$resizeTimer=d.delayedCall(function(){T.destroyed||T.onResize()},50),this.$resizeObserver=new window.ResizeObserver(function(F){var A=F[0].contentRect.width,$=F[0].contentRect.height;Math.abs(T.$size.width-A)>1||Math.abs(T.$size.height-$)>1?T.$resizeTimer.delay():T.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},_}();M.prototype.CHANGE_CURSOR=1,M.prototype.CHANGE_MARKER=2,M.prototype.CHANGE_GUTTER=4,M.prototype.CHANGE_SCROLL=8,M.prototype.CHANGE_LINES=16,M.prototype.CHANGE_TEXT=32,M.prototype.CHANGE_SIZE=64,M.prototype.CHANGE_MARKER_BACK=128,M.prototype.CHANGE_MARKER_FRONT=256,M.prototype.CHANGE_FULL=512,M.prototype.CHANGE_H_SCROLL=1024,M.prototype.$changes=0,M.prototype.$padding=null,M.prototype.$frozen=!1,M.prototype.STEPS=8,s.implement(M.prototype,D),o.defineOptions(M.prototype,"renderer",{useResizeObserver:{set:function(_){!_&&this.$resizeObserver?(this.$resizeObserver.disconnect(),this.$resizeTimer.cancel(),this.$resizeTimer=this.$resizeObserver=null):_&&!this.$resizeObserver&&this.$addResizeObserver()}},animatedScroll:{initialValue:!1},showInvisibles:{set:function(_){this.$textLayer.setShowInvisibles(_)&&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(_){typeof _=="number"&&(this.$printMarginColumn=_),this.$showPrintMargin=!!_,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(_){this.$gutter.style.display=_?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},useSvgGutterIcons:{set:function(_){this.$gutterLayer.$useSvgGutterIcons=_},initialValue:!1},showFoldedAnnotations:{set:function(_){this.$gutterLayer.$showFoldedAnnotations=_},initialValue:!1},fadeFoldWidgets:{set:function(_){h.setCssClass(this.$gutter,"ace_fade-fold-widgets",_)},initialValue:!1},showFoldWidgets:{set:function(_){this.$gutterLayer.setShowFoldWidgets(_),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(_){this.$textLayer.setDisplayIndentGuides(_)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightIndentGuides:{set:function(_){this.$textLayer.setHighlightIndentGuides(_)==!0?this.$textLayer.$highlightIndentGuide():this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells)},initialValue:!0},highlightGutterLine:{set:function(_){this.$gutterLayer.setHighlightGutterLine(_),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(_){(!this.$hScrollBarAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(_){(!this.$vScrollBarAlwaysVisible||!this.$vScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(_){typeof _=="number"&&(_=_+"px"),this.container.style.fontSize=_,this.updateFontSize()},initialValue:12},fontFamily:{set:function(_){this.container.style.fontFamily=_,this.updateFontSize()}},maxLines:{set:function(_){this.updateFull()}},minLines:{set:function(_){this.$minLines<562949953421311||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(_){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(_){_=+_||0,this.$scrollPastEnd!=_&&(this.$scrollPastEnd=_,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(_){this.$gutterLayer.$fixedWidth=!!_,this.$loop.schedule(this.CHANGE_GUTTER)}},customScrollbar:{set:function(_){this.$updateCustomScrollbar(_)},initialValue:!1},theme:{set:function(_){this.setTheme(_)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!g.isMobile&&!g.isIE}}),u.VirtualRenderer=M}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(i,u,v){var s=i("../lib/oop"),h=i("../lib/net"),d=i("../lib/event_emitter").EventEmitter,o=i("../config");function p(l){var a="importScripts('"+h.qualifyURL(l)+"');";try{return new Blob([a],{type:"application/javascript"})}catch{var c=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,f=new c;return f.append(a),f.getBlob("application/javascript")}}function e(l){if(typeof Worker>"u")return{postMessage:function(){},terminate:function(){}};if(o.get("loadWorkerFromBlob")){var a=p(l),c=window.URL||window.webkitURL,f=c.createObjectURL(a);return new Worker(f)}return new Worker(l)}var t=function(l){l.postMessage||(l=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=l,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(l,a,c,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 D={};l.forEach(function(E){D[E]=y(i.toUrl(E,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=e(f),m&&this.send("importScripts",m),this.$worker.postMessage({init:!0,tlns:D,module:a,classname:c}),this.$worker},this.onMessage=function(l){var a=l.data;switch(a.type){case"event":this._signal(a.name,{data:a.data});break;case"call":var c=this.callbacks[a.id];c&&(c(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(l){window.console&&console.error&&console.error(l)},this.$normalizePath=function(l){return h.qualifyURL(l)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker.onerror=function(l){l.preventDefault()},this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(l,a){this.$worker.postMessage({command:l,args:a})},this.call=function(l,a,c){if(c){var f=this.callbackId++;this.callbacks[f]=c,a.push(f)}this.send(l,a)},this.emit=function(l,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:l,data:{data:a.data}})}catch(c){console.error(c.stack)}},this.attachToDocument=function(l){this.$doc&&this.terminate(),this.$doc=l,this.call("setValue",[l.getValue()]),l.on("change",this.changeListener,!0)},this.changeListener=function(l){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),l.action=="insert"?this.deltaQueue.push(l.start,l.lines):this.deltaQueue.push(l.start,l.end)},this.$sendDeltaQueue=function(){var l=this.deltaQueue;l&&(this.deltaQueue=null,l.length>50&&l.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:l}))}}).call(t.prototype);var r=function(l,a,c){var f=null,m=!1,y=Object.create(d),D=[],E=new t({messageBuffer:D,terminate:function(){},postMessage:function(g){D.push(g),f&&(m?setTimeout(b):b())}});E.setEmitSync=function(g){m=g};var b=function(){var g=D.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[c](y);D.length;)b()}),E};u.UIWorkerClient=r,u.WorkerClient=t,u.createWorker=e}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(i,u,v){var s=i("./range").Range,h=i("./lib/event_emitter").EventEmitter,d=i("./lib/oop"),o=function(){function p(e,t,r,l,a,c){var f=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=a,this.othersClass=c,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=l,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 l=this.pos;l.$insertRight=!0,l.detach(),l.markerId=r.addMarker(new s(l.row,l.column,l.row,l.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(a){var c=t.createAnchor(a.row,a.column);c.$insertRight=!0,c.detach(),e.others.push(c)}),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,l=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),l&&(this.length+=r),l&&!this.session.$fromUndo){if(e.action==="insert")for(var c=this.others.length-1;c>=0;c--){var f=this.others[c],m={row:f.row,column:f.column+a};this.doc.insertMergedLines(m,e.lines)}else if(e.action==="remove")for(var c=this.others.length-1;c>=0;c--){var f=this.others[c],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,c){t.removeMarker(a.markerId),a.markerId=t.addMarker(new s(a.row,a.column,a.row,a.column+e.length),c,null,!1)};r(this.pos,this.mainClass);for(var l=this.others.length;l--;)r(this.others[l],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,h),u.PlaceHolder=o}),ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(i,u,v){var s=i("../lib/event"),h=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,l=e.ctrlKey,a=p.getAccelKey(),c=p.getButton();if(l&&h.isMac&&(c=e.button),p.editor.inMultiSelectMode&&c==2){p.editor.textInput.onContextMenu(p.domEvent);return}if(!l&&!t&&!a){c===0&&p.editor.inMultiSelectMode&&p.editor.exitMultiSelectMode();return}if(c===0){var f=p.editor,m=f.selection,y=f.inMultiSelectMode,D=p.getDocumentPosition(),E=m.getCursor(),b=p.inSelection()||m.isEmpty()&&d(D,E),g=p.x,S=p.y,M=function(B){g=B.clientX,S=B.clientY},_=f.session,T=f.renderer.pixelToScreenCoordinates(g,S),F=T,A;if(f.$mouseHandler.$enableJumpToDef)l&&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&&h.isMac&&e.ctrlKey&&f.$mouseHandler.cancelContextMenu(),A=="add"){if(!y&&b)return;if(!y){var $=m.toOrientedRange();f.addSelectionMarker($)}var C=m.rangeList.rangeAtPoint(D);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 w,x=[],I=function(){var B=f.renderer.pixelToScreenCoordinates(g,S),V=_.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(x),x=m.rectangularRangeBlock(F,T),f.$mouseHandler.$clickSelection&&x.length==1&&x[0].isEmpty()&&(x[0]=f.$mouseHandler.$clickSelection.clone()),x.forEach(f.addSelectionMarker,f),f.updateSelectionMarkers())};y&&!a?m.toSingleRange():!y&&a&&(w=m.toOrientedRange(),f.addSelectionMarker(w)),r?T=_.documentToScreenPosition(m.lead):m.moveToPosition(D),F={row:-1,column:-1};var O=function(B){I(),clearInterval(P),f.removeSelectionMarkers(x),x.length||(x=[m.toOrientedRange()]),w&&(f.removeSelectionMarker(w),m.toSingleRange(w));for(var V=0;V<x.length;V++)m.addRange(x[V]);f.inVirtualSelectionMode=!1,f.$mouseHandler.$clickSelection=null},R=I;s.capture(f.container,M,O);var P=setInterval(function(){R()},20);return p.preventDefault()}}}u.onMouseDown=o}),ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(i,u,v){u.defaultCommands=[{name:"addCursorAbove",description:"Add cursor above",exec:function(h){h.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",description:"Add cursor below",exec:function(h){h.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(h){h.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(h){h.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(h){h.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",description:"Select more after",exec:function(h){h.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",description:"Select next before",exec:function(h){h.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(h){h.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(h){h.multiSelect.rangeCount>1?h.multiSelect.joinSelections():h.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(h){h.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(h){h.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(h){h.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],u.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(h){h.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(h){return h&&h.inMultiSelectMode}}];var s=i("../keyboard/hash_handler").HashHandler;u.keyboardHandler=new s(u.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,u,v){var s=i("./range_list").RangeList,h=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");u.commands=t.defaultCommands.concat(t.multiSelectCommands);var r=i("./search").Search,l=new r;function a(E,b,g){return l.$options.wrap=!0,l.$options.needle=b,l.$options.backwards=g==-1,l.find(E)}var c=i("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(c.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],M=S.start.row,_=S.end.row;if(M===_)b.push(S.clone());else{for(b.push(new h(M,S.start.column,M,this.session.getLine(M).length));++M<_;)b.push(this.getLineRange(M,!0));b.push(new h(_,0,_,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=h.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=h.fromPoints(E[0].start,b.end);this.toSingleRange(),this.setSelectionRange(g,b.cursor==b.start)}else{var S=this.session.documentToScreenPosition(this.cursor),M=this.session.documentToScreenPosition(this.anchor),_=this.rectangularRangeBlock(S,M);_.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(E,b,g){var S=[],M=E.column<b.column;if(M)var _=E.column,T=b.column,F=E.offsetX,A=b.offsetX;else var _=b.column,T=E.column,F=b.offsetX,A=E.offsetX;var $=E.row<b.row;if($)var C=E.row,w=b.row;else var C=b.row,w=E.row;_<0&&(_=0),C<0&&(C=0),C==w&&(g=!0);for(var x,I=C;I<=w;I++){var O=h.fromPoints(this.session.screenToDocumentPosition(I,_,F),this.session.screenToDocumentPosition(I,T,A));if(O.isEmpty()){if(x&&m(O.end,x))break;x=O.end}O.cursor=M?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 M=b.indexOf(S);M!=-1&&b.splice(M,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,M=g==!0||g&&g.$byLines,_=this.session,T=this.selection,F=T.rangeList,A=(S?T:F).ranges,$;if(!A.length)return E.exec?E.exec(this,b||{}):E(this,b||{});var C=T._eventRegistry;T._eventRegistry={};var w=new d(_);this.inVirtualSelectionMode=!0;for(var x=A.length;x--;){if(M)for(;x>0&&A[x].start.row==A[x-1].end.row;)x--;w.fromOrientedRange(A[x]),w.index=x,this.selection=_.selection=w;var I=E.exec?E.exec(this,b||{}):E(this,b||{});!$&&I!==void 0&&($=I),w.toOrientedRange(A[x])}w.detach(),this.selection=_.selection=T,this.inVirtualSelectionMode=!1,T._eventRegistry=C,T.mergeOverlappingRanges(),T.ranges[0]&&T.fromOrientedRange(T.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 M=this.session.getDocument().getNewLineCharacter();E=g.join(M),E.length==(g.length-1)*M.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 M=this.$search.findAll(this.session);if(!M.length)return 0;var _=this.multiSelect;g||_.toSingleRange(M[0]);for(var T=M.length;T--;)_.addRange(M[T],!0);return S&&_.rangeList.rangeAtPoint(S.start)&&_.addRange(S,!0),M.length},this.selectMoreLines=function(E,b){var g=this.selection.toOrientedRange(),S=g.cursor==g.end,M=this.session.documentToScreenPosition(g.cursor);this.selection.$desiredColumn&&(M.column=this.selection.$desiredColumn);var _=this.session.screenToDocumentPosition(M.row+E,M.column);if(g.isEmpty())var F=_;else var T=this.session.documentToScreenPosition(S?g.end:g.start),F=this.session.screenToDocumentPosition(T.row+E,T.column);if(S){var A=h.fromPoints(_,F);A.cursor=A.start}else{var A=h.fromPoints(F,_);A.cursor=A.end}if(A.desiredColumn=M.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,M=S.length;M--;){var _=S[M];if(_.isEmpty()){var T=b.getWordRange(_.start.row,_.start.column);_.start.row=T.start.row,_.start.column=T.start.column,_.end.row=T.end.row,_.end.column=T.end.column}}g.mergeOverlappingRanges();for(var F=[],M=S.length;M--;){var _=S[M];F.unshift(b.getTextRange(_))}E<0?F.unshift(F.pop()):F.push(F.shift());for(var M=S.length;M--;){var _=S[M],A=_.clone();b.replace(_,F[M]),_.start.row=A.start.row,_.start.column=A.start.column}g.fromOrientedRange(g.ranges[0])},this.selectMore=function(E,b,g){var S=this.session,M=S.multiSelect,_=M.toOrientedRange();if(!(_.isEmpty()&&(_=S.getWordRange(_.start.row,_.start.column),_.cursor=E==-1?_.start:_.end,this.multiSelect.addRange(_),g))){var T=S.getTextRange(_),F=a(S,T,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(_.cursor)}},this.alignCursors=function(){var E=this.session,b=E.multiSelect,g=b.ranges,S=-1,M=g.filter(function(R){if(R.cursor.row==S)return!0;S=R.cursor.row});if(!g.length||M.length==g.length-1){var _=this.selection.getRange(),T=_.start.row,F=_.end.row,A=T==F;if(A){var $=this.session.getLength(),C;do C=this.session.getLine(F);while(/[=:]/.test(C)&&++F<$);do C=this.session.getLine(T);while(/[=:]/.test(C)&&--T>0);T<0&&(T=0),F>=$&&(F=$-1)}var w=this.session.removeFullLines(T,F);w=this.$reAlignText(w,A),this.session.insert({row:T,column:0},w.join(`
|
|
965
965
|
`)+`
|
|
966
|
-
`),A||(_.start.column=0,_.end.column=w[w.length-1].length),this.selection.setRange(_)}else{M.forEach(function(
|
|
966
|
+
`),A||(_.start.column=0,_.end.column=w[w.length-1].length),this.selection.setRange(_)}else{M.forEach(function(R){b.substractPoint(R.cursor)});var x=0,I=1/0,O=g.map(function(R){var P=R.cursor,B=E.getLine(P.row),V=B.substr(P.column).search(/\S/g);return V==-1&&(V=0),P.column>x&&(x=P.column),V<I&&(I=V),V});g.forEach(function(R,P){var B=R.cursor,V=x-B.column,W=O[P]-I;V>W?E.insert(B,e.stringRepeat(" ",V-W)):E.remove(new h(B.row,B.column,B.row,B.column-V+W)),R.start.column=R.end.column=x,R.start.row=R.end.row=B.row,R.cursor=R.end}),b.fromOrientedRange(g[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(E,b){var g=!0,S=!0,M,_,T;return E.map(function(w){var x=w.match(/(\s*)(.*?)(\s*)([=:].*)/);return x?M==null?(M=x[1].length,_=x[2].length,T=x[3].length,x):(M+_+T!=x[1].length+x[2].length+x[3].length&&(S=!1),M!=x[1].length&&(g=!1),M>x[1].length&&(M=x[1].length),_<x[2].length&&(_=x[2].length),T>x[3].length&&(T=x[3].length),x):[w]}).map(b?A:g?S?$:A:C);function F(w){return e.stringRepeat(" ",w)}function A(w){return w[2]?F(M)+w[2]+F(_-w[2].length+T)+w[4].replace(/^([=:])\s+/,"$1 "):w[0]}function $(w){return w[2]?F(M+_-w[2].length)+w[2]+F(T)+w[4].replace(/^([=:])\s+/,"$1 "):w[0]}function C(w){return w[2]?F(M)+w[2]+F(T)+w[4].replace(/^([=:])\s+/,"$1 "):w[0]}}}).call(f.prototype);function m(E,b){return E.row==b.row&&E.column==b.column}u.onSessionChange=function(E){var b=E.session;b&&!b.multiSelect&&(b.$selectionMarkers=[],b.selection.$initRangeList(),b.multiSelect=b.selection),this.multiSelect=b&&b.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)),b&&(b.multiSelect.on("addRange",this.$onAddRange),b.multiSelect.on("removeRange",this.$onRemoveRange),b.multiSelect.on("multiSelect",this.$onMultiSelect),b.multiSelect.on("singleSelect",this.$onSingleSelect),b.multiSelect.lead.on("change",this.$checkMultiselectChange),b.multiSelect.anchor.on("change",this.$checkMultiselectChange)),b&&this.inMultiSelectMode!=b.selection.inMultiSelectMode&&(b.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=u.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),D(E))}function D(E){if(!E.textInput)return;var b=E.textInput.getElement(),g=!1;p.addListener(b,"keydown",function(M){var _=M.keyCode==18&&!(M.ctrlKey||M.shiftKey||M.metaKey);E.$blockSelectEnabled&&_?g||(E.renderer.setMouseCursor("crosshair"),g=!0):g&&S()},E),p.addListener(b,"keyup",S,E),p.addListener(b,"blur",S,E);function S(M){g&&(E.renderer.setMouseCursor(""),g=!1)}}u.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,u,v){var s=i("../../range").Range,h=u.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 l=p||t.length,a=d.getLength(),c=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>c){var D=d.getLine(f).length;return new s(c,l,f,D)}}},this.openingBracketBlock=function(d,o,p,e,t){var r={row:p,column:e+1},l=d.$findClosingBracket(o,r,t);if(l){var a=d.foldWidgets[l.row];return a==null&&(a=d.getFoldWidget(l.row)),a=="start"&&l.row>r.row&&(l.row--,l.column=d.getLine(l.row).length),s.fromPoints(r,l)}},this.closingBracketBlock=function(d,o,p,e,t){var r={row:p,column:e},l=d.$findOpeningBracket(o,r);if(l)return l.column++,r.column--,s.fromPoints(l,r)}}).call(h.prototype)}),ace.define("ace/ext/error_marker",["require","exports","module","ace/lib/dom","ace/range","ace/config"],function(i,u,v){var s=i("../lib/dom"),h=i("../range").Range,d=i("../config").nls;function o(e,t,r){for(var l=0,a=e.length-1;l<=a;){var c=l+a>>1,f=r(t,e[c]);if(f>0)l=c+1;else if(f<0)a=c-1;else return c}return-(l+1)}function p(e,t,r){var l=e.getAnnotations().sort(h.comparePoints);if(l.length){var a=o(l,{row:t,column:-1},h.comparePoints);a<0&&(a=-a-1),a>=l.length?a=r>0?0:l.length-1:a===0&&r<0&&(a=l.length-1);var c=l[a];if(!(!c||!r)){if(c.row===t){do c=l[a+=r];while(c&&c.row===t);if(!c)return l.slice()}var f=[];t=c.row;do f[r<0?"unshift":"push"](c),c=l[a+=r];while(c&&c.row==t);return f.length&&f}}}u.showErrorMarker=function(e,t){var r=e.session,l=e.getCursorPosition(),a=l.row,c=r.widgetManager.getWidgetsAtRow(a).filter(function(M){return M.type=="errorMarker"})[0];c?c.destroy():a-=t;var f=p(r,a,t),m;if(f){var y=f[0];l.column=(y.pos&&typeof y.column!="number"?y.pos.sc:y.column)||0,l.row=y.row,m=e.renderer.$gutterLayer.$annotations[l.row]}else{if(c)return;m={displayText:[d("error-marker.good-state","Looks good!")],className:"ace_ok"}}e.session.unfold(l.row),e.selection.moveToPosition(l);var D={row:l.row,fixedWidth:!0,coverGutter:!0,el:s.createElement("div"),type:"errorMarker"},E=D.el.appendChild(s.createElement("div")),b=D.el.appendChild(s.createElement("div"));b.className="error_widget_arrow "+m.className;var g=e.renderer.$cursorLayer.getPixelPosition(l).left;b.style.left=g+e.renderer.gutterWidth-5+"px",D.el.className="error_widget_wrapper",E.className="error_widget "+m.className,m.displayText.forEach(function(M,_){E.appendChild(s.createTextNode(M)),_<m.displayText.length-1&&E.appendChild(s.createElement("br"))}),E.appendChild(s.createElement("div"));var S=function(M,_,T){if(_===0&&(T==="esc"||T==="return"))return D.destroy(),{command:"null"}};D.destroy=function(){e.$mouseHandler.isMousePressed||(e.keyBinding.removeKeyboardHandler(S),r.widgetManager.removeLineWidget(D),e.off("changeSelection",D.destroy),e.off("changeSession",D.destroy),e.off("mouseup",D.destroy),e.off("change",D.destroy))},e.keyBinding.addKeyboardHandler(S),e.on("changeSelection",D.destroy),e.on("changeSession",D.destroy),e.on("mouseup",D.destroy),e.on("change",D.destroy),e.session.widgetManager.addLineWidget(D),D.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:D.el.offsetHeight})},s.importCssString(`
|
|
967
967
|
.error_widget_wrapper {
|
|
968
968
|
background: inherit;
|
|
969
969
|
color: inherit;
|
|
@@ -996,24 +996,24 @@ import{C as pt,R as k}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,u,v){i("./loader_build")(u);var o=i("./lib/dom"),h=i("./range").Range,d=i("./editor").Editor,s=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"),u.config=i("./config"),u.edit=function(r,l){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 c="";if(r&&/input|textarea/i.test(r.tagName)){var f=r;c=f.value,r=o.createElement("pre"),f.parentNode.replaceChild(r,f)}else r&&(c=r.textContent,r.innerHTML="");var m=u.createEditSession(c),y=new d(new e(r),m,l),D={document:m,editor:y,onResize:y.resize.bind(y,null)};return f&&(D.textarea=f),y.on("destroy",function(){D.editor.container.env=null}),y.container.env=y.env=D,y},u.createEditSession=function(r,l){var a=new s(r,l);return a.setUndoManager(new p),a},u.Range=h,u.Editor=d,u.EditSession=s,u.UndoManager=p,u.VirtualRenderer=e;var t=u.config.version;u.version=t}),function(){ace.require(["ace/ace"],function(i){i&&(i.config.init(!0),i.define=ace.define);var u=function(){return this}();!u&&typeof window<"u"&&(u=window),!u&&typeof self<"u"&&(u=self),u.ace||(u.ace=i);for(var v in i)i.hasOwnProperty(v)&&(u.ace[v]=i[v]);u.ace.default=u.ace,L&&(L.exports=u.ace)})}()})(Vi);var fn=Vi.exports,gn={exports:{}};gn.exports;(function(L,n){var i=200,u="__lodash_hash_undefined__",v=1,o=2,h=9007199254740991,d="[object Arguments]",s="[object Array]",p="[object AsyncFunction]",e="[object Boolean]",t="[object Date]",r="[object Error]",l="[object Function]",a="[object GeneratorFunction]",c="[object Map]",f="[object Number]",m="[object Null]",y="[object Object]",D="[object Promise]",E="[object Proxy]",b="[object RegExp]",g="[object Set]",S="[object String]",M="[object Symbol]",_="[object Undefined]",T="[object WeakMap]",F="[object ArrayBuffer]",A="[object DataView]",$="[object Float32Array]",C="[object Float64Array]",w="[object Int8Array]",x="[object Int16Array]",I="[object Int32Array]",R="[object Uint8Array]",O="[object Uint8ClampedArray]",P="[object Uint16Array]",B="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,W=/^\[object .+?Constructor\]$/,H=/^(?:0|[1-9]\d*)$/,U={};U[$]=U[C]=U[w]=U[x]=U[I]=U[R]=U[O]=U[P]=U[B]=!0,U[d]=U[s]=U[F]=U[e]=U[A]=U[t]=U[r]=U[l]=U[c]=U[f]=U[y]=U[b]=U[g]=U[S]=U[T]=!1;var G=typeof He=="object"&&He&&He.Object===Object&&He,Y=typeof self=="object"&&self&&self.Object===Object&&self,Q=G||Y||Function("return this")(),ee=n&&!n.nodeType&&n,ne=ee&&!0&&L&&!L.nodeType&&L,se=ne&&ne.exports===ee,ge=se&&G.process,be=function(){try{return ge&&ge.binding&&ge.binding("util")}catch{}}(),ke=be&&be.isTypedArray;function Ce(z,J){for(var te=-1,ie=z==null?0:z.length,Se=0,he=[];++te<ie;){var _e=z[te];J(_e,te,z)&&(he[Se++]=_e)}return he}function Ne(z,J){for(var te=-1,ie=J.length,Se=z.length;++te<ie;)z[Se+te]=J[te];return z}function Xe(z,J){for(var te=-1,ie=z==null?0:z.length;++te<ie;)if(J(z[te],te,z))return!0;return!1}function Ze(z,J){for(var te=-1,ie=Array(z);++te<z;)ie[te]=J(te);return ie}function Rt(z){return function(J){return z(J)}}function Jt(z,J){return z.has(J)}function bn(z,J){return z==null?void 0:z[J]}function Ot(z){var J=-1,te=Array(z.size);return z.forEach(function(ie,Se){te[++J]=[Se,ie]}),te}function Tt(z,J){return function(te){return z(J(te))}}function Nt(z){var J=-1,te=Array(z.size);return z.forEach(function(ie){te[++J]=ie}),te}var wn=Array.prototype,X=Function.prototype,re=Object.prototype,ae=Q["__core-js_shared__"],de=X.toString,ce=re.hasOwnProperty,Ee=function(){var z=/[^.]+$/.exec(ae&&ae.keys&&ae.keys.IE_PROTO||"");return z?"Symbol(src)_1."+z:""}(),$e=re.toString,xe=RegExp("^"+de.call(ce).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),we=se?Q.Buffer:void 0,ve=Q.Symbol,Fe=Q.Uint8Array,st=re.propertyIsEnumerable,Yt=wn.splice,gt=ve?ve.toStringTag:void 0,Zn=Object.getOwnPropertySymbols,tr=we?we.isBuffer:void 0,nr=Tt(Object.keys,Object),Cn=_t(Q,"DataView"),Bt=_t(Q,"Map"),En=_t(Q,"Promise"),Sn=_t(Q,"Set"),Dn=_t(Q,"WeakMap"),Pt=_t(Object,"create"),ir=yt(Cn),rr=yt(Bt),sr=yt(En),or=yt(Sn),ar=yt(Dn),qn=ve?ve.prototype:void 0,An=qn?qn.valueOf:void 0;function mt(z){var J=-1,te=z==null?0:z.length;for(this.clear();++J<te;){var ie=z[J];this.set(ie[0],ie[1])}}function lr(){this.__data__=Pt?Pt(null):{},this.size=0}function ur(z){var J=this.has(z)&&delete this.__data__[z];return this.size-=J?1:0,J}function hr(z){var J=this.__data__;if(Pt){var te=J[z];return te===u?void 0:te}return ce.call(J,z)?J[z]:void 0}function cr(z){var J=this.__data__;return Pt?J[z]!==void 0:ce.call(J,z)}function pr(z,J){var te=this.__data__;return this.size+=this.has(z)?0:1,te[z]=Pt&&J===void 0?u:J,this}mt.prototype.clear=lr,mt.prototype.delete=ur,mt.prototype.get=hr,mt.prototype.has=cr,mt.prototype.set=pr;function qe(z){var J=-1,te=z==null?0:z.length;for(this.clear();++J<te;){var ie=z[J];this.set(ie[0],ie[1])}}function dr(){this.__data__=[],this.size=0}function fr(z){var J=this.__data__,te=Xt(J,z);if(te<0)return!1;var ie=J.length-1;return te==ie?J.pop():Yt.call(J,te,1),--this.size,!0}function gr(z){var J=this.__data__,te=Xt(J,z);return te<0?void 0:J[te][1]}function mr(z){return Xt(this.__data__,z)>-1}function vr(z,J){var te=this.__data__,ie=Xt(te,z);return ie<0?(++this.size,te.push([z,J])):te[ie][1]=J,this}qe.prototype.clear=dr,qe.prototype.delete=fr,qe.prototype.get=gr,qe.prototype.has=mr,qe.prototype.set=vr;function vt(z){var J=-1,te=z==null?0:z.length;for(this.clear();++J<te;){var ie=z[J];this.set(ie[0],ie[1])}}function yr(){this.size=0,this.__data__={hash:new mt,map:new(Bt||qe),string:new mt}}function br(z){var J=Zt(this,z).delete(z);return this.size-=J?1:0,J}function wr(z){return Zt(this,z).get(z)}function Cr(z){return Zt(this,z).has(z)}function Er(z,J){var te=Zt(this,z),ie=te.size;return te.set(z,J),this.size+=te.size==ie?0:1,this}vt.prototype.clear=yr,vt.prototype.delete=br,vt.prototype.get=wr,vt.prototype.has=Cr,vt.prototype.set=Er;function Qt(z){var J=-1,te=z==null?0:z.length;for(this.__data__=new vt;++J<te;)this.add(z[J])}function Sr(z){return this.__data__.set(z,u),this}function Dr(z){return this.__data__.has(z)}Qt.prototype.add=Qt.prototype.push=Sr,Qt.prototype.has=Dr;function ot(z){var J=this.__data__=new qe(z);this.size=J.size}function Ar(){this.__data__=new qe,this.size=0}function xr(z){var J=this.__data__,te=J.delete(z);return this.size=J.size,te}function $r(z){return this.__data__.get(z)}function Tr(z){return this.__data__.has(z)}function _r(z,J){var te=this.__data__;if(te instanceof qe){var ie=te.__data__;if(!Bt||ie.length<i-1)return ie.push([z,J]),this.size=++te.size,this;te=this.__data__=new vt(ie)}return te.set(z,J),this.size=te.size,this}ot.prototype.clear=Ar,ot.prototype.delete=xr,ot.prototype.get=$r,ot.prototype.has=Tr,ot.prototype.set=_r;function kr(z,J){var te=qt(z),ie=!te&&Ur(z),Se=!te&&!ie&&xn(z),he=!te&&!ie&&!Se&&li(z),_e=te||ie||Se||he,Le=_e?Ze(z.length,String):[],Re=Le.length;for(var Te in z)ce.call(z,Te)&&!(_e&&(Te=="length"||Se&&(Te=="offset"||Te=="parent")||he&&(Te=="buffer"||Te=="byteLength"||Te=="byteOffset")||Wr(Te,Re)))&&Le.push(Te);return Le}function Xt(z,J){for(var te=z.length;te--;)if(ri(z[te][0],J))return te;return-1}function Mr(z,J,te){var ie=J(z);return qt(z)?ie:Ne(ie,te(z))}function Wt(z){return z==null?z===void 0?_:m:gt&> in Object(z)?Br(z):Vr(z)}function ei(z){return Ht(z)&&Wt(z)==d}function ti(z,J,te,ie,Se){return z===J?!0:z==null||J==null||!Ht(z)&&!Ht(J)?z!==z&&J!==J:Lr(z,J,te,ie,ti,Se)}function Lr(z,J,te,ie,Se,he){var _e=qt(z),Le=qt(J),Re=_e?s:at(z),Te=Le?s:at(J);Re=Re==d?y:Re,Te=Te==d?y:Te;var Pe=Re==y,Ue=Te==y,Oe=Re==Te;if(Oe&&xn(z)){if(!xn(J))return!1;_e=!0,Pe=!1}if(Oe&&!Pe)return he||(he=new ot),_e||li(z)?ni(z,J,te,ie,Se,he):Or(z,J,Re,te,ie,Se,he);if(!(te&v)){var ze=Pe&&ce.call(z,"__wrapped__"),je=Ue&&ce.call(J,"__wrapped__");if(ze||je){var lt=ze?z.value():z,et=je?J.value():J;return he||(he=new ot),Se(lt,et,te,ie,he)}}return Oe?(he||(he=new ot),Nr(z,J,te,ie,Se,he)):!1}function Ir(z){if(!ai(z)||zr(z))return!1;var J=si(z)?xe:W;return J.test(yt(z))}function Fr(z){return Ht(z)&&oi(z.length)&&!!U[Wt(z)]}function Rr(z){if(!jr(z))return nr(z);var J=[];for(var te in Object(z))ce.call(z,te)&&te!="constructor"&&J.push(te);return J}function ni(z,J,te,ie,Se,he){var _e=te&v,Le=z.length,Re=J.length;if(Le!=Re&&!(_e&&Re>Le))return!1;var Te=he.get(z);if(Te&&he.get(J))return Te==J;var Pe=-1,Ue=!0,Oe=te&o?new Qt:void 0;for(he.set(z,J),he.set(J,z);++Pe<Le;){var ze=z[Pe],je=J[Pe];if(ie)var lt=_e?ie(je,ze,Pe,J,z,he):ie(ze,je,Pe,z,J,he);if(lt!==void 0){if(lt)continue;Ue=!1;break}if(Oe){if(!Xe(J,function(et,bt){if(!Jt(Oe,bt)&&(ze===et||Se(ze,et,te,ie,he)))return Oe.push(bt)})){Ue=!1;break}}else if(!(ze===je||Se(ze,je,te,ie,he))){Ue=!1;break}}return he.delete(z),he.delete(J),Ue}function Or(z,J,te,ie,Se,he,_e){switch(te){case A:if(z.byteLength!=J.byteLength||z.byteOffset!=J.byteOffset)return!1;z=z.buffer,J=J.buffer;case F:return!(z.byteLength!=J.byteLength||!he(new Fe(z),new Fe(J)));case e:case t:case f:return ri(+z,+J);case r:return z.name==J.name&&z.message==J.message;case b:case S:return z==J+"";case c:var Le=Ot;case g:var Re=ie&v;if(Le||(Le=Nt),z.size!=J.size&&!Re)return!1;var Te=_e.get(z);if(Te)return Te==J;ie|=o,_e.set(z,J);var Pe=ni(Le(z),Le(J),ie,Se,he,_e);return _e.delete(z),Pe;case M:if(An)return An.call(z)==An.call(J)}return!1}function Nr(z,J,te,ie,Se,he){var _e=te&v,Le=ii(z),Re=Le.length,Te=ii(J),Pe=Te.length;if(Re!=Pe&&!_e)return!1;for(var Ue=Re;Ue--;){var Oe=Le[Ue];if(!(_e?Oe in J:ce.call(J,Oe)))return!1}var ze=he.get(z);if(ze&&he.get(J))return ze==J;var je=!0;he.set(z,J),he.set(J,z);for(var lt=_e;++Ue<Re;){Oe=Le[Ue];var et=z[Oe],bt=J[Oe];if(ie)var ui=_e?ie(bt,et,Oe,J,z,he):ie(et,bt,Oe,z,J,he);if(!(ui===void 0?et===bt||Se(et,bt,te,ie,he):ui)){je=!1;break}lt||(lt=Oe=="constructor")}if(je&&!lt){var en=z.constructor,tn=J.constructor;en!=tn&&"constructor"in z&&"constructor"in J&&!(typeof en=="function"&&en instanceof en&&typeof tn=="function"&&tn instanceof tn)&&(je=!1)}return he.delete(z),he.delete(J),je}function ii(z){return Mr(z,Jr,Pr)}function Zt(z,J){var te=z.__data__;return Hr(J)?te[typeof J=="string"?"string":"hash"]:te.map}function _t(z,J){var te=bn(z,J);return Ir(te)?te:void 0}function Br(z){var J=ce.call(z,gt),te=z[gt];try{z[gt]=void 0;var ie=!0}catch{}var Se=$e.call(z);return ie&&(J?z[gt]=te:delete z[gt]),Se}var Pr=Zn?function(z){return z==null?[]:(z=Object(z),Ce(Zn(z),function(J){return st.call(z,J)}))}:Yr,at=Wt;(Cn&&at(new Cn(new ArrayBuffer(1)))!=A||Bt&&at(new Bt)!=c||En&&at(En.resolve())!=D||Sn&&at(new Sn)!=g||Dn&&at(new Dn)!=T)&&(at=function(z){var J=Wt(z),te=J==y?z.constructor:void 0,ie=te?yt(te):"";if(ie)switch(ie){case ir:return A;case rr:return c;case sr:return D;case or:return g;case ar:return T}return J});function Wr(z,J){return J=J??h,!!J&&(typeof z=="number"||H.test(z))&&z>-1&&z%1==0&&z<J}function Hr(z){var J=typeof z;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?z!=="__proto__":z===null}function zr(z){return!!Ee&&Ee in z}function jr(z){var J=z&&z.constructor,te=typeof J=="function"&&J.prototype||re;return z===te}function Vr(z){return $e.call(z)}function yt(z){if(z!=null){try{return de.call(z)}catch{}try{return z+""}catch{}}return""}function ri(z,J){return z===J||z!==z&&J!==J}var Ur=ei(function(){return arguments}())?ei:function(z){return Ht(z)&&ce.call(z,"callee")&&!st.call(z,"callee")},qt=Array.isArray;function Gr(z){return z!=null&&oi(z.length)&&!si(z)}var xn=tr||Qr;function Kr(z,J){return ti(z,J)}function si(z){if(!ai(z))return!1;var J=Wt(z);return J==l||J==a||J==p||J==E}function oi(z){return typeof z=="number"&&z>-1&&z%1==0&&z<=h}function ai(z){var J=typeof z;return z!=null&&(J=="object"||J=="function")}function Ht(z){return z!=null&&typeof z=="object"}var li=ke?Rt(ke):Fr;function Jr(z){return Gr(z)?kr(z):Rr(z)}function Yr(){return[]}function Qr(){return!1}L.exports=Kr})(gn,gn.exports);var Ui=gn.exports,Je={};Object.defineProperty(Je,"__esModule",{value:!0});Je.getAceInstance=Je.debounce=Je.editorEvents=Je.editorOptions=void 0;var lo=["minLines","maxLines","readOnly","highlightActiveLine","tabSize","enableBasicAutocompletion","enableLiveAutocompletion","enableSnippets"];Je.editorOptions=lo;var uo=["onChange","onFocus","onInput","onBlur","onCopy","onPaste","onSelectionChange","onCursorChange","onScroll","handleOptions","updateRef"];Je.editorEvents=uo;var ho=function(){var L;return typeof window>"u"?(He.window={},L=fn,delete He.window):window.ace?(L=window.ace,L.acequire=window.ace.require||window.ace.acequire):L=fn,L};Je.getAceInstance=ho;var co=function(L,n){var i=null;return function(){var u=this,v=arguments;clearTimeout(i),i=setTimeout(function(){L.apply(u,v)},n)}};Je.debounce=co;var po=Dt&&Dt.__extends||function(){var L=function(n,i){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,v){u.__proto__=v}||function(u,v){for(var o in v)Object.prototype.hasOwnProperty.call(v,o)&&(u[o]=v[o])},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 u(){this.constructor=n}n.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}(),jn=Dt&&Dt.__assign||function(){return jn=Object.assign||function(L){for(var n,i=1,u=arguments.length;i<u;i++){n=arguments[i];for(var v in n)Object.prototype.hasOwnProperty.call(n,v)&&(L[v]=n[v])}return L},jn.apply(this,arguments)};Object.defineProperty(Dt,"__esModule",{value:!0});var fo=fn,oe=Un,vi=pt,on=Ui,Lt=Je,yi=(0,Lt.getAceInstance)(),go=function(L){po(n,L);function n(i){var u=L.call(this,i)||this;return Lt.editorEvents.forEach(function(v){u[v]=u[v].bind(u)}),u.debounce=Lt.debounce,u}return n.prototype.isInShadow=function(i){for(var u=i&&i.parentNode;u;){if(u.toString()==="[object ShadowRoot]")return!0;u=u.parentNode}return!1},n.prototype.componentDidMount=function(){var i=this,u=this.props,v=u.className,o=u.onBeforeLoad,h=u.onValidate,d=u.mode,s=u.focus,p=u.theme,e=u.fontSize,t=u.lineHeight,r=u.value,l=u.defaultValue,a=u.showGutter,c=u.wrapEnabled,f=u.showPrintMargin,m=u.scrollMargin,y=m===void 0?[0,0,0,0]:m,D=u.keyboardHandler,E=u.onLoad,b=u.commands,g=u.annotations,S=u.markers,M=u.placeholder;this.editor=yi.edit(this.refEditor),o&&o(yi);for(var _=Object.keys(this.props.editorProps),T=0;T<_.length;T++)this.editor[_[T]]=this.props.editorProps[_[T]];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(l||r||""),this.props.navigateToFileEnd&&this.editor.navigateFileEnd(),this.editor.renderer.setShowGutter(a),this.editor.getSession().setUseWrapMode(c),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),M&&this.updatePlaceholder(),this.editor.getSession().selection.on("changeSelection",this.onSelectionChange),this.editor.getSession().selection.on("changeCursor",this.onCursorChange),h&&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;Lt.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)}),D&&this.editor.setKeyboardHandler("ace/keyboard/"+D),v&&(this.refEditor.className+=" "+v),E&&E(this.editor),this.editor.resize(),s&&this.editor.focus()},n.prototype.componentDidUpdate=function(i){for(var u=i,v=this.props,o=0;o<Lt.editorOptions.length;o++){var h=Lt.editorOptions[o];v[h]!==u[h]&&this.editor.setOption(h,v[h])}if(v.className!==u.className){var d=this.refEditor.className,s=d.trim().split(" "),p=u.className.trim().split(" ");p.forEach(function(r){var l=s.indexOf(r);s.splice(l,1)}),this.refEditor.className=" "+v.className+" "+s.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!==u.placeholder&&this.updatePlaceholder(),v.mode!==u.mode&&this.editor.getSession().setMode(typeof v.mode=="string"?"ace/mode/".concat(v.mode):v.mode),v.theme!==u.theme&&this.editor.setTheme("ace/theme/"+v.theme),v.keyboardHandler!==u.keyboardHandler&&(v.keyboardHandler?this.editor.setKeyboardHandler("ace/keyboard/"+v.keyboardHandler):this.editor.setKeyboardHandler(null)),v.fontSize!==u.fontSize&&this.editor.setFontSize(typeof v.fontSize=="number"?"".concat(v.fontSize,"px"):v.fontSize),v.lineHeight!==u.lineHeight&&(this.editor.container.style.lineHeight=typeof v.lineHeight=="number"?"".concat(v.lineHeight,"px"):v.lineHeight,this.editor.renderer.updateFontSize()),v.wrapEnabled!==u.wrapEnabled&&this.editor.getSession().setUseWrapMode(v.wrapEnabled),v.showPrintMargin!==u.showPrintMargin&&this.editor.setShowPrintMargin(v.showPrintMargin),v.showGutter!==u.showGutter&&this.editor.renderer.setShowGutter(v.showGutter),on(v.setOptions,u.setOptions)||this.handleOptions(v),(e||!on(v.annotations,u.annotations))&&this.editor.getSession().setAnnotations(v.annotations||[]),!on(v.markers,u.markers)&&Array.isArray(v.markers)&&this.handleMarkers(v.markers),on(v.scrollMargin,u.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 u=this.editor.getValue();this.props.onChange(u,i)}},n.prototype.onSelectionChange=function(i){if(this.props.onSelectionChange){var u=this.editor.getSelection();this.props.onSelectionChange(u,i)}},n.prototype.onCursorChange=function(i){if(this.props.onCursorChange){var u=this.editor.getSelection();this.props.onCursorChange(u,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 u=i.text;this.props.onCopy&&this.props.onCopy(u)},n.prototype.onPaste=function(i){var u=i.text;this.props.onPaste&&this.props.onPaste(u)},n.prototype.onScroll=function(){this.props.onScroll&&this.props.onScroll(this.editor)},n.prototype.handleOptions=function(i){for(var u=Object.keys(i.setOptions),v=0;v<u.length;v++)this.editor.setOption(u[v],i.setOptions[u[v]])},n.prototype.handleMarkers=function(i){var u=this,v=this.editor.getSession().getMarkers(!0);for(var o in v)v.hasOwnProperty(o)&&this.editor.getSession().removeMarker(v[o].id);v=this.editor.getSession().getMarkers(!1);for(var o in v)v.hasOwnProperty(o)&&v[o].clazz!=="ace_active-line"&&v[o].clazz!=="ace_selected-word"&&this.editor.getSession().removeMarker(v[o].id);i.forEach(function(h){var d=h.startRow,s=h.startCol,p=h.endRow,e=h.endCol,t=h.className,r=h.type,l=h.inFront,a=l===void 0?!1:l,c=new fo.Range(d,s,p,e);u.editor.getSession().addMarker(c,t,r,a)})},n.prototype.updatePlaceholder=function(){var i=this.editor,u=this.props.placeholder,v=!i.session.getValue().length,o=i.renderer.placeholderNode;!v&&o?(i.renderer.scroller.removeChild(i.renderer.placeholderNode),i.renderer.placeholderNode=null):v&&!o?(o=i.renderer.placeholderNode=document.createElement("div"),o.textContent=u||"",o.className="ace_comment ace_placeholder",o.style.padding="0 9px",o.style.position="absolute",o.style.zIndex="3",i.renderer.scroller.appendChild(o)):v&&o&&(o.textContent=u)},n.prototype.updateRef=function(i){this.refEditor=i},n.prototype.render=function(){var i=this.props,u=i.name,v=i.width,o=i.height,h=i.style,d=jn({width:v,height:o},h);return vi.createElement("div",{ref:this.updateRef,id:u,style:d})},n.propTypes={mode:oe.oneOfType([oe.string,oe.object]),focus:oe.bool,theme:oe.string,name:oe.string,className:oe.string,height:oe.string,width:oe.string,fontSize:oe.oneOfType([oe.number,oe.string]),lineHeight:oe.oneOfType([oe.number,oe.string]),showGutter:oe.bool,onChange:oe.func,onCopy:oe.func,onPaste:oe.func,onFocus:oe.func,onInput:oe.func,onBlur:oe.func,onScroll:oe.func,value:oe.string,defaultValue:oe.string,onLoad:oe.func,onSelectionChange:oe.func,onCursorChange:oe.func,onBeforeLoad:oe.func,onValidate:oe.func,minLines:oe.number,maxLines:oe.number,readOnly:oe.bool,highlightActiveLine:oe.bool,tabSize:oe.number,showPrintMargin:oe.bool,cursorStart:oe.number,debounceChangePeriod:oe.number,editorProps:oe.object,setOptions:oe.object,style:oe.object,scrollMargin:oe.array,annotations:oe.array,markers:oe.array,keyboardHandler:oe.string,wrapEnabled:oe.bool,enableSnippets:oe.bool,enableBasicAutocompletion:oe.oneOfType([oe.bool,oe.array]),enableLiveAutocompletion:oe.oneOfType([oe.bool,oe.array]),navigateToFileEnd:oe.bool,commands:oe.array,placeholder:oe.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}(vi.Component);Dt.default=go;var Gt={},ft={},Gi={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,u,v){var o=i("./lib/oop");i("./lib/lang");var h=i("./lib/event_emitter").EventEmitter,d=i("./editor").Editor,s=i("./virtual_renderer").VirtualRenderer,p=i("./edit_session").EditSession,e;e=function(t,r,l){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(l||1),this.$cEditor=this.$editors[0],this.on("focus",function(a){this.$cEditor=a}.bind(this))},function(){o.implement(this,h),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 s(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()),l=t.getUndoManager();return r.setUndoManager(l),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 l;r==null?l=this.$cEditor:l=this.$editors[r];var a=this.$editors.some(function(c){return c.session===t});return a&&(t=this.$cloneSession(t)),l.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,l;if(this.$orientation==this.BESIDE)for(var a=t/this.$splits,c=0;c<this.$splits;c++)l=this.$editors[c],l.container.style.width=a+"px",l.container.style.top="0px",l.container.style.left=c*a+"px",l.container.style.height=r+"px",l.resize();else for(var f=r/this.$splits,c=0;c<this.$splits;c++)l=this.$editors[c],l.container.style.width=t+"px",l.container.style.top=c*f+"px",l.container.style.left="0px",l.container.style.height=f+"px",l.resize()}}.call(e.prototype),u.Split=e}),ace.define("ace/ext/split",["require","exports","module","ace/split"],function(i,u,v){v.exports=i("../split")}),function(){ace.require(["ace/ext/split"],function(i){L&&(L.exports=i)})}()})(Gi);var mo=Gi.exports,vo="Expected a function",Ki="__lodash_hash_undefined__",yo="[object Function]",bo="[object GeneratorFunction]",wo="[object Symbol]",Co=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Eo=/^\w*$/,So=/^\./,Do=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ao=/[\\^$.*+?()[\]{}|]/g,xo=/\\(\\)?/g,$o=/^\[object .+?Constructor\]$/,To=typeof He=="object"&&He&&He.Object===Object&&He,_o=typeof self=="object"&&self&&self.Object===Object&&self,Jn=To||_o||Function("return this")();function ko(L,n){return L==null?void 0:L[n]}function Mo(L){var n=!1;if(L!=null&&typeof L.toString!="function")try{n=!!(L+"")}catch{}return n}var Lo=Array.prototype,Io=Function.prototype,Ji=Object.prototype,Ln=Jn["__core-js_shared__"],bi=function(){var L=/[^.]+$/.exec(Ln&&Ln.keys&&Ln.keys.IE_PROTO||"");return L?"Symbol(src)_1."+L:""}(),Yi=Io.toString,Yn=Ji.hasOwnProperty,Qi=Ji.toString,Fo=RegExp("^"+Yi.call(Yn).replace(Ao,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),wi=Jn.Symbol,Ro=Lo.splice,Oo=Xi(Jn,"Map"),Kt=Xi(Object,"create"),Ci=wi?wi.prototype:void 0,Ei=Ci?Ci.toString:void 0;function At(L){var n=-1,i=L?L.length:0;for(this.clear();++n<i;){var u=L[n];this.set(u[0],u[1])}}function No(){this.__data__=Kt?Kt(null):{}}function Bo(L){return this.has(L)&&delete this.__data__[L]}function Po(L){var n=this.__data__;if(Kt){var i=n[L];return i===Ki?void 0:i}return Yn.call(n,L)?n[L]:void 0}function Wo(L){var n=this.__data__;return Kt?n[L]!==void 0:Yn.call(n,L)}function Ho(L,n){var i=this.__data__;return i[L]=Kt&&n===void 0?Ki:n,this}At.prototype.clear=No;At.prototype.delete=Bo;At.prototype.get=Po;At.prototype.has=Wo;At.prototype.set=Ho;function Ft(L){var n=-1,i=L?L.length:0;for(this.clear();++n<i;){var u=L[n];this.set(u[0],u[1])}}function zo(){this.__data__=[]}function jo(L){var n=this.__data__,i=vn(n,L);if(i<0)return!1;var u=n.length-1;return i==u?n.pop():Ro.call(n,i,1),!0}function Vo(L){var n=this.__data__,i=vn(n,L);return i<0?void 0:n[i][1]}function Uo(L){return vn(this.__data__,L)>-1}function Go(L,n){var i=this.__data__,u=vn(i,L);return u<0?i.push([L,n]):i[u][1]=n,this}Ft.prototype.clear=zo;Ft.prototype.delete=jo;Ft.prototype.get=Vo;Ft.prototype.has=Uo;Ft.prototype.set=Go;function xt(L){var n=-1,i=L?L.length:0;for(this.clear();++n<i;){var u=L[n];this.set(u[0],u[1])}}function Ko(){this.__data__={hash:new At,map:new(Oo||Ft),string:new At}}function Jo(L){return yn(this,L).delete(L)}function Yo(L){return yn(this,L).get(L)}function Qo(L){return yn(this,L).has(L)}function Xo(L,n){return yn(this,L).set(L,n),this}xt.prototype.clear=Ko;xt.prototype.delete=Jo;xt.prototype.get=Yo;xt.prototype.has=Qo;xt.prototype.set=Xo;function vn(L,n){for(var i=L.length;i--;)if(la(L[i][0],n))return i;return-1}function Zo(L,n){n=na(n,L)?[n]:ta(n);for(var i=0,u=n.length;L!=null&&i<u;)L=L[oa(n[i++])];return i&&i==u?L:void 0}function qo(L){if(!qi(L)||ra(L))return!1;var n=ua(L)||Mo(L)?Fo:$o;return n.test(aa(L))}function ea(L){if(typeof L=="string")return L;if(Xn(L))return Ei?Ei.call(L):"";var n=L+"";return n=="0"&&1/L==-1/0?"-0":n}function ta(L){return Zi(L)?L:sa(L)}function yn(L,n){var i=L.__data__;return ia(n)?i[typeof n=="string"?"string":"hash"]:i.map}function Xi(L,n){var i=ko(L,n);return qo(i)?i:void 0}function na(L,n){if(Zi(L))return!1;var i=typeof L;return i=="number"||i=="symbol"||i=="boolean"||L==null||Xn(L)?!0:Eo.test(L)||!Co.test(L)||n!=null&&L in Object(n)}function ia(L){var n=typeof L;return n=="string"||n=="number"||n=="symbol"||n=="boolean"?L!=="__proto__":L===null}function ra(L){return!!bi&&bi in L}var sa=Qn(function(L){L=ca(L);var n=[];return So.test(L)&&n.push(""),L.replace(Do,function(i,u,v,o){n.push(v?o.replace(xo,"$1"):u||i)}),n});function oa(L){if(typeof L=="string"||Xn(L))return L;var n=L+"";return n=="0"&&1/L==-1/0?"-0":n}function aa(L){if(L!=null){try{return Yi.call(L)}catch{}try{return L+""}catch{}}return""}function Qn(L,n){if(typeof L!="function"||n&&typeof n!="function")throw new TypeError(vo);var i=function(){var u=arguments,v=n?n.apply(this,u):u[0],o=i.cache;if(o.has(v))return o.get(v);var h=L.apply(this,u);return i.cache=o.set(v,h),h};return i.cache=new(Qn.Cache||xt),i}Qn.Cache=xt;function la(L,n){return L===n||L!==L&&n!==n}var Zi=Array.isArray;function ua(L){var n=qi(L)?Qi.call(L):"";return n==yo||n==bo}function qi(L){var n=typeof L;return!!L&&(n=="object"||n=="function")}function ha(L){return!!L&&typeof L=="object"}function Xn(L){return typeof L=="symbol"||ha(L)&&Qi.call(L)==wo}function ca(L){return L==null?"":ea(L)}function pa(L,n,i){var u=L==null?void 0:Zo(L,n);return u===void 0?i:u}var da=pa,fa=ft&&ft.__extends||function(){var L=function(n,i){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,v){u.__proto__=v}||function(u,v){for(var o in v)Object.prototype.hasOwnProperty.call(v,o)&&(u[o]=v[o])},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 u(){this.constructor=n}n.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}(),Vn=ft&&ft.__assign||function(){return Vn=Object.assign||function(L){for(var n,i=1,u=arguments.length;i<u;i++){n=arguments[i];for(var v in n)Object.prototype.hasOwnProperty.call(n,v)&&(L[v]=n[v])}return L},Vn.apply(this,arguments)};Object.defineProperty(ft,"__esModule",{value:!0});var St=Je,In=(0,St.getAceInstance)(),ga=fn,ma=mo,le=Un,Si=pt,Fn=Ui,tt=da,va=function(L){fa(n,L);function n(i){var u=L.call(this,i)||this;return St.editorEvents.forEach(function(v){u[v]=u[v].bind(u)}),u.debounce=St.debounce,u}return n.prototype.isInShadow=function(i){for(var u=i&&i.parentNode;u;){if(u.toString()==="[object ShadowRoot]")return!0;u=u.parentNode}return!1},n.prototype.componentDidMount=function(){var i=this,u=this.props,v=u.className,o=u.onBeforeLoad,h=u.mode,d=u.focus,s=u.theme,p=u.fontSize,e=u.value,t=u.defaultValue,r=u.cursorStart,l=u.showGutter,a=u.wrapEnabled,c=u.showPrintMargin,f=u.scrollMargin,m=f===void 0?[0,0,0,0]:f,y=u.keyboardHandler,D=u.onLoad,E=u.commands,b=u.annotations,g=u.markers,S=u.splits;this.editor=In.edit(this.refEditor),this.isInShadow(this.refEditor)&&this.editor.renderer.attachToShadowRoot(),this.editor.setTheme("ace/theme/".concat(s)),o&&o(In);var M=Object.keys(this.props.editorProps),_=new ma.Split(this.editor.container,"ace/theme/".concat(s),S);this.editor.env.split=_,this.splitEditor=_.getEditor(0),this.split=_,this.editor.setShowPrintMargin(!1),this.editor.renderer.setShowGutter(!1);var T=this.splitEditor.$options;this.props.debounceChangePeriod&&(this.onChange=this.debounce(this.onChange,this.props.debounceChangePeriod)),_.forEach(function(A,$){for(var C=0;C<M.length;C++)A[M[C]]=i.props.editorProps[M[C]];var w=tt(t,$),x=tt(e,$,"");A.session.setUndoManager(new In.UndoManager),A.setTheme("ace/theme/".concat(s)),A.renderer.setScrollMargin(m[0],m[1],m[2],m[3]),A.getSession().setMode("ace/mode/".concat(h)),A.setFontSize(p),A.renderer.setShowGutter(l),A.getSession().setUseWrapMode(a),A.setShowPrintMargin(c),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(w===void 0?x:w,r);var I=tt(b,$,[]),R=tt(g,$,[]);A.getSession().setAnnotations(I),R&&R.length>0&&i.handleMarkers(R,A);for(var C=0;C<St.editorOptions.length;C++){var O=St.editorOptions[C];T.hasOwnProperty(O)?A.setOption(O,i.props[O]):i.props[O]&&console.warn("ReaceAce: editor option ".concat(O," 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),D&&D(F)},n.prototype.componentDidUpdate=function(i){var u=this,v=i,o=this.props,h=this.editor.env.split;if(o.splits!==v.splits&&h.setSplits(o.splits),o.orientation!==v.orientation&&h.setOrientation(o.orientation==="below"?h.BELOW:h.BESIDE),h.forEach(function(e,t){o.mode!==v.mode&&e.getSession().setMode("ace/mode/"+o.mode),o.keyboardHandler!==v.keyboardHandler&&(o.keyboardHandler?e.setKeyboardHandler("ace/keyboard/"+o.keyboardHandler):e.setKeyboardHandler(null)),o.fontSize!==v.fontSize&&e.setFontSize(o.fontSize),o.wrapEnabled!==v.wrapEnabled&&e.getSession().setUseWrapMode(o.wrapEnabled),o.showPrintMargin!==v.showPrintMargin&&e.setShowPrintMargin(o.showPrintMargin),o.showGutter!==v.showGutter&&e.renderer.setShowGutter(o.showGutter);for(var r=0;r<St.editorOptions.length;r++){var l=St.editorOptions[r];o[l]!==v[l]&&e.setOption(l,o[l])}Fn(o.setOptions,v.setOptions)||u.handleOptions(o,e);var a=tt(o.value,t,"");if(e.getValue()!==a){u.silent=!0;var c=e.session.selection.toJSON();e.setValue(a,o.cursorStart),e.session.selection.fromJSON(c),u.silent=!1}var f=tt(o.annotations,t,[]),m=tt(v.annotations,t,[]);Fn(f,m)||e.getSession().setAnnotations(f);var y=tt(o.markers,t,[]),D=tt(v.markers,t,[]);!Fn(y,D)&&Array.isArray(y)&&u.handleMarkers(y,e)}),o.className!==v.className){var d=this.refEditor.className,s=d.trim().split(" "),p=v.className.trim().split(" ");p.forEach(function(e){var t=s.indexOf(e);s.splice(t,1)}),this.refEditor.className=" "+o.className+" "+s.join(" ")}o.theme!==v.theme&&h.setTheme("ace/theme/"+o.theme),o.focus&&!v.focus&&this.splitEditor.focus(),(o.height!==this.props.height||o.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 u=[];this.editor.env.split.forEach(function(v){u.push(v.getValue())}),this.props.onChange(u,i)}},n.prototype.onSelectionChange=function(i){if(this.props.onSelectionChange){var u=[];this.editor.env.split.forEach(function(v){u.push(v.getSelection())}),this.props.onSelectionChange(u,i)}},n.prototype.onCursorChange=function(i){if(this.props.onCursorChange){var u=[];this.editor.env.split.forEach(function(v){u.push(v.getSelection())}),this.props.onCursorChange(u,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,u){for(var v=Object.keys(i.setOptions),o=0;o<v.length;o++)u.setOption(v[o],i.setOptions[v[o]])},n.prototype.handleMarkers=function(i,u){var v=u.getSession().getMarkers(!0);for(var o in v)v.hasOwnProperty(o)&&u.getSession().removeMarker(v[o].id);v=u.getSession().getMarkers(!1);for(var o in v)v.hasOwnProperty(o)&&u.getSession().removeMarker(v[o].id);i.forEach(function(h){var d=h.startRow,s=h.startCol,p=h.endRow,e=h.endCol,t=h.className,r=h.type,l=h.inFront,a=l===void 0?!1:l,c=new ga.Range(d,s,p,e);u.getSession().addMarker(c,t,r,a)})},n.prototype.updateRef=function(i){this.refEditor=i},n.prototype.render=function(){var i=this.props,u=i.name,v=i.width,o=i.height,h=i.style,d=Vn({width:v,height:o},h);return Si.createElement("div",{ref:this.updateRef,id:u,style:d})},n.propTypes={className:le.string,debounceChangePeriod:le.number,defaultValue:le.arrayOf(le.string),focus:le.bool,fontSize:le.oneOfType([le.number,le.string]),height:le.string,mode:le.string,name:le.string,onBlur:le.func,onChange:le.func,onCopy:le.func,onFocus:le.func,onInput:le.func,onLoad:le.func,onPaste:le.func,onScroll:le.func,orientation:le.string,showGutter:le.bool,splits:le.number,theme:le.string,value:le.arrayOf(le.string),width:le.string,onSelectionChange:le.func,onCursorChange:le.func,onBeforeLoad:le.func,minLines:le.number,maxLines:le.number,readOnly:le.bool,highlightActiveLine:le.bool,tabSize:le.number,showPrintMargin:le.bool,cursorStart:le.number,editorProps:le.object,setOptions:le.object,style:le.object,scrollMargin:le.array,annotations:le.array,markers:le.array,keyboardHandler:le.string,wrapEnabled:le.bool,enableBasicAutocompletion:le.oneOfType([le.bool,le.array]),enableLiveAutocompletion:le.oneOfType([le.bool,le.array]),commands:le.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}(Si.Component);ft.default=va;var er={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,u=1,v=0;n.Diff=function(o,h){return[o,h]},n.prototype.diff_main=function(o,h,d,s){typeof s>"u"&&(this.Diff_Timeout<=0?s=Number.MAX_VALUE:s=new Date().getTime()+this.Diff_Timeout*1e3);var p=s;if(o==null||h==null)throw new Error("Null input. (diff_main)");if(o==h)return o?[new n.Diff(v,o)]:[];typeof d>"u"&&(d=!0);var e=d,t=this.diff_commonPrefix(o,h),r=o.substring(0,t);o=o.substring(t),h=h.substring(t),t=this.diff_commonSuffix(o,h);var l=o.substring(o.length-t);o=o.substring(0,o.length-t),h=h.substring(0,h.length-t);var a=this.diff_compute_(o,h,e,p);return r&&a.unshift(new n.Diff(v,r)),l&&a.push(new n.Diff(v,l)),this.diff_cleanupMerge(a),a},n.prototype.diff_compute_=function(o,h,d,s){var p;if(!o)return[new n.Diff(u,h)];if(!h)return[new n.Diff(i,o)];var e=o.length>h.length?o:h,t=o.length>h.length?h:o,r=e.indexOf(t);if(r!=-1)return p=[new n.Diff(u,e.substring(0,r)),new n.Diff(v,t),new n.Diff(u,e.substring(r+t.length))],o.length>h.length&&(p[0][0]=p[2][0]=i),p;if(t.length==1)return[new n.Diff(i,o),new n.Diff(u,h)];var l=this.diff_halfMatch_(o,h);if(l){var a=l[0],c=l[1],f=l[2],m=l[3],y=l[4],D=this.diff_main(a,f,d,s),E=this.diff_main(c,m,d,s);return D.concat([new n.Diff(v,y)],E)}return d&&o.length>100&&h.length>100?this.diff_lineMode_(o,h,s):this.diff_bisect_(o,h,s)},n.prototype.diff_lineMode_=function(o,h,d){var s=this.diff_linesToChars_(o,h);o=s.chars1,h=s.chars2;var p=s.lineArray,e=this.diff_main(o,h,!1,d);this.diff_charsToLines_(e,p),this.diff_cleanupSemantic(e),e.push(new n.Diff(v,""));for(var t=0,r=0,l=0,a="",c="";t<e.length;){switch(e[t][0]){case u:l++,c+=e[t][1];break;case i:r++,a+=e[t][1];break;case v:if(r>=1&&l>=1){e.splice(t-r-l,r+l),t=t-r-l;for(var f=this.diff_main(a,c,!1,d),m=f.length-1;m>=0;m--)e.splice(t,0,f[m]);t=t+f.length}l=0,r=0,a="",c="";break}t++}return e.pop(),e},n.prototype.diff_bisect_=function(o,h,d){for(var s=o.length,p=h.length,e=Math.ceil((s+p)/2),t=e,r=2*e,l=new Array(r),a=new Array(r),c=0;c<r;c++)l[c]=-1,a[c]=-1;l[t+1]=0,a[t+1]=0;for(var f=s-p,m=f%2!=0,y=0,D=0,E=0,b=0,g=0;g<e&&!(new Date().getTime()>d);g++){for(var S=-g+y;S<=g-D;S+=2){var M=t+S,_;S==-g||S!=g&&l[M-1]<l[M+1]?_=l[M+1]:_=l[M-1]+1;for(var T=_-S;_<s&&T<p&&o.charAt(_)==h.charAt(T);)_++,T++;if(l[M]=_,_>s)D+=2;else if(T>p)y+=2;else if(m){var F=t+f-S;if(F>=0&&F<r&&a[F]!=-1){var A=s-a[F];if(_>=A)return this.diff_bisectSplit_(o,h,_,T,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 C=A-$;A<s&&C<p&&o.charAt(s-A-1)==h.charAt(p-C-1);)A++,C++;if(a[F]=A,A>s)b+=2;else if(C>p)E+=2;else if(!m){var M=t+f-$;if(M>=0&&M<r&&l[M]!=-1){var _=l[M],T=t+_-M;if(A=s-A,_>=A)return this.diff_bisectSplit_(o,h,_,T,d)}}}}return[new n.Diff(i,o),new n.Diff(u,h)]},n.prototype.diff_bisectSplit_=function(o,h,d,s,p){var e=o.substring(0,d),t=h.substring(0,s),r=o.substring(d),l=h.substring(s),a=this.diff_main(e,t,!1,p),c=this.diff_main(r,l,!1,p);return a.concat(c)},n.prototype.diff_linesToChars_=function(o,h){var d=[],s={};d[0]="";function p(l){for(var a="",c=0,f=-1,m=d.length;f<l.length-1;){f=l.indexOf(`
|
|
1000
|
-
`,c),f==-1&&(f=l.length-1);var y=l.substring(c,f+1);(s.hasOwnProperty?s.hasOwnProperty(y):s[y]!==void 0)?a+=String.fromCharCode(s[y]):(m==e&&(y=l.substring(c),f=l.length),a+=String.fromCharCode(m),s[y]=m,d[m++]=y),c=f+1}return a}var e=4e4,t=p(o);e=65535;var r=p(h);return{chars1:t,chars2:r,lineArray:d}},n.prototype.diff_charsToLines_=function(o,h){for(var d=0;d<o.length;d++){for(var s=o[d][1],p=[],e=0;e<s.length;e++)p[e]=h[s.charCodeAt(e)];o[d][1]=p.join("")}},n.prototype.diff_commonPrefix=function(o,h){if(!o||!h||o.charAt(0)!=h.charAt(0))return 0;for(var d=0,s=Math.min(o.length,h.length),p=s,e=0;d<p;)o.substring(e,p)==h.substring(e,p)?(d=p,e=d):s=p,p=Math.floor((s-d)/2+d);return p},n.prototype.diff_commonSuffix=function(o,h){if(!o||!h||o.charAt(o.length-1)!=h.charAt(h.length-1))return 0;for(var d=0,s=Math.min(o.length,h.length),p=s,e=0;d<p;)o.substring(o.length-p,o.length-e)==h.substring(h.length-p,h.length-e)?(d=p,e=d):s=p,p=Math.floor((s-d)/2+d);return p},n.prototype.diff_commonOverlap_=function(o,h){var d=o.length,s=h.length;if(d==0||s==0)return 0;d>s?o=o.substring(d-s):d<s&&(h=h.substring(0,d));var p=Math.min(d,s);if(o==h)return p;for(var e=0,t=1;;){var r=o.substring(p-t),l=h.indexOf(r);if(l==-1)return e;t+=l,(l==0||o.substring(p-t)==h.substring(0,t))&&(e=t,t++)}},n.prototype.diff_halfMatch_=function(o,h){if(this.Diff_Timeout<=0)return null;var d=o.length>h.length?o:h,s=o.length>h.length?h:o;if(d.length<4||s.length*2<d.length)return null;var p=this;function e(D,E,b){for(var g=D.substring(b,b+Math.floor(D.length/4)),S=-1,M="",_,T,F,A;(S=E.indexOf(g,S+1))!=-1;){var $=p.diff_commonPrefix(D.substring(b),E.substring(S)),C=p.diff_commonSuffix(D.substring(0,b),E.substring(0,S));M.length<C+$&&(M=E.substring(S-C,S)+E.substring(S,S+$),_=D.substring(0,b-C),T=D.substring(b+$),F=E.substring(0,S-C),A=E.substring(S+$))}return M.length*2>=D.length?[_,T,F,A,M]:null}var t=e(d,s,Math.ceil(d.length/4)),r=e(d,s,Math.ceil(d.length/2)),l;if(!t&&!r)return null;r?t?l=t[4].length>r[4].length?t:r:l=r:l=t;var a,c,f,m;o.length>h.length?(a=l[0],c=l[1],f=l[2],m=l[3]):(f=l[0],m=l[1],a=l[2],c=l[3]);var y=l[4];return[a,c,f,m,y]},n.prototype.diff_cleanupSemantic=function(o){for(var h=!1,d=[],s=0,p=null,e=0,t=0,r=0,l=0,a=0;e<o.length;)o[e][0]==v?(d[s++]=e,t=l,r=a,l=0,a=0,p=o[e][1]):(o[e][0]==u?l+=o[e][1].length:a+=o[e][1].length,p&&p.length<=Math.max(t,r)&&p.length<=Math.max(l,a)&&(o.splice(d[s-1],0,new n.Diff(i,p)),o[d[s-1]+1][0]=u,s--,s--,e=s>0?d[s-1]:-1,t=0,r=0,l=0,a=0,p=null,h=!0)),e++;for(h&&this.diff_cleanupMerge(o),this.diff_cleanupSemanticLossless(o),e=1;e<o.length;){if(o[e-1][0]==i&&o[e][0]==u){var c=o[e-1][1],f=o[e][1],m=this.diff_commonOverlap_(c,f),y=this.diff_commonOverlap_(f,c);m>=y?(m>=c.length/2||m>=f.length/2)&&(o.splice(e,0,new n.Diff(v,f.substring(0,m))),o[e-1][1]=c.substring(0,c.length-m),o[e+1][1]=f.substring(m),e++):(y>=c.length/2||y>=f.length/2)&&(o.splice(e,0,new n.Diff(v,c.substring(0,y))),o[e-1][0]=u,o[e-1][1]=f.substring(0,f.length-y),o[e+1][0]=i,o[e+1][1]=c.substring(y),e++),e++}e++}},n.prototype.diff_cleanupSemanticLossless=function(o){function h(y,D){if(!y||!D)return 6;var E=y.charAt(y.length-1),b=D.charAt(0),g=E.match(n.nonAlphaNumericRegex_),S=b.match(n.nonAlphaNumericRegex_),M=g&&E.match(n.whitespaceRegex_),_=S&&b.match(n.whitespaceRegex_),T=M&&E.match(n.linebreakRegex_),F=_&&b.match(n.linebreakRegex_),A=T&&y.match(n.blanklineEndRegex_),$=F&&D.match(n.blanklineStartRegex_);return A||$?5:T||F?4:g&&!M&&_?3:M||_?2:g||S?1:0}for(var d=1;d<o.length-1;){if(o[d-1][0]==v&&o[d+1][0]==v){var s=o[d-1][1],p=o[d][1],e=o[d+1][1],t=this.diff_commonSuffix(s,p);if(t){var r=p.substring(p.length-t);s=s.substring(0,s.length-t),p=r+p.substring(0,p.length-t),e=r+e}for(var l=s,a=p,c=e,f=h(s,p)+h(p,e);p.charAt(0)===e.charAt(0);){s+=p.charAt(0),p=p.substring(1)+e.charAt(0),e=e.substring(1);var m=h(s,p)+h(p,e);m>=f&&(f=m,l=s,a=p,c=e)}o[d-1][1]!=l&&(l?o[d-1][1]=l:(o.splice(d-1,1),d--),o[d][1]=a,c?o[d+1][1]=c:(o.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(o){for(var h=!1,d=[],s=0,p=null,e=0,t=!1,r=!1,l=!1,a=!1;e<o.length;)o[e][0]==v?(o[e][1].length<this.Diff_EditCost&&(l||a)?(d[s++]=e,t=l,r=a,p=o[e][1]):(s=0,p=null),l=a=!1):(o[e][0]==i?a=!0:l=!0,p&&(t&&r&&l&&a||p.length<this.Diff_EditCost/2&&t+r+l+a==3)&&(o.splice(d[s-1],0,new n.Diff(i,p)),o[d[s-1]+1][0]=u,s--,p=null,t&&r?(l=a=!0,s=0):(s--,e=s>0?d[s-1]:-1,l=a=!1),h=!0)),e++;h&&this.diff_cleanupMerge(o)},n.prototype.diff_cleanupMerge=function(o){o.push(new n.Diff(v,""));for(var h=0,d=0,s=0,p="",e="",t;h<o.length;)switch(o[h][0]){case u:s++,e+=o[h][1],h++;break;case i:d++,p+=o[h][1],h++;break;case v:d+s>1?(d!==0&&s!==0&&(t=this.diff_commonPrefix(e,p),t!==0&&(h-d-s>0&&o[h-d-s-1][0]==v?o[h-d-s-1][1]+=e.substring(0,t):(o.splice(0,0,new n.Diff(v,e.substring(0,t))),h++),e=e.substring(t),p=p.substring(t)),t=this.diff_commonSuffix(e,p),t!==0&&(o[h][1]=e.substring(e.length-t)+o[h][1],e=e.substring(0,e.length-t),p=p.substring(0,p.length-t))),h-=d+s,o.splice(h,d+s),p.length&&(o.splice(h,0,new n.Diff(i,p)),h++),e.length&&(o.splice(h,0,new n.Diff(u,e)),h++),h++):h!==0&&o[h-1][0]==v?(o[h-1][1]+=o[h][1],o.splice(h,1)):h++,s=0,d=0,p="",e="";break}o[o.length-1][1]===""&&o.pop();var r=!1;for(h=1;h<o.length-1;)o[h-1][0]==v&&o[h+1][0]==v&&(o[h][1].substring(o[h][1].length-o[h-1][1].length)==o[h-1][1]?(o[h][1]=o[h-1][1]+o[h][1].substring(0,o[h][1].length-o[h-1][1].length),o[h+1][1]=o[h-1][1]+o[h+1][1],o.splice(h-1,1),r=!0):o[h][1].substring(0,o[h+1][1].length)==o[h+1][1]&&(o[h-1][1]+=o[h+1][1],o[h][1]=o[h][1].substring(o[h+1][1].length)+o[h+1][1],o.splice(h+1,1),r=!0)),h++;r&&this.diff_cleanupMerge(o)},n.prototype.diff_xIndex=function(o,h){var d=0,s=0,p=0,e=0,t;for(t=0;t<o.length&&(o[t][0]!==u&&(d+=o[t][1].length),o[t][0]!==i&&(s+=o[t][1].length),!(d>h));t++)p=d,e=s;return o.length!=t&&o[t][0]===i?e:e+(h-p)},n.prototype.diff_prettyHtml=function(o){for(var h=[],d=/&/g,s=/</g,p=/>/g,e=/\n/g,t=0;t<o.length;t++){var r=o[t][0],l=o[t][1],a=l.replace(d,"&").replace(s,"<").replace(p,">").replace(e,"¶<br>");switch(r){case u:h[t]='<ins style="background:#e6ffe6;">'+a+"</ins>";break;case i:h[t]='<del style="background:#ffe6e6;">'+a+"</del>";break;case v:h[t]="<span>"+a+"</span>";break}}return h.join("")},n.prototype.diff_text1=function(o){for(var h=[],d=0;d<o.length;d++)o[d][0]!==u&&(h[d]=o[d][1]);return h.join("")},n.prototype.diff_text2=function(o){for(var h=[],d=0;d<o.length;d++)o[d][0]!==i&&(h[d]=o[d][1]);return h.join("")},n.prototype.diff_levenshtein=function(o){for(var h=0,d=0,s=0,p=0;p<o.length;p++){var e=o[p][0],t=o[p][1];switch(e){case u:d+=t.length;break;case i:s+=t.length;break;case v:h+=Math.max(d,s),d=0,s=0;break}}return h+=Math.max(d,s),h},n.prototype.diff_toDelta=function(o){for(var h=[],d=0;d<o.length;d++)switch(o[d][0]){case u:h[d]="+"+encodeURI(o[d][1]);break;case i:h[d]="-"+o[d][1].length;break;case v:h[d]="="+o[d][1].length;break}return h.join(" ").replace(/%20/g," ")},n.prototype.diff_fromDelta=function(o,h){for(var d=[],s=0,p=0,e=h.split(/\t/g),t=0;t<e.length;t++){var r=e[t].substring(1);switch(e[t].charAt(0)){case"+":try{d[s++]=new n.Diff(u,decodeURI(r))}catch{throw new Error("Illegal escape in diff_fromDelta: "+r)}break;case"-":case"=":var l=parseInt(r,10);if(isNaN(l)||l<0)throw new Error("Invalid number in diff_fromDelta: "+r);var a=o.substring(p,p+=l);e[t].charAt(0)=="="?d[s++]=new n.Diff(v,a):d[s++]=new n.Diff(i,a);break;default:if(e[t])throw new Error("Invalid diff operation in diff_fromDelta: "+e[t])}}if(p!=o.length)throw new Error("Delta length ("+p+") does not equal source text length ("+o.length+").");return d},n.prototype.match_main=function(o,h,d){if(o==null||h==null||d==null)throw new Error("Null input. (match_main)");return d=Math.max(0,Math.min(d,o.length)),o==h?0:o.length?o.substring(d,d+h.length)==h?d:this.match_bitap_(o,h,d):-1},n.prototype.match_bitap_=function(o,h,d){if(h.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var s=this.match_alphabet_(h),p=this;function e(_,T){var F=_/h.length,A=Math.abs(d-T);return p.Match_Distance?F+A/p.Match_Distance:A?1:F}var t=this.Match_Threshold,r=o.indexOf(h,d);r!=-1&&(t=Math.min(e(0,r),t),r=o.lastIndexOf(h,d+h.length),r!=-1&&(t=Math.min(e(0,r),t)));var l=1<<h.length-1;r=-1;for(var a,c,f=h.length+o.length,m,y=0;y<h.length;y++){for(a=0,c=f;a<c;)e(y,d+c)<=t?a=c:f=c,c=Math.floor((f-a)/2+a);f=c;var D=Math.max(1,d-c+1),E=Math.min(d+c,o.length)+h.length,b=Array(E+2);b[E+1]=(1<<y)-1;for(var g=E;g>=D;g--){var S=s[o.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]&l){var M=e(y,g-1);if(M<=t)if(t=M,r=g-1,r>d)D=Math.max(1,2*d-r);else break}}if(e(y+1,d)>t)break;m=b}return r},n.prototype.match_alphabet_=function(o){for(var h={},d=0;d<o.length;d++)h[o.charAt(d)]=0;for(var d=0;d<o.length;d++)h[o.charAt(d)]|=1<<o.length-d-1;return h},n.prototype.patch_addContext_=function(o,h){if(h.length!=0){if(o.start2===null)throw Error("patch not initialized");for(var d=h.substring(o.start2,o.start2+o.length1),s=0;h.indexOf(d)!=h.lastIndexOf(d)&&d.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)s+=this.Patch_Margin,d=h.substring(o.start2-s,o.start2+o.length1+s);s+=this.Patch_Margin;var p=h.substring(o.start2-s,o.start2);p&&o.diffs.unshift(new n.Diff(v,p));var e=h.substring(o.start2+o.length1,o.start2+o.length1+s);e&&o.diffs.push(new n.Diff(v,e)),o.start1-=p.length,o.start2-=p.length,o.length1+=p.length+e.length,o.length2+=p.length+e.length}},n.prototype.patch_make=function(o,h,d){var s,p;if(typeof o=="string"&&typeof h=="string"&&typeof d>"u")s=o,p=this.diff_main(s,h,!0),p.length>2&&(this.diff_cleanupSemantic(p),this.diff_cleanupEfficiency(p));else if(o&&typeof o=="object"&&typeof h>"u"&&typeof d>"u")p=o,s=this.diff_text1(p);else if(typeof o=="string"&&h&&typeof h=="object"&&typeof d>"u")s=o,p=h;else if(typeof o=="string"&&typeof h=="string"&&d&&typeof d=="object")s=o,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,l=0,a=0,c=s,f=s,m=0;m<p.length;m++){var y=p[m][0],D=p[m][1];switch(!r&&y!==v&&(t.start1=l,t.start2=a),y){case u:t.diffs[r++]=p[m],t.length2+=D.length,f=f.substring(0,a)+D+f.substring(a);break;case i:t.length1+=D.length,t.diffs[r++]=p[m],f=f.substring(0,a)+f.substring(a+D.length);break;case v:D.length<=2*this.Patch_Margin&&r&&p.length!=m+1?(t.diffs[r++]=p[m],t.length1+=D.length,t.length2+=D.length):D.length>=2*this.Patch_Margin&&r&&(this.patch_addContext_(t,c),e.push(t),t=new n.patch_obj,r=0,c=f,l=a);break}y!==u&&(l+=D.length),y!==i&&(a+=D.length)}return r&&(this.patch_addContext_(t,c),e.push(t)),e},n.prototype.patch_deepCopy=function(o){for(var h=[],d=0;d<o.length;d++){var s=o[d],p=new n.patch_obj;p.diffs=[];for(var e=0;e<s.diffs.length;e++)p.diffs[e]=new n.Diff(s.diffs[e][0],s.diffs[e][1]);p.start1=s.start1,p.start2=s.start2,p.length1=s.length1,p.length2=s.length2,h[d]=p}return h},n.prototype.patch_apply=function(o,h){if(o.length==0)return[h,[]];o=this.patch_deepCopy(o);var d=this.patch_addPadding(o);h=d+h+d,this.patch_splitMax(o);for(var s=0,p=[],e=0;e<o.length;e++){var t=o[e].start2+s,r=this.diff_text1(o[e].diffs),l,a=-1;if(r.length>this.Match_MaxBits?(l=this.match_main(h,r.substring(0,this.Match_MaxBits),t),l!=-1&&(a=this.match_main(h,r.substring(r.length-this.Match_MaxBits),t+r.length-this.Match_MaxBits),(a==-1||l>=a)&&(l=-1))):l=this.match_main(h,r,t),l==-1)p[e]=!1,s-=o[e].length2-o[e].length1;else{p[e]=!0,s=l-t;var c;if(a==-1?c=h.substring(l,l+r.length):c=h.substring(l,a+this.Match_MaxBits),r==c)h=h.substring(0,l)+this.diff_text2(o[e].diffs)+h.substring(l+r.length);else{var f=this.diff_main(r,c,!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,D=0;D<o[e].diffs.length;D++){var E=o[e].diffs[D];E[0]!==v&&(y=this.diff_xIndex(f,m)),E[0]===u?h=h.substring(0,l+y)+E[1]+h.substring(l+y):E[0]===i&&(h=h.substring(0,l+y)+h.substring(l+this.diff_xIndex(f,m+E[1].length))),E[0]!==i&&(m+=E[1].length)}}}}}return h=h.substring(d.length,h.length-d.length),[h,p]},n.prototype.patch_addPadding=function(o){for(var h=this.Patch_Margin,d="",s=1;s<=h;s++)d+=String.fromCharCode(s);for(var s=0;s<o.length;s++)o[s].start1+=h,o[s].start2+=h;var p=o[0],e=p.diffs;if(e.length==0||e[0][0]!=v)e.unshift(new n.Diff(v,d)),p.start1-=h,p.start2-=h,p.length1+=h,p.length2+=h;else if(h>e[0][1].length){var t=h-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=o[o.length-1],e=p.diffs,e.length==0||e[e.length-1][0]!=v)e.push(new n.Diff(v,d)),p.length1+=h,p.length2+=h;else if(h>e[e.length-1][1].length){var t=h-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(o){for(var h=this.Match_MaxBits,d=0;d<o.length;d++)if(!(o[d].length1<=h)){var s=o[d];o.splice(d--,1);for(var p=s.start1,e=s.start2,t="";s.diffs.length!==0;){var r=new n.patch_obj,l=!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)));s.diffs.length!==0&&r.length1<h-this.Patch_Margin;){var a=s.diffs[0][0],c=s.diffs[0][1];a===u?(r.length2+=c.length,e+=c.length,r.diffs.push(s.diffs.shift()),l=!1):a===i&&r.diffs.length==1&&r.diffs[0][0]==v&&c.length>2*h?(r.length1+=c.length,p+=c.length,l=!1,r.diffs.push(new n.Diff(a,c)),s.diffs.shift()):(c=c.substring(0,h-r.length1-this.Patch_Margin),r.length1+=c.length,p+=c.length,a===v?(r.length2+=c.length,e+=c.length):l=!1,r.diffs.push(new n.Diff(a,c)),c==s.diffs[0][1]?s.diffs.shift():s.diffs[0][1]=s.diffs[0][1].substring(c.length))}t=this.diff_text2(r.diffs),t=t.substring(t.length-this.Patch_Margin);var f=this.diff_text1(s.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))),l||o.splice(++d,0,r)}}},n.prototype.patch_toText=function(o){for(var h=[],d=0;d<o.length;d++)h[d]=o[d];return h.join("")},n.prototype.patch_fromText=function(o){var h=[];if(!o)return h;for(var d=o.split(`
|
|
1001
|
-
`),
|
|
1002
|
-
`],
|
|
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=u,L.exports.DIFF_EQUAL=v})(er);var
|
|
1004
|
-
`).length-1;if(
|
|
1005
|
-
`&&(
|
|
1006
|
-
`&&(r-=1),v.left.push({startLine:
|
|
1007
|
-
`&&(
|
|
1008
|
-
`&&(r-=1),v.right.push({startLine:o.right,endLine:o.right+r}),o.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 u=[],v={left:[],right:[]},o=0;o<i.left.length;o++){var h={startRow:i.left[o].startLine-1,endRow:i.left[o].endLine,type:"text",className:"codeMarker"};v.left.push(h)}for(var o=0;o<i.right.length;o++){var h={startRow:i.right[o].startLine-1,endRow:i.right[o].endLine,type:"text",className:"codeMarker"};v.right.push(h)}return u[0]=v.left,u[1]=v.right,u},n.prototype.render=function(){var i=this.diff();return Di.createElement(wa.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:ye.number,editorProps:ye.object,enableBasicAutocompletion:ye.bool,enableLiveAutocompletion:ye.bool,focus:ye.bool,fontSize:ye.number,height:ye.string,highlightActiveLine:ye.bool,maxLines:ye.number,minLines:ye.number,mode:ye.string,name:ye.string,className:ye.string,onLoad:ye.func,onPaste:ye.func,onScroll:ye.func,onChange:ye.func,orientation:ye.string,readOnly:ye.bool,scrollMargin:ye.array,setOptions:ye.object,showGutter:ye.bool,showPrintMargin:ye.bool,splits:ye.number,style:ye.object,tabSize:ye.number,theme:ye.string,value:ye.array,width:ye.string,wrapEnabled:ye.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);Gt.default=Ea;Object.defineProperty(It,"__esModule",{value:!0});It.diff=It.split=void 0;var Sa=Dt,Da=Gt;It.diff=Da.default;var Aa=ft;It.split=Aa.default;var xa=It.default=Sa.default,$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,u,v){var o=i("../lib/oop"),h=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"}]}};o.inherits(d,h),u.JsonHighlightRules=d}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(i,u,v){var o=i("../range").Range,h=function(){};(function(){this.checkOutdent=function(d,s){return/^\s+$/.test(d)?/^\s*\}/.test(s):!1},this.autoOutdent=function(d,s){var p=d.getLine(s),e=p.match(/^(\s*\})/);if(!e)return 0;var t=e[1].length,r=d.findMatchingBracket({row:s,column:t});if(!r||r.row==s)return 0;var l=this.$getIndent(d.getLine(r.row));d.replace(new o(s,0,s,t-1),l)},this.$getIndent=function(d){return d.match(/^\s*/)[0]}}).call(h.prototype),u.MatchingBraceOutdent=h}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(i,u,v){var o=i("../../lib/oop"),h=i("../../range").Range,d=i("./fold_mode").FoldMode,s=u.FoldMode=function(p){p&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+p.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+p.end)))};o.inherits(s,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 l=this._getFoldWidgetBase(p,e,t);return!l&&this.startRegionRe.test(r)?"start":l},this.getFoldWidgetRange=function(p,e,t,r){var l=p.getLine(t);if(this.startRegionRe.test(l))return this.getCommentRegionBlock(p,l,t);var f=l.match(this.foldingStartMarker);if(f){var a=f.index;if(f[1])return this.openingBracketBlock(p,f[1],t,a);var c=p.getCommentFoldRange(t,a+f[0].length,1);return c&&!c.isMultiLine()&&(r?c=this.getSectionRange(p,t):e!="all"&&(c=null)),c}if(e!=="markbegin"){var f=l.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/),l=e,a=t.length;e+=1;for(var c=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<=l)break;if(y.isMultiLine())e=y.end.row;else if(r==m)break}c=e}}return new h(l,a,c,p.getLine(c).length)},this.getCommentRegionBlock=function(p,e,t){for(var r=e.search(/\s*$/),l=p.getLength(),a=t,c=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,f=1;++t<l;){e=p.getLine(t);var m=c.exec(e);if(m&&(m[1]?f--:f++,!f))break}var y=t;if(y>a)return new h(a,r,y,e.length)}}.call(s.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,u,v){var o=i("../lib/oop"),h=i("./text").Mode,d=i("./json_highlight_rules").JsonHighlightRules,s=i("./matching_brace_outdent").MatchingBraceOutdent,p=i("./folding/cstyle").FoldMode,e=i("../worker/worker_client").WorkerClient,t=function(){this.HighlightRules=d,this.$outdent=new s,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new p};o.inherits(t,h),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(r,l,a){var c=this.$getIndent(l);if(r=="start"){var f=l.match(/^.*[\{\(\[]\s*$/);f&&(c+=a)}return c},this.checkOutdent=function(r,l,a){return this.$outdent.checkOutdent(l,a)},this.autoOutdent=function(r,l,a){this.$outdent.autoOutdent(l,a)},this.createWorker=function(r){var l=new e(["ace"],"ace/mode/json_worker","JsonWorker");return l.attachToDocument(r.getDocument()),l.on("annotate",function(a){r.setAnnotations(a.data)}),l.on("terminate",function(){r.clearAnnotations()}),l},this.$id="ace/mode/json"}.call(t.prototype),u.Mode=t}),function(){ace.require(["ace/mode/json"],function(i){L&&(L.exports=i)})}()})($a);var 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,u,v){var o=i("../lib/oop"),h=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"}]}};o.inherits(d,h),u.JsonHighlightRules=d}),ace.define("ace/mode/json5_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/json_highlight_rules"],function(i,u,v){var o=i("../lib/oop"),h=i("./json_highlight_rules").JsonHighlightRules,d=function(){h.call(this);var s=[{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],s);this.normalizeRules()};o.inherits(d,h),u.Json5HighlightRules=d}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(i,u,v){var o=i("../range").Range,h=function(){};(function(){this.checkOutdent=function(d,s){return/^\s+$/.test(d)?/^\s*\}/.test(s):!1},this.autoOutdent=function(d,s){var p=d.getLine(s),e=p.match(/^(\s*\})/);if(!e)return 0;var t=e[1].length,r=d.findMatchingBracket({row:s,column:t});if(!r||r.row==s)return 0;var l=this.$getIndent(d.getLine(r.row));d.replace(new o(s,0,s,t-1),l)},this.$getIndent=function(d){return d.match(/^\s*/)[0]}}).call(h.prototype),u.MatchingBraceOutdent=h}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(i,u,v){var o=i("../../lib/oop"),h=i("../../range").Range,d=i("./fold_mode").FoldMode,s=u.FoldMode=function(p){p&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+p.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+p.end)))};o.inherits(s,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 l=this._getFoldWidgetBase(p,e,t);return!l&&this.startRegionRe.test(r)?"start":l},this.getFoldWidgetRange=function(p,e,t,r){var l=p.getLine(t);if(this.startRegionRe.test(l))return this.getCommentRegionBlock(p,l,t);var f=l.match(this.foldingStartMarker);if(f){var a=f.index;if(f[1])return this.openingBracketBlock(p,f[1],t,a);var c=p.getCommentFoldRange(t,a+f[0].length,1);return c&&!c.isMultiLine()&&(r?c=this.getSectionRange(p,t):e!="all"&&(c=null)),c}if(e!=="markbegin"){var f=l.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/),l=e,a=t.length;e+=1;for(var c=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<=l)break;if(y.isMultiLine())e=y.end.row;else if(r==m)break}c=e}}return new h(l,a,c,p.getLine(c).length)},this.getCommentRegionBlock=function(p,e,t){for(var r=e.search(/\s*$/),l=p.getLength(),a=t,c=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,f=1;++t<l;){e=p.getLine(t);var m=c.exec(e);if(m&&(m[1]?f--:f++,!f))break}var y=t;if(y>a)return new h(a,r,y,e.length)}}.call(s.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,u,v){var o=i("../lib/oop"),h=i("./text").Mode,d=i("./json5_highlight_rules").Json5HighlightRules,s=i("./matching_brace_outdent").MatchingBraceOutdent,p=i("./folding/cstyle").FoldMode,e=function(){this.HighlightRules=d,this.$outdent=new s,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new p};o.inherits(e,h),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.checkOutdent=function(t,r,l){return this.$outdent.checkOutdent(r,l)},this.autoOutdent=function(t,r,l){this.$outdent.autoOutdent(r,l)},this.$id="ace/mode/json5"}.call(e.prototype),u.Mode=e}),function(){ace.require(["ace/mode/json5"],function(i){L&&(L.exports=i)})}()})(Ta);var _a={};(function(L){function n(v,o){for(var h=v,d="";h;){var s=o[h];if(typeof s=="string")return s+d;if(s)return s.location.replace(/\/*$/,"/")+(d||s.main||s.name);if(s===!1)return"";var p=h.lastIndexOf("/");if(p===-1)break;d=h.substr(p)+d,h=h.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,o,h,d,s){postMessage({type:"error",data:{message:v,data:s&&s.data,file:o,line:h,col:d,stack:s&&s.stack}})},L.normalizeModule=function(v,o){if(o.indexOf("!")!==-1){var h=o.split("!");return L.normalizeModule(v,h[0])+"!"+L.normalizeModule(v,h[1])}if(o.charAt(0)=="."){var d=v.split("/").slice(0,-1).join("/");for(o=(d?d+"/":"")+o;o.indexOf(".")!==-1&&s!=o;){var s=o;o=o.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return o},L.require=function(v,o){if(o||(o=v,v=null),!o.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");o=L.normalizeModule(v,o);var h=L.require.modules[o];if(h)return h.initialized||(h.initialized=!0,h.exports=h.factory().exports),h.exports;if(!L.require.tlns)return console.log("unable to load "+o);var d=n(o,L.require.tlns);return d.slice(-3)!=".js"&&(d+=".js"),L.require.id=o,L.require.modules[o]={},importScripts(d),L.require(v,o)},L.require.modules={},L.require.tlns={},L.define=function(v,o,h){if(arguments.length==2?(h=o,typeof v!="string"&&(o=v,v=L.require.id)):arguments.length==1&&(h=v,o=[],v=L.require.id),typeof h!="function"){L.require.modules[v]={exports:h,initialized:!0};return}o.length||(o=["require","exports","module"]);var d=function(s){return L.require(v,s)};L.require.modules[v]={exports:{},factory:function(){var s=this,p=h.apply(this,o.slice(0,h.length).map(function(e){switch(e){case"require":return d;case"exports":return s.exports;case"module":return s;default:return d(e)}}));return p&&(s.exports=p),s}}},L.define.amd={},L.require.tlns={},L.initBaseUrls=function(v){for(var o in v)this.require.tlns[o]=v[o]},L.initSender=function(){var v=L.require("ace/lib/event_emitter").EventEmitter,o=L.require("ace/lib/oop"),h=function(){};return function(){o.implement(this,v),this.callback=function(d,s){postMessage({type:"call",id:s,data:d})},this.emit=function(d,s){postMessage({type:"event",name:d,data:s})}}.call(h.prototype),new h};var i=L.main=null,u=L.sender=null;L.onmessage=function(v){var o=v.data;if(o.event&&u)u._signal(o.event,o.data);else if(o.command)if(i[o.command])i[o.command].apply(i,o.args);else{if(!L[o.command])throw new Error("Unknown command:"+o.command);L[o.command].apply(L,o.args)}else if(o.init){L.initBaseUrls(o.tlns),u=L.sender=L.initSender();var h=this.require(o.module)[o.classname];i=L.main=new h(u)}}}})(_a),ace.define("ace/lib/oop",[],function(L,n,i){n.inherits=function(u,v){u.super_=v,u.prototype=Object.create(v.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}})},n.mixin=function(u,v){for(var o in v)u[o]=v[o];return u},n.implement=function(u,v){n.mixin(u,v)}}),ace.define("ace/apply_delta",[],function(L,n,i){n.applyDelta=function(u,v,o){var h=v.start.row,d=v.start.column,s=u[h]||"";switch(v.action){case"insert":var p=v.lines;if(p.length===1)u[h]=s.substring(0,d)+v.lines[0]+s.substring(d);else{var e=[h,1].concat(v.lines);u.splice.apply(u,e),u[h]=s.substring(0,d)+u[h],u[h+v.lines.length-1]+=s.substring(d)}break;case"remove":var t=v.end.column,r=v.end.row;h===r?u[h]=s.substring(0,d)+s.substring(t):u.splice(h,r-h+1,s.substring(0,d)+u[r].substring(t))}}}),ace.define("ace/lib/event_emitter",[],function(L,n,i){var u={},v=function(){this.propagationStopped=!0},o=function(){this.defaultPrevented=!0};u._emit=u._dispatchEvent=function(h,d){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var s=this._eventRegistry[h]||[],p=this._defaultHandlers[h];if(!(!s.length&&!p)){(typeof d!="object"||!d)&&(d={}),d.type||(d.type=h),d.stopPropagation||(d.stopPropagation=v),d.preventDefault||(d.preventDefault=o),s=s.slice();for(var e=0;e<s.length&&(s[e](d,this),!d.propagationStopped);e++);if(p&&!d.defaultPrevented)return p(d,this)}},u._signal=function(h,d){var s=(this._eventRegistry||{})[h];if(s){s=s.slice();for(var p=0;p<s.length;p++)s[p](d,this)}},u.once=function(h,d){var s=this;if(this.on(h,function p(){s.off(h,p),d.apply(null,arguments)}),!d)return new Promise(function(p){d=p})},u.setDefaultHandler=function(h,d){var s=this._defaultHandlers;if(s||(s=this._defaultHandlers={_disabled_:{}}),s[h]){var p=s[h],e=s._disabled_[h];e||(s._disabled_[h]=e=[]),e.push(p);var t=e.indexOf(d);t!=-1&&e.splice(t,1)}s[h]=d},u.removeDefaultHandler=function(h,d){var s=this._defaultHandlers;if(s){var p=s._disabled_[h];if(s[h]==d)p&&this.setDefaultHandler(h,p.pop());else if(p){var e=p.indexOf(d);e!=-1&&p.splice(e,1)}}},u.on=u.addEventListener=function(h,d,s){this._eventRegistry=this._eventRegistry||{};var p=this._eventRegistry[h];return p||(p=this._eventRegistry[h]=[]),p.indexOf(d)==-1&&p[s?"unshift":"push"](d),d},u.off=u.removeListener=u.removeEventListener=function(h,d){this._eventRegistry=this._eventRegistry||{};var s=this._eventRegistry[h];if(s){var p=s.indexOf(d);p!==-1&&s.splice(p,1)}},u.removeAllListeners=function(h){h||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[h]=void 0),this._defaultHandlers&&(this._defaultHandlers[h]=void 0)},n.EventEmitter=u}),ace.define("ace/range",[],function(L,n,i){var u=function(){function v(o,h,d,s){this.start={row:o,column:h},this.end={row:d,column:s}}return v.prototype.isEqual=function(o){return this.start.row===o.start.row&&this.end.row===o.end.row&&this.start.column===o.start.column&&this.end.column===o.end.column},v.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},v.prototype.contains=function(o,h){return this.compare(o,h)==0},v.prototype.compareRange=function(o){var h,d=o.end,s=o.start;return h=this.compare(d.row,d.column),h==1?(h=this.compare(s.row,s.column),h==1?2:h==0?1:0):h==-1?-2:(h=this.compare(s.row,s.column),h==-1?-1:h==1?42:0)},v.prototype.comparePoint=function(o){return this.compare(o.row,o.column)},v.prototype.containsRange=function(o){return this.comparePoint(o.start)==0&&this.comparePoint(o.end)==0},v.prototype.intersects=function(o){var h=this.compareRange(o);return h==-1||h==0||h==1},v.prototype.isEnd=function(o,h){return this.end.row==o&&this.end.column==h},v.prototype.isStart=function(o,h){return this.start.row==o&&this.start.column==h},v.prototype.setStart=function(o,h){typeof o=="object"?(this.start.column=o.column,this.start.row=o.row):(this.start.row=o,this.start.column=h)},v.prototype.setEnd=function(o,h){typeof o=="object"?(this.end.column=o.column,this.end.row=o.row):(this.end.row=o,this.end.column=h)},v.prototype.inside=function(o,h){return this.compare(o,h)==0?!(this.isEnd(o,h)||this.isStart(o,h)):!1},v.prototype.insideStart=function(o,h){return this.compare(o,h)==0?!this.isEnd(o,h):!1},v.prototype.insideEnd=function(o,h){return this.compare(o,h)==0?!this.isStart(o,h):!1},v.prototype.compare=function(o,h){return!this.isMultiLine()&&o===this.start.row?h<this.start.column?-1:h>this.end.column?1:0:o<this.start.row?-1:o>this.end.row?1:this.start.row===o?h>=this.start.column?0:-1:this.end.row===o?h<=this.end.column?0:1:0},v.prototype.compareStart=function(o,h){return this.start.row==o&&this.start.column==h?-1:this.compare(o,h)},v.prototype.compareEnd=function(o,h){return this.end.row==o&&this.end.column==h?1:this.compare(o,h)},v.prototype.compareInside=function(o,h){return this.end.row==o&&this.end.column==h?1:this.start.row==o&&this.start.column==h?-1:this.compare(o,h)},v.prototype.clipRows=function(o,h){if(this.end.row>h)var d={row:h+1,column:0};else if(this.end.row<o)var d={row:o,column:0};if(this.start.row>h)var s={row:h+1,column:0};else if(this.start.row<o)var s={row:o,column:0};return v.fromPoints(s||this.start,d||this.end)},v.prototype.extend=function(o,h){var d=this.compare(o,h);if(d==0)return this;if(d==-1)var s={row:o,column:h};else var p={row:o,column:h};return v.fromPoints(s||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(o){var h=o.documentToScreenPosition(this.start),d=o.documentToScreenPosition(this.end);return new v(h.row,h.column,d.row,d.column)},v.prototype.moveBy=function(o,h){this.start.row+=o,this.start.column+=h,this.end.row+=o,this.end.column+=h},v}();u.fromPoints=function(v,o){return new u(v.row,v.column,o.row,o.column)},u.comparePoints=function(v,o){return v.row-o.row||v.column-o.column},n.Range=u}),ace.define("ace/anchor",[],function(L,n,i){function u(s,p,e){var t=e?s.column<=p.column:s.column<p.column;return s.row<p.row||s.row==p.row&&t}function v(s,p,e){var t=s.action=="insert",r=(t?1:-1)*(s.end.row-s.start.row),l=(t?1:-1)*(s.end.column-s.start.column),a=s.start,c=t?a:s.end;return u(p,a,e)?{row:p.row,column:p.column}:u(c,p,!e)?{row:p.row+r,column:p.column+(p.row==c.row?l:0)}:{row:a.row,column:a.column}}var o=L("./lib/oop"),h=L("./lib/event_emitter").EventEmitter,d=function(){function s(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 s.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},s.prototype.getDocument=function(){return this.document},s.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)}},s.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 l={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:l,value:r})}},s.prototype.detach=function(){this.document.off("change",this.$onChange)},s.prototype.attach=function(p){this.document=p||this.document,this.document.on("change",this.$onChange)},s.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},s}();d.prototype.$insertRight=!1,o.implement(d.prototype,h),n.Anchor=d}),ace.define("ace/document",[],function(L,n,i){var u=L("./lib/oop"),v=L("./apply_delta").applyDelta,o=L("./lib/event_emitter").EventEmitter,h=L("./range").Range,d=L("./anchor").Anchor,s=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 h(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]:`
|
|
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,u,v){i("./loader_build")(u);var s=i("./lib/dom"),h=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"),u.config=i("./config"),u.edit=function(r,l){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 c="";if(r&&/input|textarea/i.test(r.tagName)){var f=r;c=f.value,r=s.createElement("pre"),f.parentNode.replaceChild(r,f)}else r&&(c=r.textContent,r.innerHTML="");var m=u.createEditSession(c),y=new d(new e(r),m,l),D={document:m,editor:y,onResize:y.resize.bind(y,null)};return f&&(D.textarea=f),y.on("destroy",function(){D.editor.container.env=null}),y.container.env=y.env=D,y},u.createEditSession=function(r,l){var a=new o(r,l);return a.setUndoManager(new p),a},u.Range=h,u.Editor=d,u.EditSession=o,u.UndoManager=p,u.VirtualRenderer=e;var t=u.config.version;u.version=t}),function(){ace.require(["ace/ace"],function(i){i&&(i.config.init(!0),i.define=ace.define);var u=function(){return this}();!u&&typeof window<"u"&&(u=window),!u&&typeof self<"u"&&(u=self),u.ace||(u.ace=i);for(var v in i)i.hasOwnProperty(v)&&(u.ace[v]=i[v]);u.ace.default=u.ace,L&&(L.exports=u.ace)})}()})(Vi);var fn=Vi.exports,gn={exports:{}};gn.exports;(function(L,n){var i=200,u="__lodash_hash_undefined__",v=1,s=2,h=9007199254740991,d="[object Arguments]",o="[object Array]",p="[object AsyncFunction]",e="[object Boolean]",t="[object Date]",r="[object Error]",l="[object Function]",a="[object GeneratorFunction]",c="[object Map]",f="[object Number]",m="[object Null]",y="[object Object]",D="[object Promise]",E="[object Proxy]",b="[object RegExp]",g="[object Set]",S="[object String]",M="[object Symbol]",_="[object Undefined]",T="[object WeakMap]",F="[object ArrayBuffer]",A="[object DataView]",$="[object Float32Array]",C="[object Float64Array]",w="[object Int8Array]",x="[object Int16Array]",I="[object Int32Array]",O="[object Uint8Array]",R="[object Uint8ClampedArray]",P="[object Uint16Array]",B="[object Uint32Array]",V=/[\\^$.*+?()[\]{}|]/g,W=/^\[object .+?Constructor\]$/,H=/^(?:0|[1-9]\d*)$/,U={};U[$]=U[C]=U[w]=U[x]=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[l]=U[c]=U[f]=U[y]=U[b]=U[g]=U[S]=U[T]=!1;var G=typeof He=="object"&&He&&He.Object===Object&&He,Y=typeof self=="object"&&self&&self.Object===Object&&self,Q=G||Y||Function("return this")(),ee=n&&!n.nodeType&&n,ne=ee&&!0&&L&&!L.nodeType&&L,se=ne&&ne.exports===ee,ge=se&&G.process,be=function(){try{return ge&&ge.binding&&ge.binding("util")}catch{}}(),ke=be&&be.isTypedArray;function Ce(z,J){for(var te=-1,ie=z==null?0:z.length,Se=0,he=[];++te<ie;){var _e=z[te];J(_e,te,z)&&(he[Se++]=_e)}return he}function Ne(z,J){for(var te=-1,ie=J.length,Se=z.length;++te<ie;)z[Se+te]=J[te];return z}function Xe(z,J){for(var te=-1,ie=z==null?0:z.length;++te<ie;)if(J(z[te],te,z))return!0;return!1}function Ze(z,J){for(var te=-1,ie=Array(z);++te<z;)ie[te]=J(te);return ie}function Ot(z){return function(J){return z(J)}}function Jt(z,J){return z.has(J)}function bn(z,J){return z==null?void 0:z[J]}function Rt(z){var J=-1,te=Array(z.size);return z.forEach(function(ie,Se){te[++J]=[Se,ie]}),te}function Tt(z,J){return function(te){return z(J(te))}}function Nt(z){var J=-1,te=Array(z.size);return z.forEach(function(ie){te[++J]=ie}),te}var wn=Array.prototype,X=Function.prototype,re=Object.prototype,ae=Q["__core-js_shared__"],de=X.toString,ce=re.hasOwnProperty,Ee=function(){var z=/[^.]+$/.exec(ae&&ae.keys&&ae.keys.IE_PROTO||"");return z?"Symbol(src)_1."+z:""}(),$e=re.toString,xe=RegExp("^"+de.call(ce).replace(V,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),we=se?Q.Buffer:void 0,ve=Q.Symbol,Fe=Q.Uint8Array,st=re.propertyIsEnumerable,Yt=wn.splice,gt=ve?ve.toStringTag:void 0,Zn=Object.getOwnPropertySymbols,tr=we?we.isBuffer:void 0,nr=Tt(Object.keys,Object),Cn=_t(Q,"DataView"),Bt=_t(Q,"Map"),En=_t(Q,"Promise"),Sn=_t(Q,"Set"),Dn=_t(Q,"WeakMap"),Pt=_t(Object,"create"),ir=yt(Cn),rr=yt(Bt),sr=yt(En),or=yt(Sn),ar=yt(Dn),qn=ve?ve.prototype:void 0,An=qn?qn.valueOf:void 0;function mt(z){var J=-1,te=z==null?0:z.length;for(this.clear();++J<te;){var ie=z[J];this.set(ie[0],ie[1])}}function lr(){this.__data__=Pt?Pt(null):{},this.size=0}function ur(z){var J=this.has(z)&&delete this.__data__[z];return this.size-=J?1:0,J}function hr(z){var J=this.__data__;if(Pt){var te=J[z];return te===u?void 0:te}return ce.call(J,z)?J[z]:void 0}function cr(z){var J=this.__data__;return Pt?J[z]!==void 0:ce.call(J,z)}function pr(z,J){var te=this.__data__;return this.size+=this.has(z)?0:1,te[z]=Pt&&J===void 0?u:J,this}mt.prototype.clear=lr,mt.prototype.delete=ur,mt.prototype.get=hr,mt.prototype.has=cr,mt.prototype.set=pr;function qe(z){var J=-1,te=z==null?0:z.length;for(this.clear();++J<te;){var ie=z[J];this.set(ie[0],ie[1])}}function dr(){this.__data__=[],this.size=0}function fr(z){var J=this.__data__,te=Xt(J,z);if(te<0)return!1;var ie=J.length-1;return te==ie?J.pop():Yt.call(J,te,1),--this.size,!0}function gr(z){var J=this.__data__,te=Xt(J,z);return te<0?void 0:J[te][1]}function mr(z){return Xt(this.__data__,z)>-1}function vr(z,J){var te=this.__data__,ie=Xt(te,z);return ie<0?(++this.size,te.push([z,J])):te[ie][1]=J,this}qe.prototype.clear=dr,qe.prototype.delete=fr,qe.prototype.get=gr,qe.prototype.has=mr,qe.prototype.set=vr;function vt(z){var J=-1,te=z==null?0:z.length;for(this.clear();++J<te;){var ie=z[J];this.set(ie[0],ie[1])}}function yr(){this.size=0,this.__data__={hash:new mt,map:new(Bt||qe),string:new mt}}function br(z){var J=Zt(this,z).delete(z);return this.size-=J?1:0,J}function wr(z){return Zt(this,z).get(z)}function Cr(z){return Zt(this,z).has(z)}function Er(z,J){var te=Zt(this,z),ie=te.size;return te.set(z,J),this.size+=te.size==ie?0:1,this}vt.prototype.clear=yr,vt.prototype.delete=br,vt.prototype.get=wr,vt.prototype.has=Cr,vt.prototype.set=Er;function Qt(z){var J=-1,te=z==null?0:z.length;for(this.__data__=new vt;++J<te;)this.add(z[J])}function Sr(z){return this.__data__.set(z,u),this}function Dr(z){return this.__data__.has(z)}Qt.prototype.add=Qt.prototype.push=Sr,Qt.prototype.has=Dr;function ot(z){var J=this.__data__=new qe(z);this.size=J.size}function Ar(){this.__data__=new qe,this.size=0}function xr(z){var J=this.__data__,te=J.delete(z);return this.size=J.size,te}function $r(z){return this.__data__.get(z)}function Tr(z){return this.__data__.has(z)}function _r(z,J){var te=this.__data__;if(te instanceof qe){var ie=te.__data__;if(!Bt||ie.length<i-1)return ie.push([z,J]),this.size=++te.size,this;te=this.__data__=new vt(ie)}return te.set(z,J),this.size=te.size,this}ot.prototype.clear=Ar,ot.prototype.delete=xr,ot.prototype.get=$r,ot.prototype.has=Tr,ot.prototype.set=_r;function kr(z,J){var te=qt(z),ie=!te&&Ur(z),Se=!te&&!ie&&xn(z),he=!te&&!ie&&!Se&&li(z),_e=te||ie||Se||he,Le=_e?Ze(z.length,String):[],Oe=Le.length;for(var Te in z)ce.call(z,Te)&&!(_e&&(Te=="length"||Se&&(Te=="offset"||Te=="parent")||he&&(Te=="buffer"||Te=="byteLength"||Te=="byteOffset")||Wr(Te,Oe)))&&Le.push(Te);return Le}function Xt(z,J){for(var te=z.length;te--;)if(ri(z[te][0],J))return te;return-1}function Mr(z,J,te){var ie=J(z);return qt(z)?ie:Ne(ie,te(z))}function Wt(z){return z==null?z===void 0?_:m:gt&> in Object(z)?Br(z):Vr(z)}function ei(z){return Ht(z)&&Wt(z)==d}function ti(z,J,te,ie,Se){return z===J?!0:z==null||J==null||!Ht(z)&&!Ht(J)?z!==z&&J!==J:Lr(z,J,te,ie,ti,Se)}function Lr(z,J,te,ie,Se,he){var _e=qt(z),Le=qt(J),Oe=_e?o:at(z),Te=Le?o:at(J);Oe=Oe==d?y:Oe,Te=Te==d?y:Te;var Pe=Oe==y,Ue=Te==y,Re=Oe==Te;if(Re&&xn(z)){if(!xn(J))return!1;_e=!0,Pe=!1}if(Re&&!Pe)return he||(he=new ot),_e||li(z)?ni(z,J,te,ie,Se,he):Rr(z,J,Oe,te,ie,Se,he);if(!(te&v)){var ze=Pe&&ce.call(z,"__wrapped__"),je=Ue&&ce.call(J,"__wrapped__");if(ze||je){var lt=ze?z.value():z,et=je?J.value():J;return he||(he=new ot),Se(lt,et,te,ie,he)}}return Re?(he||(he=new ot),Nr(z,J,te,ie,Se,he)):!1}function Ir(z){if(!ai(z)||zr(z))return!1;var J=si(z)?xe:W;return J.test(yt(z))}function Fr(z){return Ht(z)&&oi(z.length)&&!!U[Wt(z)]}function Or(z){if(!jr(z))return nr(z);var J=[];for(var te in Object(z))ce.call(z,te)&&te!="constructor"&&J.push(te);return J}function ni(z,J,te,ie,Se,he){var _e=te&v,Le=z.length,Oe=J.length;if(Le!=Oe&&!(_e&&Oe>Le))return!1;var Te=he.get(z);if(Te&&he.get(J))return Te==J;var Pe=-1,Ue=!0,Re=te&s?new Qt:void 0;for(he.set(z,J),he.set(J,z);++Pe<Le;){var ze=z[Pe],je=J[Pe];if(ie)var lt=_e?ie(je,ze,Pe,J,z,he):ie(ze,je,Pe,z,J,he);if(lt!==void 0){if(lt)continue;Ue=!1;break}if(Re){if(!Xe(J,function(et,bt){if(!Jt(Re,bt)&&(ze===et||Se(ze,et,te,ie,he)))return Re.push(bt)})){Ue=!1;break}}else if(!(ze===je||Se(ze,je,te,ie,he))){Ue=!1;break}}return he.delete(z),he.delete(J),Ue}function Rr(z,J,te,ie,Se,he,_e){switch(te){case A:if(z.byteLength!=J.byteLength||z.byteOffset!=J.byteOffset)return!1;z=z.buffer,J=J.buffer;case F:return!(z.byteLength!=J.byteLength||!he(new Fe(z),new Fe(J)));case e:case t:case f:return ri(+z,+J);case r:return z.name==J.name&&z.message==J.message;case b:case S:return z==J+"";case c:var Le=Rt;case g:var Oe=ie&v;if(Le||(Le=Nt),z.size!=J.size&&!Oe)return!1;var Te=_e.get(z);if(Te)return Te==J;ie|=s,_e.set(z,J);var Pe=ni(Le(z),Le(J),ie,Se,he,_e);return _e.delete(z),Pe;case M:if(An)return An.call(z)==An.call(J)}return!1}function Nr(z,J,te,ie,Se,he){var _e=te&v,Le=ii(z),Oe=Le.length,Te=ii(J),Pe=Te.length;if(Oe!=Pe&&!_e)return!1;for(var Ue=Oe;Ue--;){var Re=Le[Ue];if(!(_e?Re in J:ce.call(J,Re)))return!1}var ze=he.get(z);if(ze&&he.get(J))return ze==J;var je=!0;he.set(z,J),he.set(J,z);for(var lt=_e;++Ue<Oe;){Re=Le[Ue];var et=z[Re],bt=J[Re];if(ie)var ui=_e?ie(bt,et,Re,J,z,he):ie(et,bt,Re,z,J,he);if(!(ui===void 0?et===bt||Se(et,bt,te,ie,he):ui)){je=!1;break}lt||(lt=Re=="constructor")}if(je&&!lt){var en=z.constructor,tn=J.constructor;en!=tn&&"constructor"in z&&"constructor"in J&&!(typeof en=="function"&&en instanceof en&&typeof tn=="function"&&tn instanceof tn)&&(je=!1)}return he.delete(z),he.delete(J),je}function ii(z){return Mr(z,Jr,Pr)}function Zt(z,J){var te=z.__data__;return Hr(J)?te[typeof J=="string"?"string":"hash"]:te.map}function _t(z,J){var te=bn(z,J);return Ir(te)?te:void 0}function Br(z){var J=ce.call(z,gt),te=z[gt];try{z[gt]=void 0;var ie=!0}catch{}var Se=$e.call(z);return ie&&(J?z[gt]=te:delete z[gt]),Se}var Pr=Zn?function(z){return z==null?[]:(z=Object(z),Ce(Zn(z),function(J){return st.call(z,J)}))}:Yr,at=Wt;(Cn&&at(new Cn(new ArrayBuffer(1)))!=A||Bt&&at(new Bt)!=c||En&&at(En.resolve())!=D||Sn&&at(new Sn)!=g||Dn&&at(new Dn)!=T)&&(at=function(z){var J=Wt(z),te=J==y?z.constructor:void 0,ie=te?yt(te):"";if(ie)switch(ie){case ir:return A;case rr:return c;case sr:return D;case or:return g;case ar:return T}return J});function Wr(z,J){return J=J??h,!!J&&(typeof z=="number"||H.test(z))&&z>-1&&z%1==0&&z<J}function Hr(z){var J=typeof z;return J=="string"||J=="number"||J=="symbol"||J=="boolean"?z!=="__proto__":z===null}function zr(z){return!!Ee&&Ee in z}function jr(z){var J=z&&z.constructor,te=typeof J=="function"&&J.prototype||re;return z===te}function Vr(z){return $e.call(z)}function yt(z){if(z!=null){try{return de.call(z)}catch{}try{return z+""}catch{}}return""}function ri(z,J){return z===J||z!==z&&J!==J}var Ur=ei(function(){return arguments}())?ei:function(z){return Ht(z)&&ce.call(z,"callee")&&!st.call(z,"callee")},qt=Array.isArray;function Gr(z){return z!=null&&oi(z.length)&&!si(z)}var xn=tr||Qr;function Kr(z,J){return ti(z,J)}function si(z){if(!ai(z))return!1;var J=Wt(z);return J==l||J==a||J==p||J==E}function oi(z){return typeof z=="number"&&z>-1&&z%1==0&&z<=h}function ai(z){var J=typeof z;return z!=null&&(J=="object"||J=="function")}function Ht(z){return z!=null&&typeof z=="object"}var li=ke?Ot(ke):Fr;function Jr(z){return Gr(z)?kr(z):Or(z)}function Yr(){return[]}function Qr(){return!1}L.exports=Kr})(gn,gn.exports);var Ui=gn.exports,Je={};Object.defineProperty(Je,"__esModule",{value:!0});Je.getAceInstance=Je.debounce=Je.editorEvents=Je.editorOptions=void 0;var uo=["minLines","maxLines","readOnly","highlightActiveLine","tabSize","enableBasicAutocompletion","enableLiveAutocompletion","enableSnippets"];Je.editorOptions=uo;var ho=["onChange","onFocus","onInput","onBlur","onCopy","onPaste","onSelectionChange","onCursorChange","onScroll","handleOptions","updateRef"];Je.editorEvents=ho;var co=function(){var L;return typeof window>"u"?(He.window={},L=fn,delete He.window):window.ace?(L=window.ace,L.acequire=window.ace.require||window.ace.acequire):L=fn,L};Je.getAceInstance=co;var po=function(L,n){var i=null;return function(){var u=this,v=arguments;clearTimeout(i),i=setTimeout(function(){L.apply(u,v)},n)}};Je.debounce=po;var fo=Dt&&Dt.__extends||function(){var L=function(n,i){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,v){u.__proto__=v}||function(u,v){for(var s in v)Object.prototype.hasOwnProperty.call(v,s)&&(u[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 u(){this.constructor=n}n.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}(),jn=Dt&&Dt.__assign||function(){return jn=Object.assign||function(L){for(var n,i=1,u=arguments.length;i<u;i++){n=arguments[i];for(var v in n)Object.prototype.hasOwnProperty.call(n,v)&&(L[v]=n[v])}return L},jn.apply(this,arguments)};Object.defineProperty(Dt,"__esModule",{value:!0});var go=fn,oe=Un,vi=pt,on=Ui,Lt=Je,yi=(0,Lt.getAceInstance)(),mo=function(L){fo(n,L);function n(i){var u=L.call(this,i)||this;return Lt.editorEvents.forEach(function(v){u[v]=u[v].bind(u)}),u.debounce=Lt.debounce,u}return n.prototype.isInShadow=function(i){for(var u=i&&i.parentNode;u;){if(u.toString()==="[object ShadowRoot]")return!0;u=u.parentNode}return!1},n.prototype.componentDidMount=function(){var i=this,u=this.props,v=u.className,s=u.onBeforeLoad,h=u.onValidate,d=u.mode,o=u.focus,p=u.theme,e=u.fontSize,t=u.lineHeight,r=u.value,l=u.defaultValue,a=u.showGutter,c=u.wrapEnabled,f=u.showPrintMargin,m=u.scrollMargin,y=m===void 0?[0,0,0,0]:m,D=u.keyboardHandler,E=u.onLoad,b=u.commands,g=u.annotations,S=u.markers,M=u.placeholder;this.editor=yi.edit(this.refEditor),s&&s(yi);for(var _=Object.keys(this.props.editorProps),T=0;T<_.length;T++)this.editor[_[T]]=this.props.editorProps[_[T]];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(l||r||""),this.props.navigateToFileEnd&&this.editor.navigateFileEnd(),this.editor.renderer.setShowGutter(a),this.editor.getSession().setUseWrapMode(c),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),M&&this.updatePlaceholder(),this.editor.getSession().selection.on("changeSelection",this.onSelectionChange),this.editor.getSession().selection.on("changeCursor",this.onCursorChange),h&&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;Lt.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)}),D&&this.editor.setKeyboardHandler("ace/keyboard/"+D),v&&(this.refEditor.className+=" "+v),E&&E(this.editor),this.editor.resize(),o&&this.editor.focus()},n.prototype.componentDidUpdate=function(i){for(var u=i,v=this.props,s=0;s<Lt.editorOptions.length;s++){var h=Lt.editorOptions[s];v[h]!==u[h]&&this.editor.setOption(h,v[h])}if(v.className!==u.className){var d=this.refEditor.className,o=d.trim().split(" "),p=u.className.trim().split(" ");p.forEach(function(r){var l=o.indexOf(r);o.splice(l,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!==u.placeholder&&this.updatePlaceholder(),v.mode!==u.mode&&this.editor.getSession().setMode(typeof v.mode=="string"?"ace/mode/".concat(v.mode):v.mode),v.theme!==u.theme&&this.editor.setTheme("ace/theme/"+v.theme),v.keyboardHandler!==u.keyboardHandler&&(v.keyboardHandler?this.editor.setKeyboardHandler("ace/keyboard/"+v.keyboardHandler):this.editor.setKeyboardHandler(null)),v.fontSize!==u.fontSize&&this.editor.setFontSize(typeof v.fontSize=="number"?"".concat(v.fontSize,"px"):v.fontSize),v.lineHeight!==u.lineHeight&&(this.editor.container.style.lineHeight=typeof v.lineHeight=="number"?"".concat(v.lineHeight,"px"):v.lineHeight,this.editor.renderer.updateFontSize()),v.wrapEnabled!==u.wrapEnabled&&this.editor.getSession().setUseWrapMode(v.wrapEnabled),v.showPrintMargin!==u.showPrintMargin&&this.editor.setShowPrintMargin(v.showPrintMargin),v.showGutter!==u.showGutter&&this.editor.renderer.setShowGutter(v.showGutter),on(v.setOptions,u.setOptions)||this.handleOptions(v),(e||!on(v.annotations,u.annotations))&&this.editor.getSession().setAnnotations(v.annotations||[]),!on(v.markers,u.markers)&&Array.isArray(v.markers)&&this.handleMarkers(v.markers),on(v.scrollMargin,u.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 u=this.editor.getValue();this.props.onChange(u,i)}},n.prototype.onSelectionChange=function(i){if(this.props.onSelectionChange){var u=this.editor.getSelection();this.props.onSelectionChange(u,i)}},n.prototype.onCursorChange=function(i){if(this.props.onCursorChange){var u=this.editor.getSelection();this.props.onCursorChange(u,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 u=i.text;this.props.onCopy&&this.props.onCopy(u)},n.prototype.onPaste=function(i){var u=i.text;this.props.onPaste&&this.props.onPaste(u)},n.prototype.onScroll=function(){this.props.onScroll&&this.props.onScroll(this.editor)},n.prototype.handleOptions=function(i){for(var u=Object.keys(i.setOptions),v=0;v<u.length;v++)this.editor.setOption(u[v],i.setOptions[u[v]])},n.prototype.handleMarkers=function(i){var u=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(h){var d=h.startRow,o=h.startCol,p=h.endRow,e=h.endCol,t=h.className,r=h.type,l=h.inFront,a=l===void 0?!1:l,c=new go.Range(d,o,p,e);u.editor.getSession().addMarker(c,t,r,a)})},n.prototype.updatePlaceholder=function(){var i=this.editor,u=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=u||"",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=u)},n.prototype.updateRef=function(i){this.refEditor=i},n.prototype.render=function(){var i=this.props,u=i.name,v=i.width,s=i.height,h=i.style,d=jn({width:v,height:s},h);return vi.createElement("div",{ref:this.updateRef,id:u,style:d})},n.propTypes={mode:oe.oneOfType([oe.string,oe.object]),focus:oe.bool,theme:oe.string,name:oe.string,className:oe.string,height:oe.string,width:oe.string,fontSize:oe.oneOfType([oe.number,oe.string]),lineHeight:oe.oneOfType([oe.number,oe.string]),showGutter:oe.bool,onChange:oe.func,onCopy:oe.func,onPaste:oe.func,onFocus:oe.func,onInput:oe.func,onBlur:oe.func,onScroll:oe.func,value:oe.string,defaultValue:oe.string,onLoad:oe.func,onSelectionChange:oe.func,onCursorChange:oe.func,onBeforeLoad:oe.func,onValidate:oe.func,minLines:oe.number,maxLines:oe.number,readOnly:oe.bool,highlightActiveLine:oe.bool,tabSize:oe.number,showPrintMargin:oe.bool,cursorStart:oe.number,debounceChangePeriod:oe.number,editorProps:oe.object,setOptions:oe.object,style:oe.object,scrollMargin:oe.array,annotations:oe.array,markers:oe.array,keyboardHandler:oe.string,wrapEnabled:oe.bool,enableSnippets:oe.bool,enableBasicAutocompletion:oe.oneOfType([oe.bool,oe.array]),enableLiveAutocompletion:oe.oneOfType([oe.bool,oe.array]),navigateToFileEnd:oe.bool,commands:oe.array,placeholder:oe.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}(vi.Component);Dt.default=mo;var Gt={},ft={},Gi={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,u,v){var s=i("./lib/oop");i("./lib/lang");var h=i("./lib/event_emitter").EventEmitter,d=i("./editor").Editor,o=i("./virtual_renderer").VirtualRenderer,p=i("./edit_session").EditSession,e;e=function(t,r,l){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(l||1),this.$cEditor=this.$editors[0],this.on("focus",function(a){this.$cEditor=a}.bind(this))},function(){s.implement(this,h),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()),l=t.getUndoManager();return r.setUndoManager(l),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 l;r==null?l=this.$cEditor:l=this.$editors[r];var a=this.$editors.some(function(c){return c.session===t});return a&&(t=this.$cloneSession(t)),l.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,l;if(this.$orientation==this.BESIDE)for(var a=t/this.$splits,c=0;c<this.$splits;c++)l=this.$editors[c],l.container.style.width=a+"px",l.container.style.top="0px",l.container.style.left=c*a+"px",l.container.style.height=r+"px",l.resize();else for(var f=r/this.$splits,c=0;c<this.$splits;c++)l=this.$editors[c],l.container.style.width=t+"px",l.container.style.top=c*f+"px",l.container.style.left="0px",l.container.style.height=f+"px",l.resize()}}.call(e.prototype),u.Split=e}),ace.define("ace/ext/split",["require","exports","module","ace/split"],function(i,u,v){v.exports=i("../split")}),function(){ace.require(["ace/ext/split"],function(i){L&&(L.exports=i)})}()})(Gi);var vo=Gi.exports,yo="Expected a function",Ki="__lodash_hash_undefined__",bo="[object Function]",wo="[object GeneratorFunction]",Co="[object Symbol]",Eo=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,So=/^\w*$/,Do=/^\./,Ao=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,xo=/[\\^$.*+?()[\]{}|]/g,$o=/\\(\\)?/g,To=/^\[object .+?Constructor\]$/,_o=typeof He=="object"&&He&&He.Object===Object&&He,ko=typeof self=="object"&&self&&self.Object===Object&&self,Jn=_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,Ji=Object.prototype,Ln=Jn["__core-js_shared__"],bi=function(){var L=/[^.]+$/.exec(Ln&&Ln.keys&&Ln.keys.IE_PROTO||"");return L?"Symbol(src)_1."+L:""}(),Yi=Fo.toString,Yn=Ji.hasOwnProperty,Qi=Ji.toString,Oo=RegExp("^"+Yi.call(Yn).replace(xo,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),wi=Jn.Symbol,Ro=Io.splice,No=Xi(Jn,"Map"),Kt=Xi(Object,"create"),Ci=wi?wi.prototype:void 0,Ei=Ci?Ci.toString:void 0;function At(L){var n=-1,i=L?L.length:0;for(this.clear();++n<i;){var u=L[n];this.set(u[0],u[1])}}function Bo(){this.__data__=Kt?Kt(null):{}}function Po(L){return this.has(L)&&delete this.__data__[L]}function Wo(L){var n=this.__data__;if(Kt){var i=n[L];return i===Ki?void 0:i}return Yn.call(n,L)?n[L]:void 0}function Ho(L){var n=this.__data__;return Kt?n[L]!==void 0:Yn.call(n,L)}function zo(L,n){var i=this.__data__;return i[L]=Kt&&n===void 0?Ki:n,this}At.prototype.clear=Bo;At.prototype.delete=Po;At.prototype.get=Wo;At.prototype.has=Ho;At.prototype.set=zo;function Ft(L){var n=-1,i=L?L.length:0;for(this.clear();++n<i;){var u=L[n];this.set(u[0],u[1])}}function jo(){this.__data__=[]}function Vo(L){var n=this.__data__,i=vn(n,L);if(i<0)return!1;var u=n.length-1;return i==u?n.pop():Ro.call(n,i,1),!0}function Uo(L){var n=this.__data__,i=vn(n,L);return i<0?void 0:n[i][1]}function Go(L){return vn(this.__data__,L)>-1}function Ko(L,n){var i=this.__data__,u=vn(i,L);return u<0?i.push([L,n]):i[u][1]=n,this}Ft.prototype.clear=jo;Ft.prototype.delete=Vo;Ft.prototype.get=Uo;Ft.prototype.has=Go;Ft.prototype.set=Ko;function xt(L){var n=-1,i=L?L.length:0;for(this.clear();++n<i;){var u=L[n];this.set(u[0],u[1])}}function Jo(){this.__data__={hash:new At,map:new(No||Ft),string:new At}}function Yo(L){return yn(this,L).delete(L)}function Qo(L){return yn(this,L).get(L)}function Xo(L){return yn(this,L).has(L)}function Zo(L,n){return yn(this,L).set(L,n),this}xt.prototype.clear=Jo;xt.prototype.delete=Yo;xt.prototype.get=Qo;xt.prototype.has=Xo;xt.prototype.set=Zo;function vn(L,n){for(var i=L.length;i--;)if(ua(L[i][0],n))return i;return-1}function qo(L,n){n=ia(n,L)?[n]:na(n);for(var i=0,u=n.length;L!=null&&i<u;)L=L[aa(n[i++])];return i&&i==u?L:void 0}function ea(L){if(!qi(L)||sa(L))return!1;var n=ha(L)||Lo(L)?Oo:To;return n.test(la(L))}function ta(L){if(typeof L=="string")return L;if(Xn(L))return Ei?Ei.call(L):"";var n=L+"";return n=="0"&&1/L==-1/0?"-0":n}function na(L){return Zi(L)?L:oa(L)}function yn(L,n){var i=L.__data__;return ra(n)?i[typeof n=="string"?"string":"hash"]:i.map}function Xi(L,n){var i=Mo(L,n);return ea(i)?i:void 0}function ia(L,n){if(Zi(L))return!1;var i=typeof L;return i=="number"||i=="symbol"||i=="boolean"||L==null||Xn(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!!bi&&bi in L}var oa=Qn(function(L){L=pa(L);var n=[];return Do.test(L)&&n.push(""),L.replace(Ao,function(i,u,v,s){n.push(v?s.replace($o,"$1"):u||i)}),n});function aa(L){if(typeof L=="string"||Xn(L))return L;var n=L+"";return n=="0"&&1/L==-1/0?"-0":n}function la(L){if(L!=null){try{return Yi.call(L)}catch{}try{return L+""}catch{}}return""}function Qn(L,n){if(typeof L!="function"||n&&typeof n!="function")throw new TypeError(yo);var i=function(){var u=arguments,v=n?n.apply(this,u):u[0],s=i.cache;if(s.has(v))return s.get(v);var h=L.apply(this,u);return i.cache=s.set(v,h),h};return i.cache=new(Qn.Cache||xt),i}Qn.Cache=xt;function ua(L,n){return L===n||L!==L&&n!==n}var Zi=Array.isArray;function ha(L){var n=qi(L)?Qi.call(L):"";return n==bo||n==wo}function qi(L){var n=typeof L;return!!L&&(n=="object"||n=="function")}function ca(L){return!!L&&typeof L=="object"}function Xn(L){return typeof L=="symbol"||ca(L)&&Qi.call(L)==Co}function pa(L){return L==null?"":ta(L)}function da(L,n,i){var u=L==null?void 0:qo(L,n);return u===void 0?i:u}var fa=da,ga=ft&&ft.__extends||function(){var L=function(n,i){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,v){u.__proto__=v}||function(u,v){for(var s in v)Object.prototype.hasOwnProperty.call(v,s)&&(u[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 u(){this.constructor=n}n.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}(),Vn=ft&&ft.__assign||function(){return Vn=Object.assign||function(L){for(var n,i=1,u=arguments.length;i<u;i++){n=arguments[i];for(var v in n)Object.prototype.hasOwnProperty.call(n,v)&&(L[v]=n[v])}return L},Vn.apply(this,arguments)};Object.defineProperty(ft,"__esModule",{value:!0});var St=Je,In=(0,St.getAceInstance)(),ma=fn,va=vo,le=Un,Si=pt,Fn=Ui,tt=fa,ya=function(L){ga(n,L);function n(i){var u=L.call(this,i)||this;return St.editorEvents.forEach(function(v){u[v]=u[v].bind(u)}),u.debounce=St.debounce,u}return n.prototype.isInShadow=function(i){for(var u=i&&i.parentNode;u;){if(u.toString()==="[object ShadowRoot]")return!0;u=u.parentNode}return!1},n.prototype.componentDidMount=function(){var i=this,u=this.props,v=u.className,s=u.onBeforeLoad,h=u.mode,d=u.focus,o=u.theme,p=u.fontSize,e=u.value,t=u.defaultValue,r=u.cursorStart,l=u.showGutter,a=u.wrapEnabled,c=u.showPrintMargin,f=u.scrollMargin,m=f===void 0?[0,0,0,0]:f,y=u.keyboardHandler,D=u.onLoad,E=u.commands,b=u.annotations,g=u.markers,S=u.splits;this.editor=In.edit(this.refEditor),this.isInShadow(this.refEditor)&&this.editor.renderer.attachToShadowRoot(),this.editor.setTheme("ace/theme/".concat(o)),s&&s(In);var M=Object.keys(this.props.editorProps),_=new va.Split(this.editor.container,"ace/theme/".concat(o),S);this.editor.env.split=_,this.splitEditor=_.getEditor(0),this.split=_,this.editor.setShowPrintMargin(!1),this.editor.renderer.setShowGutter(!1);var T=this.splitEditor.$options;this.props.debounceChangePeriod&&(this.onChange=this.debounce(this.onChange,this.props.debounceChangePeriod)),_.forEach(function(A,$){for(var C=0;C<M.length;C++)A[M[C]]=i.props.editorProps[M[C]];var w=tt(t,$),x=tt(e,$,"");A.session.setUndoManager(new In.UndoManager),A.setTheme("ace/theme/".concat(o)),A.renderer.setScrollMargin(m[0],m[1],m[2],m[3]),A.getSession().setMode("ace/mode/".concat(h)),A.setFontSize(p),A.renderer.setShowGutter(l),A.getSession().setUseWrapMode(a),A.setShowPrintMargin(c),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(w===void 0?x:w,r);var I=tt(b,$,[]),O=tt(g,$,[]);A.getSession().setAnnotations(I),O&&O.length>0&&i.handleMarkers(O,A);for(var C=0;C<St.editorOptions.length;C++){var R=St.editorOptions[C];T.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),D&&D(F)},n.prototype.componentDidUpdate=function(i){var u=this,v=i,s=this.props,h=this.editor.env.split;if(s.splits!==v.splits&&h.setSplits(s.splits),s.orientation!==v.orientation&&h.setOrientation(s.orientation==="below"?h.BELOW:h.BESIDE),h.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<St.editorOptions.length;r++){var l=St.editorOptions[r];s[l]!==v[l]&&e.setOption(l,s[l])}Fn(s.setOptions,v.setOptions)||u.handleOptions(s,e);var a=tt(s.value,t,"");if(e.getValue()!==a){u.silent=!0;var c=e.session.selection.toJSON();e.setValue(a,s.cursorStart),e.session.selection.fromJSON(c),u.silent=!1}var f=tt(s.annotations,t,[]),m=tt(v.annotations,t,[]);Fn(f,m)||e.getSession().setAnnotations(f);var y=tt(s.markers,t,[]),D=tt(v.markers,t,[]);!Fn(y,D)&&Array.isArray(y)&&u.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&&h.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 u=[];this.editor.env.split.forEach(function(v){u.push(v.getValue())}),this.props.onChange(u,i)}},n.prototype.onSelectionChange=function(i){if(this.props.onSelectionChange){var u=[];this.editor.env.split.forEach(function(v){u.push(v.getSelection())}),this.props.onSelectionChange(u,i)}},n.prototype.onCursorChange=function(i){if(this.props.onCursorChange){var u=[];this.editor.env.split.forEach(function(v){u.push(v.getSelection())}),this.props.onCursorChange(u,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,u){for(var v=Object.keys(i.setOptions),s=0;s<v.length;s++)u.setOption(v[s],i.setOptions[v[s]])},n.prototype.handleMarkers=function(i,u){var v=u.getSession().getMarkers(!0);for(var s in v)v.hasOwnProperty(s)&&u.getSession().removeMarker(v[s].id);v=u.getSession().getMarkers(!1);for(var s in v)v.hasOwnProperty(s)&&u.getSession().removeMarker(v[s].id);i.forEach(function(h){var d=h.startRow,o=h.startCol,p=h.endRow,e=h.endCol,t=h.className,r=h.type,l=h.inFront,a=l===void 0?!1:l,c=new ma.Range(d,o,p,e);u.getSession().addMarker(c,t,r,a)})},n.prototype.updateRef=function(i){this.refEditor=i},n.prototype.render=function(){var i=this.props,u=i.name,v=i.width,s=i.height,h=i.style,d=Vn({width:v,height:s},h);return Si.createElement("div",{ref:this.updateRef,id:u,style:d})},n.propTypes={className:le.string,debounceChangePeriod:le.number,defaultValue:le.arrayOf(le.string),focus:le.bool,fontSize:le.oneOfType([le.number,le.string]),height:le.string,mode:le.string,name:le.string,onBlur:le.func,onChange:le.func,onCopy:le.func,onFocus:le.func,onInput:le.func,onLoad:le.func,onPaste:le.func,onScroll:le.func,orientation:le.string,showGutter:le.bool,splits:le.number,theme:le.string,value:le.arrayOf(le.string),width:le.string,onSelectionChange:le.func,onCursorChange:le.func,onBeforeLoad:le.func,minLines:le.number,maxLines:le.number,readOnly:le.bool,highlightActiveLine:le.bool,tabSize:le.number,showPrintMargin:le.bool,cursorStart:le.number,editorProps:le.object,setOptions:le.object,style:le.object,scrollMargin:le.array,annotations:le.array,markers:le.array,keyboardHandler:le.string,wrapEnabled:le.bool,enableBasicAutocompletion:le.oneOfType([le.bool,le.array]),enableLiveAutocompletion:le.oneOfType([le.bool,le.array]),commands:le.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}(Si.Component);ft.default=ya;var er={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,u=1,v=0;n.Diff=function(s,h){return[s,h]},n.prototype.diff_main=function(s,h,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||h==null)throw new Error("Null input. (diff_main)");if(s==h)return s?[new n.Diff(v,s)]:[];typeof d>"u"&&(d=!0);var e=d,t=this.diff_commonPrefix(s,h),r=s.substring(0,t);s=s.substring(t),h=h.substring(t),t=this.diff_commonSuffix(s,h);var l=s.substring(s.length-t);s=s.substring(0,s.length-t),h=h.substring(0,h.length-t);var a=this.diff_compute_(s,h,e,p);return r&&a.unshift(new n.Diff(v,r)),l&&a.push(new n.Diff(v,l)),this.diff_cleanupMerge(a),a},n.prototype.diff_compute_=function(s,h,d,o){var p;if(!s)return[new n.Diff(u,h)];if(!h)return[new n.Diff(i,s)];var e=s.length>h.length?s:h,t=s.length>h.length?h:s,r=e.indexOf(t);if(r!=-1)return p=[new n.Diff(u,e.substring(0,r)),new n.Diff(v,t),new n.Diff(u,e.substring(r+t.length))],s.length>h.length&&(p[0][0]=p[2][0]=i),p;if(t.length==1)return[new n.Diff(i,s),new n.Diff(u,h)];var l=this.diff_halfMatch_(s,h);if(l){var a=l[0],c=l[1],f=l[2],m=l[3],y=l[4],D=this.diff_main(a,f,d,o),E=this.diff_main(c,m,d,o);return D.concat([new n.Diff(v,y)],E)}return d&&s.length>100&&h.length>100?this.diff_lineMode_(s,h,o):this.diff_bisect_(s,h,o)},n.prototype.diff_lineMode_=function(s,h,d){var o=this.diff_linesToChars_(s,h);s=o.chars1,h=o.chars2;var p=o.lineArray,e=this.diff_main(s,h,!1,d);this.diff_charsToLines_(e,p),this.diff_cleanupSemantic(e),e.push(new n.Diff(v,""));for(var t=0,r=0,l=0,a="",c="";t<e.length;){switch(e[t][0]){case u:l++,c+=e[t][1];break;case i:r++,a+=e[t][1];break;case v:if(r>=1&&l>=1){e.splice(t-r-l,r+l),t=t-r-l;for(var f=this.diff_main(a,c,!1,d),m=f.length-1;m>=0;m--)e.splice(t,0,f[m]);t=t+f.length}l=0,r=0,a="",c="";break}t++}return e.pop(),e},n.prototype.diff_bisect_=function(s,h,d){for(var o=s.length,p=h.length,e=Math.ceil((o+p)/2),t=e,r=2*e,l=new Array(r),a=new Array(r),c=0;c<r;c++)l[c]=-1,a[c]=-1;l[t+1]=0,a[t+1]=0;for(var f=o-p,m=f%2!=0,y=0,D=0,E=0,b=0,g=0;g<e&&!(new Date().getTime()>d);g++){for(var S=-g+y;S<=g-D;S+=2){var M=t+S,_;S==-g||S!=g&&l[M-1]<l[M+1]?_=l[M+1]:_=l[M-1]+1;for(var T=_-S;_<o&&T<p&&s.charAt(_)==h.charAt(T);)_++,T++;if(l[M]=_,_>o)D+=2;else if(T>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(_>=A)return this.diff_bisectSplit_(s,h,_,T,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 C=A-$;A<o&&C<p&&s.charAt(o-A-1)==h.charAt(p-C-1);)A++,C++;if(a[F]=A,A>o)b+=2;else if(C>p)E+=2;else if(!m){var M=t+f-$;if(M>=0&&M<r&&l[M]!=-1){var _=l[M],T=t+_-M;if(A=o-A,_>=A)return this.diff_bisectSplit_(s,h,_,T,d)}}}}return[new n.Diff(i,s),new n.Diff(u,h)]},n.prototype.diff_bisectSplit_=function(s,h,d,o,p){var e=s.substring(0,d),t=h.substring(0,o),r=s.substring(d),l=h.substring(o),a=this.diff_main(e,t,!1,p),c=this.diff_main(r,l,!1,p);return a.concat(c)},n.prototype.diff_linesToChars_=function(s,h){var d=[],o={};d[0]="";function p(l){for(var a="",c=0,f=-1,m=d.length;f<l.length-1;){f=l.indexOf(`
|
|
1000
|
+
`,c),f==-1&&(f=l.length-1);var y=l.substring(c,f+1);(o.hasOwnProperty?o.hasOwnProperty(y):o[y]!==void 0)?a+=String.fromCharCode(o[y]):(m==e&&(y=l.substring(c),f=l.length),a+=String.fromCharCode(m),o[y]=m,d[m++]=y),c=f+1}return a}var e=4e4,t=p(s);e=65535;var r=p(h);return{chars1:t,chars2:r,lineArray:d}},n.prototype.diff_charsToLines_=function(s,h){for(var d=0;d<s.length;d++){for(var o=s[d][1],p=[],e=0;e<o.length;e++)p[e]=h[o.charCodeAt(e)];s[d][1]=p.join("")}},n.prototype.diff_commonPrefix=function(s,h){if(!s||!h||s.charAt(0)!=h.charAt(0))return 0;for(var d=0,o=Math.min(s.length,h.length),p=o,e=0;d<p;)s.substring(e,p)==h.substring(e,p)?(d=p,e=d):o=p,p=Math.floor((o-d)/2+d);return p},n.prototype.diff_commonSuffix=function(s,h){if(!s||!h||s.charAt(s.length-1)!=h.charAt(h.length-1))return 0;for(var d=0,o=Math.min(s.length,h.length),p=o,e=0;d<p;)s.substring(s.length-p,s.length-e)==h.substring(h.length-p,h.length-e)?(d=p,e=d):o=p,p=Math.floor((o-d)/2+d);return p},n.prototype.diff_commonOverlap_=function(s,h){var d=s.length,o=h.length;if(d==0||o==0)return 0;d>o?s=s.substring(d-o):d<o&&(h=h.substring(0,d));var p=Math.min(d,o);if(s==h)return p;for(var e=0,t=1;;){var r=s.substring(p-t),l=h.indexOf(r);if(l==-1)return e;t+=l,(l==0||s.substring(p-t)==h.substring(0,t))&&(e=t,t++)}},n.prototype.diff_halfMatch_=function(s,h){if(this.Diff_Timeout<=0)return null;var d=s.length>h.length?s:h,o=s.length>h.length?h:s;if(d.length<4||o.length*2<d.length)return null;var p=this;function e(D,E,b){for(var g=D.substring(b,b+Math.floor(D.length/4)),S=-1,M="",_,T,F,A;(S=E.indexOf(g,S+1))!=-1;){var $=p.diff_commonPrefix(D.substring(b),E.substring(S)),C=p.diff_commonSuffix(D.substring(0,b),E.substring(0,S));M.length<C+$&&(M=E.substring(S-C,S)+E.substring(S,S+$),_=D.substring(0,b-C),T=D.substring(b+$),F=E.substring(0,S-C),A=E.substring(S+$))}return M.length*2>=D.length?[_,T,F,A,M]:null}var t=e(d,o,Math.ceil(d.length/4)),r=e(d,o,Math.ceil(d.length/2)),l;if(!t&&!r)return null;r?t?l=t[4].length>r[4].length?t:r:l=r:l=t;var a,c,f,m;s.length>h.length?(a=l[0],c=l[1],f=l[2],m=l[3]):(f=l[0],m=l[1],a=l[2],c=l[3]);var y=l[4];return[a,c,f,m,y]},n.prototype.diff_cleanupSemantic=function(s){for(var h=!1,d=[],o=0,p=null,e=0,t=0,r=0,l=0,a=0;e<s.length;)s[e][0]==v?(d[o++]=e,t=l,r=a,l=0,a=0,p=s[e][1]):(s[e][0]==u?l+=s[e][1].length:a+=s[e][1].length,p&&p.length<=Math.max(t,r)&&p.length<=Math.max(l,a)&&(s.splice(d[o-1],0,new n.Diff(i,p)),s[d[o-1]+1][0]=u,o--,o--,e=o>0?d[o-1]:-1,t=0,r=0,l=0,a=0,p=null,h=!0)),e++;for(h&&this.diff_cleanupMerge(s),this.diff_cleanupSemanticLossless(s),e=1;e<s.length;){if(s[e-1][0]==i&&s[e][0]==u){var c=s[e-1][1],f=s[e][1],m=this.diff_commonOverlap_(c,f),y=this.diff_commonOverlap_(f,c);m>=y?(m>=c.length/2||m>=f.length/2)&&(s.splice(e,0,new n.Diff(v,f.substring(0,m))),s[e-1][1]=c.substring(0,c.length-m),s[e+1][1]=f.substring(m),e++):(y>=c.length/2||y>=f.length/2)&&(s.splice(e,0,new n.Diff(v,c.substring(0,y))),s[e-1][0]=u,s[e-1][1]=f.substring(0,f.length-y),s[e+1][0]=i,s[e+1][1]=c.substring(y),e++),e++}e++}},n.prototype.diff_cleanupSemanticLossless=function(s){function h(y,D){if(!y||!D)return 6;var E=y.charAt(y.length-1),b=D.charAt(0),g=E.match(n.nonAlphaNumericRegex_),S=b.match(n.nonAlphaNumericRegex_),M=g&&E.match(n.whitespaceRegex_),_=S&&b.match(n.whitespaceRegex_),T=M&&E.match(n.linebreakRegex_),F=_&&b.match(n.linebreakRegex_),A=T&&y.match(n.blanklineEndRegex_),$=F&&D.match(n.blanklineStartRegex_);return A||$?5:T||F?4:g&&!M&&_?3:M||_?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 l=o,a=p,c=e,f=h(o,p)+h(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=h(o,p)+h(p,e);m>=f&&(f=m,l=o,a=p,c=e)}s[d-1][1]!=l&&(l?s[d-1][1]=l:(s.splice(d-1,1),d--),s[d][1]=a,c?s[d+1][1]=c:(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 h=!1,d=[],o=0,p=null,e=0,t=!1,r=!1,l=!1,a=!1;e<s.length;)s[e][0]==v?(s[e][1].length<this.Diff_EditCost&&(l||a)?(d[o++]=e,t=l,r=a,p=s[e][1]):(o=0,p=null),l=a=!1):(s[e][0]==i?a=!0:l=!0,p&&(t&&r&&l&&a||p.length<this.Diff_EditCost/2&&t+r+l+a==3)&&(s.splice(d[o-1],0,new n.Diff(i,p)),s[d[o-1]+1][0]=u,o--,p=null,t&&r?(l=a=!0,o=0):(o--,e=o>0?d[o-1]:-1,l=a=!1),h=!0)),e++;h&&this.diff_cleanupMerge(s)},n.prototype.diff_cleanupMerge=function(s){s.push(new n.Diff(v,""));for(var h=0,d=0,o=0,p="",e="",t;h<s.length;)switch(s[h][0]){case u:o++,e+=s[h][1],h++;break;case i:d++,p+=s[h][1],h++;break;case v:d+o>1?(d!==0&&o!==0&&(t=this.diff_commonPrefix(e,p),t!==0&&(h-d-o>0&&s[h-d-o-1][0]==v?s[h-d-o-1][1]+=e.substring(0,t):(s.splice(0,0,new n.Diff(v,e.substring(0,t))),h++),e=e.substring(t),p=p.substring(t)),t=this.diff_commonSuffix(e,p),t!==0&&(s[h][1]=e.substring(e.length-t)+s[h][1],e=e.substring(0,e.length-t),p=p.substring(0,p.length-t))),h-=d+o,s.splice(h,d+o),p.length&&(s.splice(h,0,new n.Diff(i,p)),h++),e.length&&(s.splice(h,0,new n.Diff(u,e)),h++),h++):h!==0&&s[h-1][0]==v?(s[h-1][1]+=s[h][1],s.splice(h,1)):h++,o=0,d=0,p="",e="";break}s[s.length-1][1]===""&&s.pop();var r=!1;for(h=1;h<s.length-1;)s[h-1][0]==v&&s[h+1][0]==v&&(s[h][1].substring(s[h][1].length-s[h-1][1].length)==s[h-1][1]?(s[h][1]=s[h-1][1]+s[h][1].substring(0,s[h][1].length-s[h-1][1].length),s[h+1][1]=s[h-1][1]+s[h+1][1],s.splice(h-1,1),r=!0):s[h][1].substring(0,s[h+1][1].length)==s[h+1][1]&&(s[h-1][1]+=s[h+1][1],s[h][1]=s[h][1].substring(s[h+1][1].length)+s[h+1][1],s.splice(h+1,1),r=!0)),h++;r&&this.diff_cleanupMerge(s)},n.prototype.diff_xIndex=function(s,h){var d=0,o=0,p=0,e=0,t;for(t=0;t<s.length&&(s[t][0]!==u&&(d+=s[t][1].length),s[t][0]!==i&&(o+=s[t][1].length),!(d>h));t++)p=d,e=o;return s.length!=t&&s[t][0]===i?e:e+(h-p)},n.prototype.diff_prettyHtml=function(s){for(var h=[],d=/&/g,o=/</g,p=/>/g,e=/\n/g,t=0;t<s.length;t++){var r=s[t][0],l=s[t][1],a=l.replace(d,"&").replace(o,"<").replace(p,">").replace(e,"¶<br>");switch(r){case u:h[t]='<ins style="background:#e6ffe6;">'+a+"</ins>";break;case i:h[t]='<del style="background:#ffe6e6;">'+a+"</del>";break;case v:h[t]="<span>"+a+"</span>";break}}return h.join("")},n.prototype.diff_text1=function(s){for(var h=[],d=0;d<s.length;d++)s[d][0]!==u&&(h[d]=s[d][1]);return h.join("")},n.prototype.diff_text2=function(s){for(var h=[],d=0;d<s.length;d++)s[d][0]!==i&&(h[d]=s[d][1]);return h.join("")},n.prototype.diff_levenshtein=function(s){for(var h=0,d=0,o=0,p=0;p<s.length;p++){var e=s[p][0],t=s[p][1];switch(e){case u:d+=t.length;break;case i:o+=t.length;break;case v:h+=Math.max(d,o),d=0,o=0;break}}return h+=Math.max(d,o),h},n.prototype.diff_toDelta=function(s){for(var h=[],d=0;d<s.length;d++)switch(s[d][0]){case u:h[d]="+"+encodeURI(s[d][1]);break;case i:h[d]="-"+s[d][1].length;break;case v:h[d]="="+s[d][1].length;break}return h.join(" ").replace(/%20/g," ")},n.prototype.diff_fromDelta=function(s,h){for(var d=[],o=0,p=0,e=h.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(u,decodeURI(r))}catch{throw new Error("Illegal escape in diff_fromDelta: "+r)}break;case"-":case"=":var l=parseInt(r,10);if(isNaN(l)||l<0)throw new Error("Invalid number in diff_fromDelta: "+r);var a=s.substring(p,p+=l);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,h,d){if(s==null||h==null||d==null)throw new Error("Null input. (match_main)");return d=Math.max(0,Math.min(d,s.length)),s==h?0:s.length?s.substring(d,d+h.length)==h?d:this.match_bitap_(s,h,d):-1},n.prototype.match_bitap_=function(s,h,d){if(h.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var o=this.match_alphabet_(h),p=this;function e(_,T){var F=_/h.length,A=Math.abs(d-T);return p.Match_Distance?F+A/p.Match_Distance:A?1:F}var t=this.Match_Threshold,r=s.indexOf(h,d);r!=-1&&(t=Math.min(e(0,r),t),r=s.lastIndexOf(h,d+h.length),r!=-1&&(t=Math.min(e(0,r),t)));var l=1<<h.length-1;r=-1;for(var a,c,f=h.length+s.length,m,y=0;y<h.length;y++){for(a=0,c=f;a<c;)e(y,d+c)<=t?a=c:f=c,c=Math.floor((f-a)/2+a);f=c;var D=Math.max(1,d-c+1),E=Math.min(d+c,s.length)+h.length,b=Array(E+2);b[E+1]=(1<<y)-1;for(var g=E;g>=D;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]&l){var M=e(y,g-1);if(M<=t)if(t=M,r=g-1,r>d)D=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 h={},d=0;d<s.length;d++)h[s.charAt(d)]=0;for(var d=0;d<s.length;d++)h[s.charAt(d)]|=1<<s.length-d-1;return h},n.prototype.patch_addContext_=function(s,h){if(h.length!=0){if(s.start2===null)throw Error("patch not initialized");for(var d=h.substring(s.start2,s.start2+s.length1),o=0;h.indexOf(d)!=h.lastIndexOf(d)&&d.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)o+=this.Patch_Margin,d=h.substring(s.start2-o,s.start2+s.length1+o);o+=this.Patch_Margin;var p=h.substring(s.start2-o,s.start2);p&&s.diffs.unshift(new n.Diff(v,p));var e=h.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,h,d){var o,p;if(typeof s=="string"&&typeof h=="string"&&typeof d>"u")o=s,p=this.diff_main(o,h,!0),p.length>2&&(this.diff_cleanupSemantic(p),this.diff_cleanupEfficiency(p));else if(s&&typeof s=="object"&&typeof h>"u"&&typeof d>"u")p=s,o=this.diff_text1(p);else if(typeof s=="string"&&h&&typeof h=="object"&&typeof d>"u")o=s,p=h;else if(typeof s=="string"&&typeof h=="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,l=0,a=0,c=o,f=o,m=0;m<p.length;m++){var y=p[m][0],D=p[m][1];switch(!r&&y!==v&&(t.start1=l,t.start2=a),y){case u:t.diffs[r++]=p[m],t.length2+=D.length,f=f.substring(0,a)+D+f.substring(a);break;case i:t.length1+=D.length,t.diffs[r++]=p[m],f=f.substring(0,a)+f.substring(a+D.length);break;case v:D.length<=2*this.Patch_Margin&&r&&p.length!=m+1?(t.diffs[r++]=p[m],t.length1+=D.length,t.length2+=D.length):D.length>=2*this.Patch_Margin&&r&&(this.patch_addContext_(t,c),e.push(t),t=new n.patch_obj,r=0,c=f,l=a);break}y!==u&&(l+=D.length),y!==i&&(a+=D.length)}return r&&(this.patch_addContext_(t,c),e.push(t)),e},n.prototype.patch_deepCopy=function(s){for(var h=[],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,h[d]=p}return h},n.prototype.patch_apply=function(s,h){if(s.length==0)return[h,[]];s=this.patch_deepCopy(s);var d=this.patch_addPadding(s);h=d+h+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),l,a=-1;if(r.length>this.Match_MaxBits?(l=this.match_main(h,r.substring(0,this.Match_MaxBits),t),l!=-1&&(a=this.match_main(h,r.substring(r.length-this.Match_MaxBits),t+r.length-this.Match_MaxBits),(a==-1||l>=a)&&(l=-1))):l=this.match_main(h,r,t),l==-1)p[e]=!1,o-=s[e].length2-s[e].length1;else{p[e]=!0,o=l-t;var c;if(a==-1?c=h.substring(l,l+r.length):c=h.substring(l,a+this.Match_MaxBits),r==c)h=h.substring(0,l)+this.diff_text2(s[e].diffs)+h.substring(l+r.length);else{var f=this.diff_main(r,c,!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,D=0;D<s[e].diffs.length;D++){var E=s[e].diffs[D];E[0]!==v&&(y=this.diff_xIndex(f,m)),E[0]===u?h=h.substring(0,l+y)+E[1]+h.substring(l+y):E[0]===i&&(h=h.substring(0,l+y)+h.substring(l+this.diff_xIndex(f,m+E[1].length))),E[0]!==i&&(m+=E[1].length)}}}}}return h=h.substring(d.length,h.length-d.length),[h,p]},n.prototype.patch_addPadding=function(s){for(var h=this.Patch_Margin,d="",o=1;o<=h;o++)d+=String.fromCharCode(o);for(var o=0;o<s.length;o++)s[o].start1+=h,s[o].start2+=h;var p=s[0],e=p.diffs;if(e.length==0||e[0][0]!=v)e.unshift(new n.Diff(v,d)),p.start1-=h,p.start2-=h,p.length1+=h,p.length2+=h;else if(h>e[0][1].length){var t=h-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+=h,p.length2+=h;else if(h>e[e.length-1][1].length){var t=h-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 h=this.Match_MaxBits,d=0;d<s.length;d++)if(!(s[d].length1<=h)){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,l=!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<h-this.Patch_Margin;){var a=o.diffs[0][0],c=o.diffs[0][1];a===u?(r.length2+=c.length,e+=c.length,r.diffs.push(o.diffs.shift()),l=!1):a===i&&r.diffs.length==1&&r.diffs[0][0]==v&&c.length>2*h?(r.length1+=c.length,p+=c.length,l=!1,r.diffs.push(new n.Diff(a,c)),o.diffs.shift()):(c=c.substring(0,h-r.length1-this.Patch_Margin),r.length1+=c.length,p+=c.length,a===v?(r.length2+=c.length,e+=c.length):l=!1,r.diffs.push(new n.Diff(a,c)),c==o.diffs[0][1]?o.diffs.shift():o.diffs[0][1]=o.diffs[0][1].substring(c.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))),l||s.splice(++d,0,r)}}},n.prototype.patch_toText=function(s){for(var h=[],d=0;d<s.length;d++)h[d]=s[d];return h.join("")},n.prototype.patch_fromText=function(s){var h=[];if(!s)return h;for(var d=s.split(`
|
|
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(h.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 l=decodeURI(d[o].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+l)}if(r=="-")t.diffs.push(new n.Diff(i,l));else if(r=="+")t.diffs.push(new n.Diff(u,l));else if(r==" ")t.diffs.push(new n.Diff(v,l));else{if(r=="@")break;if(r!=="")throw new Error('Invalid patch mode "'+r+'" in: '+l)}o++}}return h},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,h;this.length1===0?s=this.start1+",0":this.length1==1?s=this.start1+1:s=this.start1+1+","+this.length1,this.length2===0?h=this.start2+",0":this.length2==1?h=this.start2+1:h=this.start2+1+","+this.length2;for(var d=["@@ -"+s+" +"+h+` @@
|
|
1002
|
+
`],o,p=0;p<this.diffs.length;p++){switch(this.diffs[p][0]){case u: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=u,L.exports.DIFF_EQUAL=v})(er);var ba=er.exports,wa=Gt&&Gt.__extends||function(){var L=function(n,i){return L=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(u,v){u.__proto__=v}||function(u,v){for(var s in v)Object.prototype.hasOwnProperty.call(v,s)&&(u[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 u(){this.constructor=n}n.prototype=i===null?Object.create(i):(u.prototype=i.prototype,new u)}}();Object.defineProperty(Gt,"__esModule",{value:!0});var ye=Un,Di=pt,Ca=ft,Ea=ba,Sa=function(L){wa(n,L);function n(i){var u=L.call(this,i)||this;return u.state={value:u.props.value},u.onChange=u.onChange.bind(u),u.diff=u.diff.bind(u),u}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 Ea,u=this.state.value[0],v=this.state.value[1];if(u.length===0&&v.length===0)return[];var s=i.diff_main(u,v);i.diff_cleanupSemantic(s);var h=this.generateDiffedLines(s),d=this.setCodeMarkers(h);return d},n.prototype.generateDiffedLines=function(i){var u={DIFF_EQUAL:0,DIFF_DELETE:-1,DIFF_INSERT:1},v={left:[],right:[]},s={left:1,right:1};return i.forEach(function(h){var d=h[0],o=h[1],p=o.split(`
|
|
1004
|
+
`).length-1;if(o.length!==0){var e=o[0],t=o[o.length-1],r=0;switch(d){case u.DIFF_EQUAL:s.left+=p,s.right+=p;break;case u.DIFF_DELETE:e===`
|
|
1005
|
+
`&&(s.left++,p--),r=p,r===0&&v.right.push({startLine:s.right,endLine:s.right}),t===`
|
|
1006
|
+
`&&(r-=1),v.left.push({startLine:s.left,endLine:s.left+r}),s.left+=p;break;case u.DIFF_INSERT:e===`
|
|
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 u=[],v={left:[],right:[]},s=0;s<i.left.length;s++){var h={startRow:i.left[s].startLine-1,endRow:i.left[s].endLine,type:"text",className:"codeMarker"};v.left.push(h)}for(var s=0;s<i.right.length;s++){var h={startRow:i.right[s].startLine-1,endRow:i.right[s].endLine,type:"text",className:"codeMarker"};v.right.push(h)}return u[0]=v.left,u[1]=v.right,u},n.prototype.render=function(){var i=this.diff();return Di.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:ye.number,editorProps:ye.object,enableBasicAutocompletion:ye.bool,enableLiveAutocompletion:ye.bool,focus:ye.bool,fontSize:ye.number,height:ye.string,highlightActiveLine:ye.bool,maxLines:ye.number,minLines:ye.number,mode:ye.string,name:ye.string,className:ye.string,onLoad:ye.func,onPaste:ye.func,onScroll:ye.func,onChange:ye.func,orientation:ye.string,readOnly:ye.bool,scrollMargin:ye.array,setOptions:ye.object,showGutter:ye.bool,showPrintMargin:ye.bool,splits:ye.number,style:ye.object,tabSize:ye.number,theme:ye.string,value:ye.array,width:ye.string,wrapEnabled:ye.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);Gt.default=Sa;Object.defineProperty(It,"__esModule",{value:!0});It.diff=It.split=void 0;var Da=Dt,Aa=Gt;It.diff=Aa.default;var xa=ft;It.split=xa.default;var $a=It.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,u,v){var s=i("../lib/oop"),h=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,h),u.JsonHighlightRules=d}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(i,u,v){var s=i("../range").Range,h=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 l=this.$getIndent(d.getLine(r.row));d.replace(new s(o,0,o,t-1),l)},this.$getIndent=function(d){return d.match(/^\s*/)[0]}}).call(h.prototype),u.MatchingBraceOutdent=h}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(i,u,v){var s=i("../../lib/oop"),h=i("../../range").Range,d=i("./fold_mode").FoldMode,o=u.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 l=this._getFoldWidgetBase(p,e,t);return!l&&this.startRegionRe.test(r)?"start":l},this.getFoldWidgetRange=function(p,e,t,r){var l=p.getLine(t);if(this.startRegionRe.test(l))return this.getCommentRegionBlock(p,l,t);var f=l.match(this.foldingStartMarker);if(f){var a=f.index;if(f[1])return this.openingBracketBlock(p,f[1],t,a);var c=p.getCommentFoldRange(t,a+f[0].length,1);return c&&!c.isMultiLine()&&(r?c=this.getSectionRange(p,t):e!="all"&&(c=null)),c}if(e!=="markbegin"){var f=l.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/),l=e,a=t.length;e+=1;for(var c=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<=l)break;if(y.isMultiLine())e=y.end.row;else if(r==m)break}c=e}}return new h(l,a,c,p.getLine(c).length)},this.getCommentRegionBlock=function(p,e,t){for(var r=e.search(/\s*$/),l=p.getLength(),a=t,c=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,f=1;++t<l;){e=p.getLine(t);var m=c.exec(e);if(m&&(m[1]?f--:f++,!f))break}var y=t;if(y>a)return new h(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,u,v){var s=i("../lib/oop"),h=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,h),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(r,l,a){var c=this.$getIndent(l);if(r=="start"){var f=l.match(/^.*[\{\(\[]\s*$/);f&&(c+=a)}return c},this.checkOutdent=function(r,l,a){return this.$outdent.checkOutdent(l,a)},this.autoOutdent=function(r,l,a){this.$outdent.autoOutdent(l,a)},this.createWorker=function(r){var l=new e(["ace"],"ace/mode/json_worker","JsonWorker");return l.attachToDocument(r.getDocument()),l.on("annotate",function(a){r.setAnnotations(a.data)}),l.on("terminate",function(){r.clearAnnotations()}),l},this.$id="ace/mode/json"}.call(t.prototype),u.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,u,v){var s=i("../lib/oop"),h=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,h),u.JsonHighlightRules=d}),ace.define("ace/mode/json5_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/json_highlight_rules"],function(i,u,v){var s=i("../lib/oop"),h=i("./json_highlight_rules").JsonHighlightRules,d=function(){h.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,h),u.Json5HighlightRules=d}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(i,u,v){var s=i("../range").Range,h=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 l=this.$getIndent(d.getLine(r.row));d.replace(new s(o,0,o,t-1),l)},this.$getIndent=function(d){return d.match(/^\s*/)[0]}}).call(h.prototype),u.MatchingBraceOutdent=h}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(i,u,v){var s=i("../../lib/oop"),h=i("../../range").Range,d=i("./fold_mode").FoldMode,o=u.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 l=this._getFoldWidgetBase(p,e,t);return!l&&this.startRegionRe.test(r)?"start":l},this.getFoldWidgetRange=function(p,e,t,r){var l=p.getLine(t);if(this.startRegionRe.test(l))return this.getCommentRegionBlock(p,l,t);var f=l.match(this.foldingStartMarker);if(f){var a=f.index;if(f[1])return this.openingBracketBlock(p,f[1],t,a);var c=p.getCommentFoldRange(t,a+f[0].length,1);return c&&!c.isMultiLine()&&(r?c=this.getSectionRange(p,t):e!="all"&&(c=null)),c}if(e!=="markbegin"){var f=l.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/),l=e,a=t.length;e+=1;for(var c=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<=l)break;if(y.isMultiLine())e=y.end.row;else if(r==m)break}c=e}}return new h(l,a,c,p.getLine(c).length)},this.getCommentRegionBlock=function(p,e,t){for(var r=e.search(/\s*$/),l=p.getLength(),a=t,c=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,f=1;++t<l;){e=p.getLine(t);var m=c.exec(e);if(m&&(m[1]?f--:f++,!f))break}var y=t;if(y>a)return new h(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,u,v){var s=i("../lib/oop"),h=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,h),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.checkOutdent=function(t,r,l){return this.$outdent.checkOutdent(r,l)},this.autoOutdent=function(t,r,l){this.$outdent.autoOutdent(r,l)},this.$id="ace/mode/json5"}.call(e.prototype),u.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 h=v,d="";h;){var o=s[h];if(typeof o=="string")return o+d;if(o)return o.location.replace(/\/*$/,"/")+(d||o.main||o.name);if(o===!1)return"";var p=h.lastIndexOf("/");if(p===-1)break;d=h.substr(p)+d,h=h.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,h,d,o){postMessage({type:"error",data:{message:v,data:o&&o.data,file:s,line:h,col:d,stack:o&&o.stack}})},L.normalizeModule=function(v,s){if(s.indexOf("!")!==-1){var h=s.split("!");return L.normalizeModule(v,h[0])+"!"+L.normalizeModule(v,h[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 h=L.require.modules[s];if(h)return h.initialized||(h.initialized=!0,h.exports=h.factory().exports),h.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,h){if(arguments.length==2?(h=s,typeof v!="string"&&(s=v,v=L.require.id)):arguments.length==1&&(h=v,s=[],v=L.require.id),typeof h!="function"){L.require.modules[v]={exports:h,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=h.apply(this,s.slice(0,h.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"),h=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(h.prototype),new h};var i=L.main=null,u=L.sender=null;L.onmessage=function(v){var s=v.data;if(s.event&&u)u._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),u=L.sender=L.initSender();var h=this.require(s.module)[s.classname];i=L.main=new h(u)}}}})(ka),ace.define("ace/lib/oop",[],function(L,n,i){n.inherits=function(u,v){u.super_=v,u.prototype=Object.create(v.prototype,{constructor:{value:u,enumerable:!1,writable:!0,configurable:!0}})},n.mixin=function(u,v){for(var s in v)u[s]=v[s];return u},n.implement=function(u,v){n.mixin(u,v)}}),ace.define("ace/apply_delta",[],function(L,n,i){n.applyDelta=function(u,v,s){var h=v.start.row,d=v.start.column,o=u[h]||"";switch(v.action){case"insert":var p=v.lines;if(p.length===1)u[h]=o.substring(0,d)+v.lines[0]+o.substring(d);else{var e=[h,1].concat(v.lines);u.splice.apply(u,e),u[h]=o.substring(0,d)+u[h],u[h+v.lines.length-1]+=o.substring(d)}break;case"remove":var t=v.end.column,r=v.end.row;h===r?u[h]=o.substring(0,d)+o.substring(t):u.splice(h,r-h+1,o.substring(0,d)+u[r].substring(t))}}}),ace.define("ace/lib/event_emitter",[],function(L,n,i){var u={},v=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};u._emit=u._dispatchEvent=function(h,d){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var o=this._eventRegistry[h]||[],p=this._defaultHandlers[h];if(!(!o.length&&!p)){(typeof d!="object"||!d)&&(d={}),d.type||(d.type=h),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)}},u._signal=function(h,d){var o=(this._eventRegistry||{})[h];if(o){o=o.slice();for(var p=0;p<o.length;p++)o[p](d,this)}},u.once=function(h,d){var o=this;if(this.on(h,function p(){o.off(h,p),d.apply(null,arguments)}),!d)return new Promise(function(p){d=p})},u.setDefaultHandler=function(h,d){var o=this._defaultHandlers;if(o||(o=this._defaultHandlers={_disabled_:{}}),o[h]){var p=o[h],e=o._disabled_[h];e||(o._disabled_[h]=e=[]),e.push(p);var t=e.indexOf(d);t!=-1&&e.splice(t,1)}o[h]=d},u.removeDefaultHandler=function(h,d){var o=this._defaultHandlers;if(o){var p=o._disabled_[h];if(o[h]==d)p&&this.setDefaultHandler(h,p.pop());else if(p){var e=p.indexOf(d);e!=-1&&p.splice(e,1)}}},u.on=u.addEventListener=function(h,d,o){this._eventRegistry=this._eventRegistry||{};var p=this._eventRegistry[h];return p||(p=this._eventRegistry[h]=[]),p.indexOf(d)==-1&&p[o?"unshift":"push"](d),d},u.off=u.removeListener=u.removeEventListener=function(h,d){this._eventRegistry=this._eventRegistry||{};var o=this._eventRegistry[h];if(o){var p=o.indexOf(d);p!==-1&&o.splice(p,1)}},u.removeAllListeners=function(h){h||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[h]=void 0),this._defaultHandlers&&(this._defaultHandlers[h]=void 0)},n.EventEmitter=u}),ace.define("ace/range",[],function(L,n,i){var u=function(){function v(s,h,d,o){this.start={row:s,column:h},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,h){return this.compare(s,h)==0},v.prototype.compareRange=function(s){var h,d=s.end,o=s.start;return h=this.compare(d.row,d.column),h==1?(h=this.compare(o.row,o.column),h==1?2:h==0?1:0):h==-1?-2:(h=this.compare(o.row,o.column),h==-1?-1:h==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 h=this.compareRange(s);return h==-1||h==0||h==1},v.prototype.isEnd=function(s,h){return this.end.row==s&&this.end.column==h},v.prototype.isStart=function(s,h){return this.start.row==s&&this.start.column==h},v.prototype.setStart=function(s,h){typeof s=="object"?(this.start.column=s.column,this.start.row=s.row):(this.start.row=s,this.start.column=h)},v.prototype.setEnd=function(s,h){typeof s=="object"?(this.end.column=s.column,this.end.row=s.row):(this.end.row=s,this.end.column=h)},v.prototype.inside=function(s,h){return this.compare(s,h)==0?!(this.isEnd(s,h)||this.isStart(s,h)):!1},v.prototype.insideStart=function(s,h){return this.compare(s,h)==0?!this.isEnd(s,h):!1},v.prototype.insideEnd=function(s,h){return this.compare(s,h)==0?!this.isStart(s,h):!1},v.prototype.compare=function(s,h){return!this.isMultiLine()&&s===this.start.row?h<this.start.column?-1:h>this.end.column?1:0:s<this.start.row?-1:s>this.end.row?1:this.start.row===s?h>=this.start.column?0:-1:this.end.row===s?h<=this.end.column?0:1:0},v.prototype.compareStart=function(s,h){return this.start.row==s&&this.start.column==h?-1:this.compare(s,h)},v.prototype.compareEnd=function(s,h){return this.end.row==s&&this.end.column==h?1:this.compare(s,h)},v.prototype.compareInside=function(s,h){return this.end.row==s&&this.end.column==h?1:this.start.row==s&&this.start.column==h?-1:this.compare(s,h)},v.prototype.clipRows=function(s,h){if(this.end.row>h)var d={row:h+1,column:0};else if(this.end.row<s)var d={row:s,column:0};if(this.start.row>h)var o={row:h+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,h){var d=this.compare(s,h);if(d==0)return this;if(d==-1)var o={row:s,column:h};else var p={row:s,column:h};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 h=s.documentToScreenPosition(this.start),d=s.documentToScreenPosition(this.end);return new v(h.row,h.column,d.row,d.column)},v.prototype.moveBy=function(s,h){this.start.row+=s,this.start.column+=h,this.end.row+=s,this.end.column+=h},v}();u.fromPoints=function(v,s){return new u(v.row,v.column,s.row,s.column)},u.comparePoints=function(v,s){return v.row-s.row||v.column-s.column},n.Range=u}),ace.define("ace/anchor",[],function(L,n,i){function u(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),l=(t?1:-1)*(o.end.column-o.start.column),a=o.start,c=t?a:o.end;return u(p,a,e)?{row:p.row,column:p.column}:u(c,p,!e)?{row:p.row+r,column:p.column+(p.row==c.row?l:0)}:{row:a.row,column:a.column}}var s=L("./lib/oop"),h=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 l={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:l,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,h),n.Anchor=d}),ace.define("ace/document",[],function(L,n,i){var u=L("./lib/oop"),v=L("./apply_delta").applyDelta,s=L("./lib/event_emitter").EventEmitter,h=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 h(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||`
|
|
1012
1012
|
`}},p.prototype.setNewLineMode=function(e){this.$newLineMode!==e&&(this.$newLineMode=e,this._signal("changeNewLineMode"))},p.prototype.getNewLineMode=function(){return this.$newLineMode},p.prototype.isNewLine=function(e){return e==`\r
|
|
1013
1013
|
`||e=="\r"||e==`
|
|
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),l=this.pos(e.row,e.column+t.length);return this.applyDelta({start:r,end:l,action:"insert",lines:[t]},!0),this.clonePos(l)},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 l=this.getLine(e);return t==null&&(t=l.length),t=Math.min(Math.max(t,0),l.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),l={row:r.row+t.length-1,column:(t.length==1?r.column:0)+t[t.length-1].length};return this.applyDelta({start:r,end:l,action:"insert",lines:t}),this.clonePos(l)},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 l=this.clippedPos(e,t),a=this.clippedPos(e,r);return this.applyDelta({start:l,end:a,action:"remove",lines:this.getLinesForRange({start:l,end:a})},!0),this.clonePos(l)},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,l=t<this.getLength()-1,a=r?e-1:e,c=r?this.getLine(a).length:0,f=l?t+1:t,m=l?0:this.getLine(f).length,y=new h(a,c,f,m),D=this.$lines.slice(e,t+1);return this.applyDelta({start:y.start,end:y.end,action:"remove",lines:this.getLinesForRange(y)}),D},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 h||(e=h.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]:!h.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,l=r.length-t+1,a=e.start.row,c=e.start.column,f=0,m=0;f<l;f=m){m+=t-1;var y=r.slice(f,m);y.push(""),this.applyDelta({start:this.pos(a+f,c),end:this.pos(a+m,c=0),action:e.action,lines:y},!0)}e.lines=r.slice(f),e.start.row=a+f,e.start.column=c,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(),l=this.getNewLineCharacter().length,a=t||0,c=r.length;a<c;a++)if(e-=r[a].length+l,e<0)return{row:a,column:e+r[a].length+l};return{row:c-1,column:e+r[c-1].length+l}},p.prototype.positionToIndex=function(e,t){for(var r=this.$lines||this.getAllLines(),l=this.getNewLineCharacter().length,a=0,c=Math.min(e.row,r.length),f=t||0;f<c;++f)a+=r[f].length+l;return a+e.column},p.prototype.$split=function(e){return e.split(/\r\n|\r|\n/)},p}();
|
|
1015
|
-
`,r:"\r",t:" "},h,d=function(f){throw{name:"SyntaxError",message:f,at:u,text:h}},
|
|
1016
|
-
`||v=="\r")break;y+=v}}d("Bad string")},t=function(){for(;v&&v<=" ";)
|
|
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),l=this.pos(e.row,e.column+t.length);return this.applyDelta({start:r,end:l,action:"insert",lines:[t]},!0),this.clonePos(l)},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 l=this.getLine(e);return t==null&&(t=l.length),t=Math.min(Math.max(t,0),l.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),l={row:r.row+t.length-1,column:(t.length==1?r.column:0)+t[t.length-1].length};return this.applyDelta({start:r,end:l,action:"insert",lines:t}),this.clonePos(l)},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 l=this.clippedPos(e,t),a=this.clippedPos(e,r);return this.applyDelta({start:l,end:a,action:"remove",lines:this.getLinesForRange({start:l,end:a})},!0),this.clonePos(l)},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,l=t<this.getLength()-1,a=r?e-1:e,c=r?this.getLine(a).length:0,f=l?t+1:t,m=l?0:this.getLine(f).length,y=new h(a,c,f,m),D=this.$lines.slice(e,t+1);return this.applyDelta({start:y.start,end:y.end,action:"remove",lines:this.getLinesForRange(y)}),D},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 h||(e=h.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]:!h.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,l=r.length-t+1,a=e.start.row,c=e.start.column,f=0,m=0;f<l;f=m){m+=t-1;var y=r.slice(f,m);y.push(""),this.applyDelta({start:this.pos(a+f,c),end:this.pos(a+m,c=0),action:e.action,lines:y},!0)}e.lines=r.slice(f),e.start.row=a+f,e.start.column=c,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(),l=this.getNewLineCharacter().length,a=t||0,c=r.length;a<c;a++)if(e-=r[a].length+l,e<0)return{row:a,column:e+r[a].length+l};return{row:c-1,column:e+r[c-1].length+l}},p.prototype.positionToIndex=function(e,t){for(var r=this.$lines||this.getAllLines(),l=this.getNewLineCharacter().length,a=0,c=Math.min(e.row,r.length),f=t||0;f<c;++f)a+=r[f].length+l;return a+e.column},p.prototype.$split=function(e){return e.split(/\r\n|\r|\n/)},p}();o.prototype.$autoNewLine="",o.prototype.$newLineMode="auto",u.implement(o.prototype,s),n.Document=o}),ace.define("ace/lib/deep_copy",[],function(L,n,i){n.deepCopy=function u(v){if(typeof v!="object"||!v)return v;var s;if(Array.isArray(v)){s=[];for(var h=0;h<v.length;h++)s[h]=u(v[h]);return s}if(Object.prototype.toString.call(v)!=="[object Object]")return v;s={};for(var h in v)s[h]=u(v[h]);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,h){for(var d="";h>0;)h&1&&(d+=s),(h>>=1)&&(s+=s);return d};var u=/^\s\s*/,v=/\s\s*$/;n.stringTrimLeft=function(s){return s.replace(u,"")},n.stringTrimRight=function(s){return s.replace(v,"")},n.copyObject=function(s){var h={};for(var d in s)h[d]=s[d];return h},n.copyArray=function(s){for(var h=[],d=0,o=s.length;d<o;d++)s[d]&&typeof s[d]=="object"?h[d]=this.copyObject(s[d]):h[d]=s[d];return h},n.deepCopy=L("./deep_copy").deepCopy,n.arrayToMap=function(s){for(var h={},d=0;d<s.length;d++)h[s[d]]=1;return h},n.createMap=function(s){var h=Object.create(null);for(var d in s)h[d]=s[d];return h},n.arrayRemove=function(s,h){for(var d=0;d<=s.length;d++)h===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,h){var d=[];return s.replace(h,function(o){d.push({offset:arguments[arguments.length-2],length:o.length})}),d},n.deferredCall=function(s){var h=null,d=function(){h=null,s()},o=function(p){return o.cancel(),h=setTimeout(d,p||0),o};return o.schedule=o,o.call=function(){return this.cancel(),s(),o},o.cancel=function(){return clearTimeout(h),h=null,o},o.isPending=function(){return h},o},n.delayedCall=function(s,h){var d=null,o=function(){d=null,s()},p=function(e){d==null&&(d=setTimeout(o,e||h))};return p.delay=function(e){d&&clearTimeout(d),d=setTimeout(o,e||h)},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,h,d){return d&&s.codePointAt(h)>65535?2:1}}),ace.define("ace/worker/mirror",[],function(L,n,i){var u=L("../document").Document,v=L("../lib/lang"),s=n.Mirror=function(h){this.sender=h;var d=this.doc=new u(""),o=this.deferredUpdate=v.delayedCall(this.onUpdate.bind(this)),p=this;h.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 l,a;if(Array.isArray(t[r+1])?l={action:"insert",start:t[r],lines:t[r+1]}:l={action:"remove",start:t[r],end:t[r+1]},(l.action=="insert"?l.start:l.end).row>=d.$lines.length)throw a=new Error("Invalid delta"),a.data={path:p.$path,linesLength:d.$lines.length,start:l.start,end:l.end},a;d.applyDelta(l,!0)}if(p.$timeout)return o.schedule(p.$timeout);p.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(h){this.$timeout=h},this.setValue=function(h){this.doc.setValue(h),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(h){this.sender.callback(this.doc.getValue(),h)},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 u,v,s={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
1015
|
+
`,r:"\r",t:" "},h,d=function(f){throw{name:"SyntaxError",message:f,at:u,text:h}},o=function(f){return f&&f!==v&&d("Expected '"+f+"' instead of '"+v+"'"),v=h.charAt(u),u+=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="",D;if(v==='"')for(;o();){if(v==='"')return o(),y;if(v==="\\")if(o(),v==="u"){for(D=0,m=0;m<4&&(f=parseInt(o(),16),!!isFinite(f));m+=1)D=D*16+f;y+=String.fromCharCode(D)}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+"'")},l,a=function(){var f=[];if(v==="["){if(o("["),t(),v==="]")return o("]"),f;for(;v;){if(f.push(l()),t(),v==="]")return o("]"),f;o(","),t()}}d("Bad array")},c=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]=l(),t(),v==="}")return o("}"),m;o(","),t()}}d("Bad object")};return l=function(){switch(t(),v){case"{":return c();case"[":return a();case'"':return e();case"-":return p();default:return v>="0"&&v<="9"?p():r()}},function(f,m){var y;return h=f,u=0,v=" ",y=l(),t(),v&&d("Syntax error"),typeof m=="function"?function D(E,b){var g,S,M=E[b];if(M&&typeof M=="object")for(g in M)Object.hasOwnProperty.call(M,g)&&(S=D(M,g),S!==void 0?M[g]=S:delete M[g]);return m.call(E,b,M)}({"":y},""):y}}),ace.define("ace/mode/json_worker",[],function(L,n,i){var u=L("../lib/oop"),v=L("../worker/mirror").Mirror,s=L("./json/json_parse"),h=n.JsonWorker=function(d){v.call(this,d),this.setTimeout(200)};u.inherits(h,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(h.prototype)});var Ma={exports:{}};(function(L,n){ace.define("ace/theme/clouds_midnight-css",["require","exports","module"],function(i,u,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 pt,R as k}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,u,v){u.isDark=!0,u.cssClass="ace-clouds-midnight",u.cssText=i("./clouds_midnight-css");var
|
|
1132
|
+
`}),ace.define("ace/theme/clouds_midnight",["require","exports","module","ace/theme/clouds_midnight-css","ace/lib/dom"],function(i,u,v){u.isDark=!0,u.cssClass="ace-clouds-midnight",u.cssText=i("./clouds_midnight-css");var s=i("../lib/dom");s.importCssString(u.cssText,u.cssClass,!1)}),function(){ace.require(["ace/theme/clouds_midnight"],function(i){L&&(L.exports=i)})}()})(Ma);var La={exports:{}};(function(L,n){ace.define("ace/theme/chrome-css",["require","exports","module"],function(i,u,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 pt,R as k}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,u,v){u.isDark=!1,u.cssClass="ace-chrome",u.cssText=i("./chrome-css");var
|
|
1291
|
-
`+M+"$1"):_},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:
|
|
1292
|
-
`:$=="t"?T=" ":"ulULE".indexOf($)!=-1&&(T={changeCase:$,local:$>"a"}),[T]}},{regex:"/\\w*}",onMatch:function(T,F,A){var $=A.shift();return $&&($.flag=T.slice(1,-1)),this.next=$&&$.tabstopId?"start":"",[$||T]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(T,F,A){return[{text:T.slice(1)}]}},{regex:/\${\w+/,onMatch:function(T,F,A){var $={text:T.slice(2)};return A.unshift($),[$]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(T,F,A){var $=A.shift();return this.next=$&&$.tabstopId?"start":"",[$||T]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(T,F,A){var $=A[0];return $.formatFunction=T.slice(2,-1),[A.shift()]},next:"formatString"},_,{regex:/:[\?\-+]?/,onMatch:function(T,F,A){T[1]=="+"&&(A[0].ifEnd=A[0]),T[1]=="?"&&(A[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]}),g.$tokenizer},g.prototype.tokenizeTmSnippet=function(S,M){return this.getTokenizer().getLineTokens(S,M).tokens.map(function(_){return _.value||_})},g.prototype.getVariableValue=function(S,M,_){if(/^\d+$/.test(M))return(this.variables.__||{})[M]||"";if(/^[A-Z]\d+$/.test(M))return(this.variables[M[0]+"__"]||{})[M.substr(1)]||"";if(M=M.replace(/^TM_/,""),!this.variables.hasOwnProperty(M))return"";var T=this.variables[M];return typeof T=="function"&&(T=this.variables[M](S,M,_)),T??""},g.prototype.tmStrFormat=function(S,M,_){if(!M.fmt)return S;var T=M.flag||"",F=M.guard;F=new RegExp(F,T.replace(/[^gim]/g,""));var A=typeof M.fmt=="string"?this.tokenizeTmSnippet(M.fmt,"formatString"):M.fmt,$=this,C=S.replace(F,function(){var w=$.variables.__;$.variables.__=[].slice.call(arguments);for(var x=$.resolveVariables(A,_),I="E",
|
|
1290
|
+
`}),ace.define("ace/theme/chrome",["require","exports","module","ace/theme/chrome-css","ace/lib/dom"],function(i,u,v){u.isDark=!1,u.cssClass="ace-chrome",u.cssText=i("./chrome-css");var s=i("../lib/dom");s.importCssString(u.cssText,u.cssClass,!1)}),function(){ace.require(["ace/theme/chrome"],function(i){L&&(L.exports=i)})}()})(La);var Ia={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,u,v){function s(g){var S=new Date().toLocaleString("en-us",g);return S.length==1?"0"+S:S}var h=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,l=i("./tokenizer").Tokenizer,a=i("./clipboard"),c={CURRENT_WORD:function(g){return g.session.getTextRange(g.session.getWordRange())},SELECTION:function(g,S,M){var _=g.session.getTextRange();return M?_.replace(/\n\r?([ \t]*\S)/g,`
|
|
1291
|
+
`+M+"$1"):_},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"})};c.SELECTED_TEXT=c.SELECTION;var f=function(){function g(){this.snippetMap={},this.snippetNameMap={},this.variables=c}return g.prototype.getTokenizer=function(){return g.$tokenizer||this.createTokenizer()},g.prototype.createTokenizer=function(){function S(T){return T=T.substr(1),/^\d+$/.test(T)?[{tabstopId:parseInt(T,10)}]:[{text:T}]}function M(T){return"(?:[^\\\\"+T+"]|\\\\.)"}var _={regex:"/("+M("/")+"+)/",onMatch:function(T,F,A){var $=A[0];return $.fmtString=!0,$.guard=T.slice(1,-1),$.flag="",""},next:"formatString"};return g.$tokenizer=new l({start:[{regex:/\\./,onMatch:function(T,F,A){var $=T[1];return($=="}"&&A.length||"`$\\".indexOf($)!=-1)&&(T=$),[T]}},{regex:/}/,onMatch:function(T,F,A){return[A.length?A.shift():T]}},{regex:/\$(?:\d+|\w+)/,onMatch:S},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(T,F,A){var $=S(T.substr(1));return A.unshift($[0]),$},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+M("\\|")+"*\\|",onMatch:function(T,F,A){var $=T.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"},_,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(T,F,A){return A.length&&A[0].expectElse?(A[0].expectElse=!1,A[0].ifEnd={elseEnd:A[0]},[A[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(T,F,A){var $=T[1];return $=="}"&&A.length||"`$\\".indexOf($)!=-1?T=$:$=="n"?T=`
|
|
1292
|
+
`:$=="t"?T=" ":"ulULE".indexOf($)!=-1&&(T={changeCase:$,local:$>"a"}),[T]}},{regex:"/\\w*}",onMatch:function(T,F,A){var $=A.shift();return $&&($.flag=T.slice(1,-1)),this.next=$&&$.tabstopId?"start":"",[$||T]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(T,F,A){return[{text:T.slice(1)}]}},{regex:/\${\w+/,onMatch:function(T,F,A){var $={text:T.slice(2)};return A.unshift($),[$]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(T,F,A){var $=A.shift();return this.next=$&&$.tabstopId?"start":"",[$||T]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(T,F,A){var $=A[0];return $.formatFunction=T.slice(2,-1),[A.shift()]},next:"formatString"},_,{regex:/:[\?\-+]?/,onMatch:function(T,F,A){T[1]=="+"&&(A[0].ifEnd=A[0]),T[1]=="?"&&(A[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]}),g.$tokenizer},g.prototype.tokenizeTmSnippet=function(S,M){return this.getTokenizer().getLineTokens(S,M).tokens.map(function(_){return _.value||_})},g.prototype.getVariableValue=function(S,M,_){if(/^\d+$/.test(M))return(this.variables.__||{})[M]||"";if(/^[A-Z]\d+$/.test(M))return(this.variables[M[0]+"__"]||{})[M.substr(1)]||"";if(M=M.replace(/^TM_/,""),!this.variables.hasOwnProperty(M))return"";var T=this.variables[M];return typeof T=="function"&&(T=this.variables[M](S,M,_)),T??""},g.prototype.tmStrFormat=function(S,M,_){if(!M.fmt)return S;var T=M.flag||"",F=M.guard;F=new RegExp(F,T.replace(/[^gim]/g,""));var A=typeof M.fmt=="string"?this.tokenizeTmSnippet(M.fmt,"formatString"):M.fmt,$=this,C=S.replace(F,function(){var w=$.variables.__;$.variables.__=[].slice.call(arguments);for(var x=$.resolveVariables(A,_),I="E",O=0;O<x.length;O++){var R=x[O];if(typeof R=="object")if(x[O]="",R.changeCase&&R.local){var P=x[O+1];P&&typeof P=="string"&&(R.changeCase=="u"?x[O]=P[0].toUpperCase():x[O]=P[0].toLowerCase(),x[O+1]=P.substr(1))}else R.changeCase&&(I=R.changeCase);else I=="U"?x[O]=R.toUpperCase():I=="L"&&(x[O]=R.toLowerCase())}return $.variables.__=w,x.join("")});return C},g.prototype.tmFormatFunction=function(S,M,_){return M.formatFunction=="upcase"?S.toUpperCase():M.formatFunction=="downcase"?S.toLowerCase():S},g.prototype.resolveVariables=function(S,M){function _(I){var O=S.indexOf(I,$+1);O!=-1&&($=O)}for(var T=[],F="",A=!0,$=0;$<S.length;$++){var C=S[$];if(typeof C=="string"){T.push(C),C==`
|
|
1293
1293
|
`?(A=!0,F=""):A&&(F=/^\t*/.exec(C)[0],A=/\S/.test(C));continue}if(C){if(A=!1,C.fmtString){var w=S.indexOf(C,$+1);w==-1&&(w=S.length),C.fmt=S.slice($+1,w),$=w}if(C.text){var x=this.getVariableValue(M,C.text,F)+"";C.fmtString&&(x=this.tmStrFormat(x,C,M)),C.formatFunction&&(x=this.tmFormatFunction(x,C,M)),x&&!C.ifEnd?(T.push(x),_(C)):!x&&C.ifEnd&&_(C.ifEnd)}else C.elseEnd?_(C.elseEnd):(C.tabstopId!=null||C.changeCase!=null)&&T.push(C)}}return T},g.prototype.getDisplayTextForSnippet=function(S,M){var _=m.call(this,S,M);return _.text},g.prototype.insertSnippetForSelection=function(S,M,_){_===void 0&&(_={});var T=m.call(this,S,M,_),F=S.getSelectionRange(),A=S.session.replace(F,T.text),$=new y(S),C=S.inVirtualSelectionMode&&S.selection.index;$.addTabstops(T.tabstops,F.start,A,C)},g.prototype.insertSnippet=function(S,M,_){_===void 0&&(_={});var T=this;if(S.inVirtualSelectionMode)return T.insertSnippetForSelection(S,M,_);S.forEachSelection(function(){T.insertSnippetForSelection(S,M,_)},null,{keepOrder:!0}),S.tabstopManager&&S.tabstopManager.tabNext()},g.prototype.$getScope=function(S){var M=S.session.$mode.$id||"";if(M=M.split("/").pop(),M==="html"||M==="php"){M==="php"&&!S.session.$mode.inlinePhp&&(M="html");var _=S.getCursorPosition(),T=S.session.getState(_.row);typeof T=="object"&&(T=T[0]),T.substring&&(T.substring(0,3)=="js-"?M="javascript":T.substring(0,4)=="css-"?M="css":T.substring(0,4)=="php-"&&(M="php"))}return M},g.prototype.getActiveScopes=function(S){var M=this.$getScope(S),_=[M],T=this.snippetMap;return T[M]&&T[M].includeScopes&&_.push.apply(_,T[M].includeScopes),_.push("_"),_},g.prototype.expandWithTab=function(S,M){var _=this,T=S.forEachSelection(function(){return _.expandSnippetForSelection(S,M)},null,{keepOrder:!0});return T&&S.tabstopManager&&S.tabstopManager.tabNext(),T},g.prototype.expandSnippetForSelection=function(S,M){var _=S.getCursorPosition(),T=S.session.getLine(_.row),F=T.substring(0,_.column),A=T.substr(_.column),$=this.snippetMap,C;return this.getActiveScopes(S).some(function(w){var x=$[w];return x&&(C=this.findMatchingSnippet(x,F,A)),!!C},this),C?(M&&M.dryRun||(S.session.doc.removeInLine(_.row,_.column-C.replaceBefore.length,_.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,M,_){for(var T=S.length;T--;){var F=S[T];if(!(F.startRe&&!F.startRe.test(M))&&!(F.endRe&&!F.endRe.test(_))&&!(!F.startRe&&!F.endRe))return F.matchBefore=F.startRe?F.startRe.exec(M):[""],F.matchAfter=F.endRe?F.endRe.exec(_):[""],F.replaceBefore=F.triggerRe?F.triggerRe.exec(M)[0]:"",F.replaceAfter=F.endTriggerRe?F.endTriggerRe.exec(_)[0]:"",F}},g.prototype.register=function(S,M){function _(w){return w&&!/^\^?\(.*\)\$?$|^\\b$/.test(w)&&(w="(?:"+w+")"),w||""}function T(w,x,I){return w=_(w),x=_(x),w=x+w,w&&w[w.length-1]!="$"&&(w+="$"),new RegExp(w)}function F(w){w.scope||(w.scope=M||"_"),M=w.scope,A[M]||(A[M]=[],$[M]={});var x=$[M];if(w.name){var I=x[w.name];I&&C.unregister(I),x[w.name]=w}A[M].push(w),w.prefix&&(w.tabTrigger=w.prefix),!w.content&&w.body&&(w.content=Array.isArray(w.body)?w.body.join(`
|
|
1294
|
-
`):w.body),w.tabTrigger&&!w.trigger&&(!w.guard&&/^\w/.test(w.tabTrigger)&&(w.guard="\\b"),w.trigger=p.escapeRegExp(w.tabTrigger)),!(!w.trigger&&!w.guard&&!w.endTrigger&&!w.endGuard)&&(w.startRe=T(w.trigger,w.guard),w.triggerRe=new RegExp(w.trigger),w.endRe=T(w.endTrigger,w.endGuard),w.endTriggerRe=new RegExp(w.endTrigger))}var A=this.snippetMap,$=this.snippetNameMap,C=this;S||(S=[]),Array.isArray(S)?S.forEach(F):Object.keys(S).forEach(function(w){F(S[w])}),this._signal("registerSnippets",{scope:M})},g.prototype.unregister=function(S,M){function _(A){var $=F[A.scope||M];if($&&$[A.name]){delete $[A.name];var C=T[A.scope||M],w=C&&C.indexOf(A);w>=0&&C.splice(w,1)}}var T=this.snippetMap,F=this.snippetNameMap;S.content?_(S):Array.isArray(S)&&S.forEach(_)},g.prototype.parseSnippetFile=function(S){S=S.replace(/\r/g,"");for(var M=[],_={},T=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm,F;F=T.exec(S);){if(F[1])try{_=JSON.parse(F[1]),M.push(_)}catch{}if(F[4])_.content=F[4].replace(/^\t/gm,""),M.push(_),_={};else{var A=F[2],$=F[3];if(A=="regex"){var C=/\/((?:[^\/\\]|\\.)*)|$/g;_.guard=C.exec($)[1],_.trigger=C.exec($)[1],_.endTrigger=C.exec($)[1],_.endGuard=C.exec($)[1]}else A=="snippet"?(_.tabTrigger=$.match(/^\S*/)[0],_.name||(_.name=$)):A&&(_[A]=$)}}return M},g.prototype.getSnippetByName=function(S,M){var _=this.snippetNameMap,T;return this.getActiveScopes(M).some(function(F){var A=_[F];return A&&(T=A[S]),!!T},this),T},g}();d.implement(f.prototype,
|
|
1295
|
-
`&&!M.excludeExtraIndent?G+$:typeof G=="string"?G.replace(/\t/g,A):G});var w=[];C.forEach(function(G,Y){if(typeof G=="object"){var Q=G.tabstopId,ee=w[Q];if(ee||(ee=w[Q]=[],ee.index=Q,ee.value="",ee.parents={}),ee.indexOf(G)===-1){G.choices&&!ee.choices&&(ee.choices=G.choices),ee.push(G);var ne=C.indexOf(G,Y+1);if(ne!==-1){var se=C.slice(Y+1,ne),ge=se.some(function(be){return typeof be=="object"});ge&&!ee.value?ee.value=se:se.length&&(!ee.value||typeof ee.value!="string")&&(ee.value=se.join(""))}}}}),w.forEach(function(G){G.length=0});for(var x={},I=0;I<C.length;I++){var
|
|
1296
|
-
`);Y.length>1?(H=Y[Y.length-1].length,W+=Y.length-1):H+=G.length,U+=G}else G&&(G.start?G.end={row:W,column:H}:G.start={row:W,column:H})}),{text:U,tabstops:w,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 M=S.action[0]=="r",_=this.selectedTabstop||{},T=_.parents||{},F=this.tabstops.slice(),A=0;A<F.length;A++){var $=F[A],C=$==_||T[$.index];if($.rangeList.$bias=C?0:1,S.action=="remove"&&$!==_){var w=$.parents&&$.parents[_.index],x=$.rangeList.pointIndex(S.start,w);x=x<0?-x-1:x+1;var I=$.rangeList.pointIndex(S.end,w);I=I<0?-I-1:I-1;for(var
|
|
1294
|
+
`):w.body),w.tabTrigger&&!w.trigger&&(!w.guard&&/^\w/.test(w.tabTrigger)&&(w.guard="\\b"),w.trigger=p.escapeRegExp(w.tabTrigger)),!(!w.trigger&&!w.guard&&!w.endTrigger&&!w.endGuard)&&(w.startRe=T(w.trigger,w.guard),w.triggerRe=new RegExp(w.trigger),w.endRe=T(w.endTrigger,w.endGuard),w.endTriggerRe=new RegExp(w.endTrigger))}var A=this.snippetMap,$=this.snippetNameMap,C=this;S||(S=[]),Array.isArray(S)?S.forEach(F):Object.keys(S).forEach(function(w){F(S[w])}),this._signal("registerSnippets",{scope:M})},g.prototype.unregister=function(S,M){function _(A){var $=F[A.scope||M];if($&&$[A.name]){delete $[A.name];var C=T[A.scope||M],w=C&&C.indexOf(A);w>=0&&C.splice(w,1)}}var T=this.snippetMap,F=this.snippetNameMap;S.content?_(S):Array.isArray(S)&&S.forEach(_)},g.prototype.parseSnippetFile=function(S){S=S.replace(/\r/g,"");for(var M=[],_={},T=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm,F;F=T.exec(S);){if(F[1])try{_=JSON.parse(F[1]),M.push(_)}catch{}if(F[4])_.content=F[4].replace(/^\t/gm,""),M.push(_),_={};else{var A=F[2],$=F[3];if(A=="regex"){var C=/\/((?:[^\/\\]|\\.)*)|$/g;_.guard=C.exec($)[1],_.trigger=C.exec($)[1],_.endTrigger=C.exec($)[1],_.endGuard=C.exec($)[1]}else A=="snippet"?(_.tabTrigger=$.match(/^\S*/)[0],_.name||(_.name=$)):A&&(_[A]=$)}}return M},g.prototype.getSnippetByName=function(S,M){var _=this.snippetNameMap,T;return this.getActiveScopes(M).some(function(F){var A=_[F];return A&&(T=A[S]),!!T},this),T},g}();d.implement(f.prototype,o);var m=function(g,S,M){function _(G){for(var Y=[],Q=0;Q<G.length;Q++){var ee=G[Q];if(typeof ee=="object"){if(x[ee.tabstopId])continue;var ne=G.lastIndexOf(ee,Q-1);ee=Y[ne]||{tabstopId:ee.tabstopId}}Y[Q]=ee}return Y}M===void 0&&(M={});var T=g.getCursorPosition(),F=g.session.getLine(T.row),A=g.session.getTabString(),$=F.match(/^\s*/)[0];T.column<$.length&&($=$.slice(0,T.column)),S=S.replace(/\r/g,"");var C=this.tokenizeTmSnippet(S);C=this.resolveVariables(C,g),C=C.map(function(G){return G==`
|
|
1295
|
+
`&&!M.excludeExtraIndent?G+$:typeof G=="string"?G.replace(/\t/g,A):G});var w=[];C.forEach(function(G,Y){if(typeof G=="object"){var Q=G.tabstopId,ee=w[Q];if(ee||(ee=w[Q]=[],ee.index=Q,ee.value="",ee.parents={}),ee.indexOf(G)===-1){G.choices&&!ee.choices&&(ee.choices=G.choices),ee.push(G);var ne=C.indexOf(G,Y+1);if(ne!==-1){var se=C.slice(Y+1,ne),ge=se.some(function(be){return typeof be=="object"});ge&&!ee.value?ee.value=se:se.length&&(!ee.value||typeof ee.value!="string")&&(ee.value=se.join(""))}}}}),w.forEach(function(G){G.length=0});for(var x={},I=0;I<C.length;I++){var O=C[I];if(typeof O=="object"){var R=O.tabstopId,P=w[R],B=C.indexOf(O,I+1);if(x[R]){x[R]===O&&(delete x[R],Object.keys(x).forEach(function(G){P.parents[G]=!0}));continue}x[R]=O;var V=P.value;typeof V!="string"?V=_(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,H=0,U="";return C.forEach(function(G){if(typeof G=="string"){var Y=G.split(`
|
|
1296
|
+
`);Y.length>1?(H=Y[Y.length-1].length,W+=Y.length-1):H+=G.length,U+=G}else G&&(G.start?G.end={row:W,column:H}:G.start={row:W,column:H})}),{text:U,tabstops:w,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 M=S.action[0]=="r",_=this.selectedTabstop||{},T=_.parents||{},F=this.tabstops.slice(),A=0;A<F.length;A++){var $=F[A],C=$==_||T[$.index];if($.rangeList.$bias=C?0:1,S.action=="remove"&&$!==_){var w=$.parents&&$.parents[_.index],x=$.rangeList.pointIndex(S.start,w);x=x<0?-x-1:x+1;var I=$.rangeList.pointIndex(S.end,w);I=I<0?-I-1:I-1;for(var O=$.rangeList.ranges.slice(x,I),R=0;R<O.length;R++)this.removeRange(O[R])}$.rangeList.$onChange(S)}var P=this.session;!this.$inChange&&M&&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 M=this.session,_=M.getTextRange(S.firstNonLinked),T=0;T<S.length;T++){var F=S[T];if(F.linked){var A=F.original,$=u.snippetManager.tmStrFormat(_,A,this.editor);M.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,M=this.editor.selection.anchor,_=this.editor.selection.isEmpty(),T=0;T<this.ranges.length;T++)if(!this.ranges[T].linked){var F=this.ranges[T].contains(S.row,S.column),A=_||this.ranges[T].contains(M.row,M.column);if(F&&A)return}this.detach()}},g.prototype.onChangeSession=function(){this.detach()},g.prototype.tabNext=function(S){var M=this.tabstops.length,_=this.index+(S||1);_=Math.min(Math.max(_,1),M),_==M&&(_=0),this.selectTabstop(_),this.updateTabstopMarkers(),_===0&&this.detach()},g.prototype.selectTabstop=function(S){this.$openTabstops=null;var M=this.tabstops[this.index];if(M&&this.addTabstopMarkers(M),this.index=S,M=this.tabstops[this.index],!(!M||!M.length)){this.selectedTabstop=M;var _=M.firstNonLinked||M;if(M.choices&&(_.cursor=_.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(_);else{var T=this.editor.multiSelect;T.toSingleRange(_);for(var F=0;F<M.length;F++)M.hasLinkedRanges&&M[F].linked||T.addRange(M[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,M,_){var T=this.useLink||!this.editor.getOption("enableMultiselect");if(this.$openTabstops||(this.$openTabstops=[]),!S[0]){var F=e.fromPoints(_,_);E(F.start,M),E(F.end,M),S[0]=[F],S[0].index=0}var A=this.index,$=[A+1,0],C=this.ranges,w=this.snippetId=(this.snippetId||0)+1;S.forEach(function(x,I){var O=this.$openTabstops[I]||x;O.snippetId=w;for(var R=0;R<x.length;R++){var P=x[R],B=e.fromPoints(P.start,P.end||P.start);D(B.start,M),D(B.end,M),B.original=P,B.tabstop=O,C.push(B),O!=x?O.unshift(B):O[R]=B,P.fmtString||O.firstNonLinked&&T?(B.linked=!0,O.hasLinkedRanges=!0):O.firstNonLinked||(O.firstNonLinked=B)}O.firstNonLinked||(O.hasLinkedRanges=!1),O===x&&($.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 M=this.session;S.forEach(function(_){_.markerId||(_.markerId=M.addMarker(_,"ace_snippet-marker","text"))})},g.prototype.removeTabstopMarkers=function(S){var M=this.session;S.forEach(function(_){M.removeMarker(_.markerId),_.markerId=null})},g.prototype.updateTabstopMarkers=function(){if(this.selectedTabstop){var S=this.selectedTabstop.snippetId;this.selectedTabstop.index===0&&S--,this.tabstops.forEach(function(M){M.snippetId===S?this.addTabstopMarkers(M):this.removeTabstopMarkers(M)},this)}},g.prototype.removeRange=function(S){var M=S.tabstop.indexOf(S);M!=-1&&S.tabstop.splice(M,1),M=this.ranges.indexOf(S),M!=-1&&this.ranges.splice(M,1),M=S.tabstop.rangeList.ranges.indexOf(S),M!=-1&&S.tabstop.splice(M,1),this.session.removeMarker(S.markerId),S.tabstop.length||(M=this.tabstops.indexOf(S.tabstop),M!=-1&&this.tabstops.splice(M,1),this.tabstops.length||this.detach())},g}();y.prototype.keyboardHandler=new r,y.prototype.keyboardHandler.bindKeys({Tab:function(g){u.snippetManager&&u.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 D=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};h.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),u.snippetManager=new f;var b=i("./editor").Editor;(function(){this.insertSnippet=function(g,S){return u.snippetManager.insertSnippet(this,g,S)},this.expandSnippet=function(g){return u.snippetManager.expandWithTab(this,g)}}).call(b.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,u,v){var
|
|
1304
|
-
`,C.length),-1),g.data=C||[],g.setRow(0)},g.getData=function(C){return g.data[C]},g.getRow=function(){return T.start.row},g.setRow=function(C){C=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,C)),T.start.row!=C&&(g.selection.clearSelection(),T.start.row=T.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,w,x,I){if(!I&&g.isOpen&&g.anchorPos&&g.anchor&&g.anchorPos.top===C.top&&g.anchorPos.left===C.left&&g.anchor===x)return!0;var
|
|
1303
|
+
}`,"snippets.css",!1),u.snippetManager=new f;var b=i("./editor").Editor;(function(){this.insertSnippet=function(g,S){return u.snippetManager.insertSnippet(this,g,S)},this.expandSnippet=function(g){return u.snippetManager.expandWithTab(this,g)}}).call(b.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,u,v){var s=i("../virtual_renderer").VirtualRenderer,h=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"),l=function(D){return"suggest-aria-id:".concat(D)},a=r.isSafari?"menu":"listbox",c=r.isSafari?"menuitem":"option",f=r.isSafari?"aria-current":"aria-selected",m=function(D){var E=new s(D);E.$maxLines=4;var b=new h(E);return b.setHighlightActiveLine(!1),b.setShowPrintMargin(!1),b.renderer.setShowGutter(!1),b.renderer.setHighlightGutterLine(!1),b.$mouseHandler.$focusTimeout=0,b.$highlightTagPending=!0,b},y=function(){function D(E){var b=e.createElement("div"),g=m(b);E&&E.appendChild(b),b.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 w=C.getDocumentPosition();g.selection.moveToPosition(w),T.start.row=T.end.row=w.row,C.stop()});var M,_=new d(-1,0,-1,1/0),T=new d(-1,0,-1,1/0);T.id=g.session.addMarker(T,"ace_active-line","fullLine"),g.setSelectOnHover=function(C){C?_.id&&(g.session.removeMarker(_.id),_.id=null):_.id=g.session.addMarker(_,"ace_line-hover","fullLine")},g.setSelectOnHover(!1),g.on("mousemove",function(C){if(!M){M=C;return}if(!(M.x==C.x&&M.y==C.y)){M=C,M.scrollTop=g.renderer.scrollTop,g.isMouseOver=!0;var w=M.getDocumentPosition().row;_.start.row!=w&&(_.id||g.setRow(w),A(w))}}),g.renderer.on("beforeRender",function(){if(M&&_.start.row!=-1){M.$pos=null;var C=M.getDocumentPosition().row;_.id||g.setRow(C),A(C,!0)}}),g.renderer.on("afterRender",function(){for(var C=g.renderer.$textLayer,w=C.config.firstRow,x=C.config.lastRow;w<=x;w++){var I=C.element.childNodes[w-C.config.firstRow];I.setAttribute("role",c),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",w+1);var O=g.getData(w);if(O){var R="".concat(O.caption||O.value).concat(O.meta?", ".concat(O.meta):"");I.setAttribute("aria-label",R)}var P=I.querySelectorAll(".ace_completion-highlight");P.forEach(function(B){B.setAttribute("role","mark")})}}),g.renderer.on("afterRender",function(){var C=g.getRow(),w=g.renderer.$textLayer,x=w.element.childNodes[C-w.config.firstRow],I=document.activeElement;if(x!==g.selectedNode&&g.selectedNode&&(e.removeCssClass(g.selectedNode,"ace_selected"),g.selectedNode.removeAttribute(f),g.selectedNode.removeAttribute("id")),I.removeAttribute("aria-activedescendant"),g.selectedNode=x,x){var O=l(C);e.addCssClass(x,"ace_selected"),x.id=O,w.element.setAttribute("aria-activedescendant",O),I.setAttribute("aria-activedescendant",O),x.setAttribute(f,"true")}});var F=function(){A(-1)},A=function(C,w){C!==_.start.row&&(_.start.row=_.end.row=C,w||g.session._emit("changeBackMarker"),g._emit("changeHoverMarker"))};g.getHoveredRow=function(){return _.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 w=g.data[C];return typeof w=="string"?w:w&&w.value||""};var $=g.session.bgTokenizer;return $.$tokenizeRow=function(C){function w(G,Y){G&&I.push({type:(x.className||"")+(Y||""),value:G})}var x=g.data[C],I=[];if(!x)return I;typeof x=="string"&&(x={value:x});for(var O=x.caption||x.value||x.name,R=O.toLowerCase(),P=(g.filterText||"").toLowerCase(),B=0,V=0,W=0;W<=P.length;W++)if(W!=V&&(x.matchMask&1<<W||W==P.length)){var H=P.slice(V,W);V=W;var U=R.indexOf(H,B);if(U==-1)continue;w(O.slice(B,U),""),B=U+H.length,w(O.slice(U,B),"completion-highlight")}return w(O.slice(B,O.length),""),I.push({type:"completion-spacer",value:" "}),x.meta&&I.push({type:"completion-meta",value:x.meta}),x.message&&I.push({type:"completion-message",value:x.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,w){g.filterText=w||"",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 T.start.row},g.setRow=function(C){C=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,C)),T.start.row!=C&&(g.selection.clearSelection(),T.start.row=T.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,w,x,I){if(!I&&g.isOpen&&g.anchorPos&&g.anchor&&g.anchorPos.top===C.top&&g.anchorPos.left===C.left&&g.anchor===x)return!0;var O=this.container,R=this.renderer.scrollBar.width||10,P=window.innerHeight-R,B=window.innerWidth-R,V=this.renderer,W=V.$maxLines*w*1.4,H={top:0,bottom:0},U=P-C.top-3*this.$borderSize-w,G=C.top-3*this.$borderSize;x||(G<=U||U>=W?x="bottom":x="top"),x==="top"?(H.bottom=C.top-this.$borderSize,H.top=H.bottom-W):x==="bottom"&&(H.top=C.top+w+this.$borderSize,H.bottom=H.top+W);var Y=H.top>=0&&H.bottom<=P;if(!I&&!Y)return!1;Y?V.$maxPixelHeight=null:x==="top"?V.$maxPixelHeight=G:V.$maxPixelHeight=U,x==="top"?(O.style.top="",O.style.bottom=P+R-H.bottom+"px",g.isTopdown=!1):(O.style.top=H.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"),M=null),g.anchorPos=C,g.anchor=x,!0},g.show=function(C,w,x){this.tryShow(C,w,x?"bottom":void 0,!0)},g.goTo=function(C){var w=this.getRow(),x=this.session.getLength()-1;switch(C){case"up":w=w<=0?x:w-1;break;case"down":w=w>=x?-1:w+1;break;case"start":w=0;break;case"end":w=x}this.setRow(w)},g.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},g.$imageSize=0,g.$borderSize=1,g}return D}();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 pt,R as k}from"./ConfigCustomJavascriptSet__loadShare__react__loadSh
|
|
|
1393
1393
|
animation: none;
|
|
1394
1394
|
}
|
|
1395
1395
|
}
|
|
1396
|
-
`,"autocompletion.css",!1),u.AcePopup=y,u.$singleLineEditor=m,u.getAriaId=l}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(i,u,v){var o=function(){function h(d){this.editor=d,this.screenReaderDiv=document.createElement("div"),this.screenReaderDiv.classList.add("ace_screenreader-only"),this.editor.container.appendChild(this.screenReaderDiv)}return h.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 ",l=0;l<this._lines.length;l++)r+="ace-inline-screenreader-line-".concat(l," ");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 s=this.createCodeBlock();this.screenReaderDiv.appendChild(s)},h.prototype.destroy=function(){this.screenReaderDiv.remove()},h.prototype.createCodeBlock=function(){var d=document.createElement("pre");d.setAttribute("id","ace-inline-screenreader");for(var s=0;s<this._lines.length;s++){var p=document.createElement("code");p.setAttribute("id","ace-inline-screenreader-line-".concat(s));var e=document.createTextNode(this._lines[s]);p.appendChild(e),d.appendChild(p)}return d},h}();u.AceInlineScreenReader=o}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(i,u,v){var o=i("../snippets").snippetManager,h=i("./inline_screenreader").AceInlineScreenReader,d=function(){function s(){this.editor=null}return s.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 h(p));var r=e.snippet?o.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)},s.prototype.isOpen=function(){return this.editor?!!this.editor.renderer.$ghostText:!1},s.prototype.hide=function(){return this.editor?(this.editor.removeGhostText(),!0):!1},s.prototype.destroy=function(){this.hide(),this.editor=null,this.inlineScreenReader&&(this.inlineScreenReader.destroy(),this.inlineScreenReader=null)},s}();u.AceInline=d}),ace.define("ace/autocomplete/util",["require","exports","module"],function(i,u,v){u.parForEach=function(h,d,s){var p=0,e=h.length;e===0&&s();for(var t=0;t<e;t++)d(h[t],function(r,l){p++,p===e&&s(r,l)})};var o=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;u.retrievePrecedingIdentifier=function(h,d,s){s=s||o;for(var p=[],e=d-1;e>=0&&s.test(h[e]);e--)p.push(h[e]);return p.reverse().join("")},u.retrieveFollowingIdentifier=function(h,d,s){s=s||o;for(var p=[],e=d;e<h.length&&s.test(h[e]);e++)p.push(h[e]);return p},u.getCompletionPrefix=function(h){var d=h.getCursorPosition(),s=h.session.getLine(d.row),p;return h.completers.forEach(function(e){e.identifierRegexps&&e.identifierRegexps.forEach(function(t){!p&&t&&(p=this.retrievePrecedingIdentifier(s,d.column,t))}.bind(this))}.bind(this)),p||this.retrievePrecedingIdentifier(s,d.column)},u.triggerAutocomplete=function(h,s){var s=s??h.session.getPrecedingCharacter();return h.completers.some(function(p){if(p.triggerCharacters&&Array.isArray(p.triggerCharacters))return p.triggerCharacters.includes(s)})}}),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,u,v){var o=i("./keyboard/hash_handler").HashHandler,h=i("./autocomplete/popup").AcePopup,d=i("./autocomplete/inline").AceInline,s=i("./autocomplete/popup").getAriaId,p=i("./autocomplete/util"),e=i("./lib/lang"),t=i("./lib/dom"),r=i("./snippets").snippetManager,l=i("./config"),a=i("./lib/event"),c=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 o,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 D(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:l.nls("autocomplete.loading","Loading..."),value:""}]},enumerable:!1,configurable:!0}),E.prototype.$init=function(){return this.popup=new h(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,M=this.editor.getCursorPosition().column,_=this.editor.session.getLine(g).slice(S,M);this.inlineRenderer.show(this.editor,b,_)?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,M=g.$cursorLayer.getPixelPosition(this.base,!0);M.left-=this.popup.getTextLeftOffset();var _=b.container.getBoundingClientRect();M.top+=_.top-g.layerConfig.offset,M.left+=_.left-b.renderer.scrollLeft,M.left+=g.gutterWidth;var T={top:M.top,left:M.left};g.$ghostText&&g.$ghostTextWidget&&this.base.row===g.$ghostText.position.row&&(T.top+=g.$ghostTextWidget.el.offsetHeight);var F=b.container.getBoundingClientRect().bottom-S,A=F<T.top?{top:F,left:T.left}:T;this.popup.tryShow(A,S,"bottom")||this.popup.tryShow(M,S,"top")||this.popup.show(M,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 M=this.popup.getRow(),_=this.popup.data[M];this.popup.setData(this.completions.filtered,this.completions.filterText),this.editor.textInput.setAriaOptions&&this.editor.textInput.setAriaOptions({activeDescendant:s(this.popup.getRow()),inline:this.inlineEnabled}),b.keyBinding.addKeyboardHandler(this.keyboardHandler);var T;this.stickySelection&&(T=this.popup.data.indexOf(_)),(!T||T===-1)&&(T=0),this.popup.setRow(this.autoSelect?T:-1),T===M&&_!==this.completions.filtered[T]&&this.$onPopupChange();var F=this.inlineRenderer&&this.inlineEnabled;if(T===M&&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(),M=b.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(b.relatedTarget),_=this.popup&&this.popup.container;g!=S&&g.parentNode!=_&&!M&&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,M=this.getCompletionProvider().insertMatch(this.editor,b,S.filterText,g);return this.completions==S&&this.detach(),M},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 M=this.editor.getCursorPosition(),_=this.editor.session.getTextRange({start:this.base,end:M});if(_==this.completions.filterText)return;if(this.completions.setFilter(_),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==_&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,_,b);return}if(g&&g.matches){var M=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(M.row,M.column),this.base.$insertRight=!0,this.completions=new D(g.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",b)}var S=this.editor.getSession(),M=this.editor.getCursorPosition(),_=p.getCompletionPrefix(this.editor);this.base=S.doc.createAnchor(M.row,M.column-_.length),this.base.$insertRight=!0;var T={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:_,pos:M}).provideCompletions(this.editor,T,function(F,A,$){var C=A.filtered,w=p.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),$){if(!C.length){var x=!this.autoShown&&this.emptyMessage;if(typeof x=="function"&&(x=this.emptyMessage(w)),x){var I=[{caption:x,value:""}];this.completions=new D(I),this.openPopup(this.editor,w,b),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==w&&!C[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&C.length==1)return this.insertMatch(C[0])}this.completions=!$&&this.showLoadingState?new D(E.completionsForLoading.concat(C),A.filterText):A,this.openPopup(this.editor,w,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()]),M=null;if(!S||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var _=this.editor.completers.length,T=0;T<_;T++){var F=this.editor.completers[T];if(F.getDocTooltip&&S.completerId===F.id){M=F.getDocTooltip(S);break}}if(!M&&typeof S!="string"&&(M=S),typeof M=="string"&&(M={docText:M}),!M||!M.docHTML&&!M.docText)return this.hideDocTooltip();this.showDocTooltip(M)},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",c));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 M=this.popup,_=M.container.getBoundingClientRect(),T=400,F=300,A=M.renderer.scrollBar.width||10,$=_.left,C=window.innerWidth-_.right-A,w=M.isTopdown?_.top:window.innerHeight-A-_.bottom,x=[Math.min(C/T,1),Math.min($/T,1),Math.min(w/F*.9)],I=Math.max.apply(Math,x),R=S.style;R.display="block",I==x[0]?(R.left=_.right+1+"px",R.right="",R.maxWidth=T*I+"px",R.top=_.top+"px",R.bottom="",R.maxHeight=Math.min(window.innerHeight-A-_.top,F)+"px"):I==x[1]?(R.right=window.innerWidth-_.left+"px",R.left="",R.maxWidth=T*I+"px",R.top=_.top+"px",R.bottom="",R.maxHeight=Math.min(window.innerHeight-A-_.top,F)+"px"):I==x[2]&&(R.left=window.innerWidth-_.left+"px",R.maxWidth=Math.min(T,window.innerWidth)+"px",M.isTopdown?(R.top=_.bottom+"px",R.left=_.left+"px",R.right="",R.bottom="",R.maxHeight=Math.min(window.innerHeight-A-_.bottom,F)+"px"):(R.top=M.container.offsetTop-S.offsetHeight+"px",R.left=_.left+"px",R.right="",R.bottom="",R.maxHeight=Math.min(M.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),l.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 M=this.completions.filterText.length,_=0;if(g.range&&g.range.start.row===g.range.end.row&&(M-=this.initialPosition.prefix.length,M+=this.initialPosition.pos.column-g.range.start.column,_+=g.range.end.column-this.initialPosition.pos.column),M||_){var T;b.selection.getAllRanges?T=b.selection.getAllRanges():T=[b.getSelectionRange()];for(var F=0,A;A=T[F];F++)A.start.column-=M,A.end.column+=_,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(),M=b.getCursorPosition(),_=p.getCompletionPrefix(b),T=[];this.completers=b.completers;var F=b.completers.length;return b.completers.forEach(function(A,$){A.getCompletions(b,S,M,_,function(C,w){A.hideInlinePreview&&(w=w.map(function(x){return Object.assign(x,{hideInlinePreview:A.hideInlinePreview})})),!C&&w&&(T=T.concat(w)),g(null,{prefix:p.getCompletionPrefix(b),matches:T,finished:--F===0})})}),!0},E.prototype.provideCompletions=function(b,g,S){var M=function(A){var $=A.prefix,C=A.matches;this.completions=new D(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),_=!0,T=null;if(this.gatherCompletions(b,function(A,$){if(this.active){A&&(S(A,[],!0),this.detach());var C=$.prefix;if(C.indexOf($.prefix)===0){if(_){T=$;return}M($)}}}.bind(this)),_=!1,T){var F=T;T=null,M(F)}},E.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(b){typeof b.cancel=="function"&&b.cancel()})},E}(),D=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(M,_){return _.exactMatch-M.exactMatch||_.$score-M.$score||(M.caption||M.value).localeCompare(_.caption||_.value)});var S=null;g=g.filter(function(M){var _=M.snippet||M.caption||M.value;return _===S?!1:(S=_,!0)}),this.filtered=g},E.prototype.filterCompletions=function(b,g){var S=[],M=g.toUpperCase(),_=g.toLowerCase();e:for(var T=0,F;F=b[T];T++){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,w=0,x,I;if(this.exactMatch){if(g!==A.substr(0,g.length))continue e}else{var R=A.toLowerCase().indexOf(_);if(R>-1)w=R;else for(var O=0;O<g.length;O++){var P=A.indexOf(_[O],$+1),B=A.indexOf(M[O],$+1);if(x=P>=0&&(B<0||P<B)?P:B,x<0)continue e;I=x-$-1,I>0&&($===-1&&(w+=10),w+=I,C|=1<<O),$=x}}F.matchMask=C,F.exactMatch=w?0:1,F.$score=(F.score||0)-w,S.push(F)}}return S},E}();u.Autocomplete=m,u.CompletionProvider=y,u.FilteredList=D}),ace.define("ace/marker_group",["require","exports","module"],function(i,u,v){var o=function(){function h(d,s){s&&(this.markerType=s.markerType),this.markers=[],this.session=d,d.addDynamicMarker(this)}return h.prototype.getMarkerAtPosition=function(d){return this.markers.find(function(s){return s.range.contains(d.row,d.column)})},h.prototype.markersComparator=function(d,s){return d.range.start.row-s.range.start.row},h.prototype.setMarkers=function(d){this.markers=d.sort(this.markersComparator).slice(0,this.MAX_MARKERS),this.session._signal("changeBackMarker")},h.prototype.update=function(d,s,p,e){if(!(!this.markers||!this.markers.length))for(var t=e.firstRow,r=e.lastRow,l,a=0,c=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===c?a++:(c=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 D=y.toScreenRange(p);if(D.isEmpty()){l=p.getNextFoldLine(y.end.row,l),l&&l.end.row>y.end.row&&(t=l.end.row);continue}this.markerType==="fullLine"?s.drawFullLineMarker(d,D,m.className,e):D.isMultiLine()?this.markerType==="line"?s.drawMultiLineMarker(d,D,m.className,e):s.drawTextMarker(d,D,m.className,e):s.drawSingleLineMarker(d,D,m.className+" ace_br15",e)}}}},h}();o.prototype.MAX_MARKERS=1e4,u.MarkerGroup=o}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(i,u,v){function o(p,e){var t=p.getTextRange(d.fromPoints({row:0,column:0},e));return t.split(s).length-1}function h(p,e){var t=o(p,e),r=p.getValue().split(s),l=Object.create(null),a=r[t];return r.forEach(function(c,f){if(!(!c||c===a)){var m=Math.abs(t-f),y=r.length-m;l[c]?l[c]=Math.max(y,l[c]):l[c]=y}}),l}var d=i("../range").Range,s=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;u.getCompletions=function(p,e,t,r,l){var a=h(e,t),c=Object.keys(a);l(null,c.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,u,v){var o=i("../snippets").snippetManager,h=i("../autocomplete").Autocomplete,d=i("../config"),s=i("../lib/lang"),p=i("../autocomplete/util"),e=i("../marker_group").MarkerGroup,t=i("../autocomplete/text_completer"),r={getCompletions:function(_,T,F,A,$){if(T.$mode.completer)return T.$mode.completer.getCompletions(_,T,F,A,$);var C=_.session.getState(F.row),w=T.$mode.getCompletions(C,T,F,A);w=w.map(function(x){return x.completerId=r.id,x}),$(null,w)},id:"keywordCompleter"},l=function(_){var T={};return _.replace(/\${(\d+)(:(.*?))?}/g,function(F,A,$,C){return T[A]=C||""}).replace(/\$(\d+?)/g,function(F,A){return T[A]})},a={getCompletions:function(_,T,F,A,$){var C=[],w=T.getTokenAt(F.row,F.column);w&&w.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?C.push("html-tag"):C=o.getActiveScopes(_);var x=o.snippetMap,I=[];C.forEach(function(R){for(var O=x[R]||[],P=O.length;P--;){var B=O[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(_){_.snippet&&!_.docHTML&&(_.docHTML=["<b>",s.escapeHTML(_.caption),"</b>","<hr></hr>",s.escapeHTML(l(_.snippet))].join(""))},id:"snippetCompleter"},c=[a,t,r];u.setCompleters=function(_){c.length=0,_&&c.push.apply(c,_)},u.addCompleter=function(_){c.push(_)},u.textCompleter=t,u.keyWordCompleter=r,u.snippetCompleter=a;var f={name:"expandSnippet",exec:function(_){return o.expandWithTab(_)},bindKey:"Tab"},m=function(_,T){y(T.session.$mode)},y=function(_){typeof _=="string"&&(_=d.$modes[_]),_&&(o.files||(o.files={}),D(_.$id,_.snippetFileId),_.modes&&_.modes.forEach(y))},D=function(_,T){!T||!_||o.files[_]||(o.files[_]={},d.loadModule(T,function(F){F&&(o.files[_]=F,!F.snippets&&F.snippetText&&(F.snippets=o.parseSnippetFile(F.snippetText)),o.register(F.snippets||[],F.scope),F.includeScopes&&(o.snippetMap[F.scope].includeScopes=F.includeScopes,F.includeScopes.forEach(function(A){y("ace/mode/"+A)})))}))},E=function(_){var T=_.editor,F=T.completer&&T.completer.activated;if(_.command.name==="backspace")F&&!p.getCompletionPrefix(T)&&T.completer.detach();else if(_.command.name==="insertstring"&&!F){b=_;var A=_.editor.$liveAutocompletionDelay;A?g.delay(A):S(_)}},b,g=s.delayedCall(function(){S(b)},0),S=function(_){var T=_.editor,F=p.getCompletionPrefix(T),A=_.args,$=p.triggerAutocomplete(T,A);if(F&&F.length>=T.$liveAutocompletionThreshold||$){var C=h.for(T);C.autoShown=!0,C.showPopup(T)}},M=i("../editor").Editor;i("../config").defineOptions(M.prototype,"editor",{enableBasicAutocompletion:{set:function(_){_?(h.for(this),this.completers||(this.completers=Array.isArray(_)?_:c),this.commands.addCommand(h.startCommand)):this.commands.removeCommand(h.startCommand)},value:!1},enableLiveAutocompletion:{set:function(_){_?(this.completers||(this.completers=Array.isArray(_)?_:c),this.commands.on("afterExec",E)):this.commands.off("afterExec",E)},value:!1},liveAutocompletionDelay:{initialValue:0},liveAutocompletionThreshold:{initialValue:0},enableSnippets:{set:function(_){_?(this.commands.addCommand(f),this.on("changeMode",m),m(null,this)):(this.commands.removeCommand(f),this.off("changeMode",m))},value:!1}}),u.MarkerGroup=e}),function(){ace.require(["ace/ext/language_tools"],function(i){L&&(L.exports=i)})}()})(La);const Ai={jsonError:{border:"1px solid red",minHeight:200},jsonNoError:{border:"1px solid #00000000",minHeight:200}};function Ia(L){return k.createElement(xa,{style:L.error===!0?Ai.jsonError:L.error===!1?Ai.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 Rn={flex:{display:"flex"},button:{height:48,minWidth:48},wrapper:{width:"calc(100vw - 40px)",height:"calc(100vh - 188px)"}};class Fa extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,u=K.getValue(n,i)||"{}";this.setState({value:u,initialized:!0,jsonError:this.validateJson(u)})}validateJson(n){let i=!1;if(this.props.schema.validateJson!==!1&&(n||!this.props.schema.allowEmpty))try{this.props.schema.json5?ji.parse(n):JSON.parse(n)}catch(u){console.log("Error in JSON",u),i=!0}return i}renderItem(n,i){if(!this.state.initialized)return null;const{schema:u,data:v,attr:o}=this.props,{value:h,showSelectId:d}=this.state;return k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},k.createElement("div",{style:Rn.flex},k.createElement(N.Button,{color:"grey",disabled:i,style:Rn.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},j.I18n.t("ra_JSON editor"))),d?k.createElement(ao,{title:this.getText(u.label),overflowHidden:!0,applyDisabled:this.state.jsonError&&this.props.schema.doNotApplyWithError,onClose:()=>this.setState({showSelectId:!1,value:K.getValue(v,o)||{}}),onApply:()=>this.setState({showSelectId:!1},()=>this.onChange(o,h))},k.createElement("div",{style:{...Rn.wrapper,border:this.state.jsonError?"2px solid red":"2px solid transparent"}},k.createElement(Ia,{mode:this.props.schema.json5?"json5":"json",value:typeof h=="object"?JSON.stringify(h):h,onChange:s=>this.setState({value:s,jsonError:this.validateJson(s)}),name:"ConfigJsonEditor",themeType:this.props.oContext.themeType}))):null,u.help||this.state.jsonError?k.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 Oa 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,o;if(!this.state.selectOptions)return null;const u=(v=this.state.selectOptions)==null?void 0:v.find(h=>h.value===this.state.value||!h.value&&!this.state.value);return k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,disabled:i,value:this.state.value||"_",renderValue:()=>this.getText(u==null?void 0:u.label,this.props.schema.noTranslation),onChange:h=>{let{value:d}=h.target;d==="_"&&(d=""),this.setState({value:d},()=>{const s=this.onChange(this.props.attr,d);if(s instanceof Promise&&s.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}`))})}},(o=this.state.selectOptions)==null?void 0:o.map(h=>k.createElement(N.MenuItem,{key:h.value,value:h.value},h.label))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class Na extends K{scrollRef;constructor(n){super(n),this.scrollRef=k.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?k.createElement(N.Dialog,{maxWidth:"lg",open:!0,onClose:(u,v)=>{v!=="escapeKeyDown"&&v!=="backdropClick"&&this.setState({showLicenseDialog:!1})}},k.createElement(N.DialogTitle,null,this.props.schema.title?j.I18n.t(this.props.schema.title):j.I18n.t("ra_License agreement")),k.createElement(N.DialogContent,null,this.props.schema.licenseUrl?k.createElement(k.Fragment,null,this.state.loading?k.createElement(N.LinearProgress,null):null,k.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?k.createElement("div",{ref:this.scrollRef,style:{width:"100%",height:"100%",overflowY:"auto",fontSize:14}},this.props.schema.texts.map((u,v)=>this.props.schema.noTranslation?k.createElement("p",{key:v},u):k.createElement("p",{key:v},j.I18n.t(u)))):null),k.createElement(N.DialogActions,null,this.props.schema.checkBox?k.createElement(N.FormControlLabel,{control:k.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,k.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 u=this.onChange(this.props.attr,!0);u instanceof Promise&&u.catch(v=>console.error(`Cannot set value: ${v}`))},color:"primary",variant:"contained",startIcon:k.createElement(Z.Check,null)},this.props.schema.agreeText?j.I18n.t(this.props.schema.agreeText):j.I18n.t("ra_Accept license")),k.createElement(N.Button,{onClick:()=>{this.setState({showLicenseDialog:!1}),setTimeout(()=>this.setState({showLicenseDialog:!0}),2e3)},color:"grey",variant:"contained",startIcon:k.createElement(Z.Close,null)},j.I18n.t("ra_Close")))):null}}const xi={indeterminate:{opacity:.5},control:{flexDirection:"row",width:"100%"}};class Ba 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 u=K.getValue(n.data,n.attr);return n.oContext.multiEdit&&i._value===K.DIFFERENT_VALUE?{_value:K.DIFFERENT_VALUE}:u==null||i.oldValue===null||i.oldValue===void 0||u.toString()!==parseFloat(i._value).toString()&&u.toString()!==i.oldValue.toString()?{_value:u}: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 u=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),u){const v=K.getValue(this.props.data,this.props.attr),o=(v==null?void 0:v.filter(h=>h||h===0).map(h=>({label:h.toString(),value:h})))||[];return o.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),k.createElement(N.Autocomplete,{style:xi.indeterminate,fullWidth:!0,freeSolo:!0,value:o[0],getOptionSelected:(h,d)=>h.label===d.label,onChange:(h,d)=>{const s=this.onChange(this.props.attr,d==null?void 0:d.value,()=>{this.setState({_value:d==null?void 0:d.value,oldValue:this.state._value})});s instanceof Promise&&s.catch(p=>console.error(p))},options:o,getOptionLabel:h=>h.label,renderInput:h=>k.createElement(N.TextField,{...h,label:this.getText(this.props.schema.label),variant:"standard",slotProps:{htmlInput:{...h.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))),k.createElement(N.FormControl,{variant:"standard",style:xi.control},k.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 o=v.target.value,h=this.checkValue(o);h?this.onError(this.props.attr,j.I18n.t(h)):this.onError(this.props.attr),this.setState({_value:o,oldValue:this.state._value},()=>this.onChange(this.props.attr,parseFloat(o.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 Pa 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 u=JSON.parse(i.val);if(new Date(u.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(u=>console.log(`Error occurred: ${u.toString()}`)))}catch(i){console.warn(i)}}onMessage=n=>{var i,u,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 o=(n.data||n.message).split(":");o[1]==="success"?(this.setState({accessTokens:o[2],success:!0,pressed:!1},()=>this.saveToken(this.state.accessTokens)),(i=this.authWindow)==null||i.postMessage("close",n.origin),this.authWindow=null):(v=(u=this.props).onError)==null||v.call(u,o[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 u=this.getIcon();return k.createElement("div",{style:{width:"100%",margin:"0 0 1rem 0"}},k.createElement(N.Button,{disabled:this.state.running,endIcon:u||k.createElement(Z.CloudUpload,null),variant:"contained",onClick:()=>this.onOpenUrl()},i),this.state.blocked?k.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?k.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?k.createElement(k.Fragment,null,k.createElement("div",{style:{width:"100%",margin:"1rem 0 1rem 0"}},k.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")}`,":"),k.createElement("br",null),k.createElement("a",{target:this.props.schema.identifier,href:this.url,rel:"noreferrer"},this.url)),k.createElement(N.TextField,{value:this.state.accessTokens,label:j.I18n.t("ra_Enter the code from that page here"),variant:"standard",onChange:v=>{let o=v.target.value;o&&!o.startsWith("{")&&(o=atob(o));try{const h=JSON.parse(o);h.access_token&&(h.access_token_expires_on=new Date(Date.now()+(h.expires_in-10)*1e3).toISOString(),this.setState({accessTokens:JSON.stringify(h)},()=>this.saveToken(this.state.accessTokens)))}catch{}},fullWidth:!0})):null)}}const $i={flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class Wa extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,u=K.getValue(n,i)||"";this.setState({value:u,initialized:!0})}renderItem(n,i){if(!this.state.initialized)return null;const u=this.props.oContext.socket,{schema:v,attr:o}=this.props,{value:h,showSelectId:d}=this.state;return k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},v.label?k.createElement(N.InputLabel,{shrink:!0},this.getText(v.label)):null,k.createElement("div",{style:$i.flex},k.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:h,error:!!n,disabled:i,placeholder:this.getText(v.placeholder),label:this.getText(v.label),helperText:this.renderHelp(v.help,v.helpLink,v.noTranslation),onChange:s=>{const p=s.target.value;this.setState({value:p},()=>this.onChange(o,p))}}),k.createElement(N.Button,{color:"grey",disabled:i,style:$i.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},"...")),d?k.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:u,selected:h,root:v.root,onClose:()=>this.setState({showSelectId:!1}),onOk:s=>this.setState({showSelectId:!1,value:s},()=>this.onChange(o,s))}):null)}}const On={fullWidth:{width:"100%",display:"inline-block"},halfWidth1:{width:"calc(50% - 5px)",display:"inline-block",marginRight:8},halfWidth2:{width:"calc(50% - 5px)",display:"inline-block"}},an="____ppp____";class Ha extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({_repeat:n?an:"",_visible:!1,value:n?an:"",_notEqual:!1})}onChangePassword(n,i){n===void 0&&(n=this.state.value),i===void 0&&(i=this.state._repeat);const u=!!this.props.schema.repeat&&i!==n;this.setState({value:n,_repeat:i,_notEqual:u},()=>{if(u)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(o=>this.onError(this.props.attr,o))}})}renderItem(n,i){if(this.state._notEqual===void 0)return null;const u=k.createElement(N.TextField,{variant:"standard",fullWidth:!0,type:this.state._visible&&this.state.value!==an?"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!==an&&this.props.schema.visible&&!i&&!this.props.schema.readOnly?k.createElement(N.InputAdornment,{position:"end"},k.createElement(N.IconButton,{size:"large",tabIndex:-1,onClick:v=>{v.preventDefault(),v.stopPropagation(),this.setState({_visible:!this.state._visible})},edge:"end"},this.state._visible?k.createElement(Z.VisibilityOff,null):k.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:k.createElement(N.TextField,{variant:"standard",fullWidth:!0,type:"password",value:this.state._repeat,error:!!n||this.state._notEqual,disabled:!!i,onChange:o=>this.onChangePassword(void 0,o.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 k.createElement("div",{style:On.fullWidth},k.createElement("div",{style:On.halfWidth1},u),k.createElement("div",{style:On.halfWidth2},v))}return u}}class za extends K{renderItem(n,i){return k.createElement(N.TextField,{variant:"standard",fullWidth:!0,disabled:!!i,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?k.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"))}},k.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 ja={warning:{"& .Mui-error":{color:"orange"}}};class Va 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(),u=`system.adapter.${this.props.oContext.adapterName}.${this.props.oContext.instance}`,v=await this.props.oContext.socket.getObject(u),o=v==null?void 0:v.common.host,h=[];i.forEach(d=>{var p,e,t,r;if(!d||d._id===u||d.common.host!==o||!((p=d.native)!=null&&p.bind))return;if(d!=null&&d.native&&d.native.secure&&d.native.leEnabled&&d.native.leUpdate){const l=parseInt(d.native.leCheckPort||d.native.lePort,10);l&&h.push({name:`${d._id.replace("system.adapter.","")} (LE)`,port:l,v6bind:d.native.bind.includes(":")?d.native.bind:d.native.v6bind,bind:d.native.bind,enabled:!!((e=d.common)!=null&&e.enabled)})}const s=parseInt((t=d==null?void 0:d.native)==null?void 0:t.port,10);s&&h.push({name:d._id.replace("system.adapter.",""),bind:d.native.bind,v6bind:d.native.bind.includes(":")?d.native.bind:d.native.v6bind,port:s,enabled:!!((r=d.common)!=null&&r.enabled)})}),this.setState({ports:h})}static getDerivedStateFromProps(n,i){const u=K.getValue(n.data,n.attr);return u==null||i.oldValue===null||i.oldValue===void 0||u.toString()!==parseInt(i._value,10).toString()&&u.toString()!==i.oldValue.toString()?{_value:u}:null}checkValue(n){if(n==null)return null;const i=this.props.schema.min===void 0?20:this.props.schema.min,u=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>u?"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 u=this.props.schema.min===void 0?20:this.props.schema.min,v=this.props.schema.max||65535;let o;if(this.state.ports){const h=parseInt(this.state._value,10);if(h){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 s=d.findIndex(p=>p.port===h&&p.enabled);s!==-1?n=j.I18n.t("ra_Port is already used by %s",this.state.ports[s].name):(s=d.findIndex(p=>p.port===h&&!p.enabled),s!==-1&&(o=!0,n=j.I18n.t("ra_Port could be used by %s",this.state.ports[s].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))),k.createElement(N.TextField,{variant:"standard",type:"number",fullWidth:!0,slotProps:{htmlInput:{min:u,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:o?ja.warning:void 0,onChange:h=>{const d=Number(h.target.value.toString().replace(/[^0-9]/g,"")).toString(),s=this.checkValue(d);s?this.onError(this.props.attr,j.I18n.t(s)):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 Ua extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.props.oContext.socket.getEnums("rooms").then(i=>{const u=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&&u.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({value:n,selectOptions:u})}).catch(i=>console.error(`Cannot get enums: ${i}`))}renderItem(n,i){if(!this.state.selectOptions)return null;const u=this.state.selectOptions.find(v=>v.value===this.state.value);return k.createElement(N.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:this.state.value||"_",renderValue:()=>u?u.obj?k.createElement(j.TextWithIcon,{value:u.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):u.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=>k.createElement(N.MenuItem,{key:v.value,value:v.value,style:v.value===K.DIFFERENT_VALUE?{opacity:.5}:{}},v.obj?k.createElement(j.TextWithIcon,{value:v.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):v.label))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ga={noMargin:{"&>div":{marginTop:0}}};class Ka 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(u=>{const v=u;Array.isArray(v.items)?(i.push({label:this.getText(u.label,this.props.schema.noTranslation),value:u.value,group:!0}),v.items.forEach(o=>i.push({label:this.getText(o.label,this.props.schema.noTranslation),value:o.value,hidden:o.hidden}))):i.push({label:this.getText(u.label,this.props.schema.noTranslation),value:u.value,hidden:u.hidden})}),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 u=(this.state.selectOptions||[]).filter(h=>h.hidden?this.props.custom?!this.executeCustom(h.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(h.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),v=this._getValue(),o=this.props.schema.multiple?null:u.find(h=>h.value==v);return k.createElement(N.FormControl,{variant:"standard",fullWidth:!0,sx:this.props.table!==void 0&&Ga.noMargin,id:`jsonSelect_${this.props.attr}_${this.props.index||this.props.index===0?this.props.index:""}`},this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,multiple:this.props.schema.multiple,disabled:!!i,value:v||"_",renderValue:h=>this.props.schema.multiple?k.createElement(N.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.5}},h.map(d=>{const s=u.find(p=>p.value===d);if(s||this.props.schema.showAllValues!==!1){const p=(s==null?void 0:s.label)||d;return k.createElement(N.Chip,{key:d,label:p})}return null})):(o==null?void 0:o.label)===void 0?h:o.label,onChange:h=>{this.setState({value:h.target.value==="_"?"":h.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(s=>console.error(s))})}},u.map((h,d)=>h.group?k.createElement(N.ListSubheader,{key:d},h.label):k.createElement(N.MenuItem,{key:d,value:h.value,style:h.value===K.DIFFERENT_VALUE?{opacity:.5}:{}},this.props.schema.multiple?k.createElement(N.Checkbox,{checked:v.includes(h.value),onClick:()=>{const s=JSON.parse(JSON.stringify(this._getValue())),p=v.indexOf(h.value);p!==-1?s.splice(p,1):(s.push(h.value),s.sort()),this.setState({value:s},()=>this.onChange(this.props.attr,s))}}):null,k.createElement(N.ListItemText,{primary:h.label})))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ja={menuPaper:{maxHeight:800}};class Ya 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 h;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 u=this._getValue();if(!this.props.alive||!this.state.running&&!((h=this.state.list)!=null&&h.length))return this.props.schema.multiple||this.props.schema.manual===!1?j.I18n.t("ra_Cannot retrieve options, as instance is offline"):k.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:u,error:!!n,disabled:!!i,onChange:d=>{const s=d.target.value;this.setState({value:s},()=>this.onChange(this.props.attr,(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),slotProps:{input:{endAdornment:this.state.value&&!this.props.schema.noClearButton?k.createElement(N.InputAdornment,{position:"end"},k.createElement(N.IconButton,{tabIndex:-1,size:"small",onClick:()=>this.setState({value:""},()=>this.onChange(this.props.attr,""))},k.createElement(Z.Close,null))):null}}});if(this.state.running)return k.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),o=v.find(d=>d.value===u);return k.createElement(N.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,multiple:this.props.schema.multiple,disabled:!!i,sx:{"&.MuiSelect-paper":this.props.schema.multiple?Ja.menuPaper:void 0},value:u,renderValue:d=>this.props.schema.multiple?k.createElement(N.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.5}},d.map(s=>{const p=v.find(e=>e.value===s);if(p||this.props.schema.showAllValues!==!1){const e=(p==null?void 0:p.label)||s;return k.createElement(N.Chip,{key:s,label:e})}return null})):this.getText((o==null?void 0:o.label)||d,this.props.schema.noTranslation),onChange:d=>{const s=this.onChange(this.props.attr,d.target.value);s instanceof Promise&&s.catch(p=>console.error(`Cannot set value: ${p}`))}},v.map((d,s)=>d.group?k.createElement(N.ListSubheader,{key:s},this.getText(d.label,this.props.schema.noTranslation)):k.createElement(N.MenuItem,{key:s,value:d.value},this.props.schema.multiple?k.createElement(N.Checkbox,{checked:u.includes(d.value),onClick:()=>{const p=JSON.parse(JSON.stringify(this._getValue())),e=u.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,k.createElement(N.ListItemText,{primary:d.label})))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ti={fullWidth:{width:"100%"}};function ut(L){return L.split(".").reduce((n,i)=>(n<<8)+parseInt(i,10),0)>>>0}function Qa(L,n){var v,o;const i=(o=(v=L==null?void 0:L.native)==null?void 0:v.hardware)==null?void 0:o.networkInterfaces;if(!i)return null;let u;return Object.keys(i).forEach(h=>i[h].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]/))?u=d.address:u||(d.family==="IPv4"&&n.includes(".")&&(ut(n)&ut(d.netmask),ut(d.address)&ut(d.netmask)),u=d.address))})),u||Object.keys(i).forEach(h=>i[h].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]/))?u=d.address:u||(d.family==="IPv4"&&n.includes(".")&&(ut(n)&ut(d.netmask),ut(d.address)&ut(d.netmask)),u=d.address))})),u||Object.keys(i).forEach(h=>{i[h].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]/),u=d.address)})}),u||Object.keys(i).forEach(h=>{i[h].forEach(d=>{d.internal||(u=d.address)})}),u}class _i extends K{async componentDidMount(){var i;super.componentDidMount();let n=window.location.hostname;if(this.props.schema.openUrl){const u=await this.props.oContext.socket.getCurrentInstance(),v=await this.props.oContext.socket.getObject(`system.adapter.${u}`);if(v){const o=await this.props.oContext.socket.getObject(`system.host.${(i=v==null?void 0:v.common)==null?void 0:i.host}`);if(o){const h=Qa(o,window.location.hostname);if(h)n=`${h}:${window.location.port}`;else{console.warn(`Cannot find suitable IP in host ${v.common.host} for ${v._id}`);return}}}}await new Promise(u=>{this.setState({_error:"",_message:"",hostname:n},u)}),this.props.schema.onLoaded&&this._onClick()}renderErrorDialog(){return this.state._error?k.createElement(j.DialogError,{text:this.state._error,onClose:()=>this.setState({_error:""})}):null}renderMessageDialog(){return this.state._message?k.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 u=this.props.schema.data;if(u===void 0&&this.props.schema.jsonData){const o=this.getPattern(this.props.schema.jsonData,{_origin:n,_originIp:i,...this.props.data},!0);try{u=JSON.parse(o)}catch{console.error(`Cannot parse json data: ${o}`)}}u===void 0&&(u=null),this.props.schema.openUrl&&!u&&(u={_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",u).then(async o=>{if(v&&(clearTimeout(v),v=void 0),o!=null&&o.error)if(this.props.schema.error&&this.props.schema.error[o.error]){let h=this.getText(this.props.schema.error[o.error]);o.args&&o.args.forEach(d=>h=h.replace("%s",d)),this.setState({_error:h})}else this.setState({_error:o.error?j.I18n.t(o.error):j.I18n.t("ra_Error")});else{if(o!=null&&o.command){this.props.oContext.onBackEndCommand&&this.props.oContext.onBackEndCommand(o.command);return}if(o!=null&&o.reloadBrowser&&this.props.schema.reloadBrowser)window.location.reload();else if(o!=null&&o.openUrl&&this.props.schema.openUrl)window.open(o.openUrl,o.window||this.props.schema.window||"_blank");else if(o!=null&&o.result&&this.props.schema.result&&this.props.schema.result[o.result]){let h=this.getText(this.props.schema.result[o.result]);o.args&&o.args.forEach(d=>h=h.replace("%s",d)),window.alert(h)}if(o!=null&&o.native&&this.props.schema.useNative){for(const[h,d]of Object.entries(o.native))await this.onChangeAsync(h,d);setTimeout(()=>this.props.oContext.forceUpdate(Object.keys(o.native),this.props.data),300)}else o!=null&&o.result?window.alert(typeof o.result=="object"?JSON.stringify(o.result):o.result):window.alert(j.I18n.t("ra_Ok"));o!=null&&o.saveConfig&&this.props.onChange(null,null,null,!0)}}).catch(o=>{this.props.schema.error&&this.props.schema.error[o.toString()]?this.setState({_error:this.getText(this.props.schema.error[o.toString()])}):this.setState({_error:j.I18n.t(o.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=k.createElement(Z.Warning,null):n.type==="error"?i=k.createElement(Z.Error,null):n.type==="info"&&(i=k.createElement(Z.Info,null)),k.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:u=>this.setState({confirmDialog:!1},()=>u&&this._onClick())})}renderItem(n,i){const u=this.getIcon();return k.createElement("div",{style:Ti.fullWidth},k.createElement(N.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:{...Ti.fullWidth,...this.props.schema.controlStyle||void 0},disabled:i||!this.props.alive,startIcon:u,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?k.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 Za extends K{async _onClick(){var u,v;let n=this.props.schema.val;if(typeof n=="string"&&n.includes("${")){n=this.getPattern(n,null,!0);const o=await this.props.oContext.socket.getObject(this.props.schema.id);((u=o==null?void 0:o.common)==null?void 0:u.type)==="number"?n=parseFloat(n):((v=o==null?void 0:o.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(o){this.props.schema.error&&this.props.schema.error[o.toString()]?window.alert(this.getText(this.props.schema.error[o.toString()])):window.alert(j.I18n.t(o.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=k.createElement(Z.Warning,null):n.type==="error"?i=k.createElement(Z.Error,null):n.type==="info"&&(i=k.createElement(Z.Info,null)),k.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:u=>this.setState({confirmDialog:!1},()=>u&&this._onClick())})}renderItem(n,i){const u=this.getIcon();return k.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:u||void 0},this.getText(this.props.schema.label,this.props.schema.noTranslation))}}const ki={fullWidth:{width:"100%"},slider:{marginLeft:10,marginRight:10,width:"calc(100% - 20px)"}};class qa 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 u=K.getValue(n.data,n.attr);return u==null||u.toString()!==parseFloat(i._value).toString()?{_value:u}:null}renderItem(n,i){const u=this.props.schema.min||0,v=this.props.schema.max||100,o=this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):"",h=[{value:u,label:u+o},{value:v,label:v+o}];return k.createElement(N.Box,{style:ki.fullWidth},this.props.schema.label?k.createElement(N.Typography,{gutterBottom:!0},this.getText(this.props.schema.label)):null,k.createElement(N.Slider,{style:ki.slider,value:this.state._value,getAriaValueText:d=>d+o,step:this.props.schema.step||(v-u)/100,valueLabelDisplay:"auto",marks:h,min:u,max:v,disabled:!!i,onChange:d=>{const s=d.target.value;this.setState({_value:s},()=>this.onChange(this.props.attr,s))}}),this.props.schema.help?k.createElement(N.Typography,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}function ht(L,n){return L==="edit"||L==="rename"?k.createElement(Z.Edit,{style:n}):L==="delete"?k.createElement(Z.Delete,{style:n}):L==="refresh"?k.createElement(Z.Refresh,{style:n}):L==="newDevice"||L==="new"||L==="add"?k.createElement(Z.Add,{style:n}):L==="discover"||L==="search"?k.createElement(Z.Search,{style:n}):L==="unpairDevice"||L==="unpair"?k.createElement(Z.LinkOff,{style:n}):L==="pairDevice"||L==="pair"?k.createElement(Z.Link,{style:n}):L==="identify"?k.createElement(Z.NotListedLocation,{style:n}):L==="play"?k.createElement(Z.PlayArrow,{style:n}):L==="stop"?k.createElement(Z.Stop,{style:n}):L==="pause"?k.createElement(Z.Pause,{style:n}):L==="forward"||L==="next"?k.createElement(Z.FastForward,{style:n}):L==="rewind"||L==="previous"?k.createElement(Z.FastRewind,{style:n}):L==="lamp"||L==="light"?k.createElement(Z.Lightbulb,{style:n}):L==="backlight"?k.createElement(Z.Fluorescent,{style:n}):L==="dimmer"?k.createElement(Z.WbIncandescent,{style:n}):L==="socket"?k.createElement(Z.Power,{style:n}):L==="settings"?k.createElement(Z.Settings,{style:n}):L==="users"||L==="group"?k.createElement(Z.Group,{style:n}):L==="user"?k.createElement(Z.Person,{style:n}):L==="qrcode"?k.createElement(Z.QrCode,{style:n}):L==="connection"?k.createElement(Z.Wifi,{style:n}):L==="no-connection"?k.createElement(Z.WifiOff,{style:n}):L==="visible"?k.createElement(Z.Visibility,{style:n}):null}function el(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 tl 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(){super.componentDidMount();const n=await this.props.oContext.socket.getObject(this.getObjectID()),i=this.props.schema.control||this.detectType(n);try{const u=await this.props.oContext.socket.getState(this.getObjectID());this.setState({stateValue:u?u.val:null,controlType:i,obj:n},async()=>{await this.props.oContext.socket.subscribeState(this.getObjectID(),this.onStateChanged)})}catch(u){console.error(`Cannot get state ${this.getObjectID()}: ${u}`),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 u=i?i.val:null;this.state.controlType==="button"||this.state.controlType==="switch"?(u=!!u,this.state.stateValue!==u&&this.setState({stateValue:u})):u!==null&&(this.state.controlType==="slider"||this.state.controlType==="number")?(u=parseFloat(u),console.log(`${Date.now()} Received new value: ${u}`),u!==this.state.stateValue?(this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null),this.delayedUpdate.value=u,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()!==u.toString()&&this.setState({stateValue:u})};detectType(n){if(n=n||{},n.common=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.max!==void 0?"slider":"input":"text":n.common.write&&this.props.schema.controlled!==!1?"input":"text"}renderItem(n,i){var v,o,h,d,s;if(!this.state.obj)return null;let u;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=ht(this.props.schema.falseImage));const e=this.getText(this.props.schema.falseText||this.props.schema.label,this.props.schema.noTranslation);!e&&p?u=k.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):u=k.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")u=k.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:8,alignItems:"baseline"}},k.createElement(N.TextField,{style:{flex:1},value:this.state.stateValue,variant:"standard",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,await this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!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&&k.createElement(N.Button,{variant:"outlined",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=el(this.props.oContext.theme,this.props.schema.blinkOnUpdate));let l;this.props.schema.labelIcon&&(l=k.createElement(j.Icon,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let a;if(e&&l?a=k.createElement("div",{style:{whiteSpace:"nowrap"}},l,e):e?a=k.createElement("div",{style:{whiteSpace:"nowrap"}},e):l&&(a=l),this.state.controlType==="switch"||!this.state.controlType&&this.state.obj.common.type==="boolean"&&(this.state.obj.common.write&&this.state.obj.common.read!==!1||(o=this.state.obj.common.role)!=null&&o.includes("switch"))){let c=null;const f=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(c=ht(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=ht(this.props.schema.trueImage,y?{marginRight:8}:void 0)),u=k.createElement(N.Switch,{checked:!!this.state.stateValue,disabled:!!this.props.schema.readOnly,onChange:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async D=>{D&&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||c||y||m)&&(u=k.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:14}},k.createElement("span",{style:this.props.schema.falseTextStyle},f,c),u,k.createElement("span",{style:this.props.schema.trueTextStyle},m,y))),a&&(u=k.createElement("div",{style:t},a,u))}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==="%")||(h=this.state.obj.common.role)!=null&&h.includes("slider")||(d=this.state.obj.common.role)!=null&&d.includes("dimmer")||(s=this.state.obj.common.role)!=null&&s.includes("blind"))){let c=null;const f=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(c=ht(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=ht(this.props.schema.trueImage,y?{marginRight:8}:void 0));const D=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;u=k.createElement(N.Slider,{style:{width:"100%",flexGrow:1},min:D,max:E,disabled:!!this.props.schema.readOnly,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||c||y||m)&&(u=k.createElement("div",{style:{display:"flex",width:"100%",flexGrow:1,alignItems:"center"}},k.createElement("span",{style:{marginRight:16,...this.props.schema.falseTextStyle}},f,c),u,k.createElement("span",{style:{marginLeft:16,...this.props.schema.trueTextStyle}},m,y))),a&&(u=k.createElement("div",{style:t},a,u))}else if(this.state.obj.common.type==="number"&&this.state.obj.common.write){const c=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;u=k.createElement(N.TextField,{variant:"standard",style:{width:"100%"},value:this.state.stateValue,type:"number",slotProps:{htmlInput:{min:c,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 D=parseFloat(this.state.stateValue);await this.props.oContext.socket.setState(this.getObjectID(),D,!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 c=null,f,m;this.state.stateValue?(f=this.getText(this.props.schema.trueText,this.props.schema.noTranslation),this.props.schema.trueImage&&(c=ht(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&&(c=ht(this.props.schema.falseImage,f?{marginLeft:8}:void 0)),m=this.props.schema.falseTextStyle),m=Object.assign(t,m),u=k.createElement("div",{style:m},a,k.createElement(N.Box,{style:{display:"flex",alignItems:"center",gap:8},sx:r,key:this.props.schema.blinkOnUpdate?f:void 0},c,f||(this.state.stateValue?j.I18n.t("ra_true"):j.I18n.t("ra_false"))))}else{const c=this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit;let f,m;this.state.controlType==="html"?(m=(this.state.stateValue||"").toString(),f=k.createElement("span",{dangerouslySetInnerHTML:{__html:this.state.stateValue}})):this.state.stateValue===null?(f="null",m=f):this.state.stateValue===void 0?(f="undefined",m=f):(f=this.state.stateValue.toString(),m=f),u=k.createElement("div",{style:t},a,k.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:4}},k.createElement(N.Box,{sx:r,key:this.props.schema.blinkOnUpdate?m:void 0},f),c?k.createElement("span",{style:{opacity:.7,fontSize:"smaller"}},c):null))}}return u}}const Nn={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 nl extends K{renderItem(){return k.createElement(N.Box,{component:"hr",sx:j.Utils.getStyle(this.props.oContext.theme,Nn.fullWidth,this.props.schema.color==="primary"?Nn.primary:this.props.schema.color==="secondary"?Nn.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 il={header:L=>({width:"100%",background:L.palette.primary.main,color:L.palette.primary.contrastText,padding:"4px !important",borderRadius:"3px",marginBlockEnd:0,marginBlockStart:0})};class rl 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 k.createElement(N.Box,{component:n,sx:il.header},this.getText(this.props.schema.label||this.props.schema.text,this.props.schema.noTranslation))}}class sl 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}`),k.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 Mi(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 Li(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 Mt={label:{fontWeight:"bold",whiteSpace:"nowrap"},valueImage:{maxHeight:"100%"},valueAndUnit:{display:"flex",gap:4,alignItems:"baseline"},value:{},unit:{fontSize:"smaller",opacity:.7}};class ol 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 u;this.props.schema.size==="normal"?u=16:this.props.schema.size==="large"?u=20:typeof this.props.schema.size=="number"&&(u=this.props.schema.size);const v={width:"100%",height:"100%",display:"flex",alignItems:"center",position:"relative",fontSize:u};this.props.schema.narrow?v.gap=8:v.justifyContent="space-between";let o,h;this.props.schema.data&&typeof this.props.schema.data=="object"&&this.props.schema.data.en?h=this.getText(this.props.schema.data):typeof this.props.schema.data=="object"||this.props.schema.data===void 0||this.props.schema.data===null?h=JSON.stringify(this.props.schema.data):typeof this.props.schema.data=="number"?(h=this.props.schema.data.toString(),this.props.oContext.isFloatComma&&(h=h.replace(".",","))):(!this.props.schema.booleanAsCheckbox||typeof this.props.schema.data!="boolean")&&(h=this.props.schema.data.toString());let d=!1;if(this.props.schema.booleanAsCheckbox&&typeof this.props.schema.data=="boolean")o=k.createElement(N.Checkbox,{checked:!!o,disabled:!0,size:this.props.schema.size==="small"?"small":this.props.schema.size==="large"?"large":void 0});else if(h.startsWith("data:image/"))o=k.createElement("div",{style:{...Mt.value,...Mt.valueImage,...this.props.schema.styleValue||void 0}},k.createElement(j.Icon,{src:h}));else{const t={...Mt.value,...this.props.schema.styleValue||void 0};this.props.schema.html?o=k.createElement("div",{style:t,dangerouslySetInnerHTML:{__html:h}}):Array.isArray(this.props.schema.data)?(d=!0,o=k.createElement("div",{style:t},this.props.schema.data.map((r,l)=>k.createElement("div",{key:l},typeof r=="object"||r===null||r===void 0?JSON.stringify(r):r)))):h.includes(`
|
|
1397
|
-
`)?(d=!0,o=k.createElement("div",{style:t},j.Utils.renderTextWithA(h))):o=k.createElement("div",{style:t},h)}if(this.props.schema.blinkOnUpdate&&this.props.schema.blink){const t=Mi(this.props.oContext.theme,!0,this.props.schema.blinkOnUpdate),r=Li(this.props.oContext.theme,this.props.schema.blink);o=k.createElement(N.Box,{key:h,sx:{...t,...r}},o)}else if(this.props.schema.blinkOnUpdate){const t=Mi(this.props.oContext.theme,!1,this.props.schema.blinkOnUpdate);o=k.createElement(N.Box,{key:h,sx:t},o)}else if(this.props.schema.blink){const t=Li(this.props.oContext.theme,this.props.schema.blink);o=k.createElement(N.Box,{sx:t},o)}this.props.schema.unit&&(o=k.createElement("div",{style:Mt.valueAndUnit},o,k.createElement("div",{style:{...Mt.unit,...this.props.schema.styleUnit||void 0}},this.getText(this.props.schema.unit,this.props.schema.noTranslation))));let s;this.props.schema.labelIcon&&(s=k.createElement(j.Icon,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let p;this.props.schema.copyToClipboard&&(p=k.createElement(Z.ContentCopy,{className:"staticCopyButton",style:{position:"absolute",top:"calc(50% - 12px)",right:0,cursor:"pointer"},onClick:()=>{j.Utils.copyToClipboard(h),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"),k.createElement(N.Box,{component:"div",style:v,sx:e},k.createElement("div",{style:{...Mt.label,...this.props.schema.styleLabel||void 0}},s,i),o,p)}}const Ii={fullWidth:{height:"100%",width:"100%"},link:L=>({textDecoration:"underline",color:L.palette.mode==="dark"?"#4dabf5":"#254e72",cursor:"pointer"})};function Fi(L,n,i){let u,v="";L?L.toString().startsWith("#")||L.toString().startsWith("/")?(u=n||"_self",v=L):L.startsWith("http://")||L.startsWith("https://")?(u=n||"_blank",v=L):(v=`#tab-instances/config/${i}/${L}`,u=n||"_self"):(v=`#tab-instances/config/${i}`,u=n||"_self"),u==="_self"?setTimeout(o=>{o.startsWith("#")?window.location.hash=o:o.startsWith("/")?v=`${window.location.protocol}:${window.location.host}${v}`:(o.startsWith("http://")||o.startsWith("https://"))&&(window.location.href=o)},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,u))}class Ri extends K{renderItem(n,i){if(this.props.schema.button){const v=this.getIcon();return k.createElement(N.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:{...Ii.fullWidth,...this.props.schema.controlStyle||void 0},disabled:i,startIcon:v,onClick:this.props.schema.href?()=>{const o=this.props.schema.href?this.getText(this.props.schema.href,!0):null;o&&(this.props.oContext.onBackEndCommand?this.props.oContext.onBackEndCommand({command:"link",url:o,target:this.props.schema.target,close:this.props.schema.close}):Fi(o,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 u=this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation);return u&&(u.includes("<a ")||u.includes("<br")||u.includes("<b>")||u.includes("<i>"))&&(u=j.Utils.renderTextWithA(u)),k.createElement(N.Box,{component:"span",style:{...this.props.schema.controlStyle||void 0},sx:this.props.schema.href?Ii.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}):Fi(v,this.props.schema.target||"_blank",`${this.props.oContext.adapterName}.${this.props.oContext.instance}`))}:null},u)}}const Bn=1024*1024,fe={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 al(L,n,i){n=n||"key";const u=[];return Object.keys(L).forEach(v=>{const o={};o[n]=v,i?(o[i]=L[v],u.push(o)):u.push(Object.assign(o,L[v]))}),u}function Oi(L,n,i){n=n||"key";const u={};return L.forEach(v=>{let o=v[n];o==null&&(o=""),delete v[n],i?u[o]=v[i]:u[o]=v}),u}function ll(L,n){let i="";for(let u=0;u<n.length;u++)i+=String.fromCharCode(L[u%L.length].charCodeAt(0)^n.charCodeAt(u));return i}function ul(L,n){let i="";for(let u=0;u<n.length;u++)i+=String.fromCharCode(L[u%L.length].charCodeAt(0)^n.charCodeAt(u));return i}class Ve 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]=pt.createRef())}),this.refDiv=k.createRef()}async componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr)||[];let i;if(this.props.schema.objKeyName?i=al(n,this.props.schema.objKeyName,this.props.schema.objValueName):i=n,Array.isArray(i)||(i=[]),this.props.schema.encryptedAttributes){const u=await this.props.oContext.socket.getCompactSystemConfig();this.secret=(u==null?void 0:u.native.secret)||this.secret,n.forEach(v=>{this.props.schema.encryptedAttributes.forEach(o=>{v[o]&&(v[o]=ul(this.secret,v[o]))})})}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,u){var d;const{schema:v}=this.props,o=(d=v.items)==null?void 0:d.find(s=>s.attr===n);if(!o)return null;const h={items:{[n]:o}};return k.createElement($t,{oContext:this.props.oContext,alive:this.props.alive,arrayIndex:u,changed:this.props.changed,common:this.props.common,expertMode:this.props.expertMode,custom:!0,data:i,globalData:this.props.data,index:u+this.state.iteration,onChange:(s,p)=>{const e=JSON.parse(JSON.stringify(this.state.value));e[u][s]=p,this.setState({value:e},()=>{this.validateUniqueProps(),this.onChangeWrapper(e,!0)})},onError:(s,p)=>this.onError(s,p),originalData:this.props.originalData,schema:h,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 o=v[n];return i.includes(o)?(this.onError(n,"is not unique"),this.setState({errorMessage:j.I18n.t('Non-allowed duplicate entry "%s" in column "%s"',o,n)}),!0):(i.push(o),!1)})||(this.onError(n,null),this.setState({errorMessage:""}))}}static descendingComparator(n,i,u){return i[u]<n[u]?-1:i[u]>n[u]?1:0}static getComparator(n,i){return n==="desc"?(u,v)=>Ve.descendingComparator(u,v,i):(u,v)=>-Ve.descendingComparator(u,v,i)}static getFilterValue(n){var i,u,v;return(v=(u=(i=n==null?void 0:n.current)==null?void 0:i.children[0])==null?void 0:u.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:u,orderBy:v}=this.state,h=i?u:v===n&&u==="asc"?"desc":"asc",d=this.stableSort(h,n);JSON.stringify(d)!==JSON.stringify(this.state.value)&&this.setState({value:d,order:h,orderBy:n,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,d))};stableSort=(n,i)=>{const{value:u}=this.state,v=Ve.getComparator(n,i),o=u.map((h,d)=>({el:h,index:d}));return o.sort((h,d)=>{const s=v(h.el,d.el);return s!==0?s:h.index-d.index}),o.map(h=>h.el)};renderShowHideFilter(n){return n.filter?k.createElement(N.IconButton,{title:j.I18n.t("ra_Show/hide filter input"),size:"small",onClick:()=>{const i=[...this.state.filterOn],u=this.state.filterOn.indexOf(n.attr);u===-1?i.push(n.attr):i.splice(u,1),this.setState({filterOn:i},()=>{u&&Ve.getFilterValue(this.filterRefs[n.attr])&&(Ve.setFilterValue(this.filterRefs[n.attr],""),this.applyFilter())})}},this.state.filterOn.includes(n.attr)?k.createElement(Z.FilterAltOff,null):k.createElement(Z.FilterAlt,null)):null}renderImportExportButtons(n){return k.createElement(k.Fragment,null,!n.noDelete&&n.import?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Import data from %s file","CSV"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:()=>this.setState({showImportDialog:!0})},k.createElement(Z.UploadFile,null))):null,n.export?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Export data to %s file","CSV"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:()=>this.onExport()},k.createElement(Z.Download,null))):null,n.noDelete?null:k.createElement(N.IconButton,{disabled:!0,size:"small"},k.createElement(Z.Delete,null)))}renderAddButton(n){return k.createElement(N.Tooltip,{title:n?j.I18n.t("ra_Cannot add items with set filter"):j.I18n.t("ra_Add row"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement("span",null,k.createElement(N.IconButton,{size:"small",color:"primary",disabled:!!n&&!this.props.schema.allowAddByFilter,onClick:this.onAdd},k.createElement(Z.Add,null))))}enhancedTableHead(n,i){var h;const{schema:u}=this.props,{order:v,orderBy:o}=this.state;return k.createElement(N.TableHead,null,k.createElement(N.TableRow,null,(h=u.items)==null?void 0:h.map((d,s)=>this.renderOneFilter({schema:u,style:{width:d.width},showAddButton:!s&&!u.noDelete,headCell:d,order:v,orderBy:o,index:s,doAnyFilterSet:i})),!u.noDelete&&k.createElement(N.TableCell,{style:{paddingLeft:20,paddingRight:20,width:n,textAlign:"right"},padding:"checkbox"},this.renderImportExportButtons(u))))}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 s=[];n.items.forEach(p=>{var e;(e=d[p.attr])!=null&&e.includes(";")?s.push(`"${d[p.attr]}"`):s.push(d[p.attr]===void 0||d[p.attr]===null?"":d[p.attr])}),v.push(s.join(";"))});const o=document.createElement("a");o.setAttribute("href",`data:text/csv;charset=utf-8,${encodeURIComponent(v.join(`
|
|
1398
|
-
`))}`);const h=new Date;
|
|
1399
|
-
`).map(d=>d.replace("\r","").trim()),{schema:u}=this.props,v=i.shift().split(";").filter(d=>d&&u.items.find(s=>s.attr===d)),o=[];i.forEach(d=>{const s=d.split(";"),p={};for(let e=0;e<s.length;e++){let t=s[e];if(t.startsWith('"')){for(t=t.substring(1);e<s.length&&!t.endsWith('"');)t+=`;${s[++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 l=this.props.schema.items.find(a=>a.attr===v[e]);l&&l.type==="number"?r=parseFloat(t):r=t}else r=t;p[v[e]]=r}o.push(p)}),o.length?(h=this.state.value)!=null&&h.length?this.setState({showTypeOfImportDialog:o,showImportDialog:!1}):this.setState({value:o,showImportDialog:!1}):window.alert("ra_No data found in file")}onClone=n=>()=>{const i=JSON.parse(JSON.stringify(this.state.value)),u=JSON.parse(JSON.stringify(i[n]));if(typeof this.props.schema.clone=="string"&&typeof u[this.props.schema.clone]=="string"){let v=1,o=u[this.props.schema.clone];const h=o.match(/(\d+)$/);for(h?(o=o.replace(h[0],""),v=parseInt(h[0],10)+1):o+="_";i.find(d=>d[this.props.schema.clone]===o+v.toString());)v++;u[this.props.schema.clone]=`${u[this.props.schema.clone]}_${v}`}i.splice(n,0,u),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((u,v)=>{this.typingTimer=null;let o;if(this.props.schema.encryptedAttributes){const h=JSON.parse(JSON.stringify(u));if(h.forEach(d=>{this.props.schema.encryptedAttributes.forEach(s=>{d[s]&&(d[s]=ll(this.secret,d[s]))})}),this.props.schema.objKeyName){const d=Oi(h,this.props.schema.objKeyName,this.props.schema.objValueName);o=this.onChange(this.props.attr,d)}else o=this.onChange(this.props.attr,h)}else if(this.props.schema.objKeyName){const h=Oi(JSON.parse(JSON.stringify(u)),this.props.schema.objKeyName,this.props.schema.objValueName);o=this.onChange(this.props.attr,h)}else o=this.onChange(this.props.attr,u);o instanceof Promise&&o.catch(h=>console.error(`Cannot save: ${h}`)),v&&(this.applyFilter(!1,u),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)),u=(v=n.items)==null?void 0:v.reduce((o,h)=>{let d;return h.defaultFunc?this.props.custom?d=h.defaultFunc?this.executeCustom(h.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,i.length,this.props.data):this.props.schema.default:d=h.defaultFunc?this.execute(h.defaultFunc,this.props.schema.default,this.props.data,i.length,this.props.data):this.props.schema.default:d=h.default===void 0?null:h.default,o[h.attr]=d,o},{});i.push(u),this.setState({value:i},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))};isAnyFilterSet(){return!!Object.keys(this.filterRefs).find(n=>Ve.getFilterValue(this.filterRefs[n]))}applyFilter=(n,i,u)=>{i=i||this.state.value;let v=i.map((o,h)=>h);if(Object.keys(this.filterRefs).forEach(o=>{let h=Ve.getFilterValue(this.filterRefs[o]);!n&&h?(h=h.toLowerCase(),v=v.filter(d=>i[d]&&i[d][o]&&i[d][o].toLowerCase().includes(h))):this.filterRefs[o].current&&Ve.setFilterValue(this.filterRefs[o],"")}),v.length===i.length&&(v=null),v===null&&this.state.visibleValue===null){u&&u();return}JSON.stringify(v)!==JSON.stringify(this.state.visibleValue)?this.setState({visibleValue:v},()=>u&&u()):u&&u()};onMoveUp(n){const i=JSON.parse(JSON.stringify(this.state.value)),u=i[n];i.splice(n,1),i.splice(n-1,0,u),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)),u=i[n];i.splice(n,1),i.splice(n+1,0,u),this.setState({value:i,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))}onDrop(n){const i=n[0],u=new FileReader;u.onabort=()=>console.log("file reading was aborted"),u.onerror=()=>console.log("file reading has failed"),u.onload=()=>{if(i.size>Bn){window.alert(j.I18n.t("ra_File is too big. Max %sk allowed. Try use SVG.",Math.round(Bn/1024)));return}const v=new Uint8Array(u.result).reduce((o,h)=>o+String.fromCharCode(h),"");this.onImport(v)},u.readAsArrayBuffer(i)}showTypeOfImportDialog(){return this.state.showTypeOfImportDialog?k.createElement(N.Dialog,{open:!0,onClose:()=>this.setState({showTypeOfImportDialog:!1}),maxWidth:"md"},k.createElement(N.DialogTitle,null,j.I18n.t("ra_Append or replace?")),k.createElement(N.DialogContent,null,j.I18n.t("ra_Append %s entries or replace existing?",this.state.showTypeOfImportDialog.length)),k.createElement(N.DialogActions,null,k.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")),k.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?k.createElement(N.Dialog,{open:!0,onClose:()=>this.setState({showImportDialog:!1}),sx:{"& .MuiDialog-paper":{minHeight:500}},maxWidth:"md",fullWidth:!0},k.createElement(N.DialogTitle,null,j.I18n.t("ra_Import from %s","CSV")),k.createElement(N.DialogContent,null,k.createElement(Pi,{multiple:!1,accept:{"text/csv":[".csv"]},maxSize:Bn,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})=>k.createElement("div",{style:{...fe.uploadDiv,...this.state.uploadFile==="dragging"?fe.uploadDivDragging:void 0,...fe.dropZone,...this.state.icon?void 0:fe.dropZoneEmpty},...n()},k.createElement("input",{...i()}),k.createElement("div",{style:fe.uploadCenterDiv},k.createElement("div",{style:fe.uploadCenterTextAndIcon},k.createElement(Z.UploadFile,{style:fe.uploadCenterIcon}),k.createElement("div",{style:fe.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"))))))),k.createElement(N.DialogActions,null,k.createElement(N.Button,{variant:"contained",onClick:()=>this.setState({showImportDialog:!1}),color:"primary",startIcon:k.createElement(Z.Close,null)},j.I18n.t("Cancel")))):null}renderOneFilter(n){return k.createElement(N.TableCell,{key:`${n.headCell.attr}_${n.index}`,style:n.style,align:"left",sortDirection:n.orderBy===n.headCell.attr?n.order:!1},k.createElement("div",{style:{...fe.flex,...n.schema.showFirstAddOnTop?{flexDirection:"column"}:void 0}},n.showAddButton?this.renderAddButton(n.doAnyFilterSet):null,n.headCell.sort&&k.createElement(N.TableSortLabel,{active:!0,style:n.orderBy!==n.headCell.attr?fe.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)?k.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:Ve.getFilterValue(this.filterRefs[n.headCell.attr])&&k.createElement(N.InputAdornment,{position:"end"},k.createElement(N.IconButton,{size:"small",tabIndex:-1,onClick:()=>{Ve.setFilterValue(this.filterRefs[n.headCell.attr],""),this.applyFilter()}},k.createElement(Z.Close,null)))}},fullWidth:!0,placeholder:this.getText(n.headCell.title)}):k.createElement("span",{style:fe.headerText},this.getText(n.headCell.title)),this.renderShowHideFilter(n.headCell)))}enhancedFilterCard(){var h;const{schema:n}=this.props,{order:i,orderBy:u}=this.state;let v;this.props.schema.compact&&(v={paddingTop:1,paddingBottom:1});const o=!n.noDelete&&n.import||n.export;return o||n.items.find(d=>d.sort||d.filter)?k.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}},k.createElement(N.Card,null,k.createElement(N.Paper,{style:fe.paper},k.createElement(N.Accordion,{style:fe.paper},k.createElement(N.AccordionSummary,{expandIcon:k.createElement(Z.ExpandMore,null)},k.createElement(N.Typography,null,j.I18n.t("ra_Filter and Data Actions"))),k.createElement(N.AccordionDetails,null,k.createElement(N.Table,null,k.createElement(N.TableBody,null,((h=n.items)==null?void 0:h.find(d=>d.sort||d.filter))&&n.items.map((d,s)=>k.createElement(N.TableRow,{key:`${d.attr}_${s}`},this.renderOneFilter({schema:n,style:v,showAddButton:!1,headCell:d,order:i,orderBy:u,index:s,doAnyFilterSet:!1}))),o?k.createElement(N.TableRow,null,k.createElement(N.TableCell,{align:"left",style:v},k.createElement("span",{style:fe.headerText},j.I18n.t("ra_Actions"))),k.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 u=this.isAnyFilterSet();return k.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}},k.createElement(N.Card,null,k.createElement(N.Paper,{style:fe.paper},k.createElement(N.Table,null,k.createElement(N.TableBody,null,k.createElement(N.TableRow,null,k.createElement(N.TableCell,{colSpan:n.items.length+1,style:i},this.renderAddButton(u))))))))}renderCards(){const{schema:n}=this.props;let{visibleValue:i}=this.state,u;this.props.schema.compact&&(u={paddingTop:1,paddingBottom:1}),i||=this.state.value.map((o,h)=>h);const v=this.isAnyFilterSet();return k.createElement(N.Grid2,{container:!0},this.showImportDialog(),this.showTypeOfImportDialog(),this.enhancedFilterCard(),i.map((o,h)=>{var d;return k.createElement(N.Grid2,{key:`${o}_${h}`,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}},k.createElement(N.Card,null,k.createElement(N.Paper,{style:fe.paper},k.createElement(N.Table,null,k.createElement(N.TableBody,null,(d=n.items)==null?void 0:d.map(s=>k.createElement(N.TableRow,{key:`${s.attr}_${o}`},k.createElement(N.TableCell,{align:"left",style:u},k.createElement("span",{style:fe.headerText},this.getText(s.title))),k.createElement(N.TableCell,{align:"left",style:u},this.itemTable(s.attr,this.state.value[o],o)))),!n.noDelete&&k.createElement(N.TableRow,null,k.createElement(N.TableCell,{align:"left",style:u},k.createElement("span",{style:fe.headerText},this.getText("Actions"))),k.createElement(N.TableCell,{align:"left",style:u},!v&&!this.state.orderBy?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Move up"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement("span",null,k.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveUp(o),disabled:h===0},k.createElement(Z.ArrowUpward,null)))):null,!v&&!this.state.orderBy?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Move down"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement("span",null,k.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveDown(o),disabled:h===i.length-1},k.createElement(Z.ArrowDownward,null)))):null,k.createElement(N.Tooltip,{title:j.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:this.onDelete(o)},k.createElement(Z.Delete,null))),this.props.schema.clone?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:this.onClone(o)},k.createElement(Z.ContentCopy,null))):null)))))))}),this.enhancedBottomCard())}renderTable(){const{schema:n}=this.props;let{visibleValue:i}=this.state;i=i||this.state.value.map((o,h)=>h);const u=this.isAnyFilterSet();let v;return this.props.schema.compact&&(v={paddingTop:1,paddingBottom:1}),k.createElement(N.Paper,{style:fe.paper},this.showImportDialog(),this.showTypeOfImportDialog(),n.label?k.createElement("div",{style:fe.label},k.createElement(N.Toolbar,{variant:"dense",style:fe.rootTool},k.createElement(N.Typography,{style:fe.title,variant:"h6",id:"tableTitle",component:"div"},this.getText(n.label)))):null,k.createElement(N.TableContainer,null,k.createElement(N.Table,{style:fe.table,size:"small"},this.enhancedTableHead(!u&&!this.state.orderBy?120:64,u),k.createElement(N.TableBody,null,i.map((o,h)=>{var d;return k.createElement(N.TableRow,{hover:!0,key:`${o}_${h}`},(d=n.items)==null?void 0:d.map(s=>k.createElement(N.TableCell,{key:`${s.attr}_${o}`,align:"left",style:v},this.itemTable(s.attr,this.state.value[o],o))),!n.noDelete&&k.createElement(N.TableCell,{align:"left",style:{...v,...fe.buttonCell}},!u&&!this.state.orderBy?h?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Move up"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveUp(o)},k.createElement(Z.ArrowUpward,null))):k.createElement("div",{style:fe.buttonEmpty}):null,!u&&!this.state.orderBy?h<i.length-1?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Move down"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveDown(o)},k.createElement(Z.ArrowDownward,null))):k.createElement("div",{style:fe.buttonEmpty}):null,k.createElement(N.Tooltip,{title:j.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:this.onDelete(o)},k.createElement(Z.Delete,null))),this.props.schema.clone?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:this.onClone(o)},k.createElement(Z.ContentCopy,null))):null))}),!n.noDelete&&i.length>=(n.showSecondAddAt||5)?k.createElement(N.TableRow,null,k.createElement(N.TableCell,{colSpan:n.items.length+1,style:{...v}},this.renderAddButton(u))):null)),!i.length&&this.state.value.length?k.createElement("div",{style:fe.filteredOut},k.createElement(N.Typography,{style:fe.title,variant:"h6",id:"tableTitle",component:"div"},j.I18n.t("ra_All items are filtered out"),k.createElement(N.IconButton,{size:"small",onClick:()=>this.applyFilter(!0)},k.createElement(Z.Close,null)))):null),n.help?k.createElement(N.FormHelperText,{style:{paddingLeft:16}},this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null,this.state.errorMessage?k.createElement("div",{style:{display:"flex",padding:"5px"}},k.createElement(Z.Warning,{color:"error"}),k.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 u;return i&&(n.useCardFor||["xs"]).includes(i)?u=this.renderCards():u=this.renderTable(),k.createElement("div",{ref:this.refDiv,style:{width:"100%"}},u)}}const ln={indeterminate:{opacity:.5},label:{width:"100%",fontSize:14,marginBottom:2},helper:{width:"100%",fontSize:12},error:{width:"100%",fontSize:12,color:"#FF0000"}};class hl 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(u){console.log("Error in JSON",u),i=!0}return i}static getDerivedStateFromProps(n,i){if(n.oContext.multiEdit&&i.value===K.DIFFERENT_VALUE)return{value:K.DIFFERENT_VALUE};let u=K.getValue(n.data,n.attr);return u!=null&&(u=u.toString()),u==null||u!==i.value&&u!==i.oldValue?{value:u}:null}renderItem(n,i){const u=Array.isArray(this.state.value)||this.state.value===K.DIFFERENT_VALUE;if(this.props.schema.time){let h="";return typeof this.state.value=="number"?this.state.value&&this.state.value<9466596e5?h=new Date(this.state.value*1e3).toLocaleString():h=new Date(this.state.value).toLocaleString():typeof this.state.value=="string"&&(h=new Date(this.state.value).toLocaleString()),k.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:h,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),u){const h=K.getValue(this.props.data,this.props.attr),d=(h==null?void 0:h.filter(s=>s||s===0).map(s=>({label:s.toString()||"",value:s})))||[];return d.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),k.createElement(N.Autocomplete,{style:ln.indeterminate,fullWidth:!0,value:d[0],onChange:(s,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:s=>s.label,renderInput:s=>k.createElement(N.TextField,{variant:"standard",...s,error:!!n,placeholder:this.getText(this.props.schema.placeholder),slotProps:{htmlInput:{...s.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,o;if((this.props.schema.readOnly||i)&&this.props.schema.copyToClipboard?(this.props.schema.minRows>1&&(o={position:"absolute",right:3,top:20,zIndex:1e3}),v=k.createElement(N.IconButton,{tabIndex:-1,style:o,size:"small",onClick:()=>{j.Utils.copyToClipboard(this.state.value),window.alert(j.I18n.t("ra_Copied"))}},k.createElement(j.IconCopy,null))):!this.props.schema.readOnly&&!i&&this.state.value&&!this.props.schema.noClearButton&&(this.props.schema.minRows>1&&(o={position:"absolute",right:3,top:20,zIndex:1e3}),v=k.createElement(N.IconButton,{style:o,size:"small",tabIndex:-1,onClick:()=>this.setState({value:"",oldValue:this.state.value},()=>this.onChange(this.props.attr,""))},k.createElement(Z.Close,null)),this.props.schema.minRows<=1&&(v=k.createElement(N.InputAdornment,{position:"end"},v))),this.props.schema.minRows>1){const h=this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation);return k.createElement("div",{style:{width:"100%",position:"relative"}},this.props.schema.label?k.createElement("div",{style:ln.label},this.getText(this.props.schema.label)):null,k.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 s=d.target.value;this.setState({value:s,oldValue:this.state.value,jsonError:this.validateJson(s)},()=>this.onChange(this.props.attr,s||""))},placeholder:this.getText(this.props.schema.placeholder)}),h||n||this.state.jsonError?k.createElement("div",{style:n?ln.error:ln.helper},n||(this.state.jsonError?j.I18n.t("ra_Invalid JSON"):h)):null)}return k.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:h=>{const d=h.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 cl={fullWidth:{width:"100%"}};class pl 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 u=i;this.setState({text:u.text||"",style:u.style,icon:u.icon,iconStyle:u.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=ht(this.state.icon,{marginRight:this.state.text?8:void 0,...this.state.iconStyle||void 0}),n||(n=k.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"?k.createElement(N.TextField,{variant:"standard",fullWidth:!0,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?k.createElement(N.IconButton,{tabIndex:-1,size:"small",onClick:()=>{j.Utils.copyToClipboard(this.state.text),window.alert(j.I18n.t("ra_Copied"))}},k.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)}):k.createElement("div",{style:{...cl.fullWidth,...this.state.style||void 0}},n,this.props.schema.container==="html"?k.createElement("span",{dangerouslySetInnerHTML:{__html:this.state.text||""}}):this.state.text)}}class dl extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({value:n})}renderItem(n,i){const u=this.props.schema.returnFormat!=="HH:mm:ss",v=new Date(Date.parse(`Thu, 01 Jan 1970 ${this.state.value||"00:00:00"}`));return k.createElement(Wi.TimePicker,{sx:o=>({width:"100%",borderBottom:`1px solid ${o.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${o.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:o=>{let h;h=o instanceof Date?o.toTimeString().split(" ")[0]:o.toTimeString(),u&&(h=h.split(":").slice(0,2).join(":")),this.setState({value:h},()=>this.onChange(this.props.attr,this.state.value))},views:this.props.schema.views||["hours","minutes","seconds"],label:this.getText(this.props.schema.label)})}}function fl(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 gl 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 u=fl(this.props.customObj._id,`${this.props.oContext.adapterName}.${this.props.oContext.instance}`);this.setState({value:u})}else this.setState({value:n||""})}renderItem(n,i){return k.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:u=>{const v=u.target.value;this.setState({value:v},()=>this.onChange(this.props.attr,v))}})}}class ml 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 k.createElement(N.TextField,{variant:"standard",fullWidth:!0,error:!!n,disabled:!!i,slotProps:{htmlInput:{readOnly:!0},input:{endAdornment:k.createElement(N.IconButton,{tabIndex:-1,onClick:()=>{j.Utils.copyToClipboard(this.state.uuid),window.alert(j.I18n.t("ra_Copied %s",this.state.uuid))}},k.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 Ni={icon:{width:16,height:16,marginRight:8}};class vl extends K{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getUsers().then(n=>{const i={},u=j.I18n.getLanguage();this.props.schema.short?n.forEach(v=>{var o,h;return i[v._id]={color:(o=v.common)==null?void 0:o.color,icon:(h=v.common)==null?void 0:h.icon,name:j.Utils.getObjectNameFromObj(v,u)}}):n.forEach(v=>{var o,h;return i[v._id.replace(/^system\.user\./,"")]={color:(o=v.common)==null?void 0:o.color,icon:(h=v.common)==null?void 0:h.icon,name:j.Utils.getObjectNameFromObj(v,u)}}),this.setState({users:i})}).catch(n=>console.error(`Cannot get users: ${n}`))}renderItem(n,i){var v,o;const u=K.getValue(this.props.data,this.props.attr);return k.createElement(N.FormControl,{variant:"standard",fullWidth:!0},this.state.users&&this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.users?k.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:u,renderValue:h=>{var d,s,p;return k.createElement("span",null,this.state.users&&((d=this.state.users[h])!=null&&d.icon)?k.createElement(j.Icon,{src:this.state.users&&((s=this.state.users[h])==null?void 0:s.icon),style:Ni.icon}):null,this.state.users&&((p=this.state.users[h])==null?void 0:p.name)||h||"")},style:{color:this.state.users&&((v=this.state.users[u])==null?void 0:v.color)||void 0,backgroundColor:j.Utils.getInvertedColor(this.state.users&&((o=this.state.users[u])==null?void 0:o.color),this.props.oContext.themeType)},onChange:h=>this.onChange(this.props.attr,h.target.value)},this.state.users&&Object.keys(this.state.users).map(h=>k.createElement(N.MenuItem,{style:{color:this.state.users[h].color||void 0,backgroundColor:j.Utils.getInvertedColor(this.state.users[h].color,this.props.oContext.themeType)},key:h,value:h},this.state.users[h].icon?k.createElement(j.Icon,{src:this.state.users[h].icon,style:Ni.icon}):null,this.state.users[h].name))):k.createElement(N.TextField,{variant:"standard",error:!!n,disabled:!!i,value:u,onChange:h=>this.onChange(this.props.attr,h.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class yl 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?k.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 bl={accordion:$s,alive:Ts,autocomplete:_s,autocompleteSendTo:ks,certCollection:Fs,certificate:Ls,certificates:Is,checkbox:Rs,checkLicense:ct,chip:fi,chips:fi,color:Ws,coordinates:Hs,cron:Ms,custom:Ut,datePicker:zs,deviceManager:js,divider:nl,file:eo,fileSelector:mn,func:to,header:rl,image:ro,imageSendTo:io,instance:so,interface:oo,ip:no,jsonEditor:Fa,language:Oa,license:Na,number:Ba,oauth2:Pa,objectId:Wa,password:Ha,pattern:za,port:Va,qrCode:yl,room:Ua,select:Ka,selectSendTo:Ya,sendto:_i,sendTo:_i,setState:Za,slider:qa,state:tl,staticImage:sl,staticInfo:ol,staticLink:Ri,staticText:Ri,table:Ve,text:hl,textSendTo:pl,timePicker:dl,topic:gl,uuid:ml,user:vl},Qe={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 $t 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(u=>{if(this.props.oContext.multiEdit&&n[u].noMultiEdit)return null;const v=n[u].type||"panel";let o,h="Use this.props.oContext.socket!";return v==="custom"?(n[u].url?o=Ut:this.props.oContext.customs&&this.props.oContext.customs[n[u].component]?o=this.props.oContext.customs[n[u].component]:(console.error(`Cannot find custom component: ${n[u].component}`),o=K),h=this.props.oContext.socket):v==="panel"?o=$t:o=bl[v]||K,k.createElement(o,{socket:h,globalData:this.props.globalData,oContext:this.props.oContext,key:`${u}_${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:Qe.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[u],attr:u,table:this.props.table})}):null}render(){const n=this.props.schema;if(!n)return null;const{disabled:i,hidden:u}=this.calculate(n),v=this.props.schema.items,o=this.props.schema.style||{};if(u){if(n.hideOnlyControl){const d=k.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"},o,this.props.oContext.themeType==="dark"&&n.darkStyle)});return n.newLine?k.createElement(k.Fragment,null,k.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 k.createElement(N.Grid2,{key:`${this.props.attr}_${this.props.index}`,container:!0,style:Qe.fullWidth,columnSpacing:2,rowSpacing:1,sx:o},this.renderItems(v,i));let h;if(n.collapsable)h=k.createElement(N.Accordion,{key:`${this.props.attr}_${this.props.index}`,style:Qe.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})}},k.createElement(N.AccordionSummary,{expandIcon:k.createElement(Z.ExpandMore,null),sx:j.Utils.getStyle(this.props.oContext.theme,o,this.props.oContext.themeType&&n.darkStyle,n.color==="primary"?Qe.primary:n.color==="secondary"&&Qe.secondary,{width:"100%"})},k.createElement(N.Typography,{style:Qe.heading},this.getText(n.label))),k.createElement(N.AccordionDetails,null,k.createElement(N.Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:{...o,width:"100%",padding:"10px"}},this.renderItems(v,i))));else{const d=j.Utils.getStyle(this.props.oContext.theme,this.props.style,o,{width:"100%"},this.props.isParentTab&&Qe.paper,this.props.isParentTab&&(this.props.withoutSaveButtons?this.props.withIcons?{height:"calc(100% - 88px) !important"}:{height:"calc(100% - 64px) !important"}:this.props.withIcons?Qe.paperWithIcons:Qe.paperWithoutIcons));h=k.createElement(N.Box,{component:"div",key:`${this.props.attr}_${this.props.index}`,className:this.props.className,sx:d},k.createElement(N.Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:j.Utils.getStyle(this.props.oContext.theme,{width:"100%"},this.props.isParentTab&&Qe.padding,this.props.schema.innerStyle)},this.renderItems(v,i)))}if(!this.props.isParentTab){const d=k.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",...o}},h);return n.newLine?k.createElement(k.Fragment,null,k.createElement("div",{style:{flexBasis:"100%",height:0}}),d):d}return h}}const un={tabs:{height:"100%",width:"100%"},panel:{width:"100%",display:"block"},panelWithIcons:{height:"calc(100% - 72px)"},panelWithoutIcons:{height:"calc(100% - 48px)"}};class wl extends K{resizeTimeout=null;refDiv;constructor(n){super(n);let i;if(this.props.root){const u=(window.location.hash||"").replace(/^#/,"").split("/");if(u.length>=3&&u[1]==="config"){const v=u[3],o=parseInt(v,10);v&&o.toString()===v?o>=0&&o<Object.keys(this.props.schema.items).length&&(i=Object.keys(this.props.schema.items)[o]):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=k.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],u=parseInt(i,10);let v;u.toString()===i?u>=0&&u<Object.keys(this.props.schema.items).length&&(v=Object.keys(this.props.schema.items)[u]):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 u=[];Object.keys(n).map(h=>{let d;if(n[h].expertMode&&!this.props.expertMode)return;if(this.props.custom){if(this.executeCustom(n[h].hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData))return;d=this.executeCustom(n[h].disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData)}else{if(this.execute(n[h].hidden,!1,this.props.data,this.props.index,this.props.globalData))return;d=this.execute(n[h].disabled,!1,this.props.data,this.props.index,this.props.globalData)}const s=this.getIcon(n[h].icon);i=i||!!s,u.push({icon:s,disabled:d,label:this.getText(n[h].label),name:h})}),u.find(h=>h.name===this.state.tab)||setTimeout(()=>this.setState({tab:u[0].name}),50);const v=this.getCurrentBreakpoint();let o;return v==="xs"&&u.length>2?o=k.createElement(N.Toolbar,{style:{top:2,backgroundColor:this.props.oContext.themeType==="dark"?"#222":"#DDD"},variant:"dense"},k.createElement(N.IconButton,{onClick:h=>this.setState({openMenu:h.currentTarget})},k.createElement(Z.Menu,null)),this.state.openMenu?k.createElement(N.Menu,{open:!0,anchorEl:this.state.openMenu,onClose:()=>this.setState({openMenu:null})},u.map(h=>k.createElement(N.MenuItem,{disabled:h.disabled,key:h.name,onClick:()=>{this.setState({openMenu:null},()=>this.onMenuChange(h.name))},selected:h.name===this.state.tab},i?k.createElement(N.ListItemIcon,null,h.icon):null,h.label))):null):o=k.createElement(N.Tabs,{variant:"scrollable",scrollButtons:"auto",style:this.props.schema.tabsStyle,value:this.state.tab,onChange:(h,d)=>this.onMenuChange(d)},u.map(h=>k.createElement(N.Tab,{id:h.name,wrapped:!0,disabled:h.disabled,key:h.name,value:h.name,iconPosition:this.props.schema.iconPosition||"start",icon:h.icon,label:h.label}))),k.createElement("div",{style:un.tabs,ref:this.refDiv},o,k.createElement($t,{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:{...un.panel,...i?un.panelWithIcons:un.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 Cl={root:{width:"100%",height:"100%"}};class cn extends pt.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,u){if(i===!0||i&&typeof i=="string"){const v=j.I18n.getLanguage(),o=typeof i=="string"?i:"i18n";let h=await n.fileExists(`${u}.admin`,`${o}/${v}.json`),d;if(h?d=`${o}/${v}.json`:(h=await n.fileExists(`${u}.admin`,`${o}/${v}/translations.json`),h?d=`${o}/${v}/translations.json`:v!=="en"&&(h=await n.fileExists(`${u}.admin`,`${o}/en.json`),h?d=`${o}/en.json`:(h=await n.fileExists(`${u}.admin`,`${o}/en/translations.json`),h&&(d=`${o}/en/translations.json`)))),d){const s=await n.readFile(`${u}.admin`,d);let p;s.file!==void 0?p=s.file:p=s;try{const e=JSON.parse(p);j.I18n.extendTranslations(e,v)}catch(e){return console.error(`Cannot parse language file "${u}.admin/${d}: ${e}`),""}return d}return console.warn(`Cannot find i18n for ${u} / ${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,u,v)=>{if(this.props.onValueChange)this.props.onValueChange(n,i,v),u&&u();else if(n&&this.props.onChange){const o={changed:JSON.stringify(n)!==this.state.originalData};this.setState(o,()=>{this.props.onChange(n,o.changed,v),u&&u()})}else v&&this.props.onChange(null,null,v)};onError=(n,i)=>{this.errorCached=this.errorCached||JSON.parse(JSON.stringify(this.state.errors));const u=this.errorCached;i?u[n]=i:delete u[n],this.errorTimeout&&clearTimeout(this.errorTimeout),JSON.stringify(u)!==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(u=>{i[u]=n.items[u],this.flatten(n.items[u],i)}),i}buildDependencies(n){const i=this.flatten(n);Object.keys(i).forEach(u=>{var v,o,h,d,s,p,e,t,r,l;(v=i[u].confirm)!=null&&v.alsoDependsOn&&((o=i[u].confirm)==null||o.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 c={...i[u],attr:u};c.confirm&&(c.confirm.cancel="Undo"),i[a].confirmDependsOn.push(c)}})),(h=i[u].onChange)!=null&&h.alsoDependsOn&&((d=i[u].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 c={...i[u],attr:u};i[a].onChangeDependsOn.push(c)}})),(s=i[u].hidden)!=null&&s.alsoDependsOn&&((p=i[u].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 c={...i[u],attr:u};i[a].hiddenDependsOn.push(c)}})),(e=i[u].label)!=null&&e.alsoDependsOn&&((t=i[u].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 c={...i[u],attr:u};i[a].labelDependsOn.push(c)}})),(r=i[u].help)!=null&&r.alsoDependsOn&&((l=i[u].help)==null||l.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 c={...i[u],attr:u};i[a].helpDependsOn.push(c)}}))})}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"?k.createElement(wl,{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,u)=>this.onError(i,u),originalData:JSON.parse(this.state.originalData),root:!0,schema:n,expertMode:this.props.expertMode,themeName:this.props.themeName}):n.type==="panel"||!n.type?k.createElement($t,{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,u)=>this.onError(i,u),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(u=>this.forceUpdateHandlers[u]&&this.forceUpdateHandlers[u](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?k.createElement(N.LinearProgress,null):(this.oContext._themeName!==this.props.themeName&&(this.oContext._themeName=this.props.themeName,setTimeout(()=>this.updateContext(!0),0)),k.createElement("div",{style:{...!this.props.embedded||this.props.withoutSaveButtons?Cl.root:void 0,...this.props.style,...this.state.schema.style}},this.renderItem(this.state.schema)))}}const Et={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 El(L,n){let i="";for(let u=0;u<n.length;u++)i+=String.fromCharCode(L[u%L.length].charCodeAt(0)^n.charCodeAt(u));return i}function Sl(L,n){let i="";for(let u=0;u<n.length;u++)i+=String.fromCharCode(L[u%L.length].charCodeAt(0)^n.charCodeAt(u));return i}function Dl(L,n){if(typeof n!="string")return n;if(!n.startsWith("$/aes-192-cbc:")||!/^[0-9a-f]{48}$/.test(L))return El(L,n);const i=n.split(":",3),u=window.CryptoJS.enc.Hex.parse(L),v=window.CryptoJS.enc.Hex.parse(i[1]),o=window.CryptoJS.lib.CipherParams.create({ciphertext:window.CryptoJS.enc.Hex.parse(i[2])}),h=window.CryptoJS.AES.decrypt(o,u,{iv:v});return window.CryptoJS.enc.Utf8.stringify(h)}function Al(L,n,i){if(typeof n!="string")return n;if(!/^[0-9a-f]{48}$/.test(L))return Sl(L,n);let u;u=window.CryptoJS.lib.WordArray.random(128/8);const v=window.CryptoJS.enc.Hex.parse(L),o=window.CryptoJS.AES.encrypt(n,v,{iv:u}).ciphertext;return`$/aes-192-cbc:${window.CryptoJS.enc.Hex.stringify(u)}:${o}`}function Bi(L,n){var i;return document.getElementById(n)?(i=document.getElementById(n))==null?void 0:i.onload:new Promise(u=>{const v=document.createElement("script");v.setAttribute("id",n),v.onload=u,v.src=L,document.getElementsByTagName("head")[0].appendChild(v)})}let xl=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(u=>cn.loadI18n(this.props.socket,u==null?void 0:u.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:u,data:i.native,common:i.common,hash:pi(JSON.stringify(u)).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 u=new FileReader;u.onload=v=>{if(!v.target)return;const o=v.target.result;try{const h=JSON.parse(o);this.setState({data:h,changed:JSON.stringify(h)!==JSON.stringify(this.state.originalData)})}catch{window.alert(j.I18n.t("[JsonConfig] Failed to parse JSON file"))}},u.readAsText(i)}else window.alert(j.I18n.t("[JsonConfig] Failed to open JSON File"))};getExportImportButtons(){return k.createElement("div",{style:Et.exportImportButtons},k.createElement(N.Tooltip,{title:this.props.t("Import settings from JSON file"),slotProps:{popper:{sx:Et.tooltip}}},k.createElement(N.Fab,{size:"small",sx:{"&.MuiFab-root":Et.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()}},k.createElement(Z.Publish,null))),k.createElement(N.Tooltip,{title:this.props.t("Export setting to JSON file"),slotProps:{popper:{sx:Et.tooltip}}},k.createElement(N.Fab,{size:"small",sx:{"&.MuiFab-root":Et.button},onClick:()=>{this.state.data&&j.Utils.generateFile(`${this.props.adapterName}.${this.props.instance}.json`,this.state.data)}},k.createElement(Z.Publish,{style:{transform:"rotate(180deg)"}}))))}onFileChange=async(n,i,u)=>{var v;if(n===`${this.props.adapterName}.admin`&&u){if(i===this.fileLangSubscribed)try{await cn.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 o=await this.getConfigFile(this.fileSubscribed[0]);this.setState({schema:o,hash:pi(JSON.stringify(o)).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 u=await this.props.socket.getSystemConfig();await Bi("../../lib/js/crypto-js/crypto-js.js","crypto-js"),this.secret=u.native.secret}return(n=i.encryptedNative)==null||n.forEach(u=>{i.native[u]&&(i.native[u]=Dl(this.secret,i.native[u]))}),i}return i}catch(i){window.alert(`[JsonConfig] Cannot read instance object: ${i}`)}return null}renderDialogConfirm(){return this.state.confirmDialog?k.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 u=Object.keys(n);for(let v=0;v<u.length;v++)n[u[v]]&&typeof n[u[v]]=="object"&&(n[u[v]]=await this.scanForInclude(n[u[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 o="",h="";if(v.file!==void 0&&(h=v.file),typeof h=="string")o=h;else if(h.type==="Buffer"){let d="";const s=new Uint8Array(h.data),p=s.byteLength;for(let e=0;e<p;e++)d+=String.fromCharCode(s[e]);o=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(ji.parse(o),i)}catch(d){window.alert("[JsonConfig] Cannot parse json5 config!"),console.log(d)}}catch(u){this.state.schema||window.alert(`[JsonConfig] Cannot read file "${n}: ${u}`)}return null}renderSaveConfigDialog(){return this.state.saveConfigDialog?k.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 u of Object.values(i.items)){const v=this.findAttr(n,u);if(v)return v}}return null}postProcessing(n,i,u){if(u=u||this.state.schema,!n){console.error(`Data is empty in postProcessing: ${i}, ${JSON.stringify(u)}`);return}const v=n[i];if(u.items)if(u.type==="table"){const o=v;if(!Array.isArray(o))return;for(const h of o)for(const d of u.items)this.postProcessing(h,d.attr,d)}else for(const[o,h]of Object.entries(u.items)){if(h.type==="panel"||h.type==="tabs"||h.type==="accordion")return;this.postProcessing(n,o,h)}else if(i&&typeof v=="string")if(u.type==="text")u.trim!==!1&&(n[i]=v.trim());else if(u.type==="ip")n[i]=v.trim();else if(u.type==="number"){const o=parseFloat(v.toString().replace(",","."));u.min!==void 0&&o<u.min?n[i]=u.min:u.max!==void 0&&o>u.max?n[i]=u.max:n[i]=o}else if(u.type==="port"){const o=parseInt(v.toString(),10);u.min!==void 0&&o<u.min?n[i]=u.min:u.max!==void 0&&o>u.max&&(n[i]=u.max),n[i]!==0&&o<20?n[i]=20:o>65535?n[i]=65535:n[i]=o}else u.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 u=await this.getInstanceObject();if(!u){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 h of Object.keys(this.state.data)){const d=this.findAttr(h);(!d||!d.doNotSave||d.type==="state")&&!h.startsWith("_")?K.setValue(u.native,h,this.state.data[h]):(K.setValue(u.native,h,null),v[h]=this.state.data[h])}try{const h=JSON.parse(JSON.stringify(u));if(Array.isArray(h.encryptedNative)){await Bi("../../lib/js/crypto-js/crypto-js.js","crypto-js");for(const d of h.encryptedNative)h.native[d]&&(h.native[d]=Al(this.secret,h.native[d]))}await this.props.socket.setObject(h._id,h)}catch(h){window.alert(`[JsonConfig] Cannot set object: ${h}`)}const o={...u.native,...v};console.log(o),this.setState({changed:!1,data:o,updateData:this.state.updateData+1,originalData:o},()=>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?k.createElement(N.LinearProgress,null):k.createElement("div",{style:Et.root},this.renderDialogConfirm(),this.getExportImportButtons(),this.renderSaveConfigDialog(),k.createElement(cn,{key:this.state.hash,style:Et.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,u)=>{u&&this.state.error&&(window.alert(j.I18n.t("Cannot save configuration because of error in configuration")),u=!1),u&&!this.state.changed&&!i&&(u=!1),n?this.setState({data:n,changed:i,saveConfigDialog:u}):u!==void 0&&this.setState({saveConfigDialog:u})},DeviceManager:this.props.DeviceManager,theme:this.state.theme}),k.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,$t as ConfigPanel,xl as JsonConfig,cn as JsonConfigComponent};
|
|
1396
|
+
`,"autocompletion.css",!1),u.AcePopup=y,u.$singleLineEditor=m,u.getAriaId=l}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(i,u,v){var s=function(){function h(d){this.editor=d,this.screenReaderDiv=document.createElement("div"),this.screenReaderDiv.classList.add("ace_screenreader-only"),this.editor.container.appendChild(this.screenReaderDiv)}return h.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 ",l=0;l<this._lines.length;l++)r+="ace-inline-screenreader-line-".concat(l," ");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)},h.prototype.destroy=function(){this.screenReaderDiv.remove()},h.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},h}();u.AceInlineScreenReader=s}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(i,u,v){var s=i("../snippets").snippetManager,h=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 h(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}();u.AceInline=d}),ace.define("ace/autocomplete/util",["require","exports","module"],function(i,u,v){u.parForEach=function(h,d,o){var p=0,e=h.length;e===0&&o();for(var t=0;t<e;t++)d(h[t],function(r,l){p++,p===e&&o(r,l)})};var s=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;u.retrievePrecedingIdentifier=function(h,d,o){o=o||s;for(var p=[],e=d-1;e>=0&&o.test(h[e]);e--)p.push(h[e]);return p.reverse().join("")},u.retrieveFollowingIdentifier=function(h,d,o){o=o||s;for(var p=[],e=d;e<h.length&&o.test(h[e]);e++)p.push(h[e]);return p},u.getCompletionPrefix=function(h){var d=h.getCursorPosition(),o=h.session.getLine(d.row),p;return h.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)},u.triggerAutocomplete=function(h,o){var o=o??h.session.getPrecedingCharacter();return h.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,u,v){var s=i("./keyboard/hash_handler").HashHandler,h=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,l=i("./config"),a=i("./lib/event"),c=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 D(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:l.nls("autocomplete.loading","Loading..."),value:""}]},enumerable:!1,configurable:!0}),E.prototype.$init=function(){return this.popup=new h(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,M=this.editor.getCursorPosition().column,_=this.editor.session.getLine(g).slice(S,M);this.inlineRenderer.show(this.editor,b,_)?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,M=g.$cursorLayer.getPixelPosition(this.base,!0);M.left-=this.popup.getTextLeftOffset();var _=b.container.getBoundingClientRect();M.top+=_.top-g.layerConfig.offset,M.left+=_.left-b.renderer.scrollLeft,M.left+=g.gutterWidth;var T={top:M.top,left:M.left};g.$ghostText&&g.$ghostTextWidget&&this.base.row===g.$ghostText.position.row&&(T.top+=g.$ghostTextWidget.el.offsetHeight);var F=b.container.getBoundingClientRect().bottom-S,A=F<T.top?{top:F,left:T.left}:T;this.popup.tryShow(A,S,"bottom")||this.popup.tryShow(M,S,"top")||this.popup.show(M,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 M=this.popup.getRow(),_=this.popup.data[M];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 T;this.stickySelection&&(T=this.popup.data.indexOf(_)),(!T||T===-1)&&(T=0),this.popup.setRow(this.autoSelect?T:-1),T===M&&_!==this.completions.filtered[T]&&this.$onPopupChange();var F=this.inlineRenderer&&this.inlineEnabled;if(T===M&&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(),M=b.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(b.relatedTarget),_=this.popup&&this.popup.container;g!=S&&g.parentNode!=_&&!M&&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,M=this.getCompletionProvider().insertMatch(this.editor,b,S.filterText,g);return this.completions==S&&this.detach(),M},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 M=this.editor.getCursorPosition(),_=this.editor.session.getTextRange({start:this.base,end:M});if(_==this.completions.filterText)return;if(this.completions.setFilter(_),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==_&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,_,b);return}if(g&&g.matches){var M=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor(M.row,M.column),this.base.$insertRight=!0,this.completions=new D(g.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",b)}var S=this.editor.getSession(),M=this.editor.getCursorPosition(),_=p.getCompletionPrefix(this.editor);this.base=S.doc.createAnchor(M.row,M.column-_.length),this.base.$insertRight=!0;var T={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:_,pos:M}).provideCompletions(this.editor,T,function(F,A,$){var C=A.filtered,w=p.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),$){if(!C.length){var x=!this.autoShown&&this.emptyMessage;if(typeof x=="function"&&(x=this.emptyMessage(w)),x){var I=[{caption:x,value:""}];this.completions=new D(I),this.openPopup(this.editor,w,b),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==w&&!C[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&C.length==1)return this.insertMatch(C[0])}this.completions=!$&&this.showLoadingState?new D(E.completionsForLoading.concat(C),A.filterText):A,this.openPopup(this.editor,w,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()]),M=null;if(!S||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var _=this.editor.completers.length,T=0;T<_;T++){var F=this.editor.completers[T];if(F.getDocTooltip&&S.completerId===F.id){M=F.getDocTooltip(S);break}}if(!M&&typeof S!="string"&&(M=S),typeof M=="string"&&(M={docText:M}),!M||!M.docHTML&&!M.docText)return this.hideDocTooltip();this.showDocTooltip(M)},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",c));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 M=this.popup,_=M.container.getBoundingClientRect(),T=400,F=300,A=M.renderer.scrollBar.width||10,$=_.left,C=window.innerWidth-_.right-A,w=M.isTopdown?_.top:window.innerHeight-A-_.bottom,x=[Math.min(C/T,1),Math.min($/T,1),Math.min(w/F*.9)],I=Math.max.apply(Math,x),O=S.style;O.display="block",I==x[0]?(O.left=_.right+1+"px",O.right="",O.maxWidth=T*I+"px",O.top=_.top+"px",O.bottom="",O.maxHeight=Math.min(window.innerHeight-A-_.top,F)+"px"):I==x[1]?(O.right=window.innerWidth-_.left+"px",O.left="",O.maxWidth=T*I+"px",O.top=_.top+"px",O.bottom="",O.maxHeight=Math.min(window.innerHeight-A-_.top,F)+"px"):I==x[2]&&(O.left=window.innerWidth-_.left+"px",O.maxWidth=Math.min(T,window.innerWidth)+"px",M.isTopdown?(O.top=_.bottom+"px",O.left=_.left+"px",O.right="",O.bottom="",O.maxHeight=Math.min(window.innerHeight-A-_.bottom,F)+"px"):(O.top=M.container.offsetTop-S.offsetHeight+"px",O.left=_.left+"px",O.right="",O.bottom="",O.maxHeight=Math.min(M.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),l.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 M=this.completions.filterText.length,_=0;if(g.range&&g.range.start.row===g.range.end.row&&(M-=this.initialPosition.prefix.length,M+=this.initialPosition.pos.column-g.range.start.column,_+=g.range.end.column-this.initialPosition.pos.column),M||_){var T;b.selection.getAllRanges?T=b.selection.getAllRanges():T=[b.getSelectionRange()];for(var F=0,A;A=T[F];F++)A.start.column-=M,A.end.column+=_,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(),M=b.getCursorPosition(),_=p.getCompletionPrefix(b),T=[];this.completers=b.completers;var F=b.completers.length;return b.completers.forEach(function(A,$){A.getCompletions(b,S,M,_,function(C,w){A.hideInlinePreview&&(w=w.map(function(x){return Object.assign(x,{hideInlinePreview:A.hideInlinePreview})})),!C&&w&&(T=T.concat(w)),g(null,{prefix:p.getCompletionPrefix(b),matches:T,finished:--F===0})})}),!0},E.prototype.provideCompletions=function(b,g,S){var M=function(A){var $=A.prefix,C=A.matches;this.completions=new D(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),_=!0,T=null;if(this.gatherCompletions(b,function(A,$){if(this.active){A&&(S(A,[],!0),this.detach());var C=$.prefix;if(C.indexOf($.prefix)===0){if(_){T=$;return}M($)}}}.bind(this)),_=!1,T){var F=T;T=null,M(F)}},E.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(b){typeof b.cancel=="function"&&b.cancel()})},E}(),D=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(M,_){return _.exactMatch-M.exactMatch||_.$score-M.$score||(M.caption||M.value).localeCompare(_.caption||_.value)});var S=null;g=g.filter(function(M){var _=M.snippet||M.caption||M.value;return _===S?!1:(S=_,!0)}),this.filtered=g},E.prototype.filterCompletions=function(b,g){var S=[],M=g.toUpperCase(),_=g.toLowerCase();e:for(var T=0,F;F=b[T];T++){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,w=0,x,I;if(this.exactMatch){if(g!==A.substr(0,g.length))continue e}else{var O=A.toLowerCase().indexOf(_);if(O>-1)w=O;else for(var R=0;R<g.length;R++){var P=A.indexOf(_[R],$+1),B=A.indexOf(M[R],$+1);if(x=P>=0&&(B<0||P<B)?P:B,x<0)continue e;I=x-$-1,I>0&&($===-1&&(w+=10),w+=I,C|=1<<R),$=x}}F.matchMask=C,F.exactMatch=w?0:1,F.$score=(F.score||0)-w,S.push(F)}}return S},E}();u.Autocomplete=m,u.CompletionProvider=y,u.FilteredList=D}),ace.define("ace/marker_group",["require","exports","module"],function(i,u,v){var s=function(){function h(d,o){o&&(this.markerType=o.markerType),this.markers=[],this.session=d,d.addDynamicMarker(this)}return h.prototype.getMarkerAtPosition=function(d){return this.markers.find(function(o){return o.range.contains(d.row,d.column)})},h.prototype.markersComparator=function(d,o){return d.range.start.row-o.range.start.row},h.prototype.setMarkers=function(d){this.markers=d.sort(this.markersComparator).slice(0,this.MAX_MARKERS),this.session._signal("changeBackMarker")},h.prototype.update=function(d,o,p,e){if(!(!this.markers||!this.markers.length))for(var t=e.firstRow,r=e.lastRow,l,a=0,c=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===c?a++:(c=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 D=y.toScreenRange(p);if(D.isEmpty()){l=p.getNextFoldLine(y.end.row,l),l&&l.end.row>y.end.row&&(t=l.end.row);continue}this.markerType==="fullLine"?o.drawFullLineMarker(d,D,m.className,e):D.isMultiLine()?this.markerType==="line"?o.drawMultiLineMarker(d,D,m.className,e):o.drawTextMarker(d,D,m.className,e):o.drawSingleLineMarker(d,D,m.className+" ace_br15",e)}}}},h}();s.prototype.MAX_MARKERS=1e4,u.MarkerGroup=s}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(i,u,v){function s(p,e){var t=p.getTextRange(d.fromPoints({row:0,column:0},e));return t.split(o).length-1}function h(p,e){var t=s(p,e),r=p.getValue().split(o),l=Object.create(null),a=r[t];return r.forEach(function(c,f){if(!(!c||c===a)){var m=Math.abs(t-f),y=r.length-m;l[c]?l[c]=Math.max(y,l[c]):l[c]=y}}),l}var d=i("../range").Range,o=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;u.getCompletions=function(p,e,t,r,l){var a=h(e,t),c=Object.keys(a);l(null,c.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,u,v){var s=i("../snippets").snippetManager,h=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(_,T,F,A,$){if(T.$mode.completer)return T.$mode.completer.getCompletions(_,T,F,A,$);var C=_.session.getState(F.row),w=T.$mode.getCompletions(C,T,F,A);w=w.map(function(x){return x.completerId=r.id,x}),$(null,w)},id:"keywordCompleter"},l=function(_){var T={};return _.replace(/\${(\d+)(:(.*?))?}/g,function(F,A,$,C){return T[A]=C||""}).replace(/\$(\d+?)/g,function(F,A){return T[A]})},a={getCompletions:function(_,T,F,A,$){var C=[],w=T.getTokenAt(F.row,F.column);w&&w.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?C.push("html-tag"):C=s.getActiveScopes(_);var x=s.snippetMap,I=[];C.forEach(function(O){for(var R=x[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(_){_.snippet&&!_.docHTML&&(_.docHTML=["<b>",o.escapeHTML(_.caption),"</b>","<hr></hr>",o.escapeHTML(l(_.snippet))].join(""))},id:"snippetCompleter"},c=[a,t,r];u.setCompleters=function(_){c.length=0,_&&c.push.apply(c,_)},u.addCompleter=function(_){c.push(_)},u.textCompleter=t,u.keyWordCompleter=r,u.snippetCompleter=a;var f={name:"expandSnippet",exec:function(_){return s.expandWithTab(_)},bindKey:"Tab"},m=function(_,T){y(T.session.$mode)},y=function(_){typeof _=="string"&&(_=d.$modes[_]),_&&(s.files||(s.files={}),D(_.$id,_.snippetFileId),_.modes&&_.modes.forEach(y))},D=function(_,T){!T||!_||s.files[_]||(s.files[_]={},d.loadModule(T,function(F){F&&(s.files[_]=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(_){var T=_.editor,F=T.completer&&T.completer.activated;if(_.command.name==="backspace")F&&!p.getCompletionPrefix(T)&&T.completer.detach();else if(_.command.name==="insertstring"&&!F){b=_;var A=_.editor.$liveAutocompletionDelay;A?g.delay(A):S(_)}},b,g=o.delayedCall(function(){S(b)},0),S=function(_){var T=_.editor,F=p.getCompletionPrefix(T),A=_.args,$=p.triggerAutocomplete(T,A);if(F&&F.length>=T.$liveAutocompletionThreshold||$){var C=h.for(T);C.autoShown=!0,C.showPopup(T)}},M=i("../editor").Editor;i("../config").defineOptions(M.prototype,"editor",{enableBasicAutocompletion:{set:function(_){_?(h.for(this),this.completers||(this.completers=Array.isArray(_)?_:c),this.commands.addCommand(h.startCommand)):this.commands.removeCommand(h.startCommand)},value:!1},enableLiveAutocompletion:{set:function(_){_?(this.completers||(this.completers=Array.isArray(_)?_:c),this.commands.on("afterExec",E)):this.commands.off("afterExec",E)},value:!1},liveAutocompletionDelay:{initialValue:0},liveAutocompletionThreshold:{initialValue:0},enableSnippets:{set:function(_){_?(this.commands.addCommand(f),this.on("changeMode",m),m(null,this)):(this.commands.removeCommand(f),this.off("changeMode",m))},value:!1}}),u.MarkerGroup=e}),function(){ace.require(["ace/ext/language_tools"],function(i){L&&(L.exports=i)})}()})(Ia);const Ai={jsonError:{border:"1px solid red",minHeight:200},jsonNoError:{border:"1px solid #00000000",minHeight:200}};function Fa(L){return k.createElement($a,{style:L.error===!0?Ai.jsonError:L.error===!1?Ai.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 On={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,u=K.getValue(n,i)||"{}";this.setState({value:u,initialized:!0,jsonError:this.validateJson(u)})}validateJson(n){let i=!1;if(this.props.schema.validateJson!==!1&&(n||!this.props.schema.allowEmpty))try{this.props.schema.json5?ji.parse(n):JSON.parse(n)}catch(u){console.log("Error in JSON",u),i=!0}return i}renderItem(n,i){if(!this.state.initialized)return null;const{schema:u,data:v,attr:s}=this.props,{value:h,showSelectId:d}=this.state;return k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},k.createElement("div",{style:On.flex},k.createElement(N.Button,{color:"grey",disabled:i,style:On.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},j.I18n.t("ra_JSON editor"))),d?k.createElement(lo,{title:this.getText(u.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,h))},k.createElement("div",{style:{...On.wrapper,border:this.state.jsonError?"2px solid red":"2px solid transparent"}},k.createElement(Fa,{mode:this.props.schema.json5?"json5":"json",value:typeof h=="object"?JSON.stringify(h):h,onChange:o=>this.setState({value:o,jsonError:this.validateJson(o)}),name:"ConfigJsonEditor",themeType:this.props.oContext.themeType}))):null,u.help||this.state.jsonError?k.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 u=(v=this.state.selectOptions)==null?void 0:v.find(h=>h.value===this.state.value||!h.value&&!this.state.value);return k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,disabled:i,value:this.state.value||"_",renderValue:()=>this.getText(u==null?void 0:u.label,this.props.schema.noTranslation),onChange:h=>{let{value:d}=h.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(h=>k.createElement(N.MenuItem,{key:h.value,value:h.value},h.label))),this.props.schema.help?k.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=k.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?k.createElement(N.Dialog,{maxWidth:"lg",open:!0,onClose:(u,v)=>{v!=="escapeKeyDown"&&v!=="backdropClick"&&this.setState({showLicenseDialog:!1})}},k.createElement(N.DialogTitle,null,this.props.schema.title?j.I18n.t(this.props.schema.title):j.I18n.t("ra_License agreement")),k.createElement(N.DialogContent,null,this.props.schema.licenseUrl?k.createElement(k.Fragment,null,this.state.loading?k.createElement(N.LinearProgress,null):null,k.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?k.createElement("div",{ref:this.scrollRef,style:{width:"100%",height:"100%",overflowY:"auto",fontSize:14}},this.props.schema.texts.map((u,v)=>this.props.schema.noTranslation?k.createElement("p",{key:v},u):k.createElement("p",{key:v},j.I18n.t(u)))):null),k.createElement(N.DialogActions,null,this.props.schema.checkBox?k.createElement(N.FormControlLabel,{control:k.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,k.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 u=this.onChange(this.props.attr,!0);u instanceof Promise&&u.catch(v=>console.error(`Cannot set value: ${v}`))},color:"primary",variant:"contained",startIcon:k.createElement(Z.Check,null)},this.props.schema.agreeText?j.I18n.t(this.props.schema.agreeText):j.I18n.t("ra_Accept license")),k.createElement(N.Button,{onClick:()=>{this.setState({showLicenseDialog:!1}),setTimeout(()=>this.setState({showLicenseDialog:!0}),2e3)},color:"grey",variant:"contained",startIcon:k.createElement(Z.Close,null)},j.I18n.t("ra_Close")))):null}}const xi={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 u=K.getValue(n.data,n.attr);return n.oContext.multiEdit&&i._value===K.DIFFERENT_VALUE?{_value:K.DIFFERENT_VALUE}:u==null||i.oldValue===null||i.oldValue===void 0||u.toString()!==parseFloat(i._value).toString()&&u.toString()!==i.oldValue.toString()?{_value:u}: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 u=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),u){const v=K.getValue(this.props.data,this.props.attr),s=(v==null?void 0:v.filter(h=>h||h===0).map(h=>({label:h.toString(),value:h})))||[];return s.unshift({label:j.I18n.t(K.DIFFERENT_LABEL),value:K.DIFFERENT_VALUE}),k.createElement(N.Autocomplete,{style:xi.indeterminate,fullWidth:!0,freeSolo:!0,value:s[0],getOptionSelected:(h,d)=>h.label===d.label,onChange:(h,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:h=>h.label,renderInput:h=>k.createElement(N.TextField,{...h,label:this.getText(this.props.schema.label),variant:"standard",slotProps:{htmlInput:{...h.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))),k.createElement(N.FormControl,{variant:"standard",style:xi.control},k.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,h=this.checkValue(s);h?this.onError(this.props.attr,j.I18n.t(h)):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 u=JSON.parse(i.val);if(new Date(u.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(u=>console.log(`Error occurred: ${u.toString()}`)))}catch(i){console.warn(i)}}onMessage=n=>{var i,u,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=(u=this.props).onError)==null||v.call(u,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 u=this.getIcon();return k.createElement("div",{style:{width:"100%",margin:"0 0 1rem 0"}},k.createElement(N.Button,{disabled:this.state.running,endIcon:u||k.createElement(Z.CloudUpload,null),variant:"contained",onClick:()=>this.onOpenUrl()},i),this.state.blocked?k.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?k.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?k.createElement(k.Fragment,null,k.createElement("div",{style:{width:"100%",margin:"1rem 0 1rem 0"}},k.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")}`,":"),k.createElement("br",null),k.createElement("a",{target:this.props.schema.identifier,href:this.url,rel:"noreferrer"},this.url)),k.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 h=JSON.parse(s);h.access_token&&(h.access_token_expires_on=new Date(Date.now()+(h.expires_in-10)*1e3).toISOString(),this.setState({accessTokens:JSON.stringify(h)},()=>this.saveToken(this.state.accessTokens)))}catch{}},fullWidth:!0})):null)}}const $i={flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class Ha extends K{componentDidMount(){super.componentDidMount();const{data:n,attr:i}=this.props,u=K.getValue(n,i)||"";this.setState({value:u,initialized:!0})}renderItem(n,i){if(!this.state.initialized)return null;const u=this.props.oContext.socket,{schema:v,attr:s}=this.props,{value:h,showSelectId:d}=this.state;return k.createElement(N.FormControl,{fullWidth:!0,variant:"standard"},v.label?k.createElement(N.InputLabel,{shrink:!0},this.getText(v.label)):null,k.createElement("div",{style:$i.flex},k.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:h,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))}}),k.createElement(N.Button,{color:"grey",disabled:i,style:$i.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},"...")),d?k.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:u,selected:h,root:v.root,onClose:()=>this.setState({showSelectId:!1}),onOk:o=>this.setState({showSelectId:!1,value:o},()=>this.onChange(s,o))}):null)}}const Rn={fullWidth:{width:"100%",display:"inline-block"},halfWidth1:{width:"calc(50% - 5px)",display:"inline-block",marginRight:8},halfWidth2:{width:"calc(50% - 5px)",display:"inline-block"}},an="____ppp____";class za extends K{componentDidMount(){super.componentDidMount();const n=K.getValue(this.props.data,this.props.attr);this.setState({_repeat:n?an:"",_visible:!1,value:n?an:"",_notEqual:!1})}onChangePassword(n,i){n===void 0&&(n=this.state.value),i===void 0&&(i=this.state._repeat);const u=!!this.props.schema.repeat&&i!==n;this.setState({value:n,_repeat:i,_notEqual:u},()=>{if(u)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 u=k.createElement(N.TextField,{variant:"standard",fullWidth:!0,type:this.state._visible&&this.state.value!==an?"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!==an&&this.props.schema.visible&&!i&&!this.props.schema.readOnly?k.createElement(N.InputAdornment,{position:"end"},k.createElement(N.IconButton,{size:"large",tabIndex:-1,onClick:v=>{v.preventDefault(),v.stopPropagation(),this.setState({_visible:!this.state._visible})},edge:"end"},this.state._visible?k.createElement(Z.VisibilityOff,null):k.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:k.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 k.createElement("div",{style:Rn.fullWidth},k.createElement("div",{style:Rn.halfWidth1},u),k.createElement("div",{style:Rn.halfWidth2},v))}return u}}class ja extends K{renderItem(n,i){return k.createElement(N.TextField,{variant:"standard",fullWidth:!0,disabled:!!i,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?k.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"))}},k.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(),u=`system.adapter.${this.props.oContext.adapterName}.${this.props.oContext.instance}`,v=await this.props.oContext.socket.getObject(u),s=v==null?void 0:v.common.host,h=[];i.forEach(d=>{var p,e,t,r;if(!d||d._id===u||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 l=parseInt(d.native.leCheckPort||d.native.lePort,10);l&&h.push({name:`${d._id.replace("system.adapter.","")} (LE)`,port:l,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&&h.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:h})}static getDerivedStateFromProps(n,i){const u=K.getValue(n.data,n.attr);return u==null||i.oldValue===null||i.oldValue===void 0||u.toString()!==parseInt(i._value,10).toString()&&u.toString()!==i.oldValue.toString()?{_value:u}:null}checkValue(n){if(n==null)return null;const i=this.props.schema.min===void 0?20:this.props.schema.min,u=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>u?"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 u=this.props.schema.min===void 0?20:this.props.schema.min,v=this.props.schema.max||65535;let s;if(this.state.ports){const h=parseInt(this.state._value,10);if(h){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===h&&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===h&&!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))),k.createElement(N.TextField,{variant:"standard",type:"number",fullWidth:!0,slotProps:{htmlInput:{min:u,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:h=>{const d=Number(h.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 u=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&&u.unshift({label:j.I18n.t(K.NONE_LABEL),value:K.NONE_VALUE}),this.setState({value:n,selectOptions:u})}).catch(i=>console.error(`Cannot get enums: ${i}`))}renderItem(n,i){if(!this.state.selectOptions)return null;const u=this.state.selectOptions.find(v=>v.value===this.state.value);return k.createElement(N.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:this.state.value||"_",renderValue:()=>u?u.obj?k.createElement(j.TextWithIcon,{value:u.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):u.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=>k.createElement(N.MenuItem,{key:v.value,value:v.value,style:v.value===K.DIFFERENT_VALUE?{opacity:.5}:{}},v.obj?k.createElement(j.TextWithIcon,{value:v.obj,themeType:this.props.oContext.themeType,lang:j.I18n.getLanguage()}):v.label))),this.props.schema.help?k.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(u=>{const v=u;Array.isArray(v.items)?(i.push({label:this.getText(u.label,this.props.schema.noTranslation),value:u.value,group:!0,color:u.color}),v.items.forEach(s=>i.push({label:this.getText(s.label,this.props.schema.noTranslation),value:s.value,hidden:s.hidden,color:u.color}))):i.push({label:this.getText(u.label,this.props.schema.noTranslation),value:u.value,hidden:u.hidden,color:u.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 u=(this.state.selectOptions||[]).filter(h=>h.hidden?this.props.custom?!this.executeCustom(h.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(h.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),v=this._getValue(),s=this.props.schema.multiple?null:u.find(h=>h.value==v);return k.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?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,k.createElement(N.Select,{variant:"standard",error:!!n,multiple:this.props.schema.multiple,disabled:!!i,value:v||"_",renderValue:h=>this.props.schema.multiple?k.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:.5}},h.map(d=>{const o=u.find(p=>p.value===d);if(o||this.props.schema.showAllValues!==!1){const p=(o==null?void 0:o.label)||d;return k.createElement(N.Chip,{key:d,label:p})}return null})):s!=null&&s.color?k.createElement("div",{style:{color:s.color}},(s==null?void 0:s.label)===void 0?h:s.label):(s==null?void 0:s.label)===void 0?h:s.label,onChange:h=>{this.setState({value:h.target.value==="_"?"":h.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))})}},u.map((h,d)=>h.group?k.createElement(N.ListSubheader,{key:d,style:{color:h.color}},h.label):k.createElement(N.MenuItem,{key:d,value:h.value,style:h.value===K.DIFFERENT_VALUE?{opacity:.5}:{}},this.props.schema.multiple?k.createElement(N.Checkbox,{checked:v.includes(h.value),onClick:()=>{const o=JSON.parse(JSON.stringify(this._getValue())),p=v.indexOf(h.value);p!==-1?o.splice(p,1):(o.push(h.value),o.sort()),this.setState({value:o},()=>this.onChange(this.props.attr,o))}}):null,k.createElement(N.ListItemText,{primary:h.label,style:{color:h.color}})))),this.props.schema.help?k.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 h;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 u=this._getValue();if(!this.props.alive||!this.state.running&&!((h=this.state.list)!=null&&h.length))return this.props.schema.multiple||this.props.schema.manual===!1?j.I18n.t("ra_Cannot retrieve options, as instance is offline"):k.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:u,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?k.createElement(N.InputAdornment,{position:"end"},k.createElement(N.IconButton,{tabIndex:-1,size:"small",onClick:()=>this.setState({value:""},()=>this.onChange(this.props.attr,""))},k.createElement(Z.Close,null))):null}}});if(this.state.running)return k.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===u);return k.createElement(N.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,k.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:u,renderValue:d=>this.props.schema.multiple?k.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 k.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?k.createElement(N.ListSubheader,{key:o},this.getText(d.label,this.props.schema.noTranslation)):k.createElement(N.MenuItem,{key:o,value:d.value},this.props.schema.multiple?k.createElement(N.Checkbox,{checked:u.includes(d.value),onClick:()=>{const p=JSON.parse(JSON.stringify(this._getValue())),e=u.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,k.createElement(N.ListItemText,{primary:d.label})))),this.props.schema.help?k.createElement(N.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Ti={fullWidth:{width:"100%"}};function ut(L){return L.split(".").reduce((n,i)=>(n<<8)+parseInt(i,10),0)>>>0}function Xa(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 u;return Object.keys(i).forEach(h=>i[h].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]/))?u=d.address:u||(d.family==="IPv4"&&n.includes(".")&&(ut(n)&ut(d.netmask),ut(d.address)&ut(d.netmask)),u=d.address))})),u||Object.keys(i).forEach(h=>i[h].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]/))?u=d.address:u||(d.family==="IPv4"&&n.includes(".")&&(ut(n)&ut(d.netmask),ut(d.address)&ut(d.netmask)),u=d.address))})),u||Object.keys(i).forEach(h=>{i[h].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]/),u=d.address)})}),u||Object.keys(i).forEach(h=>{i[h].forEach(d=>{d.internal||(u=d.address)})}),u}class _i extends K{async componentDidMount(){var i;super.componentDidMount();let n=window.location.hostname;if(this.props.schema.openUrl){const u=await this.props.oContext.socket.getCurrentInstance(),v=await this.props.oContext.socket.getObject(`system.adapter.${u}`);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 h=Xa(s,window.location.hostname);if(h)n=`${h}:${window.location.port}`;else{console.warn(`Cannot find suitable IP in host ${v.common.host} for ${v._id}`);return}}}}await new Promise(u=>{this.setState({_error:"",_message:"",hostname:n},u)}),this.props.schema.onLoaded&&this._onClick()}renderErrorDialog(){return this.state._error?k.createElement(j.DialogError,{text:this.state._error,onClose:()=>this.setState({_error:""})}):null}renderMessageDialog(){return this.state._message?k.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 u=this.props.schema.data;if(u===void 0&&this.props.schema.jsonData){const s=this.getPattern(this.props.schema.jsonData,{_origin:n,_originIp:i,...this.props.data},!0);try{u=JSON.parse(s)}catch{console.error(`Cannot parse json data: ${s}`)}}u===void 0&&(u=null),this.props.schema.openUrl&&!u&&(u={_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",u).then(async s=>{var h,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]);(h=s.args)==null||h.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=k.createElement(Z.Warning,null):n.type==="error"?i=k.createElement(Z.Error,null):n.type==="info"&&(i=k.createElement(Z.Info,null)),k.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:u=>this.setState({confirmDialog:!1},()=>u&&this._onClick())})}renderItem(n,i){const u=this.getIcon();return k.createElement("div",{style:Ti.fullWidth},k.createElement(N.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:{...Ti.fullWidth,...this.props.schema.controlStyle||void 0},disabled:i||!this.props.alive,startIcon:u,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?k.createElement(N.CircularProgress,{size:20,style:{marginRight:8}}):null,this.getText(this.props.schema.label,this.props.schema.noTranslation)),this.renderErrorDialog(),this.renderMessageDialog())}}const Za={fullWidth:{width:"100%"}};class qa extends K{async _onClick(){var u,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);((u=s==null?void 0:s.common)==null?void 0:u.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=k.createElement(Z.Warning,null):n.type==="error"?i=k.createElement(Z.Error,null):n.type==="info"&&(i=k.createElement(Z.Info,null)),k.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:u=>this.setState({confirmDialog:!1},()=>u&&this._onClick())})}renderItem(n,i){const u=this.getIcon();return k.createElement(N.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:Za.fullWidth,disabled:i,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0}):await this._onClick()},startIcon:u||void 0},this.getText(this.props.schema.label,this.props.schema.noTranslation))}}const ki={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 u=K.getValue(n.data,n.attr);return u==null||u.toString()!==parseFloat(i._value).toString()?{_value:u}:null}renderItem(n,i){const u=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):"",h=[{value:u,label:u+s},{value:v,label:v+s}];return k.createElement(N.Box,{style:ki.fullWidth},this.props.schema.label?k.createElement(N.Typography,{gutterBottom:!0},this.getText(this.props.schema.label)):null,k.createElement(N.Slider,{style:ki.slider,value:this.state._value,getAriaValueText:d=>d+s,step:this.props.schema.step||(v-u)/100,valueLabelDisplay:"auto",marks:h,min:u,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?k.createElement(N.Typography,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}function ht(L,n){return L==="edit"||L==="rename"?k.createElement(Z.Edit,{style:n}):L==="delete"?k.createElement(Z.Delete,{style:n}):L==="refresh"?k.createElement(Z.Refresh,{style:n}):L==="newDevice"||L==="new"||L==="add"?k.createElement(Z.Add,{style:n}):L==="discover"||L==="search"?k.createElement(Z.Search,{style:n}):L==="unpairDevice"||L==="unpair"?k.createElement(Z.LinkOff,{style:n}):L==="pairDevice"||L==="pair"?k.createElement(Z.Link,{style:n}):L==="identify"?k.createElement(Z.NotListedLocation,{style:n}):L==="play"?k.createElement(Z.PlayArrow,{style:n}):L==="stop"?k.createElement(Z.Stop,{style:n}):L==="pause"?k.createElement(Z.Pause,{style:n}):L==="forward"||L==="next"?k.createElement(Z.FastForward,{style:n}):L==="rewind"||L==="previous"?k.createElement(Z.FastRewind,{style:n}):L==="lamp"||L==="light"?k.createElement(Z.Lightbulb,{style:n}):L==="backlight"?k.createElement(Z.Fluorescent,{style:n}):L==="dimmer"?k.createElement(Z.WbIncandescent,{style:n}):L==="socket"?k.createElement(Z.Power,{style:n}):L==="settings"?k.createElement(Z.Settings,{style:n}):L==="users"||L==="group"?k.createElement(Z.Group,{style:n}):L==="user"?k.createElement(Z.Person,{style:n}):L==="qrcode"?k.createElement(Z.QrCode,{style:n}):L==="connection"?k.createElement(Z.Wifi,{style:n}):L==="no-connection"?k.createElement(Z.WifiOff,{style:n}):L==="visible"?k.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 u,v;super.componentDidMount();const n=await this.props.oContext.socket.getObject(this.getObjectID());if((u=n==null?void 0:n.common)!=null&&u.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((h,d)=>{s[d.toString()]=h}),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 u=i?i.val:null;this.state.controlType==="button"||this.state.controlType==="switch"?(u=!!u,this.state.stateValue!==u&&this.setState({stateValue:u})):u!==null&&(this.state.controlType==="slider"||this.state.controlType==="number")?(u=parseFloat(u),console.log(`${Date.now()} Received new value: ${u}`),u!==this.state.stateValue?(this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null),this.delayedUpdate.value=u,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()!==u.toString()&&this.setState({stateValue:u})};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,h,d,o;if(!this.state.obj)return null;let u;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);u=k.createElement(N.FormControl,{fullWidth:!0},k.createElement(N.InputLabel,null,"$",this.getText(this.props.schema.label)),k.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?k.createElement("div",{style:{color:e.color}},e.label):t},p.map(t=>k.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=ht(this.props.schema.falseImage));const e=this.getText(this.props.schema.falseText||this.props.schema.label,this.props.schema.noTranslation);!e&&p?u=k.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):u=k.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")u=k.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:8,alignItems:"baseline"}},k.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&&k.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 l;this.props.schema.labelIcon&&(l=k.createElement(j.Icon,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let a;if(e&&l?a=k.createElement("div",{style:{whiteSpace:"nowrap"}},l,e):e?a=k.createElement("div",{style:{whiteSpace:"nowrap"}},e):l&&(a=l),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 c=null;const f=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(c=ht(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=ht(this.props.schema.trueImage,y?{marginRight:8}:void 0)),u=k.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 D=>{D&&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||c||y||m)&&(u=k.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:14}},k.createElement("span",{style:this.props.schema.falseTextStyle},f,c),u,k.createElement("span",{style:this.props.schema.trueTextStyle},m,y))),a&&(u=k.createElement("div",{style:t},a,u))}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==="%")||(h=this.state.obj.common.role)!=null&&h.includes("slider")||(d=this.state.obj.common.role)!=null&&d.includes("dimmer")||(o=this.state.obj.common.role)!=null&&o.includes("blind"))){let c=null;const f=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(c=ht(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=ht(this.props.schema.trueImage,y?{marginRight:8}:void 0));const D=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;u=k.createElement(N.Slider,{style:{width:"100%",flexGrow:1},min:D,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||c||y||m)&&(u=k.createElement("div",{style:{display:"flex",width:"100%",flexGrow:1,alignItems:"center"}},k.createElement("span",{style:{marginRight:16,...this.props.schema.falseTextStyle}},f,c),u,k.createElement("span",{style:{marginLeft:16,...this.props.schema.trueTextStyle}},m,y))),a&&(u=k.createElement("div",{style:t},a,u))}else if(this.state.obj.common.type==="number"&&this.state.obj.common.write&&!this.state.controlType){const c=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;u=k.createElement(N.TextField,{variant:"standard",style:{width:"100%"},value:this.state.stateValue,type:"number",disabled:!!this.props.schema.readOnly||i,slotProps:{htmlInput:{min:c,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 D=parseFloat(this.state.stateValue);await this.props.oContext.socket.setState(this.getObjectID(),D,!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 c=null,f,m;this.state.stateValue?(f=this.getText(this.props.schema.trueText,this.props.schema.noTranslation),this.props.schema.trueImage&&(c=ht(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&&(c=ht(this.props.schema.falseImage,f?{marginLeft:8}:void 0)),m=this.props.schema.falseTextStyle),m=Object.assign(t,m),u=k.createElement("div",{style:m},a,k.createElement(N.Box,{style:{display:"flex",alignItems:"center",gap:8},sx:r,key:this.props.schema.blinkOnUpdate?f:void 0},c,f||(this.state.stateValue?j.I18n.t("ra_true"):j.I18n.t("ra_false"))))}else{const c=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=k.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),u=k.createElement("div",{style:t},a,k.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:4}},k.createElement(N.Box,{sx:r,key:this.props.schema.blinkOnUpdate?y:void 0},m),c?k.createElement("span",{style:{opacity:.7,fontSize:"smaller"}},c):null))}}return u}}const Nn={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 k.createElement(N.Box,{component:"hr",sx:j.Utils.getStyle(this.props.oContext.theme,Nn.fullWidth,this.props.schema.color==="primary"?Nn.primary:this.props.schema.color==="secondary"?Nn.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 k.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}`),k.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 Mi(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 Li(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 Mt={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 u;this.props.schema.size==="normal"?u=16:this.props.schema.size==="large"?u=20:typeof this.props.schema.size=="number"&&(u=this.props.schema.size);const v={width:"100%",height:"100%",display:"flex",alignItems:"center",position:"relative",fontSize:u};this.props.schema.narrow?v.gap=8:v.justifyContent="space-between";let s,h;this.props.schema.data&&typeof this.props.schema.data=="object"&&this.props.schema.data.en?h=this.getText(this.props.schema.data):typeof this.props.schema.data=="object"||this.props.schema.data===void 0||this.props.schema.data===null?h=JSON.stringify(this.props.schema.data):typeof this.props.schema.data=="number"?(h=this.props.schema.data.toString(),this.props.oContext.isFloatComma&&(h=h.replace(".",","))):(!this.props.schema.booleanAsCheckbox||typeof this.props.schema.data!="boolean")&&(h=this.props.schema.data.toString());let d=!1;if(this.props.schema.booleanAsCheckbox&&typeof this.props.schema.data=="boolean")s=k.createElement(N.Checkbox,{checked:!!s,disabled:!0,size:this.props.schema.size==="small"?"small":this.props.schema.size==="large"?"large":void 0});else if(h.startsWith("data:image/"))s=k.createElement("div",{style:{...Mt.value,...Mt.valueImage,...this.props.schema.styleValue||void 0}},k.createElement(j.Icon,{src:h}));else{const t={...Mt.value,...this.props.schema.styleValue||void 0};this.props.schema.html?s=k.createElement("div",{style:t,dangerouslySetInnerHTML:{__html:h}}):Array.isArray(this.props.schema.data)?(d=!0,s=k.createElement("div",{style:t},this.props.schema.data.map((r,l)=>k.createElement("div",{key:l},typeof r=="object"||r===null||r===void 0?JSON.stringify(r):r)))):h.includes(`
|
|
1397
|
+
`)?(d=!0,s=k.createElement("div",{style:t},j.Utils.renderTextWithA(h))):s=k.createElement("div",{style:t},h)}if(this.props.schema.blinkOnUpdate&&this.props.schema.blink){const t=Mi(this.props.oContext.theme,!0,this.props.schema.blinkOnUpdate),r=Li(this.props.oContext.theme,this.props.schema.blink);s=k.createElement(N.Box,{key:h,sx:{...t,...r}},s)}else if(this.props.schema.blinkOnUpdate){const t=Mi(this.props.oContext.theme,!1,this.props.schema.blinkOnUpdate);s=k.createElement(N.Box,{key:h,sx:t},s)}else if(this.props.schema.blink){const t=Li(this.props.oContext.theme,this.props.schema.blink);s=k.createElement(N.Box,{sx:t},s)}this.props.schema.unit&&(s=k.createElement("div",{style:Mt.valueAndUnit},s,k.createElement("div",{style:{...Mt.unit,...this.props.schema.styleUnit||void 0}},this.getText(this.props.schema.unit,this.props.schema.noTranslation))));let o;this.props.schema.labelIcon&&(o=k.createElement(j.Icon,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let p;this.props.schema.copyToClipboard&&(p=k.createElement(Z.ContentCopy,{className:"staticCopyButton",style:{position:"absolute",top:"calc(50% - 12px)",right:0,cursor:"pointer"},onClick:()=>{j.Utils.copyToClipboard(h),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"),k.createElement(N.Box,{component:"div",style:v,sx:e},k.createElement("div",{style:{...Mt.label,...this.props.schema.styleLabel||void 0}},o,i),s,p)}}const Ii={fullWidth:{height:"100%",width:"100%"},link:L=>({textDecoration:"underline",color:L.palette.mode==="dark"?"#4dabf5":"#254e72",cursor:"pointer"})};function Fi(L,n,i){let u,v="";L?L.toString().startsWith("#")||L.toString().startsWith("/")?(u=n||"_self",v=L):L.startsWith("http://")||L.startsWith("https://")?(u=n||"_blank",v=L):(v=`#tab-instances/config/${i}/${L}`,u=n||"_self"):(v=`#tab-instances/config/${i}`,u=n||"_self"),u==="_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,u))}class Oi extends K{renderItem(n,i){if(this.props.schema.button){const v=this.getIcon();return k.createElement(N.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:{...Ii.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}):Fi(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 u=this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation);return u&&(u.includes("<a ")||u.includes("<br")||u.includes("<b>")||u.includes("<i>"))&&(u=j.Utils.renderTextWithA(u)),k.createElement(N.Box,{component:"span",style:{...this.props.schema.controlStyle||void 0},sx:this.props.schema.href?Ii.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}):Fi(v,this.props.schema.target||"_blank",`${this.props.oContext.adapterName}.${this.props.oContext.instance}`))}:null},u)}}const Bn=1024*1024,fe={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 u=[];return Object.keys(L).forEach(v=>{const s={};s[n]=v,i?(s[i]=L[v],u.push(s)):u.push(Object.assign(s,L[v]))}),u}function Ri(L,n,i){n=n||"key";const u={};return L.forEach(v=>{let s=v[n];s==null&&(s=""),delete v[n],i?u[s]=v[i]:u[s]=v}),u}function ul(L,n){let i="";for(let u=0;u<n.length;u++)i+=String.fromCharCode(L[u%L.length].charCodeAt(0)^n.charCodeAt(u));return i}function hl(L,n){let i="";for(let u=0;u<n.length;u++)i+=String.fromCharCode(L[u%L.length].charCodeAt(0)^n.charCodeAt(u));return i}class Ve 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]=pt.createRef())}),this.refDiv=k.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 u=await this.props.oContext.socket.getCompactSystemConfig();this.secret=(u==null?void 0:u.native.secret)||this.secret,n.forEach(v=>{this.props.schema.encryptedAttributes.forEach(s=>{v[s]&&(v[s]=hl(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,u){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 h={items:{[n]:s}};return k.createElement($t,{oContext:this.props.oContext,alive:this.props.alive,arrayIndex:u,changed:this.props.changed,common:this.props.common,expertMode:this.props.expertMode,custom:!0,data:i,globalData:this.props.data,index:u+this.state.iteration,onChange:(o,p)=>{const e=JSON.parse(JSON.stringify(this.state.value));e[u][o]=p,this.setState({value:e},()=>{this.validateUniqueProps(),this.onChangeWrapper(e,!0)})},onError:(o,p)=>this.onError(o,p),originalData:this.props.originalData,schema:h,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,u){return i[u]<n[u]?-1:i[u]>n[u]?1:0}static getComparator(n,i){return n==="desc"?(u,v)=>Ve.descendingComparator(u,v,i):(u,v)=>-Ve.descendingComparator(u,v,i)}static getFilterValue(n){var i,u,v;return(v=(u=(i=n==null?void 0:n.current)==null?void 0:i.children[0])==null?void 0:u.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:u,orderBy:v}=this.state,h=i?u:v===n&&u==="asc"?"desc":"asc",d=this.stableSort(h,n);JSON.stringify(d)!==JSON.stringify(this.state.value)&&this.setState({value:d,order:h,orderBy:n,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,d))};stableSort=(n,i)=>{const{value:u}=this.state,v=Ve.getComparator(n,i),s=u.map((h,d)=>({el:h,index:d}));return s.sort((h,d)=>{const o=v(h.el,d.el);return o!==0?o:h.index-d.index}),s.map(h=>h.el)};renderShowHideFilter(n){return n.filter?k.createElement(N.IconButton,{title:j.I18n.t("ra_Show/hide filter input"),size:"small",onClick:()=>{const i=[...this.state.filterOn],u=this.state.filterOn.indexOf(n.attr);u===-1?i.push(n.attr):i.splice(u,1),this.setState({filterOn:i},()=>{u&&Ve.getFilterValue(this.filterRefs[n.attr])&&(Ve.setFilterValue(this.filterRefs[n.attr],""),this.applyFilter())})}},this.state.filterOn.includes(n.attr)?k.createElement(Z.FilterAltOff,null):k.createElement(Z.FilterAlt,null)):null}renderImportExportButtons(n){return k.createElement(k.Fragment,null,!n.noDelete&&n.import?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Import data from %s file","CSV"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:()=>this.setState({showImportDialog:!0})},k.createElement(Z.UploadFile,null))):null,n.export?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Export data to %s file","CSV"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:()=>this.onExport()},k.createElement(Z.Download,null))):null,n.noDelete?null:k.createElement(N.IconButton,{disabled:!0,size:"small"},k.createElement(Z.Delete,null)))}renderAddButton(n){return k.createElement(N.Tooltip,{title:n?j.I18n.t("ra_Cannot add items with set filter"):j.I18n.t("ra_Add row"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement("span",null,k.createElement(N.IconButton,{size:"small",color:"primary",disabled:!!n&&!this.props.schema.allowAddByFilter,onClick:this.onAdd},k.createElement(Z.Add,null))))}enhancedTableHead(n,i){var h;const{schema:u}=this.props,{order:v,orderBy:s}=this.state;return k.createElement(N.TableHead,null,k.createElement(N.TableRow,null,(h=u.items)==null?void 0:h.map((d,o)=>this.renderOneFilter({schema:u,style:{width:d.width},showAddButton:!o&&!u.noDelete,headCell:d,order:v,orderBy:s,index:o,doAnyFilterSet:i})),!u.noDelete&&k.createElement(N.TableCell,{style:{paddingLeft:20,paddingRight:20,width:n,textAlign:"right"},padding:"checkbox"},this.renderImportExportButtons(u))))}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
|
+
`))}`);const h=new Date;s.setAttribute("download",`${h.getFullYear()}_${(h.getMonth()+1).toString().padStart(2,"0")}_${h.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 h;const i=n.split(`
|
|
1399
|
+
`).map(d=>d.replace("\r","").trim()),{schema:u}=this.props,v=i.shift().split(";").filter(d=>d&&u.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 l=this.props.schema.items.find(a=>a.attr===v[e]);l&&l.type==="number"?r=parseFloat(t):r=t}else r=t;p[v[e]]=r}s.push(p)}),s.length?(h=this.state.value)!=null&&h.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)),u=JSON.parse(JSON.stringify(i[n]));if(typeof this.props.schema.clone=="string"&&typeof u[this.props.schema.clone]=="string"){let v=1,s=u[this.props.schema.clone];const h=s.match(/(\d+)$/);for(h?(s=s.replace(h[0],""),v=parseInt(h[0],10)+1):s+="_";i.find(d=>d[this.props.schema.clone]===s+v.toString());)v++;u[this.props.schema.clone]=`${u[this.props.schema.clone]}_${v}`}i.splice(n,0,u),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((u,v)=>{this.typingTimer=null;let s;if(this.props.schema.encryptedAttributes){const h=JSON.parse(JSON.stringify(u));if(h.forEach(d=>{this.props.schema.encryptedAttributes.forEach(o=>{d[o]&&(d[o]=ul(this.secret,d[o]))})}),this.props.schema.objKeyName){const d=Ri(h,this.props.schema.objKeyName,this.props.schema.objValueName);s=this.onChange(this.props.attr,d)}else s=this.onChange(this.props.attr,h)}else if(this.props.schema.objKeyName){const h=Ri(JSON.parse(JSON.stringify(u)),this.props.schema.objKeyName,this.props.schema.objValueName);s=this.onChange(this.props.attr,h)}else s=this.onChange(this.props.attr,u);s instanceof Promise&&s.catch(h=>console.error(`Cannot save: ${h}`)),v&&(this.applyFilter(!1,u),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)),u=(v=n.items)==null?void 0:v.reduce((s,h)=>{let d;return h.defaultFunc?this.props.custom?d=h.defaultFunc?this.executeCustom(h.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,i.length,this.props.data):this.props.schema.default:d=h.defaultFunc?this.execute(h.defaultFunc,this.props.schema.default,this.props.data,i.length,this.props.data):this.props.schema.default:d=h.default===void 0?null:h.default,s[h.attr]=d,s},{});i.push(u),this.setState({value:i},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))};isAnyFilterSet(){return!!Object.keys(this.filterRefs).find(n=>Ve.getFilterValue(this.filterRefs[n]))}applyFilter=(n,i,u)=>{i=i||this.state.value;let v=i.map((s,h)=>h);if(Object.keys(this.filterRefs).forEach(s=>{let h=Ve.getFilterValue(this.filterRefs[s]);!n&&h?(h=h.toLowerCase(),v=v.filter(d=>i[d]&&i[d][s]&&i[d][s].toLowerCase().includes(h))):this.filterRefs[s].current&&Ve.setFilterValue(this.filterRefs[s],"")}),v.length===i.length&&(v=null),v===null&&this.state.visibleValue===null){u&&u();return}JSON.stringify(v)!==JSON.stringify(this.state.visibleValue)?this.setState({visibleValue:v},()=>u&&u()):u&&u()};onMoveUp(n){const i=JSON.parse(JSON.stringify(this.state.value)),u=i[n];i.splice(n,1),i.splice(n-1,0,u),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)),u=i[n];i.splice(n,1),i.splice(n+1,0,u),this.setState({value:i,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(i)))}onDrop(n){const i=n[0],u=new FileReader;u.onabort=()=>console.log("file reading was aborted"),u.onerror=()=>console.log("file reading has failed"),u.onload=()=>{if(i.size>Bn){window.alert(j.I18n.t("ra_File is too big. Max %sk allowed. Try use SVG.",Math.round(Bn/1024)));return}const v=new Uint8Array(u.result).reduce((s,h)=>s+String.fromCharCode(h),"");this.onImport(v)},u.readAsArrayBuffer(i)}showTypeOfImportDialog(){return this.state.showTypeOfImportDialog?k.createElement(N.Dialog,{open:!0,onClose:()=>this.setState({showTypeOfImportDialog:!1}),maxWidth:"md"},k.createElement(N.DialogTitle,null,j.I18n.t("ra_Append or replace?")),k.createElement(N.DialogContent,null,j.I18n.t("ra_Append %s entries or replace existing?",this.state.showTypeOfImportDialog.length)),k.createElement(N.DialogActions,null,k.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")),k.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?k.createElement(N.Dialog,{open:!0,onClose:()=>this.setState({showImportDialog:!1}),sx:{"& .MuiDialog-paper":{minHeight:500}},maxWidth:"md",fullWidth:!0},k.createElement(N.DialogTitle,null,j.I18n.t("ra_Import from %s","CSV")),k.createElement(N.DialogContent,null,k.createElement(Pi,{multiple:!1,accept:{"text/csv":[".csv"]},maxSize:Bn,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})=>k.createElement("div",{style:{...fe.uploadDiv,...this.state.uploadFile==="dragging"?fe.uploadDivDragging:void 0,...fe.dropZone,...this.state.icon?void 0:fe.dropZoneEmpty},...n()},k.createElement("input",{...i()}),k.createElement("div",{style:fe.uploadCenterDiv},k.createElement("div",{style:fe.uploadCenterTextAndIcon},k.createElement(Z.UploadFile,{style:fe.uploadCenterIcon}),k.createElement("div",{style:fe.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"))))))),k.createElement(N.DialogActions,null,k.createElement(N.Button,{variant:"contained",onClick:()=>this.setState({showImportDialog:!1}),color:"primary",startIcon:k.createElement(Z.Close,null)},j.I18n.t("Cancel")))):null}renderOneFilter(n){return k.createElement(N.TableCell,{key:`${n.headCell.attr}_${n.index}`,style:n.style,align:"left",sortDirection:n.orderBy===n.headCell.attr?n.order:!1},k.createElement("div",{style:{...fe.flex,...n.schema.showFirstAddOnTop?{flexDirection:"column"}:void 0}},n.showAddButton?this.renderAddButton(n.doAnyFilterSet):null,n.headCell.sort&&k.createElement(N.TableSortLabel,{active:!0,style:n.orderBy!==n.headCell.attr?fe.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)?k.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:Ve.getFilterValue(this.filterRefs[n.headCell.attr])&&k.createElement(N.InputAdornment,{position:"end"},k.createElement(N.IconButton,{size:"small",tabIndex:-1,onClick:()=>{Ve.setFilterValue(this.filterRefs[n.headCell.attr],""),this.applyFilter()}},k.createElement(Z.Close,null)))}},fullWidth:!0,placeholder:this.getText(n.headCell.title)}):k.createElement("span",{style:fe.headerText},this.getText(n.headCell.title)),this.renderShowHideFilter(n.headCell)))}enhancedFilterCard(){var h;const{schema:n}=this.props,{order:i,orderBy:u}=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)?k.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}},k.createElement(N.Card,null,k.createElement(N.Paper,{style:fe.paper},k.createElement(N.Accordion,{style:fe.paper},k.createElement(N.AccordionSummary,{expandIcon:k.createElement(Z.ExpandMore,null)},k.createElement(N.Typography,null,j.I18n.t("ra_Filter and Data Actions"))),k.createElement(N.AccordionDetails,null,k.createElement(N.Table,null,k.createElement(N.TableBody,null,((h=n.items)==null?void 0:h.find(d=>d.sort||d.filter))&&n.items.map((d,o)=>k.createElement(N.TableRow,{key:`${d.attr}_${o}`},this.renderOneFilter({schema:n,style:v,showAddButton:!1,headCell:d,order:i,orderBy:u,index:o,doAnyFilterSet:!1}))),s?k.createElement(N.TableRow,null,k.createElement(N.TableCell,{align:"left",style:v},k.createElement("span",{style:fe.headerText},j.I18n.t("ra_Actions"))),k.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 u=this.isAnyFilterSet();return k.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}},k.createElement(N.Card,null,k.createElement(N.Paper,{style:fe.paper},k.createElement(N.Table,null,k.createElement(N.TableBody,null,k.createElement(N.TableRow,null,k.createElement(N.TableCell,{colSpan:n.items.length+1,style:i},this.renderAddButton(u))))))))}renderCards(){const{schema:n}=this.props;let{visibleValue:i}=this.state,u;this.props.schema.compact&&(u={paddingTop:1,paddingBottom:1}),i||=this.state.value.map((s,h)=>h);const v=this.isAnyFilterSet();return k.createElement(N.Grid2,{container:!0},this.showImportDialog(),this.showTypeOfImportDialog(),this.enhancedFilterCard(),i.map((s,h)=>{var d;return k.createElement(N.Grid2,{key:`${s}_${h}`,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}},k.createElement(N.Card,null,k.createElement(N.Paper,{style:fe.paper},k.createElement(N.Table,null,k.createElement(N.TableBody,null,(d=n.items)==null?void 0:d.map(o=>k.createElement(N.TableRow,{key:`${o.attr}_${s}`},k.createElement(N.TableCell,{align:"left",style:u},k.createElement("span",{style:fe.headerText},this.getText(o.title))),k.createElement(N.TableCell,{align:"left",style:u},this.itemTable(o.attr,this.state.value[s],s)))),!n.noDelete&&k.createElement(N.TableRow,null,k.createElement(N.TableCell,{align:"left",style:u},k.createElement("span",{style:fe.headerText},this.getText("Actions"))),k.createElement(N.TableCell,{align:"left",style:u},!v&&!this.state.orderBy?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Move up"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement("span",null,k.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveUp(s),disabled:h===0},k.createElement(Z.ArrowUpward,null)))):null,!v&&!this.state.orderBy?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Move down"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement("span",null,k.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveDown(s),disabled:h===i.length-1},k.createElement(Z.ArrowDownward,null)))):null,k.createElement(N.Tooltip,{title:j.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:this.onDelete(s)},k.createElement(Z.Delete,null))),this.props.schema.clone?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:this.onClone(s)},k.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,h)=>h);const u=this.isAnyFilterSet();let v;return this.props.schema.compact&&(v={paddingTop:1,paddingBottom:1}),k.createElement(N.Paper,{style:fe.paper},this.showImportDialog(),this.showTypeOfImportDialog(),n.label?k.createElement("div",{style:fe.label},k.createElement(N.Toolbar,{variant:"dense",style:fe.rootTool},k.createElement(N.Typography,{style:fe.title,variant:"h6",id:"tableTitle",component:"div"},this.getText(n.label)))):null,k.createElement(N.TableContainer,null,k.createElement(N.Table,{style:fe.table,size:"small"},this.enhancedTableHead(!u&&!this.state.orderBy?120:64,u),k.createElement(N.TableBody,null,i.map((s,h)=>{var d;return k.createElement(N.TableRow,{hover:!0,key:`${s}_${h}`},(d=n.items)==null?void 0:d.map(o=>k.createElement(N.TableCell,{key:`${o.attr}_${s}`,align:"left",style:v},this.itemTable(o.attr,this.state.value[s],s))),!n.noDelete&&k.createElement(N.TableCell,{align:"left",style:{...v,...fe.buttonCell}},!u&&!this.state.orderBy?h?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Move up"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveUp(s)},k.createElement(Z.ArrowUpward,null))):k.createElement("div",{style:fe.buttonEmpty}):null,!u&&!this.state.orderBy?h<i.length-1?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Move down"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:()=>this.onMoveDown(s)},k.createElement(Z.ArrowDownward,null))):k.createElement("div",{style:fe.buttonEmpty}):null,k.createElement(N.Tooltip,{title:j.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:this.onDelete(s)},k.createElement(Z.Delete,null))),this.props.schema.clone?k.createElement(N.Tooltip,{title:j.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:fe.tooltip}}},k.createElement(N.IconButton,{size:"small",onClick:this.onClone(s)},k.createElement(Z.ContentCopy,null))):null))}),!n.noDelete&&i.length>=(n.showSecondAddAt||5)?k.createElement(N.TableRow,null,k.createElement(N.TableCell,{colSpan:n.items.length+1,style:{...v}},this.renderAddButton(u))):null)),!i.length&&this.state.value.length?k.createElement("div",{style:fe.filteredOut},k.createElement(N.Typography,{style:fe.title,variant:"h6",id:"tableTitle",component:"div"},j.I18n.t("ra_All items are filtered out"),k.createElement(N.IconButton,{size:"small",onClick:()=>this.applyFilter(!0)},k.createElement(Z.Close,null)))):null),n.help?k.createElement(N.FormHelperText,{style:{paddingLeft:16}},this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null,this.state.errorMessage?k.createElement("div",{style:{display:"flex",padding:"5px"}},k.createElement(Z.Warning,{color:"error"}),k.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 u;return i&&(n.useCardFor||["xs"]).includes(i)?u=this.renderCards():u=this.renderTable(),k.createElement("div",{ref:this.refDiv,style:{width:"100%"}},u)}}const ln={indeterminate:{opacity:.5},label:{width:"100%",fontSize:14,marginBottom:2},helper:{width:"100%",fontSize:12},error:{width:"100%",fontSize:12,color:"#FF0000"}};class cl 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(u){console.log("Error in JSON",u),i=!0}return i}static getDerivedStateFromProps(n,i){if(n.oContext.multiEdit&&i.value===K.DIFFERENT_VALUE)return{value:K.DIFFERENT_VALUE};let u=K.getValue(n.data,n.attr);return u!=null&&(u=u.toString()),u==null||u!==i.value&&u!==i.oldValue?{value:u}:null}renderItem(n,i){const u=Array.isArray(this.state.value)||this.state.value===K.DIFFERENT_VALUE;if(this.props.schema.time){let h="";return typeof this.state.value=="number"?this.state.value&&this.state.value<9466596e5?h=new Date(this.state.value*1e3).toLocaleString():h=new Date(this.state.value).toLocaleString():typeof this.state.value=="string"&&(h=new Date(this.state.value).toLocaleString()),k.createElement(N.TextField,{variant:"standard",fullWidth:!0,value:h,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),u){const h=K.getValue(this.props.data,this.props.attr),d=(h==null?void 0:h.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}),k.createElement(N.Autocomplete,{style:ln.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=>k.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=k.createElement(N.IconButton,{tabIndex:-1,style:s,size:"small",onClick:()=>{j.Utils.copyToClipboard(this.state.value),window.alert(j.I18n.t("ra_Copied"))}},k.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=k.createElement(N.IconButton,{style:s,size:"small",tabIndex:-1,onClick:()=>this.setState({value:"",oldValue:this.state.value},()=>this.onChange(this.props.attr,""))},k.createElement(Z.Close,null)),this.props.schema.minRows<=1&&(v=k.createElement(N.InputAdornment,{position:"end"},v))),this.props.schema.minRows>1){const h=this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation);return k.createElement("div",{style:{width:"100%",position:"relative"}},this.props.schema.label?k.createElement("div",{style:ln.label},this.getText(this.props.schema.label)):null,k.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)}),h||n||this.state.jsonError?k.createElement("div",{style:n?ln.error:ln.helper},n||(this.state.jsonError?j.I18n.t("ra_Invalid JSON"):h)):null)}return k.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:h=>{const d=h.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 u=i;this.setState({text:u.text||"",style:u.style,icon:u.icon,iconStyle:u.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=ht(this.state.icon,{marginRight:this.state.text?8:void 0,...this.state.iconStyle||void 0}),n||(n=k.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"?k.createElement(N.TextField,{variant:"standard",fullWidth:!0,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?k.createElement(N.IconButton,{tabIndex:-1,size:"small",onClick:()=>{j.Utils.copyToClipboard(this.state.text),window.alert(j.I18n.t("ra_Copied"))}},k.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)}):k.createElement("div",{style:{...pl.fullWidth,...this.state.style||void 0}},n,this.props.schema.container==="html"?k.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 u=this.props.schema.returnFormat!=="HH:mm:ss",v=new Date(Date.parse(`Thu, 01 Jan 1970 ${this.state.value||"00:00:00"}`));return k.createElement(Wi.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 h;h=s instanceof Date?s.toTimeString().split(" ")[0]:s.toTimeString(),u&&(h=h.split(":").slice(0,2).join(":")),this.setState({value:h},()=>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 u=gl(this.props.customObj._id,`${this.props.oContext.adapterName}.${this.props.oContext.instance}`);this.setState({value:u})}else this.setState({value:n||""})}renderItem(n,i){return k.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:u=>{const v=u.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 k.createElement(N.TextField,{variant:"standard",fullWidth:!0,error:!!n,disabled:!!i,slotProps:{htmlInput:{readOnly:!0},input:{endAdornment:k.createElement(N.IconButton,{tabIndex:-1,onClick:()=>{j.Utils.copyToClipboard(this.state.uuid),window.alert(j.I18n.t("ra_Copied %s",this.state.uuid))}},k.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 Ni={icon:{width:16,height:16,marginRight:8}};class yl extends K{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getUsers().then(n=>{const i={},u=j.I18n.getLanguage();this.props.schema.short?n.forEach(v=>{var s,h;return i[v._id]={color:(s=v.common)==null?void 0:s.color,icon:(h=v.common)==null?void 0:h.icon,name:j.Utils.getObjectNameFromObj(v,u)}}):n.forEach(v=>{var s,h;return i[v._id.replace(/^system\.user\./,"")]={color:(s=v.common)==null?void 0:s.color,icon:(h=v.common)==null?void 0:h.icon,name:j.Utils.getObjectNameFromObj(v,u)}}),this.setState({users:i})}).catch(n=>console.error(`Cannot get users: ${n}`))}renderItem(n,i){var v,s;const u=K.getValue(this.props.data,this.props.attr);return k.createElement(N.FormControl,{variant:"standard",fullWidth:!0},this.state.users&&this.props.schema.label?k.createElement(N.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.users?k.createElement(N.Select,{variant:"standard",error:!!n,disabled:!!i,value:u,renderValue:h=>{var d,o,p;return k.createElement("span",null,this.state.users&&((d=this.state.users[h])!=null&&d.icon)?k.createElement(j.Icon,{src:this.state.users&&((o=this.state.users[h])==null?void 0:o.icon),style:Ni.icon}):null,this.state.users&&((p=this.state.users[h])==null?void 0:p.name)||h||"")},style:{color:this.state.users&&((v=this.state.users[u])==null?void 0:v.color)||void 0,backgroundColor:j.Utils.getInvertedColor(this.state.users&&((s=this.state.users[u])==null?void 0:s.color),this.props.oContext.themeType)},onChange:h=>this.onChange(this.props.attr,h.target.value)},this.state.users&&Object.keys(this.state.users).map(h=>k.createElement(N.MenuItem,{style:{color:this.state.users[h].color||void 0,backgroundColor:j.Utils.getInvertedColor(this.state.users[h].color,this.props.oContext.themeType)},key:h,value:h},this.state.users[h].icon?k.createElement(j.Icon,{src:this.state.users[h].icon,style:Ni.icon}):null,this.state.users[h].name))):k.createElement(N.TextField,{variant:"standard",error:!!n,disabled:!!i,value:u,onChange:h=>this.onChange(this.props.attr,h.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?k.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?k.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:ct,chip:fi,chips:fi,color:Ws,coordinates:Hs,cron:Ms,custom:Ut,datePicker:zs,deviceManager:js,divider:il,file:eo,fileSelector:mn,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:Ha,password:za,pattern:ja,port:Ua,qrCode:bl,room:Ga,select:Ja,selectSendTo:Qa,sendto:_i,sendTo:_i,setState:qa,slider:el,state:nl,staticImage:ol,staticInfo:al,staticLink:Oi,staticText:Oi,table:Ve,text:cl,textSendTo:dl,timePicker:fl,topic:ml,uuid:vl,user:yl},Qe={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 $t 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(u=>{if(this.props.oContext.multiEdit&&n[u].noMultiEdit)return null;const v=n[u].type||"panel";let s,h="Use this.props.oContext.socket!";return v==="custom"?(n[u].url?s=Ut:this.props.oContext.customs&&this.props.oContext.customs[n[u].component]?s=this.props.oContext.customs[n[u].component]:(console.error(`Cannot find custom component: ${n[u].component}`),s=K),h=this.props.oContext.socket):v==="panel"?s=$t:s=wl[v]||K,k.createElement(s,{socket:h,globalData:this.props.globalData,oContext:this.props.oContext,key:`${u}_${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:Qe.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[u],attr:u,table:this.props.table})}):null}render(){const n=this.props.schema;if(!n)return null;const{disabled:i,hidden:u}=this.calculate(n),v=this.props.schema.items,s=this.props.schema.style||{};if(u){if(n.hideOnlyControl){const d=k.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?k.createElement(k.Fragment,null,k.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 k.createElement(N.Grid2,{key:`${this.props.attr}_${this.props.index}`,container:!0,style:Qe.fullWidth,columnSpacing:2,rowSpacing:1,sx:s},this.renderItems(v,i));let h;if(n.collapsable)h=k.createElement(N.Accordion,{key:`${this.props.attr}_${this.props.index}`,style:Qe.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})}},k.createElement(N.AccordionSummary,{expandIcon:k.createElement(Z.ExpandMore,null),sx:j.Utils.getStyle(this.props.oContext.theme,s,this.props.oContext.themeType&&n.darkStyle,n.color==="primary"?Qe.primary:n.color==="secondary"&&Qe.secondary,{width:"100%"})},k.createElement(N.Typography,{style:Qe.heading},this.getText(n.label))),k.createElement(N.AccordionDetails,null,k.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&&Qe.paper,this.props.isParentTab&&(this.props.withoutSaveButtons?this.props.withIcons?{height:"calc(100% - 88px) !important"}:{height:"calc(100% - 64px) !important"}:this.props.withIcons?Qe.paperWithIcons:Qe.paperWithoutIcons));h=k.createElement(N.Box,{component:"div",key:`${this.props.attr}_${this.props.index}`,className:this.props.className,sx:d},k.createElement(N.Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:j.Utils.getStyle(this.props.oContext.theme,{width:"100%"},this.props.isParentTab&&Qe.padding,this.props.schema.innerStyle)},this.renderItems(v,i)))}if(!this.props.isParentTab){const d=k.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}},h);return n.newLine?k.createElement(k.Fragment,null,k.createElement("div",{style:{flexBasis:"100%",height:0}}),d):d}return h}}const un={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 u=(window.location.hash||"").replace(/^#/,"").split("/");if(u.length>=3&&u[1]==="config"){const v=u[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=k.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],u=parseInt(i,10);let v;u.toString()===i?u>=0&&u<Object.keys(this.props.schema.items).length&&(v=Object.keys(this.props.schema.items)[u]):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 u=[];Object.keys(n).map(h=>{let d;if(n[h].expertMode&&!this.props.expertMode)return;if(this.props.custom){if(this.executeCustom(n[h].hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData))return;d=this.executeCustom(n[h].disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData)}else{if(this.execute(n[h].hidden,!1,this.props.data,this.props.index,this.props.globalData))return;d=this.execute(n[h].disabled,!1,this.props.data,this.props.index,this.props.globalData)}const o=this.getIcon(n[h].icon);i=i||!!o,u.push({icon:o,disabled:d,label:this.getText(n[h].label),name:h})}),u.find(h=>h.name===this.state.tab)||setTimeout(()=>this.setState({tab:u[0].name}),50);const v=this.getCurrentBreakpoint();let s;return v==="xs"&&u.length>2?s=k.createElement(N.Toolbar,{style:{top:2,backgroundColor:this.props.oContext.themeType==="dark"?"#222":"#DDD"},variant:"dense"},k.createElement(N.IconButton,{onClick:h=>this.setState({openMenu:h.currentTarget})},k.createElement(Z.Menu,null)),this.state.openMenu?k.createElement(N.Menu,{open:!0,anchorEl:this.state.openMenu,onClose:()=>this.setState({openMenu:null})},u.map(h=>k.createElement(N.MenuItem,{disabled:h.disabled,key:h.name,onClick:()=>{this.setState({openMenu:null},()=>this.onMenuChange(h.name))},selected:h.name===this.state.tab},i?k.createElement(N.ListItemIcon,null,h.icon):null,h.label))):null):s=k.createElement(N.Tabs,{variant:"scrollable",scrollButtons:"auto",style:this.props.schema.tabsStyle,value:this.state.tab,onChange:(h,d)=>this.onMenuChange(d)},u.map(h=>k.createElement(N.Tab,{id:h.name,wrapped:!0,disabled:h.disabled,key:h.name,value:h.name,iconPosition:this.props.schema.iconPosition||"start",icon:h.icon,label:h.label}))),k.createElement("div",{style:un.tabs,ref:this.refDiv},s,k.createElement($t,{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:{...un.panel,...i?un.panelWithIcons:un.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 cn extends pt.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,u){if(i===!0||i&&typeof i=="string"){const v=j.I18n.getLanguage(),s=typeof i=="string"?i:"i18n";let h=await n.fileExists(`${u}.admin`,`${s}/${v}.json`),d;if(h?d=`${s}/${v}.json`:(h=await n.fileExists(`${u}.admin`,`${s}/${v}/translations.json`),h?d=`${s}/${v}/translations.json`:v!=="en"&&(h=await n.fileExists(`${u}.admin`,`${s}/en.json`),h?d=`${s}/en.json`:(h=await n.fileExists(`${u}.admin`,`${s}/en/translations.json`),h&&(d=`${s}/en/translations.json`)))),d){const o=await n.readFile(`${u}.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 "${u}.admin/${d}: ${e}`),""}return d}return console.warn(`Cannot find i18n for ${u} / ${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,u,v)=>{if(this.props.onValueChange)this.props.onValueChange(n,i,v),u&&u();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),u&&u()})}else v&&this.props.onChange(null,null,v)};onError=(n,i)=>{this.errorCached=this.errorCached||JSON.parse(JSON.stringify(this.state.errors));const u=this.errorCached;i?u[n]=i:delete u[n],this.errorTimeout&&clearTimeout(this.errorTimeout),JSON.stringify(u)!==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(u=>{i[u]=n.items[u],this.flatten(n.items[u],i)}),i}buildDependencies(n){const i=this.flatten(n);Object.keys(i).forEach(u=>{var v,s,h,d,o,p,e,t,r,l;(v=i[u].confirm)!=null&&v.alsoDependsOn&&((s=i[u].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 c={...i[u],attr:u};c.confirm&&(c.confirm.cancel="Undo"),i[a].confirmDependsOn.push(c)}})),(h=i[u].onChange)!=null&&h.alsoDependsOn&&((d=i[u].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 c={...i[u],attr:u};i[a].onChangeDependsOn.push(c)}})),(o=i[u].hidden)!=null&&o.alsoDependsOn&&((p=i[u].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 c={...i[u],attr:u};i[a].hiddenDependsOn.push(c)}})),(e=i[u].label)!=null&&e.alsoDependsOn&&((t=i[u].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 c={...i[u],attr:u};i[a].labelDependsOn.push(c)}})),(r=i[u].help)!=null&&r.alsoDependsOn&&((l=i[u].help)==null||l.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 c={...i[u],attr:u};i[a].helpDependsOn.push(c)}}))})}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"?k.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,u)=>this.onError(i,u),originalData:JSON.parse(this.state.originalData),root:!0,schema:n,expertMode:this.props.expertMode,themeName:this.props.themeName}):n.type==="panel"||!n.type?k.createElement($t,{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,u)=>this.onError(i,u),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(u=>this.forceUpdateHandlers[u]&&this.forceUpdateHandlers[u](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?k.createElement(N.LinearProgress,null):(this.oContext._themeName!==this.props.themeName&&(this.oContext._themeName=this.props.themeName,setTimeout(()=>this.updateContext(!0),0)),k.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 Et={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 u=0;u<n.length;u++)i+=String.fromCharCode(L[u%L.length].charCodeAt(0)^n.charCodeAt(u));return i}function Dl(L,n){let i="";for(let u=0;u<n.length;u++)i+=String.fromCharCode(L[u%L.length].charCodeAt(0)^n.charCodeAt(u));return i}function Al(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),u=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])}),h=window.CryptoJS.AES.decrypt(s,u,{iv:v});return window.CryptoJS.enc.Utf8.stringify(h)}function xl(L,n,i){if(typeof n!="string")return n;if(!/^[0-9a-f]{48}$/.test(L))return Dl(L,n);let u;u=window.CryptoJS.lib.WordArray.random(128/8);const v=window.CryptoJS.enc.Hex.parse(L),s=window.CryptoJS.AES.encrypt(n,v,{iv:u}).ciphertext;return`$/aes-192-cbc:${window.CryptoJS.enc.Hex.stringify(u)}:${s}`}function Bi(L,n){var i;return document.getElementById(n)?(i=document.getElementById(n))==null?void 0:i.onload:new Promise(u=>{const v=document.createElement("script");v.setAttribute("id",n),v.onload=u,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(u=>cn.loadI18n(this.props.socket,u==null?void 0:u.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:u,data:i.native,common:i.common,hash:pi(JSON.stringify(u)).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 u=new FileReader;u.onload=v=>{if(!v.target)return;const s=v.target.result;try{const h=JSON.parse(s);this.setState({data:h,changed:JSON.stringify(h)!==JSON.stringify(this.state.originalData)})}catch{window.alert(j.I18n.t("[JsonConfig] Failed to parse JSON file"))}},u.readAsText(i)}else window.alert(j.I18n.t("[JsonConfig] Failed to open JSON File"))};getExportImportButtons(){return k.createElement("div",{style:Et.exportImportButtons},k.createElement(N.Tooltip,{title:this.props.t("Import settings from JSON file"),slotProps:{popper:{sx:Et.tooltip}}},k.createElement(N.Fab,{size:"small",sx:{"&.MuiFab-root":Et.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()}},k.createElement(Z.Publish,null))),k.createElement(N.Tooltip,{title:this.props.t("Export setting to JSON file"),slotProps:{popper:{sx:Et.tooltip}}},k.createElement(N.Fab,{size:"small",sx:{"&.MuiFab-root":Et.button},onClick:()=>{this.state.data&&j.Utils.generateFile(`${this.props.adapterName}.${this.props.instance}.json`,this.state.data)}},k.createElement(Z.Publish,{style:{transform:"rotate(180deg)"}}))))}onFileChange=async(n,i,u)=>{var v;if(n===`${this.props.adapterName}.admin`&&u){if(i===this.fileLangSubscribed)try{await cn.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:pi(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 u=await this.props.socket.getSystemConfig();await Bi("../../lib/js/crypto-js/crypto-js.js","crypto-js"),this.secret=u.native.secret}return(n=i.encryptedNative)==null||n.forEach(u=>{i.native[u]&&(i.native[u]=Al(this.secret,i.native[u]))}),i}return i}catch(i){window.alert(`[JsonConfig] Cannot read instance object: ${i}`)}return null}renderDialogConfirm(){return this.state.confirmDialog?k.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 u=Object.keys(n);for(let v=0;v<u.length;v++)n[u[v]]&&typeof n[u[v]]=="object"&&(n[u[v]]=await this.scanForInclude(n[u[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="",h="";if(v.file!==void 0&&(h=v.file),typeof h=="string")s=h;else if(h.type==="Buffer"){let d="";const o=new Uint8Array(h.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(ji.parse(s),i)}catch(d){window.alert("[JsonConfig] Cannot parse json5 config!"),console.log(d)}}catch(u){this.state.schema||window.alert(`[JsonConfig] Cannot read file "${n}: ${u}`)}return null}renderSaveConfigDialog(){return this.state.saveConfigDialog?k.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 u of Object.values(i.items)){const v=this.findAttr(n,u);if(v)return v}}return null}postProcessing(n,i,u){if(u=u||this.state.schema,!n){console.error(`Data is empty in postProcessing: ${i}, ${JSON.stringify(u)}`);return}const v=n[i];if(u.items)if(u.type==="table"){const s=v;if(!Array.isArray(s))return;for(const h of s)for(const d of u.items)this.postProcessing(h,d.attr,d)}else for(const[s,h]of Object.entries(u.items)){if(h.type==="panel"||h.type==="tabs"||h.type==="accordion")return;this.postProcessing(n,s,h)}else if(i&&typeof v=="string")if(u.type==="text")u.trim!==!1&&(n[i]=v.trim());else if(u.type==="ip")n[i]=v.trim();else if(u.type==="number"){const s=parseFloat(v.toString().replace(",","."));u.min!==void 0&&s<u.min?n[i]=u.min:u.max!==void 0&&s>u.max?n[i]=u.max:n[i]=s}else if(u.type==="port"){const s=parseInt(v.toString(),10);u.min!==void 0&&s<u.min?n[i]=u.min:u.max!==void 0&&s>u.max&&(n[i]=u.max),n[i]!==0&&s<20?n[i]=20:s>65535?n[i]=65535:n[i]=s}else u.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 u=await this.getInstanceObject();if(!u){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 h of Object.keys(this.state.data)){const d=this.findAttr(h);(!d||!d.doNotSave||d.type==="state")&&!h.startsWith("_")?K.setValue(u.native,h,this.state.data[h]):(K.setValue(u.native,h,null),v[h]=this.state.data[h])}try{const h=JSON.parse(JSON.stringify(u));if(Array.isArray(h.encryptedNative)){await Bi("../../lib/js/crypto-js/crypto-js.js","crypto-js");for(const d of h.encryptedNative)h.native[d]&&(h.native[d]=xl(this.secret,h.native[d]))}await this.props.socket.setObject(h._id,h)}catch(h){window.alert(`[JsonConfig] Cannot set object: ${h}`)}const s={...u.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?k.createElement(N.LinearProgress,null):k.createElement("div",{style:Et.root},this.renderDialogConfirm(),this.getExportImportButtons(),this.renderSaveConfigDialog(),k.createElement(cn,{key:this.state.hash,style:Et.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,u)=>{u&&this.state.error&&(window.alert(j.I18n.t("Cannot save configuration because of error in configuration")),u=!1),u&&!this.state.changed&&!i&&(u=!1),n?this.setState({data:n,changed:i,saveConfigDialog:u}):u!==void 0&&this.setState({saveConfigDialog:u})},DeviceManager:this.props.DeviceManager,theme:this.state.theme}),k.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,$t as ConfigPanel,$l as JsonConfig,cn as JsonConfigComponent};
|