iobroker.nspanel-lovelace-ui
Version:
NsPanel Lovelace UI is a Firmware for the nextion screen inside of NSPanel in the Design of Lovelace UI Design.
1,399 lines • 1.1 MB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DzsOJdtF.js","./index-DcK0RDrH.js","./_commonjsHelpers-CE1G-McA.js","./AdminComponentEasyAccessSet__loadShare__react__loadShare__-CJmceRyn.js","./AdminComponentEasyAccessSet__mf_v__runtimeInit__mf_v__-9o5tLcPN.js"])))=>i.map(i=>d[i]);
import{R as I,A as Q}from"./AdminComponentEasyAccessSet__loadShare__react__loadShare__-CJmceRyn.js";import{a as Yl,c as ut,g as Jl}from"./_commonjsHelpers-CE1G-McA.js";import{A as P}from"./AdminComponentEasyAccessSet__loadShare___mf_0_mui_mf_1_material__loadShare__-EKOPJIKX.js";import{A as se,I as Ql}from"./_baseIsEqual-BiOdebYq.js";import{A as z,a as Xl}from"./AdminComponentEasyAccessSet__loadShare___mf_0_iobroker_mf_1_adapter_mf_2_react_mf_2_v5__loadShare__-BJiKjF1c.js";import{R as Zl,u as Bt,a as Pn}from"./index-BTwTI1Tk.js";import{F as ql,u as Te,T as Zt,I as Nn,M as Ao,a as To,B as ec,b as ko,c as Ki,v as tc,d as nc,e as ic,f as rc,g as $o,h as Yi,i as Mo,j as Gr,k as sc,P as oc,l as qn,D as ac,L as lc,m as cc,C as uc,n as hc,o as As,p as dc}from"./TextField-C4Ld7RKX.js";import{b as pc,a as Mt,d as fc,r as _o}from"./defaultTheme-B6DpRwGi.js";import{C as mc,D as Io}from"./index-DjRuzpfl.js";import{r as gc,l as vc,i as yc}from"./AdminComponentEasyAccessSet__mf_v__runtimeInit__mf_v__-9o5tLcPN.js";import{_ as J,j as ee,c as qt,g as Fe,a as Re,b as Oe,s as me,d as Me}from"./createSvgIcon-Debf11BA.js";import{_ as bc,f as wc,a as we,T as Cc,u as Ie,b as pn,c as ve,d as rt,G as xc,o as xr,P as Sc,r as Ji}from"./Grow-DnKMqB40.js";import{P as K,p as Kr}from"./index-DcK0RDrH.js";import{u as Lo}from"./useTheme-Y4z6S2UP.js";import{_ as Dc}from"./preload-helper-BDBacUwf.js";import"./GlobalStyles-5ozVpP3B.js";const Ec=Object.freeze(Object.defineProperty({__proto__:null,get ConfigGeneric(){return q},get ConfigPanel(){return wn},get JsonConfig(){return Ib},get JsonConfigComponent(){return Ni}},Symbol.toStringTag,{value:"Module"})),Qi=K.oneOfType([K.func,K.object]);function Ac(h,e){return h.classList?!!e&&h.classList.contains(e):(" "+(h.className.baseVal||h.className)+" ").indexOf(" "+e+" ")!==-1}function Tc(h,e){h.classList?h.classList.add(e):Ac(h,e)||(typeof h.className=="string"?h.className=h.className+" "+e:h.setAttribute("class",(h.className&&h.className.baseVal||"")+" "+e))}function Ts(h,e){return h.replace(new RegExp("(^|\\s)"+e+"(?:\\s|$)","g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function kc(h,e){h.classList?h.classList.remove(e):typeof h.className=="string"?h.className=Ts(h.className,e):h.setAttribute("class",Ts(h.className&&h.className.baseVal||"",e))}var $c=function(e,t){return e&&t&&t.split(" ").forEach(function(n){return Tc(e,n)})},Sr=function(e,t){return e&&t&&t.split(" ").forEach(function(n){return kc(e,n)})},Yr=(function(h){bc(e,h);function e(){for(var n,f=arguments.length,i=new Array(f),o=0;o<f;o++)i[o]=arguments[o];return n=h.call.apply(h,[this].concat(i))||this,n.appliedClasses={appear:{},enter:{},exit:{}},n.onEnter=function(p,s){var u=n.resolveArguments(p,s),r=u[0],a=u[1];n.removeClasses(r,"exit"),n.addClass(r,a?"appear":"enter","base"),n.props.onEnter&&n.props.onEnter(p,s)},n.onEntering=function(p,s){var u=n.resolveArguments(p,s),r=u[0],a=u[1],l=a?"appear":"enter";n.addClass(r,l,"active"),n.props.onEntering&&n.props.onEntering(p,s)},n.onEntered=function(p,s){var u=n.resolveArguments(p,s),r=u[0],a=u[1],l=a?"appear":"enter";n.removeClasses(r,l),n.addClass(r,l,"done"),n.props.onEntered&&n.props.onEntered(p,s)},n.onExit=function(p){var s=n.resolveArguments(p),u=s[0];n.removeClasses(u,"appear"),n.removeClasses(u,"enter"),n.addClass(u,"exit","base"),n.props.onExit&&n.props.onExit(p)},n.onExiting=function(p){var s=n.resolveArguments(p),u=s[0];n.addClass(u,"exit","active"),n.props.onExiting&&n.props.onExiting(p)},n.onExited=function(p){var s=n.resolveArguments(p),u=s[0];n.removeClasses(u,"exit"),n.addClass(u,"exit","done"),n.props.onExited&&n.props.onExited(p)},n.resolveArguments=function(p,s){return n.props.nodeRef?[n.props.nodeRef.current,p]:[p,s]},n.getClassNames=function(p){var s=n.props.classNames,u=typeof s=="string",r=u&&s?s+"-":"",a=u?""+r+p:s[p],l=u?a+"-active":s[p+"Active"],d=u?a+"-done":s[p+"Done"];return{baseClassName:a,activeClassName:l,doneClassName:d}},n}var t=e.prototype;return t.addClass=function(f,i,o){var p=this.getClassNames(i)[o+"ClassName"],s=this.getClassNames("enter"),u=s.doneClassName;i==="appear"&&o==="done"&&u&&(p+=" "+u),o==="active"&&f&&wc(f),p&&(this.appliedClasses[i][o]=p,$c(f,p))},t.removeClasses=function(f,i){var o=this.appliedClasses[i],p=o.base,s=o.active,u=o.done;this.appliedClasses[i]={},p&&Sr(f,p),s&&Sr(f,s),u&&Sr(f,u)},t.render=function(){var f=this.props;f.classNames;var i=we(f,["classNames"]);return I.createElement(Cc,J({},i,{onEnter:this.onEnter,onEntered:this.onEntered,onEntering:this.onEntering,onExit:this.onExit,onExiting:this.onExiting,onExited:this.onExited}))},e})(I.Component);Yr.defaultProps={classNames:""};Yr.propTypes={};var Mc=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,_c=/[\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]/,Ic=/[\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]/,Dr={Space_Separator:Mc,ID_Start:_c,ID_Continue:Ic},Ge={isSpaceSeparator(h){return typeof h=="string"&&Dr.Space_Separator.test(h)},isIdStartChar(h){return typeof h=="string"&&(h>="a"&&h<="z"||h>="A"&&h<="Z"||h==="$"||h==="_"||Dr.ID_Start.test(h))},isIdContinueChar(h){return typeof h=="string"&&(h>="a"&&h<="z"||h>="A"&&h<="Z"||h>="0"&&h<="9"||h==="$"||h==="_"||h===""||h===""||Dr.ID_Continue.test(h))},isDigit(h){return typeof h=="string"&&/[0-9]/.test(h)},isHexDigit(h){return typeof h=="string"&&/[0-9A-Fa-f]/.test(h)}};let Pr,nt,Ot,Bi,Qt,Et,Je,Jr,ti;var Lc=function(e,t){Pr=String(e),nt="start",Ot=[],Bi=0,Qt=1,Et=0,Je=void 0,Jr=void 0,ti=void 0;do Je=Fc(),Pc[nt]();while(Je.type!=="eof");return typeof t=="function"?Nr({"":ti},"",t):ti};function Nr(h,e,t){const n=h[e];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let f=0;f<n.length;f++){const i=String(f),o=Nr(n,i,t);o===void 0?delete n[i]:Object.defineProperty(n,i,{value:o,writable:!0,enumerable:!0,configurable:!0})}else for(const f in n){const i=Nr(n,f,t);i===void 0?delete n[f]:Object.defineProperty(n,f,{value:i,writable:!0,enumerable:!0,configurable:!0})}return t.call(h,e,n)}let Ee,Se,ei,Rt,ke;function Fc(){for(Ee="default",Se="",ei=!1,Rt=1;;){ke=Pt();const h=Fo[Ee]();if(h)return h}}function Pt(){if(Pr[Bi])return String.fromCodePoint(Pr.codePointAt(Bi))}function oe(){const h=Pt();return h===`
`?(Qt++,Et=0):h?Et+=h.length:Et++,h&&(Bi+=h.length),h}const Fo={default(){switch(ke){case" ":case"\v":case"\f":case" ":case" ":case"\uFEFF":case`
`:case"\r":case"\u2028":case"\u2029":oe();return;case"/":oe(),Ee="comment";return;case void 0:return oe(),Ne("eof")}if(Ge.isSpaceSeparator(ke)){oe();return}return Fo[nt]()},comment(){switch(ke){case"*":oe(),Ee="multiLineComment";return;case"/":oe(),Ee="singleLineComment";return}throw Be(oe())},multiLineComment(){switch(ke){case"*":oe(),Ee="multiLineCommentAsterisk";return;case void 0:throw Be(oe())}oe()},multiLineCommentAsterisk(){switch(ke){case"*":oe();return;case"/":oe(),Ee="default";return;case void 0:throw Be(oe())}oe(),Ee="multiLineComment"},singleLineComment(){switch(ke){case`
`:case"\r":case"\u2028":case"\u2029":oe(),Ee="default";return;case void 0:return oe(),Ne("eof")}oe()},value(){switch(ke){case"{":case"[":return Ne("punctuator",oe());case"n":return oe(),on("ull"),Ne("null",null);case"t":return oe(),on("rue"),Ne("boolean",!0);case"f":return oe(),on("alse"),Ne("boolean",!1);case"-":case"+":oe()==="-"&&(Rt=-1),Ee="sign";return;case".":Se=oe(),Ee="decimalPointLeading";return;case"0":Se=oe(),Ee="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Se=oe(),Ee="decimalInteger";return;case"I":return oe(),on("nfinity"),Ne("numeric",1/0);case"N":return oe(),on("aN"),Ne("numeric",NaN);case'"':case"'":ei=oe()==='"',Se="",Ee="string";return}throw Be(oe())},identifierNameStartEscape(){if(ke!=="u")throw Be(oe());oe();const h=Br();switch(h){case"$":case"_":break;default:if(!Ge.isIdStartChar(h))throw ks();break}Se+=h,Ee="identifierName"},identifierName(){switch(ke){case"$":case"_":case"":case"":Se+=oe();return;case"\\":oe(),Ee="identifierNameEscape";return}if(Ge.isIdContinueChar(ke)){Se+=oe();return}return Ne("identifier",Se)},identifierNameEscape(){if(ke!=="u")throw Be(oe());oe();const h=Br();switch(h){case"$":case"_":case"":case"":break;default:if(!Ge.isIdContinueChar(h))throw ks();break}Se+=h,Ee="identifierName"},sign(){switch(ke){case".":Se=oe(),Ee="decimalPointLeading";return;case"0":Se=oe(),Ee="zero";return;case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":Se=oe(),Ee="decimalInteger";return;case"I":return oe(),on("nfinity"),Ne("numeric",Rt*(1/0));case"N":return oe(),on("aN"),Ne("numeric",NaN)}throw Be(oe())},zero(){switch(ke){case".":Se+=oe(),Ee="decimalPoint";return;case"e":case"E":Se+=oe(),Ee="decimalExponent";return;case"x":case"X":Se+=oe(),Ee="hexadecimal";return}return Ne("numeric",Rt*0)},decimalInteger(){switch(ke){case".":Se+=oe(),Ee="decimalPoint";return;case"e":case"E":Se+=oe(),Ee="decimalExponent";return}if(Ge.isDigit(ke)){Se+=oe();return}return Ne("numeric",Rt*Number(Se))},decimalPointLeading(){if(Ge.isDigit(ke)){Se+=oe(),Ee="decimalFraction";return}throw Be(oe())},decimalPoint(){switch(ke){case"e":case"E":Se+=oe(),Ee="decimalExponent";return}if(Ge.isDigit(ke)){Se+=oe(),Ee="decimalFraction";return}return Ne("numeric",Rt*Number(Se))},decimalFraction(){switch(ke){case"e":case"E":Se+=oe(),Ee="decimalExponent";return}if(Ge.isDigit(ke)){Se+=oe();return}return Ne("numeric",Rt*Number(Se))},decimalExponent(){switch(ke){case"+":case"-":Se+=oe(),Ee="decimalExponentSign";return}if(Ge.isDigit(ke)){Se+=oe(),Ee="decimalExponentInteger";return}throw Be(oe())},decimalExponentSign(){if(Ge.isDigit(ke)){Se+=oe(),Ee="decimalExponentInteger";return}throw Be(oe())},decimalExponentInteger(){if(Ge.isDigit(ke)){Se+=oe();return}return Ne("numeric",Rt*Number(Se))},hexadecimal(){if(Ge.isHexDigit(ke)){Se+=oe(),Ee="hexadecimalInteger";return}throw Be(oe())},hexadecimalInteger(){if(Ge.isHexDigit(ke)){Se+=oe();return}return Ne("numeric",Rt*Number(Se))},string(){switch(ke){case"\\":oe(),Se+=Rc();return;case'"':if(ei)return oe(),Ne("string",Se);Se+=oe();return;case"'":if(!ei)return oe(),Ne("string",Se);Se+=oe();return;case`
`:case"\r":throw Be(oe());case"\u2028":case"\u2029":Nc(ke);break;case void 0:throw Be(oe())}Se+=oe()},start(){switch(ke){case"{":case"[":return Ne("punctuator",oe())}Ee="value"},beforePropertyName(){switch(ke){case"$":case"_":Se=oe(),Ee="identifierName";return;case"\\":oe(),Ee="identifierNameStartEscape";return;case"}":return Ne("punctuator",oe());case'"':case"'":ei=oe()==='"',Ee="string";return}if(Ge.isIdStartChar(ke)){Se+=oe(),Ee="identifierName";return}throw Be(oe())},afterPropertyName(){if(ke===":")return Ne("punctuator",oe());throw Be(oe())},beforePropertyValue(){Ee="value"},afterPropertyValue(){switch(ke){case",":case"}":return Ne("punctuator",oe())}throw Be(oe())},beforeArrayValue(){if(ke==="]")return Ne("punctuator",oe());Ee="value"},afterArrayValue(){switch(ke){case",":case"]":return Ne("punctuator",oe())}throw Be(oe())},end(){throw Be(oe())}};function Ne(h,e){return{type:h,value:e,line:Qt,column:Et}}function on(h){for(const e of h){if(Pt()!==e)throw Be(oe());oe()}}function Rc(){switch(Pt()){case"b":return oe(),"\b";case"f":return oe(),"\f";case"n":return oe(),`
`;case"r":return oe(),"\r";case"t":return oe()," ";case"v":return oe(),"\v";case"0":if(oe(),Ge.isDigit(Pt()))throw Be(oe());return"\0";case"x":return oe(),Oc();case"u":return oe(),Br();case`
`:case"\u2028":case"\u2029":return oe(),"";case"\r":return oe(),Pt()===`
`&&oe(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":throw Be(oe());case void 0:throw Be(oe())}return oe()}function Oc(){let h="",e=Pt();if(!Ge.isHexDigit(e)||(h+=oe(),e=Pt(),!Ge.isHexDigit(e)))throw Be(oe());return h+=oe(),String.fromCodePoint(parseInt(h,16))}function Br(){let h="",e=4;for(;e-- >0;){const t=Pt();if(!Ge.isHexDigit(t))throw Be(oe());h+=oe()}return String.fromCodePoint(parseInt(h,16))}const Pc={start(){if(Je.type==="eof")throw an();Er()},beforePropertyName(){switch(Je.type){case"identifier":case"string":Jr=Je.value,nt="afterPropertyName";return;case"punctuator":Ti();return;case"eof":throw an()}},afterPropertyName(){if(Je.type==="eof")throw an();nt="beforePropertyValue"},beforePropertyValue(){if(Je.type==="eof")throw an();Er()},beforeArrayValue(){if(Je.type==="eof")throw an();if(Je.type==="punctuator"&&Je.value==="]"){Ti();return}Er()},afterPropertyValue(){if(Je.type==="eof")throw an();switch(Je.value){case",":nt="beforePropertyName";return;case"}":Ti()}},afterArrayValue(){if(Je.type==="eof")throw an();switch(Je.value){case",":nt="beforeArrayValue";return;case"]":Ti()}},end(){}};function Er(){let h;switch(Je.type){case"punctuator":switch(Je.value){case"{":h={};break;case"[":h=[];break}break;case"null":case"boolean":case"numeric":case"string":h=Je.value;break}if(ti===void 0)ti=h;else{const e=Ot[Ot.length-1];Array.isArray(e)?e.push(h):Object.defineProperty(e,Jr,{value:h,writable:!0,enumerable:!0,configurable:!0})}if(h!==null&&typeof h=="object")Ot.push(h),Array.isArray(h)?nt="beforeArrayValue":nt="beforePropertyName";else{const e=Ot[Ot.length-1];e==null?nt="end":Array.isArray(e)?nt="afterArrayValue":nt="afterPropertyValue"}}function Ti(){Ot.pop();const h=Ot[Ot.length-1];h==null?nt="end":Array.isArray(h)?nt="afterArrayValue":nt="afterPropertyValue"}function Be(h){return Vi(h===void 0?`JSON5: invalid end of input at ${Qt}:${Et}`:`JSON5: invalid character '${Ro(h)}' at ${Qt}:${Et}`)}function an(){return Vi(`JSON5: invalid end of input at ${Qt}:${Et}`)}function ks(){return Et-=5,Vi(`JSON5: invalid identifier character at ${Qt}:${Et}`)}function Nc(h){console.warn(`JSON5: '${Ro(h)}' in strings is not valid ECMAScript; consider escaping`)}function Ro(h){const e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[h])return e[h];if(h<" "){const t=h.charCodeAt(0).toString(16);return"\\x"+("00"+t).substring(t.length)}return h}function Vi(h){const e=new SyntaxError(h);return e.lineNumber=Qt,e.columnNumber=Et,e}var Bc=function(e,t,n){const f=[];let i="",o,p,s="",u;if(t!=null&&typeof t=="object"&&!Array.isArray(t)&&(n=t.space,u=t.quote,t=t.replacer),typeof t=="function")p=t;else if(Array.isArray(t)){o=[];for(const m of t){let g;typeof m=="string"?g=m:(typeof m=="number"||m instanceof String||m instanceof Number)&&(g=String(m)),g!==void 0&&o.indexOf(g)<0&&o.push(g)}}return n instanceof Number?n=Number(n):n instanceof String&&(n=String(n)),typeof n=="number"?n>0&&(n=Math.min(10,Math.floor(n)),s=" ".substr(0,n)):typeof n=="string"&&(s=n.substr(0,10)),r("",{"":e});function r(m,g){let v=g[m];switch(v!=null&&(typeof v.toJSON5=="function"?v=v.toJSON5(m):typeof v.toJSON=="function"&&(v=v.toJSON(m))),p&&(v=p.call(g,m,v)),v instanceof Number?v=Number(v):v instanceof String?v=String(v):v instanceof Boolean&&(v=v.valueOf()),v){case null:return"null";case!0:return"true";case!1:return"false"}if(typeof v=="string")return a(v);if(typeof v=="number")return String(v);if(typeof v=="object")return Array.isArray(v)?c(v):l(v)}function a(m){const g={"'":.1,'"':.2},v={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let b="";for(let S=0;S<m.length;S++){const w=m[S];switch(w){case"'":case'"':g[w]++,b+=w;continue;case"\0":if(Ge.isDigit(m[S+1])){b+="\\x00";continue}}if(v[w]){b+=v[w];continue}if(w<" "){let y=w.charCodeAt(0).toString(16);b+="\\x"+("00"+y).substring(y.length);continue}b+=w}const E=u||Object.keys(g).reduce((S,w)=>g[S]<g[w]?S:w);return b=b.replace(new RegExp(E,"g"),v[E]),E+b+E}function l(m){if(f.indexOf(m)>=0)throw TypeError("Converting circular structure to JSON5");f.push(m);let g=i;i=i+s;let v=o||Object.keys(m),b=[];for(const S of v){const w=r(S,m);if(w!==void 0){let y=d(S)+":";s!==""&&(y+=" "),y+=w,b.push(y)}}let E;if(b.length===0)E="{}";else{let S;if(s==="")S=b.join(","),E="{"+S+"}";else{let w=`,
`+i;S=b.join(w),E=`{
`+i+S+`,
`+g+"}"}}return f.pop(),i=g,E}function d(m){if(m.length===0)return a(m);const g=String.fromCodePoint(m.codePointAt(0));if(!Ge.isIdStartChar(g))return a(m);for(let v=g.length;v<m.length;v++)if(!Ge.isIdContinueChar(String.fromCodePoint(m.codePointAt(v))))return a(m);return m}function c(m){if(f.indexOf(m)>=0)throw TypeError("Converting circular structure to JSON5");f.push(m);let g=i;i=i+s;let v=[];for(let E=0;E<m.length;E++){const S=r(String(E),m);v.push(S!==void 0?S:"null")}let b;if(v.length===0)b="[]";else if(s==="")b="["+v.join(",")+"]";else{let E=`,
`+i,S=v.join(E);b=`[
`+i+S+`,
`+g+"]"}return f.pop(),i=g,b}};const Vc={parse:Lc,stringify:Bc};var Oo=Vc,Qr={exports:{}};function Wc(h){throw new Error('Could not dynamically require "'+h+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Pi={exports:{}};const jc={},Hc=Object.freeze(Object.defineProperty({__proto__:null,default:jc},Symbol.toStringTag,{value:"Module"})),zc=Yl(Hc);var Uc=Pi.exports,$s;function Gc(){return $s||($s=1,(function(h,e){(function(t,n){h.exports=n()})(Uc,function(){var t=t||(function(n,f){var i;if(typeof window<"u"&&window.crypto&&(i=window.crypto),typeof self<"u"&&self.crypto&&(i=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window<"u"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof ut<"u"&&ut.crypto&&(i=ut.crypto),!i&&typeof Wc=="function")try{i=zc}catch{}var o=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},p=Object.create||(function(){function b(){}return function(E){var S;return b.prototype=E,S=new b,b.prototype=null,S}})(),s={},u=s.lib={},r=u.Base=(function(){return{extend:function(b){var E=p(this);return b&&E.mixIn(b),(!E.hasOwnProperty("init")||this.init===E.init)&&(E.init=function(){E.$super.init.apply(this,arguments)}),E.init.prototype=E,E.$super=this,E},create:function(){var b=this.extend();return b.init.apply(b,arguments),b},init:function(){},mixIn:function(b){for(var E in b)b.hasOwnProperty(E)&&(this[E]=b[E]);b.hasOwnProperty("toString")&&(this.toString=b.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),a=u.WordArray=r.extend({init:function(b,E){b=this.words=b||[],E!=f?this.sigBytes=E:this.sigBytes=b.length*4},toString:function(b){return(b||d).stringify(this)},concat:function(b){var E=this.words,S=b.words,w=this.sigBytes,y=b.sigBytes;if(this.clamp(),w%4)for(var D=0;D<y;D++){var $=S[D>>>2]>>>24-D%4*8&255;E[w+D>>>2]|=$<<24-(w+D)%4*8}else for(var A=0;A<y;A+=4)E[w+A>>>2]=S[A>>>2];return this.sigBytes+=y,this},clamp:function(){var b=this.words,E=this.sigBytes;b[E>>>2]&=4294967295<<32-E%4*8,b.length=n.ceil(E/4)},clone:function(){var b=r.clone.call(this);return b.words=this.words.slice(0),b},random:function(b){for(var E=[],S=0;S<b;S+=4)E.push(o());return new a.init(E,b)}}),l=s.enc={},d=l.Hex={stringify:function(b){for(var E=b.words,S=b.sigBytes,w=[],y=0;y<S;y++){var D=E[y>>>2]>>>24-y%4*8&255;w.push((D>>>4).toString(16)),w.push((D&15).toString(16))}return w.join("")},parse:function(b){for(var E=b.length,S=[],w=0;w<E;w+=2)S[w>>>3]|=parseInt(b.substr(w,2),16)<<24-w%8*4;return new a.init(S,E/2)}},c=l.Latin1={stringify:function(b){for(var E=b.words,S=b.sigBytes,w=[],y=0;y<S;y++){var D=E[y>>>2]>>>24-y%4*8&255;w.push(String.fromCharCode(D))}return w.join("")},parse:function(b){for(var E=b.length,S=[],w=0;w<E;w++)S[w>>>2]|=(b.charCodeAt(w)&255)<<24-w%4*8;return new a.init(S,E)}},m=l.Utf8={stringify:function(b){try{return decodeURIComponent(escape(c.stringify(b)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(b){return c.parse(unescape(encodeURIComponent(b)))}},g=u.BufferedBlockAlgorithm=r.extend({reset:function(){this._data=new a.init,this._nDataBytes=0},_append:function(b){typeof b=="string"&&(b=m.parse(b)),this._data.concat(b),this._nDataBytes+=b.sigBytes},_process:function(b){var E,S=this._data,w=S.words,y=S.sigBytes,D=this.blockSize,$=D*4,A=y/$;b?A=n.ceil(A):A=n.max((A|0)-this._minBufferSize,0);var _=A*D,L=n.min(_*4,y);if(_){for(var T=0;T<_;T+=D)this._doProcessBlock(w,T);E=w.splice(0,_),S.sigBytes-=L}return new a.init(E,L)},clone:function(){var b=r.clone.call(this);return b._data=this._data.clone(),b},_minBufferSize:0});u.Hasher=g.extend({cfg:r.extend(),init:function(b){this.cfg=this.cfg.extend(b),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(b){return this._append(b),this._process(),this},finalize:function(b){b&&this._append(b);var E=this._doFinalize();return E},blockSize:16,_createHelper:function(b){return function(E,S){return new b.init(S).finalize(E)}},_createHmacHelper:function(b){return function(E,S){return new v.HMAC.init(b,S).finalize(E)}}});var v=s.algo={};return s})(Math);return t})})(Pi)),Pi.exports}var Kc=Qr.exports;(function(h,e){(function(t,n){h.exports=n(Gc())})(Kc,function(t){return(function(n){var f=t,i=f.lib,o=i.WordArray,p=i.Hasher,s=f.algo,u=[];(function(){for(var m=0;m<64;m++)u[m]=n.abs(n.sin(m+1))*4294967296|0})();var r=s.MD5=p.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(m,g){for(var v=0;v<16;v++){var b=g+v,E=m[b];m[b]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360}var S=this._hash.words,w=m[g+0],y=m[g+1],D=m[g+2],$=m[g+3],A=m[g+4],_=m[g+5],L=m[g+6],T=m[g+7],k=m[g+8],x=m[g+9],C=m[g+10],M=m[g+11],F=m[g+12],R=m[g+13],O=m[g+14],B=m[g+15],N=S[0],j=S[1],V=S[2],W=S[3];N=a(N,j,V,W,w,7,u[0]),W=a(W,N,j,V,y,12,u[1]),V=a(V,W,N,j,D,17,u[2]),j=a(j,V,W,N,$,22,u[3]),N=a(N,j,V,W,A,7,u[4]),W=a(W,N,j,V,_,12,u[5]),V=a(V,W,N,j,L,17,u[6]),j=a(j,V,W,N,T,22,u[7]),N=a(N,j,V,W,k,7,u[8]),W=a(W,N,j,V,x,12,u[9]),V=a(V,W,N,j,C,17,u[10]),j=a(j,V,W,N,M,22,u[11]),N=a(N,j,V,W,F,7,u[12]),W=a(W,N,j,V,R,12,u[13]),V=a(V,W,N,j,O,17,u[14]),j=a(j,V,W,N,B,22,u[15]),N=l(N,j,V,W,y,5,u[16]),W=l(W,N,j,V,L,9,u[17]),V=l(V,W,N,j,M,14,u[18]),j=l(j,V,W,N,w,20,u[19]),N=l(N,j,V,W,_,5,u[20]),W=l(W,N,j,V,C,9,u[21]),V=l(V,W,N,j,B,14,u[22]),j=l(j,V,W,N,A,20,u[23]),N=l(N,j,V,W,x,5,u[24]),W=l(W,N,j,V,O,9,u[25]),V=l(V,W,N,j,$,14,u[26]),j=l(j,V,W,N,k,20,u[27]),N=l(N,j,V,W,R,5,u[28]),W=l(W,N,j,V,D,9,u[29]),V=l(V,W,N,j,T,14,u[30]),j=l(j,V,W,N,F,20,u[31]),N=d(N,j,V,W,_,4,u[32]),W=d(W,N,j,V,k,11,u[33]),V=d(V,W,N,j,M,16,u[34]),j=d(j,V,W,N,O,23,u[35]),N=d(N,j,V,W,y,4,u[36]),W=d(W,N,j,V,A,11,u[37]),V=d(V,W,N,j,T,16,u[38]),j=d(j,V,W,N,C,23,u[39]),N=d(N,j,V,W,R,4,u[40]),W=d(W,N,j,V,w,11,u[41]),V=d(V,W,N,j,$,16,u[42]),j=d(j,V,W,N,L,23,u[43]),N=d(N,j,V,W,x,4,u[44]),W=d(W,N,j,V,F,11,u[45]),V=d(V,W,N,j,B,16,u[46]),j=d(j,V,W,N,D,23,u[47]),N=c(N,j,V,W,w,6,u[48]),W=c(W,N,j,V,T,10,u[49]),V=c(V,W,N,j,O,15,u[50]),j=c(j,V,W,N,_,21,u[51]),N=c(N,j,V,W,F,6,u[52]),W=c(W,N,j,V,$,10,u[53]),V=c(V,W,N,j,C,15,u[54]),j=c(j,V,W,N,y,21,u[55]),N=c(N,j,V,W,k,6,u[56]),W=c(W,N,j,V,B,10,u[57]),V=c(V,W,N,j,L,15,u[58]),j=c(j,V,W,N,R,21,u[59]),N=c(N,j,V,W,A,6,u[60]),W=c(W,N,j,V,M,10,u[61]),V=c(V,W,N,j,D,15,u[62]),j=c(j,V,W,N,x,21,u[63]),S[0]=S[0]+N|0,S[1]=S[1]+j|0,S[2]=S[2]+V|0,S[3]=S[3]+W|0},_doFinalize:function(){var m=this._data,g=m.words,v=this._nDataBytes*8,b=m.sigBytes*8;g[b>>>5]|=128<<24-b%32;var E=n.floor(v/4294967296),S=v;g[(b+64>>>9<<4)+15]=(E<<8|E>>>24)&16711935|(E<<24|E>>>8)&4278255360,g[(b+64>>>9<<4)+14]=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360,m.sigBytes=(g.length+1)*4,this._process();for(var w=this._hash,y=w.words,D=0;D<4;D++){var $=y[D];y[D]=($<<8|$>>>24)&16711935|($<<24|$>>>8)&4278255360}return w},clone:function(){var m=p.clone.call(this);return m._hash=this._hash.clone(),m}});function a(m,g,v,b,E,S,w){var y=m+(g&v|~g&b)+E+w;return(y<<S|y>>>32-S)+g}function l(m,g,v,b,E,S,w){var y=m+(g&b|v&~b)+E+w;return(y<<S|y>>>32-S)+g}function d(m,g,v,b,E,S,w){var y=m+(g^v^b)+E+w;return(y<<S|y>>>32-S)+g}function c(m,g,v,b,E,S,w){var y=m+(v^(g|~b))+E+w;return(y<<S|y>>>32-S)+g}f.MD5=p._createHelper(r),f.HmacMD5=p._createHmacHelper(r)})(Math),t.MD5})})(Qr);var Yc=Qr.exports;const Ms=Jl(Yc),Jc=window.innerWidth<=600?12:void 0;function Ar(h){return Object.prototype.toString.call(h)==="[object Object]"}class q extends Q.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(e){super(e),this.state={confirmDialog:!1,confirmNewValue:null,confirmAttr:null,confirmData:null,confirmCallback:null},this.isError={},e.schema&&(e.custom?this.defaultValue=e.schema.defaultFunc?this.executeCustom(e.schema.defaultFunc,e.data,e.customObj,e.oContext.instanceObj,e.arrayIndex,e.globalData):e.schema.default:e.schema.type!=="state"&&(this.defaultValue=e.schema.defaultFunc?this.execute(e.schema.defaultFunc,e.schema.default,e.data,e.arrayIndex,e.globalData):e.schema.default)),this.lang=z.I18n.getLanguage()}componentDidMount(){this.props.oContext.registerOnForceUpdate&&this.props.oContext.registerOnForceUpdate(this.props.attr,this.onUpdate);const e=["select","autocomplete","autocompleteSendTo"];if(this.defaultValue!==void 0){const t=q.getValue(this.props.data,this.props.attr);(t===void 0||e.includes(this.props.schema.type)&&(t===""||t===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)):(q.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 e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);try{e=JSON.parse(t)}catch{console.error(`Cannot parse json data: ${t}`)}}else e={attr:this.props.attr,value:q.getValue(this.props.data,this.props.attr)};e===void 0&&(e=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.defaultSendTo,e).then(t=>{t!=null&&(this.props.custom?this.props.onChange(this.props.attr,t,()=>this.props.oContext.forceUpdate([this.props.attr],this.props.data)):(q.setValue(this.props.data,this.props.attr,t),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,z.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=e=>{const t=q.getValue(e||this.props.data,this.props.attr)||"";this.state.value!==t?this.setState({value:t}):this.forceUpdate()};static getValue(e,t){if(typeof t=="string")return q.getValue(e,t.split("."));if(t.length===1)return e[t[0]];const n=t.shift();if(typeof n=="string"&&typeof e[n]=="object")return q.getValue(e[n],t)}static setValue(e,t,n){if(typeof t=="string"){q.setValue(e,t.split("."),n);return}if(t.length===1)n===null?delete e[t[0]]:e[t[0]]=n;else{const f=t.shift();if(typeof f!="string")return;(!e[f]||typeof e[f]=="object")&&(e[f]=e[f]||{}),q.setValue(e[f],t,n)}}getText(e,t){if(!e)return"";if(typeof e=="string"){const n=t?e:z.I18n.t(e);return n.includes("${")?this.getPattern(n,null,t):n}return Ar(e)?e.func?typeof e.func=="object"?this.getPattern(e.func[this.lang]||e.func.en||"",null,!0):this.getPattern(e.func,null,t):e[this.lang]||e.en||"":e.toString()}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const e=this.state.confirmData||this.props.schema.confirm;let t=null;return e.type==="warning"?t=I.createElement(se.Warning,null):e.type==="error"?t=I.createElement(se.Error,null):e.type==="info"&&(t=I.createElement(se.Info,null)),I.createElement(z.DialogConfirm,{title:this.getText(e.title)||z.I18n.t("ra_Please confirm"),text:this.getText(e.text),ok:this.getText(e.ok)||z.I18n.t("ra_Ok"),cancel:this.getText(e.cancel)||z.I18n.t("ra_Cancel"),icon:t||void 0,onClose:n=>this.setState({confirmDialog:!1},()=>{if(n){if(this.state.confirmCallback){const i=this.state.confirmCallback;this.setState({confirmCallback:null},()=>i(!0));return}const f=JSON.parse(JSON.stringify(this.props.data));this.state.confirmDepAttr&&q.setValue(f,this.state.confirmDepAttr,this.state.confirmDepNewValue),q.setValue(f,this.state.confirmAttr,this.state.confirmNewValue),this.setState({confirmDialog:!1,confirmDepAttr:null,confirmDepNewValue:null,confirmNewValue:null,confirmAttr:null,confirmData:null},()=>this.props.onChange(f))}else{const f=this.state.confirmCallback;this.setState({confirmDialog:!1,confirmDepAttr:null,confirmDepNewValue:null,confirmNewValue:null,confirmAttr:null,confirmData:null,confirmCallback:null},()=>{f&&f(!1)})}})})}getIcon(e){e=e||this.props.schema.icon;let t=null;return e==="auth"?t=I.createElement(se.Key,null):e==="send"?t=I.createElement(se.Send,null):e==="web"?t=I.createElement(se.Public,null):e==="warning"?t=I.createElement(se.Warning,null):e==="error"?t=I.createElement(se.Error,null):e==="info"?t=I.createElement(se.Info,null):e==="search"?t=I.createElement(se.Search,null):e==="book"?t=I.createElement(se.MenuBook,null):e==="help"?t=I.createElement(se.Help,null):e==="upload"?t=I.createElement(se.UploadFile,null):e==="edit"?t=I.createElement(se.Edit,null):e==="user"?t=I.createElement(se.Person,null):e==="group"?t=I.createElement(se.Group,null):e==="delete"?t=I.createElement(se.Delete,null):e==="refresh"?t=I.createElement(se.Refresh,null):e==="add"?t=I.createElement(se.Add,null):e==="unpair"?t=I.createElement(se.LinkOff,null):e==="pair"?t=I.createElement(se.Link,null):e==="save"?t=I.createElement(se.Save,null):e==="open"?t=I.createElement(se.OpenInNew,null):e&&((e.endsWith(".png")||e.endsWith(".svg")||e.endsWith(".jpg"))&&!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`./adapter/${this.props.oContext.adapterName}/${e}`),t=I.createElement(z.Icon,{src:e,style:{width:22,height:22}})),t}onChangeAsync(e,t){return new Promise(n=>{const f=this.onChange(e,t,n);f instanceof Promise&&f.catch(i=>console.error(`Cannot set value: ${i}`))})}onChange(e,t,n){const f=JSON.parse(JSON.stringify(this.props.data));if(q.setValue(f,e,t),this.props.schema.confirm&&this.execute(this.props.schema.confirm.condition,!1,f,this.props.arrayIndex,this.props.globalData))return new Promise(o=>{this.setState({confirmDialog:!0,confirmNewValue:t,confirmAttr:e,confirmData:null},()=>{typeof n=="function"?n():o()})});if(this.props.schema.confirmDependsOn)for(let o=0;o<this.props.schema.confirmDependsOn.length;o++){const p=this.props.schema.confirmDependsOn[o];if(p.confirm){const s=q.getValue(f,p.attr);if(this.execute(p.confirm.condition,!1,f,this.props.arrayIndex,this.props.globalData))return new Promise(u=>{this.setState({confirmDialog:!0,confirmNewValue:t,confirmAttr:e,confirmDepNewValue:s,confirmDepAttr:p.attr,confirmData:p.confirm},()=>{typeof n=="function"?n():u()})})}}const i=[];if(this.props.schema.onChangeDependsOn)for(let o=0;o<this.props.schema.onChangeDependsOn.length;o++){const p=this.props.schema.onChangeDependsOn[o];if(p.onChange){const s=q.getValue(f,p.attr);let u;this.props.custom?u=this.executeCustom(p.onChange.calculateFunc,f,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):u=this.execute(p.onChange.calculateFunc,s,f,this.props.arrayIndex,this.props.globalData),u!==s&&(q.setValue(f,p.attr,u),i.push(p.attr))}}if(this.props.schema.hiddenDependsOn)for(let o=0;o<this.props.schema.hiddenDependsOn.length;o++){const p=this.props.schema.hiddenDependsOn[o];p.hidden&&i.push(p.attr)}if(this.props.schema.labelDependsOn)for(let o=0;o<this.props.schema.labelDependsOn.length;o++){const p=this.props.schema.labelDependsOn[o];p.hidden&&i.push(p.attr)}if(this.props.schema.helpDependsOn)for(let o=0;o<this.props.schema.helpDependsOn.length;o++){const p=this.props.schema.helpDependsOn[o];p.hidden&&i.push(p.attr)}if(this.props.schema.onChange&&!this.props.schema.onChange.ignoreOwnChanges){const o=q.getValue(f,this.props.attr),p=this.props.custom?this.executeCustom(this.props.schema.onChange.calculateFunc,f,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):this.execute(this.props.schema.onChange.calculateFunc,o,f,this.props.arrayIndex,this.props.globalData);p!==o&&q.setValue(f,this.props.attr,p)}return this.props.custom?(this.props.onChange(e,t,()=>n&&n()),i!=null&&i.length&&i.forEach((o,p)=>setTimeout(()=>this.props.onChange(o,q.getValue(f,o)),p*50))):this.props.onChange(f,void 0,()=>{i.length&&this.props.oContext.forceUpdate(i,f),n&&n()}),Promise.resolve()}execute(e,t,n,f,i){let o;if(Ar(e))o=e.func;else if(typeof e=="string")o=e;else return e;if(!o)return t;try{return new Function("data","originalData","_system","_alive","_common","_socket","_instance","arrayIndex","globalData","_changed",o.includes("return")?o:`return ${o}`)(n||this.props.data,this.props.originalData,this.props.oContext.systemConfig,this.props.alive,this.props.common,this.props.oContext.socket,this.props.oContext.instance,f,i,this.props.changed)}catch(p){return console.error(`Cannot execute ${JSON.stringify(e)}: ${p}`),t}}executeCustom(e,t,n,f,i,o){let p;if(Ar(e))p=e.func;else if(typeof e=="string")p=e;else return e;if(!p)return null;try{return new Function("data","originalData","_system","instanceObj","customObj","_socket","arrayIndex","globalData","_changed",p.includes("return")?p:`return ${p}`)(t||this.props.data,this.props.originalData,this.props.oContext.systemConfig,f,n,this.props.oContext.socket,i,o,this.props.changed)}catch(s){return console.error(`Cannot execute ${p}: ${s}`),null}}calculate(e){let t,n,f,i;return this.props.custom?(t=e.validator?!this.executeCustom(e.validator,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,e.disabled===!0?n=!0:n=e.disabled?this.executeCustom(e.disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,e.hidden===!0?f=!0:f=e.hidden?this.executeCustom(e.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!1,i=e.defaultFunc?this.executeCustom(e.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):e.default):(t=e.validator?!this.execute(e.validator,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,e.disabled===!0?n=!0:n=e.disabled?this.execute(e.disabled,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,e.hidden===!0?f=!0:f=e.hidden?this.execute(e.hidden,!1,this.props.data,this.props.arrayIndex,this.props.globalData):!1,i=e.defaultFunc?this.execute(e.defaultFunc,e.default,this.props.data,this.props.arrayIndex,this.props.globalData):e.default),{error:t,disabled:n,hidden:f,defaultValue:i}}onError(e,t){t?this.isError[e]=t:delete this.isError[e],this.props.onError&&this.props.onError(e,t)}renderItem(e,t,n){return this.getText(this.props.schema.label)||this.getText(this.props.schema.text)}renderHelp(e,t,n){return t?I.createElement("a",{href:t,target:"_blank",rel:"noreferrer",style:{color:this.props.oContext.themeType==="dark"?"#a147ff":"#5b238f",textDecoration:"underline"}},this.getText(e,n)):(e=this.getText(e,n)||"",e&&(e.includes("<a ")||e.includes("<br")||e.includes("<b>")||e.includes("<i>"))?z.Utils.renderTextWithA(e):e)}static escapeString(e,t){return typeof e!="string"?"":(e=e.replace(/`/g,"\\`"),e=e.replace(/\${([^}]+)}/g,(n,f)=>{if(f&&typeof f=="string"&&f.startsWith("data.")){const i=q.getValue(t,f.replace(/^data\./,""));if(typeof i=="string"&&(i.includes("\\")||i.includes('"')))return`\${${f}.replace(/\\\\/g, '\\\\\\\\').replace(/"/g, '\\\\"')}`}return n}),e)}getPattern(e,t,n){if(t=t||this.props.data,!e)return"";let f;typeof e=="object"?e.func?f=e.func:(console.log(`Object must be stringified: ${JSON.stringify(e)}`),f=JSON.stringify(e)):f=e;try{if(this.props.custom)return new Function("data","originalData","arrayIndex","globalData","_system","instanceObj","customObj","_socket","_changed",`return \`${q.escapeString(f,t)}\``)(t,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 o=new Function("data","originalData","arrayIndex","globalData","_system","_alive","_common","_socket","_changed",`return \`${q.escapeString(f,t)}\``)(t,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 n?o:z.I18n.t(o)}catch(i){return console.error(`Cannot execute ${f}: ${i}`),f}}render(){const e=this.props.schema;if(!e||this.props.expertMode===!1&&e.expertMode)return null;this.props.alive&&this.defaultSendToDone===!1&&(this.sendToTimeout=setTimeout(()=>{this.sendToTimeout=null,this.sendTo()},200));const{error:t,disabled:n,hidden:f,defaultValue:i}=this.calculate(e);if(f){if(Object.keys(this.isError).length&&(setTimeout(s=>Object.keys(s).forEach(u=>this.props.onError(u)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}),e.hideOnlyControl){const s=I.createElement(P.Grid2,{size:{xs:e.xs||Jc,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0},style:{marginBottom:0,textAlign:"left",...e.style,...this.props.oContext.themeType==="dark"?e.darkStyle:{}}});return e.newLine?I.createElement(I.Fragment,null,I.createElement("div",{style:{flexBasis:"100%",height:0}}),s):s}return null}e.validatorNoSaveOnError&&(t&&!Object.keys(this.isError).length?(this.isError={[this.props.attr]:e.validatorErrorText?z.I18n.t(e.validatorErrorText):!0},setTimeout(s=>Object.keys(s).forEach(u=>this.props.onError(u,s[u])),100,JSON.parse(JSON.stringify(this.isError)))):!t&&Object.keys(this.isError).length&&(setTimeout(s=>Object.keys(s).forEach(u=>this.props.onError(u)),100,JSON.parse(JSON.stringify(this.isError))),this.isError={}));const o=this.renderItem(t,n||this.props.commandRunning||this.props.disabled,i);if(this.noPlaceRequired)return o;const p=I.createElement(P.Grid2,{title:this.getText(e.tooltip),size:{xs:e.xs||12,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0},style:{marginBottom:0,textAlign:"left",width:e.type==="divider"||e.type==="header"?e.width||"100%":void 0,...e.style,...this.props.oContext.themeType==="dark"?e.darkStyle:{}}},this.props.schema.defaultSendTo&&this.props.schema.button?I.createElement(P.Grid2,{container:!0,style:{width:"100%"}},I.createElement(P.Grid2,{flex:1},o),I.createElement(P.Grid2,null,I.createElement(P.Button,{disabled:n,variant:"outlined",onClick:()=>this.sendTo(),title:this.props.schema.buttonTooltip?this.getText(this.props.schema.buttonTooltip,this.props.schema.buttonTooltipNoTranslation):z.I18n.t("ra_Request data by instance")},this.getText(this.props.schema.button)))):o);return e.newLine?I.createElement(I.Fragment,null,I.createElement("div",{style:{flexBasis:"100%",height:0}}),this.renderDialogConfirm(),p):this.state.confirmDialog?I.createElement(I.Fragment,null,this.renderDialogConfirm(),p):p}}const wt={fullWidth:{width:"100%"},accordionSummary:h=>({backgroundColor:h.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)"}),accordionTitle:{},toolbar:h=>({backgroundColor:h.palette.mode==="dark"?"rgba(255, 255, 255, 0.08)":"rgba(0, 0, 0, 0.08)",borderRadius:"3px"}),tooltip:{pointerEvents:"none"}};class Qc extends q{typingTimer=null;constructor(e){super(e),this.props.schema.items=this.props.schema.items||[]}componentDidMount(){super.componentDidMount();let e=q.getValue(this.props.data,this.props.attr)||[];Array.isArray(e)||(e=[]),this.setState({value:e,activeIndex:-1,iteration:0,accordionErrors:{}})}componentWillUnmount(){this.typingTimer&&(clearTimeout(this.typingTimer),this.typingTimer=null),super.componentWillUnmount()}onAccordionError=e=>(t,n)=>{const f={...this.state.accordionErrors};f[e]||(f[e]={}),n?f[e][t]=n:(delete f[e][t],Object.keys(f[e]).length===0&&delete f[e]),this.setState({accordionErrors:f}),this.props.onError(t,n)};hasAccordionErrors=e=>!!(this.state.accordionErrors[e]&&Object.keys(this.state.accordionErrors[e]).length>0);itemAccordion(e,t){const{value:n}=this.state,{schema:f}=this.props,i={type:"panel",items:f.items.reduce((o,p)=>(o[p.attr]=p,o),{}),style:{marginLeft:"-8px",marginTop:"10px",marginBottom:"10px"}};return I.createElement(wn,{oContext:this.props.oContext,index:t+this.state.iteration,arrayIndex:t,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:e,custom:!0,schema:i,originalData:this.props.originalData,onChange:(o,p)=>{const s=JSON.parse(JSON.stringify(n));s[t][o]=p,this.setState({value:s},()=>this.onChangeWrapper(s))},onError:this.onAccordionError(t),table:this.props.table})}onDelete=e=>()=>{const t=JSON.parse(JSON.stringify(this.state.value));t.splice(e,1),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))};onClone=e=>()=>{const t=JSON.parse(JSON.stringify(this.state.value)),n=JSON.parse(JSON.stringify(t[e]));if(typeof this.props.schema.clone=="string"&&typeof n[this.props.schema.clone]=="string"){let f=1,i=n[this.props.schema.clone];const o=i.match(/(\d+)$/);for(o?(i=i.replace(o[0],""),f=parseInt(o[0],10)+1):i+="_";t.find(p=>p[this.props.schema.clone]===i+f.toString());)f++;n[this.props.schema.clone]=`${n[this.props.schema.clone]}_${f}`}t.splice(e,0,n),this.setState({value:t,activeIndex:-1,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))};onChangeWrapper=e=>{this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout(t=>{this.typingTimer=null;const n=this.onChange(this.props.attr,t);n instanceof Promise&&n.catch(f=>this.onError(f))},300,e)};onAdd=()=>{const{schema:e}=this.props,t=JSON.parse(JSON.stringify(this.state.value)),n=e.items&&e.items.reduce((f,i)=>{let o;return i.defaultFunc?this.props.custom?o=i.defaultFunc?this.executeCustom(i.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,t.length,this.props.data):this.props.schema.default:o=i.defaultFunc?this.execute(i.defaultFunc,this.props.schema.default,this.props.data,t.length,this.props.data):this.props.schema.default:o=i.default===void 0?null:i.default,f[i.attr]=o,f},{});t.push(n),this.setState({value:t,activeIndex:t.length-1},()=>this.onChangeWrapper(t))};onMoveUp(e){const t=JSON.parse(JSON.stringify(this.state.value)),n=t[e];t.splice(e,1),t.splice(e-1,0,n);const f=this.state.activeIndex-1;this.setState({value:t,activeIndex:f,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))}onMoveDown(e){const t=JSON.parse(JSON.stringify(this.state.value)),n=t[e];t.splice(e,1),t.splice(e+1,0,n);const f=this.state.activeIndex+1;this.setState({value:t,activeIndex:f,iteration:this.state.iteration+1e4},()=>this.onChangeWrapper(t))}onExport=()=>{const{value:e}=this.state,t=JSON.stringify(e,null,2),n=`data:application/json;charset=utf-8,${encodeURIComponent(t)}`,f=`config_section_${new Date().toISOString().slice(0,19).replace(/:/g,"-")}.json`,i=document.createElement("a");i.setAttribute("href",n),i.setAttribute("download",f),i.click()};onImport=e=>{const t=document.createElement("input");t.type="file",t.accept=".json",t.onchange=n=>{var o;const f=(o=n.target.files)==null?void 0:o[0];if(!f)return;const i=new FileReader;i.onload=p=>{var s;try{const u=JSON.parse((s=p.target)==null?void 0:s.result);if(!Array.isArray(u)){alert(z.I18n.t("ra_Invalid JSON format. Expected an array."));return}let r;e?r=u:r=[...this.state.value,...u],this.setState({value:r,activeIndex:-1},()=>this.onChangeWrapper(r))}catch{alert(z.I18n.t("ra_Invalid JSON file."))}},i.readAsText(f)},t.click()};renderItem(){const{schema:e}=this.props,{value:t}=this.state;return t?I.createElement(P.Paper,null,e.label||!e.noDelete?I.createElement(P.Toolbar,{variant:"dense"},e.label?I.createElement(P.Typography,{variant:"h6",id:"tableTitle",component:"div"},this.getText(e.label)):null,e.noDelete?null:I.createElement(I.Fragment,null,I.createElement(P.Tooltip,{title:z.I18n.t("ra_Export configuration section")},I.createElement(P.IconButton,{size:"small",color:"primary",onClick:this.onExport},I.createElement(se.FileDownload,null))),I.createElement(P.Tooltip,{title:z.I18n.t("ra_Import and replace configuration section")},I.createElement(P.IconButton,{size:"small",color:"primary",onClick:()=>this.onImport(!0)},I.createElement(se.FileUpload,null))),I.createElement(P.Tooltip,{title:z.I18n.t("ra_Import and add configuration section")},I.createElement(P.IconButton,{size:"small",color:"primary",onClick:()=>this.onImport(!1)},I.createElement(se.AddCircle,null))),I.createElement(P.IconButton,{size:"small",color:"primary",onClick:this.onAdd},I.createElement(se.Add,null)))):null,t.map((n,f)=>I.createElement(P.Accordion,{key:`${n}_${f}`,expanded:this.state.activeIndex===f,onChange:(i,o)=>this.setState({activeIndex:o?f:-1})},I.createElement(P.AccordionSummary,{expandIcon:I.createElement(se.ExpandMore,null),sx:z.Utils.getStyle(this.props.oContext.theme,wt.fullWidth,wt.accordionSummary)},I.createElement(P.Box,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%"}},I.createElement(P.Typography,{style:wt.accordionTitle},n[e.titleAttr]),this.hasAccordionErrors(f)&&I.createElement(se.Error,{sx:{fontSize:20,color:"error.main"}}))),I.createElement(P.AccordionDetails,{style:{...e.style,...this.props.oContext.themeType?e.darkStyle:void 0}},this.itemAccordion(t[f],f),I.createElement(P.Toolbar,{sx:wt.toolbar},f?I.createElement(P.Tooltip,{title:z.I18n.t("ra_Move up"),slotProps:{popper:{sx:wt.tooltip}}},I.createElement(P.IconButton,{size:"small",onClick:()=>this.onMoveUp(f)},I.createElement(se.ArrowUpward,null))):I.createElement("div",{style:wt.buttonEmpty}),f<t.length-1?I.createElement(P.Tooltip,{title:z.I18n.t("ra_Move down"),slotProps:{popper:{sx:wt.tooltip}}},I.createElement(P.IconButton,{size:"small",onClick:()=>this.onMoveDown(f)},I.createElement(se.ArrowDownward,null))):I.createElement("div",{style:wt.buttonEmpty}),e.noDelete?null:I.createElement(P.Tooltip,{title:z.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:wt.tooltip}}},I.createElement(P.IconButton,{size:"small",onClick:this.onDelete(f)},I.createElement(se.Delete,null))),e.clone?I.createElement(P.Tooltip,{title:z.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:wt.tooltip}}},I.createElement(P.IconButton,{size:"small",onClick:this.onClone(f)},I.createElement(se.ContentCopy,null))):null)))),!e.noDelete&&t.length>0?I.createElement(P.Toolbar,{variant:"dense",sx:wt.rootTool},I.createElement(P.IconButton,{size:"small",color:"primary",onClick:this.onAdd},I.createElement(se.Add,null))):null,e.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null):null}}const _s={root:{width:"100%"},notAlive:{color:"#a30000"}};class Xc extends q{componentDidMount(){super.componentDidMount();const e=this.getInstance();this.props.oContext.socket.getState(`${e}.alive`).then(t=>this.setState({alive:!!(t&&t.val),instance:e}))}getInstance(){let e=this.props.schema.instance||`${this.props.oContext.adapterName}.${this.props.oContext.instance}`;return e.includes("${")&&(e=this.getPattern(e,null,!0)),e&&!e.startsWith("system.adapter.")&&(e=`system.adapter.${e}`),e}renderItem(){if(this.getInstance()!==this.state.instance&&setTimeout(()=>{const t=this.getInstance();t?this.props.oContext.socket.getState(`${t}.alive`).then(n=>this.setState({alive:!!(n&&n.val),instance:t})):this.setState({alive:null,instance:t})},200),this.state.alive!==!1&&this.state.alive!==!0)return null;const e=this.state.instance.replace(/^system.adapter./,"");return I.createElement("div",{style:{..._s.root,...this.state.alive?void 0:_s.notAlive}},this.state.alive?this.props.schema.textAlive!==void 0?this.props.schema.textAlive?z.I18n.t(this.props.schema.textAlive,e):"":z.I18n.t("ra_Instance %s is alive",e):this.props.schema.textNotAlive!==void 0?this.props.schema.textNotAlive?z.I18n.t(this.props.schema.textNotAlive,e):"":z.I18n.t("ra_Instance %s is not alive",e))}}class Zc extends q{componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr),t=this.props.schema.options.map(n=>typeof n=="string"?{label:n,value:n}:JSON.parse(JSON.stringify(n)));Array.isArray(e)?(t.unshift({label:z.I18n.t(q.DIFFERENT_LABEL),value:q.DIFFERENT_VALUE}),this.setState({value:q.DIFFERENT_VALUE,selectOptions:t})):this.setState({value:e,selectOptions:t})}renderItem(e,t){if(!this.state.selectOptions)return null;let n;const f=JSON.parse(JSON.stringify(this.state.selectOptions));return Array.isArray(this.state.value)||this.state.value===q.DIFFERENT_VALUE?([...this.state.value].filter(o=>!f.find(p=>typeof p=="object"?p.value===o:p===o)).forEach(o=>f.push({label:o.toString(),value:o})),n={label:z.I18n.t(q.DIFFERENT_LABEL),value:q.DIFFERENT_VALUE},f.unshift(n)):(n=this.state.value!==null&&this.state.value!==void 0&&f.find(o=>typeof o=="object"?o.value==this.state.value:o==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!n&&this.props.schema.freeSolo&&(n={value:this.state.value,label:this.state.value},f.push(n))),I.createElement(P.Autocomplete,{fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,value:n,options:f,isOptionEqualToValue:(o,p)=>o.value===p.value,filterOptions:(o,p)=>{const s=o.filter(u=>p.inputValue===""?!0:u.label.toLowerCase().includes(p.inputValue.toLowerCase())||u.value.toLowerCase().includes(p.inputValue.toLowerCase()));return this.props.schema.freeSolo&&p.inputValue!==""&&s.push({label:p.inputValue,value:p.inputValue}),s},onInputChange:o=>{if(!o||!this.props.schema.freeSolo)return;const p=o.target.value;p!==this.state.value&&this.setState({value:p},()=>this.onChange(this.props.attr,p))},onChange:(o,p)=>{const s=typeof p=="object"?p?p.value:"":p;s!==this.state.value&&this.setState({value:s},()=>this.onChange(this.props.attr,s))},getOptionLabel:o=>typeof o=="object"?(o==null?void 0:o.label)??"":"",renderInput:o=>I.createElement(P.TextField,{variant:"standard",...o,error:!!e,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:t})})}}class qc extends q{initialized=!1;localContext;askInstance(){const e=q.getValue(this.props.data,this.props.attr),t=this.props.schema.options?this.props.schema.options.map(n=>typeof n=="string"?{label:n,value:n}:JSON.parse(JSON.stringify(n))):[];if(this.props.alive){let n=this.props.schema.data;if(n===void 0&&this.props.schema.jsonData){const f=this.getPattern(this.props.schema.jsonData,null,!0);try{typeof f=="string"&&(n=JSON.parse(f))}catch{console.error(`Cannot parse json data: ${JSON.stringify(n)}`)}}n===void 0&&(n=null),this.setState({loading:!0}),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",n).then(f=>{f&&Array.isArray(f)&&f.forEach(i=>t.push(typeof i=="string"?{label:i,value:i}:JSON.parse(JSON.stringify(i)))),Array.isArray(e)?(t.unshift({label:z.I18n.t(q.DIFFERENT_LABEL),value:q.DIFFERENT_VALUE}),this.setState({value:q.DIFFERENT_VALUE,selectOptions:t,loading:!1})):this.setState({value:e,selectOptions:t,loading:!1})}).catch(f=>{console.error("Error in autocompleteSendTo:",f),this.setState({loading:!1})})}else Array.isArray(e)?(t.unshift({label:z.I18n.t(q.DIFFERENT_LABEL),value:q.DIFFERENT_VALUE}),this.setState({value:q.DIFFERENT_VALUE,selectOptions:t})):this.setState({value:e,selectOptions:t})}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=q.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(e,t){if(this.props.alive){const o=this.getContext();(o!==this.localContext||!this.initialized)&&(this.localContext=o,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}let n;const f=this.state.selectOptions?JSON.parse(JSON.stringify(this.state.selectOptions)):[];return Array.isArray(this.state.value)||this.state.value===q.DIFFERENT_LABEL?([...this.state.value].filter(o=>!f.find(p=>p.value===o)).forEach(o=>f.push({label:o.toString(),value:o})),n={label:z.I18n.t(q.DIFFERENT_LABEL),value:q.DIFFERENT_VALUE},f.unshift(n)):(n=this.state.value!==null&&this.state.value!==void 0&&f.find(o=>o.value==this.state.value),this.state.value!==null&&this.state.value!==void 0&&!n&&this.props.schema.freeSolo&&(n={value:this.state.value,label:this.state.value},f.push(n)),n=n||null),f.length?I.createElement(P.Autocomplete,{value:n,fullWidth:!0,freeSolo:!!this.props.schema.freeSolo,options:f,isOptionEqualToValue:(o,p)=>o.value===p.value,filterOptions:(o,p)=>{const s=o.filter(u=>p.inputValue===""?!0:u.label.toLowerCase().includes(p.inputValue.toLowerCase())||u.value.toLowerCase().includes(p.inputValue.toLowerCase()));return this.props.schema.freeSolo&&p.inputValue!==""&&s.push({label:p.inputValue,value:p.inputValue}),s},getOptionLabel:o=>(o==null?void 0:o.label)??"",onInputChange:o=>{if(!o||!this.props.schema.freeSolo)return;const p=o.target.value;p!==this.state.value&&this.setState({value:p},()=>this.onChange(this.props.attr,p))},onChange:(o,p)=>{const s=typeof p=="object"?p?p.value:"":p;s!==this.state.value&&this.setState({value:s},()=>this.onChange(this.props.attr,s))},renderInput:o=>I.createElement(P.TextField,{variant:"standard",...o,error:!!e,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:t,InputProps:{...o.InputProps,endAdornment:I.createElement(I.Fragment,null,this.state.loading?I.createElement(P.InputAdornment,{position:"end"},I.createElement(P.CircularProgress,{size:20})):null,o.InputProps.endAdornment)}})}):I.createElement(P.TextField,{variant:"standard",fullWidth:!0,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e,disabled:t,inputProps:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0},InputProps:this.state.loading?{endAdornment:I.createElement(P.InputAdornment,{position:"end"},I.createElement(P.CircularProgress,{size:20}))}:void 0,onChange:o=>{const p=o.target.value;this.setState({value:p},()=>this.onChange(this.props.attr,(p||"").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 Tr={fullWidth:{width:"100%"},flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class eu extends q{componentDidMount(){super.componentDidMount();const{data:e,attr:t}=this.props,n=q.getValue(e,t)||"";this.setState({value:n,showDialog:!1})}renderItem(e,t){const{schema:n,attr:f}=this.props,{value:i,showDialog:o}=this.state;return I.createElement(P.FormControl,{style:Tr.fullWidth,variant:"standard"},n.label?I.createElement(P.InputLabel,{shrink:!0},this.getText(n.label)):null,I.createElement("div",{style:Tr.flex},I.createElement(P.TextField,{variant:"standard",fullWidth:!0,value:i??"",error:!!e,disabled:t,placeholder:this.getText(n.placeholder),label:this.getText(n.label),helperText:this.renderHelp(n.help,n.helpLink,n.noTranslation),onChange:p=>{const s=p.target.value;this.setState({value:s},()=>this.onChange(f,s))}}),I.createElement(P.Button,{color:"grey",disabled:t,style:Tr.button,size:"small",variant:"outlined",onClick:()=>this.setState({showDialog:!0})},"...")),o?I.createElement(z.DialogCron,{title:z.I18n.t("ra_Define schedule"),simple:n.simple,complex:n.complex,cron:i,onClose:()=>this.setState({showDialog:!1}),cancel:z.I18n.t("ra_Cancel"),ok:z.I18n.t("ra_Ok"),theme:this.props.oContext.theme,onOk:p=>this.setState({showDialog:!1,value:p},()=>this.onChange(f,p))}):null)}}class tu extends q{async componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr),n=(await this.props.oContext.socket.getCertificates()).filter(f=>{const i=this.props.attr.toLowerCase();return i.includes(f.type)||f.type==="public"&&i.includes("cert")||f.type==="private"&&(i.includes("priv")||i.includes("key"))?!0:!!(f.type==="chained"&&(i.includes("chain")||i.includes("ca")))}).map(f=>({label:f.name,value:f.name}));n.unshift({label:z.I18n.t(q.NONE_LABEL),value:q.NONE_VALUE}),this.setState({value:e,selectOptions:n})}renderItem(e,t){var f,i;if(!this.state.selectOptions)return null;const n=(f=this.state.selectOptions)==null?void 0:f.find(o=>o.value===this.state.value);return I.createElement(P.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?I.createElement(P.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,I.createElement(P.Select,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:this.state.value,renderValue:()=>this.getText(n==null?void 0:n.label,this.props.schema.noTranslation!==!1),onChange:o=>this.setState({value:o.target.value},()=>this.onChange(this.props.attr,this.state.value))},(i=this.state.selectOptions)==null?void 0:i.map(o=>I.createElement(P.MenuItem,{key:o.value,value:o.value,style:o.value===q.NONE_VALUE?{opacity:.5}:{}},this.getText(o.label,this.props.schema.noTranslation!==!1)))),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Kn={fullWidth:{width:"100%"},leWidth:{width:620,marginBottom:10},certWidth:{width:200,marginRight:10}};class nu extends q{async componentDidMount(){var p;super.componentDidMount();const e=await this.props.oContext.socket.getCertificates(),t=[],n=[],f=[];let i=[];const o=await this.props.oContext.socket.getObject("system.certificates");(p=o==null?void 0:o.native)!=null&&p.collections?i=Object.keys(o.native.collections):i=null,e.forEach(s=>{s.type==="public"?t.push({label:s.name,value:s.name}):s.type==="private"?n.push({label:s.name,value:s.name}):s.type==="chained"?f.push({label:s.name,value:s.name}):(t.push({label:s.name,value:s.name}),n.push({label:s.name,value:s.name}),f.push({label:s.name,value:s.name}))}),t.unshift({label:z.I18n.t(q.NONE_LABEL),value:q.NONE_VALUE}),n.unshift({label:z.I18n.t(q.NONE_LABEL),value:q.NONE_VALUE}),f.unshift({label:z.I18n.t(q.NONE_LABEL),value:q.NONE_VALUE}),this.setState({certsPublicOptions:t,certsChainOptions:f,certsPrivateOptions:n,collectionsOptions:i})}renderItem(e,t){var r,a,l,d,c,m,g;if(!this.state.certsPublicOptions||!this.state.certsPrivateOptions||!this.state.certsChainOptions)return null;const n=(q.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString(),f=q.getValue(this.props.data,this.props.schema.certPublicName||"certPublic"),i=q.getValue(this.props.data,this.props.schema.certPrivateName||"certPrivate"),o=q.getValue(this.props.data,this.props.schema.certChainedName||"certChained"),p=(r=this.state.certsPublicOptions)==null?void 0:r.find(v=>v.value===f),s=(a=this.state.certsPrivateOptions)==null?void 0:a.find(v=>v.value===i),u=(l=this.state.certsChainOptions)==null?void 0:l.find(v=>v.value===o);return I.createElement("div",{style:Kn.fullWidth},this.state.collectionsOptions?I.createElement(P.FormControl,{style:Kn.leWidth,variant:"standard"},I.createElement(P.InputLabel,{shrink:!0},"Let's encrypt"),I.createElement(P.Select,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:n,onChange:v=>this.onChange(this.props.schema.leCollectionName||"leCollection",v.target.value==="false"?!1:v.target.value==="true"?!0:v.target.value)},I.createElement(P.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},z.I18n.t("ra_Do not use let's encrypt")),I.createElement(P.MenuItem,{key:"_true",value:"true",style:{fontWeight:"bold"}},z.I18n.t("ra_Use all available let's encrypt certificates")),(d=this.state.collectionsOptions)==null?void 0:d.map(v=>I.createElement(P.MenuItem,{key:v,value:v},v)))):null,this.state.collectionsOptions?I.createElement("br",null):null,this.state.collectionsOptions&&n!=="false"?I.createElement("div",null,z.I18n.t("ra_Fallback custom certificates")):null,I.createElement(P.FormControl,{style:Kn.certWidth,variant:"standard"},I.createElement(P.InputLabel,{shrink:!0},z.I18n.t("ra_Public certificate")),I.createElement(P.Select,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:f||"",renderValue:()=>this.getText(p==null?void 0:p.label,!0),onChange:v=>this.onChange(this.props.schema.certPublicName||"certPublic",v.target.value)},(c=this.state.certsPublicOptions)==null?void 0:c.map((v,b)=>I.createElement(P.MenuItem,{key:`${v.value}_${b}`,value:v.value,style:v.value===q.NONE_VALUE?{opacity:.5}:{}},this.getText(v.label,!0))))),I.createElement(P.FormControl,{style:Kn.certWidth,variant:"standard"},I.createElement(P.InputLabel,{shrink:!0},z.I18n.t("ra_Private certificate")),I.createElement(P.Select,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:i||"",renderValue:()=>this.getText(s==null?void 0:s.label,!0),onChange:v=>this.onChange(this.props.schema.certPrivateName||"certPrivate",v.target.value)},(m=this.state.certsPrivateOptions)==null?void 0:m.map((v,b)=>I.createElement(P.MenuItem,{key:`${v.value}_${b}`,value:v.value,style:v.value===q.NONE_VALUE?{opacity:.5}:{}},this.getText(v.label,!0))))),I.createElement(P.FormControl,{style:Kn.certWidth,variant:"standard"},I.createElement(P.InputLabel,{shrink:!0},z.I18n.t("ra_Chained certificate")),I.createElement(P.Select,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:o||"",renderValue:()=>this.getText(u==null?void 0:u.label,!0),onChange:v=>this.onChange(this.props.schema.certChainedName||"certChained",v.target.value)},(g=this.state.certsChainOptions)==null?void 0:g.map((v,b)=>I.createElement(P.MenuItem,{key:`${v.value}_${b}`,value:v.value,style:v.value===q.NONE_VALUE?{opacity:.5}:{}},this.getText(v.label,!0))))))}}class iu extends q{async componentDidMount(){var n;super.componentDidMount();let e;const t=await this.props.oContext.socket.getObject("system.certificates");(n=t==null?void 0:t.native)!=null&&n.collections?e=Object.keys(t.native.collections):e=[],this.setState({collectionsOptions:e})}renderItem(e,t){var f;if(!this.state.collectionsOptions)return null;const n=(q.getValue(this.props.data,this.props.schema.leCollectionName||"leCollection")||"false").toString();return I.createElement(P.FormControl,{style:{width:"100%"},variant:"standard"},this.props.schema.label?I.createElement(P.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,I.createElement(P.Select,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:n,onChange:i=>this.onChange(this.props.schema.leCollectionName||"leCollection",i.target.value==="false"?!1:i.target.value==="true"?!0:i.target.value)},I.createElement(P.MenuItem,{key:"_false",value:"false",style:{fontWeight:"bold"}},z.I18n.t("ra_Do not use let's encrypt")),I.createElement(P.MenuItem,{key:"_true",value:"true",style:{fontWeight:"bold"}},z.I18n.t("ra_Use all available let's encrypt certificates")),(f=this.state.collectionsOptions)==null?void 0:f.map(i=>I.createElement(P.MenuItem,{key:i,value:i},i))),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class ru extends q{async componentDidMount(){super.componentDidMount();const e=await this.props.oContext.socket.getCurrentInstance();this.setState({requesting:!0},async()=>{const t=await this.props.oContext.socket.sendTo(e,"checkDocker",null);this.setState({requesting:!1,version:(t==null?void 0:t.version)||"",errorDocker:t?t.daemonRunning?"":z.I18n.t("ra_Docker is not installed or not running"):z.I18n.t("ra_No response from admin")})})}renderItem(e,t){const n=q.getValue(this.props.data,this.props.attr);return this.state.requesting?I.createElement(P.CircularProgress,null):this.state.errorDocker&&!n?I.createElement(P.FormHelperText,{style:{color:"orange"}},z.I18n.t("ra_Docker is not available"),": ",z.I18n.t(`ra_${this.state.errorDocker}`).replace(/^ra_/,"")):I.createElement(P.FormControl,{style:{width:"100%"},variant:"standard"},I.createElement(P.FormControlLabel,{onClick:f=>{if(f.preventDefault(),f.stopPropagation(),!t){const i=this.onChange(this.props.attr,!n);i instanceof Promise&&i.catch(o=>console.error(`Cannot set value: ${o}`))}},control:I.createElement(P.Checkbox,{checked:!!n,onChange:f=>{this.onChange(this.props.attr,f.target.checked)},disabled:t||!!this.state.errorDocker&&!n}),label:this.getText(this.props.schema.label)}),this.props.schema.hideVersion?null:I.createElement(P.FormHelperText,null,this.state.errorDocker?this.state.errorDocker:this.state.version),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const lt={fullWidth:{width:"100%"},licLabel:{fontWeight:"bold",minWidth:100,marginRight:10,textTransform:"capitalize",display:"inline-block"},errorTitle:h=>({color:h.palette.mode==="dark"?"#e39191":"#b62020"}),okTitle:h=>({color:h.palette.mode==="dark"?"#6fd56f":"#007c00"}),errorText:h=>({color:h.palette.mode==="dark"?"#e39191":"#b62020",mb:"30px"})};class Yt extends q{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 e=this.state._error;return this.state.allLicenses&&(e=[I.createElement("div",{key:"error"},e)],e.push(I.createElement(P.Button,{key:"button",variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},z.I18n.t("iobroker.net"))),this.state.allLicenses.length?e.push(I.createElement(P.TableContainer,{key:"table"},I.createElement(P.Table,{size:"small"},I.createElement(P.TableHead,null,I.createElement(P.TableRow,null,I.createElement(P.TableCell,null,z.I18n.t("ra_Product")),I.createElement(P.TableCell,null,z.I18n.t("ra_Version")),I.createElement(P.TableCell,null,"UUID"),I.createElement(P.TableCell,null,z.I18n.t("ra_ValidTill")),I.createElement(P.TableCell,null,z.I18n.t("ra_Commercial")),I.createElement(P.TableCell,null,"ID"))),I.createElement(P.TableBody,null,this.state.allLicenses.map(t=>I.createElement(P.TableRow,{key:t.id},I.createElement(P.TableCell,{sx:t.validName?null:lt.errorText},t.license.product),I.createElement(P.TableCell,{sx:t.validVersion?null:lt.errorText},t.license.version),I.createElement(P.TableCell,{sx:t.validUuid?null:lt.errorText},t.license.uuid||"--"),I.createElement(P.TableCell,{sx:t.validTill?null:lt.errorText},t.license.validTill&&t.license.validTill!=="0000-00-00 00:00:00"?new Date(t.license.validTill).toLocaleDateString():"--"),I.createElement(P.TableCell,null,t.license.invoice!=="free"?t.license.invoice==="MANUALLY_CREATED"?"✓":t.license.invoice:"-"),I.createElement(P.TableCell,null,t.id))))))):(e.push(I.createElement("div",{key:"text1"},z.I18n.t("ra_No one license found in license manager"))),e.push(I.createElement("div",{key:"text2"},z.I18n.t("ra_Please create license"))))),I.createElement(P.Dialog,{open:!0,maxWidth:"xl",fullWidth:this.props.fullWidth!==void 0?this.props.fullWidth:!0,onClick:()=>this.setState({_error:"",allLicenses:null})},I.createElement(P.DialogTitle,null,z.I18n.t("ra_Error")),I.createElement(P.DialogContent,null,I.createElement(P.DialogContentText,null,e)),I.createElement(P.DialogActions,null,I.createElement(P.Button,{variant:"contained",onClick:()=>this.setState({_error:"",allLicenses:null}),color:"primary",autoFocus:!0,startIcon:I.createElement(se.Check,null)},z.I18n.t("ra_Ok"))))}return null}renderMessageDialog(){if(this.state.showLicenseData){const e=[],t=this.state.showLicenseData;return Object.keys(t).forEach(n=>{if(!(t[n]===null||t[n]===void 0))if(typeof t[n]=="object"){const f=t[n];Object.keys(f).forEach(i=>{f[i]!==null&&f[i]!==void 0&&(typeof f[i]=="object"?e.push(I.createElement("div",{key:i},I.createElement("div",{style:lt.licLabel},i,":"),JSON.stringify(f[i],null,2))):e.push(I.createElement("div",{key:i},I.createElement("div",{style:lt.licLabel},n," -",i,":"),f[i].toString())))})}else e.push(I.createElement("div",{key:n},I.createElement("div",{style:lt.licLabel},n.replace(/_/g," "),":"),t[n].toString()))}),e.push(I.createElement("div",{key:"checked"},I.createElement("div",{style:lt.licLabel},z.I18n.t("ra_Checked"),":"),this.state.licenseOfflineCheck?z.I18n.t("ra_locally"):z.I18n.t("ra_via internet"))),I.createElement(P.Dialog,{open:!0,onClose:()=>this.setState({showLicenseData:null})},I.createElement(P.DialogTitle,null,I.createElement(P.Box,{component:"span",sx:this.state.result?lt.okTitle:lt.errorTitle},z.I18n.t("ra_License %s",this.state.result?"OK":"INVALID"))),I.createElement(P.DialogContent,null,this.state.showLinkToProfile?I.createElement(P.Button,{variant:"contained",onClick:()=>window.open("https://iobroker.net/www/account/licenses","_blank")},"https://iobroker.net"):null,this.state._error?I.createElement(P.Box,{component:"div",sx:lt.errorText},this.state._error):null,e),I.createElement(P.DialogActions,null,I.createElement(P.Button,{onClick:()=>this.setState({showLicenseData:null,_error:""}),color:"primary",variant:"contained"},z.I18n.t("ra_Close"))))}return null}static parseJwt(e){const n=e.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),f=decodeURIComponent(atob(n).split("").map(i=>`%${`00${i.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));try{return JSON.parse(f)}catch{return null}}static isVersionValid(e,t,n,f){if(!t||!e)return!0;let i=!0;const[o]=e.split(".");return t.startsWith(">=")?i=parseInt(o,10)>=parseInt(t.substring(2,10)):t.startsWith("<=")?i=parseInt(o,10)<=parseInt(t.substring(2,10)):t.startsWith(">")?i=parseInt(o,10)>parseInt(t.substring(1,10)):t.startsWith("<")?i=parseInt(o,10)<parseInt(t.substring(1,10)):t.startsWith("=")?i=parseInt(o,10)===parseInt(t.substring(1,10)):t.startsWith("==")?i=parseInt(o,10)===parseInt(t.substring(2,10)):t.startsWith("===")&&(i=parseInt(o,10)===parseInt(t.substring(3,10))),!0}async findInLicenseManager(e){var f,i,o,p;const t=await this.props.oContext.socket.getObject("system.licenses"),n=[];if((i=(f=t==null?void 0:t.native)==null?void 0:f.licenses)!=null&&i.length){let s=null;const u=Date.now();let r;if(this.props.schema.uuid){const l=await this.props.oContext.socket.getObject("system.meta.uuid");r=(o=l==null?void 0:l.native)==null?void 0:o.uuid}let a;if(this.props.schema.version){const l=await this.props.oContext.socket.getObject(`system.adapter.${e}`);a=(p=l==null?void 0:l.common)==null?void 0:p.version}t.native.licenses.forEach(l=>{const d=!l.validTill||l.validTill==="0000-00-00 00:00:00"||new Date(l.validTill).getTime()>u,c=(l.product||"").split("."),m=c[1]===e||e==="vis-2"&&c[1]==="vis",g=!r||!l.uuid||l.uuid===r,v=Yt.isVersionValid(a,l.version,l.invoice,e);(!s||l.invoice!=="free")&&d&&m&&g&&v&&(s=l),n.push({id:l.id,validName:m,validUuid:g,validVersion:v,validTill:d,license:l})}),s&&(n.find(l=>l.id===s.id).used=!0)}return n}async checkLicense(e,t){var p,s,u;let n;if(this.props.schema.uuid){const r=await this.props.oContext.socket.getObject("system.meta.uuid");n=(p=r==null?void 0:r.native)==null?void 0:p.uuid}let f;if(this.props.schema.version){const r=await this.props.oContext.socket.getObject(`system.adapter.${t}`);f=(s=r==null?void 0:r.common)==null?void 0:s.version}const i=new AbortController;let o=setTimeout(()=>{o=null,i.abort()},5e3);try{const r=await window.fetch("https://iobroker.net/api/v1/public/cert/",{method:"POST",body:JSON.stringify({json:e,uuid:n}),headers:{"Content-Type":"text/plain"},signal:i.signal});o&&clearTimeout(o);const a=await r.text();let l;try{l=JSON.parse(a)}catch{}if(l!=null&&l.error)try{const d=Yt.parseJwt(e),c=z.I18n.t(`ra_${d.error||l.error||"Unknown error"}`).replace(/^ra_/,"");return this.setState({_error:c,licenseOfflineCheck:!1,showLicenseData:d,result:!1,running:!1})}catch{return console.log("Cannot parse license"),this.setState({_error:l.error,result:!1,running:!1})}else{let d=null;try{d=Yt.parseJwt(e)}catch{}if(l){const c=l.validTill||l.valid_till;if(c&&c!=="0000-00-00 00:00:00"&&new Date(c).getTime()<Date.now())return this.setState({_error:z.I18n.t("ra_License expired on %s",new Date(c).toLocaleString()),licenseOfflineCheck:!1,showLicenseData:d,result:!1,running:!1});const m=(l.name||"").split(".");return m[1]===t||m[1]==="vis"&&t==="vis-2"?n&&!l.uuid&&t==="vis-2"?this.setState({_error:z.I18n.t("ra_License must be converted",l.uuid),showLinkToProfile:!0,licenseOfflineCheck:!1,showLicenseData:d,result:!1,running:!1}):n&&l.uuid&&l.uuid!==n?this.setState({_error:z.I18n.t('ra_Serial number (UUID) "%s" in license is for other device.',l.uuid),licenseOfflineCheck:!1,showLicenseData:d,result:!1,running:!1}):Yt.isVersionValid(f,l.version,l.invoice,t)?this.setState({licenseOfflineCheck:!1,showLicenseData:d,result:!0,running:!1}):this.setState({_error:z.I18n.t("ra_License is for version %s, but required version is %s",l.version,this.props.schema.version),licenseOfflineCheck:!1,showLicenseData:d,result:!1,running:!1}):this.setState({_error:z.I18n.t('ra_License for other product "%s"',l.name),licenseOfflineCheck:!1,showLicenseData:d,result:!1,running:!1})}throw new Error("ra_Invalid answer from server")}}catch(r){if(((u=r==null?void 0:r.response)==null?void 0:u.status)===404)return this.setState({_error:z.I18n.t("ra_License does not exist"),result:!1,running:!1});try{const a=Yt.parseJwt(e),l=(a.name||"").split(".");return a.valid_till&&a.valid_till!=="0000-00-00 00:00:00"&&new Date(a.valid_till).getTime()<Date.now()?this.setState({_error:z.I18n.t("ra_License expired on %s",new Date(a.valid_till).toLocaleString()),showLicenseData:a,licenseOfflineCheck:!0,running:!1,result:!1}):l[1]===t?n&&a.uuid&&a.uuid!==n?this.setState({_error:z.I18n.t('ra_Serial number (UUID) "%s" in license is for other device.',a.uuid),showLicenseData:a,licenseOfflineCheck:!0,result:!1,running:!1}):Yt.isVersionValid(f,a.version,a.invoice,t)?this.setState({running:!1,result:!0,licenseOfflineCheck:!0,showLicenseData:a}):this.setState({_error:z.I18n.t("ra_License is for version %s, but required version is %s",a.version,this.props.schema.version),licenseOfflineCheck:!0,showLicenseData:a,result:!1,running:!1}):this.setState({_error:z.I18n.t('ra_License for other product "%s"',a.name),licenseOfflineCheck:!0,showLicenseData:a,result:!1,running:!1})}catch{return this.setState({_error:z.I18n.t("ra_Cannot decode license"),result:!1,licenseOfflineCheck:!0,running:!1})}}}renderAskForUpdate(){return this.state.askForUpdate?I.createElement(z.DialogConfirm,{text:z.I18n.t("ra_License not found in license manager. Do you want to read licenses from iobroker.net?"),ok:z.I18n.t("ra_Yes"),onClose:async e=>{if(e){this.setState({askForUpdate:!1});try{await this.props.oContext.socket.updateLicenses(null,null)}catch(t){window.alert(z.I18n.t("ra_Cannot read licenses: %s",t));return}await this._onClick(!0)}else this.setState({askForUpdate:!1,running:!1})}}):null}async _onClick(e){const t=this.props.oContext.adapterName==="vis-2"?"vis":this.props.oContext.adapterName;this.setState({running:!0});let n,f;if(this.props.data.useLicenseManager){if(f=await this.findInLicenseManager(t),n=f.find(i=>i.used),n&&(n=n.license.json),!n&&!e){this.setState({askForUpdate:!0});return}}else n=this.props.data.license;n?await this.checkLicense(n,t):this.props.data.useLicenseManager?this.setState({_error:z.I18n.t("ra_Suitable license not found in license manager"),result:!1,running:!1,allLicenses:f}):this.setState({_error:z.I18n.t("ra_Please enter the license"),result:!1,running:!1})}renderItem(){return I.createElement("div",{style:lt.fullWidth},I.createElement(P.Button,{variant:this.props.schema.variant||"outlined",color:this.props.schema.color||"primary",style:lt.fullWidth,disabled:!this.props.data.license&&!this.props.data.useLicenseManager||this.state.running,startIcon:I.createElement(se.Send,null),onClick:()=>this._onClick()},this.state.running?I.createElement(P.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 su extends q{renderItem(e,t){const n=q.getValue(this.props.data,this.props.attr),f=Array.isArray(n);return I.createElement(P.FormControl,{style:{width:"100%"},variant:"standard"},I.createElement(P.FormControlLabel,{onClick:i=>{if(i.preventDefault(),i.stopPropagation(),!t){const o=this.onChange(this.props.attr,!n);o instanceof Promise&&o.catch(p=>console.error(`Cannot set value: ${p}`))}},control:I.createElement(P.Checkbox,{indeterminate:f,checked:!!n,onChange:i=>{let o;f?o=this.onChange(this.props.attr,!0):o=this.onChange(this.props.attr,i.target.checked),o instanceof Promise&&o.catch(p=>console.error(`Cannot set value: ${p}`))},disabled:t||this.props.schema.readOnly}),label:this.getText(this.props.schema.label)}),I.createElement(P.FormHelperText,{style:{color:"red"}},e?this.props.schema.validatorErrorText?z.I18n.t(this.props.schema.validatorErrorText):z.I18n.t("ra_Error"):null),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const ou={standard:P.Input,filled:ql,outlined:P.OutlinedInput},au=h=>{const e=h.palette.mode==="light",t=e?"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 ${h.palette.primary[e?"dark":"light"]}`,left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:h.transitions.create("transform",{duration:h.transitions.duration.shorter,easing:h.transitions.easing.easeOut}),pointerEvents:"none"},"&$focused:after":{transform:"scaleX(1)"},"&$error:after":{borderBottomColor:h.palette.error.main,transform:"scaleX(1)"},"&:before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:h.transitions.create("border-bottom-color",{duration:h.transitions.duration.shorter}),pointerEvents:"none"},"&:hover:not($disabled):not($focused):not($error):before":{borderBottom:`2px solid ${h.palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},"&$disabled:before":{borderBottomStyle:"dotted"}},error:{"&:after":{backgroundColor:h.palette.error.main,transform:"scaleX(1)"}},chip:{margin:"0 8px 8px 0",float:"left"},marginDense:{}}},ki={BACKSPACE:8,DELETE:46,LEFT_ARROW:37,RIGHT_ARROW:39},lu=({value:h,isFocused:e,isDisabled:t,isReadOnly:n,handleClick:f,handleDelete:i,style:o},p)=>I.createElement(P.Chip,{key:p,style:{...o,pointerEvents:t||n?"none":void 0,backgroundColor:e?pc[300]:void 0},onClick:f,onDelete:i,label:h});class cu extends I.Component{labelRef;labelNode=null;input;newChipKeyCodes;newChipKeys;actualInput=null;inputBlurTimeout=null;_keyPressed;_preventChipCreation;styles={};styleTheme=null;constructor(e){super(e),this.state={chips:e.defaultValue||[],focusedChip:null,inputValue:"",isFocused:!1,chipsUpdated:!1,prevPropsValue:[],variant:this.props.variant||"standard"},this.newChipKeyCodes=e.newChipKeyCodes||[13],this.newChipKeys=e.newChipKeys||["Enter"],this.labelRef=I.createRef(),this.input=I.createRef()}componentDidMount(){this.state.variant==="outlined"&&(this.labelNode=Zl.findDOMNode(this.labelRef.current),this.forceUpdate())}componentWillUnmount(){this.inputBlurTimeout&&clearTimeout(this.inputBlurTimeout)}static getDerivedStateFromProps(e,t){let n=null;return e.value&&e.value.length!==t.prevPropsValue.length&&(n={prevPropsValue:e.value},e.clearInputValueOnChange&&(n.inputValue="")),e.clearInputValueOnChange&&e.value&&e.value.length!==t.prevPropsValue.length&&(n={prevPropsValue:e.value,inputValue:""}),e.disabled&&(n={...n,focusedChip:null}),!t.chipsUpdated&&e.defaultValue&&(n={...n,chips:e.defaultValue}),n}focus=()=>{var e;(e=this.actualInput)==null||e.focus(),this.state.focusedChip&&this.setState({focusedChip:null})};handleInputBlur=e=>{this.props.onBlur&&this.props.onBlur(e),this.setState({isFocused:!1}),this.state.focusedChip&&this.setState({focusedChip:null});const t=e.target.value;let n;switch(this.props.blurBehavior||"clear"){case"add-or-clear":n={clearInputOnFail:!0};case"add":if(this.props.delayBeforeAdd){const f=(this.props.value||this.state.chips).length;this.inputBlurTimeout=setTimeout(()=>{const i=(this.props.value||this.state.chips).length;f===i?this.handleAddChip(t,n):this.clearInput()},150)}else this.handleAddChip(t,n);break;case"clear":this.clearInput();break}};handleInputFocus=e=>{var t,n;this.setState({isFocused:!0}),(n=(t=this.props).onFocus)==null||n.call(t,e)};handleKeyDown=e=>{const{focusedChip:t}=this.state;if(this._keyPressed=!1,this._preventChipCreation=!1,this.props.onKeyDown&&(this.props.onKeyDown(e),e.isDefaultPrevented()))return;const n=this.props.value||this.state.chips;if(this.newChipKeyCodes.includes(e.keyCode)||this.newChipKeys.includes(e.key)){this.handleAddChip(e.target.value)!==!1&&e.preventDefault();return}switch(e.keyCode){case ki.BACKSPACE:e.target.value===""&&(t?(this.handleDeleteChip(n[t],t),t&&this.setState({focusedChip:t-1})):this.setState({focusedChip:n.length-1}));break;case ki.DELETE:e.target.value===""&&t&&(this.handleDeleteChip(n[t],t),t<=n.length-1&&this.setState({focusedChip:t}));break;case ki.LEFT_ARROW:t===null&&e.target.value===""&&n.length?this.setState({focusedChip:n.length-1}):t!==null&&t>0&&this.setState({focusedChip:t-1});break;case ki.RIGHT_ARROW:t!==null&&t<n.length-1?this.setState({focusedChip:t+1}):this.setState({focusedChip:null});break;default:this.setState({focusedChip:null});break}};handleKeyUp=e=>{!this._preventChipCreation&&(this.newChipKeyCodes.includes(e.keyCode)||this.newChipKeys.includes(e.key))&&this._keyPressed?this.clearInput():this.updateInput(e.target.value),this.props.onKeyUp&&this.props.onKeyUp(e)};handleUpdateInput=e=>{(this.props.inputValue===null||this.props.inputValue===void 0)&&this.updateInput(e.target.value),this.props.onUpdateInput&&this.props.onUpdateInput(e)};handleAddChip(e,t){if(this.props.onBeforeAdd&&!this.props.onBeforeAdd(e))return this._preventChipCreation=!0,t&&t.clearInputOnFail&&this.clearInput(),!1;this.clearInput();const n=this.props.value||this.state.chips;return e.trim().length?((this.props.allowDuplicates||!n.includes(e))&&(this.props.value&&this.props.onAdd?this.props.onAdd(e):this.updateChips([...this.state.chips,e])),!0):!1}handleDeleteChip(e,t){if(this.props.value)this.props.onDelete&&this.props.onDelete(e,t);else{const n=this.state.chips.slice();if(n.splice(t,1)){let i=this.state.focusedChip;this.state.focusedChip===t?i=null:this.state.focusedChip!==null&&this.state.focusedChip>t&&(i=this.state.focusedChip-1),this.updateChips(n,{focusedChip:i})}}}updateChips(e,t={}){this.setState({chips:e,chipsUpdated:!0,...t}),this.props.onChange&&this.props.onChange(e)}clearInput(){this.updateInput("")}updateInput(e){this.setState({inputValue:e})}setActualInputRef=e=>{this.actualInput=e,this.props.inputRef&&this.props.inputRef(e)};render(){const{alwaysShowPlaceholder:e,chipRenderer:t=lu,className:n,disabled:f,disableUnderline:i,error:o,FormHelperTextProps:p,fullWidth:s,fullWidthInput:u,helperText:r,id:a,InputProps:l={},InputLabelProps:d={},inputValue:c,label:m,placeholder:g,readOnly:v,required:b,rootRef:E,value:S,margin:w}=this.props,y=this.state.variant;this.styleTheme!==this.props.theme.palette.mode&&(this.styleTheme=this.props.theme.palette.mode,this.styles=z.Utils.getStyle(this.props.theme,au));let D=S||this.state.chips||[];Array.isArray(D)||(D=(D||"").toString().split(/[,\s]+/).map(x=>x.trim()));const $=c??this.state.inputValue,A=(this.props.value||$).length||$.length,_=typeof d.shrink=="boolean"?d.shrink:m!==null&&(A||this.state.isFocused||D.length),L=D.map((x,C)=>t({value:x,isDisabled:!!f,isReadOnly:!!v,isFocused:this.state.focusedChip===C,handleClick:()=>this.setState({focusedChip:C}),handleDelete:()=>this.handleDeleteChip(x,C),style:this.styles.chip},C.toString())),T={};y==="outlined"&&(T.notched=!!_,T.labelWidth=_&&this.labelNode&&this.labelNode.offsetWidth||0),y!=="standard"?T.startAdornment=L:l.disableUnderline=!0;const k=ou[y];return I.createElement(P.FormControl,{ref:E,fullWidth:s,className:n,sx:{...this.styles.root,...w==="dense"?this.styles.marginDense:{}},error:o,required:D.length>0?void 0:b,onClick:this.focus,disabled:f,variant:y,component:"div",margin:w},m&&I.createElement(P.InputLabel,{htmlFor:a,sx:{"&.MuiInputLabel-root":this.styles.label,"&.MuiInputLabel-shrink":this.styles.labelShrink},shrink:!!_,focused:this.state.isFocused,variant:y,ref:this.labelRef,required:b,component:"label",...d},m),I.createElement(P.Box,{component:"div",id:"input-chip-container",sx:{...this.styles[y],...this.styles.chipContainer,...this.state.isFocused?this.styles.focused:void 0,...!i&&y==="standard"?this.styles.underline:void 0,...f?this.styles.disabled:void 0,...m?this.styles.labeled:void 0,...o?this.styles.error:void 0}},y==="standard"&&L,I.createElement(k,{ref:this.input,className:`mui-variant-${this.styles[y]} ${m?"mui-chip-with-label":"mui-chip-no-label"}`,sx:{"&.MuiInputBase-input":{...this.styles.input,...this.styles[y]},"&.MuiInputBase-root":{...this.styles.inputRoot}},id:a,value:$,onChange:this.handleUpdateInput,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onFocus:this.handleInputFocus,onBlur:this.handleInputBlur,inputRef:this.setActualInputRef,disabled:f,fullWidth:u,placeholder:!A&&(_||m===null||m===void 0)||e?g:void 0,readOnly:v,...l,...T})),r&&I.createElement(P.FormHelperText,{...p,className:p==null?void 0:p.className,style:this.styles.helperText},r))}}class Is extends q{componentDidMount(){super.componentDidMount();const{data:e,attr:t}=this.props,n=q.getValue(e,t);if(this.props.schema.delimiter&&typeof n=="string"){const f=n.split(this.props.schema.delimiter).map(i=>i.trim()).filter(i=>i);this.setState({value:f})}else this.setState({value:n||[]})}renderItem(e,t){const{attr:n,schema:f}=this.props,{value:i}=this.state;return I.createElement(P.FormControl,{fullWidth:!0,variant:"standard"},I.createElement(cu,{value:i,disabled:!!t,label:this.getText(f.label),error:!!e,onAdd:o=>{const p=JSON.parse(JSON.stringify(i));p.push(o),this.setState({value:p},()=>{let s;this.props.schema.delimiter?s=this.onChange(n,p.join(`${this.props.schema.delimiter} `)):s=this.onChange(n,p),s instanceof Promise&&s.catch(u=>console.error(u))})},theme:this.props.oContext.theme,onDelete:(o,p)=>{const s=JSON.parse(JSON.stringify(i));s.splice(p,1),this.setState({value:s},()=>{let u;this.props.schema.delimiter?u=this.onChange(n,s.join(`${this.props.schema.delimiter} `)):u=this.onChange(n,s),u instanceof Promise&&u.catch(r=>console.error(r))})}}),I.createElement(P.FormHelperText,null,z.I18n.t("ra_Press ENTER Key to add new item")),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class uu extends q{renderColorDialog(){return!!this.state.showColorDialog&&I.createElement(P.Dialog,{onClose:()=>this.setState({showColorDialog:!1}),open:this.state.showColorDialog},I.createElement(mc,{color:this.state.colorDialogValue,onChange:e=>this.setState({colorDialogValue:e.hex},()=>this.onChange(this.props.attr,this.state.colorDialogValue))}))}renderItem(e,t){const n=q.getValue(this.props.data,this.props.attr);let f=z.Utils.isUseBright(n,null);return f===null&&(f=void 0),I.createElement(I.Fragment,null,this.renderColorDialog(),I.createElement(P.TextField,{variant:"standard",disabled:!!t,style:{minWidth:100,width:"calc(100% - 8px)"},label:this.getText(this.props.schema.label),value:n||"",onClick:()=>!this.props.schema.readOnly&&this.setState({showColorDialog:!0,colorDialogValue:n||""}),onChange:i=>{const o=i.target.value,p=this.onChange(this.props.attr,o);p instanceof Promise&&p.catch(s=>console.error(`Cannot set value: ${s}`))},slotProps:{htmlInput:{style:{backgroundColor:n,color:f?"#FFF":"#000"},readOnly:this.props.schema.readOnly||!1},input:{endAdornment:!this.props.schema.readOnly&&n&&!this.props.schema.noClearButton?I.createElement(P.IconButton,{tabIndex:-1,size:"small",onClick:i=>{i.stopPropagation();const o=this.onChange(this.props.attr,"");o instanceof Promise&&o.catch(p=>console.error(`Cannot set value: ${p}`))}},I.createElement(se.Close,null)):void 0},inputLabel:{shrink:!0}}}))}}const kr={width:{width:"calc(100% - 85px)"},width50:{width:120,marginRight:5}};class hu extends q{componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr);this.setState({value:e});const t={};this.props.schema.useSystemName&&(t.useSystem=!!q.getValue(this.props.data,this.props.schema.useSystemName)),this.props.schema.longitudeName&&this.props.schema.latitudeName?(t.longitude=q.getValue(this.props.data,this.props.schema.longitudeName),t.latitude=q.getValue(this.props.data,this.props.schema.latitudeName),!t.longitude&&!t.latitude&&this.props.schema.autoInit&&setTimeout(()=>this.getCoordinates(),300)):!q.getValue(this.props.data,this.props.attr)&&this.props.schema.autoInit&&setTimeout(()=>this.getCoordinates(),300),Object.keys(t).length&&setTimeout(()=>this.setState(t),50)}async getSystemCoordinates(){const e=await this.props.oContext.socket.getCompactSystemConfig();if(e!=null&&e.common&&(e.common.longitude||e.common.latitude))if(window.alert(z.I18n.t("ra_Used system settings")),this.props.schema.longitudeName&&this.props.schema.latitudeName)this.setState({longitude:e.common.longitude,latitude:e.common.latitude},async()=>{await this.onChange(this.props.schema.longitudeName,e.common.longitude),await this.onChange(this.props.schema.latitudeName,e.common.latitude)});else{const t=e.common.latitude+(this.props.schema.divider||",")+e.common.longitude;this.setState({value:t},()=>{const n=this.onChange(this.props.attr,t);n instanceof Promise&&n.catch(f=>console.error(`Cannot set value: ${f}`))})}else window.alert(z.I18n.t("ra_Cannot determine position: System settings are empty and GPS detection is disabled in browser"))}getCoordinates(){navigator.geolocation?navigator.geolocation.getCurrentPosition(async e=>{if(e!=null&&e.coords)if(this.props.schema.longitudeName&&this.props.schema.latitudeName)this.setState({longitude:e.coords.longitude,latitude:e.coords.latitude},async()=>{await this.onChange(this.props.schema.longitudeName,e.coords.longitude||""),await this.onChange(this.props.schema.latitudeName,e.coords.latitude||"")});else{const t=e.coords.latitude+(this.props.schema.divider||",")+e.coords.longitude;this.setState({value:t},()=>{const n=this.onChange(this.props.attr,t);n instanceof Promise&&n.catch(f=>console.error(`Cannot set value: ${f}`))})}else await this.getSystemCoordinates()},async e=>{console.error(`Cannot determine coordinates from browser: ${e.message}`),await this.getSystemCoordinates()}):this.getSystemCoordinates().catch(e=>{console.error(`Cannot determine coordinates: ${e}`)})}renderItem(e,t){return I.createElement(I.Fragment,null,this.props.schema.useSystemName?I.createElement(P.FormControlLabel,{control:I.createElement(P.Checkbox,{checked:!!this.state.useSystem,onChange:n=>{const f=n.target.checked;f&&this.getSystemCoordinates().catch(i=>console.error(`Cannot determine coordinates: ${i}`)),this.setState({useSystem:f},()=>this.onChange(this.props.schema.useSystemName,f))}}),label:z.I18n.t("ra_Use system settings for position")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?I.createElement(P.TextField,{variant:"standard",style:kr.width50,value:this.state.longitude??"",error:!!e,disabled:this.state.useSystem||!!t,onChange:n=>{const f=n.target.value;this.setState({longitude:f},()=>{const i=this.onChange(this.props.schema.longitudeName,(f||"").trim());i instanceof Promise&&i.catch(o=>console.error(`Cannot set value: ${o}`))})},label:z.I18n.t("ra_Longitude")}):null,this.props.schema.longitudeName&&this.props.schema.latitudeName?I.createElement(P.TextField,{variant:"standard",style:kr.width50,value:this.state.latitude??"",error:!!e,disabled:this.state.useSystem||!!t,onChange:n=>{const f=n.target.value;this.setState({latitude:f},()=>this.onChange(this.props.schema.latitudeName,(f||"").trim()))},label:z.I18n.t("ra_Latitude")}):null,!this.props.schema.longitudeName||!this.props.schema.latitudeName?I.createElement(P.TextField,{variant:"standard",style:kr.width,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e,disabled:!!t,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.state.useSystem}},onChange:n=>{const f=n.target.value;this.setState({value:f},()=>this.onChange(this.props.attr,(f||"").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:I.createElement(P.Fab,{size:"small",onClick:()=>this.getCoordinates(),title:z.I18n.t("ra_Take browser position"),style:{marginRight:4}},I.createElement(se.LocationOn,null)),this.state.useSystem?null:I.createElement(P.Fab,{size:"small",onClick:()=>this.getSystemCoordinates(),title:z.I18n.t("ra_Take position from system settings")},I.createElement(se.GpsFixed,null)))}}yc({name:"iobroker_admin",shared:{"@iobroker/adapter-react-v5":{lib:()=>Xl,version:"*"},"@mui/icons-material":{lib:()=>Ql,version:"*"},"@iobroker/json-config":{lib:()=>Ec,version:"*"}},remotes:[]});class si extends q{static runningLoads={};constructor(e){super(e),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 e;this.props.schema.url.startsWith("http:")||this.props.schema.url.startsWith("https:")?e=this.props.schema.url:this.props.schema.url.startsWith("./")?e=`${window.location.protocol}//${window.location.host}${this.props.schema.url.replace(/^\./,"")}`:e=`${window.location.protocol}//${window.location.host}/adapter/${this.props.oContext.adapterName}/${this.props.schema.url}`;const[t,n,...f]=this.props.schema.name.split("/"),i=f.join("/");if(!e){console.error('Cannot find URL for custom component! Please define "url" as "custom/customComponents.js" in the schema');return}if(!t||!n||!i){console.error('Invalid format of "name"! Please define "name" as "ConfigCustomBackItUpSet/Components/AdapterExist" in the schema');return}let o=si.runningLoads[`${e}!${n}`];if(!(o instanceof Promise)){let p;if(this.props.schema.i18n===!0){const s=e.lastIndexOf("/");let u;s!==-1?u=e.substring(0,s):u=e;const r=z.I18n.getLanguage(),a=`${u}/i18n/${r}.json`;p=fetch(a).then(l=>l.json()).then(l=>z.I18n.extendTranslations(l,r)).catch(l=>{if(r!=="en"){fetch(`${u}/i18n/en.json`).then(d=>d.json()).then(d=>z.I18n.extendTranslations(d,r)).catch(d=>console.log(`Cannot load i18n "${a}": ${d}`));return}console.log(`Cannot load i18n "${a}": ${l}`)})}else if(this.props.schema.i18n&&typeof this.props.schema.i18n=="object")try{z.I18n.extendTranslations(this.props.schema.i18n)}catch(s){console.error(`Cannot import i18n: ${s}`)}try{console.log(e,t,n,i),gc([{name:t,entry:e,type:this.props.schema.bundlerType||void 0}]),o=vc(`${t}/${n}`),p instanceof Promise&&(o=Promise.all([o,p]).then(s=>s[0])),si.runningLoads[`${e}!${n}`]=o}catch(s){console.error(s),this.setState({error:`Cannot import from ${this.props.schema.url}: ${s}`})}}try{const p=(await o).default;if(p!=null&&p[i])this.setState({Component:p[i]});else{const s=Object.keys(p||{});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(p){console.error(p),this.setState({error:`Cannot import from ${this.props.schema.url}: ${p}`})}}render(){const e=this.state.Component,t=this.props.schema||{},n=e?I.createElement(e,{...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?I.createElement("div",null,this.state.error):I.createElement(P.LinearProgress,null);return t.newLine?I.createElement(I.Fragment,null,I.createElement("div",{style:{flexBasis:"100%",height:0}}),n):n}}const du=["localeText"],Vr=Q.createContext(null),pu=function(e){const{localeText:t}=e,n=we(e,du),{utils:f,localeText:i}=Q.useContext(Vr)??{utils:void 0,localeText:void 0},o=Te({props:n,name:"MuiLocalizationProvider"}),{children:p,dateAdapter:s,dateFormats:u,dateLibInstance:r,adapterLocale:a,localeText:l}=o,d=Q.useMemo(()=>J({},l,i,t),[l,i,t]),c=Q.useMemo(()=>{if(!s)return f||null;const v=new s({locale:a,formats:u,instance:r});if(!v.isMUIAdapter)throw new Error(["MUI X: The date adapter should be imported from `@mui/x-date-pickers` or `@mui/x-date-pickers-pro`, not from `@date-io`","For example, `import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'` instead of `import AdapterDayjs from '@date-io/dayjs'`","More information on the installation documentation: https://mui.com/x/react-date-pickers/getting-started/#installation"].join(`
`));return v},[s,a,u,r,f]),m=Q.useMemo(()=>c?{minDate:c.date("1900-01-01T00:00:00.000"),maxDate:c.date("2099-12-31T00:00:00.000")}:null,[c]),g=Q.useMemo(()=>({utils:c,defaultDates:m,localeText:d}),[m,c,d]);return ee.jsx(Vr.Provider,{value:g,children:p})},fu=h=>({components:{MuiLocalizationProvider:{defaultProps:{localeText:J({},h)}}}}),Xi=h=>{const{utils:e,formatKey:t,contextTranslation:n,propsTranslation:f}=h;return i=>{const o=i!==null&&e.isValid(i)?e.format(i,t):null;return(f??n)(i,e,o)}},Po={previousMonth:"Previous month",nextMonth:"Next month",openPreviousView:"Open previous view",openNextView:"Open next view",calendarViewSwitchingButtonAriaLabel:h=>h==="year"?"year view is open, switch to calendar view":"calendar view is open, switch to year view",start:"Start",end:"End",startDate:"Start date",startTime:"Start time",endDate:"End date",endTime:"End time",cancelButtonLabel:"Cancel",clearButtonLabel:"Clear",okButtonLabel:"OK",todayButtonLabel:"Today",datePickerToolbarTitle:"Select date",dateTimePickerToolbarTitle:"Select date & time",timePickerToolbarTitle:"Select time",dateRangePickerToolbarTitle:"Select date range",clockLabelText:(h,e,t,n)=>`Select ${h}. ${!n&&(e===null||!t.isValid(e))?"No time selected":`Selected time is ${n??t.format(e,"fullTime")}`}`,hoursClockNumberText:h=>`${h} hours`,minutesClockNumberText:h=>`${h} minutes`,secondsClockNumberText:h=>`${h} seconds`,selectViewText:h=>`Select ${h}`,calendarWeekNumberHeaderLabel:"Week number",calendarWeekNumberHeaderText:"#",calendarWeekNumberAriaLabelText:h=>`Week ${h}`,calendarWeekNumberText:h=>`${h}`,openDatePickerDialogue:(h,e,t)=>t||h!==null&&e.isValid(h)?`Choose date, selected date is ${t??e.format(h,"fullDate")}`:"Choose date",openTimePickerDialogue:(h,e,t)=>t||h!==null&&e.isValid(h)?`Choose time, selected time is ${t??e.format(h,"fullTime")}`:"Choose time",fieldClearLabel:"Clear",timeTableLabel:"pick time",dateTableLabel:"pick date",fieldYearPlaceholder:h=>"Y".repeat(h.digitAmount),fieldMonthPlaceholder:h=>h.contentType==="letter"?"MMMM":"MM",fieldDayPlaceholder:()=>"DD",fieldWeekDayPlaceholder:h=>h.contentType==="letter"?"EEEE":"EE",fieldHoursPlaceholder:()=>"hh",fieldMinutesPlaceholder:()=>"mm",fieldSecondsPlaceholder:()=>"ss",fieldMeridiemPlaceholder:()=>"aa",year:"Year",month:"Month",day:"Day",weekDay:"Week day",hours:"Hours",minutes:"Minutes",seconds:"Seconds",meridiem:"Meridiem",empty:"Empty"},mu=Po;fu(Po);const vn=()=>{const h=Q.useContext(Vr);if(h===null)throw new Error(["MUI X: Can not find the date and time pickers localization context.","It looks like you forgot to wrap your component in LocalizationProvider.","This can also happen if you are bundling multiple versions of the `@mui/x-date-pickers` package"].join(`
`));if(h.utils===null)throw new Error(["MUI X: Can not find the date and time pickers adapter from its localization context.","It looks like you forgot to pass a `dateAdapter` to your LocalizationProvider."].join(`
`));const e=Q.useMemo(()=>J({},mu,h.localeText),[h.localeText]);return Q.useMemo(()=>J({},h,{localeText:e}),[h,e])},$e=()=>vn().utils,di=()=>vn().defaultDates,yn=h=>{const e=$e(),t=Q.useRef(void 0);return t.current===void 0&&(t.current=e.date(void 0,h)),t.current},et=()=>vn().localeText,gu=Q.createContext(),At=()=>Q.useContext(gu)??!1,vu=qt(ee.jsx("path",{d:"M7 10l5 5 5-5z"}),"ArrowDropDown"),yu=qt(ee.jsx("path",{d:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"}),"ArrowLeft"),bu=qt(ee.jsx("path",{d:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z"}),"ArrowRight"),wu=qt(ee.jsx("path",{d:"M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z"}),"Calendar"),Cu=qt(ee.jsxs(Q.Fragment,{children:[ee.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),ee.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Clock");qt(ee.jsx("path",{d:"M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"}),"DateRange");qt(ee.jsxs(Q.Fragment,{children:[ee.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"}),ee.jsx("path",{d:"M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"})]}),"Time");const xu=qt(ee.jsx("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Clear");function Su(h){return Fe("MuiPickersArrowSwitcher",h)}Re("MuiPickersArrowSwitcher",["root","spacer","button","previousIconButton","nextIconButton","leftArrowIcon","rightArrowIcon"]);const Du=["children","className","slots","slotProps","isNextDisabled","isNextHidden","onGoToNext","nextLabel","isPreviousDisabled","isPreviousHidden","onGoToPrevious","previousLabel","labelId"],Eu=["ownerState"],Au=["ownerState"],Tu=me("div",{name:"MuiPickersArrowSwitcher",slot:"Root",overridesResolver:(h,e)=>e.root})({display:"flex"}),ku=me("div",{name:"MuiPickersArrowSwitcher",slot:"Spacer",overridesResolver:(h,e)=>e.spacer})(({theme:h})=>({width:h.spacing(3)})),Ls=me(Nn,{name:"MuiPickersArrowSwitcher",slot:"Button",overridesResolver:(h,e)=>e.button})({variants:[{props:{hidden:!0},style:{visibility:"hidden"}}]}),$u=h=>{const{classes:e}=h;return Me({root:["root"],spacer:["spacer"],button:["button"],previousIconButton:["previousIconButton"],nextIconButton:["nextIconButton"],leftArrowIcon:["leftArrowIcon"],rightArrowIcon:["rightArrowIcon"]},Su,e)},No=Q.forwardRef(function(e,t){const n=At(),f=Te({props:e,name:"MuiPickersArrowSwitcher"}),{children:i,className:o,slots:p,slotProps:s,isNextDisabled:u,isNextHidden:r,onGoToNext:a,nextLabel:l,isPreviousDisabled:d,isPreviousHidden:c,onGoToPrevious:m,previousLabel:g,labelId:v}=f,b=we(f,Du),E=f,S=$u(E),w={isDisabled:u,isHidden:r,goTo:a,label:l},y={isDisabled:d,isHidden:c,goTo:m,label:g},D=(p==null?void 0:p.previousIconButton)??Ls,$=Ie({elementType:D,externalSlotProps:s==null?void 0:s.previousIconButton,additionalProps:{size:"medium",title:y.label,"aria-label":y.label,disabled:y.isDisabled,edge:"end",onClick:y.goTo},ownerState:J({},E,{hidden:y.isHidden}),className:Oe(S.button,S.previousIconButton)}),A=(p==null?void 0:p.nextIconButton)??Ls,_=Ie({elementType:A,externalSlotProps:s==null?void 0:s.nextIconButton,additionalProps:{size:"medium",title:w.label,"aria-label":w.label,disabled:w.isDisabled,edge:"start",onClick:w.goTo},ownerState:J({},E,{hidden:w.isHidden}),className:Oe(S.button,S.nextIconButton)}),L=(p==null?void 0:p.leftArrowIcon)??yu,T=Ie({elementType:L,externalSlotProps:s==null?void 0:s.leftArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:E,className:S.leftArrowIcon}),k=we(T,Eu),x=(p==null?void 0:p.rightArrowIcon)??bu,C=Ie({elementType:x,externalSlotProps:s==null?void 0:s.rightArrowIcon,additionalProps:{fontSize:"inherit"},ownerState:E,className:S.rightArrowIcon}),M=we(C,Au);return ee.jsxs(Tu,J({ref:t,className:Oe(S.root,o),ownerState:E},b,{children:[ee.jsx(D,J({},$,{children:n?ee.jsx(x,J({},M)):ee.jsx(L,J({},k))})),i?ee.jsx(Zt,{variant:"subtitle1",component:"span",id:v,children:i}):ee.jsx(ku,{className:S.spacer,ownerState:E}),ee.jsx(A,J({},_,{children:n?ee.jsx(L,J({},k)):ee.jsx(x,J({},M))}))]}))}),$t=(h,e)=>h.length!==e.length?!1:e.every(t=>h.includes(t)),Bo=({openTo:h,defaultOpenTo:e,views:t,defaultViews:n})=>{const f=t??n;let i;if(h!=null)i=h;else if(f.includes(e))i=e;else if(f.length>0)i=f[0];else throw new Error("MUI X: The `views` prop must contain at least one view.");return{views:f,openTo:i}},Vo=["hours","minutes","seconds"],oi=h=>Vo.includes(h),Mu=h=>Vo.includes(h)||h==="meridiem",_u=(h,e)=>h?e.getHours(h)>=12?"pm":"am":null,ai=(h,e,t)=>t&&(h>=12?"pm":"am")!==e?e==="am"?h-12:h+12:h,Iu=(h,e,t,n)=>{const f=ai(n.getHours(h),e,t);return n.setHours(h,f)},Fs=(h,e)=>e.getHours(h)*3600+e.getMinutes(h)*60+e.getSeconds(h),pi=(h,e)=>(t,n)=>h?e.isAfter(t,n):Fs(t,e)>Fs(n,e),Wo=(h,{format:e,views:t,ampm:n})=>{if(e!=null)return e;const f=h.formats;return $t(t,["hours"])?n?`${f.hours12h} ${f.meridiem}`:f.hours24h:$t(t,["minutes"])?f.minutes:$t(t,["seconds"])?f.seconds:$t(t,["minutes","seconds"])?`${f.minutes}:${f.seconds}`:$t(t,["hours","minutes","seconds"])?n?`${f.hours12h}:${f.minutes}:${f.seconds} ${f.meridiem}`:`${f.hours24h}:${f.minutes}:${f.seconds}`:n?`${f.hours12h}:${f.minutes} ${f.meridiem}`:`${f.hours24h}:${f.minutes}`};function fi({onChange:h,onViewChange:e,openTo:t,view:n,views:f,autoFocus:i,focusedView:o,onFocusedViewChange:p}){const s=Q.useRef(t),u=Q.useRef(f),r=Q.useRef(f.includes(t)?t:f[0]),[a,l]=pn({name:"useViews",state:"view",controlled:n,default:r.current}),d=Q.useRef(i?a:null),[c,m]=pn({name:"useViews",state:"focusedView",controlled:o,default:d.current});Q.useEffect(()=>{(s.current&&s.current!==t||u.current&&u.current.some(D=>!f.includes(D)))&&(l(f.includes(t)?t:f[0]),u.current=f,s.current=t)},[t,l,a,f]);const g=f.indexOf(a),v=f[g-1]??null,b=f[g+1]??null,E=ve((D,$)=>{m($?D:A=>D===A?null:A),p==null||p(D,$)}),S=ve(D=>{E(D,!0),D!==a&&(l(D),e&&e(D))}),w=ve(()=>{b&&S(b)}),y=ve((D,$,A)=>{const _=$==="finish",L=A?f.indexOf(A)<f.length-1:!!b;if(h(D,_&&L?"partial":$,A),A&&A!==a){const k=f[f.indexOf(A)+1];k&&S(k)}else _&&w()});return{view:a,setView:S,focusedView:c,setFocusedView:E,nextView:b,previousView:v,defaultView:f.includes(t)?t:f[0],goToNextView:w,setValueAndGoToNextView:y}}function Lu(h,{disableFuture:e,maxDate:t,timezone:n}){const f=$e();return Q.useMemo(()=>{const i=f.date(void 0,n),o=f.startOfMonth(e&&f.isBefore(i,t)?i:t);return!f.isAfter(o,h)},[e,t,h,f,n])}function Fu(h,{disablePast:e,minDate:t,timezone:n}){const f=$e();return Q.useMemo(()=>{const i=f.date(void 0,n),o=f.startOfMonth(e&&f.isAfter(i,t)?i:t);return!f.isBefore(o,h)},[e,t,h,f,n])}function Xr(h,e,t,n){const f=$e(),i=_u(h,f),o=Q.useCallback(p=>{const s=h==null?null:Iu(h,p,!!e,f);t(s,n??"partial")},[e,h,t,n,f]);return{meridiemMode:i,handleMeridiemChange:o}}const li=36,Zi=2,qi=320,Ru=280,Zr=336,jo=232,Ou=48,er=me("div")({overflow:"hidden",width:qi,maxHeight:Zr,display:"flex",flexDirection:"column",margin:"0 auto"});function Pu(h){return Fe("MuiTimeClock",h)}Re("MuiTimeClock",["root","arrowSwitcher"]);const Rn=220,Nt=36,ci={x:Rn/2,y:Rn/2},Ho={x:ci.x,y:0},Nu=Ho.x-ci.x,Bu=Ho.y-ci.y,Vu=h=>h*(180/Math.PI),zo=(h,e,t)=>{const n=e-ci.x,f=t-ci.y,i=Math.atan2(Nu,Bu)-Math.atan2(n,f);let o=Vu(i);o=Math.round(o/h)*h,o%=360;const p=Math.floor(o/h)||0,s=n**2+f**2,u=Math.sqrt(s);return{value:p,distance:u}},Wu=(h,e,t=1)=>{const n=t*6;let{value:f}=zo(n,h,e);return f=f*t%60,f},ju=(h,e,t)=>{const{value:n,distance:f}=zo(30,h,e);let i=n||12;return t?i%=12:f<Rn/2-Nt&&(i+=12,i%=24),i};function Hu(h){return Fe("MuiClockPointer",h)}Re("MuiClockPointer",["root","thumb"]);const zu=["className","hasSelected","isInner","type","viewValue"],Uu=h=>{const{classes:e}=h;return Me({root:["root"],thumb:["thumb"]},Hu,e)},Gu=me("div",{name:"MuiClockPointer",slot:"Root",overridesResolver:(h,e)=>e.root})(({theme:h})=>({width:2,backgroundColor:(h.vars||h).palette.primary.main,position:"absolute",left:"calc(50% - 1px)",bottom:"50%",transformOrigin:"center bottom 0px",variants:[{props:{shouldAnimate:!0},style:{transition:h.transitions.create(["transform","height"])}}]})),Ku=me("div",{name:"MuiClockPointer",slot:"Thumb",overridesResolver:(h,e)=>e.thumb})(({theme:h})=>({width:4,height:4,backgroundColor:(h.vars||h).palette.primary.contrastText,borderRadius:"50%",position:"absolute",top:-21,left:`calc(50% - ${Nt/2}px)`,border:`${(Nt-4)/2}px solid ${(h.vars||h).palette.primary.main}`,boxSizing:"content-box",variants:[{props:{hasSelected:!0},style:{backgroundColor:(h.vars||h).palette.primary.main}}]}));function Yu(h){const e=Te({props:h,name:"MuiClockPointer"}),{className:t,isInner:n,type:f,viewValue:i}=e,o=we(e,zu),p=Q.useRef(f);Q.useEffect(()=>{p.current=f},[f]);const s=J({},e,{shouldAnimate:p.current!==f}),u=Uu(s),r=()=>{let l=360/(f==="hours"?12:60)*i;return f==="hours"&&i>12&&(l-=360),{height:Math.round((n?.26:.4)*Rn),transform:`rotateZ(${l}deg)`}};return ee.jsx(Gu,J({style:r(),className:Oe(u.root,t),ownerState:s},o,{children:ee.jsx(Ku,{ownerState:s,className:u.thumb})}))}function Ju(h){return Fe("MuiClock",h)}Re("MuiClock",["root","clock","wrapper","squareMask","pin","amButton","pmButton","meridiemText","selected"]);const Wi=(h,e,t)=>{let n=e;return n=h.setHours(n,h.getHours(t)),n=h.setMinutes(n,h.getMinutes(t)),n=h.setSeconds(n,h.getSeconds(t)),n=h.setMilliseconds(n,h.getMilliseconds(t)),n},ni=({date:h,disableFuture:e,disablePast:t,maxDate:n,minDate:f,isDateDisabled:i,utils:o,timezone:p})=>{const s=Wi(o,o.date(void 0,p),h);t&&o.isBefore(f,s)&&(f=s),e&&o.isAfter(n,s)&&(n=s);let u=h,r=h;for(o.isBefore(h,f)&&(u=f,r=null),o.isAfter(h,n)&&(r&&(r=n),u=null);u||r;){if(u&&o.isAfter(u,n)&&(u=null),r&&o.isBefore(r,f)&&(r=null),u){if(!i(u))return u;u=o.addDays(u,1)}if(r){if(!i(r))return r;r=o.addDays(r,-1)}}return null},Qu=(h,e)=>e==null||!h.isValid(e)?null:e,vt=(h,e,t)=>e==null||!h.isValid(e)?t:e,Xu=(h,e,t)=>!h.isValid(e)&&e!=null&&!h.isValid(t)&&t!=null?!0:h.isEqual(e,t),qr=(h,e)=>{const n=[h.startOfYear(e)];for(;n.length<12;){const f=n[n.length-1];n.push(h.addMonths(f,1))}return n},es=(h,e,t)=>t==="date"?h.startOfDay(h.date(void 0,e)):h.date(void 0,e),Jt=(h,e)=>{const t=h.setHours(h.date(),e==="am"?2:14);return h.format(t,"meridiem")},Zu=["year","month","day"],Rs=h=>Zu.includes(h),ts=(h,{format:e,views:t},n)=>{if(e!=null)return e;const f=h.formats;return $t(t,["year"])?f.year:$t(t,["month"])?f.month:$t(t,["day"])?f.dayOfMonth:$t(t,["month","year"])?`${f.month} ${f.year}`:$t(t,["day","month"])?`${f.month} ${f.dayOfMonth}`:n?/en/.test(h.getCurrentLocaleCode())?f.normalDateWithWeekday:f.normalDate:f.keyboardDate},qu=(h,e)=>{const t=h.startOfWeek(e);return[0,1,2,3,4,5,6].map(n=>h.addDays(t,n))},eh=h=>{const{classes:e,meridiemMode:t}=h;return Me({root:["root"],clock:["clock"],wrapper:["wrapper"],squareMask:["squareMask"],pin:["pin"],amButton:["amButton",t==="am"&&"selected"],pmButton:["pmButton",t==="pm"&&"selected"],meridiemText:["meridiemText"]},Ju,e)},th=me("div",{name:"MuiClock",slot:"Root",overridesResolver:(h,e)=>e.root})(({theme:h})=>({display:"flex",justifyContent:"center",alignItems:"center",margin:h.spacing(2)})),nh=me("div",{name:"MuiClock",slot:"Clock",overridesResolver:(h,e)=>e.clock})({backgroundColor:"rgba(0,0,0,.07)",borderRadius:"50%",height:220,width:220,flexShrink:0,position:"relative",pointerEvents:"none"}),ih=me("div",{name:"MuiClock",slot:"Wrapper",overridesResolver:(h,e)=>e.wrapper})({"&:focus":{outline:"none"}}),rh=me("div",{name:"MuiClock",slot:"SquareMask",overridesResolver:(h,e)=>e.squareMask})({width:"100%",height:"100%",position:"absolute",pointerEvents:"auto",outline:0,touchAction:"none",userSelect:"none",variants:[{props:{disabled:!1},style:{"@media (pointer: fine)":{cursor:"pointer",borderRadius:"50%"},"&:active":{cursor:"move"}}}]}),sh=me("div",{name:"MuiClock",slot:"Pin",overridesResolver:(h,e)=>e.pin})(({theme:h})=>({width:6,height:6,borderRadius:"50%",backgroundColor:(h.vars||h).palette.primary.main,position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)"})),Uo=(h,e)=>({zIndex:1,bottom:8,paddingLeft:4,paddingRight:4,width:Nt,variants:[{props:{meridiemMode:e},style:{backgroundColor:(h.vars||h).palette.primary.main,color:(h.vars||h).palette.primary.contrastText,"&:hover":{backgroundColor:(h.vars||h).palette.primary.light}}}]}),oh=me(Nn,{name:"MuiClock",slot:"AmButton",overridesResolver:(h,e)=>e.amButton})(({theme:h})=>J({},Uo(h,"am"),{position:"absolute",left:8})),ah=me(Nn,{name:"MuiClock",slot:"PmButton",overridesResolver:(h,e)=>e.pmButton})(({theme:h})=>J({},Uo(h,"pm"),{position:"absolute",right:8})),Os=me(Zt,{name:"MuiClock",slot:"meridiemText",overridesResolver:(h,e)=>e.meridiemText})({overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"});function lh(h){const e=Te({props:h,name:"MuiClock"}),{ampm:t,ampmInClock:n,autoFocus:f,children:i,value:o,handleMeridiemChange:p,isTimeDisabled:s,meridiemMode:u,minutesStep:r=1,onChange:a,selectedId:l,type:d,viewValue:c,viewRange:[m,g],disabled:v=!1,readOnly:b,className:E}=e,S=e,w=$e(),y=et(),D=Q.useRef(!1),$=eh(S),A=s(c,d),_=!t&&d==="hours"&&(c<1||c>12),L=(V,W)=>{v||b||s(V,d)||a(V,W)},T=(V,W)=>{let{offsetX:H,offsetY:U}=V;if(H===void 0){const Y=V.target.getBoundingClientRect();H=V.changedTouches[0].clientX-Y.left,U=V.changedTouches[0].clientY-Y.top}const X=d==="seconds"||d==="minutes"?Wu(H,U,r):ju(H,U,!!t);L(X,W)},k=V=>{D.current=!0,T(V,"shallow")},x=V=>{D.current&&(T(V,"finish"),D.current=!1),V.preventDefault()},C=V=>{V.buttons>0&&T(V.nativeEvent,"shallow")},M=V=>{D.current&&(D.current=!1),T(V.nativeEvent,"finish")},F=Q.useMemo(()=>d==="hours"?!0:c%5===0,[d,c]),R=d==="minutes"?r:1,O=Q.useRef(null);Bt(()=>{f&&O.current.focus()},[f]);const B=V=>Math.max(m,Math.min(g,V)),N=V=>(V+(g+1))%(g+1),j=V=>{if(!D.current)switch(V.key){case"Home":L(m,"partial"),V.preventDefault();break;case"End":L(g,"partial"),V.preventDefault();break;case"ArrowUp":L(N(c+R),"partial"),V.preventDefault();break;case"ArrowDown":L(N(c-R),"partial"),V.preventDefault();break;case"PageUp":L(B(c+5),"partial"),V.preventDefault();break;case"PageDown":L(B(c-5),"partial"),V.preventDefault();break;case"Enter":case" ":L(c,"finish"),V.preventDefault();break}};return ee.jsxs(th,{className:Oe($.root,E),children:[ee.jsxs(nh,{className:$.clock,children:[ee.jsx(rh,{onTouchMove:k,onTouchStart:k,onTouchEnd:x,onMouseUp:M,onMouseMove:C,ownerState:{disabled:v},className:$.squareMask}),!A&&ee.jsxs(Q.Fragment,{children:[ee.jsx(sh,{className:$.pin}),o!=null&&ee.jsx(Yu,{type:d,viewValue:c,isInner:_,hasSelected:F})]}),ee.jsx(ih,{"aria-activedescendant":l,"aria-label":y.clockLabelText(d,o,w,o==null?null:w.format(o,"fullTime")),ref:O,role:"listbox",onKeyDown:j,tabIndex:0,className:$.wrapper,children:i})]}),t&&n&&ee.jsxs(Q.Fragment,{children:[ee.jsx(oh,{onClick:b?void 0:()=>p("am"),disabled:v||u===null,ownerState:S,className:$.amButton,title:Jt(w,"am"),children:ee.jsx(Os,{variant:"caption",className:$.meridiemText,children:Jt(w,"am")})}),ee.jsx(ah,{disabled:v||u===null,onClick:b?void 0:()=>p("pm"),ownerState:S,className:$.pmButton,title:Jt(w,"pm"),children:ee.jsx(Os,{variant:"caption",className:$.meridiemText,children:Jt(w,"pm")})})]})]})}function ch(h){return Fe("MuiClockNumber",h)}const $i=Re("MuiClockNumber",["root","selected","disabled"]),uh=["className","disabled","index","inner","label","selected"],hh=h=>{const{classes:e,selected:t,disabled:n}=h;return Me({root:["root",t&&"selected",n&&"disabled"]},ch,e)},dh=me("span",{name:"MuiClockNumber",slot:"Root",overridesResolver:(h,e)=>[e.root,{[`&.${$i.disabled}`]:e.disabled},{[`&.${$i.selected}`]:e.selected}]})(({theme:h})=>({height:Nt,width:Nt,position:"absolute",left:`calc((100% - ${Nt}px) / 2)`,display:"inline-flex",justifyContent:"center",alignItems:"center",borderRadius:"50%",color:(h.vars||h).palette.text.primary,fontFamily:h.typography.fontFamily,"&:focused":{backgroundColor:(h.vars||h).palette.background.paper},[`&.${$i.selected}`]:{color:(h.vars||h).palette.primary.contrastText},[`&.${$i.disabled}`]:{pointerEvents:"none",color:(h.vars||h).palette.text.disabled},variants:[{props:{inner:!0},style:J({},h.typography.body2,{color:(h.vars||h).palette.text.secondary})}]}));function Go(h){const e=Te({props:h,name:"MuiClockNumber"}),{className:t,disabled:n,index:f,inner:i,label:o,selected:p}=e,s=we(e,uh),u=e,r=hh(u),a=f%12/12*Math.PI*2-Math.PI/2,l=(Rn-Nt-2)/2*(i?.65:1),d=Math.round(Math.cos(a)*l),c=Math.round(Math.sin(a)*l);return ee.jsx(dh,J({className:Oe(r.root,t),"aria-disabled":n?!0:void 0,"aria-selected":p?!0:void 0,role:"option",style:{transform:`translate(${d}px, ${c+(Rn-Nt)/2}px`},ownerState:u},s,{children:o}))}const ph=({ampm:h,value:e,getClockNumberText:t,isDisabled:n,selectedId:f,utils:i})=>{const o=e?i.getHours(e):null,p=[],s=h?1:0,u=h?12:23,r=a=>o===null?!1:h?a===12?o===12||o===0:o===a||o-12===a:o===a;for(let a=s;a<=u;a+=1){let l=a.toString();a===0&&(l="00");const d=!h&&(a===0||a>12);l=i.formatNumber(l);const c=r(a);p.push(ee.jsx(Go,{id:c?f:void 0,index:a,inner:d,selected:c,disabled:n(a),label:l,"aria-label":t(l)},a))}return p},Ps=({utils:h,value:e,isDisabled:t,getClockNumberText:n,selectedId:f})=>{const i=h.formatNumber;return[[5,i("05")],[10,i("10")],[15,i("15")],[20,i("20")],[25,i("25")],[30,i("30")],[35,i("35")],[40,i("40")],[45,i("45")],[50,i("50")],[55,i("55")],[0,i("00")]].map(([o,p],s)=>{const u=o===e;return ee.jsx(Go,{label:p,id:u?f:void 0,index:s+1,inner:!1,disabled:t(o),selected:u,"aria-label":n(p)},o)})},ns=({timezone:h,value:e,defaultValue:t,referenceDate:n,onChange:f,valueManager:i})=>{const o=$e(),p=Q.useRef(t),s=e??p.current??i.emptyValue,u=Q.useMemo(()=>i.getTimezone(o,s),[o,i,s]),r=ve(c=>u==null?c:i.setTimezone(o,u,c));let a;h?a=h:u?a=u:n?a=o.getTimezone(n):a="default";const l=Q.useMemo(()=>i.setTimezone(o,a,s),[i,o,a,s]),d=ve((c,...m)=>{const g=r(c);f==null||f(g,...m)});return{value:l,handleValueChange:d,timezone:a}},Bn=({name:h,timezone:e,value:t,defaultValue:n,referenceDate:f,onChange:i,valueManager:o})=>{const[p,s]=pn({name:h,state:"value",controlled:t,default:n??o.emptyValue}),u=ve((r,...a)=>{s(r),i==null||i(r,...a)});return ns({timezone:e,value:p,defaultValue:void 0,referenceDate:f,onChange:u,valueManager:o})},St={year:1,month:2,day:3,hours:4,minutes:5,seconds:6,milliseconds:7},fh=h=>Math.max(...h.map(e=>St[e.type]??1)),Yn=(h,e,t)=>{if(e===St.year)return h.startOfYear(t);if(e===St.month)return h.startOfMonth(t);if(e===St.day)return h.startOfDay(t);let n=t;return e<St.minutes&&(n=h.setMinutes(n,0)),e<St.seconds&&(n=h.setSeconds(n,0)),e<St.milliseconds&&(n=h.setMilliseconds(n,0)),n},mh=({props:h,utils:e,granularity:t,timezone:n,getTodayDate:f})=>{let i=f?f():Yn(e,t,es(e,n));h.minDate!=null&&e.isAfterDay(h.minDate,i)&&(i=Yn(e,t,h.minDate)),h.maxDate!=null&&e.isBeforeDay(h.maxDate,i)&&(i=Yn(e,t,h.maxDate));const o=pi(h.disableIgnoringDatePartForTimeValidation??!1,e);return h.minTime!=null&&o(h.minTime,i)&&(i=Yn(e,t,h.disableIgnoringDatePartForTimeValidation?h.minTime:Wi(e,i,h.minTime))),h.maxTime!=null&&o(i,h.maxTime)&&(i=Yn(e,t,h.disableIgnoringDatePartForTimeValidation?h.maxTime:Wi(e,i,h.maxTime))),i},Ko=(h,e)=>{const t=h.formatTokenMap[e];if(t==null)throw new Error([`MUI X: The token "${e}" is not supported by the Date and Time Pickers.`,"Please try using another token or open an issue on https://github.com/mui/mui-x/issues/new/choose if you think it should be supported."].join(`
`));return typeof t=="string"?{type:t,contentType:t==="meridiem"?"letter":"digit",maxLength:void 0}:{type:t.sectionType,contentType:t.contentType,maxLength:t.maxLength}},gh=h=>{switch(h){case"ArrowUp":return 1;case"ArrowDown":return-1;case"PageUp":return 5;case"PageDown":return-5;default:return 0}},tr=(h,e)=>{const t=[],n=h.date(void 0,"default"),f=h.startOfWeek(n),i=h.endOfWeek(n);let o=f;for(;h.isBefore(o,i);)t.push(o),o=h.addDays(o,1);return t.map(p=>h.formatByString(p,e))},Yo=(h,e,t,n)=>{switch(t){case"month":return qr(h,h.date(void 0,e)).map(f=>h.formatByString(f,n));case"weekDay":return tr(h,n);case"meridiem":{const f=h.date(void 0,e);return[h.startOfDay(f),h.endOfDay(f)].map(i=>h.formatByString(i,n))}default:return[]}},Ns="s",vh=["0","1","2","3","4","5","6","7","8","9"],yh=h=>{const e=h.date(void 0);return h.formatByString(h.setSeconds(e,0),Ns)==="0"?vh:Array.from({length:10}).map((n,f)=>h.formatByString(h.setSeconds(e,f),Ns))},fn=(h,e)=>{if(e[0]==="0")return h;const t=[];let n="";for(let f=0;f<h.length;f+=1){n+=h[f];const i=e.indexOf(n);i>-1&&(t.push(i.toString()),n="")}return t.join("")},is=(h,e)=>e[0]==="0"?h:h.split("").map(t=>e[Number(t)]).join(""),Bs=(h,e)=>{const t=fn(h,e);return t!==" "&&!Number.isNaN(Number(t))},Jo=(h,e)=>{let t=h;for(t=Number(t).toString();t.length<e;)t=`0${t}`;return t},Qo=(h,e,t,n,f)=>{if(f.type==="day"&&f.contentType==="digit-with-letter"){const o=h.setDate(t.longestMonth,e);return h.formatByString(o,f.format)}let i=e.toString();return f.hasLeadingZerosInInput&&(i=Jo(i,f.maxLength)),is(i,n)},bh=(h,e,t,n,f,i,o,p)=>{const s=gh(n),u=n==="Home",r=n==="End",a=t.value===""||u||r,l=()=>{const c=f[t.type]({currentDate:o,format:t.format,contentType:t.contentType}),m=b=>Qo(h,b,c,i,t),g=t.type==="minutes"&&(p!=null&&p.minutesStep)?p.minutesStep:1;let v;if(a){if(t.type==="year"&&!r&&!u)return h.formatByString(h.date(void 0,e),t.format);s>0||u?v=c.minimum:v=c.maximum}else v=parseInt(fn(t.value,i),10)+s*g;return v%g!==0&&((s<0||u)&&(v+=g-(g+v)%g),(s>0||r)&&(v-=v%g)),v>c.maximum?m(c.minimum+(v-c.maximum-1)%(c.maximum-c.minimum+1)):v<c.minimum?m(c.maximum-(c.minimum-v-1)%(c.maximum-c.minimum+1)):m(v)},d=()=>{const c=Yo(h,e,t.type,t.format);if(c.length===0)return t.value;if(a)return s>0||u?c[0]:c[c.length-1];const v=((c.indexOf(t.value)+s)%c.length+c.length)%c.length;return c[v]};return t.contentType==="digit"||t.contentType==="digit-with-letter"?l():d()},rs=(h,e,t)=>{let n=h.value||h.placeholder;const f=e==="non-input"?h.hasLeadingZerosInFormat:h.hasLeadingZerosInInput;return e==="non-input"&&h.hasLeadingZerosInInput&&!h.hasLeadingZerosInFormat&&(n=Number(fn(n,t)).toString()),["input-rtl","input-ltr"].includes(e)&&h.contentType==="digit"&&!f&&n.length===1&&(n=`${n}`),e==="input-rtl"&&(n=`${n}`),n},Vs=(h,e,t,n)=>h.formatByString(h.parse(e,t),n),wh=(h,e)=>h.formatByString(h.date(void 0,"system"),e).length===4,Xo=(h,e,t,n)=>{if(e!=="digit")return!1;const f=h.date(void 0,"default");switch(t){case"year":return h.lib==="dayjs"&&n==="YY"?!0:h.formatByString(h.setYear(f,1),n).startsWith("0");case"month":return h.formatByString(h.startOfYear(f),n).length>1;case"day":return h.formatByString(h.startOfMonth(f),n).length>1;case"weekDay":return h.formatByString(h.startOfWeek(f),n).length>1;case"hours":return h.formatByString(h.setHours(f,1),n).length>1;case"minutes":return h.formatByString(h.setMinutes(f,1),n).length>1;case"seconds":return h.formatByString(h.setSeconds(f,1),n).length>1;default:throw new Error("Invalid section type")}},Ch=(h,e,t)=>{const n=e.some(s=>s.type==="day"),f=[],i=[];for(let s=0;s<e.length;s+=1){const u=e[s];n&&u.type==="weekDay"||(f.push(u.format),i.push(rs(u,"non-input",t)))}const o=f.join(" "),p=i.join(" ");return h.parse(p,o)},xh=h=>h.map(e=>`${e.startSeparator}${e.value||e.placeholder}${e.endSeparator}`).join(""),Sh=(h,e,t)=>{const f=h.map(i=>{const o=rs(i,t?"input-rtl":"input-ltr",e);return`${i.startSeparator}${o}${i.endSeparator}`}).join("");return t?`${f}`:f},Dh=(h,e,t)=>{const n=h.date(void 0,t),f=h.endOfYear(n),i=h.endOfDay(n),{maxDaysInMonth:o,longestMonth:p}=qr(h,n).reduce((s,u)=>{const r=h.getDaysInMonth(u);return r>s.maxDaysInMonth?{maxDaysInMonth:r,longestMonth:u}:s},{maxDaysInMonth:0,longestMonth:null});return{year:({format:s})=>({minimum:0,maximum:wh(h,s)?9999:99}),month:()=>({minimum:1,maximum:h.getMonth(f)+1}),day:({currentDate:s})=>({minimum:1,maximum:s!=null&&h.isValid(s)?h.getDaysInMonth(s):o,longestMonth:p}),weekDay:({format:s,contentType:u})=>{if(u==="digit"){const r=tr(h,s).map(Number);return{minimum:Math.min(...r),maximum:Math.max(...r)}}return{minimum:1,maximum:7}},hours:({format:s})=>{const u=h.getHours(i);return fn(h.formatByString(h.endOfDay(n),s),e)!==u.toString()?{minimum:1,maximum:Number(fn(h.formatByString(h.startOfDay(n),s),e))}:{minimum:0,maximum:u}},minutes:()=>({minimum:0,maximum:h.getMinutes(i)}),seconds:()=>({minimum:0,maximum:h.getSeconds(i)}),meridiem:()=>({minimum:0,maximum:1}),empty:()=>({minimum:0,maximum:0})}},Eh=(h,e,t,n)=>{switch(e.type){case"year":return h.setYear(n,h.getYear(t));case"month":return h.setMonth(n,h.getMonth(t));case"weekDay":{const f=tr(h,e.format),i=h.formatByString(t,e.format),o=f.indexOf(i),s=f.indexOf(e.value)-o;return h.addDays(t,s)}case"day":return h.setDate(n,h.getDate(t));case"meridiem":{const f=h.getHours(t)<12,i=h.getHours(n);return f&&i>=12?h.addHours(n,-12):!f&&i<12?h.addHours(n,12):n}case"hours":return h.setHours(n,h.getHours(t));case"minutes":return h.setMinutes(n,h.getMinutes(t));case"seconds":return h.setSeconds(n,h.getSeconds(t));default:return n}},Ws={year:1,month:2,day:3,weekDay:4,hours:5,minutes:6,seconds:7,meridiem:8,empty:9},js=(h,e,t,n,f)=>[...t].sort((i,o)=>Ws[i.type]-Ws[o.type]).reduce((i,o)=>!f||o.modified?Eh(h,o,e,i):i,n),Ah=()=>navigator.userAgent.toLowerCase().includes("android"),Th=(h,e)=>{const t={};if(!e)return h.forEach((s,u)=>{const r=u===0?null:u-1,a=u===h.length-1?null:u+1;t[u]={leftIndex:r,rightIndex:a}}),{neighbors:t,startIndex:0,endIndex:h.length-1};const n={},f={};let i=0,o=0,p=h.length-1;for(;p>=0;){o=h.findIndex((s,u)=>{var r;return u>=i&&((r=s.endSeparator)==null?void 0:r.includes(" "))&&s.endSeparator!==" / "}),o===-1&&(o=h.length-1);for(let s=o;s>=i;s-=1)f[s]=p,n[p]=s,p-=1;i=o+1}return h.forEach((s,u)=>{const r=f[u],a=r===0?null:n[r-1],l=r===h.length-1?null:n[r+1];t[u]={leftIndex:a,rightIndex:l}}),{neighbors:t,startIndex:n[0],endIndex:n[h.length-1]}},Wr=(h,e)=>{if(h==null)return null;if(h==="all")return"all";if(typeof h=="string"){const t=e.findIndex(n=>n.type===h);return t===-1?null:t}return h},kh=(h,e)=>{if(h.value)switch(h.type){case"month":{if(h.contentType==="digit")return e.format(e.setMonth(e.date(),Number(h.value)-1),"month");const t=e.parse(h.value,h.format);return t?e.format(t,"month"):void 0}case"day":return h.contentType==="digit"?e.format(e.setDate(e.startOfYear(e.date()),Number(h.value)),"dayOfMonthFull"):h.value;case"weekDay":return;default:return}},$h=(h,e)=>{if(h.value)switch(h.type){case"weekDay":return h.contentType==="letter"?void 0:Number(h.value);case"meridiem":{const t=e.parse(`01:00 ${h.value}`,`${e.formats.hours12h}:${e.formats.minutes} ${h.format}`);return t?e.getHours(t)>=12?1:0:void 0}case"day":return h.contentType==="digit-with-letter"?parseInt(h.value,10):Number(h.value);case"month":{if(h.contentType==="digit")return Number(h.value);const t=e.parse(h.value,h.format);return t?e.getMonth(t)+1:void 0}default:return h.contentType!=="letter"?Number(h.value):void 0}},Mh=["value","referenceDate"],Qe={emptyValue:null,getTodayValue:es,getInitialReferenceValue:h=>{let{value:e,referenceDate:t}=h,n=we(h,Mh);return e!=null&&n.utils.isValid(e)?e:t??mh(n)},cleanValue:Qu,areValuesEqual:Xu,isSameError:(h,e)=>h===e,hasError:h=>h!=null,defaultErrorState:null,getTimezone:(h,e)=>e==null||!h.isValid(e)?null:h.getTimezone(e),setTimezone:(h,e,t)=>t==null?null:h.setTimezone(t,e)},Zo={updateReferenceValue:(h,e,t)=>e==null||!h.isValid(e)?t:e,getSectionsFromValue:(h,e,t,n)=>!h.isValid(e)&&!!t?t:n(e),getV7HiddenInputValueFromSections:xh,getV6InputValueFromSections:Sh,getActiveDateManager:(h,e)=>({date:e.value,referenceDate:e.referenceValue,getSections:t=>t,getNewValuesFromNewActiveDate:t=>({value:t,referenceValue:t==null||!h.isValid(t)?e.referenceValue:t})}),parseValueStr:(h,e,t)=>t(h.trim(),e)},ss=({value:h,referenceDate:e,utils:t,props:n,timezone:f})=>{const i=Q.useMemo(()=>Qe.getInitialReferenceValue({value:h,utils:t,props:n,referenceDate:e,granularity:St.day,timezone:f,getTodayDate:()=>es(t,f,"date")}),[]);return h??i},_h=["ampm","ampmInClock","autoFocus","slots","slotProps","value","defaultValue","referenceDate","disableIgnoringDatePartForTimeValidation","maxTime","minTime","disableFuture","disablePast","minutesStep","shouldDisableTime","showViewSwitcher","onChange","view","views","openTo","onViewChange","focusedView","onFocusedViewChange","className","disabled","readOnly","timezone"],Ih=h=>{const{classes:e}=h;return Me({root:["root"],arrowSwitcher:["arrowSwitcher"]},Pu,e)},Lh=me(er,{name:"MuiTimeClock",slot:"Root",overridesResolver:(h,e)=>e.root})({display:"flex",flexDirection:"column",position:"relative"}),Fh=me(No,{name:"MuiTimeClock",slot:"ArrowSwitcher",overridesResolver:(h,e)=>e.arrowSwitcher})({position:"absolute",right:12,top:15}),Rh=["hours","minutes"],Oh=Q.forwardRef(function(e,t){const n=$e(),f=Te({props:e,name:"MuiTimeClock"}),{ampm:i=n.is12HourCycleInCurrentLocale(),ampmInClock:o=!1,autoFocus:p,slots:s,slotProps:u,value:r,defaultValue:a,referenceDate:l,disableIgnoringDatePartForTimeValidation:d=!1,maxTime:c,minTime:m,disableFuture:g,disablePast:v,minutesStep:b=1,shouldDisableTime:E,showViewSwitcher:S,onChange:w,view:y,views:D=Rh,openTo:$,onViewChange:A,focusedView:_,onFocusedViewChange:L,className:T,disabled:k,readOnly:x,timezone:C}=f,M=we(f,_h),{value:F,handleValueChange:R,timezone:O}=Bn({name:"TimeClock",timezone:C,value:r,defaultValue:a,referenceDate:l,onChange:w,valueManager:Qe}),B=ss({value:F,referenceDate:l,utils:n,props:f,timezone:O}),N=et(),j=yn(O),{view:V,setView:W,previousView:H,nextView:U,setValueAndGoToNextView:X}=fi({view:y,views:D,openTo:$,onViewChange:A,onChange:R,focusedView:_,onFocusedViewChange:L}),{meridiemMode:Y,handleMeridiemChange:Z}=Xr(B,i,X),ne=Q.useCallback((he,ae)=>{const ce=pi(d,n),pe=ae==="hours"||ae==="minutes"&&D.includes("seconds"),fe=({start:xe,end:We})=>!(m&&ce(m,We)||c&&ce(xe,c)||g&&ce(xe,j)||v&&ce(j,pe?We:xe)),ge=(xe,We=1)=>{if(xe%We!==0)return!1;if(E)switch(ae){case"hours":return!E(n.setHours(B,xe),"hours");case"minutes":return!E(n.setMinutes(B,xe),"minutes");case"seconds":return!E(n.setSeconds(B,xe),"seconds");default:return!1}return!0};switch(ae){case"hours":{const xe=ai(he,Y,i),We=n.setHours(B,xe);if(n.getHours(We)!==xe)return!0;const it=n.setSeconds(n.setMinutes(We,0),0),_t=n.setSeconds(n.setMinutes(We,59),59);return!fe({start:it,end:_t})||!ge(xe)}case"minutes":{const xe=n.setMinutes(B,he),We=n.setSeconds(xe,0),it=n.setSeconds(xe,59);return!fe({start:We,end:it})||!ge(he,b)}case"seconds":{const xe=n.setSeconds(B,he);return!fe({start:xe,end:xe})||!ge(he)}default:throw new Error("not supported")}},[i,B,d,c,Y,m,b,E,n,g,v,j,D]),re=Pn(),le=Q.useMemo(()=>{switch(V){case"hours":{const he=(pe,fe)=>{const ge=ai(pe,Y,i);X(n.setHours(B,ge),fe,"hours")},ae=n.getHours(B);let ce;return i?ae>12?ce=[12,23]:ce=[0,11]:ce=[0,23],{onChange:he,viewValue:ae,children:ph({value:F,utils:n,ampm:i,getClockNumberText:N.hoursClockNumberText,isDisabled:pe=>k||ne(pe,"hours"),selectedId:re}),viewRange:ce}}case"minutes":{const he=n.getMinutes(B);return{viewValue:he,onChange:(ce,pe)=>{X(n.setMinutes(B,ce),pe,"minutes")},children:Ps({utils:n,value:he,getClockNumberText:N.minutesClockNumberText,isDisabled:ce=>k||ne(ce,"minutes"),selectedId:re}),viewRange:[0,59]}}case"seconds":{const he=n.getSeconds(B);return{viewValue:he,onChange:(ce,pe)=>{X(n.setSeconds(B,ce),pe,"seconds")},children:Ps({utils:n,value:he,getClockNumberText:N.secondsClockNumberText,isDisabled:ce=>k||ne(ce,"seconds"),selectedId:re}),viewRange:[0,59]}}default:throw new Error("You must provide the type for ClockView")}},[V,n,F,i,N.hoursClockNumberText,N.minutesClockNumberText,N.secondsClockNumberText,Y,X,B,ne,re,k]),ie=f,de=Ih(ie);return ee.jsxs(Lh,J({ref:t,className:Oe(de.root,T),ownerState:ie},M,{children:[ee.jsx(lh,J({autoFocus:p??!!_,ampmInClock:o&&D.includes("hours"),value:F,type:V,ampm:i,minutesStep:b,isTimeDisabled:ne,meridiemMode:Y,handleMeridiemChange:Z,selectedId:re,disabled:k,readOnly:x},le)),S&&ee.jsx(Fh,{className:de.arrowSwitcher,slots:s,slotProps:u,onGoToPrevious:()=>W(H),isPreviousDisabled:!H,previousLabel:N.openPreviousView,onGoToNext:()=>W(U),isNextDisabled:!U,nextLabel:N.openNextView,ownerState:ie})]}))});function Ph(h){return Fe("MuiDigitalClock",h)}Re("MuiDigitalClock",["root","list","item"]);function Tn(h,e){return Array.isArray(e)?e.every(t=>h.indexOf(t)!==-1):h.indexOf(e)!==-1}const Nh=(h,e)=>t=>{(t.key==="Enter"||t.key===" ")&&(h(t),t.preventDefault(),t.stopPropagation())},tt=(h=document)=>{const e=h.activeElement;return e?e.shadowRoot?tt(e.shadowRoot):e:null},ji=h=>Array.from(h.children).indexOf(tt(document)),qo="@media (pointer: fine)",Bh=["ampm","timeStep","autoFocus","slots","slotProps","value","defaultValue","referenceDate","disableIgnoringDatePartForTimeValidation","maxTime","minTime","disableFuture","disablePast","minutesStep","shouldDisableTime","onChange","view","openTo","onViewChange","focusedView","onFocusedViewChange","className","disabled","readOnly","views","skipDisabled","timezone"],Vh=h=>{const{classes:e}=h;return Me({root:["root"],list:["list"],item:["item"]},Ph,e)},Wh=me(er,{name:"MuiDigitalClock",slot:"Root",overridesResolver:(h,e)=>e.root})({overflowY:"auto",width:"100%","@media (prefers-reduced-motion: no-preference)":{scrollBehavior:"auto"},maxHeight:jo,variants:[{props:{alreadyRendered:!0},style:{"@media (prefers-reduced-motion: no-preference)":{scrollBehavior:"smooth"}}}]}),jh=me(To,{name:"MuiDigitalClock",slot:"List",overridesResolver:(h,e)=>e.list})({padding:0}),Hh=me(Ao,{name:"MuiDigitalClock",slot:"Item",overridesResolver:(h,e)=>e.item})(({theme:h})=>({padding:"8px 16px",margin:"2px 4px","&:first-of-type":{marginTop:4},"&:hover":{backgroundColor:h.vars?`rgba(${h.vars.palette.primary.mainChannel} / ${h.vars.palette.action.hoverOpacity})`:Mt(h.palette.primary.main,h.palette.action.hoverOpacity)},"&.Mui-selected":{backgroundColor:(h.vars||h).palette.primary.main,color:(h.vars||h).palette.primary.contrastText,"&:focus-visible, &:hover":{backgroundColor:(h.vars||h).palette.primary.dark}},"&.Mui-focusVisible":{backgroundColor:h.vars?`rgba(${h.vars.palette.primary.mainChannel} / ${h.vars.palette.action.focusOpacity})`:Mt(h.palette.primary.main,h.palette.action.focusOpacity)}})),zh=Q.forwardRef(function(e,t){const n=$e(),f=Q.useRef(null),i=rt(t,f),o=Q.useRef(null),p=Te({props:e,name:"MuiDigitalClock"}),{ampm:s=n.is12HourCycleInCurrentLocale(),timeStep:u=30,autoFocus:r,slots:a,slotProps:l,value:d,defaultValue:c,referenceDate:m,disableIgnoringDatePartForTimeValidation:g=!1,maxTime:v,minTime:b,disableFuture:E,disablePast:S,minutesStep:w=1,shouldDisableTime:y,onChange:D,view:$,openTo:A,onViewChange:_,focusedView:L,onFocusedViewChange:T,className:k,disabled:x,readOnly:C,views:M=["hours"],skipDisabled:F=!1,timezone:R}=p,O=we(p,Bh),{value:B,handleValueChange:N,timezone:j}=Bn({name:"DigitalClock",timezone:R,value:d,defaultValue:c,referenceDate:m,onChange:D,valueManager:Qe}),V=et(),W=yn(j),H=Q.useMemo(()=>J({},p,{alreadyRendered:!!f.current}),[p]),U=Vh(H),X=(a==null?void 0:a.digitalClockItem)??Hh,Y=Ie({elementType:X,externalSlotProps:l==null?void 0:l.digitalClockItem,ownerState:{},className:U.item}),Z=ss({value:B,referenceDate:m,utils:n,props:p,timezone:j}),ne=ve(ce=>N(ce,"finish","hours")),{setValueAndGoToNextView:re}=fi({view:$,views:M,openTo:A,onViewChange:_,onChange:ne,focusedView:L,onFocusedViewChange:T}),le=ve(ce=>{re(ce,"finish")});Q.useEffect(()=>{if(f.current===null)return;const ce=f.current.querySelector('[role="listbox"] [role="option"][tabindex="0"], [role="listbox"] [role="option"][aria-selected="true"]');if(!ce)return;const pe=ce.offsetTop;(r||L)&&ce.focus(),f.current.scrollTop=pe-4});const ie=Q.useCallback(ce=>{const pe=pi(g,n),fe=()=>!(b&&pe(b,ce)||v&&pe(ce,v)||E&&pe(ce,W)||S&&pe(W,ce)),ge=()=>n.getMinutes(ce)%w!==0?!1:y?!y(ce,"hours"):!0;return!fe()||!ge()},[g,n,b,v,E,W,S,w,y]),de=Q.useMemo(()=>{const ce=[];let fe=n.startOfDay(Z);for(;n.isSameDay(Z,fe);)ce.push(fe),fe=n.addMinutes(fe,u);return ce},[Z,u,n]),he=de.findIndex(ce=>n.isEqual(ce,Z)),ae=ce=>{switch(ce.key){case"PageUp":{const pe=ji(o.current)-5,fe=o.current.children,ge=Math.max(0,pe),xe=fe[ge];xe&&xe.focus(),ce.preventDefault();break}case"PageDown":{const pe=ji(o.current)+5,fe=o.current.children,ge=Math.min(fe.length-1,pe),xe=fe[ge];xe&&xe.focus(),ce.preventDefault();break}}};return ee.jsx(Wh,J({ref:i,className:Oe(U.root,k),ownerState:H},O,{children:ee.jsx(jh,{ref:o,role:"listbox","aria-label":V.timePickerToolbarTitle,className:U.list,onKeyDown:ae,children:de.map((ce,pe)=>{if(F&&ie(ce))return null;const fe=n.isEqual(ce,B),ge=n.format(ce,s?"fullTime12h":"fullTime24h"),xe=he===pe||he===-1&&pe===0?0:-1;return ee.jsx(X,J({onClick:()=>!C&&le(ce),selected:fe,disabled:x||ie(ce),disableRipple:C,role:"option","aria-disabled":C,"aria-selected":fe,tabIndex:xe},Y,{children:ge}),`${ce.valueOf()}-${ge}`)})})}))});function Uh(h){return Fe("MuiMultiSectionDigitalClock",h)}Re("MuiMultiSectionDigitalClock",["root"]);function Gh(h){return Fe("MuiMultiSectionDigitalClockSection",h)}Re("MuiMultiSectionDigitalClockSection",["root","item"]);const Kh=["autoFocus","onChange","className","disabled","readOnly","items","active","slots","slotProps","skipDisabled"],Yh=h=>{const{classes:e}=h;return Me({root:["root"],item:["item"]},Gh,e)},Jh=me(To,{name:"MuiMultiSectionDigitalClockSection",slot:"Root",overridesResolver:(h,e)=>e.root})(({theme:h})=>({maxHeight:jo,width:56,padding:0,overflow:"hidden","@media (prefers-reduced-motion: no-preference)":{scrollBehavior:"auto"},"@media (pointer: fine)":{"&:hover":{overflowY:"auto"}},"@media (pointer: none), (pointer: coarse)":{overflowY:"auto"},"&:not(:first-of-type)":{borderLeft:`1px solid ${(h.vars||h).palette.divider}`},"&::after":{display:"block",content:'""',height:"calc(100% - 40px - 6px)"},variants:[{props:{alreadyRendered:!0},style:{"@media (prefers-reduced-motion: no-preference)":{scrollBehavior:"smooth"}}}]})),Qh=me(Ao,{name:"MuiMultiSectionDigitalClockSection",slot:"Item",overridesResolver:(h,e)=>e.item})(({theme:h})=>({padding:8,margin:"2px 4px",width:Ou,justifyContent:"center","&:first-of-type":{marginTop:4},"&:hover":{backgroundColor:h.vars?`rgba(${h.vars.palette.primary.mainChannel} / ${h.vars.palette.action.hoverOpacity})`:Mt(h.palette.primary.main,h.palette.action.hoverOpacity)},"&.Mui-selected":{backgroundColor:(h.vars||h).palette.primary.main,color:(h.vars||h).palette.primary.contrastText,"&:focus-visible, &:hover":{backgroundColor:(h.vars||h).palette.primary.dark}},"&.Mui-focusVisible":{backgroundColor:h.vars?`rgba(${h.vars.palette.primary.mainChannel} / ${h.vars.palette.action.focusOpacity})`:Mt(h.palette.primary.main,h.palette.action.focusOpacity)}})),Xh=Q.forwardRef(function(e,t){const n=Q.useRef(null),f=rt(t,n),i=Q.useRef(null),o=Te({props:e,name:"MuiMultiSectionDigitalClockSection"}),{autoFocus:p,onChange:s,className:u,disabled:r,readOnly:a,items:l,active:d,slots:c,slotProps:m,skipDisabled:g}=o,v=we(o,Kh),b=Q.useMemo(()=>J({},o,{alreadyRendered:!!n.current}),[o]),E=Yh(b),S=(c==null?void 0:c.digitalClockSectionItem)??Qh;Q.useEffect(()=>{if(n.current===null)return;const D=n.current.querySelector('[role="option"][tabindex="0"], [role="option"][aria-selected="true"]');if(d&&p&&D&&D.focus(),!D||i.current===D)return;i.current=D;const $=D.offsetTop;n.current.scrollTop=$-4});const w=l.findIndex(D=>D.isFocused(D.value)),y=D=>{switch(D.key){case"PageUp":{const $=ji(n.current)-5,A=n.current.children,_=Math.max(0,$),L=A[_];L&&L.focus(),D.preventDefault();break}case"PageDown":{const $=ji(n.current)+5,A=n.current.children,_=Math.min(A.length-1,$),L=A[_];L&&L.focus(),D.preventDefault();break}}};return ee.jsx(Jh,J({ref:f,className:Oe(E.root,u),ownerState:b,autoFocusItem:p&&d,role:"listbox",onKeyDown:y},v,{children:l.map((D,$)=>{var k;const A=(k=D.isDisabled)==null?void 0:k.call(D,D.value),_=r||A;if(g&&_)return null;const L=D.isSelected(D.value),T=w===$||w===-1&&$===0?0:-1;return ee.jsx(S,J({onClick:()=>!a&&s(D.value),selected:L,disabled:_,disableRipple:a,role:"option","aria-disabled":a||_||void 0,"aria-label":D.ariaLabel,"aria-selected":L,tabIndex:T,className:E.item},m==null?void 0:m.digitalClockSectionItem,{children:D.label}),D.label)})}))}),Zh=({now:h,value:e,utils:t,ampm:n,isDisabled:f,resolveAriaLabel:i,timeStep:o,valueOrReferenceDate:p})=>{const s=e?t.getHours(e):null,u=[],r=(d,c)=>{const m=c??s;return m===null?!1:n?d===12?m===12||m===0:m===d||m-12===d:m===d},a=d=>r(d,t.getHours(p)),l=n?11:23;for(let d=0;d<=l;d+=o){let c=t.format(t.setHours(h,d),n?"hours12h":"hours24h");const m=i(parseInt(c,10).toString());c=t.formatNumber(c),u.push({value:d,label:c,isSelected:r,isDisabled:f,isFocused:a,ariaLabel:m})}return u},Hs=({value:h,utils:e,isDisabled:t,timeStep:n,resolveLabel:f,resolveAriaLabel:i,hasValue:o=!0})=>{const p=u=>h===null?!1:o&&h===u,s=u=>h===u;return[...Array.from({length:Math.ceil(60/n)},(u,r)=>{const a=n*r;return{value:a,label:e.formatNumber(f(a)),isDisabled:t,isSelected:p,isFocused:s,ariaLabel:i(a.toString())}})]},qh=["ampm","timeSteps","autoFocus","slots","slotProps","value","defaultValue","referenceDate","disableIgnoringDatePartForTimeValidation","maxTime","minTime","disableFuture","disablePast","minutesStep","shouldDisableTime","onChange","view","views","openTo","onViewChange","focusedView","onFocusedViewChange","className","disabled","readOnly","skipDisabled","timezone"],ed=h=>{const{classes:e}=h;return Me({root:["root"]},Uh,e)},td=me(er,{name:"MuiMultiSectionDigitalClock",slot:"Root",overridesResolver:(h,e)=>e.root})(({theme:h})=>({display:"flex",flexDirection:"row",width:"100%",borderBottom:`1px solid ${(h.vars||h).palette.divider}`})),nd=Q.forwardRef(function(e,t){const n=$e(),f=At(),i=Te({props:e,name:"MuiMultiSectionDigitalClock"}),{ampm:o=n.is12HourCycleInCurrentLocale(),timeSteps:p,autoFocus:s,slots:u,slotProps:r,value:a,defaultValue:l,referenceDate:d,disableIgnoringDatePartForTimeValidation:c=!1,maxTime:m,minTime:g,disableFuture:v,disablePast:b,minutesStep:E=1,shouldDisableTime:S,onChange:w,view:y,views:D=["hours","minutes"],openTo:$,onViewChange:A,focusedView:_,onFocusedViewChange:L,className:T,disabled:k,readOnly:x,skipDisabled:C=!1,timezone:M}=i,F=we(i,qh),{value:R,handleValueChange:O,timezone:B}=Bn({name:"MultiSectionDigitalClock",timezone:M,value:a,defaultValue:l,referenceDate:d,onChange:w,valueManager:Qe}),N=et(),j=yn(B),V=Q.useMemo(()=>J({hours:1,minutes:5,seconds:5},p),[p]),W=ss({value:R,referenceDate:d,utils:n,props:i,timezone:B}),H=ve((fe,ge,xe)=>O(fe,ge,xe)),U=Q.useMemo(()=>!o||!D.includes("hours")||D.includes("meridiem")?D:[...D,"meridiem"],[o,D]),{view:X,setValueAndGoToNextView:Y,focusedView:Z}=fi({view:y,views:U,openTo:$,onViewChange:A,onChange:H,focusedView:_,onFocusedViewChange:L}),ne=ve(fe=>{Y(fe,"finish","meridiem")}),{meridiemMode:re,handleMeridiemChange:le}=Xr(W,o,ne,"finish"),ie=Q.useCallback((fe,ge)=>{const xe=pi(c,n),We=ge==="hours"||ge==="minutes"&&U.includes("seconds"),it=({start:je,end:Ze})=>!(g&&xe(g,Ze)||m&&xe(je,m)||v&&xe(je,j)||b&&xe(j,We?Ze:je)),_t=(je,Ze=1)=>{if(je%Ze!==0)return!1;if(S)switch(ge){case"hours":return!S(n.setHours(W,je),"hours");case"minutes":return!S(n.setMinutes(W,je),"minutes");case"seconds":return!S(n.setSeconds(W,je),"seconds");default:return!1}return!0};switch(ge){case"hours":{const je=ai(fe,re,o),Ze=n.setHours(W,je);if(n.getHours(Ze)!==je)return!0;const st=n.setSeconds(n.setMinutes(Ze,0),0),Wt=n.setSeconds(n.setMinutes(Ze,59),59);return!it({start:st,end:Wt})||!_t(je)}case"minutes":{const je=n.setMinutes(W,fe),Ze=n.setSeconds(je,0),st=n.setSeconds(je,59);return!it({start:Ze,end:st})||!_t(fe,E)}case"seconds":{const je=n.setSeconds(W,fe);return!it({start:je,end:je})||!_t(fe)}default:throw new Error("not supported")}},[o,W,c,m,re,g,E,S,n,v,b,j,U]),de=Q.useCallback(fe=>{switch(fe){case"hours":return{onChange:ge=>{const xe=ai(ge,re,o);Y(n.setHours(W,xe),"finish","hours")},items:Zh({now:j,value:R,ampm:o,utils:n,isDisabled:ge=>ie(ge,"hours"),timeStep:V.hours,resolveAriaLabel:N.hoursClockNumberText,valueOrReferenceDate:W})};case"minutes":return{onChange:ge=>{Y(n.setMinutes(W,ge),"finish","minutes")},items:Hs({value:n.getMinutes(W),utils:n,isDisabled:ge=>ie(ge,"minutes"),resolveLabel:ge=>n.format(n.setMinutes(j,ge),"minutes"),timeStep:V.minutes,hasValue:!!R,resolveAriaLabel:N.minutesClockNumberText})};case"seconds":return{onChange:ge=>{Y(n.setSeconds(W,ge),"finish","seconds")},items:Hs({value:n.getSeconds(W),utils:n,isDisabled:ge=>ie(ge,"seconds"),resolveLabel:ge=>n.format(n.setSeconds(j,ge),"seconds"),timeStep:V.seconds,hasValue:!!R,resolveAriaLabel:N.secondsClockNumberText})};case"meridiem":{const ge=Jt(n,"am"),xe=Jt(n,"pm");return{onChange:le,items:[{value:"am",label:ge,isSelected:()=>!!R&&re==="am",isFocused:()=>!!W&&re==="am",ariaLabel:ge},{value:"pm",label:xe,isSelected:()=>!!R&&re==="pm",isFocused:()=>!!W&&re==="pm",ariaLabel:xe}]}}default:throw new Error(`Unknown view: ${fe} found.`)}},[j,R,o,n,V.hours,V.minutes,V.seconds,N.hoursClockNumberText,N.minutesClockNumberText,N.secondsClockNumberText,re,Y,W,ie,le]),he=Q.useMemo(()=>{if(!f)return U;const fe=U.filter(ge=>ge!=="meridiem");return fe.reverse(),U.includes("meridiem")&&fe.push("meridiem"),fe},[f,U]),ae=Q.useMemo(()=>U.reduce((fe,ge)=>J({},fe,{[ge]:de(ge)}),{}),[U,de]),ce=i,pe=ed(ce);return ee.jsx(td,J({ref:t,className:Oe(pe.root,T),ownerState:ce,role:"group"},F,{children:he.map(fe=>ee.jsx(Xh,{items:ae[fe].items,onChange:ae[fe].onChange,active:X===fe,autoFocus:s||Z===fe,disabled:k,readOnly:x,slots:u,slotProps:r,skipDisabled:C,"aria-label":N.selectViewText(fe)},fe))}))});function id(h){return Fe("MuiPickersDay",h)}const ln=Re("MuiPickersDay",["root","dayWithMargin","dayOutsideMonth","hiddenDaySpacingFiller","today","selected","disabled"]),rd=["autoFocus","className","day","disabled","disableHighlightToday","disableMargin","hidden","isAnimating","onClick","onDaySelect","onFocus","onBlur","onKeyDown","onMouseDown","onMouseEnter","outsideCurrentMonth","selected","showDaysOutsideCurrentMonth","children","today","isFirstVisibleCell","isLastVisibleCell"],sd=h=>{const{selected:e,disableMargin:t,disableHighlightToday:n,today:f,disabled:i,outsideCurrentMonth:o,showDaysOutsideCurrentMonth:p,classes:s}=h,u=o&&!p;return Me({root:["root",e&&!u&&"selected",i&&"disabled",!t&&"dayWithMargin",!n&&f&&"today",o&&p&&"dayOutsideMonth",u&&"hiddenDaySpacingFiller"],hiddenDaySpacingFiller:["hiddenDaySpacingFiller"]},id,s)},ea=({theme:h})=>J({},h.typography.caption,{width:li,height:li,borderRadius:"50%",padding:0,backgroundColor:"transparent",transition:h.transitions.create("background-color",{duration:h.transitions.duration.short}),color:(h.vars||h).palette.text.primary,"@media (pointer: fine)":{"&:hover":{backgroundColor:h.vars?`rgba(${h.vars.palette.primary.mainChannel} / ${h.vars.palette.action.hoverOpacity})`:Mt(h.palette.primary.main,h.palette.action.hoverOpacity)}},"&:focus":{backgroundColor:h.vars?`rgba(${h.vars.palette.primary.mainChannel} / ${h.vars.palette.action.focusOpacity})`:Mt(h.palette.primary.main,h.palette.action.focusOpacity),[`&.${ln.selected}`]:{willChange:"background-color",backgroundColor:(h.vars||h).palette.primary.dark}},[`&.${ln.selected}`]:{color:(h.vars||h).palette.primary.contrastText,backgroundColor:(h.vars||h).palette.primary.main,fontWeight:h.typography.fontWeightMedium,"&:hover":{willChange:"background-color",backgroundColor:(h.vars||h).palette.primary.dark}},[`&.${ln.disabled}:not(.${ln.selected})`]:{color:(h.vars||h).palette.text.disabled},[`&.${ln.disabled}&.${ln.selected}`]:{opacity:.6},variants:[{props:{disableMargin:!1},style:{margin:`0 ${Zi}px`}},{props:{outsideCurrentMonth:!0,showDaysOutsideCurrentMonth:!0},style:{color:(h.vars||h).palette.text.secondary}},{props:{disableHighlightToday:!1,today:!0},style:{[`&:not(.${ln.selected})`]:{border:`1px solid ${(h.vars||h).palette.text.secondary}`}}}]}),ta=(h,e)=>{const{ownerState:t}=h;return[e.root,!t.disableMargin&&e.dayWithMargin,!t.disableHighlightToday&&t.today&&e.today,!t.outsideCurrentMonth&&t.showDaysOutsideCurrentMonth&&e.dayOutsideMonth,t.outsideCurrentMonth&&!t.showDaysOutsideCurrentMonth&&e.hiddenDaySpacingFiller]},od=me(ec,{name:"MuiPickersDay",slot:"Root",overridesResolver:ta})(ea),ad=me("div",{name:"MuiPickersDay",slot:"Root",overridesResolver:ta})(({theme:h})=>J({},ea({theme:h}),{opacity:0,pointerEvents:"none"})),Jn=()=>{},ld=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiPickersDay"}),{autoFocus:f=!1,className:i,day:o,disabled:p=!1,disableHighlightToday:s=!1,disableMargin:u=!1,isAnimating:r,onClick:a,onDaySelect:l,onFocus:d=Jn,onBlur:c=Jn,onKeyDown:m=Jn,onMouseDown:g=Jn,onMouseEnter:v=Jn,outsideCurrentMonth:b,selected:E=!1,showDaysOutsideCurrentMonth:S=!1,children:w,today:y=!1}=n,D=we(n,rd),$=J({},n,{autoFocus:f,disabled:p,disableHighlightToday:s,disableMargin:u,selected:E,showDaysOutsideCurrentMonth:S,today:y}),A=sd($),_=$e(),L=Q.useRef(null),T=rt(L,t);Bt(()=>{f&&!p&&!r&&!b&&L.current.focus()},[f,p,r,b]);const k=C=>{g(C),b&&C.preventDefault()},x=C=>{p||l(o),b&&C.currentTarget.focus(),a&&a(C)};return b&&!S?ee.jsx(ad,{className:Oe(A.root,A.hiddenDaySpacingFiller,i),ownerState:$,role:D.role}):ee.jsx(od,J({className:Oe(A.root,i),ref:T,centerRipple:!0,disabled:p,tabIndex:E?0:-1,onKeyDown:C=>m(C,o),onFocus:C=>d(C,o),onBlur:C=>c(C,o),onMouseEnter:C=>v(C,o),onClick:x,onMouseDown:k},D,{ownerState:$,children:w||_.format(o,"dayOfMonth")}))}),cd=Q.memo(ld),mi=({props:h,value:e,timezone:t,adapter:n})=>{if(e===null)return null;const{shouldDisableDate:f,shouldDisableMonth:i,shouldDisableYear:o,disablePast:p,disableFuture:s}=h,u=n.utils.date(void 0,t),r=vt(n.utils,h.minDate,n.defaultDates.minDate),a=vt(n.utils,h.maxDate,n.defaultDates.maxDate);switch(!0){case!n.utils.isValid(e):return"invalidDate";case!!(f&&f(e)):return"shouldDisableDate";case!!(i&&i(e)):return"shouldDisableMonth";case!!(o&&o(e)):return"shouldDisableYear";case!!(s&&n.utils.isAfterDay(e,u)):return"disableFuture";case!!(p&&n.utils.isBeforeDay(e,u)):return"disablePast";case!!(r&&n.utils.isBeforeDay(e,r)):return"minDate";case!!(a&&n.utils.isAfterDay(e,a)):return"maxDate";default:return null}};mi.valueManager=Qe;const nr=({adapter:h,value:e,timezone:t,props:n})=>{if(e===null)return null;const{minTime:f,maxTime:i,minutesStep:o,shouldDisableTime:p,disableIgnoringDatePartForTimeValidation:s=!1,disablePast:u,disableFuture:r}=n,a=h.utils.date(void 0,t),l=pi(s,h.utils);switch(!0){case!h.utils.isValid(e):return"invalidDate";case!!(f&&l(f,e)):return"minTime";case!!(i&&l(e,i)):return"maxTime";case!!(r&&h.utils.isAfter(e,a)):return"disableFuture";case!!(u&&h.utils.isBefore(e,a)):return"disablePast";case!!(p&&p(e,"hours")):return"shouldDisableTime-hours";case!!(p&&p(e,"minutes")):return"shouldDisableTime-minutes";case!!(p&&p(e,"seconds")):return"shouldDisableTime-seconds";case!!(o&&h.utils.getMinutes(e)%o!==0):return"minutesStep";default:return null}};nr.valueManager=Qe;const jr=["disablePast","disableFuture","minDate","maxDate","shouldDisableDate","shouldDisableMonth","shouldDisableYear"],Hr=["disablePast","disableFuture","minTime","maxTime","shouldDisableTime","minutesStep","ampm","disableIgnoringDatePartForTimeValidation"],na=["minDateTime","maxDateTime"],ud=[...jr,...Hr,...na],ir=h=>ud.reduce((e,t)=>(h.hasOwnProperty(t)&&(e[t]=h[t]),e),{});function ia(h){const{props:e,validator:t,value:n,timezone:f,onError:i}=h,o=vn(),p=Q.useRef(t.valueManager.defaultErrorState),s=t({adapter:o,value:n,timezone:f,props:e}),u=t.valueManager.hasError(s);Q.useEffect(()=>{i&&!t.valueManager.isSameError(s,p.current)&&i(s,n),p.current=s},[t,i,s,n]);const r=ve(a=>t({adapter:o,value:a,timezone:f,props:e}));return{validationError:s,hasValidationError:u,getValidationErrorForNewValue:r}}const hd=({utils:h,format:e})=>{let t=10,n=e,f=h.expandFormat(e);for(;f!==n;)if(n=f,f=h.expandFormat(n),t-=1,t<0)throw new Error("MUI X: The format expansion seems to be in an infinite loop. Please open an issue with the format passed to the picker component.");return f},dd=({utils:h,expandedFormat:e})=>{const t=[],{start:n,end:f}=h.escapedCharacters,i=new RegExp(`(\\${n}[^\\${f}]*\\${f})+`,"g");let o=null;for(;o=i.exec(e);)t.push({start:o.index,end:i.lastIndex-1});return t},pd=(h,e,t,n)=>{switch(t.type){case"year":return e.fieldYearPlaceholder({digitAmount:h.formatByString(h.date(void 0,"default"),n).length,format:n});case"month":return e.fieldMonthPlaceholder({contentType:t.contentType,format:n});case"day":return e.fieldDayPlaceholder({format:n});case"weekDay":return e.fieldWeekDayPlaceholder({contentType:t.contentType,format:n});case"hours":return e.fieldHoursPlaceholder({format:n});case"minutes":return e.fieldMinutesPlaceholder({format:n});case"seconds":return e.fieldSecondsPlaceholder({format:n});case"meridiem":return e.fieldMeridiemPlaceholder({format:n});default:return n}},fd=({utils:h,date:e,shouldRespectLeadingZeros:t,localeText:n,localizedDigits:f,now:i,token:o,startSeparator:p})=>{if(o==="")throw new Error("MUI X: Should not call `commitToken` with an empty token");const s=Ko(h,o),u=Xo(h,s.contentType,s.type,o),r=t?u:s.contentType==="digit",a=e!=null&&h.isValid(e);let l=a?h.formatByString(e,o):"",d=null;if(r)if(u)d=l===""?h.formatByString(i,o).length:l.length;else{if(s.maxLength==null)throw new Error(`MUI X: The token ${o} should have a 'maxDigitNumber' property on it's adapter`);d=s.maxLength,a&&(l=is(Jo(fn(l,f),d),f))}return J({},s,{format:o,maxLength:d,value:l,placeholder:pd(h,n,s,o),hasLeadingZerosInFormat:u,hasLeadingZerosInInput:r,startSeparator:p,endSeparator:"",modified:!1})},md=h=>{var d;const{utils:e,expandedFormat:t,escapedParts:n}=h,f=e.date(void 0),i=[];let o="";const p=Object.keys(e.formatTokenMap).sort((c,m)=>m.length-c.length),s=/^([a-zA-Z]+)/,u=new RegExp(`^(${p.join("|")})*$`),r=new RegExp(`^(${p.join("|")})`),a=c=>n.find(m=>m.start<=c&&m.end>=c);let l=0;for(;l<t.length;){const c=a(l),m=c!=null,g=(d=s.exec(t.slice(l)))==null?void 0:d[1];if(!m&&g!=null&&u.test(g)){let v=g;for(;v.length>0;){const b=r.exec(v)[1];v=v.slice(b.length),i.push(fd(J({},h,{now:f,token:b,startSeparator:o}))),o=""}l+=g.length}else{const v=t[l];m&&(c==null?void 0:c.start)===l||(c==null?void 0:c.end)===l||(i.length===0?o+=v:i[i.length-1].endSeparator+=v),l+=1}}return i.length===0&&o.length>0&&i.push({type:"empty",contentType:"letter",maxLength:null,format:"",value:"",placeholder:"",hasLeadingZerosInFormat:!1,hasLeadingZerosInInput:!1,startSeparator:o,endSeparator:"",modified:!1}),i},gd=({isRtl:h,formatDensity:e,sections:t})=>t.map(n=>{const f=i=>{let o=i;return h&&o!==null&&o.includes(" ")&&(o=`${o}`),e==="spacious"&&["/",".","-"].includes(o)&&(o=` ${o} `),o};return n.startSeparator=f(n.startSeparator),n.endSeparator=f(n.endSeparator),n}),zs=h=>{let e=hd(h);h.isRtl&&h.enableAccessibleFieldDOMStructure&&(e=e.split(" ").reverse().join(" "));const t=dd(J({},h,{expandedFormat:e})),n=md(J({},h,{expandedFormat:e,escapedParts:t}));return gd(J({},h,{sections:n}))},vd=h=>{const e=$e(),t=et(),n=vn(),f=At(),{valueManager:i,fieldValueManager:o,valueType:p,validator:s,internalProps:u,internalProps:{value:r,defaultValue:a,referenceDate:l,onChange:d,format:c,formatDensity:m="dense",selectedSections:g,onSelectedSectionsChange:v,shouldRespectLeadingZeros:b=!1,timezone:E,enableAccessibleFieldDOMStructure:S=!1}}=h,{timezone:w,value:y,handleValueChange:D}=ns({timezone:E,value:r,defaultValue:a,referenceDate:l,onChange:d,valueManager:i}),$=Q.useMemo(()=>yh(e),[e]),A=Q.useMemo(()=>Dh(e,$,w),[e,$,w]),_=Q.useCallback((H,U=null)=>o.getSectionsFromValue(e,H,U,X=>zs({utils:e,localeText:t,localizedDigits:$,format:c,date:X,formatDensity:m,shouldRespectLeadingZeros:b,enableAccessibleFieldDOMStructure:S,isRtl:f})),[o,c,t,$,f,b,e,m,S]),[L,T]=Q.useState(()=>{const H=_(y),U={sections:H,value:y,referenceValue:i.emptyValue,tempValueStrAndroid:null},X=fh(H),Y=i.getInitialReferenceValue({referenceDate:l,value:y,utils:e,props:u,granularity:X,timezone:w});return J({},U,{referenceValue:Y})}),[k,x]=pn({controlled:g,default:null,name:"useField",state:"selectedSections"}),C=H=>{x(H),v==null||v(H)},M=Q.useMemo(()=>Wr(k,L.sections),[k,L.sections]),F=M==="all"?0:M,R=({value:H,referenceValue:U,sections:X})=>{if(T(Z=>J({},Z,{sections:X,value:H,referenceValue:U,tempValueStrAndroid:null})),i.areValuesEqual(e,L.value,H))return;const Y={validationError:s({adapter:n,value:H,timezone:w,props:u})};D(H,Y)},O=(H,U)=>{const X=[...L.sections];return X[H]=J({},X[H],{value:U,modified:!0}),X},B=()=>{R({value:i.emptyValue,referenceValue:L.referenceValue,sections:_(i.emptyValue)})},N=()=>{if(F==null)return;const H=L.sections[F],U=o.getActiveDateManager(e,L,H),Y=U.getSections(L.sections).filter(le=>le.value!=="").length===(H.value===""?0:1),Z=O(F,""),ne=Y?null:e.getInvalidDate(),re=U.getNewValuesFromNewActiveDate(ne);R(J({},re,{sections:Z}))},j=H=>{const U=(Z,ne)=>{const re=e.parse(Z,c);if(re==null||!e.isValid(re))return null;const le=zs({utils:e,localeText:t,localizedDigits:$,format:c,date:re,formatDensity:m,shouldRespectLeadingZeros:b,enableAccessibleFieldDOMStructure:S,isRtl:f});return js(e,re,le,ne,!1)},X=o.parseValueStr(H,L.referenceValue,U),Y=o.updateReferenceValue(e,X,L.referenceValue);R({value:X,referenceValue:Y,sections:_(X,L.sections)})},V=({activeSection:H,newSectionValue:U,shouldGoToNextSection:X})=>{X&&F<L.sections.length-1&&C(F+1);const Y=o.getActiveDateManager(e,L,H),Z=O(F,U),ne=Y.getSections(Z),re=Ch(e,ne,$);let le,ie;if(re!=null&&e.isValid(re)){const de=js(e,re,ne,Y.referenceDate,!0);le=Y.getNewValuesFromNewActiveDate(de),ie=!0}else le=Y.getNewValuesFromNewActiveDate(re),ie=(re!=null&&!e.isValid(re))!=(Y.date!=null&&!e.isValid(Y.date));return ie?R(J({},le,{sections:Z})):T(de=>J({},de,le,{sections:Z,tempValueStrAndroid:null}))},W=H=>T(U=>J({},U,{tempValueStrAndroid:H}));return Q.useEffect(()=>{const H=_(L.value);T(U=>J({},U,{sections:H}))},[c,e.locale,f]),Q.useEffect(()=>{let H;i.areValuesEqual(e,L.value,y)?H=i.getTimezone(e,L.value)!==i.getTimezone(e,y):H=!0,H&&T(U=>J({},U,{value:y,referenceValue:o.updateReferenceValue(e,y,U.referenceValue),sections:_(y)}))},[y]),{state:L,activeSectionIndex:F,parsedSelectedSections:M,setSelectedSections:C,clearValue:B,clearActiveSection:N,updateSectionValue:V,updateValueFromValueStr:j,setTempAndroidValueStr:W,getSectionsFromValue:_,sectionsValueBoundaries:A,localizedDigits:$,timezone:w}},yd=5e3,Dn=h=>h.saveQuery!=null,bd=({sections:h,updateSectionValue:e,sectionsValueBoundaries:t,localizedDigits:n,setTempAndroidValueStr:f,timezone:i})=>{const o=$e(),[p,s]=Q.useState(null),u=ve(()=>s(null));Q.useEffect(()=>{var c;p!=null&&((c=h[p.sectionIndex])==null?void 0:c.type)!==p.sectionType&&u()},[h,p,u]),Q.useEffect(()=>{if(p!=null){const c=setTimeout(()=>u(),yd);return()=>{clearTimeout(c)}}return()=>{}},[p,u]);const r=({keyPressed:c,sectionIndex:m},g,v)=>{const b=c.toLowerCase(),E=h[m];if(p!=null&&(!v||v(p.value))&&p.sectionIndex===m){const w=`${p.value}${b}`,y=g(w,E);if(!Dn(y))return s({sectionIndex:m,value:w,sectionType:E.type}),y}const S=g(b,E);return Dn(S)&&!S.saveQuery?(u(),null):(s({sectionIndex:m,value:b,sectionType:E.type}),Dn(S)?null:S)},a=c=>{const m=(b,E,S)=>{const w=E.filter(y=>y.toLowerCase().startsWith(S));return w.length===0?{saveQuery:!1}:{sectionValue:w[0],shouldGoToNextSection:w.length===1}},g=(b,E,S,w)=>{const y=D=>Yo(o,i,E.type,D);if(E.contentType==="letter")return m(E.format,y(E.format),b);if(S&&w!=null&&Ko(o,S).contentType==="letter"){const D=y(S),$=m(S,D,b);return Dn($)?{saveQuery:!1}:J({},$,{sectionValue:w($.sectionValue,D)})}return{saveQuery:!1}};return r(c,(b,E)=>{switch(E.type){case"month":{const S=w=>Vs(o,w,o.formats.month,E.format);return g(b,E,o.formats.month,S)}case"weekDay":{const S=(w,y)=>y.indexOf(w).toString();return g(b,E,o.formats.weekday,S)}case"meridiem":return g(b,E);default:return{saveQuery:!1}}})},l=c=>{const m=(v,b)=>{const E=fn(v,n),S=Number(E),w=t[b.type]({currentDate:null,format:b.format,contentType:b.contentType});if(S>w.maximum)return{saveQuery:!1};if(S<w.minimum)return{saveQuery:!0};const y=S*10>w.maximum||E.length===w.maximum.toString().length;return{sectionValue:Qo(o,S,w,n,b),shouldGoToNextSection:y}};return r(c,(v,b)=>{if(b.contentType==="digit"||b.contentType==="digit-with-letter")return m(v,b);if(b.type==="month"){Xo(o,"digit","month","MM");const E=m(v,{type:b.type,format:"MM",hasLeadingZerosInInput:!0,contentType:"digit",maxLength:2});if(Dn(E))return E;const S=Vs(o,E.sectionValue,"MM",b.format);return J({},E,{sectionValue:S})}if(b.type==="weekDay"){const E=m(v,b);if(Dn(E))return E;const S=tr(o,b.format)[Number(E.sectionValue)-1];return J({},E,{sectionValue:S})}return{saveQuery:!1}},v=>Bs(v,n))};return{applyCharacterEditing:ve(c=>{const m=h[c.sectionIndex],v=Bs(c.keyPressed,n)?l(J({},c,{keyPressed:is(c.keyPressed,n)})):a(c);if(v==null){f(null);return}e({activeSection:m,newSectionValue:v.sectionValue,shouldGoToNextSection:v.shouldGoToNextSection})}),resetCharacterQuery:u}},wd=h=>{const{internalProps:{disabled:e,readOnly:t=!1},forwardedProps:{sectionListRef:n,onBlur:f,onClick:i,onFocus:o,onInput:p,onPaste:s,focused:u,autoFocus:r=!1},fieldValueManager:a,applyCharacterEditing:l,resetCharacterQuery:d,setSelectedSections:c,parsedSelectedSections:m,state:g,clearActiveSection:v,clearValue:b,updateSectionValue:E,updateValueFromValueStr:S,sectionOrder:w,areAllSectionsEmpty:y,sectionsValueBoundaries:D}=h,$=Q.useRef(null),A=rt(n,$),_=et(),L=$e(),T=Pn(),[k,x]=Q.useState(!1),C=Q.useMemo(()=>({syncSelectionToDOM:()=>{if(!$.current)return;const ie=document.getSelection();if(!ie)return;if(m==null){ie.rangeCount>0&&$.current.getRoot().contains(ie.getRangeAt(0).startContainer)&&ie.removeAllRanges(),k&&$.current.getRoot().blur();return}if(!$.current.getRoot().contains(tt(document)))return;const de=new window.Range;let he;m==="all"?he=$.current.getRoot():g.sections[m].type==="empty"?he=$.current.getSectionContainer(m):he=$.current.getSectionContent(m),de.selectNodeContents(he),he.focus(),ie.removeAllRanges(),ie.addRange(de)},getActiveSectionIndexFromDOM:()=>{const ie=tt(document);return!ie||!$.current||!$.current.getRoot().contains(ie)?null:$.current.getSectionIndexFromDOMElement(ie)},focusField:(ie=0)=>{if(!$.current||C.getActiveSectionIndexFromDOM()!=null)return;const de=Wr(ie,g.sections);x(!0),$.current.getSectionContent(de).focus()},setSelectedSections:ie=>{if(!$.current)return;const de=Wr(ie,g.sections);x((de==="all"?0:de)!==null),c(ie)},isFieldFocused:()=>{const ie=tt(document);return!!$.current&&$.current.getRoot().contains(ie)}}),[m,c,g.sections,k]),M=ve(ie=>{if(!$.current)return;const de=g.sections[ie];$.current.getSectionContent(ie).innerHTML=de.value||de.placeholder,C.syncSelectionToDOM()}),F=ve((ie,...de)=>{ie.isDefaultPrevented()||!$.current||(x(!0),i==null||i(ie,...de),m==="all"?setTimeout(()=>{const he=document.getSelection().getRangeAt(0).startOffset;if(he===0){c(w.startIndex);return}let ae=0,ce=0;for(;ce<he&&ae<g.sections.length;){const pe=g.sections[ae];ae+=1,ce+=`${pe.startSeparator}${pe.value||pe.placeholder}${pe.endSeparator}`.length}c(ae-1)}):k?$.current.getRoot().contains(ie.target)||c(w.startIndex):(x(!0),c(w.startIndex)))}),R=ve(ie=>{if(p==null||p(ie),!$.current||m!=="all")return;const he=ie.target.textContent??"";$.current.getRoot().innerHTML=g.sections.map(ae=>`${ae.startSeparator}${ae.value||ae.placeholder}${ae.endSeparator}`).join(""),C.syncSelectionToDOM(),he.length===0||he.charCodeAt(0)===10?(d(),b(),c("all")):he.length>1?S(he):(m==="all"&&c(0),l({keyPressed:he,sectionIndex:0}))}),O=ve(ie=>{if(s==null||s(ie),t||m!=="all"){ie.preventDefault();return}const de=ie.clipboardData.getData("text");ie.preventDefault(),d(),S(de)}),B=ve((...ie)=>{if(o==null||o(...ie),k||!$.current)return;x(!0),$.current.getSectionIndexFromDOMElement(tt(document))!=null||c(w.startIndex)}),N=ve((...ie)=>{f==null||f(...ie),setTimeout(()=>{if(!$.current)return;const de=tt(document);!$.current.getRoot().contains(de)&&(x(!1),c(null))})}),j=ve(ie=>de=>{de.isDefaultPrevented()||c(ie)}),V=ve(ie=>{ie.preventDefault()}),W=ve(ie=>()=>{c(ie)}),H=ve(ie=>{if(ie.preventDefault(),t||e||typeof m!="number")return;const de=g.sections[m],he=ie.clipboardData.getData("text"),ae=/^[a-zA-Z]+$/.test(he),ce=/^[0-9]+$/.test(he),pe=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(he);de.contentType==="letter"&&ae||de.contentType==="digit"&&ce||de.contentType==="digit-with-letter"&&pe?(d(),E({activeSection:de,newSectionValue:he,shouldGoToNextSection:!0})):!ae&&!ce&&(d(),S(he))}),U=ve(ie=>{ie.preventDefault(),ie.dataTransfer.dropEffect="none"}),X=ve(ie=>{if(!$.current)return;const de=ie.target,he=de.textContent??"",ae=$.current.getSectionIndexFromDOMElement(de),ce=g.sections[ae];if(t||!$.current){M(ae);return}if(he.length===0){if(ce.value===""){M(ae);return}const pe=ie.nativeEvent.inputType;if(pe==="insertParagraph"||pe==="insertLineBreak"){M(ae);return}d(),v();return}l({keyPressed:he,sectionIndex:ae}),M(ae)});Bt(()=>{if(!(!k||!$.current)){if(m==="all")$.current.getRoot().focus();else if(typeof m=="number"){const ie=$.current.getSectionContent(m);ie&&ie.focus()}}},[m,k]);const Y=Q.useMemo(()=>g.sections.reduce((ie,de)=>(ie[de.type]=D[de.type]({currentDate:null,contentType:de.contentType,format:de.format}),ie),{}),[D,g.sections]),Z=m==="all",ne=Q.useMemo(()=>g.sections.map((ie,de)=>{const he=!Z&&!e&&!t;return{container:{"data-sectionindex":de,onClick:j(de)},content:{tabIndex:Z||de>0?-1:0,contentEditable:!Z&&!e&&!t,role:"spinbutton",id:`${T}-${ie.type}`,"aria-labelledby":`${T}-${ie.type}`,"aria-readonly":t,"aria-valuenow":$h(ie,L),"aria-valuemin":Y[ie.type].minimum,"aria-valuemax":Y[ie.type].maximum,"aria-valuetext":ie.value?kh(ie,L):_.empty,"aria-label":_[ie.type],"aria-disabled":e,spellCheck:he?!1:void 0,autoCapitalize:he?"off":void 0,autoCorrect:he?"off":void 0,[parseInt(Q.version,10)>=17?"enterKeyHint":"enterkeyhint"]:he?"next":void 0,children:ie.value||ie.placeholder,onInput:X,onPaste:H,onFocus:W(de),onDragOver:U,onMouseUp:V,inputMode:ie.contentType==="letter"?"text":"numeric"},before:{children:ie.startSeparator},after:{children:ie.endSeparator}}}),[g.sections,W,H,U,X,j,V,e,t,Z,_,L,Y,T]),re=ve(ie=>{S(ie.target.value)}),le=Q.useMemo(()=>y?"":a.getV7HiddenInputValueFromSections(g.sections),[y,g.sections,a]);return Q.useEffect(()=>{if($.current==null)throw new Error(["MUI X: The `sectionListRef` prop has not been initialized by `PickersSectionList`","You probably tried to pass a component to the `textField` slot that contains an `<input />` element instead of a `PickersSectionList`.","","If you want to keep using an `<input />` HTML element for the editing, please remove the `enableAccessibleFieldDOMStructure` prop from your picker or field component:","","<DatePicker slots={{ textField: MyCustomTextField }} />","","Learn more about the field accessible DOM structure on the MUI documentation: https://mui.com/x/react-date-pickers/fields/#fields-to-edit-a-single-element"].join(`
`));r&&$.current&&$.current.getSectionContent(w.startIndex).focus()},[]),{interactions:C,returnedValue:{autoFocus:r,readOnly:t,focused:u??k,sectionListRef:A,onBlur:N,onClick:F,onFocus:B,onInput:R,onPaste:O,enableAccessibleFieldDOMStructure:!0,elements:ne,tabIndex:m===0?-1:0,contentEditable:Z,value:le,onChange:re,areAllSectionsEmpty:y}}},Mn=h=>h.replace(/[\u2066\u2067\u2068\u2069]/g,""),Cd=(h,e,t)=>{let n=0,f=t?1:0;const i=[];for(let o=0;o<h.length;o+=1){const p=h[o],s=rs(p,t?"input-rtl":"input-ltr",e),u=`${p.startSeparator}${s}${p.endSeparator}`,r=Mn(u).length,a=u.length,l=Mn(s),d=f+(l===""?0:s.indexOf(l[0]))+p.startSeparator.length,c=d+l.length;i.push(J({},p,{start:n,end:n+r,startInInput:d,endInInput:c})),n+=r,f+=a}return i},xd=h=>{const e=At(),t=Q.useRef(void 0),n=Q.useRef(void 0),{forwardedProps:{onFocus:f,onClick:i,onPaste:o,onBlur:p,inputRef:s,placeholder:u},internalProps:{readOnly:r=!1,disabled:a=!1},parsedSelectedSections:l,activeSectionIndex:d,state:c,fieldValueManager:m,valueManager:g,applyCharacterEditing:v,resetCharacterQuery:b,updateSectionValue:E,updateValueFromValueStr:S,clearActiveSection:w,clearValue:y,setTempAndroidValueStr:D,setSelectedSections:$,getSectionsFromValue:A,areAllSectionsEmpty:_,localizedDigits:L}=h,T=Q.useRef(null),k=rt(s,T),x=Q.useMemo(()=>Cd(c.sections,L,e),[c.sections,L,e]),C=Q.useMemo(()=>({syncSelectionToDOM:()=>{if(!T.current)return;if(l==null){T.current.scrollLeft&&(T.current.scrollLeft=0);return}if(T.current!==tt(document))return;const X=T.current.scrollTop;if(l==="all")T.current.select();else{const Y=x[l],Z=Y.type==="empty"?Y.startInInput-Y.startSeparator.length:Y.startInInput,ne=Y.type==="empty"?Y.endInInput+Y.endSeparator.length:Y.endInInput;(Z!==T.current.selectionStart||ne!==T.current.selectionEnd)&&T.current===tt(document)&&T.current.setSelectionRange(Z,ne),clearTimeout(n.current),n.current=setTimeout(()=>{T.current&&T.current===tt(document)&&T.current.selectionStart===T.current.selectionEnd&&(T.current.selectionStart!==Z||T.current.selectionEnd!==ne)&&C.syncSelectionToDOM()})}T.current.scrollTop=X},getActiveSectionIndexFromDOM:()=>{const X=T.current.selectionStart??0,Y=T.current.selectionEnd??0;if(X===0&&Y===0)return null;const Z=X<=x[0].startInInput?1:x.findIndex(ne=>ne.startInInput-ne.startSeparator.length>X);return Z===-1?x.length-1:Z-1},focusField:(X=0)=>{var Y;tt(document)!==T.current&&((Y=T.current)==null||Y.focus(),$(X))},setSelectedSections:X=>$(X),isFieldFocused:()=>T.current===tt(document)}),[T,l,x,$]),M=()=>{const X=T.current.selectionStart??0;let Y;X<=x[0].startInInput||X>=x[x.length-1].endInInput?Y=1:Y=x.findIndex(ne=>ne.startInInput-ne.startSeparator.length>X);const Z=Y===-1?x.length-1:Y-1;$(Z)},F=ve((...X)=>{f==null||f(...X);const Y=T.current;clearTimeout(t.current),t.current=setTimeout(()=>{!Y||Y!==T.current||d==null&&(Y.value.length&&Number(Y.selectionEnd)-Number(Y.selectionStart)===Y.value.length?$("all"):M())})}),R=ve((X,...Y)=>{X.isDefaultPrevented()||(i==null||i(X,...Y),M())}),O=ve(X=>{if(o==null||o(X),X.preventDefault(),r||a)return;const Y=X.clipboardData.getData("text");if(typeof l=="number"){const Z=c.sections[l],ne=/^[a-zA-Z]+$/.test(Y),re=/^[0-9]+$/.test(Y),le=/^(([a-zA-Z]+)|)([0-9]+)(([a-zA-Z]+)|)$/.test(Y);if(Z.contentType==="letter"&&ne||Z.contentType==="digit"&&re||Z.contentType==="digit-with-letter"&&le){b(),E({activeSection:Z,newSectionValue:Y,shouldGoToNextSection:!0});return}if(ne||re)return}b(),S(Y)}),B=ve((...X)=>{p==null||p(...X),$(null)}),N=ve(X=>{if(r)return;const Y=X.target.value;if(Y===""){b(),y();return}const Z=X.nativeEvent.data,ne=Z&&Z.length>1,re=ne?Z:Y,le=Mn(re);if(l==="all"&&$(d),d==null||ne){S(ne?Z:le);return}let ie;if(l==="all"&&le.length===1)ie=le;else{const de=Mn(m.getV6InputValueFromSections(x,L,e));let he=-1,ae=-1;for(let ge=0;ge<de.length;ge+=1)he===-1&&de[ge]!==le[ge]&&(he=ge),ae===-1&&de[de.length-ge-1]!==le[le.length-ge-1]&&(ae=ge);const ce=x[d];if(he<ce.start||de.length-ae-1>ce.end)return;const fe=le.length-de.length+ce.end-Mn(ce.endSeparator||"").length;ie=le.slice(ce.start+Mn(ce.startSeparator||"").length,fe)}if(ie.length===0){Ah()&&D(re),b(),w();return}v({keyPressed:ie,sectionIndex:d})}),j=Q.useMemo(()=>u!==void 0?u:m.getV6InputValueFromSections(A(g.emptyValue),L,e),[u,m,A,g.emptyValue,L,e]),V=Q.useMemo(()=>c.tempValueStrAndroid??m.getV6InputValueFromSections(c.sections,L,e),[c.sections,m,c.tempValueStrAndroid,L,e]);Q.useEffect(()=>(T.current&&T.current===tt(document)&&$("all"),()=>{clearTimeout(t.current),clearTimeout(n.current)}),[]);const W=Q.useMemo(()=>d==null||c.sections[d].contentType==="letter"?"text":"numeric",[d,c.sections]),U=!(T.current&&T.current===tt(document))&&_;return{interactions:C,returnedValue:{readOnly:r,onBlur:B,onClick:R,onFocus:F,onPaste:O,inputRef:k,enableAccessibleFieldDOMStructure:!1,placeholder:j,inputMode:W,autoComplete:"off",value:U?"":V,onChange:N}}},ra=h=>{const e=$e(),{internalProps:t,internalProps:{unstableFieldRef:n,minutesStep:f,enableAccessibleFieldDOMStructure:i=!1,disabled:o=!1,readOnly:p=!1},forwardedProps:{onKeyDown:s,error:u,clearable:r,onClear:a},fieldValueManager:l,valueManager:d,validator:c}=h,m=At(),g=vd(h),{state:v,activeSectionIndex:b,parsedSelectedSections:E,setSelectedSections:S,clearValue:w,clearActiveSection:y,updateSectionValue:D,setTempAndroidValueStr:$,sectionsValueBoundaries:A,localizedDigits:_,timezone:L}=g,T=bd({sections:v.sections,updateSectionValue:D,sectionsValueBoundaries:A,localizedDigits:_,setTempAndroidValueStr:$,timezone:L}),{resetCharacterQuery:k}=T,x=d.areValuesEqual(e,v.value,d.emptyValue),C=i?wd:xd,M=Q.useMemo(()=>Th(v.sections,m&&!i),[v.sections,m,i]),{returnedValue:F,interactions:R}=C(J({},h,g,T,{areAllSectionsEmpty:x,sectionOrder:M})),O=ve(H=>{if(s==null||s(H),!o)switch(!0){case((H.ctrlKey||H.metaKey)&&String.fromCharCode(H.keyCode)==="A"&&!H.shiftKey&&!H.altKey):{H.preventDefault(),S("all");break}case H.key==="ArrowRight":{if(H.preventDefault(),E==null)S(M.startIndex);else if(E==="all")S(M.endIndex);else{const U=M.neighbors[E].rightIndex;U!==null&&S(U)}break}case H.key==="ArrowLeft":{if(H.preventDefault(),E==null)S(M.endIndex);else if(E==="all")S(M.startIndex);else{const U=M.neighbors[E].leftIndex;U!==null&&S(U)}break}case H.key==="Delete":{if(H.preventDefault(),p)break;E==null||E==="all"?w():y(),k();break}case["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(H.key):{if(H.preventDefault(),p||b==null)break;E==="all"&&S(b);const U=v.sections[b],X=l.getActiveDateManager(e,v,U),Y=bh(e,L,U,H.key,A,_,X.date,{minutesStep:f});D({activeSection:U,newSectionValue:Y,shouldGoToNextSection:!1});break}}});Bt(()=>{R.syncSelectionToDOM()});const{hasValidationError:B}=ia({props:t,validator:c,timezone:L,value:v.value,onError:t.onError}),N=Q.useMemo(()=>u!==void 0?u:B,[B,u]);Q.useEffect(()=>{!N&&b==null&&k()},[v.referenceValue,b,N]),Q.useEffect(()=>{v.tempValueStrAndroid!=null&&b!=null&&(k(),y())},[v.sections]),Q.useImperativeHandle(n,()=>({getSections:()=>v.sections,getActiveSectionIndex:R.getActiveSectionIndexFromDOM,setSelectedSections:R.setSelectedSections,focusField:R.focusField,isFieldFocused:R.isFieldFocused}));const j=ve((H,...U)=>{H.preventDefault(),a==null||a(H,...U),w(),R.isFieldFocused()?S(M.startIndex):R.focusField(0)}),V={onKeyDown:O,onClear:j,error:N,clearable:!!(r&&!x&&!p&&!o)},W={disabled:o,readOnly:p};return J({},h.forwardedProps,V,W,F)},Sd=["clearable","onClear","InputProps","sx","slots","slotProps"],Dd=["ownerState"],sa=h=>{const e=et(),{clearable:t,onClear:n,InputProps:f,sx:i,slots:o,slotProps:p}=h,s=we(h,Sd),u=(o==null?void 0:o.clearButton)??Nn,r=Ie({elementType:u,externalSlotProps:p==null?void 0:p.clearButton,ownerState:{},className:"clearButton",additionalProps:{title:e.fieldClearLabel}}),a=we(r,Dd),l=(o==null?void 0:o.clearIcon)??xu,d=Ie({elementType:l,externalSlotProps:p==null?void 0:p.clearIcon,ownerState:{}});return J({},s,{InputProps:J({},f,{endAdornment:ee.jsxs(Q.Fragment,{children:[t&&ee.jsx(ko,{position:"end",sx:{marginRight:f!=null&&f.endAdornment?-1:-1.5},children:ee.jsx(u,J({},a,{onClick:n,children:ee.jsx(l,J({fontSize:"small"},d))}))}),f==null?void 0:f.endAdornment]})}),sx:[{"& .clearButton":{opacity:1},"@media (pointer: fine)":{"& .clearButton":{opacity:0},"&:hover, &:focus-within":{".clearButton":{opacity:1}}}},...Array.isArray(i)?i:[i]]})},Ed=["value","defaultValue","referenceDate","format","formatDensity","onChange","timezone","onError","shouldRespectLeadingZeros","selectedSections","onSelectedSectionsChange","unstableFieldRef","enableAccessibleFieldDOMStructure","disabled","readOnly","dateSeparator"],oa=(h,e)=>Q.useMemo(()=>{const t=J({},h),n={},f=i=>{t.hasOwnProperty(i)&&(n[i]=t[i],delete t[i])};return Ed.forEach(f),e==="date"?jr.forEach(f):e==="time"?Hr.forEach(f):e==="date-time"&&(jr.forEach(f),Hr.forEach(f),na.forEach(f)),{forwardedProps:t,internalProps:n}},[h,e]),Ad=Q.createContext(null);function aa(h){const{contextValue:e,localeText:t,children:n}=h;return ee.jsx(Ad.Provider,{value:e,children:ee.jsx(pu,{localeText:t,children:n})})}const Td=h=>{const e=$e(),t=di();return J({},h,{disablePast:h.disablePast??!1,disableFuture:h.disableFuture??!1,format:h.format??e.formats.keyboardDate,minDate:vt(e,h.minDate,t.minDate),maxDate:vt(e,h.maxDate,t.maxDate)})},kd=h=>{const e=$e(),n=h.ampm??e.is12HourCycleInCurrentLocale()?e.formats.fullTime12h:e.formats.fullTime24h;return J({},h,{disablePast:h.disablePast??!1,disableFuture:h.disableFuture??!1,format:h.format??n})},$d=h=>{const e=Td(h),{forwardedProps:t,internalProps:n}=oa(e,"date");return ra({forwardedProps:t,internalProps:n,valueManager:Qe,fieldValueManager:Zo,validator:mi,valueType:"date"})};function Md(h){return Fe("MuiPickersTextField",h)}Re("MuiPickersTextField",["root","focused","disabled","error","required"]);function _d(h){return Fe("MuiPickersInputBase",h)}const _n=Re("MuiPickersInputBase",["root","focused","disabled","error","notchedOutline","sectionContent","sectionBefore","sectionAfter","adornedStart","adornedEnd","input"]);function Id(h){return Fe("MuiPickersSectionList",h)}const Qn=Re("MuiPickersSectionList",["root","section","sectionContent"]),Ld=["slots","slotProps","elements","sectionListRef"],la=me("div",{name:"MuiPickersSectionList",slot:"Root",overridesResolver:(h,e)=>e.root})({direction:"ltr /*! @noflip */",outline:"none"}),ca=me("span",{name:"MuiPickersSectionList",slot:"Section",overridesResolver:(h,e)=>e.section})({}),ua=me("span",{name:"MuiPickersSectionList",slot:"SectionSeparator",overridesResolver:(h,e)=>e.sectionSeparator})({whiteSpace:"pre"}),ha=me("span",{name:"MuiPickersSectionList",slot:"SectionContent",overridesResolver:(h,e)=>e.sectionContent})({outline:"none"}),Fd=h=>{const{classes:e}=h;return Me({root:["root"],section:["section"],sectionContent:["sectionContent"]},Id,e)};function Rd(h){const{slots:e,slotProps:t,element:n,classes:f}=h,i=(e==null?void 0:e.section)??ca,o=Ie({elementType:i,externalSlotProps:t==null?void 0:t.section,externalForwardedProps:n.container,className:f.section,ownerState:{}}),p=(e==null?void 0:e.sectionContent)??ha,s=Ie({elementType:p,externalSlotProps:t==null?void 0:t.sectionContent,externalForwardedProps:n.content,additionalProps:{suppressContentEditableWarning:!0},className:f.sectionContent,ownerState:{}}),u=(e==null?void 0:e.sectionSeparator)??ua,r=Ie({elementType:u,externalSlotProps:t==null?void 0:t.sectionSeparator,externalForwardedProps:n.before,ownerState:{position:"before"}}),a=Ie({elementType:u,externalSlotProps:t==null?void 0:t.sectionSeparator,externalForwardedProps:n.after,ownerState:{position:"after"}});return ee.jsxs(i,J({},o,{children:[ee.jsx(u,J({},r)),ee.jsx(p,J({},s)),ee.jsx(u,J({},a))]}))}const Od=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiPickersSectionList"}),{slots:f,slotProps:i,elements:o,sectionListRef:p}=n,s=we(n,Ld),u=Fd(n),r=Q.useRef(null),a=rt(t,r),l=m=>{if(!r.current)throw new Error(`MUI X: Cannot call sectionListRef.${m} before the mount of the component.`);return r.current};Q.useImperativeHandle(p,()=>({getRoot(){return l("getRoot")},getSectionContainer(m){return l("getSectionContainer").querySelector(`.${Qn.section}[data-sectionindex="${m}"]`)},getSectionContent(m){return l("getSectionContent").querySelector(`.${Qn.section}[data-sectionindex="${m}"] .${Qn.sectionContent}`)},getSectionIndexFromDOMElement(m){const g=l("getSectionIndexFromDOMElement");if(m==null||!g.contains(m))return null;let v=null;return m.classList.contains(Qn.section)?v=m:m.classList.contains(Qn.sectionContent)&&(v=m.parentElement),v==null?null:Number(v.dataset.sectionindex)}}));const d=(f==null?void 0:f.root)??la,c=Ie({elementType:d,externalSlotProps:i==null?void 0:i.root,externalForwardedProps:s,additionalProps:{ref:a,suppressContentEditableWarning:!0},className:u.root,ownerState:{}});return ee.jsx(d,J({},c,{children:c.contentEditable?o.map(({content:m,before:g,after:v})=>`${g.children}${m.children}${v.children}`).join(""):ee.jsx(Q.Fragment,{children:o.map((m,g)=>ee.jsx(Rd,{slots:f,slotProps:i,element:m,classes:u},g))})}))}),Pd=["elements","areAllSectionsEmpty","defaultValue","label","value","onChange","id","autoFocus","endAdornment","startAdornment","renderSuffix","slots","slotProps","contentEditable","tabIndex","onInput","onPaste","onKeyDown","fullWidth","name","readOnly","inputProps","inputRef","sectionListRef"],Nd=h=>Math.round(h*1e5)/1e5,rr=me("div",{name:"MuiPickersInputBase",slot:"Root",overridesResolver:(h,e)=>e.root})(({theme:h})=>J({},h.typography.body1,{color:(h.vars||h).palette.text.primary,cursor:"text",padding:0,display:"flex",justifyContent:"flex-start",alignItems:"center",position:"relative",boxSizing:"border-box",letterSpacing:`${Nd(.15/16)}em`,variants:[{props:{fullWidth:!0},style:{width:"100%"}}]})),os=me(la,{name:"MuiPickersInputBase",slot:"SectionsContainer",overridesResolver:(h,e)=>e.sectionsContainer})(({theme:h})=>({padding:"4px 0 5px",fontFamily:h.typography.fontFamily,fontSize:"inherit",lineHeight:"1.4375em",flexGrow:1,outline:"none",display:"flex",flexWrap:"nowrap",overflow:"hidden",letterSpacing:"inherit",width:"182px",variants:[{props:{isRtl:!0},style:{textAlign:"right /*! @noflip */"}},{props:{size:"small"},style:{paddingTop:1}},{props:{adornedStart:!1,focused:!1,filled:!1},style:{color:"currentColor",opacity:0}},{props:({adornedStart:e,focused:t,filled:n,label:f})=>!e&&!t&&!n&&f==null,style:h.vars?{opacity:h.vars.opacity.inputPlaceholder}:{opacity:h.palette.mode==="light"?.42:.5}}]})),Bd=me(ca,{name:"MuiPickersInputBase",slot:"Section",overridesResolver:(h,e)=>e.section})(({theme:h})=>({fontFamily:h.typography.fontFamily,fontSize:"inherit",letterSpacing:"inherit",lineHeight:"1.4375em",display:"inline-block",whiteSpace:"nowrap"})),Vd=me(ha,{name:"MuiPickersInputBase",slot:"SectionContent",overridesResolver:(h,e)=>e.content})(({theme:h})=>({fontFamily:h.typography.fontFamily,lineHeight:"1.4375em",letterSpacing:"inherit",width:"fit-content",outline:"none"})),Wd=me(ua,{name:"MuiPickersInputBase",slot:"Separator",overridesResolver:(h,e)=>e.separator})(()=>({whiteSpace:"pre",letterSpacing:"inherit"})),jd=me("input",{name:"MuiPickersInputBase",slot:"Input",overridesResolver:(h,e)=>e.hiddenInput})(J({},tc)),Hd=h=>{const{focused:e,disabled:t,error:n,classes:f,fullWidth:i,readOnly:o,color:p,size:s,endAdornment:u,startAdornment:r}=h,a={root:["root",e&&!t&&"focused",t&&"disabled",o&&"readOnly",n&&"error",i&&"fullWidth",`color${fc(p)}`,s==="small"&&"inputSizeSmall",!!r&&"adornedStart",!!u&&"adornedEnd"],notchedOutline:["notchedOutline"],input:["input"],sectionsContainer:["sectionsContainer"],sectionContent:["sectionContent"],sectionBefore:["sectionBefore"],sectionAfter:["sectionAfter"]};return Me(a,_d,f)},as=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiPickersInputBase"}),{elements:f,areAllSectionsEmpty:i,value:o,onChange:p,id:s,endAdornment:u,startAdornment:r,renderSuffix:a,slots:l,slotProps:d,contentEditable:c,tabIndex:m,onInput:g,onPaste:v,onKeyDown:b,name:E,readOnly:S,inputProps:w,inputRef:y,sectionListRef:D}=n,$=we(n,Pd),A=Q.useRef(null),_=rt(t,A),L=rt(w==null?void 0:w.ref,y),T=At(),k=Ki();if(!k)throw new Error("MUI X: PickersInputBase should always be used inside a PickersTextField component");const x=B=>{var N;if(k.disabled){B.stopPropagation();return}(N=k.onFocus)==null||N.call(k,B)};Q.useEffect(()=>{k&&k.setAdornedStart(!!r)},[k,r]),Q.useEffect(()=>{k&&(i?k.onEmpty():k.onFilled())},[k,i]);const C=J({},n,k,{isRtl:T}),M=Hd(C),F=(l==null?void 0:l.root)||rr,R=Ie({elementType:F,externalSlotProps:d==null?void 0:d.root,externalForwardedProps:$,additionalProps:{"aria-invalid":k.error,ref:_},className:M.root,ownerState:C}),O=(l==null?void 0:l.input)||os;return ee.jsxs(F,J({},R,{children:[r,ee.jsx(Od,{sectionListRef:D,elements:f,contentEditable:c,tabIndex:m,className:M.sectionsContainer,onFocus:x,onBlur:k.onBlur,onInput:g,onPaste:v,onKeyDown:b,slots:{root:O,section:Bd,sectionContent:Vd,sectionSeparator:Wd},slotProps:{root:{ownerState:C},sectionContent:{className:_n.sectionContent},sectionSeparator:({position:B})=>({className:B==="before"?_n.sectionBefore:_n.sectionAfter})}}),u,a?a(J({},k)):null,ee.jsx(jd,J({name:E,className:M.input,value:o,onChange:p,id:s,"aria-hidden":"true",tabIndex:-1,readOnly:S,required:k.required,disabled:k.disabled},w,{ref:L}))]}))});function zd(h){return Fe("MuiPickersOutlinedInput",h)}const Ct=J({},_n,Re("MuiPickersOutlinedInput",["root","notchedOutline","input"])),Ud=["children","className","label","notched","shrink"],Gd=me("fieldset",{name:"MuiPickersOutlinedInput",slot:"NotchedOutline",overridesResolver:(h,e)=>e.notchedOutline})(({theme:h})=>{const e=h.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{textAlign:"left",position:"absolute",bottom:0,right:0,top:-5,left:0,margin:0,padding:"0 8px",pointerEvents:"none",borderRadius:"inherit",borderStyle:"solid",borderWidth:1,overflow:"hidden",minWidth:"0%",borderColor:h.vars?`rgba(${h.vars.palette.common.onBackgroundChannel} / 0.23)`:e}}),Us=me("span")(({theme:h})=>({fontFamily:h.typography.fontFamily,fontSize:"inherit"})),Kd=me("legend")(({theme:h})=>({float:"unset",width:"auto",overflow:"hidden",variants:[{props:{withLabel:!1},style:{padding:0,lineHeight:"11px",transition:h.transitions.create("width",{duration:150,easing:h.transitions.easing.easeOut})}},{props:{withLabel:!0},style:{display:"block",padding:0,height:11,fontSize:"0.75em",visibility:"hidden",maxWidth:.01,transition:h.transitions.create("max-width",{duration:50,easing:h.transitions.easing.easeOut}),whiteSpace:"nowrap","& > span":{paddingLeft:5,paddingRight:5,display:"inline-block",opacity:0,visibility:"visible"}}},{props:{withLabel:!0,notched:!0},style:{maxWidth:"100%",transition:h.transitions.create("max-width",{duration:100,easing:h.transitions.easing.easeOut,delay:50})}}]}));function Yd(h){const{className:e,label:t}=h,n=we(h,Ud),f=t!=null&&t!=="",i=J({},h,{withLabel:f});return ee.jsx(Gd,J({"aria-hidden":!0,className:e},n,{ownerState:i,children:ee.jsx(Kd,{ownerState:i,children:f?ee.jsx(Us,{children:t}):ee.jsx(Us,{className:"notranslate",children:""})})}))}const Jd=["label","autoFocus","ownerState","notched"],Qd=me(rr,{name:"MuiPickersOutlinedInput",slot:"Root",overridesResolver:(h,e)=>e.root})(({theme:h})=>{const e=h.palette.mode==="light"?"rgba(0, 0, 0, 0.23)":"rgba(255, 255, 255, 0.23)";return{padding:"0 14px",borderRadius:(h.vars||h).shape.borderRadius,[`&:hover .${Ct.notchedOutline}`]:{borderColor:(h.vars||h).palette.text.primary},"@media (hover: none)":{[`&:hover .${Ct.notchedOutline}`]:{borderColor:h.vars?`rgba(${h.vars.palette.common.onBackgroundChannel} / 0.23)`:e}},[`&.${Ct.focused} .${Ct.notchedOutline}`]:{borderStyle:"solid",borderWidth:2},[`&.${Ct.disabled}`]:{[`& .${Ct.notchedOutline}`]:{borderColor:(h.vars||h).palette.action.disabled},"*":{color:(h.vars||h).palette.action.disabled}},[`&.${Ct.error} .${Ct.notchedOutline}`]:{borderColor:(h.vars||h).palette.error.main},variants:Object.keys((h.vars??h).palette).filter(t=>{var n;return((n=(h.vars??h).palette[t])==null?void 0:n.main)??!1}).map(t=>({props:{color:t},style:{[`&.${Ct.focused}:not(.${Ct.error}) .${Ct.notchedOutline}`]:{borderColor:(h.vars||h).palette[t].main}}}))}}),Xd=me(os,{name:"MuiPickersOutlinedInput",slot:"SectionsContainer",overridesResolver:(h,e)=>e.sectionsContainer})({padding:"16.5px 0",variants:[{props:{size:"small"},style:{padding:"8.5px 0"}}]}),Zd=h=>{const{classes:e}=h,n=Me({root:["root"],notchedOutline:["notchedOutline"],input:["input"]},zd,e);return J({},e,n)},da=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiPickersOutlinedInput"}),{label:f,ownerState:i,notched:o}=n,p=we(n,Jd),s=Ki(),u=J({},n,i,s,{color:(s==null?void 0:s.color)||"primary"}),r=Zd(u);return ee.jsx(as,J({slots:{root:Qd,input:Xd},renderSuffix:a=>ee.jsx(Yd,{shrink:!!(o||a.adornedStart||a.focused||a.filled),notched:!!(o||a.adornedStart||a.focused||a.filled),className:r.notchedOutline,label:f!=null&&f!==""&&(s!=null&&s.required)?ee.jsxs(Q.Fragment,{children:[f," ","*"]}):f,ownerState:u})},p,{label:f,classes:r,ref:t}))});da.muiName="Input";function qd(h,...e){const t=new URL(`https://mui.com/production-error/?code=${h}`);return e.forEach(n=>t.searchParams.append("args[]",n)),`Minified MUI error #${h}; visit ${t} for the full message.`}function kn(h){if(typeof h!="object"||h===null)return!1;const e=Object.getPrototypeOf(h);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in h)&&!(Symbol.iterator in h)}function pa(h){if(Q.isValidElement(h)||_o.isValidElementType(h)||!kn(h))return h;const e={};return Object.keys(h).forEach(t=>{e[t]=pa(h[t])}),e}function Hi(h,e,t={clone:!0}){const n=t.clone?{...h}:h;return kn(h)&&kn(e)&&Object.keys(e).forEach(f=>{Q.isValidElement(e[f])||_o.isValidElementType(e[f])?n[f]=e[f]:kn(e[f])&&Object.prototype.hasOwnProperty.call(h,f)&&kn(h[f])?n[f]=Hi(h[f],e[f],t):t.clone?n[f]=kn(e[f])?pa(e[f]):e[f]:n[f]=e[f]}),n}const ep=h=>{const e=Object.keys(h).map(t=>({key:t,val:h[t]}))||[];return e.sort((t,n)=>t.val-n.val),e.reduce((t,n)=>({...t,[n.key]:n.val}),{})};function tp(h){const{values:e={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:t="px",step:n=5,...f}=h,i=ep(e),o=Object.keys(i);function p(l){return`@media (min-width:${typeof e[l]=="number"?e[l]:l}${t})`}function s(l){return`@media (max-width:${(typeof e[l]=="number"?e[l]:l)-n/100}${t})`}function u(l,d){const c=o.indexOf(d);return`@media (min-width:${typeof e[l]=="number"?e[l]:l}${t}) and (max-width:${(c!==-1&&typeof e[o[c]]=="number"?e[o[c]]:d)-n/100}${t})`}function r(l){return o.indexOf(l)+1<o.length?u(l,o[o.indexOf(l)+1]):p(l)}function a(l){const d=o.indexOf(l);return d===0?p(o[1]):d===o.length-1?s(o[d]):u(l,o[o.indexOf(l)+1]).replace("@media","@media not all and")}return{keys:o,values:i,up:p,down:s,between:u,only:r,not:a,unit:t,...f}}function Gs(h,e){if(!h.containerQueries)return e;const t=Object.keys(e).filter(n=>n.startsWith("@container")).sort((n,f)=>{var o,p;const i=/min-width:\s*([0-9.]+)/;return+(((o=n.match(i))==null?void 0:o[1])||0)-+(((p=f.match(i))==null?void 0:p[1])||0)});return t.length?t.reduce((n,f)=>{const i=e[f];return delete n[f],n[f]=i,n},{...e}):e}function np(h,e){return e==="@"||e.startsWith("@")&&(h.some(t=>e.startsWith(`@${t}`))||!!e.match(/^@\d/))}function ip(h,e){const t=e.match(/^@([^/]+)?\/?(.+)?$/);if(!t)return null;const[,n,f]=t,i=Number.isNaN(+n)?n||0:+n;return h.containerQueries(f).up(i)}function rp(h){const e=(i,o)=>i.replace("@media",o?`@container ${o}`:"@container");function t(i,o){i.up=(...p)=>e(h.breakpoints.up(...p),o),i.down=(...p)=>e(h.breakpoints.down(...p),o),i.between=(...p)=>e(h.breakpoints.between(...p),o),i.only=(...p)=>e(h.breakpoints.only(...p),o),i.not=(...p)=>{const s=e(h.breakpoints.not(...p),o);return s.includes("not all and")?s.replace("not all and ","").replace("min-width:","width<").replace("max-width:","width>").replace("and","or"):s}}const n={},f=i=>(t(n,i),n);return t(f),{...h,containerQueries:f}}const sp={borderRadius:4};function ii(h,e){return e?Hi(h,e,{clone:!1}):h}const sr={xs:0,sm:600,md:900,lg:1200,xl:1536},Ks={keys:["xs","sm","md","lg","xl"],up:h=>`@media (min-width:${sr[h]}px)`},op={containerQueries:h=>({up:e=>{let t=typeof e=="number"?e:sr[e]||e;return typeof t=="number"&&(t=`${t}px`),h?`@container ${h} (min-width:${t})`:`@container (min-width:${t})`}})};function Vt(h,e,t){const n=h.theme||{};if(Array.isArray(e)){const i=n.breakpoints||Ks;return e.reduce((o,p,s)=>(o[i.up(i.keys[s])]=t(e[s]),o),{})}if(typeof e=="object"){const i=n.breakpoints||Ks;return Object.keys(e).reduce((o,p)=>{if(np(i.keys,p)){const s=ip(n.containerQueries?n:op,p);s&&(o[s]=t(e[p],p))}else if(Object.keys(i.values||sr).includes(p)){const s=i.up(p);o[s]=t(e[p],p)}else{const s=p;o[s]=e[s]}return o},{})}return t(e)}function ap(h={}){var t;return((t=h.keys)==null?void 0:t.reduce((n,f)=>{const i=h.up(f);return n[i]={},n},{}))||{}}function Ys(h,e){return h.reduce((t,n)=>{const f=t[n];return(!f||Object.keys(f).length===0)&&delete t[n],t},e)}function fa(h){if(typeof h!="string")throw new Error(qd(7));return h.charAt(0).toUpperCase()+h.slice(1)}function or(h,e,t=!0){if(!e||typeof e!="string")return null;if(h&&h.vars&&t){const n=`vars.${e}`.split(".").reduce((f,i)=>f&&f[i]?f[i]:null,h);if(n!=null)return n}return e.split(".").reduce((n,f)=>n&&n[f]!=null?n[f]:null,h)}function zi(h,e,t,n=t){let f;return typeof h=="function"?f=h(t):Array.isArray(h)?f=h[t]||n:f=or(h,t)||n,e&&(f=e(f,n,h)),f}function Ke(h){const{prop:e,cssProperty:t=h.prop,themeKey:n,transform:f}=h,i=o=>{if(o[e]==null)return null;const p=o[e],s=o.theme,u=or(s,n)||{};return Vt(o,p,a=>{let l=zi(u,f,a);return a===l&&typeof a=="string"&&(l=zi(u,f,`${e}${a==="default"?"":fa(a)}`,a)),t===!1?l:{[t]:l}})};return i.propTypes={},i.filterProps=[e],i}function lp(h){const e={};return t=>(e[t]===void 0&&(e[t]=h(t)),e[t])}const cp={m:"margin",p:"padding"},up={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},Js={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},hp=lp(h=>{if(h.length>2)if(Js[h])h=Js[h];else return[h];const[e,t]=h.split(""),n=cp[e],f=up[t]||"";return Array.isArray(f)?f.map(i=>n+i):[n+f]}),ls=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],cs=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"];[...ls,...cs];function gi(h,e,t,n){const f=or(h,e,!0)??t;return typeof f=="number"||typeof f=="string"?i=>typeof i=="string"?i:typeof f=="string"?f.startsWith("var(")&&i===0?0:f.startsWith("var(")&&i===1?f:`calc(${i} * ${f})`:f*i:Array.isArray(f)?i=>{if(typeof i=="string")return i;const o=Math.abs(i),p=f[o];return i>=0?p:typeof p=="number"?-p:typeof p=="string"&&p.startsWith("var(")?`calc(-1 * ${p})`:`-${p}`}:typeof f=="function"?f:()=>{}}function ma(h){return gi(h,"spacing",8)}function vi(h,e){return typeof e=="string"||e==null?e:h(e)}function dp(h,e){return t=>h.reduce((n,f)=>(n[f]=vi(e,t),n),{})}function pp(h,e,t,n){if(!e.includes(t))return null;const f=hp(t),i=dp(f,n),o=h[t];return Vt(h,o,i)}function ga(h,e){const t=ma(h.theme);return Object.keys(h).map(n=>pp(h,e,n,t)).reduce(ii,{})}function ze(h){return ga(h,ls)}ze.propTypes={};ze.filterProps=ls;function Ue(h){return ga(h,cs)}Ue.propTypes={};Ue.filterProps=cs;function fp(h=8,e=ma({spacing:h})){if(h.mui)return h;const t=(...n)=>(n.length===0?[1]:n).map(i=>{const o=e(i);return typeof o=="number"?`${o}px`:o}).join(" ");return t.mui=!0,t}function ar(...h){const e=h.reduce((n,f)=>(f.filterProps.forEach(i=>{n[i]=f}),n),{}),t=n=>Object.keys(n).reduce((f,i)=>e[i]?ii(f,e[i](n)):f,{});return t.propTypes={},t.filterProps=h.reduce((n,f)=>n.concat(f.filterProps),[]),t}function gt(h){return typeof h!="number"?h:`${h}px solid`}function yt(h,e){return Ke({prop:h,themeKey:"borders",transform:e})}const mp=yt("border",gt),gp=yt("borderTop",gt),vp=yt("borderRight",gt),yp=yt("borderBottom",gt),bp=yt("borderLeft",gt),wp=yt("borderColor"),Cp=yt("borderTopColor"),xp=yt("borderRightColor"),Sp=yt("borderBottomColor"),Dp=yt("borderLeftColor"),Ep=yt("outline",gt),Ap=yt("outlineColor"),lr=h=>{if(h.borderRadius!==void 0&&h.borderRadius!==null){const e=gi(h.theme,"shape.borderRadius",4),t=n=>({borderRadius:vi(e,n)});return Vt(h,h.borderRadius,t)}return null};lr.propTypes={};lr.filterProps=["borderRadius"];ar(mp,gp,vp,yp,bp,wp,Cp,xp,Sp,Dp,lr,Ep,Ap);const cr=h=>{if(h.gap!==void 0&&h.gap!==null){const e=gi(h.theme,"spacing",8),t=n=>({gap:vi(e,n)});return Vt(h,h.gap,t)}return null};cr.propTypes={};cr.filterProps=["gap"];const ur=h=>{if(h.columnGap!==void 0&&h.columnGap!==null){const e=gi(h.theme,"spacing",8),t=n=>({columnGap:vi(e,n)});return Vt(h,h.columnGap,t)}return null};ur.propTypes={};ur.filterProps=["columnGap"];const hr=h=>{if(h.rowGap!==void 0&&h.rowGap!==null){const e=gi(h.theme,"spacing",8),t=n=>({rowGap:vi(e,n)});return Vt(h,h.rowGap,t)}return null};hr.propTypes={};hr.filterProps=["rowGap"];const Tp=Ke({prop:"gridColumn"}),kp=Ke({prop:"gridRow"}),$p=Ke({prop:"gridAutoFlow"}),Mp=Ke({prop:"gridAutoColumns"}),_p=Ke({prop:"gridAutoRows"}),Ip=Ke({prop:"gridTemplateColumns"}),Lp=Ke({prop:"gridTemplateRows"}),Fp=Ke({prop:"gridTemplateAreas"}),Rp=Ke({prop:"gridArea"});ar(cr,ur,hr,Tp,kp,$p,Mp,_p,Ip,Lp,Fp,Rp);function In(h,e){return e==="grey"?e:h}const Op=Ke({prop:"color",themeKey:"palette",transform:In}),Pp=Ke({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:In}),Np=Ke({prop:"backgroundColor",themeKey:"palette",transform:In});ar(Op,Pp,Np);function ct(h){return h<=1&&h!==0?`${h*100}%`:h}const Bp=Ke({prop:"width",transform:ct}),us=h=>{if(h.maxWidth!==void 0&&h.maxWidth!==null){const e=t=>{var f,i,o,p,s;const n=((o=(i=(f=h.theme)==null?void 0:f.breakpoints)==null?void 0:i.values)==null?void 0:o[t])||sr[t];return n?((s=(p=h.theme)==null?void 0:p.breakpoints)==null?void 0:s.unit)!=="px"?{maxWidth:`${n}${h.theme.breakpoints.unit}`}:{maxWidth:n}:{maxWidth:ct(t)}};return Vt(h,h.maxWidth,e)}return null};us.filterProps=["maxWidth"];const Vp=Ke({prop:"minWidth",transform:ct}),Wp=Ke({prop:"height",transform:ct}),jp=Ke({prop:"maxHeight",transform:ct}),Hp=Ke({prop:"minHeight",transform:ct});Ke({prop:"size",cssProperty:"width",transform:ct});Ke({prop:"size",cssProperty:"height",transform:ct});const zp=Ke({prop:"boxSizing"});ar(Bp,us,Vp,Wp,jp,Hp,zp);const va={border:{themeKey:"borders",transform:gt},borderTop:{themeKey:"borders",transform:gt},borderRight:{themeKey:"borders",transform:gt},borderBottom:{themeKey:"borders",transform:gt},borderLeft:{themeKey:"borders",transform:gt},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:gt},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:lr},color:{themeKey:"palette",transform:In},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:In},backgroundColor:{themeKey:"palette",transform:In},p:{style:Ue},pt:{style:Ue},pr:{style:Ue},pb:{style:Ue},pl:{style:Ue},px:{style:Ue},py:{style:Ue},padding:{style:Ue},paddingTop:{style:Ue},paddingRight:{style:Ue},paddingBottom:{style:Ue},paddingLeft:{style:Ue},paddingX:{style:Ue},paddingY:{style:Ue},paddingInline:{style:Ue},paddingInlineStart:{style:Ue},paddingInlineEnd:{style:Ue},paddingBlock:{style:Ue},paddingBlockStart:{style:Ue},paddingBlockEnd:{style:Ue},m:{style:ze},mt:{style:ze},mr:{style:ze},mb:{style:ze},ml:{style:ze},mx:{style:ze},my:{style:ze},margin:{style:ze},marginTop:{style:ze},marginRight:{style:ze},marginBottom:{style:ze},marginLeft:{style:ze},marginX:{style:ze},marginY:{style:ze},marginInline:{style:ze},marginInlineStart:{style:ze},marginInlineEnd:{style:ze},marginBlock:{style:ze},marginBlockStart:{style:ze},marginBlockEnd:{style:ze},displayPrint:{cssProperty:!1,transform:h=>({"@media print":{display:h}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:cr},rowGap:{style:hr},columnGap:{style:ur},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:ct},maxWidth:{style:us},minWidth:{transform:ct},height:{transform:ct},maxHeight:{transform:ct},minHeight:{transform:ct},boxSizing:{},font:{themeKey:"font"},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function Up(...h){const e=h.reduce((n,f)=>n.concat(Object.keys(f)),[]),t=new Set(e);return h.every(n=>t.size===Object.keys(n).length)}function Gp(h,e){return typeof h=="function"?h(e):h}function Kp(){function h(t,n,f,i){const o={[t]:n,theme:f},p=i[t];if(!p)return{[t]:n};const{cssProperty:s=t,themeKey:u,transform:r,style:a}=p;if(n==null)return null;if(u==="typography"&&n==="inherit")return{[t]:n};const l=or(f,u)||{};return a?a(o):Vt(o,n,c=>{let m=zi(l,r,c);return c===m&&typeof c=="string"&&(m=zi(l,r,`${t}${c==="default"?"":fa(c)}`,c)),s===!1?m:{[s]:m}})}function e(t){const{sx:n,theme:f={},nested:i}=t||{};if(!n)return null;const o=f.unstable_sxConfig??va;function p(s){let u=s;if(typeof s=="function")u=s(f);else if(typeof s!="object")return s;if(!u)return null;const r=ap(f.breakpoints),a=Object.keys(r);let l=r;return Object.keys(u).forEach(d=>{const c=Gp(u[d],f);if(c!=null)if(typeof c=="object")if(o[d])l=ii(l,h(d,c,f,o));else{const m=Vt({theme:f},c,g=>({[d]:g}));Up(m,c)?l[d]=e({sx:c,theme:f,nested:!0}):l=ii(l,m)}else l=ii(l,h(d,c,f,o))}),!i&&f.modularCssLayers?{"@layer sx":Gs(f,Ys(a,l))}:Gs(f,Ys(a,l))}return Array.isArray(n)?n.map(p):p(n)}return e}const ya=Kp();ya.filterProps=["sx"];function Yp(h,e){var n;const t=this;if(t.vars){if(!((n=t.colorSchemes)!=null&&n[h])||typeof t.getColorSchemeSelector!="function")return{};let f=t.getColorSchemeSelector(h);return f==="&"?e:((f.includes("data-")||f.includes("."))&&(f=`*:where(${f.replace(/\s*&$/,"")}) &`),{[f]:e})}return t.palette.mode===h?e:{}}function Jp(h={},...e){const{breakpoints:t={},palette:n={},spacing:f,shape:i={},...o}=h,p=tp(t),s=fp(f);let u=Hi({breakpoints:p,direction:"ltr",components:{},palette:{mode:"light",...n},spacing:s,shape:{...sp,...i}},o);return u=rp(u),u.applyStyles=Yp,u=e.reduce((r,a)=>Hi(r,a),u),u.unstable_sxConfig={...va,...o==null?void 0:o.unstable_sxConfig},u.unstable_sx=function(a){return ya({sx:a,theme:this})},u}Jp();function Qp(h){return h!=="ownerState"&&h!=="theme"&&h!=="sx"&&h!=="as"}function Xp(h){return Fe("MuiPickersFilledInput",h)}const cn=J({},_n,Re("MuiPickersFilledInput",["root","underline","input"])),Zp=["label","autoFocus","disableUnderline","ownerState"],qp=me(rr,{name:"MuiPickersFilledInput",slot:"Root",overridesResolver:(h,e)=>e.root,shouldForwardProp:h=>Qp(h)&&h!=="disableUnderline"})(({theme:h})=>{const e=h.palette.mode==="light",t=e?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)",n=e?"rgba(0, 0, 0, 0.06)":"rgba(255, 255, 255, 0.09)",f=e?"rgba(0, 0, 0, 0.09)":"rgba(255, 255, 255, 0.13)",i=e?"rgba(0, 0, 0, 0.12)":"rgba(255, 255, 255, 0.12)";return{backgroundColor:h.vars?h.vars.palette.FilledInput.bg:n,borderTopLeftRadius:(h.vars||h).shape.borderRadius,borderTopRightRadius:(h.vars||h).shape.borderRadius,transition:h.transitions.create("background-color",{duration:h.transitions.duration.shorter,easing:h.transitions.easing.easeOut}),"&:hover":{backgroundColor:h.vars?h.vars.palette.FilledInput.hoverBg:f,"@media (hover: none)":{backgroundColor:h.vars?h.vars.palette.FilledInput.bg:n}},[`&.${cn.focused}`]:{backgroundColor:h.vars?h.vars.palette.FilledInput.bg:n},[`&.${cn.disabled}`]:{backgroundColor:h.vars?h.vars.palette.FilledInput.disabledBg:i},variants:[...Object.keys((h.vars??h).palette).filter(o=>(h.vars??h).palette[o].main).map(o=>{var p;return{props:{color:o,disableUnderline:!1},style:{"&::after":{borderBottom:`2px solid ${(p=(h.vars||h).palette[o])==null?void 0:p.main}`}}}}),{props:{disableUnderline:!1},style:{"&::after":{left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:h.transitions.create("transform",{duration:h.transitions.duration.shorter,easing:h.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${cn.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${cn.error}`]:{"&:before, &:after":{borderBottomColor:(h.vars||h).palette.error.main}},"&::before":{borderBottom:`1px solid ${h.vars?`rgba(${h.vars.palette.common.onBackgroundChannel} / ${h.vars.opacity.inputUnderline})`:t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:h.transitions.create("border-bottom-color",{duration:h.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${cn.disabled}, .${cn.error}):before`]:{borderBottom:`1px solid ${(h.vars||h).palette.text.primary}`},[`&.${cn.disabled}:before`]:{borderBottomStyle:"dotted"}}},{props:({startAdornment:o})=>!!o,style:{paddingLeft:12}},{props:({endAdornment:o})=>!!o,style:{paddingRight:12}}]}}),ef=me(os,{name:"MuiPickersFilledInput",slot:"sectionsContainer",overridesResolver:(h,e)=>e.sectionsContainer})({paddingTop:25,paddingRight:12,paddingBottom:8,paddingLeft:12,variants:[{props:{size:"small"},style:{paddingTop:21,paddingBottom:4}},{props:({startAdornment:h})=>!!h,style:{paddingLeft:0}},{props:({endAdornment:h})=>!!h,style:{paddingRight:0}},{props:{hiddenLabel:!0},style:{paddingTop:16,paddingBottom:17}},{props:{hiddenLabel:!0,size:"small"},style:{paddingTop:8,paddingBottom:9}}]}),tf=h=>{const{classes:e,disableUnderline:t}=h,f=Me({root:["root",!t&&"underline"],input:["input"]},Xp,e);return J({},e,f)},ba=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiPickersFilledInput"}),{label:f,disableUnderline:i=!1,ownerState:o}=n,p=we(n,Zp),s=Ki(),u=J({},n,o,s,{color:(s==null?void 0:s.color)||"primary"}),r=tf(u);return ee.jsx(as,J({slots:{root:qp,input:ef},slotProps:{root:{disableUnderline:i}}},p,{label:f,classes:r,ref:t}))});ba.muiName="Input";function nf(h){return Fe("MuiPickersFilledInput",h)}const Xn=J({},_n,Re("MuiPickersInput",["root","input"])),rf=["label","autoFocus","disableUnderline","ownerState"],sf=me(rr,{name:"MuiPickersInput",slot:"Root",overridesResolver:(h,e)=>e.root})(({theme:h})=>{let t=h.palette.mode==="light"?"rgba(0, 0, 0, 0.42)":"rgba(255, 255, 255, 0.7)";return h.vars&&(t=`rgba(${h.vars.palette.common.onBackgroundChannel} / ${h.vars.opacity.inputUnderline})`),{"label + &":{marginTop:16},variants:[...Object.keys((h.vars??h).palette).filter(n=>(h.vars??h).palette[n].main).map(n=>({props:{color:n},style:{"&::after":{borderBottom:`2px solid ${(h.vars||h).palette[n].main}`}}})),{props:{disableUnderline:!1},style:{"&::after":{background:"red",left:0,bottom:0,content:'""',position:"absolute",right:0,transform:"scaleX(0)",transition:h.transitions.create("transform",{duration:h.transitions.duration.shorter,easing:h.transitions.easing.easeOut}),pointerEvents:"none"},[`&.${Xn.focused}:after`]:{transform:"scaleX(1) translateX(0)"},[`&.${Xn.error}`]:{"&:before, &:after":{borderBottomColor:(h.vars||h).palette.error.main}},"&::before":{borderBottom:`1px solid ${t}`,left:0,bottom:0,content:'"\\00a0"',position:"absolute",right:0,transition:h.transitions.create("border-bottom-color",{duration:h.transitions.duration.shorter}),pointerEvents:"none"},[`&:hover:not(.${Xn.disabled}, .${Xn.error}):before`]:{borderBottom:`2px solid ${(h.vars||h).palette.text.primary}`,"@media (hover: none)":{borderBottom:`1px solid ${t}`}},[`&.${Xn.disabled}:before`]:{borderBottomStyle:"dotted"}}}]}}),of=h=>{const{classes:e,disableUnderline:t}=h,f=Me({root:["root",!t&&"underline"],input:["input"]},nf,e);return J({},e,f)},wa=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiPickersInput"}),{label:f,disableUnderline:i=!1,ownerState:o}=n,p=we(n,rf),s=Ki(),u=J({},n,o,s,{disableUnderline:i,color:(s==null?void 0:s.color)||"primary"}),r=of(u);return ee.jsx(as,J({slots:{root:sf}},p,{label:f,classes:r,ref:t}))});wa.muiName="Input";const af=["onFocus","onBlur","className","color","disabled","error","variant","required","InputProps","inputProps","inputRef","sectionListRef","elements","areAllSectionsEmpty","onClick","onKeyDown","onKeyUp","onPaste","onInput","endAdornment","startAdornment","tabIndex","contentEditable","focused","value","onChange","fullWidth","id","name","helperText","FormHelperTextProps","label","InputLabelProps"],lf={standard:wa,filled:ba,outlined:da},cf=me(rc,{name:"MuiPickersTextField",slot:"Root",overridesResolver:(h,e)=>e.root})({maxWidth:"100%"}),uf=h=>{const{focused:e,disabled:t,classes:n,required:f}=h;return Me({root:["root",e&&!t&&"focused",t&&"disabled",f&&"required"]},Md,n)},Ca=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiPickersTextField"}),{onFocus:f,onBlur:i,className:o,color:p="primary",disabled:s=!1,error:u=!1,variant:r="outlined",required:a=!1,InputProps:l,inputProps:d,inputRef:c,sectionListRef:m,elements:g,areAllSectionsEmpty:v,onClick:b,onKeyDown:E,onKeyUp:S,onPaste:w,onInput:y,endAdornment:D,startAdornment:$,tabIndex:A,contentEditable:_,focused:L,value:T,onChange:k,fullWidth:x,id:C,name:M,helperText:F,FormHelperTextProps:R,label:O,InputLabelProps:B}=n,N=we(n,af),j=Q.useRef(null),V=rt(t,j),W=Pn(C),H=F&&W?`${W}-helper-text`:void 0,U=O&&W?`${W}-label`:void 0,X=J({},n,{color:p,disabled:s,error:u,focused:L,required:a,variant:r}),Y=uf(X),Z=lf[r];return ee.jsxs(cf,J({className:Oe(Y.root,o),ref:V,focused:L,onFocus:f,onBlur:i,disabled:s,variant:r,error:u,color:p,fullWidth:x,required:a,ownerState:X},N,{children:[ee.jsx(nc,J({htmlFor:W,id:U},B,{children:O})),ee.jsx(Z,J({elements:g,areAllSectionsEmpty:v,onClick:b,onKeyDown:E,onKeyUp:S,onInput:y,onPaste:w,endAdornment:D,startAdornment:$,tabIndex:A,contentEditable:_,value:T,onChange:k,id:W,fullWidth:x,inputProps:d,inputRef:c,sectionListRef:m,label:O,name:M,role:"group","aria-labelledby":U,"aria-describedby":H,"aria-live":H?"polite":void 0},l)),F&&ee.jsx(ic,J({id:H},R,{children:F}))]}))}),hf=["enableAccessibleFieldDOMStructure"],df=["InputProps","readOnly"],pf=["onPaste","onKeyDown","inputMode","readOnly","InputProps","inputProps","inputRef"],xa=h=>{let{enableAccessibleFieldDOMStructure:e}=h,t=we(h,hf);if(e){const{InputProps:a,readOnly:l}=t,d=we(t,df);return J({},d,{InputProps:J({},a??{},{readOnly:l})})}const{onPaste:n,onKeyDown:f,inputMode:i,readOnly:o,InputProps:p,inputProps:s,inputRef:u}=t,r=we(t,pf);return J({},r,{InputProps:J({},p??{},{readOnly:o}),inputProps:J({},s??{},{inputMode:i,onPaste:n,onKeyDown:f,ref:u})})},ff=["slots","slotProps","InputProps","inputProps"],Sa=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiDateField"}),{slots:f,slotProps:i,InputProps:o,inputProps:p}=n,s=we(n,ff),u=n,r=(f==null?void 0:f.textField)??(e.enableAccessibleFieldDOMStructure?Ca:$o),a=Ie({elementType:r,externalSlotProps:i==null?void 0:i.textField,externalForwardedProps:s,additionalProps:{ref:t},ownerState:u});a.inputProps=J({},p,a.inputProps),a.InputProps=J({},o,a.InputProps);const l=$d(a),d=xa(l),c=sa(J({},d,{slots:f,slotProps:i}));return ee.jsx(r,J({},c))}),mf=h=>{const e=kd(h),{forwardedProps:t,internalProps:n}=oa(e,"time");return ra({forwardedProps:t,internalProps:n,valueManager:Qe,fieldValueManager:Zo,validator:nr,valueType:"time"})},gf=["slots","slotProps","InputProps","inputProps"],Da=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiTimeField"}),{slots:f,slotProps:i,InputProps:o,inputProps:p}=n,s=we(n,gf),u=n,r=(f==null?void 0:f.textField)??(e.enableAccessibleFieldDOMStructure?Ca:$o),a=Ie({elementType:r,externalSlotProps:i==null?void 0:i.textField,externalForwardedProps:s,ownerState:u,additionalProps:{ref:t}});a.inputProps=J({},p,a.inputProps),a.InputProps=J({},o,a.InputProps);const l=mf(a),d=xa(l),c=sa(J({},d,{slots:f,slotProps:i}));return ee.jsx(r,J({},c))}),Ea=({shouldDisableDate:h,shouldDisableMonth:e,shouldDisableYear:t,minDate:n,maxDate:f,disableFuture:i,disablePast:o,timezone:p})=>{const s=vn();return Q.useCallback(u=>mi({adapter:s,value:u,timezone:p,props:{shouldDisableDate:h,shouldDisableMonth:e,shouldDisableYear:t,minDate:n,maxDate:f,disableFuture:i,disablePast:o}})!==null,[s,h,e,t,n,f,i,o,p])},vf=(h,e,t)=>(n,f)=>{switch(f.type){case"changeMonth":return J({},n,{slideDirection:f.direction,currentMonth:f.newMonth,isMonthSwitchingAnimating:!h});case"changeMonthTimezone":{const i=f.newTimezone;if(t.getTimezone(n.currentMonth)===i)return n;let o=t.setTimezone(n.currentMonth,i);return t.getMonth(o)!==t.getMonth(n.currentMonth)&&(o=t.setMonth(o,t.getMonth(n.currentMonth))),J({},n,{currentMonth:o})}case"finishMonthSwitchingAnimation":return J({},n,{isMonthSwitchingAnimating:!1});case"changeFocusedDay":{if(n.focusedDay!=null&&f.focusedDay!=null&&t.isSameDay(f.focusedDay,n.focusedDay))return n;const i=f.focusedDay!=null&&!e&&!t.isSameMonth(n.currentMonth,f.focusedDay);return J({},n,{focusedDay:f.focusedDay,isMonthSwitchingAnimating:i&&!h&&!f.withoutMonthSwitchingAnimation,currentMonth:i?t.startOfMonth(f.focusedDay):n.currentMonth,slideDirection:f.focusedDay!=null&&t.isAfterDay(f.focusedDay,n.currentMonth)?"left":"right"})}default:throw new Error("missing support")}},yf=h=>{const{value:e,referenceDate:t,disableFuture:n,disablePast:f,disableSwitchToMonthOnDayFocus:i=!1,maxDate:o,minDate:p,onMonthChange:s,reduceAnimations:u,shouldDisableDate:r,timezone:a}=h,l=$e(),d=Q.useRef(vf(!!u,i,l)).current,c=Q.useMemo(()=>Qe.getInitialReferenceValue({value:e,utils:l,timezone:a,props:h,referenceDate:t,granularity:St.day}),[t,a]),[m,g]=Q.useReducer(d,{isMonthSwitchingAnimating:!1,focusedDay:c,currentMonth:l.startOfMonth(c),slideDirection:"left"});Q.useEffect(()=>{g({type:"changeMonthTimezone",newTimezone:l.getTimezone(c)})},[c,l]);const v=Q.useCallback(y=>{g(J({type:"changeMonth"},y)),s&&s(y.newMonth)},[s]),b=Q.useCallback(y=>{const D=y;l.isSameMonth(D,m.currentMonth)||v({newMonth:l.startOfMonth(D),direction:l.isAfterDay(D,m.currentMonth)?"left":"right"})},[m.currentMonth,v,l]),E=Ea({shouldDisableDate:r,minDate:p,maxDate:o,disableFuture:n,disablePast:f,timezone:a}),S=Q.useCallback(()=>{g({type:"finishMonthSwitchingAnimation"})},[]),w=ve((y,D)=>{E(y)||g({type:"changeFocusedDay",focusedDay:y,withoutMonthSwitchingAnimation:D})});return{referenceDate:c,calendarState:m,changeMonth:b,changeFocusedDay:w,isDateDisabled:E,onMonthSwitchingAnimationEnd:S,handleChangeMonth:v}},bf=h=>Fe("MuiPickersFadeTransitionGroup",h);Re("MuiPickersFadeTransitionGroup",["root"]);const wf=h=>{const{classes:e}=h;return Me({root:["root"]},bf,e)},Cf=me(Mo,{name:"MuiPickersFadeTransitionGroup",slot:"Root",overridesResolver:(h,e)=>e.root})({display:"block",position:"relative"});function Aa(h){const e=Te({props:h,name:"MuiPickersFadeTransitionGroup"}),{children:t,className:n,reduceAnimations:f,transKey:i}=e,o=wf(e),p=Lo();return f?t:ee.jsx(Cf,{className:Oe(o.root,n),children:ee.jsx(Yi,{appear:!1,mountOnEnter:!0,unmountOnExit:!0,timeout:{appear:p.transitions.duration.enteringScreen,enter:p.transitions.duration.enteringScreen,exit:0},children:t},i)})}const xf=h=>Fe("MuiPickersSlideTransition",h),ft=Re("MuiPickersSlideTransition",["root","slideEnter-left","slideEnter-right","slideEnterActive","slideExit","slideExitActiveLeft-left","slideExitActiveLeft-right"]),Sf=["children","className","reduceAnimations","slideDirection","transKey","classes"],Df=h=>{const{classes:e,slideDirection:t}=h,n={root:["root"],exit:["slideExit"],enterActive:["slideEnterActive"],enter:[`slideEnter-${t}`],exitActive:[`slideExitActiveLeft-${t}`]};return Me(n,xf,e)},Ef=me(Mo,{name:"MuiPickersSlideTransition",slot:"Root",overridesResolver:(h,e)=>[e.root,{[`.${ft["slideEnter-left"]}`]:e["slideEnter-left"]},{[`.${ft["slideEnter-right"]}`]:e["slideEnter-right"]},{[`.${ft.slideEnterActive}`]:e.slideEnterActive},{[`.${ft.slideExit}`]:e.slideExit},{[`.${ft["slideExitActiveLeft-left"]}`]:e["slideExitActiveLeft-left"]},{[`.${ft["slideExitActiveLeft-right"]}`]:e["slideExitActiveLeft-right"]}]})(({theme:h})=>{const e=h.transitions.create("transform",{duration:h.transitions.duration.complex,easing:"cubic-bezier(0.35, 0.8, 0.4, 1)"});return{display:"block",position:"relative",overflowX:"hidden","& > *":{position:"absolute",top:0,right:0,left:0},[`& .${ft["slideEnter-left"]}`]:{willChange:"transform",transform:"translate(100%)",zIndex:1},[`& .${ft["slideEnter-right"]}`]:{willChange:"transform",transform:"translate(-100%)",zIndex:1},[`& .${ft.slideEnterActive}`]:{transform:"translate(0%)",transition:e},[`& .${ft.slideExit}`]:{transform:"translate(0%)"},[`& .${ft["slideExitActiveLeft-left"]}`]:{willChange:"transform",transform:"translate(-100%)",transition:e,zIndex:0},[`& .${ft["slideExitActiveLeft-right"]}`]:{willChange:"transform",transform:"translate(100%)",transition:e,zIndex:0}}});function Af(h){const e=Te({props:h,name:"MuiPickersSlideTransition"}),{children:t,className:n,reduceAnimations:f,transKey:i}=e,o=we(e,Sf),p=Df(e),s=Lo();if(f)return ee.jsx("div",{className:Oe(p.root,n),children:t});const u={exit:p.exit,enterActive:p.enterActive,enter:p.enter,exitActive:p.exitActive};return ee.jsx(Ef,{className:Oe(p.root,n),childFactory:r=>Q.cloneElement(r,{classNames:u}),role:"presentation",children:ee.jsx(Yr,J({mountOnEnter:!0,unmountOnExit:!0,timeout:s.transitions.duration.complex,classNames:u},o,{children:t}),i)})}const Tf=h=>Fe("MuiDayCalendar",h);Re("MuiDayCalendar",["root","header","weekDayLabel","loadingContainer","slideTransition","monthContainer","weekContainer","weekNumberLabel","weekNumber"]);const kf=["parentProps","day","focusableDay","selectedDays","isDateDisabled","currentMonthNumber","isViewFocused"],$f=["ownerState"],Mf=h=>{const{classes:e}=h;return Me({root:["root"],header:["header"],weekDayLabel:["weekDayLabel"],loadingContainer:["loadingContainer"],slideTransition:["slideTransition"],monthContainer:["monthContainer"],weekContainer:["weekContainer"],weekNumberLabel:["weekNumberLabel"],weekNumber:["weekNumber"]},Tf,e)},Ta=(li+Zi*2)*6,_f=me("div",{name:"MuiDayCalendar",slot:"Root",overridesResolver:(h,e)=>e.root})({}),If=me("div",{name:"MuiDayCalendar",slot:"Header",overridesResolver:(h,e)=>e.header})({display:"flex",justifyContent:"center",alignItems:"center"}),Lf=me(Zt,{name:"MuiDayCalendar",slot:"WeekDayLabel",overridesResolver:(h,e)=>e.weekDayLabel})(({theme:h})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:(h.vars||h).palette.text.secondary})),Ff=me(Zt,{name:"MuiDayCalendar",slot:"WeekNumberLabel",overridesResolver:(h,e)=>e.weekNumberLabel})(({theme:h})=>({width:36,height:40,margin:"0 2px",textAlign:"center",display:"flex",justifyContent:"center",alignItems:"center",color:h.palette.text.disabled})),Rf=me(Zt,{name:"MuiDayCalendar",slot:"WeekNumber",overridesResolver:(h,e)=>e.weekNumber})(({theme:h})=>J({},h.typography.caption,{width:li,height:li,padding:0,margin:`0 ${Zi}px`,color:h.palette.text.disabled,fontSize:"0.75rem",alignItems:"center",justifyContent:"center",display:"inline-flex"})),Of=me("div",{name:"MuiDayCalendar",slot:"LoadingContainer",overridesResolver:(h,e)=>e.loadingContainer})({display:"flex",justifyContent:"center",alignItems:"center",minHeight:Ta}),Pf=me(Af,{name:"MuiDayCalendar",slot:"SlideTransition",overridesResolver:(h,e)=>e.slideTransition})({minHeight:Ta}),Nf=me("div",{name:"MuiDayCalendar",slot:"MonthContainer",overridesResolver:(h,e)=>e.monthContainer})({overflow:"hidden"}),Bf=me("div",{name:"MuiDayCalendar",slot:"WeekContainer",overridesResolver:(h,e)=>e.weekContainer})({margin:`${Zi}px 0`,display:"flex",justifyContent:"center"});function Vf(h){let{parentProps:e,day:t,focusableDay:n,selectedDays:f,isDateDisabled:i,currentMonthNumber:o,isViewFocused:p}=h,s=we(h,kf);const{disabled:u,disableHighlightToday:r,isMonthSwitchingAnimating:a,showDaysOutsideCurrentMonth:l,slots:d,slotProps:c,timezone:m}=e,g=$e(),v=yn(m),b=n!==null&&g.isSameDay(t,n),E=f.some(T=>g.isSameDay(T,t)),S=g.isSameDay(t,v),w=(d==null?void 0:d.day)??cd,y=Ie({elementType:w,externalSlotProps:c==null?void 0:c.day,additionalProps:J({disableHighlightToday:r,showDaysOutsideCurrentMonth:l,role:"gridcell",isAnimating:a,"data-timestamp":g.toJsDate(t).valueOf()},s),ownerState:J({},e,{day:t,selected:E})}),D=we(y,$f),$=Q.useMemo(()=>u||i(t),[u,i,t]),A=Q.useMemo(()=>g.getMonth(t)!==o,[g,t,o]),_=Q.useMemo(()=>{const T=g.startOfMonth(g.setMonth(t,o));return l?g.isSameDay(t,g.startOfWeek(T)):g.isSameDay(t,T)},[o,t,l,g]),L=Q.useMemo(()=>{const T=g.endOfMonth(g.setMonth(t,o));return l?g.isSameDay(t,g.endOfWeek(T)):g.isSameDay(t,T)},[o,t,l,g]);return ee.jsx(w,J({},D,{day:t,disabled:$,autoFocus:p&&b,today:S,outsideCurrentMonth:A,isFirstVisibleCell:_,isLastVisibleCell:L,selected:E,tabIndex:b?0:-1,"aria-selected":E,"aria-current":S?"date":void 0}))}function Wf(h){const e=Te({props:h,name:"MuiDayCalendar"}),t=$e(),{onFocusedDayChange:n,className:f,currentMonth:i,selectedDays:o,focusedDay:p,loading:s,onSelectedDaysChange:u,onMonthSwitchingAnimationEnd:r,readOnly:a,reduceAnimations:l,renderLoading:d=()=>ee.jsx("span",{children:"..."}),slideDirection:c,TransitionProps:m,disablePast:g,disableFuture:v,minDate:b,maxDate:E,shouldDisableDate:S,shouldDisableMonth:w,shouldDisableYear:y,dayOfWeekFormatter:D=ae=>t.format(ae,"weekdayShort").charAt(0).toUpperCase(),hasFocus:$,onFocusedViewChange:A,gridLabelId:_,displayWeekNumber:L,fixedWeekNumber:T,autoFocus:k,timezone:x}=e,C=yn(x),M=Mf(e),F=At(),R=Ea({shouldDisableDate:S,shouldDisableMonth:w,shouldDisableYear:y,minDate:b,maxDate:E,disablePast:g,disableFuture:v,timezone:x}),O=et(),[B,N]=pn({name:"DayCalendar",state:"hasFocus",controlled:$,default:k??!1}),[j,V]=Q.useState(()=>p||C),W=ve(ae=>{a||u(ae)}),H=ae=>{R(ae)||(n(ae),V(ae),A==null||A(!0),N(!0))},U=ve((ae,ce)=>{switch(ae.key){case"ArrowUp":H(t.addDays(ce,-7)),ae.preventDefault();break;case"ArrowDown":H(t.addDays(ce,7)),ae.preventDefault();break;case"ArrowLeft":{const pe=t.addDays(ce,F?1:-1),fe=t.addMonths(ce,F?1:-1),ge=ni({utils:t,date:pe,minDate:F?pe:t.startOfMonth(fe),maxDate:F?t.endOfMonth(fe):pe,isDateDisabled:R,timezone:x});H(ge||pe),ae.preventDefault();break}case"ArrowRight":{const pe=t.addDays(ce,F?-1:1),fe=t.addMonths(ce,F?-1:1),ge=ni({utils:t,date:pe,minDate:F?t.startOfMonth(fe):pe,maxDate:F?pe:t.endOfMonth(fe),isDateDisabled:R,timezone:x});H(ge||pe),ae.preventDefault();break}case"Home":H(t.startOfWeek(ce)),ae.preventDefault();break;case"End":H(t.endOfWeek(ce)),ae.preventDefault();break;case"PageUp":H(t.addMonths(ce,1)),ae.preventDefault();break;case"PageDown":H(t.addMonths(ce,-1)),ae.preventDefault();break}}),X=ve((ae,ce)=>H(ce)),Y=ve((ae,ce)=>{B&&t.isSameDay(j,ce)&&(A==null||A(!1))}),Z=t.getMonth(i),ne=t.getYear(i),re=Q.useMemo(()=>o.filter(ae=>!!ae).map(ae=>t.startOfDay(ae)),[t,o]),le=`${ne}-${Z}`,ie=Q.useMemo(()=>Q.createRef(),[le]),de=Q.useMemo(()=>{const ae=t.startOfMonth(i),ce=t.endOfMonth(i);return R(j)||t.isAfterDay(j,ce)||t.isBeforeDay(j,ae)?ni({utils:t,date:j,minDate:ae,maxDate:ce,disablePast:g,disableFuture:v,isDateDisabled:R,timezone:x}):j},[i,v,g,j,R,t,x]),he=Q.useMemo(()=>{const ae=t.getWeekArray(i);let ce=t.addMonths(i,1);for(;T&&ae.length<T;){const pe=t.getWeekArray(ce),fe=t.isSameDay(ae[ae.length-1][0],pe[0][0]);pe.slice(fe?1:0).forEach(ge=>{ae.length<T&&ae.push(ge)}),ce=t.addMonths(ce,1)}return ae},[i,T,t]);return ee.jsxs(_f,{role:"grid","aria-labelledby":_,className:M.root,children:[ee.jsxs(If,{role:"row",className:M.header,children:[L&&ee.jsx(Ff,{variant:"caption",role:"columnheader","aria-label":O.calendarWeekNumberHeaderLabel,className:M.weekNumberLabel,children:O.calendarWeekNumberHeaderText}),qu(t,C).map((ae,ce)=>ee.jsx(Lf,{variant:"caption",role:"columnheader","aria-label":t.format(ae,"weekday"),className:M.weekDayLabel,children:D(ae)},ce.toString()))]}),s?ee.jsx(Of,{className:M.loadingContainer,children:d()}):ee.jsx(Pf,J({transKey:le,onExited:r,reduceAnimations:l,slideDirection:c,className:Oe(f,M.slideTransition)},m,{nodeRef:ie,children:ee.jsx(Nf,{ref:ie,role:"rowgroup",className:M.monthContainer,children:he.map((ae,ce)=>ee.jsxs(Bf,{role:"row",className:M.weekContainer,"aria-rowindex":ce+1,children:[L&&ee.jsx(Rf,{className:M.weekNumber,role:"rowheader","aria-label":O.calendarWeekNumberAriaLabelText(t.getWeekNumber(ae[0])),children:O.calendarWeekNumberText(t.getWeekNumber(ae[0]))}),ae.map((pe,fe)=>ee.jsx(Vf,{parentProps:e,day:pe,selectedDays:re,focusableDay:de,onKeyDown:U,onFocus:X,onBlur:Y,onDaySelect:W,isDateDisabled:R,currentMonthNumber:Z,isViewFocused:B,"aria-colindex":fe+1},pe.toString()))]},`week-${ae[0]}`))})}))]})}function jf(h){return Fe("MuiPickersMonth",h)}const Mi=Re("MuiPickersMonth",["root","monthButton","disabled","selected"]),Hf=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","aria-label","monthsPerRow","slots","slotProps"],zf=h=>{const{disabled:e,selected:t,classes:n}=h;return Me({root:["root"],monthButton:["monthButton",e&&"disabled",t&&"selected"]},jf,n)},Uf=me("div",{name:"MuiPickersMonth",slot:"Root",overridesResolver:(h,e)=>[e.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{monthsPerRow:4},style:{flexBasis:"25%"}}]}),Gf=me("button",{name:"MuiPickersMonth",slot:"MonthButton",overridesResolver:(h,e)=>[e.monthButton,{[`&.${Mi.disabled}`]:e.disabled},{[`&.${Mi.selected}`]:e.selected}]})(({theme:h})=>J({color:"unset",backgroundColor:"transparent",border:0,outline:0},h.typography.subtitle1,{margin:"8px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:h.vars?`rgba(${h.vars.palette.action.activeChannel} / ${h.vars.palette.action.hoverOpacity})`:Mt(h.palette.action.active,h.palette.action.hoverOpacity)},"&:hover":{backgroundColor:h.vars?`rgba(${h.vars.palette.action.activeChannel} / ${h.vars.palette.action.hoverOpacity})`:Mt(h.palette.action.active,h.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${Mi.disabled}`]:{color:(h.vars||h).palette.text.secondary},[`&.${Mi.selected}`]:{color:(h.vars||h).palette.primary.contrastText,backgroundColor:(h.vars||h).palette.primary.main,"&:focus, &:hover":{backgroundColor:(h.vars||h).palette.primary.dark}}})),Kf=Q.memo(function(e){const t=Te({props:e,name:"MuiPickersMonth"}),{autoFocus:n,className:f,children:i,disabled:o,selected:p,value:s,tabIndex:u,onClick:r,onKeyDown:a,onFocus:l,onBlur:d,"aria-current":c,"aria-label":m,slots:g,slotProps:v}=t,b=we(t,Hf),E=Q.useRef(null),S=zf(t);Bt(()=>{var D;n&&((D=E.current)==null||D.focus())},[n]);const w=(g==null?void 0:g.monthButton)??Gf,y=Ie({elementType:w,externalSlotProps:v==null?void 0:v.monthButton,additionalProps:{children:i,disabled:o,tabIndex:u,ref:E,type:"button",role:"radio","aria-current":c,"aria-checked":p,"aria-label":m,onClick:D=>r(D,s),onKeyDown:D=>a(D,s),onFocus:D=>l(D,s),onBlur:D=>d(D,s)},ownerState:t,className:S.monthButton});return ee.jsx(Uf,J({className:Oe(S.root,f),ownerState:t},b,{children:ee.jsx(w,J({},y))}))});function Yf(h){return Fe("MuiMonthCalendar",h)}Re("MuiMonthCalendar",["root"]);const Jf=["className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","shouldDisableMonth","readOnly","disableHighlightToday","autoFocus","onMonthFocus","hasFocus","onFocusedViewChange","monthsPerRow","timezone","gridLabelId","slots","slotProps"],Qf=h=>{const{classes:e}=h;return Me({root:["root"]},Yf,e)};function Xf(h,e){const t=$e(),n=di(),f=Te({props:h,name:e});return J({disableFuture:!1,disablePast:!1},f,{minDate:vt(t,f.minDate,n.minDate),maxDate:vt(t,f.maxDate,n.maxDate)})}const Zf=me("div",{name:"MuiMonthCalendar",slot:"Root",overridesResolver:(h,e)=>e.root})({display:"flex",flexWrap:"wrap",alignContent:"stretch",padding:"0 4px",width:qi,boxSizing:"border-box"}),qf=Q.forwardRef(function(e,t){const n=Xf(e,"MuiMonthCalendar"),{className:f,value:i,defaultValue:o,referenceDate:p,disabled:s,disableFuture:u,disablePast:r,maxDate:a,minDate:l,onChange:d,shouldDisableMonth:c,readOnly:m,autoFocus:g=!1,onMonthFocus:v,hasFocus:b,onFocusedViewChange:E,monthsPerRow:S=3,timezone:w,gridLabelId:y,slots:D,slotProps:$}=n,A=we(n,Jf),{value:_,handleValueChange:L,timezone:T}=Bn({name:"MonthCalendar",timezone:w,value:i,defaultValue:o,referenceDate:p,onChange:d,valueManager:Qe}),k=yn(T),x=At(),C=$e(),M=Q.useMemo(()=>Qe.getInitialReferenceValue({value:_,utils:C,props:n,timezone:T,referenceDate:p,granularity:St.month}),[]),F=n,R=Qf(F),O=Q.useMemo(()=>C.getMonth(k),[C,k]),B=Q.useMemo(()=>_!=null?C.getMonth(_):null,[_,C]),[N,j]=Q.useState(()=>B||C.getMonth(M)),[V,W]=pn({name:"MonthCalendar",state:"hasFocus",controlled:b,default:g??!1}),H=ve(le=>{W(le),E&&E(le)}),U=Q.useCallback(le=>{const ie=C.startOfMonth(r&&C.isAfter(k,l)?k:l),de=C.startOfMonth(u&&C.isBefore(k,a)?k:a),he=C.startOfMonth(le);return C.isBefore(he,ie)||C.isAfter(he,de)?!0:c?c(he):!1},[u,r,a,l,k,c,C]),X=ve((le,ie)=>{if(m)return;const de=C.setMonth(_??M,ie);L(de)}),Y=ve(le=>{U(C.setMonth(_??M,le))||(j(le),H(!0),v&&v(le))});Q.useEffect(()=>{j(le=>B!==null&&le!==B?B:le)},[B]);const Z=ve((le,ie)=>{switch(le.key){case"ArrowUp":Y((12+ie-3)%12),le.preventDefault();break;case"ArrowDown":Y((12+ie+3)%12),le.preventDefault();break;case"ArrowLeft":Y((12+ie+(x?1:-1))%12),le.preventDefault();break;case"ArrowRight":Y((12+ie+(x?-1:1))%12),le.preventDefault();break}}),ne=ve((le,ie)=>{Y(ie)}),re=ve((le,ie)=>{N===ie&&H(!1)});return ee.jsx(Zf,J({ref:t,className:Oe(R.root,f),ownerState:F,role:"radiogroup","aria-labelledby":y},A,{children:qr(C,_??M).map(le=>{const ie=C.getMonth(le),de=C.format(le,"monthShort"),he=C.format(le,"month"),ae=ie===B,ce=s||U(le);return ee.jsx(Kf,{selected:ae,value:ie,onClick:X,onKeyDown:Z,autoFocus:V&&ie===N,disabled:ce,tabIndex:ie===N&&!ce?0:-1,onFocus:ne,onBlur:re,"aria-current":O===ie?"date":void 0,"aria-label":he,monthsPerRow:S,slots:D,slotProps:$,children:de},de)})}))});function em(h){return Fe("MuiPickersYear",h)}const _i=Re("MuiPickersYear",["root","yearButton","selected","disabled"]),tm=["autoFocus","className","children","disabled","selected","value","tabIndex","onClick","onKeyDown","onFocus","onBlur","aria-current","yearsPerRow","slots","slotProps"],nm=h=>{const{disabled:e,selected:t,classes:n}=h;return Me({root:["root"],yearButton:["yearButton",e&&"disabled",t&&"selected"]},em,n)},im=me("div",{name:"MuiPickersYear",slot:"Root",overridesResolver:(h,e)=>[e.root]})({display:"flex",alignItems:"center",justifyContent:"center",flexBasis:"33.3%",variants:[{props:{yearsPerRow:4},style:{flexBasis:"25%"}}]}),rm=me("button",{name:"MuiPickersYear",slot:"YearButton",overridesResolver:(h,e)=>[e.yearButton,{[`&.${_i.disabled}`]:e.disabled},{[`&.${_i.selected}`]:e.selected}]})(({theme:h})=>J({color:"unset",backgroundColor:"transparent",border:0,outline:0},h.typography.subtitle1,{margin:"6px 0",height:36,width:72,borderRadius:18,cursor:"pointer","&:focus":{backgroundColor:h.vars?`rgba(${h.vars.palette.action.activeChannel} / ${h.vars.palette.action.focusOpacity})`:Mt(h.palette.action.active,h.palette.action.focusOpacity)},"&:hover":{backgroundColor:h.vars?`rgba(${h.vars.palette.action.activeChannel} / ${h.vars.palette.action.hoverOpacity})`:Mt(h.palette.action.active,h.palette.action.hoverOpacity)},"&:disabled":{cursor:"auto",pointerEvents:"none"},[`&.${_i.disabled}`]:{color:(h.vars||h).palette.text.secondary},[`&.${_i.selected}`]:{color:(h.vars||h).palette.primary.contrastText,backgroundColor:(h.vars||h).palette.primary.main,"&:focus, &:hover":{backgroundColor:(h.vars||h).palette.primary.dark}}})),sm=Q.memo(function(e){const t=Te({props:e,name:"MuiPickersYear"}),{autoFocus:n,className:f,children:i,disabled:o,selected:p,value:s,tabIndex:u,onClick:r,onKeyDown:a,onFocus:l,onBlur:d,"aria-current":c,slots:m,slotProps:g}=t,v=we(t,tm),b=Q.useRef(null),E=nm(t);Bt(()=>{var y;n&&((y=b.current)==null||y.focus())},[n]);const S=(m==null?void 0:m.yearButton)??rm,w=Ie({elementType:S,externalSlotProps:g==null?void 0:g.yearButton,additionalProps:{children:i,disabled:o,tabIndex:u,ref:b,type:"button",role:"radio","aria-current":c,"aria-checked":p,onClick:y=>r(y,s),onKeyDown:y=>a(y,s),onFocus:y=>l(y,s),onBlur:y=>d(y,s)},ownerState:t,className:E.yearButton});return ee.jsx(im,J({className:Oe(E.root,f),ownerState:t},v,{children:ee.jsx(S,J({},w))}))});function om(h){return Fe("MuiYearCalendar",h)}Re("MuiYearCalendar",["root"]);const am=["autoFocus","className","value","defaultValue","referenceDate","disabled","disableFuture","disablePast","maxDate","minDate","onChange","readOnly","shouldDisableYear","disableHighlightToday","onYearFocus","hasFocus","onFocusedViewChange","yearsOrder","yearsPerRow","timezone","gridLabelId","slots","slotProps"],lm=h=>{const{classes:e}=h;return Me({root:["root"]},om,e)};function cm(h,e){const t=$e(),n=di(),f=Te({props:h,name:e});return J({disablePast:!1,disableFuture:!1},f,{yearsPerRow:f.yearsPerRow??3,minDate:vt(t,f.minDate,n.minDate),maxDate:vt(t,f.maxDate,n.maxDate)})}const um=me("div",{name:"MuiYearCalendar",slot:"Root",overridesResolver:(h,e)=>e.root})({display:"flex",flexDirection:"row",flexWrap:"wrap",overflowY:"auto",height:"100%",padding:"0 4px",width:qi,maxHeight:Ru,boxSizing:"border-box",position:"relative"}),hm=Q.forwardRef(function(e,t){const n=cm(e,"MuiYearCalendar"),{autoFocus:f,className:i,value:o,defaultValue:p,referenceDate:s,disabled:u,disableFuture:r,disablePast:a,maxDate:l,minDate:d,onChange:c,readOnly:m,shouldDisableYear:g,onYearFocus:v,hasFocus:b,onFocusedViewChange:E,yearsOrder:S="asc",yearsPerRow:w,timezone:y,gridLabelId:D,slots:$,slotProps:A}=n,_=we(n,am),{value:L,handleValueChange:T,timezone:k}=Bn({name:"YearCalendar",timezone:y,value:o,defaultValue:p,referenceDate:s,onChange:c,valueManager:Qe}),x=yn(k),C=At(),M=$e(),F=Q.useMemo(()=>Qe.getInitialReferenceValue({value:L,utils:M,props:n,timezone:k,referenceDate:s,granularity:St.year}),[]),R=n,O=lm(R),B=Q.useMemo(()=>M.getYear(x),[M,x]),N=Q.useMemo(()=>L!=null?M.getYear(L):null,[L,M]),[j,V]=Q.useState(()=>N||M.getYear(F)),[W,H]=pn({name:"YearCalendar",state:"hasFocus",controlled:b,default:f??!1}),U=ve(pe=>{H(pe),E&&E(pe)}),X=Q.useCallback(pe=>{if(a&&M.isBeforeYear(pe,x)||r&&M.isAfterYear(pe,x)||d&&M.isBeforeYear(pe,d)||l&&M.isAfterYear(pe,l))return!0;if(!g)return!1;const fe=M.startOfYear(pe);return g(fe)},[r,a,l,d,x,g,M]),Y=ve((pe,fe)=>{if(m)return;const ge=M.setYear(L??F,fe);T(ge)}),Z=ve(pe=>{X(M.setYear(L??F,pe))||(V(pe),U(!0),v==null||v(pe))});Q.useEffect(()=>{V(pe=>N!==null&&pe!==N?N:pe)},[N]);const ne=S!=="desc"?w*1:w*-1,re=C&&S==="asc"||!C&&S==="desc"?-1:1,le=ve((pe,fe)=>{switch(pe.key){case"ArrowUp":Z(fe-ne),pe.preventDefault();break;case"ArrowDown":Z(fe+ne),pe.preventDefault();break;case"ArrowLeft":Z(fe-re),pe.preventDefault();break;case"ArrowRight":Z(fe+re),pe.preventDefault();break}}),ie=ve((pe,fe)=>{Z(fe)}),de=ve((pe,fe)=>{j===fe&&U(!1)}),he=Q.useRef(null),ae=rt(t,he);Q.useEffect(()=>{if(f||he.current===null)return;const pe=he.current.querySelector('[tabindex="0"]');if(!pe)return;const fe=pe.offsetHeight,ge=pe.offsetTop,xe=he.current.clientHeight,We=he.current.scrollTop,it=ge+fe;fe>xe||ge<We||(he.current.scrollTop=it-xe/2-fe/2)},[f]);const ce=M.getYearRange([d,l]);return S==="desc"&&ce.reverse(),ee.jsx(um,J({ref:ae,className:Oe(O.root,i),ownerState:R,role:"radiogroup","aria-labelledby":D},_,{children:ce.map(pe=>{const fe=M.getYear(pe),ge=fe===N,xe=u||X(pe);return ee.jsx(sm,{selected:ge,value:fe,onClick:Y,onKeyDown:le,autoFocus:W&&fe===j,disabled:xe,tabIndex:fe===j&&!xe?0:-1,onFocus:ie,onBlur:de,"aria-current":B===fe?"date":void 0,yearsPerRow:w,slots:$,slotProps:A,children:M.format(pe,"year")},M.format(pe,"year"))})}))}),dm=h=>Fe("MuiPickersCalendarHeader",h),pm=Re("MuiPickersCalendarHeader",["root","labelContainer","label","switchViewButton","switchViewIcon"]),fm=["slots","slotProps","currentMonth","disabled","disableFuture","disablePast","maxDate","minDate","onMonthChange","onViewChange","view","reduceAnimations","views","labelId","className","timezone","format"],mm=["ownerState"],gm=h=>{const{classes:e}=h;return Me({root:["root"],labelContainer:["labelContainer"],label:["label"],switchViewButton:["switchViewButton"],switchViewIcon:["switchViewIcon"]},dm,e)},vm=me("div",{name:"MuiPickersCalendarHeader",slot:"Root",overridesResolver:(h,e)=>e.root})({display:"flex",alignItems:"center",marginTop:12,marginBottom:4,paddingLeft:24,paddingRight:12,maxHeight:40,minHeight:40}),ym=me("div",{name:"MuiPickersCalendarHeader",slot:"LabelContainer",overridesResolver:(h,e)=>e.labelContainer})(({theme:h})=>J({display:"flex",overflow:"hidden",alignItems:"center",cursor:"pointer",marginRight:"auto"},h.typography.body1,{fontWeight:h.typography.fontWeightMedium})),bm=me("div",{name:"MuiPickersCalendarHeader",slot:"Label",overridesResolver:(h,e)=>e.label})({marginRight:6}),wm=me(Nn,{name:"MuiPickersCalendarHeader",slot:"SwitchViewButton",overridesResolver:(h,e)=>e.switchViewButton})({marginRight:"auto",variants:[{props:{view:"year"},style:{[`.${pm.switchViewIcon}`]:{transform:"rotate(180deg)"}}}]}),Cm=me(vu,{name:"MuiPickersCalendarHeader",slot:"SwitchViewIcon",overridesResolver:(h,e)=>e.switchViewIcon})(({theme:h})=>({willChange:"transform",transition:h.transitions.create("transform"),transform:"rotate(0deg)"})),xm=Q.forwardRef(function(e,t){const n=et(),f=$e(),i=Te({props:e,name:"MuiPickersCalendarHeader"}),{slots:o,slotProps:p,currentMonth:s,disabled:u,disableFuture:r,disablePast:a,maxDate:l,minDate:d,onMonthChange:c,onViewChange:m,view:g,reduceAnimations:v,views:b,labelId:E,className:S,timezone:w,format:y=`${f.formats.month} ${f.formats.year}`}=i,D=we(i,fm),$=i,A=gm(i),_=(o==null?void 0:o.switchViewButton)??wm,L=Ie({elementType:_,externalSlotProps:p==null?void 0:p.switchViewButton,additionalProps:{size:"small","aria-label":n.calendarViewSwitchingButtonAriaLabel(g)},ownerState:$,className:A.switchViewButton}),T=(o==null?void 0:o.switchViewIcon)??Cm,k=Ie({elementType:T,externalSlotProps:p==null?void 0:p.switchViewIcon,ownerState:$,className:A.switchViewIcon}),x=we(k,mm),C=()=>c(f.addMonths(s,1),"left"),M=()=>c(f.addMonths(s,-1),"right"),F=Lu(s,{disableFuture:r,maxDate:l,timezone:w}),R=Fu(s,{disablePast:a,minDate:d,timezone:w}),O=()=>{if(!(b.length===1||!m||u))if(b.length===2)m(b.find(N=>N!==g)||b[0]);else{const N=b.indexOf(g)!==0?0:1;m(b[N])}};if(b.length===1&&b[0]==="year")return null;const B=f.formatByString(s,y);return ee.jsxs(vm,J({},D,{ownerState:$,className:Oe(A.root,S),ref:t,children:[ee.jsxs(ym,{role:"presentation",onClick:O,ownerState:$,"aria-live":"polite",className:A.labelContainer,children:[ee.jsx(Aa,{reduceAnimations:v,transKey:B,children:ee.jsx(bm,{id:E,ownerState:$,className:A.label,children:B})}),b.length>1&&!u&&ee.jsx(_,J({},L,{children:ee.jsx(T,J({},x))}))]}),ee.jsx(Yi,{in:g==="day",appear:!v,enter:!v,children:ee.jsx(No,{slots:o,slotProps:p,onGoToPrevious:M,isPreviousDisabled:R,previousLabel:n.previousMonth,onGoToNext:C,isNextDisabled:F,nextLabel:n.nextMonth})})]}))}),Sm="@media (prefers-reduced-motion: reduce)",Ln=typeof navigator<"u"&&navigator.userAgent.match(/android\s(\d+)|OS\s(\d+)/i),Qs=Ln&&Ln[1]?parseInt(Ln[1],10):null,Xs=Ln&&Ln[2]?parseInt(Ln[2],10):null,Dm=Qs&&Qs<10||Xs&&Xs<13||!1,ka=()=>Gr(Sm,{defaultMatches:!1})||Dm,Em=h=>Fe("MuiDateCalendar",h);Re("MuiDateCalendar",["root","viewTransitionContainer"]);const Am=["autoFocus","onViewChange","value","defaultValue","referenceDate","disableFuture","disablePast","onChange","onYearChange","onMonthChange","reduceAnimations","shouldDisableDate","shouldDisableMonth","shouldDisableYear","view","views","openTo","className","disabled","readOnly","minDate","maxDate","disableHighlightToday","focusedView","onFocusedViewChange","showDaysOutsideCurrentMonth","fixedWeekNumber","dayOfWeekFormatter","slots","slotProps","loading","renderLoading","displayWeekNumber","yearsOrder","yearsPerRow","monthsPerRow","timezone"],Tm=h=>{const{classes:e}=h;return Me({root:["root"],viewTransitionContainer:["viewTransitionContainer"]},Em,e)};function km(h,e){const t=$e(),n=di(),f=ka(),i=Te({props:h,name:e});return J({},i,{loading:i.loading??!1,disablePast:i.disablePast??!1,disableFuture:i.disableFuture??!1,openTo:i.openTo??"day",views:i.views??["year","day"],reduceAnimations:i.reduceAnimations??f,renderLoading:i.renderLoading??(()=>ee.jsx("span",{children:"..."})),minDate:vt(t,i.minDate,n.minDate),maxDate:vt(t,i.maxDate,n.maxDate)})}const $m=me(er,{name:"MuiDateCalendar",slot:"Root",overridesResolver:(h,e)=>e.root})({display:"flex",flexDirection:"column",height:Zr}),Mm=me(Aa,{name:"MuiDateCalendar",slot:"ViewTransitionContainer",overridesResolver:(h,e)=>e.viewTransitionContainer})({}),_m=Q.forwardRef(function(e,t){const n=$e(),f=Pn(),i=km(e,"MuiDateCalendar"),{autoFocus:o,onViewChange:p,value:s,defaultValue:u,referenceDate:r,disableFuture:a,disablePast:l,onChange:d,onYearChange:c,onMonthChange:m,reduceAnimations:g,shouldDisableDate:v,shouldDisableMonth:b,shouldDisableYear:E,view:S,views:w,openTo:y,className:D,disabled:$,readOnly:A,minDate:_,maxDate:L,disableHighlightToday:T,focusedView:k,onFocusedViewChange:x,showDaysOutsideCurrentMonth:C,fixedWeekNumber:M,dayOfWeekFormatter:F,slots:R,slotProps:O,loading:B,renderLoading:N,displayWeekNumber:j,yearsOrder:V,yearsPerRow:W,monthsPerRow:H,timezone:U}=i,X=we(i,Am),{value:Y,handleValueChange:Z,timezone:ne}=Bn({name:"DateCalendar",timezone:U,value:s,defaultValue:u,referenceDate:r,onChange:d,valueManager:Qe}),{view:re,setView:le,focusedView:ie,setFocusedView:de,goToNextView:he,setValueAndGoToNextView:ae}=fi({view:S,views:w,openTo:y,onChange:Z,onViewChange:p,autoFocus:o,focusedView:k,onFocusedViewChange:x}),{referenceDate:ce,calendarState:pe,changeFocusedDay:fe,changeMonth:ge,handleChangeMonth:xe,isDateDisabled:We,onMonthSwitchingAnimationEnd:it}=yf({value:Y,referenceDate:r,reduceAnimations:g,onMonthChange:m,minDate:_,maxDate:L,shouldDisableDate:v,disablePast:l,disableFuture:a,timezone:ne}),_t=$&&Y||_,je=$&&Y||L,Ze=`${f}-grid-label`,st=ie!==null,Wt=(R==null?void 0:R.calendarHeader)??xm,yi=Ie({elementType:Wt,externalSlotProps:O==null?void 0:O.calendarHeader,additionalProps:{views:w,view:re,currentMonth:pe.currentMonth,onViewChange:le,onMonthChange:(_e,ot)=>xe({newMonth:_e,direction:ot}),minDate:_t,maxDate:je,disabled:$,disablePast:l,disableFuture:a,reduceAnimations:g,timezone:ne,labelId:Ze},ownerState:i}),ht=ve(_e=>{const ot=n.startOfMonth(_e),en=n.endOfMonth(_e),Tt=We(_e)?ni({utils:n,date:_e,minDate:n.isBefore(_,ot)?ot:_,maxDate:n.isAfter(L,en)?en:L,disablePast:l,disableFuture:a,isDateDisabled:We,timezone:ne}):_e;Tt?(ae(Tt,"finish"),m==null||m(ot)):(he(),ge(ot)),fe(Tt,!0)}),bi=ve(_e=>{const ot=n.startOfYear(_e),en=n.endOfYear(_e),Tt=We(_e)?ni({utils:n,date:_e,minDate:n.isBefore(_,ot)?ot:_,maxDate:n.isAfter(L,en)?en:L,disablePast:l,disableFuture:a,isDateDisabled:We,timezone:ne}):_e;Tt?(ae(Tt,"finish"),c==null||c(Tt)):(he(),ge(ot)),fe(Tt,!0)}),wi=ve(_e=>Z(_e&&Wi(n,_e,Y??ce),"finish",re));Q.useEffect(()=>{Y!=null&&n.isValid(Y)&&ge(Y)},[Y]);const Wn=i,jn=Tm(Wn),jt={disablePast:l,disableFuture:a,maxDate:L,minDate:_},Cn={disableHighlightToday:T,readOnly:A,disabled:$,timezone:ne,gridLabelId:Ze,slots:R,slotProps:O},xn=Q.useRef(re);Q.useEffect(()=>{xn.current!==re&&(ie===xn.current&&de(re,!0),xn.current=re)},[ie,de,re]);const mr=Q.useMemo(()=>[Y],[Y]);return ee.jsxs($m,J({ref:t,className:Oe(jn.root,D),ownerState:Wn},X,{children:[ee.jsx(Wt,J({},yi,{slots:R,slotProps:O})),ee.jsx(Mm,{reduceAnimations:g,className:jn.viewTransitionContainer,transKey:re,ownerState:Wn,children:ee.jsxs("div",{children:[re==="year"&&ee.jsx(hm,J({},jt,Cn,{value:Y,onChange:bi,shouldDisableYear:E,hasFocus:st,onFocusedViewChange:_e=>de("year",_e),yearsOrder:V,yearsPerRow:W,referenceDate:ce})),re==="month"&&ee.jsx(qf,J({},jt,Cn,{hasFocus:st,className:D,value:Y,onChange:ht,shouldDisableMonth:b,onFocusedViewChange:_e=>de("month",_e),monthsPerRow:H,referenceDate:ce})),re==="day"&&ee.jsx(Wf,J({},pe,jt,Cn,{onMonthSwitchingAnimationEnd:it,onFocusedDayChange:fe,reduceAnimations:g,selectedDays:mr,onSelectedDaysChange:wi,shouldDisableDate:v,shouldDisableMonth:b,shouldDisableYear:E,hasFocus:st,onFocusedViewChange:_e=>de("day",_e),showDaysOutsideCurrentMonth:C,fixedWeekNumber:M,dayOfWeekFormatter:F,displayWeekNumber:j,loading:B,renderLoading:N}))]})})]}))});function $a(h){return Fe("MuiPickersToolbar",h)}Re("MuiPickersToolbar",["root","content"]);const Im=["children","className","toolbarTitle","hidden","titleId","isLandscape","classes","landscapeDirection"],Lm=h=>{const{classes:e}=h;return Me({root:["root"],content:["content"]},$a,e)},Fm=me("div",{name:"MuiPickersToolbar",slot:"Root",overridesResolver:(h,e)=>e.root})(({theme:h})=>({display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"space-between",padding:h.spacing(2,3),variants:[{props:{isLandscape:!0},style:{height:"auto",maxWidth:160,padding:16,justifyContent:"flex-start",flexWrap:"wrap"}}]})),Rm=me("div",{name:"MuiPickersToolbar",slot:"Content",overridesResolver:(h,e)=>e.content})({display:"flex",flexWrap:"wrap",width:"100%",flex:1,justifyContent:"space-between",alignItems:"center",flexDirection:"row",variants:[{props:{isLandscape:!0},style:{justifyContent:"flex-start",alignItems:"flex-start",flexDirection:"column"}},{props:{isLandscape:!0,landscapeDirection:"row"},style:{flexDirection:"row"}}]}),Ma=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiPickersToolbar"}),{children:f,className:i,toolbarTitle:o,hidden:p,titleId:s}=n,u=we(n,Im),r=n,a=Lm(r);return p?null:ee.jsxs(Fm,J({ref:t,className:Oe(a.root,i),ownerState:r},u,{children:[ee.jsx(Zt,{color:"text.secondary",variant:"overline",id:s,children:o}),ee.jsx(Rm,{className:a.content,ownerState:r,children:f})]}))});function Om(h){return Fe("MuiDatePickerToolbar",h)}Re("MuiDatePickerToolbar",["root","title"]);const Pm=["value","isLandscape","onChange","toolbarFormat","toolbarPlaceholder","views","className","onViewChange","view"],Nm=h=>{const{classes:e}=h;return Me({root:["root"],title:["title"]},Om,e)},Bm=me(Ma,{name:"MuiDatePickerToolbar",slot:"Root",overridesResolver:(h,e)=>e.root})({}),Vm=me(Zt,{name:"MuiDatePickerToolbar",slot:"Title",overridesResolver:(h,e)=>e.title})({variants:[{props:{isLandscape:!0},style:{margin:"auto 16px auto auto"}}]}),Wm=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiDatePickerToolbar"}),{value:f,isLandscape:i,toolbarFormat:o,toolbarPlaceholder:p="––",views:s,className:u}=n,r=we(n,Pm),a=$e(),l=et(),d=Nm(n),c=Q.useMemo(()=>{if(!f)return p;const g=ts(a,{format:o,views:s},!0);return a.formatByString(f,g)},[f,o,p,a,s]),m=n;return ee.jsx(Bm,J({ref:t,toolbarTitle:l.datePickerToolbarTitle,isLandscape:i,className:Oe(d.root,u)},r,{children:ee.jsx(Vm,{variant:"h4",align:i?"left":"center",ownerState:m,className:d.title,children:c})}))});function _a(h,e){const t=$e(),n=di(),f=Te({props:h,name:e}),i=Q.useMemo(()=>{var o;return((o=f.localeText)==null?void 0:o.toolbarTitle)==null?f.localeText:J({},f.localeText,{datePickerToolbarTitle:f.localeText.toolbarTitle})},[f.localeText]);return J({},f,{localeText:i},Bo({views:f.views,openTo:f.openTo,defaultViews:["year","day"],defaultOpenTo:"day"}),{disableFuture:f.disableFuture??!1,disablePast:f.disablePast??!1,minDate:vt(t,f.minDate,n.minDate),maxDate:vt(t,f.maxDate,n.maxDate),slots:J({toolbar:Wm},f.slots)})}function jm(h){return Fe("MuiPickersPopper",h)}Re("MuiPickersPopper",["root","paper"]);const Hm=["PaperComponent","popperPlacement","ownerState","children","paperSlotProps","paperClasses","onPaperClick","onPaperTouchStart"],zm=h=>{const{classes:e}=h;return Me({root:["root"],paper:["paper"]},jm,e)},Um=me(Sc,{name:"MuiPickersPopper",slot:"Root",overridesResolver:(h,e)=>e.root})(({theme:h})=>({zIndex:h.zIndex.modal})),Gm=me(oc,{name:"MuiPickersPopper",slot:"Paper",overridesResolver:(h,e)=>e.paper})({outline:0,transformOrigin:"top center",variants:[{props:({placement:h})=>["top","top-start","top-end"].includes(h),style:{transformOrigin:"bottom center"}}]});function Km(h,e){return e.documentElement.clientWidth<h.clientX||e.documentElement.clientHeight<h.clientY}function Ym(h,e){const t=Q.useRef(!1),n=Q.useRef(!1),f=Q.useRef(null),i=Q.useRef(!1);Q.useEffect(()=>{if(!h)return;function s(){i.current=!0}return document.addEventListener("mousedown",s,!0),document.addEventListener("touchstart",s,!0),()=>{document.removeEventListener("mousedown",s,!0),document.removeEventListener("touchstart",s,!0),i.current=!1}},[h]);const o=ve(s=>{if(!i.current)return;const u=n.current;n.current=!1;const r=xr(f.current);if(!f.current||"clientX"in s&&Km(s,r))return;if(t.current){t.current=!1;return}let a;s.composedPath?a=s.composedPath().indexOf(f.current)>-1:a=!r.documentElement.contains(s.target)||f.current.contains(s.target),!a&&!u&&e(s)}),p=()=>{n.current=!0};return Q.useEffect(()=>{if(h){const s=xr(f.current),u=()=>{t.current=!0};return s.addEventListener("touchstart",o),s.addEventListener("touchmove",u),()=>{s.removeEventListener("touchstart",o),s.removeEventListener("touchmove",u)}}},[h,o]),Q.useEffect(()=>{if(h){const s=xr(f.current);return s.addEventListener("click",o),()=>{s.removeEventListener("click",o),n.current=!1}}},[h,o]),[f,p,p]}const Jm=Q.forwardRef((h,e)=>{const{PaperComponent:t,popperPlacement:n,ownerState:f,children:i,paperSlotProps:o,paperClasses:p,onPaperClick:s,onPaperTouchStart:u}=h,r=we(h,Hm),a=J({},f,{placement:n}),l=Ie({elementType:t,externalSlotProps:o,additionalProps:{tabIndex:-1,elevation:8,ref:e},className:p,ownerState:a});return ee.jsx(t,J({},r,l,{onClick:d=>{var c;s(d),(c=l.onClick)==null||c.call(l,d)},onTouchStart:d=>{var c;u(d),(c=l.onTouchStart)==null||c.call(l,d)},ownerState:a,children:i}))});function Qm(h){const e=Te({props:h,name:"MuiPickersPopper"}),{anchorEl:t,children:n,containerRef:f=null,shouldRestoreFocus:i,onBlur:o,onDismiss:p,open:s,role:u,placement:r,slots:a,slotProps:l,reduceAnimations:d}=e;Q.useEffect(()=>{function C(M){s&&M.key==="Escape"&&p()}return document.addEventListener("keydown",C),()=>{document.removeEventListener("keydown",C)}},[p,s]);const c=Q.useRef(null);Q.useEffect(()=>{u==="tooltip"||i&&!i()||(s?c.current=tt(document):c.current&&c.current instanceof HTMLElement&&setTimeout(()=>{c.current instanceof HTMLElement&&c.current.focus()}))},[s,u,i]);const[m,g,v]=Ym(s,o??p),b=Q.useRef(null),E=rt(b,f),S=rt(E,m),w=e,y=zm(w),D=ka(),$=d??D,A=C=>{C.key==="Escape"&&(C.stopPropagation(),p())},_=(a==null?void 0:a.desktopTransition)??$?Yi:xc,L=(a==null?void 0:a.desktopTrapFocus)??sc,T=(a==null?void 0:a.desktopPaper)??Gm,k=(a==null?void 0:a.popper)??Um,x=Ie({elementType:k,externalSlotProps:l==null?void 0:l.popper,additionalProps:{transition:!0,role:u,open:s,anchorEl:t,placement:r,onKeyDown:A},className:y.root,ownerState:e});return ee.jsx(k,J({},x,{children:({TransitionProps:C,placement:M})=>ee.jsx(L,J({open:s,disableAutoFocus:!0,disableRestoreFocus:!0,disableEnforceFocus:u==="tooltip",isEnabled:()=>!0},l==null?void 0:l.desktopTrapFocus,{children:ee.jsx(_,J({},C,l==null?void 0:l.desktopTransition,{children:ee.jsx(Jm,{PaperComponent:T,ownerState:w,popperPlacement:M,ref:S,onPaperClick:g,onPaperTouchStart:v,paperClasses:y.paper,paperSlotProps:l==null?void 0:l.desktopPaper,children:n})}))}))}))}const Xm=({open:h,onOpen:e,onClose:t})=>{const n=Q.useRef(typeof h=="boolean").current,[f,i]=Q.useState(!1);Q.useEffect(()=>{if(n){if(typeof h!="boolean")throw new Error("You must not mix controlling and uncontrolled mode for `open` prop");i(h)}},[n,h]);const o=Q.useCallback(p=>{n||i(p),p&&e&&e(),!p&&t&&t()},[n,e,t]);return{isOpen:f,setIsOpen:o}},Zm=h=>{const{action:e,hasChanged:t,dateState:n,isControlled:f}=h,i=!f&&!n.hasBeenModifiedSinceMount;return e.name==="setValueFromField"?!0:e.name==="setValueFromAction"?i&&["accept","today","clear"].includes(e.pickerAction)?!0:t(n.lastPublishedValue):e.name==="setValueFromView"&&e.selectionState!=="shallow"||e.name==="setValueFromShortcut"?i?!0:t(n.lastPublishedValue):!1},qm=h=>{const{action:e,hasChanged:t,dateState:n,isControlled:f,closeOnSelect:i}=h,o=!f&&!n.hasBeenModifiedSinceMount;return e.name==="setValueFromAction"?o&&["accept","today","clear"].includes(e.pickerAction)?!0:t(n.lastCommittedValue):e.name==="setValueFromView"&&e.selectionState==="finish"&&i?o?!0:t(n.lastCommittedValue):e.name==="setValueFromShortcut"?e.changeImportance==="accept"&&t(n.lastCommittedValue):!1},eg=h=>{const{action:e,closeOnSelect:t}=h;return e.name==="setValueFromAction"?!0:e.name==="setValueFromView"?e.selectionState==="finish"&&t:e.name==="setValueFromShortcut"?e.changeImportance==="accept":!1},tg=({props:h,valueManager:e,valueType:t,wrapperVariant:n,validator:f})=>{const{onAccept:i,onChange:o,value:p,defaultValue:s,closeOnSelect:u=n==="desktop",timezone:r,referenceDate:a}=h,{current:l}=Q.useRef(s),{current:d}=Q.useRef(p!==void 0),[c,m]=Q.useState(r),g=$e(),v=vn(),{isOpen:b,setIsOpen:E}=Xm(h),{timezone:S,value:w,handleValueChange:y}=ns({timezone:r,value:p,defaultValue:l,referenceDate:a,onChange:o,valueManager:e}),[D,$]=Q.useState(()=>{let Z;return w!==void 0?Z=w:l!==void 0?Z=l:Z=e.emptyValue,{draft:Z,lastPublishedValue:Z,lastCommittedValue:Z,lastControlledValue:p,hasBeenModifiedSinceMount:!1}}),A=e.getTimezone(g,D.draft);c!==r&&(m(r),r&&A&&r!==A&&$(Z=>J({},Z,{draft:e.setTimezone(g,r,Z.draft)})));const{getValidationErrorForNewValue:_}=ia({props:h,validator:f,timezone:S,value:D.draft,onError:h.onError}),L=ve(Z=>{const ne={action:Z,dateState:D,hasChanged:ae=>!e.areValuesEqual(g,Z.value,ae),isControlled:d,closeOnSelect:u},re=Zm(ne),le=qm(ne),ie=eg(ne);$(ae=>J({},ae,{draft:Z.value,lastPublishedValue:re?Z.value:ae.lastPublishedValue,lastCommittedValue:le?Z.value:ae.lastCommittedValue,hasBeenModifiedSinceMount:!0}));let de=null;const he=()=>(de||(de={validationError:Z.name==="setValueFromField"?Z.context.validationError:_(Z.value)},Z.name==="setValueFromShortcut"&&(de.shortcut=Z.shortcut)),de);re&&y(Z.value,he()),le&&i&&i(Z.value,he()),ie&&E(!1)});if(D.lastControlledValue!==p){const Z=e.areValuesEqual(g,D.draft,w);$(ne=>J({},ne,{lastControlledValue:p},Z?{}:{lastCommittedValue:w,lastPublishedValue:w,draft:w,hasBeenModifiedSinceMount:!0}))}const T=ve(()=>{L({value:e.emptyValue,name:"setValueFromAction",pickerAction:"clear"})}),k=ve(()=>{L({value:D.lastPublishedValue,name:"setValueFromAction",pickerAction:"accept"})}),x=ve(()=>{L({value:D.lastPublishedValue,name:"setValueFromAction",pickerAction:"dismiss"})}),C=ve(()=>{L({value:D.lastCommittedValue,name:"setValueFromAction",pickerAction:"cancel"})}),M=ve(()=>{L({value:e.getTodayValue(g,S,t),name:"setValueFromAction",pickerAction:"today"})}),F=ve(Z=>{Z.preventDefault(),E(!0)}),R=ve(Z=>{Z==null||Z.preventDefault(),E(!1)}),O=ve((Z,ne="partial")=>L({name:"setValueFromView",value:Z,selectionState:ne})),B=ve((Z,ne,re)=>L({name:"setValueFromShortcut",value:Z,changeImportance:ne,shortcut:re})),N=ve((Z,ne)=>L({name:"setValueFromField",value:Z,context:ne})),j={onClear:T,onAccept:k,onDismiss:x,onCancel:C,onSetToday:M,onOpen:F,onClose:R},V={value:D.draft,onChange:N},W=Q.useMemo(()=>e.cleanValue(g,D.draft),[g,e,D.draft]),H={value:W,onChange:O,onClose:R,open:b},X=J({},j,{value:W,onChange:O,onSelectShortcut:B,isValid:Z=>{const ne=f({adapter:v,value:Z,timezone:S,props:h});return!e.hasError(ne)}}),Y=Q.useMemo(()=>({onOpen:F,onClose:R,open:b}),[b,R,F]);return{open:b,fieldProps:V,viewProps:H,layoutProps:X,actions:j,contextValue:Y}},ng=["className","sx"],ig=({props:h,propsFromPickerValue:e,additionalViewProps:t,autoFocusView:n,rendererInterceptor:f,fieldRef:i})=>{const{onChange:o,open:p,onClose:s}=e,{view:u,views:r,openTo:a,onViewChange:l,viewRenderers:d,timezone:c}=h,m=we(h,ng),{view:g,setView:v,defaultView:b,focusedView:E,setFocusedView:S,setValueAndGoToNextView:w}=fi({view:u,views:r,openTo:a,onChange:o,onViewChange:l,autoFocus:n}),{hasUIView:y,viewModeLookup:D}=Q.useMemo(()=>r.reduce((x,C)=>{let M;return d[C]!=null?M="UI":M="field",x.viewModeLookup[C]=M,M==="UI"&&(x.hasUIView=!0),x},{hasUIView:!1,viewModeLookup:{}}),[d,r]),$=Q.useMemo(()=>r.reduce((x,C)=>d[C]!=null&&oi(C)?x+1:x,0),[d,r]),A=D[g],_=ve(()=>A==="UI"),[L,T]=Q.useState(A==="UI"?g:null);return L!==g&&D[g]==="UI"&&T(g),Bt(()=>{A==="field"&&p&&(s(),setTimeout(()=>{var x,C;(x=i==null?void 0:i.current)==null||x.setSelectedSections(g),(C=i==null?void 0:i.current)==null||C.focusField(g)}))},[g]),Bt(()=>{if(!p)return;let x=g;A==="field"&&L!=null&&(x=L),x!==b&&D[x]==="UI"&&D[b]==="UI"&&(x=b),x!==g&&v(x),S(x,!0)},[p]),{hasUIView:y,shouldRestoreFocus:_,layoutProps:{views:r,view:L,onViewChange:v},renderCurrentView:()=>{if(L==null)return null;const x=d[L];if(x==null)return null;const C=J({},m,t,e,{views:r,timezone:c,onChange:w,view:L,onViewChange:v,focusedView:E,onFocusedViewChange:S,showViewSwitcher:$>1,timeViewsCount:$});return f?f(d,L,C):x(C)}}};function Zs(){return typeof window>"u"?"portrait":window.screen&&window.screen.orientation&&window.screen.orientation.angle?Math.abs(window.screen.orientation.angle)===90?"landscape":"portrait":window.orientation&&Math.abs(Number(window.orientation))===90?"landscape":"portrait"}const rg=(h,e)=>{const[t,n]=Q.useState(Zs);return Bt(()=>{const i=()=>{n(Zs())};return window.addEventListener("orientationchange",i),()=>{window.removeEventListener("orientationchange",i)}},[]),Tn(h,["hours","minutes","seconds"])?!1:(e||t)==="landscape"},sg=({props:h,propsFromPickerValue:e,propsFromPickerViews:t,wrapperVariant:n})=>{const{orientation:f}=h,i=rg(t.views,f),o=At();return{layoutProps:J({},t,e,{isLandscape:i,isRtl:o,wrapperVariant:n,disabled:h.disabled,readOnly:h.readOnly})}};function og(h){const{props:e,pickerValueResponse:t}=h;return Q.useMemo(()=>({value:t.viewProps.value,open:t.open,disabled:e.disabled??!1,readOnly:e.readOnly??!1}),[t.viewProps.value,t.open,e.disabled,e.readOnly])}const Ia=({props:h,valueManager:e,valueType:t,wrapperVariant:n,additionalViewProps:f,validator:i,autoFocusView:o,rendererInterceptor:p,fieldRef:s})=>{const u=tg({props:h,valueManager:e,valueType:t,wrapperVariant:n,validator:i}),r=ig({props:h,additionalViewProps:f,autoFocusView:o,fieldRef:s,propsFromPickerValue:u.viewProps,rendererInterceptor:p}),a=sg({props:h,wrapperVariant:n,propsFromPickerValue:u.layoutProps,propsFromPickerViews:r.layoutProps}),l=og({props:h,pickerValueResponse:u});return{open:u.open,actions:u.actions,fieldProps:u.fieldProps,renderCurrentView:r.renderCurrentView,hasUIView:r.hasUIView,shouldRestoreFocus:r.shouldRestoreFocus,layoutProps:a.layoutProps,contextValue:u.contextValue,ownerState:l}};function La(h){return Fe("MuiPickersLayout",h)}const un=Re("MuiPickersLayout",["root","landscape","contentWrapper","toolbar","actionBar","tabs","shortcuts"]),ag=["onAccept","onClear","onCancel","onSetToday","actions"];function lg(h){const{onAccept:e,onClear:t,onCancel:n,onSetToday:f,actions:i}=h,o=we(h,ag),p=et();if(i==null||i.length===0)return null;const s=i==null?void 0:i.map(u=>{switch(u){case"clear":return ee.jsx(qn,{onClick:t,children:p.clearButtonLabel},u);case"cancel":return ee.jsx(qn,{onClick:n,children:p.cancelButtonLabel},u);case"accept":return ee.jsx(qn,{onClick:e,children:p.okButtonLabel},u);case"today":return ee.jsx(qn,{onClick:f,children:p.todayButtonLabel},u);default:return null}});return ee.jsx(ac,J({},o,{children:s}))}const cg=["items","changeImportance","isLandscape","onChange","isValid"],ug=["getValue"];function hg(h){const{items:e,changeImportance:t="accept",onChange:n,isValid:f}=h,i=we(h,cg);if(e==null||e.length===0)return null;const o=e.map(p=>{let{getValue:s}=p,u=we(p,ug);const r=s({isValid:f});return J({},u,{label:u.label,onClick:()=>{n(r,t,u)},disabled:!f(r)})});return ee.jsx(lc,J({dense:!0,sx:[{maxHeight:Zr,maxWidth:200,overflow:"auto"},...Array.isArray(i.sx)?i.sx:[i.sx]]},i,{children:o.map(p=>ee.jsx(cc,{children:ee.jsx(uc,J({},p))},p.id??p.label))}))}function dg(h){return h.view!==null}const pg=h=>{const{classes:e,isLandscape:t}=h;return Me({root:["root",t&&"landscape"],contentWrapper:["contentWrapper"],toolbar:["toolbar"],actionBar:["actionBar"],tabs:["tabs"],landscape:["landscape"],shortcuts:["shortcuts"]},La,e)},fg=h=>{const{wrapperVariant:e,onAccept:t,onClear:n,onCancel:f,onSetToday:i,view:o,views:p,onViewChange:s,value:u,onChange:r,onSelectShortcut:a,isValid:l,isLandscape:d,disabled:c,readOnly:m,children:g,slots:v,slotProps:b}=h,E=pg(h),S=(v==null?void 0:v.actionBar)??lg,w=Ie({elementType:S,externalSlotProps:b==null?void 0:b.actionBar,additionalProps:{onAccept:t,onClear:n,onCancel:f,onSetToday:i,actions:e==="desktop"?[]:["cancel","accept"]},className:E.actionBar,ownerState:J({},h,{wrapperVariant:e})}),y=ee.jsx(S,J({},w)),D=v==null?void 0:v.toolbar,$=Ie({elementType:D,externalSlotProps:b==null?void 0:b.toolbar,additionalProps:{isLandscape:d,onChange:r,value:u,view:o,onViewChange:s,views:p,disabled:c,readOnly:m},className:E.toolbar,ownerState:J({},h,{wrapperVariant:e})}),A=dg($)&&D?ee.jsx(D,J({},$)):null,_=g,L=v==null?void 0:v.tabs,T=o&&L?ee.jsx(L,J({view:o,onViewChange:s,className:E.tabs},b==null?void 0:b.tabs)):null,k=(v==null?void 0:v.shortcuts)??hg,x=Ie({elementType:k,externalSlotProps:b==null?void 0:b.shortcuts,additionalProps:{isValid:l,isLandscape:d,onChange:a},className:E.shortcuts,ownerState:{isValid:l,isLandscape:d,onChange:a,wrapperVariant:e}}),C=o&&k?ee.jsx(k,J({},x)):null;return{toolbar:A,content:_,tabs:T,actionBar:y,shortcuts:C}},mg=h=>{const{isLandscape:e,classes:t}=h;return Me({root:["root",e&&"landscape"],contentWrapper:["contentWrapper"]},La,t)},gg=me("div",{name:"MuiPickersLayout",slot:"Root",overridesResolver:(h,e)=>e.root})({display:"grid",gridAutoColumns:"max-content auto max-content",gridAutoRows:"max-content auto max-content",[`& .${un.actionBar}`]:{gridColumn:"1 / 4",gridRow:3},variants:[{props:{isLandscape:!0},style:{[`& .${un.toolbar}`]:{gridColumn:1,gridRow:"2 / 3"},[`.${un.shortcuts}`]:{gridColumn:"2 / 4",gridRow:1}}},{props:{isLandscape:!0,isRtl:!0},style:{[`& .${un.toolbar}`]:{gridColumn:3}}},{props:{isLandscape:!1},style:{[`& .${un.toolbar}`]:{gridColumn:"2 / 4",gridRow:1},[`& .${un.shortcuts}`]:{gridColumn:1,gridRow:"2 / 3"}}},{props:{isLandscape:!1,isRtl:!0},style:{[`& .${un.shortcuts}`]:{gridColumn:3}}}]}),vg=me("div",{name:"MuiPickersLayout",slot:"ContentWrapper",overridesResolver:(h,e)=>e.contentWrapper})({gridColumn:2,gridRow:2,display:"flex",flexDirection:"column"}),Fa=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiPickersLayout"}),{toolbar:f,content:i,tabs:o,actionBar:p,shortcuts:s}=fg(n),{sx:u,className:r,isLandscape:a,wrapperVariant:l}=n,d=mg(n);return ee.jsxs(gg,{ref:t,sx:u,className:Oe(d.root,r),ownerState:n,children:[a?s:f,a?f:s,ee.jsx(vg,{className:d.contentWrapper,children:l==="desktop"?ee.jsxs(Q.Fragment,{children:[i,o]}):ee.jsxs(Q.Fragment,{children:[o,i]})}),p]})}),yg=["props","getOpenDialogAriaText"],bg=["ownerState"],wg=["ownerState"],Ra=h=>{var he;let{props:e,getOpenDialogAriaText:t}=h,n=we(h,yg);const{slots:f,slotProps:i,className:o,sx:p,format:s,formatDensity:u,enableAccessibleFieldDOMStructure:r,selectedSections:a,onSelectedSectionsChange:l,timezone:d,name:c,label:m,inputRef:g,readOnly:v,disabled:b,autoFocus:E,localeText:S,reduceAnimations:w}=e,y=Q.useRef(null),D=Q.useRef(null),$=Pn(),A=((he=i==null?void 0:i.toolbar)==null?void 0:he.hidden)??!1,{open:_,actions:L,hasUIView:T,layoutProps:k,renderCurrentView:x,shouldRestoreFocus:C,fieldProps:M,contextValue:F,ownerState:R}=Ia(J({},n,{props:e,fieldRef:D,autoFocusView:!0,additionalViewProps:{},wrapperVariant:"desktop"})),O=f.inputAdornment??ko,B=Ie({elementType:O,externalSlotProps:i==null?void 0:i.inputAdornment,additionalProps:{position:"end"},ownerState:e}),N=we(B,bg),j=f.openPickerButton??Nn,V=Ie({elementType:j,externalSlotProps:i==null?void 0:i.openPickerButton,additionalProps:{disabled:b||v,onClick:_?L.onClose:L.onOpen,"aria-label":t(M.value),edge:N.position},ownerState:e}),W=we(V,wg),H=f.openPickerIcon,U=Ie({elementType:H,externalSlotProps:i==null?void 0:i.openPickerIcon,ownerState:R}),X=f.field,Y=Ie({elementType:X,externalSlotProps:i==null?void 0:i.field,additionalProps:J({},M,A&&{id:$},{readOnly:v,disabled:b,className:o,sx:p,format:s,formatDensity:u,enableAccessibleFieldDOMStructure:r,selectedSections:a,onSelectedSectionsChange:l,timezone:d,label:m,name:c,autoFocus:E&&!e.open,focused:_?!0:void 0},g?{inputRef:g}:{}),ownerState:e});T&&(Y.InputProps=J({},Y.InputProps,{ref:y},!e.disableOpenPicker&&{[`${N.position}Adornment`]:ee.jsx(O,J({},N,{children:ee.jsx(j,J({},W,{children:ee.jsx(H,J({},U))}))}))}));const Z=J({textField:f.textField,clearIcon:f.clearIcon,clearButton:f.clearButton},Y.slots),ne=f.layout??Fa;let re=$;A&&(m?re=`${$}-label`:re=void 0);const le=J({},i,{toolbar:J({},i==null?void 0:i.toolbar,{titleId:$}),popper:J({"aria-labelledby":re},i==null?void 0:i.popper)}),ie=rt(D,Y.unstableFieldRef);return{renderPicker:()=>ee.jsxs(aa,{contextValue:F,localeText:S,children:[ee.jsx(X,J({},Y,{slots:Z,slotProps:le,unstableFieldRef:ie})),ee.jsx(Qm,J({role:"dialog",placement:"bottom-start",anchorEl:y.current},L,{open:_,slots:f,slotProps:le,shouldRestoreFocus:C,reduceAnimations:w,children:ee.jsx(ne,J({},k,le==null?void 0:le.layout,{slots:f,slotProps:le,children:x()}))}))]})}},Fn=({view:h,onViewChange:e,views:t,focusedView:n,onFocusedViewChange:f,value:i,defaultValue:o,referenceDate:p,onChange:s,className:u,classes:r,disableFuture:a,disablePast:l,minDate:d,maxDate:c,shouldDisableDate:m,shouldDisableMonth:g,shouldDisableYear:v,reduceAnimations:b,onMonthChange:E,monthsPerRow:S,onYearChange:w,yearsOrder:y,yearsPerRow:D,slots:$,slotProps:A,loading:_,renderLoading:L,disableHighlightToday:T,readOnly:k,disabled:x,showDaysOutsideCurrentMonth:C,dayOfWeekFormatter:M,sx:F,autoFocus:R,fixedWeekNumber:O,displayWeekNumber:B,timezone:N})=>ee.jsx(_m,{view:h,onViewChange:e,views:t.filter(Rs),focusedView:n&&Rs(n)?n:null,onFocusedViewChange:f,value:i,defaultValue:o,referenceDate:p,onChange:s,className:u,classes:r,disableFuture:a,disablePast:l,minDate:d,maxDate:c,shouldDisableDate:m,shouldDisableMonth:g,shouldDisableYear:v,reduceAnimations:b,onMonthChange:E,monthsPerRow:S,onYearChange:w,yearsOrder:y,yearsPerRow:D,slots:$,slotProps:A,loading:_,renderLoading:L,disableHighlightToday:T,readOnly:k,disabled:x,showDaysOutsideCurrentMonth:C,dayOfWeekFormatter:M,sx:F,autoFocus:R,fixedWeekNumber:O,displayWeekNumber:B,timezone:N}),Oa=Q.forwardRef(function(e,t){var u,r;const n=et(),f=$e(),i=_a(e,"MuiDesktopDatePicker"),o=J({day:Fn,month:Fn,year:Fn},i.viewRenderers),p=J({},i,{viewRenderers:o,format:ts(f,i,!1),yearsPerRow:i.yearsPerRow??4,slots:J({openPickerIcon:wu,field:Sa},i.slots),slotProps:J({},i.slotProps,{field:a=>{var l;return J({},Ji((l=i.slotProps)==null?void 0:l.field,a),ir(i),{ref:t})},toolbar:J({hidden:!0},(u=i.slotProps)==null?void 0:u.toolbar)})}),{renderPicker:s}=Ra({props:p,valueManager:Qe,valueType:"date",getOpenDialogAriaText:Xi({utils:f,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:(r=p.localeText)==null?void 0:r.openDatePickerDialogue}),validator:mi});return s()});Oa.propTypes={autoFocus:K.bool,className:K.string,closeOnSelect:K.bool,dayOfWeekFormatter:K.func,defaultValue:K.object,disabled:K.bool,disableFuture:K.bool,disableHighlightToday:K.bool,disableOpenPicker:K.bool,disablePast:K.bool,displayWeekNumber:K.bool,enableAccessibleFieldDOMStructure:K.any,fixedWeekNumber:K.number,format:K.string,formatDensity:K.oneOf(["dense","spacious"]),inputRef:Qi,label:K.node,loading:K.bool,localeText:K.object,maxDate:K.object,minDate:K.object,monthsPerRow:K.oneOf([3,4]),name:K.string,onAccept:K.func,onChange:K.func,onClose:K.func,onError:K.func,onMonthChange:K.func,onOpen:K.func,onSelectedSectionsChange:K.func,onViewChange:K.func,onYearChange:K.func,open:K.bool,openTo:K.oneOf(["day","month","year"]),orientation:K.oneOf(["landscape","portrait"]),readOnly:K.bool,reduceAnimations:K.bool,referenceDate:K.object,renderLoading:K.func,selectedSections:K.oneOfType([K.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),K.number]),shouldDisableDate:K.func,shouldDisableMonth:K.func,shouldDisableYear:K.func,showDaysOutsideCurrentMonth:K.bool,slotProps:K.object,slots:K.object,sx:K.oneOfType([K.arrayOf(K.oneOfType([K.func,K.object,K.bool])),K.func,K.object]),timezone:K.string,value:K.object,view:K.oneOf(["day","month","year"]),viewRenderers:K.shape({day:K.func,month:K.func,year:K.func}),views:K.arrayOf(K.oneOf(["day","month","year"]).isRequired),yearsOrder:K.oneOf(["asc","desc"]),yearsPerRow:K.oneOf([3,4])};const Cg=me(hc)({[`& .${As.container}`]:{outline:0},[`& .${As.paper}`]:{outline:0,minWidth:qi}}),xg=me(dc)({"&:first-of-type":{padding:0}});function Sg(h){const{children:e,onDismiss:t,open:n,slots:f,slotProps:i}=h,o=(f==null?void 0:f.dialog)??Cg,p=(f==null?void 0:f.mobileTransition)??Yi;return ee.jsx(o,J({open:n,onClose:t},i==null?void 0:i.dialog,{TransitionComponent:p,TransitionProps:i==null?void 0:i.mobileTransition,PaperComponent:f==null?void 0:f.mobilePaper,PaperProps:i==null?void 0:i.mobilePaper,children:ee.jsx(xg,{children:e})}))}const Dg=["props","getOpenDialogAriaText"],Pa=h=>{var N;let{props:e,getOpenDialogAriaText:t}=h,n=we(h,Dg);const{slots:f,slotProps:i,className:o,sx:p,format:s,formatDensity:u,enableAccessibleFieldDOMStructure:r,selectedSections:a,onSelectedSectionsChange:l,timezone:d,name:c,label:m,inputRef:g,readOnly:v,disabled:b,localeText:E}=e,S=Q.useRef(null),w=Pn(),y=((N=i==null?void 0:i.toolbar)==null?void 0:N.hidden)??!1,{open:D,actions:$,layoutProps:A,renderCurrentView:_,fieldProps:L,contextValue:T}=Ia(J({},n,{props:e,fieldRef:S,autoFocusView:!0,additionalViewProps:{},wrapperVariant:"mobile"})),k=f.field,x=Ie({elementType:k,externalSlotProps:i==null?void 0:i.field,additionalProps:J({},L,y&&{id:w},!(b||v)&&{onClick:$.onOpen,onKeyDown:Nh($.onOpen)},{readOnly:v??!0,disabled:b,className:o,sx:p,format:s,formatDensity:u,enableAccessibleFieldDOMStructure:r,selectedSections:a,onSelectedSectionsChange:l,timezone:d,label:m,name:c},g?{inputRef:g}:{}),ownerState:e});x.inputProps=J({},x.inputProps,{"aria-label":t(L.value)});const C=J({textField:f.textField},x.slots),M=f.layout??Fa;let F=w;y&&(m?F=`${w}-label`:F=void 0);const R=J({},i,{toolbar:J({},i==null?void 0:i.toolbar,{titleId:w}),mobilePaper:J({"aria-labelledby":F},i==null?void 0:i.mobilePaper)}),O=rt(S,x.unstableFieldRef);return{renderPicker:()=>ee.jsxs(aa,{contextValue:T,localeText:E,children:[ee.jsx(k,J({},x,{slots:C,slotProps:R,unstableFieldRef:O})),ee.jsx(Sg,J({},$,{open:D,slots:f,slotProps:R,children:ee.jsx(M,J({},A,R==null?void 0:R.layout,{slots:f,slotProps:R,children:_()}))}))]})}},Na=Q.forwardRef(function(e,t){var u,r;const n=et(),f=$e(),i=_a(e,"MuiMobileDatePicker"),o=J({day:Fn,month:Fn,year:Fn},i.viewRenderers),p=J({},i,{viewRenderers:o,format:ts(f,i,!1),slots:J({field:Sa},i.slots),slotProps:J({},i.slotProps,{field:a=>{var l;return J({},Ji((l=i.slotProps)==null?void 0:l.field,a),ir(i),{ref:t})},toolbar:J({hidden:!1},(u=i.slotProps)==null?void 0:u.toolbar)})}),{renderPicker:s}=Pa({props:p,valueManager:Qe,valueType:"date",getOpenDialogAriaText:Xi({utils:f,formatKey:"fullDate",contextTranslation:n.openDatePickerDialogue,propsTranslation:(r=p.localeText)==null?void 0:r.openDatePickerDialogue}),validator:mi});return s()});Na.propTypes={autoFocus:K.bool,className:K.string,closeOnSelect:K.bool,dayOfWeekFormatter:K.func,defaultValue:K.object,disabled:K.bool,disableFuture:K.bool,disableHighlightToday:K.bool,disableOpenPicker:K.bool,disablePast:K.bool,displayWeekNumber:K.bool,enableAccessibleFieldDOMStructure:K.any,fixedWeekNumber:K.number,format:K.string,formatDensity:K.oneOf(["dense","spacious"]),inputRef:Qi,label:K.node,loading:K.bool,localeText:K.object,maxDate:K.object,minDate:K.object,monthsPerRow:K.oneOf([3,4]),name:K.string,onAccept:K.func,onChange:K.func,onClose:K.func,onError:K.func,onMonthChange:K.func,onOpen:K.func,onSelectedSectionsChange:K.func,onViewChange:K.func,onYearChange:K.func,open:K.bool,openTo:K.oneOf(["day","month","year"]),orientation:K.oneOf(["landscape","portrait"]),readOnly:K.bool,reduceAnimations:K.bool,referenceDate:K.object,renderLoading:K.func,selectedSections:K.oneOfType([K.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),K.number]),shouldDisableDate:K.func,shouldDisableMonth:K.func,shouldDisableYear:K.func,showDaysOutsideCurrentMonth:K.bool,slotProps:K.object,slots:K.object,sx:K.oneOfType([K.arrayOf(K.oneOfType([K.func,K.object,K.bool])),K.func,K.object]),timezone:K.string,value:K.object,view:K.oneOf(["day","month","year"]),viewRenderers:K.shape({day:K.func,month:K.func,year:K.func}),views:K.arrayOf(K.oneOf(["day","month","year"]).isRequired),yearsOrder:K.oneOf(["asc","desc"]),yearsPerRow:K.oneOf([3,4])};const Eg=["desktopModeMediaQuery"],Ag=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiDatePicker"}),{desktopModeMediaQuery:f=qo}=n,i=we(n,Eg);return Gr(f,{defaultMatches:!0})?ee.jsx(Oa,J({ref:t},i)):ee.jsx(Na,J({ref:t},i))});function Tg(h){return Fe("MuiPickersToolbarText",h)}const qs=Re("MuiPickersToolbarText",["root","selected"]),kg=["className","selected","value"],$g=h=>{const{classes:e,selected:t}=h;return Me({root:["root",t&&"selected"]},Tg,e)},Mg=me(Zt,{name:"MuiPickersToolbarText",slot:"Root",overridesResolver:(h,e)=>[e.root,{[`&.${qs.selected}`]:e.selected}]})(({theme:h})=>({transition:h.transitions.create("color"),color:(h.vars||h).palette.text.secondary,[`&.${qs.selected}`]:{color:(h.vars||h).palette.text.primary}})),Ba=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiPickersToolbarText"}),{className:f,value:i}=n,o=we(n,kg),p=$g(n);return ee.jsx(Mg,J({ref:t,className:Oe(p.root,f),component:"span"},o,{children:i}))}),_g=["align","className","selected","typographyClassName","value","variant","width"],Ig=h=>{const{classes:e}=h;return Me({root:["root"]},$a,e)},Lg=me(qn,{name:"MuiPickersToolbarButton",slot:"Root",overridesResolver:(h,e)=>e.root})({padding:0,minWidth:16,textTransform:"none"}),Zn=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiPickersToolbarButton"}),{align:f,className:i,selected:o,typographyClassName:p,value:s,variant:u,width:r}=n,a=we(n,_g),l=Ig(n);return ee.jsx(Lg,J({variant:"text",ref:t,className:Oe(l.root,i)},r?{sx:{width:r}}:{},a,{children:ee.jsx(Ba,{align:f,className:p,variant:u,value:s,selected:o})}))});function Fg(h){return Fe("MuiTimePickerToolbar",h)}const ri=Re("MuiTimePickerToolbar",["root","separator","hourMinuteLabel","hourMinuteLabelLandscape","hourMinuteLabelReverse","ampmSelection","ampmLandscape","ampmLabel"]),Rg=["ampm","ampmInClock","value","isLandscape","onChange","view","onViewChange","views","disabled","readOnly","className"],Og=h=>{const{isLandscape:e,classes:t,isRtl:n}=h;return Me({root:["root"],separator:["separator"],hourMinuteLabel:["hourMinuteLabel",e&&"hourMinuteLabelLandscape",n&&"hourMinuteLabelReverse"],ampmSelection:["ampmSelection",e&&"ampmLandscape"],ampmLabel:["ampmLabel"]},Fg,t)},Pg=me(Ma,{name:"MuiTimePickerToolbar",slot:"Root",overridesResolver:(h,e)=>e.root})({}),Ng=me(Ba,{name:"MuiTimePickerToolbar",slot:"Separator",overridesResolver:(h,e)=>e.separator})({outline:0,margin:"0 4px 0 2px",cursor:"default"}),Bg=me("div",{name:"MuiTimePickerToolbar",slot:"HourMinuteLabel",overridesResolver:(h,e)=>[{[`&.${ri.hourMinuteLabelLandscape}`]:e.hourMinuteLabelLandscape,[`&.${ri.hourMinuteLabelReverse}`]:e.hourMinuteLabelReverse},e.hourMinuteLabel]})({display:"flex",justifyContent:"flex-end",alignItems:"flex-end",variants:[{props:{isRtl:!0},style:{flexDirection:"row-reverse"}},{props:{isLandscape:!0},style:{marginTop:"auto"}}]}),Vg=me("div",{name:"MuiTimePickerToolbar",slot:"AmPmSelection",overridesResolver:(h,e)=>[{[`.${ri.ampmLabel}`]:e.ampmLabel},{[`&.${ri.ampmLandscape}`]:e.ampmLandscape},e.ampmSelection]})({display:"flex",flexDirection:"column",marginRight:"auto",marginLeft:12,[`& .${ri.ampmLabel}`]:{fontSize:17},variants:[{props:{isLandscape:!0},style:{margin:"4px 0 auto",flexDirection:"row",justifyContent:"space-around",flexBasis:"100%"}}]});function Wg(h){const e=Te({props:h,name:"MuiTimePickerToolbar"}),{ampm:t,ampmInClock:n,value:f,isLandscape:i,onChange:o,view:p,onViewChange:s,views:u,disabled:r,readOnly:a,className:l}=e,d=we(e,Rg),c=$e(),m=et(),g=At(),v=!!(t&&!n&&u.includes("hours")),{meridiemMode:b,handleMeridiemChange:E}=Xr(f,t,o),S=$=>t?c.format($,"hours12h"):c.format($,"hours24h"),w=J({},e,{isRtl:g}),y=Og(w),D=ee.jsx(Ng,{tabIndex:-1,value:":",variant:"h3",selected:!1,className:y.separator});return ee.jsxs(Pg,J({landscapeDirection:"row",toolbarTitle:m.timePickerToolbarTitle,isLandscape:i,ownerState:w,className:Oe(y.root,l)},d,{children:[ee.jsxs(Bg,{className:y.hourMinuteLabel,ownerState:w,children:[Tn(u,"hours")&&ee.jsx(Zn,{tabIndex:-1,variant:"h3",onClick:()=>s("hours"),selected:p==="hours",value:f?S(f):"--"}),Tn(u,["hours","minutes"])&&D,Tn(u,"minutes")&&ee.jsx(Zn,{tabIndex:-1,variant:"h3",onClick:()=>s("minutes"),selected:p==="minutes",value:f?c.format(f,"minutes"):"--"}),Tn(u,["minutes","seconds"])&&D,Tn(u,"seconds")&&ee.jsx(Zn,{variant:"h3",onClick:()=>s("seconds"),selected:p==="seconds",value:f?c.format(f,"seconds"):"--"})]}),v&&ee.jsxs(Vg,{className:y.ampmSelection,ownerState:w,children:[ee.jsx(Zn,{disableRipple:!0,variant:"subtitle2",selected:b==="am",typographyClassName:y.ampmLabel,value:Jt(c,"am"),onClick:a?void 0:()=>E("am"),disabled:r}),ee.jsx(Zn,{disableRipple:!0,variant:"subtitle2",selected:b==="pm",typographyClassName:y.ampmLabel,value:Jt(c,"pm"),onClick:a?void 0:()=>E("pm"),disabled:r})]})]}))}function Va(h,e){var o;const t=$e(),n=Te({props:h,name:e}),f=n.ampm??t.is12HourCycleInCurrentLocale(),i=Q.useMemo(()=>{var p;return((p=n.localeText)==null?void 0:p.toolbarTitle)==null?n.localeText:J({},n.localeText,{timePickerToolbarTitle:n.localeText.toolbarTitle})},[n.localeText]);return J({},n,{ampm:f,localeText:i},Bo({views:n.views,openTo:n.openTo,defaultViews:["hours","minutes"],defaultOpenTo:"hours"}),{disableFuture:n.disableFuture??!1,disablePast:n.disablePast??!1,slots:J({toolbar:Wg},n.slots),slotProps:J({},n.slotProps,{toolbar:J({ampm:f,ampmInClock:n.ampmInClock},(o=n.slotProps)==null?void 0:o.toolbar)})})}const $r=({view:h,onViewChange:e,focusedView:t,onFocusedViewChange:n,views:f,value:i,defaultValue:o,referenceDate:p,onChange:s,className:u,classes:r,disableFuture:a,disablePast:l,minTime:d,maxTime:c,shouldDisableTime:m,minutesStep:g,ampm:v,ampmInClock:b,slots:E,slotProps:S,readOnly:w,disabled:y,sx:D,autoFocus:$,showViewSwitcher:A,disableIgnoringDatePartForTimeValidation:_,timezone:L})=>ee.jsx(Oh,{view:h,onViewChange:e,focusedView:t&&oi(t)?t:null,onFocusedViewChange:n,views:f.filter(oi),value:i,defaultValue:o,referenceDate:p,onChange:s,className:u,classes:r,disableFuture:a,disablePast:l,minTime:d,maxTime:c,shouldDisableTime:m,minutesStep:g,ampm:v,ampmInClock:b,slots:E,slotProps:S,readOnly:w,disabled:y,sx:D,autoFocus:$,showViewSwitcher:A,disableIgnoringDatePartForTimeValidation:_,timezone:L}),jg=({view:h,onViewChange:e,focusedView:t,onFocusedViewChange:n,views:f,value:i,defaultValue:o,referenceDate:p,onChange:s,className:u,classes:r,disableFuture:a,disablePast:l,minTime:d,maxTime:c,shouldDisableTime:m,minutesStep:g,ampm:v,slots:b,slotProps:E,readOnly:S,disabled:w,sx:y,autoFocus:D,disableIgnoringDatePartForTimeValidation:$,timeSteps:A,skipDisabled:_,timezone:L})=>ee.jsx(zh,{view:h,onViewChange:e,focusedView:t,onFocusedViewChange:n,views:f.filter(oi),value:i,defaultValue:o,referenceDate:p,onChange:s,className:u,classes:r,disableFuture:a,disablePast:l,minTime:d,maxTime:c,shouldDisableTime:m,minutesStep:g,ampm:v,slots:b,slotProps:E,readOnly:S,disabled:w,sx:y,autoFocus:D,disableIgnoringDatePartForTimeValidation:$,timeStep:A==null?void 0:A.minutes,skipDisabled:_,timezone:L}),eo=({view:h,onViewChange:e,focusedView:t,onFocusedViewChange:n,views:f,value:i,defaultValue:o,referenceDate:p,onChange:s,className:u,classes:r,disableFuture:a,disablePast:l,minTime:d,maxTime:c,shouldDisableTime:m,minutesStep:g,ampm:v,slots:b,slotProps:E,readOnly:S,disabled:w,sx:y,autoFocus:D,disableIgnoringDatePartForTimeValidation:$,timeSteps:A,skipDisabled:_,timezone:L})=>ee.jsx(nd,{view:h,onViewChange:e,focusedView:t,onFocusedViewChange:n,views:f.filter(oi),value:i,defaultValue:o,referenceDate:p,onChange:s,className:u,classes:r,disableFuture:a,disablePast:l,minTime:d,maxTime:c,shouldDisableTime:m,minutesStep:g,ampm:v,slots:b,slotProps:E,readOnly:S,disabled:w,sx:y,autoFocus:D,disableIgnoringDatePartForTimeValidation:$,timeSteps:A,skipDisabled:_,timezone:L}),Hg=(h,e,t)=>t?e.filter(n=>!Mu(n)||n==="hours"):h?[...e,"meridiem"]:e,zg=(h,e)=>1440/((h.hours??1)*(h.minutes??5))<=e;function Ug({thresholdToRenderTimeInASingleColumn:h,ampm:e,timeSteps:t,views:n}){const f=h??24,i=J({hours:1,minutes:5,seconds:5},t),o=zg(i,f);return{thresholdToRenderTimeInASingleColumn:f,timeSteps:i,shouldRenderTimeInASingleColumn:o,views:Hg(e,n,o)}}const Wa=Q.forwardRef(function(e,t){var v,b,E,S;const n=et(),f=$e(),i=Va(e,"MuiDesktopTimePicker"),{shouldRenderTimeInASingleColumn:o,views:p,timeSteps:s}=Ug(i),u=o?jg:eo,r=J({hours:u,minutes:u,seconds:u,meridiem:u},i.viewRenderers),a=i.ampmInClock??!0,l=o?[]:["accept"],c=((v=r.hours)==null?void 0:v.name)===eo.name?p:p.filter(w=>w!=="meridiem"),m=J({},i,{ampmInClock:a,timeSteps:s,viewRenderers:r,format:Wo(f,i),views:o?["hours"]:c,slots:J({field:Da,openPickerIcon:Cu},i.slots),slotProps:J({},i.slotProps,{field:w=>{var y;return J({},Ji((y=i.slotProps)==null?void 0:y.field,w),ir(i),{ref:t})},toolbar:J({hidden:!0,ampmInClock:a},(b=i.slotProps)==null?void 0:b.toolbar),actionBar:J({actions:l},(E=i.slotProps)==null?void 0:E.actionBar)})}),{renderPicker:g}=Ra({props:m,valueManager:Qe,valueType:"time",getOpenDialogAriaText:Xi({utils:f,formatKey:"fullTime",contextTranslation:n.openTimePickerDialogue,propsTranslation:(S=m.localeText)==null?void 0:S.openTimePickerDialogue}),validator:nr});return g()});Wa.propTypes={ampm:K.bool,ampmInClock:K.bool,autoFocus:K.bool,className:K.string,closeOnSelect:K.bool,defaultValue:K.object,disabled:K.bool,disableFuture:K.bool,disableIgnoringDatePartForTimeValidation:K.bool,disableOpenPicker:K.bool,disablePast:K.bool,enableAccessibleFieldDOMStructure:K.any,format:K.string,formatDensity:K.oneOf(["dense","spacious"]),inputRef:Qi,label:K.node,localeText:K.object,maxTime:K.object,minTime:K.object,minutesStep:K.number,name:K.string,onAccept:K.func,onChange:K.func,onClose:K.func,onError:K.func,onOpen:K.func,onSelectedSectionsChange:K.func,onViewChange:K.func,open:K.bool,openTo:K.oneOf(["hours","meridiem","minutes","seconds"]),orientation:K.oneOf(["landscape","portrait"]),readOnly:K.bool,reduceAnimations:K.bool,referenceDate:K.object,selectedSections:K.oneOfType([K.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),K.number]),shouldDisableTime:K.func,skipDisabled:K.bool,slotProps:K.object,slots:K.object,sx:K.oneOfType([K.arrayOf(K.oneOfType([K.func,K.object,K.bool])),K.func,K.object]),thresholdToRenderTimeInASingleColumn:K.number,timeSteps:K.shape({hours:K.number,minutes:K.number,seconds:K.number}),timezone:K.string,value:K.object,view:K.oneOf(["hours","meridiem","minutes","seconds"]),viewRenderers:K.shape({hours:K.func,meridiem:K.func,minutes:K.func,seconds:K.func}),views:K.arrayOf(K.oneOf(["hours","minutes","seconds"]).isRequired)};const ja=Q.forwardRef(function(e,t){var r,a;const n=et(),f=$e(),i=Va(e,"MuiMobileTimePicker"),o=J({hours:$r,minutes:$r,seconds:$r},i.viewRenderers),p=i.ampmInClock??!1,s=J({},i,{ampmInClock:p,viewRenderers:o,format:Wo(f,i),slots:J({field:Da},i.slots),slotProps:J({},i.slotProps,{field:l=>{var d;return J({},Ji((d=i.slotProps)==null?void 0:d.field,l),ir(i),{ref:t})},toolbar:J({hidden:!1,ampmInClock:p},(r=i.slotProps)==null?void 0:r.toolbar)})}),{renderPicker:u}=Pa({props:s,valueManager:Qe,valueType:"time",getOpenDialogAriaText:Xi({utils:f,formatKey:"fullTime",contextTranslation:n.openTimePickerDialogue,propsTranslation:(a=s.localeText)==null?void 0:a.openTimePickerDialogue}),validator:nr});return u()});ja.propTypes={ampm:K.bool,ampmInClock:K.bool,autoFocus:K.bool,className:K.string,closeOnSelect:K.bool,defaultValue:K.object,disabled:K.bool,disableFuture:K.bool,disableIgnoringDatePartForTimeValidation:K.bool,disableOpenPicker:K.bool,disablePast:K.bool,enableAccessibleFieldDOMStructure:K.any,format:K.string,formatDensity:K.oneOf(["dense","spacious"]),inputRef:Qi,label:K.node,localeText:K.object,maxTime:K.object,minTime:K.object,minutesStep:K.number,name:K.string,onAccept:K.func,onChange:K.func,onClose:K.func,onError:K.func,onOpen:K.func,onSelectedSectionsChange:K.func,onViewChange:K.func,open:K.bool,openTo:K.oneOf(["hours","minutes","seconds"]),orientation:K.oneOf(["landscape","portrait"]),readOnly:K.bool,reduceAnimations:K.bool,referenceDate:K.object,selectedSections:K.oneOfType([K.oneOf(["all","day","empty","hours","meridiem","minutes","month","seconds","weekDay","year"]),K.number]),shouldDisableTime:K.func,slotProps:K.object,slots:K.object,sx:K.oneOfType([K.arrayOf(K.oneOfType([K.func,K.object,K.bool])),K.func,K.object]),timezone:K.string,value:K.object,view:K.oneOf(["hours","minutes","seconds"]),viewRenderers:K.shape({hours:K.func,minutes:K.func,seconds:K.func}),views:K.arrayOf(K.oneOf(["hours","minutes","seconds"]).isRequired)};const Gg=["desktopModeMediaQuery"],Kg=Q.forwardRef(function(e,t){const n=Te({props:e,name:"MuiTimePicker"}),{desktopModeMediaQuery:f=qo}=n,i=we(n,Gg);return Gr(f,{defaultMatches:!0})?ee.jsx(Wa,J({ref:t},i)):ee.jsx(ja,J({ref:t},i))});class Yg extends q{componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr);this.setState({value:e})}renderItem(e,t){return I.createElement(Ag,{sx:n=>({width:"100%",borderBottom:`1px solid ${n.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${n.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:!!t,value:this.state.value,onChange:n=>{this.setState({value:n},()=>this.onChange(this.props.attr,this.state.value))},label:this.getText(this.props.schema.label)})}}class Jg extends q{renderItem(){if(!this.props.schema)return null;if(this.props.oContext.DeviceManager){const t=this.props.oContext.DeviceManager;return I.createElement(t,{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 I.createElement("div",null,"DeviceManager not found")}}const xt={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}},Qg=["jpg","jpeg","svg","png","webp","gif","apng","avif","webp"],Xg=["mp3","ogg","wav","aac"],Zg=["avi","mp4","mov"],qg=["txt","log","html","htm"],ev=["json","js","ts"];class dr extends q{dropzoneRef;imagePrefix;objectID;path;constructor(e){super(e),this.dropzoneRef=I.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 e=q.getValue(this.props.data,this.props.attr);this.setState({value:e}),this.props.oContext.socket.subscribeFiles(this.objectID,`${this.path}/*`,this.onFolderChanged).catch(t=>console.error(`Cannot subscribe: ${t}`))})}onFolderChanged=(e,t)=>{this.path&&t.startsWith(this.path)&&this.updateFiles().catch(n=>console.error(`Cannot update files: ${n}`))};componentWillUnmount(){this.props.oContext.socket.subscribeFiles(this.objectID,`${this.path}/*`,this.onFolderChanged).catch(e=>console.error(`Cannot subscribe: ${e}`)),super.componentWillUnmount()}async updateFiles(){const e=await this.readFiles(this.props.schema.pattern);await new Promise(t=>this.setState({files:e},t))}async readFolder(e,t,n){try{const f=await this.props.oContext.socket.readDir(this.objectID,e.replace(/^\//,"")||null);for(let i=0;i<f.length;i++){const o=f[i];if(o.isDir)await this.readFolder(`${e+o.file}/`,t,n);else{let p=!1;n==="*.*"&&o.file.includes(".")||!n||n==="*"||n===".*"&&o.file.startsWith(".")?p=!0:p=new RegExp(`^${n.replace(/\./g,"\\.").replace(/\*/g,".*")}$`).test(o.file),p&&t.push({name:e+o.file,size:o.stats?z.Utils.formatBytes(o.stats.size):"--"})}}}catch(f){console.error(`Cannot read "${e}": ${f}`)}return t}async readFiles(e){const t=[];e=e||this.props.schema.pattern,e||(e="**/*.*");let n;const f=e.lastIndexOf("/");if(f===-1?n=e:n=e.substring(f+1),e.startsWith("**"))await this.readFolder("/",t,n);else{const i=e.lastIndexOf("/");if(i===-1)await this.readFolder("/",t,n);else{const o=e.substring(0,i+1);await this.readFolder(o,t,n)}}return t}onDrop(e){const t=e[0],n=new FileReader,f=this.props.schema.maxSize||2*1024*1024;n.onabort=()=>console.log("file reading was aborted"),n.onerror=()=>console.log("file reading has failed"),n.onload=()=>{if(t.size>f){window.alert(z.I18n.t("File is too big. Max %sk allowed. Try use SVG.",Math.round(f/1024)));return}this.props.oContext.socket.writeFile64(this.objectID,this.path+t.name,n.result).then(()=>this.updateFiles()).then(()=>this.setState({value:this.path+t.name},()=>this.onChange(this.props.attr,this.path+t.name))).catch(i=>window.alert(`Cannot upload file: ${i}`))},n.readAsArrayBuffer(t)}renderDeleteDialog(){return this.state.deleteFile?I.createElement(z.DialogConfirm,{title:z.I18n.t("ra_Are you sure?"),text:z.I18n.t("ra_File will be deleted"),ok:z.I18n.t("ra_Delete"),cancel:z.I18n.t("ra_Cancel"),onClose:e=>{const t=this.state.deleteFile;this.setState({deleteFile:""},()=>{e&&this.props.oContext.socket.deleteFile(this.objectID,t).then(()=>this.updateFiles()).catch(n=>window.alert(`Cannot delete file: ${n}`))})}}):null}static base64ToArrayBuffer(e){const t=window.atob(e),n=t.length,f=new Uint8Array(n);for(let i=0;i<n;i++)f[i]=t.charCodeAt(i);return f.buffer}loadFile(){return this.props.oContext.socket.readFile(this.objectID,this.state.value,!0)}play(){this.loadFile().then(e=>{if(typeof AudioContext<"u"){const t=new AudioContext,n=dr.base64ToArrayBuffer(e.file);t.decodeAudioData(n,f=>{const i=t.createBufferSource();i.buffer=f,i.connect(t.destination),i.start(0)},f=>window.alert(`Cannot play: ${f.message}`))}})}getFileIcon(e){return e!=null&&e.extension?Qg.includes(e.extension)?I.createElement("div",{style:{...xt.selectedImage,backgroundImage:`url(${this.imagePrefix}/${this.objectID}/${e.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"}}):Xg.includes(e.extension)?I.createElement(se.MusicNote,null):qg.includes(e.extension)?I.createElement(se.Article,null):Zg.includes(e.extension)?I.createElement(se.Videocam,null):ev.includes(e.extension)?I.createElement(se.Code,null):null:null}renderItem(e,t){if(!this.state.files)return null;const n=[];this.props.schema.withFolder||this.state.files.forEach(r=>{const a=r.name.lastIndexOf("/");if(a===-1)n.includes("/")||n.push("/");else{const l=r.name.substring(0,a+1);n.includes(l)||n.push(l)}});const f=this.state.files.map(r=>({value:r.name,label:!this.props.schema.withFolder&&n.length===1?`${r.name.substring(n[0].length)}`:`${r.name}${this.props.schema.noSize?"":`(${r.size})`}`,extension:r.name.toLowerCase().split(".").pop()}));this.props.schema.noNone||f.unshift({label:z.I18n.t("ra_none"),value:""});const i=f.find(r=>r.value===this.state.value);let o=0;this.props.schema.upload&&o++,this.props.schema.refresh&&o++;const p=this.state.value&&(this.state.value.endsWith(".mp3")||this.state.value.endsWith(".ogg")||this.state.value.endsWith(".wav"));p&&o++;const s=I.createElement("div",{style:xt.fullWidth},I.createElement(P.FormControl,{variant:"standard",style:{width:`calc(100% - ${o*42}px)`}},this.props.schema.label?I.createElement(P.InputLabel,null,this.getText(this.props.schema.label)):null,I.createElement(P.Select,{variant:"standard",error:!!e,disabled:!!t,value:this.state.value||"_",renderValue:()=>I.createElement(I.Fragment,null,this.getFileIcon(i),I.createElement("span",null,(i==null?void 0:i.label)||"")),onChange:r=>{this.setState({value:r.target.value==="_"?"":r.target.value},()=>this.onChange(this.props.attr,this.state.value))}},f.map(r=>I.createElement(P.MenuItem,{key:r.value,value:r.value},I.createElement(P.ListItemIcon,null,this.getFileIcon(r)),I.createElement(P.ListItemText,null,r.label),this.props.schema.delete&&i.value?I.createElement(P.IconButton,{style:xt.deleteButton,size:"small",onClick:()=>this.setState({deleteFile:i.value})},I.createElement(se.Delete,null)):null))),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null),this.props.schema.refresh&&I.createElement(P.IconButton,{onClick:()=>this.updateFiles()},I.createElement(se.Refresh,null)),this.props.schema.upload&&I.createElement(P.IconButton,{onClick:()=>{var r;return(r=this.dropzoneRef.current)==null?void 0:r.open()}},I.createElement(se.UploadFile,null)),p&&I.createElement(P.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},I.createElement(se.PlayArrow,null)));if(!this.props.schema.upload)return I.createElement(I.Fragment,null,s,this.renderDeleteDialog());let u={"*/*":[]};if(this.props.schema.fileTypes==="image"?u={"image/*":[".png",".jpg",".svg",".gif",".apng",".avif",".webp"]}:this.props.schema.fileTypes==="audio"?u={"audio/*":[".mp3",".ogg",".wav",".mp4"]}:this.props.schema.fileTypes==="text"&&(u={"text/plain":[".txt"]}),this.props.schema.pattern){const r=this.props.schema.pattern.split("/").pop().toLowerCase().replace(/.*\./,"");r==="png"||r==="jpg"||r==="svg"||r==="gif"||r==="apng"||r==="avif"||r==="webp"?u={"image/*":[".png",".jpg",".svg",".gif",".apng",".avif",".webp"]}:r==="mp3"||r==="ogg"||r==="wav"?u={"audio/*":[".mp3",".ogg",".wav",".mp4"]}:r==="ics"?u={"text/calendar":[".ics"]}:r==="txt"?u={"text/plain":[".txt"]}:r==="pem"?u={"text/plain":[".pem"]}:u={"*/*":[`.${r}`]}}return I.createElement(Io,{ref:this.dropzoneRef,multiple:!1,accept:u,noKeyboard:!0,noClick:!0,maxSize:this.props.schema.maxSize||2*1024*1024,onDragEnter:()=>{this.setState({uploadFile:"dragging"})},onDragLeave:()=>this.setState({uploadFile:!0}),onDrop:(r,a)=>{var l,d,c;this.setState({uploadFile:!1}),r.length?this.onDrop(r):window.alert(((c=(d=(l=a==null?void 0:a[0])==null?void 0:l.errors)==null?void 0:d[0])==null?void 0:c.message)||z.I18n.t("Cannot upload"))}},({getRootProps:r,getInputProps:a})=>I.createElement("div",{style:{...xt.uploadDiv,...this.state.uploadFile==="dragging"?xt.uploadDivDragging:void 0,...t?xt.disabledOpacity:void 0},...r()},I.createElement("input",{...a()}),this.state.uploadFile==="dragging"?I.createElement("div",{style:{...xt.uploadCenterDiv,...this.state.uploadError?xt.error:void 0}},I.createElement("div",{style:xt.uploadCenterTextAndIcon},I.createElement(se.UploadFile,{style:xt.uploadCenterIcon}),I.createElement("div",{style:xt.uploadCenterText},this.state.uploadFile==="dragging"?z.I18n.t("ra_Drop file here"):z.I18n.t("ra_Place your files here or click here to open the browse dialog")))):null,s,this.renderDeleteDialog()))}}const Ii={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}},tv=["jpg","jpeg","svg","png","webp","gif","apng","avif","webp"],nv=["mp3","ogg","wav","aac"],iv=["avi","mp4","mov"],rv=["txt","log","html","htm"],sv=["json","js","ts"];class ov extends q{imagePrefix="../..";componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr);this.imagePrefix=this.props.oContext.imagePrefix===void 0?"./files":this.props.oContext.imagePrefix,this.setState({value:e??""})}static getDerivedStateFromProps(e,t){const n=q.getValue(e.data,e.attr);return n==null||n.toString().trim()!==(t.value||"").toString().trim()?{value:n??""}:null}loadFile(){const e=this.state.value.indexOf("/");if(e!==-1){const t=this.state.value.substring(0,e),n=this.state.value.substring(e+1);return this.props.oContext.socket.readFile(t,n,!0)}return Promise.resolve(null)}play(){this.loadFile().then(e=>{if(typeof AudioContext<"u"&&(e!=null&&e.file)){const t=new AudioContext,n=dr.base64ToArrayBuffer(e.file);t.decodeAudioData(n,f=>{const i=t.createBufferSource();i.buffer=f,i.connect(t.destination),i.start(0)},f=>window.alert(`Cannot play: ${f.message}`))}})}getIcon(){const e=this.state.value.split(".").pop().toLowerCase();return tv.includes(e)?I.createElement("div",{style:{...Ii.selectedImage,backgroundImage:`url(${this.imagePrefix}/${this.state.value})`,backgroundSize:"contain",backgroundRepeat:"no-repeat"}}):nv.includes(e)?I.createElement(P.IconButton,{style:{color:"#00FF00"},onClick:()=>this.play()},I.createElement(se.PlayArrow,null)):rv.includes(e)?I.createElement(se.Article,null):iv.includes(e)?I.createElement(se.Videocam,null):sv.includes(e)?I.createElement(se.Code,null):null}renderFileBrowser(){return this.state.showFileBrowser?I.createElement(z.DialogSelectFile,{imagePrefix:this.props.oContext.imagePrefix,socket:this.props.oContext.socket,selected:this.state.value,onClose:()=>this.setState({showFileBrowser:!1}),onOk:e=>{const t=Array.isArray(e)?e[0]:e;this.setState({value:t},()=>this.onChange(this.props.attr,this.props.schema.trim===!1?t:(t||"").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(e,t){const n=this.getIcon();return I.createElement("div",{style:Ii.fullWidth},n,I.createElement(P.TextField,{variant:"standard",style:n?Ii.fullWidthIcon:Ii.fullWidthOneButton,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e,disabled:!!t,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:!!this.props.schema.disableEdit}},onChange:f=>{const i=f.target.value;this.setState({value:i},()=>this.onChange(this.props.attr,this.props.schema.trim===!1?i:(i||"").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)}),I.createElement(P.Button,{disabled:t,variant:"outlined",onClick:()=>this.setState({showFileBrowser:!0})},"..."),this.renderFileBrowser())}}class av extends q{componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr);this.props.oContext.socket.getEnums("functions").then(t=>{const n=Object.keys(t).map(f=>({value:this.props.schema.short?f.replace("enum.functions.",""):f,label:this.getText(t[f].common.name),obj:t[f]}));this.props.schema.allowDeactivate!==!1&&n.unshift({label:z.I18n.t(q.NONE_LABEL),value:q.NONE_VALUE}),this.setState({value:e,selectOptions:n})})}renderItem(e,t){if(!this.state.selectOptions)return null;const n=this.state.selectOptions.find(f=>f.value===this.state.value);return I.createElement(P.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?I.createElement(P.InputLabel,null,this.getText(this.props.schema.label)):null,I.createElement(P.Select,{variant:"standard",error:!!e,disabled:!!t,value:this.state.value||"_",renderValue:()=>n?n.obj?I.createElement(z.TextWithIcon,{value:n.obj,themeType:this.props.oContext.themeType,lang:z.I18n.getLanguage()}):n.label:"",onChange:f=>{this.setState({value:f.target.value==="_"?"":f.target.value},()=>this.onChange(this.props.attr,this.state.value))}},this.state.selectOptions.map(f=>I.createElement(P.MenuItem,{key:f.value,value:f.value,style:f.value===q.DIFFERENT_VALUE?{opacity:.5}:{}},f.obj?I.createElement(z.TextWithIcon,{value:f.obj,themeType:this.props.oContext.themeType,lang:z.I18n.getLanguage()}):f.label))),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class lv extends q{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getHostByIp(this.props.common.host).then(e=>{this.props.schema.listenOnAllPorts||(e=e.filter(t=>t.address!=="0.0.0.0"&&t.address!=="::")),this.props.schema.onlyIp4?e=e.filter(t=>t.family==="ipv4"):this.props.schema.onlyIp6&&(e=e.filter(t=>t.family==="ipv6")),this.props.schema.noInternal&&(e=e.filter(t=>!t.internal)),e.forEach(t=>{t.address==="0.0.0.0"?t.name=`[IPv4] 0.0.0.0 - ${z.I18n.t("ra_Listen on all IPs")}`:t.address==="::"&&(t.name=`[IPv6] :: - ${z.I18n.t("ra_Listen on all IPs")}`)}),this.setState({ips:e})}).catch(e=>console.error(e))}renderItem(e,t){var i,o;const n=q.getValue(this.props.data,this.props.attr),f=(i=this.state.ips)==null?void 0:i.find(p=>p.address===n);return I.createElement(P.FormControl,{fullWidth:!0,variant:"standard"},this.state.ips&&this.props.schema.label?I.createElement(P.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.ips?I.createElement(P.Select,{variant:"standard",error:!!e,disabled:!!t,value:n,renderValue:p=>(f==null?void 0:f.name)||p,onChange:p=>this.onChange(this.props.attr,p.target.value)},(o=this.state.ips)==null?void 0:o.map((p,s)=>I.createElement(P.MenuItem,{key:s,value:p.address},p.name))):I.createElement(P.TextField,{fullWidth:!0,variant:"standard",error:!!e,disabled:!!t,value:n,onChange:p=>this.onChange(this.props.attr,p.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class cv extends q{initialized=!1;localContext;componentDidMount(){super.componentDidMount(),this.askInstance()}askInstance(){if(this.props.alive){let e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);if(t)try{e=JSON.parse(t)}catch{console.error(`Cannot parse json data: ${JSON.stringify(e)}`)}}e===void 0&&(e=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",e).then(t=>this.setState({image:t||""}))}}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=q.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(){if(this.props.alive){const e=this.getContext();(e!==this.localContext||!this.initialized)&&(this.localContext=e,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}return this.state.image===void 0?null:I.createElement("img",{alt:"dynamic content",src:this.state.image,style:{width:this.props.schema.width||"100%",height:this.props.schema.height}})}}class uv extends q{index;constructor(e){super(e),this.index=Date.now()}componentDidMount(){if(super.componentDidMount(),this.props.schema.base64){const e=q.getValue(this.props.data,this.props.attr);this.setState({value:e})}else this.props.oContext.socket.fileExists(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr).then(e=>e&&this.loadImage())}_getUrl(e){e&&(this.index=Date.now());let t=`files/${this.props.oContext.adapterName}.${this.props.oContext.instance}/${this.props.attr}?t=${this.index}`;return window.location.port==="3000"&&(t=`${window.location.protocol}//${window.location.hostname}:8081/${t}`),t}loadImage(){fetch(this._getUrl()).then(e=>e.blob()).then(e=>{const t=new FileReader;t.onload=()=>{this.setState({value:t.result})},t.readAsDataURL(e)}).catch(e=>console.error(e))}renderItem(e,t){return I.createElement(P.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?I.createElement(P.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,I.createElement(z.UploadImage,{error:!!e,disabled:t,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 n=this.onChange(this.props.attr,this.state.value);n instanceof Promise&&n.catch(f=>console.error(`Cannot set value: ${f}`))}else this.props.oContext.socket.deleteFile(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr).catch(n=>console.error(n))}),onChange:n=>this.setState({value:n},()=>{if(this.props.schema.base64){const f=this.onChange(this.props.attr,this.state.value);f instanceof Promise&&f.catch(i=>console.error(`Cannot set value: ${i}`))}else n.startsWith("data")&&(n=n.split(",")[1]);this.props.oContext.socket.writeFile64(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.attr,n).catch(f=>console.error(f))})}),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class hv extends q{renderItem(){return I.createElement(z.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?I.createElement(P.Box,{component:"div",sx:{fontWeight:"bold",fontSize:"larger"}},this.getText(this.props.schema.title)):null,this.getText(this.props.schema.text))}}const to={icon:{width:20,height:20,marginRight:4}};class dv extends q{componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr);let t=this.props.schema.adapter;t==="_dataSources"&&(t=void 0),this.props.oContext.socket.getAdapterInstances(t,!0).then(async n=>{this.props.schema.adapter==="_dataSources"?n=n.filter(i=>{var o;return(o=i==null?void 0:i.common)==null?void 0:o.getHistory}):this.props.schema.adapter?n=n.filter(i=>i==null?void 0:i._id.startsWith(`system.adapter.${this.props.schema.adapter}.`)):this.props.schema.adapters&&Array.isArray(this.props.schema.adapters)&&(n=n.filter(i=>{var o;return this.props.schema.adapters.includes((o=i==null?void 0:i.common)==null?void 0:o.name)})),this.props.schema.onlyEnabled&&(n=n.filter(i=>{var o;return(o=i==null?void 0:i.common)==null?void 0:o.enabled}));const f=n.map(i=>({value:this.props.schema.long?i._id:this.props.schema.short?i._id.split(".").pop():i._id.replace(/^system\.adapter\./,""),label:`${i.common.name} [${i._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${i.common.name}/${i.common.icon}`}));f.sort((i,o)=>i.value>o.value?1:i.value<o.value?-1:0),this.props.schema.allowDeactivate!==!1&&f.unshift({label:z.I18n.t(q.NONE_LABEL),value:q.NONE_VALUE}),this.props.schema.all&&f.unshift({label:z.I18n.t("sch_all"),value:"*"}),this.setState({value:e||"",selectOptions:f}),await this.props.oContext.socket.subscribeObject(`system.adapter.${t?`${t}.`:""}*`,this.onInstancesUpdate)}).catch(n=>console.error(`Cannot get instances: ${n}`))}componentWillUnmount(){this.props.oContext.socket.unsubscribeObject("system.adapter.*",this.onInstancesUpdate).then(()=>{}),super.componentWillUnmount()}onInstancesUpdate=(e,t)=>{if(!e.match(/^system\.adapter\.[-_a-z\d]+\.\d+$/))return;const n=this.props.schema.long?e:this.props.schema.short?e.split(".").pop():e.replace(/^system\.adapter\./,""),f=this.state.selectOptions.findIndex(i=>i.value===n);if(t){if(this.props.schema.adapter==="_dataSources"&&(!t.common||!t.common.getHistory))return;if(f===-1){const i=JSON.parse(JSON.stringify(this.state.selectOptions)),o=typeof t.common.name=="object"?t.common.name[z.I18n.getLanguage()]||t.common.name.en:t.common.name;i.push({value:this.props.schema.long?t._id:this.props.schema.short?t._id.split(".").pop():t._id.replace(/^system\.adapter\./,""),label:`${o} [${t._id.replace(/^system\.adapter\./,"")}]`,icon:`adapter/${o}/${t.common.icon}`}),i.sort((p,s)=>p.label>s.label?1:p.label<s.label?-1:0),this.setState({selectOptions:i})}}else if(f!==-1){const i=JSON.parse(JSON.stringify(this.state.selectOptions)),o={};this.state.value===i[f].value&&(o.value=q.NONE_VALUE),i.splice(f,1),o.selectOptions=i,this.setState(o)}};renderItem(e,t){var f;if(!this.state.selectOptions)return null;const n=(f=this.state.selectOptions)==null?void 0:f.find(i=>i.value===this.state.value);return I.createElement(P.FormControl,{fullWidth:!0,key:this.props.attr,variant:"standard"},this.props.schema.label?I.createElement(P.InputLabel,{shrink:!0},this.getText(this.props.schema.label)):null,I.createElement(P.Select,{variant:"standard",error:!!e,displayEmpty:!0,disabled:!!t,value:this.state.value,renderValue:()=>I.createElement("span",{style:{display:"flex"}},n!=null&&n.icon?I.createElement("img",{src:`./${n.icon}`,alt:n.value,style:to.icon}):null,this.getText(n==null?void 0:n.label,!0)),onChange:i=>this.setState({value:i.target.value},()=>this.onChange(this.props.attr,this.state.value))},this.state.selectOptions.map(i=>I.createElement(P.MenuItem,{key:i.value,value:i.value,style:i.value===q.NONE_VALUE?{opacity:.5}:{}},i.icon?I.createElement("img",{src:`./${i.icon}`,alt:i.value,style:to.icon}):null,this.getText(i.label,!0)))),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const no={address:{fontSize:"smaller",opacity:.5,marginLeft:8}};class pv extends q{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getObject(`system.host.${this.props.common.host}`).then(e=>{var n,f;const t=[];if((f=(n=e==null?void 0:e.native)==null?void 0:n.hardware)!=null&&f.networkInterfaces){const i=e.native.hardware.networkInterfaces;Object.keys(i).forEach(o=>{if(this.props.schema.ignoreInternal&&!i[o].find(s=>!s.internal)||this.props.schema.ignoreLoopback&&i[o].find(s=>s.address==="127.0.0.1"||s.address==="::1"))return;let p=i[o].find(s=>s.family==="IPv4");p||=i[o].find(s=>s.family==="IPv6"),t.push({value:o,address:p.address})})}this.setState({interfaces:t})}).catch(e=>window.alert(`Cannot read interfaces: ${e}`))}renderItem(e,t){var i,o,p;const n=q.getValue(this.props.data,this.props.attr),f=(i=this.state.interfaces)==null?void 0:i.find(s=>s.value===n);return I.createElement(P.FormControl,{fullWidth:!0,variant:"standard"},(o=this.state.interfaces)!=null&&o.length&&this.props.schema.label?I.createElement(P.InputLabel,null,this.getText(this.props.schema.label)):null,(p=this.state.interfaces)!=null&&p.length?I.createElement(P.Select,{variant:"standard",error:!!e,disabled:!!t,value:n,renderValue:s=>f?I.createElement("span",null,f.value,I.createElement("span",{style:no.address},f.address)):s,onChange:s=>this.onChange(this.props.attr,s.target.value)},this.state.interfaces.map((s,u)=>I.createElement(P.MenuItem,{key:u,value:s.value},I.createElement("span",null,s.value,I.createElement("span",{style:no.address},s.address))))):I.createElement(P.TextField,{fullWidth:!0,variant:"standard",error:!!e,disabled:!!t,value:n,onChange:s=>this.onChange(this.props.attr,s.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const En={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"}},fv=({toggleTranslation:h,noTranslation:e,title:t,fullWidth:n,help:f,maxWidth:i,progress:o,icon:p,applyDisabled:s,applyButton:u,onClose:r,children:a,titleButtonApply:l,titleButtonClose:d,onApply:c,textInput:m,defaultValue:g,overflowHidden:v})=>{const[b,E]=Q.useState(g);Q.useEffect(()=>{E(g)},[g]);const S=P.useTheme(),w=P.useMediaQuery(S.breakpoints.down("md"));let y=null;return p&&(y=p),I.createElement(P.Dialog,{open:!0,maxWidth:w?!1:i||"md",fullWidth:!!n,fullScreen:w,disableEscapeKeyDown:!1,onClose:r,sx:{"& .MuiPaper-root":w?{}:En.modalDialog}},t&&I.createElement(P.DialogTitle,null,p?I.createElement(y,{style:En.titleIcon}):null,t,z.I18n.getLanguage()!=="en"&&h?I.createElement(P.IconButton,{size:"large",style:{...En.languageButton,...e?En.languageButtonActive:{}},onClick:()=>h(),title:z.I18n.t("Disable/Enable translation")},I.createElement(se.Language,null)):null),I.createElement(P.DialogContent,{sx:{...v?En.overflowHidden:{},...En.content},style:{paddingTop:8}},m&&I.createElement(P.TextField,{autoComplete:"off",fullWidth:!0,autoFocus:!0,variant:"outlined",size:"medium",multiline:!0,value:b,onChange:D=>E(D.target.value)}),a,f?I.createElement("div",null,f):null),I.createElement(P.DialogActions,null,u!==!1&&I.createElement(P.Button,{startIcon:I.createElement(se.Check,null),disabled:o||s&&g===b,onClick:()=>c&&c(m?b:""),variant:"contained",color:"primary"},z.I18n.t(l||"Ok")),I.createElement(P.Button,{color:"grey",onClick:()=>r&&r(),disabled:o,variant:"contained",startIcon:I.createElement(se.Close,null)},z.I18n.t(d||"Cancel"))))};var On={},mn={},Ha={exports:{}};(function(h,e){(function(){var t="ace",n=(function(){return this})();!n&&typeof window<"u"&&(n=window);var f=function(r,a,l){if(typeof r!="string"){f.original?f.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(l=a),f.modules[r]||(f.payloads[r]=l,f.modules[r]=null)};f.modules={},f.payloads={};var i=function(r,a,l){if(typeof a=="string"){var d=s(r,a);if(d!=null)return l&&l(),d}else if(Object.prototype.toString.call(a)==="[object Array]"){for(var c=[],m=0,g=a.length;m<g;++m){var v=s(r,a[m]);if(v==null&&o.original)return;c.push(v)}return l&&l.apply(null,c)||!0}},o=function(r,a){var l=i("",r,a);return l==null&&o.original?o.original.apply(this,arguments):l},p=function(r,a){if(a.indexOf("!")!==-1){var l=a.split("!");return p(r,l[0])+"!"+p(r,l[1])}if(a.charAt(0)=="."){var d=r.split("/").slice(0,-1).join("/");for(a=d+"/"+a;a.indexOf(".")!==-1&&c!=a;){var c=a;a=a.replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return a},s=function(r,a){a=p(r,a);var l=f.modules[a];if(!l){if(l=f.payloads[a],typeof l=="function"){var d={},c={id:a,uri:"",exports:d,packaged:!0},m=function(v,b){return i(a,v,b)},g=l(m,d,c);d=g||c.exports,f.modules[a]=d,delete f.payloads[a]}l=f.modules[a]=d||l}return l};function u(r){var a=n;n[r]||(n[r]={}),a=n[r],(!a.define||!a.define.packaged)&&(f.original=a.define,a.define=f,a.define.packaged=!0),(!a.require||!a.require.packaged)&&(o.original=a.require,a.require=o,a.require.packaged=!0)}u(t)})(),ace.define("ace/lib/es6-shim",["require","exports","module"],function(t,n,f){function i(o,p,s){Object.defineProperty(o,p,{value:s,enumerable:!1,writable:!0,configurable:!0})}String.prototype.startsWith||i(String.prototype,"startsWith",function(o,p){return p=p||0,this.lastIndexOf(o,p)===p}),String.prototype.endsWith||i(String.prototype,"endsWith",function(o,p){var s=this;(p===void 0||p>s.length)&&(p=s.length),p-=o.length;var u=s.indexOf(o,p);return u!==-1&&u===p}),String.prototype.repeat||i(String.prototype,"repeat",function(o){for(var p="",s=this;o>0;)o&1&&(p+=s),(o>>=1)&&(s+=s);return p}),String.prototype.includes||i(String.prototype,"includes",function(o,p){return this.indexOf(o,p)!=-1}),Object.assign||(Object.assign=function(o){if(o==null)throw new TypeError("Cannot convert undefined or null to object");for(var p=Object(o),s=1;s<arguments.length;s++){var u=arguments[s];u!=null&&Object.keys(u).forEach(function(r){p[r]=u[r]})}return p}),Object.values||(Object.values=function(o){return Object.keys(o).map(function(p){return o[p]})}),Array.prototype.find||i(Array.prototype,"find",function(o){for(var p=this.length,s=arguments[1],u=0;u<p;u++){var r=this[u];if(o.call(s,r,u,this))return r}}),Array.prototype.findIndex||i(Array.prototype,"findIndex",function(o){for(var p=this.length,s=arguments[1],u=0;u<p;u++){var r=this[u];if(o.call(s,r,u,this))return u}}),Array.prototype.includes||i(Array.prototype,"includes",function(o,p){return this.indexOf(o,p)!=-1}),Array.prototype.fill||i(Array.prototype,"fill",function(o){for(var p=this,s=p.length>>>0,u=arguments[1],r=u>>0,a=r<0?Math.max(s+r,0):Math.min(r,s),l=arguments[2],d=l===void 0?s:l>>0,c=d<0?Math.max(s+d,0):Math.min(d,s);a<c;)p[a]=o,a++;return p}),Array.of||i(Array,"of",function(){return Array.prototype.slice.call(arguments)})}),ace.define("ace/lib/fixoldbrowsers",["require","exports","module","ace/lib/es6-shim"],function(t,n,f){t("./es6-shim")}),ace.define("ace/lib/deep_copy",["require","exports","module"],function(t,n,f){n.deepCopy=function i(o){if(typeof o!="object"||!o)return o;var p;if(Array.isArray(o)){p=[];for(var s=0;s<o.length;s++)p[s]=i(o[s]);return p}if(Object.prototype.toString.call(o)!=="[object Object]")return o;p={};for(var s in o)p[s]=i(o[s]);return p}}),ace.define("ace/lib/lang",["require","exports","module","ace/lib/deep_copy"],function(t,n,f){n.last=function(p){return p[p.length-1]},n.stringReverse=function(p){return p.split("").reverse().join("")},n.stringRepeat=function(p,s){for(var u="";s>0;)s&1&&(u+=p),(s>>=1)&&(p+=p);return u};var i=/^\s\s*/,o=/\s\s*$/;n.stringTrimLeft=function(p){return p.replace(i,"")},n.stringTrimRight=function(p){return p.replace(o,"")},n.copyObject=function(p){var s={};for(var u in p)s[u]=p[u];return s},n.copyArray=function(p){for(var s=[],u=0,r=p.length;u<r;u++)p[u]&&typeof p[u]=="object"?s[u]=this.copyObject(p[u]):s[u]=p[u];return s},n.deepCopy=t("./deep_copy").deepCopy,n.arrayToMap=function(p){for(var s={},u=0;u<p.length;u++)s[p[u]]=1;return s},n.createMap=function(p){var s=Object.create(null);for(var u in p)s[u]=p[u];return s},n.arrayRemove=function(p,s){for(var u=0;u<=p.length;u++)s===p[u]&&p.splice(u,1)},n.escapeRegExp=function(p){return p.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},n.escapeHTML=function(p){return(""+p).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},n.getMatchOffsets=function(p,s){var u=[];return p.replace(s,function(r){u.push({offset:arguments[arguments.length-2],length:r.length})}),u},n.deferredCall=function(p){var s=null,u=function(){s=null,p()},r=function(a){return r.cancel(),s=setTimeout(u,a||0),r};return r.schedule=r,r.call=function(){return this.cancel(),p(),r},r.cancel=function(){return clearTimeout(s),s=null,r},r.isPending=function(){return s},r},n.delayedCall=function(p,s){var u=null,r=function(){u=null,p()},a=function(l){u==null&&(u=setTimeout(r,l||s))};return a.delay=function(l){u&&clearTimeout(u),u=setTimeout(r,l||s)},a.schedule=a,a.call=function(){this.cancel(),p()},a.cancel=function(){u&&clearTimeout(u),u=null},a.isPending=function(){return u},a},n.supportsLookbehind=function(){try{new RegExp("(?<=.)")}catch{return!1}return!0},n.skipEmptyMatch=function(p,s,u){return u&&p.codePointAt(s)>65535?2:1}}),ace.define("ace/lib/useragent",["require","exports","module"],function(t,n,f){n.OS={LINUX:"LINUX",MAC:"MAC",WINDOWS:"WINDOWS"},n.getOS=function(){return n.isMac?n.OS.MAC:n.isLinux?n.OS.LINUX:n.OS.WINDOWS};var i=typeof navigator=="object"?navigator:{},o=(/mac|win|linux/i.exec(i.platform)||["other"])[0].toLowerCase(),p=i.userAgent||"",s=i.appName||"";n.isWin=o=="win",n.isMac=o=="mac",n.isLinux=o=="linux",n.isIE=s=="Microsoft Internet Explorer"||s.indexOf("MSAppHost")>=0?parseFloat((p.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((p.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),n.isOldIE=n.isIE&&n.isIE<9,n.isGecko=n.isMozilla=p.match(/ Gecko\/\d+/),n.isOpera=typeof opera=="object"&&Object.prototype.toString.call(window.opera)=="[object Opera]",n.isWebKit=parseFloat(p.split("WebKit/")[1])||void 0,n.isChrome=parseFloat(p.split(" Chrome/")[1])||void 0,n.isSafari=parseFloat(p.split(" Safari/")[1])&&!n.isChrome||void 0,n.isEdge=parseFloat(p.split(" Edge/")[1])||void 0,n.isAIR=p.indexOf("AdobeAIR")>=0,n.isAndroid=p.indexOf("Android")>=0,n.isChromeOS=p.indexOf(" CrOS ")>=0,n.isIOS=/iPad|iPhone|iPod/.test(p)&&!window.MSStream,n.isIOS&&(n.isMac=!0),n.isMobile=n.isIOS||n.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(t,n,f){var i=t("./useragent"),o="http://www.w3.org/1999/xhtml";n.buildDom=function l(d,c,m){if(typeof d=="string"&&d){var g=document.createTextNode(d);return c&&c.appendChild(g),g}if(!Array.isArray(d))return d&&d.appendChild&&c&&c.appendChild(d),d;if(typeof d[0]!="string"||!d[0]){for(var v=[],b=0;b<d.length;b++){var E=l(d[b],c,m);E&&v.push(E)}return v}var S=document.createElement(d[0]),w=d[1],y=1;w&&typeof w=="object"&&!Array.isArray(w)&&(y=2);for(var b=y;b<d.length;b++)l(d[b],S,m);return y==2&&Object.keys(w).forEach(function(D){var $=w[D];D==="class"?S.className=Array.isArray($)?$.join(" "):$:typeof $=="function"||D=="value"||D[0]=="$"?S[D]=$:D==="ref"?m&&(m[$]=S):D==="style"?typeof $=="string"&&(S.style.cssText=$):$!=null&&S.setAttribute(D,$)}),c&&c.appendChild(S),S},n.getDocumentHead=function(l){return l||(l=document),l.head||l.getElementsByTagName("head")[0]||l.documentElement},n.createElement=function(l,d){return document.createElementNS?document.createElementNS(d||o,l):document.createElement(l)},n.removeChildren=function(l){l.innerHTML=""},n.createTextNode=function(l,d){var c=d?d.ownerDocument:document;return c.createTextNode(l)},n.createFragment=function(l){var d=l?l.ownerDocument:document;return d.createDocumentFragment()},n.hasCssClass=function(l,d){var c=(l.className+"").split(/\s+/g);return c.indexOf(d)!==-1},n.addCssClass=function(l,d){n.hasCssClass(l,d)||(l.className+=" "+d)},n.removeCssClass=function(l,d){for(var c=l.className.split(/\s+/g);;){var m=c.indexOf(d);if(m==-1)break;c.splice(m,1)}l.className=c.join(" ")},n.toggleCssClass=function(l,d){for(var c=l.className.split(/\s+/g),m=!0;;){var g=c.indexOf(d);if(g==-1)break;m=!1,c.splice(g,1)}return m&&c.push(d),l.className=c.join(" "),m},n.setCssClass=function(l,d,c){c?n.addCssClass(l,d):n.removeCssClass(l,d)},n.hasCssString=function(l,d){var c=0,m;if(d=d||document,m=d.querySelectorAll("style")){for(;c<m.length;)if(m[c++].id===l)return!0}},n.removeElementById=function(l,d){d=d||document,d.getElementById(l)&&d.getElementById(l).remove()};var p,s=[];n.useStrictCSP=function(l){p=l,l==!1?u():s||(s=[])};function u(){var l=s;s=null,l&&l.forEach(function(d){r(d[0],d[1])})}function r(l,d,c){if(!(typeof document>"u")){if(s){if(c)u();else if(c===!1)return s.push([l,d])}if(!p){var m=c;!c||!c.getRootNode?m=document:(m=c.getRootNode(),(!m||m==c)&&(m=document));var g=m.ownerDocument||m;if(d&&n.hasCssString(d,m))return null;d&&(l+=`
/*# sourceURL=ace/css/`+d+" */");var v=n.createElement("style");v.appendChild(g.createTextNode(l)),d&&(v.id=d),m==g&&(m=n.getDocumentHead(g)),m.insertBefore(v,m.firstChild)}}}if(n.importCssString=r,n.importCssStylsheet=function(l,d){n.buildDom(["link",{rel:"stylesheet",href:l}],n.getDocumentHead(d))},n.$fixPositionBug=function(l){var d=l.getBoundingClientRect();if(l.style.left){var c=parseFloat(l.style.left),m=+d.left;Math.abs(c-m)>1&&(l.style.left=2*c-m+"px")}if(l.style.right){var c=parseFloat(l.style.right),m=window.innerWidth-d.right;Math.abs(c-m)>1&&(l.style.right=2*c-m+"px")}if(l.style.top){var c=parseFloat(l.style.top),m=+d.top;Math.abs(c-m)>1&&(l.style.top=2*c-m+"px")}if(l.style.bottom){var c=parseFloat(l.style.bottom),m=window.innerHeight-d.bottom;Math.abs(c-m)>1&&(l.style.bottom=2*c-m+"px")}},n.scrollbarWidth=function(l){var d=n.createElement("ace_inner");d.style.width="100%",d.style.minWidth="0px",d.style.height="200px",d.style.display="block";var c=n.createElement("ace_outer"),m=c.style;m.position="absolute",m.left="-10000px",m.overflow="hidden",m.width="200px",m.minWidth="0px",m.height="150px",m.display="block",c.appendChild(d);var g=l&&l.documentElement||document&&document.documentElement;if(!g)return 0;g.appendChild(c);var v=d.offsetWidth;m.overflow="scroll";var b=d.offsetWidth;return v===b&&(b=c.clientWidth),g.removeChild(c),v-b},n.computedStyle=function(l,d){return window.getComputedStyle(l,"")||{}},n.setStyle=function(l,d,c){l[d]!==c&&(l[d]=c)},n.HAS_CSS_ANIMATION=!1,n.HAS_CSS_TRANSFORMS=!1,n.HI_DPI=i.isWin?typeof window<"u"&&window.devicePixelRatio>=1.5:!0,i.isChromeOS&&(n.HI_DPI=!1),typeof document<"u"){var a=document.createElement("div");n.HI_DPI&&a.style.transform!==void 0&&(n.HAS_CSS_TRANSFORMS=!0),!i.isEdge&&typeof a.style.animationName<"u"&&(n.HAS_CSS_ANIMATION=!0),a=null}n.HAS_CSS_TRANSFORMS?n.translate=function(l,d,c){l.style.transform="translate("+Math.round(d)+"px, "+Math.round(c)+"px)"}:n.translate=function(l,d,c){l.style.top=Math.round(c)+"px",l.style.left=Math.round(d)+"px"}}),ace.define("ace/lib/net",["require","exports","module","ace/lib/dom"],function(t,n,f){var i=t("./dom");n.get=function(o,p){var s=new XMLHttpRequest;s.open("GET",o,!0),s.onreadystatechange=function(){s.readyState===4&&p(s.responseText)},s.send(null)},n.loadScript=function(o,p){var s=i.getDocumentHead(),u=document.createElement("script");u.src=o,s.appendChild(u),u.onload=u.onreadystatechange=function(r,a){(a||!u.readyState||u.readyState=="loaded"||u.readyState=="complete")&&(u=u.onload=u.onreadystatechange=null,a||p())}},n.qualifyURL=function(o){var p=document.createElement("a");return p.href=o,p.href}}),ace.define("ace/lib/oop",["require","exports","module"],function(t,n,f){n.inherits=function(i,o){i.super_=o,i.prototype=Object.create(o.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}})},n.mixin=function(i,o){for(var p in o)i[p]=o[p];return i},n.implement=function(i,o){n.mixin(i,o)}}),ace.define("ace/lib/event_emitter",["require","exports","module"],function(t,n,f){var i={},o=function(){this.propagationStopped=!0},p=function(){this.defaultPrevented=!0};i._emit=i._dispatchEvent=function(s,u){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var r=this._eventRegistry[s]||[],a=this._defaultHandlers[s];if(!(!r.length&&!a)){(typeof u!="object"||!u)&&(u={}),u.type||(u.type=s),u.stopPropagation||(u.stopPropagation=o),u.preventDefault||(u.preventDefault=p),r=r.slice();for(var l=0;l<r.length&&(r[l](u,this),!u.propagationStopped);l++);if(a&&!u.defaultPrevented)return a(u,this)}},i._signal=function(s,u){var r=(this._eventRegistry||{})[s];if(r){r=r.slice();for(var a=0;a<r.length;a++)r[a](u,this)}},i.once=function(s,u){var r=this;if(this.on(s,function a(){r.off(s,a),u.apply(null,arguments)}),!u)return new Promise(function(a){u=a})},i.setDefaultHandler=function(s,u){var r=this._defaultHandlers;if(r||(r=this._defaultHandlers={_disabled_:{}}),r[s]){var a=r[s],l=r._disabled_[s];l||(r._disabled_[s]=l=[]),l.push(a);var d=l.indexOf(u);d!=-1&&l.splice(d,1)}r[s]=u},i.removeDefaultHandler=function(s,u){var r=this._defaultHandlers;if(r){var a=r._disabled_[s];if(r[s]==u)a&&this.setDefaultHandler(s,a.pop());else if(a){var l=a.indexOf(u);l!=-1&&a.splice(l,1)}}},i.on=i.addEventListener=function(s,u,r){this._eventRegistry=this._eventRegistry||{};var a=this._eventRegistry[s];return a||(a=this._eventRegistry[s]=[]),a.indexOf(u)==-1&&a[r?"unshift":"push"](u),u},i.off=i.removeListener=i.removeEventListener=function(s,u){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[s];if(r){var a=r.indexOf(u);a!==-1&&r.splice(a,1)}},i.removeAllListeners=function(s){s||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[s]=void 0),this._defaultHandlers&&(this._defaultHandlers[s]=void 0)},n.EventEmitter=i}),ace.define("ace/lib/report_error",["require","exports","module"],function(t,n,f){n.reportError=function(o,p){var s=new Error(o);s.data=p,typeof console=="object"&&console.error&&console.error(s),setTimeout(function(){throw s})}}),ace.define("ace/lib/default_english_messages",["require","exports","module"],function(t,n,f){var i={"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"};n.defaultEnglishMessages=i}),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(t,n,f){"no use strict";var i=t("./oop"),o=t("./event_emitter").EventEmitter,p=t("./report_error").reportError,s=t("./default_english_messages").defaultEnglishMessages,u={setOptions:function(c){Object.keys(c).forEach(function(m){this.setOption(m,c[m])},this)},getOptions:function(c){var m={};if(c)Array.isArray(c)||(c=Object.keys(c));else{var g=this.$options;c=Object.keys(g).filter(function(v){return!g[v].hidden})}return c.forEach(function(v){m[v]=this.getOption(v)},this),m},setOption:function(c,m){if(this["$"+c]!==m){var g=this.$options[c];if(!g)return r('misspelled option "'+c+'"');if(g.forwardTo)return this[g.forwardTo]&&this[g.forwardTo].setOption(c,m);g.handlesSet||(this["$"+c]=m),g&&g.set&&g.set.call(this,m)}},getOption:function(c){var m=this.$options[c];return m?m.forwardTo?this[m.forwardTo]&&this[m.forwardTo].getOption(c):m&&m.get?m.get.call(this):this["$"+c]:r('misspelled option "'+c+'"')}};function r(c){typeof console<"u"&&console.warn&&console.warn.apply(console,arguments)}var a,l,d=(function(){function c(){this.$defaultOptions={},a=s,l="dollarSigns"}return c.prototype.defineOptions=function(m,g,v){return m.$options||(this.$defaultOptions[g]=m.$options={}),Object.keys(v).forEach(function(b){var E=v[b];typeof E=="string"&&(E={forwardTo:E}),E.name||(E.name=b),m.$options[E.name]=E,"initialValue"in E&&(m["$"+E.name]=E.initialValue)}),i.implement(m,u),this},c.prototype.resetOptions=function(m){Object.keys(m.$options).forEach(function(g){var v=m.$options[g];"value"in v&&m.setOption(g,v.value)})},c.prototype.setDefaultValue=function(m,g,v){if(!m){for(m in this.$defaultOptions)if(this.$defaultOptions[m][g])break;if(!this.$defaultOptions[m][g])return!1}var b=this.$defaultOptions[m]||(this.$defaultOptions[m]={});b[g]&&(b.forwardTo?this.setDefaultValue(b.forwardTo,g,v):b[g].value=v)},c.prototype.setDefaultValues=function(m,g){Object.keys(g).forEach(function(v){this.setDefaultValue(m,v,g[v])},this)},c.prototype.setMessages=function(m,g){a=m,g&&g.placeholders&&(l=g.placeholders)},c.prototype.nls=function(m,g,v){a[m]||(r("No message found for the key '"+m+"' in messages with id "+a.$id+", trying to find a translation for the default string '"+g+"'."),a[g]||r("No message found for the default string '"+g+"' in the provided messages. Falling back to the default English message."));var b=a[m]||a[g]||g;return v&&(l==="dollarSigns"&&(b=b.replace(/\$(\$|[\d]+)/g,function(E,S){return S=="$"?"$":v[S]})),l==="curlyBrackets"&&(b=b.replace(/\{([^\}]+)\}/g,function(E,S){return v[S]}))),b},c})();d.prototype.warn=r,d.prototype.reportError=p,i.implement(d.prototype,o),n.AppConfig=d}),ace.define("ace/theme/textmate-css",["require","exports","module"],function(t,n,f){f.exports=`.ace-tm .ace_gutter {
background: #f0f0f0;
color: #333;
}
.ace-tm .ace_print-margin {
width: 1px;
background: #e8e8e8;
}
.ace-tm .ace_fold {
background-color: #6B72E6;
}
.ace-tm {
background-color: #FFFFFF;
color: black;
}
.ace-tm .ace_cursor {
color: black;
}
.ace-tm .ace_invisible {
color: rgb(191, 191, 191);
}
.ace-tm .ace_storage,
.ace-tm .ace_keyword {
color: blue;
}
.ace-tm .ace_constant {
color: rgb(197, 6, 11);
}
.ace-tm .ace_constant.ace_buildin {
color: rgb(88, 72, 246);
}
.ace-tm .ace_constant.ace_language {
color: rgb(88, 92, 246);
}
.ace-tm .ace_constant.ace_library {
color: rgb(6, 150, 14);
}
.ace-tm .ace_invalid {
background-color: rgba(255, 0, 0, 0.1);
color: red;
}
.ace-tm .ace_support.ace_function {
color: rgb(60, 76, 114);
}
.ace-tm .ace_support.ace_constant {
color: rgb(6, 150, 14);
}
.ace-tm .ace_support.ace_type,
.ace-tm .ace_support.ace_class {
color: rgb(109, 121, 222);
}
.ace-tm .ace_keyword.ace_operator {
color: rgb(104, 118, 135);
}
.ace-tm .ace_string {
color: rgb(3, 106, 7);
}
.ace-tm .ace_comment {
color: rgb(76, 136, 107);
}
.ace-tm .ace_comment.ace_doc {
color: rgb(0, 102, 255);
}
.ace-tm .ace_comment.ace_doc.ace_tag {
color: rgb(128, 159, 191);
}
.ace-tm .ace_constant.ace_numeric {
color: rgb(0, 0, 205);
}
.ace-tm .ace_variable {
color: rgb(49, 132, 149);
}
.ace-tm .ace_xml-pe {
color: rgb(104, 104, 91);
}
.ace-tm .ace_entity.ace_name.ace_function {
color: #0000A2;
}
.ace-tm .ace_heading {
color: rgb(12, 7, 255);
}
.ace-tm .ace_list {
color:rgb(185, 6, 144);
}
.ace-tm .ace_meta.ace_tag {
color:rgb(0, 22, 142);
}
.ace-tm .ace_string.ace_regex {
color: rgb(255, 0, 0)
}
.ace-tm .ace_marker-layer .ace_selection {
background: rgb(181, 213, 255);
}
.ace-tm.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px white;
}
.ace-tm .ace_marker-layer .ace_step {
background: rgb(252, 255, 0);
}
.ace-tm .ace_marker-layer .ace_stack {
background: rgb(164, 229, 101);
}
.ace-tm .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid rgb(192, 192, 192);
}
.ace-tm .ace_marker-layer .ace_active-line {
background: rgba(0, 0, 0, 0.07);
}
.ace-tm .ace_gutter-active-line {
background-color : #dcdcdc;
}
.ace-tm .ace_marker-layer .ace_selected-word {
background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250);
}
.ace-tm .ace_indent-guide {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
}
.ace-tm .ace_indent-guide-active {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;
}
`}),ace.define("ace/theme/textmate",["require","exports","module","ace/theme/textmate-css","ace/lib/dom"],function(t,n,f){n.isDark=!1,n.cssClass="ace-tm",n.cssText=t("./textmate-css"),n.$id="ace/theme/textmate";var i=t("../lib/dom");i.importCssString(n.cssText,n.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(t,n,f){"no use strict";var i=t("./lib/lang"),o=t("./lib/net"),p=t("./lib/dom"),s=t("./lib/app_config").AppConfig;f.exports=n=new s;var u={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:"",suffix:".js",$moduleUrls:{},loadWorkerFromBlob:!0,sharedPopups:!1,useStrictCSP:null};n.get=function(d){if(!u.hasOwnProperty(d))throw new Error("Unknown config key: "+d);return u[d]},n.set=function(d,c){if(u.hasOwnProperty(d))u[d]=c;else if(this.setDefaultValue("",d,c)==!1)throw new Error("Unknown config key: "+d);d=="useStrictCSP"&&p.useStrictCSP(c)},n.all=function(){return i.copyObject(u)},n.$modes={},n.moduleUrl=function(d,c){if(u.$moduleUrls[d])return u.$moduleUrls[d];var m=d.split("/");c=c||m[m.length-2]||"";var g=c=="snippets"?"/":"-",v=m[m.length-1];if(c=="worker"&&g=="-"){var b=new RegExp("^"+c+"[\\-_]|[\\-_]"+c+"$","g");v=v.replace(b,"")}(!v||v==c)&&m.length>1&&(v=m[m.length-2]);var E=u[c+"Path"];return E==null?E=u.basePath:g=="/"&&(c=g=""),E&&E.slice(-1)!="/"&&(E+="/"),E+c+g+v+this.get("suffix")},n.setModuleUrl=function(d,c){return u.$moduleUrls[d]=c};var r=function(d,c){if(d==="ace/theme/textmate"||d==="./theme/textmate")return c(null,t("./theme/textmate"));if(a)return a(d,c);console.error("loader is not configured")},a;n.setLoader=function(d){a=d},n.dynamicModules=Object.create(null),n.$loading={},n.$loaded={},n.loadModule=function(d,c){var m;if(Array.isArray(d))var g=d[0],v=d[1];else if(typeof d=="string")var v=d;var b=function(E){if(E&&!n.$loading[v])return c&&c(E);if(n.$loading[v]||(n.$loading[v]=[]),n.$loading[v].push(c),!(n.$loading[v].length>1)){var S=function(){r(v,function(w,y){y&&(n.$loaded[v]=y),n._emit("load.module",{name:v,module:y});var D=n.$loading[v];n.$loading[v]=null,D.forEach(function($){$&&$(y)})})};if(!n.get("packaged"))return S();o.loadScript(n.moduleUrl(v,g),S),l()}};if(n.dynamicModules[v])n.dynamicModules[v]().then(function(E){E.default?b(E.default):b(E)});else{try{m=this.$require(v)}catch{}b(m||n.$loaded[v])}},n.$require=function(d){if(typeof f.require=="function"){var c="require";return f[c](d)}},n.setModuleLoader=function(d,c){n.dynamicModules[d]=c};var l=function(){!u.basePath&&!u.workerPath&&!u.modePath&&!u.themePath&&!Object.keys(u.$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"),l=function(){})};n.version="1.43.4"}),ace.define("ace/loader_build",["require","exports","module","ace/lib/fixoldbrowsers","ace/config"],function(t,n,f){t("./lib/fixoldbrowsers");var i=t("./config");i.setLoader(function(u,r){t([u],function(a){r(null,a)})});var o=(function(){return this||typeof window<"u"&&window})();f.exports=function(u){i.init=p,i.$require=t,u.require=t},p(!0);function p(u){if(!(!o||!o.document)){i.set("packaged",u||t.packaged||f.packaged||o.define&&(void 0).packaged);var r={},a="",l=document.currentScript||document._currentScript,d=l&&l.ownerDocument||document;l&&l.src&&(a=l.src.split(/[?#]/)[0].split("/").slice(0,-1).join("/")||"");for(var c=d.getElementsByTagName("script"),m=0;m<c.length;m++){var g=c[m],v=g.src||g.getAttribute("src");if(v){for(var b=g.attributes,E=0,S=b.length;E<S;E++){var w=b[E];w.name.indexOf("data-ace-")===0&&(r[s(w.name.replace(/^data-ace-/,""))]=w.value)}var y=v.match(/^(.*)\/ace([\-.]\w+)?\.js(\?|$)/);y&&(a=y[1])}}a&&(r.base=r.base||a,r.packaged=!0),r.basePath=r.base,r.workerPath=r.workerPath||r.base,r.modePath=r.modePath||r.base,r.themePath=r.themePath||r.base,delete r.base;for(var D in r)typeof r[D]<"u"&&i.set(D,r[D])}}function s(u){return u.replace(/-(.)/g,function(r,a){return a.toUpperCase()})}}),ace.define("ace/range",["require","exports","module"],function(t,n,f){var i=(function(){function o(p,s,u,r){this.start={row:p,column:s},this.end={row:u,column:r}}return o.prototype.isEqual=function(p){return this.start.row===p.start.row&&this.end.row===p.end.row&&this.start.column===p.start.column&&this.end.column===p.end.column},o.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},o.prototype.contains=function(p,s){return this.compare(p,s)==0},o.prototype.compareRange=function(p){var s,u=p.end,r=p.start;return s=this.compare(u.row,u.column),s==1?(s=this.compare(r.row,r.column),s==1?2:s==0?1:0):s==-1?-2:(s=this.compare(r.row,r.column),s==-1?-1:s==1?42:0)},o.prototype.comparePoint=function(p){return this.compare(p.row,p.column)},o.prototype.containsRange=function(p){return this.comparePoint(p.start)==0&&this.comparePoint(p.end)==0},o.prototype.intersects=function(p){var s=this.compareRange(p);return s==-1||s==0||s==1},o.prototype.isEnd=function(p,s){return this.end.row==p&&this.end.column==s},o.prototype.isStart=function(p,s){return this.start.row==p&&this.start.column==s},o.prototype.setStart=function(p,s){typeof p=="object"?(this.start.column=p.column,this.start.row=p.row):(this.start.row=p,this.start.column=s)},o.prototype.setEnd=function(p,s){typeof p=="object"?(this.end.column=p.column,this.end.row=p.row):(this.end.row=p,this.end.column=s)},o.prototype.inside=function(p,s){return this.compare(p,s)==0?!(this.isEnd(p,s)||this.isStart(p,s)):!1},o.prototype.insideStart=function(p,s){return this.compare(p,s)==0?!this.isEnd(p,s):!1},o.prototype.insideEnd=function(p,s){return this.compare(p,s)==0?!this.isStart(p,s):!1},o.prototype.compare=function(p,s){return!this.isMultiLine()&&p===this.start.row?s<this.start.column?-1:s>this.end.column?1:0:p<this.start.row?-1:p>this.end.row?1:this.start.row===p?s>=this.start.column?0:-1:this.end.row===p?s<=this.end.column?0:1:0},o.prototype.compareStart=function(p,s){return this.start.row==p&&this.start.column==s?-1:this.compare(p,s)},o.prototype.compareEnd=function(p,s){return this.end.row==p&&this.end.column==s?1:this.compare(p,s)},o.prototype.compareInside=function(p,s){return this.end.row==p&&this.end.column==s?1:this.start.row==p&&this.start.column==s?-1:this.compare(p,s)},o.prototype.clipRows=function(p,s){if(this.end.row>s)var u={row:s+1,column:0};else if(this.end.row<p)var u={row:p,column:0};if(this.start.row>s)var r={row:s+1,column:0};else if(this.start.row<p)var r={row:p,column:0};return o.fromPoints(r||this.start,u||this.end)},o.prototype.extend=function(p,s){var u=this.compare(p,s);if(u==0)return this;if(u==-1)var r={row:p,column:s};else var a={row:p,column:s};return o.fromPoints(r||this.start,a||this.end)},o.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},o.prototype.isMultiLine=function(){return this.start.row!==this.end.row},o.prototype.clone=function(){return o.fromPoints(this.start,this.end)},o.prototype.collapseRows=function(){return this.end.column==0?new o(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new o(this.start.row,0,this.end.row,0)},o.prototype.toScreenRange=function(p){var s=p.documentToScreenPosition(this.start),u=p.documentToScreenPosition(this.end);return new o(s.row,s.column,u.row,u.column)},o.prototype.moveBy=function(p,s){this.start.row+=p,this.start.column+=s,this.end.row+=p,this.end.column+=s},o})();i.fromPoints=function(o,p){return new i(o.row,o.column,p.row,p.column)},i.comparePoints=function(o,p){return o.row-p.row||o.column-p.column},n.Range=i}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(t,n,f){for(var i=t("./oop"),o={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:"*"}},p={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++)p["Digit"+s]=48+s,p["Numpad"+s]=96+s,o.PRINTABLE_KEYS[48+s]=""+s,o.FUNCTION_KEYS[96+s]="Numpad"+s;for(var s=65;s<91;s++){var u=String.fromCharCode(s+32);p["Key"+u.toUpperCase()]=s,o.PRINTABLE_KEYS[s]=u}for(var s=1;s<13;s++)p["F"+s]=111+s,o.FUNCTION_KEYS[111+s]="F"+s;var r={Shift:16,Control:17,Alt:18,Meta:224};for(var a in r)p[a]=p[a+"Left"]=p[a+"Right"]=r[a];n.$codeToKeyCode=p,o.PRINTABLE_KEYS[173]="-";for(var l in o.FUNCTION_KEYS){var d=o.FUNCTION_KEYS[l].toLowerCase();o[d]=parseInt(l,10)}for(var l in o.PRINTABLE_KEYS){var d=o.PRINTABLE_KEYS[l].toLowerCase();o[d]=parseInt(l,10)}i.mixin(o,o.MODIFIER_KEYS),i.mixin(o,o.PRINTABLE_KEYS),i.mixin(o,o.FUNCTION_KEYS),o.enter=o.return,o.escape=o.esc,o.del=o.delete,(function(){for(var c=["cmd","ctrl","alt","shift"],m=Math.pow(2,c.length);m--;)o.KEY_MODS[m]=c.filter(function(g){return m&o.KEY_MODS[g]}).join("-")+"-"})(),o.KEY_MODS[0]="",o.KEY_MODS[-1]="input-",i.mixin(n,o),n.default=n,n.keyCodeToString=function(c){var m=o[c];return typeof m!="string"&&(m=String.fromCharCode(c)),m.toLowerCase()}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(t,n,f){var i=t("./keys"),o=t("./useragent"),p=null,s=0,u;function r(){u=!1;try{document.createComment("").addEventListener("test",function(){},{get passive(){return u={passive:!1},!0}})}catch{}}function a(){return u==null&&r(),u}function l(E,S,w){this.elem=E,this.type=S,this.callback=w}l.prototype.destroy=function(){c(this.elem,this.type,this.callback),this.elem=this.type=this.callback=void 0};var d=n.addListener=function(E,S,w,y){E.addEventListener(S,w,a()),y&&y.$toDestroy.push(new l(E,S,w))},c=n.removeListener=function(E,S,w){E.removeEventListener(S,w,a())};n.stopEvent=function(E){return n.stopPropagation(E),n.preventDefault(E),!1},n.stopPropagation=function(E){E.stopPropagation&&E.stopPropagation()},n.preventDefault=function(E){E.preventDefault&&E.preventDefault()},n.getButton=function(E){return E.type=="dblclick"?0:E.type=="contextmenu"||o.isMac&&E.ctrlKey&&!E.altKey&&!E.shiftKey?2:E.button},n.capture=function(E,S,w){var y=E&&E.ownerDocument||document;function D($){S&&S($),w&&w($),c(y,"mousemove",S),c(y,"mouseup",D),c(y,"dragstart",D)}return d(y,"mousemove",S),d(y,"mouseup",D),d(y,"dragstart",D),D},n.addMouseWheelListener=function(E,S,w){d(E,"wheel",function(y){var D=.15,$=y.deltaX||0,A=y.deltaY||0;switch(y.deltaMode){case y.DOM_DELTA_PIXEL:y.wheelX=$*D,y.wheelY=A*D;break;case y.DOM_DELTA_LINE:var _=15;y.wheelX=$*_,y.wheelY=A*_;break;case y.DOM_DELTA_PAGE:var L=150;y.wheelX=$*L,y.wheelY=A*L;break}S(y)},w)},n.addMultiMouseDownListener=function(E,S,w,y,D){var $=0,A,_,L,T={2:"dblclick",3:"tripleclick",4:"quadclick"};function k(x){if(n.getButton(x)!==0?$=0:x.detail>1?($++,$>4&&($=1)):$=1,o.isIE){var C=Math.abs(x.clientX-A)>5||Math.abs(x.clientY-_)>5;(!L||C)&&($=1),L&&clearTimeout(L),L=setTimeout(function(){L=null},S[$-1]||600),$==1&&(A=x.clientX,_=x.clientY)}if(x._clicks=$,w[y]("mousedown",x),$>4)$=0;else if($>1)return w[y](T[$],x)}Array.isArray(E)||(E=[E]),E.forEach(function(x){d(x,"mousedown",k,D)})};function m(E){return 0|(E.ctrlKey?1:0)|(E.altKey?2:0)|(E.shiftKey?4:0)|(E.metaKey?8:0)}n.getModifierString=function(E){return i.KEY_MODS[m(E)]};function g(E,S,w){var y=m(S);if(!w&&S.code&&(w=i.$codeToKeyCode[S.code]||w),!o.isMac&&p){if(S.getModifierState&&(S.getModifierState("OS")||S.getModifierState("Win"))&&(y|=8),p.altGr)if((3&y)!=3)p.altGr=0;else return;if(w===18||w===17){var D=S.location;if(w===17&&D===1)p[w]==1&&(s=S.timeStamp);else if(w===18&&y===3&&D===2){var $=S.timeStamp-s;$<50&&(p.altGr=!0)}}}if(w in i.MODIFIER_KEYS&&(w=-1),!(!y&&w===13&&S.location===3&&(E(S,y,-w),S.defaultPrevented))){if(o.isChromeOS&&y&8){if(E(S,y,w),S.defaultPrevented)return;y&=-9}return!y&&!(w in i.FUNCTION_KEYS)&&!(w in i.PRINTABLE_KEYS)?!1:E(S,y,w)}}n.addCommandKeyListener=function(E,S,w){var y=null;d(E,"keydown",function(D){p[D.keyCode]=(p[D.keyCode]||0)+1;var $=g(S,D,D.keyCode);return y=D.defaultPrevented,$},w),d(E,"keypress",function(D){y&&(D.ctrlKey||D.altKey||D.shiftKey||D.metaKey)&&(n.stopEvent(D),y=null)},w),d(E,"keyup",function(D){p[D.keyCode]=null},w),p||(v(),d(window,"focus",v))};function v(){p=Object.create(null)}if(typeof window=="object"&&window.postMessage&&!o.isOldIE){var b=1;n.nextTick=function(E,S){S=S||window;var w="zero-timeout-message-"+b++,y=function(D){D.data==w&&(n.stopPropagation(D),c(S,"message",y),E())};d(S,"message",y),S.postMessage(w,"*")}}n.$idleBlocked=!1,n.onIdle=function(E,S){return setTimeout(function w(){n.$idleBlocked?setTimeout(w,100):E()},S)},n.$idleBlockId=null,n.blockIdle=function(E){n.$idleBlockId&&clearTimeout(n.$idleBlockId),n.$idleBlocked=!0,n.$idleBlockId=setTimeout(function(){n.$idleBlocked=!1},E||100)},n.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),n.nextFrame?n.nextFrame=n.nextFrame.bind(window):n.nextFrame=function(E){setTimeout(E,17)}}),ace.define("ace/clipboard",["require","exports","module"],function(t,n,f){var i;f.exports={lineMode:!1,pasteCancelled:function(){return i&&i>Date.now()-50?!0:i=!1},cancel:function(){i=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(t,n,f){var i=t("../lib/event"),o=t("../config").nls,p=t("../lib/useragent"),s=t("../lib/dom"),u=t("../lib/lang"),r=t("../clipboard"),a=p.isChrome<18,l=p.isIE,d=p.isChrome>63,c=400,m=t("../lib/keys"),g=m.KEY_MODS,v=p.isIOS,b=v?/\s/:/\n/,E=p.isMobile,S=(function(){function w(y,D){var $=this;this.host=D,this.text=s.createElement("textarea"),this.text.className="ace_text-input",this.text.setAttribute("wrap","off"),this.text.setAttribute("autocomplete","off"),this.text.setAttribute("autocorrect","off"),this.text.setAttribute("autocapitalize","off"),this.text.setAttribute("spellcheck","false"),this.text.style.opacity="0",y.insertBefore(this.text,y.firstChild),this.copied=!1,this.pasted=!1,this.inComposition=!1,this.sendingText=!1,this.tempStyle="",E||(this.text.style.fontSize="1px"),this.commandMode=!1,this.ignoreFocusEvents=!1,this.lastValue="",this.lastSelectionStart=0,this.lastSelectionEnd=0,this.lastRestoreEnd=0,this.rowStart=Number.MAX_SAFE_INTEGER,this.rowEnd=Number.MIN_SAFE_INTEGER,this.numberOfExtraLines=0;try{this.$isFocused=document.activeElement===this.text}catch{}this.cancelComposition=this.cancelComposition.bind(this),this.setAriaOptions({role:"textbox"}),i.addListener(this.text,"blur",function(A){$.ignoreFocusEvents||(D.onBlur(A),$.$isFocused=!1)},D),i.addListener(this.text,"focus",function(A){if(!$.ignoreFocusEvents){if($.$isFocused=!0,p.isEdge)try{if(!document.hasFocus())return}catch{}D.onFocus(A),p.isEdge?setTimeout($.resetSelection.bind($)):$.resetSelection()}},D),this.$focusScroll=!1,D.on("beforeEndOperation",function(){var A=D.curOp,_=A&&A.command&&A.command.name;if(_!="insertstring"){var L=_&&(A.docChanged||A.selectionChanged);$.inComposition&&L&&($.lastValue=$.text.value="",$.onCompositionEnd()),$.resetSelection()}}),D.on("changeSelection",this.setAriaLabel.bind(this)),this.resetSelection=v?this.$resetSelectionIOS:this.$resetSelection,this.$isFocused&&D.onFocus(),this.inputHandler=null,this.afterContextMenu=!1,i.addCommandKeyListener(this.text,function(A,_,L){if(!$.inComposition)return D.onCommandKey(A,_,L)},D),i.addListener(this.text,"select",this.onSelect.bind(this),D),i.addListener(this.text,"input",this.onInput.bind(this),D),i.addListener(this.text,"cut",this.onCut.bind(this),D),i.addListener(this.text,"copy",this.onCopy.bind(this),D),i.addListener(this.text,"paste",this.onPaste.bind(this),D),(!("oncut"in this.text)||!("oncopy"in this.text)||!("onpaste"in this.text))&&i.addListener(y,"keydown",function(A){if(!(p.isMac&&!A.metaKey||!A.ctrlKey))switch(A.keyCode){case 67:$.onCopy(A);break;case 86:$.onPaste(A);break;case 88:$.onCut(A);break}},D),this.syncComposition=u.delayedCall(this.onCompositionUpdate.bind(this),50).schedule.bind(null,null),i.addListener(this.text,"compositionstart",this.onCompositionStart.bind(this),D),i.addListener(this.text,"compositionupdate",this.onCompositionUpdate.bind(this),D),i.addListener(this.text,"keyup",this.onKeyup.bind(this),D),i.addListener(this.text,"keydown",this.syncComposition.bind(this),D),i.addListener(this.text,"compositionend",this.onCompositionEnd.bind(this),D),this.closeTimeout,i.addListener(this.text,"mouseup",this.$onContextMenu.bind(this),D),i.addListener(this.text,"mousedown",function(A){A.preventDefault(),$.onContextMenuClose()},D),i.addListener(D.renderer.scroller,"contextmenu",this.$onContextMenu.bind(this),D),i.addListener(this.text,"contextmenu",this.$onContextMenu.bind(this),D),v&&this.addIosSelectionHandler(y,D,this.text)}return w.prototype.addIosSelectionHandler=function(y,D,$){var A=this,_=null,L=!1;$.addEventListener("keydown",function(k){_&&clearTimeout(_),L=!0},!0),$.addEventListener("keyup",function(k){_=setTimeout(function(){L=!1},100)},!0);var T=function(k){if(document.activeElement===$&&!(L||A.inComposition||D.$mouseHandler.isMousePressed)&&!A.copied){var x=$.selectionStart,C=$.selectionEnd,M=null,F=0;if(x==0?M=m.up:x==1?M=m.home:C>A.lastSelectionEnd&&A.lastValue[C]==`
`?M=m.end:x<A.lastSelectionStart&&A.lastValue[x-1]==" "?(M=m.left,F=g.option):x<A.lastSelectionStart||x==A.lastSelectionStart&&A.lastSelectionEnd!=A.lastSelectionStart&&x==C?M=m.left:C>A.lastSelectionEnd&&A.lastValue.slice(0,C).split(`
`).length>2?M=m.down:C>A.lastSelectionEnd&&A.lastValue[C-1]==" "?(M=m.right,F=g.option):(C>A.lastSelectionEnd||C==A.lastSelectionEnd&&A.lastSelectionEnd!=A.lastSelectionStart&&x==C)&&(M=m.right),x!==C&&(F|=g.shift),M){var R=D.onCommandKey({},F,M);if(!R&&D.commands){M=m.keyCodeToString(M);var O=D.commands.findKeyCommand(F,M);O&&D.execCommand(O)}A.lastSelectionStart=x,A.lastSelectionEnd=C,A.resetSelection("")}}};document.addEventListener("selectionchange",T),D.on("destroy",function(){document.removeEventListener("selectionchange",T)})},w.prototype.onContextMenuClose=function(){var y=this;clearTimeout(this.closeTimeout),this.closeTimeout=setTimeout(function(){y.tempStyle&&(y.text.style.cssText=y.tempStyle,y.tempStyle=""),y.host.renderer.$isMousePressed=!1,y.host.renderer.$keepTextAreaAtCursor&&y.host.renderer.$moveTextAreaToCursor()},0)},w.prototype.$onContextMenu=function(y){this.host.textInput.onContextMenu(y),this.onContextMenuClose()},w.prototype.onKeyup=function(y){y.keyCode==27&&this.text.value.length<this.text.selectionStart&&(this.inComposition||(this.lastValue=this.text.value),this.lastSelectionStart=this.lastSelectionEnd=-1,this.resetSelection()),this.syncComposition()},w.prototype.cancelComposition=function(){this.ignoreFocusEvents=!0,this.text.blur(),this.text.focus(),this.ignoreFocusEvents=!1},w.prototype.onCompositionStart=function(y){if(!(this.inComposition||!this.host.onCompositionStart||this.host.$readOnly)&&(this.inComposition={},!this.commandMode)){y.data&&(this.inComposition.useTextareaForIME=!1),setTimeout(this.onCompositionUpdate.bind(this),0),this.host._signal("compositionStart"),this.host.on("mousedown",this.cancelComposition);var D=this.host.getSelectionRange();D.end.row=D.start.row,D.end.column=D.start.column,this.inComposition.markerRange=D,this.inComposition.selectionStart=this.lastSelectionStart,this.host.onCompositionStart(this.inComposition),this.inComposition.useTextareaForIME?(this.lastValue=this.text.value="",this.lastSelectionStart=0,this.lastSelectionEnd=0):(this.text.msGetInputContext&&(this.inComposition.context=this.text.msGetInputContext()),this.text.getInputContext&&(this.inComposition.context=this.text.getInputContext()))}},w.prototype.onCompositionUpdate=function(){if(!(!this.inComposition||!this.host.onCompositionUpdate||this.host.$readOnly)){if(this.commandMode)return this.cancelComposition();if(this.inComposition.useTextareaForIME)this.host.onCompositionUpdate(this.text.value);else{var y=this.text.value;this.sendText(y),this.inComposition.markerRange&&(this.inComposition.context&&(this.inComposition.markerRange.start.column=this.inComposition.selectionStart=this.inComposition.context.compositionStartOffset),this.inComposition.markerRange.end.column=this.inComposition.markerRange.start.column+this.lastSelectionEnd-this.inComposition.selectionStart+this.lastRestoreEnd)}}},w.prototype.onCompositionEnd=function(y){!this.host.onCompositionEnd||this.host.$readOnly||(this.inComposition=!1,this.host.onCompositionEnd(),this.host.off("mousedown",this.cancelComposition),y&&this.onInput())},w.prototype.onCut=function(y){this.doCopy(y,!0)},w.prototype.onCopy=function(y){this.doCopy(y,!1)},w.prototype.onPaste=function(y){var D=this.handleClipboardData(y);r.pasteCancelled()||(typeof D=="string"?(D&&this.host.onPaste(D,y),p.isIE&&setTimeout(this.resetSelection),i.preventDefault(y)):(this.text.value="",this.pasted=!0))},w.prototype.doCopy=function(y,D){var $=this,A=this.host.getCopyText();if(!A)return i.preventDefault(y);this.handleClipboardData(y,A)?(v&&(this.resetSelection(A),this.copied=A,setTimeout(function(){$.copied=!1},10)),D?this.host.onCut():this.host.onCopy(),i.preventDefault(y)):(this.copied=!0,this.text.value=A,this.text.select(),setTimeout(function(){$.copied=!1,$.resetSelection(),D?$.host.onCut():$.host.onCopy()}))},w.prototype.handleClipboardData=function(y,D,$){var A=y.clipboardData||window.clipboardData;if(!(!A||a)){var _=l||$?"Text":"text/plain";try{return D?A.setData(_,D)!==!1:A.getData(_)}catch(L){if(!$)return this.handleClipboardData(L,D,!0)}}},w.prototype.onInput=function(y){if(this.inComposition)return this.onCompositionUpdate();if(y&&y.inputType){if(y.inputType=="historyUndo")return this.host.execCommand("undo");if(y.inputType=="historyRedo")return this.host.execCommand("redo")}var D=this.text.value,$=this.sendText(D,!0);(D.length>c+100||b.test($)||E&&this.lastSelectionStart<1&&this.lastSelectionStart==this.lastSelectionEnd)&&this.resetSelection()},w.prototype.sendText=function(y,D){if(this.afterContextMenu&&(this.afterContextMenu=!1),this.pasted)return this.resetSelection(),y&&this.host.onPaste(y),this.pasted=!1,"";for(var $=this.text.selectionStart,A=this.text.selectionEnd,_=this.lastSelectionStart,L=this.lastValue.length-this.lastSelectionEnd,T=y,k=y.length-$,x=y.length-A,C=0;_>0&&this.lastValue[C]==y[C];)C++,_--;for(T=T.slice(C),C=1;L>0&&this.lastValue.length-C>this.lastSelectionStart-1&&this.lastValue[this.lastValue.length-C]==y[y.length-C];)C++,L--;k-=C-1,x-=C-1;var M=T.length-C+1;if(M<0&&(_=-M,M=0),T=T.slice(0,M),!D&&!T&&!k&&!_&&!L&&!x)return"";this.sendingText=!0;var F=!1;return p.isAndroid&&T==". "&&(T=" ",F=!0),T&&!_&&!L&&!k&&!x||this.commandMode?this.host.onTextInput(T):this.host.onTextInput(T,{extendLeft:_,extendRight:L,restoreStart:k,restoreEnd:x}),this.sendingText=!1,this.lastValue=y,this.lastSelectionStart=$,this.lastSelectionEnd=A,this.lastRestoreEnd=x,F?`
`:T},w.prototype.onSelect=function(y){var D=this;if(!this.inComposition){var $=function(A){return A.selectionStart===0&&A.selectionEnd>=D.lastValue.length&&A.value===D.lastValue&&D.lastValue&&A.selectionEnd!==D.lastSelectionEnd};this.copied?this.copied=!1:$(this.text)?(this.host.selectAll(),this.resetSelection()):E&&this.text.selectionStart!=this.lastSelectionStart&&this.resetSelection()}},w.prototype.$resetSelectionIOS=function(y){if(!(!this.$isFocused||this.copied&&!y||this.sendingText)){y||(y="");var D=`
ab`+y+`cde fg
`;D!=this.text.value&&(this.text.value=this.lastValue=D);var $=4,A=4+(y.length||(this.host.selection.isEmpty()?0:1));(this.lastSelectionStart!=$||this.lastSelectionEnd!=A)&&this.text.setSelectionRange($,A),this.lastSelectionStart=$,this.lastSelectionEnd=A}},w.prototype.$resetSelection=function(){var y=this;if(!(this.inComposition||this.sendingText)&&!(!this.$isFocused&&!this.afterContextMenu)){this.inComposition=!0;var D=0,$=0,A="",_=function(O,B){for(var N=B,j=1;j<=O-y.rowStart&&j<2*y.numberOfExtraLines+1;j++)N+=y.host.session.getLine(O-j).length+1;return N};if(this.host.session){var L=this.host.selection,T=L.getRange(),k=L.cursor.row;k===this.rowEnd+1?(this.rowStart=this.rowEnd+1,this.rowEnd=this.rowStart+2*this.numberOfExtraLines):k===this.rowStart-1?(this.rowEnd=this.rowStart-1,this.rowStart=this.rowEnd-2*this.numberOfExtraLines):(k<this.rowStart-1||k>this.rowEnd+1)&&(this.rowStart=k>this.numberOfExtraLines?k-this.numberOfExtraLines:0,this.rowEnd=k>this.numberOfExtraLines?k+this.numberOfExtraLines:2*this.numberOfExtraLines);for(var x=[],C=this.rowStart;C<=this.rowEnd;C++)x.push(this.host.session.getLine(C));if(A=x.join(`
`),D=_(T.start.row,T.start.column),$=_(T.end.row,T.end.column),T.start.row<this.rowStart){var M=this.host.session.getLine(this.rowStart-1);D=T.start.row<this.rowStart-1?0:D,$+=M.length+1,A=M+`
`+A}else if(T.end.row>this.rowEnd){var F=this.host.session.getLine(this.rowEnd+1);$=T.end.row>this.rowEnd+1?F.length:T.end.column,$+=A.length+1,A=A+`
`+F}else E&&k>0&&(A=`
`+A,$+=1,D+=1);A.length>c&&(D<c&&$<c?A=A.slice(0,c):(A=`
`,D==$?D=$=0:(D=0,$=1)));var R=A+`
`;R!=this.lastValue&&(this.text.value=this.lastValue=R,this.lastSelectionStart=this.lastSelectionEnd=R.length)}if(this.afterContextMenu&&(this.lastSelectionStart=this.text.selectionStart,this.lastSelectionEnd=this.text.selectionEnd),this.lastSelectionEnd!=$||this.lastSelectionStart!=D||this.text.selectionEnd!=this.lastSelectionEnd)try{this.text.setSelectionRange(D,$),this.lastSelectionStart=D,this.lastSelectionEnd=$}catch{}this.inComposition=!1}},w.prototype.setHost=function(y){this.host=y},w.prototype.setNumberOfExtraLines=function(y){if(this.rowStart=Number.MAX_SAFE_INTEGER,this.rowEnd=Number.MIN_SAFE_INTEGER,y<0){this.numberOfExtraLines=0;return}this.numberOfExtraLines=y},w.prototype.setAriaLabel=function(){var y="";if(this.host.$textInputAriaLabel&&(y+="".concat(this.host.$textInputAriaLabel,", ")),this.host.session){var D=this.host.session.selection.cursor.row;y+=o("text-input.aria-label","Cursor at row $0",[D+1])}this.text.setAttribute("aria-label",y)},w.prototype.setAriaOptions=function(y){y.activeDescendant?(this.text.setAttribute("aria-haspopup","true"),this.text.setAttribute("aria-autocomplete",y.inline?"both":"list"),this.text.setAttribute("aria-activedescendant",y.activeDescendant)):(this.text.setAttribute("aria-haspopup","false"),this.text.setAttribute("aria-autocomplete","both"),this.text.removeAttribute("aria-activedescendant")),y.role&&this.text.setAttribute("role",y.role),y.setLabel&&(this.text.setAttribute("aria-roledescription",o("text-input.aria-roledescription","editor")),this.setAriaLabel())},w.prototype.focus=function(){var y=this;if(this.setAriaOptions({setLabel:this.host.renderer.enableKeyboardAccessibility}),this.tempStyle||d||this.$focusScroll=="browser")return this.text.focus({preventScroll:!0});var D=this.text.style.top;this.text.style.position="fixed",this.text.style.top="0px";try{var $=this.text.getBoundingClientRect().top!=0}catch{return}var A=[];if($)for(var _=this.text.parentElement;_&&_.nodeType==1;)A.push(_),_.setAttribute("ace_nocontext","true"),!_.parentElement&&_.getRootNode?_=_.getRootNode().host:_=_.parentElement;this.text.focus({preventScroll:!0}),$&&A.forEach(function(L){L.removeAttribute("ace_nocontext")}),setTimeout(function(){y.text.style.position="",y.text.style.top=="0px"&&(y.text.style.top=D)},0)},w.prototype.blur=function(){this.text.blur()},w.prototype.isFocused=function(){return this.$isFocused},w.prototype.setInputHandler=function(y){this.inputHandler=y},w.prototype.getInputHandler=function(){return this.inputHandler},w.prototype.getElement=function(){return this.text},w.prototype.setCommandMode=function(y){this.commandMode=y,this.text.readOnly=!1},w.prototype.setReadOnly=function(y){this.commandMode||(this.text.readOnly=y)},w.prototype.setCopyWithEmptySelection=function(y){},w.prototype.onContextMenu=function(y){this.afterContextMenu=!0,this.resetSelection(),this.host._emit("nativecontextmenu",{target:this.host,domEvent:y}),this.moveToMouse(y,!0)},w.prototype.moveToMouse=function(y,D){var $=this;this.tempStyle||(this.tempStyle=this.text.style.cssText),this.text.style.cssText=(D?"z-index:100000;":"")+(p.isIE?"opacity:0.1;":"")+"text-indent: -"+(this.lastSelectionStart+this.lastSelectionEnd)*this.host.renderer.characterWidth*.5+"px;";var A=this.host.container.getBoundingClientRect(),_=s.computedStyle(this.host.container),L=A.top+(parseInt(_.borderTopWidth)||0),T=A.left+(parseInt(_.borderLeftWidth)||0),k=A.bottom-L-this.text.clientHeight-2,x=function(C){s.translate($.text,C.clientX-T-2,Math.min(C.clientY-L-2,k))};x(y),y.type=="mousedown"&&(this.host.renderer.$isMousePressed=!0,clearTimeout(this.closeTimeout),p.isWin&&i.capture(this.host.container,x,this.onContextMenuClose.bind(this)))},w.prototype.destroy=function(){this.text.parentElement&&this.text.parentElement.removeChild(this.text)},w})();n.TextInput=S,n.$setUserAgentForTests=function(w,y){E=w,v=y}}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(t,n,f){var i=t("../lib/useragent"),o=0,p=550,s=(function(){function a(l){l.$clickSelection=null;var d=l.editor;d.setDefaultHandler("mousedown",this.onMouseDown.bind(l)),d.setDefaultHandler("dblclick",this.onDoubleClick.bind(l)),d.setDefaultHandler("tripleclick",this.onTripleClick.bind(l)),d.setDefaultHandler("quadclick",this.onQuadClick.bind(l)),d.setDefaultHandler("mousewheel",this.onMouseWheel.bind(l));var c=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];c.forEach(function(m){l[m]=this[m]},this),l.selectByLines=this.extendSelectionBy.bind(l,"getLineRange"),l.selectByWords=this.extendSelectionBy.bind(l,"getWordRange")}return a.prototype.onMouseDown=function(l){var d=l.inSelection(),c=l.getDocumentPosition();this.mousedownEvent=l;var m=this.editor,g=l.getButton();if(g!==0){var v=m.getSelectionRange(),b=v.isEmpty();(b||g==1)&&m.selection.moveToPosition(c),g==2&&(m.textInput.onContextMenu(l.domEvent),i.isMozilla||l.preventDefault());return}if(this.mousedownEvent.time=Date.now(),d&&!m.isFocused()&&(m.focus(),this.$focusTimeout&&!this.$clickSelection&&!m.inMultiSelectMode)){this.setState("focusWait"),this.captureMouse(l);return}return this.captureMouse(l),this.startSelect(c,l.domEvent._clicks>1),l.preventDefault()},a.prototype.startSelect=function(l,d){l=l||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var c=this.editor;this.mousedownEvent&&(this.mousedownEvent.getShiftKey()?c.selection.selectToPosition(l):d||c.selection.moveToPosition(l),d||this.select(),c.setStyle("ace_selecting"),this.setState("select"))},a.prototype.select=function(){var l,d=this.editor,c=d.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var m=this.$clickSelection.comparePoint(c);if(m==-1)l=this.$clickSelection.end;else if(m==1)l=this.$clickSelection.start;else{var g=r(this.$clickSelection,c,d.session);c=g.cursor,l=g.anchor}d.selection.setSelectionAnchor(l.row,l.column)}d.selection.selectToPosition(c),d.renderer.scrollCursorIntoView()},a.prototype.extendSelectionBy=function(l){var d,c=this.editor,m=c.renderer.screenToTextCoordinates(this.x,this.y),g=c.selection[l](m.row,m.column);if(this.$clickSelection){var v=this.$clickSelection.comparePoint(g.start),b=this.$clickSelection.comparePoint(g.end);if(v==-1&&b<=0)d=this.$clickSelection.end,(g.end.row!=m.row||g.end.column!=m.column)&&(m=g.start);else if(b==1&&v>=0)d=this.$clickSelection.start,(g.start.row!=m.row||g.start.column!=m.column)&&(m=g.end);else if(v==-1&&b==1)m=g.end,d=g.start;else{var E=r(this.$clickSelection,m,c.session);m=E.cursor,d=E.anchor}c.selection.setSelectionAnchor(d.row,d.column)}c.selection.selectToPosition(m),c.renderer.scrollCursorIntoView()},a.prototype.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting")},a.prototype.focusWait=function(){var l=u(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),d=Date.now();(l>o||d-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},a.prototype.onDoubleClick=function(l){var d=l.getDocumentPosition(),c=this.editor,m=c.session,g=m.getBracketRange(d);g?(g.isEmpty()&&(g.start.column--,g.end.column++),this.setState("select")):(g=c.selection.getWordRange(d.row,d.column),this.setState("selectByWords")),this.$clickSelection=g,this.select()},a.prototype.onTripleClick=function(l){var d=l.getDocumentPosition(),c=this.editor;this.setState("selectByLines");var m=c.getSelectionRange();m.isMultiLine()&&m.contains(d.row,d.column)?(this.$clickSelection=c.selection.getLineRange(m.start.row),this.$clickSelection.end=c.selection.getLineRange(m.end.row).end):this.$clickSelection=c.selection.getLineRange(d.row),this.select()},a.prototype.onQuadClick=function(l){var d=this.editor;d.selectAll(),this.$clickSelection=d.getSelectionRange(),this.setState("selectAll")},a.prototype.onMouseWheel=function(l){if(!l.getAccelKey()){l.getShiftKey()&&l.wheelY&&!l.wheelX&&(l.wheelX=l.wheelY,l.wheelY=0);var d=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var c=this.$lastScroll,m=l.domEvent.timeStamp,g=m-c.t,v=g?l.wheelX/g:c.vx,b=g?l.wheelY/g:c.vy;g<p&&(v=(v+c.vx)/2,b=(b+c.vy)/2);var E=Math.abs(v/b),S=!1;if(E>=1&&d.renderer.isScrollableBy(l.wheelX*l.speed,0)&&(S=!0),E<=1&&d.renderer.isScrollableBy(0,l.wheelY*l.speed)&&(S=!0),S)c.allowed=m;else if(m-c.allowed<p){var w=Math.abs(v)<=1.5*Math.abs(c.vx)&&Math.abs(b)<=1.5*Math.abs(c.vy);w?(S=!0,c.allowed=m):c.allowed=0}if(c.t=m,c.vx=v,c.vy=b,S)return d.renderer.scrollBy(l.wheelX*l.speed,l.wheelY*l.speed),l.stop()}},a})();s.prototype.selectEnd=s.prototype.selectByLinesEnd,s.prototype.selectAllEnd=s.prototype.selectByLinesEnd,s.prototype.selectByWordsEnd=s.prototype.selectByLinesEnd,n.DefaultHandlers=s;function u(a,l,d,c){return Math.sqrt(Math.pow(d-a,2)+Math.pow(c-l,2))}function r(a,l,d){if(a.start.row==a.end.row)var c=2*l.column-a.start.column-a.end.column;else if(a.start.row==a.end.row-1&&!a.start.column&&!a.end.column)var c=3*l.column-2*d.getLine(a.start.row).length;else var c=2*l.row-a.start.row-a.end.row;return c<0?{cursor:a.start,anchor:a.end}:{cursor:a.end,anchor:a.start}}}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(t,n,f){var i=t("../lib/event"),o=t("../lib/useragent"),p=(function(){function s(u,r){this.speed,this.wheelX,this.wheelY,this.domEvent=u,this.editor=r,this.x=this.clientX=u.clientX,this.y=this.clientY=u.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1}return s.prototype.stopPropagation=function(){i.stopPropagation(this.domEvent),this.propagationStopped=!0},s.prototype.preventDefault=function(){i.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 u=this.getDocumentPosition().row,r=this.editor.session.documentToScreenRow(u,0),a=this.editor.session.documentToScreenRow(this.editor.renderer.$gutterLayer.$lines.get(0).row,0);return r-a},s.prototype.inSelection=function(){if(this.$inSelection!==null)return this.$inSelection;var u=this.editor,r=u.getSelectionRange();if(r.isEmpty())this.$inSelection=!1;else{var a=this.getDocumentPosition();this.$inSelection=r.contains(a.row,a.column)}return this.$inSelection},s.prototype.getButton=function(){return i.getButton(this.domEvent)},s.prototype.getShiftKey=function(){return this.domEvent.shiftKey},s.prototype.getAccelKey=function(){return o.isMac?this.domEvent.metaKey:this.domEvent.ctrlKey},s})();n.MouseEvent=p}),ace.define("ace/lib/scroll",["require","exports","module"],function(t,n,f){n.preventParentScroll=function(o){o.stopPropagation();var p=o.currentTarget,s=p.scrollHeight>p.clientHeight;s||o.preventDefault()}}),ace.define("ace/tooltip",["require","exports","module","ace/lib/dom","ace/lib/event","ace/range","ace/lib/scroll"],function(t,n,f){var i=this&&this.__extends||(function(){var m=function(g,v){return m=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,E){b.__proto__=E}||function(b,E){for(var S in E)Object.prototype.hasOwnProperty.call(E,S)&&(b[S]=E[S])},m(g,v)};return function(g,v){if(typeof v!="function"&&v!==null)throw new TypeError("Class extends value "+String(v)+" is not a constructor or null");m(g,v);function b(){this.constructor=g}g.prototype=v===null?Object.create(v):(b.prototype=v.prototype,new b)}})(),o=this&&this.__values||function(m){var g=typeof Symbol=="function"&&Symbol.iterator,v=g&&m[g],b=0;if(v)return v.call(m);if(m&&typeof m.length=="number")return{next:function(){return m&&b>=m.length&&(m=void 0),{value:m&&m[b++],done:!m}}};throw new TypeError(g?"Object is not iterable.":"Symbol.iterator is not defined.")},p=t("./lib/dom");t("./lib/event");var s=t("./range").Range,u=t("./lib/scroll").preventParentScroll,r="ace_tooltip",a=(function(){function m(g){this.isOpen=!1,this.$element=null,this.$parentNode=g}return m.prototype.$init=function(){return this.$element=p.createElement("div"),this.$element.className=r,this.$element.style.display="none",this.$parentNode.appendChild(this.$element),this.$element},m.prototype.getElement=function(){return this.$element||this.$init()},m.prototype.setText=function(g){this.getElement().textContent=g},m.prototype.setHtml=function(g){this.getElement().innerHTML=g},m.prototype.setPosition=function(g,v){this.getElement().style.left=g+"px",this.getElement().style.top=v+"px"},m.prototype.setClassName=function(g){p.addCssClass(this.getElement(),g)},m.prototype.setTheme=function(g){this.theme&&(this.theme.isDark&&p.removeCssClass(this.getElement(),"ace_dark"),this.theme.cssClass&&p.removeCssClass(this.getElement(),this.theme.cssClass)),g.isDark&&p.addCssClass(this.getElement(),"ace_dark"),g.cssClass&&p.addCssClass(this.getElement(),g.cssClass),this.theme={isDark:g.isDark,cssClass:g.cssClass}},m.prototype.show=function(g,v,b){g!=null&&this.setText(g),v!=null&&b!=null&&this.setPosition(v,b),this.isOpen||(this.getElement().style.display="block",this.isOpen=!0)},m.prototype.hide=function(g){this.isOpen&&(this.getElement().style.display="none",this.getElement().className=r,this.isOpen=!1)},m.prototype.getHeight=function(){return this.getElement().offsetHeight},m.prototype.getWidth=function(){return this.getElement().offsetWidth},m.prototype.destroy=function(){this.isOpen=!1,this.$element&&this.$element.parentNode&&this.$element.parentNode.removeChild(this.$element)},m})(),l=(function(){function m(){this.popups=[]}return m.prototype.addPopup=function(g){this.popups.push(g),this.updatePopups()},m.prototype.removePopup=function(g){var v=this.popups.indexOf(g);v!==-1&&(this.popups.splice(v,1),this.updatePopups())},m.prototype.updatePopups=function(){var g,v,b,E;this.popups.sort(function(T,k){return k.priority-T.priority});var S=[];try{for(var w=o(this.popups),y=w.next();!y.done;y=w.next()){var D=y.value,$=!0;try{for(var A=(b=void 0,o(S)),_=A.next();!_.done;_=A.next()){var L=_.value;if(this.doPopupsOverlap(L,D)){$=!1;break}}}catch(T){b={error:T}}finally{try{_&&!_.done&&(E=A.return)&&E.call(A)}finally{if(b)throw b.error}}$?S.push(D):D.hide()}}catch(T){g={error:T}}finally{try{y&&!y.done&&(v=w.return)&&v.call(w)}finally{if(g)throw g.error}}},m.prototype.doPopupsOverlap=function(g,v){var b=g.getElement().getBoundingClientRect(),E=v.getElement().getBoundingClientRect();return b.left<E.right&&b.right>E.left&&b.top<E.bottom&&b.bottom>E.top},m})(),d=new l;n.popupManager=d,n.Tooltip=a;var c=(function(m){i(g,m);function g(v){v===void 0&&(v=document.body);var b=m.call(this,v)||this;b.timeout=void 0,b.lastT=0,b.idleTime=350,b.lastEvent=void 0,b.onMouseOut=b.onMouseOut.bind(b),b.onMouseMove=b.onMouseMove.bind(b),b.waitForHover=b.waitForHover.bind(b),b.hide=b.hide.bind(b);var E=b.getElement();return E.style.whiteSpace="pre-wrap",E.style.pointerEvents="auto",E.addEventListener("mouseout",b.onMouseOut),E.tabIndex=-1,E.addEventListener("blur",function(){E.contains(document.activeElement)||this.hide()}.bind(b)),E.addEventListener("wheel",u),b}return g.prototype.addToEditor=function(v){v.on("mousemove",this.onMouseMove),v.on("mousedown",this.hide);var b=v.renderer.getMouseEventTarget();b&&typeof b.removeEventListener=="function"&&b.addEventListener("mouseout",this.onMouseOut,!0)},g.prototype.removeFromEditor=function(v){v.off("mousemove",this.onMouseMove),v.off("mousedown",this.hide);var b=v.renderer.getMouseEventTarget();b&&typeof b.removeEventListener=="function"&&b.removeEventListener("mouseout",this.onMouseOut,!0),this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},g.prototype.onMouseMove=function(v,b){this.lastEvent=v,this.lastT=Date.now();var E=b.$mouseHandler.isMousePressed;if(this.isOpen){var S=this.lastEvent&&this.lastEvent.getDocumentPosition();(!this.range||!this.range.contains(S.row,S.column)||E||this.isOutsideOfText(this.lastEvent))&&this.hide()}this.timeout||E||(this.lastEvent=v,this.timeout=setTimeout(this.waitForHover,this.idleTime))},g.prototype.waitForHover=function(){this.timeout&&clearTimeout(this.timeout);var v=Date.now()-this.lastT;if(this.idleTime-v>10){this.timeout=setTimeout(this.waitForHover,this.idleTime-v);return}this.timeout=null,this.lastEvent&&!this.isOutsideOfText(this.lastEvent)&&this.$gatherData(this.lastEvent,this.lastEvent.editor)},g.prototype.isOutsideOfText=function(v){var b=v.editor,E=v.getDocumentPosition(),S=b.session.getLine(E.row);if(E.column==S.length){var w=b.renderer.pixelToScreenCoordinates(v.clientX,v.clientY),y=b.session.documentToScreenPosition(E.row,E.column);if(y.column!=w.column||y.row!=w.row)return!0}return!1},g.prototype.setDataProvider=function(v){this.$gatherData=v},g.prototype.showForRange=function(v,b,E,S){if(!(S&&S!=this.lastEvent)&&!(this.isOpen&&document.activeElement==this.getElement())){var w=v.renderer;this.isOpen||(d.addPopup(this),this.$registerCloseEvents(),this.setTheme(w.theme)),this.isOpen=!0,this.range=s.fromPoints(b.start,b.end);var y=w.textToScreenCoordinates(b.start.row,b.start.column),D=w.scroller.getBoundingClientRect();y.pageX<D.left&&(y.pageX=D.left);var $=this.getElement();$.innerHTML="",$.appendChild(E),$.style.maxHeight="",$.style.display="block",this.$setPosition(v,y,!0,b),p.$fixPositionBug($)}},g.prototype.$setPosition=function(v,b,E,S){var w=10;E&&this.addMarker(S,v.session);var y=v.renderer,D=this.getElement(),$=D.offsetHeight,A=D.offsetWidth,_=b.pageY,L=b.pageX,T=window.innerHeight-_-y.lineHeight,k=this.$shouldPlaceAbove($,_,T-w);D.style.maxHeight=(k?_:T)-w+"px",D.style.top=k?"":_+y.lineHeight+"px",D.style.bottom=k?window.innerHeight-_+"px":"",D.style.left=Math.min(L,window.innerWidth-A-w)+"px"},g.prototype.$shouldPlaceAbove=function(v,b,E){return!(b-v<0&&b<E)},g.prototype.addMarker=function(v,b){this.marker&&this.$markerSession.removeMarker(this.marker),this.$markerSession=b,this.marker=b&&b.addMarker(v,"ace_highlight-marker","text")},g.prototype.hide=function(v){v&&this.$fromKeyboard&&v.type=="keydown"&&v.code=="Escape"||!v&&document.activeElement==this.getElement()||v&&v.target&&(v.type!="keydown"||v.ctrlKey||v.metaKey)&&this.$element.contains(v.target)||(this.lastEvent=null,this.timeout&&clearTimeout(this.timeout),this.timeout=null,this.addMarker(null),this.isOpen&&(this.$fromKeyboard=!1,this.$removeCloseEvents(),this.getElement().style.display="none",this.isOpen=!1,d.removePopup(this)))},g.prototype.$registerCloseEvents=function(){window.addEventListener("keydown",this.hide,!0),window.addEventListener("wheel",this.hide,!0),window.addEventListener("mousedown",this.hide,!0)},g.prototype.$removeCloseEvents=function(){window.removeEventListener("keydown",this.hide,!0),window.removeEventListener("wheel",this.hide,!0),window.removeEventListener("mousedown",this.hide,!0)},g.prototype.onMouseOut=function(v){this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.lastEvent=null,this.isOpen&&(!v.relatedTarget||this.getElement().contains(v.relatedTarget)||v&&v.currentTarget.contains(v.relatedTarget)||v.relatedTarget.classList.contains("ace_content")||this.hide())},g})(a);n.HoverTooltip=c}),ace.define("ace/mouse/default_gutter_handler",["require","exports","module","ace/lib/dom","ace/mouse/mouse_event","ace/tooltip","ace/config","ace/range"],function(t,n,f){var i=this&&this.__extends||(function(){var c=function(m,g){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,b){v.__proto__=b}||function(v,b){for(var E in b)Object.prototype.hasOwnProperty.call(b,E)&&(v[E]=b[E])},c(m,g)};return function(m,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");c(m,g);function v(){this.constructor=m}m.prototype=g===null?Object.create(g):(v.prototype=g.prototype,new v)}})(),o=this&&this.__values||function(c){var m=typeof Symbol=="function"&&Symbol.iterator,g=m&&c[m],v=0;if(g)return g.call(c);if(c&&typeof c.length=="number")return{next:function(){return c&&v>=c.length&&(c=void 0),{value:c&&c[v++],done:!c}}};throw new TypeError(m?"Object is not iterable.":"Symbol.iterator is not defined.")},p=t("../lib/dom"),s=t("./mouse_event").MouseEvent,u=t("../tooltip").HoverTooltip,r=t("../config").nls,a=t("../range").Range;function l(c){var m=c.editor,g=m.renderer.$gutterLayer;c.$tooltip=new d(m),c.$tooltip.addToEditor(m),c.$tooltip.setDataProvider(function(v,b){var E=v.getDocumentPosition().row;c.$tooltip.showTooltip(E)}),c.editor.setDefaultHandler("guttermousedown",function(v){if(!(!m.isFocused()||v.getButton()!=0)){var b=g.getRegion(v);if(b!="foldWidgets"){var E=v.getDocumentPosition().row,S=m.session.selection;if(v.getShiftKey())S.selectTo(E,0);else{if(v.domEvent.detail==2)return m.selectAll(),v.preventDefault();c.$clickSelection=m.selection.getLineRange(E)}return c.setState("selectByLines"),c.captureMouse(v),v.preventDefault()}}})}n.GutterHandler=l;var d=(function(c){i(m,c);function m(g){var v=c.call(this,g.container)||this;v.id="gt"+ ++m.$uid,v.editor=g,v.visibleTooltipRow;var b=v.getElement();return b.setAttribute("role","tooltip"),b.setAttribute("id",v.id),b.style.pointerEvents="auto",v.idleTime=50,v.onDomMouseMove=v.onDomMouseMove.bind(v),v.onDomMouseOut=v.onDomMouseOut.bind(v),v.setClassName("ace_gutter-tooltip"),v}return m.prototype.onDomMouseMove=function(g){var v=new s(g,this.editor);this.onMouseMove(v,this.editor)},m.prototype.onDomMouseOut=function(g){var v=new s(g,this.editor);this.onMouseOut(v)},m.prototype.addToEditor=function(g){var v=g.renderer.$gutter;v.addEventListener("mousemove",this.onDomMouseMove),v.addEventListener("mouseout",this.onDomMouseOut),c.prototype.addToEditor.call(this,g)},m.prototype.removeFromEditor=function(g){var v=g.renderer.$gutter;v.removeEventListener("mousemove",this.onDomMouseMove),v.removeEventListener("mouseout",this.onDomMouseOut),c.prototype.removeFromEditor.call(this,g)},m.prototype.destroy=function(){this.editor&&this.removeFromEditor(this.editor),c.prototype.destroy.call(this)},Object.defineProperty(m,"annotationLabels",{get:function(){return{error:{singular:r("gutter-tooltip.aria-label.error.singular","error"),plural:r("gutter-tooltip.aria-label.error.plural","errors")},security:{singular:r("gutter-tooltip.aria-label.security.singular","security finding"),plural:r("gutter-tooltip.aria-label.security.plural","security findings")},warning:{singular:r("gutter-tooltip.aria-label.warning.singular","warning"),plural:r("gutter-tooltip.aria-label.warning.plural","warnings")},info:{singular:r("gutter-tooltip.aria-label.info.singular","information message"),plural:r("gutter-tooltip.aria-label.info.plural","information messages")},hint:{singular:r("gutter-tooltip.aria-label.hint.singular","suggestion"),plural:r("gutter-tooltip.aria-label.hint.plural","suggestions")}}},enumerable:!1,configurable:!0}),m.prototype.showTooltip=function(g){var v,b=this.editor.renderer.$gutterLayer,E=b.$annotations[g],S;E?S={displayText:Array.from(E.displayText),type:Array.from(E.type)}:S={displayText:[],type:[]};var w=b.session.getFoldLine(g);if(w&&b.$showFoldedAnnotations){for(var y={error:[],security:[],warning:[],info:[],hint:[]},D={error:1,security:2,warning:3,info:4,hint:5},$,A=g+1;A<=w.end.row;A++)if(b.$annotations[A])for(var _=0;_<b.$annotations[A].text.length;_++){var L=b.$annotations[A].type[_];y[L].push(b.$annotations[A].text[_]),(!$||D[L]<D[$])&&($=L)}if(["error","security","warning"].includes($)){var T="".concat(m.annotationsToSummaryString(y)," in folded code.");S.displayText.push(T),S.type.push($+"_fold")}}if(S.displayText.length===0)return this.hide();for(var k={error:[],security:[],warning:[],info:[],hint:[]},x=b.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",A=0;A<S.displayText.length;A++){var C=p.createElement("span"),M=p.createElement("span");(v=M.classList).add.apply(v,["ace_".concat(S.type[A]),x]),M.setAttribute("aria-label","".concat(m.annotationLabels[S.type[A].replace("_fold","")].singular)),M.setAttribute("role","img"),M.appendChild(p.createTextNode(" ")),C.appendChild(M),C.appendChild(p.createTextNode(S.displayText[A])),C.appendChild(p.createElement("br")),k[S.type[A].replace("_fold","")].push(C)}var F=p.createElement("span");k.error.forEach(function(B){return F.appendChild(B)}),k.security.forEach(function(B){return F.appendChild(B)}),k.warning.forEach(function(B){return F.appendChild(B)}),k.info.forEach(function(B){return F.appendChild(B)}),k.hint.forEach(function(B){return F.appendChild(B)}),F.setAttribute("aria-live","polite");var R=this.$findLinkedAnnotationNode(g);R&&R.setAttribute("aria-describedby",this.id);var O=a.fromPoints({row:g,column:0},{row:g,column:0});this.showForRange(this.editor,O,F),this.visibleTooltipRow=g,this.editor._signal("showGutterTooltip",this)},m.prototype.$setPosition=function(g,v,b,E){var S=this.$findCellByRow(E.start.row);if(S){var w=S&&S.element,y=w&&w.querySelector(".ace_gutter_annotation");if(y){var D=y.getBoundingClientRect();if(D){var $={pageX:D.right,pageY:D.top};return c.prototype.$setPosition.call(this,g,$,!1,E)}}}},m.prototype.$shouldPlaceAbove=function(g,v,b){return b<g},m.prototype.$findLinkedAnnotationNode=function(g){var v=this.$findCellByRow(g);if(v){var b=v.element;if(b.childNodes.length>2)return b.childNodes[2]}},m.prototype.$findCellByRow=function(g){return this.editor.renderer.$gutterLayer.$lines.cells.find(function(v){return v.row===g})},m.prototype.hide=function(g){if(this.isOpen){if(this.$element.removeAttribute("aria-live"),this.visibleTooltipRow!=null){var v=this.$findLinkedAnnotationNode(this.visibleTooltipRow);v&&v.removeAttribute("aria-describedby")}this.visibleTooltipRow=void 0,this.editor._signal("hideGutterTooltip",this),c.prototype.hide.call(this,g)}},m.annotationsToSummaryString=function(g){var v,b,E=[],S=["error","security","warning","info","hint"];try{for(var w=o(S),y=w.next();!y.done;y=w.next()){var D=y.value;if(g[D].length){var $=g[D].length===1?m.annotationLabels[D].singular:m.annotationLabels[D].plural;E.push("".concat(g[D].length," ").concat($))}}}catch(A){v={error:A}}finally{try{y&&!y.done&&(b=w.return)&&b.call(w)}finally{if(v)throw v.error}}return E.join(", ")},m.prototype.isOutsideOfText=function(g){var v=g.editor,b=v.renderer.$gutter.getBoundingClientRect();return!(g.clientX>=b.left&&g.clientX<=b.right&&g.clientY>=b.top&&g.clientY<=b.bottom)},m})(u);d.$uid=0,n.GutterTooltip=d}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(t,n,f){var i=t("../lib/dom"),o=t("../lib/event"),p=t("../lib/useragent"),s=200,u=200,r=5;function a(d){var c=d.editor,m=i.createElement("div");m.style.cssText="top:-100px;position:absolute;z-index:2147483647;opacity:0.5",m.textContent=" ";var g=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];g.forEach(function(V){d[V]=this[V]},this),c.on("mousedown",this.onMouseDown.bind(d));var v=c.container,b,E,S,w,y,D,$=0,A,_,L,T,k;this.onDragStart=function(V){if(this.cancelDrag||!v.draggable){var W=this;return setTimeout(function(){W.startSelect(),W.captureMouse(V)},0),V.preventDefault()}y=c.getSelectionRange();var H=V.dataTransfer;H.effectAllowed=c.getReadOnly()?"copy":"copyMove",c.container.appendChild(m),H.setDragImage&&H.setDragImage(m,0,0),setTimeout(function(){c.container.removeChild(m)}),H.clearData(),H.setData("Text",c.session.getTextRange()),_=!0,this.setState("drag")},this.onDragEnd=function(V){if(v.draggable=!1,_=!1,this.setState(null),!c.getReadOnly()){var W=V.dataTransfer.dropEffect;!A&&W=="move"&&c.session.remove(c.getSelectionRange()),c.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(V){if(!(c.getReadOnly()||!N(V.dataTransfer)))return E=V.clientX,S=V.clientY,b||F(),$++,V.dataTransfer.dropEffect=A=j(V),o.preventDefault(V)},this.onDragOver=function(V){if(!(c.getReadOnly()||!N(V.dataTransfer)))return E=V.clientX,S=V.clientY,b||(F(),$++),O!==null&&(O=null),V.dataTransfer.dropEffect=A=j(V),o.preventDefault(V)},this.onDragLeave=function(V){if($--,$<=0&&b)return R(),A=null,o.preventDefault(V)},this.onDrop=function(V){if(D){var W=V.dataTransfer;if(_)switch(A){case"move":y.contains(D.row,D.column)?y={start:D,end:D}:y=c.moveText(y,D);break;case"copy":y=c.moveText(y,D,!0);break}else{var H=W.getData("Text");y={start:D,end:c.session.insert(D,H)},c.focus(),A=null}return R(),o.preventDefault(V)}},o.addListener(v,"dragstart",this.onDragStart.bind(d),c),o.addListener(v,"dragend",this.onDragEnd.bind(d),c),o.addListener(v,"dragenter",this.onDragEnter.bind(d),c),o.addListener(v,"dragover",this.onDragOver.bind(d),c),o.addListener(v,"dragleave",this.onDragLeave.bind(d),c),o.addListener(v,"drop",this.onDrop.bind(d),c);function x(V,W){var H=Date.now(),U=!W||V.row!=W.row,X=!W||V.column!=W.column;if(!T||U||X)c.moveCursorToPosition(V),T=H,k={x:E,y:S};else{var Y=l(k.x,k.y,E,S);Y>r?T=null:H-T>=u&&(c.renderer.scrollCursorIntoView(),T=null)}}function C(V,W){var H=Date.now(),U=c.renderer.layerConfig.lineHeight,X=c.renderer.layerConfig.characterWidth,Y=c.renderer.scroller.getBoundingClientRect(),Z={x:{left:E-Y.left,right:Y.right-E},y:{top:S-Y.top,bottom:Y.bottom-S}},ne=Math.min(Z.x.left,Z.x.right),re=Math.min(Z.y.top,Z.y.bottom),le={row:V.row,column:V.column};ne/X<=2&&(le.column+=Z.x.left<Z.x.right?-3:2),re/U<=1&&(le.row+=Z.y.top<Z.y.bottom?-1:1);var ie=V.row!=le.row,de=V.column!=le.column,he=!W||V.row!=W.row;ie||de&&!he?L?H-L>=s&&c.renderer.scrollCursorIntoView(le):L=H:L=null}function M(){var V=D;D=c.renderer.screenToTextCoordinates(E,S),x(D,V),C(D,V)}function F(){y=c.selection.toOrientedRange(),b=c.session.addMarker(y,"ace_selection",c.getSelectionStyle()),c.clearSelection(),c.isFocused()&&c.renderer.$cursorLayer.setBlinking(!1),clearInterval(w),M(),w=setInterval(M,20),$=0,o.addListener(document,"mousemove",B)}function R(){clearInterval(w),c.session.removeMarker(b),b=null,c.selection.fromOrientedRange(y),c.isFocused()&&!_&&c.$resetCursorStyle(),y=null,D=null,$=0,L=null,T=null,o.removeListener(document,"mousemove",B)}var O=null;function B(){O==null&&(O=setTimeout(function(){O!=null&&b&&R()},20))}function N(V){var W=V.types;return!W||Array.prototype.some.call(W,function(H){return H=="text/plain"||H=="Text"})}function j(V){var W=["copy","copymove","all","uninitialized"],H=["move","copymove","linkmove","all","uninitialized"],U=p.isMac?V.altKey:V.ctrlKey,X="uninitialized";try{X=V.dataTransfer.effectAllowed.toLowerCase()}catch{}var Y="none";return U&&W.indexOf(X)>=0?Y="copy":H.indexOf(X)>=0?Y="move":W.indexOf(X)>=0&&(Y="copy"),Y}}(function(){this.dragWait=function(){var d=Date.now()-this.mousedownEvent.time;d>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var d=this.editor.container;d.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(d){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var d=this.editor,c=d.container;c.draggable=!0,d.renderer.$cursorLayer.setBlinking(!1),d.setStyle("ace_dragging");var m=p.isWin?"default":"move";d.renderer.setCursorStyle(m),this.setState("dragReady")},this.onMouseDrag=function(d){var c=this.editor.container;if(p.isIE&&this.state=="dragReady"){var m=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);m>3&&c.dragDrop()}if(this.state==="dragWait"){var m=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);m>0&&(c.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(d){if(this.$dragEnabled){this.mousedownEvent=d;var c=this.editor,m=d.inSelection(),g=d.getButton(),v=d.domEvent.detail||1;if(v===1&&g===0&&m){if(d.editor.inMultiSelectMode&&(d.getAccelKey()||d.getShiftKey()))return;this.mousedownEvent.time=Date.now();var b=d.domEvent.target||d.domEvent.srcElement;if("unselectable"in b&&(b.unselectable="on"),c.getDragDelay()){if(p.isWebKit){this.cancelDrag=!0;var E=c.container;E.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(d,this.onMouseDrag.bind(this)),d.defaultPrevented=!0}}}}).call(a.prototype);function l(d,c,m,g){return Math.sqrt(Math.pow(m-d,2)+Math.pow(g-c,2))}n.DragdropHandler=a}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(t,n,f){var i=t("./mouse_event").MouseEvent,o=t("../lib/event"),p=t("../lib/dom");n.addTouchListeners=function(s,u){var r="scroll",a,l,d,c,m,g,v=0,b,E=0,S=0,w=0,y,D;function $(){var x=window.navigator&&window.navigator.clipboard,C=!1,M=function(){var O=u.getCopyText(),B=u.session.getUndoManager().hasUndo();D.replaceChild(p.buildDom(C?["span",!O&&F("selectall")&&["span",{class:"ace_mobile-button",action:"selectall"},"Select All"],O&&F("copy")&&["span",{class:"ace_mobile-button",action:"copy"},"Copy"],O&&F("cut")&&["span",{class:"ace_mobile-button",action:"cut"},"Cut"],x&&F("paste")&&["span",{class:"ace_mobile-button",action:"paste"},"Paste"],B&&F("undo")&&["span",{class:"ace_mobile-button",action:"undo"},"Undo"],F("find")&&["span",{class:"ace_mobile-button",action:"find"},"Find"],F("openCommandPalette")&&["span",{class:"ace_mobile-button",action:"openCommandPalette"},"Palette"]]:["span"]),D.firstChild)},F=function(O){return u.commands.canExecute(O,u)},R=function(O){var B=O.target.getAttribute("action");if(B=="more"||!C)return C=!C,M();B=="paste"?x.readText().then(function(N){u.execCommand(B,N)}):B&&((B=="cut"||B=="copy")&&(x?x.writeText(u.getCopyText()):document.execCommand("copy")),u.execCommand(B)),D.firstChild.style.display="none",C=!1,B!="openCommandPalette"&&u.focus()};D=p.buildDom(["div",{class:"ace_mobile-menu",ontouchstart:function(O){r="menu",O.stopPropagation(),O.preventDefault(),u.textInput.focus()},ontouchend:function(O){O.stopPropagation(),O.preventDefault(),R(O)},onclick:R},["span"],["span",{class:"ace_mobile-button",action:"more"},"..."]],u.container)}function A(){if(!u.getOption("enableMobileMenu")){D&&_();return}D||$();var x=u.selection.cursor,C=u.renderer.textToScreenCoordinates(x.row,x.column),M=u.renderer.textToScreenCoordinates(0,0).pageX,F=u.renderer.scrollLeft,R=u.container.getBoundingClientRect();D.style.top=C.pageY-R.top-3+"px",C.pageX-R.left<R.width-70?(D.style.left="",D.style.right="10px"):(D.style.right="",D.style.left=M+F-R.left+"px"),D.style.display="",D.firstChild.style.display="none",u.on("input",_)}function _(x){D&&(D.style.display="none"),u.off("input",_)}function L(){m=null,clearTimeout(m);var x=u.selection.getRange(),C=x.contains(b.row,b.column);(x.isEmpty()||!C)&&(u.selection.moveToPosition(b),u.selection.selectWord()),r="wait",A()}function T(){m=null,clearTimeout(m),u.selection.moveToPosition(b);var x=E>=2?u.selection.getLineRange(b.row):u.session.getBracketRange(b);x&&!x.isEmpty()?u.selection.setRange(x):u.selection.selectWord(),r="wait"}o.addListener(s,"contextmenu",function(x){if(y){var C=u.textInput.getElement();C.focus()}},u),o.addListener(s,"touchstart",function(x){var C=x.touches;if(m||C.length>1){clearTimeout(m),m=null,d=-1,r="zoom";return}y=u.$mouseHandler.isMousePressed=!0;var M=u.renderer.layerConfig.lineHeight,F=u.renderer.layerConfig.lineHeight,R=x.timeStamp;c=R;var O=C[0],B=O.clientX,N=O.clientY;Math.abs(a-B)+Math.abs(l-N)>M&&(d=-1),a=x.clientX=B,l=x.clientY=N,S=w=0;var j=new i(x,u);if(b=j.getDocumentPosition(),R-d<500&&C.length==1&&!v)E++,x.preventDefault(),x.button=0,T();else{E=0;var V=u.selection.cursor,W=u.selection.isEmpty()?V:u.selection.anchor,H=u.renderer.$cursorLayer.getPixelPosition(V,!0),U=u.renderer.$cursorLayer.getPixelPosition(W,!0),X=u.renderer.scroller.getBoundingClientRect(),Y=u.renderer.layerConfig.offset,Z=u.renderer.scrollLeft,ne=function(ie,de){return ie=ie/F,de=de/M-.75,ie*ie+de*de};if(x.clientX<X.left){r="zoom";return}var re=ne(x.clientX-X.left-H.left+Z,x.clientY-X.top-H.top+Y),le=ne(x.clientX-X.left-U.left+Z,x.clientY-X.top-U.top+Y);re<3.5&&le<3.5&&(r=re>le?"cursor":"anchor"),le<3.5?r="anchor":re<3.5?r="cursor":r="scroll",m=setTimeout(L,450)}d=R},u),o.addListener(s,"touchend",function(x){y=u.$mouseHandler.isMousePressed=!1,g&&clearInterval(g),r=="zoom"?(r="",v=0):m?(u.selection.moveToPosition(b),v=0,A()):r=="scroll"?(k(),_()):A(),clearTimeout(m),m=null},u),o.addListener(s,"touchmove",function(x){m&&(clearTimeout(m),m=null);var C=x.touches;if(!(C.length>1||r=="zoom")){var M=C[0],F=a-M.clientX,R=l-M.clientY;if(r=="wait")if(F*F+R*R>4)r="cursor";else return x.preventDefault();a=M.clientX,l=M.clientY,x.clientX=M.clientX,x.clientY=M.clientY;var O=x.timeStamp,B=O-c;if(c=O,r=="scroll"){var N=new i(x,u);N.speed=1,N.wheelX=F,N.wheelY=R,10*Math.abs(F)<Math.abs(R)&&(F=0),10*Math.abs(R)<Math.abs(F)&&(R=0),B!=0&&(S=F/B,w=R/B),u._emit("mousewheel",N),N.propagationStopped||(S=w=0)}else{var j=new i(x,u),V=j.getDocumentPosition();r=="cursor"?u.selection.moveCursorToPosition(V):r=="anchor"&&u.selection.setSelectionAnchor(V.row,V.column),u.renderer.scrollCursorIntoView(V),x.preventDefault()}}},u);function k(){v+=60,g=setInterval(function(){v--<=0&&(clearInterval(g),g=null),Math.abs(S)<.01&&(S=0),Math.abs(w)<.01&&(w=0),v<20&&(S=.9*S),v<20&&(w=.9*w);var x=u.session.getScrollTop();u.renderer.scrollBy(10*S,10*w),x==u.session.getScrollTop()&&(v=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(t,n,f){var i=t("../lib/event"),o=t("../lib/useragent"),p=t("./default_handlers").DefaultHandlers,s=t("./default_gutter_handler").GutterHandler,u=t("./mouse_event").MouseEvent,r=t("./dragdrop_handler").DragdropHandler,a=t("./touch_handler").addTouchListeners,l=t("../config"),d=(function(){function c(m){this.$dragDelay,this.$dragEnabled,this.$mouseMoved,this.mouseEvent,this.$focusTimeout;var g=this;this.editor=m,new p(this),new s(this),new r(this);var v=function(S){var w=!document.hasFocus||!document.hasFocus()||!m.isFocused()&&document.activeElement==(m.textInput&&m.textInput.getElement());w&&window.focus(),m.focus(),setTimeout(function(){m.isFocused()||m.focus()})},b=m.renderer.getMouseEventTarget();i.addListener(b,"click",this.onMouseEvent.bind(this,"click"),m),i.addListener(b,"mousemove",this.onMouseMove.bind(this,"mousemove"),m),i.addMultiMouseDownListener([b,m.renderer.scrollBarV&&m.renderer.scrollBarV.inner,m.renderer.scrollBarH&&m.renderer.scrollBarH.inner,m.textInput&&m.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent",m),i.addMouseWheelListener(m.container,this.onMouseWheel.bind(this,"mousewheel"),m),a(m.container,m);var E=m.renderer.$gutter;i.addListener(E,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),m),i.addListener(E,"click",this.onMouseEvent.bind(this,"gutterclick"),m),i.addListener(E,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),m),i.addListener(E,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),m),i.addListener(b,"mousedown",v,m),i.addListener(E,"mousedown",v,m),o.isIE&&m.renderer.scrollBarV&&(i.addListener(m.renderer.scrollBarV.element,"mousedown",v,m),i.addListener(m.renderer.scrollBarH.element,"mousedown",v,m)),m.on("mousemove",function(S){if(!(g.state||g.$dragDelay||!g.$dragEnabled)){var w=m.renderer.screenToTextCoordinates(S.x,S.y),y=m.session.selection.getRange(),D=m.renderer;!y.isEmpty()&&y.insideStart(w.row,w.column)?D.setCursorStyle("default"):D.setCursorStyle("")}},m)}return c.prototype.onMouseEvent=function(m,g){this.editor.session&&this.editor._emit(m,new u(g,this.editor))},c.prototype.onMouseMove=function(m,g){var v=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;!v||!v.length||this.editor._emit(m,new u(g,this.editor))},c.prototype.onMouseWheel=function(m,g){var v=new u(g,this.editor);v.speed=this.$scrollSpeed*2,v.wheelX=g.wheelX,v.wheelY=g.wheelY,this.editor._emit(m,v)},c.prototype.setState=function(m){this.state=m},c.prototype.captureMouse=function(m,g){this.x=m.x,this.y=m.y,this.isMousePressed=!0;var v=this.editor,b=this.editor.renderer;b.$isMousePressed=!0;var E=this,S=!0,w=function(_){if(_){if(o.isWebKit&&!_.which&&E.releaseMouse)return E.releaseMouse();E.x=_.clientX,E.y=_.clientY,g&&g(_),E.mouseEvent=new u(_,E.editor),E.$mouseMoved=!0}},y=function(_){v.off("beforeEndOperation",A),S=!1,v.session&&D(),E[E.state+"End"]&&E[E.state+"End"](_),E.state="",E.isMousePressed=b.$isMousePressed=!1,b.$keepTextAreaAtCursor&&b.$moveTextAreaToCursor(),E.$onCaptureMouseMove=E.releaseMouse=null,_&&E.onMouseEvent("mouseup",_),v.endOperation()},D=function(){E[E.state]&&E[E.state](),E.$mouseMoved=!1},$=function(){S&&(D(),i.nextFrame($))};if(o.isOldIE&&m.domEvent.type=="dblclick")return setTimeout(function(){y(m)});var A=function(_){E.releaseMouse&&v.curOp.command.name&&v.curOp.selectionChanged&&(E[E.state+"End"]&&E[E.state+"End"](),E.state="",E.releaseMouse())};v.on("beforeEndOperation",A),v.startOperation({command:{name:"mouse"}}),E.$onCaptureMouseMove=w,E.releaseMouse=i.capture(this.editor.container,w,y),$()},c.prototype.cancelContextMenu=function(){var m=function(g){g&&g.domEvent&&g.domEvent.type!="contextmenu"||(this.editor.off("nativecontextmenu",m),g&&g.domEvent&&i.stopEvent(g.domEvent))}.bind(this);setTimeout(m,10),this.editor.on("nativecontextmenu",m)},c.prototype.destroy=function(){this.releaseMouse&&this.releaseMouse(),this.$tooltip&&this.$tooltip.destroy()},c})();d.prototype.releaseMouse=null,l.defineOptions(d.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:o.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0}}),n.MouseHandler=d}),ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(t,n,f){var i=t("../lib/dom"),o=(function(){function p(s){s.on("click",function(u){var r=u.getDocumentPosition(),a=s.session,l=a.getFoldAt(r.row,r.column,1);l&&(u.getAccelKey()?a.removeFold(l):a.expandFold(l),u.stop());var d=u.domEvent&&u.domEvent.target;d&&i.hasCssClass(d,"ace_inline_button")&&i.hasCssClass(d,"ace_toggle_wrap")&&(a.setOption("wrap",!a.getUseWrapMode()),s.renderer.scrollCursorIntoView())}),s.on("gutterclick",function(u){var r=s.renderer.$gutterLayer.getRegion(u);if(r=="foldWidgets"){var a=u.getDocumentPosition().row,l=s.session;l.foldWidgets&&l.foldWidgets[a]&&s.session.onFoldWidgetClick(a,u),s.isFocused()||s.focus(),u.stop()}}),s.on("gutterdblclick",function(u){var r=s.renderer.$gutterLayer.getRegion(u);if(r=="foldWidgets"){var a=u.getDocumentPosition().row,l=s.session,d=l.getParentFoldRangeData(a,!0),c=d.range||d.firstRange;if(c){a=c.start.row;var m=l.getFoldAt(a,l.getLine(a).length,1);m?l.removeFold(m):(l.addFold("...",c),s.renderer.scrollCursorIntoView({row:c.start.row,column:0}))}u.stop()}})}return p})();n.FoldHandler=o}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(t,n,f){var i=t("../lib/keys"),o=t("../lib/event"),p=(function(){function s(u){this.$editor=u,this.$data={editor:u},this.$handlers=[],this.setDefaultHandler(u.commands)}return s.prototype.setDefaultHandler=function(u){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=u,this.addKeyboardHandler(u,0)},s.prototype.setKeyboardHandler=function(u){var r=this.$handlers;if(r[r.length-1]!=u){for(;r[r.length-1]&&r[r.length-1]!=this.$defaultHandler;)this.removeKeyboardHandler(r[r.length-1]);this.addKeyboardHandler(u,1)}},s.prototype.addKeyboardHandler=function(u,r){if(u){typeof u=="function"&&!u.handleKeyboard&&(u.handleKeyboard=u);var a=this.$handlers.indexOf(u);a!=-1&&this.$handlers.splice(a,1),r==null?this.$handlers.push(u):this.$handlers.splice(r,0,u),a==-1&&u.attach&&u.attach(this.$editor)}},s.prototype.removeKeyboardHandler=function(u){var r=this.$handlers.indexOf(u);return r==-1?!1:(this.$handlers.splice(r,1),u.detach&&u.detach(this.$editor),!0)},s.prototype.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},s.prototype.getStatusText=function(){var u=this.$data,r=u.editor;return this.$handlers.map(function(a){return a.getStatusText&&a.getStatusText(r,u)||""}).filter(Boolean).join(" ")},s.prototype.$callKeyboardHandlers=function(u,r,a,l){for(var d,c=!1,m=this.$editor.commands,g=this.$handlers.length;g--&&(d=this.$handlers[g].handleKeyboard(this.$data,u,r,a,l),!(!(!d||!d.command)&&(d.command=="null"?c=!0:c=m.exec(d.command,this.$editor,d.args,l),c&&l&&u!=-1&&d.passEvent!=!0&&d.command.passEvent!=!0&&o.stopEvent(l),c))););return!c&&u==-1&&(d={command:"insertstring"},c=m.exec("insertstring",this.$editor,r)),c&&this.$editor._signal&&this.$editor._signal("keyboardActivity",d),c},s.prototype.onCommandKey=function(u,r,a){var l=i.keyCodeToString(a);return this.$callKeyboardHandlers(r,l,a,u)},s.prototype.onTextInput=function(u){return this.$callKeyboardHandlers(-1,u)},s})();n.KeyBinding=p}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(t,n,f){var i=0,o=0,p=!1,s=!1,u=!1,r=[[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]],a=[[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]],l=0,d=1,c=0,m=1,g=2,v=3,b=4,E=5,S=6,w=7,y=8,D=9,$=10,A=11,_=12,L=13,T=14,k=15,x=16,C=17,M=18,F=[M,M,M,M,M,M,M,M,M,S,E,S,y,E,M,M,M,M,M,M,M,M,M,M,M,M,M,M,E,E,E,S,y,b,b,A,A,A,b,b,b,b,b,$,D,$,D,D,g,g,g,g,g,g,g,g,g,g,D,b,b,b,b,b,b,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,b,b,b,b,b,b,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,b,b,b,b,M,M,M,M,M,M,E,M,M,M,M,M,M,M,M,M,M,M,M,M,M,M,M,M,M,M,M,M,M,M,M,M,M,D,b,A,A,A,A,b,b,b,b,c,b,b,M,b,b,A,A,g,g,b,c,b,b,b,g,c,b,b,b,b,b],R=[y,y,y,y,y,y,y,y,y,y,y,M,M,M,c,m,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,y,E,L,T,k,x,C,D,A,A,A,A,A,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,D,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,y];function O(V,W,H,U){var X=i?a:r,Y=null,Z=null,ne=null,re=0,le=null,ie=null,de=-1,he=null,ae=null,ce=[];if(!U)for(he=0,U=[];he<H;he++)U[he]=j(V[he]);for(o=i,p=!1,s=!1,u=!1,ae=0;ae<H;ae++){if(Y=re,ce[ae]=Z=N(V,U,ce,ae),re=X[Y][Z],le=re&240,re&=15,W[ae]=ne=X[re][5],le>0)if(le==16){for(he=de;he<ae;he++)W[he]=1;de=-1}else de=-1;if(ie=X[re][6],ie)de==-1&&(de=ae);else if(de>-1){for(he=de;he<ae;he++)W[he]=ne;de=-1}U[ae]==E&&(W[ae]=0),o|=ne}if(u){for(he=0;he<H;he++)if(U[he]==S){W[he]=i;for(var pe=he-1;pe>=0&&U[pe]==y;pe--)W[pe]=i}}}function B(V,W,H){if(!(o<V)){if(V==1&&i==d&&!s){H.reverse();return}for(var U=H.length,X=0,Y,Z,ne,re;X<U;){if(W[X]>=V){for(Y=X+1;Y<U&&W[Y]>=V;)Y++;for(Z=X,ne=Y-1;Z<ne;Z++,ne--)re=H[Z],H[Z]=H[ne],H[ne]=re;X=Y}X++}}}function N(V,W,H,U){var X=W[U],Y,Z,ne,re;switch(X){case c:case m:p=!1;case b:case v:return X;case g:return p?v:g;case w:return p=!0,m;case y:return b;case D:return U<1||U+1>=W.length||(Y=H[U-1])!=g&&Y!=v||(Z=W[U+1])!=g&&Z!=v?b:(p&&(Z=v),Z==Y?Z:b);case $:return Y=U>0?H[U-1]:E,Y==g&&U+1<W.length&&W[U+1]==g?g:b;case A:if(U>0&&H[U-1]==g)return g;if(p)return b;for(re=U+1,ne=W.length;re<ne&&W[re]==A;)re++;return re<ne&&W[re]==g?g:b;case _:for(ne=W.length,re=U+1;re<ne&&W[re]==_;)re++;if(re<ne){var le=V[U],ie=le>=1425&&le<=2303||le==64286;if(Y=W[re],ie&&(Y==m||Y==w))return m}return U<1||(Y=W[U-1])==E?b:H[U-1];case E:return p=!1,s=!0,i;case S:return u=!0,b;case L:case T:case x:case C:case k:p=!1;case M:return b}}function j(V){var W=V.charCodeAt(0),H=W>>8;return H==0?W>191?c:F[W]:H==5?/[\u0591-\u05f4]/.test(V)?m:c:H==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(V)?_:/[\u0660-\u0669\u066b-\u066c]/.test(V)?v:W==1642?A:/[\u06f0-\u06f9]/.test(V)?g:w:H==32&&W<=8287?R[W&255]:H==254&&W>=65136?w:b}n.L=c,n.R=m,n.EN=g,n.ON_R=3,n.AN=4,n.R_H=5,n.B=6,n.RLE=7,n.DOT="·",n.doBidiReorder=function(V,W,H){if(V.length<2)return{};var U=V.split(""),X=new Array(U.length),Y=new Array(U.length),Z=[];i=H?d:l,O(U,Z,U.length,W);for(var ne=0;ne<X.length;X[ne]=ne,ne++);B(2,Z,X),B(1,Z,X);for(var ne=0;ne<X.length-1;ne++)W[ne]===v?Z[ne]=n.AN:Z[ne]===m&&(W[ne]>w&&W[ne]<L||W[ne]===b||W[ne]===M)?Z[ne]=n.ON_R:ne>0&&U[ne-1]==="ل"&&/\u0622|\u0623|\u0625|\u0627/.test(U[ne])&&(Z[ne-1]=Z[ne]=n.R_H,ne++);U[U.length-1]===n.DOT&&(Z[U.length-1]=n.B),U[0]===""&&(Z[0]=n.RLE);for(var ne=0;ne<X.length;ne++)Y[ne]=Z[X[ne]];return{logicalFromVisual:X,bidiLevels:Y}},n.hasBidiCharacters=function(V,W){for(var H=!1,U=0;U<V.length;U++)W[U]=j(V.charAt(U)),!H&&(W[U]==m||W[U]==w||W[U]==v)&&(H=!0);return H},n.getVisualFromLogicalIdx=function(V,W){for(var H=0;H<W.logicalFromVisual.length;H++)if(W.logicalFromVisual[H]==V)return H;return 0}}),ace.define("ace/bidihandler",["require","exports","module","ace/lib/bidiutil","ace/lib/lang"],function(t,n,f){var i=t("./lib/bidiutil"),o=t("./lib/lang"),p=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\u202B]/,s=(function(){function u(r){this.session=r,this.bidiMap={},this.currentRow=null,this.bidiUtil=i,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=p.test(r.getValue())}return u.prototype.isBidiRow=function(r,a,l){return this.seenBidi?(r!==this.currentRow&&(this.currentRow=r,this.updateRowLine(a,l),this.updateBidiMap()),this.bidiMap.bidiLevels):!1},u.prototype.onChange=function(r){this.seenBidi?this.currentRow=null:r.action=="insert"&&p.test(r.lines.join(`
`))&&(this.seenBidi=!0,this.currentRow=null)},u.prototype.getDocumentRow=function(){var r=0,a=this.session.$screenRowCache;if(a.length){var l=this.session.$getRowCacheIndex(a,this.currentRow);l>=0&&(r=this.session.$docRowCache[l])}return r},u.prototype.getSplitIndex=function(){var r=0,a=this.session.$screenRowCache;if(a.length)for(var l,d=this.session.$getRowCacheIndex(a,this.currentRow);this.currentRow-r>0&&(l=this.session.$getRowCacheIndex(a,this.currentRow-r-1),l===d);)d=l,r++;else r=this.currentRow;return r},u.prototype.updateRowLine=function(r,a){r===void 0&&(r=this.getDocumentRow());var l=r===this.session.getLength()-1,d=l?this.EOF:this.EOL;if(this.wrapIndent=0,this.line=this.session.getLine(r),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE,this.session.$useWrapMode){var c=this.session.$wrapData[r];c&&(a===void 0&&(a=this.getSplitIndex()),a>0&&c.length?(this.wrapIndent=c.indent,this.wrapOffset=this.wrapIndent*this.charWidths[i.L],this.line=a<c.length?this.line.substring(c[a-1],c[a]):this.line.substring(c[c.length-1])):this.line=this.line.substring(0,c[a]),a==c.length&&(this.line+=this.showInvisibles?d:i.DOT))}else this.line+=this.showInvisibles?d:i.DOT;var m=this.session,g=0,v;this.line=this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g,function(b,E){return b===" "||m.isFullWidth(b.charCodeAt(0))?(v=b===" "?m.getScreenTabSize(E+g):2,g+=v-1,o.stringRepeat(i.DOT,v)):b}),this.isRtlDir&&(this.fontMetrics.$main.textContent=this.line.charAt(this.line.length-1)==i.DOT?this.line.substr(0,this.line.length-1):this.line,this.rtlLineOffset=this.contentWidth-this.fontMetrics.$main.getBoundingClientRect().width)},u.prototype.updateBidiMap=function(){var r=[];i.hasBidiCharacters(this.line,r)||this.isRtlDir?this.bidiMap=i.doBidiReorder(this.line,r,this.isRtlDir):this.bidiMap={}},u.prototype.markAsDirty=function(){this.currentRow=null},u.prototype.updateCharacterWidths=function(r){if(this.characterWidth!==r.$characterSize.width){this.fontMetrics=r;var a=this.characterWidth=r.$characterSize.width,l=r.$measureCharWidth("ה");this.charWidths[i.L]=this.charWidths[i.EN]=this.charWidths[i.ON_R]=a,this.charWidths[i.R]=this.charWidths[i.AN]=l,this.charWidths[i.R_H]=l*.45,this.charWidths[i.B]=this.charWidths[i.RLE]=0,this.currentRow=null}},u.prototype.setShowInvisibles=function(r){this.showInvisibles=r,this.currentRow=null},u.prototype.setEolChar=function(r){this.EOL=r},u.prototype.setContentWidth=function(r){this.contentWidth=r},u.prototype.isRtlLine=function(r){return this.$isRtl?!0:r!=null?this.session.getLine(r).charAt(0)==this.RLE:this.isRtlDir},u.prototype.setRtlDirection=function(r,a){for(var l=r.getCursorPosition(),d=r.selection.getSelectionAnchor().row;d<=l.row;d++)!a&&r.session.getLine(d).charAt(0)===r.session.$bidiHandler.RLE?r.session.doc.removeInLine(d,0,1):a&&r.session.getLine(d).charAt(0)!==r.session.$bidiHandler.RLE&&r.session.doc.insert({column:0,row:d},r.session.$bidiHandler.RLE)},u.prototype.getPosLeft=function(r){r-=this.wrapIndent;var a=this.line.charAt(0)===this.RLE?1:0,l=r>a?this.session.getOverwrite()?r:r-1:a,d=i.getVisualFromLogicalIdx(l,this.bidiMap),c=this.bidiMap.bidiLevels,m=0;!this.session.getOverwrite()&&r<=a&&c[d]%2!==0&&d++;for(var g=0;g<d;g++)m+=this.charWidths[c[g]];return!this.session.getOverwrite()&&r>a&&c[d]%2===0&&(m+=this.charWidths[c[d]]),this.wrapIndent&&(m+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(m+=this.rtlLineOffset),m},u.prototype.getSelections=function(r,a){var l=this.bidiMap,d=l.bidiLevels,c,m=[],g=0,v=Math.min(r,a)-this.wrapIndent,b=Math.max(r,a)-this.wrapIndent,E=!1,S=!1,w=0;this.wrapIndent&&(g+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var y,D=0;D<d.length;D++)y=l.logicalFromVisual[D],c=d[D],E=y>=v&&y<b,E&&!S?w=g:!E&&S&&m.push({left:w,width:g-w}),g+=this.charWidths[c],S=E;if(E&&D===d.length&&m.push({left:w,width:g-w}),this.isRtlDir)for(var $=0;$<m.length;$++)m[$].left+=this.rtlLineOffset;return m},u.prototype.offsetToCol=function(l){this.isRtlDir&&(l-=this.rtlLineOffset);var a=0,l=Math.max(l,0),d=0,c=0,m=this.bidiMap.bidiLevels,g=this.charWidths[m[c]];for(this.wrapIndent&&(l-=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);l>d+g/2;){if(d+=g,c===m.length-1){g=0;break}g=this.charWidths[m[++c]]}return c>0&&m[c-1]%2!==0&&m[c]%2===0?(l<d&&c--,a=this.bidiMap.logicalFromVisual[c]):c>0&&m[c-1]%2===0&&m[c]%2!==0?a=1+(l>d?this.bidiMap.logicalFromVisual[c]:this.bidiMap.logicalFromVisual[c-1]):this.isRtlDir&&c===m.length-1&&g===0&&m[c-1]%2===0||!this.isRtlDir&&c===0&&m[c]%2!==0?a=1+this.bidiMap.logicalFromVisual[c]:(c>0&&m[c-1]%2!==0&&g!==0&&c--,a=this.bidiMap.logicalFromVisual[c]),a===0&&this.isRtlDir&&a++,a+this.wrapIndent},u})();n.BidiHandler=s}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(t,n,f){var i=t("./lib/oop"),o=t("./lib/lang"),p=t("./lib/event_emitter").EventEmitter,s=t("./range").Range,u=(function(){function r(a){this.session=a,this.doc=a.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var l=this;this.cursor.on("change",function(d){l.$cursorChanged=!0,l.$silent||l._emit("changeCursor"),!l.$isEmpty&&!l.$silent&&l._emit("changeSelection"),!l.$keepDesiredColumnOnChange&&d.old.column!=d.value.column&&(l.$desiredColumn=null)}),this.anchor.on("change",function(){l.$anchorChanged=!0,!l.$isEmpty&&!l.$silent&&l._emit("changeSelection")})}return r.prototype.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},r.prototype.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},r.prototype.getCursor=function(){return this.lead.getPosition()},r.prototype.setAnchor=function(a,l){this.$isEmpty=!1,this.anchor.setPosition(a,l)},r.prototype.getAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},r.prototype.getSelectionLead=function(){return this.lead.getPosition()},r.prototype.isBackwards=function(){var a=this.anchor,l=this.lead;return a.row>l.row||a.row==l.row&&a.column>l.column},r.prototype.getRange=function(){var a=this.anchor,l=this.lead;return this.$isEmpty?s.fromPoints(l,l):this.isBackwards()?s.fromPoints(l,a):s.fromPoints(a,l)},r.prototype.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},r.prototype.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},r.prototype.setRange=function(a,l){var d=l?a.end:a.start,c=l?a.start:a.end;this.$setSelection(d.row,d.column,c.row,c.column)},r.prototype.$setSelection=function(a,l,d,c){if(!this.$silent){var m=this.$isEmpty,g=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(a,l),this.cursor.setPosition(d,c),this.$isEmpty=!s.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||m!=this.$isEmpty||g)&&this._emit("changeSelection")}},r.prototype.$moveSelection=function(a){var l=this.lead;this.$isEmpty&&this.setSelectionAnchor(l.row,l.column),a.call(this)},r.prototype.selectTo=function(a,l){this.$moveSelection(function(){this.moveCursorTo(a,l)})},r.prototype.selectToPosition=function(a){this.$moveSelection(function(){this.moveCursorToPosition(a)})},r.prototype.moveTo=function(a,l){this.clearSelection(),this.moveCursorTo(a,l)},r.prototype.moveToPosition=function(a){this.clearSelection(),this.moveCursorToPosition(a)},r.prototype.selectUp=function(){this.$moveSelection(this.moveCursorUp)},r.prototype.selectDown=function(){this.$moveSelection(this.moveCursorDown)},r.prototype.selectRight=function(){this.$moveSelection(this.moveCursorRight)},r.prototype.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},r.prototype.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},r.prototype.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},r.prototype.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},r.prototype.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},r.prototype.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},r.prototype.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},r.prototype.getWordRange=function(a,l){if(typeof l>"u"){var d=a||this.lead;a=d.row,l=d.column}return this.session.getWordRange(a,l)},r.prototype.selectWord=function(){this.setSelectionRange(this.getWordRange())},r.prototype.selectAWord=function(){var a=this.getCursor(),l=this.session.getAWordRange(a.row,a.column);this.setSelectionRange(l)},r.prototype.getLineRange=function(a,l){var d=typeof a=="number"?a:this.lead.row,c,m=this.session.getFoldLine(d);return m?(d=m.start.row,c=m.end.row):c=d,l===!0?new s(d,0,c,this.session.getLine(c).length):new s(d,0,c+1,0)},r.prototype.selectLine=function(){this.setSelectionRange(this.getLineRange())},r.prototype.moveCursorUp=function(){this.moveCursorBy(-1,0)},r.prototype.moveCursorDown=function(){this.moveCursorBy(1,0)},r.prototype.wouldMoveIntoSoftTab=function(a,l,d){var c=a.column,m=a.column+l;return d<0&&(c=a.column-l,m=a.column),this.session.isTabStop(a)&&this.doc.getLine(a.row).slice(c,m).split(" ").length-1==l},r.prototype.moveCursorLeft=function(){var a=this.lead.getPosition(),l;if(l=this.session.getFoldAt(a.row,a.column,-1))this.moveCursorTo(l.start.row,l.start.column);else if(a.column===0)a.row>0&&this.moveCursorTo(a.row-1,this.doc.getLine(a.row-1).length);else{var d=this.session.getTabSize();this.wouldMoveIntoSoftTab(a,d,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-d):this.moveCursorBy(0,-1)}},r.prototype.moveCursorRight=function(){var a=this.lead.getPosition(),l;if(l=this.session.getFoldAt(a.row,a.column,1))this.moveCursorTo(l.end.row,l.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 d=this.session.getTabSize(),a=this.lead;this.wouldMoveIntoSoftTab(a,d,1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,d):this.moveCursorBy(0,1)}},r.prototype.moveCursorLineStart=function(){var a=this.lead.row,l=this.lead.column,d=this.session.documentToScreenRow(a,l),c=this.session.screenToDocumentPosition(d,0),m=this.session.getDisplayLine(a,null,c.row,c.column),g=m.match(/^\s*/);g[0].length!=l&&!this.session.$useEmacsStyleLineStart&&(c.column+=g[0].length),this.moveCursorToPosition(c)},r.prototype.moveCursorLineEnd=function(){var a=this.lead,l=this.session.getDocumentLastRowColumnPosition(a.row,a.column);if(this.lead.column==l.column){var d=this.session.getLine(l.row);if(l.column==d.length){var c=d.search(/\s+$/);c>0&&(l.column=c)}}this.moveCursorTo(l.row,l.column)},r.prototype.moveCursorFileEnd=function(){var a=this.doc.getLength()-1,l=this.doc.getLine(a).length;this.moveCursorTo(a,l)},r.prototype.moveCursorFileStart=function(){this.moveCursorTo(0,0)},r.prototype.moveCursorLongWordRight=function(){var a=this.lead.row,l=this.lead.column,d=this.doc.getLine(a),c=d.substring(l);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var m=this.session.getFoldAt(a,l,1);if(m){this.moveCursorTo(m.end.row,m.end.column);return}if(this.session.nonTokenRe.exec(c)&&(l+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,c=d.substring(l)),l>=d.length){this.moveCursorTo(a,d.length),this.moveCursorRight(),a<this.doc.getLength()-1&&this.moveCursorWordRight();return}this.session.tokenRe.exec(c)&&(l+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(a,l)},r.prototype.moveCursorLongWordLeft=function(){var a=this.lead.row,l=this.lead.column,d;if(d=this.session.getFoldAt(a,l,-1)){this.moveCursorTo(d.start.row,d.start.column);return}var c=this.session.getFoldStringAt(a,l,-1);c==null&&(c=this.doc.getLine(a).substring(0,l));var m=o.stringReverse(c);if(this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0,this.session.nonTokenRe.exec(m)&&(l-=this.session.nonTokenRe.lastIndex,m=m.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0),l<=0){this.moveCursorTo(a,0),this.moveCursorLeft(),a>0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(m)&&(l-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(a,l)},r.prototype.$shortWordEndIndex=function(a){var l=0,d,c=/\s/,m=this.session.tokenRe;if(m.lastIndex=0,this.session.tokenRe.exec(a))l=this.session.tokenRe.lastIndex;else{for(;(d=a[l])&&c.test(d);)l++;if(l<1){for(m.lastIndex=0;(d=a[l])&&!m.test(d);)if(m.lastIndex=0,l++,c.test(d))if(l>2){l--;break}else{for(;(d=a[l])&&c.test(d);)l++;if(l>2)break}}}return m.lastIndex=0,l},r.prototype.moveCursorShortWordRight=function(){var a=this.lead.row,l=this.lead.column,d=this.doc.getLine(a),c=d.substring(l),m=this.session.getFoldAt(a,l,1);if(m)return this.moveCursorTo(m.end.row,m.end.column);if(l==d.length){var g=this.doc.getLength();do a++,c=this.doc.getLine(a);while(a<g&&/^\s*$/.test(c));/^\s+/.test(c)||(c=""),l=0}var v=this.$shortWordEndIndex(c);this.moveCursorTo(a,l+v)},r.prototype.moveCursorShortWordLeft=function(){var a=this.lead.row,l=this.lead.column,d;if(d=this.session.getFoldAt(a,l,-1))return this.moveCursorTo(d.start.row,d.start.column);var c=this.session.getLine(a).substring(0,l);if(l===0){do a--,c=this.doc.getLine(a);while(a>0&&/^\s*$/.test(c));l=c.length,/\s+$/.test(c)||(c="")}var m=o.stringReverse(c),g=this.$shortWordEndIndex(m);return this.moveCursorTo(a,l-g)},r.prototype.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},r.prototype.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},r.prototype.moveCursorBy=function(a,l){var d=this.session.documentToScreenPosition(this.lead.row,this.lead.column),c;if(l===0&&(a!==0&&(this.session.$bidiHandler.isBidiRow(d.row,this.lead.row)?(c=this.session.$bidiHandler.getPosLeft(d.column),d.column=Math.round(c/this.session.$bidiHandler.charWidths[0])):c=d.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?d.column=this.$desiredColumn:this.$desiredColumn=d.column),a!=0&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var m=this.session.lineWidgets[this.lead.row];a<0?a-=m.rowsAbove||0:a>0&&(a+=m.rowCount-(m.rowsAbove||0))}var g=this.session.screenToDocumentPosition(d.row+a,d.column,c);a!==0&&l===0&&g.row===this.lead.row&&(g.column,this.lead.column),this.moveCursorTo(g.row,g.column+l,l===0)},r.prototype.moveCursorToPosition=function(a){this.moveCursorTo(a.row,a.column)},r.prototype.moveCursorTo=function(a,l,d){var c=this.session.getFoldAt(a,l,1);c&&(a=c.start.row,l=c.start.column),this.$keepDesiredColumnOnChange=!0;var m=this.session.getLine(a);/[\uDC00-\uDFFF]/.test(m.charAt(l))&&m.charAt(l-1)&&(this.lead.row==a&&this.lead.column==l+1?l=l-1:l=l+1),this.lead.setPosition(a,l),this.$keepDesiredColumnOnChange=!1,d||(this.$desiredColumn=null)},r.prototype.moveCursorToScreen=function(a,l,d){var c=this.session.screenToDocumentPosition(a,l);this.moveCursorTo(c.row,c.column,d)},r.prototype.detach=function(){this.lead.detach(),this.anchor.detach()},r.prototype.fromOrientedRange=function(a){this.setSelectionRange(a,a.cursor==a.start),this.$desiredColumn=a.desiredColumn||this.$desiredColumn},r.prototype.toOrientedRange=function(a){var l=this.getRange();return a?(a.start.column=l.start.column,a.start.row=l.start.row,a.end.column=l.end.column,a.end.row=l.end.row):a=l,a.cursor=this.isBackwards()?a.start:a.end,a.desiredColumn=this.$desiredColumn,a},r.prototype.getRangeOfMovements=function(a){var l=this.getCursor();try{a(this);var d=this.getCursor();return s.fromPoints(l,d)}catch{return s.fromPoints(l,l)}finally{this.moveCursorToPosition(l)}},r.prototype.toJSON=function(){if(this.rangeCount)var a=this.ranges.map(function(l){var d=l.clone();return d.isBackwards=l.cursor==l.start,d});else{var a=this.getRange();a.isBackwards=this.isBackwards()}return a},r.prototype.fromJSON=function(a){if(a.start==null)if(this.rangeList&&a.length>1){this.toSingleRange(a[0]);for(var l=a.length;l--;){var d=s.fromPoints(a[l].start,a[l].end);a[l].isBackwards&&(d.cursor=d.start),this.addRange(d,!0)}return}else a=a[0];this.rangeList&&this.toSingleRange(a),this.setSelectionRange(a,a.isBackwards)},r.prototype.isEqual=function(a){if((a.length||this.rangeCount)&&a.length!=this.rangeCount)return!1;if(!a.length||!this.ranges)return this.getRange().isEqual(a);for(var l=this.ranges.length;l--;)if(!this.ranges[l].isEqual(a[l]))return!1;return!0},r})();u.prototype.setSelectionAnchor=u.prototype.setAnchor,u.prototype.getSelectionAnchor=u.prototype.getAnchor,u.prototype.setSelectionRange=u.prototype.setRange,i.implement(u.prototype,p),n.Selection=u}),ace.define("ace/tokenizer",["require","exports","module","ace/lib/report_error"],function(t,n,f){var i=t("./lib/report_error").reportError,o=2e3,p=(function(){function s(u){this.splitRegex,this.states=u,this.regExps={},this.matchMappings={};for(var r in this.states){for(var a=this.states[r],l=[],d=0,c=this.matchMappings[r]={defaultToken:"text"},m="g",g=[],v=0;v<a.length;v++){var b=a[v];if(b.defaultToken&&(c.defaultToken=b.defaultToken),b.caseInsensitive&&m.indexOf("i")===-1&&(m+="i"),b.unicode&&m.indexOf("u")===-1&&(m+="u"),b.regex!=null){b.regex instanceof RegExp&&(b.regex=b.regex.toString().slice(1,-1));var E=b.regex,S=new RegExp("(?:("+E+")|(.))").exec("a").length-2;Array.isArray(b.token)?b.token.length==1||S==1?b.token=b.token[0]:S-1!=b.token.length?(this.reportError("number of classes and regexp groups doesn't match",{rule:b,groupCount:S-1}),b.token=b.token[0]):(b.tokenArray=b.token,b.token=null,b.onMatch=this.$arrayTokens):typeof b.token=="function"&&!b.onMatch&&(S>1?b.onMatch=this.$applyToken:b.onMatch=b.token),S>1&&(/\\\d/.test(b.regex)?E=b.regex.replace(/\\([0-9]+)/g,function(w,y){return"\\"+(parseInt(y,10)+d+1)}):(S=1,E=this.removeCapturingGroups(b.regex)),!b.splitRegex&&typeof b.token!="string"&&g.push(b)),c[d]=v,d+=S,l.push(E),b.onMatch||(b.onMatch=null)}}l.length||(c[0]=0,l.push("$")),g.forEach(function(w){w.splitRegex=this.createSplitterRegexp(w.regex,m)},this),this.regExps[r]=new RegExp("("+l.join(")|(")+")|($)",m)}}return s.prototype.$setMaxTokenCount=function(u){o=u|0},s.prototype.$applyToken=function(u){var r=this.splitRegex.exec(u).slice(1),a=this.token.apply(this,r);if(typeof a=="string")return[{type:a,value:u}];for(var l=[],d=0,c=a.length;d<c;d++)r[d]&&(l[l.length]={type:a[d],value:r[d]});return l},s.prototype.$arrayTokens=function(u){if(!u)return[];var r=this.splitRegex.exec(u);if(!r)return"text";for(var a=[],l=this.tokenArray,d=0,c=l.length;d<c;d++)r[d+1]&&(a[a.length]={type:l[d],value:r[d+1]});return a},s.prototype.removeCapturingGroups=function(u){var r=u.replace(/\\.|\[(?:\\.|[^\\\]])*|\(\?[:=!<]|(\()/g,function(a,l){return l?"(?:":a});return r},s.prototype.createSplitterRegexp=function(u,r){if(u.indexOf("(?=")!=-1){var a=0,l=!1,d={};u.replace(/(\\.)|(\((?:\?[=!])?)|(\))|([\[\]])/g,function(c,m,g,v,b,E){return l?l=b!="]":b?l=!0:v?(a==d.stack&&(d.end=E+1,d.stack=-1),a--):g&&(a++,g.length!=1&&(d.stack=a,d.start=E)),c}),d.end!=null&&/^\)*$/.test(u.substr(d.end))&&(u=u.substring(0,d.start)+u.substr(d.end))}return u.charAt(0)!="^"&&(u="^"+u),u.charAt(u.length-1)!="$"&&(u+="$"),new RegExp(u,(r||"").replace("g",""))},s.prototype.getLineTokens=function(u,r){if(r&&typeof r!="string"){var a=r.slice(0);r=a[0],r==="#tmp"&&(a.shift(),r=a.shift())}else var a=[];var l=r||"start",d=this.states[l];d||(l="start",d=this.states[l]);var c=this.matchMappings[l],m=this.regExps[l];m.lastIndex=0;for(var g,v=[],b=0,E=0,S={type:null,value:""};g=m.exec(u);){var w=c.defaultToken,y=null,D=g[0],$=m.lastIndex;if($-D.length>b){var A=u.substring(b,$-D.length);S.type==w?S.value+=A:(S.type&&v.push(S),S={type:w,value:A})}for(var _=0;_<g.length-2;_++)if(g[_+1]!==void 0){y=d[c[_]],y.onMatch?w=y.onMatch(D,l,a,u):w=y.token,y.next&&(typeof y.next=="string"?l=y.next:l=y.next(l,a),d=this.states[l],d||(this.reportError("state doesn't exist",l),l="start",d=this.states[l]),c=this.matchMappings[l],b=$,m=this.regExps[l],m.lastIndex=$),y.consumeLineEnd&&(b=$);break}if(D){if(typeof w=="string")(!y||y.merge!==!1)&&S.type===w?S.value+=D:(S.type&&v.push(S),S={type:w,value:D});else if(w){S.type&&v.push(S),S={type:null,value:""};for(var _=0;_<w.length;_++)v.push(w[_])}}if(b==u.length)break;if(b=$,E++>o){for(E>2*u.length&&this.reportError("infinite loop with in ace tokenizer",{startState:r,line:u});b<u.length;)S.type&&v.push(S),S={value:u.substring(b,b+=500),type:"overflow"};l="start",a=[];break}}return S.type&&v.push(S),a.length>1&&a[0]!==l&&a.unshift("#tmp",l),{tokens:v,state:a.length?a:l}},s})();p.prototype.reportError=i,n.Tokenizer=p}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/deep_copy"],function(t,n,f){var i=t("../lib/deep_copy").deepCopy,o;o=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}},(function(){this.addRules=function(u,r){if(!r){for(var a in u)this.$rules[a]=u[a];return}for(var a in u){for(var l=u[a],d=0;d<l.length;d++){var c=l[d];(c.next||c.onMatch)&&(typeof c.next=="string"&&c.next.indexOf(r)!==0&&(c.next=r+c.next),c.nextState&&c.nextState.indexOf(r)!==0&&(c.nextState=r+c.nextState))}this.$rules[r+a]=l}},this.getRules=function(){return this.$rules},this.embedRules=function(u,r,a,l,d){var c=typeof u=="function"?new u().getRules():u;if(l)for(var m=0;m<l.length;m++)l[m]=r+l[m];else{l=[];for(var g in c)l.push(r+g)}if(this.addRules(c,r),a)for(var v=Array.prototype[d?"push":"unshift"],m=0;m<l.length;m++)v.apply(this.$rules[l[m]],i(a));this.$embeds||(this.$embeds=[]),this.$embeds.push(r)},this.getEmbeds=function(){return this.$embeds};var p=function(u,r){return(u!="start"||r.length)&&r.unshift(this.nextState,u),this.nextState},s=function(u,r){return r.shift(),r.shift()||"start"};this.normalizeRules=function(){var u=0,r=this.$rules;function a(l){var d=r[l];d.processed=!0;for(var c=0;c<d.length;c++){var m=d[c],g=null;Array.isArray(m)&&(g=m,m={}),!m.regex&&m.start&&(m.regex=m.start,m.next||(m.next=[]),m.next.push({defaultToken:m.token},{token:m.token+".end",regex:m.end||m.start,next:"pop"}),m.token=m.token+".start",m.push=!0);var v=m.next||m.push;if(v&&Array.isArray(v)){var b=m.stateName;b||(b=m.token,typeof b!="string"&&(b=b[0]||""),r[b]&&(b+=u++)),r[b]=v,m.next=b,a(b)}else v=="pop"&&(m.next=s);if(m.push&&(m.nextState=m.next||m.push,m.next=p,delete m.push),m.rules)for(var E in m.rules)r[E]?r[E].push&&r[E].push.apply(r[E],m.rules[E]):r[E]=m.rules[E];var S=typeof m=="string"?m:m.include;if(S&&(S==="$self"&&(S="start"),Array.isArray(S)?g=S.map(function(y){return r[y]}):g=r[S]),g){var w=[c,1].concat(g);m.noEscape&&(w=w.filter(function(y){return!y.next})),d.splice.apply(d,w),c--}m.keywordMap&&(m.token=this.createKeywordMapper(m.keywordMap,m.defaultToken||"text",m.caseInsensitive),delete m.defaultToken)}}Object.keys(r).forEach(a,this)},this.createKeywordMapper=function(u,r,a,l){var d=Object.create(null);return this.$keywordList=[],Object.keys(u).forEach(function(c){for(var m=u[c],g=m.split(l||"|"),v=g.length;v--;){var b=g[v];this.$keywordList.push(b),a&&(b=b.toLowerCase()),d[b]=c}},this),u=null,a?function(c){return d[c.toLowerCase()]||r}:function(c){return d[c]||r}},this.getKeywords=function(){return this.$keywords}}).call(o.prototype),n.TextHighlightRules=o}),ace.define("ace/mode/behaviour",["require","exports","module"],function(t,n,f){var i;i=function(){this.$behaviours={}},(function(){this.add=function(o,p,s){switch(void 0){case this.$behaviours:this.$behaviours={};case this.$behaviours[o]:this.$behaviours[o]={}}this.$behaviours[o][p]=s},this.addBehaviours=function(o){for(var p in o)for(var s in o[p])this.add(p,s,o[p][s])},this.remove=function(o){this.$behaviours&&this.$behaviours[o]&&delete this.$behaviours[o]},this.inherit=function(o,p){if(typeof o=="function")var s=new o().getBehaviours(p);else var s=o.getBehaviours(p);this.addBehaviours(s)},this.getBehaviours=function(o){if(o){for(var p={},s=0;s<o.length;s++)this.$behaviours[o[s]]&&(p[o[s]]=this.$behaviours[o[s]]);return p}else return this.$behaviours}}).call(i.prototype),n.Behaviour=i}),ace.define("ace/token_iterator",["require","exports","module","ace/range"],function(t,n,f){var i=t("./range").Range,o=(function(){function p(s,u,r){this.$session=s,this.$row=u,this.$rowTokens=s.getTokens(u);var a=s.getTokenAt(u,r);this.$tokenIndex=a?a.index:-1}return p.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]},p.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]},p.prototype.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},p.prototype.getCurrentTokenRow=function(){return this.$row},p.prototype.getCurrentTokenColumn=function(){var s=this.$rowTokens,u=this.$tokenIndex,r=s[u].start;if(r!==void 0)return r;for(r=0;u>0;)u-=1,r+=s[u].value.length;return r},p.prototype.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},p.prototype.getCurrentTokenRange=function(){var s=this.$rowTokens[this.$tokenIndex],u=this.getCurrentTokenColumn();return new i(this.$row,u,this.$row,u+s.value.length)},p})();n.TokenIterator=o}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(t,n,f){var i=t("../../lib/oop"),o=t("../behaviour").Behaviour,p=t("../../token_iterator").TokenIterator,s=t("../../lib/lang"),u=["text","paren.rparen","rparen","paren","punctuation.operator"],r=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],a,l={},d={'"':'"',"'":"'"},c=function(v){var b=-1;if(v.multiSelect&&(b=v.selection.index,l.rangeCount!=v.multiSelect.rangeCount&&(l={rangeCount:v.multiSelect.rangeCount})),l[b])return a=l[b];a=l[b]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},m=function(v,b,E,S){var w=v.end.row-v.start.row;return{text:E+b+S,selection:[0,v.start.column+1,w,v.end.column+(w?0:1)]}},g;g=function(v){v=v||{},this.add("braces","insertion",function(b,E,S,w,y){var D=S.getCursorPosition(),$=w.doc.getLine(D.row);if(y=="{"){c(S);var A=S.getSelectionRange(),_=w.doc.getTextRange(A),L=w.getTokenAt(D.row,D.column);if(_!==""&&_!=="{"&&S.getWrapBehavioursEnabled())return m(A,_,"{","}");if(L&&/(?:string)\.quasi|\.xml/.test(L.type)){var T=[/tag\-(?:open|name)/,/attribute\-name/];return T.some(function(O){return O.test(L.type)})||/(string)\.quasi/.test(L.type)&&L.value[D.column-L.start-1]!=="$"?void 0:(g.recordAutoInsert(S,w,"}"),{text:"{}",selection:[1,1]})}else if(g.isSaneInsertion(S,w))return/[\]\}\)]/.test($[D.column])||S.inMultiSelectMode||v.braces?(g.recordAutoInsert(S,w,"}"),{text:"{}",selection:[1,1]}):(g.recordMaybeInsert(S,w,"{"),{text:"{",selection:[1,1]})}else if(y=="}"){c(S);var k=$.substring(D.column,D.column+1);if(k=="}"){var x=w.$findOpeningBracket("}",{column:D.column+1,row:D.row});if(x!==null&&g.isAutoInsertedClosing(D,$,y))return g.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else if(y==`
`||y==`\r
`){c(S);var C="";g.isMaybeInsertedClosing(D,$)&&(C=s.stringRepeat("}",a.maybeInsertedBrackets),g.clearMaybeInsertedClosing());var k=$.substring(D.column,D.column+1);if(k==="}"){var M=w.findMatchingBracket({row:D.row,column:D.column+1},"}");if(!M)return null;var F=this.$getIndent(w.getLine(M.row))}else if(C)var F=this.$getIndent($);else{g.clearMaybeInsertedClosing();return}var R=F+w.getTabString();return{text:`
`+R+`
`+F+C,selection:[1,R.length,1,R.length]}}else g.clearMaybeInsertedClosing()}),this.add("braces","deletion",function(b,E,S,w,y){var D=w.doc.getTextRange(y);if(!y.isMultiLine()&&D=="{"){c(S);var $=w.doc.getLine(y.start.row),A=$.substring(y.end.column,y.end.column+1);if(A=="}")return y.end.column++,y;a.maybeInsertedBrackets--}}),this.add("parens","insertion",function(b,E,S,w,y){if(y=="("){c(S);var D=S.getSelectionRange(),$=w.doc.getTextRange(D);if($!==""&&S.getWrapBehavioursEnabled())return m(D,$,"(",")");if(g.isSaneInsertion(S,w))return g.recordAutoInsert(S,w,")"),{text:"()",selection:[1,1]}}else if(y==")"){c(S);var A=S.getCursorPosition(),_=w.doc.getLine(A.row),L=_.substring(A.column,A.column+1);if(L==")"){var T=w.$findOpeningBracket(")",{column:A.column+1,row:A.row});if(T!==null&&g.isAutoInsertedClosing(A,_,y))return g.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(b,E,S,w,y){var D=w.doc.getTextRange(y);if(!y.isMultiLine()&&D=="("){c(S);var $=w.doc.getLine(y.start.row),A=$.substring(y.start.column+1,y.start.column+2);if(A==")")return y.end.column++,y}}),this.add("brackets","insertion",function(b,E,S,w,y){if(y=="["){c(S);var D=S.getSelectionRange(),$=w.doc.getTextRange(D);if($!==""&&S.getWrapBehavioursEnabled())return m(D,$,"[","]");if(g.isSaneInsertion(S,w))return g.recordAutoInsert(S,w,"]"),{text:"[]",selection:[1,1]}}else if(y=="]"){c(S);var A=S.getCursorPosition(),_=w.doc.getLine(A.row),L=_.substring(A.column,A.column+1);if(L=="]"){var T=w.$findOpeningBracket("]",{column:A.column+1,row:A.row});if(T!==null&&g.isAutoInsertedClosing(A,_,y))return g.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(b,E,S,w,y){var D=w.doc.getTextRange(y);if(!y.isMultiLine()&&D=="["){c(S);var $=w.doc.getLine(y.start.row),A=$.substring(y.start.column+1,y.start.column+2);if(A=="]")return y.end.column++,y}}),this.add("string_dquotes","insertion",function(b,E,S,w,y){var D=w.$mode.$quotes||d;if(y.length==1&&D[y]){if(this.lineCommentStart&&this.lineCommentStart.indexOf(y)!=-1)return;c(S);var $=y,A=S.getSelectionRange(),_=w.doc.getTextRange(A);if(_!==""&&(_.length!=1||!D[_])&&S.getWrapBehavioursEnabled())return m(A,_,$,$);if(!_){var L=S.getCursorPosition(),T=w.doc.getLine(L.row),k=T.substring(L.column-1,L.column),x=T.substring(L.column,L.column+1),C=w.getTokenAt(L.row,L.column),M=w.getTokenAt(L.row,L.column+1);if(k=="\\"&&C&&/escape/.test(C.type))return null;var F=C&&/string|escape/.test(C.type),R=!M||/string|escape/.test(M.type),O;if(x==$)O=F!==R,O&&/string\.end/.test(M.type)&&(O=!1);else{if(F&&!R||F&&R)return null;var B=w.$mode.tokenRe;B.lastIndex=0;var N=B.test(k);B.lastIndex=0;var j=B.test(x),V=w.$mode.$pairQuotesAfter,W=V&&V[$]&&V[$].test(k);if(!W&&N||j||x&&!/[\s;,.})\]\\]/.test(x))return null;var H=T[L.column-2];if(k==$&&(H==$||B.test(H)))return null;O=!0}return{text:O?$+$:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(b,E,S,w,y){var D=w.$mode.$quotes||d,$=w.doc.getTextRange(y);if(!y.isMultiLine()&&D.hasOwnProperty($)){c(S);var A=w.doc.getLine(y.start.row),_=A.substring(y.start.column+1,y.start.column+2);if(_==$)return y.end.column++,y}}),v.closeDocComment!==!1&&this.add("doc comment end","insertion",function(b,E,S,w,y){if(b==="doc-start"&&(y===`
`||y===`\r
`)&&S.selection.isEmpty()){var D=S.getCursorPosition();if(D.column===0)return;for(var $=w.doc.getLine(D.row),A=w.doc.getLine(D.row+1),_=w.getTokens(D.row),L=0,T=0;T<_.length;T++){L+=_[T].value.length;var k=_[T];if(L>=D.column){if(L===D.column){if(!/\.doc/.test(k.type))return;if(/\*\//.test(k.value)){var x=_[T+1];if(!x||!/\.doc/.test(x.type))return}}var C=D.column-(L-k.value.length),M=k.value.indexOf("*/"),F=k.value.indexOf("/**",M>-1?M+2:0);if(F!==-1&&C>F&&C<F+3||M!==-1&&F!==-1&&C>=M&&C<=F||!/\.doc/.test(k.type))return;break}}var R=this.$getIndent($);if(/\s*\*/.test(A))return/^\s*\*/.test($)?{text:y+R+"* ",selection:[1,2+R.length,1,2+R.length]}:{text:y+R+" * ",selection:[1,3+R.length,1,3+R.length]};if(/\/\*\*/.test($.substring(0,D.column)))return{text:y+R+" * "+y+" "+R+"*/",selection:[1,4+R.length,1,4+R.length]}}})},g.isSaneInsertion=function(v,b){var E=v.getCursorPosition(),S=new p(b,E.row,E.column);if(!this.$matchTokenType(S.getCurrentToken()||"text",u)){if(/[)}\]]/.test(v.session.getLine(E.row)[E.column]))return!0;var w=new p(b,E.row,E.column+1);if(!this.$matchTokenType(w.getCurrentToken()||"text",u))return!1}return S.stepForward(),S.getCurrentTokenRow()!==E.row||this.$matchTokenType(S.getCurrentToken()||"text",r)},g.$matchTokenType=function(v,b){return b.indexOf(v.type||v)>-1},g.recordAutoInsert=function(v,b,E){var S=v.getCursorPosition(),w=b.doc.getLine(S.row);this.isAutoInsertedClosing(S,w,a.autoInsertedLineEnd[0])||(a.autoInsertedBrackets=0),a.autoInsertedRow=S.row,a.autoInsertedLineEnd=E+w.substr(S.column),a.autoInsertedBrackets++},g.recordMaybeInsert=function(v,b,E){var S=v.getCursorPosition(),w=b.doc.getLine(S.row);this.isMaybeInsertedClosing(S,w)||(a.maybeInsertedBrackets=0),a.maybeInsertedRow=S.row,a.maybeInsertedLineStart=w.substr(0,S.column)+E,a.maybeInsertedLineEnd=w.substr(S.column),a.maybeInsertedBrackets++},g.isAutoInsertedClosing=function(v,b,E){return a.autoInsertedBrackets>0&&v.row===a.autoInsertedRow&&E===a.autoInsertedLineEnd[0]&&b.substr(v.column)===a.autoInsertedLineEnd},g.isMaybeInsertedClosing=function(v,b){return a.maybeInsertedBrackets>0&&v.row===a.maybeInsertedRow&&b.substr(v.column)===a.maybeInsertedLineEnd&&b.substr(0,v.column)==a.maybeInsertedLineStart},g.popAutoInsertedClosing=function(){a.autoInsertedLineEnd=a.autoInsertedLineEnd.substr(1),a.autoInsertedBrackets--},g.clearMaybeInsertedClosing=function(){a&&(a.maybeInsertedBrackets=0,a.maybeInsertedRow=-1)},i.inherits(g,o),n.CstyleBehaviour=g}),ace.define("ace/unicode",["require","exports","module"],function(t,n,f){for(var i=[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],o=0,p=[],s=0;s<i.length;s+=2)p.push(o+=i[s]),i[s+1]&&p.push(45,o+=i[s+1]);n.wordChars=String.fromCharCode.apply(null,p)}),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(t,n,f){var i=t("../config"),o=t("../tokenizer").Tokenizer,p=t("./text_highlight_rules").TextHighlightRules,s=t("./behaviour/cstyle").CstyleBehaviour,u=t("../unicode"),r=t("../lib/lang"),a=t("../token_iterator").TokenIterator,l=t("../range").Range,d;d=function(){this.HighlightRules=p},(function(){this.$defaultBehaviour=new s,this.tokenRe=new RegExp("^["+u.wordChars+"\\$_]+","g"),this.nonTokenRe=new RegExp("^(?:[^"+u.wordChars+"\\$_]|\\s])+","g"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=this.$highlightRules||new this.HighlightRules(this.$highlightRuleConfig),this.$tokenizer=new o(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart="",this.blockComment="",this.toggleCommentLines=function(c,m,g,v){var b=m.doc,E=!0,S=!0,w=1/0,y=m.getTabSize(),D=!1;if(this.lineCommentStart){if(Array.isArray(this.lineCommentStart))var _=this.lineCommentStart.map(r.escapeRegExp).join("|"),$=this.lineCommentStart[0];else var _=r.escapeRegExp(this.lineCommentStart),$=this.lineCommentStart;_=new RegExp("^(\\s*)(?:"+_+") ?"),D=m.getUseSoftTabs();var k=function(j,V){var W=j.match(_);if(W){var H=W[1].length,U=W[0].length;!M(j,H,U)&&W[0][U-1]==" "&&U--,b.removeInLine(V,H,U)}},C=$+" ",T=function(j,V){(!E||/\S/.test(j))&&(M(j,w,w)?b.insertInLine({row:V,column:w},C):b.insertInLine({row:V,column:w},$))},x=function(j,V){return _.test(j)},M=function(j,V,W){for(var H=0;V--&&j.charAt(V)==" ";)H++;if(H%y!=0)return!1;for(var H=0;j.charAt(W++)==" ";)H++;return y>2?H%y!=y-1:H%y==0}}else{if(!this.blockComment)return!1;var $=this.blockComment.start,A=this.blockComment.end,_=new RegExp("^(\\s*)(?:"+r.escapeRegExp($)+")"),L=new RegExp("(?:"+r.escapeRegExp(A)+")\\s*$"),T=function(O,B){x(O,B)||(!E||/\S/.test(O))&&(b.insertInLine({row:B,column:O.length},A),b.insertInLine({row:B,column:w},$))},k=function(O,B){var N;(N=O.match(L))&&b.removeInLine(B,O.length-N[0].length,O.length),(N=O.match(_))&&b.removeInLine(B,N[1].length,N[0].length)},x=function(O,B){if(_.test(O))return!0;for(var N=m.getTokens(B),j=0;j<N.length;j++)if(N[j].type==="comment")return!0}}function F(O){for(var B=g;B<=v;B++)O(b.getLine(B),B)}var R=1/0;F(function(O,B){var N=O.search(/\S/);N!==-1?(N<w&&(w=N),S&&!x(O,B)&&(S=!1)):R>O.length&&(R=O.length)}),w==1/0&&(w=R,E=!1,S=!1),D&&w%y!=0&&(w=Math.floor(w/y)*y),F(S?k:T)},this.toggleBlockComment=function(c,m,g,v){var b=this.blockComment;if(b){!b.start&&b[0]&&(b=b[0]);var E=new a(m,v.row,v.column),S=E.getCurrentToken();m.selection;var w=m.selection.toOrientedRange(),y,D;if(S&&/comment/.test(S.type)){for(var $,A;S&&/comment/.test(S.type);){var _=S.value.indexOf(b.start);if(_!=-1){var L=E.getCurrentTokenRow(),T=E.getCurrentTokenColumn()+_;$=new l(L,T,L,T+b.start.length);break}S=E.stepBackward()}for(var E=new a(m,v.row,v.column),S=E.getCurrentToken();S&&/comment/.test(S.type);){var _=S.value.indexOf(b.end);if(_!=-1){var L=E.getCurrentTokenRow(),T=E.getCurrentTokenColumn()+_;A=new l(L,T,L,T+b.end.length);break}S=E.stepForward()}A&&m.remove(A),$&&(m.remove($),y=$.start.row,D=-b.start.length)}else D=b.start.length,y=g.start.row,m.insert(g.end,b.end),m.insert(g.start,b.start);w.start.row==y&&(w.start.column+=D),w.end.row==y&&(w.end.column+=D),m.selection.fromOrientedRange(w)}},this.getNextLineIndent=function(c,m,g){return this.$getIndent(m)},this.checkOutdent=function(c,m,g){return!1},this.autoOutdent=function(c,m,g){},this.$getIndent=function(c){return c.match(/^\s*/)[0]},this.createWorker=function(c){return null},this.createModeDelegates=function(c){this.$embeds=[],this.$modes={};for(var m in c)if(c[m]){var g=c[m],v=g.prototype.$id,b=i.$modes[v];b||(i.$modes[v]=b=new g),i.$modes[m]||(i.$modes[m]=b),this.$embeds.push(m),this.$modes[m]=b}for(var E=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"],S=function(y){(function(D){var $=E[y],A=D[$];D[E[y]]=function(){return this.$delegator($,arguments,A)}})(w)},w=this,m=0;m<E.length;m++)S(m)},this.$delegator=function(c,m,g){var v=m[0]||"start";if(typeof v!="string"){if(Array.isArray(v[2])){var b=v[2][v[2].length-1],E=this.$modes[b];if(E)return E[c].apply(E,[v[1]].concat([].slice.call(m,1)))}v=v[0]||"start"}for(var S=0;S<this.$embeds.length;S++)if(this.$modes[this.$embeds[S]]){var w=v.split(this.$embeds[S]);if(!w[0]&&w[1]){m[0]=w[1];var E=this.$modes[this.$embeds[S]];return E[c].apply(E,m)}}var y=g.apply(this,m);return g?y:void 0},this.transformAction=function(c,m,g,v,b){if(this.$behaviour){var E=this.$behaviour.getBehaviours();for(var S in E)if(E[S][m]){var w=E[S][m].apply(this,arguments);if(w)return w}}},this.getKeywords=function(c){if(!this.completionKeywords){var m=this.$tokenizer.rules,g=[];for(var v in m)for(var b=m[v],E=0,S=b.length;E<S;E++)if(typeof b[E].token=="string")/keyword|support|storage/.test(b[E].token)&&g.push(b[E].regex);else if(typeof b[E].token=="object"){for(var w=0,y=b[E].token.length;w<y;w++)if(/keyword|support|storage/.test(b[E].token[w])){var v=b[E].regex.match(/\(.+?\)/g)[w];g.push(v.substr(1,v.length-2))}}this.completionKeywords=g}return c?g.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(c,m,g,v){var b=this.$keywordList||this.$createKeywordList();return b.map(function(E){return{name:E,value:E,score:0,meta:"keyword"}})},this.$id="ace/mode/text"}).call(d.prototype),n.Mode=d}),ace.define("ace/line_widgets",["require","exports","module","ace/lib/dom"],function(t,n,f){var i=t("./lib/dom"),o=(function(){function p(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 p.prototype.getRowLength=function(s){var u;return this.lineWidgets?u=this.lineWidgets[s]&&this.lineWidgets[s].rowCount||0:u=0,!this.$useWrapMode||!this.$wrapData[s]?1+u:this.$wrapData[s].length+1+u},p.prototype.$getWidgetScreenLength=function(){var s=0;return this.lineWidgets.forEach(function(u){u&&u.rowCount&&!u.hidden&&(s+=u.rowCount)}),s},p.prototype.$onChangeEditor=function(s){this.attach(s.editor)},p.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)))},p.prototype.detach=function(s){var u=this.editor;if(u){this.editor=null,u.widgetManager=null,u.renderer.off("beforeRender",this.measureWidgets),u.renderer.off("afterRender",this.renderWidgets);var r=this.session.lineWidgets;r&&r.forEach(function(a){a&&a.el&&a.el.parentNode&&(a._inDocument=!1,a.el.parentNode.removeChild(a.el))})}},p.prototype.updateOnFold=function(s,u){var r=u.lineWidgets;if(!(!r||!s.action)){for(var a=s.data,l=a.start.row,d=a.end.row,c=s.action=="add",m=l+1;m<d;m++)r[m]&&(r[m].hidden=c);r[d]&&(c?r[l]?r[d].hidden=c:r[l]=r[d]:(r[l]==r[d]&&(r[l]=void 0),r[d].hidden=c))}},p.prototype.updateOnChange=function(s){var u=this.session.lineWidgets;if(u){var r=s.start.row,a=s.end.row-r;if(a!==0)if(s.action=="remove"){var l=u.splice(r+1,a);!u[r]&&l[l.length-1]&&(u[r]=l.pop()),l.forEach(function(c){c&&this.removeLineWidget(c)},this),this.$updateRows()}else{var d=new Array(a);u[r]&&u[r].column!=null&&s.start.column>u[r].column&&r++,d.unshift(r,0),u.splice.apply(u,d),this.$updateRows()}}},p.prototype.$updateRows=function(){var s=this.session.lineWidgets;if(s){var u=!0;s.forEach(function(r,a){if(r)for(u=!1,r.row=a;r.$oldWidget;)r.$oldWidget.row=a,r=r.$oldWidget}),u&&(this.session.lineWidgets=null)}},p.prototype.$registerLineWidget=function(s){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength()));var u=this.session.lineWidgets[s.row];return u&&(s.$oldWidget=u,u.el&&u.el.parentNode&&(u.el.parentNode.removeChild(u.el),u._inDocument=!1)),this.session.lineWidgets[s.row]=s,s},p.prototype.addLineWidget=function(s){if(this.$registerLineWidget(s),s.session=this.session,!this.editor)return s;var u=this.editor.renderer;s.html&&!s.el&&(s.el=i.createElement("div"),s.el.innerHTML=s.html),s.text&&!s.el&&(s.el=i.createElement("div"),s.el.textContent=s.text),s.el&&(i.addCssClass(s.el,"ace_lineWidgetContainer"),s.className&&i.addCssClass(s.el,s.className),s.el.style.position="absolute",s.el.style.zIndex="5",u.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/u.layerConfig.lineHeight);var r=this.session.getFoldAt(s.row,0);if(s.$fold=r,r){var a=this.session.lineWidgets;s.row==r.end.row&&!a[r.start.row]?a[r.start.row]=s:s.hidden=!0}return this.session._emit("changeFold",{data:{start:{row:s.row}}}),this.$updateRows(),this.renderWidgets(null,u),this.onWidgetChanged(s),s},p.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 u=this.session.lineWidgets[s.row];if(u==s)this.session.lineWidgets[s.row]=s.$oldWidget,s.$oldWidget&&this.onWidgetChanged(s.$oldWidget);else for(;u;){if(u.$oldWidget==s){u.$oldWidget=s.$oldWidget;break}u=u.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:s.row}}}),this.$updateRows()},p.prototype.getWidgetsAtRow=function(s){for(var u=this.session.lineWidgets,r=u&&u[s],a=[];r;)a.push(r),r=r.$oldWidget;return a},p.prototype.onWidgetChanged=function(s){this.session._changedWidgets.push(s),this.editor&&this.editor.renderer.updateFull()},p.prototype.measureWidgets=function(s,u){var r=this.session._changedWidgets,a=u.layerConfig;if(!(!r||!r.length)){for(var l=1/0,d=0;d<r.length;d++){var c=r[d];if(!(!c||!c.el)&&c.session==this.session){if(!c._inDocument){if(this.session.lineWidgets[c.row]!=c)continue;c._inDocument=!0,u.container.appendChild(c.el)}c.h=c.el.offsetHeight,c.fixedWidth||(c.w=c.el.offsetWidth,c.screenWidth=Math.ceil(c.w/a.characterWidth));var m=c.h/a.lineHeight;c.coverLine&&(m-=this.session.getRowLineCount(c.row),m<0&&(m=0)),c.rowCount!=m&&(c.rowCount=m,c.row<l&&(l=c.row))}}l!=1/0&&(this.session._emit("changeFold",{data:{start:{row:l}}}),this.session.lineWidgetWidth=null),this.session._changedWidgets=[]}},p.prototype.renderWidgets=function(s,u){var r=u.layerConfig,a=this.session.lineWidgets;if(a){for(var l=Math.min(this.firstRow,r.firstRow),d=Math.max(this.lastRow,r.lastRow,a.length);l>0&&!a[l];)l--;this.firstRow=r.firstRow,this.lastRow=r.lastRow,u.$cursorLayer.config=r;for(var c=l;c<=d;c++){var m=a[c];if(!(!m||!m.el)){if(m.hidden){m.el.style.top=-100-(m.pixelHeight||0)+"px";continue}m._inDocument||(m._inDocument=!0,u.container.appendChild(m.el));var g=u.$cursorLayer.getPixelPosition({row:c,column:0},!0).top;m.coverLine||(g+=r.lineHeight*this.session.getRowLineCount(m.row)),m.el.style.top=g-r.offset+"px";var v=m.coverGutter?0:u.gutterWidth;m.fixedWidth||(v-=u.scrollLeft),m.el.style.left=v+"px",m.fullWidth&&m.screenWidth&&(m.el.style.minWidth=r.width+2*r.padding+"px"),m.fixedWidth?m.el.style.right=u.scrollBar.getWidth()+"px":m.el.style.right=""}}}},p})();n.LineWidgets=o}),ace.define("ace/apply_delta",["require","exports","module"],function(t,n,f){n.applyDelta=function(i,o,p){var s=o.start.row,u=o.start.column,r=i[s]||"";switch(o.action){case"insert":var a=o.lines;if(a.length===1)i[s]=r.substring(0,u)+o.lines[0]+r.substring(u);else{var l=[s,1].concat(o.lines);i.splice.apply(i,l),i[s]=r.substring(0,u)+i[s],i[s+o.lines.length-1]+=r.substring(u)}break;case"remove":var d=o.end.column,c=o.end.row;s===c?i[s]=r.substring(0,u)+r.substring(d):i.splice(s,c-s+1,r.substring(0,u)+i[c].substring(d));break}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(t,n,f){var i=t("./lib/oop"),o=t("./lib/event_emitter").EventEmitter,p=(function(){function r(a,l,d){this.$onChange=this.onChange.bind(this),this.attach(a),typeof l!="number"?this.setPosition(l.row,l.column):this.setPosition(l,d)}return r.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},r.prototype.getDocument=function(){return this.document},r.prototype.onChange=function(a){if(!(a.start.row==a.end.row&&a.start.row!=this.row)&&!(a.start.row>this.row)){var l=u(a,{row:this.row,column:this.column},this.$insertRight);this.setPosition(l.row,l.column,!0)}},r.prototype.setPosition=function(a,l,d){var c;if(d?c={row:a,column:l}:c=this.$clipPositionToDocument(a,l),!(this.row==c.row&&this.column==c.column)){var m={row:this.row,column:this.column};this.row=c.row,this.column=c.column,this._signal("change",{old:m,value:c})}},r.prototype.detach=function(){this.document.off("change",this.$onChange)},r.prototype.attach=function(a){this.document=a||this.document,this.document.on("change",this.$onChange)},r.prototype.$clipPositionToDocument=function(a,l){var d={};return a>=this.document.getLength()?(d.row=Math.max(0,this.document.getLength()-1),d.column=this.document.getLine(d.row).length):a<0?(d.row=0,d.column=0):(d.row=a,d.column=Math.min(this.document.getLine(d.row).length,Math.max(0,l))),l<0&&(d.column=0),d},r})();p.prototype.$insertRight=!1,i.implement(p.prototype,o);function s(r,a,l){var d=l?r.column<=a.column:r.column<a.column;return r.row<a.row||r.row==a.row&&d}function u(r,a,l){var d=r.action=="insert",c=(d?1:-1)*(r.end.row-r.start.row),m=(d?1:-1)*(r.end.column-r.start.column),g=r.start,v=d?g:r.end;return s(a,g,l)?{row:a.row,column:a.column}:s(v,a,!l)?{row:a.row+c,column:a.column+(a.row==v.row?m:0)}:{row:g.row,column:g.column}}n.Anchor=p}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(t,n,f){var i=t("./lib/oop"),o=t("./apply_delta").applyDelta,p=t("./lib/event_emitter").EventEmitter,s=t("./range").Range,u=t("./anchor").Anchor,r=(function(){function a(l){this.$lines=[""],l.length===0?this.$lines=[""]:Array.isArray(l)?this.insertMergedLines({row:0,column:0},l):this.insert({row:0,column:0},l)}return a.prototype.setValue=function(l){var d=this.getLength()-1;this.remove(new s(0,0,d,this.getLine(d).length)),this.insert({row:0,column:0},l||"")},a.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},a.prototype.createAnchor=function(l,d){return new u(this,l,d)},a.prototype.$detectNewLine=function(l){var d=l.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=d?d[1]:`
`,this._signal("changeNewLineMode")},a.prototype.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return`\r
`;case"unix":return`
`;default:return this.$autoNewLine||`
`}},a.prototype.setNewLineMode=function(l){this.$newLineMode!==l&&(this.$newLineMode=l,this._signal("changeNewLineMode"))},a.prototype.getNewLineMode=function(){return this.$newLineMode},a.prototype.isNewLine=function(l){return l==`\r
`||l=="\r"||l==`
`},a.prototype.getLine=function(l){return this.$lines[l]||""},a.prototype.getLines=function(l,d){return this.$lines.slice(l,d+1)},a.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},a.prototype.getLength=function(){return this.$lines.length},a.prototype.getTextRange=function(l){return this.getLinesForRange(l).join(this.getNewLineCharacter())},a.prototype.getLinesForRange=function(l){var d;if(l.start.row===l.end.row)d=[this.getLine(l.start.row).substring(l.start.column,l.end.column)];else{d=this.getLines(l.start.row,l.end.row),d[0]=(d[0]||"").substring(l.start.column);var c=d.length-1;l.end.row-l.start.row==c&&(d[c]=d[c].substring(0,l.end.column))}return d},a.prototype.insertLines=function(l,d){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(l,d)},a.prototype.removeLines=function(l,d){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(l,d)},a.prototype.insertNewLine=function(l){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(l,["",""])},a.prototype.insert=function(l,d){return this.getLength()<=1&&this.$detectNewLine(d),this.insertMergedLines(l,this.$split(d))},a.prototype.insertInLine=function(l,d){var c=this.clippedPos(l.row,l.column),m=this.pos(l.row,l.column+d.length);return this.applyDelta({start:c,end:m,action:"insert",lines:[d]},!0),this.clonePos(m)},a.prototype.clippedPos=function(l,d){var c=this.getLength();l===void 0?l=c:l<0?l=0:l>=c&&(l=c-1,d=void 0);var m=this.getLine(l);return d==null&&(d=m.length),d=Math.min(Math.max(d,0),m.length),{row:l,column:d}},a.prototype.clonePos=function(l){return{row:l.row,column:l.column}},a.prototype.pos=function(l,d){return{row:l,column:d}},a.prototype.$clipPosition=function(l){var d=this.getLength();return l.row>=d?(l.row=Math.max(0,d-1),l.column=this.getLine(d-1).length):(l.row=Math.max(0,l.row),l.column=Math.min(Math.max(l.column,0),this.getLine(l.row).length)),l},a.prototype.insertFullLines=function(l,d){l=Math.min(Math.max(l,0),this.getLength());var c=0;l<this.getLength()?(d=d.concat([""]),c=0):(d=[""].concat(d),l--,c=this.$lines[l].length),this.insertMergedLines({row:l,column:c},d)},a.prototype.insertMergedLines=function(l,d){var c=this.clippedPos(l.row,l.column),m={row:c.row+d.length-1,column:(d.length==1?c.column:0)+d[d.length-1].length};return this.applyDelta({start:c,end:m,action:"insert",lines:d}),this.clonePos(m)},a.prototype.remove=function(l){var d=this.clippedPos(l.start.row,l.start.column),c=this.clippedPos(l.end.row,l.end.column);return this.applyDelta({start:d,end:c,action:"remove",lines:this.getLinesForRange({start:d,end:c})}),this.clonePos(d)},a.prototype.removeInLine=function(l,d,c){var m=this.clippedPos(l,d),g=this.clippedPos(l,c);return this.applyDelta({start:m,end:g,action:"remove",lines:this.getLinesForRange({start:m,end:g})},!0),this.clonePos(m)},a.prototype.removeFullLines=function(l,d){l=Math.min(Math.max(0,l),this.getLength()-1),d=Math.min(Math.max(0,d),this.getLength()-1);var c=d==this.getLength()-1&&l>0,m=d<this.getLength()-1,g=c?l-1:l,v=c?this.getLine(g).length:0,b=m?d+1:d,E=m?0:this.getLine(b).length,S=new s(g,v,b,E),w=this.$lines.slice(l,d+1);return this.applyDelta({start:S.start,end:S.end,action:"remove",lines:this.getLinesForRange(S)}),w},a.prototype.removeNewLine=function(l){l<this.getLength()-1&&l>=0&&this.applyDelta({start:this.pos(l,this.getLine(l).length),end:this.pos(l+1,0),action:"remove",lines:["",""]})},a.prototype.replace=function(l,d){if(l instanceof s||(l=s.fromPoints(l.start,l.end)),d.length===0&&l.isEmpty())return l.start;if(d==this.getTextRange(l))return l.end;this.remove(l);var c;return d?c=this.insert(l.start,d):c=l.start,c},a.prototype.applyDeltas=function(l){for(var d=0;d<l.length;d++)this.applyDelta(l[d])},a.prototype.revertDeltas=function(l){for(var d=l.length-1;d>=0;d--)this.revertDelta(l[d])},a.prototype.applyDelta=function(l,d){var c=l.action=="insert";(c?l.lines.length<=1&&!l.lines[0]:!s.comparePoints(l.start,l.end))||(c&&l.lines.length>2e4?this.$splitAndapplyLargeDelta(l,2e4):(o(this.$lines,l,d),this._signal("change",l)))},a.prototype.$safeApplyDelta=function(l){var d=this.$lines.length;(l.action=="remove"&&l.start.row<d&&l.end.row<d||l.action=="insert"&&l.start.row<=d)&&this.applyDelta(l)},a.prototype.$splitAndapplyLargeDelta=function(l,d){for(var c=l.lines,m=c.length-d+1,g=l.start.row,v=l.start.column,b=0,E=0;b<m;b=E){E+=d-1;var S=c.slice(b,E);S.push(""),this.applyDelta({start:this.pos(g+b,v),end:this.pos(g+E,v=0),action:l.action,lines:S},!0)}l.lines=c.slice(b),l.start.row=g+b,l.start.column=v,this.applyDelta(l,!0)},a.prototype.revertDelta=function(l){this.$safeApplyDelta({start:this.clonePos(l.start),end:this.clonePos(l.end),action:l.action=="insert"?"remove":"insert",lines:l.lines.slice()})},a.prototype.indexToPosition=function(l,d){for(var c=this.$lines||this.getAllLines(),m=this.getNewLineCharacter().length,g=d||0,v=c.length;g<v;g++)if(l-=c[g].length+m,l<0)return{row:g,column:l+c[g].length+m};return{row:v-1,column:l+c[v-1].length+m}},a.prototype.positionToIndex=function(l,d){for(var c=this.$lines||this.getAllLines(),m=this.getNewLineCharacter().length,g=0,v=Math.min(l.row,c.length),b=d||0;b<v;++b)g+=c[b].length+m;return g+l.column},a.prototype.$split=function(l){return l.split(/\r\n|\r|\n/)},a})();r.prototype.$autoNewLine="",r.prototype.$newLineMode="auto",i.implement(r.prototype,p),n.Document=r}),ace.define("ace/background_tokenizer",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(t,n,f){var i=t("./lib/oop"),o=t("./lib/event_emitter").EventEmitter,p=(function(){function s(u,r){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=u;var a=this;this.$worker=function(){if(a.running){for(var l=new Date,d=a.currentLine,c=-1,m=a.doc,g=d;a.lines[d];)d++;var v=m.getLength(),b=0;for(a.running=!1;d<v;){a.$tokenizeRow(d),c=d;do d++;while(a.lines[d]);if(b++,b%5===0&&new Date-l>20){a.running=setTimeout(a.$worker,20);break}}a.currentLine=d,c==-1&&(c=d),g<=c&&a.fireUpdateEvent(g,c)}}}return s.prototype.setTokenizer=function(u){this.tokenizer=u,this.lines=[],this.states=[],this.start(0)},s.prototype.setDocument=function(u){this.doc=u,this.lines=[],this.states=[],this.stop()},s.prototype.fireUpdateEvent=function(u,r){var a={first:u,last:r};this._signal("update",{data:a})},s.prototype.start=function(u){this.currentLine=Math.min(u||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(u){var r=u.start.row,a=u.end.row-r;if(a===0)this.lines[r]=null;else if(u.action=="remove")this.lines.splice(r,a+1,null),this.states.splice(r,a+1,null);else{var l=Array(a+1);l.unshift(r,1),this.lines.splice.apply(this.lines,l),this.states.splice.apply(this.states,l)}this.currentLine=Math.min(r,this.currentLine,this.doc.getLength()),this.stop()},s.prototype.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},s.prototype.getTokens=function(u){return this.lines[u]||this.$tokenizeRow(u)},s.prototype.getState=function(u){return this.currentLine==u&&this.$tokenizeRow(u),this.states[u]||"start"},s.prototype.$tokenizeRow=function(u){var r=this.doc.getLine(u),a=this.states[u-1],l=this.tokenizer.getLineTokens(r,a,u);return this.states[u]+""!=l.state+""?(this.states[u]=l.state,this.lines[u+1]=null,this.currentLine>u+1&&(this.currentLine=u+1)):this.currentLine==u&&(this.currentLine=u+1),this.lines[u]=l.tokens},s.prototype.cleanup=function(){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.removeAllListeners()},s})();i.implement(p.prototype,o),n.BackgroundTokenizer=p}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/range"],function(t,n,f){var i=t("./lib/lang"),o=t("./range").Range,p=(function(){function s(u,r,a){a===void 0&&(a="text"),this.setRegexp(u),this.clazz=r,this.type=a,this.docLen=0}return s.prototype.setRegexp=function(u){this.regExp+""!=u+""&&(this.regExp=u,this.cache=[])},s.prototype.update=function(u,r,a,l){if(this.regExp){for(var d=l.firstRow,c=l.lastRow,m={},g=a.$editor&&a.$editor.$search,v=g&&g.$isMultilineSearch(a.$editor.getLastSearchOptions()),b=d;b<=c;b++){var E=this.cache[b];if(E==null||a.getValue().length!=this.docLen){if(v){E=[];var S=g.$multiLineForward(a,this.regExp,b,c);if(S){var w=S.endRow<=c?S.endRow-1:c;w>b&&(b=w),E.push(new o(S.startRow,S.startCol,S.endRow,S.endCol))}E.length>this.MAX_RANGES&&(E=E.slice(0,this.MAX_RANGES))}else E=i.getMatchOffsets(a.getLine(b),this.regExp),E.length>this.MAX_RANGES&&(E=E.slice(0,this.MAX_RANGES)),E=E.map(function(A){return new o(b,A.offset,b,A.offset+A.length)});this.cache[b]=E.length?E:""}if(E.length!==0)for(var y=E.length;y--;){var D=E[y].toScreenRange(a),$=D.toString();m[$]||(m[$]=!0,r.drawSingleLineMarker(u,D,this.clazz,l))}}this.docLen=a.getValue().length}},s})();p.prototype.MAX_RANGES=500,n.SearchHighlight=p}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(t,n,f){var i=(function(){function w(){this.$keepRedoStack,this.$maxRev=0,this.$fromUndo=!1,this.$undoDepth=1/0,this.reset()}return w.prototype.addSession=function(y){this.$session=y},w.prototype.add=function(y,D,$){if(!this.$fromUndo&&y!=this.$lastDelta){if(this.$keepRedoStack||(this.$redoStack.length=0),D===!1||!this.lastDeltas){this.lastDeltas=[];var A=this.$undoStack.length;A>this.$undoDepth-1&&this.$undoStack.splice(0,A-this.$undoDepth+1),this.$undoStack.push(this.lastDeltas),y.id=this.$rev=++this.$maxRev}(y.action=="remove"||y.action=="insert")&&(this.$lastDelta=y),this.lastDeltas.push(y)}},w.prototype.addSelection=function(y,D){this.selections.push({value:y,rev:D||this.$rev})},w.prototype.startNewGroup=function(){return this.lastDeltas=null,this.$rev},w.prototype.markIgnored=function(y,D){D==null&&(D=this.$rev+1);for(var $=this.$undoStack,A=$.length;A--;){var _=$[A][0];if(_.id<=y)break;_.id<D&&(_.ignore=!0)}this.lastDeltas=null},w.prototype.getSelection=function(y,D){for(var $=this.selections,A=$.length;A--;){var _=$[A];if(_.rev<y)return D&&(_=$[A+1]),_}},w.prototype.getRevision=function(){return this.$rev},w.prototype.getDeltas=function(y,D){D==null&&(D=this.$rev+1);for(var $=this.$undoStack,A=null,_=0,L=$.length;L--;){var T=$[L][0];if(T.id<D&&!A&&(A=L+1),T.id<=y){_=L+1;break}}return $.slice(_,A)},w.prototype.getChangedRanges=function(y,D){D==null&&(D=this.$rev+1)},w.prototype.getChangedLines=function(y,D){D==null&&(D=this.$rev+1)},w.prototype.undo=function(y,D){this.lastDeltas=null;var $=this.$undoStack;if(o($,$.length)){y||(y=this.$session),this.$redoStackBaseRev!==this.$rev&&this.$redoStack.length&&(this.$redoStack=[]),this.$fromUndo=!0;var A=$.pop(),_=null;return A&&(_=y.undoChanges(A,D),this.$redoStack.push(A),this.$syncRev()),this.$fromUndo=!1,_}},w.prototype.redo=function(y,D){if(this.lastDeltas=null,y||(y=this.$session),this.$fromUndo=!0,this.$redoStackBaseRev!=this.$rev){var $=this.getDeltas(this.$redoStackBaseRev,this.$rev+1);S(this.$redoStack,$),this.$redoStackBaseRev=this.$rev,this.$redoStack.forEach(function(L){L[0].id=++this.$maxRev},this)}var A=this.$redoStack.pop(),_=null;return A&&(_=y.redoChanges(A,D),this.$undoStack.push(A),this.$syncRev()),this.$fromUndo=!1,_},w.prototype.$syncRev=function(){var y=this.$undoStack,D=y[y.length-1],$=D&&D[0].id||0;this.$redoStackBaseRev=$,this.$rev=$},w.prototype.reset=function(){this.lastDeltas=null,this.$lastDelta=null,this.$undoStack=[],this.$redoStack=[],this.$rev=0,this.mark=0,this.$redoStackBaseRev=this.$rev,this.selections=[]},w.prototype.canUndo=function(){return this.$undoStack.length>0},w.prototype.canRedo=function(){return this.$redoStack.length>0},w.prototype.bookmark=function(y){y==null&&(y=this.$rev),this.mark=y},w.prototype.isAtBookmark=function(){return this.$rev===this.mark},w.prototype.toJSON=function(){return{$redoStack:this.$redoStack,$undoStack:this.$undoStack}},w.prototype.fromJSON=function(y){this.reset(),this.$undoStack=y.$undoStack,this.$redoStack=y.$redoStack},w.prototype.$prettyPrint=function(y){return y?a(y):a(this.$undoStack)+`
---
`+a(this.$redoStack)},w})();i.prototype.hasUndo=i.prototype.canUndo,i.prototype.hasRedo=i.prototype.canRedo,i.prototype.isClean=i.prototype.isAtBookmark,i.prototype.markClean=i.prototype.bookmark;function o(w,y){for(var D=y;D--;){var $=w[D];if($&&!$[0].ignore){for(;D<y-1;){var A=c(w[D],w[D+1]);w[D]=A[0],w[D+1]=A[1],D++}return!0}}}var p=t("./range").Range,s=p.comparePoints;p.comparePoints;function u(w){return{row:w.row,column:w.column}}function r(w){return{start:u(w.start),end:u(w.end),action:w.action,lines:w.lines.slice()}}function a(w){if(w=w||this,Array.isArray(w))return w.map(a).join(`
`);var y="";return w.action?(y=w.action=="insert"?"+":"-",y+="["+w.lines+"]"):w.value&&(Array.isArray(w.value)?y=w.value.map(l).join(`
`):y=l(w.value)),w.start&&(y+=l(w)),(w.id||w.rev)&&(y+=" ("+(w.id||w.rev)+")"),y}function l(w){return w.start.row+":"+w.start.column+"=>"+w.end.row+":"+w.end.column}function d(w,y){var D=w.action=="insert",$=y.action=="insert";if(D&&$)if(s(y.start,w.end)>=0)g(y,w,-1);else if(s(y.start,w.start)<=0)g(w,y,1);else return null;else if(D&&!$)if(s(y.start,w.end)>=0)g(y,w,-1);else if(s(y.end,w.start)<=0)g(w,y,-1);else return null;else if(!D&&$)if(s(y.start,w.start)>=0)g(y,w,1);else if(s(y.start,w.start)<=0)g(w,y,1);else return null;else if(!D&&!$)if(s(y.start,w.start)>=0)g(y,w,1);else if(s(y.end,w.start)<=0)g(w,y,-1);else return null;return[y,w]}function c(w,y){for(var D=w.length;D--;)for(var $=0;$<y.length;$++)if(!d(w[D],y[$])){for(;D<w.length;){for(;$--;)d(y[$],w[D]);$=y.length,D++}return[w,y]}return w.selectionBefore=y.selectionBefore=w.selectionAfter=y.selectionAfter=null,[y,w]}function m(w,y){var D=w.action=="insert",$=y.action=="insert";if(D&&$)s(w.start,y.start)<0?g(y,w,1):g(w,y,1);else if(D&&!$)s(w.start,y.end)>=0?g(w,y,-1):(s(w.start,y.start)<=0||g(w,p.fromPoints(y.start,w.start),-1),g(y,w,1));else if(!D&&$)s(y.start,w.end)>=0?g(y,w,-1):(s(y.start,w.start)<=0||g(y,p.fromPoints(w.start,y.start),-1),g(w,y,1));else if(!D&&!$)if(s(y.start,w.end)>=0)g(y,w,-1);else if(s(y.end,w.start)<=0)g(w,y,-1);else{var A,_;return s(w.start,y.start)<0&&(A=w,w=b(w,y.start)),s(w.end,y.end)>0&&(_=b(w,y.end)),v(y.end,w.start,w.end,-1),_&&!A&&(w.lines=_.lines,w.start=_.start,w.end=_.end,_=w),[y,A,_].filter(Boolean)}return[y,w]}function g(w,y,D){v(w.start,y.start,y.end,D),v(w.end,y.start,y.end,D)}function v(w,y,D,$){w.row==($==1?y:D).row&&(w.column+=$*(D.column-y.column)),w.row+=$*(D.row-y.row)}function b(w,y){var D=w.lines,$=w.end;w.end=u(y);var A=w.end.row-w.start.row,_=D.splice(A,D.length),L=A?y.column:y.column-w.start.column;D.push(_[0].substring(0,L)),_[0]=_[0].substr(L);var T={start:u(y),end:$,lines:_,action:w.action};return T}function E(w,y){y=r(y);for(var D=w.length;D--;){for(var $=w[D],A=0;A<$.length;A++){var _=$[A],L=m(_,y);y=L[0],L.length!=2&&(L[2]?($.splice(A+1,1,L[1],L[2]),A++):L[1]||($.splice(A,1),A--))}$.length||w.splice(D,1)}return w}function S(w,y){for(var D=0;D<y.length;D++)for(var $=y[D],A=0;A<$.length;A++)E(w,$[A])}n.UndoManager=i}),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(t,n,f){var i=t("../range").Range,o=(function(){function p(s,u){this.foldData=s,Array.isArray(u)?this.folds=u:u=this.folds=[u];var r=u[u.length-1];this.range=new i(u[0].start.row,u[0].start.column,r.end.row,r.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(a){a.setFoldLine(this)},this)}return p.prototype.shiftRow=function(s){this.start.row+=s,this.end.row+=s,this.folds.forEach(function(u){u.start.row+=s,u.end.row+=s})},p.prototype.addFold=function(s){if(s.sameRow){if(s.start.row<this.startRow||s.endRow>this.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(s),this.folds.sort(function(u,r){return-u.range.compareEnd(r.start.row,r.start.column)}),this.range.compareEnd(s.start.row,s.start.column)>0?(this.end.row=s.end.row,this.end.column=s.end.column):this.range.compareStart(s.end.row,s.end.column)<0&&(this.start.row=s.start.row,this.start.column=s.start.column)}else if(s.start.row==this.end.row)this.folds.push(s),this.end.row=s.end.row,this.end.column=s.end.column;else if(s.end.row==this.start.row)this.folds.unshift(s),this.start.row=s.start.row,this.start.column=s.start.column;else throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");s.foldLine=this},p.prototype.containsRow=function(s){return s>=this.start.row&&s<=this.end.row},p.prototype.walk=function(s,u,r){var a=0,l=this.folds,d,c,m,g=!0;u==null&&(u=this.end.row,r=this.end.column);for(var v=0;v<l.length;v++){if(d=l[v],c=d.range.compareStart(u,r),c==-1){s(null,u,r,a,g);return}if(m=s(null,d.start.row,d.start.column,a,g),m=!m&&s(d.placeholder,d.start.row,d.start.column,a),m||c===0)return;g=!d.sameRow,a=d.end.column}s(null,u,r,a,g)},p.prototype.getNextFoldTo=function(s,u){for(var r,a,l=0;l<this.folds.length;l++){if(r=this.folds[l],a=r.range.compareEnd(s,u),a==-1)return{fold:r,kind:"after"};if(a===0)return{fold:r,kind:"inside"}}return null},p.prototype.addRemoveChars=function(s,u,r){var a=this.getNextFoldTo(s,u),l,d;if(a){if(l=a.fold,a.kind=="inside"&&l.start.column!=u&&l.start.row!=s)window.console&&window.console.log(s,u,l);else if(l.start.row==s){d=this.folds;var c=d.indexOf(l);for(c===0&&(this.start.column+=r),c;c<d.length;c++){if(l=d[c],l.start.column+=r,!l.sameRow)return;l.end.column+=r}this.end.column+=r}}},p.prototype.split=function(s,u){var r=this.getNextFoldTo(s,u);if(!r||r.kind=="inside")return null;var a=r.fold,l=this.folds,d=this.foldData,c=l.indexOf(a),m=l[c-1];this.end.row=m.end.row,this.end.column=m.end.column,l=l.splice(c,l.length-c);var g=new p(d,l);return d.splice(d.indexOf(this)+1,0,g),g},p.prototype.merge=function(s){for(var u=s.folds,r=0;r<u.length;r++)this.addFold(u[r]);var a=this.foldData;a.splice(a.indexOf(s),1)},p.prototype.toString=function(){var s=[this.range.toString()+": ["];return this.folds.forEach(function(u){s.push(" "+u.toString())}),s.push("]"),s.join(`
`)},p.prototype.idxToPosition=function(s){for(var u=0,r=0;r<this.folds.length;r++){var a=this.folds[r];if(s-=a.start.column-u,s<0)return{row:a.start.row,column:a.start.column+s};if(s-=a.placeholder.length,s<0)return a.start;u=a.end.column}return{row:this.end.row,column:this.end.column+s}},p})();n.FoldLine=o}),ace.define("ace/range_list",["require","exports","module","ace/range"],function(t,n,f){var i=t("./range").Range,o=i.comparePoints,p=(function(){function s(){this.ranges=[],this.$bias=1}return s.prototype.pointIndex=function(u,r,a){for(var l=this.ranges,d=a||0;d<l.length;d++){var c=l[d],m=o(u,c.end);if(!(m>0)){var g=o(u,c.start);return m===0?r&&g!==0?-d-2:d:g>0||g===0&&!r?d:-d-1}}return-d-1},s.prototype.add=function(u){var r=!u.isEmpty(),a=this.pointIndex(u.start,r);a<0&&(a=-a-1);var l=this.pointIndex(u.end,r,a);return l<0?l=-l-1:l++,this.ranges.splice(a,l-a,u)},s.prototype.addList=function(u){for(var r=[],a=u.length;a--;)r.push.apply(r,this.add(u[a]));return r},s.prototype.substractPoint=function(u){var r=this.pointIndex(u);if(r>=0)return this.ranges.splice(r,1)},s.prototype.merge=function(){var u=[],r=this.ranges;r=r.sort(function(m,g){return o(m.start,g.start)});for(var a=r[0],l,d=1;d<r.length;d++){l=a,a=r[d];var c=o(l.end,a.start);c<0||c==0&&!l.isEmpty()&&!a.isEmpty()||(o(l.end,a.end)<0&&(l.end.row=a.end.row,l.end.column=a.end.column),r.splice(d,1),u.push(a),a=l,d--)}return this.ranges=r,u},s.prototype.contains=function(u,r){return this.pointIndex({row:u,column:r})>=0},s.prototype.containsPoint=function(u){return this.pointIndex(u)>=0},s.prototype.rangeAtPoint=function(u){var r=this.pointIndex(u);if(r>=0)return this.ranges[r]},s.prototype.clipRows=function(u,r){var a=this.ranges;if(a[0].start.row>r||a[a.length-1].start.row<u)return[];var l=this.pointIndex({row:u,column:0});l<0&&(l=-l-1);var d=this.pointIndex({row:r,column:0},l);d<0&&(d=-d-1);for(var c=[],m=l;m<d;m++)c.push(a[m]);return c},s.prototype.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},s.prototype.attach=function(u){this.session&&this.detach(),this.session=u,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(u){for(var r=u.start,a=u.end,l=r.row,d=a.row,c=this.ranges,m=0,g=c.length;m<g;m++){var v=c[m];if(v.end.row>=l)break}if(u.action=="insert")for(var b=d-l,E=-r.column+a.column;m<g;m++){var v=c[m];if(v.start.row>l)break;if(v.start.row==l&&v.start.column>=r.column&&(v.start.column==r.column&&this.$bias<=0||(v.start.column+=E,v.start.row+=b)),v.end.row==l&&v.end.column>=r.column){if(v.end.column==r.column&&this.$bias<0)continue;v.end.column==r.column&&E>0&&m<g-1&&v.end.column>v.start.column&&v.end.column==c[m+1].start.column&&(v.end.column-=E),v.end.column+=E,v.end.row+=b}}else for(var b=l-d,E=r.column-a.column;m<g;m++){var v=c[m];if(v.start.row>d)break;v.end.row<d&&(l<v.end.row||l==v.end.row&&r.column<v.end.column)?(v.end.row=l,v.end.column=r.column):v.end.row==d?v.end.column<=a.column?(b||v.end.column>r.column)&&(v.end.column=r.column,v.end.row=r.row):(v.end.column+=E,v.end.row+=b):v.end.row>d&&(v.end.row+=b),v.start.row<d&&(l<v.start.row||l==v.start.row&&r.column<v.start.column)?(v.start.row=l,v.start.column=r.column):v.start.row==d?v.start.column<=a.column?(b||v.start.column>r.column)&&(v.start.column=r.column,v.start.row=r.row):(v.start.column+=E,v.start.row+=b):v.start.row>d&&(v.start.row+=b)}if(b!=0&&m<g)for(;m<g;m++){var v=c[m];v.start.row+=b,v.end.row+=b}},s})();p.prototype.comparePoints=o,n.RangeList=p}),ace.define("ace/edit_session/fold",["require","exports","module","ace/range_list"],function(t,n,f){var i=this&&this.__extends||(function(){var l=function(d,c){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,g){m.__proto__=g}||function(m,g){for(var v in g)Object.prototype.hasOwnProperty.call(g,v)&&(m[v]=g[v])},l(d,c)};return function(d,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");l(d,c);function m(){this.constructor=d}d.prototype=c===null?Object.create(c):(m.prototype=c.prototype,new m)}})(),o=t("../range_list").RangeList,p=(function(l){i(d,l);function d(c,m){var g=l.call(this)||this;return g.foldLine=null,g.placeholder=m,g.range=c,g.start=c.start,g.end=c.end,g.sameRow=c.start.row==c.end.row,g.subFolds=g.ranges=[],g}return d.prototype.toString=function(){return'"'+this.placeholder+'" '+this.range.toString()},d.prototype.setFoldLine=function(c){this.foldLine=c,this.subFolds.forEach(function(m){m.setFoldLine(c)})},d.prototype.clone=function(){var c=this.range.clone(),m=new d(c,this.placeholder);return this.subFolds.forEach(function(g){m.subFolds.push(g.clone())}),m.collapseChildren=this.collapseChildren,m},d.prototype.addSubFold=function(c){if(!this.range.isEqual(c)){u(c,this.start);for(var E=c.start.row,S=c.start.column,m=0,g=-1;m<this.subFolds.length&&(g=this.subFolds[m].range.compare(E,S),g==1);m++);var v=this.subFolds[m],b=0;if(g==0){if(v.range.containsRange(c))return v.addSubFold(c);b=1}for(var E=c.range.end.row,S=c.range.end.column,w=m,g=-1;w<this.subFolds.length&&(g=this.subFolds[w].range.compare(E,S),g==1);w++);g==0&&w++;for(var y=this.subFolds.splice(m,w-m,c),D=g==0?y.length-1:y.length,$=b;$<D;$++)c.addSubFold(y[$]);return c.setFoldLine(this.foldLine),c}},d.prototype.restoreRange=function(c){return a(c,this.start)},d})(o);function s(l,d){l.row-=d.row,l.row==0&&(l.column-=d.column)}function u(l,d){s(l.start,d),s(l.end,d)}function r(l,d){l.row==0&&(l.column+=d.column),l.row+=d.row}function a(l,d){r(l.start,d),r(l.end,d)}n.Fold=p}),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(t,n,f){var i=t("../range").Range,o=t("./fold_line").FoldLine,p=t("./fold").Fold,s=t("../token_iterator").TokenIterator,u=t("../mouse/mouse_event").MouseEvent;function r(){this.getFoldAt=function(a,l,d){var c=this.getFoldLine(a);if(!c)return null;for(var m=c.folds,g=0;g<m.length;g++){var v=m[g].range;if(v.contains(a,l)){if(d==1&&v.isEnd(a,l)&&!v.isEmpty())continue;if(d==-1&&v.isStart(a,l)&&!v.isEmpty())continue;return m[g]}}},this.getFoldsInRange=function(a){var l=a.start,d=a.end,c=this.$foldData,m=[];l.column+=1,d.column-=1;for(var g=0;g<c.length;g++){var v=c[g].range.compareRange(a);if(v!=2){if(v==-2)break;for(var b=c[g].folds,E=0;E<b.length;E++){var S=b[E];if(v=S.range.compareRange(a),v==-2)break;if(v==2)continue;if(v==42)break;m.push(S)}}}return l.column-=1,d.column+=1,m},this.getFoldsInRangeList=function(a){if(Array.isArray(a)){var l=[];a.forEach(function(d){l=l.concat(this.getFoldsInRange(d))},this)}else var l=this.getFoldsInRange(a);return l},this.getAllFolds=function(){for(var a=[],l=this.$foldData,d=0;d<l.length;d++)for(var c=0;c<l[d].folds.length;c++)a.push(l[d].folds[c]);return a},this.getFoldStringAt=function(a,l,d,c){if(c=c||this.getFoldLine(a),!c)return null;for(var m={end:{column:0}},g,v,b=0;b<c.folds.length;b++){v=c.folds[b];var E=v.range.compareEnd(a,l);if(E==-1){g=this.getLine(v.start.row).substring(m.end.column,v.start.column);break}else if(E===0)return null;m=v}return g||(g=this.getLine(v.start.row).substring(m.end.column)),d==-1?g.substring(0,l-m.end.column):d==1?g.substring(l-m.end.column):g},this.getFoldLine=function(a,l){var d=this.$foldData,c=0;for(l&&(c=d.indexOf(l)),c==-1&&(c=0),c;c<d.length;c++){var m=d[c];if(m.start.row<=a&&m.end.row>=a)return m;if(m.end.row>a)return null}return null},this.getNextFoldLine=function(a,l){var d=this.$foldData,c=0;for(l&&(c=d.indexOf(l)),c==-1&&(c=0),c;c<d.length;c++){var m=d[c];if(m.end.row>=a)return m}return null},this.getFoldedRowCount=function(a,l){for(var d=this.$foldData,c=l-a+1,m=0;m<d.length;m++){var g=d[m],v=g.end.row,b=g.start.row;if(v>=l){b<l&&(b>=a?c-=l-b:c=0);break}else v>=a&&(b>=a?c-=v-b:c-=v-a+1)}return c},this.$addFoldLine=function(a){return this.$foldData.push(a),this.$foldData.sort(function(l,d){return l.start.row-d.start.row}),a},this.addFold=function(a,l){var d=this.$foldData,c=!1,m;a instanceof p?m=a:(m=new p(l,a),m.collapseChildren=l.collapseChildren),this.$clipRangeToDocument(m.range);var g=m.start.row,v=m.start.column,b=m.end.row,E=m.end.column,S=this.getFoldAt(g,v,1),w=this.getFoldAt(b,E,-1);if(S&&w==S)return S.addSubFold(m);S&&!S.range.isStart(g,v)&&this.removeFold(S),w&&!w.range.isEnd(b,E)&&this.removeFold(w);var y=this.getFoldsInRange(m.range);y.length>0&&(this.removeFolds(y),m.collapseChildren||y.forEach(function(_){m.addSubFold(_)}));for(var D=0;D<d.length;D++){var $=d[D];if(b==$.start.row){$.addFold(m),c=!0;break}else if(g==$.end.row){if($.addFold(m),c=!0,!m.sameRow){var A=d[D+1];if(A&&A.start.row==b){$.merge(A);break}}break}else if(b<=$.start.row)break}return c||($=this.$addFoldLine(new o(this.$foldData,m))),this.$useWrapMode?this.$updateWrapData($.start.row,$.start.row):this.$updateRowLengthCache($.start.row,$.start.row),this.$modified=!0,this._signal("changeFold",{data:m,action:"add"}),m},this.addFolds=function(a){a.forEach(function(l){this.addFold(l)},this)},this.removeFold=function(a){var l=a.foldLine,d=l.start.row,c=l.end.row,m=this.$foldData,g=l.folds;if(g.length==1)m.splice(m.indexOf(l),1);else if(l.range.isEnd(a.end.row,a.end.column))g.pop(),l.end.row=g[g.length-1].end.row,l.end.column=g[g.length-1].end.column;else if(l.range.isStart(a.start.row,a.start.column))g.shift(),l.start.row=g[0].start.row,l.start.column=g[0].start.column;else if(a.sameRow)g.splice(g.indexOf(a),1);else{var v=l.split(a.start.row,a.start.column);g=v.folds,g.shift(),v.start.row=g[0].start.row,v.start.column=g[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(d,c):this.$updateRowLengthCache(d,c)),this.$modified=!0,this._signal("changeFold",{data:a,action:"remove"})},this.removeFolds=function(a){for(var l=[],d=0;d<a.length;d++)l.push(a[d]);l.forEach(function(c){this.removeFold(c)},this),this.$modified=!0},this.expandFold=function(a){this.removeFold(a),a.subFolds.forEach(function(l){a.restoreRange(l),this.addFold(l)},this),a.collapseChildren>0&&this.foldAll(a.start.row+1,a.end.row,a.collapseChildren-1),a.subFolds=[]},this.expandFolds=function(a){a.forEach(function(l){this.expandFold(l)},this)},this.unfold=function(a,l){var d,c;if(a==null)d=new i(0,0,this.getLength(),0),l==null&&(l=!0);else if(typeof a=="number")d=new i(a,0,a,this.getLine(a).length);else if("row"in a)d=i.fromPoints(a,a);else{if(Array.isArray(a))return c=[],a.forEach(function(g){c=c.concat(this.unfold(g))},this),c;d=a}c=this.getFoldsInRangeList(d);for(var m=c;c.length==1&&i.comparePoints(c[0].start,d.start)<0&&i.comparePoints(c[0].end,d.end)>0;)this.expandFolds(c),c=this.getFoldsInRangeList(d);if(l!=!1?this.removeFolds(c):this.expandFolds(c),m.length)return m},this.isRowFolded=function(a,l){return!!this.getFoldLine(a,l)},this.getRowFoldEnd=function(a,l){var d=this.getFoldLine(a,l);return d?d.end.row:a},this.getRowFoldStart=function(a,l){var d=this.getFoldLine(a,l);return d?d.start.row:a},this.getFoldDisplayLine=function(a,l,d,c,m){c==null&&(c=a.start.row),m==null&&(m=0),l==null&&(l=a.end.row),d==null&&(d=this.getLine(l).length);var g=this.doc,v="";return a.walk(function(b,E,S,w){if(!(E<c)){if(E==c){if(S<m)return;w=Math.max(m,w)}b!=null?v+=b:v+=g.getLine(E).substring(w,S)}},l,d),v},this.getDisplayLine=function(a,l,d,c){var m=this.getFoldLine(a);if(m)return this.getFoldDisplayLine(m,a,l,d,c);var g;return g=this.doc.getLine(a),g.substring(c||0,l||g.length)},this.$cloneFoldData=function(){var a=[];return a=this.$foldData.map(function(l){var d=l.folds.map(function(c){return c.clone()});return new o(a,d)}),a},this.toggleFold=function(a){var l=this.selection,d=l.getRange(),c,m;if(d.isEmpty()){var g=d.start;if(c=this.getFoldAt(g.row,g.column),c){this.expandFold(c);return}else if(a){var v=this.getFoldLine(g.row);v&&this.expandFolds(v.folds);return}else(m=this.findMatchingBracket(g))?d.comparePoint(m)==1?d.end=m:(d.start=m,d.start.column++,d.end.column--):(m=this.findMatchingBracket({row:g.row,column:g.column+1}))?(d.comparePoint(m)==1?d.end=m:d.start=m,d.start.column++):d=this.getCommentFoldRange(g.row,g.column)||d}else{var b=this.getFoldsInRange(d);if(a&&b.length){this.expandFolds(b);return}else b.length==1&&(c=b[0])}if(c||(c=this.getFoldAt(d.start.row,d.start.column)),c&&c.range.toString()==d.toString()){this.expandFold(c);return}var E="...";if(!d.isMultiLine()){if(E=this.getTextRange(d),E.length<4)return;E=E.trim().substring(0,2)+".."}this.addFold(E,d)},this.getCommentFoldRange=function(a,l,d){var c=new s(this,a,l),m=c.getCurrentToken(),g=m&&m.type;if(m&&/^comment|string/.test(g)){g=g.match(/comment|string/)[0],g=="comment"&&(g+="|doc-start|\\.doc");var v=new RegExp(g),b=new i;if(d!=1){do m=c.stepBackward();while(m&&v.test(m.type));m=c.stepForward()}b.start.row=c.getCurrentTokenRow(),b.start.column=c.getCurrentTokenColumn()+m.value.length,c=new s(this,a,l);var E=this.getState(c.$row);if(d!=-1){var S=-1;do if(m=c.stepForward(),S==-1){var w=this.getState(c.$row);E.toString()!==w.toString()&&(S=c.$row)}else if(c.$row>S)break;while(m&&v.test(m.type));m=c.stepBackward()}else m=c.getCurrentToken();return b.end.row=c.getCurrentTokenRow(),b.end.column=c.getCurrentTokenColumn(),b.start.row==b.end.row&&b.start.column>b.end.column?void 0:b}},this.foldAll=function(a,l,d,c){d==null&&(d=1e5);var m=this.foldWidgets;if(m){l=l||this.getLength(),a=a||0;for(var g=a;g<l;g++)if(m[g]==null&&(m[g]=this.getFoldWidget(g)),m[g]=="start"&&!(c&&!c(g))){var v=this.getFoldWidgetRange(g);v&&v.isMultiLine()&&v.end.row<=l&&v.start.row>=a&&(g=v.end.row,v.collapseChildren=d,this.addFold("...",v))}}},this.foldToLevel=function(a){for(this.foldAll();a-- >0;)this.unfold(null,!1)},this.foldAllComments=function(){var a=this;this.foldAll(null,null,null,function(l){for(var d=a.getTokens(l),c=0;c<d.length;c++){var m=d[c];if(!(m.type=="text"&&/^\s+$/.test(m.value)))return!!/comment/.test(m.type)}})},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(a){if(!this.$foldStyles[a])throw new Error("invalid fold style: "+a+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle!=a){this.$foldStyle=a,a=="manual"&&this.unfold();var l=this.$foldMode;this.$setFolding(null),this.$setFolding(l)}},this.$setFolding=function(a){if(this.$foldMode!=a){if(this.$foldMode=a,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation"),!a||this.$foldStyle=="manual"){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=a.getFoldWidget.bind(a,this,this.$foldStyle),this.getFoldWidgetRange=a.getFoldWidgetRange.bind(a,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(a,l){var d=this.foldWidgets;if(!d||l&&d[a])return{};for(var c=a-1,m;c>=0;){var g=d[c];if(g==null&&(g=d[c]=this.getFoldWidget(c)),g=="start"){var v=this.getFoldWidgetRange(c);if(m||(m=v),v&&v.end.row>=a)break}c--}return{range:c!==-1&&v,firstRange:m}},this.onFoldWidgetClick=function(a,l){l instanceof u&&(l=l.domEvent);var d={children:l.shiftKey,all:l.ctrlKey||l.metaKey,siblings:l.altKey},c=this.$toggleFoldWidget(a,d);if(!c){var m=l.target||l.srcElement;m&&/ace_fold-widget/.test(m.className)&&(m.className+=" ace_invalid")}},this.$toggleFoldWidget=function(a,l){if(this.getFoldWidget){var d=this.getFoldWidget(a),c=this.getLine(a),m=d==="end"?-1:1,g=this.getFoldAt(a,m===-1?0:c.length,m);if(g)return l.children||l.all?this.removeFold(g):this.expandFold(g),g;var v=this.getFoldWidgetRange(a,!0);if(v&&!v.isMultiLine()&&(g=this.getFoldAt(v.start.row,v.start.column,1),g&&v.isEqual(g.range)))return this.removeFold(g),g;if(l.siblings){var b=this.getParentFoldRangeData(a);if(b.range)var E=b.range.start.row+1,S=b.range.end.row;this.foldAll(E,S,l.all?1e4:0)}else l.children?(S=v?v.end.row:this.getLength(),this.foldAll(a+1,S,l.all?1e4:0)):v&&(l.all&&(v.collapseChildren=1e4),this.addFold("...",v));return v}},this.toggleFoldWidget=function(a){var l=this.selection.getCursor().row;l=this.getRowFoldStart(l);var d=this.$toggleFoldWidget(l,{});if(!d){var c=this.getParentFoldRangeData(l,!0);if(d=c.range||c.firstRange,d){l=d.start.row;var m=this.getFoldAt(l,this.getLine(l).length,1);m?this.removeFold(m):this.addFold("...",d)}}},this.updateFoldWidgets=function(a){var l=a.start.row,d=a.end.row-l;if(d===0)this.foldWidgets[l]=null;else if(a.action=="remove")this.foldWidgets.splice(l,d+1,null);else{var c=Array(d+1);c.unshift(l,1),this.foldWidgets.splice.apply(this.foldWidgets,c)}},this.tokenizerUpdateFoldWidgets=function(a){var l=a.data;l.first!=l.last&&this.foldWidgets.length>l.first&&this.foldWidgets.splice(l.first,this.foldWidgets.length)}}n.Folding=r}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(t,n,f){var i=t("../token_iterator").TokenIterator,o=t("../range").Range;function p(){this.findMatchingBracket=function(s,u){if(s.column==0)return null;var r=u||this.getLine(s.row).charAt(s.column-1);if(r=="")return null;var a=r.match(/([\(\[\{])|([\)\]\}])/);return a?a[1]?this.$findClosingBracket(a[1],s):this.$findOpeningBracket(a[2],s):null},this.getBracketRange=function(s){var u=this.getLine(s.row),r=!0,a,l=u.charAt(s.column-1),d=l&&l.match(/([\(\[\{])|([\)\]\}])/);if(d||(l=u.charAt(s.column),s={row:s.row,column:s.column+1},d=l&&l.match(/([\(\[\{])|([\)\]\}])/),r=!1),!d)return null;if(d[1]){var c=this.$findClosingBracket(d[1],s);if(!c)return null;a=o.fromPoints(s,c),r||(a.end.column++,a.start.column--),a.cursor=a.end}else{var c=this.$findOpeningBracket(d[2],s);if(!c)return null;a=o.fromPoints(c,s),r||(a.start.column++,a.end.column--),a.cursor=a.start}return a},this.getMatchingBracketRanges=function(s,u){var r=this.getLine(s.row),a=/([\(\[\{])|([\)\]\}])/,l=!u&&r.charAt(s.column-1),d=l&&l.match(a);if(d||(l=(u===void 0||u)&&r.charAt(s.column),s={row:s.row,column:s.column+1},d=l&&l.match(a)),!d)return null;var c=new o(s.row,s.column-1,s.row,s.column),m=d[1]?this.$findClosingBracket(d[1],s):this.$findOpeningBracket(d[2],s);if(!m)return[c];var g=new o(m.row,m.column,m.row,m.column+1);return[c,g]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(s,u,r){var a=this.$brackets[s],l=1,d=new i(this,u.row,u.column),c=d.getCurrentToken();if(c||(c=d.stepForward()),!!c){r||(r=new RegExp("(\\.?"+c.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)").replace(/-close\b/,"-(close|open)")+")+"));for(var m=u.column-d.getCurrentTokenColumn()-2,g=c.value;;){for(;m>=0;){var v=g.charAt(m);if(v==a){if(l-=1,l==0)return{row:d.getCurrentTokenRow(),column:m+d.getCurrentTokenColumn()}}else v==s&&(l+=1);m-=1}do c=d.stepBackward();while(c&&!r.test(c.type));if(c==null)break;g=c.value,m=g.length-1}return null}},this.$findClosingBracket=function(s,u,r){var a=this.$brackets[s],l=1,d=new i(this,u.row,u.column),c=d.getCurrentToken();if(c||(c=d.stepForward()),!!c){r||(r=new RegExp("(\\.?"+c.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)").replace(/-open\b/,"-(close|open)")+")+"));for(var m=u.column-d.getCurrentTokenColumn();;){for(var g=c.value,v=g.length;m<v;){var b=g.charAt(m);if(b==a){if(l-=1,l==0)return{row:d.getCurrentTokenRow(),column:m+d.getCurrentTokenColumn()}}else b==s&&(l+=1);m+=1}do c=d.stepForward();while(c&&!r.test(c.type));if(c==null)break;m=0}return null}},this.getMatchingTags=function(s){var u=new i(this,s.row,s.column),r=this.$findTagName(u);if(r){var a=u.stepBackward();return a.value==="<"?this.$findClosingTag(u,r):this.$findOpeningTag(u,r)}},this.$findTagName=function(s){var u=s.getCurrentToken(),r=!1,a=!1;if(u&&u.type.indexOf("tag-name")===-1)do a?u=s.stepBackward():u=s.stepForward(),u&&(u.value==="/>"?a=!0:u.type.indexOf("tag-name")!==-1&&(r=!0));while(u&&!r);return u},this.$findClosingTag=function(s,u){var r,a=u.value,l=u.value,d=0,c=new o(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1);u=s.stepForward();var m=new o(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+u.value.length),g=!1;do{if(r=u,r.type.indexOf("tag-close")!==-1&&!g){var v=new o(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1);g=!0}if(u=s.stepForward(),u){if(u.value===">"&&!g){var v=new o(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1);g=!0}if(u.type.indexOf("tag-name")!==-1){if(a=u.value,l===a){if(r.value==="<")d++;else if(r.value==="</"&&(d--,d<0)){s.stepBackward();var b=new o(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+2);u=s.stepForward();var E=new o(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+u.value.length);if(u.type.indexOf("tag-close")===-1&&(u=s.stepForward()),u&&u.value===">")var S=new o(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1);else return}}}else if(l===a&&u.value==="/>"&&(d--,d<0))var b=new o(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+2),E=b,S=E,v=new o(m.end.row,m.end.column,m.end.row,m.end.column+1)}}while(u&&d>=0);if(c&&v&&b&&S&&m&&E)return{openTag:new o(c.start.row,c.start.column,v.end.row,v.end.column),closeTag:new o(b.start.row,b.start.column,S.end.row,S.end.column),openTagName:m,closeTagName:E}},this.$findOpeningTag=function(s,u){var r=s.getCurrentToken(),a=u.value,l=0,d=s.getCurrentTokenRow(),c=s.getCurrentTokenColumn(),m=c+2,g=new o(d,c,d,m);s.stepForward();var v=new o(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+u.value.length);if(u.type.indexOf("tag-close")===-1&&(u=s.stepForward()),!(!u||u.value!==">")){var b=new o(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1);s.stepBackward(),s.stepBackward();do if(u=r,d=s.getCurrentTokenRow(),c=s.getCurrentTokenColumn(),m=c+u.value.length,r=s.stepBackward(),u){if(u.type.indexOf("tag-name")!==-1){if(a===u.value)if(r.value==="<"){if(l++,l>0){var E=new o(d,c,d,m),S=new o(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1);do u=s.stepForward();while(u&&u.value!==">");var w=new o(s.getCurrentTokenRow(),s.getCurrentTokenColumn(),s.getCurrentTokenRow(),s.getCurrentTokenColumn()+1)}}else r.value==="</"&&l--}else if(u.value==="/>"){for(var y=0,D=r;D;){if(D.type.indexOf("tag-name")!==-1&&D.value===a){l--;break}else if(D.value==="<")break;D=s.stepBackward(),y++}for(var $=0;$<y;$++)s.stepForward()}}while(r&&l<=0);if(S&&w&&g&&b&&E&&v)return{openTag:new o(S.start.row,S.start.column,w.end.row,w.end.column),closeTag:new o(g.start.row,g.start.column,b.end.row,b.end.column),openTagName:E,closeTagName:v}}}}n.BracketMatch=p}),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(t,n,f){var i=t("./lib/oop"),o=t("./lib/lang"),p=t("./bidihandler").BidiHandler,s=t("./config"),u=t("./lib/event_emitter").EventEmitter,r=t("./selection").Selection,a=t("./mode/text").Mode,l=t("./range").Range,d=t("./line_widgets").LineWidgets,c=t("./document").Document,m=t("./background_tokenizer").BackgroundTokenizer,g=t("./search_highlight").SearchHighlight,v=t("./undomanager").UndoManager,b=(function(){function T(k,x){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"+ ++T.$uid,this.$foldData.toString=function(){return this.join(`
`)},this.$gutterCustomWidgets={},this.bgTokenizer=new m(new a().getTokenizer(),this);var C=this;this.bgTokenizer.on("update",function(M){C._signal("tokenizerUpdate",M)}),this.on("changeFold",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this),(typeof k!="object"||!k.getLine)&&(k=new c(k)),this.setDocument(k),this.selection=new r(this),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.selection.on("changeCursor",this.$onSelectionChange),this.$bidiHandler=new p(this),s.resetOptions(this),this.setMode(x),s._signal("session",this),this.destroyed=!1,this.$initOperationListeners()}return T.prototype.$initOperationListeners=function(){var k=this;this.curOp=null,this.on("change",function(){k.curOp||(k.startOperation(),k.curOp.selectionBefore=k.$lastSel),k.curOp.docChanged=!0},!0),this.on("changeSelection",function(){k.curOp||(k.startOperation(),k.curOp.selectionBefore=k.$lastSel),k.curOp.selectionChanged=!0},!0),this.$operationResetTimer=o.delayedCall(this.endOperation.bind(this,!0))},T.prototype.startOperation=function(k){if(this.curOp){if(!k||this.curOp.command)return;this.prevOp=this.curOp}k||(k={}),this.$operationResetTimer.schedule(),this.curOp={command:k.command||{},args:k.args},this.curOp.selectionBefore=this.selection.toJSON(),this._signal("startOperation",k)},T.prototype.endOperation=function(k){if(this.curOp){if(k&&k.returnValue===!1){this.curOp=null,this._signal("endOperation",k);return}if(k==!0&&this.curOp.command&&this.curOp.command.name=="mouse")return;var x=this.selection.toJSON();this.curOp.selectionAfter=x,this.$lastSel=this.selection.toJSON(),this.getUndoManager().addSelection(x),this._signal("beforeEndOperation"),this.prevOp=this.curOp,this.curOp=null,this._signal("endOperation",k)}},T.prototype.setDocument=function(k){this.doc&&this.doc.off("change",this.$onChange),this.doc=k,k.on("change",this.$onChange,!0),this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},T.prototype.getDocument=function(){return this.doc},Object.defineProperty(T.prototype,"widgetManager",{get:function(){var k=new d(this);return this.widgetManager=k,this.$editor&&k.attach(this.$editor),k},set:function(k){Object.defineProperty(this,"widgetManager",{writable:!0,enumerable:!0,configurable:!0,value:k})},enumerable:!1,configurable:!0}),T.prototype.$resetRowCache=function(k){if(!k){this.$docRowCache=[],this.$screenRowCache=[];return}var x=this.$docRowCache.length,C=this.$getRowCacheIndex(this.$docRowCache,k)+1;x>C&&(this.$docRowCache.splice(C,x),this.$screenRowCache.splice(C,x))},T.prototype.$getRowCacheIndex=function(k,x){for(var C=0,M=k.length-1;C<=M;){var F=C+M>>1,R=k[F];if(x>R)C=F+1;else if(x<R)M=F-1;else return F}return C-1},T.prototype.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.destroyed||this.bgTokenizer.start(0)},T.prototype.onChangeFold=function(k){var x=k.data;this.$resetRowCache(x.start.row)},T.prototype.onChange=function(k){this.$modified=!0,this.$bidiHandler.onChange(k),this.$resetRowCache(k.start.row);var x=this.$updateInternalDataOnChange(k);!this.$fromUndo&&this.$undoManager&&(x&&x.length&&(this.$undoManager.add({action:"removeFolds",folds:x},this.mergeUndoDeltas),this.mergeUndoDeltas=!0),this.$undoManager.add(k,this.mergeUndoDeltas),this.mergeUndoDeltas=!0,this.$informUndoManager.schedule()),this.bgTokenizer.$updateOnChange(k),this._signal("change",k)},T.prototype.onSelectionChange=function(){this._signal("changeSelection")},T.prototype.setValue=function(k){this.doc.setValue(k),this.selection.moveTo(0,0),this.$resetRowCache(0),this.setUndoManager(this.$undoManager),this.getUndoManager().reset()},T.fromJSON=function(k){typeof k=="string"&&(k=JSON.parse(k));var x=new v;x.$undoStack=k.history.undo,x.$redoStack=k.history.redo,x.mark=k.history.mark,x.$rev=k.history.rev;var C=new T(k.value);return k.folds.forEach(function(M){C.addFold("...",l.fromPoints(M.start,M.end))}),C.setAnnotations(k.annotations),C.setBreakpoints(k.breakpoints),C.setMode(k.mode),C.setScrollLeft(k.scrollLeft),C.setScrollTop(k.scrollTop),C.setUndoManager(x),C.selection.fromJSON(k.selection),C},T.prototype.toJSON=function(){return{annotations:this.$annotations,breakpoints:this.$breakpoints,folds:this.getAllFolds().map(function(k){return k.range}),history:this.getUndoManager(),mode:this.$mode.$id,scrollLeft:this.$scrollLeft,scrollTop:this.$scrollTop,selection:this.selection.toJSON(),value:this.doc.getValue()}},T.prototype.toString=function(){return this.doc.getValue()},T.prototype.getSelection=function(){return this.selection},T.prototype.getState=function(k){return this.bgTokenizer.getState(k)},T.prototype.getTokens=function(k){return this.bgTokenizer.getTokens(k)},T.prototype.getTokenAt=function(k,x){var C=this.bgTokenizer.getTokens(k),M,F=0;if(x==null){var R=C.length-1;F=this.getLine(k).length}else for(var R=0;R<C.length&&(F+=C[R].value.length,!(F>=x));R++);return M=C[R],M?(M.index=R,M.start=F-M.value.length,M):null},T.prototype.setUndoManager=function(k){if(this.$undoManager=k,this.$informUndoManager&&this.$informUndoManager.cancel(),k){var x=this;k.addSession(this),this.$syncInformUndoManager=function(){x.$informUndoManager.cancel(),x.mergeUndoDeltas=!1},this.$informUndoManager=o.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},T.prototype.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},T.prototype.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},T.prototype.getTabString=function(){return this.getUseSoftTabs()?o.stringRepeat(" ",this.getTabSize()):" "},T.prototype.setUseSoftTabs=function(k){this.setOption("useSoftTabs",k)},T.prototype.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},T.prototype.setTabSize=function(k){this.setOption("tabSize",k)},T.prototype.getTabSize=function(){return this.$tabSize},T.prototype.isTabStop=function(k){return this.$useSoftTabs&&k.column%this.$tabSize===0},T.prototype.setNavigateWithinSoftTabs=function(k){this.setOption("navigateWithinSoftTabs",k)},T.prototype.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},T.prototype.setOverwrite=function(k){this.setOption("overwrite",k)},T.prototype.getOverwrite=function(){return this.$overwrite},T.prototype.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},T.prototype.addGutterDecoration=function(k,x){this.$decorations[k]||(this.$decorations[k]=""),this.$decorations[k]+=" "+x,this._signal("changeBreakpoint",{})},T.prototype.removeGutterCustomWidget=function(k){this.$editor&&this.$editor.renderer.$gutterLayer.$removeCustomWidget(k)},T.prototype.addGutterCustomWidget=function(k,x){this.$editor&&this.$editor.renderer.$gutterLayer.$addCustomWidget(k,x)},T.prototype.removeGutterDecoration=function(k,x){this.$decorations[k]=(this.$decorations[k]||"").replace(" "+x,""),this._signal("changeBreakpoint",{})},T.prototype.getBreakpoints=function(){return this.$breakpoints},T.prototype.setBreakpoints=function(k){this.$breakpoints=[];for(var x=0;x<k.length;x++)this.$breakpoints[k[x]]="ace_breakpoint";this._signal("changeBreakpoint",{})},T.prototype.clearBreakpoints=function(){this.$breakpoints=[],this._signal("changeBreakpoint",{})},T.prototype.setBreakpoint=function(k,x){x===void 0&&(x="ace_breakpoint"),x?this.$breakpoints[k]=x:delete this.$breakpoints[k],this._signal("changeBreakpoint",{})},T.prototype.clearBreakpoint=function(k){delete this.$breakpoints[k],this._signal("changeBreakpoint",{})},T.prototype.addMarker=function(k,x,C,M){var F=this.$markerId++,R={range:k,type:C||"line",renderer:typeof C=="function"?C:null,clazz:x,inFront:!!M,id:F};return M?(this.$frontMarkers[F]=R,this._signal("changeFrontMarker")):(this.$backMarkers[F]=R,this._signal("changeBackMarker")),F},T.prototype.addDynamicMarker=function(k,x){if(k.update){var C=this.$markerId++;return k.id=C,k.inFront=!!x,x?(this.$frontMarkers[C]=k,this._signal("changeFrontMarker")):(this.$backMarkers[C]=k,this._signal("changeBackMarker")),k}},T.prototype.removeMarker=function(k){var x=this.$frontMarkers[k]||this.$backMarkers[k];if(x){var C=x.inFront?this.$frontMarkers:this.$backMarkers;delete C[k],this._signal(x.inFront?"changeFrontMarker":"changeBackMarker")}},T.prototype.getMarkers=function(k){return k?this.$frontMarkers:this.$backMarkers},T.prototype.highlight=function(k){if(!this.$searchHighlight){var x=new g(null,"ace_selected-word","text");this.$searchHighlight=this.addDynamicMarker(x)}this.$searchHighlight.setRegexp(k)},T.prototype.highlightLines=function(k,x,C,M){typeof x!="number"&&(C=x,x=k),C||(C="ace_step");var F=new l(k,0,x,1/0);return F.id=this.addMarker(F,C,"fullLine",M),F},T.prototype.setAnnotations=function(k){this.$annotations=k,this._signal("changeAnnotation",{})},T.prototype.getAnnotations=function(){return this.$annotations||[]},T.prototype.clearAnnotations=function(){this.setAnnotations([])},T.prototype.$detectNewLine=function(k){var x=k.match(/^.*?(\r?\n)/m);x?this.$autoNewLine=x[1]:this.$autoNewLine=`
`},T.prototype.getWordRange=function(k,x){var C=this.getLine(k),M=!1;if(x>0&&(M=!!C.charAt(x-1).match(this.tokenRe)),M||(M=!!C.charAt(x).match(this.tokenRe)),M)var F=this.tokenRe;else if(/^\s+$/.test(C.slice(x-1,x+1)))var F=/\s/;else var F=this.nonTokenRe;var R=x;if(R>0){do R--;while(R>=0&&C.charAt(R).match(F));R++}for(var O=x;O<C.length&&C.charAt(O).match(F);)O++;return new l(k,R,k,O)},T.prototype.getAWordRange=function(k,x){for(var C=this.getWordRange(k,x),M=this.getLine(C.end.row);M.charAt(C.end.column).match(/[ \t]/);)C.end.column+=1;return C},T.prototype.setNewLineMode=function(k){this.doc.setNewLineMode(k)},T.prototype.getNewLineMode=function(){return this.doc.getNewLineMode()},T.prototype.setUseWorker=function(k){this.setOption("useWorker",k)},T.prototype.getUseWorker=function(){return this.$useWorker},T.prototype.onReloadTokenizer=function(k){var x=k.data;this.bgTokenizer.start(x.first),this._signal("tokenizerUpdate",k)},T.prototype.setMode=function(k,x){if(k&&typeof k=="object"){if(k.getTokenizer)return this.$onChangeMode(k);var C=k,M=C.path}else M=k||"ace/mode/text";if(this.$modes["ace/mode/text"]||(this.$modes["ace/mode/text"]=new a),this.$modes[M]&&!C){this.$onChangeMode(this.$modes[M]),x&&x();return}this.$modeId=M,s.loadModule(["mode",M],function(F){if(!this.destroyed){if(this.$modeId!==M)return x&&x();this.$modes[M]&&!C?this.$onChangeMode(this.$modes[M]):F&&F.Mode&&(F=new F.Mode(C),C||(this.$modes[M]=F,F.$id=M),this.$onChangeMode(F)),x&&x()}}.bind(this)),this.$mode||this.$onChangeMode(this.$modes["ace/mode/text"],!0)},T.prototype.$onChangeMode=function(k,x){if(x||(this.$modeId=k.$id),this.$mode!==k){var C=this.$mode;this.$mode=k,this.$stopWorker(),this.$useWorker&&this.$startWorker();var M=k.getTokenizer();if(M.on!==void 0){var F=this.onReloadTokenizer.bind(this);M.on("update",F)}this.bgTokenizer.setTokenizer(M),this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=k.tokenRe,this.nonTokenRe=k.nonTokenRe,x||(k.attachToSession&&k.attachToSession(this),this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding(k.foldingRules),this.bgTokenizer.start(0),this._emit("changeMode",{oldMode:C,mode:k}))}},T.prototype.$stopWorker=function(){this.$worker&&(this.$worker.terminate(),this.$worker=null)},T.prototype.$startWorker=function(){try{this.$worker=this.$mode.createWorker(this)}catch(k){s.warn("Could not load worker",k),this.$worker=null}},T.prototype.getMode=function(){return this.$mode},T.prototype.setScrollTop=function(k){this.$scrollTop===k||isNaN(k)||(this.$scrollTop=k,this._signal("changeScrollTop",k))},T.prototype.getScrollTop=function(){return this.$scrollTop},T.prototype.setScrollLeft=function(k){this.$scrollLeft===k||isNaN(k)||(this.$scrollLeft=k,this._signal("changeScrollLeft",k))},T.prototype.getScrollLeft=function(){return this.$scrollLeft},T.prototype.getScreenWidth=function(){return this.$computeWidth(),this.lineWidgets?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},T.prototype.getLineWidgetMaxWidth=function(){if(this.lineWidgetsWidth!=null)return this.lineWidgetsWidth;var k=0;return this.lineWidgets.forEach(function(x){x&&x.screenWidth>k&&(k=x.screenWidth)}),this.lineWidgetWidth=k},T.prototype.$computeWidth=function(k){if(this.$modified||k){if(this.$modified=!1,this.$useWrapMode)return this.screenWidth=this.$wrapLimit;for(var x=this.doc.getAllLines(),C=this.$rowLengthCache,M=0,F=0,R=this.$foldData[F],O=R?R.start.row:1/0,B=x.length,N=0;N<B;N++){if(N>O){if(N=R.end.row+1,N>=B)break;R=this.$foldData[F++],O=R?R.start.row:1/0}C[N]==null&&(C[N]=this.$getStringScreenWidth(x[N])[0]),C[N]>M&&(M=C[N])}this.screenWidth=M}},T.prototype.getLine=function(k){return this.doc.getLine(k)},T.prototype.getLines=function(k,x){return this.doc.getLines(k,x)},T.prototype.getLength=function(){return this.doc.getLength()},T.prototype.getTextRange=function(k){return this.doc.getTextRange(k||this.selection.getRange())},T.prototype.insert=function(k,x){return this.doc.insert(k,x)},T.prototype.remove=function(k){return this.doc.remove(k)},T.prototype.removeFullLines=function(k,x){return this.doc.removeFullLines(k,x)},T.prototype.undoChanges=function(k,x){if(k.length){this.$fromUndo=!0;for(var C=k.length-1;C!=-1;C--){var M=k[C];M.action=="insert"||M.action=="remove"?this.doc.revertDelta(M):M.folds&&this.addFolds(M.folds)}!x&&this.$undoSelect&&(k.selectionBefore?this.selection.fromJSON(k.selectionBefore):this.selection.setRange(this.$getUndoSelection(k,!0))),this.$fromUndo=!1}},T.prototype.redoChanges=function(k,x){if(k.length){this.$fromUndo=!0;for(var C=0;C<k.length;C++){var M=k[C];(M.action=="insert"||M.action=="remove")&&this.doc.$safeApplyDelta(M)}!x&&this.$undoSelect&&(k.selectionAfter?this.selection.fromJSON(k.selectionAfter):this.selection.setRange(this.$getUndoSelection(k,!1))),this.$fromUndo=!1}},T.prototype.setUndoSelect=function(k){this.$undoSelect=k},T.prototype.$getUndoSelection=function(k,x){function C(B){return x?B.action!=="insert":B.action==="insert"}for(var M,F,R=0;R<k.length;R++){var O=k[R];if(O.start){if(!M){C(O)?M=l.fromPoints(O.start,O.end):M=l.fromPoints(O.start,O.start);continue}C(O)?(F=O.start,M.compare(F.row,F.column)==-1&&M.setStart(F),F=O.end,M.compare(F.row,F.column)==1&&M.setEnd(F)):(F=O.start,M.compare(F.row,F.column)==-1&&(M=l.fromPoints(O.start,O.start)))}}return M},T.prototype.replace=function(k,x){return this.doc.replace(k,x)},T.prototype.moveText=function(k,x,C){var M=this.getTextRange(k),F=this.getFoldsInRange(k),R=l.fromPoints(x,x);if(!C){this.remove(k);var O=k.start.row-k.end.row,B=O?-k.end.column:k.start.column-k.end.column;B&&(R.start.row==k.end.row&&R.start.column>k.end.column&&(R.start.column+=B),R.end.row==k.end.row&&R.end.column>k.end.column&&(R.end.column+=B)),O&&R.start.row>=k.end.row&&(R.start.row+=O,R.end.row+=O)}if(R.end=this.insert(R.start,M),F.length){var N=k.start,j=R.start,O=j.row-N.row,B=j.column-N.column;this.addFolds(F.map(function(H){return H=H.clone(),H.start.row==N.row&&(H.start.column+=B),H.end.row==N.row&&(H.end.column+=B),H.start.row+=O,H.end.row+=O,H}))}return R},T.prototype.indentRows=function(k,x,C){C=C.replace(/\t/g,this.getTabString());for(var M=k;M<=x;M++)this.doc.insertInLine({row:M,column:0},C)},T.prototype.outdentRows=function(k){for(var x=k.collapseRows(),C=new l(0,0,0,0),M=this.getTabSize(),F=x.start.row;F<=x.end.row;++F){var R=this.getLine(F);C.start.row=F,C.end.row=F;for(var O=0;O<M&&R.charAt(O)==" ";++O);O<M&&R.charAt(O)==" "?(C.start.column=O,C.end.column=O+1):(C.start.column=0,C.end.column=O),this.remove(C)}},T.prototype.$moveLines=function(k,x,C){if(k=this.getRowFoldStart(k),x=this.getRowFoldEnd(x),C<0){var M=this.getRowFoldStart(k+C);if(M<0)return 0;var F=M-k}else if(C>0){var M=this.getRowFoldEnd(x+C);if(M>this.doc.getLength()-1)return 0;var F=M-x}else{k=this.$clipRowToDocument(k),x=this.$clipRowToDocument(x);var F=x-k+1}var R=new l(k,0,x,Number.MAX_VALUE),O=this.getFoldsInRange(R).map(function(N){return N=N.clone(),N.start.row+=F,N.end.row+=F,N}),B=C==0?this.doc.getLines(k,x):this.doc.removeFullLines(k,x);return this.doc.insertFullLines(k+F,B),O.length&&this.addFolds(O),F},T.prototype.moveLinesUp=function(k,x){return this.$moveLines(k,x,-1)},T.prototype.moveLinesDown=function(k,x){return this.$moveLines(k,x,1)},T.prototype.duplicateLines=function(k,x){return this.$moveLines(k,x,0)},T.prototype.$clipRowToDocument=function(k){return Math.max(0,Math.min(k,this.doc.getLength()-1))},T.prototype.$clipColumnToRow=function(k,x){return x<0?0:Math.min(this.doc.getLine(k).length,x)},T.prototype.$clipPositionToDocument=function(k,x){if(x=Math.max(0,x),k<0)k=0,x=0;else{var C=this.doc.getLength();k>=C?(k=C-1,x=this.doc.getLine(C-1).length):x=Math.min(this.doc.getLine(k).length,x)}return{row:k,column:x}},T.prototype.$clipRangeToDocument=function(k){k.start.row<0?(k.start.row=0,k.start.column=0):k.start.column=this.$clipColumnToRow(k.start.row,k.start.column);var x=this.doc.getLength()-1;return k.end.row>x?(k.end.row=x,k.end.column=this.doc.getLine(x).length):k.end.column=this.$clipColumnToRow(k.end.row,k.end.column),k},T.prototype.setUseWrapMode=function(k){if(k!=this.$useWrapMode){if(this.$useWrapMode=k,this.$modified=!0,this.$resetRowCache(0),k){var x=this.getLength();this.$wrapData=Array(x),this.$updateWrapData(0,x-1)}this._signal("changeWrapMode")}},T.prototype.getUseWrapMode=function(){return this.$useWrapMode},T.prototype.setWrapLimitRange=function(k,x){(this.$wrapLimitRange.min!==k||this.$wrapLimitRange.max!==x)&&(this.$wrapLimitRange={min:k,max:x},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode"))},T.prototype.adjustWrapLimit=function(k,x){var C=this.$wrapLimitRange;C.max<0&&(C={min:x,max:x});var M=this.$constrainWrapLimit(k,C.min,C.max);return M!=this.$wrapLimit&&M>1?(this.$wrapLimit=M,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},T.prototype.$constrainWrapLimit=function(k,x,C){return x&&(k=Math.max(x,k)),C&&(k=Math.min(C,k)),k},T.prototype.getWrapLimit=function(){return this.$wrapLimit},T.prototype.setWrapLimit=function(k){this.setWrapLimitRange(k,k)},T.prototype.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},T.prototype.$updateInternalDataOnChange=function(k){var x=this.$useWrapMode,C=k.action,M=k.start,F=k.end,R=M.row,O=F.row,B=O-R,N=null;if(this.$updating=!0,B!=0)if(C==="remove"){this[x?"$wrapData":"$rowLengthCache"].splice(R,B);var j=this.$foldData;N=this.getFoldsInRange(k),this.removeFolds(N);var V=this.getFoldLine(F.row),W=0;if(V){V.addRemoveChars(F.row,F.column,M.column-F.column),V.shiftRow(-B);var H=this.getFoldLine(R);H&&H!==V&&(H.merge(V),V=H),W=j.indexOf(V)+1}for(W;W<j.length;W++){var V=j[W];V.start.row>=F.row&&V.shiftRow(-B)}O=R}else{var U=Array(B);U.unshift(R,0);var X=x?this.$wrapData:this.$rowLengthCache;X.splice.apply(X,U);var j=this.$foldData,V=this.getFoldLine(R),W=0;if(V){var Y=V.range.compareInside(M.row,M.column);Y==0?(V=V.split(M.row,M.column),V&&(V.shiftRow(B),V.addRemoveChars(O,0,F.column-M.column))):Y==-1&&(V.addRemoveChars(R,0,F.column-M.column),V.shiftRow(B)),W=j.indexOf(V)+1}for(W;W<j.length;W++){var V=j[W];V.start.row>=R&&V.shiftRow(B)}}else{B=Math.abs(k.start.column-k.end.column),C==="remove"&&(N=this.getFoldsInRange(k),this.removeFolds(N),B=-B);var V=this.getFoldLine(R);V&&V.addRemoveChars(R,M.column,B)}return x&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,x?this.$updateWrapData(R,O):this.$updateRowLengthCache(R,O),N},T.prototype.$updateRowLengthCache=function(k,x){this.$rowLengthCache[k]=null,this.$rowLengthCache[x]=null},T.prototype.$updateWrapData=function(k,x){var C=this.doc.getAllLines(),M=this.getTabSize(),F=this.$wrapData,R=this.$wrapLimit,O,B,N=k;for(x=Math.min(x,C.length-1);N<=x;)B=this.getFoldLine(N,B),B?(O=[],B.walk(function(j,V,W,H){var U;if(j!=null){U=this.$getDisplayTokens(j,O.length),U[0]=w;for(var X=1;X<U.length;X++)U[X]=y}else U=this.$getDisplayTokens(C[V].substring(H,W),O.length);O=O.concat(U)}.bind(this),B.end.row,C[B.end.row].length+1),F[B.start.row]=this.$computeWrapSplits(O,R,M),N=B.end.row+1):(O=this.$getDisplayTokens(C[N]),F[N]=this.$computeWrapSplits(O,R,M),N++)},T.prototype.$computeWrapSplits=function(k,x,C){if(k.length==0)return[];var M=[],F=k.length,R=0,O=0,B=this.$wrapAsCode,N=this.$indentedSoftWrap,j=x<=Math.max(2*C,8)||N===!1?0:Math.floor(x/2);function V(){var Y=0;if(j===0)return Y;if(N)for(var Z=0;Z<k.length;Z++){var ne=k[Z];if(ne==$)Y+=1;else if(ne==A)Y+=C;else{if(ne==_)continue;break}}return B&&N!==!1&&(Y+=C),Math.min(Y,j)}function W(Y){for(var Z=Y-R,ne=R;ne<Y;ne++){var re=k[ne];(re===12||re===2)&&(Z-=1)}M.length||(H=V(),M.indent=H),O+=Z,M.push(O),R=Y}for(var H=0;F-R>x-H;){var U=R+x-H;if(k[U-1]>=$&&k[U]>=$){W(U);continue}if(k[U]==w||k[U]==y){for(U;U!=R-1&&k[U]!=w;U--);if(U>R){W(U);continue}for(U=R+x,U;U<k.length&&k[U]==y;U++);if(U==k.length)break;W(U);continue}for(var X=Math.max(U-(x-(x>>2)),R-1);U>X&&k[U]<w;)U--;if(B){for(;U>X&&k[U]<w;)U--;for(;U>X&&k[U]==D;)U--}else for(;U>X&&k[U]<$;)U--;if(U>X){W(++U);continue}U=R+x,k[U]==S&&U--,W(U-H)}return M},T.prototype.$getDisplayTokens=function(k,x){var C=[],M;x=x||0;for(var F=0;F<k.length;F++){var R=k.charCodeAt(F);if(R==9){M=this.getScreenTabSize(C.length+x),C.push(A);for(var O=1;O<M;O++)C.push(_)}else R==32?C.push($):R>39&&R<48||R>57&&R<64?C.push(D):R>=4352&&L(R)?C.push(E,S):C.push(E)}return C},T.prototype.$getStringScreenWidth=function(k,x,C){if(x==0)return[0,0];x==null&&(x=1/0),C=C||0;var M,F;for(F=0;F<k.length&&(M=k.charCodeAt(F),M==9?C+=this.getScreenTabSize(C):M>=4352&&L(M)?C+=2:C+=1,!(C>x));F++);return[C,F]},T.prototype.getRowLength=function(k){var x=1;return this.lineWidgets&&(x+=this.lineWidgets[k]&&this.lineWidgets[k].rowCount||0),!this.$useWrapMode||!this.$wrapData[k]?x:this.$wrapData[k].length+x},T.prototype.getRowLineCount=function(k){return!this.$useWrapMode||!this.$wrapData[k]?1:this.$wrapData[k].length+1},T.prototype.getRowWrapIndent=function(k){if(this.$useWrapMode){var x=this.screenToDocumentPosition(k,Number.MAX_VALUE),C=this.$wrapData[x.row];return C.length&&C[0]<x.column?C.indent:0}else return 0},T.prototype.getScreenLastRowColumn=function(k){var x=this.screenToDocumentPosition(k,Number.MAX_VALUE);return this.documentToScreenColumn(x.row,x.column)},T.prototype.getDocumentLastRowColumn=function(k,x){var C=this.documentToScreenRow(k,x);return this.getScreenLastRowColumn(C)},T.prototype.getDocumentLastRowColumnPosition=function(k,x){var C=this.documentToScreenRow(k,x);return this.screenToDocumentPosition(C,Number.MAX_VALUE/10)},T.prototype.getRowSplitData=function(k){if(this.$useWrapMode)return this.$wrapData[k]},T.prototype.getScreenTabSize=function(k){return this.$tabSize-(k%this.$tabSize|0)},T.prototype.screenToDocumentRow=function(k,x){return this.screenToDocumentPosition(k,x).row},T.prototype.screenToDocumentColumn=function(k,x){return this.screenToDocumentPosition(k,x).column},T.prototype.screenToDocumentPosition=function(k,x,C){if(k<0)return{row:0,column:0};var M,F=0,R=0,O,B=0,N=0,j=this.$screenRowCache,V=this.$getRowCacheIndex(j,k),W=j.length;if(W&&V>=0)var B=j[V],F=this.$docRowCache[V],H=k>j[W-1];else var H=!W;for(var U=this.getLength()-1,X=this.getNextFoldLine(F),Y=X?X.start.row:1/0;B<=k&&(N=this.getRowLength(F),!(B+N>k||F>=U));)B+=N,F++,F>Y&&(F=X.end.row+1,X=this.getNextFoldLine(F,X),Y=X?X.start.row:1/0),H&&(this.$docRowCache.push(F),this.$screenRowCache.push(B));if(X&&X.start.row<=F)M=this.getFoldDisplayLine(X),F=X.start.row;else{if(B+N<=k||F>U)return{row:U,column:this.getLine(U).length};M=this.getLine(F),X=null}var Z=0,ne=Math.floor(k-B);if(this.$useWrapMode){var re=this.$wrapData[F];re&&(O=re[ne],ne>0&&re.length&&(Z=re.indent,R=re[ne-1]||re[re.length-1],M=M.substring(R)))}return C!==void 0&&this.$bidiHandler.isBidiRow(B+ne,F,ne)&&(x=this.$bidiHandler.offsetToCol(C)),R+=this.$getStringScreenWidth(M,x-Z)[1],this.$useWrapMode&&R>=O&&(R=O-1),X?X.idxToPosition(R):{row:F,column:R}},T.prototype.documentToScreenPosition=function(k,x){if(typeof x>"u")var C=this.$clipPositionToDocument(k.row,k.column);else C=this.$clipPositionToDocument(k,x);k=C.row,x=C.column;var M=0,F=null,R=null;R=this.getFoldAt(k,x,1),R&&(k=R.start.row,x=R.start.column);var O,B=0,N=this.$docRowCache,j=this.$getRowCacheIndex(N,k),V=N.length;if(V&&j>=0)var B=N[j],M=this.$screenRowCache[j],W=k>N[V-1];else var W=!V;for(var H=this.getNextFoldLine(B),U=H?H.start.row:1/0;B<k;){if(B>=U){if(O=H.end.row+1,O>k)break;H=this.getNextFoldLine(O,H),U=H?H.start.row:1/0}else O=B+1;M+=this.getRowLength(B),B=O,W&&(this.$docRowCache.push(B),this.$screenRowCache.push(M))}var X="";H&&B>=U?(X=this.getFoldDisplayLine(H,k,x),F=H.start.row):(X=this.getLine(k).substring(0,x),F=k);var Y=0;if(this.$useWrapMode){var Z=this.$wrapData[F];if(Z){for(var ne=0;X.length>=Z[ne];)M++,ne++;X=X.substring(Z[ne-1]||0,X.length),Y=ne>0?Z.indent:0}}return this.lineWidgets&&this.lineWidgets[B]&&this.lineWidgets[B].rowsAbove&&(M+=this.lineWidgets[B].rowsAbove),{row:M,column:Y+this.$getStringScreenWidth(X)[0]}},T.prototype.documentToScreenColumn=function(k,x){return this.documentToScreenPosition(k,x).column},T.prototype.documentToScreenRow=function(k,x){return this.documentToScreenPosition(k,x).row},T.prototype.getScreenLength=function(){var k=0,x=null;if(this.$useWrapMode)for(var F=this.$wrapData.length,R=0,M=0,x=this.$foldData[M++],O=x?x.start.row:1/0;R<F;){var B=this.$wrapData[R];k+=B?B.length+1:1,R++,R>O&&(R=x.end.row+1,x=this.$foldData[M++],O=x?x.start.row:1/0)}else{k=this.getLength();for(var C=this.$foldData,M=0;M<C.length;M++)x=C[M],k-=x.end.row-x.start.row}return this.lineWidgets&&(k+=this.$getWidgetScreenLength()),k},T.prototype.$setFontMetrics=function(k){this.$enableVarChar&&(this.$getStringScreenWidth=function(x,C,M){if(C===0)return[0,0];C||(C=1/0),M=M||0;var F,R;for(R=0;R<x.length&&(F=x.charAt(R),F===" "?M+=this.getScreenTabSize(M):M+=k.getCharacterWidth(F),!(M>C));R++);return[M,R]})},T.prototype.getPrecedingCharacter=function(){var k=this.selection.getCursor();if(k.column===0)return k.row===0?"":this.doc.getNewLineCharacter();var x=this.getLine(k.row);return x[k.column-1]},T.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()},T})();b.$uid=0,b.prototype.$modes=s.$modes,b.prototype.getValue=b.prototype.toString,b.prototype.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},b.prototype.$overwrite=!1,b.prototype.$mode=null,b.prototype.$modeId=null,b.prototype.$scrollTop=0,b.prototype.$scrollLeft=0,b.prototype.$wrapLimit=80,b.prototype.$useWrapMode=!1,b.prototype.$wrapLimitRange={min:null,max:null},b.prototype.lineWidgets=null,b.prototype.isFullWidth=L,i.implement(b.prototype,u);var E=1,S=2,w=3,y=4,D=9,$=10,A=11,_=12;function L(T){return T<4352?!1:T>=4352&&T<=4447||T>=4515&&T<=4519||T>=4602&&T<=4607||T>=9001&&T<=9002||T>=11904&&T<=11929||T>=11931&&T<=12019||T>=12032&&T<=12245||T>=12272&&T<=12283||T>=12288&&T<=12350||T>=12353&&T<=12438||T>=12441&&T<=12543||T>=12549&&T<=12589||T>=12593&&T<=12686||T>=12688&&T<=12730||T>=12736&&T<=12771||T>=12784&&T<=12830||T>=12832&&T<=12871||T>=12880&&T<=13054||T>=13056&&T<=19903||T>=19968&&T<=42124||T>=42128&&T<=42182||T>=43360&&T<=43388||T>=44032&&T<=55203||T>=55216&&T<=55238||T>=55243&&T<=55291||T>=63744&&T<=64255||T>=65040&&T<=65049||T>=65072&&T<=65106||T>=65108&&T<=65126||T>=65128&&T<=65131||T>=65281&&T<=65376||T>=65504&&T<=65510}t("./edit_session/folding").Folding.call(b.prototype),t("./edit_session/bracket_match").BracketMatch.call(b.prototype),s.defineOptions(b.prototype,"session",{wrap:{set:function(T){if(!T||T=="off"?T=!1:T=="free"?T=!0:T=="printMargin"?T=-1:typeof T=="string"&&(T=parseInt(T,10)||!1),this.$wrap!=T)if(this.$wrap=T,!T)this.setUseWrapMode(!1);else{var k=typeof T=="number"?T:null;this.setWrapLimitRange(k,k),this.setUseWrapMode(!0)}},get:function(){return this.getUseWrapMode()?this.$wrap==-1?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(T){T=T=="auto"?this.$mode.type!="text":T!="text",T!=this.$wrapAsCode&&(this.$wrapAsCode=T,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(T){this.$useWorker=T,this.$stopWorker(),T&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(T){T=parseInt(T),T>0&&this.$tabSize!==T&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=T,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(T){this.setFoldStyle(T)},handlesSet:!0},overwrite:{set:function(T){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(T){this.doc.setNewLineMode(T)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(T){this.setMode(T)},get:function(){return this.$modeId},handlesSet:!0}}),n.EditSession=b}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(t,n,f){var i=t("./lib/lang"),o=t("./lib/oop"),p=t("./range").Range,s=(function(){function l(){this.$options={}}return l.prototype.set=function(d){return o.mixin(this.$options,d),this},l.prototype.getOptions=function(){return i.copyObject(this.$options)},l.prototype.setOptions=function(d){this.$options=d},l.prototype.find=function(d){var c=this.$options,m=this.$matchIterator(d,c);if(!m)return!1;var g=null;return m.forEach(function(v,b,E,S){return g=new p(v,b,E,S),b==S&&c.start&&c.start.start&&c.skipCurrent!=!1&&g.isEqual(c.start)?(g=null,!1):!0}),g},l.prototype.findAll=function(d){var c=this.$options;if(!c.needle)return[];this.$assembleRegExp(c);var m=c.range,g=m?d.getLines(m.start.row,m.end.row):d.doc.getAllLines(),v=[],b=c.re;if(c.$isMultiLine){var E=b.length,S=g.length-E,w;e:for(var y=b.offset||0;y<=S;y++){for(var D=0;D<E;D++)if(g[y+D].search(b[D])==-1)continue e;var $=g[y],A=g[y+E-1],_=$.length-$.match(b[0])[0].length,L=A.match(b[E-1])[0].length;w&&w.end.row===y&&w.end.column>_||(v.push(w=new p(y,_,y+E-1,L)),E>2&&(y=y+E-2))}}else for(var T,k=0;k<g.length;k++)if(this.$isMultilineSearch(c)){var x=g.length-1;if(T=this.$multiLineForward(d,b,k,x),T){var C=T.endRow<=x?T.endRow-1:x;C>k&&(k=C),v.push(new p(T.startRow,T.startCol,T.endRow,T.endCol))}}else{T=i.getMatchOffsets(g[k],b);for(var D=0;D<T.length;D++){var M=T[D];v.push(new p(k,M.offset,k,M.offset+M.length))}}if(m){for(var F=m.start.column,R=m.end.column,k=0,D=v.length-1;k<D&&v[k].start.column<F&&v[k].start.row==0;)k++;for(var O=m.end.row-m.start.row;k<D&&v[D].end.column>R&&v[D].end.row==O;)D--;for(v=v.slice(k,D+1),k=0,D=v.length;k<D;k++)v[k].start.row+=m.start.row,v[k].end.row+=m.start.row}return v},l.prototype.parseReplaceString=function(d){for(var c={DollarSign:36,Ampersand:38,Digit0:48,Digit1:49,Digit9:57,Backslash:92,n:110,t:116},m="",g=0,v=d.length;g<v;g++){var b=d.charCodeAt(g);if(b===c.Backslash){if(g++,g>=v){m+="\\";break}var E=d.charCodeAt(g);switch(E){case c.Backslash:m+="\\";break;case c.n:m+=`
`;break;case c.t:m+=" ";break}continue}if(b===c.DollarSign){if(g++,g>=v){m+="$";break}var S=d.charCodeAt(g);if(S===c.DollarSign){m+="$$";continue}if(S===c.Digit0||S===c.Ampersand){m+="$&";continue}if(c.Digit1<=S&&S<=c.Digit9){m+="$"+d[g];continue}}m+=d[g]}return m||d},l.prototype.replace=function(d,c){var m=this.$options,g=this.$assembleRegExp(m);if(m.$isMultiLine)return c;if(g){var v=this.$isMultilineSearch(m);v&&(d=d.replace(/\r\n|\r|\n/g,`
`));var b=g.exec(d);if(!b||!v&&b[0].length!=d.length)return null;if(c=m.regExp?this.parseReplaceString(c):c.replace(/\$/g,"$$$$"),c=d.replace(g,c),m.preserveCase){c=c.split("");for(var E=Math.min(d.length,d.length);E--;){var S=d[E];S&&S.toLowerCase()!=S?c[E]=c[E].toUpperCase():c[E]=c[E].toLowerCase()}c=c.join("")}return c}},l.prototype.$assembleRegExp=function(d,c){if(d.needle instanceof RegExp)return d.re=d.needle;var m=d.needle;if(!d.needle)return d.re=!1;d.regExp||(m=i.escapeRegExp(m));var g=d.caseSensitive?"gm":"gmi";try{new RegExp(m,"u"),d.$supportsUnicodeFlag=!0,g+="u"}catch{d.$supportsUnicodeFlag=!1}if(d.wholeWord&&(m=u(m,d)),d.$isMultiLine=!c&&/[\n\r]/.test(m),d.$isMultiLine)return d.re=this.$assembleMultilineRegExp(m,g);try{var v=new RegExp(m,g)}catch{v=!1}return d.re=v},l.prototype.$assembleMultilineRegExp=function(d,c){for(var m=d.replace(/\r\n|\r|\n/g,`$
^`).split(`
`),g=[],v=0;v<m.length;v++)try{g.push(new RegExp(m[v],c))}catch{return!1}return g},l.prototype.$isMultilineSearch=function(d){return d.re&&/\\r\\n|\\r|\\n/.test(d.re.source)&&d.regExp&&!d.$isMultiLine},l.prototype.$multiLineForward=function(d,c,m,g){for(var v,b=a(d,m),E=m;E<=g;){for(var S=0;S<b&&!(E>g);S++){var w=d.getLine(E++);v=v==null?w:v+`
`+w}var y=c.exec(v);if(c.lastIndex=0,y){var D=v.slice(0,y.index).split(`
`),$=y[0].split(`
`),A=m+D.length-1,_=D[D.length-1].length,L=A+$.length-1,T=$.length==1?_+$[0].length:$[$.length-1].length;return{startRow:A,startCol:_,endRow:L,endCol:T}}}return null},l.prototype.$multiLineBackward=function(d,c,m,g,v){for(var b,E=a(d,g),S=d.getLine(g).length-m,w=g;w>=v;){for(var y=0;y<E&&w>=v;y++){var D=d.getLine(w--);b=b==null?D:D+`
`+b}var $=r(b,c,S);if($){var A=b.slice(0,$.index).split(`
`),_=$[0].split(`
`),L=w+A.length,T=A[A.length-1].length,k=L+_.length-1,x=_.length==1?T+_[0].length:_[_.length-1].length;return{startRow:L,startCol:T,endRow:k,endCol:x}}}return null},l.prototype.$matchIterator=function(d,c){var m=this.$assembleRegExp(c);if(!m)return!1;var g=this.$isMultilineSearch(c),v=this.$multiLineForward,b=this.$multiLineBackward,E=c.backwards==!0,S=c.skipCurrent!=!1,w=m.unicode,y=c.range,D=c.start;D||(D=y?y[E?"end":"start"]:d.selection.getRange()),D.start&&(D=D[S!=E?"end":"start"]);var $=y?y.start.row:0,A=y?y.end.row:d.getLength()-1;if(E)var _=function(k){var x=D.row;if(!T(x,D.column,k)){for(x--;x>=$;x--)if(T(x,Number.MAX_VALUE,k))return;if(c.wrap!=!1){for(x=A,$=D.row;x>=$;x--)if(T(x,Number.MAX_VALUE,k))return}}};else var _=function(x){var C=D.row;if(!T(C,D.column,x)){for(C=C+1;C<=A;C++)if(T(C,0,x))return;if(c.wrap!=!1){for(C=$,A=D.row;C<=A;C++)if(T(C,0,x))return}}};if(c.$isMultiLine)var L=m.length,T=function(k,x,C){var M=E?k-L+1:k;if(!(M<0||M+L>d.getLength())){var F=d.getLine(M),R=F.search(m[0]);if(!(!E&&R<x||R===-1)){for(var O=1;O<L;O++)if(F=d.getLine(M+O),F.search(m[O])==-1)return;var B=F.match(m[L-1])[0].length;if(!(E&&B>x)&&C(M,R,M+L-1,B))return!0}}};else if(E)var T=function(x,C,M){if(g){var F=b(d,m,C,x,$);if(!F)return!1;if(M(F.startRow,F.startCol,F.endRow,F.endCol))return!0}else{var R=d.getLine(x),O=[],B,N=0;for(m.lastIndex=0;B=m.exec(R);){var j=B[0].length;if(N=B.index,!j){if(N>=R.length)break;m.lastIndex=N+=i.skipEmptyMatch(R,N,w)}if(B.index+j>C)break;O.push(B.index,j)}for(var V=O.length-1;V>=0;V-=2){var W=O[V-1],j=O[V];if(M(x,W,x,W+j))return!0}}};else var T=function(x,C,M){if(m.lastIndex=C,g){var F=v(d,m,x,A);if(F){var R=F.endRow<=A?F.endRow-1:A;R>x&&(x=R)}if(!F)return!1;if(M(F.startRow,F.startCol,F.endRow,F.endCol))return!0}else for(var O=d.getLine(x),B,N;N=m.exec(O);){var j=N[0].length;if(B=N.index,M(x,B,x,B+j))return!0;if(!j&&(m.lastIndex=B+=i.skipEmptyMatch(O,B,w),B>=O.length))return!1}};return{forEach:_}},l})();function u(l,d){var c=i.supportsLookbehind();function m(E,S){S===void 0&&(S=!0);var w=c&&d.$supportsUnicodeFlag?new RegExp("[\\p{L}\\p{N}_]","u"):new RegExp("\\w");return w.test(E)||d.regExp?c&&d.$supportsUnicodeFlag?S?"(?<=^|[^\\p{L}\\p{N}_])":"(?=[^\\p{L}\\p{N}_]|$)":"\\b":""}var g=Array.from(l),v=g[0],b=g[g.length-1];return m(v)+l+m(b,!1)}function r(l,d,c){for(var m=null,g=0;g<=l.length;){d.lastIndex=g;var v=d.exec(l);if(!v)break;var b=v.index+v[0].length;if(b>l.length-c)break;(!m||b>m.index+m[0].length)&&(m=v),g=v.index+1}return m}function a(l,d){var c=5e3,m={row:d,column:0},g=l.doc.positionToIndex(m),v=g+c,b=l.doc.indexToPosition(v),E=b.row;return E+1}n.Search=s}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(t,n,f){var i=this&&this.__extends||(function(){var l=function(d,c){return l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(m,g){m.__proto__=g}||function(m,g){for(var v in g)Object.prototype.hasOwnProperty.call(g,v)&&(m[v]=g[v])},l(d,c)};return function(d,c){if(typeof c!="function"&&c!==null)throw new TypeError("Class extends value "+String(c)+" is not a constructor or null");l(d,c);function m(){this.constructor=d}d.prototype=c===null?Object.create(c):(m.prototype=c.prototype,new m)}})(),o=t("../lib/keys"),p=t("../lib/useragent"),s=o.KEY_MODS,u=(function(){function l(d,c){this.$init(d,c,!1)}return l.prototype.$init=function(d,c,m){this.platform=c||(p.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(d),this.$singleCommand=m},l.prototype.addCommand=function(d){this.commands[d.name]&&this.removeCommand(d),this.commands[d.name]=d,d.bindKey&&this._buildKeyHash(d)},l.prototype.removeCommand=function(d,c){var m=d&&(typeof d=="string"?d:d.name);d=this.commands[m],c||delete this.commands[m];var g=this.commandKeyBinding;for(var v in g){var b=g[v];if(b==d)delete g[v];else if(Array.isArray(b)){var E=b.indexOf(d);E!=-1&&(b.splice(E,1),b.length==1&&(g[v]=b[0]))}}},l.prototype.bindKey=function(d,c,m){if(typeof d=="object"&&d&&(m==null&&(m=d.position),d=d[this.platform]),!!d){if(typeof c=="function")return this.addCommand({exec:c,bindKey:d,name:c.name||d});d.split("|").forEach(function(g){var v="";if(g.indexOf(" ")!=-1){var b=g.split(/\s+/);g=b.pop(),b.forEach(function(w){var y=this.parseKeys(w),D=s[y.hashId]+y.key;v+=(v?" ":"")+D,this._addCommandToBinding(v,"chainKeys")},this),v+=" "}var E=this.parseKeys(g),S=s[E.hashId]+E.key;this._addCommandToBinding(v+S,c,m)},this)}},l.prototype._addCommandToBinding=function(d,c,m){var g=this.commandKeyBinding,v;if(!c)delete g[d];else if(!g[d]||this.$singleCommand)g[d]=c;else{Array.isArray(g[d])?(v=g[d].indexOf(c))!=-1&&g[d].splice(v,1):g[d]=[g[d]],typeof m!="number"&&(m=r(c));var b=g[d];for(v=0;v<b.length;v++){var E=b[v],S=r(E);if(S>m)break}b.splice(v,0,c)}},l.prototype.addCommands=function(d){d&&Object.keys(d).forEach(function(c){var m=d[c];if(m){if(typeof m=="string")return this.bindKey(m,c);typeof m=="function"&&(m={exec:m}),typeof m=="object"&&(m.name||(m.name=c),this.addCommand(m))}},this)},l.prototype.removeCommands=function(d){Object.keys(d).forEach(function(c){this.removeCommand(d[c])},this)},l.prototype.bindKeys=function(d){Object.keys(d).forEach(function(c){this.bindKey(c,d[c])},this)},l.prototype._buildKeyHash=function(d){this.bindKey(d.bindKey,d)},l.prototype.parseKeys=function(d){var c=d.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(S){return S}),m=c.pop(),g=o[m];if(o.FUNCTION_KEYS[g])m=o.FUNCTION_KEYS[g].toLowerCase();else if(c.length){if(c.length==1&&c[0]=="shift")return{key:m.toUpperCase(),hashId:-1}}else return{key:m,hashId:-1};for(var v=0,b=c.length;b--;){var E=o.KEY_MODS[c[b]];if(E==null)return typeof console<"u"&&console.error("invalid modifier "+c[b]+" in "+d),!1;v|=E}return{key:m,hashId:v}},l.prototype.findKeyCommand=function(d,c){var m=s[d]+c;return this.commandKeyBinding[m]},l.prototype.handleKeyboard=function(d,c,m,g){if(!(g<0)){var v=s[c]+m,b=this.commandKeyBinding[v];return d.$keyChain&&(d.$keyChain+=" "+v,b=this.commandKeyBinding[d.$keyChain]||b),b&&(b=="chainKeys"||b[b.length-1]=="chainKeys")?(d.$keyChain=d.$keyChain||v,{command:"null"}):(d.$keyChain&&((!c||c==4)&&m.length==1?d.$keyChain=d.$keyChain.slice(0,-v.length-1):(c==-1||g>0)&&(d.$keyChain="")),{command:b})}},l.prototype.getStatusText=function(d,c){return c.$keyChain||""},l})();function r(l){return typeof l=="object"&&l.bindKey&&l.bindKey.position||(l.isDefault?-100:0)}var a=(function(l){i(d,l);function d(c,m){var g=l.call(this,c,m)||this;return g.$singleCommand=!0,g}return d})(u);a.call=function(l,d,c){u.prototype.$init.call(l,d,c,!0)},u.call=function(l,d,c){u.prototype.$init.call(l,d,c,!1)},n.HashHandler=a,n.MultiHashHandler=u}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(t,n,f){var i=this&&this.__extends||(function(){var r=function(a,l){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,c){d.__proto__=c}||function(d,c){for(var m in c)Object.prototype.hasOwnProperty.call(c,m)&&(d[m]=c[m])},r(a,l)};return function(a,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");r(a,l);function d(){this.constructor=a}a.prototype=l===null?Object.create(l):(d.prototype=l.prototype,new d)}})(),o=t("../lib/oop"),p=t("../keyboard/hash_handler").MultiHashHandler,s=t("../lib/event_emitter").EventEmitter,u=(function(r){i(a,r);function a(l,d){var c=r.call(this,d,l)||this;return c.byName=c.commands,c.setDefaultHandler("exec",function(m){return m.args?m.command.exec(m.editor,m.args,m.event,!1):m.command.exec(m.editor,{},m.event,!0)}),c}return a.prototype.exec=function(l,d,c){if(Array.isArray(l)){for(var m=l.length;m--;)if(this.exec(l[m],d,c))return!0;return!1}typeof l=="string"&&(l=this.commands[l]);var g={editor:d,command:l,args:c};return this.canExecute(l,d)?(g.returnValue=this._emit("exec",g),this._signal("afterExec",g),g.returnValue!==!1):(this._signal("commandUnavailable",g),!1)},a.prototype.canExecute=function(l,d){return typeof l=="string"&&(l=this.commands[l]),!(!l||d&&d.$readOnly&&!l.readOnly||this.$checkCommandState!=!1&&l.isAvailable&&!l.isAvailable(d))},a.prototype.toggleRecording=function(l){if(!this.$inReplay)return l&&l._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(d){this.macro.push([d.command,d.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},a.prototype.replay=function(l){if(!(this.$inReplay||!this.macro)){if(this.recording)return this.toggleRecording(l);try{this.$inReplay=!0,this.macro.forEach(function(d){typeof d=="string"?this.exec(d,l):this.exec(d[0],l,d[1])},this)}finally{this.$inReplay=!1}}},a.prototype.trimMacro=function(l){return l.map(function(d){return typeof d[0]!="string"&&(d[0]=d[0].name),d[1]||(d=d[0]),d})},a})(p);o.implement(u.prototype,s),n.CommandManager=u}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(t,n,f){var i=t("../lib/lang"),o=t("../config"),p=t("../range").Range;function s(r,a){return{win:r,mac:a}}n.commands=[{name:"showSettingsMenu",description:"Show settings menu",bindKey:s("Ctrl-,","Command-,"),exec:function(r){o.loadModule("ace/ext/settings_menu",function(a){a.init(r),r.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",description:"Go to next error",bindKey:s("Alt-E","F4"),exec:function(r){o.loadModule("ace/ext/error_marker",function(a){a.showErrorMarker(r,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",description:"Go to previous error",bindKey:s("Alt-Shift-E","Shift-F4"),exec:function(r){o.loadModule("ace/ext/error_marker",function(a){a.showErrorMarker(r,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:s("Ctrl-A","Command-A"),exec:function(r){r.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:s(null,"Ctrl-L"),exec:function(r){r.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:s("Ctrl-L","Command-L"),exec:function(r,a){typeof a=="number"&&!isNaN(a)&&r.gotoLine(a),r.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:s("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(r){r.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(r){r.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",description:"Toggle fold widget",bindKey:s("F2","F2"),exec:function(r){r.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",description:"Toggle parent fold widget",bindKey:s("Alt-F2","Alt-F2"),exec:function(r){r.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:s(null,"Ctrl-Command-Option-0"),exec:function(r){r.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldAllComments",description:"Fold all comments",bindKey:s(null,"Ctrl-Command-Option-0"),exec:function(r){r.session.foldAllComments()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:s("Alt-0","Command-Option-0"),exec:function(r){r.session.foldAll(),r.session.unfold(r.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:s("Alt-Shift-0","Command-Option-Shift-0"),exec:function(r){r.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:s("Ctrl-K","Command-G"),exec:function(r){r.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:s("Ctrl-Shift-K","Command-Shift-G"),exec:function(r){r.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:s("Alt-K","Ctrl-G"),exec:function(r){r.selection.isEmpty()?r.selection.selectWord():r.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:s("Alt-Shift-K","Ctrl-Shift-G"),exec:function(r){r.selection.isEmpty()?r.selection.selectWord():r.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:s("Ctrl-F","Command-F"),exec:function(r){o.loadModule("ace/ext/searchbox",function(a){a.Search(r)})},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(r){r.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:s("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(r){r.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(r){r.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(r){r.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:s("Up","Up|Ctrl-P"),exec:function(r,a){r.navigateUp(a.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(r){r.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(r){r.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(r){r.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:s("Down","Down|Ctrl-N"),exec:function(r,a){r.navigateDown(a.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:s("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(r){r.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:s("Ctrl-Left","Option-Left"),exec:function(r){r.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(r){r.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(r){r.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:s("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(r){r.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:s("Left","Left|Ctrl-B"),exec:function(r,a){r.navigateLeft(a.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:s("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(r){r.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:s("Ctrl-Right","Option-Right"),exec:function(r){r.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(r){r.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(r){r.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:s("Shift-Right","Shift-Right"),exec:function(r){r.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:s("Right","Right|Ctrl-F"),exec:function(r,a){r.navigateRight(a.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(r){r.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:s(null,"Option-PageDown"),exec:function(r){r.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:s("PageDown","PageDown|Ctrl-V"),exec:function(r){r.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(r){r.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:s(null,"Option-PageUp"),exec:function(r){r.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(r){r.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:s("Ctrl-Up",null),exec:function(r){r.renderer.scrollBy(0,-2*r.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:s("Ctrl-Down",null),exec:function(r){r.renderer.scrollBy(0,2*r.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(r){r.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(r){r.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:s("Ctrl-Alt-E","Command-Option-E"),exec:function(r){r.commands.toggleRecording(r)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:s("Ctrl-Shift-E","Command-Shift-E"),exec:function(r){r.commands.replay(r)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:s("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(r){r.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:s("Ctrl-Shift-\\|Ctrl-Shift-P","Command-Shift-\\"),exec:function(r){r.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:s("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(r){r.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(r){},readOnly:!0},{name:"cut",description:"Cut",exec:function(r){var a=r.$copyWithEmptySelection&&r.selection.isEmpty(),l=a?r.selection.getLineRange():r.selection.getRange();r._emit("cut",l),l.isEmpty()||r.session.remove(l),r.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(r,a){r.$handlePaste(a)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:s("Ctrl-D","Command-D"),exec:function(r){r.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:s("Ctrl-Shift-D","Command-Shift-D"),exec:function(r){r.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:s("Ctrl-Alt-S","Command-Alt-S"),exec:function(r){r.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:s("Ctrl-/","Command-/"),exec:function(r){r.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:s("Ctrl-Shift-/","Command-Shift-/"),exec:function(r){r.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:s("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(r){r.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:s("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(r){r.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:s("Ctrl-H","Command-Option-F"),exec:function(r){o.loadModule("ace/ext/searchbox",function(a){a.Search(r,!0)})}},{name:"undo",description:"Undo",bindKey:s("Ctrl-Z","Command-Z"),exec:function(r){r.undo()}},{name:"redo",description:"Redo",bindKey:s("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(r){r.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:s("Alt-Shift-Up","Command-Option-Up"),exec:function(r){r.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:s("Alt-Up","Option-Up"),exec:function(r){r.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:s("Alt-Shift-Down","Command-Option-Down"),exec:function(r){r.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:s("Alt-Down","Option-Down"),exec:function(r){r.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:s("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(r){r.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:s("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(r){r.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:s("Shift-Delete",null),exec:function(r){if(r.selection.isEmpty())r.remove("left");else return!1},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:s("Alt-Backspace","Command-Backspace"),exec:function(r){r.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:s("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(r){r.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:s("Ctrl-Shift-Backspace",null),exec:function(r){var a=r.selection.getRange();a.start.column=0,r.session.remove(a)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:s("Ctrl-Shift-Delete",null),exec:function(r){var a=r.selection.getRange();a.end.column=Number.MAX_VALUE,r.session.remove(a)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:s("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(r){r.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:s("Ctrl-Delete","Alt-Delete"),exec:function(r){r.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:s("Shift-Tab","Shift-Tab"),exec:function(r){r.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:s("Tab","Tab"),exec:function(r){r.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:s("Ctrl-[","Ctrl-["),exec:function(r){r.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:s("Ctrl-]","Ctrl-]"),exec:function(r){r.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(r,a){r.insert(a)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(r,a){r.insert(i.stringRepeat(a.text||"",a.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:s(null,"Ctrl-O"),exec:function(r){r.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:s("Alt-Shift-X","Ctrl-T"),exec:function(r){r.transposeLetters()},multiSelectAction:function(r){r.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:s("Ctrl-U","Ctrl-U"),exec:function(r){r.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:s("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(r){r.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:s(null,null),exec:function(r){r.autoIndent()},scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:s("Ctrl-Shift-L","Command-Shift-L"),exec:function(r){var a=r.selection.getRange();a.start.column=a.end.column=0,a.end.row++,r.selection.setRange(a,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"openlink",bindKey:s("Ctrl+F3","F3"),exec:function(r){r.openLink()}},{name:"joinlines",description:"Join lines",bindKey:s(null,null),exec:function(r){for(var a=r.selection.isBackwards(),l=a?r.selection.getSelectionLead():r.selection.getSelectionAnchor(),d=a?r.selection.getSelectionAnchor():r.selection.getSelectionLead(),c=r.session.doc.getLine(l.row).length,m=r.session.doc.getTextRange(r.selection.getRange()),g=m.replace(/\n\s*/," ").length,v=r.session.doc.getLine(l.row),b=l.row+1;b<=d.row+1;b++){var E=i.stringTrimLeft(i.stringTrimRight(r.session.doc.getLine(b)));E.length!==0&&(E=" "+E),v+=E}d.row+1<r.session.doc.getLength()-1&&(v+=r.session.doc.getNewLineCharacter()),r.clearSelection(),r.session.doc.replace(new p(l.row,0,d.row+2,0),v),g>0?(r.selection.moveCursorTo(l.row,l.column),r.selection.selectTo(l.row,l.column+g)):(c=r.session.doc.getLine(l.row).length>c?c+1:c,r.selection.moveCursorTo(l.row,c))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:s(null,null),exec:function(r){var a=r.session.doc.getLength()-1,l=r.session.doc.getLine(a).length,d=r.selection.rangeList.ranges,c=[];d.length<1&&(d=[r.selection.getRange()]);for(var m=0;m<d.length;m++)m==d.length-1&&(d[m].end.row===a&&d[m].end.column===l||c.push(new p(d[m].end.row,d[m].end.column,a,l))),m===0?d[m].start.row===0&&d[m].start.column===0||c.push(new p(0,0,d[m].start.row,d[m].start.column)):c.push(new p(d[m-1].end.row,d[m-1].end.column,d[m].start.row,d[m].start.column));r.exitMultiSelectMode(),r.clearSelection();for(var m=0;m<c.length;m++)r.selection.addRange(c[m],!1)},readOnly:!0,scrollIntoView:"none"},{name:"addLineAfter",description:"Add new line after the current line",exec:function(r){r.selection.clearSelection(),r.navigateLineEnd(),r.insert(`
`)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"addLineBefore",description:"Add new line before the current line",exec:function(r){r.selection.clearSelection();var a=r.getCursorPosition();r.selection.moveTo(a.row-1,Number.MAX_VALUE),r.insert(`
`),a.row===0&&r.navigateUp()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"openCommandPallete",exec:function(r){console.warn("This is an obsolete command. Please use `openCommandPalette` instead."),r.prompt({$type:"commands"})},readOnly:!0},{name:"openCommandPalette",description:"Open command palette",bindKey:s("F1","F1"),exec:function(r){r.prompt({$type:"commands"})},readOnly:!0},{name:"modeSelect",description:"Change language mode...",bindKey:s(null,null),exec:function(r){r.prompt({$type:"modes"})},readOnly:!0}];for(var u=1;u<9;u++)n.commands.push({name:"foldToLevel"+u,description:"Fold To Level "+u,level:u,exec:function(r){r.session.foldToLevel(this.level)},scrollIntoView:"center",readOnly:!0})}),ace.define("ace/keyboard/gutter_handler",["require","exports","module","ace/lib/keys"],function(t,n,f){var i=t("../lib/keys"),o=(function(){function s(u){this.editor=u,this.gutterLayer=u.renderer.$gutterLayer,this.element=u.renderer.$gutter,this.lines=u.renderer.$gutterLayer.$lines,this.activeRowIndex=null,this.activeLane=null,this.annotationTooltip=this.editor.$mouseHandler.$tooltip}return s.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))},s.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))},s.prototype.$onGutterKeyDown=function(u){if(this.annotationTooltip.isOpen){u.preventDefault(),u.keyCode===i.escape&&this.annotationTooltip.hide();return}if(u.target===this.element){if(u.keyCode!=i.enter)return;u.preventDefault();var r=this.editor.getCursorPosition().row;this.editor.isRowVisible(r)||this.editor.scrollToLine(r,!0,!0),setTimeout(function(){var a=this.$rowToRowIndex(this.gutterLayer.$cursorCell.row),l=this.$findNearestFoldLaneWidget(a),d=this.$findNearestAnnotation(a);if(!(l===null&&d===null)){var c=this.$findClosestNumber(l,d,a);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=d,this.activeLane="annotation",this.$focusAnnotation(this.activeRowIndex);return}}}.bind(this),10);return}this.$handleGutterKeyboardInteraction(u),setTimeout(function(){this.editor._signal("gutterkeydown",new p(u,this))}.bind(this),10)},s.prototype.$handleGutterKeyboardInteraction=function(u){if(u.keyCode===i.tab){u.preventDefault();return}if(u.keyCode===i.escape){u.preventDefault(),this.$blurGutter(),this.element.focus(),this.lane=null;return}if(u.keyCode===i.up){switch(u.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetUp();break;case"annotation":this.$moveAnnotationUp();break}return}if(u.keyCode===i.down){switch(u.preventDefault(),this.activeLane){case"fold":this.$moveFoldWidgetDown();break;case"annotation":this.$moveAnnotationDown();break}return}if(u.keyCode===i.left){u.preventDefault(),this.$switchLane("annotation");return}if(u.keyCode===i.right){u.preventDefault(),this.$switchLane("fold");return}if(u.keyCode===i.enter||u.keyCode===i.space){switch(u.preventDefault(),this.activeLane){case"fold":var r=this.$rowIndexToRow(this.activeRowIndex),a=this.editor.session.$gutterCustomWidgets[r];if(a)a.callbacks&&a.callbacks.onClick&&a.callbacks.onClick(u,r);else if(this.gutterLayer.session.foldWidgets[r]==="start"){this.editor.session.onFoldWidgetClick(this.$rowIndexToRow(this.activeRowIndex),u),setTimeout(function(){this.$rowIndexToRow(this.activeRowIndex)!==r&&(this.$blurFoldWidget(this.activeRowIndex),this.activeRowIndex=this.$rowToRowIndex(r),this.$focusFoldWidget(this.activeRowIndex))}.bind(this),10);break}else if(this.gutterLayer.session.foldWidgets[this.$rowIndexToRow(this.activeRowIndex)]==="end")break;return;case"annotation":this.annotationTooltip.showTooltip(this.$rowIndexToRow(this.activeRowIndex)),this.annotationTooltip.$fromKeyboard=!0;break}return}},s.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.hide()},s.prototype.$isFoldWidgetVisible=function(u){var r=this.editor.isRowFullyVisible(this.$rowIndexToRow(u)),a=this.$getFoldWidget(u).style.display!=="none";return r&&a},s.prototype.$isCustomWidgetVisible=function(u){var r=this.editor.isRowFullyVisible(this.$rowIndexToRow(u)),a=!!this.$getCustomWidget(u);return r&&a},s.prototype.$isAnnotationVisible=function(u){var r=this.editor.isRowFullyVisible(this.$rowIndexToRow(u)),a=this.$getAnnotation(u).style.display!=="none";return r&&a},s.prototype.$getFoldWidget=function(u){var r=this.lines.get(u),a=r.element;return a.childNodes[1]},s.prototype.$getCustomWidget=function(u){var r=this.lines.get(u),a=r.element;return a.childNodes[3]},s.prototype.$getAnnotation=function(u){var r=this.lines.get(u),a=r.element;return a.childNodes[2]},s.prototype.$findNearestFoldLaneWidget=function(u){if(this.$isCustomWidgetVisible(u)||this.$isFoldWidgetVisible(u))return u;for(var r=0;u-r>0||u+r<this.lines.getLength()-1;){if(r++,u-r>=0&&this.$isCustomWidgetVisible(u-r))return u-r;if(u+r<=this.lines.getLength()-1&&this.$isCustomWidgetVisible(u+r))return u+r;if(u-r>=0&&this.$isFoldWidgetVisible(u-r))return u-r;if(u+r<=this.lines.getLength()-1&&this.$isFoldWidgetVisible(u+r))return u+r}return null},s.prototype.$findNearestAnnotation=function(u){if(this.$isAnnotationVisible(u))return u;for(var r=0;u-r>0||u+r<this.lines.getLength()-1;){if(r++,u-r>=0&&this.$isAnnotationVisible(u-r))return u-r;if(u+r<=this.lines.getLength()-1&&this.$isAnnotationVisible(u+r))return u+r}return null},s.prototype.$focusFoldWidget=function(u){if(u!=null){var r=this.$getFoldWidget(u);r.classList.add(this.editor.renderer.keyboardFocusClassName),r.focus()}},s.prototype.$focusCustomWidget=function(u){if(u!=null){var r=this.$getCustomWidget(u);r&&(r.classList.add(this.editor.renderer.keyboardFocusClassName),r.focus())}},s.prototype.$focusAnnotation=function(u){if(u!=null){var r=this.$getAnnotation(u);r.classList.add(this.editor.renderer.keyboardFocusClassName),r.focus()}},s.prototype.$blurFoldWidget=function(u){var r=this.$getFoldWidget(u);r.classList.remove(this.editor.renderer.keyboardFocusClassName),r.blur()},s.prototype.$blurCustomWidget=function(u){var r=this.$getCustomWidget(u);r&&(r.classList.remove(this.editor.renderer.keyboardFocusClassName),r.blur())},s.prototype.$blurAnnotation=function(u){var r=this.$getAnnotation(u);r.classList.remove(this.editor.renderer.keyboardFocusClassName),r.blur()},s.prototype.$moveFoldWidgetUp=function(){for(var u=this.activeRowIndex;u>0;)if(u--,this.$isFoldWidgetVisible(u)||this.$isCustomWidgetVisible(u)){this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=u,this.$isFoldWidgetVisible(u)?this.$focusFoldWidget(this.activeRowIndex):this.$focusCustomWidget(this.activeRowIndex);return}},s.prototype.$moveFoldWidgetDown=function(){for(var u=this.activeRowIndex;u<this.lines.getLength()-1;)if(u++,this.$isFoldWidgetVisible(u)||this.$isCustomWidgetVisible(u)){this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=u,this.$isFoldWidgetVisible(u)?this.$focusFoldWidget(this.activeRowIndex):this.$focusCustomWidget(this.activeRowIndex);return}},s.prototype.$moveAnnotationUp=function(){for(var u=this.activeRowIndex;u>0;)if(u--,this.$isAnnotationVisible(u)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=u,this.$focusAnnotation(this.activeRowIndex);return}},s.prototype.$moveAnnotationDown=function(){for(var u=this.activeRowIndex;u<this.lines.getLength()-1;)if(u++,this.$isAnnotationVisible(u)){this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=u,this.$focusAnnotation(this.activeRowIndex);return}},s.prototype.$findClosestNumber=function(u,r,a){return u===null?r:r===null||Math.abs(a-u)<=Math.abs(a-r)?u:r},s.prototype.$switchLane=function(u){switch(u){case"annotation":if(this.activeLane==="annotation")break;var r=this.$findNearestAnnotation(this.activeRowIndex);if(r==null)break;this.activeLane="annotation",this.$blurFoldWidget(this.activeRowIndex),this.$blurCustomWidget(this.activeRowIndex),this.activeRowIndex=r,this.$focusAnnotation(this.activeRowIndex);break;case"fold":if(this.activeLane==="fold")break;var a=this.$findNearestFoldLaneWidget(this.activeRowIndex);if(a===null)break;this.activeLane="fold",this.$blurAnnotation(this.activeRowIndex),this.activeRowIndex=a,this.$isCustomWidgetVisible(a)?this.$focusCustomWidget(this.activeRowIndex):this.$focusFoldWidget(this.activeRowIndex);break}},s.prototype.$rowIndexToRow=function(u){var r=this.lines.get(u);return r?r.row:null},s.prototype.$rowToRowIndex=function(u){for(var r=0;r<this.lines.getLength();r++){var a=this.lines.get(r);if(a.row==u)return r}return null},s})();n.GutterKeyboardHandler=o;var p=(function(){function s(u,r){this.gutterKeyboardHandler=r,this.domEvent=u}return s.prototype.getKey=function(){return i.keyCodeToString(this.domEvent.keyCode)},s.prototype.getRow=function(){return this.gutterKeyboardHandler.$rowIndexToRow(this.gutterKeyboardHandler.activeRowIndex)},s.prototype.isInAnnotationLane=function(){return this.gutterKeyboardHandler.activeLane==="annotation"},s.prototype.isInFoldLane=function(){return this.gutterKeyboardHandler.activeLane==="fold"},s})();n.GutterKeyboardEvent=p}),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(t,n,f){var i=this&&this.__values||function(x){var C=typeof Symbol=="function"&&Symbol.iterator,M=C&&x[C],F=0;if(M)return M.call(x);if(x&&typeof x.length=="number")return{next:function(){return x&&F>=x.length&&(x=void 0),{value:x&&x[F++],done:!x}}};throw new TypeError(C?"Object is not iterable.":"Symbol.iterator is not defined.")},o=t("./lib/oop"),p=t("./lib/dom"),s=t("./lib/lang"),u=t("./lib/useragent"),r=t("./keyboard/textinput").TextInput,a=t("./mouse/mouse_handler").MouseHandler,l=t("./mouse/fold_handler").FoldHandler,d=t("./keyboard/keybinding").KeyBinding,c=t("./edit_session").EditSession,m=t("./search").Search,g=t("./range").Range,v=t("./lib/event_emitter").EventEmitter,b=t("./commands/command_manager").CommandManager,E=t("./commands/default_commands").commands,S=t("./config"),w=t("./token_iterator").TokenIterator,y=t("./keyboard/gutter_handler").GutterKeyboardHandler,D=t("./config").nls,$=t("./clipboard"),A=t("./lib/keys"),_=t("./lib/event"),L=t("./tooltip").HoverTooltip,T=(function(){function x(C,M,F){this.id="editor"+ ++x.$uid,this.session,this.$toDestroy=[];var R=C.getContainerElement();this.container=R,this.renderer=C,this.commands=new b(u.isMac?"mac":"win",E),typeof document=="object"&&(this.textInput=new r(C.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.$mouseHandler=new a(this),new l(this)),this.keyBinding=new d(this),this.$search=new m().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,B){B._$emitInputEvent.schedule(31)}),this.setSession(M||F&&F.session||new c("")),S.resetOptions(this),F&&this.setOptions(F),S._signal("editor",this)}return x.prototype.$initOperationListeners=function(){this.commands.on("exec",this.startOperation.bind(this),!0),this.commands.on("afterExec",this.endOperation.bind(this),!0)},x.prototype.startOperation=function(C){this.session.startOperation(C)},x.prototype.endOperation=function(C){this.session.endOperation(C)},x.prototype.onStartOperation=function(C){this.curOp=this.session.curOp,this.curOp.scrollTop=this.renderer.scrollTop,this.prevOp=this.session.prevOp,C||(this.previousCommand=null)},x.prototype.onEndOperation=function(C){if(this.curOp&&this.session){if(C&&C.returnValue===!1){this.curOp=null;return}if(this._signal("beforeEndOperation"),!this.curOp)return;var M=this.curOp.command,F=M&&M.scrollIntoView;if(F){switch(F){case"center-animate":F="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}F=="animate"&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.$lastSel=this.session.selection.toJSON(),this.prevOp=this.curOp,this.curOp=null}},x.prototype.$historyTracker=function(C){if(this.$mergeUndoDeltas){var M=this.prevOp,F=this.$mergeableCommands,R=M.command&&C.command.name==M.command.name;if(C.command.name=="insertstring"){var O=C.args;this.mergeNextCommand===void 0&&(this.mergeNextCommand=!0),R=R&&this.mergeNextCommand&&(!/\s/.test(O)||/\s/.test(M.args)),this.mergeNextCommand=!0}else R=R&&F.indexOf(C.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(R=!1),R?this.session.mergeUndoDeltas=!0:F.indexOf(C.command.name)!==-1&&(this.sequenceStartTime=Date.now())}},x.prototype.setKeyboardHandler=function(C,M){if(C&&typeof C=="string"&&C!="ace"){this.$keybindingId=C;var F=this;S.loadModule(["keybinding",C],function(R){F.$keybindingId==C&&F.keyBinding.setKeyboardHandler(R&&R.handler),M&&M()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(C),M&&M()},x.prototype.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},x.prototype.setSession=function(C){if(this.session!=C){this.curOp&&this.endOperation(),this.curOp={};var M=this.session;if(M){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 F=this.session.getSelection();F.off("changeCursor",this.$onCursorChange),F.off("changeSelection",this.$onSelectionChange)}this.session=C,C?(this.$onDocumentChange=this.onDocumentChange.bind(this),C.on("change",this.$onDocumentChange),this.renderer.setSession(C),this.$onChangeMode=this.onChangeMode.bind(this),C.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),C.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),C.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),C.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),C.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),C.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=C.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.$onStartOperation=this.onStartOperation.bind(this),this.session.on("startOperation",this.$onStartOperation),this.$onEndOperation=this.onEndOperation.bind(this),this.session.on("endOperation",this.$onEndOperation),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(C)),this._signal("changeSession",{session:C,oldSession:M}),this.curOp=null,M&&M._signal("changeEditor",{oldEditor:this}),M&&(M.$editor=null),C&&C._signal("changeEditor",{editor:this}),C&&(C.$editor=this),C&&!C.destroyed&&C.bgTokenizer.scheduleStart()}},x.prototype.getSession=function(){return this.session},x.prototype.setValue=function(C,M){return this.session.doc.setValue(C),M?M==1?this.navigateFileEnd():M==-1&&this.navigateFileStart():this.selectAll(),C},x.prototype.getValue=function(){return this.session.getValue()},x.prototype.getSelection=function(){return this.selection},x.prototype.resize=function(C){this.renderer.onResize(C)},x.prototype.setTheme=function(C,M){this.renderer.setTheme(C,M)},x.prototype.getTheme=function(){return this.renderer.getTheme()},x.prototype.setStyle=function(C,M){this.renderer.setStyle(C,M)},x.prototype.unsetStyle=function(C){this.renderer.unsetStyle(C)},x.prototype.getFontSize=function(){return this.getOption("fontSize")||p.computedStyle(this.container).fontSize},x.prototype.setFontSize=function(C){this.setOption("fontSize",C)},x.prototype.$highlightBrackets=function(){if(!this.$highlightPending){var C=this;this.$highlightPending=!0,setTimeout(function(){C.$highlightPending=!1;var M=C.session;if(!(!M||M.destroyed)){M.$bracketHighlight&&(M.$bracketHighlight.markerIds.forEach(function(H){M.removeMarker(H)}),M.$bracketHighlight=null);var F=C.getCursorPosition(),R=C.getKeyboardHandler(),O=R&&R.$getDirectionForHighlight&&R.$getDirectionForHighlight(C),B=M.getMatchingBracketRanges(F,O);if(!B){var N=new w(M,F.row,F.column),j=N.getCurrentToken();if(j&&/\b(?:tag-open|tag-name)/.test(j.type)){var V=M.getMatchingTags(F);V&&(B=[V.openTagName.isEmpty()?V.openTag:V.openTagName,V.closeTagName.isEmpty()?V.closeTag:V.closeTagName])}}if(!B&&M.$mode.getMatching&&(B=M.$mode.getMatching(C.session)),!B){C.getHighlightIndentGuides()&&C.renderer.$textLayer.$highlightIndentGuide();return}var W="ace_bracket";Array.isArray(B)?B.length==1&&(W="ace_error_bracket"):B=[B],B.length==2&&(g.comparePoints(B[0].end,B[1].start)==0?B=[g.fromPoints(B[0].start,B[1].end)]:g.comparePoints(B[0].start,B[1].end)==0&&(B=[g.fromPoints(B[1].start,B[0].end)])),M.$bracketHighlight={ranges:B,markerIds:B.map(function(H){return M.addMarker(H,W,"text")})},C.getHighlightIndentGuides()&&C.renderer.$textLayer.$highlightIndentGuide()}},50)}},x.prototype.focus=function(){this.textInput.focus()},x.prototype.isFocused=function(){return this.textInput.isFocused()},x.prototype.blur=function(){this.textInput.blur()},x.prototype.onFocus=function(C){this.$isFocused||(this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit("focus",C))},x.prototype.onBlur=function(C){this.$isFocused&&(this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit("blur",C))},x.prototype.$cursorChange=function(){this.renderer.updateCursor(),this.$highlightBrackets(),this.$updateHighlightActiveLine()},x.prototype.onDocumentChange=function(C){var M=this.session.$useWrapMode,F=C.start.row==C.end.row?C.end.row:1/0;this.renderer.updateLines(C.start.row,F,M),this._signal("change",C),this.$cursorChange()},x.prototype.onTokenizerUpdate=function(C){var M=C.data;this.renderer.updateLines(M.first,M.last)},x.prototype.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},x.prototype.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},x.prototype.onCursorChange=function(){this.$cursorChange(),this._signal("changeSelection")},x.prototype.$updateHighlightActiveLine=function(){var C=this.getSession(),M;if(this.$highlightActiveLine&&((this.$selectionStyle!="line"||!this.selection.isMultiLine())&&(M=this.getCursorPosition()),this.renderer.theme&&this.renderer.theme.$selectionColorConflict&&!this.selection.isEmpty()&&(M=!1),this.renderer.$maxLines&&this.session.getLength()===1&&!(this.renderer.$minLines>1)&&(M=!1)),C.$highlightLineMarker&&!M)C.removeMarker(C.$highlightLineMarker.id),C.$highlightLineMarker=null;else if(!C.$highlightLineMarker&&M){var F=new g(M.row,M.column,M.row,1/0);F.id=C.addMarker(F,"ace_active-line","screenLine"),C.$highlightLineMarker=F}else M&&(C.$highlightLineMarker.start.row=M.row,C.$highlightLineMarker.end.row=M.row,C.$highlightLineMarker.start.column=M.column,C._signal("changeBackMarker"))},x.prototype.onSelectionChange=function(C){var M=this.session;if(M.$selectionMarker&&M.removeMarker(M.$selectionMarker),M.$selectionMarker=null,this.selection.isEmpty())this.$updateHighlightActiveLine();else{var F=this.selection.getRange(),R=this.getSelectionStyle();M.$selectionMarker=M.addMarker(F,"ace_selection",R)}var O=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(O),this._signal("changeSelection")},x.prototype.$getSelectionHighLightRegexp=function(){var C=this.session,M=this.getSelectionRange();if(!(M.isEmpty()||M.isMultiLine())){var F=M.start.column,R=M.end.column,O=C.getLine(M.start.row),B=O.substring(F,R);if(!(B.length>5e3||!/[\w\d]/.test(B))){var N=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:B}),j=O.substring(F-1,R+1);if(N.test(j))return N}}},x.prototype.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},x.prototype.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},x.prototype.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},x.prototype.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},x.prototype.onChangeMode=function(C){this.renderer.updateText(),this._emit("changeMode",C)},x.prototype.onChangeWrapLimit=function(){this.renderer.updateFull()},x.prototype.onChangeWrapMode=function(){this.renderer.onResize(!0)},x.prototype.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},x.prototype.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},x.prototype.getCopyText=function(){var C=this.getSelectedText(),M=this.session.doc.getNewLineCharacter(),F=!1;if(!C&&this.$copyWithEmptySelection){F=!0;for(var R=this.selection.getAllRanges(),O=0;O<R.length;O++){var B=R[O];O&&R[O-1].start.row==B.start.row||(C+=this.session.getLine(B.start.row)+M)}}var N={text:C};return this._signal("copy",N),$.lineMode=F?N.text:!1,N.text},x.prototype.onCopy=function(){this.commands.exec("copy",this)},x.prototype.onCut=function(){this.commands.exec("cut",this)},x.prototype.onPaste=function(C,M){var F={text:C,event:M};this.commands.exec("paste",this,F)},x.prototype.$handlePaste=function(C){typeof C=="string"&&(C={text:C}),this._signal("paste",C);var M=C.text,F=M===$.lineMode,R=this.session;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)F?R.insert({row:this.selection.lead.row,column:0},M):this.insert(M);else if(F)this.selection.rangeList.ranges.forEach(function(W){R.insert({row:W.start.row,column:0},M)});else{var O=M.split(/\r\n|\r|\n/),B=this.selection.rangeList.ranges,N=O.length==2&&(!O[0]||!O[1]);if(O.length!=B.length||N)return this.commands.exec("insertstring",this,M);for(var j=B.length;j--;){var V=B[j];V.isEmpty()||R.remove(V),R.insert(V.start,O[j])}}},x.prototype.execCommand=function(C,M){return this.commands.exec(C,this,M)},x.prototype.insert=function(C,M){var F=this.session,R=F.getMode(),O=this.getCursorPosition();if(this.getBehavioursEnabled()&&!M){var B=R.transformAction(F.getState(O.row),"insertion",this,F,C);B&&(C!==B.text&&(this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1)),C=B.text)}if(C==" "&&(C=this.session.getTabString()),this.selection.isEmpty()){if(this.session.getOverwrite()&&C.indexOf(`
`)==-1){var N=g.fromPoints(O,O);N.end.column+=C.length,this.session.remove(N)}}else{var N=this.getSelectionRange();O=this.session.remove(N),this.clearSelection()}if(C==`
`||C==`\r
`){var H=F.getLine(O.row);if(O.column>H.search(/\S|$/)){var j=H.substr(O.column).search(/\S|$/);F.doc.removeInLine(O.row,O.column,O.column+j)}}this.clearSelection();var V=O.column,W=F.getState(O.row),H=F.getLine(O.row),U=R.checkOutdent(W,H,C);if(F.insert(O,C),B&&B.selection&&(B.selection.length==2?this.selection.setSelectionRange(new g(O.row,V+B.selection[0],O.row,V+B.selection[1])):this.selection.setSelectionRange(new g(O.row+B.selection[0],B.selection[1],O.row+B.selection[2],B.selection[3]))),this.$enableAutoIndent){if(F.getDocument().isNewLine(C)){var X=R.getNextLineIndent(W,H.slice(0,O.column),F.getTabString());F.insert({row:O.row+1,column:0},X)}U&&R.autoOutdent(W,F,O.row)}},x.prototype.autoIndent=function(){for(var C=this.session,M=C.getMode(),F=this.selection.isEmpty()?[new g(0,0,C.doc.getLength()-1,0)]:this.selection.getAllRanges(),R="",O="",B="",N=C.getTabString(),j=0;j<F.length;j++)for(var V=F[j].start.row,W=F[j].end.row,H=V;H<=W;H++){H>0&&(R=C.getState(H-1),O=C.getLine(H-1),B=M.getNextLineIndent(R,O,N));var U=C.getLine(H),X=M.$getIndent(U);if(B!==X){if(X.length>0){var Y=new g(H,0,H,X.length);C.remove(Y)}B.length>0&&C.insert({row:H,column:0},B)}M.autoOutdent(R,C,H)}},x.prototype.onTextInput=function(C,M){if(!M)return this.keyBinding.onTextInput(C);this.startOperation({command:{name:"insertstring"}});var F=this.applyComposition.bind(this,C,M);this.selection.rangeCount?this.forEachSelection(F):F(),this.endOperation()},x.prototype.applyComposition=function(C,M){if(M.extendLeft||M.extendRight){var F=this.selection.getRange();F.start.column-=M.extendLeft,F.end.column+=M.extendRight,F.start.column<0&&(F.start.row--,F.start.column+=this.session.getLine(F.start.row).length+1),this.selection.setRange(F),!C&&!F.isEmpty()&&this.remove()}if((C||!this.selection.isEmpty())&&this.insert(C,!0),M.restoreStart||M.restoreEnd){var F=this.selection.getRange();F.start.column-=M.restoreStart,F.end.column-=M.restoreEnd,this.selection.setRange(F)}},x.prototype.onCommandKey=function(C,M,F){return this.keyBinding.onCommandKey(C,M,F)},x.prototype.setOverwrite=function(C){this.session.setOverwrite(C)},x.prototype.getOverwrite=function(){return this.session.getOverwrite()},x.prototype.toggleOverwrite=function(){this.session.toggleOverwrite()},x.prototype.setScrollSpeed=function(C){this.setOption("scrollSpeed",C)},x.prototype.getScrollSpeed=function(){return this.getOption("scrollSpeed")},x.prototype.setDragDelay=function(C){this.setOption("dragDelay",C)},x.prototype.getDragDelay=function(){return this.getOption("dragDelay")},x.prototype.setSelectionStyle=function(C){this.setOption("selectionStyle",C)},x.prototype.getSelectionStyle=function(){return this.getOption("selectionStyle")},x.prototype.setHighlightActiveLine=function(C){this.setOption("highlightActiveLine",C)},x.prototype.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},x.prototype.setHighlightGutterLine=function(C){this.setOption("highlightGutterLine",C)},x.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},x.prototype.setHighlightSelectedWord=function(C){this.setOption("highlightSelectedWord",C)},x.prototype.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},x.prototype.setAnimatedScroll=function(C){this.renderer.setAnimatedScroll(C)},x.prototype.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},x.prototype.setShowInvisibles=function(C){this.renderer.setShowInvisibles(C)},x.prototype.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},x.prototype.setDisplayIndentGuides=function(C){this.renderer.setDisplayIndentGuides(C)},x.prototype.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},x.prototype.setHighlightIndentGuides=function(C){this.renderer.setHighlightIndentGuides(C)},x.prototype.getHighlightIndentGuides=function(){return this.renderer.getHighlightIndentGuides()},x.prototype.setShowPrintMargin=function(C){this.renderer.setShowPrintMargin(C)},x.prototype.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},x.prototype.setPrintMarginColumn=function(C){this.renderer.setPrintMarginColumn(C)},x.prototype.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},x.prototype.setReadOnly=function(C){this.setOption("readOnly",C)},x.prototype.getReadOnly=function(){return this.getOption("readOnly")},x.prototype.setBehavioursEnabled=function(C){this.setOption("behavioursEnabled",C)},x.prototype.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},x.prototype.setWrapBehavioursEnabled=function(C){this.setOption("wrapBehavioursEnabled",C)},x.prototype.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},x.prototype.setShowFoldWidgets=function(C){this.setOption("showFoldWidgets",C)},x.prototype.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},x.prototype.setFadeFoldWidgets=function(C){this.setOption("fadeFoldWidgets",C)},x.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},x.prototype.remove=function(C){this.selection.isEmpty()&&(C=="left"?this.selection.selectLeft():this.selection.selectRight());var M=this.getSelectionRange();if(this.getBehavioursEnabled()){var F=this.session,R=F.getState(M.start.row),O=F.getMode().transformAction(R,"deletion",this,F,M);if(M.end.column===0){var B=F.getTextRange(M);if(B[B.length-1]==`
`){var N=F.getLine(M.end.row);/^\s+$/.test(N)&&(M.end.column=N.length)}}O&&(M=O)}this.session.remove(M),this.clearSelection()},x.prototype.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},x.prototype.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},x.prototype.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},x.prototype.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var C=this.getSelectionRange();C.start.column==C.end.column&&C.start.row==C.end.row&&(C.end.column=0,C.end.row++),this.session.remove(C),this.clearSelection()},x.prototype.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var C=this.getCursorPosition();this.insert(`
`),this.moveCursorToPosition(C)},x.prototype.setGhostText=function(C,M){this.renderer.setGhostText(C,M)},x.prototype.removeGhostText=function(){this.renderer.removeGhostText()},x.prototype.transposeLetters=function(){if(this.selection.isEmpty()){var C=this.getCursorPosition(),M=C.column;if(M!==0){var F=this.session.getLine(C.row),R,O;M<F.length?(R=F.charAt(M)+F.charAt(M-1),O=new g(C.row,M-1,C.row,M+1)):(R=F.charAt(M-1)+F.charAt(M-2),O=new g(C.row,M-2,C.row,M)),this.session.replace(O,R),this.session.selection.moveToPosition(O.end)}}},x.prototype.toLowerCase=function(){var C=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var M=this.getSelectionRange(),F=this.session.getTextRange(M);this.session.replace(M,F.toLowerCase()),this.selection.setSelectionRange(C)},x.prototype.toUpperCase=function(){var C=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var M=this.getSelectionRange(),F=this.session.getTextRange(M);this.session.replace(M,F.toUpperCase()),this.selection.setSelectionRange(C)},x.prototype.indent=function(){var C=this.session,M=this.getSelectionRange();if(M.start.row<M.end.row){var F=this.$getSelectedRows();C.indentRows(F.first,F.last," ");return}else if(M.start.column<M.end.column){var R=C.getTextRange(M);if(!/^\s+$/.test(R)){var F=this.$getSelectedRows();C.indentRows(F.first,F.last," ");return}}var O=C.getLine(M.start.row),B=M.start,N=C.getTabSize(),j=C.documentToScreenColumn(B.row,B.column);if(this.session.getUseSoftTabs())var V=N-j%N,W=s.stringRepeat(" ",V);else{for(var V=j%N;O[M.start.column-1]==" "&&V;)M.start.column--,V--;this.selection.setSelectionRange(M),W=" "}return this.insert(W)},x.prototype.blockIndent=function(){var C=this.$getSelectedRows();this.session.indentRows(C.first,C.last," ")},x.prototype.blockOutdent=function(){var C=this.session.getSelection();this.session.outdentRows(C.getRange())},x.prototype.sortLines=function(){for(var C=this.$getSelectedRows(),M=this.session,F=[],R=C.first;R<=C.last;R++)F.push(M.getLine(R));F.sort(function(N,j){return N.toLowerCase()<j.toLowerCase()?-1:N.toLowerCase()>j.toLowerCase()?1:0});for(var O=new g(0,0,0,0),R=C.first;R<=C.last;R++){var B=M.getLine(R);O.start.row=R,O.end.row=R,O.end.column=B.length,M.replace(O,F[R-C.first])}},x.prototype.toggleCommentLines=function(){var C=this.session.getState(this.getCursorPosition().row),M=this.$getSelectedRows();this.session.getMode().toggleCommentLines(C,this.session,M.first,M.last)},x.prototype.toggleBlockComment=function(){var C=this.getCursorPosition(),M=this.session.getState(C.row),F=this.getSelectionRange();this.session.getMode().toggleBlockComment(M,this.session,F,C)},x.prototype.getNumberAt=function(C,M){var F=/[\-]?[0-9]+(?:\.[0-9]+)?/g;F.lastIndex=0;for(var R=this.session.getLine(C);F.lastIndex<M;){var O=F.exec(R);if(O.index<=M&&O.index+O[0].length>=M){var B={value:O[0],start:O.index,end:O.index+O[0].length};return B}}return null},x.prototype.modifyNumber=function(C){var M=this.selection.getCursor().row,F=this.selection.getCursor().column,R=new g(M,F-1,M,F),O=this.session.getTextRange(R);if(!isNaN(parseFloat(O))&&isFinite(O)){var B=this.getNumberAt(M,F);if(B){var N=B.value.indexOf(".")>=0?B.start+B.value.indexOf(".")+1:B.end,j=B.start+B.value.length-N,V=parseFloat(B.value);V*=Math.pow(10,j),N!==B.end&&F<N?C*=Math.pow(10,B.end-F-1):C*=Math.pow(10,B.end-F),V+=C,V/=Math.pow(10,j);var W=V.toFixed(j),H=new g(M,B.start,M,B.end);this.session.replace(H,W),this.moveCursorTo(M,Math.max(B.start+1,F+W.length-B.value.length))}}else this.toggleWord()},x.prototype.toggleWord=function(){var C=this.selection.getCursor().row,M=this.selection.getCursor().column;this.selection.selectWord();var F=this.getSelectedText(),R=this.selection.getWordRange().start.column,O=F.replace(/([a-z]+|[A-Z]+)(?=[A-Z_]|$)/g,"$1 ").split(/\s/),B=M-R-1;B<0&&(B=0);var N=0,j=0,V=this;F.match(/[A-Za-z0-9_]+/)&&O.forEach(function(le,ie){j=N+le.length,B>=N&&B<=j&&(F=le,V.selection.clearSelection(),V.moveCursorTo(C,N+R),V.selection.selectTo(C,j+R)),N=j});for(var W=this.$toggleWordPairs,H,U=0;U<W.length;U++)for(var X=W[U],Y=0;Y<=1;Y++){var Z=+!Y,ne=F.match(new RegExp("^\\s?_?("+s.escapeRegExp(X[Y])+")\\s?$","i"));if(ne){var re=F.match(new RegExp("([_]|^|\\s)("+s.escapeRegExp(ne[1])+")($|\\s)","g"));re&&(H=F.replace(new RegExp(s.escapeRegExp(X[Y]),"i"),function(le){var ie=X[Z];return le.toUpperCase()==le?ie=ie.toUpperCase():le.charAt(0).toUpperCase()==le.charAt(0)&&(ie=ie.substr(0,0)+X[Z].charAt(0).toUpperCase()+ie.substr(1)),ie}),this.insert(H),H="")}}},x.prototype.findLinkAt=function(C,M){var F,R,O=this.session.getLine(C),B=O.split(/((?:https?|ftp):\/\/[\S]+)/),N=M;N<0&&(N=0);var j=0,V=0,W;try{for(var H=i(B),U=H.next();!U.done;U=H.next()){var X=U.value;if(V=j+X.length,N>=j&&N<=V&&X.match(/((?:https?|ftp):\/\/[\S]+)/)){W=X.replace(/[\s:.,'";}\]]+$/,"");break}j=V}}catch(Y){F={error:Y}}finally{try{U&&!U.done&&(R=H.return)&&R.call(H)}finally{if(F)throw F.error}}return W},x.prototype.openLink=function(){var C=this.selection.getCursor(),M=this.findLinkAt(C.row,C.column);return M&&window.open(M,"_blank"),M!=null},x.prototype.removeLines=function(){var C=this.$getSelectedRows();this.session.removeFullLines(C.first,C.last),this.clearSelection()},x.prototype.duplicateSelection=function(){var C=this.selection,M=this.session,F=C.getRange(),R=C.isBackwards();if(F.isEmpty()){var O=F.start.row;M.duplicateLines(O,O)}else{var B=R?F.start:F.end,N=M.insert(B,M.getTextRange(F));F.start=B,F.end=N,C.setSelectionRange(F,R)}},x.prototype.moveLinesDown=function(){this.$moveLines(1,!1)},x.prototype.moveLinesUp=function(){this.$moveLines(-1,!1)},x.prototype.moveText=function(C,M,F){return this.session.moveText(C,M,F)},x.prototype.copyLinesUp=function(){this.$moveLines(-1,!0)},x.prototype.copyLinesDown=function(){this.$moveLines(1,!0)},x.prototype.$moveLines=function(C,M){var F,R,O=this.selection;if(!O.inMultiSelectMode||this.inVirtualSelectionMode){var B=O.toOrientedRange();F=this.$getSelectedRows(B),R=this.session.$moveLines(F.first,F.last,M?0:C),M&&C==-1&&(R=0),B.moveBy(R,0),O.fromOrientedRange(B)}else{var N=O.rangeList.ranges;O.rangeList.detach(this.session),this.inVirtualSelectionMode=!0;for(var j=0,V=0,W=N.length,H=0;H<W;H++){var U=H;N[H].moveBy(j,0),F=this.$getSelectedRows(N[H]);for(var X=F.first,Y=F.last;++H<W;){V&&N[H].moveBy(V,0);var Z=this.$getSelectedRows(N[H]);if(M&&Z.first!=Y)break;if(!M&&Z.first>Y+1)break;Y=Z.last}for(H--,j=this.session.$moveLines(X,Y,M?0:C),M&&C==-1&&(U=H+1);U<=H;)N[U].moveBy(j,0),U++;M||(j=0),V+=j}O.fromOrientedRange(O.ranges[0]),O.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},x.prototype.$getSelectedRows=function(C){return C=(C||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(C.start.row),last:this.session.getRowFoldEnd(C.end.row)}},x.prototype.onCompositionStart=function(C){this.renderer.showComposition(C)},x.prototype.onCompositionUpdate=function(C){this.renderer.setCompositionText(C)},x.prototype.onCompositionEnd=function(){this.renderer.hideComposition()},x.prototype.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},x.prototype.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},x.prototype.isRowVisible=function(C){return C>=this.getFirstVisibleRow()&&C<=this.getLastVisibleRow()},x.prototype.isRowFullyVisible=function(C){return C>=this.renderer.getFirstFullyVisibleRow()&&C<=this.renderer.getLastFullyVisibleRow()},x.prototype.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},x.prototype.$moveByPage=function(C,M){var F=this.renderer,R=this.renderer.layerConfig,O=C*Math.floor(R.height/R.lineHeight);M===!0?this.selection.$moveSelection(function(){this.moveCursorBy(O,0)}):M===!1&&(this.selection.moveCursorBy(O,0),this.selection.clearSelection());var B=F.scrollTop;F.scrollBy(0,O*R.lineHeight),M!=null&&F.scrollCursorIntoView(null,.5),F.animateScrolling(B)},x.prototype.selectPageDown=function(){this.$moveByPage(1,!0)},x.prototype.selectPageUp=function(){this.$moveByPage(-1,!0)},x.prototype.gotoPageDown=function(){this.$moveByPage(1,!1)},x.prototype.gotoPageUp=function(){this.$moveByPage(-1,!1)},x.prototype.scrollPageDown=function(){this.$moveByPage(1)},x.prototype.scrollPageUp=function(){this.$moveByPage(-1)},x.prototype.scrollToRow=function(C){this.renderer.scrollToRow(C)},x.prototype.scrollToLine=function(C,M,F,R){this.renderer.scrollToLine(C,M,F,R)},x.prototype.centerSelection=function(){var C=this.getSelectionRange(),M={row:Math.floor(C.start.row+(C.end.row-C.start.row)/2),column:Math.floor(C.start.column+(C.end.column-C.start.column)/2)};this.renderer.alignCursor(M,.5)},x.prototype.getCursorPosition=function(){return this.selection.getCursor()},x.prototype.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},x.prototype.getSelectionRange=function(){return this.selection.getRange()},x.prototype.selectAll=function(){this.selection.selectAll()},x.prototype.clearSelection=function(){this.selection.clearSelection()},x.prototype.moveCursorTo=function(C,M){this.selection.moveCursorTo(C,M)},x.prototype.moveCursorToPosition=function(C){this.selection.moveCursorToPosition(C)},x.prototype.jumpToMatching=function(C,M){var F=this.getCursorPosition(),R=new w(this.session,F.row,F.column),O=R.getCurrentToken(),B=0;O&&O.type.indexOf("tag-name")!==-1&&(O=R.stepBackward());var N=O||R.stepForward();if(N){var j,V=!1,W={},H=F.column-N.start,U,X={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(N.value.match(/[{}()\[\]]/g)){for(;H<N.value.length&&!V;H++)if(X[N.value[H]])switch(U=X[N.value[H]]+"."+N.type.replace("rparen","lparen"),isNaN(W[U])&&(W[U]=0),N.value[H]){case"(":case"[":case"{":W[U]++;break;case")":case"]":case"}":W[U]--,W[U]===-1&&(j="bracket",V=!0);break}}else N.type.indexOf("tag-name")!==-1&&(isNaN(W[N.value])&&(W[N.value]=0),O.value==="<"&&B>1?W[N.value]++:O.value==="</"&&W[N.value]--,W[N.value]===-1&&(j="tag",V=!0));V||(O=N,B++,N=R.stepForward(),H=0)}while(N&&!V);if(j){var Y,Z;if(j==="bracket")Y=this.session.getBracketRange(F),Y||(Y=new g(R.getCurrentTokenRow(),R.getCurrentTokenColumn()+H-1,R.getCurrentTokenRow(),R.getCurrentTokenColumn()+H-1),Z=Y.start,(M||Z.row===F.row&&Math.abs(Z.column-F.column)<2)&&(Y=this.session.getBracketRange(Z)));else if(j==="tag"){if(!N||N.type.indexOf("tag-name")===-1)return;if(Y=new g(R.getCurrentTokenRow(),R.getCurrentTokenColumn()-2,R.getCurrentTokenRow(),R.getCurrentTokenColumn()-2),Y.compare(F.row,F.column)===0){var ne=this.session.getMatchingTags(F);ne&&(ne.openTag.contains(F.row,F.column)?(Y=ne.closeTag,Z=Y.start):(Y=ne.openTag,ne.closeTag.start.row===F.row&&ne.closeTag.start.column===F.column?Z=Y.end:Z=Y.start))}Z=Z||Y.start}Z=Y&&Y.cursor||Z,Z&&(C?Y&&M?this.selection.setRange(Y):Y&&Y.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(Z.row,Z.column):this.selection.moveTo(Z.row,Z.column))}}},x.prototype.gotoLine=function(C,M,F){this.selection.clearSelection(),this.session.unfold({row:C-1,column:M||0}),this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(C-1,M||0),this.isRowFullyVisible(C-1)||this.scrollToLine(C-1,!0,F)},x.prototype.navigateTo=function(C,M){this.selection.moveTo(C,M)},x.prototype.navigateUp=function(C){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var M=this.selection.anchor.getPosition();return this.moveCursorToPosition(M)}this.selection.clearSelection(),this.selection.moveCursorBy(-C||-1,0)},x.prototype.navigateDown=function(C){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var M=this.selection.anchor.getPosition();return this.moveCursorToPosition(M)}this.selection.clearSelection(),this.selection.moveCursorBy(C||1,0)},x.prototype.navigateLeft=function(C){if(this.selection.isEmpty())for(C=C||1;C--;)this.selection.moveCursorLeft();else{var M=this.getSelectionRange().start;this.moveCursorToPosition(M)}this.clearSelection()},x.prototype.navigateRight=function(C){if(this.selection.isEmpty())for(C=C||1;C--;)this.selection.moveCursorRight();else{var M=this.getSelectionRange().end;this.moveCursorToPosition(M)}this.clearSelection()},x.prototype.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},x.prototype.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},x.prototype.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},x.prototype.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},x.prototype.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},x.prototype.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},x.prototype.replace=function(C,M){M&&this.$search.set(M);var F=this.$search.find(this.session),R=0;return F&&(this.$tryReplace(F,C)&&(R=1),this.selection.setSelectionRange(F),this.renderer.scrollSelectionIntoView(F.start,F.end)),R},x.prototype.replaceAll=function(C,M){M&&this.$search.set(M);var F=this.$search.findAll(this.session),R=0;if(!F.length)return R;var O=this.getSelectionRange();this.selection.moveTo(0,0);for(var B=F.length-1;B>=0;--B)this.$tryReplace(F[B],C)&&R++;return this.selection.setSelectionRange(O),R},x.prototype.$tryReplace=function(C,M){var F=this.session.getTextRange(C);return M=this.$search.replace(F,M),M!==null?(C.end=this.session.replace(C,M),C):null},x.prototype.getLastSearchOptions=function(){return this.$search.getOptions()},x.prototype.find=function(C,M,F){M||(M={}),typeof C=="string"||C instanceof RegExp?M.needle=C:typeof C=="object"&&o.mixin(M,C);var R=this.selection.getRange();M.needle==null&&(C=this.session.getTextRange(R)||this.$search.$options.needle,C||(R=this.session.getWordRange(R.start.row,R.start.column),C=this.session.getTextRange(R)),this.$search.set({needle:C})),this.$search.set(M),M.start||this.$search.set({start:R});var O=this.$search.find(this.session);if(M.preventScroll)return O;if(O)return this.revealRange(O,F),O;M.backwards?R.start=R.end:R.end=R.start,this.selection.setRange(R)},x.prototype.findNext=function(C,M){this.find({skipCurrent:!0,backwards:!1},C,M)},x.prototype.findPrevious=function(C,M){this.find(C,{skipCurrent:!0,backwards:!0},M)},x.prototype.revealRange=function(C,M){this.session.unfold(C),this.selection.setSelectionRange(C);var F=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(C.start,C.end,.5),M!==!1&&this.renderer.animateScrolling(F)},x.prototype.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},x.prototype.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},x.prototype.destroy=function(){this.destroyed=!0,this.$toDestroy&&(this.$toDestroy.forEach(function(C){C.destroy()}),this.$toDestroy=[]),this.$mouseHandler&&this.$mouseHandler.destroy(),this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy(),this._$emitInputEvent&&this._$emitInputEvent.cancel(),this.removeAllListeners()},x.prototype.setAutoScrollEditorIntoView=function(C){if(C){var M,F=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 B=this.on("changeSelection",function(){R=!0}),N=this.renderer.on("beforeRender",function(){R&&(M=F.renderer.container.getBoundingClientRect())}),j=this.renderer.on("afterRender",function(){if(R&&M&&(F.isFocused()||F.searchBox&&F.searchBox.isFocused())){var V=F.renderer,W=V.$cursorLayer.$pixelPos,H=V.layerConfig,U=W.top-H.offset;W.top>=0&&U+M.top<0?R=!0:W.top<H.height&&W.top+M.top+H.lineHeight>window.innerHeight?R=!1:R=null,R!=null&&(O.style.top=U+"px",O.style.left=W.left+"px",O.style.height=H.lineHeight+"px",O.scrollIntoView(R)),R=M=null}});this.setAutoScrollEditorIntoView=function(V){V||(delete this.setAutoScrollEditorIntoView,this.off("changeSelection",B),this.renderer.off("afterRender",j),this.renderer.off("beforeRender",N))}}},x.prototype.$resetCursorStyle=function(){var C=this.$cursorStyle||"ace",M=this.renderer.$cursorLayer;M&&(M.setSmoothBlinking(/smooth/.test(C)),M.isBlinking=!this.$readOnly&&C!="wide",p.setCssClass(M.element,"ace_slim-cursors",/slim/.test(C)))},x.prototype.prompt=function(C,M,F){var R=this;S.loadModule("ace/ext/prompt",function(O){O.prompt(R,C,M,F)})},x})();T.$uid=0,T.prototype.curOp=null,T.prototype.prevOp={},T.prototype.$mergeableCommands=["backspace","del","insertstring"],T.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"],["&&","||"],["==","!="]],o.implement(T.prototype,v),S.defineOptions(T.prototype,"editor",{selectionStyle:{set:function(x){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:x})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(x){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(x){var C=this;if(this.textInput.setReadOnly(x),!this.destroyed){this.$resetCursorStyle(),this.$readOnlyCallback||(this.$readOnlyCallback=function(F){var R=!1;if(F&&F.type=="keydown"){if(F&&F.key&&!F.ctrlKey&&!F.metaKey&&(F.key==" "&&F.preventDefault(),R=F.key.length==1),!R)return}else F&&F.type!=="exec"&&(R=!0);if(R){C.hoverTooltip||(C.hoverTooltip=new L);var O=p.createElement("div");O.textContent=D("editor.tooltip.disable-editing","Editing is disabled"),C.hoverTooltip.isOpen||C.hoverTooltip.showForRange(C,C.getSelectionRange(),O)}else C.hoverTooltip&&C.hoverTooltip.isOpen&&C.hoverTooltip.hide()});var M=this.textInput.getElement();x?(_.addListener(M,"keydown",this.$readOnlyCallback,this),this.commands.on("exec",this.$readOnlyCallback),this.commands.on("commandUnavailable",this.$readOnlyCallback)):(_.removeListener(M,"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(x){this.textInput.setCopyWithEmptySelection(x)},initialValue:!1},cursorStyle:{set:function(x){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(x){this.setAutoScrollEditorIntoView(x)}},keyboardHandler:{set:function(x){this.setKeyboardHandler(x)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(x){this.session.setValue(x)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(x){this.setSession(x)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(x){this.renderer.$gutterLayer.setShowLineNumbers(x),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),x&&this.$relativeLineNumbers?k.attach(this):k.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(x){this.$showLineNumbers&&x?k.attach(this):k.detach(this)}},placeholder:{set:function(x){this.$updatePlaceholder||(this.$updatePlaceholder=function(){var C=this.session&&(this.renderer.$composition||this.session.getLength()>1||this.session.getLine(0).length>0);if(C&&this.renderer.placeholderNode)this.renderer.off("afterRender",this.$updatePlaceholder),p.removeCssClass(this.container,"ace_hasPlaceholder"),this.renderer.placeholderNode.remove(),this.renderer.placeholderNode=null;else if(!C&&!this.renderer.placeholderNode){this.renderer.on("afterRender",this.$updatePlaceholder),p.addCssClass(this.container,"ace_hasPlaceholder");var M=p.createElement("div");M.className="ace_placeholder",M.textContent=this.$placeholder||"",this.renderer.placeholderNode=M,this.renderer.content.appendChild(this.renderer.placeholderNode)}else!C&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"")}.bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},enableKeyboardAccessibility:{set:function(x){var C={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},M=function(R){if(R.target==this.renderer.scroller&&R.keyCode===A.enter){R.preventDefault();var O=this.getCursorPosition().row;this.isRowVisible(O)||this.scrollToLine(O,!0,!0),this.focus()}},F;x?(this.renderer.enableKeyboardAccessibility=!0,this.renderer.keyboardFocusClassName="ace_keyboard-focus",this.textInput.getElement().setAttribute("tabindex",-1),this.textInput.setNumberOfExtraLines(u.isWin?3:0),this.renderer.scroller.setAttribute("tabindex",0),this.renderer.scroller.setAttribute("role","group"),this.renderer.scroller.setAttribute("aria-roledescription",D("editor.scroller.aria-roledescription","editor")),this.renderer.scroller.classList.add(this.renderer.keyboardFocusClassName),this.renderer.scroller.setAttribute("aria-label",D("editor.scroller.aria-label","Editor content, press Enter to start editing, press Escape to exit")),this.renderer.scroller.addEventListener("keyup",M.bind(this)),this.commands.addCommand(C),this.renderer.$gutter.setAttribute("tabindex",0),this.renderer.$gutter.setAttribute("aria-hidden",!1),this.renderer.$gutter.setAttribute("role","group"),this.renderer.$gutter.setAttribute("aria-roledescription",D("editor.gutter.aria-roledescription","editor gutter")),this.renderer.$gutter.setAttribute("aria-label",D("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),F||(F=new y(this)),F.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",M.bind(this)),this.commands.removeCommand(C),this.renderer.content.removeAttribute("aria-hidden"),this.renderer.$gutter.setAttribute("tabindex",-1),this.renderer.$gutter.setAttribute("aria-hidden",!0),this.renderer.$gutter.removeAttribute("role"),this.renderer.$gutter.removeAttribute("aria-roledescription"),this.renderer.$gutter.removeAttribute("aria-label"),this.renderer.$gutter.classList.remove(this.renderer.keyboardFocusClassName),F&&F.removeListener())},initialValue:!1},textInputAriaLabel:{set:function(x){this.$textInputAriaLabel=x},initialValue:""},enableMobileMenu:{set:function(x){this.$enableMobileMenu=x},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",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var k={getText:function(x,C){return(Math.abs(x.selection.lead.row-C)||C+1+(C<9?"·":""))+""},getWidth:function(x,C,M){return Math.max(C.toString().length,(M.lastRow+1).toString().length,2)*M.characterWidth},update:function(x,C){C.renderer.$loop.schedule(C.renderer.CHANGE_GUTTER)},attach:function(x){x.renderer.$gutterLayer.$renderer=this,x.on("changeSelection",this.update),this.update(null,x)},detach:function(x){x.renderer.$gutterLayer.$renderer==this&&(x.renderer.$gutterLayer.$renderer=null),x.off("changeSelection",this.update),this.update(null,x)}};n.Editor=T}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(t,n,f){var i=t("../lib/dom"),o=(function(){function p(s,u){this.element=s,this.canvasHeight=u||5e5,this.element.style.height=this.canvasHeight*2+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0}return p.prototype.moveContainer=function(s){i.translate(this.element,0,-(s.firstRowScreen*s.lineHeight%this.canvasHeight)-s.offset*this.$offsetCoefficient)},p.prototype.pageChanged=function(s,u){return Math.floor(s.firstRowScreen*s.lineHeight/this.canvasHeight)!==Math.floor(u.firstRowScreen*u.lineHeight/this.canvasHeight)},p.prototype.computeLineTop=function(s,u,r){var a=u.firstRowScreen*u.lineHeight,l=Math.floor(a/this.canvasHeight),d=r.documentToScreenRow(s,0)*u.lineHeight;return d-l*this.canvasHeight},p.prototype.computeLineHeight=function(s,u,r){return u.lineHeight*r.getRowLineCount(s)},p.prototype.getLength=function(){return this.cells.length},p.prototype.get=function(s){return this.cells[s]},p.prototype.shift=function(){this.$cacheCell(this.cells.shift())},p.prototype.pop=function(){this.$cacheCell(this.cells.pop())},p.prototype.push=function(s){if(Array.isArray(s)){this.cells.push.apply(this.cells,s);for(var u=i.createFragment(this.element),r=0;r<s.length;r++)u.appendChild(s[r].element);this.element.appendChild(u)}else this.cells.push(s),this.element.appendChild(s.element)},p.prototype.unshift=function(s){if(Array.isArray(s)){this.cells.unshift.apply(this.cells,s);for(var u=i.createFragment(this.element),r=0;r<s.length;r++)u.appendChild(s[r].element);this.element.firstChild?this.element.insertBefore(u,this.element.firstChild):this.element.appendChild(u)}else this.cells.unshift(s),this.element.insertAdjacentElement("afterbegin",s.element)},p.prototype.last=function(){return this.cells.length?this.cells[this.cells.length-1]:null},p.prototype.$cacheCell=function(s){s&&(s.element.remove(),this.cellCache.push(s))},p.prototype.createCell=function(s,u,r,a){var l=this.cellCache.pop();if(!l){var d=i.createElement("div");a&&a(d),this.element.appendChild(d),l={element:d,text:"",row:s}}return l.row=s,l},p})();n.Lines=o}),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(t,n,f){var i=t("../lib/dom"),o=t("../lib/oop"),p=t("../lib/lang"),s=t("../lib/event_emitter").EventEmitter,u=t("./lines").Lines,r=t("../config").nls,a=(function(){function d(c){this.$showCursorMarker=null,this.element=i.createElement("div"),this.element.className="ace_layer ace_gutter-layer",c.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$lines=new u(this.element),this.$lines.$offsetCoefficient=1}return d.prototype.setSession=function(c){this.session&&this.session.off("change",this.$updateAnnotations),this.session=c,c&&c.on("change",this.$updateAnnotations)},d.prototype.addGutterDecoration=function(c,m){window.console&&console.warn&&console.warn("deprecated use session.addGutterDecoration"),this.session.addGutterDecoration(c,m)},d.prototype.removeGutterDecoration=function(c,m){window.console&&console.warn&&console.warn("deprecated use session.removeGutterDecoration"),this.session.removeGutterDecoration(c,m)},d.prototype.setAnnotations=function(c){this.$annotations=[];for(var m=0;m<c.length;m++){var g=c[m],v=g.row,b=this.$annotations[v];b||(b=this.$annotations[v]={text:[],type:[],displayText:[]});var E=g.text,S=g.text,w=g.type;E=E?p.escapeHTML(E):g.html||"",S=S||g.html||"",b.text.indexOf(E)===-1&&(b.text.push(E),b.type.push(w),b.displayText.push(S));var y=g.className;y?b.className=y:w==="error"?b.className=" ace_error":w==="security"&&!/\bace_error\b/.test(b.className)?b.className=" ace_security":w==="warning"&&!/\bace_(error|security)\b/.test(b.className)?b.className=" ace_warning":w==="info"&&!b.className?b.className=" ace_info":w==="hint"&&!b.className&&(b.className=" ace_hint")}},d.prototype.$updateAnnotations=function(c){if(this.$annotations.length){var m=c.start.row,g=c.end.row-m;if(g!==0)if(c.action=="remove")this.$annotations.splice(m,g+1,null);else{var v=new Array(g+1);v.unshift(m,1),this.$annotations.splice.apply(this.$annotations,v)}}},d.prototype.update=function(c){this.config=c;var m=this.session,g=c.firstRow,v=Math.min(c.lastRow+c.gutterOffset,m.getLength()-1);this.oldLastRow=v,this.config=c,this.$lines.moveContainer(c),this.$updateCursorRow();for(var b=m.getNextFoldLine(g),E=b?b.start.row:1/0,S=null,w=-1,y=g;;){if(y>E&&(y=b.end.row+1,b=m.getNextFoldLine(y,b),E=b?b.start.row:1/0),y>v){for(;this.$lines.getLength()>w+1;)this.$lines.pop();break}S=this.$lines.get(++w),S?S.row=y:(S=this.$lines.createCell(y,c,this.session,l),this.$lines.push(S)),this.$renderCell(S,c,b,y),y++}this._signal("afterRender"),this.$updateGutterWidth(c),this.$showCursorMarker&&this.$highlightGutterLine&&this.$updateCursorMarker()},d.prototype.$updateGutterWidth=function(c){var m=this.session,g=m.gutterRenderer||this.$renderer,v=m.$firstLineNumber,b=this.$lines.last()?this.$lines.last().text:"";(this.$fixedWidth||m.$useWrapMode)&&(b=m.getLength()+v-1);var E=g?g.getWidth(m,b,c):b.toString().length*c.characterWidth,S=this.$padding||this.$computePadding();E+=S.left+S.right,E!==this.gutterWidth&&!isNaN(E)&&(this.gutterWidth=E,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",E))},d.prototype.$updateCursorRow=function(){if(this.$highlightGutterLine){var c=this.session.selection.getCursor();this.$cursorRow!==c.row&&(this.$cursorRow=c.row)}},d.prototype.updateLineHighlight=function(){if(this.$showCursorMarker&&this.$updateCursorMarker(),!!this.$highlightGutterLine){var c=this.session.selection.cursor.row;if(this.$cursorRow=c,!(this.$cursorCell&&this.$cursorCell.row==c)){this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var m=this.$lines.cells;this.$cursorCell=null;for(var g=0;g<m.length;g++){var v=m[g];if(v.row>=this.$cursorRow){if(v.row>this.$cursorRow){var b=this.session.getFoldLine(this.$cursorRow);if(g>0&&b&&b.start.row==m[g-1].row)v=m[g-1];else break}v.element.className="ace_gutter-active-line "+v.element.className,this.$cursorCell=v;break}}}}},d.prototype.$updateCursorMarker=function(){if(this.session){var c=this.session;this.$highlightElement||(this.$highlightElement=i.createElement("div"),this.$highlightElement.className="ace_gutter-cursor",this.$highlightElement.style.pointerEvents="none",this.element.appendChild(this.$highlightElement));var m=c.selection.cursor,g=this.config,v=this.$lines,b=g.firstRowScreen*g.lineHeight,E=Math.floor(b/v.canvasHeight),S=c.documentToScreenRow(m)*g.lineHeight,w=S-E*v.canvasHeight;i.setStyle(this.$highlightElement.style,"height",g.lineHeight+"px"),i.setStyle(this.$highlightElement.style,"top",w+"px")}},d.prototype.scrollLines=function(c){var m=this.config;if(this.config=c,this.$updateCursorRow(),this.$lines.pageChanged(m,c))return this.update(c);this.$lines.moveContainer(c);var g=Math.min(c.lastRow+c.gutterOffset,this.session.getLength()-1),v=this.oldLastRow;if(this.oldLastRow=g,!m||v<c.firstRow)return this.update(c);if(g<m.firstRow)return this.update(c);if(m.firstRow<c.firstRow)for(var b=this.session.getFoldedRowCount(m.firstRow,c.firstRow-1);b>0;b--)this.$lines.shift();if(v>g)for(var b=this.session.getFoldedRowCount(g+1,v);b>0;b--)this.$lines.pop();c.firstRow<m.firstRow&&this.$lines.unshift(this.$renderLines(c,c.firstRow,m.firstRow-1)),g>v&&this.$lines.push(this.$renderLines(c,v+1,g)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(c)},d.prototype.$renderLines=function(c,m,g){for(var v=[],b=m,E=this.session.getNextFoldLine(b),S=E?E.start.row:1/0;b>S&&(b=E.end.row+1,E=this.session.getNextFoldLine(b,E),S=E?E.start.row:1/0),!(b>g);){var w=this.$lines.createCell(b,c,this.session,l);this.$renderCell(w,c,E,b),v.push(w),b++}return v},d.prototype.$renderCell=function(c,m,g,v){var b=c.element,E=this.session,S=b.childNodes[0],w=b.childNodes[1],y=b.childNodes[2],D=b.childNodes[3],$=y.firstChild,A=E.$firstLineNumber,_=E.$breakpoints,L=E.$decorations,T=E.gutterRenderer||this.$renderer,k=this.$showFoldWidgets&&E.foldWidgets,x=g?g.start.row:Number.MAX_VALUE,C=m.lineHeight+"px",M=this.$useSvgGutterIcons?"ace_gutter-cell_svg-icons ":"ace_gutter-cell ",F=this.$useSvgGutterIcons?"ace_icon_svg":"ace_icon",R=(T?T.getText(E,v):v+A).toString();if(this.$highlightGutterLine&&(v==this.$cursorRow||g&&v<this.$cursorRow&&v>=x&&this.$cursorRow<=g.end.row)&&(M+="ace_gutter-active-line ",this.$cursorCell!=c&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=c)),_[v]&&(M+=_[v]),L[v]&&(M+=L[v]),this.$annotations[v]&&v!==x&&(M+=this.$annotations[v].className),k){var O=k[v];O==null&&(O=k[v]=E.getFoldWidget(v))}if(O){var B="ace_fold-widget ace_"+O,N=O=="start"&&v==x&&v<g.end.row;if(N){B+=" ace_closed";for(var j="",V=!1,W=v+1;W<=g.end.row;W++)if(this.$annotations[W]){if(this.$annotations[W].className===" ace_error"){V=!0,j=" ace_error_fold";break}this.$annotations[W].className===" ace_security"?(V=!0,j=" ace_security_fold"):this.$annotations[W].className===" ace_warning"&&j!==" ace_security_fold"&&(V=!0,j=" ace_warning_fold")}M+=j}else B+=" ace_open";w.className!=B&&(w.className=B),i.setStyle(w.style,"height",C),i.setStyle(w.style,"display","inline-block"),w.setAttribute("role","button"),w.setAttribute("tabindex","-1");var H=E.getFoldWidgetRange(v);H?w.setAttribute("aria-label",r("gutter.code-folding.range.aria-label","Toggle code folding, rows $0 through $1",[H.start.row+1,H.end.row+1])):g?w.setAttribute("aria-label",r("gutter.code-folding.closed.aria-label","Toggle code folding, rows $0 through $1",[g.start.row+1,g.end.row+1])):w.setAttribute("aria-label",r("gutter.code-folding.open.aria-label","Toggle code folding, row $0",[v+1])),N?(w.setAttribute("aria-expanded","false"),w.setAttribute("title",r("gutter.code-folding.closed.title","Unfold code"))):(w.setAttribute("aria-expanded","true"),w.setAttribute("title",r("gutter.code-folding.open.title","Fold code")))}else w&&(i.setStyle(w.style,"display","none"),w.setAttribute("tabindex","0"),w.removeAttribute("role"),w.removeAttribute("aria-label"));var U=this.session.$gutterCustomWidgets[v];if(U?this.$addCustomWidget(v,U,c):D&&this.$removeCustomWidget(v,c),V&&this.$showFoldedAnnotations){y.className="ace_gutter_annotation",$.className=F,$.className+=j,i.setStyle($.style,"height",C),i.setStyle(y.style,"display","block"),i.setStyle(y.style,"height",C);var X;switch(j){case" ace_error_fold":X=r("gutter.annotation.aria-label.error","Error, read annotations row $0",[R]);break;case" ace_security_fold":X=r("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[R]);break;case" ace_warning_fold":X=r("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[R]);break}y.setAttribute("aria-label",X),y.setAttribute("tabindex","-1"),y.setAttribute("role","button")}else if(this.$annotations[v]){y.className="ace_gutter_annotation",$.className=F,this.$useSvgGutterIcons?$.className+=this.$annotations[v].className:b.classList.add(this.$annotations[v].className.replace(" ","")),i.setStyle($.style,"height",C),i.setStyle(y.style,"display","block"),i.setStyle(y.style,"height",C);var X;switch(this.$annotations[v].className){case" ace_error":X=r("gutter.annotation.aria-label.error","Error, read annotations row $0",[R]);break;case" ace_security":X=r("gutter.annotation.aria-label.security","Security finding, read annotations row $0",[R]);break;case" ace_warning":X=r("gutter.annotation.aria-label.warning","Warning, read annotations row $0",[R]);break;case" ace_info":X=r("gutter.annotation.aria-label.info","Info, read annotations row $0",[R]);break;case" ace_hint":X=r("gutter.annotation.aria-label.hint","Suggestion, read annotations row $0",[R]);break}y.setAttribute("aria-label",X),y.setAttribute("tabindex","-1"),y.setAttribute("role","button")}else i.setStyle(y.style,"display","none"),y.removeAttribute("aria-label"),y.removeAttribute("role"),y.setAttribute("tabindex","0");return R!==S.data&&(S.data=R),b.className!=M&&(b.className=M),i.setStyle(c.element.style,"height",this.$lines.computeLineHeight(v,m,E)+"px"),i.setStyle(c.element.style,"top",this.$lines.computeLineTop(v,m,E)+"px"),c.text=R,y.style.display==="none"&&w.style.display==="none"&&!U?c.element.setAttribute("aria-hidden",!0):c.element.setAttribute("aria-hidden",!1),c},d.prototype.setHighlightGutterLine=function(c){this.$highlightGutterLine=c,!c&&this.$highlightElement&&(this.$highlightElement.remove(),this.$highlightElement=null)},d.prototype.setShowLineNumbers=function(c){this.$renderer=!c&&{getWidth:function(){return 0},getText:function(){return""}}},d.prototype.getShowLineNumbers=function(){return this.$showLineNumbers},d.prototype.setShowFoldWidgets=function(c){c?i.addCssClass(this.element,"ace_folding-enabled"):i.removeCssClass(this.element,"ace_folding-enabled"),this.$showFoldWidgets=c,this.$padding=null},d.prototype.getShowFoldWidgets=function(){return this.$showFoldWidgets},d.prototype.$hideFoldWidget=function(c,m){var g=m||this.$getGutterCell(c);if(g&&g.element){var v=g.element.childNodes[1];v&&i.setStyle(v.style,"display","none")}},d.prototype.$showFoldWidget=function(c,m){var g=m||this.$getGutterCell(c);if(g&&g.element){var v=g.element.childNodes[1];v&&this.session.foldWidgets&&this.session.foldWidgets[g.row]&&i.setStyle(v.style,"display","inline-block")}},d.prototype.$getGutterCell=function(c){var m=this.$lines.cells,g=0,v=m.length-1;if(!(c<m[0].row||c>m[v].row)){for(;g<=v;){var b=Math.floor((g+v)/2),E=m[b];if(E.row>c)v=b-1;else if(E.row<c)g=b+1;else return E}return E}},d.prototype.$addCustomWidget=function(c,m,g){var v=m.className,b=m.label,E=m.title,S=m.callbacks;this.session.$gutterCustomWidgets[c]={className:v,label:b,title:E,callbacks:S},this.$hideFoldWidget(c,g);var w=g||this.$getGutterCell(c);if(w&&w.element){var y=w.element.querySelector(".ace_custom-widget");y&&y.remove(),y=i.createElement("span"),y.className="ace_custom-widget ".concat(v),y.setAttribute("tabindex","-1"),y.setAttribute("role","button"),y.setAttribute("aria-label",b),y.setAttribute("title",E),i.setStyle(y.style,"display","inline-block"),i.setStyle(y.style,"height","inherit"),S&&S.onClick&&y.addEventListener("click",function(D){S.onClick(D,c),D.stopPropagation()}),w.element.appendChild(y)}},d.prototype.$removeCustomWidget=function(c,m){delete this.session.$gutterCustomWidgets[c],this.$showFoldWidget(c,m);var g=m||this.$getGutterCell(c);if(g&&g.element){var v=g.element.querySelector(".ace_custom-widget");v&&g.element.removeChild(v)}},d.prototype.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var c=i.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=(parseInt(c.borderLeftWidth)||0)+(parseInt(c.paddingLeft)||0)+1,this.$padding.right=(parseInt(c.borderRightWidth)||0)+(parseInt(c.paddingRight)||0),this.$padding},d.prototype.getRegion=function(c){var m=this.$padding||this.$computePadding(),g=this.element.getBoundingClientRect();if(c.x<m.left+g.left)return"markers";if(this.$showFoldWidgets&&c.x>g.right-m.right)return"foldWidgets"},d})();a.prototype.$fixedWidth=!1,a.prototype.$highlightGutterLine=!0,a.prototype.$renderer=void 0,a.prototype.$showLineNumbers=!0,a.prototype.$showFoldWidgets=!0,o.implement(a.prototype,s);function l(d){var c=document.createTextNode("");d.appendChild(c);var m=i.createElement("span");d.appendChild(m);var g=i.createElement("span");d.appendChild(g);var v=i.createElement("span");return g.appendChild(v),d}n.Gutter=a}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(t,n,f){var i=t("../range").Range,o=t("../lib/dom"),p=(function(){function u(r){this.element=o.createElement("div"),this.element.className="ace_layer ace_marker-layer",r.appendChild(this.element)}return u.prototype.setPadding=function(r){this.$padding=r},u.prototype.setSession=function(r){this.session=r},u.prototype.setMarkers=function(r){this.markers=r},u.prototype.elt=function(r,a){var l=this.i!=-1&&this.element.childNodes[this.i];l?this.i++:(l=document.createElement("div"),this.element.appendChild(l),this.i=-1),l.style.cssText=a,l.className=r},u.prototype.update=function(r){if(r){this.config=r,this.i=0;var a;for(var l in this.markers){var d=this.markers[l];if(!d.range){d.update(a,this,this.session,r);continue}var c=d.range.clipRows(r.firstRow,r.lastRow);if(!c.isEmpty())if(c=c.toScreenRange(this.session),d.renderer){var m=this.$getTop(c.start.row,r),g=this.$padding+c.start.column*r.characterWidth;d.renderer(a,c,g,m,r)}else d.type=="fullLine"?this.drawFullLineMarker(a,c,d.clazz,r):d.type=="screenLine"?this.drawScreenLineMarker(a,c,d.clazz,r):c.isMultiLine()?d.type=="text"?this.drawTextMarker(a,c,d.clazz,r):this.drawMultiLineMarker(a,c,d.clazz,r):this.drawSingleLineMarker(a,c,d.clazz+" ace_start ace_br15",r)}if(this.i!=-1)for(;this.i<this.element.childElementCount;)this.element.removeChild(this.element.lastChild)}},u.prototype.$getTop=function(r,a){return(r-a.firstRowScreen)*a.lineHeight},u.prototype.drawTextMarker=function(r,a,l,d,c){for(var m=this.session,g=a.start.row,v=a.end.row,b=g,E=0,S=0,w=m.getScreenLastRowColumn(b),y=new i(b,a.start.column,b,S);b<=v;b++)y.start.row=y.end.row=b,y.start.column=b==g?a.start.column:m.getRowWrapIndent(b),y.end.column=w,E=S,S=w,w=b+1<v?m.getScreenLastRowColumn(b+1):b==v?0:a.end.column,this.drawSingleLineMarker(r,y,l+(b==g?" ace_start":"")+" ace_br"+s(b==g||b==g+1&&a.start.column,E<S,S>w,b==v),d,b==v?0:1,c)},u.prototype.drawMultiLineMarker=function(r,a,l,d,c){var m=this.$padding,g=d.lineHeight,v=this.$getTop(a.start.row,d),b=m+a.start.column*d.characterWidth;if(c=c||"",this.session.$bidiHandler.isBidiRow(a.start.row)){var E=a.clone();E.end.row=E.start.row,E.end.column=this.session.getLine(E.start.row).length,this.drawBidiSingleLineMarker(r,E,l+" ace_br1 ace_start",d,null,c)}else this.elt(l+" ace_br1 ace_start","height:"+g+"px;right:"+m+"px;top:"+v+"px;left:"+b+"px;"+(c||""));if(this.session.$bidiHandler.isBidiRow(a.end.row)){var E=a.clone();E.start.row=E.end.row,E.start.column=0,this.drawBidiSingleLineMarker(r,E,l+" ace_br12",d,null,c)}else{v=this.$getTop(a.end.row,d);var S=a.end.column*d.characterWidth;this.elt(l+" ace_br12","height:"+g+"px;width:"+S+"px;top:"+v+"px;left:"+m+"px;"+(c||""))}if(g=(a.end.row-a.start.row-1)*d.lineHeight,!(g<=0)){v=this.$getTop(a.start.row+1,d);var w=(a.start.column?1:0)|(a.end.column?0:8);this.elt(l+(w?" ace_br"+w:""),"height:"+g+"px;right:"+m+"px;top:"+v+"px;left:"+m+"px;"+(c||""))}},u.prototype.drawSingleLineMarker=function(r,a,l,d,c,m){if(this.session.$bidiHandler.isBidiRow(a.start.row))return this.drawBidiSingleLineMarker(r,a,l,d,c,m);var g=d.lineHeight,v=(a.end.column+(c||0)-a.start.column)*d.characterWidth,b=this.$getTop(a.start.row,d),E=this.$padding+a.start.column*d.characterWidth;this.elt(l,"height:"+g+"px;width:"+v+"px;top:"+b+"px;left:"+E+"px;"+(m||""))},u.prototype.drawBidiSingleLineMarker=function(r,a,l,d,c,m){var g=d.lineHeight,v=this.$getTop(a.start.row,d),b=this.$padding,E=this.session.$bidiHandler.getSelections(a.start.column,a.end.column);E.forEach(function(S){this.elt(l,"height:"+g+"px;width:"+(S.width+(c||0))+"px;top:"+v+"px;left:"+(b+S.left)+"px;"+(m||""))},this)},u.prototype.drawFullLineMarker=function(r,a,l,d,c){var m=this.$getTop(a.start.row,d),g=d.lineHeight;a.start.row!=a.end.row&&(g+=this.$getTop(a.end.row,d)-m),this.elt(l,"height:"+g+"px;top:"+m+"px;left:0;right:0;"+(c||""))},u.prototype.drawScreenLineMarker=function(r,a,l,d,c){var m=this.$getTop(a.start.row,d),g=d.lineHeight;this.elt(l,"height:"+g+"px;top:"+m+"px;left:0;right:0;"+(c||""))},u})();p.prototype.$padding=0;function s(u,r,a,l){return(u?1:0)|(r?2:0)|(a?4:0)|(l?8:0)}n.Marker=p}),ace.define("ace/layer/text_util",["require","exports","module"],function(t,n,f){var i=new Set(["text","rparen","lparen"]);n.isTextToken=function(o){return i.has(o)}}),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(t,n,f){var i=t("../lib/oop"),o=t("../lib/dom"),p=t("../lib/lang"),s=t("./lines").Lines,u=t("../lib/event_emitter").EventEmitter,r=t("../config").nls,a=t("./text_util").isTextToken,l=(function(){function d(c){this.dom=o,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",c.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new s(this.element)}return d.prototype.$updateEolChar=function(){var c=this.session.doc,m=c.getNewLineCharacter()==`
`&&c.getNewLineMode()!="windows",g=m?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=g)return this.EOL_CHAR=g,!0},d.prototype.setPadding=function(c){this.$padding=c,this.element.style.margin="0 "+c+"px"},d.prototype.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},d.prototype.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},d.prototype.$setFontMetrics=function(c){this.$fontMetrics=c,this.$fontMetrics.on("changeCharacterSize",function(m){this._signal("changeCharacterSize",m)}.bind(this)),this.$pollSizeChanges()},d.prototype.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},d.prototype.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},d.prototype.setSession=function(c){this.session=c,c&&this.$computeTabString()},d.prototype.setShowInvisibles=function(c){return this.showInvisibles==c?!1:(this.showInvisibles=c,typeof c=="string"?(this.showSpaces=/tab/i.test(c),this.showTabs=/space/i.test(c),this.showEOL=/eol/i.test(c)):this.showSpaces=this.showTabs=this.showEOL=c,this.$computeTabString(),!0)},d.prototype.setDisplayIndentGuides=function(c){return this.displayIndentGuides==c?!1:(this.displayIndentGuides=c,this.$computeTabString(),!0)},d.prototype.setHighlightIndentGuides=function(c){return this.$highlightIndentGuides===c?!1:(this.$highlightIndentGuides=c,c)},d.prototype.$computeTabString=function(){var c=this.session.getTabSize();this.tabSize=c;for(var m=this.$tabStrings=[0],g=1;g<c+1;g++)if(this.showTabs){var v=this.dom.createElement("span");v.className="ace_invisible ace_invisible_tab",v.textContent=p.stringRepeat(this.TAB_CHAR,g),m.push(v)}else m.push(this.dom.createTextNode(p.stringRepeat(" ",g),this.element));if(this.displayIndentGuides){this.$indentGuideRe=/\s\S| \t|\t |\s$/;var b="ace_indent-guide",E=this.showSpaces?" ace_invisible ace_invisible_space":"",S=this.showSpaces?p.stringRepeat(this.SPACE_CHAR,this.tabSize):p.stringRepeat(" ",this.tabSize),w=this.showTabs?" ace_invisible ace_invisible_tab":"",y=this.showTabs?p.stringRepeat(this.TAB_CHAR,this.tabSize):S,v=this.dom.createElement("span");v.className=b+E,v.textContent=S,this.$tabStrings[" "]=v;var v=this.dom.createElement("span");v.className=b+w,v.textContent=y,this.$tabStrings[" "]=v}},d.prototype.updateLines=function(c,m,g){if(this.config.lastRow!=c.lastRow||this.config.firstRow!=c.firstRow)return this.update(c);this.config=c;for(var v=Math.max(m,c.firstRow),b=Math.min(g,c.lastRow),E=this.element.childNodes,S=0,y=c.firstRow;y<v;y++){var D=this.session.getFoldLine(y);if(D)if(D.containsRow(v)){v=D.start.row;break}else y=D.end.row;S++}for(var w=!1,y=v,D=this.session.getNextFoldLine(y),$=D?D.start.row:1/0;y>$&&(y=D.end.row+1,D=this.session.getNextFoldLine(y,D),$=D?D.start.row:1/0),!(y>b);){var A=E[S++];if(A){this.dom.removeChildren(A),this.$renderLine(A,y,y==$?D:!1),w&&(A.style.top=this.$lines.computeLineTop(y,c,this.session)+"px");var _=c.lineHeight*this.session.getRowLength(y)+"px";A.style.height!=_&&(w=!0,A.style.height=_)}y++}if(w)for(;S<this.$lines.cells.length;){var L=this.$lines.cells[S++];L.element.style.top=this.$lines.computeLineTop(L.row,c,this.session)+"px"}},d.prototype.scrollLines=function(c){var m=this.config;if(this.config=c,this.$lines.pageChanged(m,c))return this.update(c);this.$lines.moveContainer(c);var g=c.lastRow,v=m?m.lastRow:-1;if(!m||v<c.firstRow)return this.update(c);if(g<m.firstRow)return this.update(c);if(!m||m.lastRow<c.firstRow)return this.update(c);if(c.lastRow<m.firstRow)return this.update(c);if(m.firstRow<c.firstRow)for(var b=this.session.getFoldedRowCount(m.firstRow,c.firstRow-1);b>0;b--)this.$lines.shift();if(m.lastRow>c.lastRow)for(var b=this.session.getFoldedRowCount(c.lastRow+1,m.lastRow);b>0;b--)this.$lines.pop();c.firstRow<m.firstRow&&this.$lines.unshift(this.$renderLinesFragment(c,c.firstRow,m.firstRow-1)),c.lastRow>m.lastRow&&this.$lines.push(this.$renderLinesFragment(c,m.lastRow+1,c.lastRow)),this.$highlightIndentGuide()},d.prototype.$renderLinesFragment=function(c,m,g){for(var v=[],b=m,E=this.session.getNextFoldLine(b),S=E?E.start.row:1/0;b>S&&(b=E.end.row+1,E=this.session.getNextFoldLine(b,E),S=E?E.start.row:1/0),!(b>g);){var w=this.$lines.createCell(b,c,this.session),y=w.element;this.dom.removeChildren(y),o.setStyle(y.style,"height",this.$lines.computeLineHeight(b,c,this.session)+"px"),o.setStyle(y.style,"top",this.$lines.computeLineTop(b,c,this.session)+"px"),this.$renderLine(y,b,b==S?E:!1),this.$useLineGroups()?y.className="ace_line_group":y.className="ace_line",v.push(w),b++}return v},d.prototype.update=function(c){this.$lines.moveContainer(c),this.config=c;for(var m=c.firstRow,g=c.lastRow,v=this.$lines;v.getLength();)v.pop();v.push(this.$renderLinesFragment(c,m,g))},d.prototype.$renderToken=function(c,m,g,v){for(var b=this,E=/(\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,S=this.dom.createFragment(this.element),w,y=0;w=E.exec(v);){var D=w[1],$=w[2],A=w[3],_=w[4],L=w[5];if(!(!b.showSpaces&&$)){var T=y!=w.index?v.slice(y,w.index):"";if(y=w.index+w[0].length,T&&S.appendChild(this.dom.createTextNode(T,this.element)),D){var k=b.session.getScreenTabSize(m+w.index),x=b.$tabStrings[k].cloneNode(!0);x.charCount=1,S.appendChild(x),m+=k-1}else if($)if(b.showSpaces){var C=this.dom.createElement("span");C.className="ace_invisible ace_invisible_space",C.textContent=p.stringRepeat(b.SPACE_CHAR,$.length),S.appendChild(C)}else S.appendChild(this.dom.createTextNode($,this.element));else if(A){var C=this.dom.createElement("span");C.className="ace_invisible ace_invisible_space ace_invalid",C.textContent=p.stringRepeat(b.SPACE_CHAR,A.length),S.appendChild(C)}else if(_){m+=1;var C=this.dom.createElement("span");C.style.width=b.config.characterWidth*2+"px",C.className=b.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",C.textContent=b.showSpaces?b.SPACE_CHAR:_,S.appendChild(C)}else if(L){m+=1;var C=this.dom.createElement("span");C.style.width=b.config.characterWidth*2+"px",C.className="ace_cjk",C.textContent=L,S.appendChild(C)}}}if(S.appendChild(this.dom.createTextNode(y?v.slice(y):v,this.element)),a(g.type))c.appendChild(S);else{var M="ace_"+g.type.replace(/\./g," ace_"),C=this.dom.createElement("span");g.type=="fold"&&(C.style.width=g.value.length*this.config.characterWidth+"px",C.setAttribute("title",r("inline-fold.closed.title","Unfold code"))),C.className=M,C.appendChild(S),c.appendChild(C)}return m+v.length},d.prototype.renderIndentGuide=function(c,m,g){var v=m.search(this.$indentGuideRe);if(v<=0||v>=g)return m;if(m[0]==" "){v-=v%this.tabSize;for(var b=v/this.tabSize,E=0;E<b;E++)c.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),m.substr(v)}else if(m[0]==" "){for(var E=0;E<v;E++)c.appendChild(this.$tabStrings[" "].cloneNode(!0));return this.$highlightIndentGuide(),m.substr(v)}return this.$highlightIndentGuide(),m},d.prototype.$highlightIndentGuide=function(){if(!(!this.$highlightIndentGuides||!this.displayIndentGuides)){this.$highlightIndentGuideMarker={indentLevel:void 0,start:void 0,end:void 0,dir:void 0};var c=this.session.doc.$lines;if(c){var m=this.session.selection.getCursor(),g=/^\s*/.exec(this.session.doc.getLine(m.row))[0].length,v=Math.floor(g/this.tabSize);this.$highlightIndentGuideMarker={indentLevel:v,start:m.row};var b=this.session.$bracketHighlight;if(b){for(var E=this.session.$bracketHighlight.ranges,S=0;S<E.length;S++)if(m.row!==E[S].start.row){this.$highlightIndentGuideMarker.end=E[S].start.row+1,m.row>E[S].start.row?this.$highlightIndentGuideMarker.dir=-1:this.$highlightIndentGuideMarker.dir=1;break}}if(!this.$highlightIndentGuideMarker.end&&c[m.row]!==""&&m.column===c[m.row].length){this.$highlightIndentGuideMarker.dir=1;for(var S=m.row+1;S<c.length;S++){var w=c[S],y=/^\s*/.exec(w)[0].length;if(w!==""&&(this.$highlightIndentGuideMarker.end=S,y<=g))break}}this.$renderHighlightIndentGuide()}}},d.prototype.$clearActiveIndentGuide=function(){for(var c=this.element.querySelectorAll(".ace_indent-guide-active"),m=0;m<c.length;m++)c[m].classList.remove("ace_indent-guide-active")},d.prototype.$setIndentGuideActive=function(c,m){var g=this.session.doc.getLine(c.row);if(g!==""){var v=c.element;if(c.element.classList&&c.element.classList.contains("ace_line_group"))if(c.element.childNodes.length>0)v=c.element.childNodes[0];else return;var b=v.childNodes;if(b){var E=b[m-1];E&&E.classList&&E.classList.contains("ace_indent-guide")&&E.classList.add("ace_indent-guide-active")}}},d.prototype.$renderHighlightIndentGuide=function(){if(this.$lines){var c=this.$lines.cells;this.$clearActiveIndentGuide();var m=this.$highlightIndentGuideMarker.indentLevel;if(m!==0)if(this.$highlightIndentGuideMarker.dir===1)for(var g=0;g<c.length;g++){var v=c[g];if(this.$highlightIndentGuideMarker.end&&v.row>=this.$highlightIndentGuideMarker.start+1){if(v.row>=this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(v,m)}}else for(var g=c.length-1;g>=0;g--){var v=c[g];if(this.$highlightIndentGuideMarker.end&&v.row<this.$highlightIndentGuideMarker.start){if(v.row<this.$highlightIndentGuideMarker.end)break;this.$setIndentGuideActive(v,m)}}}},d.prototype.$createLineElement=function(c){var m=this.dom.createElement("div");return m.className="ace_line",m.style.height=this.config.lineHeight+"px",m},d.prototype.$renderWrappedLine=function(c,m,g){var v=0,b=0,E=g[0],S=0,w=this.$createLineElement();c.appendChild(w);for(var y=0;y<m.length;y++){var D=m[y],$=D.value;if(y==0&&this.displayIndentGuides){if(v=$.length,$=this.renderIndentGuide(w,$,E),!$)continue;v-=$.length}if(v+$.length<E)S=this.$renderToken(w,S,D,$),v+=$.length;else{for(;v+$.length>=E;){S=this.$renderToken(w,S,D,$.substring(0,E-v)),$=$.substring(E-v),v=E,w=this.$createLineElement(),c.appendChild(w);var A=this.dom.createTextNode(p.stringRepeat(" ",g.indent),this.element);A.charCount=0,w.appendChild(A),b++,S=0,E=g[b]||Number.MAX_VALUE}$.length!=0&&(v+=$.length,S=this.$renderToken(w,S,D,$))}}g[g.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(w,S,null,"",!0)},d.prototype.$renderSimpleLine=function(c,m){for(var g=0,v=0;v<m.length;v++){var b=m[v],E=b.value;if(!(v==0&&this.displayIndentGuides&&(E=this.renderIndentGuide(c,E),!E))){if(g+E.length>this.MAX_LINE_LENGTH)return this.$renderOverflowMessage(c,g,b,E);g=this.$renderToken(c,g,b,E)}}},d.prototype.$renderOverflowMessage=function(c,m,g,v,b){g&&this.$renderToken(c,m,g,v.slice(0,this.MAX_LINE_LENGTH-m));var E=this.dom.createElement("span");E.className="ace_inline_button ace_keyword ace_toggle_wrap",E.textContent=b?"<hide>":"<click to see more...>",c.appendChild(E)},d.prototype.$renderLine=function(c,m,g){if(!g&&g!=!1&&(g=this.session.getFoldLine(m)),g)var v=this.$getFoldLineTokens(m,g);else var v=this.session.getTokens(m);var b=c;if(v.length){var E=this.session.getRowSplitData(m);if(E&&E.length){this.$renderWrappedLine(c,v,E);var b=c.lastChild}else{var b=c;this.$useLineGroups()&&(b=this.$createLineElement(),c.appendChild(b)),this.$renderSimpleLine(b,v)}}else this.$useLineGroups()&&(b=this.$createLineElement(),c.appendChild(b));if(this.showEOL&&b){g&&(m=g.end.row);var S=this.dom.createElement("span");S.className="ace_invisible ace_invisible_eol",S.textContent=m==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,b.appendChild(S)}},d.prototype.$getFoldLineTokens=function(c,m){var g=this.session,v=[];function b(S,w,y){for(var D=0,$=0;$+S[D].value.length<w;)if($+=S[D].value.length,D++,D==S.length)return;if($!=w){var A=S[D].value.substring(w-$);A.length>y-w&&(A=A.substring(0,y-w)),v.push({type:S[D].type,value:A}),$=w+A.length,D+=1}for(;$<y&&D<S.length;){var A=S[D].value;A.length+$>y?v.push({type:S[D].type,value:A.substring(0,y-$)}):v.push(S[D]),$+=A.length,D+=1}}var E=g.getTokens(c);return m.walk(function(S,w,y,D,$){S!=null?v.push({type:"fold",value:S}):($&&(E=g.getTokens(w)),E.length&&b(E,D,y))},m.end.row,this.session.getLine(m.end.row).length),v},d.prototype.$useLineGroups=function(){return this.session.getUseWrapMode()},d})();l.prototype.EOF_CHAR="¶",l.prototype.EOL_CHAR_LF="¬",l.prototype.EOL_CHAR_CRLF="¤",l.prototype.EOL_CHAR=l.prototype.EOL_CHAR_LF,l.prototype.TAB_CHAR="—",l.prototype.SPACE_CHAR="·",l.prototype.$padding=0,l.prototype.MAX_LINE_LENGTH=1e4,l.prototype.showInvisibles=!1,l.prototype.showSpaces=!1,l.prototype.showTabs=!1,l.prototype.showEOL=!1,l.prototype.displayIndentGuides=!0,l.prototype.$highlightIndentGuides=!0,l.prototype.$tabStrings=[],l.prototype.destroy={},l.prototype.onChangeTabSize=l.prototype.$computeTabString,i.implement(l.prototype,u),n.Text=l}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(t,n,f){var i=t("../lib/dom"),o=(function(){function p(s){this.element=i.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(),i.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)}return p.prototype.$updateOpacity=function(s){for(var u=this.cursors,r=u.length;r--;)i.setStyle(u[r].style,"opacity",s?"":"0")},p.prototype.$startCssAnimation=function(){for(var s=this.cursors,u=s.length;u--;)s[u].style.animationDuration=this.blinkInterval+"ms";this.$isAnimating=!0,setTimeout(function(){this.$isAnimating&&i.addCssClass(this.element,"ace_animate-blinking")}.bind(this))},p.prototype.$stopCssAnimation=function(){this.$isAnimating=!1,i.removeCssClass(this.element,"ace_animate-blinking")},p.prototype.setPadding=function(s){this.$padding=s},p.prototype.setSession=function(s){this.session=s},p.prototype.setBlinking=function(s){s!=this.isBlinking&&(this.isBlinking=s,this.restartTimer())},p.prototype.setBlinkInterval=function(s){s!=this.blinkInterval&&(this.blinkInterval=s,this.restartTimer())},p.prototype.setSmoothBlinking=function(s){s!=this.smoothBlinking&&(this.smoothBlinking=s,i.setCssClass(this.element,"ace_smooth-blinking",s),this.$updateCursors(!0),this.restartTimer())},p.prototype.addCursor=function(){var s=i.createElement("div");return s.className="ace_cursor",this.element.appendChild(s),this.cursors.push(s),s},p.prototype.removeCursor=function(){if(this.cursors.length>1){var s=this.cursors.pop();return s.parentNode.removeChild(s),s}},p.prototype.hideCursor=function(){this.isVisible=!1,i.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},p.prototype.showCursor=function(){this.isVisible=!0,i.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},p.prototype.restartTimer=function(){var s=this.$updateCursors;if(clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&(this.$isSmoothBlinking=!1,i.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&&i.addCssClass(this.element,"ace_smooth-blinking")}.bind(this))),i.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var u=function(){this.timeoutId=setTimeout(function(){s(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){s(!0),u()},this.blinkInterval),u()}},p.prototype.getPixelPosition=function(s,u){if(!this.config||!this.session)return{left:0,top:0};s||(s=this.session.selection.getCursor());var r=this.session.documentToScreenPosition(s),a=this.$padding+(this.session.$bidiHandler.isBidiRow(r.row,s.row)?this.session.$bidiHandler.getPosLeft(r.column):r.column*this.config.characterWidth),l=(r.row-(u?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:a,top:l}},p.prototype.isCursorInView=function(s,u){return s.top>=0&&s.top<u.maxHeight},p.prototype.update=function(s){this.config=s;var u=this.session.$selectionMarkers,r=0,a=0;(u===void 0||u.length===0)&&(u=[{cursor:null}]);for(var r=0,l=u.length;r<l;r++){var d=this.getPixelPosition(u[r].cursor,!0);if(!((d.top>s.height+s.offset||d.top<0)&&r>1)){var c=this.cursors[a++]||this.addCursor(),m=c.style;this.drawCursor?this.drawCursor(c,d,s,u[r],this.session):this.isCursorInView(d,s)?(i.setStyle(m,"display","block"),i.translate(c,d.left,d.top),i.setStyle(m,"width",Math.round(s.characterWidth)+"px"),i.setStyle(m,"height",s.lineHeight+"px")):i.setStyle(m,"display","none")}}for(;this.cursors.length>a;)this.removeCursor();var g=this.session.getOverwrite();this.$setOverwrite(g),this.$pixelPos=d,this.restartTimer()},p.prototype.$setOverwrite=function(s){s!=this.overwrite&&(this.overwrite=s,s?i.addCssClass(this.element,"ace_overwrite-cursors"):i.removeCssClass(this.element,"ace_overwrite-cursors"))},p.prototype.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)},p})();o.prototype.$padding=0,o.prototype.drawCursor=null,n.Cursor=o}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(t,n,f){var i=this&&this.__extends||(function(){var c=function(m,g){return c=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,b){v.__proto__=b}||function(v,b){for(var E in b)Object.prototype.hasOwnProperty.call(b,E)&&(v[E]=b[E])},c(m,g)};return function(m,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");c(m,g);function v(){this.constructor=m}m.prototype=g===null?Object.create(g):(v.prototype=g.prototype,new v)}})(),o=t("./lib/oop"),p=t("./lib/dom"),s=t("./lib/event"),u=t("./lib/event_emitter").EventEmitter,r=32768,a=(function(){function c(m,g){this.element=p.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+g,this.inner=p.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent=" ",this.element.appendChild(this.inner),m.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 c.prototype.setVisible=function(m){this.element.style.display=m?"":"none",this.isVisible=m,this.coeff=1},c})();o.implement(a.prototype,u);var l=(function(c){i(m,c);function m(g,v){var b=c.call(this,g,"-v")||this;return b.scrollTop=0,b.scrollHeight=0,v.$scrollbarWidth=b.width=p.scrollbarWidth(g.ownerDocument),b.inner.style.width=b.element.style.width=(b.width||15)+5+"px",b.$minWidth=0,b}return m.prototype.onScroll=function(){if(!this.skipEvent){if(this.scrollTop=this.element.scrollTop,this.coeff!=1){var g=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-g)/(this.coeff-g)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},m.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},m.prototype.setHeight=function(g){this.element.style.height=g+"px"},m.prototype.setScrollHeight=function(g){this.scrollHeight=g,g>r?(this.coeff=r/g,g=r):this.coeff!=1&&(this.coeff=1),this.inner.style.height=g+"px"},m.prototype.setScrollTop=function(g){this.scrollTop!=g&&(this.skipEvent=!0,this.scrollTop=g,this.element.scrollTop=g*this.coeff)},m})(a);l.prototype.setInnerHeight=l.prototype.setScrollHeight;var d=(function(c){i(m,c);function m(g,v){var b=c.call(this,g,"-h")||this;return b.scrollLeft=0,b.height=v.$scrollbarWidth,b.inner.style.height=b.element.style.height=(b.height||15)+5+"px",b}return m.prototype.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},m.prototype.getHeight=function(){return this.isVisible?this.height:0},m.prototype.setWidth=function(g){this.element.style.width=g+"px"},m.prototype.setInnerWidth=function(g){this.inner.style.width=g+"px"},m.prototype.setScrollWidth=function(g){this.inner.style.width=g+"px"},m.prototype.setScrollLeft=function(g){this.scrollLeft!=g&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=g)},m})(a);n.ScrollBar=l,n.ScrollBarV=l,n.ScrollBarH=d,n.VScrollBar=l,n.HScrollBar=d}),ace.define("ace/scrollbar_custom",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(t,n,f){var i=this&&this.__extends||(function(){var d=function(c,m){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,v){g.__proto__=v}||function(g,v){for(var b in v)Object.prototype.hasOwnProperty.call(v,b)&&(g[b]=v[b])},d(c,m)};return function(c,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");d(c,m);function g(){this.constructor=c}c.prototype=m===null?Object.create(m):(g.prototype=m.prototype,new g)}})(),o=t("./lib/oop"),p=t("./lib/dom"),s=t("./lib/event"),u=t("./lib/event_emitter").EventEmitter;p.importCssString(`.ace_editor>.ace_sb-v div, .ace_editor>.ace_sb-h div{
position: absolute;
background: rgba(128, 128, 128, 0.6);
-moz-box-sizing: border-box;
box-sizing: border-box;
border: 1px solid #bbb;
border-radius: 2px;
z-index: 8;
}
.ace_editor>.ace_sb-v, .ace_editor>.ace_sb-h {
position: absolute;
z-index: 6;
background: none;
overflow: hidden!important;
}
.ace_editor>.ace_sb-v {
z-index: 6;
right: 0;
top: 0;
width: 12px;
}
.ace_editor>.ace_sb-v div {
z-index: 8;
right: 0;
width: 100%;
}
.ace_editor>.ace_sb-h {
bottom: 0;
left: 0;
height: 12px;
}
.ace_editor>.ace_sb-h div {
bottom: 0;
height: 100%;
}
.ace_editor>.ace_sb_grabbed {
z-index: 8;
background: #000;
}`,"ace_scrollbar.css",!1);var r=(function(){function d(c,m){this.element=p.createElement("div"),this.element.className="ace_sb"+m,this.inner=p.createElement("div"),this.inner.className="",this.element.appendChild(this.inner),this.VScrollWidth=12,this.HScrollHeight=12,c.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addMultiMouseDownListener(this.element,[500,300,300],this,"onMouseDown")}return d.prototype.setVisible=function(c){this.element.style.display=c?"":"none",this.isVisible=c,this.coeff=1},d})();o.implement(r.prototype,u);var a=(function(d){i(c,d);function c(m,g){var v=d.call(this,m,"-v")||this;return v.scrollTop=0,v.scrollHeight=0,v.parent=m,v.width=v.VScrollWidth,v.renderer=g,v.inner.style.width=v.element.style.width=(v.width||15)+"px",v.$minWidth=0,v}return c.prototype.onMouseDown=function(m,g){if(m==="mousedown"&&!(s.getButton(g)!==0||g.detail===2)){if(g.target===this.inner){var v=this,b=g.clientY,E=function(_){b=_.clientY},S=function(){clearInterval($)},w=g.clientY,y=this.thumbTop,D=function(){if(b!==void 0){var _=v.scrollTopFromThumbTop(y+b-w);_!==v.scrollTop&&v._emit("scroll",{data:_})}};s.capture(this.inner,E,S);var $=setInterval(D,20);return s.preventDefault(g)}var A=g.clientY-this.element.getBoundingClientRect().top-this.thumbHeight/2;return this._emit("scroll",{data:this.scrollTopFromThumbTop(A)}),s.preventDefault(g)}},c.prototype.getHeight=function(){return this.height},c.prototype.scrollTopFromThumbTop=function(m){var g=m*(this.pageHeight-this.viewHeight)/(this.slideHeight-this.thumbHeight);return g=g>>0,g<0?g=0:g>this.pageHeight-this.viewHeight&&(g=this.pageHeight-this.viewHeight),g},c.prototype.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},c.prototype.setHeight=function(m){this.height=Math.max(0,m),this.slideHeight=this.height,this.viewHeight=this.height,this.setScrollHeight(this.pageHeight,!0)},c.prototype.setScrollHeight=function(m,g){this.pageHeight===m&&!g||(this.pageHeight=m,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})))},c.prototype.setScrollTop=function(m){this.scrollTop=m,m<0&&(m=0),this.thumbTop=m*(this.slideHeight-this.thumbHeight)/(this.pageHeight-this.viewHeight),this.inner.style.top=this.thumbTop+"px"},c})(r);a.prototype.setInnerHeight=a.prototype.setScrollHeight;var l=(function(d){i(c,d);function c(m,g){var v=d.call(this,m,"-h")||this;return v.scrollLeft=0,v.scrollWidth=0,v.height=v.HScrollHeight,v.inner.style.height=v.element.style.height=(v.height||12)+"px",v.renderer=g,v}return c.prototype.onMouseDown=function(m,g){if(m==="mousedown"&&!(s.getButton(g)!==0||g.detail===2)){if(g.target===this.inner){var v=this,b=g.clientX,E=function(_){b=_.clientX},S=function(){clearInterval($)},w=g.clientX,y=this.thumbLeft,D=function(){if(b!==void 0){var _=v.scrollLeftFromThumbLeft(y+b-w);_!==v.scrollLeft&&v._emit("scroll",{data:_})}};s.capture(this.inner,E,S);var $=setInterval(D,20);return s.preventDefault(g)}var A=g.clientX-this.element.getBoundingClientRect().left-this.thumbWidth/2;return this._emit("scroll",{data:this.scrollLeftFromThumbLeft(A)}),s.preventDefault(g)}},c.prototype.getHeight=function(){return this.isVisible?this.height:0},c.prototype.scrollLeftFromThumbLeft=function(m){var g=m*(this.pageWidth-this.viewWidth)/(this.slideWidth-this.thumbWidth);return g=g>>0,g<0?g=0:g>this.pageWidth-this.viewWidth&&(g=this.pageWidth-this.viewWidth),g},c.prototype.setWidth=function(m){this.width=Math.max(0,m),this.element.style.width=this.width+"px",this.slideWidth=this.width,this.viewWidth=this.width,this.setScrollWidth(this.pageWidth,!0)},c.prototype.setScrollWidth=function(m,g){this.pageWidth===m&&!g||(this.pageWidth=m,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})))},c.prototype.setScrollLeft=function(m){this.scrollLeft=m,m<0&&(m=0),this.thumbLeft=m*(this.slideWidth-this.thumbWidth)/(this.pageWidth-this.viewWidth),this.inner.style.left=this.thumbLeft+"px"},c})(r);l.prototype.setInnerWidth=l.prototype.setScrollWidth,n.ScrollBar=a,n.ScrollBarV=a,n.ScrollBarH=l,n.VScrollBar=a,n.HScrollBar=l}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(t,n,f){var i=t("./lib/event"),o=(function(){function p(s,u){this.onRender=s,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=u||window;var r=this;this._flush=function(a){r.pending=!1;var l=r.changes;if(l&&(i.blockIdle(100),r.changes=0,r.onRender(l)),r.changes){if(r.$recursionLimit--<0)return;r.schedule()}else r.$recursionLimit=2}}return p.prototype.schedule=function(s){this.changes=this.changes|s,this.changes&&!this.pending&&(i.nextFrame(this._flush),this.pending=!0)},p.prototype.clear=function(s){var u=this.changes;return this.changes=0,u},p})();n.RenderLoop=o}),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(t,n,f){var i=t("../lib/oop"),o=t("../lib/dom"),p=t("../lib/lang"),s=t("../lib/event"),u=t("../lib/useragent"),r=t("../lib/event_emitter").EventEmitter,a=512,l=typeof ResizeObserver=="function",d=200,c=(function(){function m(g){this.el=o.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=o.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=o.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),g.appendChild(this.el),this.$measureNode.textContent=p.stringRepeat("X",a),this.$characterSize={width:0,height:0},l?this.$addObserver():this.checkForSizeChanges()}return m.prototype.$setMeasureNodeStyles=function(g,v){g.width=g.height="auto",g.left=g.top="0px",g.visibility="hidden",g.position="absolute",g.whiteSpace="pre",u.isIE<8?g["font-family"]="inherit":g.font="inherit",g.overflow=v?"hidden":"visible"},m.prototype.checkForSizeChanges=function(g){if(g===void 0&&(g=this.$measureSizes()),g&&(this.$characterSize.width!==g.width||this.$characterSize.height!==g.height)){this.$measureNode.style.fontWeight="bold";var v=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=g,this.charSizes=Object.create(null),this.allowBoldFonts=v&&v.width===g.width&&v.height===g.height,this._emit("changeCharacterSize",{data:g})}},m.prototype.$addObserver=function(){var g=this;this.$observer=new window.ResizeObserver(function(v){g.checkForSizeChanges()}),this.$observer.observe(this.$measureNode)},m.prototype.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var g=this;return this.$pollSizeChangesTimer=s.onIdle(function v(){g.checkForSizeChanges(),s.onIdle(v,500)},500)},m.prototype.setPolling=function(g){g?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},m.prototype.$measureSizes=function(g){var v={height:(g||this.$measureNode).clientHeight,width:(g||this.$measureNode).clientWidth/a};return v.width===0||v.height===0?null:v},m.prototype.$measureCharWidth=function(g){this.$main.textContent=p.stringRepeat(g,a);var v=this.$main.getBoundingClientRect();return v.width/a},m.prototype.getCharacterWidth=function(g){var v=this.charSizes[g];return v===void 0&&(v=this.charSizes[g]=this.$measureCharWidth(g)/this.$characterSize.width),v},m.prototype.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},m.prototype.$getZoom=function(g){return!g||!g.parentElement?1:(Number(window.getComputedStyle(g).zoom)||1)*this.$getZoom(g.parentElement)},m.prototype.$initTransformMeasureNodes=function(){var g=function(v,b){return["div",{style:"position: absolute;top:"+v+"px;left:"+b+"px;"}]};this.els=o.buildDom([g(0,0),g(d,0),g(0,d),g(d,d)],this.el)},m.prototype.transformCoordinates=function(g,v){if(g){var b=this.$getZoom(this.el);g=y(1/b,g)}function E(B,N,j){var V=B[1]*N[0]-B[0]*N[1];return[(-N[1]*j[0]+N[0]*j[1])/V,(+B[1]*j[0]-B[0]*j[1])/V]}function S(B,N){return[B[0]-N[0],B[1]-N[1]]}function w(B,N){return[B[0]+N[0],B[1]+N[1]]}function y(B,N){return[B*N[0],B*N[1]]}this.els||this.$initTransformMeasureNodes();function D(B){var N=B.getBoundingClientRect();return[N.left,N.top]}var $=D(this.els[0]),A=D(this.els[1]),_=D(this.els[2]),L=D(this.els[3]),T=E(S(L,A),S(L,_),S(w(A,_),w(L,$))),k=y(1+T[0],S(A,$)),x=y(1+T[1],S(_,$));if(v){var C=v,M=T[0]*C[0]/d+T[1]*C[1]/d+1,F=w(y(C[0],k),y(C[1],x));return w(y(1/M/d,F),$)}var R=S(g,$),O=E(S(k,y(T[0],R)),S(x,y(T[1],R)),R);return y(d,O)},m})();c.prototype.$characterSize={width:0,height:0},i.implement(c.prototype,r),n.FontMetrics=c}),ace.define("ace/css/editor-css",["require","exports","module"],function(t,n,f){f.exports=`
.ace_br1 {border-top-left-radius : 3px;}
.ace_br2 {border-top-right-radius : 3px;}
.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}
.ace_br4 {border-bottom-right-radius: 3px;}
.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}
.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}
.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}
.ace_br8 {border-bottom-left-radius : 3px;}
.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}
.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}
.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}
.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}
.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}
.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}
.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}
.ace_editor {
position: relative;
overflow: hidden;
padding: 0;
font: 12px/normal 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'Source Code Pro', 'source-code-pro', monospace;
direction: ltr;
text-align: left;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
forced-color-adjust: none;
}
.ace_scroller {
position: absolute;
overflow: hidden;
top: 0;
bottom: 0;
background-color: inherit;
-ms-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
cursor: text;
}
.ace_content {
position: absolute;
box-sizing: border-box;
min-width: 100%;
contain: style size layout;
font-variant-ligatures: no-common-ligatures;
}
.ace_invisible {
font-variant-ligatures: none;
}
.ace_keyboard-focus:focus {
box-shadow: inset 0 0 0 2px #5E9ED6;
outline: none;
}
.ace_dragging .ace_scroller:before{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
content: '';
background: rgba(250, 250, 250, 0.01);
z-index: 1000;
}
.ace_dragging.ace_dark .ace_scroller:before{
background: rgba(0, 0, 0, 0.01);
}
.ace_gutter {
position: absolute;
overflow : hidden;
width: auto;
top: 0;
bottom: 0;
left: 0;
cursor: default;
z-index: 4;
-ms-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
contain: style size layout;
}
.ace_gutter-active-line {
position: absolute;
left: 0;
right: 0;
}
.ace_scroller.ace_scroll-left:after {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
pointer-events: none;
}
.ace_gutter-cell, .ace_gutter-cell_svg-icons {
position: absolute;
top: 0;
left: 0;
right: 0;
padding-left: 19px;
padding-right: 6px;
background-repeat: no-repeat;
}
.ace_gutter-cell_svg-icons .ace_gutter_annotation {
margin-left: -14px;
float: left;
}
.ace_gutter-cell .ace_gutter_annotation {
margin-left: -19px;
float: left;
}
.ace_gutter-cell.ace_error, .ace_icon.ace_error, .ace_icon.ace_error_fold, .ace_gutter-cell.ace_security, .ace_icon.ace_security, .ace_icon.ace_security_fold {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");
background-repeat: no-repeat;
background-position: 2px center;
}
.ace_gutter-cell.ace_warning, .ace_icon.ace_warning, .ace_icon.ace_warning_fold {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");
background-repeat: no-repeat;
background-position: 2px center;
}
.ace_gutter-cell.ace_info, .ace_icon.ace_info, .ace_gutter-cell.ace_hint, .ace_icon.ace_hint {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");
background-repeat: no-repeat;
background-position: 2px center;
}
.ace_dark .ace_gutter-cell.ace_info, .ace_dark .ace_icon.ace_info, .ace_dark .ace_gutter-cell.ace_hint, .ace_dark .ace_icon.ace_hint {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");
}
.ace_icon_svg.ace_error {
-webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJyZWQiIHNoYXBlLXJlbmRlcmluZz0iZ2VvbWV0cmljUHJlY2lzaW9uIj4KPGNpcmNsZSBmaWxsPSJub25lIiBjeD0iOCIgY3k9IjgiIHI9IjciIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPGxpbmUgeDE9IjExIiB5MT0iNSIgeDI9IjUiIHkyPSIxMSIvPgo8bGluZSB4MT0iMTEiIHkxPSIxMSIgeDI9IjUiIHkyPSI1Ii8+CjwvZz4KPC9zdmc+");
background-color: crimson;
}
.ace_icon_svg.ace_security {
-webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0iZGFya29yYW5nZSIgZmlsbD0ibm9uZSIgc2hhcGUtcmVuZGVyaW5nPSJnZW9tZXRyaWNQcmVjaXNpb24iPgogICAgICAgIDxwYXRoIGNsYXNzPSJzdHJva2UtbGluZWpvaW4tcm91bmQiIGQ9Ik04IDE0LjgzMDdDOCAxNC44MzA3IDIgMTIuOTA0NyAyIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOEM3Ljk4OTk5IDEuMzQ5MTggMTAuNjkgMy4yNjU0OCAxNCAzLjI2NTQ4VjguMDg5OTJDMTQgMTIuOTA0NyA4IDE0LjgzMDcgOCAxNC44MzA3WiIvPgogICAgICAgIDxwYXRoIGQ9Ik0yIDguMDg5OTJWMy4yNjU0OEM1LjMxIDMuMjY1NDggNy45ODk5OSAxLjM0OTE4IDcuOTg5OTkgMS4zNDkxOCIvPgogICAgICAgIDxwYXRoIGQ9Ik0xMy45OSA4LjA4OTkyVjMuMjY1NDhDMTAuNjggMy4yNjU0OCA4IDEuMzQ5MTggOCAxLjM0OTE4Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggNFY5Ii8+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTggMTBWMTIiLz4KICAgIDwvZz4KPC9zdmc+");
background-color: crimson;
}
.ace_icon_svg.ace_warning {
-webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJkYXJrb3JhbmdlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+Cjxwb2x5Z29uIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGZpbGw9Im5vbmUiIHBvaW50cz0iOCAxIDE1IDE1IDEgMTUgOCAxIi8+CjxyZWN0IHg9IjgiIHk9IjEyIiB3aWR0aD0iMC4wMSIgaGVpZ2h0PSIwLjAxIi8+CjxsaW5lIHgxPSI4IiB5MT0iNiIgeDI9IjgiIHkyPSIxMCIvPgo8L2c+Cjwvc3ZnPg==");
background-color: darkorange;
}
.ace_icon_svg.ace_info {
-webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiI+CjxnIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlPSJibHVlIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CjxjaXJjbGUgZmlsbD0ibm9uZSIgY3g9IjgiIGN5PSI4IiByPSI3IiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjxwb2x5bGluZSBwb2ludHM9IjggMTEgOCA4Ii8+Cjxwb2x5bGluZSBwb2ludHM9IjkgOCA2IDgiLz4KPGxpbmUgeDE9IjEwIiB5MT0iMTEiIHgyPSI2IiB5Mj0iMTEiLz4KPHJlY3QgeD0iOCIgeT0iNSIgd2lkdGg9IjAuMDEiIGhlaWdodD0iMC4wMSIvPgo8L2c+Cjwvc3ZnPg==");
background-color: royalblue;
}
.ace_icon_svg.ace_hint {
-webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjAgMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgICA8ZyBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZT0ic2lsdmVyIiBmaWxsPSJub25lIiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiI+CiAgICAgICAgPHBhdGggY2xhc3M9InN0cm9rZS1saW5lam9pbi1yb3VuZCIgZD0iTTYgMTRIMTAiLz4KICAgICAgICA8cGF0aCBkPSJNOCAxMUg5QzkgOS40NzAwMiAxMiA4LjU0MDAyIDEyIDUuNzYwMDJDMTIuMDIgNC40MDAwMiAxMS4zOSAzLjM2MDAyIDEwLjQzIDIuNjcwMDJDOSAxLjY0MDAyIDcuMDAwMDEgMS42NDAwMiA1LjU3MDAxIDIuNjcwMDJDNC42MTAwMSAzLjM2MDAyIDMuOTggNC40MDAwMiA0IDUuNzYwMDJDNCA4LjU0MDAyIDcuMDAwMDEgOS40NzAwMiA3LjAwMDAxIDExSDhaIi8+CiAgICA8L2c+Cjwvc3ZnPg==");
background-color: silver;
}
.ace_icon_svg.ace_error_fold {
-webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSI+CiAgPHBhdGggZD0ibSAxOC45Mjk4NTEsNy44Mjk4MDc2IGMgMC4xNDYzNTMsNi4zMzc0NjA0IC02LjMyMzE0Nyw3Ljc3Nzg0NDQgLTcuNDc3OTEyLDcuNzc3ODQ0NCAtMi4xMDcyNzI2LC0wLjEyODc1IDUuMTE3Njc4LDAuMzU2MjQ5IDUuMDUxNjk4LC03Ljg3MDA2MTggLTAuNjA0NjcyLC04LjAwMzk3MzQ5IC03LjA3NzI3MDYsLTcuNTYzMTE4OSAtNC44NTczLC03LjQzMDM5NTU2IDEuNjA2LC0wLjExNTE0MjI1IDYuODk3NDg1LDEuMjYyNTQ1OTYgNy4yODM1MTQsNy41MjI2MTI5NiB6IiBmaWxsPSJjcmltc29uIiBzdHJva2Utd2lkdGg9IjIiLz4KICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0ibSA4LjExNDc1NjIsMi4wNTI5ODI4IGMgMy4zNDkxNjk4LDAgNi4wNjQxMzI4LDIuNjc2ODYyNyA2LjA2NDEzMjgsNS45Nzg5NTMgMCwzLjMwMjExMjIgLTIuNzE0OTYzLDUuOTc4OTIwMiAtNi4wNjQxMzI4LDUuOTc4OTIwMiAtMy4zNDkxNDczLDAgLTYuMDY0MTc3MiwtMi42NzY4MDggLTYuMDY0MTc3MiwtNS45Nzg5MjAyIDAuMDA1MzksLTMuMjk5ODg2MSAyLjcxNzI2NTYsLTUuOTczNjQwOCA2LjA2NDE3NzIsLTUuOTc4OTUzIHogbSAwLC0xLjczNTgyNzE5IGMgLTQuMzIxNDgzNiwwIC03LjgyNDc0MDM4LDMuNDU0MDE4NDkgLTcuODI0NzQwMzgsNy43MTQ3ODAxOSAwLDQuMjYwNzI4MiAzLjUwMzI1Njc4LDcuNzE0NzQ1MiA3LjgyNDc0MDM4LDcuNzE0NzQ1MiA0LjMyMTQ0OTgsMCA3LjgyNDY5OTgsLTMuNDU0MDE3IDcuODI0Njk5OCwtNy43MTQ3NDUyIDAsLTIuMDQ2MDkxNCAtMC44MjQzOTIsLTQuMDA4MzY3MiAtMi4yOTE3NTYsLTUuNDU1MTc0NiBDIDEyLjE4MDIyNSwxLjEyOTk2NDggMTAuMTkwMDEzLDAuMzE3MTU1NjEgOC4xMTQ3NTYyLDAuMzE3MTU1NjEgWiBNIDYuOTM3NDU2Myw4LjI0MDU5ODUgNC42NzE4Njg1LDEwLjQ4NTg1MiA2LjAwODY4MTQsMTEuODc2NzI4IDguMzE3MDAzNSw5LjYwMDc5MTEgMTAuNjI1MzM3LDExLjg3NjcyOCAxMS45NjIxMzgsMTAuNDg1ODUyIDkuNjk2NTUwOCw4LjI0MDU5ODUgMTEuOTYyMTM4LDYuMDA2ODA2NiAxMC41NzMyNDYsNC42Mzc0MzM1IDguMzE3MDAzNSw2Ljg3MzQyOTcgNi4wNjA3NjA3LDQuNjM3NDMzNSA0LjY3MTg2ODUsNi4wMDY4MDY2IFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");
background-color: crimson;
}
.ace_icon_svg.ace_security_fold {
-webkit-mask-image: url("data:image/svg+xml;base64,CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB2aWV3Qm94PSIwIDAgMTcgMTQiIGZpbGw9Im5vbmUiPgogICAgPHBhdGggZD0iTTEwLjAwMDEgMTMuNjk5MkMxMC4wMDAxIDEzLjY5OTIgMTEuOTI0MSAxMy40NzYzIDEzIDEyLjY5OTJDMTQuNDEzOSAxMS42NzgxIDE2IDEwLjUgMTYuMTI1MSA2LjgxMTI2VjIuNTg5ODdDMTYuMTI1MSAyLjU0NzY4IDE2LjEyMjEgMi41MDYxOSAxNi4xMTY0IDIuNDY1NTlWMS43MTQ4NUgxNS4yNDE0TDE1LjIzMDcgMS43MTQ4NEwxNC42MjUxIDEuNjk5MjJWNi44MTEyM0MxNC42MjUxIDguNTEwNjEgMTQuNjI1MSA5LjQ2NDYxIDEyLjc4MjQgMTEuNzIxQzEyLjE1ODYgMTIuNDg0OCAxMC4wMDAxIDEzLjY5OTIgMTAuMDAwMSAxMy42OTkyWiIgZmlsbD0iY3JpbXNvbiIgc3Ryb2tlLXdpZHRoPSIyIi8+CiAgICA8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTcuMzM2MDkgMC4zNjc0NzVDNy4wMzIxNCAwLjE1MjY1MiA2LjYyNTQ4IDAuMTUzNjE0IDYuMzIyNTMgMC4zNjk5OTdMNi4zMDg2OSAwLjM3OTU1NEM2LjI5NTUzIDAuMzg4NTg4IDYuMjczODggMC40MDMyNjYgNi4yNDQxNyAwLjQyMjc4OUM2LjE4NDcxIDAuNDYxODYgNi4wOTMyMSAwLjUyMDE3MSA1Ljk3MzEzIDAuNTkxMzczQzUuNzMyNTEgMC43MzQwNTkgNS4zNzk5IDAuOTI2ODY0IDQuOTQyNzkgMS4xMjAwOUM0LjA2MTQ0IDEuNTA5NyAyLjg3NTQxIDEuODgzNzcgMS41ODk4NCAxLjg4Mzc3SDAuNzE0ODQ0VjIuNzU4NzdWNi45ODAxNUMwLjcxNDg0NCA5LjQ5Mzc0IDIuMjg4NjYgMTEuMTk3MyAzLjcwMjU0IDEyLjIxODVDNC40MTg0NSAxMi43MzU1IDUuMTI4NzQgMTMuMTA1MyA1LjY1NzMzIDEzLjM0NTdDNS45MjI4NCAxMy40NjY0IDYuMTQ1NjYgMTMuNTU1OSA2LjMwNDY1IDEzLjYxNjFDNi4zODQyMyAxMy42NDYyIDYuNDQ4MDUgMTMuNjY5IDYuNDkzNDkgMTMuNjg0OEM2LjUxNjIyIDEzLjY5MjcgNi41MzQzOCAxMy42OTg5IDYuNTQ3NjQgMTMuNzAzM0w2LjU2MzgyIDEzLjcwODdMNi41NjkwOCAxMy43MTA0TDYuNTcwOTkgMTMuNzExTDYuODM5ODQgMTMuNzUzM0w2LjU3MjQyIDEzLjcxMTVDNi43NDYzMyAxMy43NjczIDYuOTMzMzUgMTMuNzY3MyA3LjEwNzI3IDEzLjcxMTVMNy4xMDg3IDEzLjcxMUw3LjExMDYxIDEzLjcxMDRMNy4xMTU4NyAxMy43MDg3TDcuMTMyMDUgMTMuNzAzM0M3LjE0NTMxIDEzLjY5ODkgNy4xNjM0NiAxMy42OTI3IDcuMTg2MTkgMTMuNjg0OEM3LjIzMTY0IDEzLjY2OSA3LjI5NTQ2IDEzLjY0NjIgNy4zNzUwMyAxMy42MTYxQzcuNTM0MDMgMTMuNTU1OSA3Ljc1Njg1IDEzLjQ2NjQgOC4wMjIzNiAxMy4zNDU3QzguNTUwOTUgMTMuMTA1MyA5LjI2MTIzIDEyLjczNTUgOS45NzcxNSAxMi4yMTg1QzExLjM5MSAxMS4xOTczIDEyLjk2NDggOS40OTM3NyAxMi45NjQ4IDYuOTgwMThWMi43NTg4QzEyLjk2NDggMi43MTY2IDEyLjk2MTkgMi42NzUxMSAxMi45NTYxIDIuNjM0NTFWMS44ODM3N0gxMi4wODExQzEyLjA3NzUgMS44ODM3NyAxMi4wNzQgMS44ODM3NyAxMi4wNzA0IDEuODgzNzdDMTAuNzk3OSAxLjg4MDA0IDkuNjE5NjIgMS41MTEwMiA4LjczODk0IDEuMTI0ODZDOC43MzUzNCAxLjEyMzI3IDguNzMxNzQgMS4xMjE2OCA4LjcyODE0IDEuMTIwMDlDOC4yOTEwMyAwLjkyNjg2NCA3LjkzODQyIDAuNzM0MDU5IDcuNjk3NzkgMC41OTEzNzNDNy41Nzc3MiAwLjUyMDE3MSA3LjQ4NjIyIDAuNDYxODYgNy40MjY3NiAwLjQyMjc4OUM3LjM5NzA1IDAuNDAzMjY2IDcuMzc1MzkgMC4zODg1ODggNy4zNjIyNCAwLjM3OTU1NEw3LjM0ODk2IDAuMzcwMzVDNy4zNDg5NiAwLjM3MDM1IDcuMzQ4NDcgMC4zNzAwMiA3LjM0NTYzIDAuMzc0MDU0TDcuMzM3NzkgMC4zNjg2NTlMNy4zMzYwOSAwLjM2NzQ3NVpNOC4wMzQ3MSAyLjcyNjkxQzguODYwNCAzLjA5MDYzIDkuOTYwNjYgMy40NjMwOSAxMS4yMDYxIDMuNTg5MDdWNi45ODAxNUgxMS4yMTQ4QzExLjIxNDggOC42Nzk1MyAxMC4xNjM3IDkuOTI1MDcgOC45NTI1NCAxMC43OTk4QzguMzU1OTUgMTEuMjMwNiA3Ljc1Mzc0IDExLjU0NTQgNy4yOTc5NiAxMS43NTI3QzcuMTE2NzEgMTEuODM1MSA2Ljk2MDYyIDExLjg5OTYgNi44Mzk4NCAxMS45NDY5QzYuNzE5MDYgMTEuODk5NiA2LjU2Mjk3IDExLjgzNTEgNi4zODE3MyAxMS43NTI3QzUuOTI1OTUgMTEuNTQ1NCA1LjMyMzczIDExLjIzMDYgNC43MjcxNSAxMC43OTk4QzMuNTE2MDMgOS45MjUwNyAyLjQ2NDg0IDguNjc5NTUgMi40NjQ4NCA2Ljk4MDE4VjMuNTg5MDlDMy43MTczOCAzLjQ2MjM5IDQuODIzMDggMy4wODYzOSA1LjY1MDMzIDIuNzIwNzFDNi4xNDIyOCAyLjUwMzI0IDYuNTQ0ODUgMi4yODUzNyA2LjgzMjU0IDIuMTE2MjRDNy4xMjE4MSAyLjI4NTM1IDcuNTI3IDIuNTAzNTIgOC4wMjE5NiAyLjcyMTMxQzguMDI2MiAyLjcyMzE3IDguMDMwNDUgMi43MjUwNCA4LjAzNDcxIDIuNzI2OTFaTTUuOTY0ODQgMy40MDE0N1Y3Ljc3NjQ3SDcuNzE0ODRWMy40MDE0N0g1Ljk2NDg0Wk01Ljk2NDg0IDEwLjQwMTVWOC42NTE0N0g3LjcxNDg0VjEwLjQwMTVINS45NjQ4NFoiIGZpbGw9ImNyaW1zb24iIHN0cm9rZS13aWR0aD0iMiIvPgo8L3N2Zz4=");
background-color: crimson;
}
.ace_icon_svg.ace_warning_fold {
-webkit-mask-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAyMCAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNC43NzY5IDE0LjczMzdMOC42NTE5MiAyLjQ4MzY5QzguMzI5NDYgMS44Mzg3NyA3LjQwOTEzIDEuODM4NzcgNy4wODY2NyAyLjQ4MzY5TDAuOTYxNjY5IDE0LjczMzdDMC42NzA3NzUgMTUuMzE1NSAxLjA5MzgzIDE2IDEuNzQ0MjkgMTZIMTMuOTk0M0MxNC42NDQ4IDE2IDE1LjA2NzggMTUuMzE1NSAxNC43NzY5IDE0LjczMzdaTTMuMTYwMDcgMTQuMjVMNy44NjkyOSA0LjgzMTU2TDEyLjU3ODUgMTQuMjVIMy4xNjAwN1pNOC43NDQyOSAxMS42MjVWMTMuMzc1SDYuOTk0MjlWMTEuNjI1SDguNzQ0MjlaTTYuOTk0MjkgMTAuNzVWNy4yNUg4Ljc0NDI5VjEwLjc1SDYuOTk0MjlaIiBmaWxsPSIjRUM3MjExIi8+CjxwYXRoIGQ9Ik0xMS4xOTkxIDIuOTUyMzhDMTAuODgwOSAyLjMxNDY3IDEwLjM1MzcgMS44MDUyNiA5LjcwNTUgMS41MDlMMTEuMDQxIDEuMDY5NzhDMTEuNjg4MyAwLjk0OTgxNCAxMi4zMzcgMS4yNzI2MyAxMi42MzE3IDEuODYxNDFMMTcuNjEzNiAxMS44MTYxQzE4LjM1MjcgMTMuMjkyOSAxNy41OTM4IDE1LjA4MDQgMTYuMDE4IDE1LjU3NDVDMTYuNDA0NCAxNC40NTA3IDE2LjMyMzEgMTMuMjE4OCAxNS43OTI0IDEyLjE1NTVMMTEuMTk5MSAyLjk1MjM4WiIgZmlsbD0iI0VDNzIxMSIvPgo8L3N2Zz4=");
background-color: darkorange;
}
.ace_scrollbar {
contain: strict;
position: absolute;
right: 0;
bottom: 0;
z-index: 6;
}
.ace_scrollbar-inner {
position: absolute;
cursor: text;
left: 0;
top: 0;
}
.ace_scrollbar-v{
overflow-x: hidden;
overflow-y: scroll;
top: 0;
}
.ace_scrollbar-h {
overflow-x: scroll;
overflow-y: hidden;
left: 0;
}
.ace_print-margin {
position: absolute;
height: 100%;
}
.ace_text-input {
position: absolute;
z-index: 0;
width: 0.5em;
height: 1em;
opacity: 0;
background: transparent;
-moz-appearance: none;
appearance: none;
border: none;
resize: none;
outline: none;
overflow: hidden;
font: inherit;
padding: 0 1px;
margin: 0 -1px;
contain: strict;
-ms-user-select: text;
-moz-user-select: text;
-webkit-user-select: text;
user-select: text;
/*with \`pre-line\` chrome inserts instead of space*/
white-space: pre!important;
}
.ace_text-input.ace_composition {
background: transparent;
color: inherit;
z-index: 1000;
opacity: 1;
}
.ace_composition_placeholder { color: transparent }
.ace_composition_marker {
border-bottom: 1px solid;
position: absolute;
border-radius: 0;
margin-top: 1px;
}
[ace_nocontext=true] {
transform: none!important;
filter: none!important;
clip-path: none!important;
mask : none!important;
contain: none!important;
perspective: none!important;
mix-blend-mode: initial!important;
z-index: auto;
}
.ace_layer {
z-index: 1;
position: absolute;
overflow: hidden;
/* workaround for chrome bug https://github.com/ajaxorg/ace/issues/2312*/
word-wrap: normal;
white-space: pre;
height: 100%;
width: 100%;
box-sizing: border-box;
/* setting pointer-events: auto; on node under the mouse, which changes
during scroll, will break mouse wheel scrolling in Safari */
pointer-events: none;
}
.ace_gutter-layer {
position: relative;
width: auto;
text-align: right;
pointer-events: auto;
height: 1000000px;
contain: style size layout;
}
.ace_text-layer {
font: inherit !important;
position: absolute;
height: 1000000px;
width: 1000000px;
contain: style size layout;
}
.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {
contain: style size layout;
position: absolute;
top: 0;
left: 0;
right: 0;
}
.ace_hidpi .ace_text-layer,
.ace_hidpi .ace_gutter-layer,
.ace_hidpi .ace_content,
.ace_hidpi .ace_gutter {
contain: strict;
}
.ace_hidpi .ace_text-layer > .ace_line,
.ace_hidpi .ace_text-layer > .ace_line_group {
contain: strict;
}
.ace_cjk {
display: inline-block;
text-align: center;
}
.ace_cursor-layer {
z-index: 4;
}
.ace_cursor {
z-index: 4;
position: absolute;
box-sizing: border-box;
border-left: 2px solid;
/* workaround for smooth cursor repaintng whole screen in chrome */
transform: translatez(0);
}
.ace_multiselect .ace_cursor {
border-left-width: 1px;
}
.ace_slim-cursors .ace_cursor {
border-left-width: 1px;
}
.ace_overwrite-cursors .ace_cursor {
border-left-width: 0;
border-bottom: 1px solid;
}
.ace_hidden-cursors .ace_cursor {
opacity: 0.2;
}
.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {
opacity: 0;
}
.ace_smooth-blinking .ace_cursor {
transition: opacity 0.18s;
}
.ace_animate-blinking .ace_cursor {
animation-duration: 1000ms;
animation-timing-function: step-end;
animation-name: blink-ace-animate;
animation-iteration-count: infinite;
}
.ace_animate-blinking.ace_smooth-blinking .ace_cursor {
animation-duration: 1000ms;
animation-timing-function: ease-in-out;
animation-name: blink-ace-animate-smooth;
}
@keyframes blink-ace-animate {
from, to { opacity: 1; }
60% { opacity: 0; }
}
@keyframes blink-ace-animate-smooth {
from, to { opacity: 1; }
45% { opacity: 1; }
60% { opacity: 0; }
85% { opacity: 0; }
}
.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {
position: absolute;
z-index: 3;
}
.ace_marker-layer .ace_selection {
position: absolute;
z-index: 5;
}
.ace_marker-layer .ace_bracket {
position: absolute;
z-index: 6;
}
.ace_marker-layer .ace_error_bracket {
position: absolute;
border-bottom: 1px solid #DE5555;
border-radius: 0;
}
.ace_marker-layer .ace_active-line {
position: absolute;
z-index: 2;
}
.ace_marker-layer .ace_selected-word {
position: absolute;
z-index: 4;
box-sizing: border-box;
}
.ace_line .ace_fold {
box-sizing: border-box;
display: inline-block;
height: 11px;
margin-top: -2px;
vertical-align: middle;
background-image:
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");
background-repeat: no-repeat, repeat-x;
background-position: center center, top left;
color: transparent;
border: 1px solid black;
border-radius: 2px;
cursor: pointer;
pointer-events: auto;
}
.ace_dark .ace_fold {
}
.ace_fold:hover{
background-image:
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");
}
.ace_tooltip {
background-color: #f5f5f5;
border: 1px solid gray;
border-radius: 1px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
color: black;
padding: 3px 4px;
position: fixed;
z-index: 999999;
box-sizing: border-box;
cursor: default;
white-space: pre-wrap;
word-wrap: break-word;
line-height: normal;
font-style: normal;
font-weight: normal;
letter-spacing: normal;
pointer-events: none;
overflow: auto;
max-width: min(33em, 66vw);
overscroll-behavior: contain;
}
.ace_tooltip pre {
white-space: pre-wrap;
}
.ace_tooltip.ace_dark {
background-color: #636363;
color: #fff;
}
.ace_tooltip:focus {
outline: 1px solid #5E9ED6;
}
.ace_icon {
display: inline-block;
width: 18px;
vertical-align: top;
}
.ace_icon_svg {
display: inline-block;
width: 12px;
vertical-align: top;
-webkit-mask-repeat: no-repeat;
-webkit-mask-size: 12px;
-webkit-mask-position: center;
}
.ace_folding-enabled > .ace_gutter-cell, .ace_folding-enabled > .ace_gutter-cell_svg-icons {
padding-right: 13px;
}
.ace_fold-widget, .ace_custom-widget {
box-sizing: border-box;
margin: 0 -12px 0 1px;
display: none;
width: 11px;
vertical-align: top;
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");
background-repeat: no-repeat;
background-position: center;
border-radius: 3px;
border: 1px solid transparent;
cursor: pointer;
pointer-events: auto;
}
.ace_custom-widget {
background: none;
}
.ace_folding-enabled .ace_fold-widget {
display: inline-block;
}
.ace_fold-widget.ace_end {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");
}
.ace_fold-widget.ace_closed {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");
}
.ace_fold-widget:hover {
border: 1px solid rgba(0, 0, 0, 0.3);
background-color: rgba(255, 255, 255, 0.2);
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
}
.ace_fold-widget:active {
border: 1px solid rgba(0, 0, 0, 0.4);
background-color: rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}
/**
* Dark version for fold widgets
*/
.ace_dark .ace_fold-widget {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");
}
.ace_dark .ace_fold-widget.ace_end {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget.ace_closed {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");
}
.ace_dark .ace_fold-widget:hover {
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
background-color: rgba(255, 255, 255, 0.1);
}
.ace_dark .ace_fold-widget:active {
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
}
.ace_inline_button {
border: 1px solid lightgray;
display: inline-block;
margin: -1px 8px;
padding: 0 5px;
pointer-events: auto;
cursor: pointer;
}
.ace_inline_button:hover {
border-color: gray;
background: rgba(200,200,200,0.2);
display: inline-block;
pointer-events: auto;
}
.ace_fold-widget.ace_invalid {
background-color: #FFB4B4;
border-color: #DE5555;
}
.ace_fade-fold-widgets .ace_fold-widget {
transition: opacity 0.4s ease 0.05s;
opacity: 0;
}
.ace_fade-fold-widgets:hover .ace_fold-widget {
transition: opacity 0.05s ease 0.05s;
opacity:1;
}
.ace_underline {
text-decoration: underline;
}
.ace_bold {
font-weight: bold;
}
.ace_nobold .ace_bold {
font-weight: normal;
}
.ace_italic {
font-style: italic;
}
.ace_error-marker {
background-color: rgba(255, 0, 0,0.2);
position: absolute;
z-index: 9;
}
.ace_highlight-marker {
background-color: rgba(255, 255, 0,0.2);
position: absolute;
z-index: 8;
}
.ace_mobile-menu {
position: absolute;
line-height: 1.5;
border-radius: 4px;
-ms-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
background: white;
box-shadow: 1px 3px 2px grey;
border: 1px solid #dcdcdc;
color: black;
}
.ace_dark > .ace_mobile-menu {
background: #333;
color: #ccc;
box-shadow: 1px 3px 2px grey;
border: 1px solid #444;
}
.ace_mobile-button {
padding: 2px;
cursor: pointer;
overflow: hidden;
}
.ace_mobile-button:hover {
background-color: #eee;
opacity:1;
}
.ace_mobile-button:active {
background-color: #ddd;
}
.ace_placeholder {
position: relative;
font-family: arial;
transform: scale(0.9);
transform-origin: left;
white-space: pre;
opacity: 0.7;
margin: 0 10px;
z-index: 1;
}
.ace_ghost_text {
opacity: 0.5;
font-style: italic;
}
.ace_ghost_text_container > div {
white-space: pre;
}
.ghost_text_line_wrapped::after {
content: "↩";
position: absolute;
}
.ace_lineWidgetContainer.ace_ghost_text {
margin: 0px 4px
}
.ace_screenreader-only {
position:absolute;
left:-10000px;
top:auto;
width:1px;
height:1px;
overflow:hidden;
}
.ace_hidden_token {
display: none;
}`}),ace.define("ace/layer/decorators",["require","exports","module","ace/lib/dom","ace/lib/oop","ace/lib/event_emitter"],function(t,n,f){var i=t("../lib/dom"),o=t("../lib/oop"),p=t("../lib/event_emitter").EventEmitter,s=(function(){function u(r,a){this.renderer=a,this.pixelRatio=1,this.maxHeight=a.layerConfig.maxHeight,this.lineHeight=a.layerConfig.lineHeight,this.minDecorationHeight=2*this.pixelRatio|0,this.halfMinDecorationHeight=this.minDecorationHeight/2|0,this.colors={},this.colors.dark={error:"rgba(255, 18, 18, 1)",warning:"rgba(18, 136, 18, 1)",info:"rgba(18, 18, 136, 1)"},this.colors.light={error:"rgb(255,51,51)",warning:"rgb(32,133,72)",info:"rgb(35,68,138)"},this.setScrollBarV(r)}return u.prototype.$createCanvas=function(){this.canvas=i.createElement("canvas"),this.canvas.style.top="0px",this.canvas.style.right="0px",this.canvas.style.zIndex="7",this.canvas.style.position="absolute"},u.prototype.setScrollBarV=function(r){this.$createCanvas(),this.scrollbarV=r,r.element.appendChild(this.canvas),this.setDimensions()},u.prototype.$updateDecorators=function(r){if(typeof this.canvas.getContext!="function")return;var a=this.renderer.theme.isDark===!0?this.colors.dark:this.colors.light;this.setDimensions(r);var l=this.canvas.getContext("2d");function d(k,x){return k.priority<x.priority?-1:k.priority>x.priority?1:0}var c=this.renderer.session.$annotations;if(l.clearRect(0,0,this.canvas.width,this.canvas.height),c){var m={info:1,warning:2,error:3};c.forEach(function(k){k.priority=m[k.type]||null}),c=c.sort(d);for(var g=0;g<c.length;g++){var v=c[g].row,b=this.getVerticalOffsetForRow(v),E=b+this.lineHeight,S=Math.round(this.heightRatio*b),w=Math.round(this.heightRatio*E),y=Math.round((S+w)/2),D=w-y;D<this.halfMinDecorationHeight&&(D=this.halfMinDecorationHeight),y-D<0&&(y=D),y+D>this.canvasHeight&&(y=this.canvasHeight-D);var $=y-D,A=y+D,_=A-$;l.fillStyle=a[c[g].type]||null,l.fillRect(0,$,Math.round(this.oneZoneWidth-1),_)}}var L=this.renderer.session.selection.getCursor();if(L){var T=Math.round(this.getVerticalOffsetForRow(L.row)*this.heightRatio);l.fillStyle="rgba(0, 0, 0, 0.5)",l.fillRect(0,T,this.canvasWidth,2)}},u.prototype.getVerticalOffsetForRow=function(r){r=r|0;var a=this.renderer.session.documentToScreenRow(r,0)*this.lineHeight;return a},u.prototype.setDimensions=function(r){r=r||this.renderer.layerConfig,this.maxHeight=r.maxHeight,this.lineHeight=r.lineHeight,this.canvasHeight=r.height,this.canvasWidth=this.scrollbarV.width||this.canvasWidth,this.setZoneWidth(),this.canvas.width=this.canvasWidth,this.canvas.height=this.canvasHeight,this.maxHeight<this.canvasHeight?this.heightRatio=1:this.heightRatio=this.canvasHeight/this.maxHeight},u.prototype.setZoneWidth=function(){this.oneZoneWidth=this.canvasWidth},u.prototype.destroy=function(){this.canvas.parentNode.removeChild(this.canvas)},u})();o.implement(s.prototype,p),n.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(t,n,f){var i=t("./lib/oop"),o=t("./lib/dom"),p=t("./lib/lang"),s=t("./config"),u=t("./layer/gutter").Gutter,r=t("./layer/marker").Marker,a=t("./layer/text").Text,l=t("./layer/cursor").Cursor,d=t("./scrollbar").HScrollBar,c=t("./scrollbar").VScrollBar,m=t("./scrollbar_custom").HScrollBar,g=t("./scrollbar_custom").VScrollBar,v=t("./renderloop").RenderLoop,b=t("./layer/font_metrics").FontMetrics,E=t("./lib/event_emitter").EventEmitter,S=t("./css/editor-css"),w=t("./layer/decorators").Decorator,y=t("./lib/useragent"),D=t("./layer/text_util").isTextToken;o.importCssString(S,"ace_editor.css",!1);var $=(function(){function A(_,L){var T=this;this.container=_||o.createElement("div"),o.addCssClass(this.container,"ace_editor"),o.HI_DPI&&o.addCssClass(this.container,"ace_hidpi"),this.setTheme(L),s.get("useStrictCSP")==null&&s.set("useStrictCSP",!1),this.$gutter=o.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden","true"),this.scroller=o.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=o.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new u(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new r(this.content);var k=this.$textLayer=new a(this.content);this.canvas=k.element,this.$markerFront=new r(this.content),this.$cursorLayer=new l(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new c(this.container,this),this.scrollBarH=new d(this.container,this),this.scrollBarV.on("scroll",function(x){T.$scrollAnimation||T.session.setScrollTop(x.data-T.scrollMargin.top)}),this.scrollBarH.on("scroll",function(x){T.$scrollAnimation||T.session.setScrollLeft(x.data-T.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new b(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.on("changeCharacterSize",function(x){T.updateCharacterSize(),T.onResize(!0,T.gutterWidth,T.$size.width,T.$size.height),T._signal("changeCharacterSize",x)}),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=!y.isIOS,this.$loop=new v(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 A.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(),o.setStyle(this.scroller.style,"line-height",this.lineHeight+"px")},A.prototype.setSession=function(_){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=_,_&&this.scrollMargin.top&&_.getScrollTop()<=0&&_.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(_),this.$markerBack.setSession(_),this.$markerFront.setSession(_),this.$gutterLayer.setSession(_),this.$textLayer.setSession(_),_&&(this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode))},A.prototype.updateLines=function(_,L,T){if(L===void 0&&(L=1/0),this.$changedLines?(this.$changedLines.firstRow>_&&(this.$changedLines.firstRow=_),this.$changedLines.lastRow<L&&(this.$changedLines.lastRow=L)):this.$changedLines={firstRow:_,lastRow:L},this.$changedLines.lastRow<this.layerConfig.firstRow)if(T)this.$changedLines.lastRow=this.layerConfig.lastRow;else return;this.$changedLines.firstRow>this.layerConfig.lastRow||this.$loop.schedule(this.CHANGE_LINES)},A.prototype.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},A.prototype.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},A.prototype.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},A.prototype.updateFull=function(_){_?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},A.prototype.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},A.prototype.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},A.prototype.onResize=function(_,L,T,k){if(!(this.resizing>2)){this.resizing>0?this.resizing++:this.resizing=_?1:0;var x=this.container;k||(k=x.clientHeight||x.scrollHeight),!k&&this.$maxLines&&this.lineHeight>1&&(!x.style.height||x.style.height=="0px")&&(x.style.height="1px",k=x.clientHeight||x.scrollHeight),T||(T=x.clientWidth||x.scrollWidth);var C=this.$updateCachedSize(_,L,T,k);if(this.$resizeTimer&&this.$resizeTimer.cancel(),!this.$size.scrollerHeight||!T&&!k)return this.resizing=0;_&&(this.$gutterLayer.$padding=null),_?this.$renderChanges(C|this.$changes,!0):this.$loop.schedule(C|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.$customScrollbar&&this.$updateCustomScrollbar(!0)}},A.prototype.$updateCachedSize=function(_,L,T,k){k-=this.$extraHeight||0;var x=0,C=this.$size,M={width:C.width,height:C.height,scrollerHeight:C.scrollerHeight,scrollerWidth:C.scrollerWidth};if(k&&(_||C.height!=k)&&(C.height=k,x|=this.CHANGE_SIZE,C.scrollerHeight=C.height,this.$horizScroll&&(C.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.setHeight(C.scrollerHeight),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",x=x|this.CHANGE_SCROLL),T&&(_||C.width!=T)){x|=this.CHANGE_SIZE,C.width=T,L==null&&(L=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=L,o.setStyle(this.scrollBarH.element.style,"left",L+"px"),o.setStyle(this.scroller.style,"left",L+this.margin.left+"px"),C.scrollerWidth=Math.max(0,T-L-this.scrollBarV.getWidth()-this.margin.h),o.setStyle(this.$gutter.style,"left",this.margin.left+"px");var F=this.scrollBarV.getWidth()+"px";o.setStyle(this.scrollBarH.element.style,"right",F),o.setStyle(this.scroller.style,"right",F),o.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight()),this.scrollBarH.setWidth(C.scrollerWidth),(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||_)&&(x|=this.CHANGE_FULL)}return C.$dirty=!T||!k,x&&this._signal("resize",M),x},A.prototype.onGutterResize=function(_){var L=this.$showGutter?_:0;L!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,L,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()},A.prototype.adjustWrapLimit=function(){var _=this.$size.scrollerWidth-this.$padding*2,L=Math.floor(_/this.characterWidth);return this.session.adjustWrapLimit(L,this.$showPrintMargin&&this.$printMarginColumn)},A.prototype.setAnimatedScroll=function(_){this.setOption("animatedScroll",_)},A.prototype.getAnimatedScroll=function(){return this.$animatedScroll},A.prototype.setShowInvisibles=function(_){this.setOption("showInvisibles",_),this.session.$bidiHandler.setShowInvisibles(_)},A.prototype.getShowInvisibles=function(){return this.getOption("showInvisibles")},A.prototype.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},A.prototype.setDisplayIndentGuides=function(_){this.setOption("displayIndentGuides",_)},A.prototype.getHighlightIndentGuides=function(){return this.getOption("highlightIndentGuides")},A.prototype.setHighlightIndentGuides=function(_){this.setOption("highlightIndentGuides",_)},A.prototype.setShowPrintMargin=function(_){this.setOption("showPrintMargin",_)},A.prototype.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},A.prototype.setPrintMarginColumn=function(_){this.setOption("printMarginColumn",_)},A.prototype.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},A.prototype.getShowGutter=function(){return this.getOption("showGutter")},A.prototype.setShowGutter=function(_){return this.setOption("showGutter",_)},A.prototype.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},A.prototype.setFadeFoldWidgets=function(_){this.setOption("fadeFoldWidgets",_)},A.prototype.setHighlightGutterLine=function(_){this.setOption("highlightGutterLine",_)},A.prototype.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},A.prototype.$updatePrintMargin=function(){if(!(!this.$showPrintMargin&&!this.$printMarginEl)){if(!this.$printMarginEl){var _=o.createElement("div");_.className="ace_layer ace_print-margin-layer",this.$printMarginEl=o.createElement("div"),this.$printMarginEl.className="ace_print-margin",_.appendChild(this.$printMarginEl),this.content.insertBefore(_,this.content.firstChild)}var L=this.$printMarginEl.style;L.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",L.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&this.session.$wrap==-1&&this.adjustWrapLimit()}},A.prototype.getContainerElement=function(){return this.container},A.prototype.getMouseEventTarget=function(){return this.scroller},A.prototype.getTextAreaContainer=function(){return this.container},A.prototype.$moveTextAreaToCursor=function(){if(!this.$isMousePressed){var _=this.textarea.style,L=this.$composition;if(!this.$keepTextAreaAtCursor&&!L){o.translate(this.textarea,-100,0);return}var T=this.$cursorLayer.$pixelPos;if(T){L&&L.markerRange&&(T=this.$cursorLayer.getPixelPosition(L.markerRange.start,!0));var k=this.layerConfig,x=T.top,C=T.left;x-=k.offset;var M=L&&L.useTextareaForIME||y.isMobile?this.lineHeight:1;if(x<0||x>k.height-M){o.translate(this.textarea,0,0);return}var F=1,R=this.$size.height-M;if(!L)x+=this.lineHeight;else if(L.useTextareaForIME){var O=this.textarea.value;F=this.characterWidth*this.session.$getStringScreenWidth(O)[0]}else x+=this.lineHeight+2;C-=this.scrollLeft,C>this.$size.scrollerWidth-F&&(C=this.$size.scrollerWidth-F),C+=this.gutterWidth+this.margin.left,o.setStyle(_,"height",M+"px"),o.setStyle(_,"width",F+"px"),o.translate(this.textarea,Math.min(C,this.$size.scrollerWidth-F),Math.min(x,R))}}},A.prototype.getFirstVisibleRow=function(){return this.layerConfig.firstRow},A.prototype.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},A.prototype.getLastFullyVisibleRow=function(){var _=this.layerConfig,L=_.lastRow,T=this.session.documentToScreenRow(L,0)*_.lineHeight;return T-this.session.getScrollTop()>_.height-_.lineHeight?L-1:L},A.prototype.getLastVisibleRow=function(){return this.layerConfig.lastRow},A.prototype.setPadding=function(_){this.$padding=_,this.$textLayer.setPadding(_),this.$cursorLayer.setPadding(_),this.$markerFront.setPadding(_),this.$markerBack.setPadding(_),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},A.prototype.setScrollMargin=function(_,L,T,k){var x=this.scrollMargin;x.top=_|0,x.bottom=L|0,x.right=k|0,x.left=T|0,x.v=x.top+x.bottom,x.h=x.left+x.right,x.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-x.top),this.updateFull()},A.prototype.setMargin=function(_,L,T,k){var x=this.margin;x.top=_|0,x.bottom=L|0,x.right=k|0,x.left=T|0,x.v=x.top+x.bottom,x.h=x.left+x.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},A.prototype.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},A.prototype.setHScrollBarAlwaysVisible=function(_){this.setOption("hScrollBarAlwaysVisible",_)},A.prototype.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},A.prototype.setVScrollBarAlwaysVisible=function(_){this.setOption("vScrollBarAlwaysVisible",_)},A.prototype.$updateScrollBarV=function(){var _=this.layerConfig.maxHeight,L=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(_-=(L-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>_-L&&(_=this.scrollTop+L,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(_+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},A.prototype.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},A.prototype.freeze=function(){this.$frozen=!0},A.prototype.unfreeze=function(){this.$frozen=!1},A.prototype.$renderChanges=function(_,L){if(this.$changes&&(_|=this.$changes,this.$changes=0),!this.session||!this.container.offsetWidth||this.$frozen||!_&&!L){this.$changes|=_;return}if(this.$size.$dirty)return this.$changes|=_,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",_),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var T=this.layerConfig;if(_&this.CHANGE_FULL||_&this.CHANGE_SIZE||_&this.CHANGE_TEXT||_&this.CHANGE_LINES||_&this.CHANGE_SCROLL||_&this.CHANGE_H_SCROLL){if(_|=this.$computeLayerConfig()|this.$loop.clear(),T.firstRow!=this.layerConfig.firstRow&&T.firstRowScreen==this.layerConfig.firstRowScreen){var k=this.scrollTop+(T.firstRow-Math.max(this.layerConfig.firstRow,0))*this.lineHeight;k>0&&(this.scrollTop=k,_=_|this.CHANGE_SCROLL,_|=this.$computeLayerConfig()|this.$loop.clear())}T=this.layerConfig,this.$updateScrollBarV(),_&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),o.translate(this.content,-this.scrollLeft,-T.offset);var x=T.width+2*this.$padding+"px",C=T.minHeight+"px";o.setStyle(this.content.style,"width",x),o.setStyle(this.content.style,"height",C)}if(_&this.CHANGE_H_SCROLL&&(o.translate(this.content,-this.scrollLeft,-T.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller ":"ace_scroller ace_scroll-left ",this.enableKeyboardAccessibility&&(this.scroller.className+=this.keyboardFocusClassName)),_&this.CHANGE_FULL){this.$changedLines=null,this.$textLayer.update(T),this.$showGutter&&this.$gutterLayer.update(T),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(T),this.$markerBack.update(T),this.$markerFront.update(T),this.$cursorLayer.update(T),this.$moveTextAreaToCursor(),this._signal("afterRender",_);return}if(_&this.CHANGE_SCROLL){this.$changedLines=null,_&this.CHANGE_TEXT||_&this.CHANGE_LINES?this.$textLayer.update(T):this.$textLayer.scrollLines(T),this.$showGutter&&(_&this.CHANGE_GUTTER||_&this.CHANGE_LINES?this.$gutterLayer.update(T):this.$gutterLayer.scrollLines(T)),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(T),this.$markerBack.update(T),this.$markerFront.update(T),this.$cursorLayer.update(T),this.$moveTextAreaToCursor(),this._signal("afterRender",_);return}_&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(T),this.$showGutter&&this.$gutterLayer.update(T),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(T)):_&this.CHANGE_LINES?((this.$updateLines()||_&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(T),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(T)):_&this.CHANGE_TEXT||_&this.CHANGE_GUTTER?(this.$showGutter&&this.$gutterLayer.update(T),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(T)):_&this.CHANGE_CURSOR&&(this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(T),this.$customScrollbar&&this.$scrollDecorator.$updateDecorators(T)),_&this.CHANGE_CURSOR&&(this.$cursorLayer.update(T),this.$moveTextAreaToCursor()),_&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(T),_&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(T),this._signal("afterRender",_)},A.prototype.$autosize=function(){var _=this.session.getScreenLength()*this.lineHeight,L=this.$maxLines*this.lineHeight,T=Math.min(L,Math.max((this.$minLines||1)*this.lineHeight,_))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(T+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&T>this.$maxPixelHeight&&(T=this.$maxPixelHeight);var k=T<=2*this.lineHeight,x=!k&&_>L;if(T!=this.desiredHeight||this.$size.height!=this.desiredHeight||x!=this.$vScroll){x!=this.$vScroll&&(this.$vScroll=x,this.scrollBarV.setVisible(x));var C=this.container.clientWidth;this.container.style.height=T+"px",this.$updateCachedSize(!0,this.$gutterWidth,C,T),this.desiredHeight=T,this._signal("autosize")}},A.prototype.$computeLayerConfig=function(){var _=this.session,L=this.$size,T=L.height<=2*this.lineHeight,k=this.session.getScreenLength(),x=k*this.lineHeight,C=this.$getLongestLine(),M=!T&&(this.$hScrollBarAlwaysVisible||L.scrollerWidth-C-2*this.$padding<0),F=this.$horizScroll!==M;F&&(this.$horizScroll=M,this.scrollBarH.setVisible(M));var R=this.$vScroll;this.$maxLines&&this.lineHeight>1&&(this.$autosize(),T=L.height<=2*this.lineHeight);var O=L.scrollerHeight+this.lineHeight,B=!this.$maxLines&&this.$scrollPastEnd?(L.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;x+=B;var N=this.scrollMargin;this.session.setScrollTop(Math.max(-N.top,Math.min(this.scrollTop,x-L.scrollerHeight+N.bottom))),this.session.setScrollLeft(Math.max(-N.left,Math.min(this.scrollLeft,C+2*this.$padding-L.scrollerWidth+N.right)));var j=!T&&(this.$vScrollBarAlwaysVisible||L.scrollerHeight-x+B<0||this.scrollTop>N.top),V=R!==j;V&&(this.$vScroll=j,this.scrollBarV.setVisible(j));var W=this.scrollTop%this.lineHeight,H=Math.ceil(O/this.lineHeight)-1,U=Math.max(0,Math.round((this.scrollTop-W)/this.lineHeight)),X=U+H,Y,Z,ne=this.lineHeight;U=_.screenToDocumentRow(U,0);var re=_.getFoldLine(U);re&&(U=re.start.row),Y=_.documentToScreenRow(U,0),Z=_.getRowLength(U)*ne,X=Math.min(_.screenToDocumentRow(X,0),_.getLength()-1),O=L.scrollerHeight+_.getRowLength(X)*ne+Z,W=this.scrollTop-Y*ne,W<0&&Y>0&&(Y=Math.max(0,Y+Math.floor(W/ne)),W=this.scrollTop-Y*ne);var le=0;return(this.layerConfig.width!=C||F)&&(le=this.CHANGE_H_SCROLL),(F||V)&&(le|=this.$updateCachedSize(!0,this.gutterWidth,L.width,L.height),this._signal("scrollbarVisibilityChanged"),V&&(C=this.$getLongestLine())),this.layerConfig={width:C,padding:this.$padding,firstRow:U,firstRowScreen:Y,lastRow:X,lineHeight:ne,characterWidth:this.characterWidth,minHeight:O,maxHeight:x,offset:W,gutterOffset:ne?Math.max(0,Math.ceil((W+L.height-L.scrollerHeight)/ne)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(C-this.$padding),le},A.prototype.$updateLines=function(){if(this.$changedLines){var _=this.$changedLines.firstRow,L=this.$changedLines.lastRow;this.$changedLines=null;var T=this.layerConfig;if(!(_>T.lastRow+1)&&!(L<T.firstRow)){if(L===1/0){this.$showGutter&&this.$gutterLayer.update(T),this.$textLayer.update(T);return}return this.$textLayer.updateLines(T,_,L),!0}}},A.prototype.$getLongestLine=function(){var _=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(_+=1),this.$textLayer&&_>this.$textLayer.MAX_LINE_LENGTH&&(_=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(_*this.characterWidth))},A.prototype.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},A.prototype.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},A.prototype.addGutterDecoration=function(_,L){this.$gutterLayer.addGutterDecoration(_,L)},A.prototype.removeGutterDecoration=function(_,L){this.$gutterLayer.removeGutterDecoration(_,L)},A.prototype.updateBreakpoints=function(_){this._rows=_,this.$loop.schedule(this.CHANGE_GUTTER)},A.prototype.setAnnotations=function(_){this.$gutterLayer.setAnnotations(_),this.$loop.schedule(this.CHANGE_GUTTER)},A.prototype.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},A.prototype.hideCursor=function(){this.$cursorLayer.hideCursor()},A.prototype.showCursor=function(){this.$cursorLayer.showCursor()},A.prototype.scrollSelectionIntoView=function(_,L,T){this.scrollCursorIntoView(_,T),this.scrollCursorIntoView(L,T)},A.prototype.scrollCursorIntoView=function(_,L,T){if(this.$size.scrollerHeight!==0){var k=this.$cursorLayer.getPixelPosition(_),x=k.left,C=k.top,M=T&&T.top||0,F=T&&T.bottom||0;this.$scrollAnimation&&(this.$stopAnimation=!0);var R=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;R+M>C?(L&&R+M>C+this.lineHeight&&(C-=L*this.$size.scrollerHeight),C===0&&(C=-this.scrollMargin.top),this.session.setScrollTop(C)):R+this.$size.scrollerHeight-F<C+this.lineHeight&&(L&&R+this.$size.scrollerHeight-F<C-this.lineHeight&&(C+=L*this.$size.scrollerHeight),this.session.setScrollTop(C+this.lineHeight+F-this.$size.scrollerHeight));var O=this.scrollLeft,B=2*this.layerConfig.characterWidth;x-B<O?(x-=B,x<this.$padding+B&&(x=-this.scrollMargin.left),this.session.setScrollLeft(x)):(x+=B,O+this.$size.scrollerWidth<x+this.characterWidth?this.session.setScrollLeft(Math.round(x+this.characterWidth-this.$size.scrollerWidth)):O<=this.$padding&&x-O<this.characterWidth&&this.session.setScrollLeft(0))}},A.prototype.getScrollTop=function(){return this.session.getScrollTop()},A.prototype.getScrollLeft=function(){return this.session.getScrollLeft()},A.prototype.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},A.prototype.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},A.prototype.scrollToRow=function(_){this.session.setScrollTop(_*this.lineHeight)},A.prototype.alignCursor=function(_,L){typeof _=="number"&&(_={row:_,column:0});var T=this.$cursorLayer.getPixelPosition(_),k=this.$size.scrollerHeight-this.lineHeight,x=T.top-k*(L||0);return this.session.setScrollTop(x),x},A.prototype.$calcSteps=function(_,L){var T=0,k=this.STEPS,x=[],C=function(M,F,R){return R*(Math.pow(M-1,3)+1)+F};for(T=0;T<k;++T)x.push(C(T/this.STEPS,_,L-_));return x},A.prototype.scrollToLine=function(_,L,T,k){var x=this.$cursorLayer.getPixelPosition({row:_,column:0}),C=x.top;L&&(C-=this.$size.scrollerHeight/2);var M=this.scrollTop;this.session.setScrollTop(C),T!==!1&&this.animateScrolling(M,k)},A.prototype.animateScrolling=function(_,L){var T=this.scrollTop;if(!this.$animatedScroll)return;var k=this;if(_==T)return;if(this.$scrollAnimation){var x=this.$scrollAnimation.steps;if(x.length&&(_=x[0],_==T))return}var C=k.$calcSteps(_,T);this.$scrollAnimation={from:_,to:T,steps:C},clearInterval(this.$timer),k.session.setScrollTop(C.shift()),k.session.$scrollTop=T;function M(){k.$timer=clearInterval(k.$timer),k.$scrollAnimation=null,k.$stopAnimation=!1,L&&L()}this.$timer=setInterval(function(){if(k.$stopAnimation){M();return}if(!k.session)return clearInterval(k.$timer);C.length?(k.session.setScrollTop(C.shift()),k.session.$scrollTop=T):T!=null?(k.session.$scrollTop=-1,k.session.setScrollTop(T),T=null):M()},10)},A.prototype.scrollToY=function(_){this.scrollTop!==_&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=_)},A.prototype.scrollToX=function(_){this.scrollLeft!==_&&(this.scrollLeft=_),this.$loop.schedule(this.CHANGE_H_SCROLL)},A.prototype.scrollTo=function(_,L){this.session.setScrollTop(L),this.session.setScrollLeft(_)},A.prototype.scrollBy=function(_,L){L&&this.session.setScrollTop(this.session.getScrollTop()+L),_&&this.session.setScrollLeft(this.session.getScrollLeft()+_)},A.prototype.isScrollableBy=function(_,L){if(L<0&&this.session.getScrollTop()>=1-this.scrollMargin.top||L>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom||_<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left||_>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},A.prototype.pixelToScreenCoordinates=function(_,L){var T;if(this.$hasCssTransforms){T={top:0,left:0};var k=this.$fontMetrics.transformCoordinates([_,L]);_=k[1]-this.gutterWidth-this.margin.left,L=k[0]}else T=this.scroller.getBoundingClientRect();var x=_+this.scrollLeft-T.left-this.$padding,C=x/this.characterWidth,M=Math.floor((L+this.scrollTop-T.top)/this.lineHeight),F=this.$blockCursor?Math.floor(C):Math.round(C);return{row:M,column:F,side:C-F>0?1:-1,offsetX:x}},A.prototype.screenToTextCoordinates=function(_,L){var T;if(this.$hasCssTransforms){T={top:0,left:0};var k=this.$fontMetrics.transformCoordinates([_,L]);_=k[1]-this.gutterWidth-this.margin.left,L=k[0]}else T=this.scroller.getBoundingClientRect();var x=_+this.scrollLeft-T.left-this.$padding,C=x/this.characterWidth,M=this.$blockCursor?Math.floor(C):Math.round(C),F=Math.floor((L+this.scrollTop-T.top)/this.lineHeight);return this.session.screenToDocumentPosition(F,Math.max(M,0),x)},A.prototype.textToScreenCoordinates=function(_,L){var T=this.scroller.getBoundingClientRect(),k=this.session.documentToScreenPosition(_,L),x=this.$padding+(this.session.$bidiHandler.isBidiRow(k.row,_)?this.session.$bidiHandler.getPosLeft(k.column):Math.round(k.column*this.characterWidth)),C=k.row*this.lineHeight;return{pageX:T.left+x-this.scrollLeft,pageY:T.top+C-this.scrollTop}},A.prototype.visualizeFocus=function(){o.addCssClass(this.container,"ace_focus")},A.prototype.visualizeBlur=function(){o.removeCssClass(this.container,"ace_focus")},A.prototype.showComposition=function(_){this.$composition=_,_.cssText||(_.cssText=this.textarea.style.cssText),_.useTextareaForIME==null&&(_.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(o.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):_.markerId=this.session.addMarker(_.markerRange,"ace_composition_marker","text")},A.prototype.setCompositionText=function(_){var L=this.session.selection.cursor;this.addToken(_,"composition_placeholder",L.row,L.column),this.$moveTextAreaToCursor()},A.prototype.hideComposition=function(){if(this.$composition){this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),o.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var _=this.session.selection.cursor;this.removeExtraToken(_.row,_.column),this.$composition=null,this.$cursorLayer.element.style.display=""}},A.prototype.setGhostText=function(_,L){var T=this.session.selection.cursor,k=L||{row:T.row,column:T.column};this.removeGhostText();var x=this.$calculateWrappedTextChunks(_,k);this.addToken(x[0].text,"ghost_text",k.row,k.column),this.$ghostText={text:_,position:{row:k.row,column:k.column}};var C=o.createElement("div");if(x.length>1){var M=this.hideTokensAfterPosition(k.row,k.column),F;x.slice(1).forEach(function(V){var W=o.createElement("div"),H=o.createElement("span");H.className="ace_ghost_text",V.wrapped&&(W.className="ghost_text_line_wrapped"),V.text.length===0&&(V.text=" "),H.appendChild(o.createTextNode(V.text)),W.appendChild(H),C.appendChild(W),F=W}),M.forEach(function(V){var W=o.createElement("span");D(V.type)||(W.className="ace_"+V.type.replace(/\./g," ace_")),W.appendChild(o.createTextNode(V.value)),F.appendChild(W)}),this.$ghostTextWidget={el:C,row:k.row,column:k.column,className:"ace_ghost_text_container"},this.session.widgetManager.addLineWidget(this.$ghostTextWidget);var R=this.$cursorLayer.getPixelPosition(k,!0),O=this.container,B=O.getBoundingClientRect().height,N=x.length*this.lineHeight,j=N<B-R.top;if(j)return;N<B?this.scrollBy(0,(x.length-1)*this.lineHeight):this.scrollToRow(k.row)}},A.prototype.$calculateWrappedTextChunks=function(_,L){var T=this.$size.scrollerWidth-this.$padding*2,k=Math.floor(T/this.characterWidth)-2;k=k<=0?60:k;for(var x=_.split(/\r?\n/),C=[],M=0;M<x.length;M++){var F=this.session.$getDisplayTokens(x[M],L.column),R=this.session.$computeWrapSplits(F,k,this.session.$tabSize);if(R.length>0){var O=0;R.push(x[M].length);for(var B=0;B<R.length;B++){var N=x[M].slice(O,R[B]);C.push({text:N,wrapped:!0}),O=R[B]}}else C.push({text:x[M],wrapped:!1})}return C},A.prototype.removeGhostText=function(){if(this.$ghostText){var _=this.$ghostText.position;this.removeExtraToken(_.row,_.column),this.$ghostTextWidget&&(this.session.widgetManager.removeLineWidget(this.$ghostTextWidget),this.$ghostTextWidget=null),this.$ghostText=null}},A.prototype.addToken=function(_,L,T,k){var x=this.session;x.bgTokenizer.lines[T]=null;var C={type:L,value:_},M=x.getTokens(T);if(k==null||!M.length)M.push(C);else for(var F=0,R=0;R<M.length;R++){var O=M[R];if(F+=O.value.length,k<=F){var B=O.value.length-(F-k),N=O.value.slice(0,B),j=O.value.slice(B);M.splice(R,1,{type:O.type,value:N},C,{type:O.type,value:j});break}}this.updateLines(T,T)},A.prototype.hideTokensAfterPosition=function(_,L){for(var T=this.session.getTokens(_),k=0,x=!1,C=[],M=0;M<T.length;M++){var F=T[M];if(k+=F.value.length,F.type!=="ghost_text"){if(x){C.push({type:F.type,value:F.value}),F.type="hidden_token";continue}k===L&&(x=!0)}}return this.updateLines(_,_),C},A.prototype.removeExtraToken=function(_,L){this.session.bgTokenizer.lines[_]=null,this.updateLines(_,_)},A.prototype.setTheme=function(_,L){var T=this;if(this.$themeId=_,T._dispatchEvent("themeChange",{theme:_}),!_||typeof _=="string"){var k=_||this.$options.theme.initialValue;s.loadModule(["theme",k],x)}else x(_);function x(C){if(T.$themeId!=_)return L&&L();if(!C||!C.cssClass)throw new Error("couldn't load module "+_+" or it didn't call define");C.$id&&(T.$themeId=C.$id),o.importCssString(C.cssText,C.cssClass,T.container),T.theme&&o.removeCssClass(T.container,T.theme.cssClass);var M="padding"in C?C.padding:"padding"in(T.theme||{})?4:T.$padding;if(T.$padding&&M!=T.$padding&&T.setPadding(M),T.$gutterLayer){var F=C.$showGutterCursorMarker;F&&!T.$gutterLayer.$showCursorMarker?T.$gutterLayer.$showCursorMarker="theme":!F&&T.$gutterLayer.$showCursorMarker=="theme"&&(T.$gutterLayer.$showCursorMarker=null)}T.$theme=C.cssClass,T.theme=C,o.addCssClass(T.container,C.cssClass),o.setCssClass(T.container,"ace_dark",C.isDark),T.$size&&(T.$size.width=0,T.$updateSizeAsync()),T._dispatchEvent("themeLoaded",{theme:C}),L&&L(),y.isSafari&&T.scroller&&(T.scroller.style.background="red",T.scroller.style.background="")}},A.prototype.getTheme=function(){return this.$themeId},A.prototype.setStyle=function(_,L){o.setCssClass(this.container,_,L!==!1)},A.prototype.unsetStyle=function(_){o.removeCssClass(this.container,_)},A.prototype.setCursorStyle=function(_){o.setStyle(this.scroller.style,"cursor",_)},A.prototype.setMouseCursor=function(_){o.setStyle(this.scroller.style,"cursor",_)},A.prototype.attachToShadowRoot=function(){o.importCssString(S,"ace_editor.css",this.container)},A.prototype.destroy=function(){this.freeze(),this.$fontMetrics.destroy(),this.$cursorLayer.destroy(),this.removeAllListeners(),this.container.textContent="",this.setOption("useResizeObserver",!1)},A.prototype.$updateCustomScrollbar=function(_){var L=this;this.$horizScroll=this.$vScroll=null,this.scrollBarV.element.remove(),this.scrollBarH.element.remove(),_===!0?(this.scrollBarV=new g(this.container,this),this.scrollBarH=new m(this.container,this),this.scrollBarV.setHeight(this.$size.scrollerHeight),this.scrollBarH.setWidth(this.$size.scrollerWidth),this.scrollBarV.addEventListener("scroll",function(T){L.$scrollAnimation||L.session.setScrollTop(T.data-L.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(T){L.$scrollAnimation||L.session.setScrollLeft(T.data-L.scrollMargin.left)}),this.$scrollDecorator?(this.$scrollDecorator.setScrollBarV(this.scrollBarV),this.$scrollDecorator.$updateDecorators()):(this.$scrollDecorator=new w(this.scrollBarV,this),this.$scrollDecorator.$updateDecorators())):(this.scrollBarV=new c(this.container,this),this.scrollBarH=new d(this.container,this),this.scrollBarV.addEventListener("scroll",function(T){L.$scrollAnimation||L.session.setScrollTop(T.data-L.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(T){L.$scrollAnimation||L.session.setScrollLeft(T.data-L.scrollMargin.left)}))},A.prototype.$addResizeObserver=function(){if(!(!window.ResizeObserver||this.$resizeObserver)){var _=this;this.$resizeTimer=p.delayedCall(function(){_.destroyed||_.onResize()},50),this.$resizeObserver=new window.ResizeObserver(function(L){var T=L[0].contentRect.width,k=L[0].contentRect.height;Math.abs(_.$size.width-T)>1||Math.abs(_.$size.height-k)>1?_.$resizeTimer.delay():_.$resizeTimer.cancel()}),this.$resizeObserver.observe(this.container)}},A})();$.prototype.CHANGE_CURSOR=1,$.prototype.CHANGE_MARKER=2,$.prototype.CHANGE_GUTTER=4,$.prototype.CHANGE_SCROLL=8,$.prototype.CHANGE_LINES=16,$.prototype.CHANGE_TEXT=32,$.prototype.CHANGE_SIZE=64,$.prototype.CHANGE_MARKER_BACK=128,$.prototype.CHANGE_MARKER_FRONT=256,$.prototype.CHANGE_FULL=512,$.prototype.CHANGE_H_SCROLL=1024,$.prototype.$changes=0,$.prototype.$padding=null,$.prototype.$frozen=!1,$.prototype.STEPS=8,i.implement($.prototype,E),s.defineOptions($.prototype,"renderer",{useResizeObserver:{set:function(A){!A&&this.$resizeObserver?(this.$resizeObserver.disconnect(),this.$resizeTimer.cancel(),this.$resizeTimer=this.$resizeObserver=null):A&&!this.$resizeObserver&&this.$addResizeObserver()}},animatedScroll:{initialValue:!1},showInvisibles:{set:function(A){this.$textLayer.setShowInvisibles(A)&&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(A){typeof A=="number"&&(this.$printMarginColumn=A),this.$showPrintMargin=!!A,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(A){this.$gutter.style.display=A?"block":"none",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},useSvgGutterIcons:{set:function(A){this.$gutterLayer.$useSvgGutterIcons=A},initialValue:!1},showFoldedAnnotations:{set:function(A){this.$gutterLayer.$showFoldedAnnotations=A},initialValue:!1},fadeFoldWidgets:{set:function(A){o.setCssClass(this.$gutter,"ace_fade-fold-widgets",A)},initialValue:!1},showFoldWidgets:{set:function(A){this.$gutterLayer.setShowFoldWidgets(A),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(A){this.$textLayer.setDisplayIndentGuides(A)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightIndentGuides:{set:function(A){this.$textLayer.setHighlightIndentGuides(A)==!0?this.$textLayer.$highlightIndentGuide():this.$textLayer.$clearActiveIndentGuide(this.$textLayer.$lines.cells)},initialValue:!0},highlightGutterLine:{set:function(A){this.$gutterLayer.setHighlightGutterLine(A),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},hScrollBarAlwaysVisible:{set:function(A){(!this.$hScrollBarAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(A){(!this.$vScrollBarAlwaysVisible||!this.$vScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(A){typeof A=="number"&&(A=A+"px"),this.container.style.fontSize=A,this.updateFontSize()},initialValue:12},fontFamily:{set:function(A){this.container.style.fontFamily=A,this.updateFontSize()}},maxLines:{set:function(A){this.updateFull()}},minLines:{set:function(A){this.$minLines<562949953421311||(this.$minLines=0),this.updateFull()}},maxPixelHeight:{set:function(A){this.updateFull()},initialValue:0},scrollPastEnd:{set:function(A){A=+A||0,this.$scrollPastEnd!=A&&(this.$scrollPastEnd=A,this.$loop.schedule(this.CHANGE_SCROLL))},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(A){this.$gutterLayer.$fixedWidth=!!A,this.$loop.schedule(this.CHANGE_GUTTER)}},customScrollbar:{set:function(A){this.$updateCustomScrollbar(A)},initialValue:!1},theme:{set:function(A){this.setTheme(A)},get:function(){return this.$themeId||this.theme},initialValue:"./theme/textmate",handlesSet:!0},hasCssTransforms:{},useTextareaForIME:{initialValue:!y.isMobile&&!y.isIE}}),n.VirtualRenderer=$}),ace.define("ace/worker/worker_client",["require","exports","module","ace/lib/oop","ace/lib/net","ace/lib/event_emitter","ace/config"],function(t,n,f){var i=t("../lib/oop"),o=t("../lib/net"),p=t("../lib/event_emitter").EventEmitter,s=t("../config");function u(d){var c="importScripts('"+o.qualifyURL(d)+"');";try{return new Blob([c],{type:"application/javascript"})}catch{var m=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,g=new m;return g.append(c),g.getBlob("application/javascript")}}function r(d){if(typeof Worker>"u")return{postMessage:function(){},terminate:function(){}};if(s.get("loadWorkerFromBlob")){var c=u(d),m=window.URL||window.webkitURL,g=m.createObjectURL(c);return new Worker(g)}return new Worker(d)}var a=function(d){d.postMessage||(d=this.$createWorkerFromOldConfig.apply(this,arguments)),this.$worker=d,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(){i.implement(this,p),this.$createWorkerFromOldConfig=function(d,c,m,g,v){if(t.nameToUrl&&!t.toUrl&&(t.toUrl=t.nameToUrl),s.get("packaged")||!t.toUrl)g=g||s.moduleUrl(c,"worker");else{var b=this.$normalizePath;g=g||b(t.toUrl("ace/worker/worker.js",null,"_"));var E={};d.forEach(function(S){E[S]=b(t.toUrl(S,null,"_").replace(/(\.js)?(\?.*)?$/,""))})}return this.$worker=r(g),v&&this.send("importScripts",v),this.$worker.postMessage({init:!0,tlns:E,module:c,classname:m}),this.$worker},this.onMessage=function(d){var c=d.data;switch(c.type){case"event":this._signal(c.name,{data:c.data});break;case"call":var m=this.callbacks[c.id];m&&(m(c.data),delete this.callbacks[c.id]);break;case"error":this.reportError(c.data);break;case"log":window.console&&console.log&&console.log.apply(console,c.data);break}},this.reportError=function(d){window.console&&console.error&&console.error(d)},this.$normalizePath=function(d){return o.qualifyURL(d)},this.terminate=function(){this._signal("terminate",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker.onerror=function(d){d.preventDefault()},this.$worker=null,this.$doc&&this.$doc.off("change",this.changeListener),this.$doc=null},this.send=function(d,c){this.$worker.postMessage({command:d,args:c})},this.call=function(d,c,m){if(m){var g=this.callbackId++;this.callbacks[g]=m,c.push(g)}this.send(d,c)},this.emit=function(d,c){try{c.data&&c.data.err&&(c.data.err={message:c.data.err.message,stack:c.data.err.stack,code:c.data.err.code}),this.$worker&&this.$worker.postMessage({event:d,data:{data:c.data}})}catch(m){console.error(m.stack)}},this.attachToDocument=function(d){this.$doc&&this.terminate(),this.$doc=d,this.call("setValue",[d.getValue()]),d.on("change",this.changeListener,!0)},this.changeListener=function(d){this.deltaQueue||(this.deltaQueue=[],setTimeout(this.$sendDeltaQueue,0)),d.action=="insert"?this.deltaQueue.push(d.start,d.lines):this.deltaQueue.push(d.start,d.end)},this.$sendDeltaQueue=function(){var d=this.deltaQueue;d&&(this.deltaQueue=null,d.length>50&&d.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:d}))}}).call(a.prototype);var l=function(d,c,m){var g=null,v=!1,b=Object.create(p),E=[],S=new a({messageBuffer:E,terminate:function(){},postMessage:function(y){E.push(y),g&&(v?setTimeout(w):w())}});S.setEmitSync=function(y){v=y};var w=function(){var y=E.shift();y.command?g[y.command].apply(g,y.args):y.event&&b._signal(y.event,y.data)};return b.postMessage=function(y){S.onMessage({data:y})},b.callback=function(y,D){this.postMessage({type:"call",id:D,data:y})},b.emit=function(y,D){this.postMessage({type:"event",name:y,data:D})},s.loadModule(["worker",c],function(y){for(g=new y[m](b);E.length;)w()}),S};n.UIWorkerClient=l,n.WorkerClient=a,n.createWorker=r}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(t,n,f){var i=t("./range").Range,o=t("./lib/event_emitter").EventEmitter,p=t("./lib/oop"),s=(function(){function u(r,a,l,d,c,m){var g=this;this.length=a,this.session=r,this.doc=r.getDocument(),this.mainClass=c,this.othersClass=m,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate,!0),this.$others=d,this.$onCursorChange=function(){setTimeout(function(){g.onCursorChange()})},this.$pos=l;var v=r.getUndoManager().$undoStack||r.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=v.length,this.setup(),r.selection.on("changeCursor",this.$onCursorChange)}return u.prototype.setup=function(){var r=this,a=this.doc,l=this.session;this.selectionBefore=l.selection.toJSON(),l.selection.inMultiSelectMode&&l.selection.toSingleRange(),this.pos=a.createAnchor(this.$pos.row,this.$pos.column);var d=this.pos;d.$insertRight=!0,d.detach(),d.markerId=l.addMarker(new i(d.row,d.column,d.row,d.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(c){var m=a.createAnchor(c.row,c.column);m.$insertRight=!0,m.detach(),r.others.push(m)}),l.setUndoSelect(!1)},u.prototype.showOtherMarkers=function(){if(!this.othersActive){var r=this.session,a=this;this.othersActive=!0,this.others.forEach(function(l){l.markerId=r.addMarker(new i(l.row,l.column,l.row,l.column+a.length),a.othersClass,null,!1)})}},u.prototype.hideOtherMarkers=function(){if(this.othersActive){this.othersActive=!1;for(var r=0;r<this.others.length;r++)this.session.removeMarker(this.others[r].markerId)}},u.prototype.onUpdate=function(r){if(this.$updating)return this.updateAnchors(r);var a=r;if(a.start.row===a.end.row&&a.start.row===this.pos.row){this.$updating=!0;var l=r.action==="insert"?a.end.column-a.start.column:a.start.column-a.end.column,d=a.start.column>=this.pos.column&&a.start.column<=this.pos.column+this.length+1,c=a.start.column-this.pos.column;if(this.updateAnchors(r),d&&(this.length+=l),d&&!this.session.$fromUndo){if(r.action==="insert")for(var m=this.others.length-1;m>=0;m--){var g=this.others[m],v={row:g.row,column:g.column+c};this.doc.insertMergedLines(v,r.lines)}else if(r.action==="remove")for(var m=this.others.length-1;m>=0;m--){var g=this.others[m],v={row:g.row,column:g.column+c};this.doc.remove(new i(v.row,v.column,v.row,v.column-l))}}this.$updating=!1,this.updateMarkers()}},u.prototype.updateAnchors=function(r){this.pos.onChange(r);for(var a=this.others.length;a--;)this.others[a].onChange(r);this.updateMarkers()},u.prototype.updateMarkers=function(){if(!this.$updating){var r=this,a=this.session,l=function(c,m){a.removeMarker(c.markerId),c.markerId=a.addMarker(new i(c.row,c.column,c.row,c.column+r.length),m,null,!1)};l(this.pos,this.mainClass);for(var d=this.others.length;d--;)l(this.others[d],this.othersClass)}},u.prototype.onCursorChange=function(r){if(!(this.$updating||!this.session)){var a=this.session.selection.getCursor();a.row===this.pos.row&&a.column>=this.pos.column&&a.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",r)):(this.hideOtherMarkers(),this._emit("cursorLeave",r))}},u.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},u.prototype.cancel=function(){if(this.$undoStackDepth!==-1){for(var r=this.session.getUndoManager(),a=(r.$undoStack||r.$undostack).length-this.$undoStackDepth,l=0;l<a;l++)r.undo(this.session,!0);this.selectionBefore&&this.session.selection.fromJSON(this.selectionBefore)}},u})();p.implement(s.prototype,o),n.PlaceHolder=s}),ace.define("ace/mouse/multi_select_handler",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(t,n,f){var i=t("../lib/event"),o=t("../lib/useragent");function p(u,r){return u.row==r.row&&u.column==r.column}function s(u){var r=u.domEvent,a=r.altKey,l=r.shiftKey,d=r.ctrlKey,c=u.getAccelKey(),m=u.getButton();if(d&&o.isMac&&(m=r.button),u.editor.inMultiSelectMode&&m==2){u.editor.textInput.onContextMenu(u.domEvent);return}if(!d&&!a&&!c){m===0&&u.editor.inMultiSelectMode&&u.editor.exitMultiSelectMode();return}if(m===0){var g=u.editor,v=g.selection,b=g.inMultiSelectMode,E=u.getDocumentPosition(),S=v.getCursor(),w=u.inSelection()||v.isEmpty()&&p(E,S),y=u.x,D=u.y,$=function(N){y=N.clientX,D=N.clientY},A=g.session,_=g.renderer.pixelToScreenCoordinates(y,D),L=_,T;if(g.$mouseHandler.$enableJumpToDef)d&&a||c&&a?T=l?"block":"add":a&&g.$blockSelectEnabled&&(T="block");else if(c&&!a){if(T="add",!b&&l)return}else a&&g.$blockSelectEnabled&&(T="block");if(T&&o.isMac&&r.ctrlKey&&g.$mouseHandler.cancelContextMenu(),T=="add"){if(!b&&w)return;if(!b){var k=v.toOrientedRange();g.addSelectionMarker(k)}var x=v.rangeList.rangeAtPoint(E);g.inVirtualSelectionMode=!0,l&&(x=null,k=v.ranges[0]||k,g.removeSelectionMarker(k)),g.once("mouseup",function(){var N=v.toOrientedRange();x&&N.isEmpty()&&p(x.cursor,N.cursor)?v.substractPoint(N.cursor):(l?v.substractPoint(k.cursor):k&&(g.removeSelectionMarker(k),v.addRange(k)),v.addRange(N)),g.inVirtualSelectionMode=!1})}else if(T=="block"){u.stop(),g.inVirtualSelectionMode=!0;var C,M=[],F=function(){var N=g.renderer.pixelToScreenCoordinates(y,D),j=A.screenToDocumentPosition(N.row,N.column,N.offsetX);p(L,N)&&p(j,v.lead)||(L=N,g.selection.moveToPosition(j),g.renderer.scrollCursorIntoView(),g.removeSelectionMarkers(M),M=v.rectangularRangeBlock(L,_),g.$mouseHandler.$clickSelection&&M.length==1&&M[0].isEmpty()&&(M[0]=g.$mouseHandler.$clickSelection.clone()),M.forEach(g.addSelectionMarker,g),g.updateSelectionMarkers())};b&&!c?v.toSingleRange():!b&&c&&(C=v.toOrientedRange(),g.addSelectionMarker(C)),l?_=A.documentToScreenPosition(v.lead):v.moveToPosition(E),L={row:-1,column:-1};var R=function(N){F(),clearInterval(B),g.removeSelectionMarkers(M),M.length||(M=[v.toOrientedRange()]),C&&(g.removeSelectionMarker(C),v.toSingleRange(C));for(var j=0;j<M.length;j++)v.addRange(M[j]);g.inVirtualSelectionMode=!1,g.$mouseHandler.$clickSelection=null},O=F;i.capture(g.container,$,R);var B=setInterval(function(){O()},20);return u.preventDefault()}}}n.onMouseDown=s}),ace.define("ace/commands/multi_select_commands",["require","exports","module","ace/keyboard/hash_handler"],function(t,n,f){n.defaultCommands=[{name:"addCursorAbove",description:"Add cursor above",exec:function(o){o.selectMoreLines(-1)},bindKey:{win:"Ctrl-Alt-Up",mac:"Ctrl-Alt-Up"},scrollIntoView:"cursor",readOnly:!0},{name:"addCursorBelow",description:"Add cursor below",exec:function(o){o.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(o){o.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(o){o.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(o){o.selectMore(-1)},bindKey:{win:"Ctrl-Alt-Left",mac:"Ctrl-Alt-Left"},scrollIntoView:"cursor",readOnly:!0},{name:"selectMoreAfter",description:"Select more after",exec:function(o){o.selectMore(1)},bindKey:{win:"Ctrl-Alt-Right",mac:"Ctrl-Alt-Right"},scrollIntoView:"cursor",readOnly:!0},{name:"selectNextBefore",description:"Select next before",exec:function(o){o.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(o){o.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(o){o.multiSelect.rangeCount>1?o.multiSelect.joinSelections():o.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(o){o.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(o){o.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(o){o.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],n.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(o){o.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(o){return o&&o.inMultiSelectMode}}];var i=t("../keyboard/hash_handler").HashHandler;n.keyboardHandler=new i(n.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(t,n,f){var i=t("./range_list").RangeList,o=t("./range").Range,p=t("./selection").Selection,s=t("./mouse/multi_select_handler").onMouseDown,u=t("./lib/event"),r=t("./lib/lang"),a=t("./commands/multi_select_commands");n.commands=a.defaultCommands.concat(a.multiSelectCommands);var l=t("./search").Search,d=new l;function c(S,w,y){return d.$options.wrap=!0,d.$options.needle=w,d.$options.backwards=y==-1,d.find(S)}var m=t("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(m.prototype),(function(){this.ranges=null,this.rangeList=null,this.addRange=function(S,w){if(S){if(!this.inMultiSelectMode&&this.rangeCount===0){var y=this.toOrientedRange();if(this.rangeList.add(y),this.rangeList.add(S),this.rangeList.ranges.length!=2)return this.rangeList.removeAll(),w||this.fromOrientedRange(S);this.rangeList.removeAll(),this.rangeList.add(y),this.$onAddRange(y)}S.cursor||(S.cursor=S.end);var D=this.rangeList.add(S);return this.$onAddRange(S),D.length&&this.$onRemoveRange(D),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),w||this.fromOrientedRange(S)}},this.toSingleRange=function(S){S=S||this.ranges[0];var w=this.rangeList.removeAll();w.length&&this.$onRemoveRange(w),S&&this.fromOrientedRange(S)},this.substractPoint=function(S){var w=this.rangeList.substractPoint(S);if(w)return this.$onRemoveRange(w),w[0]},this.mergeOverlappingRanges=function(){var S=this.rangeList.merge();S.length&&this.$onRemoveRange(S)},this.$onAddRange=function(S){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(S),this._signal("addRange",{range:S})},this.$onRemoveRange=function(S){if(this.rangeCount=this.rangeList.ranges.length,this.rangeCount==1&&this.inMultiSelectMode){var w=this.rangeList.ranges.pop();S.push(w),this.rangeCount=0}for(var y=S.length;y--;){var D=this.ranges.indexOf(S[y]);this.ranges.splice(D,1)}this._signal("removeRange",{ranges:S}),this.rangeCount===0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),w=w||this.ranges[0],w&&!w.isEqual(this.getRange())&&this.fromOrientedRange(w)},this.$initRangeList=function(){this.rangeList||(this.rangeList=new i,this.ranges=[],this.rangeCount=0)},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){for(var S=this.ranges.length?this.ranges:[this.getRange()],w=[],y=0;y<S.length;y++){var D=S[y],$=D.start.row,A=D.end.row;if($===A)w.push(D.clone());else{for(w.push(new o($,D.start.column,$,this.session.getLine($).length));++$<A;)w.push(this.getLineRange($,!0));w.push(new o(A,0,A,D.end.column))}y==0&&!this.isBackwards()&&(w=w.reverse())}this.toSingleRange();for(var y=w.length;y--;)this.addRange(w[y])},this.joinSelections=function(){var S=this.rangeList.ranges,w=S[S.length-1],y=o.fromPoints(S[0].start,w.end);this.toSingleRange(),this.setSelectionRange(y,w.cursor==w.start)},this.toggleBlockSelection=function(){if(this.rangeCount>1){var S=this.rangeList.ranges,w=S[S.length-1],y=o.fromPoints(S[0].start,w.end);this.toSingleRange(),this.setSelectionRange(y,w.cursor==w.start)}else{var D=this.session.documentToScreenPosition(this.cursor),$=this.session.documentToScreenPosition(this.anchor),A=this.rectangularRangeBlock(D,$);A.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(S,w,y){var D=[],$=S.column<w.column;if($)var A=S.column,_=w.column,L=S.offsetX,T=w.offsetX;else var A=w.column,_=S.column,L=w.offsetX,T=S.offsetX;var k=S.row<w.row;if(k)var x=S.row,C=w.row;else var x=w.row,C=S.row;A<0&&(A=0),x<0&&(x=0),x==C&&(y=!0);for(var M,F=x;F<=C;F++){var R=o.fromPoints(this.session.screenToDocumentPosition(F,A,L),this.session.screenToDocumentPosition(F,_,T));if(R.isEmpty()){if(M&&v(R.end,M))break;M=R.end}R.cursor=$?R.start:R.end,D.push(R)}if(k&&D.reverse(),!y){for(var O=D.length-1;D[O].isEmpty()&&O>0;)O--;if(O>0)for(var B=0;D[B].isEmpty();)B++;for(var N=O;N>=B;N--)D[N].isEmpty()&&D.splice(N,1)}return D}}).call(p.prototype);var g=t("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(S){S.cursor||(S.cursor=S.end);var w=this.getSelectionStyle();return S.marker=this.session.addMarker(S,"ace_selection",w),this.session.$selectionMarkers.push(S),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,S},this.removeSelectionMarker=function(S){if(S.marker){this.session.removeMarker(S.marker);var w=this.session.$selectionMarkers.indexOf(S);w!=-1&&this.session.$selectionMarkers.splice(w,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length}},this.removeSelectionMarkers=function(S){for(var w=this.session.$selectionMarkers,y=S.length;y--;){var D=S[y];if(D.marker){this.session.removeMarker(D.marker);var $=w.indexOf(D);$!=-1&&w.splice($,1)}}this.session.selectionMarkerCount=w.length},this.$onAddRange=function(S){this.addSelectionMarker(S.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(S){this.removeSelectionMarkers(S.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(S){this.inMultiSelectMode||(this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(a.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers())},this.$onSingleSelect=function(S){this.session.multiSelect.inVirtualMode||(this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(a.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection"))},this.$onMultiSelectExec=function(S){var w=S.command,y=S.editor;if(y.multiSelect){if(w.multiSelectAction)w.multiSelectAction=="forEach"?D=y.forEachSelection(w,S.args):w.multiSelectAction=="forEachLine"?D=y.forEachSelection(w,S.args,!0):w.multiSelectAction=="single"?(y.exitMultiSelectMode(),D=w.exec(y,S.args||{})):D=w.multiSelectAction(y,S.args||{});else{var D=w.exec(y,S.args||{});y.multiSelect.addRange(y.multiSelect.toOrientedRange()),y.multiSelect.mergeOverlappingRanges()}return D}},this.forEachSelection=function(S,w,y){if(!this.inVirtualSelectionMode){var D=y&&y.keepOrder,$=y==!0||y&&y.$byLines,A=this.session,_=this.selection,L=_.rangeList,T=(D?_:L).ranges,k;if(!T.length)return S.exec?S.exec(this,w||{}):S(this,w||{});var x=_._eventRegistry;_._eventRegistry={};var C=new p(A);this.inVirtualSelectionMode=!0;for(var M=T.length;M--;){if($)for(;M>0&&T[M].start.row==T[M-1].end.row;)M--;C.fromOrientedRange(T[M]),C.index=M,this.selection=A.selection=C;var F=S.exec?S.exec(this,w||{}):S(this,w||{});!k&&F!==void 0&&(k=F),C.toOrientedRange(T[M])}C.detach(),this.selection=A.selection=_,this.inVirtualSelectionMode=!1,_._eventRegistry=x,_.mergeOverlappingRanges(),_.ranges[0]&&_.fromOrientedRange(_.ranges[0]);var R=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),R&&R.from==R.to&&this.renderer.animateScrolling(R.from),k}},this.exitMultiSelectMode=function(){!this.inMultiSelectMode||this.inVirtualSelectionMode||this.multiSelect.toSingleRange()},this.getSelectedText=function(){var S="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){for(var w=this.multiSelect.rangeList.ranges,y=[],D=0;D<w.length;D++)y.push(this.session.getTextRange(w[D]));var $=this.session.getDocument().getNewLineCharacter();S=y.join($),S.length==(y.length-1)*$.length&&(S="")}else this.selection.isEmpty()||(S=this.session.getTextRange(this.getSelectionRange()));return S},this.$checkMultiselectChange=function(S,w){if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var y=this.multiSelect.ranges[0];if(this.multiSelect.isEmpty()&&w==this.multiSelect.anchor)return;var D=w==this.multiSelect.anchor?y.cursor==y.start?y.end:y.start:y.cursor;D.row!=w.row||this.session.$clipPositionToDocument(D.row,D.column).column!=w.column?this.multiSelect.toSingleRange(this.multiSelect.toOrientedRange()):this.multiSelect.mergeOverlappingRanges()}},this.findAll=function(S,w,y){if(w=w||{},w.needle=S||w.needle,w.needle==null){var D=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();w.needle=this.session.getTextRange(D)}this.$search.set(w);var $=this.$search.findAll(this.session);if(!$.length)return 0;var A=this.multiSelect;y||A.toSingleRange($[0]);for(var _=$.length;_--;)A.addRange($[_],!0);return D&&A.rangeList.rangeAtPoint(D.start)&&A.addRange(D,!0),$.length},this.selectMoreLines=function(S,w){var y=this.selection.toOrientedRange(),D=y.cursor==y.end,$=this.session.documentToScreenPosition(y.cursor);this.selection.$desiredColumn&&($.column=this.selection.$desiredColumn);var A=this.session.screenToDocumentPosition($.row+S,$.column);if(y.isEmpty())var L=A;else var _=this.session.documentToScreenPosition(D?y.end:y.start),L=this.session.screenToDocumentPosition(_.row+S,_.column);if(D){var T=o.fromPoints(A,L);T.cursor=T.start}else{var T=o.fromPoints(L,A);T.cursor=T.end}if(T.desiredColumn=$.column,!this.selection.inMultiSelectMode)this.selection.addRange(y);else if(w)var k=y.cursor;this.selection.addRange(T),k&&this.selection.substractPoint(k)},this.transposeSelections=function(S){for(var w=this.session,y=w.multiSelect,D=y.ranges,$=D.length;$--;){var A=D[$];if(A.isEmpty()){var _=w.getWordRange(A.start.row,A.start.column);A.start.row=_.start.row,A.start.column=_.start.column,A.end.row=_.end.row,A.end.column=_.end.column}}y.mergeOverlappingRanges();for(var L=[],$=D.length;$--;){var A=D[$];L.unshift(w.getTextRange(A))}S<0?L.unshift(L.pop()):L.push(L.shift());for(var $=D.length;$--;){var A=D[$],T=A.clone();w.replace(A,L[$]),A.start.row=T.start.row,A.start.column=T.start.column}y.fromOrientedRange(y.ranges[0])},this.selectMore=function(S,w,y){var D=this.session,$=D.multiSelect,A=$.toOrientedRange();if(!(A.isEmpty()&&(A=D.getWordRange(A.start.row,A.start.column),A.cursor=S==-1?A.start:A.end,this.multiSelect.addRange(A),y))){var _=D.getTextRange(A),L=c(D,_,S);L&&(L.cursor=S==-1?L.start:L.end,this.session.unfold(L),this.multiSelect.addRange(L),this.renderer.scrollCursorIntoView(null,.5)),w&&this.multiSelect.substractPoint(A.cursor)}},this.alignCursors=function(){var S=this.session,w=S.multiSelect,y=w.ranges,D=-1,$=y.filter(function(O){if(O.cursor.row==D)return!0;D=O.cursor.row});if(!y.length||$.length==y.length-1){var A=this.selection.getRange(),_=A.start.row,L=A.end.row,T=_==L;if(T){var k=this.session.getLength(),x;do x=this.session.getLine(L);while(/[=:]/.test(x)&&++L<k);do x=this.session.getLine(_);while(/[=:]/.test(x)&&--_>0);_<0&&(_=0),L>=k&&(L=k-1)}var C=this.session.removeFullLines(_,L);C=this.$reAlignText(C,T),this.session.insert({row:_,column:0},C.join(`
`)+`
`),T||(A.start.column=0,A.end.column=C[C.length-1].length),this.selection.setRange(A)}else{$.forEach(function(O){w.substractPoint(O.cursor)});var M=0,F=1/0,R=y.map(function(O){var B=O.cursor,N=S.getLine(B.row),j=N.substr(B.column).search(/\S/g);return j==-1&&(j=0),B.column>M&&(M=B.column),j<F&&(F=j),j});y.forEach(function(O,B){var N=O.cursor,j=M-N.column,V=R[B]-F;j>V?S.insert(N,r.stringRepeat(" ",j-V)):S.remove(new o(N.row,N.column,N.row,N.column-j+V)),O.start.column=O.end.column=M,O.start.row=O.end.row=N.row,O.cursor=O.end}),w.fromOrientedRange(y[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(S,w){var y=!0,D=!0,$,A,_;return S.map(function(C){var M=C.match(/(\s*)(.*?)(\s*)([=:].*)/);return M?$==null?($=M[1].length,A=M[2].length,_=M[3].length,M):($+A+_!=M[1].length+M[2].length+M[3].length&&(D=!1),$!=M[1].length&&(y=!1),$>M[1].length&&($=M[1].length),A<M[2].length&&(A=M[2].length),_>M[3].length&&(_=M[3].length),M):[C]}).map(w?T:y?D?k:T:x);function L(C){return r.stringRepeat(" ",C)}function T(C){return C[2]?L($)+C[2]+L(A-C[2].length+_)+C[4].replace(/^([=:])\s+/,"$1 "):C[0]}function k(C){return C[2]?L($+A-C[2].length)+C[2]+L(_)+C[4].replace(/^([=:])\s+/,"$1 "):C[0]}function x(C){return C[2]?L($)+C[2]+L(_)+C[4].replace(/^([=:])\s+/,"$1 "):C[0]}}}).call(g.prototype);function v(S,w){return S.row==w.row&&S.column==w.column}n.onSessionChange=function(S){var w=S.session;w&&!w.multiSelect&&(w.$selectionMarkers=[],w.selection.$initRangeList(),w.multiSelect=w.selection),this.multiSelect=w&&w.multiSelect;var y=S.oldSession;y&&(y.multiSelect.off("addRange",this.$onAddRange),y.multiSelect.off("removeRange",this.$onRemoveRange),y.multiSelect.off("multiSelect",this.$onMultiSelect),y.multiSelect.off("singleSelect",this.$onSingleSelect),y.multiSelect.lead.off("change",this.$checkMultiselectChange),y.multiSelect.anchor.off("change",this.$checkMultiselectChange)),w&&(w.multiSelect.on("addRange",this.$onAddRange),w.multiSelect.on("removeRange",this.$onRemoveRange),w.multiSelect.on("multiSelect",this.$onMultiSelect),w.multiSelect.on("singleSelect",this.$onSingleSelect),w.multiSelect.lead.on("change",this.$checkMultiselectChange),w.multiSelect.anchor.on("change",this.$checkMultiselectChange)),w&&this.inMultiSelectMode!=w.selection.inMultiSelectMode&&(w.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())};function b(S){S.$multiselectOnSessionChange||(S.$onAddRange=S.$onAddRange.bind(S),S.$onRemoveRange=S.$onRemoveRange.bind(S),S.$onMultiSelect=S.$onMultiSelect.bind(S),S.$onSingleSelect=S.$onSingleSelect.bind(S),S.$multiselectOnSessionChange=n.onSessionChange.bind(S),S.$checkMultiselectChange=S.$checkMultiselectChange.bind(S),S.$multiselectOnSessionChange(S),S.on("changeSession",S.$multiselectOnSessionChange),S.on("mousedown",s),S.commands.addCommands(a.defaultCommands),E(S))}function E(S){if(!S.textInput)return;var w=S.textInput.getElement(),y=!1;u.addListener(w,"keydown",function($){var A=$.keyCode==18&&!($.ctrlKey||$.shiftKey||$.metaKey);S.$blockSelectEnabled&&A?y||(S.renderer.setMouseCursor("crosshair"),y=!0):y&&D()},S),u.addListener(w,"keyup",D,S),u.addListener(w,"blur",D,S);function D($){y&&(S.renderer.setMouseCursor(""),y=!1)}}n.MultiSelect=b,t("./config").defineOptions(g.prototype,"editor",{enableMultiselect:{set:function(S){b(this),S?this.on("mousedown",s):this.off("mousedown",s)},value:!0},enableBlockSelect:{set:function(S){this.$blockSelectEnabled=S},value:!0}})}),ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(t,n,f){var i=t("../../range").Range,o=n.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(p,s,u){var r=p.getLine(u);return this.foldingStartMarker.test(r)?"start":s=="markbeginend"&&this.foldingStopMarker&&this.foldingStopMarker.test(r)?"end":""},this.getFoldWidgetRange=function(p,s,u){return null},this.indentationBlock=function(p,s,u){var r=/\S/,a=p.getLine(s),l=a.search(r);if(l!=-1){for(var d=u||a.length,c=p.getLength(),m=s,g=s;++s<c;){var v=p.getLine(s).search(r);if(v!=-1){if(v<=l){var b=p.getTokenAt(s,0);if(!b||b.type!=="string")break}g=s}}if(g>m){var E=p.getLine(g).length;return new i(m,d,g,E)}}},this.openingBracketBlock=function(p,s,u,r,a){var l={row:u,column:r+1},d=p.$findClosingBracket(s,l,a);if(d){var c=p.foldWidgets[d.row];return c==null&&(c=p.getFoldWidget(d.row)),c=="start"&&d.row>l.row&&(d.row--,d.column=p.getLine(d.row).length),i.fromPoints(l,d)}},this.closingBracketBlock=function(p,s,u,r,a){var l={row:u,column:r},d=p.$findOpeningBracket(s,l);if(d)return d.column++,l.column--,i.fromPoints(d,l)}}).call(o.prototype)}),ace.define("ace/ext/error_marker",["require","exports","module","ace/lib/dom","ace/range","ace/config"],function(t,n,f){var i=t("../lib/dom"),o=t("../range").Range,p=t("../config").nls;function s(r,a,l){for(var d=0,c=r.length-1;d<=c;){var m=d+c>>1,g=l(a,r[m]);if(g>0)d=m+1;else if(g<0)c=m-1;else return m}return-(d+1)}function u(r,a,l){var d=r.getAnnotations().sort(o.comparePoints);if(d.length){var c=s(d,{row:a,column:-1},o.comparePoints);c<0&&(c=-c-1),c>=d.length?c=l>0?0:d.length-1:c===0&&l<0&&(c=d.length-1);var m=d[c];if(!(!m||!l)){if(m.row===a){do m=d[c+=l];while(m&&m.row===a);if(!m)return d.slice()}var g=[];a=m.row;do g[l<0?"unshift":"push"](m),m=d[c+=l];while(m&&m.row==a);return g.length&&g}}}n.showErrorMarker=function(r,a){var l=r.session,d=r.getCursorPosition(),c=d.row,m=l.widgetManager.getWidgetsAtRow(c).filter(function($){return $.type=="errorMarker"})[0];m?m.destroy():c-=a;var g=u(l,c,a),v;if(g){var b=g[0];d.column=(b.pos&&typeof b.column!="number"?b.pos.sc:b.column)||0,d.row=b.row,v=r.renderer.$gutterLayer.$annotations[d.row]}else{if(m)return;v={displayText:[p("error-marker.good-state","Looks good!")],className:"ace_ok"}}r.session.unfold(d.row),r.selection.moveToPosition(d);var E={row:d.row,fixedWidth:!0,coverGutter:!0,el:i.createElement("div"),type:"errorMarker"},S=E.el.appendChild(i.createElement("div")),w=E.el.appendChild(i.createElement("div"));w.className="error_widget_arrow "+v.className;var y=r.renderer.$cursorLayer.getPixelPosition(d).left;w.style.left=y+r.renderer.gutterWidth-5+"px",E.el.className="error_widget_wrapper",S.className="error_widget "+v.className,v.displayText.forEach(function($,A){S.appendChild(i.createTextNode($)),A<v.displayText.length-1&&S.appendChild(i.createElement("br"))}),S.appendChild(i.createElement("div"));var D=function($,A,_){if(A===0&&(_==="esc"||_==="return"))return E.destroy(),{command:"null"}};E.destroy=function(){r.$mouseHandler.isMousePressed||(r.keyBinding.removeKeyboardHandler(D),l.widgetManager.removeLineWidget(E),r.off("changeSelection",E.destroy),r.off("changeSession",E.destroy),r.off("mouseup",E.destroy),r.off("change",E.destroy))},r.keyBinding.addKeyboardHandler(D),r.on("changeSelection",E.destroy),r.on("changeSession",E.destroy),r.on("mouseup",E.destroy),r.on("change",E.destroy),r.session.widgetManager.addLineWidget(E),E.el.onmousedown=r.focus.bind(r),r.renderer.scrollCursorIntoView(null,.5,{bottom:E.el.offsetHeight})},i.importCssString(`
.error_widget_wrapper {
background: inherit;
color: inherit;
border:none
}
.error_widget {
border-top: solid 2px;
border-bottom: solid 2px;
margin: 5px 0;
padding: 10px 40px;
white-space: pre-wrap;
}
.error_widget.ace_error, .error_widget_arrow.ace_error{
border-color: #ff5a5a
}
.error_widget.ace_warning, .error_widget_arrow.ace_warning{
border-color: #F1D817
}
.error_widget.ace_info, .error_widget_arrow.ace_info{
border-color: #5a5a5a
}
.error_widget.ace_ok, .error_widget_arrow.ace_ok{
border-color: #5aaa5a
}
.error_widget_arrow {
position: absolute;
border: solid 5px;
border-top-color: transparent!important;
border-right-color: transparent!important;
border-left-color: transparent!important;
top: -5px;
}
`,"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(t,n,f){t("./loader_build")(n);var i=t("./lib/dom"),o=t("./range").Range,p=t("./editor").Editor,s=t("./edit_session").EditSession,u=t("./undomanager").UndoManager,r=t("./virtual_renderer").VirtualRenderer;t("./worker/worker_client"),t("./keyboard/hash_handler"),t("./placeholder"),t("./multi_select"),t("./mode/folding/fold_mode"),t("./theme/textmate"),t("./ext/error_marker"),n.config=t("./config"),n.edit=function(l,d){if(typeof l=="string"){var c=l;if(l=document.getElementById(c),!l)throw new Error("ace.edit can't find div #"+c)}if(l&&l.env&&l.env.editor instanceof p)return l.env.editor;var m="";if(l&&/input|textarea/i.test(l.tagName)){var g=l;m=g.value,l=i.createElement("pre"),g.parentNode.replaceChild(l,g)}else l&&(m=l.textContent,l.innerHTML="");var v=n.createEditSession(m),b=new p(new r(l),v,d),E={document:v,editor:b,onResize:b.resize.bind(b,null)};return g&&(E.textarea=g),b.on("destroy",function(){E.editor.container.env=null}),b.container.env=b.env=E,b},n.createEditSession=function(l,d){var c=new s(l,d);return c.setUndoManager(new u),c},n.Range=o,n.Editor=p,n.EditSession=s,n.UndoManager=u,n.VirtualRenderer=r;var a=n.config.version;n.version=a}),(function(){ace.require(["ace/ace"],function(t){t&&(t.config.init(!0),t.define=ace.define);var n=(function(){return this})();!n&&typeof window<"u"&&(n=window),!n&&typeof self<"u"&&(n=self),n.ace||(n.ace=t);for(var f in t)t.hasOwnProperty(f)&&(n.ace[f]=t[f]);n.ace.default=n.ace,h&&(h.exports=n.ace)})})()})(Ha);var Ui=Ha.exports,Gi={exports:{}};Gi.exports;(function(h,e){var t=200,n="__lodash_hash_undefined__",f=1,i=2,o=9007199254740991,p="[object Arguments]",s="[object Array]",u="[object AsyncFunction]",r="[object Boolean]",a="[object Date]",l="[object Error]",d="[object Function]",c="[object GeneratorFunction]",m="[object Map]",g="[object Number]",v="[object Null]",b="[object Object]",E="[object Promise]",S="[object Proxy]",w="[object RegExp]",y="[object Set]",D="[object String]",$="[object Symbol]",A="[object Undefined]",_="[object WeakMap]",L="[object ArrayBuffer]",T="[object DataView]",k="[object Float32Array]",x="[object Float64Array]",C="[object Int8Array]",M="[object Int16Array]",F="[object Int32Array]",R="[object Uint8Array]",O="[object Uint8ClampedArray]",B="[object Uint16Array]",N="[object Uint32Array]",j=/[\\^$.*+?()[\]{}|]/g,V=/^\[object .+?Constructor\]$/,W=/^(?:0|[1-9]\d*)$/,H={};H[k]=H[x]=H[C]=H[M]=H[F]=H[R]=H[O]=H[B]=H[N]=!0,H[p]=H[s]=H[L]=H[r]=H[T]=H[a]=H[l]=H[d]=H[m]=H[g]=H[b]=H[w]=H[y]=H[D]=H[_]=!1;var U=typeof ut=="object"&&ut&&ut.Object===Object&&ut,X=typeof self=="object"&&self&&self.Object===Object&&self,Y=U||X||Function("return this")(),Z=e&&!e.nodeType&&e,ne=Z&&!0&&h&&!h.nodeType&&h,re=ne&&ne.exports===Z,le=re&&U.process,ie=(function(){try{return le&&le.binding&&le.binding("util")}catch{}})(),de=ie&&ie.isTypedArray;function he(G,te){for(var ue=-1,ye=G==null?0:G.length,Pe=0,De=[];++ue<ye;){var He=G[ue];te(He,ue,G)&&(De[Pe++]=He)}return De}function ae(G,te){for(var ue=-1,ye=te.length,Pe=G.length;++ue<ye;)G[Pe+ue]=te[ue];return G}function ce(G,te){for(var ue=-1,ye=G==null?0:G.length;++ue<ye;)if(te(G[ue],ue,G))return!0;return!1}function pe(G,te){for(var ue=-1,ye=Array(G);++ue<G;)ye[ue]=te(ue);return ye}function fe(G){return function(te){return G(te)}}function ge(G,te){return G.has(te)}function xe(G,te){return G==null?void 0:G[te]}function We(G){var te=-1,ue=Array(G.size);return G.forEach(function(ye,Pe){ue[++te]=[Pe,ye]}),ue}function it(G,te){return function(ue){return G(te(ue))}}function _t(G){var te=-1,ue=Array(G.size);return G.forEach(function(ye){ue[++te]=ye}),ue}var je=Array.prototype,Ze=Function.prototype,st=Object.prototype,Wt=Y["__core-js_shared__"],yi=Ze.toString,ht=st.hasOwnProperty,bi=(function(){var G=/[^.]+$/.exec(Wt&&Wt.keys&&Wt.keys.IE_PROTO||"");return G?"Symbol(src)_1."+G:""})(),wi=st.toString,Wn=RegExp("^"+yi.call(ht).replace(j,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),jn=re?Y.Buffer:void 0,jt=Y.Symbol,Cn=Y.Uint8Array,xn=st.propertyIsEnumerable,mr=je.splice,_e=jt?jt.toStringTag:void 0,ot=Object.getOwnPropertySymbols,en=jn?jn.isBuffer:void 0,Tt=it(Object.keys,Object),gr=Sn(Y,"DataView"),Hn=Sn(Y,"Map"),vr=Sn(Y,"Promise"),yr=Sn(Y,"Set"),br=Sn(Y,"WeakMap"),zn=Sn(Object,"create"),el=rn(gr),tl=rn(Hn),nl=rn(vr),il=rn(yr),rl=rn(br),ms=jt?jt.prototype:void 0,wr=ms?ms.valueOf:void 0;function tn(G){var te=-1,ue=G==null?0:G.length;for(this.clear();++te<ue;){var ye=G[te];this.set(ye[0],ye[1])}}function sl(){this.__data__=zn?zn(null):{},this.size=0}function ol(G){var te=this.has(G)&&delete this.__data__[G];return this.size-=te?1:0,te}function al(G){var te=this.__data__;if(zn){var ue=te[G];return ue===n?void 0:ue}return ht.call(te,G)?te[G]:void 0}function ll(G){var te=this.__data__;return zn?te[G]!==void 0:ht.call(te,G)}function cl(G,te){var ue=this.__data__;return this.size+=this.has(G)?0:1,ue[G]=zn&&te===void 0?n:te,this}tn.prototype.clear=sl,tn.prototype.delete=ol,tn.prototype.get=al,tn.prototype.has=ll,tn.prototype.set=cl;function It(G){var te=-1,ue=G==null?0:G.length;for(this.clear();++te<ue;){var ye=G[te];this.set(ye[0],ye[1])}}function ul(){this.__data__=[],this.size=0}function hl(G){var te=this.__data__,ue=xi(te,G);if(ue<0)return!1;var ye=te.length-1;return ue==ye?te.pop():mr.call(te,ue,1),--this.size,!0}function dl(G){var te=this.__data__,ue=xi(te,G);return ue<0?void 0:te[ue][1]}function pl(G){return xi(this.__data__,G)>-1}function fl(G,te){var ue=this.__data__,ye=xi(ue,G);return ye<0?(++this.size,ue.push([G,te])):ue[ye][1]=te,this}It.prototype.clear=ul,It.prototype.delete=hl,It.prototype.get=dl,It.prototype.has=pl,It.prototype.set=fl;function nn(G){var te=-1,ue=G==null?0:G.length;for(this.clear();++te<ue;){var ye=G[te];this.set(ye[0],ye[1])}}function ml(){this.size=0,this.__data__={hash:new tn,map:new(Hn||It),string:new tn}}function gl(G){var te=Si(this,G).delete(G);return this.size-=te?1:0,te}function vl(G){return Si(this,G).get(G)}function yl(G){return Si(this,G).has(G)}function bl(G,te){var ue=Si(this,G),ye=ue.size;return ue.set(G,te),this.size+=ue.size==ye?0:1,this}nn.prototype.clear=ml,nn.prototype.delete=gl,nn.prototype.get=vl,nn.prototype.has=yl,nn.prototype.set=bl;function Ci(G){var te=-1,ue=G==null?0:G.length;for(this.__data__=new nn;++te<ue;)this.add(G[te])}function wl(G){return this.__data__.set(G,n),this}function Cl(G){return this.__data__.has(G)}Ci.prototype.add=Ci.prototype.push=wl,Ci.prototype.has=Cl;function Ht(G){var te=this.__data__=new It(G);this.size=te.size}function xl(){this.__data__=new It,this.size=0}function Sl(G){var te=this.__data__,ue=te.delete(G);return this.size=te.size,ue}function Dl(G){return this.__data__.get(G)}function El(G){return this.__data__.has(G)}function Al(G,te){var ue=this.__data__;if(ue instanceof It){var ye=ue.__data__;if(!Hn||ye.length<t-1)return ye.push([G,te]),this.size=++ue.size,this;ue=this.__data__=new nn(ye)}return ue.set(G,te),this.size=ue.size,this}Ht.prototype.clear=xl,Ht.prototype.delete=Sl,Ht.prototype.get=Dl,Ht.prototype.has=El,Ht.prototype.set=Al;function Tl(G,te){var ue=Di(G),ye=!ue&&jl(G),Pe=!ue&&!ye&&Cr(G),De=!ue&&!ye&&!Pe&&Ds(G),He=ue||ye||Pe||De,Ye=He?pe(G.length,String):[],Xe=Ye.length;for(var Ve in G)ht.call(G,Ve)&&!(He&&(Ve=="length"||Pe&&(Ve=="offset"||Ve=="parent")||De&&(Ve=="buffer"||Ve=="byteLength"||Ve=="byteOffset")||Pl(Ve,Xe)))&&Ye.push(Ve);return Ye}function xi(G,te){for(var ue=G.length;ue--;)if(ws(G[ue][0],te))return ue;return-1}function kl(G,te,ue){var ye=te(G);return Di(G)?ye:ae(ye,ue(G))}function Un(G){return G==null?G===void 0?A:v:_e&&_e in Object(G)?Rl(G):Wl(G)}function gs(G){return Gn(G)&&Un(G)==p}function vs(G,te,ue,ye,Pe){return G===te?!0:G==null||te==null||!Gn(G)&&!Gn(te)?G!==G&&te!==te:$l(G,te,ue,ye,vs,Pe)}function $l(G,te,ue,ye,Pe,De){var He=Di(G),Ye=Di(te),Xe=He?s:zt(G),Ve=Ye?s:zt(te);Xe=Xe==p?b:Xe,Ve=Ve==p?b:Ve;var at=Xe==b,bt=Ve==b,qe=Xe==Ve;if(qe&&Cr(G)){if(!Cr(te))return!1;He=!0,at=!1}if(qe&&!at)return De||(De=new Ht),He||Ds(G)?ys(G,te,ue,ye,Pe,De):Ll(G,te,Xe,ue,ye,Pe,De);if(!(ue&f)){var dt=at&&ht.call(G,"__wrapped__"),pt=bt&&ht.call(te,"__wrapped__");if(dt||pt){var Ut=dt?G.value():G,Lt=pt?te.value():te;return De||(De=new Ht),Pe(Ut,Lt,ue,ye,De)}}return qe?(De||(De=new Ht),Fl(G,te,ue,ye,Pe,De)):!1}function Ml(G){if(!Ss(G)||Bl(G))return!1;var te=Cs(G)?Wn:V;return te.test(rn(G))}function _l(G){return Gn(G)&&xs(G.length)&&!!H[Un(G)]}function Il(G){if(!Vl(G))return Tt(G);var te=[];for(var ue in Object(G))ht.call(G,ue)&&ue!="constructor"&&te.push(ue);return te}function ys(G,te,ue,ye,Pe,De){var He=ue&f,Ye=G.length,Xe=te.length;if(Ye!=Xe&&!(He&&Xe>Ye))return!1;var Ve=De.get(G);if(Ve&&De.get(te))return Ve==te;var at=-1,bt=!0,qe=ue&i?new Ci:void 0;for(De.set(G,te),De.set(te,G);++at<Ye;){var dt=G[at],pt=te[at];if(ye)var Ut=He?ye(pt,dt,at,te,G,De):ye(dt,pt,at,G,te,De);if(Ut!==void 0){if(Ut)continue;bt=!1;break}if(qe){if(!ce(te,function(Lt,sn){if(!ge(qe,sn)&&(dt===Lt||Pe(dt,Lt,ue,ye,De)))return qe.push(sn)})){bt=!1;break}}else if(!(dt===pt||Pe(dt,pt,ue,ye,De))){bt=!1;break}}return De.delete(G),De.delete(te),bt}function Ll(G,te,ue,ye,Pe,De,He){switch(ue){case T:if(G.byteLength!=te.byteLength||G.byteOffset!=te.byteOffset)return!1;G=G.buffer,te=te.buffer;case L:return!(G.byteLength!=te.byteLength||!De(new Cn(G),new Cn(te)));case r:case a:case g:return ws(+G,+te);case l:return G.name==te.name&&G.message==te.message;case w:case D:return G==te+"";case m:var Ye=We;case y:var Xe=ye&f;if(Ye||(Ye=_t),G.size!=te.size&&!Xe)return!1;var Ve=He.get(G);if(Ve)return Ve==te;ye|=i,He.set(G,te);var at=ys(Ye(G),Ye(te),ye,Pe,De,He);return He.delete(G),at;case $:if(wr)return wr.call(G)==wr.call(te)}return!1}function Fl(G,te,ue,ye,Pe,De){var He=ue&f,Ye=bs(G),Xe=Ye.length,Ve=bs(te),at=Ve.length;if(Xe!=at&&!He)return!1;for(var bt=Xe;bt--;){var qe=Ye[bt];if(!(He?qe in te:ht.call(te,qe)))return!1}var dt=De.get(G);if(dt&&De.get(te))return dt==te;var pt=!0;De.set(G,te),De.set(te,G);for(var Ut=He;++bt<Xe;){qe=Ye[bt];var Lt=G[qe],sn=te[qe];if(ye)var Es=He?ye(sn,Lt,qe,te,G,De):ye(Lt,sn,qe,G,te,De);if(!(Es===void 0?Lt===sn||Pe(Lt,sn,ue,ye,De):Es)){pt=!1;break}Ut||(Ut=qe=="constructor")}if(pt&&!Ut){var Ei=G.constructor,Ai=te.constructor;Ei!=Ai&&"constructor"in G&&"constructor"in te&&!(typeof Ei=="function"&&Ei instanceof Ei&&typeof Ai=="function"&&Ai instanceof Ai)&&(pt=!1)}return De.delete(G),De.delete(te),pt}function bs(G){return kl(G,Ul,Ol)}function Si(G,te){var ue=G.__data__;return Nl(te)?ue[typeof te=="string"?"string":"hash"]:ue.map}function Sn(G,te){var ue=xe(G,te);return Ml(ue)?ue:void 0}function Rl(G){var te=ht.call(G,_e),ue=G[_e];try{G[_e]=void 0;var ye=!0}catch{}var Pe=wi.call(G);return ye&&(te?G[_e]=ue:delete G[_e]),Pe}var Ol=ot?function(G){return G==null?[]:(G=Object(G),he(ot(G),function(te){return xn.call(G,te)}))}:Gl,zt=Un;(gr&&zt(new gr(new ArrayBuffer(1)))!=T||Hn&&zt(new Hn)!=m||vr&&zt(vr.resolve())!=E||yr&&zt(new yr)!=y||br&&zt(new br)!=_)&&(zt=function(G){var te=Un(G),ue=te==b?G.constructor:void 0,ye=ue?rn(ue):"";if(ye)switch(ye){case el:return T;case tl:return m;case nl:return E;case il:return y;case rl:return _}return te});function Pl(G,te){return te=te??o,!!te&&(typeof G=="number"||W.test(G))&&G>-1&&G%1==0&&G<te}function Nl(G){var te=typeof G;return te=="string"||te=="number"||te=="symbol"||te=="boolean"?G!=="__proto__":G===null}function Bl(G){return!!bi&&bi in G}function Vl(G){var te=G&&G.constructor,ue=typeof te=="function"&&te.prototype||st;return G===ue}function Wl(G){return wi.call(G)}function rn(G){if(G!=null){try{return yi.call(G)}catch{}try{return G+""}catch{}}return""}function ws(G,te){return G===te||G!==G&&te!==te}var jl=gs((function(){return arguments})())?gs:function(G){return Gn(G)&&ht.call(G,"callee")&&!xn.call(G,"callee")},Di=Array.isArray;function Hl(G){return G!=null&&xs(G.length)&&!Cs(G)}var Cr=en||Kl;function zl(G,te){return vs(G,te)}function Cs(G){if(!Ss(G))return!1;var te=Un(G);return te==d||te==c||te==u||te==S}function xs(G){return typeof G=="number"&&G>-1&&G%1==0&&G<=o}function Ss(G){var te=typeof G;return G!=null&&(te=="object"||te=="function")}function Gn(G){return G!=null&&typeof G=="object"}var Ds=de?fe(de):_l;function Ul(G){return Hl(G)?Tl(G):Il(G)}function Gl(){return[]}function Kl(){return!1}h.exports=zl})(Gi,Gi.exports);var za=Gi.exports,Dt={};Object.defineProperty(Dt,"__esModule",{value:!0});Dt.getAceInstance=Dt.debounce=Dt.editorEvents=Dt.editorOptions=void 0;var mv=["minLines","maxLines","readOnly","highlightActiveLine","tabSize","enableBasicAutocompletion","enableLiveAutocompletion","enableSnippets"];Dt.editorOptions=mv;var gv=["onChange","onFocus","onInput","onBlur","onCopy","onPaste","onSelectionChange","onCursorChange","onScroll","handleOptions","updateRef"];Dt.editorEvents=gv;var vv=function(){var h;return typeof window>"u"?(ut.window={},h=Ui,delete ut.window):window.ace?(h=window.ace,h.acequire=window.ace.require||window.ace.acequire):h=Ui,h};Dt.getAceInstance=vv;var yv=function(h,e){var t=null;return function(){var n=this,f=arguments;clearTimeout(t),t=setTimeout(function(){h.apply(n,f)},e)}};Dt.debounce=yv;var bv=mn&&mn.__extends||(function(){var h=function(e,t){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,f){n.__proto__=f}||function(n,f){for(var i in f)Object.prototype.hasOwnProperty.call(f,i)&&(n[i]=f[i])},h(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");h(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),zr=mn&&mn.__assign||function(){return zr=Object.assign||function(h){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var f in e)Object.prototype.hasOwnProperty.call(e,f)&&(h[f]=e[f])}return h},zr.apply(this,arguments)};Object.defineProperty(mn,"__esModule",{value:!0});var wv=Ui,be=Kr,io=Q,Li=za,$n=Dt,ro=(0,$n.getAceInstance)(),Cv=(function(h){bv(e,h);function e(t){var n=h.call(this,t)||this;return $n.editorEvents.forEach(function(f){n[f]=n[f].bind(n)}),n.debounce=$n.debounce,n}return e.prototype.isInShadow=function(t){for(var n=t&&t.parentNode;n;){if(n.toString()==="[object ShadowRoot]")return!0;n=n.parentNode}return!1},e.prototype.componentDidMount=function(){var t=this,n=this.props,f=n.className,i=n.onBeforeLoad,o=n.onValidate,p=n.mode,s=n.focus,u=n.theme,r=n.fontSize,a=n.lineHeight,l=n.value,d=n.defaultValue,c=n.showGutter,m=n.wrapEnabled,g=n.showPrintMargin,v=n.scrollMargin,b=v===void 0?[0,0,0,0]:v,E=n.keyboardHandler,S=n.onLoad,w=n.commands,y=n.annotations,D=n.markers,$=n.placeholder;this.editor=ro.edit(this.refEditor),i&&i(ro);for(var A=Object.keys(this.props.editorProps),_=0;_<A.length;_++)this.editor[A[_]]=this.props.editorProps[A[_]];this.props.debounceChangePeriod&&(this.onChange=this.debounce(this.onChange,this.props.debounceChangePeriod)),this.editor.renderer.setScrollMargin(b[0],b[1],b[2],b[3]),this.isInShadow(this.refEditor)&&this.editor.renderer.attachToShadowRoot(),this.editor.getSession().setMode(typeof p=="string"?"ace/mode/".concat(p):p),u&&u!==""&&this.editor.setTheme("ace/theme/".concat(u)),this.editor.setFontSize(typeof r=="number"?"".concat(r,"px"):r),a&&(this.editor.container.style.lineHeight=typeof a=="number"?"".concat(a,"px"):"".concat(a),this.editor.renderer.updateFontSize()),this.editor.getSession().setValue(d||l||""),this.props.navigateToFileEnd&&this.editor.navigateFileEnd(),this.editor.renderer.setShowGutter(c),this.editor.getSession().setUseWrapMode(m),this.editor.setShowPrintMargin(g),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),$&&this.updatePlaceholder(),this.editor.getSession().selection.on("changeSelection",this.onSelectionChange),this.editor.getSession().selection.on("changeCursor",this.onCursorChange),o&&this.editor.getSession().on("changeAnnotation",function(){var T=t.editor.getSession().getAnnotations();t.props.onValidate(T)}),this.editor.session.on("changeScrollTop",this.onScroll),this.editor.getSession().setAnnotations(y||[]),D&&D.length>0&&this.handleMarkers(D);var L=this.editor.$options;$n.editorOptions.forEach(function(T){L.hasOwnProperty(T)?t.editor.setOption(T,t.props[T]):t.props[T]&&console.warn("ReactAce: editor option ".concat(T," was activated but not found. Did you need to import a related tool or did you possibly mispell the option?"))}),this.handleOptions(this.props),Array.isArray(w)&&w.forEach(function(T){typeof T.exec=="string"?t.editor.commands.bindKey(T.bindKey,T.exec):t.editor.commands.addCommand(T)}),E&&this.editor.setKeyboardHandler("ace/keyboard/"+E),f&&(this.refEditor.className+=" "+f),S&&S(this.editor),this.editor.resize(),s&&this.editor.focus()},e.prototype.componentDidUpdate=function(t){for(var n=t,f=this.props,i=0;i<$n.editorOptions.length;i++){var o=$n.editorOptions[i];f[o]!==n[o]&&this.editor.setOption(o,f[o])}if(f.className!==n.className){var p=this.refEditor.className,s=p.trim().split(" "),u=n.className.trim().split(" ");u.forEach(function(l){var d=s.indexOf(l);s.splice(d,1)}),this.refEditor.className=" "+f.className+" "+s.join(" ")}var r=this.editor&&f.value!=null&&this.editor.getValue()!==f.value;if(r){this.silent=!0;var a=this.editor.session.selection.toJSON();this.editor.setValue(f.value,f.cursorStart),this.editor.session.selection.fromJSON(a),this.silent=!1}f.placeholder!==n.placeholder&&this.updatePlaceholder(),f.mode!==n.mode&&this.editor.getSession().setMode(typeof f.mode=="string"?"ace/mode/".concat(f.mode):f.mode),f.theme!==n.theme&&this.editor.setTheme("ace/theme/"+f.theme),f.keyboardHandler!==n.keyboardHandler&&(f.keyboardHandler?this.editor.setKeyboardHandler("ace/keyboard/"+f.keyboardHandler):this.editor.setKeyboardHandler(null)),f.fontSize!==n.fontSize&&this.editor.setFontSize(typeof f.fontSize=="number"?"".concat(f.fontSize,"px"):f.fontSize),f.lineHeight!==n.lineHeight&&(this.editor.container.style.lineHeight=typeof f.lineHeight=="number"?"".concat(f.lineHeight,"px"):f.lineHeight,this.editor.renderer.updateFontSize()),f.wrapEnabled!==n.wrapEnabled&&this.editor.getSession().setUseWrapMode(f.wrapEnabled),f.showPrintMargin!==n.showPrintMargin&&this.editor.setShowPrintMargin(f.showPrintMargin),f.showGutter!==n.showGutter&&this.editor.renderer.setShowGutter(f.showGutter),Li(f.setOptions,n.setOptions)||this.handleOptions(f),(r||!Li(f.annotations,n.annotations))&&this.editor.getSession().setAnnotations(f.annotations||[]),!Li(f.markers,n.markers)&&Array.isArray(f.markers)&&this.handleMarkers(f.markers),Li(f.scrollMargin,n.scrollMargin)||this.handleScrollMargins(f.scrollMargin),(t.height!==this.props.height||t.width!==this.props.width)&&this.editor.resize(),this.props.focus&&!t.focus&&this.editor.focus()},e.prototype.handleScrollMargins=function(t){t===void 0&&(t=[0,0,0,0]),this.editor.renderer.setScrollMargin(t[0],t[1],t[2],t[3])},e.prototype.componentWillUnmount=function(){this.editor&&(this.editor.destroy(),this.editor=null)},e.prototype.onChange=function(t){if(this.editor&&this.props.onChange&&!this.silent){var n=this.editor.getValue();this.props.onChange(n,t)}},e.prototype.onSelectionChange=function(t){if(this.props.onSelectionChange){var n=this.editor.getSelection();this.props.onSelectionChange(n,t)}},e.prototype.onCursorChange=function(t){if(this.props.onCursorChange){var n=this.editor.getSelection();this.props.onCursorChange(n,t)}},e.prototype.onInput=function(t){this.props.onInput&&this.props.onInput(t),this.props.placeholder&&this.updatePlaceholder()},e.prototype.onFocus=function(t){this.props.onFocus&&this.props.onFocus(t,this.editor)},e.prototype.onBlur=function(t){this.props.onBlur&&this.props.onBlur(t,this.editor)},e.prototype.onCopy=function(t){var n=t.text;this.props.onCopy&&this.props.onCopy(n)},e.prototype.onPaste=function(t){var n=t.text;this.props.onPaste&&this.props.onPaste(n)},e.prototype.onScroll=function(){this.props.onScroll&&this.props.onScroll(this.editor)},e.prototype.handleOptions=function(t){for(var n=Object.keys(t.setOptions),f=0;f<n.length;f++)this.editor.setOption(n[f],t.setOptions[n[f]])},e.prototype.handleMarkers=function(t){var n=this,f=this.editor.getSession().getMarkers(!0);for(var i in f)f.hasOwnProperty(i)&&this.editor.getSession().removeMarker(f[i].id);f=this.editor.getSession().getMarkers(!1);for(var i in f)f.hasOwnProperty(i)&&f[i].clazz!=="ace_active-line"&&f[i].clazz!=="ace_selected-word"&&this.editor.getSession().removeMarker(f[i].id);t.forEach(function(o){var p=o.startRow,s=o.startCol,u=o.endRow,r=o.endCol,a=o.className,l=o.type,d=o.inFront,c=d===void 0?!1:d,m=new wv.Range(p,s,u,r);n.editor.getSession().addMarker(m,a,l,c)})},e.prototype.updatePlaceholder=function(){var t=this.editor,n=this.props.placeholder,f=!t.session.getValue().length,i=t.renderer.placeholderNode;!f&&i?(t.renderer.scroller.removeChild(t.renderer.placeholderNode),t.renderer.placeholderNode=null):f&&!i?(i=t.renderer.placeholderNode=document.createElement("div"),i.textContent=n||"",i.className="ace_comment ace_placeholder",i.style.padding="0 9px",i.style.position="absolute",i.style.zIndex="3",t.renderer.scroller.appendChild(i)):f&&i&&(i.textContent=n)},e.prototype.updateRef=function(t){this.refEditor=t},e.prototype.render=function(){var t=this.props,n=t.name,f=t.width,i=t.height,o=t.style,p=zr({width:f,height:i},o);return io.createElement("div",{ref:this.updateRef,id:n,style:p})},e.propTypes={mode:be.oneOfType([be.string,be.object]),focus:be.bool,theme:be.string,name:be.string,className:be.string,height:be.string,width:be.string,fontSize:be.oneOfType([be.number,be.string]),lineHeight:be.oneOfType([be.number,be.string]),showGutter:be.bool,onChange:be.func,onCopy:be.func,onPaste:be.func,onFocus:be.func,onInput:be.func,onBlur:be.func,onScroll:be.func,value:be.string,defaultValue:be.string,onLoad:be.func,onSelectionChange:be.func,onCursorChange:be.func,onBeforeLoad:be.func,onValidate:be.func,minLines:be.number,maxLines:be.number,readOnly:be.bool,highlightActiveLine:be.bool,tabSize:be.number,showPrintMargin:be.bool,cursorStart:be.number,debounceChangePeriod:be.number,editorProps:be.object,setOptions:be.object,style:be.object,scrollMargin:be.array,annotations:be.array,markers:be.array,keyboardHandler:be.string,wrapEnabled:be.bool,enableSnippets:be.bool,enableBasicAutocompletion:be.oneOfType([be.bool,be.array]),enableLiveAutocompletion:be.oneOfType([be.bool,be.array]),navigateToFileEnd:be.bool,commands:be.array,placeholder:be.string},e.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},e})(io.Component);mn.default=Cv;var ui={},Xt={},Ua={exports:{}};(function(h,e){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(t,n,f){var i=t("./lib/oop");t("./lib/lang");var o=t("./lib/event_emitter").EventEmitter,p=t("./editor").Editor,s=t("./virtual_renderer").VirtualRenderer,u=t("./edit_session").EditSession,r;r=function(a,l,d){this.BELOW=1,this.BESIDE=0,this.$container=a,this.$theme=l,this.$splits=0,this.$editorCSS="",this.$editors=[],this.$orientation=this.BESIDE,this.setSplits(d||1),this.$cEditor=this.$editors[0],this.on("focus",function(c){this.$cEditor=c}.bind(this))},(function(){i.implement(this,o),this.$createEditor=function(){var a=document.createElement("div");a.className=this.$editorCSS,a.style.cssText="position: absolute; top:0px; bottom:0px",this.$container.appendChild(a);var l=new p(new s(a,this.$theme));return l.on("focus",function(){this._emit("focus",l)}.bind(this)),this.$editors.push(l),l.setFontSize(this.$fontSize),l},this.setSplits=function(a){var l;if(a<1)throw"The number of splits have to be > 0!";if(a!=this.$splits){if(a>this.$splits){for(;this.$splits<this.$editors.length&&this.$splits<a;)l=this.$editors[this.$splits],this.$container.appendChild(l.container),l.setFontSize(this.$fontSize),this.$splits++;for(;this.$splits<a;)this.$createEditor(),this.$splits++}else for(;this.$splits>a;)l=this.$editors[this.$splits-1],this.$container.removeChild(l.container),this.$splits--;this.resize()}},this.getSplits=function(){return this.$splits},this.getEditor=function(a){return this.$editors[a]},this.getCurrentEditor=function(){return this.$cEditor},this.focus=function(){this.$cEditor.focus()},this.blur=function(){this.$cEditor.blur()},this.setTheme=function(a){this.$editors.forEach(function(l){l.setTheme(a)})},this.setKeyboardHandler=function(a){this.$editors.forEach(function(l){l.setKeyboardHandler(a)})},this.forEach=function(a,l){this.$editors.forEach(a,l)},this.$fontSize="",this.setFontSize=function(a){this.$fontSize=a,this.forEach(function(l){l.setFontSize(a)})},this.$cloneSession=function(a){var l=new u(a.getDocument(),a.getMode()),d=a.getUndoManager();return l.setUndoManager(d),l.setTabSize(a.getTabSize()),l.setUseSoftTabs(a.getUseSoftTabs()),l.setOverwrite(a.getOverwrite()),l.setBreakpoints(a.getBreakpoints()),l.setUseWrapMode(a.getUseWrapMode()),l.setUseWorker(a.getUseWorker()),l.setWrapLimitRange(a.$wrapLimitRange.min,a.$wrapLimitRange.max),l.$foldData=a.$cloneFoldData(),l},this.setSession=function(a,l){var d;l==null?d=this.$cEditor:d=this.$editors[l];var c=this.$editors.some(function(m){return m.session===a});return c&&(a=this.$cloneSession(a)),d.setSession(a),a},this.getOrientation=function(){return this.$orientation},this.setOrientation=function(a){this.$orientation!=a&&(this.$orientation=a,this.resize())},this.resize=function(){var a=this.$container.clientWidth,l=this.$container.clientHeight,d;if(this.$orientation==this.BESIDE)for(var c=a/this.$splits,m=0;m<this.$splits;m++)d=this.$editors[m],d.container.style.width=c+"px",d.container.style.top="0px",d.container.style.left=m*c+"px",d.container.style.height=l+"px",d.resize();else for(var g=l/this.$splits,m=0;m<this.$splits;m++)d=this.$editors[m],d.container.style.width=a+"px",d.container.style.top=m*g+"px",d.container.style.left="0px",d.container.style.height=g+"px",d.resize()}}).call(r.prototype),n.Split=r}),ace.define("ace/ext/split",["require","exports","module","ace/ext/split","ace/split"],function(t,n,f){f.exports=t("../split")}),(function(){ace.require(["ace/ext/split"],function(t){h&&(h.exports=t)})})()})(Ua);var xv=Ua.exports,Sv="Expected a function",Ga="__lodash_hash_undefined__",Dv="[object Function]",Ev="[object GeneratorFunction]",Av="[object Symbol]",Tv=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,kv=/^\w*$/,$v=/^\./,Mv=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,_v=/[\\^$.*+?()[\]{}|]/g,Iv=/\\(\\)?/g,Lv=/^\[object .+?Constructor\]$/,Fv=typeof ut=="object"&&ut&&ut.Object===Object&&ut,Rv=typeof self=="object"&&self&&self.Object===Object&&self,hs=Fv||Rv||Function("return this")();function Ov(h,e){return h==null?void 0:h[e]}function Pv(h){var e=!1;if(h!=null&&typeof h.toString!="function")try{e=!!(h+"")}catch{}return e}var Nv=Array.prototype,Bv=Function.prototype,Ka=Object.prototype,Mr=hs["__core-js_shared__"],so=(function(){var h=/[^.]+$/.exec(Mr&&Mr.keys&&Mr.keys.IE_PROTO||"");return h?"Symbol(src)_1."+h:""})(),Ya=Bv.toString,ds=Ka.hasOwnProperty,Ja=Ka.toString,Vv=RegExp("^"+Ya.call(ds).replace(_v,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),oo=hs.Symbol,Wv=Nv.splice,jv=Qa(hs,"Map"),hi=Qa(Object,"create"),ao=oo?oo.prototype:void 0,lo=ao?ao.toString:void 0;function gn(h){var e=-1,t=h?h.length:0;for(this.clear();++e<t;){var n=h[e];this.set(n[0],n[1])}}function Hv(){this.__data__=hi?hi(null):{}}function zv(h){return this.has(h)&&delete this.__data__[h]}function Uv(h){var e=this.__data__;if(hi){var t=e[h];return t===Ga?void 0:t}return ds.call(e,h)?e[h]:void 0}function Gv(h){var e=this.__data__;return hi?e[h]!==void 0:ds.call(e,h)}function Kv(h,e){var t=this.__data__;return t[h]=hi&&e===void 0?Ga:e,this}gn.prototype.clear=Hv;gn.prototype.delete=zv;gn.prototype.get=Uv;gn.prototype.has=Gv;gn.prototype.set=Kv;function Vn(h){var e=-1,t=h?h.length:0;for(this.clear();++e<t;){var n=h[e];this.set(n[0],n[1])}}function Yv(){this.__data__=[]}function Jv(h){var e=this.__data__,t=pr(e,h);if(t<0)return!1;var n=e.length-1;return t==n?e.pop():Wv.call(e,t,1),!0}function Qv(h){var e=this.__data__,t=pr(e,h);return t<0?void 0:e[t][1]}function Xv(h){return pr(this.__data__,h)>-1}function Zv(h,e){var t=this.__data__,n=pr(t,h);return n<0?t.push([h,e]):t[n][1]=e,this}Vn.prototype.clear=Yv;Vn.prototype.delete=Jv;Vn.prototype.get=Qv;Vn.prototype.has=Xv;Vn.prototype.set=Zv;function bn(h){var e=-1,t=h?h.length:0;for(this.clear();++e<t;){var n=h[e];this.set(n[0],n[1])}}function qv(){this.__data__={hash:new gn,map:new(jv||Vn),string:new gn}}function ey(h){return fr(this,h).delete(h)}function ty(h){return fr(this,h).get(h)}function ny(h){return fr(this,h).has(h)}function iy(h,e){return fr(this,h).set(h,e),this}bn.prototype.clear=qv;bn.prototype.delete=ey;bn.prototype.get=ty;bn.prototype.has=ny;bn.prototype.set=iy;function pr(h,e){for(var t=h.length;t--;)if(fy(h[t][0],e))return t;return-1}function ry(h,e){e=ly(e,h)?[e]:ay(e);for(var t=0,n=e.length;h!=null&&t<n;)h=h[dy(e[t++])];return t&&t==n?h:void 0}function sy(h){if(!Za(h)||uy(h))return!1;var e=my(h)||Pv(h)?Vv:Lv;return e.test(py(h))}function oy(h){if(typeof h=="string")return h;if(fs(h))return lo?lo.call(h):"";var e=h+"";return e=="0"&&1/h==-1/0?"-0":e}function ay(h){return Xa(h)?h:hy(h)}function fr(h,e){var t=h.__data__;return cy(e)?t[typeof e=="string"?"string":"hash"]:t.map}function Qa(h,e){var t=Ov(h,e);return sy(t)?t:void 0}function ly(h,e){if(Xa(h))return!1;var t=typeof h;return t=="number"||t=="symbol"||t=="boolean"||h==null||fs(h)?!0:kv.test(h)||!Tv.test(h)||e!=null&&h in Object(e)}function cy(h){var e=typeof h;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?h!=="__proto__":h===null}function uy(h){return!!so&&so in h}var hy=ps(function(h){h=vy(h);var e=[];return $v.test(h)&&e.push(""),h.replace(Mv,function(t,n,f,i){e.push(f?i.replace(Iv,"$1"):n||t)}),e});function dy(h){if(typeof h=="string"||fs(h))return h;var e=h+"";return e=="0"&&1/h==-1/0?"-0":e}function py(h){if(h!=null){try{return Ya.call(h)}catch{}try{return h+""}catch{}}return""}function ps(h,e){if(typeof h!="function"||e&&typeof e!="function")throw new TypeError(Sv);var t=function(){var n=arguments,f=e?e.apply(this,n):n[0],i=t.cache;if(i.has(f))return i.get(f);var o=h.apply(this,n);return t.cache=i.set(f,o),o};return t.cache=new(ps.Cache||bn),t}ps.Cache=bn;function fy(h,e){return h===e||h!==h&&e!==e}var Xa=Array.isArray;function my(h){var e=Za(h)?Ja.call(h):"";return e==Dv||e==Ev}function Za(h){var e=typeof h;return!!h&&(e=="object"||e=="function")}function gy(h){return!!h&&typeof h=="object"}function fs(h){return typeof h=="symbol"||gy(h)&&Ja.call(h)==Av}function vy(h){return h==null?"":oy(h)}function yy(h,e,t){var n=h==null?void 0:ry(h,e);return n===void 0?t:n}var by=yy,wy=Xt&&Xt.__extends||(function(){var h=function(e,t){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,f){n.__proto__=f}||function(n,f){for(var i in f)Object.prototype.hasOwnProperty.call(f,i)&&(n[i]=f[i])},h(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");h(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})(),Ur=Xt&&Xt.__assign||function(){return Ur=Object.assign||function(h){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var f in e)Object.prototype.hasOwnProperty.call(e,f)&&(h[f]=e[f])}return h},Ur.apply(this,arguments)};Object.defineProperty(Xt,"__esModule",{value:!0});var dn=Dt,_r=(0,dn.getAceInstance)(),Cy=Ui,xy=xv,Ce=Kr,co=Q,Ir=za,Ft=by,Sy=(function(h){wy(e,h);function e(t){var n=h.call(this,t)||this;return dn.editorEvents.forEach(function(f){n[f]=n[f].bind(n)}),n.debounce=dn.debounce,n}return e.prototype.isInShadow=function(t){for(var n=t&&t.parentNode;n;){if(n.toString()==="[object ShadowRoot]")return!0;n=n.parentNode}return!1},e.prototype.componentDidMount=function(){var t=this,n=this.props,f=n.className,i=n.onBeforeLoad,o=n.mode,p=n.focus,s=n.theme,u=n.fontSize,r=n.value,a=n.defaultValue,l=n.cursorStart,d=n.showGutter,c=n.wrapEnabled,m=n.showPrintMargin,g=n.scrollMargin,v=g===void 0?[0,0,0,0]:g,b=n.keyboardHandler,E=n.onLoad,S=n.commands,w=n.annotations,y=n.markers,D=n.splits;this.editor=_r.edit(this.refEditor),this.isInShadow(this.refEditor)&&this.editor.renderer.attachToShadowRoot(),this.editor.setTheme("ace/theme/".concat(s)),i&&i(_r);var $=Object.keys(this.props.editorProps),A=new xy.Split(this.editor.container,"ace/theme/".concat(s),D);this.editor.env.split=A,this.splitEditor=A.getEditor(0),this.split=A,this.editor.setShowPrintMargin(!1),this.editor.renderer.setShowGutter(!1);var _=this.splitEditor.$options;this.props.debounceChangePeriod&&(this.onChange=this.debounce(this.onChange,this.props.debounceChangePeriod)),A.forEach(function(T,k){for(var x=0;x<$.length;x++)T[$[x]]=t.props.editorProps[$[x]];var C=Ft(a,k),M=Ft(r,k,"");T.session.setUndoManager(new _r.UndoManager),T.setTheme("ace/theme/".concat(s)),T.renderer.setScrollMargin(v[0],v[1],v[2],v[3]),T.getSession().setMode("ace/mode/".concat(o)),T.setFontSize(u),T.renderer.setShowGutter(d),T.getSession().setUseWrapMode(c),T.setShowPrintMargin(m),T.on("focus",t.onFocus),T.on("blur",t.onBlur),T.on("input",t.onInput),T.on("copy",t.onCopy),T.on("paste",t.onPaste),T.on("change",t.onChange),T.getSession().selection.on("changeSelection",t.onSelectionChange),T.getSession().selection.on("changeCursor",t.onCursorChange),T.session.on("changeScrollTop",t.onScroll),T.setValue(C===void 0?M:C,l);var F=Ft(w,k,[]),R=Ft(y,k,[]);T.getSession().setAnnotations(F),R&&R.length>0&&t.handleMarkers(R,T);for(var x=0;x<dn.editorOptions.length;x++){var O=dn.editorOptions[x];_.hasOwnProperty(O)?T.setOption(O,t.props[O]):t.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?"))}t.handleOptions(t.props,T),Array.isArray(S)&&S.forEach(function(B){typeof B.exec=="string"?T.commands.bindKey(B.bindKey,B.exec):T.commands.addCommand(B)}),b&&T.setKeyboardHandler("ace/keyboard/"+b)}),f&&(this.refEditor.className+=" "+f),p&&this.splitEditor.focus();var L=this.editor.env.split;L.setOrientation(this.props.orientation==="below"?L.BELOW:L.BESIDE),L.resize(!0),E&&E(L)},e.prototype.componentDidUpdate=function(t){var n=this,f=t,i=this.props,o=this.editor.env.split;if(i.splits!==f.splits&&o.setSplits(i.splits),i.orientation!==f.orientation&&o.setOrientation(i.orientation==="below"?o.BELOW:o.BESIDE),o.forEach(function(r,a){i.mode!==f.mode&&r.getSession().setMode("ace/mode/"+i.mode),i.keyboardHandler!==f.keyboardHandler&&(i.keyboardHandler?r.setKeyboardHandler("ace/keyboard/"+i.keyboardHandler):r.setKeyboardHandler(null)),i.fontSize!==f.fontSize&&r.setFontSize(i.fontSize),i.wrapEnabled!==f.wrapEnabled&&r.getSession().setUseWrapMode(i.wrapEnabled),i.showPrintMargin!==f.showPrintMargin&&r.setShowPrintMargin(i.showPrintMargin),i.showGutter!==f.showGutter&&r.renderer.setShowGutter(i.showGutter);for(var l=0;l<dn.editorOptions.length;l++){var d=dn.editorOptions[l];i[d]!==f[d]&&r.setOption(d,i[d])}Ir(i.setOptions,f.setOptions)||n.handleOptions(i,r);var c=Ft(i.value,a,"");if(r.getValue()!==c){n.silent=!0;var m=r.session.selection.toJSON();r.setValue(c,i.cursorStart),r.session.selection.fromJSON(m),n.silent=!1}var g=Ft(i.annotations,a,[]),v=Ft(f.annotations,a,[]);Ir(g,v)||r.getSession().setAnnotations(g);var b=Ft(i.markers,a,[]),E=Ft(f.markers,a,[]);!Ir(b,E)&&Array.isArray(b)&&n.handleMarkers(b,r)}),i.className!==f.className){var p=this.refEditor.className,s=p.trim().split(" "),u=f.className.trim().split(" ");u.forEach(function(r){var a=s.indexOf(r);s.splice(a,1)}),this.refEditor.className=" "+i.className+" "+s.join(" ")}i.theme!==f.theme&&o.setTheme("ace/theme/"+i.theme),i.focus&&!f.focus&&this.splitEditor.focus(),(i.height!==this.props.height||i.width!==this.props.width)&&this.editor.resize()},e.prototype.componentWillUnmount=function(){this.editor.destroy(),this.editor=null},e.prototype.onChange=function(t){if(this.props.onChange&&!this.silent){var n=[];this.editor.env.split.forEach(function(f){n.push(f.getValue())}),this.props.onChange(n,t)}},e.prototype.onSelectionChange=function(t){if(this.props.onSelectionChange){var n=[];this.editor.env.split.forEach(function(f){n.push(f.getSelection())}),this.props.onSelectionChange(n,t)}},e.prototype.onCursorChange=function(t){if(this.props.onCursorChange){var n=[];this.editor.env.split.forEach(function(f){n.push(f.getSelection())}),this.props.onCursorChange(n,t)}},e.prototype.onFocus=function(t){this.props.onFocus&&this.props.onFocus(t)},e.prototype.onInput=function(t){this.props.onInput&&this.props.onInput(t)},e.prototype.onBlur=function(t){this.props.onBlur&&this.props.onBlur(t)},e.prototype.onCopy=function(t){this.props.onCopy&&this.props.onCopy(t)},e.prototype.onPaste=function(t){this.props.onPaste&&this.props.onPaste(t)},e.prototype.onScroll=function(){this.props.onScroll&&this.props.onScroll(this.editor)},e.prototype.handleOptions=function(t,n){for(var f=Object.keys(t.setOptions),i=0;i<f.length;i++)n.setOption(f[i],t.setOptions[f[i]])},e.prototype.handleMarkers=function(t,n){var f=n.getSession().getMarkers(!0);for(var i in f)f.hasOwnProperty(i)&&n.getSession().removeMarker(f[i].id);f=n.getSession().getMarkers(!1);for(var i in f)f.hasOwnProperty(i)&&n.getSession().removeMarker(f[i].id);t.forEach(function(o){var p=o.startRow,s=o.startCol,u=o.endRow,r=o.endCol,a=o.className,l=o.type,d=o.inFront,c=d===void 0?!1:d,m=new Cy.Range(p,s,u,r);n.getSession().addMarker(m,a,l,c)})},e.prototype.updateRef=function(t){this.refEditor=t},e.prototype.render=function(){var t=this.props,n=t.name,f=t.width,i=t.height,o=t.style,p=Ur({width:f,height:i},o);return co.createElement("div",{ref:this.updateRef,id:n,style:p})},e.propTypes={className:Ce.string,debounceChangePeriod:Ce.number,defaultValue:Ce.arrayOf(Ce.string),focus:Ce.bool,fontSize:Ce.oneOfType([Ce.number,Ce.string]),height:Ce.string,mode:Ce.string,name:Ce.string,onBlur:Ce.func,onChange:Ce.func,onCopy:Ce.func,onFocus:Ce.func,onInput:Ce.func,onLoad:Ce.func,onPaste:Ce.func,onScroll:Ce.func,orientation:Ce.string,showGutter:Ce.bool,splits:Ce.number,theme:Ce.string,value:Ce.arrayOf(Ce.string),width:Ce.string,onSelectionChange:Ce.func,onCursorChange:Ce.func,onBeforeLoad:Ce.func,minLines:Ce.number,maxLines:Ce.number,readOnly:Ce.bool,highlightActiveLine:Ce.bool,tabSize:Ce.number,showPrintMargin:Ce.bool,cursorStart:Ce.number,editorProps:Ce.object,setOptions:Ce.object,style:Ce.object,scrollMargin:Ce.array,annotations:Ce.array,markers:Ce.array,keyboardHandler:Ce.string,wrapEnabled:Ce.bool,enableBasicAutocompletion:Ce.oneOfType([Ce.bool,Ce.array]),enableLiveAutocompletion:Ce.oneOfType([Ce.bool,Ce.array]),commands:Ce.array},e.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},e})(co.Component);Xt.default=Sy;var qa={exports:{}};(function(h){var e=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},t=-1,n=1,f=0;e.Diff=function(i,o){return[i,o]},e.prototype.diff_main=function(i,o,p,s){typeof s>"u"&&(this.Diff_Timeout<=0?s=Number.MAX_VALUE:s=new Date().getTime()+this.Diff_Timeout*1e3);var u=s;if(i==null||o==null)throw new Error("Null input. (diff_main)");if(i==o)return i?[new e.Diff(f,i)]:[];typeof p>"u"&&(p=!0);var r=p,a=this.diff_commonPrefix(i,o),l=i.substring(0,a);i=i.substring(a),o=o.substring(a),a=this.diff_commonSuffix(i,o);var d=i.substring(i.length-a);i=i.substring(0,i.length-a),o=o.substring(0,o.length-a);var c=this.diff_compute_(i,o,r,u);return l&&c.unshift(new e.Diff(f,l)),d&&c.push(new e.Diff(f,d)),this.diff_cleanupMerge(c),c},e.prototype.diff_compute_=function(i,o,p,s){var u;if(!i)return[new e.Diff(n,o)];if(!o)return[new e.Diff(t,i)];var r=i.length>o.length?i:o,a=i.length>o.length?o:i,l=r.indexOf(a);if(l!=-1)return u=[new e.Diff(n,r.substring(0,l)),new e.Diff(f,a),new e.Diff(n,r.substring(l+a.length))],i.length>o.length&&(u[0][0]=u[2][0]=t),u;if(a.length==1)return[new e.Diff(t,i),new e.Diff(n,o)];var d=this.diff_halfMatch_(i,o);if(d){var c=d[0],m=d[1],g=d[2],v=d[3],b=d[4],E=this.diff_main(c,g,p,s),S=this.diff_main(m,v,p,s);return E.concat([new e.Diff(f,b)],S)}return p&&i.length>100&&o.length>100?this.diff_lineMode_(i,o,s):this.diff_bisect_(i,o,s)},e.prototype.diff_lineMode_=function(i,o,p){var s=this.diff_linesToChars_(i,o);i=s.chars1,o=s.chars2;var u=s.lineArray,r=this.diff_main(i,o,!1,p);this.diff_charsToLines_(r,u),this.diff_cleanupSemantic(r),r.push(new e.Diff(f,""));for(var a=0,l=0,d=0,c="",m="";a<r.length;){switch(r[a][0]){case n:d++,m+=r[a][1];break;case t:l++,c+=r[a][1];break;case f:if(l>=1&&d>=1){r.splice(a-l-d,l+d),a=a-l-d;for(var g=this.diff_main(c,m,!1,p),v=g.length-1;v>=0;v--)r.splice(a,0,g[v]);a=a+g.length}d=0,l=0,c="",m="";break}a++}return r.pop(),r},e.prototype.diff_bisect_=function(i,o,p){for(var s=i.length,u=o.length,r=Math.ceil((s+u)/2),a=r,l=2*r,d=new Array(l),c=new Array(l),m=0;m<l;m++)d[m]=-1,c[m]=-1;d[a+1]=0,c[a+1]=0;for(var g=s-u,v=g%2!=0,b=0,E=0,S=0,w=0,y=0;y<r&&!(new Date().getTime()>p);y++){for(var D=-y+b;D<=y-E;D+=2){var $=a+D,A;D==-y||D!=y&&d[$-1]<d[$+1]?A=d[$+1]:A=d[$-1]+1;for(var _=A-D;A<s&&_<u&&i.charAt(A)==o.charAt(_);)A++,_++;if(d[$]=A,A>s)E+=2;else if(_>u)b+=2;else if(v){var L=a+g-D;if(L>=0&&L<l&&c[L]!=-1){var T=s-c[L];if(A>=T)return this.diff_bisectSplit_(i,o,A,_,p)}}}for(var k=-y+S;k<=y-w;k+=2){var L=a+k,T;k==-y||k!=y&&c[L-1]<c[L+1]?T=c[L+1]:T=c[L-1]+1;for(var x=T-k;T<s&&x<u&&i.charAt(s-T-1)==o.charAt(u-x-1);)T++,x++;if(c[L]=T,T>s)w+=2;else if(x>u)S+=2;else if(!v){var $=a+g-k;if($>=0&&$<l&&d[$]!=-1){var A=d[$],_=a+A-$;if(T=s-T,A>=T)return this.diff_bisectSplit_(i,o,A,_,p)}}}}return[new e.Diff(t,i),new e.Diff(n,o)]},e.prototype.diff_bisectSplit_=function(i,o,p,s,u){var r=i.substring(0,p),a=o.substring(0,s),l=i.substring(p),d=o.substring(s),c=this.diff_main(r,a,!1,u),m=this.diff_main(l,d,!1,u);return c.concat(m)},e.prototype.diff_linesToChars_=function(i,o){var p=[],s={};p[0]="";function u(d){for(var c="",m=0,g=-1,v=p.length;g<d.length-1;){g=d.indexOf(`
`,m),g==-1&&(g=d.length-1);var b=d.substring(m,g+1);(s.hasOwnProperty?s.hasOwnProperty(b):s[b]!==void 0)?c+=String.fromCharCode(s[b]):(v==r&&(b=d.substring(m),g=d.length),c+=String.fromCharCode(v),s[b]=v,p[v++]=b),m=g+1}return c}var r=4e4,a=u(i);r=65535;var l=u(o);return{chars1:a,chars2:l,lineArray:p}},e.prototype.diff_charsToLines_=function(i,o){for(var p=0;p<i.length;p++){for(var s=i[p][1],u=[],r=0;r<s.length;r++)u[r]=o[s.charCodeAt(r)];i[p][1]=u.join("")}},e.prototype.diff_commonPrefix=function(i,o){if(!i||!o||i.charAt(0)!=o.charAt(0))return 0;for(var p=0,s=Math.min(i.length,o.length),u=s,r=0;p<u;)i.substring(r,u)==o.substring(r,u)?(p=u,r=p):s=u,u=Math.floor((s-p)/2+p);return u},e.prototype.diff_commonSuffix=function(i,o){if(!i||!o||i.charAt(i.length-1)!=o.charAt(o.length-1))return 0;for(var p=0,s=Math.min(i.length,o.length),u=s,r=0;p<u;)i.substring(i.length-u,i.length-r)==o.substring(o.length-u,o.length-r)?(p=u,r=p):s=u,u=Math.floor((s-p)/2+p);return u},e.prototype.diff_commonOverlap_=function(i,o){var p=i.length,s=o.length;if(p==0||s==0)return 0;p>s?i=i.substring(p-s):p<s&&(o=o.substring(0,p));var u=Math.min(p,s);if(i==o)return u;for(var r=0,a=1;;){var l=i.substring(u-a),d=o.indexOf(l);if(d==-1)return r;a+=d,(d==0||i.substring(u-a)==o.substring(0,a))&&(r=a,a++)}},e.prototype.diff_halfMatch_=function(i,o){if(this.Diff_Timeout<=0)return null;var p=i.length>o.length?i:o,s=i.length>o.length?o:i;if(p.length<4||s.length*2<p.length)return null;var u=this;function r(E,S,w){for(var y=E.substring(w,w+Math.floor(E.length/4)),D=-1,$="",A,_,L,T;(D=S.indexOf(y,D+1))!=-1;){var k=u.diff_commonPrefix(E.substring(w),S.substring(D)),x=u.diff_commonSuffix(E.substring(0,w),S.substring(0,D));$.length<x+k&&($=S.substring(D-x,D)+S.substring(D,D+k),A=E.substring(0,w-x),_=E.substring(w+k),L=S.substring(0,D-x),T=S.substring(D+k))}return $.length*2>=E.length?[A,_,L,T,$]:null}var a=r(p,s,Math.ceil(p.length/4)),l=r(p,s,Math.ceil(p.length/2)),d;if(!a&&!l)return null;l?a?d=a[4].length>l[4].length?a:l:d=l:d=a;var c,m,g,v;i.length>o.length?(c=d[0],m=d[1],g=d[2],v=d[3]):(g=d[0],v=d[1],c=d[2],m=d[3]);var b=d[4];return[c,m,g,v,b]},e.prototype.diff_cleanupSemantic=function(i){for(var o=!1,p=[],s=0,u=null,r=0,a=0,l=0,d=0,c=0;r<i.length;)i[r][0]==f?(p[s++]=r,a=d,l=c,d=0,c=0,u=i[r][1]):(i[r][0]==n?d+=i[r][1].length:c+=i[r][1].length,u&&u.length<=Math.max(a,l)&&u.length<=Math.max(d,c)&&(i.splice(p[s-1],0,new e.Diff(t,u)),i[p[s-1]+1][0]=n,s--,s--,r=s>0?p[s-1]:-1,a=0,l=0,d=0,c=0,u=null,o=!0)),r++;for(o&&this.diff_cleanupMerge(i),this.diff_cleanupSemanticLossless(i),r=1;r<i.length;){if(i[r-1][0]==t&&i[r][0]==n){var m=i[r-1][1],g=i[r][1],v=this.diff_commonOverlap_(m,g),b=this.diff_commonOverlap_(g,m);v>=b?(v>=m.length/2||v>=g.length/2)&&(i.splice(r,0,new e.Diff(f,g.substring(0,v))),i[r-1][1]=m.substring(0,m.length-v),i[r+1][1]=g.substring(v),r++):(b>=m.length/2||b>=g.length/2)&&(i.splice(r,0,new e.Diff(f,m.substring(0,b))),i[r-1][0]=n,i[r-1][1]=g.substring(0,g.length-b),i[r+1][0]=t,i[r+1][1]=m.substring(b),r++),r++}r++}},e.prototype.diff_cleanupSemanticLossless=function(i){function o(b,E){if(!b||!E)return 6;var S=b.charAt(b.length-1),w=E.charAt(0),y=S.match(e.nonAlphaNumericRegex_),D=w.match(e.nonAlphaNumericRegex_),$=y&&S.match(e.whitespaceRegex_),A=D&&w.match(e.whitespaceRegex_),_=$&&S.match(e.linebreakRegex_),L=A&&w.match(e.linebreakRegex_),T=_&&b.match(e.blanklineEndRegex_),k=L&&E.match(e.blanklineStartRegex_);return T||k?5:_||L?4:y&&!$&&A?3:$||A?2:y||D?1:0}for(var p=1;p<i.length-1;){if(i[p-1][0]==f&&i[p+1][0]==f){var s=i[p-1][1],u=i[p][1],r=i[p+1][1],a=this.diff_commonSuffix(s,u);if(a){var l=u.substring(u.length-a);s=s.substring(0,s.length-a),u=l+u.substring(0,u.length-a),r=l+r}for(var d=s,c=u,m=r,g=o(s,u)+o(u,r);u.charAt(0)===r.charAt(0);){s+=u.charAt(0),u=u.substring(1)+r.charAt(0),r=r.substring(1);var v=o(s,u)+o(u,r);v>=g&&(g=v,d=s,c=u,m=r)}i[p-1][1]!=d&&(d?i[p-1][1]=d:(i.splice(p-1,1),p--),i[p][1]=c,m?i[p+1][1]=m:(i.splice(p+1,1),p--))}p++}},e.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,e.whitespaceRegex_=/\s/,e.linebreakRegex_=/[\r\n]/,e.blanklineEndRegex_=/\n\r?\n$/,e.blanklineStartRegex_=/^\r?\n\r?\n/,e.prototype.diff_cleanupEfficiency=function(i){for(var o=!1,p=[],s=0,u=null,r=0,a=!1,l=!1,d=!1,c=!1;r<i.length;)i[r][0]==f?(i[r][1].length<this.Diff_EditCost&&(d||c)?(p[s++]=r,a=d,l=c,u=i[r][1]):(s=0,u=null),d=c=!1):(i[r][0]==t?c=!0:d=!0,u&&(a&&l&&d&&c||u.length<this.Diff_EditCost/2&&a+l+d+c==3)&&(i.splice(p[s-1],0,new e.Diff(t,u)),i[p[s-1]+1][0]=n,s--,u=null,a&&l?(d=c=!0,s=0):(s--,r=s>0?p[s-1]:-1,d=c=!1),o=!0)),r++;o&&this.diff_cleanupMerge(i)},e.prototype.diff_cleanupMerge=function(i){i.push(new e.Diff(f,""));for(var o=0,p=0,s=0,u="",r="",a;o<i.length;)switch(i[o][0]){case n:s++,r+=i[o][1],o++;break;case t:p++,u+=i[o][1],o++;break;case f:p+s>1?(p!==0&&s!==0&&(a=this.diff_commonPrefix(r,u),a!==0&&(o-p-s>0&&i[o-p-s-1][0]==f?i[o-p-s-1][1]+=r.substring(0,a):(i.splice(0,0,new e.Diff(f,r.substring(0,a))),o++),r=r.substring(a),u=u.substring(a)),a=this.diff_commonSuffix(r,u),a!==0&&(i[o][1]=r.substring(r.length-a)+i[o][1],r=r.substring(0,r.length-a),u=u.substring(0,u.length-a))),o-=p+s,i.splice(o,p+s),u.length&&(i.splice(o,0,new e.Diff(t,u)),o++),r.length&&(i.splice(o,0,new e.Diff(n,r)),o++),o++):o!==0&&i[o-1][0]==f?(i[o-1][1]+=i[o][1],i.splice(o,1)):o++,s=0,p=0,u="",r="";break}i[i.length-1][1]===""&&i.pop();var l=!1;for(o=1;o<i.length-1;)i[o-1][0]==f&&i[o+1][0]==f&&(i[o][1].substring(i[o][1].length-i[o-1][1].length)==i[o-1][1]?(i[o][1]=i[o-1][1]+i[o][1].substring(0,i[o][1].length-i[o-1][1].length),i[o+1][1]=i[o-1][1]+i[o+1][1],i.splice(o-1,1),l=!0):i[o][1].substring(0,i[o+1][1].length)==i[o+1][1]&&(i[o-1][1]+=i[o+1][1],i[o][1]=i[o][1].substring(i[o+1][1].length)+i[o+1][1],i.splice(o+1,1),l=!0)),o++;l&&this.diff_cleanupMerge(i)},e.prototype.diff_xIndex=function(i,o){var p=0,s=0,u=0,r=0,a;for(a=0;a<i.length&&(i[a][0]!==n&&(p+=i[a][1].length),i[a][0]!==t&&(s+=i[a][1].length),!(p>o));a++)u=p,r=s;return i.length!=a&&i[a][0]===t?r:r+(o-u)},e.prototype.diff_prettyHtml=function(i){for(var o=[],p=/&/g,s=/</g,u=/>/g,r=/\n/g,a=0;a<i.length;a++){var l=i[a][0],d=i[a][1],c=d.replace(p,"&").replace(s,"<").replace(u,">").replace(r,"¶<br>");switch(l){case n:o[a]='<ins style="background:#e6ffe6;">'+c+"</ins>";break;case t:o[a]='<del style="background:#ffe6e6;">'+c+"</del>";break;case f:o[a]="<span>"+c+"</span>";break}}return o.join("")},e.prototype.diff_text1=function(i){for(var o=[],p=0;p<i.length;p++)i[p][0]!==n&&(o[p]=i[p][1]);return o.join("")},e.prototype.diff_text2=function(i){for(var o=[],p=0;p<i.length;p++)i[p][0]!==t&&(o[p]=i[p][1]);return o.join("")},e.prototype.diff_levenshtein=function(i){for(var o=0,p=0,s=0,u=0;u<i.length;u++){var r=i[u][0],a=i[u][1];switch(r){case n:p+=a.length;break;case t:s+=a.length;break;case f:o+=Math.max(p,s),p=0,s=0;break}}return o+=Math.max(p,s),o},e.prototype.diff_toDelta=function(i){for(var o=[],p=0;p<i.length;p++)switch(i[p][0]){case n:o[p]="+"+encodeURI(i[p][1]);break;case t:o[p]="-"+i[p][1].length;break;case f:o[p]="="+i[p][1].length;break}return o.join(" ").replace(/%20/g," ")},e.prototype.diff_fromDelta=function(i,o){for(var p=[],s=0,u=0,r=o.split(/\t/g),a=0;a<r.length;a++){var l=r[a].substring(1);switch(r[a].charAt(0)){case"+":try{p[s++]=new e.Diff(n,decodeURI(l))}catch{throw new Error("Illegal escape in diff_fromDelta: "+l)}break;case"-":case"=":var d=parseInt(l,10);if(isNaN(d)||d<0)throw new Error("Invalid number in diff_fromDelta: "+l);var c=i.substring(u,u+=d);r[a].charAt(0)=="="?p[s++]=new e.Diff(f,c):p[s++]=new e.Diff(t,c);break;default:if(r[a])throw new Error("Invalid diff operation in diff_fromDelta: "+r[a])}}if(u!=i.length)throw new Error("Delta length ("+u+") does not equal source text length ("+i.length+").");return p},e.prototype.match_main=function(i,o,p){if(i==null||o==null||p==null)throw new Error("Null input. (match_main)");return p=Math.max(0,Math.min(p,i.length)),i==o?0:i.length?i.substring(p,p+o.length)==o?p:this.match_bitap_(i,o,p):-1},e.prototype.match_bitap_=function(i,o,p){if(o.length>this.Match_MaxBits)throw new Error("Pattern too long for this browser.");var s=this.match_alphabet_(o),u=this;function r(A,_){var L=A/o.length,T=Math.abs(p-_);return u.Match_Distance?L+T/u.Match_Distance:T?1:L}var a=this.Match_Threshold,l=i.indexOf(o,p);l!=-1&&(a=Math.min(r(0,l),a),l=i.lastIndexOf(o,p+o.length),l!=-1&&(a=Math.min(r(0,l),a)));var d=1<<o.length-1;l=-1;for(var c,m,g=o.length+i.length,v,b=0;b<o.length;b++){for(c=0,m=g;c<m;)r(b,p+m)<=a?c=m:g=m,m=Math.floor((g-c)/2+c);g=m;var E=Math.max(1,p-m+1),S=Math.min(p+m,i.length)+o.length,w=Array(S+2);w[S+1]=(1<<b)-1;for(var y=S;y>=E;y--){var D=s[i.charAt(y-1)];if(b===0?w[y]=(w[y+1]<<1|1)&D:w[y]=(w[y+1]<<1|1)&D|((v[y+1]|v[y])<<1|1)|v[y+1],w[y]&d){var $=r(b,y-1);if($<=a)if(a=$,l=y-1,l>p)E=Math.max(1,2*p-l);else break}}if(r(b+1,p)>a)break;v=w}return l},e.prototype.match_alphabet_=function(i){for(var o={},p=0;p<i.length;p++)o[i.charAt(p)]=0;for(var p=0;p<i.length;p++)o[i.charAt(p)]|=1<<i.length-p-1;return o},e.prototype.patch_addContext_=function(i,o){if(o.length!=0){if(i.start2===null)throw Error("patch not initialized");for(var p=o.substring(i.start2,i.start2+i.length1),s=0;o.indexOf(p)!=o.lastIndexOf(p)&&p.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)s+=this.Patch_Margin,p=o.substring(i.start2-s,i.start2+i.length1+s);s+=this.Patch_Margin;var u=o.substring(i.start2-s,i.start2);u&&i.diffs.unshift(new e.Diff(f,u));var r=o.substring(i.start2+i.length1,i.start2+i.length1+s);r&&i.diffs.push(new e.Diff(f,r)),i.start1-=u.length,i.start2-=u.length,i.length1+=u.length+r.length,i.length2+=u.length+r.length}},e.prototype.patch_make=function(i,o,p){var s,u;if(typeof i=="string"&&typeof o=="string"&&typeof p>"u")s=i,u=this.diff_main(s,o,!0),u.length>2&&(this.diff_cleanupSemantic(u),this.diff_cleanupEfficiency(u));else if(i&&typeof i=="object"&&typeof o>"u"&&typeof p>"u")u=i,s=this.diff_text1(u);else if(typeof i=="string"&&o&&typeof o=="object"&&typeof p>"u")s=i,u=o;else if(typeof i=="string"&&typeof o=="string"&&p&&typeof p=="object")s=i,u=p;else throw new Error("Unknown call format to patch_make.");if(u.length===0)return[];for(var r=[],a=new e.patch_obj,l=0,d=0,c=0,m=s,g=s,v=0;v<u.length;v++){var b=u[v][0],E=u[v][1];switch(!l&&b!==f&&(a.start1=d,a.start2=c),b){case n:a.diffs[l++]=u[v],a.length2+=E.length,g=g.substring(0,c)+E+g.substring(c);break;case t:a.length1+=E.length,a.diffs[l++]=u[v],g=g.substring(0,c)+g.substring(c+E.length);break;case f:E.length<=2*this.Patch_Margin&&l&&u.length!=v+1?(a.diffs[l++]=u[v],a.length1+=E.length,a.length2+=E.length):E.length>=2*this.Patch_Margin&&l&&(this.patch_addContext_(a,m),r.push(a),a=new e.patch_obj,l=0,m=g,d=c);break}b!==n&&(d+=E.length),b!==t&&(c+=E.length)}return l&&(this.patch_addContext_(a,m),r.push(a)),r},e.prototype.patch_deepCopy=function(i){for(var o=[],p=0;p<i.length;p++){var s=i[p],u=new e.patch_obj;u.diffs=[];for(var r=0;r<s.diffs.length;r++)u.diffs[r]=new e.Diff(s.diffs[r][0],s.diffs[r][1]);u.start1=s.start1,u.start2=s.start2,u.length1=s.length1,u.length2=s.length2,o[p]=u}return o},e.prototype.patch_apply=function(i,o){if(i.length==0)return[o,[]];i=this.patch_deepCopy(i);var p=this.patch_addPadding(i);o=p+o+p,this.patch_splitMax(i);for(var s=0,u=[],r=0;r<i.length;r++){var a=i[r].start2+s,l=this.diff_text1(i[r].diffs),d,c=-1;if(l.length>this.Match_MaxBits?(d=this.match_main(o,l.substring(0,this.Match_MaxBits),a),d!=-1&&(c=this.match_main(o,l.substring(l.length-this.Match_MaxBits),a+l.length-this.Match_MaxBits),(c==-1||d>=c)&&(d=-1))):d=this.match_main(o,l,a),d==-1)u[r]=!1,s-=i[r].length2-i[r].length1;else{u[r]=!0,s=d-a;var m;if(c==-1?m=o.substring(d,d+l.length):m=o.substring(d,c+this.Match_MaxBits),l==m)o=o.substring(0,d)+this.diff_text2(i[r].diffs)+o.substring(d+l.length);else{var g=this.diff_main(l,m,!1);if(l.length>this.Match_MaxBits&&this.diff_levenshtein(g)/l.length>this.Patch_DeleteThreshold)u[r]=!1;else{this.diff_cleanupSemanticLossless(g);for(var v=0,b,E=0;E<i[r].diffs.length;E++){var S=i[r].diffs[E];S[0]!==f&&(b=this.diff_xIndex(g,v)),S[0]===n?o=o.substring(0,d+b)+S[1]+o.substring(d+b):S[0]===t&&(o=o.substring(0,d+b)+o.substring(d+this.diff_xIndex(g,v+S[1].length))),S[0]!==t&&(v+=S[1].length)}}}}}return o=o.substring(p.length,o.length-p.length),[o,u]},e.prototype.patch_addPadding=function(i){for(var o=this.Patch_Margin,p="",s=1;s<=o;s++)p+=String.fromCharCode(s);for(var s=0;s<i.length;s++)i[s].start1+=o,i[s].start2+=o;var u=i[0],r=u.diffs;if(r.length==0||r[0][0]!=f)r.unshift(new e.Diff(f,p)),u.start1-=o,u.start2-=o,u.length1+=o,u.length2+=o;else if(o>r[0][1].length){var a=o-r[0][1].length;r[0][1]=p.substring(r[0][1].length)+r[0][1],u.start1-=a,u.start2-=a,u.length1+=a,u.length2+=a}if(u=i[i.length-1],r=u.diffs,r.length==0||r[r.length-1][0]!=f)r.push(new e.Diff(f,p)),u.length1+=o,u.length2+=o;else if(o>r[r.length-1][1].length){var a=o-r[r.length-1][1].length;r[r.length-1][1]+=p.substring(0,a),u.length1+=a,u.length2+=a}return p},e.prototype.patch_splitMax=function(i){for(var o=this.Match_MaxBits,p=0;p<i.length;p++)if(!(i[p].length1<=o)){var s=i[p];i.splice(p--,1);for(var u=s.start1,r=s.start2,a="";s.diffs.length!==0;){var l=new e.patch_obj,d=!0;for(l.start1=u-a.length,l.start2=r-a.length,a!==""&&(l.length1=l.length2=a.length,l.diffs.push(new e.Diff(f,a)));s.diffs.length!==0&&l.length1<o-this.Patch_Margin;){var c=s.diffs[0][0],m=s.diffs[0][1];c===n?(l.length2+=m.length,r+=m.length,l.diffs.push(s.diffs.shift()),d=!1):c===t&&l.diffs.length==1&&l.diffs[0][0]==f&&m.length>2*o?(l.length1+=m.length,u+=m.length,d=!1,l.diffs.push(new e.Diff(c,m)),s.diffs.shift()):(m=m.substring(0,o-l.length1-this.Patch_Margin),l.length1+=m.length,u+=m.length,c===f?(l.length2+=m.length,r+=m.length):d=!1,l.diffs.push(new e.Diff(c,m)),m==s.diffs[0][1]?s.diffs.shift():s.diffs[0][1]=s.diffs[0][1].substring(m.length))}a=this.diff_text2(l.diffs),a=a.substring(a.length-this.Patch_Margin);var g=this.diff_text1(s.diffs).substring(0,this.Patch_Margin);g!==""&&(l.length1+=g.length,l.length2+=g.length,l.diffs.length!==0&&l.diffs[l.diffs.length-1][0]===f?l.diffs[l.diffs.length-1][1]+=g:l.diffs.push(new e.Diff(f,g))),d||i.splice(++p,0,l)}}},e.prototype.patch_toText=function(i){for(var o=[],p=0;p<i.length;p++)o[p]=i[p];return o.join("")},e.prototype.patch_fromText=function(i){var o=[];if(!i)return o;for(var p=i.split(`
`),s=0,u=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;s<p.length;){var r=p[s].match(u);if(!r)throw new Error("Invalid patch string: "+p[s]);var a=new e.patch_obj;for(o.push(a),a.start1=parseInt(r[1],10),r[2]===""?(a.start1--,a.length1=1):r[2]=="0"?a.length1=0:(a.start1--,a.length1=parseInt(r[2],10)),a.start2=parseInt(r[3],10),r[4]===""?(a.start2--,a.length2=1):r[4]=="0"?a.length2=0:(a.start2--,a.length2=parseInt(r[4],10)),s++;s<p.length;){var l=p[s].charAt(0);try{var d=decodeURI(p[s].substring(1))}catch{throw new Error("Illegal escape in patch_fromText: "+d)}if(l=="-")a.diffs.push(new e.Diff(t,d));else if(l=="+")a.diffs.push(new e.Diff(n,d));else if(l==" ")a.diffs.push(new e.Diff(f,d));else{if(l=="@")break;if(l!=="")throw new Error('Invalid patch mode "'+l+'" in: '+d)}s++}}return o},e.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},e.patch_obj.prototype.toString=function(){var i,o;this.length1===0?i=this.start1+",0":this.length1==1?i=this.start1+1:i=this.start1+1+","+this.length1,this.length2===0?o=this.start2+",0":this.length2==1?o=this.start2+1:o=this.start2+1+","+this.length2;for(var p=["@@ -"+i+" +"+o+` @@
`],s,u=0;u<this.diffs.length;u++){switch(this.diffs[u][0]){case n:s="+";break;case t:s="-";break;case f:s=" ";break}p[u+1]=s+encodeURI(this.diffs[u][1])+`
`}return p.join("").replace(/%20/g," ")},h.exports=e,h.exports.diff_match_patch=e,h.exports.DIFF_DELETE=t,h.exports.DIFF_INSERT=n,h.exports.DIFF_EQUAL=f})(qa);var Dy=qa.exports,Ey=ui&&ui.__extends||(function(){var h=function(e,t){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,f){n.__proto__=f}||function(n,f){for(var i in f)Object.prototype.hasOwnProperty.call(f,i)&&(n[i]=f[i])},h(e,t)};return function(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");h(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}})();Object.defineProperty(ui,"__esModule",{value:!0});var Le=Kr,uo=Q,Ay=Xt,Ty=Dy,ky=(function(h){Ey(e,h);function e(t){var n=h.call(this,t)||this;return n.state={value:n.props.value},n.onChange=n.onChange.bind(n),n.diff=n.diff.bind(n),n}return e.prototype.componentDidUpdate=function(){var t=this.props.value;t!==this.state.value&&this.setState({value:t})},e.prototype.onChange=function(t){this.setState({value:t}),this.props.onChange&&this.props.onChange(t)},e.prototype.diff=function(){var t=new Ty,n=this.state.value[0],f=this.state.value[1];if(n.length===0&&f.length===0)return[];var i=t.diff_main(n,f);t.diff_cleanupSemantic(i);var o=this.generateDiffedLines(i),p=this.setCodeMarkers(o);return p},e.prototype.generateDiffedLines=function(t){var n={DIFF_EQUAL:0,DIFF_DELETE:-1,DIFF_INSERT:1},f={left:[],right:[]},i={left:1,right:1};return t.forEach(function(o){var p=o[0],s=o[1],u=s.split(`
`).length-1;if(s.length!==0){var r=s[0],a=s[s.length-1],l=0;switch(p){case n.DIFF_EQUAL:i.left+=u,i.right+=u;break;case n.DIFF_DELETE:r===`
`&&(i.left++,u--),l=u,l===0&&f.right.push({startLine:i.right,endLine:i.right}),a===`
`&&(l-=1),f.left.push({startLine:i.left,endLine:i.left+l}),i.left+=u;break;case n.DIFF_INSERT:r===`
`&&(i.right++,u--),l=u,l===0&&f.left.push({startLine:i.left,endLine:i.left}),a===`
`&&(l-=1),f.right.push({startLine:i.right,endLine:i.right+l}),i.right+=u;break;default:throw new Error("Diff type was not defined.")}}}),f},e.prototype.setCodeMarkers=function(t){t===void 0&&(t={left:[],right:[]});for(var n=[],f={left:[],right:[]},i=0;i<t.left.length;i++){var o={startRow:t.left[i].startLine-1,endRow:t.left[i].endLine,type:"text",className:"codeMarker"};f.left.push(o)}for(var i=0;i<t.right.length;i++){var o={startRow:t.right[i].startLine-1,endRow:t.right[i].endLine,type:"text",className:"codeMarker"};f.right.push(o)}return n[0]=f.left,n[1]=f.right,n},e.prototype.render=function(){var t=this.diff();return uo.createElement(Ay.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:t})},e.propTypes={cursorStart:Le.number,editorProps:Le.object,enableBasicAutocompletion:Le.bool,enableLiveAutocompletion:Le.bool,focus:Le.bool,fontSize:Le.number,height:Le.string,highlightActiveLine:Le.bool,maxLines:Le.number,minLines:Le.number,mode:Le.string,name:Le.string,className:Le.string,onLoad:Le.func,onPaste:Le.func,onScroll:Le.func,onChange:Le.func,orientation:Le.string,readOnly:Le.bool,scrollMargin:Le.array,setOptions:Le.object,showGutter:Le.bool,showPrintMargin:Le.bool,splits:Le.number,style:Le.object,tabSize:Le.number,theme:Le.string,value:Le.array,width:Le.string,wrapEnabled:Le.bool},e.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},e})(uo.Component);ui.default=ky;Object.defineProperty(On,"__esModule",{value:!0});On.diff=On.split=void 0;var $y=mn,My=ui;On.diff=My.default;var _y=Xt;On.split=_y.default;var Iy=On.default=$y.default,Ly={exports:{}};(function(h,e){ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(t,n,f){var i=t("../lib/oop"),o=t("./text_highlight_rules").TextHighlightRules,p=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"}]}};i.inherits(p,o),n.JsonHighlightRules=p}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(t,n,f){var i=t("../range").Range,o=function(){};(function(){this.checkOutdent=function(p,s){return/^\s+$/.test(p)?/^\s*\}/.test(s):!1},this.autoOutdent=function(p,s){var u=p.getLine(s),r=u.match(/^(\s*\})/);if(!r)return 0;var a=r[1].length,l=p.findMatchingBracket({row:s,column:a});if(!l||l.row==s)return 0;var d=this.$getIndent(p.getLine(l.row));p.replace(new i(s,0,s,a-1),d)},this.$getIndent=function(p){return p.match(/^\s*/)[0]}}).call(o.prototype),n.MatchingBraceOutdent=o}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(t,n,f){var i=t("../../lib/oop"),o=t("../../range").Range,p=t("./fold_mode").FoldMode,s=n.FoldMode=function(u){u&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+u.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+u.end)))};i.inherits(s,p),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(u,r,a){var l=u.getLine(a);if(this.singleLineBlockCommentRe.test(l)&&!this.startRegionRe.test(l)&&!this.tripleStarBlockCommentRe.test(l))return"";var d=this._getFoldWidgetBase(u,r,a);return!d&&this.startRegionRe.test(l)?"start":d},this.getFoldWidgetRange=function(u,r,a,l){var d=u.getLine(a);if(this.startRegionRe.test(d))return this.getCommentRegionBlock(u,d,a);var g=d.match(this.foldingStartMarker);if(g){var c=g.index;if(g[1])return this.openingBracketBlock(u,g[1],a,c);var m=u.getCommentFoldRange(a,c+g[0].length,1);return m&&!m.isMultiLine()&&(l?m=this.getSectionRange(u,a):r!="all"&&(m=null)),m}if(r!=="markbegin"){var g=d.match(this.foldingStopMarker);if(g){var c=g.index+g[0].length;return g[1]?this.closingBracketBlock(u,g[1],a,c):u.getCommentFoldRange(a,c,-1)}}},this.getSectionRange=function(u,r){var a=u.getLine(r),l=a.search(/\S/),d=r,c=a.length;r+=1;for(var m=r,g=u.getLength();++r<g;){a=u.getLine(r);var v=a.search(/\S/);if(v!==-1){if(l>v)break;var b=this.getFoldWidgetRange(u,"all",r);if(b){if(b.start.row<=d)break;if(b.isMultiLine())r=b.end.row;else if(l==v)break}m=r}}return new o(d,c,m,u.getLine(m).length)},this.getCommentRegionBlock=function(u,r,a){for(var l=r.search(/\s*$/),d=u.getLength(),c=a,m=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,g=1;++a<d;){r=u.getLine(a);var v=m.exec(r);if(v&&(v[1]?g--:g++,!g))break}var b=a;if(b>c)return new o(c,l,b,r.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(t,n,f){var i=t("../lib/oop"),o=t("./text").Mode,p=t("./json_highlight_rules").JsonHighlightRules,s=t("./matching_brace_outdent").MatchingBraceOutdent,u=t("./folding/cstyle").FoldMode,r=t("../worker/worker_client").WorkerClient,a=function(){this.HighlightRules=p,this.$outdent=new s,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new u};i.inherits(a,o),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.getNextLineIndent=function(l,d,c){var m=this.$getIndent(d);if(l=="start"){var g=d.match(/^.*[\{\(\[]\s*$/);g&&(m+=c)}return m},this.checkOutdent=function(l,d,c){return this.$outdent.checkOutdent(d,c)},this.autoOutdent=function(l,d,c){this.$outdent.autoOutdent(d,c)},this.createWorker=function(l){var d=new r(["ace"],"ace/mode/json_worker","JsonWorker");return d.attachToDocument(l.getDocument()),d.on("annotate",function(c){l.setAnnotations(c.data)}),d.on("terminate",function(){l.clearAnnotations()}),d},this.$id="ace/mode/json"}.call(a.prototype),n.Mode=a}),(function(){ace.require(["ace/mode/json"],function(t){h&&(h.exports=t)})})()})(Ly);var Fy={exports:{}};(function(h,e){ace.define("ace/mode/json_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(t,n,f){var i=t("../lib/oop"),o=t("./text_highlight_rules").TextHighlightRules,p=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"}]}};i.inherits(p,o),n.JsonHighlightRules=p}),ace.define("ace/mode/json5_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/json_highlight_rules"],function(t,n,f){var i=t("../lib/oop"),o=t("./json_highlight_rules").JsonHighlightRules,p=function(){o.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 u in this.$rules)this.$rules[u].unshift.apply(this.$rules[u],s);this.normalizeRules()};i.inherits(p,o),n.Json5HighlightRules=p}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(t,n,f){var i=t("../range").Range,o=function(){};(function(){this.checkOutdent=function(p,s){return/^\s+$/.test(p)?/^\s*\}/.test(s):!1},this.autoOutdent=function(p,s){var u=p.getLine(s),r=u.match(/^(\s*\})/);if(!r)return 0;var a=r[1].length,l=p.findMatchingBracket({row:s,column:a});if(!l||l.row==s)return 0;var d=this.$getIndent(p.getLine(l.row));p.replace(new i(s,0,s,a-1),d)},this.$getIndent=function(p){return p.match(/^\s*/)[0]}}).call(o.prototype),n.MatchingBraceOutdent=o}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(t,n,f){var i=t("../../lib/oop"),o=t("../../range").Range,p=t("./fold_mode").FoldMode,s=n.FoldMode=function(u){u&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+u.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+u.end)))};i.inherits(s,p),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(u,r,a){var l=u.getLine(a);if(this.singleLineBlockCommentRe.test(l)&&!this.startRegionRe.test(l)&&!this.tripleStarBlockCommentRe.test(l))return"";var d=this._getFoldWidgetBase(u,r,a);return!d&&this.startRegionRe.test(l)?"start":d},this.getFoldWidgetRange=function(u,r,a,l){var d=u.getLine(a);if(this.startRegionRe.test(d))return this.getCommentRegionBlock(u,d,a);var g=d.match(this.foldingStartMarker);if(g){var c=g.index;if(g[1])return this.openingBracketBlock(u,g[1],a,c);var m=u.getCommentFoldRange(a,c+g[0].length,1);return m&&!m.isMultiLine()&&(l?m=this.getSectionRange(u,a):r!="all"&&(m=null)),m}if(r!=="markbegin"){var g=d.match(this.foldingStopMarker);if(g){var c=g.index+g[0].length;return g[1]?this.closingBracketBlock(u,g[1],a,c):u.getCommentFoldRange(a,c,-1)}}},this.getSectionRange=function(u,r){var a=u.getLine(r),l=a.search(/\S/),d=r,c=a.length;r+=1;for(var m=r,g=u.getLength();++r<g;){a=u.getLine(r);var v=a.search(/\S/);if(v!==-1){if(l>v)break;var b=this.getFoldWidgetRange(u,"all",r);if(b){if(b.start.row<=d)break;if(b.isMultiLine())r=b.end.row;else if(l==v)break}m=r}}return new o(d,c,m,u.getLine(m).length)},this.getCommentRegionBlock=function(u,r,a){for(var l=r.search(/\s*$/),d=u.getLength(),c=a,m=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,g=1;++a<d;){r=u.getLine(a);var v=m.exec(r);if(v&&(v[1]?g--:g++,!g))break}var b=a;if(b>c)return new o(c,l,b,r.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(t,n,f){var i=t("../lib/oop"),o=t("./text").Mode,p=t("./json5_highlight_rules").Json5HighlightRules,s=t("./matching_brace_outdent").MatchingBraceOutdent,u=t("./folding/cstyle").FoldMode,r=function(){this.HighlightRules=p,this.$outdent=new s,this.$behaviour=this.$defaultBehaviour,this.foldingRules=new u};i.inherits(r,o),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.checkOutdent=function(a,l,d){return this.$outdent.checkOutdent(l,d)},this.autoOutdent=function(a,l,d){this.$outdent.autoOutdent(l,d)},this.$id="ace/mode/json5"}.call(r.prototype),n.Mode=r}),(function(){ace.require(["ace/mode/json5"],function(t){h&&(h.exports=t)})})()})(Fy);var Ry={};(function(h){function e(f,i){for(var o=f,p="";o;){var s=i[o];if(typeof s=="string")return s+p;if(s)return s.location.replace(/\/*$/,"/")+(p||s.main||s.name);if(s===!1)return"";var u=o.lastIndexOf("/");if(u===-1)break;p=o.substr(u)+p,o=o.slice(0,u)}return f}if(!(typeof h.window<"u"&&h.document)&&!(h.require&&h.define)){h.console||(h.console=function(){var f=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:f})},h.console.error=h.console.warn=h.console.log=h.console.trace=h.console),h.window=h,h.ace=h,h.onerror=function(f,i,o,p,s){postMessage({type:"error",data:{message:f,data:s&&s.data,file:i,line:o,col:p,stack:s&&s.stack}})},h.normalizeModule=function(f,i){if(i.indexOf("!")!==-1){var o=i.split("!");return h.normalizeModule(f,o[0])+"!"+h.normalizeModule(f,o[1])}if(i.charAt(0)=="."){var p=f.split("/").slice(0,-1).join("/");for(i=(p?p+"/":"")+i;i.indexOf(".")!==-1&&s!=i;){var s=i;i=i.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return i},h.require=function(f,i){if(i||(i=f,f=null),!i.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");i=h.normalizeModule(f,i);var o=h.require.modules[i];if(o)return o.initialized||(o.initialized=!0,o.exports=o.factory().exports),o.exports;if(!h.require.tlns)return console.log("unable to load "+i);var p=e(i,h.require.tlns);return p.slice(-3)!=".js"&&(p+=".js"),h.require.id=i,h.require.modules[i]={},importScripts(p),h.require(f,i)},h.require.modules={},h.require.tlns={},h.define=function(f,i,o){if(arguments.length==2?(o=i,typeof f!="string"&&(i=f,f=h.require.id)):arguments.length==1&&(o=f,i=[],f=h.require.id),typeof o!="function"){h.require.modules[f]={exports:o,initialized:!0};return}i.length||(i=["require","exports","module"]);var p=function(s){return h.require(f,s)};h.require.modules[f]={exports:{},factory:function(){var s=this,u=o.apply(this,i.slice(0,o.length).map(function(r){switch(r){case"require":return p;case"exports":return s.exports;case"module":return s;default:return p(r)}}));return u&&(s.exports=u),s}}},h.define.amd={},h.require.tlns={},h.initBaseUrls=function(f){for(var i in f)this.require.tlns[i]=f[i]},h.initSender=function(){var f=h.require("ace/lib/event_emitter").EventEmitter,i=h.require("ace/lib/oop"),o=function(){};return function(){i.implement(this,f),this.callback=function(p,s){postMessage({type:"call",id:s,data:p})},this.emit=function(p,s){postMessage({type:"event",name:p,data:s})}}.call(o.prototype),new o};var t=h.main=null,n=h.sender=null;h.onmessage=function(f){var i=f.data;if(i.event&&n)n._signal(i.event,i.data);else if(i.command)if(t[i.command])t[i.command].apply(t,i.args);else{if(!h[i.command])throw new Error("Unknown command:"+i.command);h[i.command].apply(h,i.args)}else if(i.init){h.initBaseUrls(i.tlns),n=h.sender=h.initSender();var o=this.require(i.module)[i.classname];t=h.main=new o(n)}}}})(Ry),ace.define("ace/lib/oop",[],function(h,e,t){e.inherits=function(n,f){n.super_=f,n.prototype=Object.create(f.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}})},e.mixin=function(n,f){for(var i in f)n[i]=f[i];return n},e.implement=function(n,f){e.mixin(n,f)}}),ace.define("ace/apply_delta",[],function(h,e,t){e.applyDelta=function(n,f,i){var o=f.start.row,p=f.start.column,s=n[o]||"";switch(f.action){case"insert":var u=f.lines;if(u.length===1)n[o]=s.substring(0,p)+f.lines[0]+s.substring(p);else{var r=[o,1].concat(f.lines);n.splice.apply(n,r),n[o]=s.substring(0,p)+n[o],n[o+f.lines.length-1]+=s.substring(p)}break;case"remove":var a=f.end.column,l=f.end.row;o===l?n[o]=s.substring(0,p)+s.substring(a):n.splice(o,l-o+1,s.substring(0,p)+n[l].substring(a))}}}),ace.define("ace/lib/event_emitter",[],function(h,e,t){var n={},f=function(){this.propagationStopped=!0},i=function(){this.defaultPrevented=!0};n._emit=n._dispatchEvent=function(o,p){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var s=this._eventRegistry[o]||[],u=this._defaultHandlers[o];if(!(!s.length&&!u)){(typeof p!="object"||!p)&&(p={}),p.type||(p.type=o),p.stopPropagation||(p.stopPropagation=f),p.preventDefault||(p.preventDefault=i),s=s.slice();for(var r=0;r<s.length&&(s[r](p,this),!p.propagationStopped);r++);if(u&&!p.defaultPrevented)return u(p,this)}},n._signal=function(o,p){var s=(this._eventRegistry||{})[o];if(s){s=s.slice();for(var u=0;u<s.length;u++)s[u](p,this)}},n.once=function(o,p){var s=this;if(this.on(o,function u(){s.off(o,u),p.apply(null,arguments)}),!p)return new Promise(function(u){p=u})},n.setDefaultHandler=function(o,p){var s=this._defaultHandlers;if(s||(s=this._defaultHandlers={_disabled_:{}}),s[o]){var u=s[o],r=s._disabled_[o];r||(s._disabled_[o]=r=[]),r.push(u);var a=r.indexOf(p);a!=-1&&r.splice(a,1)}s[o]=p},n.removeDefaultHandler=function(o,p){var s=this._defaultHandlers;if(s){var u=s._disabled_[o];if(s[o]==p)u&&this.setDefaultHandler(o,u.pop());else if(u){var r=u.indexOf(p);r!=-1&&u.splice(r,1)}}},n.on=n.addEventListener=function(o,p,s){this._eventRegistry=this._eventRegistry||{};var u=this._eventRegistry[o];return u||(u=this._eventRegistry[o]=[]),u.indexOf(p)==-1&&u[s?"unshift":"push"](p),p},n.off=n.removeListener=n.removeEventListener=function(o,p){this._eventRegistry=this._eventRegistry||{};var s=this._eventRegistry[o];if(s){var u=s.indexOf(p);u!==-1&&s.splice(u,1)}},n.removeAllListeners=function(o){o||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[o]=void 0),this._defaultHandlers&&(this._defaultHandlers[o]=void 0)},e.EventEmitter=n}),ace.define("ace/range",[],function(h,e,t){var n=(function(){function f(i,o,p,s){this.start={row:i,column:o},this.end={row:p,column:s}}return f.prototype.isEqual=function(i){return this.start.row===i.start.row&&this.end.row===i.end.row&&this.start.column===i.start.column&&this.end.column===i.end.column},f.prototype.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},f.prototype.contains=function(i,o){return this.compare(i,o)==0},f.prototype.compareRange=function(i){var o,p=i.end,s=i.start;return o=this.compare(p.row,p.column),o==1?(o=this.compare(s.row,s.column),o==1?2:o==0?1:0):o==-1?-2:(o=this.compare(s.row,s.column),o==-1?-1:o==1?42:0)},f.prototype.comparePoint=function(i){return this.compare(i.row,i.column)},f.prototype.containsRange=function(i){return this.comparePoint(i.start)==0&&this.comparePoint(i.end)==0},f.prototype.intersects=function(i){var o=this.compareRange(i);return o==-1||o==0||o==1},f.prototype.isEnd=function(i,o){return this.end.row==i&&this.end.column==o},f.prototype.isStart=function(i,o){return this.start.row==i&&this.start.column==o},f.prototype.setStart=function(i,o){typeof i=="object"?(this.start.column=i.column,this.start.row=i.row):(this.start.row=i,this.start.column=o)},f.prototype.setEnd=function(i,o){typeof i=="object"?(this.end.column=i.column,this.end.row=i.row):(this.end.row=i,this.end.column=o)},f.prototype.inside=function(i,o){return this.compare(i,o)==0?!(this.isEnd(i,o)||this.isStart(i,o)):!1},f.prototype.insideStart=function(i,o){return this.compare(i,o)==0?!this.isEnd(i,o):!1},f.prototype.insideEnd=function(i,o){return this.compare(i,o)==0?!this.isStart(i,o):!1},f.prototype.compare=function(i,o){return!this.isMultiLine()&&i===this.start.row?o<this.start.column?-1:o>this.end.column?1:0:i<this.start.row?-1:i>this.end.row?1:this.start.row===i?o>=this.start.column?0:-1:this.end.row===i?o<=this.end.column?0:1:0},f.prototype.compareStart=function(i,o){return this.start.row==i&&this.start.column==o?-1:this.compare(i,o)},f.prototype.compareEnd=function(i,o){return this.end.row==i&&this.end.column==o?1:this.compare(i,o)},f.prototype.compareInside=function(i,o){return this.end.row==i&&this.end.column==o?1:this.start.row==i&&this.start.column==o?-1:this.compare(i,o)},f.prototype.clipRows=function(i,o){if(this.end.row>o)var p={row:o+1,column:0};else if(this.end.row<i)var p={row:i,column:0};if(this.start.row>o)var s={row:o+1,column:0};else if(this.start.row<i)var s={row:i,column:0};return f.fromPoints(s||this.start,p||this.end)},f.prototype.extend=function(i,o){var p=this.compare(i,o);if(p==0)return this;if(p==-1)var s={row:i,column:o};else var u={row:i,column:o};return f.fromPoints(s||this.start,u||this.end)},f.prototype.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},f.prototype.isMultiLine=function(){return this.start.row!==this.end.row},f.prototype.clone=function(){return f.fromPoints(this.start,this.end)},f.prototype.collapseRows=function(){return this.end.column==0?new f(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new f(this.start.row,0,this.end.row,0)},f.prototype.toScreenRange=function(i){var o=i.documentToScreenPosition(this.start),p=i.documentToScreenPosition(this.end);return new f(o.row,o.column,p.row,p.column)},f.prototype.moveBy=function(i,o){this.start.row+=i,this.start.column+=o,this.end.row+=i,this.end.column+=o},f})();n.fromPoints=function(f,i){return new n(f.row,f.column,i.row,i.column)},n.comparePoints=function(f,i){return f.row-i.row||f.column-i.column},e.Range=n}),ace.define("ace/anchor",[],function(h,e,t){function n(s,u,r){var a=r?s.column<=u.column:s.column<u.column;return s.row<u.row||s.row==u.row&&a}function f(s,u,r){var a=s.action=="insert",l=(a?1:-1)*(s.end.row-s.start.row),d=(a?1:-1)*(s.end.column-s.start.column),c=s.start,m=a?c:s.end;return n(u,c,r)?{row:u.row,column:u.column}:n(m,u,!r)?{row:u.row+l,column:u.column+(u.row==m.row?d:0)}:{row:c.row,column:c.column}}var i=h("./lib/oop"),o=h("./lib/event_emitter").EventEmitter,p=(function(){function s(u,r,a){this.$onChange=this.onChange.bind(this),this.attach(u),typeof r!="number"?this.setPosition(r.row,r.column):this.setPosition(r,a)}return s.prototype.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},s.prototype.getDocument=function(){return this.document},s.prototype.onChange=function(u){if(!(u.start.row==u.end.row&&u.start.row!=this.row)&&!(u.start.row>this.row)){var r=f(u,{row:this.row,column:this.column},this.$insertRight);this.setPosition(r.row,r.column,!0)}},s.prototype.setPosition=function(u,r,a){var l;if(a?l={row:u,column:r}:l=this.$clipPositionToDocument(u,r),!(this.row==l.row&&this.column==l.column)){var d={row:this.row,column:this.column};this.row=l.row,this.column=l.column,this._signal("change",{old:d,value:l})}},s.prototype.detach=function(){this.document.off("change",this.$onChange)},s.prototype.attach=function(u){this.document=u||this.document,this.document.on("change",this.$onChange)},s.prototype.$clipPositionToDocument=function(u,r){var a={};return u>=this.document.getLength()?(a.row=Math.max(0,this.document.getLength()-1),a.column=this.document.getLine(a.row).length):u<0?(a.row=0,a.column=0):(a.row=u,a.column=Math.min(this.document.getLine(a.row).length,Math.max(0,r))),r<0&&(a.column=0),a},s})();p.prototype.$insertRight=!1,i.implement(p.prototype,o),e.Anchor=p}),ace.define("ace/document",[],function(h,e,t){var n=h("./lib/oop"),f=h("./apply_delta").applyDelta,i=h("./lib/event_emitter").EventEmitter,o=h("./range").Range,p=h("./anchor").Anchor,s=(function(){function u(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 u.prototype.setValue=function(r){var a=this.getLength()-1;this.remove(new o(0,0,a,this.getLine(a).length)),this.insert({row:0,column:0},r||"")},u.prototype.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},u.prototype.createAnchor=function(r,a){return new p(this,r,a)},u.prototype.$detectNewLine=function(r){var a=r.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=a?a[1]:`
`,this._signal("changeNewLineMode")},u.prototype.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return`\r
`;case"unix":return`
`;default:return this.$autoNewLine||`
`}},u.prototype.setNewLineMode=function(r){this.$newLineMode!==r&&(this.$newLineMode=r,this._signal("changeNewLineMode"))},u.prototype.getNewLineMode=function(){return this.$newLineMode},u.prototype.isNewLine=function(r){return r==`\r
`||r=="\r"||r==`
`},u.prototype.getLine=function(r){return this.$lines[r]||""},u.prototype.getLines=function(r,a){return this.$lines.slice(r,a+1)},u.prototype.getAllLines=function(){return this.getLines(0,this.getLength())},u.prototype.getLength=function(){return this.$lines.length},u.prototype.getTextRange=function(r){return this.getLinesForRange(r).join(this.getNewLineCharacter())},u.prototype.getLinesForRange=function(r){var a;if(r.start.row===r.end.row)a=[this.getLine(r.start.row).substring(r.start.column,r.end.column)];else{a=this.getLines(r.start.row,r.end.row),a[0]=(a[0]||"").substring(r.start.column);var l=a.length-1;r.end.row-r.start.row==l&&(a[l]=a[l].substring(0,r.end.column))}return a},u.prototype.insertLines=function(r,a){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(r,a)},u.prototype.removeLines=function(r,a){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(r,a)},u.prototype.insertNewLine=function(r){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(r,["",""])},u.prototype.insert=function(r,a){return this.getLength()<=1&&this.$detectNewLine(a),this.insertMergedLines(r,this.$split(a))},u.prototype.insertInLine=function(r,a){var l=this.clippedPos(r.row,r.column),d=this.pos(r.row,r.column+a.length);return this.applyDelta({start:l,end:d,action:"insert",lines:[a]},!0),this.clonePos(d)},u.prototype.clippedPos=function(r,a){var l=this.getLength();r===void 0?r=l:r<0?r=0:r>=l&&(r=l-1,a=void 0);var d=this.getLine(r);return a==null&&(a=d.length),a=Math.min(Math.max(a,0),d.length),{row:r,column:a}},u.prototype.clonePos=function(r){return{row:r.row,column:r.column}},u.prototype.pos=function(r,a){return{row:r,column:a}},u.prototype.$clipPosition=function(r){var a=this.getLength();return r.row>=a?(r.row=Math.max(0,a-1),r.column=this.getLine(a-1).length):(r.row=Math.max(0,r.row),r.column=Math.min(Math.max(r.column,0),this.getLine(r.row).length)),r},u.prototype.insertFullLines=function(r,a){r=Math.min(Math.max(r,0),this.getLength());var l=0;r<this.getLength()?(a=a.concat([""]),l=0):(a=[""].concat(a),r--,l=this.$lines[r].length),this.insertMergedLines({row:r,column:l},a)},u.prototype.insertMergedLines=function(r,a){var l=this.clippedPos(r.row,r.column),d={row:l.row+a.length-1,column:(a.length==1?l.column:0)+a[a.length-1].length};return this.applyDelta({start:l,end:d,action:"insert",lines:a}),this.clonePos(d)},u.prototype.remove=function(r){var a=this.clippedPos(r.start.row,r.start.column),l=this.clippedPos(r.end.row,r.end.column);return this.applyDelta({start:a,end:l,action:"remove",lines:this.getLinesForRange({start:a,end:l})}),this.clonePos(a)},u.prototype.removeInLine=function(r,a,l){var d=this.clippedPos(r,a),c=this.clippedPos(r,l);return this.applyDelta({start:d,end:c,action:"remove",lines:this.getLinesForRange({start:d,end:c})},!0),this.clonePos(d)},u.prototype.removeFullLines=function(r,a){r=Math.min(Math.max(0,r),this.getLength()-1),a=Math.min(Math.max(0,a),this.getLength()-1);var l=a==this.getLength()-1&&r>0,d=a<this.getLength()-1,c=l?r-1:r,m=l?this.getLine(c).length:0,g=d?a+1:a,v=d?0:this.getLine(g).length,b=new o(c,m,g,v),E=this.$lines.slice(r,a+1);return this.applyDelta({start:b.start,end:b.end,action:"remove",lines:this.getLinesForRange(b)}),E},u.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:["",""]})},u.prototype.replace=function(r,a){if(r instanceof o||(r=o.fromPoints(r.start,r.end)),a.length===0&&r.isEmpty())return r.start;if(a==this.getTextRange(r))return r.end;this.remove(r);var l;return a?l=this.insert(r.start,a):l=r.start,l},u.prototype.applyDeltas=function(r){for(var a=0;a<r.length;a++)this.applyDelta(r[a])},u.prototype.revertDeltas=function(r){for(var a=r.length-1;a>=0;a--)this.revertDelta(r[a])},u.prototype.applyDelta=function(r,a){var l=r.action=="insert";(l?r.lines.length<=1&&!r.lines[0]:!o.comparePoints(r.start,r.end))||(l&&r.lines.length>2e4?this.$splitAndapplyLargeDelta(r,2e4):(f(this.$lines,r,a),this._signal("change",r)))},u.prototype.$safeApplyDelta=function(r){var a=this.$lines.length;(r.action=="remove"&&r.start.row<a&&r.end.row<a||r.action=="insert"&&r.start.row<=a)&&this.applyDelta(r)},u.prototype.$splitAndapplyLargeDelta=function(r,a){for(var l=r.lines,d=l.length-a+1,c=r.start.row,m=r.start.column,g=0,v=0;g<d;g=v){v+=a-1;var b=l.slice(g,v);b.push(""),this.applyDelta({start:this.pos(c+g,m),end:this.pos(c+v,m=0),action:r.action,lines:b},!0)}r.lines=l.slice(g),r.start.row=c+g,r.start.column=m,this.applyDelta(r,!0)},u.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()})},u.prototype.indexToPosition=function(r,a){for(var l=this.$lines||this.getAllLines(),d=this.getNewLineCharacter().length,c=a||0,m=l.length;c<m;c++)if(r-=l[c].length+d,r<0)return{row:c,column:r+l[c].length+d};return{row:m-1,column:r+l[m-1].length+d}},u.prototype.positionToIndex=function(r,a){for(var l=this.$lines||this.getAllLines(),d=this.getNewLineCharacter().length,c=0,m=Math.min(r.row,l.length),g=a||0;g<m;++g)c+=l[g].length+d;return c+r.column},u.prototype.$split=function(r){return r.split(/\r\n|\r|\n/)},u})();s.prototype.$autoNewLine="",s.prototype.$newLineMode="auto",n.implement(s.prototype,i),e.Document=s}),ace.define("ace/lib/deep_copy",[],function(h,e,t){e.deepCopy=function n(f){if(typeof f!="object"||!f)return f;var i;if(Array.isArray(f)){i=[];for(var o=0;o<f.length;o++)i[o]=n(f[o]);return i}if(Object.prototype.toString.call(f)!=="[object Object]")return f;i={};for(var o in f)i[o]=n(f[o]);return i}}),ace.define("ace/lib/lang",[],function(h,e,t){e.last=function(i){return i[i.length-1]},e.stringReverse=function(i){return i.split("").reverse().join("")},e.stringRepeat=function(i,o){for(var p="";o>0;)o&1&&(p+=i),(o>>=1)&&(i+=i);return p};var n=/^\s\s*/,f=/\s\s*$/;e.stringTrimLeft=function(i){return i.replace(n,"")},e.stringTrimRight=function(i){return i.replace(f,"")},e.copyObject=function(i){var o={};for(var p in i)o[p]=i[p];return o},e.copyArray=function(i){for(var o=[],p=0,s=i.length;p<s;p++)i[p]&&typeof i[p]=="object"?o[p]=this.copyObject(i[p]):o[p]=i[p];return o},e.deepCopy=h("./deep_copy").deepCopy,e.arrayToMap=function(i){for(var o={},p=0;p<i.length;p++)o[i[p]]=1;return o},e.createMap=function(i){var o=Object.create(null);for(var p in i)o[p]=i[p];return o},e.arrayRemove=function(i,o){for(var p=0;p<=i.length;p++)o===i[p]&&i.splice(p,1)},e.escapeRegExp=function(i){return i.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},e.escapeHTML=function(i){return(""+i).replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<")},e.getMatchOffsets=function(i,o){var p=[];return i.replace(o,function(s){p.push({offset:arguments[arguments.length-2],length:s.length})}),p},e.deferredCall=function(i){var o=null,p=function(){o=null,i()},s=function(u){return s.cancel(),o=setTimeout(p,u||0),s};return s.schedule=s,s.call=function(){return this.cancel(),i(),s},s.cancel=function(){return clearTimeout(o),o=null,s},s.isPending=function(){return o},s},e.delayedCall=function(i,o){var p=null,s=function(){p=null,i()},u=function(r){p==null&&(p=setTimeout(s,r||o))};return u.delay=function(r){p&&clearTimeout(p),p=setTimeout(s,r||o)},u.schedule=u,u.call=function(){this.cancel(),i()},u.cancel=function(){p&&clearTimeout(p),p=null},u.isPending=function(){return p},u},e.supportsLookbehind=function(){try{new RegExp("(?<=.)")}catch{return!1}return!0},e.skipEmptyMatch=function(i,o,p){return p&&i.codePointAt(o)>65535?2:1}}),ace.define("ace/worker/mirror",[],function(h,e,t){var n=h("../document").Document,f=h("../lib/lang"),i=e.Mirror=function(o){this.sender=o;var p=this.doc=new n(""),s=this.deferredUpdate=f.delayedCall(this.onUpdate.bind(this)),u=this;o.on("change",function(r){var a=r.data;if(a[0].start)p.applyDeltas(a);else for(var l=0;l<a.length;l+=2){var d,c;if(Array.isArray(a[l+1])?d={action:"insert",start:a[l],lines:a[l+1]}:d={action:"remove",start:a[l],end:a[l+1]},(d.action=="insert"?d.start:d.end).row>=p.$lines.length)throw c=new Error("Invalid delta"),c.data={path:u.$path,linesLength:p.$lines.length,start:d.start,end:d.end},c;p.applyDelta(d,!0)}if(u.$timeout)return s.schedule(u.$timeout);u.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(o){this.$timeout=o},this.setValue=function(o){this.doc.setValue(o),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(o){this.sender.callback(this.doc.getValue(),o)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(i.prototype)}),ace.define("ace/mode/json/json_parse",[],function(h,e,t){var n,f,i={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
`,r:"\r",t:" "},o,p=function(g){throw{name:"SyntaxError",message:g,at:n,text:o}},s=function(g){return g&&g!==f&&p("Expected '"+g+"' instead of '"+f+"'"),f=o.charAt(n),n+=1,f},u=function(){var g,v="";for(f==="-"&&(v="-",s("-"));f>="0"&&f<="9";)v+=f,s();if(f===".")for(v+=".";s()&&f>="0"&&f<="9";)v+=f;if(f==="e"||f==="E")for(v+=f,s(),(f==="-"||f==="+")&&(v+=f,s());f>="0"&&f<="9";)v+=f,s();if(g=+v,!isNaN(g))return g;p("Bad number")},r=function(){var g,v,b="",E;if(f==='"')for(;s();){if(f==='"')return s(),b;if(f==="\\")if(s(),f==="u"){for(E=0,v=0;v<4&&(g=parseInt(s(),16),!!isFinite(g));v+=1)E=E*16+g;b+=String.fromCharCode(E)}else{if(typeof i[f]!="string")break;b+=i[f]}else{if(f==`
`||f=="\r")break;b+=f}}p("Bad string")},a=function(){for(;f&&f<=" ";)s()},l=function(){switch(f){case"t":return s("t"),s("r"),s("u"),s("e"),!0;case"f":return s("f"),s("a"),s("l"),s("s"),s("e"),!1;case"n":return s("n"),s("u"),s("l"),s("l"),null}p("Unexpected '"+f+"'")},d,c=function(){var g=[];if(f==="["){if(s("["),a(),f==="]")return s("]"),g;for(;f;){if(g.push(d()),a(),f==="]")return s("]"),g;s(","),a()}}p("Bad array")},m=function(){var g,v={};if(f==="{"){if(s("{"),a(),f==="}")return s("}"),v;for(;f;){if(g=r(),a(),s(":"),Object.hasOwnProperty.call(v,g)&&p('Duplicate key "'+g+'"'),v[g]=d(),a(),f==="}")return s("}"),v;s(","),a()}}p("Bad object")};return d=function(){switch(a(),f){case"{":return m();case"[":return c();case'"':return r();case"-":return u();default:return f>="0"&&f<="9"?u():l()}},function(g,v){var b;return o=g,n=0,f=" ",b=d(),a(),f&&p("Syntax error"),typeof v=="function"?(function E(S,w){var y,D,$=S[w];if($&&typeof $=="object")for(y in $)Object.hasOwnProperty.call($,y)&&(D=E($,y),D!==void 0?$[y]=D:delete $[y]);return v.call(S,w,$)})({"":b},""):b}}),ace.define("ace/mode/json_worker",[],function(h,e,t){var n=h("../lib/oop"),f=h("../worker/mirror").Mirror,i=h("./json/json_parse"),o=e.JsonWorker=function(p){f.call(this,p),this.setTimeout(200)};n.inherits(o,f),function(){this.onUpdate=function(){var p=this.doc.getValue(),s=[];try{p&&i(p)}catch(r){var u=this.doc.indexToPosition(r.at-1);s.push({row:u.row,column:u.column,text:r.message,type:"error"})}this.sender.emit("annotate",s)}}.call(o.prototype)});var Oy={exports:{}};(function(h,e){ace.define("ace/theme/clouds_midnight-css",["require","exports","module"],function(t,n,f){f.exports=`.ace-clouds-midnight .ace_gutter {
background: #232323;
color: #929292
}
.ace-clouds-midnight .ace_print-margin {
width: 1px;
background: #232323
}
.ace-clouds-midnight {
background-color: #191919;
color: #929292
}
.ace-clouds-midnight .ace_cursor {
color: #7DA5DC
}
.ace-clouds-midnight .ace_marker-layer .ace_selection {
background: #000000
}
.ace-clouds-midnight.ace_multiselect .ace_selection.ace_start {
box-shadow: 0 0 3px 0px #191919;
}
.ace-clouds-midnight .ace_marker-layer .ace_step {
background: rgb(102, 82, 0)
}
.ace-clouds-midnight .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid #BFBFBF
}
.ace-clouds-midnight .ace_marker-layer .ace_active-line {
background: rgba(215, 215, 215, 0.031)
}
.ace-clouds-midnight .ace_gutter-active-line {
background-color: rgba(215, 215, 215, 0.031)
}
.ace-clouds-midnight .ace_marker-layer .ace_selected-word {
border: 1px solid #000000
}
.ace-clouds-midnight .ace_invisible {
color: #666
}
.ace-clouds-midnight .ace_keyword,
.ace-clouds-midnight .ace_meta,
.ace-clouds-midnight .ace_support.ace_constant.ace_property-value {
color: #927C5D
}
.ace-clouds-midnight .ace_keyword.ace_operator {
color: #4B4B4B
}
.ace-clouds-midnight .ace_keyword.ace_other.ace_unit {
color: #366F1A
}
.ace-clouds-midnight .ace_constant.ace_language {
color: #39946A
}
.ace-clouds-midnight .ace_constant.ace_numeric {
color: #46A609
}
.ace-clouds-midnight .ace_constant.ace_character.ace_entity {
color: #A165AC
}
.ace-clouds-midnight .ace_invalid {
color: #FFFFFF;
background-color: #E92E2E
}
.ace-clouds-midnight .ace_fold {
background-color: #927C5D;
border-color: #929292
}
.ace-clouds-midnight .ace_storage,
.ace-clouds-midnight .ace_support.ace_class,
.ace-clouds-midnight .ace_support.ace_function,
.ace-clouds-midnight .ace_support.ace_other,
.ace-clouds-midnight .ace_support.ace_type {
color: #E92E2E
}
.ace-clouds-midnight .ace_string {
color: #5D90CD
}
.ace-clouds-midnight .ace_comment {
color: #3C403B
}
.ace-clouds-midnight .ace_entity.ace_name.ace_tag,
.ace-clouds-midnight .ace_entity.ace_other.ace_attribute-name {
color: #606060
}
.ace-clouds-midnight .ace_indent-guide {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHB3d/8PAAOIAdULw8qMAAAAAElFTkSuQmCC) right repeat-y
}
.ace-clouds-midnight .ace_indent-guide-active {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQIW2PQ1dX9zzBz5sz/ABCcBFFentLlAAAAAElFTkSuQmCC) right repeat-y;
}
`}),ace.define("ace/theme/clouds_midnight",["require","exports","module","ace/theme/clouds_midnight-css","ace/lib/dom"],function(t,n,f){n.isDark=!0,n.cssClass="ace-clouds-midnight",n.cssText=t("./clouds_midnight-css");var i=t("../lib/dom");i.importCssString(n.cssText,n.cssClass,!1)}),(function(){ace.require(["ace/theme/clouds_midnight"],function(t){h&&(h.exports=t)})})()})(Oy);var Py={exports:{}};(function(h,e){ace.define("ace/theme/chrome-css",["require","exports","module"],function(t,n,f){f.exports=`.ace-chrome .ace_gutter {
background: #ebebeb;
color: #333;
overflow : hidden;
}
.ace-chrome .ace_print-margin {
width: 1px;
background: #e8e8e8;
}
.ace-chrome {
background-color: #FFFFFF;
color: black;
}
.ace-chrome .ace_cursor {
color: black;
}
.ace-chrome .ace_invisible {
color: rgb(191, 191, 191);
}
.ace-chrome .ace_constant.ace_buildin {
color: rgb(88, 72, 246);
}
.ace-chrome .ace_constant.ace_language {
color: rgb(88, 92, 246);
}
.ace-chrome .ace_constant.ace_library {
color: rgb(6, 150, 14);
}
.ace-chrome .ace_invalid {
background-color: rgb(153, 0, 0);
color: white;
}
.ace-chrome .ace_fold {
}
.ace-chrome .ace_support.ace_function {
color: rgb(60, 76, 114);
}
.ace-chrome .ace_support.ace_constant {
color: rgb(6, 150, 14);
}
.ace-chrome .ace_support.ace_type,
.ace-chrome .ace_support.ace_class
.ace-chrome .ace_support.ace_other {
color: rgb(109, 121, 222);
}
.ace-chrome .ace_variable.ace_parameter {
font-style:italic;
color:#FD971F;
}
.ace-chrome .ace_keyword.ace_operator {
color: rgb(104, 118, 135);
}
.ace-chrome .ace_comment {
color: #236e24;
}
.ace-chrome .ace_comment.ace_doc {
color: #236e24;
}
.ace-chrome .ace_comment.ace_doc.ace_tag {
color: #236e24;
}
.ace-chrome .ace_constant.ace_numeric {
color: rgb(0, 0, 205);
}
.ace-chrome .ace_variable {
color: rgb(49, 132, 149);
}
.ace-chrome .ace_xml-pe {
color: rgb(104, 104, 91);
}
.ace-chrome .ace_entity.ace_name.ace_function {
color: #0000A2;
}
.ace-chrome .ace_heading {
color: rgb(12, 7, 255);
}
.ace-chrome .ace_list {
color:rgb(185, 6, 144);
}
.ace-chrome .ace_marker-layer .ace_selection {
background: rgb(181, 213, 255);
}
.ace-chrome .ace_marker-layer .ace_step {
background: rgb(252, 255, 0);
}
.ace-chrome .ace_marker-layer .ace_stack {
background: rgb(164, 229, 101);
}
.ace-chrome .ace_marker-layer .ace_bracket {
margin: -1px 0 0 -1px;
border: 1px solid rgb(192, 192, 192);
}
.ace-chrome .ace_marker-layer .ace_active-line {
background: rgba(0, 0, 0, 0.07);
}
.ace-chrome .ace_gutter-active-line {
background-color : #dcdcdc;
}
.ace-chrome .ace_marker-layer .ace_selected-word {
background: rgb(250, 250, 255);
border: 1px solid rgb(200, 200, 250);
}
.ace-chrome .ace_storage,
.ace-chrome .ace_keyword,
.ace-chrome .ace_meta.ace_tag {
color: rgb(147, 15, 128);
}
.ace-chrome .ace_string.ace_regex {
color: rgb(255, 0, 0)
}
.ace-chrome .ace_string {
color: #1A1AA6;
}
.ace-chrome .ace_entity.ace_other.ace_attribute-name {
color: #994409;
}
.ace-chrome .ace_indent-guide {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;
}
.ace-chrome .ace_indent-guide-active {
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAAZSURBVHjaYvj///9/hivKyv8BAAAA//8DACLqBhbvk+/eAAAAAElFTkSuQmCC") right repeat-y;
}
`}),ace.define("ace/theme/chrome",["require","exports","module","ace/theme/chrome-css","ace/lib/dom"],function(t,n,f){n.isDark=!1,n.cssClass="ace-chrome",n.cssText=t("./chrome-css");var i=t("../lib/dom");i.importCssString(n.cssText,n.cssClass,!1)}),(function(){ace.require(["ace/theme/chrome"],function(t){h&&(h.exports=t)})})()})(Py);var Ny={exports:{}};(function(h,e){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(t,n,f){function i(y){var D=new Date().toLocaleString("en-us",y);return D.length==1?"0"+D:D}var o=t("./lib/dom"),p=t("./lib/oop"),s=t("./lib/event_emitter").EventEmitter,u=t("./lib/lang"),r=t("./range").Range,a=t("./range_list").RangeList,l=t("./keyboard/hash_handler").HashHandler,d=t("./tokenizer").Tokenizer,c=t("./clipboard"),m={CURRENT_WORD:function(y){return y.session.getTextRange(y.session.getWordRange())},SELECTION:function(y,D,$){var A=y.session.getTextRange();return $?A.replace(/\n\r?([ \t]*\S)/g,`
`+$+"$1"):A},CURRENT_LINE:function(y){return y.session.getLine(y.getCursorPosition().row)},PREV_LINE:function(y){return y.session.getLine(y.getCursorPosition().row-1)},LINE_INDEX:function(y){return y.getCursorPosition().row},LINE_NUMBER:function(y){return y.getCursorPosition().row+1},SOFT_TABS:function(y){return y.session.getUseSoftTabs()?"YES":"NO"},TAB_SIZE:function(y){return y.session.getTabSize()},CLIPBOARD:function(y){return c.getText&&c.getText()},FILENAME:function(y){return/[^/\\]*$/.exec(this.FILEPATH(y))[0]},FILENAME_BASE:function(y){return/[^/\\]*$/.exec(this.FILEPATH(y))[0].replace(/\.[^.]*$/,"")},DIRECTORY:function(y){return this.FILEPATH(y).replace(/[^/\\]*$/,"")},FILEPATH:function(y){return"/not implemented.txt"},WORKSPACE_NAME:function(){return"Unknown"},FULLNAME:function(){return"Unknown"},BLOCK_COMMENT_START:function(y){var D=y.session.$mode||{};return D.blockComment&&D.blockComment.start||""},BLOCK_COMMENT_END:function(y){var D=y.session.$mode||{};return D.blockComment&&D.blockComment.end||""},LINE_COMMENT:function(y){var D=y.session.$mode||{};return D.lineCommentStart||""},CURRENT_YEAR:i.bind(null,{year:"numeric"}),CURRENT_YEAR_SHORT:i.bind(null,{year:"2-digit"}),CURRENT_MONTH:i.bind(null,{month:"numeric"}),CURRENT_MONTH_NAME:i.bind(null,{month:"long"}),CURRENT_MONTH_NAME_SHORT:i.bind(null,{month:"short"}),CURRENT_DATE:i.bind(null,{day:"2-digit"}),CURRENT_DAY_NAME:i.bind(null,{weekday:"long"}),CURRENT_DAY_NAME_SHORT:i.bind(null,{weekday:"short"}),CURRENT_HOUR:i.bind(null,{hour:"2-digit",hour12:!1}),CURRENT_MINUTE:i.bind(null,{minute:"2-digit"}),CURRENT_SECOND:i.bind(null,{second:"2-digit"})};m.SELECTED_TEXT=m.SELECTION;var g=(function(){function y(){this.snippetMap={},this.snippetNameMap={},this.variables=m}return y.prototype.getTokenizer=function(){return y.$tokenizer||this.createTokenizer()},y.prototype.createTokenizer=function(){function D(_){return _=_.substr(1),/^\d+$/.test(_)?[{tabstopId:parseInt(_,10)}]:[{text:_}]}function $(_){return"(?:[^\\\\"+_+"]|\\\\.)"}var A={regex:"/("+$("/")+"+)/",onMatch:function(_,L,T){var k=T[0];return k.fmtString=!0,k.guard=_.slice(1,-1),k.flag="",""},next:"formatString"};return y.$tokenizer=new d({start:[{regex:/\\./,onMatch:function(_,L,T){var k=_[1];return(k=="}"&&T.length||"`$\\".indexOf(k)!=-1)&&(_=k),[_]}},{regex:/}/,onMatch:function(_,L,T){return[T.length?T.shift():_]}},{regex:/\$(?:\d+|\w+)/,onMatch:D},{regex:/\$\{[\dA-Z_a-z]+/,onMatch:function(_,L,T){var k=D(_.substr(1));return T.unshift(k[0]),k},next:"snippetVar"},{regex:/\n/,token:"newline",merge:!1}],snippetVar:[{regex:"\\|"+$("\\|")+"*\\|",onMatch:function(_,L,T){var k=_.slice(1,-1).replace(/\\[,|\\]|,/g,function(x){return x.length==2?x[1]:"\0"}).split("\0").map(function(x){return{value:x}});return T[0].choices=k,[k[0]]},next:"start"},A,{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"start"}],formatString:[{regex:/:/,onMatch:function(_,L,T){return T.length&&T[0].expectElse?(T[0].expectElse=!1,T[0].ifEnd={elseEnd:T[0]},[T[0].ifEnd]):":"}},{regex:/\\./,onMatch:function(_,L,T){var k=_[1];return k=="}"&&T.length||"`$\\".indexOf(k)!=-1?_=k:k=="n"?_=`
`:k=="t"?_=" ":"ulULE".indexOf(k)!=-1&&(_={changeCase:k,local:k>"a"}),[_]}},{regex:"/\\w*}",onMatch:function(_,L,T){var k=T.shift();return k&&(k.flag=_.slice(1,-1)),this.next=k&&k.tabstopId?"start":"",[k||_]},next:"start"},{regex:/\$(?:\d+|\w+)/,onMatch:function(_,L,T){return[{text:_.slice(1)}]}},{regex:/\${\w+/,onMatch:function(_,L,T){var k={text:_.slice(2)};return T.unshift(k),[k]},next:"formatStringVar"},{regex:/\n/,token:"newline",merge:!1},{regex:/}/,onMatch:function(_,L,T){var k=T.shift();return this.next=k&&k.tabstopId?"start":"",[k||_]},next:"start"}],formatStringVar:[{regex:/:\/\w+}/,onMatch:function(_,L,T){var k=T[0];return k.formatFunction=_.slice(2,-1),[T.shift()]},next:"formatString"},A,{regex:/:[\?\-+]?/,onMatch:function(_,L,T){_[1]=="+"&&(T[0].ifEnd=T[0]),_[1]=="?"&&(T[0].expectElse=!0)},next:"formatString"},{regex:"([^:}\\\\]|\\\\.)*:?",token:"",next:"formatString"}]}),y.$tokenizer},y.prototype.tokenizeTmSnippet=function(D,$){return this.getTokenizer().getLineTokens(D,$).tokens.map(function(A){return A.value||A})},y.prototype.getVariableValue=function(D,$,A){if(/^\d+$/.test($))return(this.variables.__||{})[$]||"";if(/^[A-Z]\d+$/.test($))return(this.variables[$[0]+"__"]||{})[$.substr(1)]||"";if($=$.replace(/^TM_/,""),!this.variables.hasOwnProperty($))return"";var _=this.variables[$];return typeof _=="function"&&(_=this.variables[$](D,$,A)),_??""},y.prototype.tmStrFormat=function(D,$,A){if(!$.fmt)return D;var _=$.flag||"",L=$.guard;L=new RegExp(L,_.replace(/[^gim]/g,""));var T=typeof $.fmt=="string"?this.tokenizeTmSnippet($.fmt,"formatString"):$.fmt,k=this,x=D.replace(L,function(){var C=k.variables.__;k.variables.__=[].slice.call(arguments);for(var M=k.resolveVariables(T,A),F="E",R=0;R<M.length;R++){var O=M[R];if(typeof O=="object")if(M[R]="",O.changeCase&&O.local){var B=M[R+1];B&&typeof B=="string"&&(O.changeCase=="u"?M[R]=B[0].toUpperCase():M[R]=B[0].toLowerCase(),M[R+1]=B.substr(1))}else O.changeCase&&(F=O.changeCase);else F=="U"?M[R]=O.toUpperCase():F=="L"&&(M[R]=O.toLowerCase())}return k.variables.__=C,M.join("")});return x},y.prototype.tmFormatFunction=function(D,$,A){return $.formatFunction=="upcase"?D.toUpperCase():$.formatFunction=="downcase"?D.toLowerCase():D},y.prototype.resolveVariables=function(D,$){function A(F){var R=D.indexOf(F,k+1);R!=-1&&(k=R)}for(var _=[],L="",T=!0,k=0;k<D.length;k++){var x=D[k];if(typeof x=="string"){_.push(x),x==`
`?(T=!0,L=""):T&&(L=/^\t*/.exec(x)[0],T=/\S/.test(x));continue}if(x){if(T=!1,x.fmtString){var C=D.indexOf(x,k+1);C==-1&&(C=D.length),x.fmt=D.slice(k+1,C),k=C}if(x.text){var M=this.getVariableValue($,x.text,L)+"";x.fmtString&&(M=this.tmStrFormat(M,x,$)),x.formatFunction&&(M=this.tmFormatFunction(M,x,$)),M&&!x.ifEnd?(_.push(M),A(x)):!M&&x.ifEnd&&A(x.ifEnd)}else x.elseEnd?A(x.elseEnd):(x.tabstopId!=null||x.changeCase!=null)&&_.push(x)}}return _},y.prototype.getDisplayTextForSnippet=function(D,$){var A=v.call(this,D,$);return A.text},y.prototype.insertSnippetForSelection=function(D,$,A){A===void 0&&(A={});var _=v.call(this,D,$,A),L=D.getSelectionRange(),T=D.session.replace(L,_.text),k=new b(D),x=D.inVirtualSelectionMode&&D.selection.index;k.addTabstops(_.tabstops,L.start,T,x)},y.prototype.insertSnippet=function(D,$,A){A===void 0&&(A={});var _=this;if(D.inVirtualSelectionMode)return _.insertSnippetForSelection(D,$,A);D.forEachSelection(function(){_.insertSnippetForSelection(D,$,A)},null,{keepOrder:!0}),D.tabstopManager&&D.tabstopManager.tabNext()},y.prototype.$getScope=function(D){var $=D.session.$mode.$id||"";if($=$.split("/").pop(),$==="html"||$==="php"){$==="php"&&!D.session.$mode.inlinePhp&&($="html");var A=D.getCursorPosition(),_=D.session.getState(A.row);typeof _=="object"&&(_=_[0]),_.substring&&(_.substring(0,3)=="js-"?$="javascript":_.substring(0,4)=="css-"?$="css":_.substring(0,4)=="php-"&&($="php"))}return $},y.prototype.getActiveScopes=function(D){var $=this.$getScope(D),A=[$],_=this.snippetMap;return _[$]&&_[$].includeScopes&&A.push.apply(A,_[$].includeScopes),A.push("_"),A},y.prototype.expandWithTab=function(D,$){var A=this,_=D.forEachSelection(function(){return A.expandSnippetForSelection(D,$)},null,{keepOrder:!0});return _&&D.tabstopManager&&D.tabstopManager.tabNext(),_},y.prototype.expandSnippetForSelection=function(D,$){var A=D.getCursorPosition(),_=D.session.getLine(A.row),L=_.substring(0,A.column),T=_.substr(A.column),k=this.snippetMap,x;return this.getActiveScopes(D).some(function(C){var M=k[C];return M&&(x=this.findMatchingSnippet(M,L,T)),!!x},this),x?($&&$.dryRun||(D.session.doc.removeInLine(A.row,A.column-x.replaceBefore.length,A.column+x.replaceAfter.length),this.variables.M__=x.matchBefore,this.variables.T__=x.matchAfter,this.insertSnippetForSelection(D,x.content),this.variables.M__=this.variables.T__=null),!0):!1},y.prototype.findMatchingSnippet=function(D,$,A){for(var _=D.length;_--;){var L=D[_];if(!(L.startRe&&!L.startRe.test($))&&!(L.endRe&&!L.endRe.test(A))&&!(!L.startRe&&!L.endRe))return L.matchBefore=L.startRe?L.startRe.exec($):[""],L.matchAfter=L.endRe?L.endRe.exec(A):[""],L.replaceBefore=L.triggerRe?L.triggerRe.exec($)[0]:"",L.replaceAfter=L.endTriggerRe?L.endTriggerRe.exec(A)[0]:"",L}},y.prototype.register=function(D,$){function A(C){return C&&!/^\^?\(.*\)\$?$|^\\b$/.test(C)&&(C="(?:"+C+")"),C||""}function _(C,M,F){return C=A(C),M=A(M),C=M+C,C&&C[C.length-1]!="$"&&(C+="$"),new RegExp(C)}function L(C){C.scope||(C.scope=$||"_"),$=C.scope,T[$]||(T[$]=[],k[$]={});var M=k[$];if(C.name){var F=M[C.name];F&&x.unregister(F),M[C.name]=C}T[$].push(C),C.prefix&&(C.tabTrigger=C.prefix),!C.content&&C.body&&(C.content=Array.isArray(C.body)?C.body.join(`
`):C.body),C.tabTrigger&&!C.trigger&&(!C.guard&&/^\w/.test(C.tabTrigger)&&(C.guard="\\b"),C.trigger=u.escapeRegExp(C.tabTrigger)),!(!C.trigger&&!C.guard&&!C.endTrigger&&!C.endGuard)&&(C.startRe=_(C.trigger,C.guard),C.triggerRe=new RegExp(C.trigger),C.endRe=_(C.endTrigger,C.endGuard),C.endTriggerRe=new RegExp(C.endTrigger))}var T=this.snippetMap,k=this.snippetNameMap,x=this;D||(D=[]),Array.isArray(D)?D.forEach(L):Object.keys(D).forEach(function(C){L(D[C])}),this._signal("registerSnippets",{scope:$})},y.prototype.unregister=function(D,$){function A(T){var k=L[T.scope||$];if(k&&k[T.name]){delete k[T.name];var x=_[T.scope||$],C=x&&x.indexOf(T);C>=0&&x.splice(C,1)}}var _=this.snippetMap,L=this.snippetNameMap;D.content?A(D):Array.isArray(D)&&D.forEach(A)},y.prototype.parseSnippetFile=function(D){D=D.replace(/\r/g,"");for(var $=[],A={},_=/^#.*|^({[\s\S]*})\s*$|^(\S+) (.*)$|^((?:\n*\t.*)+)/gm,L;L=_.exec(D);){if(L[1])try{A=JSON.parse(L[1]),$.push(A)}catch{}if(L[4])A.content=L[4].replace(/^\t/gm,""),$.push(A),A={};else{var T=L[2],k=L[3];if(T=="regex"){var x=/\/((?:[^\/\\]|\\.)*)|$/g;A.guard=x.exec(k)[1],A.trigger=x.exec(k)[1],A.endTrigger=x.exec(k)[1],A.endGuard=x.exec(k)[1]}else T=="snippet"?(A.tabTrigger=k.match(/^\S*/)[0],A.name||(A.name=k)):T&&(A[T]=k)}}return $},y.prototype.getSnippetByName=function(D,$){var A=this.snippetNameMap,_;return this.getActiveScopes($).some(function(L){var T=A[L];return T&&(_=T[D]),!!_},this),_},y})();p.implement(g.prototype,s);var v=function(y,D,$){function A(U){for(var X=[],Y=0;Y<U.length;Y++){var Z=U[Y];if(typeof Z=="object"){if(M[Z.tabstopId])continue;var ne=U.lastIndexOf(Z,Y-1);Z=X[ne]||{tabstopId:Z.tabstopId}}X[Y]=Z}return X}$===void 0&&($={});var _=y.getCursorPosition(),L=y.session.getLine(_.row),T=y.session.getTabString(),k=L.match(/^\s*/)[0];_.column<k.length&&(k=k.slice(0,_.column)),D=D.replace(/\r/g,"");var x=this.tokenizeTmSnippet(D);x=this.resolveVariables(x,y),x=x.map(function(U){return U==`
`&&!$.excludeExtraIndent?U+k:typeof U=="string"?U.replace(/\t/g,T):U});var C=[];x.forEach(function(U,X){if(typeof U=="object"){var Y=U.tabstopId,Z=C[Y];if(Z||(Z=C[Y]=[],Z.index=Y,Z.value="",Z.parents={}),Z.indexOf(U)===-1){U.choices&&!Z.choices&&(Z.choices=U.choices),Z.push(U);var ne=x.indexOf(U,X+1);if(ne!==-1){var re=x.slice(X+1,ne),le=re.some(function(ie){return typeof ie=="object"});le&&!Z.value?Z.value=re:re.length&&(!Z.value||typeof Z.value!="string")&&(Z.value=re.join(""))}}}}),C.forEach(function(U){U.length=0});for(var M={},F=0;F<x.length;F++){var R=x[F];if(typeof R=="object"){var O=R.tabstopId,B=C[O],N=x.indexOf(R,F+1);if(M[O]){M[O]===R&&(delete M[O],Object.keys(M).forEach(function(U){B.parents[U]=!0}));continue}M[O]=R;var j=B.value;typeof j!="string"?j=A(j):R.fmt&&(j=this.tmStrFormat(j,R,y)),x.splice.apply(x,[F+1,Math.max(0,N-F)].concat(j,R)),B.indexOf(R)===-1&&B.push(R)}}var V=0,W=0,H="";return x.forEach(function(U){if(typeof U=="string"){var X=U.split(`
`);X.length>1?(W=X[X.length-1].length,V+=X.length-1):W+=U.length,H+=U}else U&&(U.start?U.end={row:V,column:W}:U.start={row:V,column:W})}),{text:H,tabstops:C,tokens:x}},b=(function(){function y(D){if(this.index=0,this.ranges=[],this.tabstops=[],D.tabstopManager)return D.tabstopManager;D.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=u.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(D)}return y.prototype.attach=function(D){this.$openTabstops=null,this.selectedTabstop=null,this.editor=D,this.session=D.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)},y.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},y.prototype.onChange=function(D){for(var $=D.action[0]=="r",A=this.selectedTabstop||{},_=A.parents||{},L=this.tabstops.slice(),T=0;T<L.length;T++){var k=L[T],x=k==A||_[k.index];if(k.rangeList.$bias=x?0:1,D.action=="remove"&&k!==A){var C=k.parents&&k.parents[A.index],M=k.rangeList.pointIndex(D.start,C);M=M<0?-M-1:M+1;var F=k.rangeList.pointIndex(D.end,C);F=F<0?-F-1:F-1;for(var R=k.rangeList.ranges.slice(M,F),O=0;O<R.length;O++)this.removeRange(R[O])}k.rangeList.$onChange(D)}var B=this.session;!this.$inChange&&$&&B.getLength()==1&&!B.getValue()&&this.detach()},y.prototype.updateLinkedFields=function(){var D=this.selectedTabstop;if(!(!D||!D.hasLinkedRanges||!D.firstNonLinked)){this.$inChange=!0;for(var $=this.session,A=$.getTextRange(D.firstNonLinked),_=0;_<D.length;_++){var L=D[_];if(L.linked){var T=L.original,k=n.snippetManager.tmStrFormat(A,T,this.editor);$.replace(L,k)}}this.$inChange=!1}},y.prototype.onAfterExec=function(D){D.command&&!D.command.readOnly&&this.updateLinkedFields()},y.prototype.onChangeSelection=function(){if(this.editor){for(var D=this.editor.selection.lead,$=this.editor.selection.anchor,A=this.editor.selection.isEmpty(),_=0;_<this.ranges.length;_++)if(!this.ranges[_].linked){var L=this.ranges[_].contains(D.row,D.column),T=A||this.ranges[_].contains($.row,$.column);if(L&&T)return}this.detach()}},y.prototype.onChangeSession=function(){this.detach()},y.prototype.tabNext=function(D){var $=this.tabstops.length,A=this.index+(D||1);A=Math.min(Math.max(A,1),$),A==$&&(A=0),this.selectTabstop(A),this.updateTabstopMarkers(),A===0&&this.detach()},y.prototype.selectTabstop=function(D){this.$openTabstops=null;var $=this.tabstops[this.index];if($&&this.addTabstopMarkers($),this.index=D,$=this.tabstops[this.index],!(!$||!$.length)){this.selectedTabstop=$;var A=$.firstNonLinked||$;if($.choices&&(A.cursor=A.start),this.editor.inVirtualSelectionMode)this.editor.selection.fromOrientedRange(A);else{var _=this.editor.multiSelect;_.toSingleRange(A);for(var L=0;L<$.length;L++)$.hasLinkedRanges&&$[L].linked||_.addRange($[L].clone(),!0)}this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler),this.selectedTabstop&&this.selectedTabstop.choices&&this.editor.execCommand("startAutocomplete",{matches:this.selectedTabstop.choices})}},y.prototype.addTabstops=function(D,$,A){var _=this.useLink||!this.editor.getOption("enableMultiselect");if(this.$openTabstops||(this.$openTabstops=[]),!D[0]){var L=r.fromPoints(A,A);S(L.start,$),S(L.end,$),D[0]=[L],D[0].index=0}var T=this.index,k=[T+1,0],x=this.ranges,C=this.snippetId=(this.snippetId||0)+1;D.forEach(function(M,F){var R=this.$openTabstops[F]||M;R.snippetId=C;for(var O=0;O<M.length;O++){var B=M[O],N=r.fromPoints(B.start,B.end||B.start);E(N.start,$),E(N.end,$),N.original=B,N.tabstop=R,x.push(N),R!=M?R.unshift(N):R[O]=N,B.fmtString||R.firstNonLinked&&_?(N.linked=!0,R.hasLinkedRanges=!0):R.firstNonLinked||(R.firstNonLinked=N)}R.firstNonLinked||(R.hasLinkedRanges=!1),R===M&&(k.push(R),this.$openTabstops[F]=R),this.addTabstopMarkers(R),R.rangeList=R.rangeList||new a,R.rangeList.$bias=0,R.rangeList.addList(R)},this),k.length>2&&(this.tabstops.length&&k.push(k.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,k))},y.prototype.addTabstopMarkers=function(D){var $=this.session;D.forEach(function(A){A.markerId||(A.markerId=$.addMarker(A,"ace_snippet-marker","text"))})},y.prototype.removeTabstopMarkers=function(D){var $=this.session;D.forEach(function(A){$.removeMarker(A.markerId),A.markerId=null})},y.prototype.updateTabstopMarkers=function(){if(this.selectedTabstop){var D=this.selectedTabstop.snippetId;this.selectedTabstop.index===0&&D--,this.tabstops.forEach(function($){$.snippetId===D?this.addTabstopMarkers($):this.removeTabstopMarkers($)},this)}},y.prototype.removeRange=function(D){var $=D.tabstop.indexOf(D);$!=-1&&D.tabstop.splice($,1),$=this.ranges.indexOf(D),$!=-1&&this.ranges.splice($,1),$=D.tabstop.rangeList.ranges.indexOf(D),$!=-1&&D.tabstop.splice($,1),this.session.removeMarker(D.markerId),D.tabstop.length||($=this.tabstops.indexOf(D.tabstop),$!=-1&&this.tabstops.splice($,1),this.tabstops.length||this.detach())},y})();b.prototype.keyboardHandler=new l,b.prototype.keyboardHandler.bindKeys({Tab:function(y){n.snippetManager&&n.snippetManager.expandWithTab(y)||(y.tabstopManager.tabNext(1),y.renderer.scrollCursorIntoView())},"Shift-Tab":function(y){y.tabstopManager.tabNext(-1),y.renderer.scrollCursorIntoView()},Esc:function(y){y.tabstopManager.detach()}});var E=function(y,D){y.row==0&&(y.column+=D.column),y.row+=D.row},S=function(y,D){y.row==D.row&&(y.column-=D.column),y.row-=D.row};o.importCssString(`
.ace_snippet-marker {
-moz-box-sizing: border-box;
box-sizing: border-box;
background: rgba(194, 193, 208, 0.09);
border: 1px dotted rgba(211, 208, 235, 0.62);
position: absolute;
}`,"snippets.css",!1),n.snippetManager=new g;var w=t("./editor").Editor;(function(){this.insertSnippet=function(y,D){return n.snippetManager.insertSnippet(this,y,D)},this.expandSnippet=function(y){return n.snippetManager.expandWithTab(this,y)}}).call(w.prototype)}),ace.define("ace/autocomplete/popup",["require","exports","module","ace/virtual_renderer","ace/editor","ace/range","ace/lib/event","ace/lib/lang","ace/lib/dom","ace/config","ace/lib/useragent"],function(t,n,f){var i=t("../virtual_renderer").VirtualRenderer,o=t("../editor").Editor,p=t("../range").Range,s=t("../lib/event"),u=t("../lib/lang"),r=t("../lib/dom"),a=t("../config").nls,l=t("./../lib/useragent"),d=function(E){return"suggest-aria-id:".concat(E)},c=l.isSafari?"menu":"listbox",m=l.isSafari?"menuitem":"option",g=l.isSafari?"aria-current":"aria-selected",v=function(E){var S=new i(E);S.$maxLines=4;var w=new o(S);return w.setHighlightActiveLine(!1),w.setShowPrintMargin(!1),w.renderer.setShowGutter(!1),w.renderer.setHighlightGutterLine(!1),w.$mouseHandler.$focusTimeout=0,w.$highlightTagPending=!0,w},b=(function(){function E(S){var w=r.createElement("div"),y=v(w);S&&S.appendChild(w),w.style.display="none",y.renderer.content.style.cursor="default",y.renderer.setStyle("ace_autocomplete"),y.renderer.$textLayer.element.setAttribute("role",c),y.renderer.$textLayer.element.setAttribute("aria-roledescription",a("autocomplete.popup.aria-roledescription","Autocomplete suggestions")),y.renderer.$textLayer.element.setAttribute("aria-label",a("autocomplete.popup.aria-label","Autocomplete suggestions")),y.renderer.textarea.setAttribute("aria-hidden","true"),y.setOption("displayIndentGuides",!1),y.setOption("dragDelay",150);var D=function(){};y.focus=D,y.$isFocused=!0,y.renderer.$cursorLayer.restartTimer=D,y.renderer.$cursorLayer.element.style.opacity="0",y.renderer.$maxLines=8,y.renderer.$keepTextAreaAtCursor=!1,y.setHighlightActiveLine(!1),y.session.highlight(""),y.session.$searchHighlight.clazz="ace_highlight-marker",y.on("mousedown",function(x){var C=x.getDocumentPosition();y.selection.moveToPosition(C),_.start.row=_.end.row=C.row,x.stop()});var $,A=new p(-1,0,-1,1/0),_=new p(-1,0,-1,1/0);_.id=y.session.addMarker(_,"ace_active-line","fullLine"),y.setSelectOnHover=function(x){x?A.id&&(y.session.removeMarker(A.id),A.id=null):A.id=y.session.addMarker(A,"ace_line-hover","fullLine")},y.setSelectOnHover(!1),y.on("mousemove",function(x){if(!$){$=x;return}if(!($.x==x.x&&$.y==x.y)){$=x,$.scrollTop=y.renderer.scrollTop,y.isMouseOver=!0;var C=$.getDocumentPosition().row;A.start.row!=C&&(A.id||y.setRow(C),T(C))}}),y.renderer.on("beforeRender",function(){if($&&A.start.row!=-1){$.$pos=null;var x=$.getDocumentPosition().row;A.id||y.setRow(x),T(x,!0)}}),y.renderer.on("afterRender",function(){for(var x=y.renderer.$textLayer,C=x.config.firstRow,M=x.config.lastRow;C<=M;C++){var F=x.element.childNodes[C-x.config.firstRow];F.setAttribute("role",m),F.setAttribute("aria-roledescription",a("autocomplete.popup.item.aria-roledescription","item")),F.setAttribute("aria-setsize",y.data.length),F.setAttribute("aria-describedby","doc-tooltip"),F.setAttribute("aria-posinset",C+1);var R=y.getData(C);if(R){var O="".concat(R.caption||R.value).concat(R.meta?", ".concat(R.meta):"");F.setAttribute("aria-label",O)}var B=F.querySelectorAll(".ace_completion-highlight");B.forEach(function(N){N.setAttribute("role","mark")})}}),y.renderer.on("afterRender",function(){var x=y.getRow(),C=y.renderer.$textLayer,M=C.element.childNodes[x-C.config.firstRow],F=document.activeElement;if(M!==y.selectedNode&&y.selectedNode&&(r.removeCssClass(y.selectedNode,"ace_selected"),y.selectedNode.removeAttribute(g),y.selectedNode.removeAttribute("id")),F.removeAttribute("aria-activedescendant"),y.selectedNode=M,M){var R=d(x);r.addCssClass(M,"ace_selected"),M.id=R,C.element.setAttribute("aria-activedescendant",R),F.setAttribute("aria-activedescendant",R),M.setAttribute(g,"true")}});var L=function(){T(-1)},T=function(x,C){x!==A.start.row&&(A.start.row=A.end.row=x,C||y.session._emit("changeBackMarker"),y._emit("changeHoverMarker"))};y.getHoveredRow=function(){return A.start.row},s.addListener(y.container,"mouseout",function(){y.isMouseOver=!1,L()}),y.on("hide",L),y.on("changeSelection",L),y.session.doc.getLength=function(){return y.data.length},y.session.doc.getLine=function(x){var C=y.data[x];return typeof C=="string"?C:C&&C.value||""};var k=y.session.bgTokenizer;return k.$tokenizeRow=function(x){function C(U,X){U&&F.push({type:(M.className||"")+(X||""),value:U})}var M=y.data[x],F=[];if(!M)return F;typeof M=="string"&&(M={value:M});for(var R=M.caption||M.value||M.name,O=R.toLowerCase(),B=(y.filterText||"").toLowerCase(),N=0,j=0,V=0;V<=B.length;V++)if(V!=j&&(M.matchMask&1<<V||V==B.length)){var W=B.slice(j,V);j=V;var H=O.indexOf(W,N);if(H==-1)continue;C(R.slice(N,H),""),N=H+W.length,C(R.slice(H,N),"completion-highlight")}return C(R.slice(N,R.length),""),F.push({type:"completion-spacer",value:" "}),M.meta&&F.push({type:"completion-meta",value:M.meta}),M.message&&F.push({type:"completion-message",value:M.message}),F},k.$updateOnChange=D,k.start=D,y.session.$computeWidth=function(){return this.screenWidth=0},y.isOpen=!1,y.isTopdown=!1,y.autoSelect=!0,y.filterText="",y.isMouseOver=!1,y.data=[],y.setData=function(x,C){y.filterText=C||"",y.setValue(u.stringRepeat(`
`,x.length),-1),y.data=x||[],y.setRow(0)},y.getData=function(x){return y.data[x]},y.getRow=function(){return _.start.row},y.setRow=function(x){x=Math.max(this.autoSelect?0:-1,Math.min(this.data.length-1,x)),_.start.row!=x&&(y.selection.clearSelection(),_.start.row=_.end.row=x||0,y.session._emit("changeBackMarker"),y.moveCursorTo(x||0,0),y.isOpen&&y._signal("select"))},y.on("changeSelection",function(){y.isOpen&&y.setRow(y.selection.lead.row),y.renderer.scrollCursorIntoView()}),y.hide=function(){this.container.style.display="none",y.anchorPos=null,y.anchor=null,y.isOpen&&(y.isOpen=!1,this._signal("hide"))},y.tryShow=function(x,C,M,F){if(!F&&y.isOpen&&y.anchorPos&&y.anchor&&y.anchorPos.top===x.top&&y.anchorPos.left===x.left&&y.anchor===M)return!0;var R=this.container,O=this.renderer.scrollBar.width||10,B=window.innerHeight-O,N=window.innerWidth-O,j=this.renderer,V=j.$maxLines*C*1.4,W={top:0,bottom:0},H=B-x.top-3*this.$borderSize-C,U=x.top-3*this.$borderSize;M||(U<=H||H>=V?M="bottom":M="top"),M==="top"?(W.bottom=x.top-this.$borderSize,W.top=W.bottom-V):M==="bottom"&&(W.top=x.top+C+this.$borderSize,W.bottom=W.top+V);var X=W.top>=0&&W.bottom<=B;if(!F&&!X)return!1;X?j.$maxPixelHeight=null:M==="top"?j.$maxPixelHeight=U:j.$maxPixelHeight=H,M==="top"?(R.style.top="",R.style.bottom=B+O-W.bottom+"px",y.isTopdown=!1):(R.style.top=W.top+"px",R.style.bottom="",y.isTopdown=!0),R.style.display="";var Y=x.left;return Y+R.offsetWidth>N&&(Y=N-R.offsetWidth),R.style.left=Y+"px",R.style.right="",y.isOpen||(y.isOpen=!0,this._signal("show"),$=null),y.anchorPos=x,y.anchor=M,r.$fixPositionBug(R),!0},y.show=function(x,C,M){this.tryShow(x,C,M?"bottom":void 0,!0)},y.goTo=function(x){var C=this.getRow(),M=this.session.getLength()-1;switch(x){case"up":C=C<=0?M:C-1;break;case"down":C=C>=M?-1:C+1;break;case"start":C=0;break;case"end":C=M}this.setRow(C)},y.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},y.$imageSize=0,y.$borderSize=1,y}return E})();r.importCssString(`
.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
background-color: #CAD6FA;
z-index: 1;
}
.ace_dark.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {
background-color: #3a674e;
}
.ace_editor.ace_autocomplete .ace_line-hover {
border: 1px solid #abbffe;
margin-top: -1px;
background: rgba(233,233,253,0.4);
position: absolute;
z-index: 2;
}
.ace_dark.ace_editor.ace_autocomplete .ace_line-hover {
border: 1px solid rgba(109, 150, 13, 0.8);
background: rgba(58, 103, 78, 0.62);
}
.ace_completion-meta {
opacity: 0.5;
margin-left: 0.9em;
}
.ace_completion-message {
margin-left: 0.9em;
color: blue;
}
.ace_editor.ace_autocomplete .ace_completion-highlight{
color: #2d69c7;
}
.ace_dark.ace_editor.ace_autocomplete .ace_completion-highlight{
color: #93ca12;
}
.ace_editor.ace_autocomplete {
width: 300px;
z-index: 200000;
border: 1px lightgray solid;
position: fixed;
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
line-height: 1.4;
background: #fefefe;
color: #111;
}
.ace_dark.ace_editor.ace_autocomplete {
border: 1px #484747 solid;
box-shadow: 2px 3px 5px rgba(0, 0, 0, 0.51);
line-height: 1.4;
background: #25282c;
color: #c1c1c1;
}
.ace_autocomplete .ace_text-layer {
width: calc(100% - 8px);
}
.ace_autocomplete .ace_line {
display: flex;
align-items: center;
}
.ace_autocomplete .ace_line > * {
min-width: 0;
flex: 0 0 auto;
}
.ace_autocomplete .ace_line .ace_ {
flex: 0 1 auto;
overflow: hidden;
text-overflow: ellipsis;
}
.ace_autocomplete .ace_completion-spacer {
flex: 1;
}
.ace_autocomplete.ace_loading:after {
content: "";
position: absolute;
top: 0px;
height: 2px;
width: 8%;
background: blue;
z-index: 100;
animation: ace_progress 3s infinite linear;
animation-delay: 300ms;
transform: translateX(-100%) scaleX(1);
}
@keyframes ace_progress {
0% { transform: translateX(-100%) scaleX(1) }
50% { transform: translateX(625%) scaleX(2) }
100% { transform: translateX(1500%) scaleX(3) }
}
@media (prefers-reduced-motion) {
.ace_autocomplete.ace_loading:after {
transform: translateX(625%) scaleX(2);
animation: none;
}
}
`,"autocompletion.css",!1),n.AcePopup=b,n.$singleLineEditor=v,n.getAriaId=d}),ace.define("ace/autocomplete/inline_screenreader",["require","exports","module"],function(t,n,f){var i=(function(){function o(p){this.editor=p,this.screenReaderDiv=document.createElement("div"),this.screenReaderDiv.classList.add("ace_screenreader-only"),this.editor.container.appendChild(this.screenReaderDiv)}return o.prototype.setScreenReaderContent=function(p){for(!this.popup&&this.editor.completer&&this.editor.completer.popup&&(this.popup=this.editor.completer.popup,this.popup.renderer.on("afterRender",function(){var u=this.popup.getRow(),r=this.popup.renderer.$textLayer,a=r.element.childNodes[u-r.config.firstRow];if(a){for(var l="doc-tooltip ",d=0;d<this._lines.length;d++)l+="ace-inline-screenreader-line-".concat(d," ");a.setAttribute("aria-describedby",l)}}.bind(this)));this.screenReaderDiv.firstChild;)this.screenReaderDiv.removeChild(this.screenReaderDiv.firstChild);this._lines=p.split(/\r\n|\r|\n/);var s=this.createCodeBlock();this.screenReaderDiv.appendChild(s)},o.prototype.destroy=function(){this.screenReaderDiv.remove()},o.prototype.createCodeBlock=function(){var p=document.createElement("pre");p.setAttribute("id","ace-inline-screenreader");for(var s=0;s<this._lines.length;s++){var u=document.createElement("code");u.setAttribute("id","ace-inline-screenreader-line-".concat(s));var r=document.createTextNode(this._lines[s]);u.appendChild(r),p.appendChild(u)}return p},o})();n.AceInlineScreenReader=i}),ace.define("ace/autocomplete/inline",["require","exports","module","ace/snippets","ace/autocomplete/inline_screenreader"],function(t,n,f){var i=t("../snippets").snippetManager,o=t("./inline_screenreader").AceInlineScreenReader,p=(function(){function s(){this.editor=null}return s.prototype.show=function(u,r,a){if(a=a||"",u&&this.editor&&this.editor!==u&&(this.hide(),this.editor=null,this.inlineScreenReader=null),!u||!r)return!1;this.inlineScreenReader||(this.inlineScreenReader=new o(u));var l=r.snippet?i.getDisplayTextForSnippet(u,r.snippet):r.value;return r.hideInlinePreview||!l||!l.startsWith(a)?!1:(this.editor=u,this.inlineScreenReader.setScreenReaderContent(l),l=l.slice(a.length),l===""?u.removeGhostText():u.setGhostText(l),!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})();n.AceInline=p}),ace.define("ace/autocomplete/util",["require","exports","module"],function(t,n,f){n.parForEach=function(o,p,s){var u=0,r=o.length;r===0&&s();for(var a=0;a<r;a++)p(o[a],function(l,d){u++,u===r&&s(l,d)})};var i=/[a-zA-Z_0-9\$\-\u00A2-\u2000\u2070-\uFFFF]/;n.retrievePrecedingIdentifier=function(o,p,s){s=s||i;for(var u=[],r=p-1;r>=0&&s.test(o[r]);r--)u.push(o[r]);return u.reverse().join("")},n.retrieveFollowingIdentifier=function(o,p,s){s=s||i;for(var u=[],r=p;r<o.length&&s.test(o[r]);r++)u.push(o[r]);return u},n.getCompletionPrefix=function(o){var p=o.getCursorPosition(),s=o.session.getLine(p.row),u;return o.completers.forEach(function(r){r.identifierRegexps&&r.identifierRegexps.forEach(function(a){!u&&a&&(u=this.retrievePrecedingIdentifier(s,p.column,a))}.bind(this))}.bind(this)),u||this.retrievePrecedingIdentifier(s,p.column)},n.triggerAutocomplete=function(o,s){var s=s??o.session.getPrecedingCharacter();return o.completers.some(function(u){if(u.triggerCharacters&&Array.isArray(u.triggerCharacters))return u.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(t,n,f){var i=t("./keyboard/hash_handler").HashHandler,o=t("./autocomplete/popup").AcePopup,p=t("./autocomplete/inline").AceInline,s=t("./autocomplete/popup").getAriaId,u=t("./autocomplete/util"),r=t("./lib/lang"),a=t("./lib/dom"),l=t("./snippets").snippetManager,d=t("./config"),c=t("./lib/event"),m=t("./lib/scroll").preventParentScroll,g=function(S,w){w.completer&&w.completer.destroy()},v=(function(){function S(){this.autoInsert=!1,this.autoSelect=!0,this.autoShown=!1,this.exactMatch=!1,this.inlineEnabled=!1,this.keyboardHandler=new i,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=r.delayedCall(function(){this.updateCompletions(!0)}.bind(this)),this.tooltipTimer=r.delayedCall(this.updateDocTooltip.bind(this),50),this.popupTimer=r.delayedCall(this.$updatePopupPosition.bind(this),50),this.stickySelectionTimer=r.delayedCall(function(){this.stickySelection=!0}.bind(this),this.stickySelectionDelay),this.$firstOpenTimer=r.delayedCall(function(){var w=this.completionProvider&&this.completionProvider.initialPosition;this.autoShown||this.popup&&this.popup.isOpen||!w||this.editor.completers.length===0||(this.completions=new E(S.completionsForLoading),this.openPopup(this.editor,w.prefix,!1),this.popup.renderer.setStyle("ace_loading",!0))}.bind(this),this.stickySelectionDelay)}return Object.defineProperty(S,"completionsForLoading",{get:function(){return[{caption:d.nls("autocomplete.loading","Loading..."),value:""}]},enumerable:!1,configurable:!0}),S.prototype.$init=function(){return this.popup=new o(this.parentNode||document.body||document.documentElement),this.popup.on("click",function(w){this.insertMatch(),w.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor),this.popup.on("show",this.$onPopupShow.bind(this)),this.popup.on("hide",this.$onHidePopup.bind(this)),this.popup.on("select",this.$onPopupChange.bind(this)),c.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},S.prototype.$initInline=function(){if(!(!this.inlineEnabled||this.inlineRenderer))return this.inlineRenderer=new p,this.inlineRenderer},S.prototype.getPopup=function(){return this.popup||this.$init()},S.prototype.$onHidePopup=function(){this.inlineRenderer&&this.inlineRenderer.hide(),this.hideDocTooltip(),this.stickySelectionTimer.cancel(),this.popupTimer.cancel(),this.stickySelection=!1},S.prototype.$seen=function(w){!this.hasSeen.has(w)&&w&&w.completer&&w.completer.onSeen&&typeof w.completer.onSeen=="function"&&(w.completer.onSeen(this.editor,w),this.hasSeen.add(w))},S.prototype.$onPopupChange=function(w){if(this.inlineRenderer&&this.inlineEnabled){var y=w?null:this.popup.getData(this.popup.getRow());if(this.$updateGhostText(y),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)},S.prototype.$updateGhostText=function(w){var y=this.base.row,D=this.base.column,$=this.editor.getCursorPosition().column,A=this.editor.session.getLine(y).slice(D,$);this.inlineRenderer.show(this.editor,w,A)?this.$seen(w):this.inlineRenderer.hide()},S.prototype.$onPopupRender=function(){var w=this.inlineRenderer&&this.inlineEnabled;if(this.completions&&this.completions.filtered&&this.completions.filtered.length>0)for(var y=this.popup.getFirstVisibleRow();y<=this.popup.getLastVisibleRow();y++){var D=this.popup.getData(y);D&&(!w||D.hideInlinePreview)&&this.$seen(D)}},S.prototype.$onPopupShow=function(w){this.$onPopupChange(w),this.stickySelection=!1,this.stickySelectionDelay>=0&&this.stickySelectionTimer.schedule(this.stickySelectionDelay)},S.prototype.observeLayoutChanges=function(){if(!(this.$elements||!this.editor)){window.addEventListener("resize",this.onLayoutChange,{passive:!0}),window.addEventListener("wheel",this.mousewheelListener);for(var w=this.editor.container.parentNode,y=[];w;)y.push(w),w.addEventListener("scroll",this.onLayoutChange,{passive:!0}),w=w.parentNode;this.$elements=y}},S.prototype.unObserveLayoutChanges=function(){var w=this;window.removeEventListener("resize",this.onLayoutChange,{passive:!0}),window.removeEventListener("wheel",this.mousewheelListener),this.$elements&&this.$elements.forEach(function(y){y.removeEventListener("scroll",w.onLayoutChange,{passive:!0})}),this.$elements=null},S.prototype.onLayoutChange=function(){if(!this.popup.isOpen)return this.unObserveLayoutChanges();this.$updatePopupPosition(),this.updateDocTooltip()},S.prototype.$updatePopupPosition=function(){var w=this.editor,y=w.renderer,D=y.layerConfig.lineHeight,$=y.$cursorLayer.getPixelPosition(this.base,!0);$.left-=this.popup.getTextLeftOffset();var A=w.container.getBoundingClientRect();$.top+=A.top-y.layerConfig.offset,$.left+=A.left-w.renderer.scrollLeft,$.left+=y.gutterWidth;var _={top:$.top,left:$.left};y.$ghostText&&y.$ghostTextWidget&&this.base.row===y.$ghostText.position.row&&(_.top+=y.$ghostTextWidget.el.offsetHeight);var L=w.container.getBoundingClientRect().bottom-D,T=L<_.top?{top:L,left:_.left}:_;this.popup.tryShow(T,D,"bottom")||this.popup.tryShow($,D,"top")||this.popup.show($,D)},S.prototype.openPopup=function(w,y,D){this.$firstOpenTimer.cancel(),this.popup||this.$init(),this.inlineEnabled&&!this.inlineRenderer&&this.$initInline(),this.popup.autoSelect=this.autoSelect,this.popup.setSelectOnHover(this.setSelectOnHover);var $=this.popup.getRow(),A=this.popup.data[$];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}),w.keyBinding.addKeyboardHandler(this.keyboardHandler);var _;this.stickySelection&&(_=this.popup.data.indexOf(A)),(!_||_===-1)&&(_=0),this.popup.setRow(this.autoSelect?_:-1),_===$&&A!==this.completions.filtered[_]&&this.$onPopupChange();var L=this.inlineRenderer&&this.inlineEnabled;if(_===$&&L){var T=this.popup.getData(this.popup.getRow());this.$updateGhostText(T)}D||(this.popup.setTheme(w.getTheme()),this.popup.setFontSize(w.getFontSize()),this.$updatePopupPosition(),this.tooltipNode&&this.updateDocTooltip()),this.changeTimer.cancel(),this.observeLayoutChanges()},S.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()},S.prototype.changeListener=function(w){var y=this.editor.selection.lead;(y.row!=this.base.row||y.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},S.prototype.blurListener=function(w){var y=document.activeElement,D=this.editor.textInput.getElement(),$=w.relatedTarget&&this.tooltipNode&&this.tooltipNode.contains(w.relatedTarget),A=this.popup&&this.popup.container;y!=D&&y.parentNode!=A&&!$&&y!=this.tooltipNode&&w.relatedTarget!=D&&this.detach()},S.prototype.mousedownListener=function(w){this.detach()},S.prototype.mousewheelListener=function(w){this.popup&&!this.popup.isMouseOver&&this.detach()},S.prototype.mouseOutListener=function(w){this.popup.isOpen&&this.$updatePopupPosition()},S.prototype.goTo=function(w){this.popup.goTo(w)},S.prototype.insertMatch=function(w,y){if(w||(w=this.popup.getData(this.popup.getRow())),!w)return!1;if(w.value==="")return this.detach();var D=this.completions,$=this.getCompletionProvider().insertMatch(this.editor,w,D.filterText,y);return this.completions==D&&this.detach(),$},S.prototype.showPopup=function(w,y){this.editor&&this.detach(),this.activated=!0,this.editor=w,w.completer!=this&&(w.completer&&w.completer.detach(),w.completer=this),w.on("changeSelection",this.changeListener),w.on("blur",this.blurListener),w.on("mousedown",this.mousedownListener),w.on("mousewheel",this.mousewheelListener),this.updateCompletions(!1,y)},S.prototype.getCompletionProvider=function(w){return this.completionProvider||(this.completionProvider=new b(w)),this.completionProvider},S.prototype.gatherCompletions=function(w,y){return this.getCompletionProvider().gatherCompletions(w,y)},S.prototype.updateCompletions=function(w,y){if(w&&this.base&&this.completions){var $=this.editor.getCursorPosition(),A=this.editor.session.getTextRange({start:this.base,end:$});if(A==this.completions.filterText)return;if(this.completions.setFilter(A),!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==A&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,A,w);return}if(y&&y.matches){var $=this.editor.getSelectionRange().start;return this.base=this.editor.session.doc.createAnchor($.row,$.column),this.base.$insertRight=!0,this.completions=new E(y.matches),this.getCompletionProvider().completions=this.completions,this.openPopup(this.editor,"",w)}var D=this.editor.getSession(),$=this.editor.getCursorPosition(),A=u.getCompletionPrefix(this.editor);this.base=D.doc.createAnchor($.row,$.column-A.length),this.base.$insertRight=!0;var _={exactMatch:this.exactMatch,ignoreCaption:this.ignoreCaption};this.getCompletionProvider({prefix:A,pos:$}).provideCompletions(this.editor,_,function(L,T,k){var x=T.filtered,C=u.getCompletionPrefix(this.editor);if(this.$firstOpenTimer.cancel(),k){if(!x.length){var M=!this.autoShown&&this.emptyMessage;if(typeof M=="function"&&(M=this.emptyMessage(C)),M){var F=[{caption:M,value:""}];this.completions=new E(F),this.openPopup(this.editor,C,w),this.popup.renderer.setStyle("ace_loading",!1),this.popup.renderer.setStyle("ace_empty-message",!0);return}return this.detach()}if(x.length==1&&x[0].value==C&&!x[0].snippet)return this.detach();if(this.autoInsert&&!this.autoShown&&x.length==1)return this.insertMatch(x[0])}this.completions=!k&&this.showLoadingState?new E(S.completionsForLoading.concat(x),T.filterText):T,this.openPopup(this.editor,C,w),this.popup.renderer.setStyle("ace_empty-message",!1),this.popup.renderer.setStyle("ace_loading",!k)}.bind(this)),this.showLoadingState&&!this.autoShown&&(!this.popup||!this.popup.isOpen)&&this.$firstOpenTimer.delay(this.stickySelectionDelay/2)},S.prototype.cancelContextMenu=function(){this.editor.$mouseHandler.cancelContextMenu()},S.prototype.updateDocTooltip=function(){var w=this.popup,y=this.completions&&this.completions.filtered,D=y&&(y[w.getHoveredRow()]||y[w.getRow()]),$=null;if(!D||!this.editor||!this.popup.isOpen)return this.hideDocTooltip();for(var A=this.editor.completers.length,_=0;_<A;_++){var L=this.editor.completers[_];if(L.getDocTooltip&&D.completerId===L.id){$=L.getDocTooltip(D);break}}if(!$&&typeof D!="string"&&($=D),typeof $=="string"&&($={docText:$}),!$||!$.docHTML&&!$.docText)return this.hideDocTooltip();this.showDocTooltip($)},S.prototype.showDocTooltip=function(w){this.tooltipNode||(this.tooltipNode=a.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",m));var y=this.editor.renderer.theme;this.tooltipNode.className="ace_tooltip ace_doc-tooltip "+(y.isDark?"ace_dark ":"")+(y.cssClass||"");var D=this.tooltipNode;w.docHTML?D.innerHTML=w.docHTML:w.docText&&(D.textContent=w.docText),D.parentNode||this.popup.container.appendChild(this.tooltipNode);var $=this.popup,A=$.container.getBoundingClientRect(),_=400,L=300,T=$.renderer.scrollBar.width||10,k=A.left,x=window.innerWidth-A.right-T,C=$.isTopdown?A.top:window.innerHeight-T-A.bottom,M=[Math.min(x/_,1),Math.min(k/_,1),Math.min(C/L*.9)],F=Math.max.apply(Math,M),R=D.style;R.display="block",F==M[0]?(R.left=A.right+1+"px",R.right="",R.maxWidth=_*F+"px",R.top=A.top+"px",R.bottom="",R.maxHeight=Math.min(window.innerHeight-T-A.top,L)+"px"):F==M[1]?(R.right=window.innerWidth-A.left+"px",R.left="",R.maxWidth=_*F+"px",R.top=A.top+"px",R.bottom="",R.maxHeight=Math.min(window.innerHeight-T-A.top,L)+"px"):F==M[2]&&(R.left=window.innerWidth-A.left+"px",R.maxWidth=Math.min(_,window.innerWidth)+"px",$.isTopdown?(R.top=A.bottom+"px",R.left=A.left+"px",R.right="",R.bottom="",R.maxHeight=Math.min(window.innerHeight-T-A.bottom,L)+"px"):(R.top=$.container.offsetTop-D.offsetHeight+"px",R.left=A.left+"px",R.right="",R.bottom="",R.maxHeight=Math.min($.container.offsetTop,L)+"px"))},S.prototype.hideDocTooltip=function(){if(this.tooltipTimer.cancel(),!!this.tooltipNode){var w=this.tooltipNode;!this.editor.isFocused()&&document.activeElement==w&&this.editor.focus(),this.tooltipNode=null,w.parentNode&&w.parentNode.removeChild(w)}},S.prototype.onTooltipClick=function(w){for(var y=w.target;y&&y!=this.tooltipNode;){if(y.nodeName=="A"&&y.href){y.rel="noreferrer",y.target="_blank";break}y=y.parentNode}},S.prototype.destroy=function(){if(this.detach(),this.popup){this.popup.destroy();var w=this.popup.container;w&&w.parentNode&&w.parentNode.removeChild(w)}this.editor&&this.editor.completer==this&&(this.editor.off("destroy",g),this.editor.completer=null),this.inlineRenderer=this.popup=this.editor=null},S.for=function(w){return w.completer instanceof S||(w.completer&&(w.completer.destroy(),w.completer=null),d.get("sharedPopups")?(S.$sharedInstance||(S.$sharedInstance=new S),w.completer=S.$sharedInstance):(w.completer=new S,w.once("destroy",g))),w.completer},S})();v.prototype.commands={Up:function(S){S.completer.goTo("up")},Down:function(S){S.completer.goTo("down")},"Ctrl-Up|Ctrl-Home":function(S){S.completer.goTo("start")},"Ctrl-Down|Ctrl-End":function(S){S.completer.goTo("end")},Esc:function(S){S.completer.detach()},Return:function(S){return S.completer.insertMatch()},"Shift-Return":function(S){S.completer.insertMatch(null,{deleteSuffix:!0})},Tab:function(S){var w=S.completer.insertMatch();if(w||S.tabstopManager)return w;S.completer.goTo("down")},Backspace:function(S){S.execCommand("backspace");var w=u.getCompletionPrefix(S);!w&&S.completer&&S.completer.detach()},PageUp:function(S){S.completer.popup.gotoPageUp()},PageDown:function(S){S.completer.popup.gotoPageDown()}},v.startCommand={name:"startAutocomplete",exec:function(S,w){var y=v.for(S);y.autoInsert=!1,y.autoSelect=!0,y.autoShown=!1,y.showPopup(S,w),y.cancelContextMenu()},bindKey:"Ctrl-Space|Ctrl-Shift-Space|Alt-Space"};var b=(function(){function S(w){this.initialPosition=w,this.active=!0}return S.prototype.insertByIndex=function(w,y,D){return!this.completions||!this.completions.filtered?!1:this.insertMatch(w,this.completions.filtered[y],D)},S.prototype.insertMatch=function(w,y,D){if(!y)return!1;if(w.startOperation({command:{name:"insertMatch"}}),y.completer&&y.completer.insertMatch)y.completer.insertMatch(w,y);else{if(!this.completions)return!1;var $=this.completions.filterText.length,A=0;if(y.range&&y.range.start.row===y.range.end.row&&($-=this.initialPosition.prefix.length,$+=this.initialPosition.pos.column-y.range.start.column,A+=y.range.end.column-this.initialPosition.pos.column),$||A){var _;w.selection.getAllRanges?_=w.selection.getAllRanges():_=[w.getSelectionRange()];for(var L=0,T;T=_[L];L++)T.start.column-=$,T.end.column+=A,w.session.remove(T)}y.snippet?l.insertSnippet(w,y.snippet):this.$insertString(w,y),y.completer&&y.completer.onInsert&&typeof y.completer.onInsert=="function"&&y.completer.onInsert(w,y),y.command&&y.command==="startAutocomplete"&&w.execCommand(y.command)}return w.endOperation(),!0},S.prototype.$insertString=function(w,y){var D=y.value||y;w.execCommand("insertstring",D)},S.prototype.gatherCompletions=function(w,y){var D=w.getSession(),$=w.getCursorPosition(),A=u.getCompletionPrefix(w),_=[];this.completers=w.completers;var L=w.completers.length;return w.completers.forEach(function(T,k){T.getCompletions(w,D,$,A,function(x,C){T.hideInlinePreview&&(C=C.map(function(M){return Object.assign(M,{hideInlinePreview:T.hideInlinePreview})})),!x&&C&&(_=_.concat(C)),y(null,{prefix:u.getCompletionPrefix(w),matches:_,finished:--L===0})})}),!0},S.prototype.provideCompletions=function(w,y,D){var $=function(T){var k=T.prefix,x=T.matches;this.completions=new E(x),y.exactMatch&&(this.completions.exactMatch=!0),y.ignoreCaption&&(this.completions.ignoreCaption=!0),this.completions.setFilter(k),(T.finished||this.completions.filtered.length)&&D(null,this.completions,T.finished)}.bind(this),A=!0,_=null;if(this.gatherCompletions(w,function(T,k){if(this.active){T&&(D(T,[],!0),this.detach());var x=k.prefix;if(x.indexOf(k.prefix)===0){if(A){_=k;return}$(k)}}}.bind(this)),A=!1,_){var L=_;_=null,$(L)}},S.prototype.detach=function(){this.active=!1,this.completers&&this.completers.forEach(function(w){typeof w.cancel=="function"&&w.cancel()})},S})(),E=(function(){function S(w,y){this.all=w,this.filtered=w,this.filterText=y||"",this.exactMatch=!1,this.ignoreCaption=!1}return S.prototype.setFilter=function(w){if(w.length>this.filterText&&w.lastIndexOf(this.filterText,0)===0)var y=this.filtered;else var y=this.all;this.filterText=w,y=this.filterCompletions(y,this.filterText),y=y.sort(function($,A){return A.exactMatch-$.exactMatch||A.$score-$.$score||($.caption||$.value).localeCompare(A.caption||A.value)});var D=null;y=y.filter(function($){var A=$.snippet||$.caption||$.value;return A===D?!1:(D=A,!0)}),this.filtered=y},S.prototype.filterCompletions=function(w,y){var D=[],$=y.toUpperCase(),A=y.toLowerCase();e:for(var _=0,L;L=w[_];_++){if(L.skipFilter){L.$score=L.score,D.push(L);continue}var T=!this.ignoreCaption&&L.caption||L.value||L.snippet;if(T){var k=-1,x=0,C=0,M,F;if(this.exactMatch){if(y!==T.substr(0,y.length))continue e}else{var R=T.toLowerCase().indexOf(A);if(R>-1)C=R;else for(var O=0;O<y.length;O++){var B=T.indexOf(A[O],k+1),N=T.indexOf($[O],k+1);if(M=B>=0&&(N<0||B<N)?B:N,M<0)continue e;F=M-k-1,F>0&&(k===-1&&(C+=10),C+=F,x|=1<<O),k=M}}L.matchMask=x,L.exactMatch=C?0:1,L.$score=(L.score||0)-C,D.push(L)}}return D},S})();n.Autocomplete=v,n.CompletionProvider=b,n.FilteredList=E}),ace.define("ace/marker_group",["require","exports","module"],function(t,n,f){var i=(function(){function o(p,s){s&&(this.markerType=s.markerType),this.markers=[],this.session=p,p.addDynamicMarker(this)}return o.prototype.getMarkerAtPosition=function(p){return this.markers.find(function(s){return s.range.contains(p.row,p.column)})},o.prototype.markersComparator=function(p,s){return p.range.start.row-s.range.start.row},o.prototype.setMarkers=function(p){this.markers=p.sort(this.markersComparator).slice(0,this.MAX_MARKERS),this.session._signal("changeBackMarker")},o.prototype.update=function(p,s,u,r){if(!(!this.markers||!this.markers.length))for(var a=r.firstRow,l=r.lastRow,d,c=0,m=0,g=0;g<this.markers.length;g++){var v=this.markers[g];if(!(v.range.end.row<a)&&!(v.range.start.row>l)&&(v.range.start.row===m?c++:(m=v.range.start.row,c=0),!(c>200))){var b=v.range.clipRows(a,l);if(!(b.start.row===b.end.row&&b.start.column===b.end.column)){var E=b.toScreenRange(u);if(E.isEmpty()){d=u.getNextFoldLine(b.end.row,d),d&&d.end.row>b.end.row&&(a=d.end.row);continue}this.markerType==="fullLine"?s.drawFullLineMarker(p,E,v.className,r):E.isMultiLine()?this.markerType==="line"?s.drawMultiLineMarker(p,E,v.className,r):s.drawTextMarker(p,E,v.className,r):s.drawSingleLineMarker(p,E,v.className+" ace_br15",r)}}}},o})();i.prototype.MAX_MARKERS=1e4,n.MarkerGroup=i}),ace.define("ace/autocomplete/text_completer",["require","exports","module","ace/range"],function(t,n,f){function i(u,r){var a=u.getTextRange(p.fromPoints({row:0,column:0},r));return a.split(s).length-1}function o(u,r){var a=i(u,r),l=u.getValue().split(s),d=Object.create(null),c=l[a];return l.forEach(function(m,g){if(!(!m||m===c)){var v=Math.abs(a-g),b=l.length-v;d[m]?d[m]=Math.max(b,d[m]):d[m]=b}}),d}var p=t("../range").Range,s=/[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/;n.getCompletions=function(u,r,a,l,d){var c=o(r,a),m=Object.keys(c);d(null,m.map(function(g){return{caption:g,value:g,score:c[g],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(t,n,f){var i=t("../snippets").snippetManager,o=t("../autocomplete").Autocomplete,p=t("../config"),s=t("../lib/lang"),u=t("../autocomplete/util"),r=t("../marker_group").MarkerGroup,a=t("../autocomplete/text_completer"),l={getCompletions:function(A,_,L,T,k){if(_.$mode.completer)return _.$mode.completer.getCompletions(A,_,L,T,k);var x=A.session.getState(L.row),C=_.$mode.getCompletions(x,_,L,T);C=C.map(function(M){return M.completerId=l.id,M}),k(null,C)},id:"keywordCompleter"},d=function(A){var _={};return A.replace(/\${(\d+)(:(.*?))?}/g,function(L,T,k,x){return _[T]=x||""}).replace(/\$(\d+?)/g,function(L,T){return _[T]})},c={getCompletions:function(A,_,L,T,k){var x=[],C=_.getTokenAt(L.row,L.column);C&&C.type.match(/(tag-name|tag-open|tag-whitespace|attribute-name|attribute-value)\.xml$/)?x.push("html-tag"):x=i.getActiveScopes(A);var M=i.snippetMap,F=[];x.forEach(function(R){for(var O=M[R]||[],B=O.length;B--;){var N=O[B],j=N.name||N.tabTrigger;j&&F.push({caption:j,snippet:N.content,meta:N.tabTrigger&&!N.name?N.tabTrigger+"⇥ ":"snippet",completerId:c.id})}},this),k(null,F)},getDocTooltip:function(A){A.snippet&&!A.docHTML&&(A.docHTML=["<b>",s.escapeHTML(A.caption),"</b>","<hr></hr>",s.escapeHTML(d(A.snippet))].join(""))},id:"snippetCompleter"},m=[c,a,l];n.setCompleters=function(A){m.length=0,A&&m.push.apply(m,A)},n.addCompleter=function(A){m.push(A)},n.textCompleter=a,n.keyWordCompleter=l,n.snippetCompleter=c;var g={name:"expandSnippet",exec:function(A){return i.expandWithTab(A)},bindKey:"Tab"},v=function(A,_){b(_.session.$mode)},b=function(A){typeof A=="string"&&(A=p.$modes[A]),A&&(i.files||(i.files={}),E(A.$id,A.snippetFileId),A.modes&&A.modes.forEach(b))},E=function(A,_){!_||!A||i.files[A]||(i.files[A]={},p.loadModule(_,function(L){L&&(i.files[A]=L,!L.snippets&&L.snippetText&&(L.snippets=i.parseSnippetFile(L.snippetText)),i.register(L.snippets||[],L.scope),L.includeScopes&&(i.snippetMap[L.scope].includeScopes=L.includeScopes,L.includeScopes.forEach(function(T){b("ace/mode/"+T)})))}))},S=function(A){var _=A.editor,L=_.completer&&_.completer.activated;if(A.command.name==="backspace")L&&!u.getCompletionPrefix(_)&&_.completer.detach();else if(A.command.name==="insertstring"&&!L){w=A;var T=A.editor.$liveAutocompletionDelay;T?y.delay(T):D(A)}},w,y=s.delayedCall(function(){D(w)},0),D=function(A){var _=A.editor,L=u.getCompletionPrefix(_),T=A.args,k=u.triggerAutocomplete(_,T);if(L&&L.length>=_.$liveAutocompletionThreshold||k){var x=o.for(_);x.autoShown=!0,x.showPopup(_)}},$=t("../editor").Editor;t("../config").defineOptions($.prototype,"editor",{enableBasicAutocompletion:{set:function(A){A?(o.for(this),this.completers||(this.completers=Array.isArray(A)?A:m),this.commands.addCommand(o.startCommand)):this.commands.removeCommand(o.startCommand)},value:!1},enableLiveAutocompletion:{set:function(A){A?(this.completers||(this.completers=Array.isArray(A)?A:m),this.commands.on("afterExec",S)):this.commands.off("afterExec",S)},value:!1},liveAutocompletionDelay:{initialValue:0},liveAutocompletionThreshold:{initialValue:0},enableSnippets:{set:function(A){A?(this.commands.addCommand(g),this.on("changeMode",v),v(null,this)):(this.commands.removeCommand(g),this.off("changeMode",v))},value:!1}}),n.MarkerGroup=r}),(function(){ace.require(["ace/ext/language_tools"],function(t){h&&(h.exports=t)})})()})(Ny);const ho={jsonError:{border:"1px solid red",minHeight:200},jsonNoError:{border:"1px solid #00000000",minHeight:200}};function By(h){return I.createElement(Iy,{style:h.error===!0?ho.jsonError:h.error===!1?ho.jsonNoError:void 0,mode:h.mode||"json",width:"100%",height:"100%",showPrintMargin:h.editValueMode,showGutter:h.editValueMode,highlightActiveLine:h.editValueMode,defaultValue:h.defaultValue,theme:h.themeType==="dark"?"clouds_midnight":"chrome",value:h.value,readOnly:!h.onChange,onChange:e=>{var t;return(t=h.onChange)==null?void 0:t.call(h,e)},name:h.name||"UNIQUE_ID_OF_DIV1",fontSize:h.fontSize||14,setOptions:{enableBasicAutocompletion:!0,enableLiveAutocompletion:!0,enableSnippets:!0,showLineNumbers:h.editValueMode,tabSize:h.editValueMode?2:void 0},editorProps:{$blockScrolling:!0}})}const Lr={flex:{display:"flex"},button:{height:48,minWidth:48},wrapper:{width:"calc(100vw - 40px)",height:"calc(100vh - 188px)"}};class Vy extends q{componentDidMount(){super.componentDidMount();const{data:e,attr:t}=this.props,n=q.getValue(e,t)||"{}";this.setState({value:n,initialized:!0,jsonError:this.validateJson(n)})}validateJson(e){let t=!1;if(this.props.schema.validateJson!==!1&&(e||!this.props.schema.allowEmpty))try{this.props.schema.json5?Oo.parse(e):JSON.parse(e)}catch(n){console.log("Error in JSON",n),t=!0}return t}renderItem(e,t){if(!this.state.initialized)return null;const{schema:n,data:f,attr:i}=this.props,{value:o,showSelectId:p}=this.state,s=n.readOnly===!0;return I.createElement(P.FormControl,{fullWidth:!0,variant:"standard"},I.createElement("div",{style:Lr.flex},I.createElement(P.Button,{color:"grey",disabled:t,style:Lr.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},z.I18n.t("ra_JSON editor"))),p?I.createElement(fv,{title:this.getText(n.label),overflowHidden:!0,applyDisabled:this.state.jsonError&&this.props.schema.doNotApplyWithError||s,onClose:()=>this.setState({showSelectId:!1,value:q.getValue(f,i)||{}}),onApply:s?void 0:()=>this.setState({showSelectId:!1},()=>this.onChange(i,o))},I.createElement("div",{style:{...Lr.wrapper,border:this.state.jsonError?"2px solid red":"2px solid transparent"}},I.createElement(By,{mode:this.props.schema.json5?"json5":"json",value:typeof o=="object"?JSON.stringify(o):o,onChange:s?void 0:u=>this.setState({value:u,jsonError:this.validateJson(u)}),name:"ConfigJsonEditor",themeType:this.props.oContext.themeType}))):null,n.help||this.state.jsonError?I.createElement(P.FormHelperText,null,this.state.jsonError?z.I18n.t("ra_Invalid JSON"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Wy=[{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 jy extends q{componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr),t=[...Wy];this.props.schema.system?t.unshift({value:"",label:z.I18n.t("ra_System language")}):t.unshift({value:"",label:z.I18n.t("ra_none")}),this.setState({value:this.props.schema.system?e||"":e||z.I18n.getLanguage(),selectOptions:t})}renderItem(e,t){var f,i;if(!this.state.selectOptions)return null;const n=(f=this.state.selectOptions)==null?void 0:f.find(o=>o.value===this.state.value||!o.value&&!this.state.value);return I.createElement(P.FormControl,{fullWidth:!0,variant:"standard"},this.props.schema.label?I.createElement(P.InputLabel,null,this.getText(this.props.schema.label)):null,I.createElement(P.Select,{variant:"standard",error:!!e,disabled:t,value:this.state.value||"_",renderValue:()=>this.getText(n==null?void 0:n.label,this.props.schema.noTranslation),onChange:o=>{let{value:p}=o.target;p==="_"&&(p=""),this.setState({value:p},()=>{const s=this.onChange(this.props.attr,p);if(s instanceof Promise&&s.catch(u=>console.error(u)),this.props.schema.changeGuiLanguage)if(p){if(p===z.I18n.getLanguage())return;z.I18n.setLanguage(p),this.props.oContext.changeLanguage&&this.props.oContext.changeLanguage()}else this.props.oContext.socket.getSystemConfig().then(u=>{u.common.language!==z.I18n.getLanguage()&&u.common.language&&(z.I18n.setLanguage(u.common.language),this.props.oContext.changeLanguage&&this.props.oContext.changeLanguage())}).catch(u=>console.error(`Cannot read system config: ${u}`))})}},(i=this.state.selectOptions)==null?void 0:i.map(o=>I.createElement(P.MenuItem,{key:o.value,value:o.value},o.label))),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class Hy extends q{scrollRef;constructor(e){super(e),this.scrollRef=I.createRef()}scrolledDown(){return this.scrollRef.current?this.scrollRef.current.offsetHeight+this.scrollRef.current.scrollTop>=this.scrollRef.current.scrollHeight:!1}componentDidMount(){super.componentDidMount(),q.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(e=>e.text()).then(e=>this.setState({license:e,loading:!1})).catch(e=>this.setState({license:e.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(e,t){return this.state.showLicenseDialog?I.createElement(P.Dialog,{maxWidth:"lg",open:!0,onClose:(n,f)=>{f!=="escapeKeyDown"&&f!=="backdropClick"&&this.setState({showLicenseDialog:!1})}},I.createElement(P.DialogTitle,null,this.props.schema.title?z.I18n.t(this.props.schema.title):z.I18n.t("ra_License agreement")),I.createElement(P.DialogContent,null,this.props.schema.licenseUrl?I.createElement(I.Fragment,null,this.state.loading?I.createElement(P.LinearProgress,null):null,I.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?I.createElement("div",{ref:this.scrollRef,style:{width:"100%",height:"100%",overflowY:"auto",fontSize:14}},this.props.schema.texts.map((n,f)=>this.props.schema.noTranslation?I.createElement("p",{key:f},n):I.createElement("p",{key:f},z.I18n.t(n)))):null),I.createElement(P.DialogActions,null,this.props.schema.checkBox?I.createElement(P.FormControlLabel,{control:I.createElement(P.Checkbox,{disabled:t,checked:!!this.state.licenseChecked,onClick:()=>this.setState({licenseChecked:!this.state.licenseChecked})}),label:z.I18n.t(this.props.schema.checkBox)}):null,I.createElement(P.Button,{disabled:t||this.state.loading||this.state.error||this.props.schema.checkBox&&!this.state.licenseChecked||!this.state.scrolledDown,onClick:()=>{this.setState({showLicenseDialog:!1});const n=this.onChange(this.props.attr,!0);n instanceof Promise&&n.catch(f=>console.error(`Cannot set value: ${f}`))},color:"primary",variant:"contained",startIcon:I.createElement(se.Check,null)},this.props.schema.agreeText?z.I18n.t(this.props.schema.agreeText):z.I18n.t("ra_Accept license")),I.createElement(P.Button,{onClick:()=>{this.setState({showLicenseDialog:!1}),setTimeout(()=>this.setState({showLicenseDialog:!0}),2e3)},color:"grey",variant:"contained",startIcon:I.createElement(se.Close,null)},z.I18n.t("ra_Close")))):null}}const po={indeterminate:{opacity:.5},control:{flexDirection:"row",width:"100%"}};class zy extends q{updateTimeout;componentDidMount(){super.componentDidMount();let e=q.getValue(this.props.data,this.props.attr);if(e==null&&(e=""),Array.isArray(e)&&this.props.oContext.multiEdit){e=q.DIFFERENT_VALUE,this.setState({_value:e,oldValue:e});return}this.setState({_value:e.toString(),oldValue:e.toString()})}static getDerivedStateFromProps(e,t){if(e.schema.min!==void 0&&e.schema.min<0||e.schema.max!==void 0&&e.schema.max<0)return null;const n=q.getValue(e.data,e.attr);return e.oContext.multiEdit&&t._value===q.DIFFERENT_VALUE?{_value:q.DIFFERENT_VALUE}:n==null||t.oldValue===null||t.oldValue===void 0||n.toString()!==parseFloat(t._value).toString()&&n.toString()!==t.oldValue.toString()?{_value:n}:null}checkValue(e){if(e==null||(e=e.toString().trim().replace(",","."),e==="-"))return null;const t=e===""?0:parseFloat(e);return e!==""&&Number.isNaN(t)?"ra_Not a number":e!==""&&window.isFinite(t)?this.props.schema.min!==void 0&&t<this.props.schema.min?"ra_Too small":this.props.schema.max!==void 0&&t>this.props.schema.max?"ra_Too big":e===""||e==="-"||Number.isNaN(t)?"ra_Not a number":null:"ra_Not a number"}renderItem(e,t){var i;const n=Array.isArray(this.state._value)||this.state._value===q.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),n){const o=q.getValue(this.props.data,this.props.attr),p=(o==null?void 0:o.filter(s=>s||s===0).map(s=>({label:s.toString(),value:s})))||[];return p.unshift({label:z.I18n.t(q.DIFFERENT_LABEL),value:q.DIFFERENT_VALUE}),I.createElement(P.Autocomplete,{style:po.indeterminate,fullWidth:!0,freeSolo:!0,value:p[0],getOptionSelected:(s,u)=>s.label===u.label,onChange:(s,u)=>{const r=this.onChange(this.props.attr,u==null?void 0:u.value,()=>{this.setState({_value:u==null?void 0:u.value,oldValue:this.state._value})});r instanceof Promise&&r.catch(a=>console.error(a))},options:p,getOptionLabel:s=>s.label,renderInput:s=>I.createElement(P.TextField,{...s,label:this.getText(this.props.schema.label),variant:"standard",slotProps:{htmlInput:{...s.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:!!e,placeholder:this.getText(this.props.schema.placeholder),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation),disabled:!!t})})}!e&&this.state._value!==null&&this.state._value!==void 0&&this.state._value&&(e=this.checkValue(this.state._value),e&&(e=z.I18n.t(e)));const f=parseFloat(((i=this.state._value)==null?void 0:i.toString().replace(",","."))||"");return I.createElement(P.FormControl,{variant:"standard",style:po.control},I.createElement(P.TextField,{sx:{"& .up-down":{display:"none"},"&:hover .up-down":{display:"block"}},variant:"standard",type:Number.isNaN(f)?"text":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:!!e,disabled:!!t,onChange:o=>{const p=o.target.value,s=this.checkValue(p);s?this.onError(this.props.attr,z.I18n.t(s)):this.onError(this.props.attr),this.setState({_value:p,oldValue:this.state._value},()=>{const u=parseFloat(p.toString().replace(",","."));Number.isNaN(u)?this.onChange(this.props.attr,p.toString().replace(",",".")):this.onChange(this.props.attr,u)})},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:e&&typeof e=="string"?e:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)}))}}class Uy extends q{authWindow;oid;url;constructor(e){super(e),this.state={...this.state,accessTokens:"",success:!1,blocked:!1,running:!1,pressed:!1},this.url=`https://oauth2.iobroker.in/${e.schema.identifier}?redirect=true`,e.schema.scope&&(this.url+=`&scope=${encodeURIComponent(e.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 e=await this.props.oContext.socket.getState(this.oid);if(e){const t=JSON.parse(e.val);new Date(t.access_token_expires_on).getTime()>Date.now()&&this.setState({accessTokens:e.val})}}onTokensUpdated=(e,t)=>{if(t!=null&&t.val){const n=JSON.parse(t.val);if(new Date(n.access_token_expires_on).getTime()>Date.now()){this.state.accessTokens!==t.val&&this.setState({accessTokens:t.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(e){try{e&&!e.startsWith("{")&&(e=atob(e));const t=JSON.parse(e);t.access_token&&t.refresh_token&&t.expires_in&&(t.access_token_expires_on||=new Date(Date.now()+t.expires_in*1e3).toISOString(),this.props.oContext.socket.setState(this.oid,JSON.stringify(t),!0).catch(n=>console.log(`Error occurred: ${n.toString()}`)))}catch(t){console.warn(t)}}onMessage=e=>{var t,n,f;if(e.origin==="https://oauth2.iobroker.in"&&(typeof e.data=="string"&&e.data.startsWith(`${this.props.schema.identifier}-authentication:`)||typeof e.message=="string"&&e.message.startsWith(`${this.props.schema.identifier}-authentication:`))){const i=(e.data||e.message).split(":");i[1]==="success"?(this.setState({accessTokens:i[2],success:!0,pressed:!1},()=>this.saveToken(this.state.accessTokens)),(t=this.authWindow)==null||t.postMessage("close",e.origin),this.authWindow=null):(f=(n=this.props).onError)==null||f.call(n,i[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 e="";if(this.state.accessTokens)try{const f=JSON.parse(this.state.accessTokens);e=new Date(f.access_token_expires_on).toLocaleString()}catch{}let t;this.state.accessTokens?t=this.props.schema.refreshLabel?this.getText(this.props.schema.refreshLabel):z.I18n.t("ra_Renew %s access",this.props.schema.identifier[0].toUpperCase()+this.props.schema.identifier.slice(1)):t=this.props.schema.label?this.getText(this.props.schema.label):z.I18n.t("ra_Get %s access",this.props.schema.identifier[0].toUpperCase()+this.props.schema.identifier.slice(1));const n=this.getIcon();return I.createElement("div",{style:{width:"100%",margin:"0 0 1rem 0"}},I.createElement(P.Button,{disabled:this.state.running,endIcon:n||I.createElement(se.CloudUpload,null),variant:"contained",onClick:()=>this.onOpenUrl()},t),this.state.blocked?I.createElement("div",{style:{color:"red",fontSize:16,marginTop:20}},z.I18n.t("ra_Please allow popups in your browser for this page!")):null,this.state.accessTokens?I.createElement("div",{style:{color:"green",fontSize:16,marginTop:20}},this.props.alive?z.I18n.t("ra_Successfully authorized. Token valid till %s and will be automatically renewed.",e):z.I18n.t("ra_Successfully authorized. Token valid till %s but it can expire as the instance is not running.",e)):null,this.state.pressed?I.createElement(I.Fragment,null,I.createElement("div",{style:{width:"100%",margin:"1rem 0 1rem 0"}},I.createElement("span",{style:{marginRight:4}},`${z.I18n.t("ra_If the button above does not work, you can authorize manually this app by visiting this url")}`,":"),I.createElement("br",null),I.createElement("a",{target:this.props.schema.identifier,href:this.url,rel:"noreferrer"},this.url)),I.createElement(P.TextField,{value:this.state.accessTokens,label:z.I18n.t("ra_Enter the code from that page here"),variant:"standard",onChange:f=>{let i=f.target.value;i&&!i.startsWith("{")&&(i=atob(i));try{const o=JSON.parse(i);o.access_token&&(o.access_token_expires_on=new Date(Date.now()+(o.expires_in-10)*1e3).toISOString(),this.setState({accessTokens:JSON.stringify(o)},()=>this.saveToken(this.state.accessTokens)))}catch{}},fullWidth:!0})):null)}}const fo={flex:{display:"flex"},button:{height:48,marginLeft:4,minWidth:48}};class Gy extends q{componentDidMount(){super.componentDidMount();const{data:e,attr:t}=this.props,n=q.getValue(e,t)||"";this.setState({value:n,initialized:!0})}renderItem(e,t){if(!this.state.initialized)return null;const n=this.props.oContext.socket,{schema:f,attr:i}=this.props,{value:o,showSelectId:p}=this.state;return I.createElement(P.FormControl,{fullWidth:!0,variant:"standard"},f.label?I.createElement(P.InputLabel,{shrink:!0},this.getText(f.label)):null,I.createElement("div",{style:fo.flex},I.createElement(P.TextField,{variant:"standard",fullWidth:!0,value:o,error:!!e,disabled:t,placeholder:this.getText(f.placeholder),label:this.getText(f.label),helperText:this.renderHelp(f.help,f.helpLink,f.noTranslation),onChange:s=>{const u=s.target.value;this.setState({value:u},()=>this.onChange(i,u))}}),I.createElement(P.Button,{color:"grey",disabled:t,style:fo.button,size:"small",variant:"outlined",onClick:()=>this.setState({showSelectId:!0})},"...")),p?I.createElement(z.DialogSelectID,{imagePrefix:this.props.oContext.imagePrefix===void 0?"../..":this.props.oContext.imagePrefix,dialogName:`admin.${this.props.oContext.adapterName}`,filterFunc:f.filterFunc,themeType:this.props.oContext.themeType,theme:this.props.oContext.theme,types:f.types?Array.isArray(f.types)?f.types:[f.types]:void 0,customFilter:f.customFilter,filters:f.filters,socket:n,selected:o,root:f.root,onClose:()=>this.setState({showSelectId:!1}),onOk:s=>this.setState({showSelectId:!1,value:s},()=>this.onChange(i,s))}):null)}}const Fr={fullWidth:{width:"100%",display:"inline-block"},halfWidth1:{width:"calc(50% - 5px)",display:"inline-block",marginRight:8},halfWidth2:{width:"calc(50% - 5px)",display:"inline-block"}},Fi="____ppp____";class Ky extends q{componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr);this.setState({_repeat:e?Fi:"",_visible:!1,value:e?Fi:"",_notEqual:!1})}onChangePassword(e,t){e===void 0&&(e=this.state.value),t===void 0&&(t=this.state._repeat);const n=!!this.props.schema.repeat&&t!==e;this.setState({value:e,_repeat:t,_notEqual:n},()=>{if(n)this.onError(this.props.attr,z.I18n.t("ra_Passwords are not equal!"));else{this.onError(this.props.attr);const f=this.onChange(this.props.attr,e);f instanceof Promise&&f.catch(i=>this.onError(this.props.attr,i))}})}renderItem(e,t){if(this.state._notEqual===void 0)return null;const n=I.createElement(P.TextField,{variant:"standard",fullWidth:!0,type:this.state._visible&&this.state.value!==Fi?"text":"password",value:this.state.value,error:!!e||this.state._notEqual,disabled:!!t,onChange:f=>this.onChangePassword(f.target.value),label:this.getText(this.props.schema.label),slotProps:{input:{autoComplete:"new-password",endAdornment:this.state.value&&this.state.value!==Fi&&this.props.schema.visible&&!t&&!this.props.schema.readOnly?I.createElement(P.InputAdornment,{position:"end"},I.createElement(P.IconButton,{size:"large",tabIndex:-1,onClick:f=>{f.preventDefault(),f.stopPropagation(),this.setState({_visible:!this.state._visible})},edge:"end"},this.state._visible?I.createElement(se.VisibilityOff,null):I.createElement(se.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?z.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 f=this.state._visible?null:I.createElement(P.TextField,{variant:"standard",fullWidth:!0,type:"password",value:this.state._repeat,error:!!e||this.state._notEqual,disabled:!!t,onChange:i=>this.onChangePassword(void 0,i.target.value),label:`${this.getText(this.props.schema.label)} (${z.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?z.I18n.t("ra_Passwords are not equal!"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)});return I.createElement("div",{style:Fr.fullWidth},I.createElement("div",{style:Fr.halfWidth1},n),I.createElement("div",{style:Fr.halfWidth2},f))}return n}}class Yy extends q{renderItem(e,t){return I.createElement(P.TextField,{variant:"standard",fullWidth:!0,disabled:!!t,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?I.createElement(P.IconButton,{tabIndex:-1,size:"small",onClick:()=>{z.Utils.copyToClipboard(this.getPattern(this.props.schema.pattern,null,this.props.schema.noTranslation)),window.alert(z.I18n.t("ra_Copied"))}},I.createElement(z.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 Jy={warning:{"& .Mui-error":{color:"orange"}}};class Qy extends q{updateTimeout;async componentDidMount(){super.componentDidMount();let e=q.getValue(this.props.data,this.props.attr);e==null&&(e=""),this.setState({_value:e.toString(),oldValue:e.toString()});const t=await this.props.oContext.socket.getAdapterInstances(),n=`system.adapter.${this.props.oContext.adapterName}.${this.props.oContext.instance}`,f=await this.props.oContext.socket.getObject(n),i=f==null?void 0:f.common.host,o=[];t.forEach(p=>{var u,r,a,l;if(!p||p._id===n||p.common.host!==i||!((u=p.native)!=null&&u.bind))return;if(p!=null&&p.native&&p.native.secure&&p.native.leEnabled&&p.native.leUpdate){const d=parseInt(p.native.leCheckPort||p.native.lePort,10);d&&o.push({name:`${p._id.replace("system.adapter.","")} (LE)`,port:d,v6bind:p.native.bind.includes(":")?p.native.bind:p.native.v6bind,bind:p.native.bind,enabled:!!((r=p.common)!=null&&r.enabled)})}const s=parseInt((a=p==null?void 0:p.native)==null?void 0:a.port,10);s&&o.push({name:p._id.replace("system.adapter.",""),bind:p.native.bind,v6bind:p.native.bind.includes(":")?p.native.bind:p.native.v6bind,port:s,enabled:!!((l=p.common)!=null&&l.enabled)})}),this.setState({ports:o})}static getDerivedStateFromProps(e,t){const n=q.getValue(e.data,e.attr);return n==null||t.oldValue===null||t.oldValue===void 0||n.toString()!==parseInt(t._value,10).toString()&&n.toString()!==t.oldValue.toString()?{_value:n}:null}checkValue(e){if(e==null)return null;const t=this.props.schema.min===void 0?20:this.props.schema.min,n=this.props.schema.max||65535;e=e.toString().trim();const f=e===""?0:parseInt(e,10);return e!==""&&Number.isNaN(f)?"ra_Not a number":e!==""&&window.isFinite(Number(e))?f<t?"ra_Too small":f>n?"ra_Too big":e===""||e==="-"||Number.isNaN(f)?"ra_Not a number":null:"ra_Not a number"}renderItem(e,t){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 n=this.props.schema.min===void 0?20:this.props.schema.min,f=this.props.schema.max||65535;let i;if(this.state.ports){const o=parseInt(this.state._value,10);if(o){const p=this.props.data.bind,s=this.state.ports.filter(r=>{if(r.port!==o)return!1;const a=r.bind,l=r.v6bind;return!p||!a||p==="0.0.0.0"||a==="0.0.0.0"||p==="::"||l==="::"||p===a||p===l});let u=s.findIndex(r=>r.port===o&&r.enabled);if(u!==-1){const r=this.state.ports.find(a=>a.port===o&&a.enabled&&s.some(l=>l.name===a.name&&l.bind===a.bind));e=z.I18n.t("ra_Port is already used by %s",(r==null?void 0:r.name)||s[u].name)}else if(u=s.findIndex(r=>r.port===o&&!r.enabled),u!==-1){i=!0;const r=this.state.ports.find(a=>a.port===o&&!a.enabled&&s.some(l=>l.name===a.name&&l.bind===a.bind));e=z.I18n.t("ra_Port could be used by %s",(r==null?void 0:r.name)||s[u].name)}}}return!e&&this.state._value!==null&&this.state._value!==void 0&&(e=this.checkValue(this.state._value),typeof e=="string"&&(e=z.I18n.t(e))),I.createElement(P.TextField,{variant:"standard",type:"number",fullWidth:!0,slotProps:{htmlInput:{min:n,max:f,readOnly:this.props.schema.readOnly||!1}},value:this.state._value===null||this.state._value===void 0?"":this.state._value,error:!!e,disabled:!!t,sx:i?Jy.warning:void 0,onChange:o=>{const p=Number(o.target.value.toString().replace(/[^0-9]/g,"")).toString(),s=this.checkValue(p);s?this.onError(this.props.attr,z.I18n.t(s)):this.onError(this.props.attr),this.setState({_value:p,oldValue:this.state._value},()=>{if(p.trim()===parseInt(p,10).toString()){const u=this.onChange(this.props.attr,parseInt(p,10)||0);u instanceof Promise&&u.catch(r=>{console.error(`Cannot set value for ${this.props.attr}: ${r}`)})}})},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:e&&typeof e=="string"?e:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}class Xy extends q{componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr);this.props.oContext.socket.getEnums("rooms").then(t=>{const n=Object.keys(t).map(f=>({value:this.props.schema.short?f.replace("enum.rooms.",""):f,label:this.getText(t[f].common.name),obj:t[f]}));this.props.schema.allowDeactivate!==!1&&n.unshift({label:z.I18n.t(q.NONE_LABEL),value:q.NONE_VALUE}),this.setState({value:e,selectOptions:n})}).catch(t=>console.error(`Cannot get enums: ${t}`))}renderItem(e,t){if(!this.state.selectOptions)return null;const n=this.state.selectOptions.find(f=>f.value===this.state.value);return I.createElement(P.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?I.createElement(P.InputLabel,null,this.getText(this.props.schema.label)):null,I.createElement(P.Select,{variant:"standard",error:!!e,disabled:!!t,value:this.state.value||"_",renderValue:()=>n?n.obj?I.createElement(z.TextWithIcon,{value:n.obj,themeType:this.props.oContext.themeType,lang:z.I18n.getLanguage()}):n.label:"",onChange:f=>{this.setState({value:f.target.value==="_"?"":f.target.value},()=>this.onChange(this.props.attr,this.state.value))}},this.state.selectOptions.map(f=>I.createElement(P.MenuItem,{key:f.value,value:f.value,style:f.value===q.DIFFERENT_VALUE?{opacity:.5}:{}},f.obj?I.createElement(z.TextWithIcon,{value:f.obj,themeType:this.props.oContext.themeType,lang:z.I18n.getLanguage()}):f.label))),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const Zy={noMargin:{"&>div":{marginTop:0}}};class qy extends q{initialValue="";componentDidMount(){super.componentDidMount();let e=q.getValue(this.props.data,this.props.attr);this.props.schema.multiple&&(typeof e=="string"?e=[e]:e==null&&(e=[]));const t=[];(this.props.schema.options||[]).forEach(n=>{const f=n;Array.isArray(f.items)?(t.push({label:this.getText(n.label,this.props.schema.noTranslation),value:n.value,group:!0,color:n.color}),f.items.forEach(i=>t.push({label:this.getText(i.label,this.props.schema.noTranslation),value:i.value,hidden:i.hidden,color:n.color}))):t.push({label:this.getText(n.label,this.props.schema.noTranslation),value:n.value,hidden:n.hidden,color:n.color})}),Array.isArray(e)&&!this.props.schema.multiple?(this.initialValue=[...e],t.unshift({label:z.I18n.t(q.DIFFERENT_LABEL),value:q.DIFFERENT_VALUE}),this.setState({value:q.DIFFERENT_VALUE,selectOptions:t})):this.setState({value:e,selectOptions:t})}_getValue(){let e=this.state.value===null||this.state.value===void 0?q.getValue(this.props.data,this.props.attr):this.state.value;return this.props.schema.multiple&&(typeof e=="string"?e=[e]:e==null&&(e=[])),e}renderItem(e,t){if(!this.state.selectOptions)return null;const n=(this.state.selectOptions||[]).filter(o=>o.hidden?this.props.custom?!this.executeCustom(o.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(o.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),f=this._getValue(),i=this.props.schema.multiple?null:n.find(o=>o.value==f);return I.createElement(P.FormControl,{variant:"standard",fullWidth:!0,sx:this.props.table!==void 0&&Zy.noMargin,id:`jsonSelect_${this.props.attr}_${this.props.index||this.props.index===0?this.props.index:""}`},this.props.schema.label?I.createElement(P.InputLabel,null,this.getText(this.props.schema.label)):null,I.createElement(P.Select,{variant:"standard",error:!!e,multiple:this.props.schema.multiple,disabled:!!t,value:f||"_",renderValue:o=>this.props.schema.multiple?I.createElement("div",{style:{display:"flex",flexWrap:"wrap",gap:.5}},o.map(p=>{const s=n.find(u=>u.value===p);if(s||this.props.schema.showAllValues!==!1){const u=(s==null?void 0:s.label)||p;return I.createElement(P.Chip,{key:p,label:u})}return null})):i!=null&&i.color?I.createElement("div",{style:{color:i.color}},(i==null?void 0:i.label)===void 0?o:i.label):(i==null?void 0:i.label)===void 0?o:i.label,onChange:o=>{this.setState({value:o.target.value==="_"?"":o.target.value},()=>{let p;this.state.value===q.DIFFERENT_VALUE?p=this.onChange(this.props.attr,this.initialValue):p=this.onChange(this.props.attr,this.state.value),p instanceof Promise&&p.catch(s=>console.error(s))})}},n.map((o,p)=>o.group?I.createElement(P.ListSubheader,{key:p,style:{color:o.color}},o.label):I.createElement(P.MenuItem,{key:p,value:o.value,style:o.value===q.DIFFERENT_VALUE?{opacity:.5}:{}},this.props.schema.multiple?I.createElement(P.Checkbox,{checked:f.includes(o.value),onClick:()=>{const s=JSON.parse(JSON.stringify(this._getValue())),u=f.indexOf(o.value);u!==-1?s.splice(u,1):(s.push(o.value),s.sort()),this.setState({value:s},()=>this.onChange(this.props.attr,s))}}):null,I.createElement(P.ListItemText,{primary:o.label,style:{color:o.color}})))),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const eb={menuPaper:{maxHeight:800}};class tb extends q{initialized=!1;localContext;askInstance(){if(this.props.alive){let e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);try{e=JSON.parse(t)}catch{console.error(`Cannot parse json data: ${t}`)}}e===void 0&&(e=null),this.setState({running:!0},()=>{this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",e).then(t=>this.setState({list:t,running:!1})).catch(t=>{console.error(`Cannot send command: ${t}`)})})}else{const e=q.getValue(this.props.data,this.props.attr);this.setState({value:e,running:!1})}}getContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=q.getValue(this.props.data,t)),JSON.stringify(e)}_getValue(){let e=this.state.value===null||this.state.value===void 0?q.getValue(this.props.data,this.props.attr):this.state.value;return this.props.schema.multiple&&(typeof e=="string"?e=[e]:e==null&&(e=[])),e}renderItem(e,t){if(this.props.alive){const o=this.getContext();(o!==this.localContext||!this.initialized)&&(this.localContext=o,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}const n=this._getValue();if(!this.props.alive||!this.state.running&&!Array.isArray(this.state.list))return this.props.schema.multiple||this.props.schema.manual===!1?z.I18n.t("ra_Cannot retrieve options, as instance is offline"):I.createElement(P.TextField,{variant:"standard",fullWidth:!0,value:n,error:!!e,disabled:!!t,onChange:o=>{const p=o.target.value;this.setState({value:p},()=>this.onChange(this.props.attr,(p||"").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?I.createElement(P.InputAdornment,{position:"end"},I.createElement(P.IconButton,{tabIndex:-1,size:"small",onClick:()=>this.setState({value:""},()=>this.onChange(this.props.attr,""))},I.createElement(se.Close,null))):null}}});if(this.state.running)return I.createElement(P.CircularProgress,{size:"24"});const f=this.state.list.filter(o=>o.hidden?this.props.custom?!this.executeCustom(o.hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.arrayIndex,this.props.globalData):!this.execute(o.hidden,this.props.schema.default,this.props.data,this.props.arrayIndex,this.props.globalData):!0),i=f.find(o=>o.value===n);return I.createElement(P.FormControl,{variant:"standard",fullWidth:!0},this.props.schema.label?I.createElement(P.InputLabel,null,this.getText(this.props.schema.label)):null,I.createElement(P.Select,{variant:"standard",error:!!e,multiple:this.props.schema.multiple,disabled:!!t,sx:{"&.MuiSelect-paper":this.props.schema.multiple?eb.menuPaper:void 0},value:n,renderValue:o=>this.props.schema.multiple?I.createElement(P.Box,{sx:{display:"flex",flexWrap:"wrap",gap:.5}},o.map(p=>{const s=f.find(u=>u.value===p);if(s||this.props.schema.showAllValues!==!1){const u=(s==null?void 0:s.label)||p;return I.createElement(P.Chip,{key:p,label:u})}return null})):this.getText((i==null?void 0:i.label)||o,this.props.schema.noTranslation),onChange:o=>{const p=this.onChange(this.props.attr,o.target.value);p instanceof Promise&&p.catch(s=>console.error(`Cannot set value: ${s}`))}},f.map((o,p)=>o.group?I.createElement(P.ListSubheader,{key:p},this.getText(o.label,this.props.schema.noTranslation)):I.createElement(P.MenuItem,{key:p,value:o.value},this.props.schema.multiple?I.createElement(P.Checkbox,{checked:n.includes(o.value),onClick:()=>{const s=JSON.parse(JSON.stringify(this._getValue())),u=n.indexOf(o.value);u!==-1?s.splice(u,1):(s.push(o.value),s.sort()),this.setState({value:s},()=>this.onChange(this.props.attr,s))}}):null,I.createElement(P.ListItemText,{primary:o.label})))),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}const mo={fullWidth:{width:"100%"}};function Gt(h){return h.split(".").reduce((e,t)=>(e<<8)+parseInt(t,10),0)>>>0}function nb(h,e){var f,i;const t=(i=(f=h==null?void 0:h.native)==null?void 0:f.hardware)==null?void 0:i.networkInterfaces;if(!t)return null;let n;return Object.keys(t).forEach(o=>t[o].forEach(p=>{p.internal||e.includes(":")&&p.family!=="IPv6"||e.includes(".")&&!e.match(/[^.\d]/)&&p.family!=="IPv4"||(p.family==="IPv4"&&!p.address.startsWith("172")&&(e==="127.0.0.0"||e==="localhost"||e.match(/[^.\d]/))?n=p.address:n||(p.family==="IPv4"&&e.includes(".")&&(Gt(e)&Gt(p.netmask),Gt(p.address)&Gt(p.netmask)),n=p.address))})),n||Object.keys(t).forEach(o=>t[o].forEach(p=>{p.internal||e.includes(":")&&p.family!=="IPv6"||e.includes(".")&&!e.match(/[^.\d]/)&&p.family!=="IPv4"||(p.family==="IPv6"&&(e==="127.0.0.0"||e==="localhost"||e.match(/[^.\d]/))?n=p.address:n||(p.family==="IPv4"&&e.includes(".")&&(Gt(e)&Gt(p.netmask),Gt(p.address)&Gt(p.netmask)),n=p.address))})),n||Object.keys(t).forEach(o=>{t[o].forEach(p=>{p.internal||e.includes(":")&&p.family!=="IPv6"||e.includes(".")&&!e.match(/[^.\d]/)&&p.family!=="IPv4"||(e==="127.0.0.0"||e==="localhost"||e.match(/[^.\d]/),n=p.address)})}),n||Object.keys(t).forEach(o=>{t[o].forEach(p=>{p.internal||(n=p.address)})}),n}class go extends q{async componentDidMount(){var t;super.componentDidMount();let e=window.location.hostname;if(this.props.schema.openUrl){const n=await this.props.oContext.socket.getCurrentInstance(),f=await this.props.oContext.socket.getObject(`system.adapter.${n}`);if(f){const i=await this.props.oContext.socket.getObject(`system.host.${(t=f==null?void 0:f.common)==null?void 0:t.host}`);if(i){const o=nb(i,window.location.hostname);if(o)e=`${o}:${window.location.port}`;else{console.warn(`Cannot find suitable IP in host ${f.common.host} for ${f._id}`);return}}}}await new Promise(n=>{this.setState({_error:"",_message:"",hostname:e},n)}),this.props.schema.onLoaded&&this._onClick()}renderErrorDialog(){return this.state._error?I.createElement(z.DialogError,{text:this.state._error,onClose:()=>this.setState({_error:""})}):null}renderMessageDialog(){return this.state._message?I.createElement(z.DialogMessage,{text:this.state._message,onClose:()=>this.setState({_message:""})}):null}_onClick(){this.props.oContext.onCommandRunning(!0),this.setState({running:!0});const e=`${window.location.protocol}//${window.location.host}${window.location.pathname.replace(/\/index\.html$/,"")}`,t=`${window.location.protocol}//${this.state.hostname.split(":").length>3?`[${this.state.hostname}]`:this.state.hostname}${window.location.pathname.replace(/\/index\.html$/,"")}`;let n=this.props.schema.data;if(n===void 0&&this.props.schema.jsonData){const i=this.getPattern(this.props.schema.jsonData,{_origin:e,_originIp:t,...this.props.data},!0);try{n=JSON.parse(i)}catch{console.error(`Cannot parse json data: ${i}`)}}n===void 0&&(n=null),this.props.schema.openUrl&&!n&&(n={_origin:e,_originIp:t});let f;this.props.schema.timeout&&(f=setTimeout(()=>{this.props.oContext.onCommandRunning(!1),this.setState({_error:z.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",n).then(async i=>{var o,p,s,u,r;if(f&&(clearTimeout(f),f=void 0),i!=null&&i.error)if(this.props.schema.error&&this.props.schema.error[i.error]){let a=this.getText(this.props.schema.error[i.error]);(o=i.args)==null||o.forEach(l=>a=a.replace("%s",l)),this.setState({_error:a})}else this.setState({_error:i.error?typeof i.error=="string"?z.I18n.t(i.error):JSON.stringify(i.error):z.I18n.t("ra_Error")});else{if(i!=null&&i.command){(s=(p=this.props.oContext).onBackEndCommand)==null||s.call(p,i.command);return}if(i!=null&&i.reloadBrowser&&this.props.schema.reloadBrowser)window.location.reload();else if(i!=null&&i.openUrl&&this.props.schema.openUrl)window.open(i.openUrl,i.window||this.props.schema.window||"_blank");else if(i!=null&&i.result&&((u=this.props.schema.result)!=null&&u[i.result])){let a=this.getText(this.props.schema.result[i.result]);(r=i.args)==null||r.forEach(l=>a=a.replace("%s",l)),window.alert(a)}if(i!=null&&i.native&&this.props.schema.useNative){for(const[a,l]of Object.entries(i.native))await this.onChangeAsync(a,l);setTimeout(()=>this.props.oContext.forceUpdate(Object.keys(i.native),this.props.data),300)}else i!=null&&i.result?window.alert(typeof i.result=="object"?JSON.stringify(i.result):i.result):window.alert(z.I18n.t("ra_Ok"));i!=null&&i.saveConfig&&this.props.onChange(null,null,null,!0)}}).catch(i=>{this.props.schema.error&&this.props.schema.error[i.toString()]?this.setState({_error:this.getText(this.props.schema.error[i.toString()])}):this.setState({_error:z.I18n.t(i.toString())||z.I18n.t("ra_Error")})}).then(()=>{this.props.oContext.onCommandRunning(!1),this.setState({running:!1})})}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const e=this.state.confirmData||this.props.schema.confirm;let t=null;return e.type==="warning"?t=I.createElement(se.Warning,null):e.type==="error"?t=I.createElement(se.Error,null):e.type==="info"&&(t=I.createElement(se.Info,null)),I.createElement(z.DialogConfirm,{title:this.getText(e.title)||z.I18n.t("ra_Please confirm"),text:this.getText(e.text),ok:this.getText(e.ok)||z.I18n.t("ra_Ok"),cancel:this.getText(e.cancel)||z.I18n.t("ra_Cancel"),icon:t||void 0,onClose:n=>this.setState({confirmDialog:!1},()=>n&&this._onClick())})}renderItem(e,t){const n=this.getIcon();return I.createElement("div",{style:mo.fullWidth},I.createElement(P.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:{...mo.fullWidth,...this.props.schema.controlStyle||void 0},disabled:t||!this.props.alive,startIcon:n,title:this.props.alive?this.getText(this.props.schema.title)||"":z.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?I.createElement(P.CircularProgress,{size:20,style:{marginRight:8}}):null,this.getText(this.props.schema.label,this.props.schema.noTranslation)),this.renderErrorDialog(),this.renderMessageDialog())}}const ib={fullWidth:{width:"100%"}};class rb extends q{async _onClick(){var n,f;let e=this.props.schema.val;if(typeof e=="string"&&e.includes("${")){e=this.getPattern(e,null,!0);const i=await this.props.oContext.socket.getObject(this.props.schema.id);((n=i==null?void 0:i.common)==null?void 0:n.type)==="number"?e=parseFloat(e):((f=i==null?void 0:i.common)==null?void 0:f.type)==="boolean"&&(e=e==="true"||e===!0||e==="1"||e===1)}const t=(this.props.schema.id||"").replace(/%INSTANCE%/g,(this.props.oContext.instance||0).toString());try{await this.props.oContext.socket.setState(t,{val:e,ack:!!this.props.schema.ack}),this.props.schema.okText&&window.alert(this.getText(this.props.schema.okText))}catch(i){this.props.schema.error&&this.props.schema.error[i.toString()]?window.alert(this.getText(this.props.schema.error[i.toString()])):window.alert(z.I18n.t(i.toString())||z.I18n.t("ra_Error"))}}renderDialogConfirm(){if(!this.state.confirmDialog)return null;const e=this.state.confirmData||this.props.schema.confirm;let t=null;return e.type==="warning"?t=I.createElement(se.Warning,null):e.type==="error"?t=I.createElement(se.Error,null):e.type==="info"&&(t=I.createElement(se.Info,null)),I.createElement(z.DialogConfirm,{title:this.getText(e.title)||z.I18n.t("ra_Please confirm"),text:this.getText(e.text),ok:this.getText(e.ok)||z.I18n.t("ra_Ok"),cancel:this.getText(e.cancel)||z.I18n.t("ra_Cancel"),icon:t,onClose:n=>this.setState({confirmDialog:!1},()=>n&&this._onClick())})}renderItem(e,t){const n=this.getIcon();return I.createElement(P.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:ib.fullWidth,disabled:t,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0}):await this._onClick()},startIcon:n||void 0},this.getText(this.props.schema.label,this.props.schema.noTranslation))}}const vo={fullWidth:{width:"100%"},slider:{marginLeft:10,marginRight:10,width:"calc(100% - 20px)"}};class sb extends q{componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr);this.setState({_value:e})}static getDerivedStateFromProps(e,t){if(e.schema.min!==void 0&&e.schema.min<0||e.schema.max!==void 0&&e.schema.max<0)return null;const n=q.getValue(e.data,e.attr);return n==null||n.toString()!==parseFloat(t._value).toString()?{_value:n}:null}renderItem(e,t){const n=this.props.schema.min||0,f=this.props.schema.max||100,i=this.props.schema.unit?this.getText(this.props.schema.unit,this.props.schema.noTranslation):"",o=[{value:n,label:n+i},{value:f,label:f+i}];return I.createElement(P.Box,{style:vo.fullWidth},this.props.schema.label?I.createElement(P.Typography,{gutterBottom:!0},this.getText(this.props.schema.label)):null,I.createElement(P.Slider,{style:vo.slider,value:this.state._value,getAriaValueText:p=>p+i,step:this.props.schema.step||(f-n)/100,valueLabelDisplay:"auto",marks:o,min:n,max:f,disabled:!!t,onChange:p=>{const s=p.target.value;this.setState({_value:s},()=>this.onChange(this.props.attr,s))}}),this.props.schema.help?I.createElement(P.Typography,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}function Kt(h,e){return h==="edit"||h==="rename"?I.createElement(se.Edit,{style:e}):h==="delete"?I.createElement(se.Delete,{style:e}):h==="refresh"?I.createElement(se.Refresh,{style:e}):h==="newDevice"||h==="new"||h==="add"?I.createElement(se.Add,{style:e}):h==="discover"||h==="search"?I.createElement(se.Search,{style:e}):h==="unpairDevice"||h==="unpair"?I.createElement(se.LinkOff,{style:e}):h==="pairDevice"||h==="pair"?I.createElement(se.Link,{style:e}):h==="identify"?I.createElement(se.NotListedLocation,{style:e}):h==="play"?I.createElement(se.PlayArrow,{style:e}):h==="stop"?I.createElement(se.Stop,{style:e}):h==="pause"?I.createElement(se.Pause,{style:e}):h==="forward"||h==="next"?I.createElement(se.FastForward,{style:e}):h==="rewind"||h==="previous"?I.createElement(se.FastRewind,{style:e}):h==="lamp"||h==="light"?I.createElement(se.Lightbulb,{style:e}):h==="backlight"?I.createElement(se.Fluorescent,{style:e}):h==="dimmer"?I.createElement(se.WbIncandescent,{style:e}):h==="socket"?I.createElement(se.Power,{style:e}):h==="settings"?I.createElement(se.Settings,{style:e}):h==="users"||h==="group"?I.createElement(se.Group,{style:e}):h==="user"?I.createElement(se.Person,{style:e}):h==="qrcode"?I.createElement(se.QrCode,{style:e}):h==="connection"?I.createElement(se.Wifi,{style:e}):h==="no-connection"?I.createElement(se.WifiOff,{style:e}):h==="visible"?I.createElement(se.Visibility,{style:e}):null}function ob(h,e){return typeof e=="string"?{"@keyframes newStateAnimationOnceColor":{"0%":{color:e},"100%":{color:h.palette.mode==="dark"?"#fff":"#000"}},animation:"newStateAnimationOnceColor 2s ease-in-out"}:{"@keyframes newStateAnimationOnce":{"0%":{color:"#00f900"},"80%":{color:h.palette.mode==="dark"?"#518851":"#008000"},"100%":{color:h.palette.mode==="dark"?"#fff":"#000"}},animation:"newStateAnimationOnce 2s ease-in-out"}}class ab extends q{controlTimeout=null;delayedUpdate={timer:null,value:null};getObjectID(){let e=(this.props.schema.oid||"").toString();return e.includes("${")&&(e=this.getPattern(e,null,!0)),this.props.schema.foreign?e:`${this.props.schema.system?"system.adapter.":""}${this.props.oContext.adapterName}.${this.props.oContext.instance||0}.${e}`}async componentDidMount(){var n,f;super.componentDidMount();const e=await this.props.oContext.socket.getObject(this.getObjectID());if((n=e==null?void 0:e.common)!=null&&n.states&&!this.props.schema.options){if(Array.isArray((f=e==null?void 0:e.common)==null?void 0:f.states)){const i={};e.common.states.forEach((o,p)=>{i[p.toString()]=o}),e.common.states=i}Object.keys(e.common.states).length||(e.common.states=void 0)}const t=this.props.schema.control||this.detectType(e);try{const i=await this.props.oContext.socket.getState(this.getObjectID());this.setState({stateValue:i?i.val:null,controlType:t,obj:e},async()=>{await this.props.oContext.socket.subscribeState(this.getObjectID(),this.onStateChanged)})}catch(i){console.error(`Cannot get state ${this.getObjectID()}: ${i}`),this.setState({controlType:t,obj:e})}}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(e=>console.error(`Cannot control value: ${e.toString()}`)))}onStateChanged=(e,t)=>{let n=t?t.val:null;this.state.controlType==="button"||this.state.controlType==="switch"?(n=!!n,this.state.stateValue!==n&&this.setState({stateValue:n})):n!==null&&(this.state.controlType==="slider"||this.state.controlType==="number")?(n=parseFloat(n),console.log(`${Date.now()} Received new value: ${n}`),n!==this.state.stateValue?(this.delayedUpdate.timer&&(clearTimeout(this.delayedUpdate.timer),this.delayedUpdate.timer=null),this.delayedUpdate.value=n,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()!==n.toString()&&this.setState({stateValue:n})};detectType(e){if(e||={},e.common||={},e.common.type==="boolean"){if(this.props.schema.controlled!==!1){if(e.common.read===!1||this.props.schema.controlled===!0)return"button";if(e.common.write||this.props.schema.controlled===!0)return"switch"}return"text"}return e.common.type==="number"&&this.props.schema.controlled!==!1?e.common.write||this.props.schema.controlled===!0?e.common.states||this.props.schema.options?"select":e.common.max!==void 0?"slider":"input":"text":e.common.write&&this.props.schema.controlled!==!1?e.common.states||this.props.schema.options?"select":"input":"text"}getNormalizedStates(){let e;return this.props.schema.options?e=this.props.schema.options.map(t=>typeof t=="string"?{value:t,label:this.getText(t,this.props.schema.noTranslation)}:{value:t.value,label:this.getText(t.label,this.props.schema.noTranslation),color:t.color}):this.state.obj.common.states?(e=[],Object.keys(this.state.obj.common.states).forEach(t=>{e.push({value:t,label:this.getText(this.state.obj.common.states[t],this.props.schema.noTranslation)})})):e=[],e}renderItem(e,t){var f,i,o,p,s;if(!this.state.obj)return null;let n;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 u=this.getNormalizedStates(),r=u.find(a=>a.value===this.state.stateValue);n=I.createElement(P.FormControl,{fullWidth:!0},I.createElement(P.InputLabel,null,"$",this.getText(this.props.schema.label)),I.createElement(P.Select,{value:this.state.stateValue,disabled:!!this.props.schema.readOnly||t,onChange:a=>{this.setState({stateValue:a.target.value},()=>{let l=this.state.stateValue;this.state.obj.common.type==="number"&&(l=parseFloat(l.toString().replace(",","."))),this.props.oContext.socket.setState(this.getObjectID(),l,!1)})},renderValue:a=>r!=null&&r.color?I.createElement("div",{style:{color:r.color}},r.label):a},u.map(a=>I.createElement(P.MenuItem,{key:(a.value??"").toString(),value:a.value,style:{color:a.color}},"$",a.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||(f=this.state.obj.common.role)!=null&&f.includes("button"))){let u=null;this.props.schema.falseImage&&(u=Kt(this.props.schema.falseImage));const r=this.getText(this.props.schema.falseText||this.props.schema.label,this.props.schema.noTranslation);!r&&u?n=I.createElement(P.IconButton,{style:this.props.schema.falseTextStyle,disabled:!!this.props.schema.readOnly,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async a=>{a&&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)}},u):n=I.createElement(P.Button,{variant:this.props.schema.variant||"contained",startIcon:u,style:this.props.schema.falseTextStyle,disabled:t||!!this.props.schema.readOnly,onClick:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async a=>{a&&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)}},r||this.getObjectID().split(".").pop())}else if(this.state.controlType==="input"||!this.state.controlType&&this.state.obj.common.write&&this.state.obj.common.type==="string")n=I.createElement("div",{style:{width:"100%",display:"flex",flexDirection:"row",gap:8,alignItems:"baseline"}},I.createElement(P.TextField,{style:{flex:1},value:this.state.stateValue,variant:"standard",disabled:!!this.props.schema.readOnly||t,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:u=>{this.props.schema.setOnEnterKey&&u.key==="Enter"&&this.props.oContext.socket.setState(this.getObjectID(),this.state.stateValue,!1)},onChange:u=>{this.setState({stateValue:u.target.value},()=>{this.props.schema.setOnEnterKey||this.props.schema.showEnterButton||(this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(async()=>{this.controlTimeout=null;let r=this.state.stateValue;this.state.obj.common.type==="number"&&(r=parseFloat(r.toString().replace(",","."))),await this.props.oContext.socket.setState(this.getObjectID(),r,!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&&I.createElement(P.Button,{variant:"outlined",disabled:t,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 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);let r=this.getText(this.props.schema.label,this.props.schema.noTranslation);const a={display:"flex",alignItems:"center",fontSize:u||"1rem",gap:8};this.props.schema.narrow||(a.width="100%",a.justifyContent="space-between"),r.trim()&&!r.trim().endsWith(":")&&this.props.schema.addColon&&(r=`${r.trim()}:`);let l;this.props.schema.blinkOnUpdate&&(l=ob(this.props.oContext.theme,this.props.schema.blinkOnUpdate));let d;this.props.schema.labelIcon&&(d=I.createElement(z.Icon,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let c;if(r&&d?c=I.createElement("div",{style:{whiteSpace:"nowrap"}},d,r):r?c=I.createElement("div",{style:{whiteSpace:"nowrap"}},r):d&&(c=d),this.state.controlType==="switch"||!this.state.controlType&&this.state.obj.common.type==="boolean"&&(this.state.obj.common.write&&this.state.obj.common.read!==!1||(i=this.state.obj.common.role)!=null&&i.includes("switch"))){let m=null;const g=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(m=Kt(this.props.schema.falseImage,g?{marginLeft:8}:void 0));let v=null;const b=this.getText(this.props.schema.trueText,this.props.schema.noTranslation);this.props.schema.trueImage&&(v=Kt(this.props.schema.trueImage,b?{marginRight:8}:void 0)),n=I.createElement(P.Switch,{checked:!!this.state.stateValue,disabled:!!this.props.schema.readOnly||t,onChange:async()=>{this.props.schema.confirm?this.setState({confirmDialog:!0,confirmCallback:async E=>{E&&await this.props.oContext.socket.setState(this.getObjectID(),!this.state.stateValue,!1)}}):await this.props.oContext.socket.setState(this.getObjectID(),!this.state.stateValue,!1)}}),(g||m||b||v)&&(n=I.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:14}},I.createElement("span",{style:this.props.schema.falseTextStyle},g,m),n,I.createElement("span",{style:this.props.schema.trueTextStyle},v,b))),c&&(n=I.createElement("div",{style:a},c,n))}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==="%")||(o=this.state.obj.common.role)!=null&&o.includes("slider")||(p=this.state.obj.common.role)!=null&&p.includes("dimmer")||(s=this.state.obj.common.role)!=null&&s.includes("blind"))){let m=null;const g=this.getText(this.props.schema.falseText,this.props.schema.noTranslation);this.props.schema.falseImage&&(m=Kt(this.props.schema.falseImage,g?{marginLeft:8}:void 0));let v=null;const b=this.getText(this.props.schema.trueText,this.props.schema.noTranslation);this.props.schema.trueImage&&(v=Kt(this.props.schema.trueImage,b?{marginRight:8}:void 0));const E=this.props.schema.min===void 0?this.state.obj.common.min||0:this.props.schema.min,S=this.props.schema.max===void 0?this.state.obj.common.max===void 0?100:this.state.obj.common.max:this.props.schema.max,w=this.props.schema.step===void 0?this.state.obj.common.step||1:this.props.schema.step;n=I.createElement(P.Slider,{style:{width:"100%",flexGrow:1},min:E,max:S,disabled:!!this.props.schema.readOnly||t,step:w,value:this.state.stateValue,valueLabelDisplay:"auto",valueLabelFormat:y=>`${y}${this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit||""}`,onChange:(y,D)=>{this.setState({stateValue:D},()=>{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)})}}),(g||m||b||v)&&(n=I.createElement("div",{style:{display:"flex",width:"100%",flexGrow:1,alignItems:"center"}},I.createElement("span",{style:{marginRight:16,...this.props.schema.falseTextStyle}},g,m),n,I.createElement("span",{style:{marginLeft:16,...this.props.schema.trueTextStyle}},v,b))),c&&(n=I.createElement("div",{style:a},c,n))}else if(this.state.obj.common.type==="number"&&this.state.obj.common.write&&!this.state.controlType){const m=this.props.schema.min===void 0?this.state.obj.common.min===void 0?void 0:this.state.obj.common.min:this.props.schema.min,g=this.props.schema.max===void 0?this.state.obj.common.max===void 0?void 0:this.state.obj.common.max:this.props.schema.max,v=this.props.schema.step===void 0?this.state.obj.common.step===void 0?void 0:this.state.obj.common.step:this.props.schema.step;n=I.createElement(P.TextField,{variant:"standard",style:{width:"100%"},value:this.state.stateValue,type:"number",disabled:!!this.props.schema.readOnly||t,slotProps:{htmlInput:{min:m,max:g,step:v,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:b=>{this.setState({stateValue:b.target.value},()=>{this.controlTimeout&&clearTimeout(this.controlTimeout),this.controlTimeout=setTimeout(async()=>{this.controlTimeout=null;const E=parseFloat(this.state.stateValue);await this.props.oContext.socket.setState(this.getObjectID(),E,!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 m=null,g,v;this.state.stateValue?(g=this.getText(this.props.schema.trueText,this.props.schema.noTranslation),this.props.schema.trueImage&&(m=Kt(this.props.schema.falseImage,g?{marginRight:8}:void 0)),v=this.props.schema.trueTextStyle):(g=this.getText(this.props.schema.falseText,this.props.schema.noTranslation),this.props.schema.falseImage&&(m=Kt(this.props.schema.falseImage,g?{marginLeft:8}:void 0)),v=this.props.schema.falseTextStyle),v=Object.assign(a,v),n=I.createElement("div",{style:v},c,I.createElement(P.Box,{style:{display:"flex",alignItems:"center",gap:8},sx:l,key:this.props.schema.blinkOnUpdate?g:void 0},m,g||(this.state.stateValue?z.I18n.t("ra_true"):z.I18n.t("ra_false"))))}else{const m=this.getText(this.props.schema.unit,this.props.schema.noTranslation)||this.state.obj.common.unit;let g=this.state.stateValue;if(g!=null&&(this.props.schema.options||this.state.obj.common.states)){const S=this.getNormalizedStates().find(w=>w.value===g);S&&(g=S.label)}let v,b;this.state.controlType==="html"?(b=(g||"").toString(),v=I.createElement("span",{dangerouslySetInnerHTML:{__html:g}})):this.state.stateValue===null?(v="null",b=v):this.state.stateValue===void 0?(v="undefined",b=v):(v=g.toString(),b=v),n=I.createElement("div",{style:a},c,I.createElement("div",{style:{display:"flex",alignItems:"baseline",gap:4}},I.createElement(P.Box,{sx:l,key:this.props.schema.blinkOnUpdate?b:void 0},v),m?I.createElement("span",{style:{opacity:.7,fontSize:"smaller"}},m):null))}}return n}}const Rr={fullWidth:h=>({width:"100%",backgroundColor:h.palette.mode==="dark"?"#FFF":"#000",borderStyle:"hidden"}),primary:h=>({backgroundColor:h.palette.primary.main}),secondary:h=>({backgroundColor:h.palette.secondary.main})};class lb extends q{renderItem(){return I.createElement(P.Box,{component:"hr",sx:z.Utils.getStyle(this.props.oContext.theme,Rr.fullWidth,this.props.schema.color==="primary"?Rr.primary:this.props.schema.color==="secondary"?Rr.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 cb={header:h=>({width:"100%",background:h.palette.primary.main,color:h.palette.primary.contrastText,padding:"4px !important",borderRadius:"3px",marginBlockEnd:0,marginBlockStart:0})};class ub extends q{renderItem(){let e="h5";switch((this.props.schema.size||5).toString()){case"1":e="h1";break;case"2":e="h2";break;case"3":e="h3";break;case"4":e="h4";break;case"5":default:e="h5";break}return I.createElement(P.Box,{component:e,sx:cb.header},this.getText(this.props.schema.label||this.props.schema.text,this.props.schema.noTranslation))}}class hb extends q{renderItem(){let e=this.props.schema.src;return e&&!e.startsWith(".")&&!e.startsWith("http")&&!e.startsWith(`adapter/${this.props.oContext.adapterName}/`)&&!e.startsWith(`./adapter/${this.props.oContext.adapterName}/`)&&(e=`adapter/${this.props.oContext.adapterName}/${e}`),I.createElement("img",{src:e,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 yo(h,e,t){return typeof t=="string"?{"@keyframes newValueAnimationOnceColor":{"0%":{color:e?`${t} !important`:t},"100%":{color:h.palette.mode==="dark"?e?"#fff !important":"#fff":e?"#000 !important":"#000"}},animation:"newValueAnimationOnceColor 2s ease-in-out"}:{"@keyframes newValueAnimationOnce":{"0%":{color:e?"#00f900 !important":"#00f900"},"80%":{color:h.palette.mode==="dark"?e?"#518851 !important":"#518851":e?"#008000 !important":"#008000"},"100%":{color:h.palette.mode==="dark"?e?"#fff !important":"#fff":e?"#000 !important":"#000"}},animation:"newValueAnimationOnce 2s ease-in-out"}}function bo(h,e){return typeof e=="string"?{"@keyframes blinkAnimationColor":{"0%":{color:e},"100%":{color:h.palette.mode==="dark"?"#fff":"#000"}},animation:"blinkAnimationColor 2s ease-in-out infinite"}:{"@keyframes blinkAnimation":{"0%":{color:"#00f900"},"80%":{color:h.palette.mode==="dark"?"#518851":"#008000"},"100%":{color:h.palette.mode==="dark"?"#fff":"#000"}},animation:"blinkAnimation 2s ease-in-out infinite"}}const An={label:{fontWeight:"bold",whiteSpace:"nowrap"},valueImage:{maxHeight:"100%"},valueAndUnit:{display:"flex",gap:4,alignItems:"baseline"},value:{},unit:{fontSize:"smaller",opacity:.7}};class db extends q{renderItem(e){let t=this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation);this.props.schema.addColon&&typeof t=="string"&&!t.trim().endsWith(":")&&(t=`${t.trim()}:`),t&&(t.includes("<a ")||t.includes("<br")||t.includes("<b>")||t.includes("<i>"))&&(t=z.Utils.renderTextWithA(t));let n;this.props.schema.size==="normal"?n=16:this.props.schema.size==="large"?n=20:typeof this.props.schema.size=="number"&&(n=this.props.schema.size);const f={width:"100%",height:"100%",display:"flex",alignItems:"center",position:"relative",fontSize:n};this.props.schema.narrow?f.gap=8:f.justifyContent="space-between";let i,o;this.props.schema.data&&typeof this.props.schema.data=="object"&&this.props.schema.data.en?o=this.getText(this.props.schema.data):typeof this.props.schema.data=="object"||this.props.schema.data===void 0||this.props.schema.data===null?o=JSON.stringify(this.props.schema.data):typeof this.props.schema.data=="number"?(o=this.props.schema.data.toString(),this.props.oContext.isFloatComma&&(o=o.replace(".",","))):(!this.props.schema.booleanAsCheckbox||typeof this.props.schema.data!="boolean")&&(o=this.props.schema.data.toString());let p=!1;if(this.props.schema.booleanAsCheckbox&&typeof this.props.schema.data=="boolean")i=I.createElement(P.Checkbox,{checked:!!i,disabled:!0,size:this.props.schema.size==="small"?"small":this.props.schema.size==="large"?"large":void 0});else if(o.startsWith("data:image/"))i=I.createElement("div",{style:{...An.value,...An.valueImage,...this.props.schema.styleValue||void 0}},I.createElement(z.Icon,{src:o}));else{const a={...An.value,...this.props.schema.styleValue||void 0};this.props.schema.html?i=I.createElement("div",{style:a,dangerouslySetInnerHTML:{__html:o}}):Array.isArray(this.props.schema.data)?(p=!0,i=I.createElement("div",{style:a},this.props.schema.data.map((l,d)=>I.createElement("div",{key:d},typeof l=="object"||l===null||l===void 0?JSON.stringify(l):l)))):o.includes(`
`)?(p=!0,i=I.createElement("div",{style:a},z.Utils.renderTextWithA(o))):i=I.createElement("div",{style:a},o)}if(this.props.schema.blinkOnUpdate&&this.props.schema.blink){const a=yo(this.props.oContext.theme,!0,this.props.schema.blinkOnUpdate),l=bo(this.props.oContext.theme,this.props.schema.blink);i=I.createElement(P.Box,{key:o,sx:{...a,...l}},i)}else if(this.props.schema.blinkOnUpdate){const a=yo(this.props.oContext.theme,!1,this.props.schema.blinkOnUpdate);i=I.createElement(P.Box,{key:o,sx:a},i)}else if(this.props.schema.blink){const a=bo(this.props.oContext.theme,this.props.schema.blink);i=I.createElement(P.Box,{sx:a},i)}this.props.schema.unit&&(i=I.createElement("div",{style:An.valueAndUnit},i,I.createElement("div",{style:{...An.unit,...this.props.schema.styleUnit||void 0}},this.getText(this.props.schema.unit,this.props.schema.noTranslation))));let s;this.props.schema.labelIcon&&(s=I.createElement(z.Icon,{src:this.props.schema.labelIcon,style:{marginRight:4}}));let u;this.props.schema.copyToClipboard&&(u=I.createElement(se.ContentCopy,{className:"staticCopyButton",style:{position:"absolute",top:"calc(50% - 12px)",right:0,cursor:"pointer"},onClick:()=>{z.Utils.copyToClipboard(o),window.alert(z.I18n.t("ra_Copied"))}}));const r={"& .staticCopyButton":{display:"none"},"& .staticCopyButton:action":{transform:"scale(0.9)"},"&:hover .staticCopyButton":{display:"block"}};return this.props.schema.highlight&&(r["&:hover"]={backgroundColor:this.props.oContext.themeType==="dark"?"#51515180":"#b8b8b880"}),p&&(f.alignItems="top"),I.createElement(P.Box,{component:"div",style:f,sx:r},I.createElement("div",{style:{...An.label,...this.props.schema.styleLabel||void 0}},s,t),i,u)}}const wo={fullWidth:{height:"100%",width:"100%"},link:h=>({textDecoration:"underline",color:h.palette.mode==="dark"?"#4dabf5":"#254e72",cursor:"pointer"})};function Co(h,e,t){let n,f="";h?h.toString().startsWith("#")||h.toString().startsWith("/")?(n=e||"_self",f=h):h.startsWith("http://")||h.startsWith("https://")?(n=e||"_blank",f=h):(f=`#tab-instances/config/${t}/${h}`,n=e||"_self"):(f=`#tab-instances/config/${t}`,n=e||"_self"),n==="_self"?setTimeout(i=>{i.startsWith("#")?window.location.hash=i:i.startsWith("/")?f=`${window.location.protocol}:${window.location.host}${f}`:(i.startsWith("http://")||i.startsWith("https://"))&&(window.location.href=i)},100,f):(f.startsWith("#")?f=`${window.location.protocol}:${window.location.host}${window.location.pathname}${f}`:f.startsWith("/")&&(f=`${window.location.protocol}:${window.location.host}${f}`),window.open(f,n))}class xo extends q{renderItem(e,t){if(this.props.schema.button){const f=this.getIcon();return I.createElement(P.Button,{variant:this.props.schema.variant||void 0,color:this.props.schema.color||"grey",style:{...wo.fullWidth,...this.props.schema.controlStyle||void 0},disabled:t,startIcon:f,onClick:this.props.schema.href?()=>{const i=this.props.schema.href?this.getText(this.props.schema.href,!0):null;i&&(this.props.oContext.onBackEndCommand?this.props.oContext.onBackEndCommand({command:"link",url:i,target:this.props.schema.target,close:this.props.schema.close}):Co(i,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 n=this.getText(this.props.schema.text||this.props.schema.label,this.props.schema.noTranslation);return n&&(n.includes("<a ")||n.includes("<br")||n.includes("<b>")||n.includes("<i>"))&&(n=z.Utils.renderTextWithA(n)),I.createElement(P.Box,{component:"span",style:{...this.props.schema.controlStyle||void 0},sx:this.props.schema.href?wo.link:void 0,onClick:this.props.schema.href?()=>{const f=this.props.schema.href?this.getText(this.props.schema.href,!0):null;f&&(this.props.oContext.onBackEndCommand?this.props.oContext.onBackEndCommand({command:"link",url:f,target:this.props.schema.target||"_blank",close:this.props.schema.close}):Co(f,this.props.schema.target||"_blank",`${this.props.oContext.adapterName}.${this.props.oContext.instance}`))}:null},n)}}const Or=1024*1024,Ae={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 pb(h,e,t){e=e||"key";const n=[];return Object.keys(h).forEach(f=>{const i={};i[e]=f,t?(i[t]=h[f],n.push(i)):n.push(Object.assign(i,h[f]))}),n}function So(h,e,t){e=e||"key";const n={};return h.forEach(f=>{let i=f[e];i==null&&(i=""),delete f[e],t?n[i]=f[t]:n[i]=f}),n}function fb(h,e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(h[n%h.length].charCodeAt(0)^e.charCodeAt(n));return t}function mb(h,e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(h[n%h.length].charCodeAt(0)^e.charCodeAt(n));return t}class mt extends q{filterRefs;typingTimer=null;resizeTimeout=null;secret="Zgfr56gFe87jJOM";refDiv;constructor(e){super(e),this.filterRefs={},this.props.schema.items=this.props.schema.items||[],this.props.schema.items.forEach(t=>{t.filter&&(this.filterRefs[t.attr]=Q.createRef())}),this.refDiv=I.createRef()}async componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr)||[];let t;if(this.props.schema.objKeyName?t=pb(e,this.props.schema.objKeyName,this.props.schema.objValueName):t=e,Array.isArray(t)||(t=[]),this.props.schema.encryptedAttributes){const n=await this.props.oContext.socket.getCompactSystemConfig();this.secret=(n==null?void 0:n.native.secret)||this.secret,e.forEach(f=>{this.props.schema.encryptedAttributes.forEach(i=>{f[i]&&(f[i]=mb(this.secret,f[i]))})})}this.setState({value:t,visibleValue:null,orderBy:"",order:"asc",iteration:0,filterOn:[],width:0,tableErrors:{}},()=>this.validateUniqueProps())}componentWillUnmount(){this.typingTimer&&(clearTimeout(this.typingTimer),this.typingTimer=null),this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null),super.componentWillUnmount()}itemTable(e,t,n){var p;const{schema:f}=this.props,i=(p=f.items)==null?void 0:p.find(s=>s.attr===e);if(!i)return null;const o={items:{[e]:i}};return I.createElement(wn,{oContext:this.props.oContext,alive:this.props.alive,arrayIndex:n,changed:this.props.changed,common:this.props.common,expertMode:this.props.expertMode,custom:!0,data:t,globalData:this.props.data,index:n+this.state.iteration,onChange:(s,u)=>{const r=JSON.parse(JSON.stringify(this.state.value));r[n][s]=u,this.setState({value:r},()=>{this.validateUniqueProps(),this.onChangeWrapper(r,!0)})},onError:this.onTableRowError(n),originalData:this.props.originalData,schema:o,table:!0,themeName:this.props.themeName})}validateUniqueProps(){if(!this.props.schema.uniqueColumns)return;let e=null,t=null;for(const n of this.props.schema.uniqueColumns){const f=[];this.state.value.find(o=>{const p=o[n];return f.includes(p)?(e||(e=n,t=p),this.onError(n,"is not unique"),!0):(f.push(p),!1)})||this.onError(n,null)}e?this.setState({errorMessage:z.I18n.t('Non-allowed duplicate entry "%s" in column "%s"',t,e)}):this.setState({errorMessage:""})}onTableRowError=e=>(t,n)=>{const f={...this.state.tableErrors};f[e]||(f[e]={}),n?f[e][t]=n:(delete f[e][t],Object.keys(f[e]).length===0&&delete f[e]),this.setState({tableErrors:f}),this.props.onError(t,n)};static descendingComparator(e,t,n){return t[n]<e[n]?-1:t[n]>e[n]?1:0}static getComparator(e,t){return e==="desc"?(n,f)=>mt.descendingComparator(n,f,t):(n,f)=>-mt.descendingComparator(n,f,t)}static getFilterValue(e){var t,n,f;return(f=(n=(t=e==null?void 0:e.current)==null?void 0:t.children[0])==null?void 0:n.children[0])==null?void 0:f.value}static setFilterValue(e,t){return e.current.children[0].children[0].value=t}handleRequestSort=(e,t=!1)=>{const{order:n,orderBy:f}=this.state,o=t?n:f===e&&n==="asc"?"desc":"asc",p=this.stableSort(o,e);JSON.stringify(p)!==JSON.stringify(this.state.value)&&this.setState({value:p,order:o,orderBy:e,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,p))};stableSort=(e,t)=>{const{value:n}=this.state,f=mt.getComparator(e,t),i=n.map((o,p)=>({el:o,index:p}));return i.sort((o,p)=>{const s=f(o.el,p.el);return s!==0?s:o.index-p.index}),i.map(o=>o.el)};renderShowHideFilter(e){return e.filter?I.createElement(P.IconButton,{title:z.I18n.t("ra_Show/hide filter input"),size:"small",onClick:()=>{const t=[...this.state.filterOn],n=this.state.filterOn.indexOf(e.attr);n===-1?t.push(e.attr):t.splice(n,1),this.setState({filterOn:t},()=>{n&&mt.getFilterValue(this.filterRefs[e.attr])&&(mt.setFilterValue(this.filterRefs[e.attr],""),this.applyFilter())})}},this.state.filterOn.includes(e.attr)?I.createElement(se.FilterAltOff,null):I.createElement(se.FilterAlt,null)):null}renderImportExportButtons(e){return I.createElement(I.Fragment,null,!e.noDelete&&e.import?I.createElement(P.Tooltip,{title:z.I18n.t("ra_Import data from %s file","CSV"),slotProps:{popper:{sx:Ae.tooltip}}},I.createElement(P.IconButton,{size:"small",onClick:()=>this.setState({showImportDialog:!0})},I.createElement(se.UploadFile,null))):null,e.export?I.createElement(P.Tooltip,{title:z.I18n.t("ra_Export data to %s file","CSV"),slotProps:{popper:{sx:Ae.tooltip}}},I.createElement(P.IconButton,{size:"small",onClick:()=>this.onExport()},I.createElement(se.Download,null))):null,e.noDelete?null:I.createElement(P.IconButton,{disabled:!0,size:"small"},I.createElement(se.Delete,null)))}renderAddButton(e){return I.createElement(P.Tooltip,{title:e?z.I18n.t("ra_Cannot add items with set filter"):z.I18n.t("ra_Add row"),slotProps:{popper:{sx:Ae.tooltip}}},I.createElement("span",null,I.createElement(P.IconButton,{size:"small",color:"primary",disabled:!!e&&!this.props.schema.allowAddByFilter,onClick:this.onAdd},I.createElement(se.Add,null))))}enhancedTableHead(e,t){var o;const{schema:n}=this.props,{order:f,orderBy:i}=this.state;return I.createElement(P.TableHead,null,I.createElement(P.TableRow,null,(o=n.items)==null?void 0:o.map((p,s)=>this.renderOneFilter({schema:n,style:{width:p.width},showAddButton:!s&&!n.noDelete,headCell:p,order:f,orderBy:i,index:s,doAnyFilterSet:t})),!n.noDelete&&I.createElement(P.TableCell,{style:{paddingLeft:20,paddingRight:20,width:e,textAlign:"right"},padding:"checkbox"},this.renderImportExportButtons(n))))}onDelete=e=>()=>{const t=JSON.parse(JSON.stringify(this.state.value));t.splice(e,1);const n={...this.state.tableErrors};n[e]&&(Object.keys(n[e]).forEach(i=>{this.props.onError(i,void 0)}),delete n[e]);const f={};Object.keys(n).forEach(i=>{const o=parseInt(i,10);o>e?f[o-1]=n[o]:f[o]=n[o]}),this.setState({value:t,iteration:this.state.iteration+1e4,tableErrors:f},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))};onExport(){const{schema:e}=this.props,{value:t}=this.state,f=[e.items.map(p=>p.attr).join(";")];t.forEach(p=>{const s=[];e.items.forEach(u=>{p[u.attr]&&typeof p[u.attr]=="string"&&p[u.attr].includes(";")?s.push(`"${p[u.attr]}"`):s.push(p[u.attr]===void 0||p[u.attr]===null?"":p[u.attr])}),f.push(s.join(";"))});const i=document.createElement("a");i.setAttribute("href",`data:text/csv;charset=utf-8,${encodeURIComponent(f.join(`
`))}`);const o=new Date;i.setAttribute("download",`${o.getFullYear()}_${(o.getMonth()+1).toString().padStart(2,"0")}_${o.getDate().toString().padStart(2,"0")}_${this.props.oContext.adapterName}.${this.props.oContext.instance}_${this.props.attr}.csv`),i.style.display="none",document.body.appendChild(i),i.click(),document.body.removeChild(i)}onImport(e){var o;const t=e.split(`
`).map(p=>p.replace("\r","").trim()),{schema:n}=this.props,f=t.shift().split(";").filter(p=>p&&n.items.find(s=>s.attr===p)),i=[];t.forEach(p=>{const s=p.split(";"),u={};for(let r=0;r<s.length;r++){let a=s[r];if(a.startsWith('"')){for(a=a.substring(1);r<s.length&&!a.endsWith('"');)a+=`;${s[++r]}`;a=a.substring(0,a.length-1)}let l=a;if(a==="true")l=!0;else if(a==="false")l=!1;else if(window.isFinite(a)){const d=this.props.schema.items.find(c=>c.attr===f[r]);d&&d.type==="number"?l=parseFloat(a):l=a}else l=a;u[f[r]]=l}i.push(u)}),i.length?(o=this.state.value)!=null&&o.length?this.setState({showTypeOfImportDialog:i,showImportDialog:!1}):this.setState({value:i,showImportDialog:!1}):window.alert("ra_No data found in file")}onClone=e=>()=>{const t=JSON.parse(JSON.stringify(this.state.value)),n=JSON.parse(JSON.stringify(t[e]));if(typeof this.props.schema.clone=="string"&&typeof n[this.props.schema.clone]=="string"){let f=1,i=n[this.props.schema.clone];const o=i.match(/(\d+)$/);for(o?(i=i.replace(o[0],""),f=parseInt(o[0],10)+1):i+="_";t.find(p=>p[this.props.schema.clone]===i+f.toString());)f++;n[this.props.schema.clone]=`${n[this.props.schema.clone]}_${f}`}t.splice(e,0,n),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))};onChangeWrapper=(e,t)=>{this.typingTimer&&clearTimeout(this.typingTimer),this.typingTimer=setTimeout((n,f)=>{this.typingTimer=null;let i;if(this.props.schema.encryptedAttributes){const o=JSON.parse(JSON.stringify(n));if(o.forEach(p=>{this.props.schema.encryptedAttributes.forEach(s=>{p[s]&&(p[s]=fb(this.secret,p[s]))})}),this.props.schema.objKeyName){const p=So(o,this.props.schema.objKeyName,this.props.schema.objValueName);i=this.onChange(this.props.attr,p)}else i=this.onChange(this.props.attr,o)}else if(this.props.schema.objKeyName){const o=So(JSON.parse(JSON.stringify(n)),this.props.schema.objKeyName,this.props.schema.objValueName);i=this.onChange(this.props.attr,o)}else i=this.onChange(this.props.attr,n);i instanceof Promise&&i.catch(o=>console.error(`Cannot save: ${o}`)),f&&(this.applyFilter(!1,n),this.handleRequestSort(this.state.orderBy,!0))},300,e,t)};onAdd=()=>{var f;const{schema:e}=this.props,t=JSON.parse(JSON.stringify(this.state.value)),n=(f=e.items)==null?void 0:f.reduce((i,o)=>{let p;return o.defaultFunc?this.props.custom?p=o.defaultFunc?this.executeCustom(o.defaultFunc,this.props.data,this.props.customObj,this.props.oContext.instanceObj,t.length,this.props.data):this.props.schema.default:p=o.defaultFunc?this.execute(o.defaultFunc,this.props.schema.default,this.props.data,t.length,this.props.data):this.props.schema.default:p=o.default===void 0?null:o.default,i[o.attr]=p,i},{});t.push(n),this.setState({value:t},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))};isAnyFilterSet(){return!!Object.keys(this.filterRefs).find(e=>mt.getFilterValue(this.filterRefs[e]))}applyFilter=(e,t,n)=>{t=t||this.state.value;let f=t.map((i,o)=>o);if(Object.keys(this.filterRefs).forEach(i=>{let o=mt.getFilterValue(this.filterRefs[i]);!e&&o?(o=o.toLowerCase(),f=f.filter(p=>t[p]&&t[p][i]&&t[p][i].toLowerCase().includes(o))):this.filterRefs[i].current&&mt.setFilterValue(this.filterRefs[i],"")}),f.length===t.length&&(f=null),f===null&&this.state.visibleValue===null){n&&n();return}JSON.stringify(f)!==JSON.stringify(this.state.visibleValue)?this.setState({visibleValue:f},()=>n&&n()):n&&n()};onMoveUp(e){const t=JSON.parse(JSON.stringify(this.state.value)),n=t[e];t.splice(e,1),t.splice(e-1,0,n),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))}onMoveDown(e){const t=JSON.parse(JSON.stringify(this.state.value)),n=t[e];t.splice(e,1),t.splice(e+1,0,n),this.setState({value:t,iteration:this.state.iteration+1e4},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(t)))}onDrop(e){const t=e[0],n=new FileReader;n.onabort=()=>console.log("file reading was aborted"),n.onerror=()=>console.log("file reading has failed"),n.onload=()=>{if(t.size>Or){window.alert(z.I18n.t("ra_File is too big. Max %sk allowed. Try use SVG.",Math.round(Or/1024)));return}const f=new Uint8Array(n.result).reduce((i,o)=>i+String.fromCharCode(o),"");this.onImport(f)},n.readAsArrayBuffer(t)}showTypeOfImportDialog(){return this.state.showTypeOfImportDialog?I.createElement(P.Dialog,{open:!0,onClose:()=>this.setState({showTypeOfImportDialog:!1}),maxWidth:"md"},I.createElement(P.DialogTitle,null,z.I18n.t("ra_Append or replace?")),I.createElement(P.DialogContent,null,z.I18n.t("ra_Append %s entries or replace existing?",this.state.showTypeOfImportDialog.length)),I.createElement(P.DialogActions,null,I.createElement(P.Button,{variant:"contained",color:"primary",autoFocus:!0,onClick:()=>{const e=JSON.parse(JSON.stringify(this.state.value));this.state.showTypeOfImportDialog.forEach(t=>e.push(t)),this.setState({value:e,iteration:this.state.iteration+1e4,showTypeOfImportDialog:!1},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(e)))}},z.I18n.t("ra_Append")),I.createElement(P.Button,{variant:"contained",color:"secondary",autoFocus:!0,onClick:()=>{const e=this.state.showTypeOfImportDialog;this.setState({value:e,iteration:this.state.iteration+1e4,showTypeOfImportDialog:!1},()=>this.applyFilter(!1,null,()=>this.onChangeWrapper(e)))}},z.I18n.t("ra_Replace")))):null}showImportDialog(){return this.state.showImportDialog?I.createElement(P.Dialog,{open:!0,onClose:()=>this.setState({showImportDialog:!1}),sx:{"& .MuiDialog-paper":{minHeight:500}},maxWidth:"md",fullWidth:!0},I.createElement(P.DialogTitle,null,z.I18n.t("ra_Import from %s","CSV")),I.createElement(P.DialogContent,null,I.createElement(Io,{multiple:!1,accept:{"text/csv":[".csv"]},maxSize:Or,onDragEnter:()=>this.setState({uploadFile:"dragging"}),onDragLeave:()=>this.setState({uploadFile:!0}),onDrop:(e,t)=>{this.setState({uploadFile:!1}),e.length?this.onDrop(e):window.alert(t&&t[0]&&t[0].errors&&t[0].errors[0]&&t[0].errors[0].message||z.I18n.t("ra_Cannot upload"))}},({getRootProps:e,getInputProps:t})=>I.createElement("div",{style:{...Ae.uploadDiv,...this.state.uploadFile==="dragging"?Ae.uploadDivDragging:void 0,...Ae.dropZone,...this.state.icon?void 0:Ae.dropZoneEmpty},...e()},I.createElement("input",{...t()}),I.createElement("div",{style:Ae.uploadCenterDiv},I.createElement("div",{style:Ae.uploadCenterTextAndIcon},I.createElement(se.UploadFile,{style:Ae.uploadCenterIcon}),I.createElement("div",{style:Ae.uploadCenterText},this.state.uploadFile==="dragging"?z.I18n.t("ra_Drop file here"):z.I18n.t("ra_Place your files here or click here to open the browse dialog"))))))),I.createElement(P.DialogActions,null,I.createElement(P.Button,{variant:"contained",onClick:()=>this.setState({showImportDialog:!1}),color:"primary",startIcon:I.createElement(se.Close,null)},z.I18n.t("Cancel")))):null}renderOneFilter(e){return I.createElement(P.TableCell,{key:`${e.headCell.attr}_${e.index}`,style:e.style,align:"left",sortDirection:e.orderBy===e.headCell.attr?e.order:!1},I.createElement("div",{style:{...Ae.flex,...e.schema.showFirstAddOnTop?{flexDirection:"column"}:void 0}},e.showAddButton?this.renderAddButton(e.doAnyFilterSet):null,e.headCell.sort&&I.createElement(P.TableSortLabel,{active:!0,style:e.orderBy!==e.headCell.attr?Ae.silver:void 0,direction:e.orderBy===e.headCell.attr?e.order:"asc",onClick:()=>this.handleRequestSort(e.headCell.attr)}),e.headCell.filter&&this.state.filterOn.includes(e.headCell.attr)?I.createElement(P.TextField,{variant:"standard",ref:this.filterRefs[e.headCell.attr],onChange:()=>this.applyFilter(),title:z.I18n.t("ra_You can filter entries by entering here some text"),slotProps:{input:{endAdornment:mt.getFilterValue(this.filterRefs[e.headCell.attr])&&I.createElement(P.InputAdornment,{position:"end"},I.createElement(P.IconButton,{size:"small",tabIndex:-1,onClick:()=>{mt.setFilterValue(this.filterRefs[e.headCell.attr],""),this.applyFilter()}},I.createElement(se.Close,null)))}},fullWidth:!0,placeholder:this.getText(e.headCell.title)}):I.createElement("span",{style:Ae.headerText},this.getText(e.headCell.title)),this.renderShowHideFilter(e.headCell)))}enhancedFilterCard(){var o;const{schema:e}=this.props,{order:t,orderBy:n}=this.state;let f;this.props.schema.compact&&(f={paddingTop:1,paddingBottom:1});const i=!e.noDelete&&e.import||e.export;return i||e.items.find(p=>p.sort||p.filter)?I.createElement(P.Grid2,{size:{xs:e.xs||12,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0}},I.createElement(P.Card,null,I.createElement(P.Paper,{style:Ae.paper},I.createElement(P.Accordion,{style:Ae.paper},I.createElement(P.AccordionSummary,{expandIcon:I.createElement(se.ExpandMore,null)},I.createElement(P.Typography,null,z.I18n.t("ra_Filter and Data Actions"))),I.createElement(P.AccordionDetails,null,I.createElement(P.Table,null,I.createElement(P.TableBody,null,((o=e.items)==null?void 0:o.find(p=>p.sort||p.filter))&&e.items.map((p,s)=>I.createElement(P.TableRow,{key:`${p.attr}_${s}`},this.renderOneFilter({schema:e,style:f,showAddButton:!1,headCell:p,order:t,orderBy:n,index:s,doAnyFilterSet:!1}))),i?I.createElement(P.TableRow,null,I.createElement(P.TableCell,{align:"left",style:f},I.createElement("span",{style:Ae.headerText},z.I18n.t("ra_Actions"))),I.createElement(P.TableCell,{style:f},this.renderImportExportButtons(e))):null))))))):null}enhancedBottomCard(){const{schema:e}=this.props;let t;this.props.schema.compact&&(t={paddingTop:1,paddingBottom:1});const n=this.isAnyFilterSet();return I.createElement(P.Grid2,{size:{xs:e.xs||12,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0}},I.createElement(P.Card,null,I.createElement(P.Paper,{style:Ae.paper},I.createElement(P.Table,null,I.createElement(P.TableBody,null,I.createElement(P.TableRow,null,I.createElement(P.TableCell,{colSpan:e.items.length+1,style:t},this.renderAddButton(n))))))))}renderCards(){const{schema:e}=this.props;let{visibleValue:t}=this.state,n;this.props.schema.compact&&(n={paddingTop:1,paddingBottom:1}),t||=this.state.value.map((i,o)=>o);const f=this.isAnyFilterSet();return I.createElement(P.Grid2,{container:!0},this.showImportDialog(),this.showTypeOfImportDialog(),this.enhancedFilterCard(),t.map((i,o)=>{var p;return I.createElement(P.Grid2,{key:`${i}_${o}`,size:{xs:e.xs||12,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0}},I.createElement(P.Card,null,I.createElement(P.Paper,{style:Ae.paper},I.createElement(P.Table,null,I.createElement(P.TableBody,null,(p=e.items)==null?void 0:p.map(s=>I.createElement(P.TableRow,{key:`${s.attr}_${i}`},I.createElement(P.TableCell,{align:"left",style:n},I.createElement("span",{style:Ae.headerText},this.getText(s.title))),I.createElement(P.TableCell,{align:"left",style:n},this.itemTable(s.attr,this.state.value[i],i)))),!e.noDelete&&I.createElement(P.TableRow,null,I.createElement(P.TableCell,{align:"left",style:n},I.createElement("span",{style:Ae.headerText},this.getText("Actions"))),I.createElement(P.TableCell,{align:"left",style:n},!f&&!this.state.orderBy?I.createElement(P.Tooltip,{title:z.I18n.t("ra_Move up"),slotProps:{popper:{sx:Ae.tooltip}}},I.createElement("span",null,I.createElement(P.IconButton,{size:"small",onClick:()=>this.onMoveUp(i),disabled:o===0},I.createElement(se.ArrowUpward,null)))):null,!f&&!this.state.orderBy?I.createElement(P.Tooltip,{title:z.I18n.t("ra_Move down"),slotProps:{popper:{sx:Ae.tooltip}}},I.createElement("span",null,I.createElement(P.IconButton,{size:"small",onClick:()=>this.onMoveDown(i),disabled:o===t.length-1},I.createElement(se.ArrowDownward,null)))):null,I.createElement(P.Tooltip,{title:z.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:Ae.tooltip}}},I.createElement(P.IconButton,{size:"small",onClick:this.onDelete(i)},I.createElement(se.Delete,null))),this.props.schema.clone?I.createElement(P.Tooltip,{title:z.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:Ae.tooltip}}},I.createElement(P.IconButton,{size:"small",onClick:this.onClone(i)},I.createElement(se.ContentCopy,null))):null)))))))}),this.enhancedBottomCard())}renderTable(){const{schema:e}=this.props;let{visibleValue:t}=this.state;t=t||this.state.value.map((i,o)=>o);const n=this.isAnyFilterSet();let f;return this.props.schema.compact&&(f={paddingTop:1,paddingBottom:1}),I.createElement(P.Paper,{style:Ae.paper},this.showImportDialog(),this.showTypeOfImportDialog(),e.label?I.createElement("div",{style:Ae.label},I.createElement(P.Toolbar,{variant:"dense",style:Ae.rootTool},I.createElement(P.Typography,{style:Ae.title,variant:"h6",id:"tableTitle",component:"div"},this.getText(e.label)))):null,I.createElement(P.TableContainer,null,I.createElement(P.Table,{style:Ae.table,size:"small"},this.enhancedTableHead(!n&&!this.state.orderBy?120:64,n),I.createElement(P.TableBody,null,t.map((i,o)=>{var p;return I.createElement(P.TableRow,{hover:!0,key:`${i}_${o}`},(p=e.items)==null?void 0:p.map(s=>I.createElement(P.TableCell,{key:`${s.attr}_${i}`,align:"left",style:f},this.itemTable(s.attr,this.state.value[i],i))),!e.noDelete&&I.createElement(P.TableCell,{align:"left",style:{...f,...Ae.buttonCell}},!n&&!this.state.orderBy?o?I.createElement(P.Tooltip,{title:z.I18n.t("ra_Move up"),slotProps:{popper:{sx:Ae.tooltip}}},I.createElement(P.IconButton,{size:"small",onClick:()=>this.onMoveUp(i)},I.createElement(se.ArrowUpward,null))):I.createElement("div",{style:Ae.buttonEmpty}):null,!n&&!this.state.orderBy?o<t.length-1?I.createElement(P.Tooltip,{title:z.I18n.t("ra_Move down"),slotProps:{popper:{sx:Ae.tooltip}}},I.createElement(P.IconButton,{size:"small",onClick:()=>this.onMoveDown(i)},I.createElement(se.ArrowDownward,null))):I.createElement("div",{style:Ae.buttonEmpty}):null,I.createElement(P.Tooltip,{title:z.I18n.t("ra_Delete current row"),slotProps:{popper:{sx:Ae.tooltip}}},I.createElement(P.IconButton,{size:"small",onClick:this.onDelete(i)},I.createElement(se.Delete,null))),this.props.schema.clone?I.createElement(P.Tooltip,{title:z.I18n.t("ra_Clone current row"),slotProps:{popper:{sx:Ae.tooltip}}},I.createElement(P.IconButton,{size:"small",onClick:this.onClone(i)},I.createElement(se.ContentCopy,null))):null))}),!e.noDelete&&t.length>=(e.showSecondAddAt||5)?I.createElement(P.TableRow,null,I.createElement(P.TableCell,{colSpan:e.items.length+1,style:{...f}},this.renderAddButton(n))):null)),!t.length&&this.state.value.length?I.createElement("div",{style:Ae.filteredOut},I.createElement(P.Typography,{style:Ae.title,variant:"h6",id:"tableTitle",component:"div"},z.I18n.t("ra_All items are filtered out"),I.createElement(P.IconButton,{size:"small",onClick:()=>this.applyFilter(!0)},I.createElement(se.Close,null)))):null),e.help?I.createElement(P.FormHelperText,{style:{paddingLeft:16}},this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null,this.state.errorMessage?I.createElement("div",{style:{display:"flex",padding:"5px"}},I.createElement(se.Warning,{color:"error"}),I.createElement("span",{style:{color:"red",alignSelf:"center"}},this.state.errorMessage)):null)}componentDidUpdate(){var e;(e=this.refDiv.current)!=null&&e.clientWidth&&this.refDiv.current.clientWidth!==this.state.width&&(this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{var t;this.resizeTimeout=null,this.setState({width:(t=this.refDiv.current)==null?void 0:t.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:e}=this.props;if(!this.state.value||!Array.isArray(this.state.value))return null;const t=this.getCurrentBreakpoint();let n;return t&&(e.useCardFor||["xs"]).includes(t)?n=this.renderCards():n=this.renderTable(),I.createElement("div",{ref:this.refDiv,style:{width:"100%"}},n)}}const Ri={indeterminate:{opacity:.5},label:{width:"100%",fontSize:14,marginBottom:2},helper:{width:"100%",fontSize:12},error:{width:"100%",fontSize:12,color:"#FF0000"}};class gb extends q{updateTimeout=null;componentDidMount(){super.componentDidMount();let e=q.getValue(this.props.data,this.props.attr);if(Array.isArray(e)&&this.props.oContext.multiEdit){e=q.DIFFERENT_VALUE,this.setState({value:e,oldValue:e,jsonError:!1});return}this.setState({value:e,oldValue:e,jsonError:this.validateJson(e)})}validateJson(e){let t=!1;if(this.props.schema.validateJson&&(e||!this.props.schema.allowEmpty))try{JSON.parse(e)}catch(n){console.log("Error in JSON",n),t=!0}return t}static getDerivedStateFromProps(e,t){if(e.oContext.multiEdit&&t.value===q.DIFFERENT_VALUE)return{value:q.DIFFERENT_VALUE};let n=q.getValue(e.data,e.attr);return n!=null&&(n=n.toString()),n==null||n!==t.value&&n!==t.oldValue?{value:n}:null}renderItem(e,t){const n=Array.isArray(this.state.value)||this.state.value===q.DIFFERENT_VALUE;if(this.props.schema.time){let o="";return typeof this.state.value=="number"?this.state.value&&this.state.value<9466596e5?o=new Date(this.state.value*1e3).toLocaleString():o=new Date(this.state.value).toLocaleString():typeof this.state.value=="string"&&(o=new Date(this.state.value).toLocaleString()),I.createElement(P.TextField,{variant:"standard",fullWidth:!0,value:o,error:!!e||!!this.state.jsonError,disabled:!!t,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),n){const o=q.getValue(this.props.data,this.props.attr),p=(o==null?void 0:o.filter(s=>s||s===0).map(s=>({label:s.toString()||"",value:s})))||[];return p.unshift({label:z.I18n.t(q.DIFFERENT_LABEL),value:q.DIFFERENT_VALUE}),I.createElement(P.Autocomplete,{style:Ri.indeterminate,fullWidth:!0,value:p[0],onChange:(s,u)=>{const r=u?u.value:"",a=this.onChange(this.props.attr,r,()=>{this.setState({value:r,oldValue:r,jsonError:this.validateJson(u)})});a instanceof Promise&&a.catch(l=>console.error(`Cannot set value: ${l}`))},options:p,getOptionLabel:s=>s.label,renderInput:s=>I.createElement(P.TextField,{variant:"standard",...s,error:!!e,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:!!t})})}let f,i;if((this.props.schema.readOnly||t)&&this.props.schema.copyToClipboard?(this.props.schema.minRows>1&&(i={position:"absolute",right:3,top:20,zIndex:1e3}),f=I.createElement(P.IconButton,{tabIndex:-1,style:i,size:"small",onClick:()=>{z.Utils.copyToClipboard(this.state.value),window.alert(z.I18n.t("ra_Copied"))}},I.createElement(z.IconCopy,null))):!this.props.schema.readOnly&&!t&&this.state.value&&!this.props.schema.noClearButton&&(this.props.schema.minRows>1&&(i={position:"absolute",right:3,top:20,zIndex:1e3}),f=I.createElement(P.IconButton,{style:i,size:"small",tabIndex:-1,onClick:()=>this.setState({value:"",oldValue:this.state.value},()=>this.onChange(this.props.attr,""))},I.createElement(se.Close,null)),this.props.schema.minRows<=1&&(f=I.createElement(P.InputAdornment,{position:"end"},f))),this.props.schema.minRows>1){const o=this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation);return I.createElement("div",{style:{width:"100%",position:"relative"}},this.props.schema.label?I.createElement("div",{style:Ri.label},this.getText(this.props.schema.label)):null,I.createElement(P.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:!!t,readOnly:this.props.schema.readOnly||!1,onChange:p=>{const s=p.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)}),o||e||this.state.jsonError?I.createElement("div",{style:e?Ri.error:Ri.helper},e||(this.state.jsonError?z.I18n.t("ra_Invalid JSON"):o)):null)}return I.createElement(P.TextField,{variant:"standard",fullWidth:!0,value:this.state.value===null||this.state.value===void 0?"":this.state.value,error:!!e||!!this.state.jsonError,disabled:!!t,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0,readOnly:this.props.schema.readOnly||!1},input:{endAdornment:f}},onChange:o=>{const p=o.target.value;this.setState({value:p,oldValue:this.state.value,jsonError:this.validateJson(p)},()=>this.onChange(this.props.attr,p))},placeholder:this.getText(this.props.schema.placeholder),label:this.getText(this.props.schema.label),helperText:this.state.jsonError?z.I18n.t("ra_Invalid JSON"):this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const vb={fullWidth:{width:"100%"}};class yb extends q{initialized=!1;localContext;askInstance(){if(this.props.alive){let e=this.props.schema.data;if(e===void 0&&this.props.schema.jsonData){const t=this.getPattern(this.props.schema.jsonData,null,!0);try{e=JSON.parse(t)}catch{console.error(`Cannot parse json data: ${t}`)}}e===void 0&&(e=null),this.props.oContext.socket.sendTo(`${this.props.oContext.adapterName}.${this.props.oContext.instance}`,this.props.schema.command||"send",e).then(t=>{if(typeof t=="object"){const n=t;this.setState({text:n.text||"",style:n.style,icon:n.icon,iconStyle:n.iconStyle})}else typeof t=="string"&&this.setState({text:t||""})}).catch(t=>console.error(`Cannot send command: ${t}`))}}getLocalContext(){const e={};return Array.isArray(this.props.schema.alsoDependsOn)&&this.props.schema.alsoDependsOn.forEach(t=>e[t]=q.getValue(this.props.data,t)),JSON.stringify(e)}renderItem(){if(this.props.alive){const t=this.getLocalContext();(t!==this.localContext||!this.initialized)&&(this.localContext=t,setTimeout(()=>this.askInstance(),this.initialized?300:50),this.initialized=!0)}if(this.state.text===void 0)return null;let e=null;return this.state.icon&&(e=Kt(this.state.icon,{marginRight:this.state.text?8:void 0,...this.state.iconStyle||void 0}),e||(e=I.createElement(z.Icon,{src:this.state.icon,style:{marginRight:this.state.text?8:void 0,...this.state.iconStyle||void 0}}))),this.props.schema.container==="text"?I.createElement(P.TextField,{variant:"standard",fullWidth:!0,slotProps:{input:{endAdornment:this.props.schema.copyToClipboard?I.createElement(P.IconButton,{tabIndex:-1,size:"small",onClick:()=>{z.Utils.copyToClipboard(this.state.text),window.alert(z.I18n.t("ra_Copied"))}},I.createElement(z.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)}):I.createElement("div",{style:{...vb.fullWidth,...this.state.style||void 0}},e,this.props.schema.container==="html"?I.createElement("span",{dangerouslySetInnerHTML:{__html:this.state.text||""}}):this.state.text)}}class bb extends q{componentDidMount(){super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr);this.setState({value:e})}renderItem(e,t){const n=this.props.schema.returnFormat!=="HH:mm:ss",f=new Date(Date.parse(`Thu, 01 Jan 1970 ${this.state.value||"00:00:00"}`));return I.createElement(Kg,{sx:i=>({width:"100%",borderBottom:`1px solid ${i.palette.text.primary}`,"& fieldset":{display:"none"},"& input":{padding:`${i.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:!!t,value:f,onChange:i=>{let o;o=i instanceof Date?i.toTimeString().split(" ")[0]:i.toTimeString(),n&&(o=o.split(":").slice(0,2).join(":")),this.setState({value:o},()=>this.onChange(this.props.attr,this.state.value))},views:this.props.schema.views||["hours","minutes","seconds"],label:this.getText(this.props.schema.label)})}}function wb(h,e){let t;return e&&h.substring(0,e.length)===e?t=h.substring(e.length+1):t=h,t=t.replace(/\./g,"/").replace(/_/g," "),t}class Cb extends q{componentDidMount(){var t;super.componentDidMount();const e=q.getValue(this.props.data,this.props.attr);if(!e&&((t=this.props.customObj)!=null&&t._id)){const n=wb(this.props.customObj._id,`${this.props.oContext.adapterName}.${this.props.oContext.instance}`);this.setState({value:n})}else this.setState({value:e||""})}renderItem(e,t){return I.createElement(P.TextField,{variant:"standard",fullWidth:!0,slotProps:{htmlInput:{maxLength:this.props.schema.maxLength||this.props.schema.max||void 0}},value:this.state.value,error:!!e,disabled:t,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:n=>{const f=n.target.value;this.setState({value:f},()=>this.onChange(this.props.attr,f))}})}}class xb extends q{async componentDidMount(){var t;super.componentDidMount();const e=await this.props.oContext.socket.getObject("system.meta.uuid");this.setState({uuid:((t=e==null?void 0:e.native)==null?void 0:t.uuid)||"unknown"})}renderItem(e,t){return I.createElement(P.TextField,{variant:"standard",fullWidth:!0,error:!!e,disabled:!!t,slotProps:{htmlInput:{readOnly:!0},input:{endAdornment:I.createElement(P.IconButton,{tabIndex:-1,onClick:()=>{z.Utils.copyToClipboard(this.state.uuid),window.alert(z.I18n.t("ra_Copied %s",this.state.uuid))}},I.createElement(se.ContentCopy,null))}},value:this.state.uuid||"",label:this.getText(this.props.schema.label)||z.I18n.t("ra_Serial number (UUID)"),helperText:this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)})}}const Do={icon:{width:16,height:16,marginRight:8}};class Sb extends q{componentDidMount(){super.componentDidMount(),this.props.oContext.socket.getUsers().then(e=>{const t={},n=z.I18n.getLanguage();this.props.schema.short?e.forEach(f=>{var i,o;return t[f._id]={color:(i=f.common)==null?void 0:i.color,icon:(o=f.common)==null?void 0:o.icon,name:z.Utils.getObjectNameFromObj(f,n)}}):e.forEach(f=>{var i,o;return t[f._id.replace(/^system\.user\./,"")]={color:(i=f.common)==null?void 0:i.color,icon:(o=f.common)==null?void 0:o.icon,name:z.Utils.getObjectNameFromObj(f,n)}}),this.setState({users:t})}).catch(e=>console.error(`Cannot get users: ${e}`))}renderItem(e,t){var f,i;const n=q.getValue(this.props.data,this.props.attr);return I.createElement(P.FormControl,{variant:"standard",fullWidth:!0},this.state.users&&this.props.schema.label?I.createElement(P.InputLabel,null,this.getText(this.props.schema.label)):null,this.state.users?I.createElement(P.Select,{variant:"standard",error:!!e,disabled:!!t,value:n,renderValue:o=>{var p,s,u;return I.createElement("span",null,this.state.users&&((p=this.state.users[o])!=null&&p.icon)?I.createElement(z.Icon,{src:this.state.users&&((s=this.state.users[o])==null?void 0:s.icon),style:Do.icon}):null,this.state.users&&((u=this.state.users[o])==null?void 0:u.name)||o||"")},style:{color:this.state.users&&((f=this.state.users[n])==null?void 0:f.color)||void 0,backgroundColor:z.Utils.getInvertedColor(this.state.users&&((i=this.state.users[n])==null?void 0:i.color),this.props.oContext.themeType)},onChange:o=>this.onChange(this.props.attr,o.target.value)},this.state.users&&Object.keys(this.state.users).map(o=>I.createElement(P.MenuItem,{style:{color:this.state.users[o].color||void 0,backgroundColor:z.Utils.getInvertedColor(this.state.users[o].color,this.props.oContext.themeType)},key:o,value:o},this.state.users[o].icon?I.createElement(z.Icon,{src:this.state.users[o].icon,style:Do.icon}):null,this.state.users[o].name))):I.createElement(P.TextField,{variant:"standard",error:!!e,disabled:!!t,value:n,onChange:o=>this.onChange(this.props.attr,o.target.value),label:this.getText(this.props.schema.label)}),this.props.schema.help?I.createElement(P.FormHelperText,null,this.renderHelp(this.props.schema.help,this.props.schema.helpLink,this.props.schema.noTranslation)):null)}}class Db extends q{async componentDidMount(){super.componentDidMount();const e=await Dc(()=>import("./index-DzsOJdtF.js").then(t=>t.i),__vite__mapDeps([0,1,2,3,4]),import.meta.url);this.setState({QRCode:e.default})}renderItem(){const e=this.state.QRCode;return e?I.createElement(e,{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 Eb={accordion:Qc,alive:Xc,autocomplete:Zc,autocompleteSendTo:qc,certCollection:iu,certificate:tu,certificates:nu,checkbox:su,checkDocker:ru,checkLicense:Yt,chip:Is,chips:Is,color:uu,coordinates:hu,cron:eu,custom:si,datePicker:Yg,deviceManager:Jg,divider:lb,file:ov,fileSelector:dr,func:av,header:ub,image:uv,imageSendTo:cv,infoBox:hv,instance:dv,interface:pv,ip:lv,jsonEditor:Vy,language:jy,license:Hy,number:zy,oauth2:Uy,objectId:Gy,password:Ky,pattern:Yy,port:Qy,qrCode:Db,room:Xy,select:qy,selectSendTo:tb,sendto:go,sendTo:go,setState:rb,slider:sb,state:ab,staticImage:hb,staticInfo:db,staticLink:xo,staticText:xo,table:mt,text:gb,textSendTo:yb,timePicker:bb,topic:Cb,uuid:xb,user:Sb},kt={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:h=>({backgroundColor:h.palette.primary.main,color:h.palette.mode==="dark"?"inherit":"#FFF"}),secondary:h=>({backgroundColor:h.palette.secondary.main})};class wn extends q{componentDidMount(){var e;super.componentDidMount(),(e=this.props.schema)!=null&&e.collapsable&&this.setState({expanded:(window._localStorage||window.localStorage).getItem(`${this.props.oContext.adapterName}.${this.props.attr}`)==="true"})}renderItems(e,t){return e?Object.keys(e).map(n=>{if(this.props.oContext.multiEdit&&e[n].noMultiEdit)return null;const f=e[n].type||"panel";let i,o="Use this.props.oContext.socket!";return f==="custom"?(e[n].url?i=si:this.props.oContext.customs&&this.props.oContext.customs[e[n].component]?i=this.props.oContext.customs[e[n].component]:(console.error(`Cannot find custom component: ${e[n].component}`),i=q),o=this.props.oContext.socket):f==="panel"?i=wn:i=Eb[f]||q,I.createElement(i,{socket:o,globalData:this.props.globalData,oContext:this.props.oContext,key:`${n}_${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:kt.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:t,customObj:this.props.customObj,custom:this.props.custom,schema:e[n],attr:n,table:this.props.table})}):null}render(){const e=this.props.schema;if(!e)return null;const{disabled:t,hidden:n}=this.calculate(e),f=this.props.schema.items,i=this.props.schema.style||{};if(n){if(e.hideOnlyControl){const p=I.createElement(P.Grid2,{size:{xs:e.xs||void 0,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0},sx:z.Utils.getStyle(this.props.oContext.theme,{marginBottom:0,textAlign:"left"},i,this.props.oContext.themeType==="dark"&&e.darkStyle)});return e.newLine?I.createElement(I.Fragment,null,I.createElement("div",{style:{flexBasis:"100%",height:0}}),p):p}return null}if(this.props.table)return this.renderItems(f,t);if(this.props.custom)return I.createElement(P.Grid2,{key:`${this.props.attr}_${this.props.index}`,container:!0,style:kt.fullWidth,columnSpacing:2,rowSpacing:1,sx:i},this.renderItems(f,t));let o;if(e.collapsable)o=I.createElement(P.Accordion,{key:`${this.props.attr}_${this.props.index}`,style:kt.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})}},I.createElement(P.AccordionSummary,{expandIcon:I.createElement(se.ExpandMore,null),sx:z.Utils.getStyle(this.props.oContext.theme,i,this.props.oContext.themeType&&e.darkStyle,e.color==="primary"?kt.primary:e.color==="secondary"&&kt.secondary,{width:"100%"})},I.createElement(P.Typography,{style:kt.heading},this.getText(e.label))),I.createElement(P.AccordionDetails,null,I.createElement(P.Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:{...i,width:"100%",padding:"10px"}},this.renderItems(f,t))));else{const p=z.Utils.getStyle(this.props.oContext.theme,this.props.style,i,{width:"100%"},this.props.isParentTab&&kt.paper,this.props.isParentTab&&(this.props.withoutSaveButtons?this.props.withIcons?{height:"calc(100% - 88px) !important"}:{height:"calc(100% - 64px) !important"}:this.props.withIcons?kt.paperWithIcons:kt.paperWithoutIcons));o=I.createElement(P.Box,{component:"div",key:`${this.props.attr}_${this.props.index}`,className:this.props.className,sx:p},I.createElement(P.Grid2,{container:!0,columnSpacing:2,rowSpacing:1,sx:z.Utils.getStyle(this.props.oContext.theme,{width:"100%"},this.props.isParentTab&&kt.padding,this.props.schema.innerStyle)},this.renderItems(f,t)))}if(!this.props.isParentTab){const p=I.createElement(P.Grid2,{title:this.getText(e.tooltip),size:{xs:e.xs||void 0,sm:e.sm||void 0,md:e.md||void 0,lg:e.lg||void 0,xl:e.xl||void 0},sx:{marginBottom:0,textAlign:"left",...i}},o);return e.newLine?I.createElement(I.Fragment,null,I.createElement("div",{style:{flexBasis:"100%",height:0}}),p):p}return o}}const Oi={tabs:{height:"100%",width:"100%"},panel:{width:"100%",display:"block"},panelWithIcons:{height:"calc(100% - 72px)"},panelWithoutIcons:{height:"calc(100% - 48px)"}};class Ab extends q{resizeTimeout=null;refDiv;constructor(e){super(e);let t;if(this.props.root){const n=(window.location.hash||"").replace(/^#/,"").split("/");if(n.length>=3&&n[1]==="config"){const f=n[3],i=parseInt(f,10);f&&i.toString()===f?i>=0&&i<Object.keys(this.props.schema.items).length&&(t=Object.keys(this.props.schema.items)[i]):f&&Object.keys(this.props.schema.items).includes(f)&&(t=f),window.addEventListener("hashchange",this.onHashTabsChanged,!1)}}t===void 0&&(t=(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(t)||(t=Object.keys(this.props.schema.items)[0])),this.refDiv=I.createRef(),Object.assign(this.state,{tab:t,width:0,openMenu:null,tabErrors:{}})}onTabError=(e,t)=>{const n=this.state.tab;if(!n){this.props.onError(e,t);return}const f={...this.state.tabErrors};f[n]||(f[n]={}),t?f[n][e]=t:(delete f[n][e],Object.keys(f[n]).length===0&&delete f[n]),this.setState({tabErrors:f}),this.props.onError(e,t)};hasTabErrors=e=>!!(this.state.tabErrors[e]&&Object.keys(this.state.tabErrors[e]).length>0);componentWillUnmount(){this.resizeTimeout&&(clearTimeout(this.resizeTimeout),this.resizeTimeout=null),window.removeEventListener("hashchange",this.onHashTabsChanged,!1),super.componentWillUnmount()}onHashTabsChanged=()=>{const e=(window.location.hash||"").replace(/^#/,"").split("/");if(e.length>3&&e[1]==="config"){const t=e[3],n=parseInt(t,10);let f;n.toString()===t?n>=0&&n<Object.keys(this.props.schema.items).length&&(f=Object.keys(this.props.schema.items)[n]):Object.keys(this.props.schema.items).includes(t)&&(f=t),f!==void 0&&f!==this.state.tab&&((window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,f),this.setState({tab:f}))}};getCurrentBreakpoint(){if(!this.state.width)return"md";if(!this.state.initialBreakpoint){let e;return this.state.width<600?e="xs":this.state.width<900?e="sm":this.state.width<1200?e="md":this.state.width<1536?e="lg":e="xl",setTimeout(()=>{this.setState({initialBreakpoint:e})},50),e}return this.state.initialBreakpoint}componentDidUpdate(){var e;!this.state.initialBreakpoint&&((e=this.refDiv.current)!=null&&e.clientWidth)&&this.refDiv.current.clientWidth!==this.state.width&&(this.resizeTimeout&&clearTimeout(this.resizeTimeout),this.resizeTimeout=setTimeout(()=>{var t;this.resizeTimeout=null,this.setState({width:(t=this.refDiv.current)==null?void 0:t.clientWidth})},50))}onMenuChange(e){(window._localStorage||window.localStorage).setItem(`${this.props.dialogName||"App"}.${this.props.oContext.adapterName}`,e),this.setState({tab:e},()=>{if(this.props.root){const t=(window.location.hash||"").split("/");t.length>=3&&t[1]==="config"&&(t[3]=this.state.tab,window.location.hash=t.join("/"))}})}render(){const e=this.props.schema.items;let t=!1;const n=[];Object.keys(e).map(o=>{let p;if(e[o].expertMode&&!this.props.expertMode)return;if(this.props.custom){if(this.executeCustom(e[o].hidden,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData))return;p=this.executeCustom(e[o].disabled,this.props.data,this.props.customObj,this.props.oContext.instanceObj,this.props.index,this.props.globalData)}else{if(this.execute(e[o].hidden,!1,this.props.data,this.props.index,this.props.globalData))return;p=this.execute(e[o].disabled,!1,this.props.data,this.props.index,this.props.globalData)}const s=this.getIcon(e[o].icon);t=t||!!s,n.push({icon:s,disabled:p,label:this.getText(e[o].label),name:o})}),n.find(o=>o.name===this.state.tab)||setTimeout(()=>this.setState({tab:n[0].name}),50);const f=this.getCurrentBreakpoint();let i;return f==="xs"&&n.length>2?i=I.createElement(P.Toolbar,{style:{top:2,backgroundColor:this.props.oContext.themeType==="dark"?"#222":"#DDD"},variant:"dense"},I.createElement(P.IconButton,{onClick:o=>this.setState({openMenu:o.currentTarget})},I.createElement(se.Menu,null)),this.state.openMenu?I.createElement(P.Menu,{open:!0,anchorEl:this.state.openMenu,onClose:()=>this.setState({openMenu:null})},n.map(o=>{const p=this.hasTabErrors(o.name);return I.createElement(P.MenuItem,{disabled:o.disabled,key:o.name,onClick:()=>{this.setState({openMenu:null},()=>this.onMenuChange(o.name))},selected:o.name===this.state.tab,sx:p?{color:"error.main"}:void 0},t?I.createElement(P.ListItemIcon,null,o.icon):null,I.createElement(P.Box,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"}},o.label,p&&I.createElement(se.Error,{sx:{fontSize:16,color:"error.main"}})))})):null):i=I.createElement(P.Tabs,{variant:"scrollable",scrollButtons:"auto",style:this.props.schema.tabsStyle,value:this.state.tab,onChange:(o,p)=>this.onMenuChange(p)},n.map(o=>{const p=this.hasTabErrors(o.name),s=p?I.createElement(P.Box,{sx:{display:"flex",alignItems:"center",gap:.5}},o.label,I.createElement(se.Error,{sx:{fontSize:16,color:"error.main"}})):o.label;return I.createElement(P.Tab,{id:o.name,wrapped:!0,disabled:o.disabled,key:o.name,value:o.name,iconPosition:this.props.schema.iconPosition||"start",icon:o.icon,label:s,sx:p?{"& .MuiTab-wrapper":{color:"error.main"}}:void 0})})),I.createElement("div",{style:Oi.tabs,ref:this.refDiv},i,I.createElement(wn,{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:{...Oi.panel,...t?Oi.panelWithIcons:Oi.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.onTabError,customObj:this.props.customObj,custom:this.props.custom,schema:e[this.state.tab],table:this.props.table,withIcons:t}))}}const Tb={root:{width:"100%",height:"100%"}};class Ni extends Q.Component{forceUpdateHandlers;errorTimeout=null;errorCached=null;oContext;constructor(e){super(e),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(e,t){return e.updateData!==t.updateData?{updateData:e.updateData,originalData:JSON.stringify(e.data),schema:JSON.parse(JSON.stringify(e.schema))}:null}static async loadI18n(e,t,n){if(t===!0||t&&typeof t=="string"){const f=z.I18n.getLanguage(),i=typeof t=="string"?t:"i18n";let o=await e.fileExists(`${n}.admin`,`${i}/${f}.json`),p;if(o?p=`${i}/${f}.json`:(o=await e.fileExists(`${n}.admin`,`${i}/${f}/translations.json`),o?p=`${i}/${f}/translations.json`:f!=="en"&&(o=await e.fileExists(`${n}.admin`,`${i}/en.json`),o?p=`${i}/en.json`:(o=await e.fileExists(`${n}.admin`,`${i}/en/translations.json`),o&&(p=`${i}/en/translations.json`)))),p){const s=await e.readFile(`${n}.admin`,p);let u;s.file!==void 0?u=s.file:u=s;try{const r=JSON.parse(u);z.I18n.extendTranslations(r,f)}catch(r){return console.error(`Cannot parse language file "${n}.admin/${p}: ${r}`),""}return p}return console.warn(`Cannot find i18n for ${n} / ${p}`),""}return t&&typeof t=="object"&&z.I18n.extendTranslations(t),""}onCommandRunning=e=>this.setState({commandRunning:e});readData(){this.props.socket.getCompactSystemConfig().then(e=>this.props.socket.getState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`).then(t=>this.setState({systemConfig:e.common,alive:!!(t&&t.val)},()=>{this.updateContext(!0),this.props.custom||this.props.socket.subscribeState(`system.adapter.${this.props.adapterName}.${this.props.instance}.alive`,this.onAlive)}))).catch(e=>console.error(`Cannot read system config: ${e}`))}onAlive=(e,t)=>{!!(t!=null&&t.val)!==this.state.alive&&this.setState({alive:!!(t!=null&&t.val)})};onChange=(e,t,n,f)=>{if(this.props.onValueChange)this.props.onValueChange(e,t,f),n&&n();else if(e&&this.props.onChange){const i={changed:JSON.stringify(e)!==this.state.originalData};this.setState(i,()=>{this.props.onChange(e,i.changed,f),n&&n()})}else f&&this.props.onChange(null,null,f)};onError=(e,t)=>{this.errorCached=this.errorCached||JSON.parse(JSON.stringify(this.state.errors));const n=this.errorCached;t?n[e]=t:delete n[e],this.errorTimeout&&clearTimeout(this.errorTimeout),JSON.stringify(n)!==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(e,t){return t=t||{},e.items&&Object.keys(e.items).forEach(n=>{t[n]=e.items[n],this.flatten(e.items[n],t)}),t}buildDependencies(e){const t=this.flatten(e);Object.keys(t).forEach(n=>{var f,i,o,p,s,u,r,a,l,d;(f=t[n].confirm)!=null&&f.alsoDependsOn&&((i=t[n].confirm)==null||i.alsoDependsOn.forEach(c=>{if(!t[c])console.error(`[JsonConfigComponent] Attribute ${c} does not exist!`),c.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${c.replace(/^data\./,"")}" instead of "${c}"`);else{t[c].confirmDependsOn=t[c].confirmDependsOn||[];const m={...t[n],attr:n};m.confirm&&(m.confirm.cancel="Undo"),t[c].confirmDependsOn.push(m)}})),(o=t[n].onChange)!=null&&o.alsoDependsOn&&((p=t[n].onChange)==null||p.alsoDependsOn.forEach(c=>{if(!t[c])console.error(`[JsonConfigComponent] Attribute ${c} does not exist!`),c.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${c.replace(/^data\./,"")}" instead of "${c}"`);else{t[c].onChangeDependsOn=t[c].onChangeDependsOn||[];const m={...t[n],attr:n};t[c].onChangeDependsOn.push(m)}})),(s=t[n].hidden)!=null&&s.alsoDependsOn&&((u=t[n].hidden)==null||u.alsoDependsOn.forEach(c=>{if(!t[c])console.error(`[JsonConfigComponent] Attribute ${c} does not exist!`),c.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${c.replace(/^data\./,"")}" instead of "${c}"`);else{t[c].hiddenDependsOn=t[c].hiddenDependsOn||[];const m={...t[n],attr:n};t[c].hiddenDependsOn.push(m)}})),(r=t[n].label)!=null&&r.alsoDependsOn&&((a=t[n].label)==null||a.alsoDependsOn.forEach(c=>{if(!t[c])console.error(`[JsonConfigComponent] Attribute ${c} does not exist!`),c.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${c.replace(/^data\./,"")}" instead of "${c}"`);else{t[c].labelDependsOn=t[c].labelDependsOn||[];const m={...t[n],attr:n};t[c].labelDependsOn.push(m)}})),(l=t[n].help)!=null&&l.alsoDependsOn&&((d=t[n].help)==null||d.alsoDependsOn.forEach(c=>{if(!t[c])console.error(`[JsonConfigComponent] Attribute ${c} does not exist!`),c.startsWith("data.")&&console.warn(`[JsonConfigComponent] please use "${c.replace(/^data\./,"")}" instead of "${c}"`);else{t[c].helpDependsOn=t[c].helpDependsOn||[];const m={...t[n],attr:n};t[c].helpDependsOn.push(m)}}))})}updateContext(e){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},e&&this.forceUpdate()}renderItem(e){return e.type==="tabs"?I.createElement(Ab,{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:(t,n)=>this.onError(t,n),originalData:JSON.parse(this.state.originalData),root:!0,schema:e,expertMode:this.props.expertMode,themeName:this.props.themeName}):e.type==="panel"||!e.type?I.createElement(wn,{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:(t,n)=>this.onError(t,n),originalData:JSON.parse(this.state.originalData),root:!0,schema:e,themeName:this.props.themeName}):(console.error(`Unknown item type in root: ${JSON.stringify(e)}`),null)}changeLanguage=()=>{this.forceUpdate()};forceAttrUpdate=(e,t)=>{Array.isArray(e)?e.forEach(n=>this.forceUpdateHandlers[n]&&this.forceUpdateHandlers[n](t)):this.forceUpdateHandlers[e]&&this.forceUpdateHandlers[e](t)};registerOnForceUpdate=(e,t)=>{t?this.forceUpdateHandlers[e]=t:this.forceUpdateHandlers[e]&&delete this.forceUpdateHandlers[e]};render(){return!this.state.systemConfig||!this.oContext?I.createElement(P.LinearProgress,null):(this.oContext._themeName!==this.props.themeName&&(this.oContext._themeName=this.props.themeName,setTimeout(()=>this.updateContext(!0),0)),I.createElement("div",{style:{...!this.props.embedded||this.props.withoutSaveButtons?Tb.root:void 0,...this.props.style,...this.state.schema.style}},this.renderItem(this.state.schema)))}}const hn={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 kb(h,e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(h[n%h.length].charCodeAt(0)^e.charCodeAt(n));return t}function $b(h,e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(h[n%h.length].charCodeAt(0)^e.charCodeAt(n));return t}function Mb(h,e){if(typeof e!="string")return e;if(!e.startsWith("$/aes-192-cbc:")||!/^[0-9a-f]{48}$/.test(h))return kb(h,e);const t=e.split(":",3),n=window.CryptoJS.enc.Hex.parse(h),f=window.CryptoJS.enc.Hex.parse(t[1]),i=window.CryptoJS.lib.CipherParams.create({ciphertext:window.CryptoJS.enc.Hex.parse(t[2])}),o=window.CryptoJS.AES.decrypt(i,n,{iv:f});return window.CryptoJS.enc.Utf8.stringify(o)}function _b(h,e,t){if(typeof e!="string")return e;if(!/^[0-9a-f]{48}$/.test(h))return $b(h,e);let n;n=window.CryptoJS.lib.WordArray.random(128/8);const f=window.CryptoJS.enc.Hex.parse(h),i=window.CryptoJS.AES.encrypt(e,f,{iv:n}).ciphertext;return`$/aes-192-cbc:${window.CryptoJS.enc.Hex.stringify(n)}:${i}`}function Eo(h,e){var t;return document.getElementById(e)?(t=document.getElementById(e))==null?void 0:t.onload:new Promise(n=>{const f=document.createElement("script");f.setAttribute("id",e),f.onload=n,f.src=h,document.getElementsByTagName("head")[0].appendChild(f)})}let Ib=class extends z.Router{fileSubscribed=[];fileLangSubscribed="";secret;constructor(e){super(e),this.state={updateData:0,changed:!1,confirmDialog:!1,theme:z.Theme(e.themeName),saveConfigDialog:!1,hash:"_"},this.secret=e.secret||"",this.getInstanceObject().then(t=>this.getConfigFile().then(n=>Ni.loadI18n(this.props.socket,n==null?void 0:n.i18n,this.props.adapterName).then(f=>{f&&(this.fileLangSubscribed||(this.fileLangSubscribed=f,this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,this.fileLangSubscribed,this.onFileChange))),t?this.setState({schema:n,data:t.native,common:t.common,hash:Ms(JSON.stringify(n)).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=e=>{const t=e.target.files[0];if(t){const n=new FileReader;n.onload=f=>{if(!f.target)return;const i=f.target.result;try{const o=JSON.parse(i);this.setState({data:o,changed:JSON.stringify(o)!==JSON.stringify(this.state.originalData)})}catch{window.alert(z.I18n.t("[JsonConfig] Failed to parse JSON file"))}},n.readAsText(t)}else window.alert(z.I18n.t("[JsonConfig] Failed to open JSON File"))};getExportImportButtons(){return I.createElement("div",{style:hn.exportImportButtons},I.createElement(P.Tooltip,{title:this.props.t("Import settings from JSON file"),slotProps:{popper:{sx:hn.tooltip}}},I.createElement(P.Fab,{size:"small",sx:{"&.MuiFab-root":hn.button},onClick:()=>{const e=document.createElement("input");e.setAttribute("type","file"),e.setAttribute("id","files"),e.setAttribute("opacity",0),e.addEventListener("change",t=>this.handleFileSelect(t),!1),e.click()}},I.createElement(se.Publish,null))),I.createElement(P.Tooltip,{title:this.props.t("Export setting to JSON file"),slotProps:{popper:{sx:hn.tooltip}}},I.createElement(P.Fab,{size:"small",sx:{"&.MuiFab-root":hn.button},onClick:()=>{this.state.data&&z.Utils.generateFile(`${this.props.adapterName}.${this.props.instance}.json`,this.state.data)}},I.createElement(se.Publish,{style:{transform:"rotate(180deg)"}}))))}onFileChange=async(e,t,n)=>{var f;if(e===`${this.props.adapterName}.admin`&&n){if(t===this.fileLangSubscribed)try{await Ni.loadI18n(this.props.socket,(f=this.state.schema)==null?void 0:f.i18n,this.props.adapterName),this.setState({hash:`${this.state.hash}1`})}catch{}else if(this.fileSubscribed.includes(t))try{const i=await this.getConfigFile(this.fileSubscribed[0]);this.setState({schema:i,hash:Ms(JSON.stringify(i)).toString()})}catch{}}};async getInstanceObject(){var e;try{const t=await this.props.socket.getObject(`system.adapter.${this.props.adapterName}.${this.props.instance}`);if(Array.isArray(t.encryptedNative)){if(!this.secret){const n=await this.props.socket.getSystemConfig();await Eo("../../lib/js/crypto-js/crypto-js.js","crypto-js"),this.secret=n.native.secret}return(e=t.encryptedNative)==null||e.forEach(n=>{t.native[n]&&(t.native[n]=Mb(this.secret,t.native[n]))}),t}return t}catch(t){window.alert(`[JsonConfig] Cannot read instance object: ${t}`)}return null}renderDialogConfirm(){return this.state.confirmDialog?I.createElement(z.DialogConfirm,{title:z.I18n.t("ra_Please confirm"),text:z.I18n.t("ra_Some data are not stored. Discard?"),ok:z.I18n.t("ra_Discard"),cancel:z.I18n.t("ra_Cancel"),onClose:e=>this.setState({confirmDialog:!1},()=>e&&z.Router.doNavigate(null))}):null}async scanForInclude(e,t){if(typeof e["#include"]=="string"){const f=await this._getConfigFile(e["#include"],[...t]);return delete e["#include"],f&&(e={...e,...f}),e}const n=Object.keys(e);for(let f=0;f<n.length;f++)e[n[f]]&&typeof e[n[f]]=="object"&&(e[n[f]]=await this.scanForInclude(e[n[f]],t));return e}async getConfigFile(e){return this._getConfigFile(e)}async _getConfigFile(e,t){if(e=e||"jsonConfig.json5",t=t||[],t.includes(e))return window.alert(`[JsonConfig] Circular reference in file: ${e} => ${t.join(" => ")}`),null;t.push(e);try{await this.props.socket.fileExists(`${this.props.adapterName}.admin`,e)||(e="jsonConfig.json");const f=await this.props.socket.readFile(`${this.props.adapterName}.admin`,e);let i="",o="";if(f.file!==void 0&&(o=f.file),typeof o=="string")i=o;else if(o.type==="Buffer"){let p="";const s=new Uint8Array(o.data),u=s.byteLength;for(let r=0;r<u;r++)p+=String.fromCharCode(s[r]);i=p}this.fileSubscribed.includes(e)||(this.fileSubscribed.push(e),await this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`,e,this.onFileChange));try{return await this.scanForInclude(Oo.parse(i),t)}catch(p){window.alert("[JsonConfig] Cannot parse json5 config!"),console.log(p)}}catch(n){this.state.schema||window.alert(`[JsonConfig] Cannot read file "${e}: ${n}`)}return null}renderSaveConfigDialog(){return this.state.saveConfigDialog?I.createElement(z.DialogConfirm,{title:z.I18n.t("ra_Please confirm"),text:z.I18n.t("Save configuration?"),ok:z.I18n.t("ra_Save"),cancel:z.I18n.t("ra_Cancel"),onClose:e=>this.setState({saveConfigDialog:!1},()=>e&&this.onSave(!0))}):null}findAttr(e,t){if(t=t||this.state.schema,t!=null&&t.items){if(e in t.items)return t.items[e];for(const n of Object.values(t.items)){const f=this.findAttr(e,n);if(f)return f}}return null}postProcessing(e,t,n){if(n=n||this.state.schema,!e){console.error(`Data is empty in postProcessing: ${t}, ${JSON.stringify(n)}`);return}const f=e[t];if(n.items)if(n.type==="table"){const i=f;if(!Array.isArray(i))return;for(const o of i)for(const p of n.items)this.postProcessing(o,p.attr,p)}else for(const[i,o]of Object.entries(n.items)){if(o.type==="panel"||o.type==="tabs"||o.type==="accordion")return;this.postProcessing(e,i,o)}else if(t&&typeof f=="string")if(n.type==="text")n.trim!==!1&&(e[t]=f.trim());else if(n.type==="ip")e[t]=f.trim();else if(n.type==="number"){const i=parseFloat(f.toString().replace(",","."));n.min!==void 0&&i<n.min?e[t]=n.min:n.max!==void 0&&i>n.max?e[t]=n.max:e[t]=i}else if(n.type==="port"){const i=parseInt(f.toString(),10);n.min!==void 0&&i<n.min?e[t]=n.min:n.max!==void 0&&i>n.max&&(e[t]=n.max),e[t]!==0&&i<20?e[t]=20:i>65535?e[t]=65535:e[t]=i}else n.type==="checkbox"&&(e[t]=e[t]===!0||e[t]==="true"||e[t]==="on"||e[t]===1||e[t]==="1")}async onSave(e,t){if(e){const n=await this.getInstanceObject();if(!n){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 f={};for(const o of Object.keys(this.state.data)){const p=this.findAttr(o);(!p||!p.doNotSave||p.type==="state")&&!o.startsWith("_")?q.setValue(n.native,o,this.state.data[o]):(q.setValue(n.native,o,null),f[o]=this.state.data[o])}try{const o=JSON.parse(JSON.stringify(n));if(Array.isArray(o.encryptedNative)){await Eo("../../lib/js/crypto-js/crypto-js.js","crypto-js");for(const p of o.encryptedNative)o.native[p]&&(o.native[p]=_b(this.secret,o.native[p]))}await this.props.socket.setObject(o._id,o)}catch(o){window.alert(`[JsonConfig] Cannot set object: ${o}`)}const i={...n.native,...f};console.log(i),this.setState({changed:!1,data:i,updateData:this.state.updateData+1,originalData:i},()=>t&&z.Router.doNavigate(null))}else this.state.changed?this.setState({confirmDialog:!0}):z.Router.doNavigate(null)}componentDidUpdate(e,t){t.changed!==this.state.changed&&this.props.configStored(!this.state.changed)}async componentDidMount(){const e=`${window.location.protocol}//${window.location.host}${window.location.pathname}validate_config/${this.props.adapterName}`;console.log(`fetch ${e}`),await fetch(e)}render(){return!this.state.data||!this.state.schema?I.createElement(P.LinearProgress,null):I.createElement("div",{style:hn.root},this.renderDialogConfirm(),this.getExportImportButtons(),this.renderSaveConfigDialog(),I.createElement(Ni,{key:this.state.hash,style:hn.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:e=>this.setState({error:e}),onChange:(e,t,n)=>{n&&this.state.error&&(window.alert(z.I18n.t("Cannot save configuration because of error in configuration")),n=!1),n&&!this.state.changed&&!t&&(n=!1),e?this.setState({data:e,changed:t,saveConfigDialog:n}):n!==void 0&&this.setState({saveConfigDialog:n})},DeviceManager:this.props.DeviceManager,theme:this.state.theme}),I.createElement(z.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:e=>this.onSave(!0,e),onClose:()=>this.onSave(!1)}))}};export{q as ConfigGeneric,wn as ConfigPanel,Ib as JsonConfig,Ni as JsonConfigComponent};