From c2de01197de7e22a9d1b2aa1ee46924b69e58554 Mon Sep 17 00:00:00 2001 From: madgrizzle Date: Wed, 17 Oct 2018 01:47:15 +0000 Subject: [PATCH 001/685] running off RPi --- Actions/__init__.pyc | Bin 148 -> 126 bytes Actions/actions.pyc | Bin 12399 -> 11805 bytes Connection/__init__.pyc | Bin 151 -> 129 bytes Connection/nonVisibleWidgets.pyc | Bin 1528 -> 1462 bytes Connection/serialPort.pyc | Bin 2392 -> 2260 bytes Connection/serialPortThread.pyc | Bin 5651 -> 5497 bytes DataStructures/__init__.pyc | Bin 155 -> 133 bytes DataStructures/data.pyc | Bin 2373 -> 2307 bytes DataStructures/logger.pyc | Bin 3230 -> 3054 bytes DataStructures/loggingQueue.pyc | Bin 1060 -> 972 bytes DataStructures/makesmithInitFuncs.pyc | Bin 605 -> 539 bytes File/__init__.pyc | Bin 145 -> 123 bytes File/gcodeFile.pyc | Bin 12873 -> 12499 bytes app.pyc | Bin 655 -> 633 bytes background/__init__.pyc | Bin 151 -> 129 bytes background/backgroundTasks.pyc | Bin 4177 -> 4045 bytes config/__init__.pyc | Bin 147 -> 125 bytes config/config.pyc | Bin 13032 -> 12636 bytes main.py | 2 +- webcontrol.json | 2 +- 20 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/__init__.pyc b/Actions/__init__.pyc index 681fa4e04f88b7d346824f0f10ddd63bb8d38921..961b1d09bae089c30d9e5d3d29c61e71b6a206db 100644 GIT binary patch delta 50 zcmbQjSjW!%nU|}g<=8}aGX-@91_u3%{M=Oif=vDL)THG6ypp2)9DT>+lFaQyN`l Iay8Hb0Hq;UxBvhE delta 1621 zcmbOm^FD!%`7a7{}z2%>2CKn9XyT6Pd`=J6V=(8@XCPv+W>L>*CYwjAUxv{F=jr zY`yke+GOkP;;tlD?__1(?c{p*7q0}_)*A7X9k(0;2g!BuOMw++yLh9}I&!V87hXlK zwVORft69jk_lcw{*%{YUb}hLXce9v6I@$KlRZb(<-pR^pU&suq$>!>B$kpnsF@sF4 fn}2Ha7$BXOnp~2ZpBFPRK@kA8j2gcH diff --git a/Connection/nonVisibleWidgets.pyc b/Connection/nonVisibleWidgets.pyc index e65f6d4037d025f247b95d48a8e3b3f2df884ae7..d156057ef519577743bc5706f1f8c636c3a9566c 100644 GIT binary patch delta 136 zcmeyty^Wil`7IbwvL9l$^kiUQaJGsGElw>ej>*c;$cu5wPcF?(%_}L6anCIA uC{2n9Pfc>p&nqd)&xrxjd8x@InfZA!ljpODPG)4OrpSat6zFbYH39&cC`?ZP diff --git a/Connection/serialPort.pyc b/Connection/serialPort.pyc index 95e18cba720d52327643b761c3e795eac351f36c..a582f20d00873b8cac9d6f0c24204b09c028e00e 100644 GIT binary patch delta 258 zcmca1bVZPz`7`R!Gbr={J^fU5vQ}qin^~+O}lJoOQit=;xo%8eZQj<$E s^Yip4KVf=BjJnP2EQ=Y5QuvrPfGCBNbJ#nGF>taj$6=z>X>#fV0F&BS1ONa4 delta 390 zcmca2ctePt`72BV$>*3}k*|C6ZRW*{6lh<_8bE>e$s+6>?c^2jTjgh^fU5vQ}qin^~+O}lJoOQit=;xo%8eZQj<$E y^Yip4KM)m}EW@^iXtlEJXNgt2*_@+_k!Z#LI0HF}Ry;>of;f}kitHlNP-6gt0dBJZ delta 477 zcmeyVHCcz9`7?c?)Js21moULL)i&Kk=W3uuy@?u=_lS^|`^Gb?i+%ro& zN|R#3QBqB`9-+@Z=hi<&-&Ma+Ih%0OKsLWB>pF diff --git a/DataStructures/__init__.pyc b/DataStructures/__init__.pyc index 65a9581aa8274af8d7cdaad6d49e917570da5d3a..a0cb845f7bd83565b7a484915b65902ddf3c81d0 100644 GIT binary patch delta 58 zcmbQu*viPx{F#@lqUG2`b~AN71_lQGjQreG{en#W^3a7?;G7#Nd*m(&UoTqSWG;i7AQzDcKx? diff --git a/DataStructures/data.pyc b/DataStructures/data.pyc index 00afcb3a9d62882c811e0a1e29c22ad5f67189e0..95c086ea3cfc9bf96025a40fa0144de40a6d2e44 100644 GIT binary patch delta 149 zcmX>q)GWl#{F#@lqUG2|_Bs}IEd~Y#{fzwFRQ-ZX{qoeLGmUshoaI_btih94bN3Ui Iwwy;D09uEDmjD0& delta 546 zcmaDSK2MUJ`7=iib|79N{dp9V=iib|79N{dp9V D?FMI9 diff --git a/DataStructures/makesmithInitFuncs.pyc b/DataStructures/makesmithInitFuncs.pyc index 5c7ea495645e0887c991281ad95476df6f72f7f4..9096e37a8d6127843828867b28e9c91a52433375 100644 GIT binary patch delta 155 zcmcc1GMj~+`7s-P;81e0G9eu AmjD0& diff --git a/File/__init__.pyc b/File/__init__.pyc index 6084ae281f015f5c2dab18cbff7f2200b49230c0..7af1e6e7efe7dc2cdcbc3511fafa5c6fe76ab0ef 100644 GIT binary patch delta 47 zcmbQpSk2D-nU|}g<=8}aGg%b|1_u3%{M=Oif=vDL)THG6ypp2)9DTRUoK*dZ1&RP# C$qzvQ delta 69 zcmb=P$jHw8nU_oW*WQWjX2wn&Ma3~$`5AdJF8Rr&xv6<2#WC)gB_5?o YG2y96&iQ#IMfo`~Zkai$F%zQ{0Vk#yX#fBK diff --git a/File/gcodeFile.pyc b/File/gcodeFile.pyc index 00aab5fa18fe5e338aa560f19d400a4e22e02015..681b8ea67c8e0c7a8a1ec1832dd3c7befeb4d300 100644 GIT binary patch delta 605 zcmX?^aygNm`7~)N?stgPa`WgATsrm((`sJxf$@zIDMfo}UZkai$`jdAs zCg4}G*_-Jf0Yf&|uyC^DH)Zk;?*I5zY<|VVNx+`TYJ7_b81kEM3L60>heR_7ICgWa ztQ7&LY(6E&&qBZ=9_5dOOfgVh#7w{xR!t5>m-vez*hTQe{)I9tVp7N-^!$7JPaW=A_0~fQ06o1iU7zl5&!@I delta 76 zcmZo}Hk@3=9m;RxzQ)sYS&xS@{`xF)sPZrManjCB-rBnI#^j fNipH6NzVCsB}Mr;F-eKZ+37|3rFkha6B85x+Hf0M diff --git a/background/backgroundTasks.pyc b/background/backgroundTasks.pyc index 953f07ac60323a2c4775f1e8b7b81f68d53c5c15..0c224f39bf3dd5e5970c530e3ecbed083b6fd042 100644 GIT binary patch delta 257 zcmcbpa8{n3`7re^G&*`7CTFJ?<(KBA#7v&ZFTB}+V;wUEMlkZcqe!>#WL4hz6q@jh RcPE7=yyR=8z=VnXHUMC|lk@-p diff --git a/config/__init__.pyc b/config/__init__.pyc index 988360b5154ecab59245cdbf1c711f23c9dd779a..f682e6186a4977cdf0b3368902f86ff6540e0f60 100644 GIT binary patch delta 79 zcmbQtSj*1*nU|}g<=8}aGY2&W1_u3%{M=Oif=vDL)THG6ypp2)9DN|2mYJ>}AD@|* dSrQ+wS5R5P0aR*}o1apelWNBZWETT50|53^7j*yt delta 71 zcmb=O%*f9CnU^cad-p_kGgBJ|1_o!Vn9$JK;wx@oBa7eVVLKQUZJ$e_vl GjWhu*G~v1c delta 1074 zcmcbU^dgm=`7>oULL)i&Kk=W3uuy@?u=_lS^|`^Gb?i+%ro& zN|R#3Qa-_%yGA+#zl_%5E&CA60k{e1*l0xKa-7KxlLZ)B8%8Qa~tESRPa)U`w gMT}fq-P9g%km*-feJ(N`JUP!`8F`jYHa64*03R5Gs{jB1 diff --git a/main.py b/main.py index 0a796b56..04a8f53d 100644 --- a/main.py +++ b/main.py @@ -289,5 +289,5 @@ def default_error_handler(e): if __name__ == '__main__': app.debug = False app.config['SECRET_KEY'] = 'secret!' - socketio.run(app, use_reloader=False) + socketio.run(app, use_reloader=False, host='0.0.0.0') #socketio.run(app, host='0.0.0.0') diff --git a/webcontrol.json b/webcontrol.json index 99a0077d..7e90a57b 100644 --- a/webcontrol.json +++ b/webcontrol.json @@ -546,7 +546,7 @@ "section": "Maslow Settings", "title": "Serial Connection", "type": "string", - "value": "COM5:" + "value": "/dev/ttyACM0" }, { "default": 2978.4, From 90f1fe8731baf3a01daed7b65d244cb49e46f356 Mon Sep 17 00:00:00 2001 From: John Boiles Date: Wed, 17 Oct 2018 22:43:02 -0700 Subject: [PATCH 002/685] Remove .pyc files --- .gitignore | 4 ++++ Actions/__init__.pyc | Bin 126 -> 0 bytes Actions/actions.pyc | Bin 11805 -> 0 bytes Connection/__init__.pyc | Bin 129 -> 0 bytes Connection/nonVisibleWidgets.pyc | Bin 1462 -> 0 bytes Connection/serialPort.pyc | Bin 2260 -> 0 bytes Connection/serialPortThread.pyc | Bin 5497 -> 0 bytes DataStructures/__init__.pyc | Bin 133 -> 0 bytes DataStructures/data.pyc | Bin 2307 -> 0 bytes DataStructures/logger.pyc | Bin 3054 -> 0 bytes DataStructures/loggingQueue.pyc | Bin 972 -> 0 bytes DataStructures/makesmithInitFuncs.pyc | Bin 539 -> 0 bytes File/__init__.pyc | Bin 123 -> 0 bytes File/file.pyc | Bin 2469 -> 0 bytes File/gcodeFile.pyc | Bin 12499 -> 0 bytes app.pyc | Bin 633 -> 0 bytes background/__init__.pyc | Bin 129 -> 0 bytes background/backgroundTasks.pyc | Bin 4045 -> 0 bytes config/__init__.pyc | Bin 125 -> 0 bytes config/config.pyc | Bin 12636 -> 0 bytes main.pyc | Bin 4280 -> 0 bytes 21 files changed, 4 insertions(+) delete mode 100644 Actions/__init__.pyc delete mode 100644 Actions/actions.pyc delete mode 100644 Connection/__init__.pyc delete mode 100644 Connection/nonVisibleWidgets.pyc delete mode 100644 Connection/serialPort.pyc delete mode 100644 Connection/serialPortThread.pyc delete mode 100644 DataStructures/__init__.pyc delete mode 100644 DataStructures/data.pyc delete mode 100644 DataStructures/logger.pyc delete mode 100644 DataStructures/loggingQueue.pyc delete mode 100644 DataStructures/makesmithInitFuncs.pyc delete mode 100644 File/__init__.pyc delete mode 100644 File/file.pyc delete mode 100644 File/gcodeFile.pyc delete mode 100644 app.pyc delete mode 100644 background/__init__.pyc delete mode 100644 background/backgroundTasks.pyc delete mode 100644 config/__init__.pyc delete mode 100644 config/config.pyc delete mode 100644 main.pyc diff --git a/.gitignore b/.gitignore index 1026c06b..2f10bf7b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,7 @@ venv.bak/ #logs log.txt +*.pyc + +# IDE-specific files +.idea diff --git a/Actions/__init__.pyc b/Actions/__init__.pyc deleted file mode 100644 index 961b1d09bae089c30d9e5d3d29c61e71b6a206db..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 126 zcmZSn%*$2Lax6NT0SXv_v;z#pN`FX|q@$s2?nI-Y@dIgmw96+@;x%nxjIjMFa6N`bE0RUYc8Danc diff --git a/Actions/actions.pyc b/Actions/actions.pyc deleted file mode 100644 index f9d33737058a264968647cd55d15eb3822dbdb57..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 11805 zcmc&)OKe=%c|LcB9Lh63??7i&B^%KrsxlJMqpC8h+^q5}wPh)HM18E(6Q%A}a_pj98b$Yw|HV(q0u>xV zvR1w4=~g4yzS(XBH+t=wUJnkT{LNa>=(Ke_MK-vKNB2xidn{D)*QWbIP3+VqUp(LL67_ybxbePPud( ztF3YE89Zd)G9LXGNculg50%=%A2?yDdl}`QA_E>-s*UAlNrV+L>Y=5Mg_*2m>L`=e znjBrZwpQPgpG!-1WbyOK6+MlAZ@TxZ?V9J>WiJRC?Ya)Q^zBZ|yAxA)OGT6g zBS_q8P?ho?Fr=ku_kOi0M4!YMD%EQp*DG%~wt^ssY^~GYYSe=~NbLpRsy2IGkYy(D zgF;mOMx*HkhmmV`s_xrejN?fW2i@?|g44QDZECN?^~iwQYi?n&=&4q1dN-=IpyQX2 zRg&lzK%M7G&UYK?ZEqFzrOR1%WM!=*Rw0wK zUa+3W@068CiGYL)h(Yq7$n^g;+DJ?7h@fDnEG#tK&Jnc(8Nmx|VTQX%(1_$7dlVsr zs2CM|wWDUHGn4}-88th{PTMEjzwpp}G+%|_(5ljdO zH$UikA=OLPr#*j zT%~^F4x}~S%>2M+2Hd5ElE5~G{|CKB?Vf?Z*;H0?P#Oh7s@J6{y3wrG6VVX1iDpR*-OaY^ z?F#S2s#Uw)ME}&P?fX@2^vD;KC1OqoRX=cg?IqH5>B!ci^&E5r4O0=nH4eik#-6aY zI>6e5%@JR~V*n6rqNb0T411KqBmgP=OfU&swz4|ZE>NGX3s)T*q@F;sLbt#!0~cM- zO|-Q`JMB=xI15Zf1&K0xmf7c+oMw`!IuRVoct!q86<|2MQB-oG&7pOl=_mZ zS;nJ3M$+%?m1D9^yupxhhL_^1MZ7dcBb30`@K??QOj7-`EQ@al;}>4Z&u-JONt>LX?b}Gr=(A5C`kx zH=TCM8*iMojW4F=mjn-|Pp1$N@4NWv!M5*JU7Qg_3vM)8o-dTqO2a@Q)`;~E1_v_f zL8I$kzkb_!YmM3@WlI*|8pXV$LZCJmA?09wob4hLV)Q>070$)c5ec4A+6JJ7*%PP) z`*yXbp`gepBM73PlJ$K-?Lz_UatMs&b6m=lQ9miQGq9qIsL+3LU`65Xi**duHqJ!x z`bG!W$KJ$E_^2d)E;q*L-33xl*XyGr0;K;gO5_esSA?F}gWyts$??abbulvb`1K{{7;^EkCUw%Glf;9}oyBvD_FX24JCf4B zJRiv6#Sz7v99j~1lCPqZov)HQf#hJ~$0_+<(DU0Hon@~bc>ecLqN9WHQ7bu}q_%Yc zxX+b~^=iAsqbt-;eX`cx+3=B_Nm4f#FfVkKNOiiDG(V8o#Odt~~5 z%h}_EzWXN%6C@Nx;{p=b-upxKZPD zKOXj#RrBcnb{n0WKEU-8gMFBiPxmo5*vAJa6#m|U9zdu76ZHR@{zlpO#KwVuMcAwN z!~vF2k!X3Z4Z-yheleaf5%%F4Y_b*?O+qv@(c;V{uCH-%MXktDnG~y;5Ru!^=J4I1 zuPjDG`aBpexs&k}DnCF@Qy8d1bJjCJ<+IiZ(lb^uGm;S#!JTC*&PvqH&w$eYPpmx~ zijC%0#QTE%n8WU3v&d30v2!b{;4S>#d)Sjz#zo6`5$0|b1wyljavs_oQ|$r|Mmu9H47)%B(?woA%)`+~;@_2i5OvI}CpZI# z{a`QzDGO?IJnCm$VK#{Na@uf47;!4V-$gDbxs}xh){SY8sf#E=_~~M}JVb(v>f$3z zXF}~r5EuXrCe_ZAdWcXbMC7o#h(Itxz)v!k^-g<24tvu)iA)3C2zAGLnt5(fiDxBq z(i2;RV-(^(g5EdekfQ0n%DK)IO0AdeI#tCjLB<}D&XnGL>6Q1cl-^x@ z<D>&X6yiIdkQVRJ;4jtI-G8-H=&a7B%#;-4C-4PbUs5fLo9~234utyB*zN zymHOcx>^sVllG@wZF#y|t$EVXc@uqGUSHNPibR44mx&EVybr3jlI?J?Y8&8 zmQ~wLEV6VI4de{l^xDSrc@ZV%XhtVRBFV4_)Cn2^gW9%3dnEa~-|2O=bB1}=?fTyR zMyIE5cl4dT1$Uimtj0C!PVJtDWyxASTuunFqYZi-8M? z>!Kbal|hvyY6)6rMx+m_0wu^w4$1@nt@iIo4><`r?>W{UVh?-ke@E))rT(7}88NCq zd^B5H7o_!1hqQ(|iRT;5@IS;Vj!B!j=rnE4JhH}U#Hjv{rT)0oe{V?r^cZHA>5{0I z`_fBMdinjqUW6~h+FX@36Vm4I2HOnGbpKI-=wU8A{jhZrvR?O=w-sngJB}K~ zG4b%YCMq!T1HMBsdW(JlQ~=EXaR`oBM&q!`>56eNaRMN0(e<2pAyyZ*nPwKo8-9Vg zyx9?KqfU+yGnitLwWEWjVQ?oLHjkl=VEpA^wJ~Zr`Y9697vUWbh4*SaX|^_C{huMN zagQ2zV3a}BgYjq6i#aTdfgEDRW-+e`lt0^IhTRYm6YIv8q>-g7Xg0qh;j86N3pX?A z`$uk$+%8re`fVmM_38yXBo=L_iedxVYD0Si_^zbjPi2XVD9?{YL@s$uS%Y%JqHyJHE(FYhYUNHRBaKUBia$36lmtVNx&)g+|KkTAk{9Ex~ zf{wX{G=T=XN}rN2L2D!vSL)xL`O}qu{_y)(68U-`twhTPowYR)!o434{L>Zj6IWin zAo@KTv|^-zav}1`_7(Yfz=#;d#6&Md&ghegrz=;kVNXpQKJh_9D&~<`6{6jQo7oii ziu__hMuL~z^Bl6_U}DHvgYl5V?;vuJC;d7~O=PZ!gC)NL;03`6q{H%2`H945)E)!2W+1IJIYuPVNp#|i#4p`1gc5ei zcx*q6Ml}s^#DWB)_waiFHg7Ks))^mCC!D(Jq$olU=*5SwI5#D?bu z+u{|-<-zSnP}?@pe0+bYLH5Nr6FA+4R}636_xy6#m!pH=aHG?WuQkH^404^f9JgKx zI|u`6#%^?aZCB1NDb@drZ#oj_(L>VF=)|Gx)qM|<4!!^_AGjP0g*-R`)zRAY^911x z3JJn*0(z&c)0u^RuRt!LV*hNYow!Su+Dru%=*Wa01|TXF#WLfF5RI*gWnRS{`YjU? zqD0}SOm8rChi}X|{nD0K)ji*HJlrMgV5rby4Mu1W#uF|dJoy$b8yfh`=gnTwX;ndf zjl3bl6pm4ou#<75hYR5&cJVw2_)g%)rtx+n(F@})kQEbGHk@%8Eg0m4BmSYPV~=zqJvE z;TJQPhhOwMuq4XSNJK|C9ekR{587qHBrwLEqS%2PG;K&q&0DzW!~`k0vInmu0tNN@7b!81xGm>$82X=X?)U zSBa-nAe012^7vNjRAvk}_tVxi(otxH1^m_sc|KV@g0!20$WavRD+4nJjxFhjuaLP zbA{Q$GsyAHNMY6(t_8HchL2Utf#0j)4$IT$TA%v<*+C@}@zj0oTtLQIWeLRrMrPaL ZR1Urp*_>ZD+wpaFB|A8U5TN{K{ts=GFRTCn diff --git a/Connection/__init__.pyc b/Connection/__init__.pyc deleted file mode 100644 index 1b17752fbde9b8afabb9966f894e336014620ef0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 129 zcmZSn%*$2Lax6NT0SXv_v;zWU9<`3)0?p{}xyN z3uk@+*pqA**c&3#acxgx`}^!9`Eh;x`TX0*9J(u^|0lFvMxvl!1O}jrAd4VkI|dU& zl|YuXb^@jcRUfi`Yxlqmpc+CpB)bn7!7_qk0OtT_03WggD26bf98h@uldefbn!iKh zmHLFP(!P9IYk#z@bJw1Y>1>XTR_3*BeCr#L@5P}l@JJhMT|;s`&Aqm@^S4Pqw)H#h z^upkKU98Z%Jx0#>jJA6~0)e3svMdHnxW=pp*bmA8a2OOSI${Lb2-5i^=4Zc>7>@;A zR}u;Bgc7B#P%LdDc5QmGD|KFq!iw5@QK}Q9n@-vaMT46L9oAkk0Ache46%KQ!UgOi zw{?vH-+i&z`YxRF+89wI7Q$PxK;bp1x@LQuV3c#B52xRcA z5=&}*V1a1Nl`({8S7J?UwM;U-OWhEzyg}t#38YpSm2*-WMM~hh~{_$O-LMxQC?8 zc;sdqJ=@`ero}hb%ntWcGpql8A*P!zDW~9<&)pyaqfv4#;&qGGgzNPDqDon-3Z)E{ zOIg`sYuMykr7UbNWy&vAI$*&wmGV)Vu;2h8&1JPg`{$CGM^5CpzQJG+k0M&}@r1GX zdn9;_=DykHeoON|t*(4nQo0HJT@si4OfOp!z<6eaKQGgLa{@GfllX4-YCMaqT! VCy;^mM=jBhnOes*a#v`@zW_$xWs?8^ diff --git a/Connection/serialPort.pyc b/Connection/serialPort.pyc deleted file mode 100644 index a582f20d00873b8cac9d6f0c24204b09c028e00e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2260 zcmbtVOK;>v5H8y@lS~vKi-bTRq2@M7(L~x42ZVOXY8MV0R!)S(AYpp!p121;M(*+^ zBV|w7KgNX{zlI+GU$vb$0WPad(&chLs_Xme;pngT_AcN4@pDT3FT(Q)hFe2q_z$Qc zDg#;s6v%r>MMz~ti>P~#s2I^=3#GcvUximN!OcC%kuW_7;y= z`xe7JhA<>BfMO8}Ft`8|KqLwfL|%dWBd<&-KAnx_?4J;OdkVj^+^FGhWu4NMs+Vh% zvbxA^nyXS*`rJ5`)@9jNHq~tFN?ibkVjRxQYnvKXzc!73cOHn^0Lgr~LZ{s70ye4& zmc;;WYFa!hrIj-q-Doy2AlTJ%D_+>jv984S3VQ}8JA!&A`#VyhCB%^DF@_WRK*<}> z6Cxau%>4@CQ48|8t(<}*DXtWc4wXxDleGn~3NTl%_(C^us#coWlp7Ychajr#Ds`IM z%5+G@tQ8MVW)L(Jhj;|xOtE5F*meuh$Q?o)<#lO}HumVkEMb|Ox;Q$%CF!UmQ?g>d z+43$9B#A}xB*{l&LG05`Dvz7tv44sQV1M!5RWGiHkp9VCE}mk~;Po@J0t(lMT!MEO zolgs9Ks6bF569d-thAd5=$IBC4LGoMf2Xrmb#$&RxedA~yG`x+?qR#i2trR>E8PB+^_wQN~gRxYpG zB2%b=tyIa09=`KHfQxG#0j zWwg&^gwZXCL+QA0!aj^wAtgW&(HgA}lOe6g*bpG{$%Ft}QeZ;KZm+DTay+PD8U5FH zh!gh+7d>TFZ%j4Rp=XAH)$mOEN=KKpZP3*>v{Phz>tZQ#o{I3T40QX$UC;789Y#tC zHJ-jdI6s2eQ>yFcJB)Yz-9s~#BK7xS1@E?u89en@* diff --git a/Connection/serialPortThread.pyc b/Connection/serialPortThread.pyc deleted file mode 100644 index ad1d589881d2065c6d40e6edbbb6f6cfece87190..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5497 zcmb_g-Etg974Df?$?r{Q-iQXG(JBQhZF4H)BP?Yvzuhele7Rblq4gAb52CXOu z#Mtzeh72{OC)CaaIoh10tl(CI=P9M91z4xRnGp^_Sf*ql)ii<488Sevsd zIU$fa6>T)9c<3caRj-Hm95EQCCbT_`9~lh~dTFN@_ToIrvt@)GJH0g5D=$%nwxELa7obA&og&Xciu*yEpgaU^o$hNRdkG!Hr2&3l z8xwc6SqUHZw9(_|FfPd_b`D}=G^i9pyC0`HCc^)I8atSy(S}8aS`LsIdQNh3vu|KAkC_s zxr$vm{IuFRqju)$lSeZ0v`6_n%JV$jJV*?F#)v0gK+HY$@o^Qm<)S!0ZkcIVVMFIh zns={;hIh4|Vo;XTi)IodmMzv!VtP=fR>RNDP@5UIl!U9-*Vb>}x*9gm0%B=eoA$Nk zdKMe|hERhx9c5Uze_By!WX&W}~?8@#=rsLAqkLcre2?z0D z0A^=iQ?>CUBD`ky?gw-gx(eut_sU3mC+ZU7FSf5i#&!XeHi9%fR^h zqRxX#yQ}SLTJ{eR-9FN#L5N%f*pM&fy)4T$fXA{x5Z?dh2;!?9GH1nBV+qVJu%2I{aQEs4+mN+1@HSBvFHL&_k z8jSP|L~B7P2B?V7jFM`i;avz`$DM3=4d=Ox8dQ#$>_0FbVmgAfyMi?UI($IZ5LRxKsx#JqnCl7*`78s9Xy2H39H zdqBfbW)l8P@#LQy*z1U>M0b;GSs0IznOAsps{R5mVMt=BR}5_zQ+)n-%`lyl_Arn4<1~x6GKA_9M}Q&i- zegRF)0KHu(IeMm!n1-0mz%A*s*qy1TjMb9AbXgYVRa|2nV3_*rI#Vll9 zUPzht<-nsVDP--Lg!hNmuyp*Yg}OP16YjbC>}vSo#*O10S5_FyW(orKVuM7qtFyzf z6GJv>#YSBmlTua`Xt`4RwgEzxZk5vXU9K9#PMo`a6aXuoa7*{%{j?}o!Zk|`qNzhk zi1gt4Dr1X*G-QLa=$3K+G7$R3zVvY+YG@c(IzL@*7iC{CJ3aPu#|{s%w*%2u!UrY( zg-`%&Jp_#+1gWx2kt2l)@o?_AL+uRhiunz6=6D+v#-uc@?ZsBks$9=mQ)lQvPDZ5nSkX!d#wBg(P_Y3{rV6@;Vs%W_7+Bp-9;Mn3Y#-ft=xc3sqZ24|K_AFZ3olqFKM@&!ab*_a^!EXT2Hu z;(u+{Yxs4q?oUrl0{@IRi|;GgQw!enroD6CYg0>r&IjkcCG=YJ=(+;XJdOPg|GYOd zv5Yh3QR^+>ga)9sph-oG5!>xN?(242G~90Yi)5Jbk@2_PPKr*u9nq_ueQCW&3S6-i zEgdlwI>U31vt!5^{YI=8{S>n!P0H;5Y&#?R6%B8eFicKOPEJB3stnDh-*{&_n4X-T zYffX)Uc|tDeZ!W+jvXQ>t@K}dO~|sC1=LHZY`Y`ogJ^{VB^PJz6i90Fip)6C$ XoEYQ>&ICW=(T2`5hn|_0`dsioh^fTF diff --git a/DataStructures/__init__.pyc b/DataStructures/__init__.pyc deleted file mode 100644 index a0cb845f7bd83565b7a484915b65902ddf3c81d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 133 zcmZSn%*$2Lax6NT0SXv_v;zd{VKq+c#R_fI%8EH0} zkuO`kB|iZl!8<>|XHf7Bd;oN}KUbDcp8onEg8FLG_fvW; zOJaIF&;S`g2;ec_0PR86fUr^VP0&rq<{+G__&Lxm$l4ILE4~GK9>RHu+Ym26JP%I+ zo&bCo64Qcycahdf|Dvnw(a6m)Ni(dtHgR8?B*CKMJ2ju?$=4;87f?GUAEn8@=zp%9 znhEGLQnTNZeWW-%4vV}`h&F}Jaguw#1!3<$d}pY>PZODnPpcv z$nX*e8Lpne$l99dUIu)DBM;XBH)L=H;uQ#A6#9~^^)lcq5MGtluL*rs=xZW>U64NK zF?<7Ja!elfObVRg9%efRci{`YOmS$_~2ZHkXSP<(%%Z2bJiAJdKBwo~q={C-6kO&x2u+R zl|GEA3PeWvr{+9waEp4>B`gTBH)*srHW_YB(ye1065JI=Z*dj%T~S7^EYNPTx!&Z| zEf9P#NXZ$ZG?u(UyW{P5?-E(n zVahy~#V^l@4#{cCsav0s?y0;~I>1C6+EtpmV{HZzU|gtUiKLupqvBny62Xkp!n#8` zxDSkdCan98QrV|UD6Qjij;Ml$g_O{}{Gc!qMI;ufBdNML*^-74ZNLuKw&PQu*QHjf z1RM;dkdmK9%9)~)vhgaR|Cr$PP7g{umStr0jbwY7Cjx41I#9@OC;Wk#l#^WqaesZL=?A7VnU`m64q32EU zUpgaT>s%A|K9TkU-5%YIi}$Lx$}+D*@1nQZ5QIm_3e{@Qw+TUatDf=Ntq!3(72l{l z1$TwWY@hb36F@4|UH$jzv;X&bLaQU9SAD9Q=4O_V{$Ez4B|oZ8fKRw>ET0K$ JUUhdGe*=%XA$tG- diff --git a/DataStructures/logger.pyc b/DataStructures/logger.pyc deleted file mode 100644 index ebf62f735552901a7ca8bbedb3504adac68b6680..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3054 zcmb_eUvC>l5T89ecI-B#EonnhC6-bYBcTM!15$;cEzlB)rf?3VmeV?9Oj~Gjp}SR@%p}{`@tf>Q}@6dl)W+ zh>3cTisFD$MdN^a0V#g2QCg#3P4?=P)@fX)9^?}BmY}gjHlP9Y8uW_jCDAXv2EWwp zG}-n5qTSvZB~Fj?c$!*0De}W4woV(J=EI>a^wB7ZMmjQ?-m`k@Y^;5*3mfG{tW6f{ z)OctWc9Iuf`;paS6OEG0uDkZ09ht)qa3wz9-OoMw^R z?gYHaZkx%(FXO+z1$|kOnys{4=~&@gatf`hL8bSz)_d^lEBs=+pLg# z8PM-nsJBdZnf66mrD!h6ZDQ?Qj3dPGZxkPbGCT~&L?X+>Y z#~{aW0^*yFwj=h3-QnARjp1-0YZvQuvP!2!`-)B#tzp(zwEKLWlv0pSGpGfX z!b`+X(LtSx-x!?zI#Yn(g?F_|C$7^VfIGp9fbE|K)NiodZ;Fp_syqUA!GkLFf8a9h zwyu7=MdBssW9yt5TAgHwGDj0m&DHKleri&E1nndnYS1RmGgj6{J3BE2xPZ3`YlJ0P zj@P3DJ)MZDpSD1u$bdt7kbrAjPhjEf3P^RTl zEQbsD4hK_CaW)-zj(By7MBI0ovE7^`n@4spf}J8yH@`97bbT=ejD>ZZ zWrl4`PCOH-Iv+&8fhV^LK`RYaQ>z%w;9787wNzUPuh?zo)guh|5d`91mIo&JD!l+V zz!o7GC^X|aCqBO_ugrnoWhgnVtAI;*=G%+p4jK9?SJ_fNv02FQi{0=FW`c~*#c0SV z$pU<3WX}OocnP*X!*J|5HLt3-YXZhB(Im-YY;k@d&u&%uv5&L>9*TejgMmC?jXEb0 zB3;dqEJ(C~if6O;%gM4N5i6A?gR@8hM?Tek4lxHxTt?~4v@MFf(1#|SzMe{`gtL^} zE~^K}x~!(4ZdhiSlT(xU7_WP6!!;SHhuTl*e`}i|uj9 zlos;JnrAxUwNMH-j=Fz1lrub|T2}AblDJlelA|r>pCfK^w2)g46i;??(EJ{ZJ7zvL zTIxn^oypC$lLwbI_^{K&AsgUeDW`x zbZpTZ}0pzxW=$2b;TmXzArr=_SXK7bKovVNyDX>V%A2>~z;& zpkN`K*9L%nhuK_YB&ZJ8|BQE1O5g-PPjnhZ}bW@CIFByxrjv zB`NBrVT=L}x3$u`)WT1`XXV2Eew;^e?R{v!-fuU? pZ+vxzP@?c63$8jLhffYX@2v&qFG^s)WHPvAh(>T(T~ya={{V@Oo1_2$ diff --git a/DataStructures/loggingQueue.pyc b/DataStructures/loggingQueue.pyc deleted file mode 100644 index 1f9e5993d97c22777a464728f1c68ea8b3e9961d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 972 zcmb_bJ&)5s5S_JifiobbrrHXnKo<#Ggb+|7B%Esq#mZ;z*&Eqe%R45VbY1SZ@rU>U z@MfI=5*=W9#!ve(Z{C|E{q`vPa`*L9NyjI}_Z1>MN2-W6$cn0jT1B0rjUrX0WEI(j zt`n+ebVqa``nXA{I-~V+E|)u`EW2!6(4DWw*6M!npIv2xE_85RkCmdT96P_$>@_!5 ze;Dm(pXz<%%0}ZNHwA0Qy7hI)`jN5n+d=KR&Q`8q+umGcnfs1ssX)tTNU;__1bXM| z+U@GN@KdCmdyNQ>kt{?)A&HO;6sZVO%Gb*T+odE4apnyoXrx<3w?qbXiZ~H`NNAgi z6AGo)v6c7B8IH0z0ui+xVsByW?U2V-?_p#3dgXi{{*grSJj zlc?Eo^`uGsjqPy;v>zPXOAniKF=)~y2osBvaygG`L|v%=UC})hS|E;!7HaZ%a&lL6 z)|l9rG1Cvvm}o*S_kOWQ^tYzU=pLL}n5*;Ian3?vOyx^(0#1YXS6f?hwB`TMvq*h0 PiF+CUY%<$xmuPGxo;si}~~R?XIBD6XSad^M`;EH>Oh2mgtq}HbWdys&|m%1Hg6u=zLT0 z`l_w?a%>C#O{9=MgZX`cBg&M}fhdb8NwuVl2=Ha+Qo8_b6m5uXP@n2np_)at%sJQ6 z5+d*FheVh(Yy!W8XVzWgOkbHNcVBcZ4_$38(3$cu7Ca8lo95T#NBs-W(Ci)G^inNP z;YEv-7N7S3*0y=$tmSzKnywscgozaVOcA_4jgo+mWVJBCZnT=nLK~G{(#OaY8!I64x-3F^VaGk<4h-VRx z-UIs%fP(ghDZR)-hp0hRv9s5~X!+5>tZN(#bLp)^UC0hKAQN@5lpG+S(-=?<@%t(&Yo#fk=*!^}&E_AiR}oKrn#V}xtL?%VIX zXZ!9v$ulI+G8qPKoCG>Ya;6XJo&=gDdA<+&@g&d%k{|Rzznuiac3W6(a%BAcM(d%EyjP=kBL2m_$`!o3{_Aqrv><*kJ zd5t=#C5-5UJf#OtXNVf(EMtN&69gR+Z+MQK6)IFN@oAMZc)opSRY}Vf16R z#+okxKZbA)LSgIH&D-0>!q)P}W_jiD($m%LqBo~Ghri(YpK2G9=gr$(p1mR-$X7vJ zRnl8m#)NTQn_*x~it8mXDzujm-xD&dheqoOh=r~Bo7?w&Ip>#r`Q5@NdI-jDu>eak z%T>R-a8L6sv*FoP8&=uOlufIYGo@^ml}uT&%HvFVY?Y-^U$fW#W9Xc)w_G&+t!Np|+?hO_NmrfT^oW>!7agc#AV`C$E zZLPcqRTCz$_U?J#aGvFxoTxAZCieQ4fe9=_OTd~qmK9PJNL;#T3}txlbbH6}Zd8-F z7S_!;#JV!Qt$Q9sZDk|rRumcwjI>F^mf;;rRVxar8K4>^T3NuGRjf>#5dc)&ZmJY3 zvJS0+w7P4>pankC5{N*IgN1t0hTzt!MM;oltEWl3rE$RV%a;|ovfox9#oSwMW7F7W z@^4mwJKQc)tEguCj;kLBO=a>NH;jx**<{r;_%^d-33_rXNVSq{wrROpU)ut_`8w3b zN?|P3YnvnrV`aPXO#wKvgZ>QC;vN5)R;l(I$!_dFOsXhDY_z`|nn&#&|ApFFOk$HJ zk-r2kJ`*an4$Nsx#meQg7Isjvi%IC`7)Xrbof8AX72}Ww#M%Daxh!Ud=S+!9;)=L_ z^mZ`A$-CoX5cVmIV;Jv+ww!+ffn)}Z diff --git a/File/gcodeFile.pyc b/File/gcodeFile.pyc deleted file mode 100644 index 681b8ea67c8e0c7a8a1ec1832dd3c7befeb4d300..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12499 zcmbVSTWl0rdOlU{TN{H72Fz`SVrJQGGhi?zb75zenSsH8z(d;X0>-RUbXD7By1VSE zYOsl&Y%&uiQWRyP-DtIW%gZWxiNi1;`Pi6`jJZ48XM$c6I;QHFps$^aDz2F+ z4PeCR|L|9G5X<%;xZytx(|VLGUTs9##HzaBNhHp#60KECO01fe0NAQVG_ z%JPgltFR8gF1{D>O-l$Cj9E8kUh`zcHCaJ9ngw$(1p~_1a=O%qFk`SBM~y5MA=7aq z%zBYmiEDA9*k!+#hN>6%>0%hDUbeOz+G&yeG^|xgfKiYhN9^=sTn|q#N2ec$4=QmZ zOXAw;%TX;ny-5Th=gO|w#j+c^&eNM*SrY`2xwO50MT8+;Tv8xe6U?e0I4@eTYiY0Q*KFR|G z265_%!X^$xjnjskX(5x?8VGR7t*Q&H-MzUAKX351Oh$@gA2}+qu znQ^t^2U$OU(y$TCWJyOpUO+B)seKapwdhGGnfMBGNT+co9PwZXaqb@R;P=51Y_KJ< z0SvIyp1Q)kf;kHoKtvu6nB)ycY|VLawAak6?J8h*v4(3tLQAn{sh}2ND51J*2DgK8UM1|g z!>vjMw`*SAgdZ`%ORY*JRtjG3hzEGs78UH7rD5{H367eDwhWDsl^X+Q^)E~Yrdtt& zNH}2bpPD%^yJ$8BwL;*LXVwQf+QtsEzQZJ+xa*LlQO420$@Utg5#xgQnB+u({p~Z^ ze&z?q%)uqF20QeqIfz<$_A6Vm(S7=kTB7lYx`(9gGzU1u$~%RXcefU*;1hS{6ZiJ* z#!2HiPVlO+dk0+{FiTKlUlE0!y@TPgckYnDL*hzyxHWsn%pWmG&Xfp5)8(BAGisY8 z-GOkfRJ!-=@%tyn=f+d!4l4KS$ee31x1nu5*Fa=Hic9y-oOed#4sDs!e~S~X$_3yAAwT1M(m4a#J# z6g@jpBnkaMsyzu|(LfP5ABcf4EUM9hI$H>{Z~3*RHD1!?T9m0qEzOc>S$L3y%Qe4} zTQ{{hw`rc-h#!TiP$q0N>tTWwQp+^-lggr^{xS#&G%_ewXHj}lU69slE%xnb3rXAr zc2VH!mLc;i%@9P9=;daXQU03Cz_oCSW{@U#D?tU?9_Vw?Z!CmCiO?cED|1<7^?+Gf zn2=>kCjMiaV@J#5%YKr=KqFC)$c*wKHm8uUD)Y(pD9sd$8bP>f8PDP;+eS&uJ@}?( zbQ!deRAkiQ4v zPK4*3m)w_~0{R<8FTKtndaID5t?xy|Q%w~h49)0D*HAUU@^H;Vr)_Ppg%-nqkV+cG z_$;nr-LYf43<+|@7waBuhd1SOXb(%=8keR+Z`*2O1*@*1)DBuoNj#`7n7x=o9)ne| zw+hRE$CUym!Vc2+5Da?x-+Mve`JRk;FN?iwG4yC6d6j08KwN8U-h&WY$Xl+(Sr!KE zcG}D>!|%t_>RBRDrWIA5L;y&E#pgF3`RPo>uZ5TWN){&_HkB{15_z?@9WH6-`ay7$ z2apHoMJmbkJiWTw2i>bna|#f3h@;OyH_QY)*pTq)g;N)g{Odoze&~Xw^AhsPZ!zG$ z=+G{OvUa!@Fj__CLE@Yl5`9{VXRIrpXwrm6gxBx`nZ5yM?U@Q@7tCwJDg}{ z7EI!4HNSwYXOjWXz$RjI#&lDLEF1`7%4IOtz-COLV3l0aJnS{e=Po7cbGK7Q;;}z6 z7fJ*6UjxU2K}PIIo0$h=u$y^IJeOHG$y(-ZrF!LamxNn~1C~>A0~drPX}-Yq#-U=S zM089)hRzslYoY*fMi+?3ND5^p{nbpVwW!XPlkia#H&d??*Xw=*>Mm7&n)ykVYd&VP z?&=z9#Yqq~fU;?Oh-wnoRi10btz7}&ZATN{E%YJ+qSQ;XwHge$2R?AsiyO9woCxSz z?E3g|dyGd>+N2)vf~Z;zse2=z_8;_b_Bez=)QFS1U-L+6;x9*mSEunY;a#n&<0q&5 zRg4*g%h{rbNX421p5Gp!5+#*d$THb7U__>twHTIV1o~pzlkLK`Cni93gHdEpGYyl8 z4(HQxti~N{_m%E>uzxT7Jo68gt-nC+?ta;Js-0VxUp$Hcdg{y>VUY!?Kl}mz{^UYL z1uvV-a$;H@3~6^E`RdI$jmQY4);6V{v{L1-qLcC&2EV}I7a3eZkkRgfWf0ezS$MhT zFO+Yvh~}x#P#&W)E%P!JeEAv!dOw6LWdco!s@}RHXwogvokYo&(U?oG;;Xm(1U9SU zYhCdtHZEW-Uu9?SBM?hqrfBMkA4E+#{I=z9Yi%~{N0Z(`U z*z7QS$Iy&Q8xBZY{$~#3UFE|f7nA^h`^{0%h*HAvf3PQ1X0JbeX0O1@jSBP=Y%0XE|sFZ`}F_8y3yVKe)H^8dzX!wLA^E zq^pgzC!Rvu_mWBrXd505xxj=M0NRs+k_lszdBWX)))8?V)qMtF7) z?Ll%RtN>&IXdX=O%EQM|8hUYp{+i4^RcU8tiT^095jUTO|#HoHEe-_9GSn(EvZ!-86 zgWCwK&!r0{m$t&B4xy34rSfd6i4~7K7JVfucLkwvv(&=LPV}tog&<18imV5cj-7EG zO?c%*v*N>saGXin6*jr8QzKbI5XL_I5uzzhuErEC2KPCA!e07D`s5*Lhwfo`Lw35J zbEs#?*$Yp|-k$voog%y`d(n=FTy%-e`+?4*K;?bTVSGlMJ?@ALJmxvQ^%Wk|SfM&G z<}5Udmu@ujZp-)#a6CNhuR&OsP!iFRcJJ_lwE7ySCIn~0aq<+IJdz`r0ZO; zU<~&*kRj;*j`0CSi}T$}4)byAhksna=;{XYgQEO++uJrr1n#)wJ4k)ce|u+Ry9Kts zP+LGdj0qg^eoO#{%HI$BsDX>Ze)4KtswB3p>afQr1s!%zZWw+Ma{0JOB`P@nE3UZ8s0TOxrdO{#*zB0Zh2q#RFYg zFe~Q)y6oZs&dgY*pF51@0jg}`0eYLc-8f=;V3|CGS$E0h#l#>lCR`iL+`-nJk;y+@ zrc!-D;NVGk?i9TKa}(=u^oOT(Rbe5BYIg!zx(GOa=J>?%v?|s9f^b8!beIJw)&iVB zGn__s?hMYCcA-%2;3hoWNf!oujRge+aGzVX-Z?4J=_RcwZ~e?-RL!LH)sar*YDted zH=VrlAMm1}#H4j=Q^o7F6(_g@Y4|njR_jb8IE2$#;|^pEF~Lr?p54)5NMo?{ZY%%p zwsZwG0ngqXc9fcer$OWP!BY)w>GTyYIB(PY44pbnee8Cp2cU<0@sU2|I`J#L@>htg zy_>64DpqYHMhb21(3SP})+*S1w;Kbx0E6(|fdt|fo&FZ-DxNA7hYorO-_8%s>Lun} zx_?qP#oGR;3jM_5RCM5QffEFLfGBWQQiK274Va&x3EM*YN!G74+ZeLpsSy@%9n#YX zI?jUY@b$|!YlN$rb&%f_g7}D(11D_ZZWd7Q1?# z62XmQ`U}puGse4z!Z73lw-N5)!cJF+!d2%PUn~EQXacr@*A^h4i*Znbl7=G2nPmaT z7M*6HKd549((8TzE5KDo4s_4vIIc{`j`4(ye>n5t{*4t^JLu@{c6b27^U)vWqQ_BC z%#pazdPu+)T3Y%vKUG}*O&oJs$5JP4@8ne>MyUEPstSoi|3B-hY7ZZIRhf~uLJ7!ysE-=ie7JYRfR6^RE2L7#dEEeIBX)h?BIdH)RlZ-9JY}6 zJL&-^U+~5{mO;lJ75z{}5cTe&Q5F5j33TS0?rq8z0_ELH3Tq}Lf)|-4o zC?k|8|0=qRsG?=-=M~=6{qxl1n^N>C)H)t<;YN`4rp}(pe<$tlTW16{d16vKc3Q92 zv({T|_~6zD<(cvf(w*H~ z{<)Mu4lyD7cw~)o4}sk<dZFg0#-PG8*t1s(HLE2Z3RjQLl^|9m;7H zfSD}NH4FB$eZkz?$WtX;|J|C?tKyA=9MP~Rq8QJ! zoJWMm{u+)6?bE!~`07r(r|WPg>ay+>e<5tgZojOjp z_9nDed*81-yb;p19;Nm2o9sfDi#qa>Mb<&g{bIeuJbhRU6o@e(S011rIG~Kds{=sb zht*pV-VEG|$yY(>yZ}uzpNAQyY3P!7Tbtzj80ojUNsb_5cF|Y6t7ib)W5D^EZr1x? z`Mia11(o!yv~AV=4>Evl5N>EmNjn$TB2ue-35E!u zQ61swC+p#55_S_{J@3IHA`0wlq@NO6GWa<+SCE)Ps-IKR4}WO5L>$vush6) zF2FOf68#8hP}#nt+QZF2gWp>C>2HD!TLgBBk2pNNy0FLMT=m-vB6~jOTH8WABT3?A zJSxoWMHlx$d%slSw}LyYJwUn~R-$TzTc`XGJ<%zm)Lg-4;O$S>YZ7U5dq&{e;ReOi ztB6}&{y07$L642hj~ck$I*NKSk(AWb*KyPyr}A}#Z6p;#dxhluR;)eY3wx{H9W4-0DNSOYdd@AL-!ty`oOvyN@q@< z8K015XunRHE|GWkx<=<12Hc5!xdU(u>6a;|taF9IO$PFhl^Oe82GSqPj7f=5f0X}# zfj0l^jJ?5tJ5KsRuM#?ULV7fH3#R6__AwRCA9Ek`y^HDX1%MsGrwIQ}5x{rY`2f55 zkZa#t>A*!;wlgL^+IjsRW1leCGDA&nh6S3d=Jg7bdl*nnmM=0m$KV{{ixap$-55 diff --git a/app.pyc b/app.pyc deleted file mode 100644 index 7cc260d30421472d35347f5e90c57843dddcf855..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 633 zcmZWlO>fjN5PeSet0CPkaB6=+PTe~~h!YYATFJecgOw(;BGg_7+bh^J{RR9e{t!Q) z9ecY}2q$@&d3rN%#^s;W>c{=>&mEpl!TO($(IfY$9Eg?vN&hV3MR-h$lmE)J7 z>KMO5KgCTmuP2eVa_-ul2UIq;*Wj?Ko!gD9g#wu3-V5AzW~}{^BgH$6@`QZacm`@64K; bT#ox(`qsLBXXss8FVqZg#40^SEo$)y{CkRW diff --git a/background/__init__.pyc b/background/__init__.pyc deleted file mode 100644 index e47ccb76d2a08be1b31d71a0d38a406fbb055a3f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 129 zcmZSn%*$2Lax6NT0SXv_v;zl8=s!|HnP?0W3` zvA#3wkH~&%=_~&Q5-Qq`z?I-Hvkd-D~gE{MLUWV;~vExB|h!=1@2QkK}m&nDg{14ag}zeau@4K z+L;`!r)X!2q6&RVv{R#~DvLTrld_nmXi63{6xC$WplE`&T6Jh*{*9lO!pcpucG_B# zrNzbsHgsZKflcvo);-Y9WE)++!RIx6kND(0pXiKepXd{!-#+lw$s4{?l)vRWkM@1G z_Y+up()5{Xg7z!4Uu9bR@Y2pC@0=?-Q|yofpYqRS?bBVTd=;;hxSL`UW`6h?rO*O* znI7jJ<-a3WW5t-n1IhQs=T$lXlV}Zn>a;&SW^_RXso?UVVyuHkq8s%1T`Zr1>sZxj z7L4bF@ri${sjcfiOn zKur;SEbyVg?;74QT#ObqNSnW0GhC}u&+9t0!(1CKQ^TkBKEOs6^oD5{g`5U^p$&3< zIMmkZCBYzujJ6Gu&`cyhQJqJUI??ZJR(I=h-lgf=5~E@+=O1t#j^3fn_V} zBI!8_%dNFhH~&N@vl-T7O}4{4HEI9V;4~ZNL9dh&7#n0m7i7I43Y`u@NK3-gAkAEG zoaF~WH_LO~b@6F%Y}{Vp_Hf~-R0Ef;im%sga=pxJuf0%-3(;e}OJ&2Qd)ty*LYdl26}=OOeRrE#hOybrC4+vIZsu7RI?KTz*GDEB+K+^O3nmS%SQR3% zj}X}PEDB>$E6)0ToeTHl+&KLtdq3-o9@gbjC#7p;Z!mN%cA+5fs}Pi~!YqU5Gqi@W z?$IxdbuHi|z`lXi%3hY}m4R6~*1H@PB=X8`*gfb=ZeLnH3GIP>eQ@gLaO;AiW8JXV z=o zeYNb}Q$JSs)SEc*y)IkB1;~~72%pVSWvBOLdK80vLGk$5$0U#ui=o`a%qzEKbYY$W zJ;SC?%jXmPv^cNO878X7ZxS@q^D6uD3{RIT-34BbnaXH)^78JOcIxu(BsYqE8RW&= z0c`R=5JHM+%>5dy$85QGU#7-01Jr*L>iTokRemvCp~e#g)PZ8&)6Y>)GWB-EO?o?R z5D)Abj9_eRJwk_cNu=AqDnp=X`5ZmF1W>1go`ixwA9n-g5ldM1sE zCN+qSYjfXebAxJgNwvSv;0FLg3#0ag*4Q*m+c$ZC9)KIwNTIS#wK%ui%M9)@nY?ga zn7e^1x?LJ!#mc3_U3#V`p(h&V^5Tdto2VN=0{iBUXEf&}oz~i?-S9y>9`HdaI>g?i^ z2~MiZGWZ*t$f3J1Q91`Y&?@YMd1Kp{e8X`fl)d(1P!(D9Qyjg(G8X&)F^cujERfyy z-;9z>9>)#ORr&h}(L>+4);b=kqeLvT`+D0rqc5T+*}QKthS*WjFd10+i?019&~F^W z6)@SuSDM@6sV;(gF=ksE7|Em;v@`kxvd#XM>gsfo(4?JCp)WsW+OIKKWAF+CE*r^Q ssr5DsywF-!U#}iT{KF)RhOzz`>tp%7!E<#EQx^Zc+FEU?=GXlH082Pk+W-In diff --git a/config/__init__.pyc b/config/__init__.pyc deleted file mode 100644 index f682e6186a4977cdf0b3368902f86ff6540e0f60..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 125 zcmZSn%*$2Lax6NT0SXv_v;z%LWv=UJ9o(u zcXxJYX2oSJrUj&jplO?;h|#otNzjL;4?zOdfzgKo2?_)#3iLS-ZQt6U4@FTJXi@Yb z{l0T&|450F=$hQUd*VoO92e%x5F{=DlCsD5~@?gWvP`#@A8!N-dzYly9rD zr4|4f*j5X+z!_D}s7jw&=u;N!`c%1JRkCU!i|2l&v#JDaR^3zTu2NrH7~oKIg#pg+ zHz@M?tE)lml!CH$YEgJQ@OA8XP8?KMfboN3;;gR*#Z{*mRueC%qOx3e!jhA$qFMu0 z25LEMB*f%zdr=TJVkg!~f+6Bb$9XqFmpF7*Jq}!LRF-wb0akUn2B_4i7Ly>vz@;#9 zf@-284~XhY-mCgfgM^s5yu?E_V313?CiD5=*Z7+)SXf6wzInBpdDw@C54<%USAt~q z-D;3r#4K@=1$sKHmV%WcAo;UVzJ+i6BNQ6!wp4%;%vI#sLWW!>(5G}id3O(D$SOZ0 zNN}@HfI$Ujvso@>_Cj9y1A-Y+{-6NE%HOB_oQ$wX`DidC@LuH)OM_A6j|lLD^7jaU z_NX0|W={$MPYAqUxpRdlL2;35=Ne>b_>E7a0Lj1gPJ&-7Bctxx>O13V(^840ZrSRN zrS4klj#5h*HIG$ZxsGD4(1(7r3CmR->3A=Ib-hffM`3yLRt$i1Mbc2(g*9CjKq}d@ z9D05-2%shY0!foLu`ZW{{{h%v)&<~|6!8S0snxKer)t4eXUZu|4MC+pleG;Qcxfqs zG?$h}(JAJdmDO+UvxE&KkKbv0V=6e-c#BIT(rAfG;^f)Q5yJOzsUTxkbaH9#!`Zo1 z$)5r$=1P@S>_^F=NAMLw{s4*zQEc|B=2IE4Fo6U>SB7#Jham8oS^QsnGuwr}lU3u8 z;rJa}t=TGawpQ7w&Pdfis*QMSZJ!$793a>4K=vZ(bT%2bPn}EpNe&dYLkO$ZvMTxq z!EK|ZAG8cmk*umx^Yw!n%d${juOG_vjscAuhqWQqA6XmgTW0W6(m>syN^-LPE&X>U zuVS(J=Ok}H$osLqF>EDyGASA2(xRVPfTK?>Y}d_l-rHN7F$DcPuLbW^GX6P5^c+bcITGy}LGs;qmFeh-bYnH7AL zbXpF>GIq04Fpb2ArBXms1OEYg@E`-a4!uWp7$r-X-T0)S>cf-s}>6k>)t3QiG%>g zf?*qgY`EGu@v24b(zD1I#jsLqB)VnjWP;hSs$J6K(*6p{Z&YdpE=#OxIy4Z+fc>A{^4fh;L(?-qr677q7X$r^VB#g9wO(Z}v5nX&9rva|XSmPKfh6cb+ zXD!D%g#V0n0A3X&`J8f|gqv9Y&GuNxnbQ?^z>^O)&+TtM0 zSQ+MMi4v`w8BRm zff7g16Y_8>s*RD$C*2{(Ll|>k75?EP(uEk{leUXOlwe%cm-@&AIGQca2{sh*Je(85 zZR44S)UDwbJJDf8JQEz4g!K3IOtkg0#%AsTC{|spr^^~K;bNTK{dnBj*|>~K-7yvi z*_h77r3EaAN&XTa53zWf1><5f+cSg?v!KIppJQ=^Mcd@N6L{>Hd-o`7pJnj^3kKEV zuS#K~>bnkc$5_0GVmA>tIbnQ6%MV=vCa$4SHViqwBi13?81t>B`+(Jhfw3NK8F9O9 z#O;<5AGfmhnEhNPYYke%7?DOE&*(F3Jw>BVcTY}|U(@);e~4lQMqSQT)C}k^%;Zs# zJ0eF|Wz=DlHGOWPnZ=uQ06;UQwA48$HXwF6!LwQimhhcwzc!$vZ%K1oVSd_LxJq`< zi1{8nlQ~!ama3oNXC8CR73i4b8z}Nl`X`6{6hU+a?j%wmCZhJ;gz9ubL|GaY3IL7ux@KceuNhjxhA7%{|ujH1J2 zoirlmT+&PovKhT1VF>9Uu|hckc9=6UnHdphf9~?=%-9On%OqEpP;&$xeu!m0(&7t2BIt zwYz004+C3R`ct3`FGb_`TTesdAIM9IS!uGq5MEMlsn4U6`@-2l6#_fDjz&Lka|5n~ zn)M)VxM+AE&6-usS9>&T;(nU-5N$exu{-L~rA^3&HoUUg$vY_%t?n1EOx*L}o@~s& z2i&7YqehFkJ7~7)hGa+bXxB8k8wD4*Y+>Uyzb2tKOdn#nnZ-*MQ&P||L|NE;hY85W z#O6g}z&vv^BA!GITpx}ytoap>G4P3mLndF*qIyb@CSJV9+zpY31eueTf5Mavk?1=_ z00uZ6 zA6EFx*YlFuohyh=nAnk^*lv>?s3GT2))yK{SV2S}@!Fh@Zif<7NKv#Jw!Oel=d^OgkMp@zu=96$kgqTwjZ7pKM zYI`Uz@*6=lbUfdyAt~gPqOjtuCP^)RZE6bXsp49ATSw@JvF=0q_pDyh z@%$jtZ&>#w9me^gr2p&Aq+f&?zG&eyU;nnkhetA~Azi|lP2S*27KgM)REt3o>=~QN zF=1~GJ*rxmexdZcX>Sgz=32KJE>h>3R|S=-;YDgD6N4ZTE*bWT$wB0{4&1?wgTb6* zJ$SUG9$AjGzWx{XeEqxjJi83bI(=r`nO~j_m?H=njT*<{0CHbPA)E1pcph-Y{2Ac< zcg`0i9`0l+_MzUD>;*?M$qb2>=?P>*d+|ld;?sa`m~_Mdz@|8$Sek64Fvn){y(yQA z&1qyTaQ`e18?6Ug5?D@2%r|A^v@{D3o-4%GK(ZdT4(RaQ>Sh(d{W-VDAtqscX*zqQ=(fYN2c+OKSN=h z55$0=uo;8(Xlx{c!@xTCuVFRTiDR8J?6Ykq7zc&ajXOMH-7rZi!GnV3S!E1s3n4 zAn=$+WcNI}oTHL(S1J2|{SMbQc^IBbU;SB5HNyFNmbEYiX2m^ zOYlh(oKumbbyQ(A-pHZFT!B-@e~qH;g(cx6n$7G*JB1YK8g9OfS7+E! z@rtWKRi8lW35T3A!-k>`Zo}~hotOX@RyAa#G*eTaGckci2n^$dFPD@gdXdPc)7K9X zCso4)!zU8tbkbJ3iL?d-3+Xc1rdKp!R>A~{euZ?|+$Q_k&WIX&MDdCxsUSE)T1=v2 z^zkaXWk70S958Jq`P*H{S!_d#9ckwCBE?SqQrUyZP#v^{Y>7K)$|#0ueC6FCY-(ga zOx!_%V~fH=L*TZ07P|qP972pP$%zAdS7Z%5KEUJ9VYU}t6}A>SrBIsu_*+cVW*(D_ zCOCztO-_-aX)6Bo-Jmq&ldQ0VsI$c%yhUVkRgmtfo*_+W%V^Pa%0Zm)^lOv`Qe|vN zGv7{m;fR5zJp;6-NIOc0o)+;7SjUZ%#~0r$-1LtZZcg6xUp)5a9sV9aR=AAEvH=jf;_^EY4JvjBqw9-Ma5Nf8B2kzL}8;QF({}LMe0%?n&Jem$6X-6=8;~( zGa*sjT_}w^kIq-x#$jMD?0(jI&X)I5s5tEdNe$CLswNzZ4^rsR7)B}As4Lv~fL~AZ z8c+e)b=YsTxr?j#IvN@MG8NfY1uOzbl~Z&44T0s&3Bv6e{?cNwi2mp-@gHmn^sWav zNCN}pez>B}RQWVQVQWJPPToEJ#30!SU6%2wlfdnn)Z@#)W&l0YJoT< zbb9cFqbZ?}KOy{LdqTXb(4J7dRcFGKrIJ;Me{OZy_^kbiiwBz#nWyZ0#AT+lj#3Tc zGj?azkGIYG01oub`gm*IC$s*jYu4{&nz8avAPiY!rUkpLqd)sv5*QMl{mkwbFtpLE z95%4JPkQ0Vf*V`Gr=Ae%VqD*t8iVq;l>8HW9`TNU60@#6Y}O#N>sh;Id@+;W2KY}4 z3x2{EV$yy2XMJSB4)Juvb?F}})okC-*M((wE!C?g#g;Y}aLj??D# z8{cVNd?vge>FwHTBjM^xQobzF$O?SXRjrd%iD!zdczO470LLjKU+{19O`ooj8BF?c zvX^z_hKWf7@~l zqVtnp3kGDj6lA{z$vk#CF33AeX7+2Hxfx}>SGy)|{ke^z%LjeXaPO|3R5KT zA(B^fn4!3aOH~eZ75ACEmETs|lB-F+atWo&^B+j?clxChr%s)E=Nob)CAQU8c>cQB+C7W1yotNn{C`T`S{x`eup>)6Rx~0 zaGVei<1TN+Jj67T5 zrLyD;mX@jr{+E_S`IeR{q2DOu(Y#qPgjO!|1?K!H96QO!(=5Ksf*f*r31qluwuG6h6C-b9I_DP1~foG)dFey^w%_{(uTWO-KPXsn!8n6KUD(PV9B|Vs^$Y zm0AfYyc93M4_=1{fbX33#%U8I)ch&2cQP~Q%9RCN)Wic=>r!Q>4z5dx3&Mp0uYa z7^3@Xf)~tjQQkdF(Itv6Q{!@e+XzK76wgv)HeZiYbcNzMYRu*9F^Z-so~Fh$))m@( zsAgF|e$zauX?fE;xtPrL_S;x4^!8bfd1^28nA?jKj8kxq4(;OL)!qa=?Il4@Ef-tU z#0MrQfQmrXqEkrFO-Rk78&~A`H43KqNN|CEBhi1g*atAc;t~ay38xM%E0`&Gt`|JB zCwQ(DJU0rSxf49|1<%cbXF+6GEcUCUE>imz1y?CpqF`CxzEV(c7gPv;L|rYYcM9tD zW7Hc3^=?7Ed5l^usPD0x1h?qGrtA-!Wmsbgfsd7lqt>gp;nU&Y_^Vo&nL!M3njEMX zTm6llR;Ik5$~41q@KxmL12chHrjkHqu2FF(@{BTL*z>y?wvFp`I%Y_Ce(ox5|A*i3M3BSC8mZIzo~C;^aXHPykYJ<4I*=D(|r^oh2UF&z)r+*bdGL1~HOzjhCyu#B-(?Wcc3%`cv$k zZWm4z>(7rO`Tt`X7QCNSbq_@{g zNClg{6L|sQx|C;oOwR6JT#tJ9?_jD~8nQJ@8oyXl&rl&G<0M|JbjS0Rh`F9u+uBym zXLRA!-c1CA!B2r%d;_kcjXc*jt(#BH)2c+es5-UrxfPmVC1coZDE1 zc=EQ&M^|I=G{9ahiYwHHzM3+7%bLs%VUYOUo?^RL7y7aX1)+XZWyV@mW~rg_wWA+TZPaJaPEO8eTf6?$d_QOEk)mTxjS;*Di=p7zfJKwhnd7LI-c=ct`|jOc@v^3 z;v3o;-4$CPZ_d!9IuZozklarnI2o)VMB@W3APruh(>rZ!ZyOy?7I!^Ay>n7{^rVGbktc2v^8Rz%;AQqRcGk*1#p zs@@8-{k-kPZwI5C8Ghe&9&Ye(lLxjxdO+NlINZ29-26Hp^6)VR!6@q{eK(QWTZSW} ze?LxxZlpddVXhxwn6yUiid8|Yv}R3WHe!ui6?+nEeC#qP6*N&()(qAUDl>zt6@12L L1{U+rP{sNO&ER;v From 2931185be11620ada17a5da6710811cb2e99e99c Mon Sep 17 00:00:00 2001 From: John Hogan Date: Wed, 24 Oct 2018 21:11:15 -0400 Subject: [PATCH 003/685] this has t work --- Actions/actions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index eb78df5b..f284c968 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -114,8 +114,8 @@ def defineHome(self): else: scaleFactor = 1.0 self.data.gcodeShift = [ - self.data.xval / scaleFactor, - self.data.yval / scaleFactor, + self.data.gcodeShift[0] / scaleFactor, + self.data.gcodeShift[0] / scaleFactor, ] self.data.config.setValue("Advanced Settings", "homeX", str(self.data.xval)) self.data.config.setValue("Advanced Settings", "homeY", str(self.data.yval)) From fc94f0beac0f02ead6bba37fa4012f4bf0e18e64 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Wed, 24 Oct 2018 21:15:40 -0400 Subject: [PATCH 004/685] oops --- Actions/actions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index f284c968..eb78df5b 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -114,8 +114,8 @@ def defineHome(self): else: scaleFactor = 1.0 self.data.gcodeShift = [ - self.data.gcodeShift[0] / scaleFactor, - self.data.gcodeShift[0] / scaleFactor, + self.data.xval / scaleFactor, + self.data.yval / scaleFactor, ] self.data.config.setValue("Advanced Settings", "homeX", str(self.data.xval)) self.data.config.setValue("Advanced Settings", "homeY", str(self.data.yval)) From a9769d46918b6a5d72638a036ef2f0c8ff2c4805 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Thu, 25 Oct 2018 09:09:54 -0400 Subject: [PATCH 005/685] fixed home and unit switching --- Actions/actions.py | 33 +++++-- Background/UIProcessor.py | 155 +++++++++++++++++---------------- Background/messageProcessor.py | 119 +++++++++++++------------ main.py | 15 ++-- static/scripts/frontpage.js | 37 +++++++- static/styles/frontpage.css | 2 + templates/base.html | 4 + templates/frontpage.html | 9 ++ webcontrol.json | 6 +- 9 files changed, 228 insertions(+), 152 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index eb78df5b..42b49281 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -33,7 +33,10 @@ def processAction(self, msg): self.data.ui_queue.put("Message: Error with stopping Z-Axis movement") elif msg["data"]["command"] == "startRun": if not self.startRun(): - self.data.ui_queue.put("Message: Error with starting run") + if len(self.data.gcode)>0: + self.data.ui_queue.put("Message: Error with starting run.") + else: + self.data.ui_queue.put("Message: No GCode file loaded.") elif msg["data"]["command"] == "stopRun": if not self.stopRun(): self.data.ui_queue.put("Message: Error with stopping run") @@ -114,11 +117,16 @@ def defineHome(self): else: scaleFactor = 1.0 self.data.gcodeShift = [ - self.data.xval / scaleFactor, - self.data.yval / scaleFactor, + self.data.xval, + self.data.yval, ] self.data.config.setValue("Advanced Settings", "homeX", str(self.data.xval)) self.data.config.setValue("Advanced Settings", "homeY", str(self.data.yval)) + position = {"xval": self.data.xval, "yval": self.data.yval} + self.data.ui_queue.put( + "Action: homePositionMessage:_" + json.dumps(position) + ) # the "_" facilitates the parse + print("gcodeShift="+str(self.data.gcodeShift[0])+", "+str(self.data.gcodeShift[1])) self.data.gcodeFile.loadUpdateFile() return True except Exception as e: @@ -178,10 +186,13 @@ def stopZ(self): def startRun(self): try: - self.data.uploadFlag = 1 - self.data.gcode_queue.put(self.data.gcode[self.data.gcodeIndex]) - self.data.gcodeIndex += 1 - return True + if len(self.data.gcode)>0: + self.data.uploadFlag = 1 + self.data.gcode_queue.put(self.data.gcode[self.data.gcodeIndex]) + self.data.gcodeIndex += 1 + return True + else: + return False except Exception as e: print(e) self.data.uploadFlag = 0 @@ -432,7 +443,7 @@ def updateSetting(self, setting, value): if setting == "toInches": self.data.units = "INCHES" self.data.config.setValue("Computed Settings", "units", self.data.units) - scaleFactor = 1.0 + scaleFactor = 1.0/25.4 self.data.gcodeShift = [ self.data.gcodeShift[0] / scaleFactor, self.data.gcodeShift[1] / scaleFactor, @@ -440,6 +451,9 @@ def updateSetting(self, setting, value): self.data.tolerance = 0.020 self.data.gcode_queue.put("G20 ") self.data.config.setValue("Computed Settings", "distToMove", value) + self.data.config.setValue("Advanced Settings", "homeX", self.data.gcodeShift[0]) + self.data.config.setValue("Advanced Settings", "homeY", self.data.gcodeShift[1]) + print("gcodeShift=" + str(self.data.gcodeShift[0]) + ", " + str(self.data.gcodeShift[1])) elif setting == "toMM": self.data.units = "MM" self.data.config.setValue("Computed Settings", "units", self.data.units) @@ -451,6 +465,9 @@ def updateSetting(self, setting, value): self.data.tolerance = 0.5 self.data.gcode_queue.put("G21") self.data.config.setValue("Computed Settings", "distToMove", value) + self.data.config.setValue("Advanced Settings", "homeX", self.data.gcodeShift[0]) + self.data.config.setValue("Advanced Settings", "homeY", self.data.gcodeShift[1]) + print("gcodeShift=" + str(self.data.gcodeShift[0]) + ", " + str(self.data.gcodeShift[1])) elif setting == "toInchesZ": self.data.units = "INCHES" self.data.config.setValue( diff --git a/Background/UIProcessor.py b/Background/UIProcessor.py index 8184f86d..1a86a89f 100644 --- a/Background/UIProcessor.py +++ b/Background/UIProcessor.py @@ -27,80 +27,89 @@ def start(self, _app): message = self.app.data.ui_queue.get() # send message to web for display in appropriate column if message != "": - if message[0] != "[" and message[0] != "<": + if message[0] == "<": + # print message + self.setPosOnScreen(message) + elif message[0] == "[": + if message[1:4] == "PE:": + # todo: + oo = 1 + # app.setErrorOnScreen(message) + elif message[0:8] == "Message:": + if message.find("adjust Z-Axis") != -1: + print("found adjust Z-Axis in message") + socketio.emit( + "requestedSetting", + {"setting": "pauseButtonSetting", "value": "Resume"}, + namespace="/MaslowCNC", + ) + self.activateModal("Notification:", message[9:]) + elif message[0:7] == "Action:": + if message.find("unitsUpdate") != -1: + units = self.app.data.config.getValue( + "Computed Settings", "units" + ) + socketio.emit( + "requestedSetting", + {"setting": "units", "value": units}, + namespace="/MaslowCNC", + ) + if message.find("gcodeUpdate") != -1: + socketio.emit( + "gcodeUpdate", + { + "data": json.dumps( + [ + ob.__dict__ + for ob in self.app.data.gcodeFile.line + ] + ) + }, + namespace="/MaslowCNC", + ) + if message.find("setAsPause") != -1: + socketio.emit( + "requestedSetting", + {"setting": "pauseButtonSetting", "value": "Pause"}, + namespace="/MaslowCNC", + ) + if message.find("setAsResume") != -1: + socketio.emit( + "requestedSetting", + {"setting": "pauseButtonSetting", "value": "Resume"}, + namespace="/MaslowCNC", + ) + if message.find("positionUpdate") != -1: + msg = message.split( + "_" + ) # everything to the right of the "_" should be the position data already json.dumps'ed + socketio.emit( + "positionMessage", + {"data": msg[1]}, + namespace="/MaslowCNC", + ) + if message.find("homePositionMessage") != -1: + msg = message.split( + "_" + ) # everything to the right of the "_" should be the position data already json.dumps'ed + print("sending home position update") + socketio.emit( + "homePositionMessage", + {"data": msg[1]}, + namespace="/MaslowCNC", + ) + if message.find("updatePorts") != -1: + ports = json.dumps(self.app.data.comPorts) + socketio.emit( + "updatePorts", {"data": ports}, namespace="/MaslowCNC" + ) + elif message[0:6] == "ALARM:": + self.activateModal("Notification:", message[7:]) + elif message == "ok\r\n": + pass # displaying all the 'ok' messages clutters up the display + else: + print("UIProcessor:"+message) self.sendControllerMessage(message) - if message[0] == "<": - # print message - self.setPosOnScreen(message) - elif message[0] == "[": - if message[1:4] == "PE:": - # todo: - oo = 1 - # app.setErrorOnScreen(message) - elif message[0:8] == "Message:": - if message.find("adjust Z-Axis") != -1: - print("found adjust Z-Axis in message") - socketio.emit( - "requestedSetting", - {"setting": "pauseButtonSetting", "value": "Resume"}, - namespace="/MaslowCNC", - ) - self.activateModal("Notification:", message[9:]) - elif message[0:7] == "Action:": - if message.find("unitsUpdate") != -1: - units = self.app.data.config.getValue( - "Computed Settings", "units" - ) - socketio.emit( - "requestedSetting", - {"setting": "units", "value": units}, - namespace="/MaslowCNC", - ) - if message.find("gcodeUpdate") != -1: - socketio.emit( - "gcodeUpdate", - { - "data": json.dumps( - [ - ob.__dict__ - for ob in self.app.data.gcodeFile.line - ] - ) - }, - namespace="/MaslowCNC", - ) - if message.find("setAsPause") != -1: - socketio.emit( - "requestedSetting", - {"setting": "pauseButtonSetting", "value": "Pause"}, - namespace="/MaslowCNC", - ) - if message.find("setAsResume") != -1: - socketio.emit( - "requestedSetting", - {"setting": "pauseButtonSetting", "value": "Resume"}, - namespace="/MaslowCNC", - ) - if message.find("positionUpdate") != -1: - msg = message.split( - "_" - ) # everything to the right of the "_" should be the position data already json.dumps'ed - socketio.emit( - "positionMessage", - {"data": msg[1]}, - namespace="/MaslowCNC", - ) - if message.find("updatePorts") != -1: - ports = json.dumps(self.app.data.comPorts) - socketio.emit( - "updatePorts", {"data": ports}, namespace="/MaslowCNC" - ) - elif message[0:6] == "ALARM:": - self.activateModal("Notification:", message[7:]) - elif message == "ok\r\n": - pass # displaying all the 'ok' messages clutters up the display - else: - print(message) def setPosOnScreen(self, message): try: diff --git a/Background/messageProcessor.py b/Background/messageProcessor.py index a988bfb2..2306de02 100644 --- a/Background/messageProcessor.py +++ b/Background/messageProcessor.py @@ -19,70 +19,69 @@ def start(self): message = self.data.message_queue.get() # send message to web for display in appropriate column if message != "": - if message[0] != "[" and message[0] != "<": + if message[0] == "<": self.data.ui_queue.put(message) - if message[0] == "<": - self.data.ui_queue.put(message) - elif message[0] == "$": - self.data.config.receivedSetting(message) - elif message[0] == "[": - if message[1:4] == "PE:": - # todo: - oo = 1 - # app.setErrorOnScreen(message) - elif message[1:8] == "Measure": - measuredDist = float(message[9 : len(message) - 3]) - try: - self.data.measureRequest(measuredDist) - except Exception as e: - print(e) - print("No function has requested a measurement") - elif message[0:13] == "Maslow Paused": - self.data.uploadFlag = 0 - print(message) - elif message[0:8] == "Message:": - if ( - self.data.calibrationInProcess - and message[0:15] == "Message: Unable" - ): # this suppresses the annoying messages about invalid chain lengths during the calibration process - break - self.data.previousUploadStatus = self.data.uploadFlag - self.data.uploadFlag = 0 - if message.find("adjust Z-Axis") != -1: + elif message[0] == "$": + self.data.config.receivedSetting(message) + elif message[0] == "[": + if message[1:4] == "PE:": + # todo: + oo = 1 + # app.setErrorOnScreen(message) + elif message[1:8] == "Measure": + measuredDist = float(message[9 : len(message) - 3]) + try: + self.data.measureRequest(measuredDist) + except Exception as e: + print(e) + print("No function has requested a measurement") + elif message[0:13] == "Maslow Paused": + self.data.uploadFlag = 0 + print(message) + elif message[0:8] == "Message:": + if ( + self.data.calibrationInProcess + and message[0:15] == "Message: Unable" + ): # this suppresses the annoying messages about invalid chain lengths during the calibration process + break + self.data.previousUploadStatus = self.data.uploadFlag + self.data.uploadFlag = 0 + if message.find("adjust Z-Axis") != -1: + self.data.ui_queue.put(message) + elif message[0:6] == "ALARM:": + self.data.previousUploadStatus = self.data.uploadFlag + self.data.uploadFlag = 0 self.data.ui_queue.put(message) - elif message[0:6] == "ALARM:": - self.data.previousUploadStatus = self.data.uploadFlag - self.data.uploadFlag = 0 - self.data.ui_queue.put(message) - elif message[0:8] == "Firmware": - self.data.logger.writeToLog( - "Ground Control Version " + str(self.data.version) + "\n" - ) - print( - "Ground Control " - + str(self.data.version) - + "\r\n" - + message - + "\r\n" - ) - # Check that version numbers match - if float(message[-7:]) < float(self.data.version): - self.data.ui_queue.put( - "Message: Warning, your firmware is out of date and may not work correctly with this version of Ground Control\n\n" - + "Ground Control Version " - + str(self.data.version) - + "\r\n" - + message + elif message[0:8] == "Firmware": + self.data.logger.writeToLog( + "Ground Control Version " + str(self.data.version) + "\n" ) - if float(message[-7:]) > float(self.data.version): - self.data.ui_queue.put( - "Message: Warning, your version of Ground Control is out of date and may not work with this firmware version\n\n" - + "Ground Control Version " + print( + "Ground Control " + str(self.data.version) + "\r\n" + message + + "\r\n" ) - elif message == "ok\r\n": - pass # displaying all the 'ok' messages clutters up the display - else: - print(message) + # Check that version numbers match + if float(message[-7:]) < float(self.data.version): + self.data.ui_queue.put( + "Message: Warning, your firmware is out of date and may not work correctly with this version of Ground Control\n\n" + + "Ground Control Version " + + str(self.data.version) + + "\r\n" + + message + ) + if float(message[-7:]) > float(self.data.version): + self.data.ui_queue.put( + "Message: Warning, your version of Ground Control is out of date and may not work with this firmware version\n\n" + + "Ground Control Version " + + str(self.data.version) + + "\r\n" + + message + ) + elif message == "ok\r\n": + pass # displaying all the 'ok' messages clutters up the display + else: + #print("messageProcessor:"+message) + self.data.ui_queue.put(message) diff --git a/main.py b/main.py index 24b3f291..c110e498 100644 --- a/main.py +++ b/main.py @@ -25,13 +25,9 @@ app.data.config.computeSettings(None, None, None, True) app.data.units = app.data.config.getValue("Computed Settings", "units") app.data.comport = app.data.config.getValue("Maslow Settings", "COMport") -if app.data.units == "INCHES": - scale = 1.0 -else: - scale = 25.4 app.data.gcodeShift = [ - float(app.data.config.getValue("Advanced Settings", "homeX")) / scale, - float(app.data.config.getValue("Advanced Settings", "homeY")) / scale, + float(app.data.config.getValue("Advanced Settings", "homeX")), + float(app.data.config.getValue("Advanced Settings", "homeY")), ] # app.previousPosX = 0.0 # app.previousPosY = 0.0 @@ -463,6 +459,13 @@ def settingRequest(msg): {"setting": msg["data"], "value": distToMoveZ}, namespace="/MaslowCNC", ) + if msg["data"] == "homePosition": + homeX = app.data.config.getValue("Advanced Settings", "homeX") + homeY = app.data.config.getValue("Advanced Settings", "homeY") + position = {"xval": homeX, "yval": homeY} + app.data.ui_queue.put( + "Action: homePositionMessage:_" + json.dumps(position) + ) # the "_" facilitates the parse @socketio.on("updateSetting", namespace="/MaslowCNC") diff --git a/static/scripts/frontpage.js b/static/scripts/frontpage.js index 66f36fce..cdb2ee38 100644 --- a/static/scripts/frontpage.js +++ b/static/scripts/frontpage.js @@ -34,6 +34,14 @@ sled.center(originX,originY) //sled.center(vx,vy) draw.zoom(10, {x:originX,y:originY}); +var home = draw.group() +home.add(draw.line(1.5*scale,-0.0*scale,1.5*scale,3.0*scale).stroke({width:.1,color:"#0F0"})) +home.add(draw.line(-0.0*scale,1.5*scale,3.0*scale,1.5*scale).stroke({width:.1,color:"#0F0"})) +home.add(draw.circle(3*scale).stroke({width:.1,color:"#0F0"}).fill({color:"#fff",opacity:0})) +home.center(originX,originY) +//sled.center(vx,vy) +draw.zoom(10, {x:originX,y:originY}); + function positionUpdate(x,y,z){ var _x, _y =0 //console.log(x) @@ -45,10 +53,24 @@ function positionUpdate(x,y,z){ _x = originX+x*scale; _y = originY-y*scale } - sled.center(_x, _y); } +function homePositionUpdate(x,y){ + var _x, _y =0 + //console.log(x) + if ($("#units").text()=="MM"){ + _x = originX+x*scale/25.4 + _y = originY-y*scale/25.4 + } + else{ + _x = originX+x*scale; + _y = originY-y*scale + } + //console.log("home:"+_x+", "+_y) + home.center(_x, _y); +} + function unitSwitch(){ if ( $("#units").text()=="MM") { $("#units").text("INCHES"); @@ -66,6 +88,7 @@ function unitSwitch(){ $(document).ready(function(){ settingRequest("units"); settingRequest("distToMove"); + settingRequest("homePosition"); checkForGCodeUpdate(); }); @@ -81,6 +104,10 @@ function pauseRun(){ function processRequestedSetting(msg){ console.log(msg); if (msg.setting=="pauseButtonSetting"){ + if(msg.value=="Resume") + $('#pauseButton').removeClass('btn-warning').addClass('btn-info'); + else + $('#pauseButton').removeClass('btn-info').addClass('btn-warning'); $("#pauseButton").text(msg.value); } if (msg.setting=="units"){ @@ -103,10 +130,16 @@ function processRequestedSetting(msg){ function processPositionMessage(msg){ var json = JSON.parse(msg.data); - $('#positionMessage').html('

XPos:'+json.xval+' Ypos:'+json.yval+' ZPos:'+json.zval+'

'); + $('#positionMessage').html('

XPos:'+Math.round(json.xval,2)+' Ypos:'+Math.round(json.yval,2)+' ZPos:'+Math.round(json.zval,2)+'

'); positionUpdate(json.xval,json.yval,json.zval); } +function processHomePositionMessage(msg){ + var json = JSON.parse(msg.data); + $('#homePositionMessage').html('

XPos:'+Math.round(json.xval,2)+' Ypos:'+Math.round(json.yval,2)+'

'); + homePositionUpdate(json.xval,json.yval); +} + function gcodeUpdate(msg){ console.log("updating gcode"); if (gcode!=null) { diff --git a/static/styles/frontpage.css b/static/styles/frontpage.css index 1aafcf40..fc6bae2e 100644 --- a/static/styles/frontpage.css +++ b/static/styles/frontpage.css @@ -16,3 +16,5 @@ html, body{ .flex-fill { flex:1; } + + diff --git a/templates/base.html b/templates/base.html index 4bdf74c8..862a9a3b 100644 --- a/templates/base.html +++ b/templates/base.html @@ -48,6 +48,10 @@ } }); + socket.on('homePositionMessage', function(msg){ + processHomePositionMessage(msg) + }); + socket.on('activateModal', function(msg){ console.log("activateModal") $('#notificationModal').data('bs.modal',null); diff --git a/templates/frontpage.html b/templates/frontpage.html index 577789ba..2191b575 100644 --- a/templates/frontpage.html +++ b/templates/frontpage.html @@ -110,6 +110,15 @@

Position

+
+
+

Home

+
+
+

+
+
+

Controller Messages

diff --git a/webcontrol.json b/webcontrol.json index b3286363..78bbda4c 100644 --- a/webcontrol.json +++ b/webcontrol.json @@ -131,7 +131,7 @@ "section": "Advanced Settings", "title": "Home Position X Coordinate", "type": "string", - "value": "-610.01" + "value": 0.0 }, { "default": 0.0, @@ -140,7 +140,7 @@ "section": "Advanced Settings", "title": "Home Position Y Coordinate", "type": "string", - "value": "-610.0" + "value": -1.9999999999999996 }, { "default": 0, @@ -517,7 +517,7 @@ "default": 1.0, "key": "distToMove", "type": "float", - "value": 24.0 + "value": 2.0 }, { "default": 0.5, From d7a72b5c802b8f30e660b017adafe80b9e1e4d8f Mon Sep 17 00:00:00 2001 From: John Hogan Date: Thu, 25 Oct 2018 12:56:42 -0400 Subject: [PATCH 006/685] Hopefully fixed metrics now --- Actions/actions.py | 7 ++- Background/UIProcessor.py | 16 +++-- Background/messageProcessor.py | 2 +- DataStructures/data.py | 1 + File/gcodeFile.py | 106 +++++++++++++++++++++------------ main.py | 1 + webcontrol.json | 6 +- 7 files changed, 90 insertions(+), 49 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index 42b49281..39887a92 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -259,7 +259,10 @@ def pauseRun(self): def resumeRun(self): try: - self.data.uploadFlag = 1 + if self.data.manualZAxisAdjust: + self.data.uploadFlag = self.data.previousUploadStatus + else: + self.data.uploadFlag = 1 # send cycle resume command to unpause the machine self.data.quick_queue.put("~") self.data.ui_queue.put("Action: setAsPause") @@ -287,7 +290,7 @@ def returnToCenter(self): def clearGCode(self): try: - self.data.gcodeFile = "" + self.data.gcodeFile.clearGcode() return True except Exception as e: print(e) diff --git a/Background/UIProcessor.py b/Background/UIProcessor.py index 1a86a89f..bdb4e2b4 100644 --- a/Background/UIProcessor.py +++ b/Background/UIProcessor.py @@ -54,6 +54,15 @@ def start(self, _app): {"setting": "units", "value": units}, namespace="/MaslowCNC", ) + if message.find("distToMoveUpdate") != -1: + units = self.app.data.config.getValue( + "Computed Settings", "distToMove" + ) + socketio.emit( + "requestedSetting", + {"setting": "distToMove", "value": units}, + namespace="/MaslowCNC", + ) if message.find("gcodeUpdate") != -1: socketio.emit( "gcodeUpdate", @@ -117,15 +126,12 @@ def setPosOnScreen(self, message): startpt = message.find("MPos:") + 5 endpt = message.find("WPos:") numz = message[startpt:endpt] - units = "mm" # message[endpt+1:endpt+3] valz = numz.split(",") self.app.data.xval = float(valz[0]) self.app.data.yval = float(valz[1]) self.app.data.zval = float(valz[2]) - # print "x:"+str(app.data.xval)+", y:"+str(app.data.yval)+", z:"+str(app.data.zval) - if math.isnan(self.app.data.xval): self.sendControllerMessage("Unable to resolve x Kinematics.") self.app.data.xval = 0 @@ -154,7 +160,9 @@ def activateModal(self, title, message): ) def sendControllerMessage(self, message): - socketio.emit("controllerMessage", {"data": message}, namespace="/MaslowCNC") + socketio.emit( + "controllerMessage", {"data": message}, namespace="/MaslowCNC" + ) def sendPositionMessage(self, position): socketio.emit( diff --git a/Background/messageProcessor.py b/Background/messageProcessor.py index 2306de02..ba059dda 100644 --- a/Background/messageProcessor.py +++ b/Background/messageProcessor.py @@ -47,6 +47,7 @@ def start(self): self.data.previousUploadStatus = self.data.uploadFlag self.data.uploadFlag = 0 if message.find("adjust Z-Axis") != -1: + self.data.manualZAxisAdjust = True self.data.ui_queue.put(message) elif message[0:6] == "ALARM:": self.data.previousUploadStatus = self.data.uploadFlag @@ -83,5 +84,4 @@ def start(self): elif message == "ok\r\n": pass # displaying all the 'ok' messages clutters up the display else: - #print("messageProcessor:"+message) self.data.ui_queue.put(message) diff --git a/DataStructures/data.py b/DataStructures/data.py index 24d88134..f4898197 100644 --- a/DataStructures/data.py +++ b/DataStructures/data.py @@ -57,6 +57,7 @@ class Data: # sets a flag if the gcode is being uploaded currently uploadFlag = 0 previousUploadStatus = 0 + manualZAxisAdjust = False # this is used to determine the first time the position is received from the machine firstTimePosFlag = 0 # report if the serial connection is open diff --git a/File/gcodeFile.py b/File/gcodeFile.py index a5a8376d..70ee4ac9 100644 --- a/File/gcodeFile.py +++ b/File/gcodeFile.py @@ -19,7 +19,7 @@ class GCodeFile(MakesmithInitFuncs): isChanged = False canvasScaleFactor = 1 # scale from mm to pixels INCHES = 1.0 - MILLIMETERS = 1.0 / 25.4 + MILLIMETERS = 1.0/25.4 xPosition = 0 yPosition = 0 @@ -41,6 +41,11 @@ def serializeGCode(self): return sendStr def loadUpdateFile(self): + if (self.data.units=="MM"): + self.canvasScaleFactor = self.MILLIMETERS + else: + self.canvasScaleFactor = self.INCHES + filename = self.data.gcodeFile.filename # print(filename) del self.line[:] @@ -103,7 +108,7 @@ def loadUpdateFile(self): except: print("Gcode File Error") self.data.ui_queue.put("Message: Cannot open gcode file.") - self.data.gcodeFile = "" + self.data.gcodeFile.filename = "" return False self.updateGcode() self.data.gcodeFile.isChanged = True @@ -117,7 +122,8 @@ def addPoint(self, x, y): Add a point to the line currently being plotted """ self.line[-1].points.append( - (x * self.canvasScaleFactor, y * self.canvasScaleFactor * -1.0) + #(x * self.canvasScaleFactor, y * self.canvasScaleFactor * -1.0) + (x , y * -1.0) ) def isNotReallyClose(self, x0, x1): @@ -444,10 +450,60 @@ def updateOneLine(self, fullString): print("G18 not supported") if gString == "G20": + ''' + TODO: Fix this.. this is sloppy programming + ''' + if self.data.units != "INCHES": + self.data.units = "INCHES" + self.data.config.setValue("Computed Settings", "units", self.data.units) + scaleFactor = 1.0 / 25.4 + self.data.gcodeShift = [ + self.data.gcodeShift[0] * scaleFactor, + self.data.gcodeShift[1] * scaleFactor, + ] + self.xPosition *= scaleFactor + self.yPosition *= scaleFactor + self.data.tolerance = 0.020 + value = float(self.data.config.getValue("Computed Settings", "distToMove"))/25.4 + self.data.config.setValue("Computed Settings", "distToMove", value) + self.data.config.setValue("Advanced Settings", "homeX", self.data.gcodeShift[0]) + self.data.config.setValue("Advanced Settings", "homeY", self.data.gcodeShift[1]) + self.data.ui_queue.put("Action: unitsUpdate") + self.data.ui_queue.put("Action: distToMoveUpdate") + position = {"xval": self.data.gcodeShift[0], "yval": self.data.gcodeShift[1]} + self.data.ui_queue.put( + "Action: homePositionMessage:_" + json.dumps(position) + ) # the "_" facilitates the parse + self.data.gcode_queue.put("G20 ") + print("gcodeShift=" + str(self.data.gcodeShift[0]) + ", " + str(self.data.gcodeShift[1])) self.canvasScaleFactor = self.INCHES # self.data.units = "INCHES" if gString == "G21": + ''' + TODO: Fix this.. this is sloppy programming + ''' + if self.data.units != "MM": + self.data.units = "MM" + self.data.config.setValue("Computed Settings", "units", self.data.units) + scaleFactor = 25.4 + self.data.gcodeShift = [ + self.data.gcodeShift[0] * scaleFactor, + self.data.gcodeShift[1] * scaleFactor, + ] + self.data.tolerance = 0.50 + value = float(self.data.config.getValue("Computed Settings", "distToMove"))*25.4 + self.data.config.setValue("Computed Settings", "distToMove", value) + self.data.config.setValue("Advanced Settings", "homeX", self.data.gcodeShift[0]) + self.data.config.setValue("Advanced Settings", "homeY", self.data.gcodeShift[1]) + self.data.ui_queue.put("Action: unitsUpdate") + self.data.ui_queue.put("Action: distToMoveUpdate") + position = {"xval": self.data.gcodeShift[0], "yval": self.data.gcodeShift[1]} + self.data.ui_queue.put( + "Action: homePositionMessage:_" + json.dumps(position) + ) # the "_" facilitates the parse + self.data.gcode_queue.put("G21 ") + print("gcodeShift=" + str(self.data.gcodeShift[0]) + ", " + str(self.data.gcodeShift[1])) self.canvasScaleFactor = self.MILLIMETERS # self.data.units = "MM" @@ -457,47 +513,16 @@ def updateOneLine(self, fullString): if gString == "G91": self.absoluteFlag = 1 - def callBackMechanism(self, callback): + def callBackMechanism(self): """ - Call the loadNextLine function periodically in a non-blocking way to - update the gcode. + Call the loadNextLine function in background. """ - # with self.scatterObject.canvas: - - # self.line.append(Line()) #Line(points = (), width = 1, group = 'gcode') - - # Draw numberOfTimesToCall lines on the canvas - # print "here:"+str(self.lineNumber) - numberOfTimesToCall = 500 - for _ in range(numberOfTimesToCall): + for _ in range(min(len(self.data.gcode), self.maxNumberOfLinesToRead)): self.loadNextLine() - # Repeat until end of file - # print "end:"+str(self.lineNumber) - # print self.lineNumber - # print len(self.data.gcode) - # print self.maxNumberOfLinesToRead - if self.lineNumber < min(len(self.data.gcode), self.maxNumberOfLinesToRead): - # print "here" - self.callBackMechanism(self.updateGcode) - if True: - for line in self.line: - _str = ( - "Type:" - + str(line.type) - + ", Color:" - + str(line.color) - + ", Dashed:" - + str(line.dashed) - + "..." - ) - for point in line.points: - _str += str(point) - # print _str - def updateGcode(self): """ updateGcode parses the gcode commands and calls the appropriate drawing function for the @@ -524,10 +549,13 @@ def updateGcode(self): + " lines of gcode.\nrendering all " + str(len(self.data.gcode)) + " lines simultaneously may crash the\n program, only the first " - + self.maxNumberOfLinesToRead + + str(self.maxNumberOfLinesToRead) + "lines are shown here.\nThe complete program will cut if you choose to do so unless the home position is moved from (0,0)." ) print(errorText) self.data.ui_queue.put("Message: " + errorText) - self.callBackMechanism(self.updateGcode) + th = threading.Thread(target=self.callBackMechanism) + th.start() + + diff --git a/main.py b/main.py index c110e498..cbb34645 100644 --- a/main.py +++ b/main.py @@ -133,6 +133,7 @@ def uploadGCode(): def openGCode(): if request.method == "POST": f = request.form["selectedGCode"] + print("selectedGcode="+str(f)) app.data.gcodeFile.filename = "gcode/" + f returnVal = app.data.gcodeFile.loadUpdateFile() if returnVal: diff --git a/webcontrol.json b/webcontrol.json index 78bbda4c..1e6600d3 100644 --- a/webcontrol.json +++ b/webcontrol.json @@ -140,7 +140,7 @@ "section": "Advanced Settings", "title": "Home Position Y Coordinate", "type": "string", - "value": -1.9999999999999996 + "value": -50.79999999999998 }, { "default": 0, @@ -517,7 +517,7 @@ "default": 1.0, "key": "distToMove", "type": "float", - "value": 2.0 + "value": 50.8 }, { "default": 0.5, @@ -529,7 +529,7 @@ "default": "MM", "key": "units", "type": "string", - "value": "INCHES" + "value": "MM" }, { "default": "MM", From 9ddebf759101e0177d339d8fc2e3a6a0d36cdde9 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Thu, 25 Oct 2018 13:40:25 -0400 Subject: [PATCH 007/685] Again, hopefully fixed metrics now --- Background/UIProcessor.py | 2 +- Connection/serialPortThread.py | 2 +- File/gcodeFile.py | 19 ++++++++++++------- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Background/UIProcessor.py b/Background/UIProcessor.py index bdb4e2b4..5c548529 100644 --- a/Background/UIProcessor.py +++ b/Background/UIProcessor.py @@ -117,7 +117,7 @@ def start(self, _app): elif message == "ok\r\n": pass # displaying all the 'ok' messages clutters up the display else: - print("UIProcessor:"+message) + #print("UIProcessor:"+message) self.sendControllerMessage(message) def setPosOnScreen(self, message): diff --git a/Connection/serialPortThread.py b/Connection/serialPortThread.py index e0ed2756..6a41ed11 100644 --- a/Connection/serialPortThread.py +++ b/Connection/serialPortThread.py @@ -39,7 +39,7 @@ def _write(self, message, isQuickCommand=False): message = message + "\n" # message = message.encode() - print("Sending: " + str(message)) + print("Sending: " + str(message).rstrip('\n')) self.bufferSpace = self.bufferSpace - len( message diff --git a/File/gcodeFile.py b/File/gcodeFile.py index 70ee4ac9..22b5917a 100644 --- a/File/gcodeFile.py +++ b/File/gcodeFile.py @@ -25,6 +25,7 @@ class GCodeFile(MakesmithInitFuncs): yPosition = 0 zPosition = 0 + lineNumber = 0 # the line number currently being processed absoluteFlag = 0 @@ -41,7 +42,7 @@ def serializeGCode(self): return sendStr def loadUpdateFile(self): - if (self.data.units=="MM"): + if self.data.units == "MM": self.canvasScaleFactor = self.MILLIMETERS else: self.canvasScaleFactor = self.INCHES @@ -174,9 +175,12 @@ def drawLine(self, gCodeLine, command): if command == "G00": # draw a dashed line + print("G00 issued so first points are added") self.line.append(Line()) # points = (), width = 1, group = 'gcode') self.line[-1].type = "line" self.line[-1].dashed = True + print("xPos,yPos:"+str(self.xPosition)+", "+str(self.yPosition)) + print("xTgt,yTgt:" + str(xTarget) + ", " + str(yTarget)) self.addPoint(self.xPosition, self.yPosition) self.addPoint(xTarget, yTarget) else: @@ -461,8 +465,6 @@ def updateOneLine(self, fullString): self.data.gcodeShift[0] * scaleFactor, self.data.gcodeShift[1] * scaleFactor, ] - self.xPosition *= scaleFactor - self.yPosition *= scaleFactor self.data.tolerance = 0.020 value = float(self.data.config.getValue("Computed Settings", "distToMove"))/25.4 self.data.config.setValue("Computed Settings", "distToMove", value) @@ -477,7 +479,6 @@ def updateOneLine(self, fullString): self.data.gcode_queue.put("G20 ") print("gcodeShift=" + str(self.data.gcodeShift[0]) + ", " + str(self.data.gcodeShift[1])) self.canvasScaleFactor = self.INCHES - # self.data.units = "INCHES" if gString == "G21": ''' @@ -505,7 +506,6 @@ def updateOneLine(self, fullString): self.data.gcode_queue.put("G21 ") print("gcodeShift=" + str(self.data.gcodeShift[0]) + ", " + str(self.data.gcodeShift[1])) self.canvasScaleFactor = self.MILLIMETERS - # self.data.units = "MM" if gString == "G90": self.absoluteFlag = 0 @@ -532,8 +532,13 @@ def updateGcode(self): # reset variables self.data.backgroundRedraw = False - self.xPosition = self.data.gcodeShift[0] * self.canvasScaleFactor - self.yPosition = self.data.gcodeShift[1] * self.canvasScaleFactor + #print("canvasScaleFactor="+str(self.canvasScaleFactor)) + if (self.data.units=="INCHES"): + scaleFactor = 1.0; + else: + scaleFactor = 1/25.4; + self.xPosition = self.data.gcodeShift[0] * scaleFactor + self.yPosition = self.data.gcodeShift[1] * scaleFactor self.zPosition = 0 self.prependString = "G00 " From cdb9c699963f6471d14a51436be849750cd3d85e Mon Sep 17 00:00:00 2001 From: John Hogan Date: Thu, 25 Oct 2018 14:41:19 -0400 Subject: [PATCH 008/685] mobile page updates --- static/scripts/frontpage.js | 9 +++--- templates/frontpage.html | 16 +++++----- templates/frontpage_mobile.html | 14 +++++++-- templates/settings_mobile.html | 56 ++++++++++++++++++++++++++------- webcontrol.json | 8 ++--- 5 files changed, 71 insertions(+), 32 deletions(-) diff --git a/static/scripts/frontpage.js b/static/scripts/frontpage.js index cdb2ee38..958b45e1 100644 --- a/static/scripts/frontpage.js +++ b/static/scripts/frontpage.js @@ -130,27 +130,26 @@ function processRequestedSetting(msg){ function processPositionMessage(msg){ var json = JSON.parse(msg.data); - $('#positionMessage').html('

XPos:'+Math.round(json.xval,2)+' Ypos:'+Math.round(json.yval,2)+' ZPos:'+Math.round(json.zval,2)+'

'); + $('#positionMessage').html('XPos:'+json.xval.toFixed(2)+' Ypos:'+json.yval.toFixed(2)+' ZPos:'+json.zval.toFixed(2)); positionUpdate(json.xval,json.yval,json.zval); } function processHomePositionMessage(msg){ var json = JSON.parse(msg.data); - $('#homePositionMessage').html('

XPos:'+Math.round(json.xval,2)+' Ypos:'+Math.round(json.yval,2)+'

'); + $('#homePositionMessage').html('XPos:'+json.xval.toFixed(2)+' Ypos:'+json.yval.toFixed(2)); homePositionUpdate(json.xval,json.yval); } function gcodeUpdate(msg){ console.log("updating gcode"); if (gcode!=null) { - console.log("removing gcode"); - //gcode.remove(); + //console.log("removing gcode"); gcode.remove(); } gcode = draw.group(); var data = JSON.parse(msg.data) data.forEach(function(line) { - console.log(line) + //console.log(line) if (line.type=='line'){ if (line.dashed==true) { gcode.add(draw.polyline(line.points).fill('none').stroke({width:.1, color: '#AA0'})) diff --git a/templates/frontpage.html b/templates/frontpage.html index 2191b575..2fbc831a 100644 --- a/templates/frontpage.html +++ b/templates/frontpage.html @@ -103,19 +103,19 @@

Controls

-
-

Position

+
+
Sled:
-
-

+
+
-
-

Home

+
+
Home:
-
-

+
+
diff --git a/templates/frontpage_mobile.html b/templates/frontpage_mobile.html index a44ac757..21e64a56 100644 --- a/templates/frontpage_mobile.html +++ b/templates/frontpage_mobile.html @@ -124,12 +124,20 @@

Controls

-

Position

+
Position
-
-

+
+
+
+
+
Home:
+
+
+
+
+
diff --git a/templates/settings_mobile.html b/templates/settings_mobile.html index dabbe4f7..c335bc50 100644 --- a/templates/settings_mobile.html +++ b/templates/settings_mobile.html @@ -14,19 +14,26 @@

{{setting.title}}

{% if setting.key =="COMport" %} - + {% if ports|length == 0 %} + - {% endfor %} - {% endif %} - + {% else %} + {% for port in ports %} + + {% endfor %} + {% endif %} + +
+ +
+
{% elif setting.type=="options" %} +
- +
diff --git a/webcontrol.json b/webcontrol.json index d1966ae8..98303002 100644 --- a/webcontrol.json +++ b/webcontrol.json @@ -7,7 +7,7 @@ "section": "Advanced Settings", "title": "Max touch Z-axis plunge", "type": "string", - "value": "0.0" + "value": "50" }, { "default": 8113.73, @@ -44,7 +44,7 @@ "section": "Advanced Settings", "title": "Chain Tolerance, Left Chain", "type": "string", - "value": "0.0" + "value": "0" }, { "default": 0, @@ -53,7 +53,7 @@ "section": "Advanced Settings", "title": "Chain Tolerance, Right Chain", "type": "string", - "value": "0.0" + "value": "0" }, { "default": "Top", @@ -66,7 +66,7 @@ "section": "Advanced Settings", "title": "Top/Bottom Chain Feed", "type": "options", - "value": "Top" + "value": "Bottom" }, { "default": 1650, @@ -76,7 +76,7 @@ "section": "Advanced Settings", "title": "Extend Chain Distance", "type": "string", - "value": "2032" + "value": "1650" }, { "default": 3360, @@ -86,7 +86,7 @@ "section": "Advanced Settings", "title": "Chain Length", "type": "string", - "value": "4267" + "value": "3360" }, { "default": 7560.0, @@ -131,7 +131,7 @@ "section": "Advanced Settings", "title": "Home Position X Coordinate", "type": "string", - "value": 0.0 + "value": "0.0" }, { "default": 0.0, @@ -140,7 +140,7 @@ "section": "Advanced Settings", "title": "Home Position Y Coordinate", "type": "string", - "value": -50.79999999999998 + "value": "-3.36" }, { "default": 0, @@ -181,7 +181,7 @@ "section": "Advanced Settings", "title": "Rotation Radius for Triangular Kinematics", "type": "string", - "value": "132.75" + "value": "139.1" }, { "default": 0, @@ -191,7 +191,7 @@ "section": "Advanced Settings", "title": "Chain Sag Correction Value for Triangular Kinematics", "type": "string", - "value": "33.00" + "value": "33" }, { "default": 0, @@ -221,7 +221,7 @@ "section": "Advanced Settings", "title": "Top Beam Tilt (Experimental)", "type": "string", - "value": "0.0" + "value": "0" }, { "default": 0, @@ -311,7 +311,7 @@ "section": "Advanced Settings", "title": "Kp Velocity", "type": "string", - "value": "7" + "value": "5" }, { "default": 0, @@ -379,7 +379,7 @@ "section": "Advanced Settings", "title": "PWM frequency for motor control", "type": "options", - "value": "490Hz" + "value": "31,000Hz" }, { "default": 2.0, @@ -493,7 +493,7 @@ "firmwareKey": 38, "key": "chainOverSprocketComputed", "type": "string", - "value": 1 + "value": 2 }, { "firmwareKey": 39, @@ -517,25 +517,25 @@ "default": 1.0, "key": "distToMove", "type": "float", - "value": 0.0 + "value": 2.0 }, { "default": 0.5, "key": "distToMoveZ", "type": "float", - "value": 3.0 + "value": 1.0 }, { "default": "MM", "key": "units", "type": "string", - "value": "MM" + "value": "INCHES" }, { "default": "MM", "key": "unitsZ", "type": "string", - "value": 3 + "value": "INCHES" } ], "Maslow Settings": [ @@ -546,7 +546,7 @@ "section": "Maslow Settings", "title": "Serial Connection", "type": "string", - "value": "/dev/ttyACM0" + "value": "COM5" }, { "default": 2978.4, @@ -556,7 +556,7 @@ "section": "Maslow Settings", "title": "Distance Between Motors", "type": "string", - "value": "3581.481" + "value": "3002.7" }, { "default": 2438.4, @@ -586,7 +586,7 @@ "section": "Maslow Settings", "title": "Motor Offset Height in MM", "type": "string", - "value": "510" + "value": "405" }, { "default": 310, @@ -626,7 +626,7 @@ "section": "Maslow Settings", "title": "z-axis installed", "type": "bool", - "value": 1 + "value": 0 }, { "default": 3.17, @@ -645,7 +645,7 @@ "section": "Maslow Settings", "title": "Open File", "type": "string", - "value": "C:\\Users\\john\\Desktop\\Maslow\\sled\\part.nc" + "value": "/Users/johnboiles/Downloads/Table Legs 2 (1).nc" }, { "default": "", @@ -654,7 +654,7 @@ "section": "Maslow Settings", "title": "Macro 1", "type": "string", - "value": "$$" + "value": "G0 X0 Y0" }, { "default": "Macro 1", @@ -663,7 +663,7 @@ "section": "Maslow Settings", "title": "Macro 1 Title", "type": "string", - "value": "$$" + "value": "Macro 1" }, { "default": "", @@ -672,7 +672,7 @@ "section": "Maslow Settings", "title": "Macro 2", "type": "string", - "value": "B02 L1 R0" + "value": "G0 X-9 Y9" }, { "default": "Macro 2", @@ -681,7 +681,7 @@ "section": "Maslow Settings", "title": "Macro 2 Title", "type": "string", - "value": "B02 L1 R0" + "value": "Macro 2" }, { "default": 5, @@ -708,115 +708,115 @@ "firmwareKey": 45, "key": "xyErrorArray", "type": "string", - "value": "12903,12506,12414,12036,11804,11482,10993,10563,10964,10775,10417,9837,9775,9069,9316,9298,9134,8802,8439,7895,7763,7321,7229,6836,6378,6198,6092,5911,5782,5429,5031,13269,13014,12685,12296,11971,11768,11489,11313,10645,10689,10395,10388,9853,9785,9426,9461,9432,9134,8824,8404,8134,8032,7567,7437,6884,7144,6692,6809,6220,6069,5563,14045,13449,13408,12797,12663,12122,12107,11784,11572,11289,10726,10531,10289,10282,10418,10071,10053,9635,9396,9089,8745,8435,8395,8022,7919,7970,7502,7234,6740,6659,5987,14201,13489,13667,13170,12791,12579,11997,11947,11705,11348,11393,10835,10661,10431,10655,10313,10191,10055,9556,9531,9101,9073,9011,8727,8135,7959,7782,7682,7421,6918,6674,15003,14294,14592,13840,13423,13061,12970,12372,12302,12000,11895,11333,11488,11172,11379,11152,10935,10801,10463,10291,10036,9675,9614,9189,8766,9164,8819,8236,7868,7219,6748,15247,14653,14695,14172,13476,13209,12976,12650,12632,12467,12190,11810,11843,11506,11480,11116,11363,10708,10806,10298,10282,9808,9820,9396,9308,8773,9023,8329,8212,7521,7784,16329,15380,15469,14587,14685,14269,13633,13727,13304,13364,12959,12357,12579,12253,11973,12167,11894,11840,11749,11733,11036,10666,10688,10169,9746,10089,9628,9444,9300,8687,8661,15499,15528,15150,15417,15254,14626,14706,13598,13555,13181,12702,12617,12412,12356,12340,12328,12429,12176,11779,11754,11408,11347,11206,10585,10098,10117,9990,9663,8074,8099,7419,15574,15982,16617,16556,15145,15617,15360,14328,14597,13690,13463,13180,13492,12557,12575,12985,12887,12477,12475,12147,12045,12035,11473,11067,10510,10468,11015,10709,10029,9843,9161,18101,16510,16730,15680,15974,15182,15884,14673,15012,14955,14627,13787,13636,13655,13656,13142,13140,12971,11753,13410,12674,12524,11620,11308,11396,11544,11068,11191,10444,8857,8020,19049,18172,16825,15851,15924,15856,15836,15141,16594,14638,14215,14440,14381,13800,13828,13439,13077,13380,13505,13463,13095,12246,12302,12175,11252,12247,11368,11633,10438,10716,10664,19609,18179,16821,16457,16476,15831,15744,16216,16079,14686,15643,14696,15158,13578,14988,14824,14942,13811,13762,14126,12650,13338,13275,13127,11595,12820,11740,10525,10513,9135,10873,17646,17571,19053,18941,16914,16390,16434,15891,15995,16020,15064,15707,14748,15929,14652,15259,15115,14125,14035,13887,13885,14321,13840,13299,13071,12959,13127,12893,11138,12406,11969,17553,17527,18704,17593,17529,17982,17689,16297,16285,16245,16079,15745,14839,16064,15320,16040,15850,15616,14736,14600,14502,14332,13622,12899,12866,12488,12312,12532,12488,12453,11860,17568,20708,20745,18990,17585,18065,17614,16999,17014,17051,17753,16578,16537,16299,15752,15704,15963,15866,15651,14966,15070,14864,14490,14419,13905,13908,13930,12630,13734,13729,12977,2037,2975,3071,4139,4821,5554,5468,6247,5562,6984,8315,7427,8938,9812,8818,10119,9592,10605,10538,11613,10873,12065,11427,12125,12670,12481,12955,12880,12498,13252,13498,1414,2207,2557,3084,3718,4431,5539,4603,5509,5461,6269,6181,7455,7427,8090,7983,8896,9245,9263,9792,10063,10142,11419,10883,11367,11162,11695,11686,12011,12388,13032,2577,3078,3104,3493,4010,4145,4799,5337,4725,5815,5604,6628,7178,7746,7175,8112,8028,8305,8521,9211,9365,10181,10233,10263,10815,10718,11724,11685,12453,12354,13473,1877,2607,2474,2670,3063,3993,3615,4248,5505,4929,5631,6146,5664,6567,6374,7113,7038,7828,8314,8353,8805,8763,9615,9931,9926,10956,10988,11667,11666,12110,12845,2860,2858,2810,3494,3840,4342,4827,4744,5454,5073,5740,5836,6275,6877,6591,7295,6818,7794,7234,8106,8157,9041,9136,9805,10377,10393,11197,11530,12381,12462,13450,1841,2537,2576,2748,3073,3923,3860,4462,4482,5420,4738,5617,5779,5956,6498,6545,6438,7162,7185,7672,7610,8405,8369,9173,9290,10281,10424,11457,11521,12598,12850,2945,2713,2774,3088,4216,4120,4293,4417,4778,4754,5127,5227,5302,5749,5991,6254,6804,6290,7194,7122,7873,8397,8517,9362,9964,10211,11038,10680,11378,11794,11796,1942,2049,2401,3165,3497,4030,4037,4711,4718,4479,5142,5117,5276,6233,6251,6474,6535,6773,7396,7379,7124,8276,8523,8358,10192,10143,11065,11549,13049,13022,13686,1995,2778,3505,3443,3602,3716,4280,4284,4861,4896,4896,5051,5381,5437,5663,5379,6568,6049,6051,6521,7954,7927,8785,9314,9187,10595,10931,10739,11644,11865,12713,3567,2486,3506,3493,3059,3444,4220,4701,4656,4842,4973,5199,4830,4939,5027,6210,6206,6338,6688,7054,7791,7901,8134,8741,9021,10231,10234,10858,11591,13489,13312,3154,3057,2566,3443,3722,3878,4788,4592,4761,4687,4781,5602,5469,5090,6058,5845,6025,6022,6212,7127,7707,7895,7939,9162,9801,9557,11101,10725,12406,11750,11797,3679,3580,2696,3756,4016,3927,3859,4472,4594,4588,4864,5095,5231,5518,5452,5878,5891,6443,6439,6940,7414,7308,8511,8316,9468,9463,11249,12261,12247,12758,12914,2596,2636,4249,4128,4323,4219,4201,4716,5126,5120,5529,5255,5506,5324,5687,5949,5905,6199,6546,6692,6768,7567,8122,8920,8869,9572,10162,10734,12537,11972,12930,3046,3006,3525,3505,4485,4430,4760,5543,5604,5067,5298,6253,4615,5598,6006,6474,6486,6629,6522,7323,7199,8464,8800,10013,10011,10797,11247,12381,12447,12166,12967,3045,4851,4862,4741,4301,5025,4302,4939,4970,5010,5267,6557,6555,5764,6129,6098,5830,7003,6644,6399,6748,7344,7966,8470,9340,9303,11185,12442,11779,11784,13300" + "value": "-2943,-2646,-2286,-1940,-1950,-1583,-1493,-1373,-1193,-1193,-980,-680,-623,-630,-606,-630,-570,-726,-766,-680,-656,-540,-566,-230,-36,290,360,396,690,970,1186,-2416,-2653,-2163,-1993,-1670,-1246,-1356,-1146,-1190,-1123,-933,-646,-553,-543,-600,-696,-536,-580,-553,-520,-423,-420,-266,-113,120,240,260,506,626,866,1163,-1736,-2126,-2160,-1920,-1673,-1436,-1180,-1216,-1170,-1146,-883,-813,-716,-616,-463,-560,-506,-613,-553,-380,-350,-320,-373,-256,123,143,100,393,590,510,1453,-1840,-1456,-1730,-1673,-1556,-1266,-1226,-1066,-1030,-1016,-750,-576,-466,-436,-296,-426,-363,-433,-226,-63,-96,-96,-163,120,190,293,60,253,390,450,926,-1220,-1433,-1590,-1406,-1390,-913,-933,-960,-1020,-910,-750,-523,-466,-446,-273,-183,-266,-246,-280,-13,-3,-20,-46,33,146,283,236,160,160,180,210,233,-516,-933,-806,-1086,-740,-783,-743,-590,-606,-413,-326,-433,-303,-6,-6,-70,-186,-103,120,226,16,-46,390,296,326,553,366,660,56,-1053,503,-506,-656,-576,-830,-620,-706,-770,-633,-623,-286,-276,-403,-366,-130,-6,170,150,120,260,223,150,220,230,353,403,260,120,-10,-650,-1433,936,126,-283,-686,-360,-563,-236,-393,-313,-243,-240,-176,-243,-176,96,226,233,193,200,386,276,390,220,313,326,283,333,16,-150,-276,-1883,1320,536,-36,-326,-190,-386,-393,-443,-390,-536,-230,-220,-210,-100,-33,120,120,203,200,393,316,230,420,156,10,163,190,-330,-650,-1213,-2003,2310,1543,680,336,-530,-156,-206,-296,-280,-296,90,96,40,190,250,293,376,303,453,480,323,236,343,110,163,123,213,-76,-66,-1486,160,2106,1113,666,150,26,86,-6,-226,-66,-123,113,110,73,146,266,333,353,366,303,370,346,270,373,6,-120,-60,-153,-646,-643,-1920,-2413,3793,2636,1750,1163,483,310,196,-56,83,273,370,236,180,390,483,326,403,436,303,396,336,316,263,23,36,-63,-316,-340,-230,-1703,-2086,5916,1953,1780,786,623,563,343,136,283,300,466,253,156,400,433,226,120,310,223,296,120,40,113,-40,-303,-233,-493,-1406,-1210,-1203,-3400,2280,4226,1676,1173,716,1070,753,413,476,596,666,430,430,730,450,390,173,26,210,153,166,-63,130,90,-63,-283,-36,-33,-2563,-2376,-460,6720,3846,1103,1113,600,576,443,-73,310,226,330,416,343,370,216,-93,-43,-86,-76,-93,-386,-140,-46,-336,-50,-700,-1303,-1936,-2176,-4080,-2020,2320,2056,1466,1576,1646,1990,2040,1806,1223,2423,2606,2150,1780,1786,2433,2493,2610,2873,2460,2743,3176,2643,2746,2243,2136,2176,2613,2406,2410,2480,2810,2810,1536,2213,1786,1490,1630,1296,1646,1383,1610,1490,1973,1483,1886,1746,1756,1613,1963,2086,2733,2803,2830,2676,1970,2116,2096,2473,2453,2300,2466,3016,2893,1873,1680,1776,1216,940,1656,1473,1433,1353,1496,1666,1673,966,1966,1490,1560,1910,2203,1703,2056,2080,2156,1886,1390,1920,2009,2383,2636,2686,2546,2463,2396,1890,1306,1460,1366,1306,1780,1480,1310,1266,1146,950,1250,1413,1463,1336,1973,1540,1746,1756,1773,2376,1810,1736,1903,1953,2336,2786,2823,2766,2760,2296,2025,1590,1793,1563,1293,1173,1193,996,1046,640,523,1600,1196,1466,1206,1426,1506,1766,1570,2063,2093,2090,1983,2110,2173,2363,2593,2520,3296,3060,2623,2440,1693,1686,1413,1590,1390,1153,963,1330,863,953,1503,1010,1336,1706,1723,1553,1373,1566,1833,2216,1503,2370,2386,2176,2493,2736,2776,3843,3413,2606,2433,2036,2036,1996,1366,1043,1093,1296,1143,740,1393,1446,1540,1290,1283,1293,1360,1083,1526,1590,1623,1996,2036,2236,2253,2343,2943,3046,3740,3326,2850,2880,2273,2120,1896,1966,1556,1450,1456,1513,920,1080,1530,1000,910,1386,1433,1526,1440,1873,1836,1893,1843,2343,2583,2646,3000,3263,3430,4093,3673,2856,2783,2540,2246,2056,1753,1933,1583,1303,1413,1073,1350,743,1250,970,1243,1246,1503,1223,1523,1860,1646,1973,2286,2480,2830,3140,3563,3606,4240,4035,3363,3236,2933,2063,2236,1976,1856,1600,1766,1400,1226,1340,1020,1103,1240,880,1406,1353,1593,1946,2180,2160,2180,2423,2850,2830,3443,3546,4296,3743,4420,3666,3156,2843,2233,2326,2183,1966,1943,1620,1286,1210,1323,1130,1183,940,1193,1453,1273,1650,1566,1880,1876,2240,2526,2696,2946,3486,3636,4393,4246,4316,3670,3550,3116,2620,2340,2263,2073,1753,1830,1606,1133,1283,1266,1333,1333,1373,1693,1866,1776,1936,2113,2200,2536,2836,2916,3170,3376,3806,4170,4136,4946,3643,3773,3076,2643,2680,2506,1866,1803,1386,1553,1340,1353,1063,1300,910,1213,1470,1613,1863,1776,2110,2206,2290,2766,2776,3110,3693,3253,3943,4193,4360,4680,3590,3453,2833,2833,2270,2283,2236,1706,1990,1820,1700,1793,1760,1706,1983,1896,2300,2503,2440,2780,2936,2856,2810,3186,3196,3230,4180,4290,2975,5513,4716,3596,3660,3166,2496,2723,2596,2380,1763,1856,1890,1903,1723,1606,2103,2160,2070,2270,2653,2850,3003,3090,3133,3280,3723,3716,3883,3880,4336,4056" }, { "default": "0", "firmwareKey": 47, "key": "calX0", "type": "string", - "value": "12.306828365383796" + "value": "-0.057924589946894256" }, { "default": "0", "firmwareKey": 48, "key": "calX1", "type": "string", - "value": "-0.0030334144723844995" + "value": "-5.425168628115157e-05" }, { "default": "0", "firmwareKey": 49, "key": "calX2", "type": "string", - "value": "-0.006484037277598355" + "value": "-0.0010468132007692588" }, { "default": "0", "firmwareKey": 50, "key": "calX3", "type": "string", - "value": "-3.780558156344352e-07" + "value": "3.1345687691376675e-06" }, { "default": "0", "firmwareKey": 51, "key": "calX4", "type": "string", - "value": "4.988530237200542e-08" + "value": "-4.754334366448905e-08" }, { "default": "0", "firmwareKey": 52, "key": "calX5", "type": "string", - "value": "3.4616351643045745e-07" + "value": "-6.886070117753619e-07" }, { "default": "0", "firmwareKey": 53, "key": "calY0", "type": "string", - "value": "6.2635116724449595" + "value": "1.2291766286321435" }, { "default": "0", "firmwareKey": 54, "key": "calY1", "type": "string", - "value": "0.004282628129145149" + "value": "0.0002786276211441312" }, { "default": "0", "firmwareKey": 55, "key": "calY2", "type": "string", - "value": "0.0013022863069535669" + "value": "-0.000797449713947047" }, { "default": "0", "firmwareKey": 56, "key": "calY3", "type": "string", - "value": "9.597606000766018e-07" + "value": "2.785955472705101e-07" }, { "default": "0", "firmwareKey": 57, "key": "calY4", "type": "string", - "value": "8.81047492386211e-07" + "value": "1.515479563526153e-06" }, { "default": "0", "firmwareKey": 58, "key": "calY5", "type": "string", - "value": "4.338345870544009e-06" + "value": "2.1318284035692225e-06" }, { "default": "0", "key": "opticalCenterX", "type": "string", - "value": "316.4" + "value": "681.7" }, { "default": "0", "key": "opticalCenterY", "type": "string", - "value": "213.9" + "value": "511.8" }, { "default": "1.0", "key": "scaleX", "type": "string", - "value": "1.028" + "value": "0.998263889" }, { "default": "1.0", "key": "scaleY", "type": "string", - "value": "1.0" + "value": "1.002604167" }, { "default": 5, From c29ce670304e017fb4b00091b04431f0db47c1f3 Mon Sep 17 00:00:00 2001 From: madgrizzle Date: Fri, 26 Oct 2018 23:04:23 +0000 Subject: [PATCH 017/685] fixed typo --- Connection/serialPort.py | 2 +- static/scripts/frontpage.js | 2 +- webcontrol.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Connection/serialPort.py b/Connection/serialPort.py index 14a8b288..de935137 100644 --- a/Connection/serialPort.py +++ b/Connection/serialPort.py @@ -64,7 +64,7 @@ def openConnection(self, *args): # self.data.message_queue is the queue which handles passing CAN messages between threads # print "serialport.self.app.logger="+str(self.app.logger) self.data.ui_queue.put( - "Message: connectionStatus:_" + json.dumps({'status': 'disconnected', 'port': 'none'}) + "Action: connectionStatus:_" + json.dumps({'status': 'disconnected', 'port': 'none'}) ) # the "_" facilitates the parse x = SerialPortThread() x.data = self.data diff --git a/static/scripts/frontpage.js b/static/scripts/frontpage.js index e3c78e05..54decfdd 100644 --- a/static/scripts/frontpage.js +++ b/static/scripts/frontpage.js @@ -130,7 +130,7 @@ function processRequestedSetting(msg){ function processPositionMessage(msg){ var _json = JSON.parse(msg.data); - $('#positionMessage').html('XPos:'+_json.xval.toFixed(2)+' Ypos:'+_json.yval.toFixed(2)+' ZPos:'+_json.zval.toFixed(2)); + $('#positionMessage').html('XPos:'+parseFloat(_json.xval).toFixed(2)+' Ypos:'+parseFloat(_json.yval).toFixed(2)+' ZPos:'+parseFloat(_json.zval).toFixed(2)); positionUpdate(_json.xval,_json.yval,_json.zval); } diff --git a/webcontrol.json b/webcontrol.json index 98303002..23c33b60 100644 --- a/webcontrol.json +++ b/webcontrol.json @@ -546,7 +546,7 @@ "section": "Maslow Settings", "title": "Serial Connection", "type": "string", - "value": "COM5" + "value": "/dev/ttyACM0" }, { "default": 2978.4, From 2f5775c73956aff255dd700df2c34c50af124628 Mon Sep 17 00:00:00 2001 From: madgrizzle Date: Fri, 26 Oct 2018 23:37:12 +0000 Subject: [PATCH 018/685] versioned javascript --- templates/base.html | 2 +- templates/frontpage.html | 2 +- templates/frontpage_mobile.html | 4 ++-- templates/opticalCalibration.html | 2 +- templates/setSprockets.html | 2 +- templates/zaxis.html | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/templates/base.html b/templates/base.html index 093463c6..85f257bb 100644 --- a/templates/base.html +++ b/templates/base.html @@ -2,7 +2,7 @@ {% block title %}{% endblock %} - WebControl - + diff --git a/templates/frontpage.html b/templates/frontpage.html index 2fbc831a..1b73bbdd 100644 --- a/templates/frontpage.html +++ b/templates/frontpage.html @@ -8,7 +8,7 @@ - + {% endblock %} diff --git a/templates/frontpage_mobile.html b/templates/frontpage_mobile.html index 21e64a56..e2c130c5 100644 --- a/templates/frontpage_mobile.html +++ b/templates/frontpage_mobile.html @@ -1,7 +1,7 @@ {% extends 'base.html' %} {% block header %} - + {% endblock %} @@ -9,7 +9,7 @@ - + {% endblock %} diff --git a/templates/opticalCalibration.html b/templates/opticalCalibration.html index a6c94e6b..19dd54e6 100644 --- a/templates/opticalCalibration.html +++ b/templates/opticalCalibration.html @@ -147,7 +147,7 @@

Sled Position

{% endblock %} {% block javascript %} - + + {% endblock %} diff --git a/templates/zaxis.html b/templates/zaxis.html index b575e947..bdd7a98a 100644 --- a/templates/zaxis.html +++ b/templates/zaxis.html @@ -34,5 +34,5 @@ {% endblock %} {% block javascript %} - + {% endblock %} From c994bed03cd5074d91ddb2b72cc4e70e18922298 Mon Sep 17 00:00:00 2001 From: madgrizzle Date: Sat, 27 Oct 2018 01:59:40 +0000 Subject: [PATCH 019/685] testing --- static/scripts/frontpage.js | 11 ++++------- templates/frontpage.html | 2 +- webcontrol.json | 4 ++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/static/scripts/frontpage.js b/static/scripts/frontpage.js index 54decfdd..112a5272 100644 --- a/static/scripts/frontpage.js +++ b/static/scripts/frontpage.js @@ -31,20 +31,18 @@ sled.add(draw.line(1.5*scale,-0.0*scale,1.5*scale,3.0*scale).stroke({width:.1,co sled.add(draw.line(-0.0*scale,1.5*scale,3.0*scale,1.5*scale).stroke({width:.1,color:"#F00"})) sled.add(draw.circle(3*scale).stroke({width:.1,color:"#F00"}).fill({color:"#fff",opacity:0})) sled.center(originX,originY) -//sled.center(vx,vy) -draw.zoom(10, {x:originX,y:originY}); var home = draw.group() home.add(draw.line(1.5*scale,-0.0*scale,1.5*scale,3.0*scale).stroke({width:.1,color:"#0F0"})) home.add(draw.line(-0.0*scale,1.5*scale,3.0*scale,1.5*scale).stroke({width:.1,color:"#0F0"})) home.add(draw.circle(3*scale).stroke({width:.1,color:"#0F0"}).fill({color:"#fff",opacity:0})) home.center(originX,originY) -//sled.center(vx,vy) +/ + draw.zoom(10, {x:originX,y:originY}); function positionUpdate(x,y,z){ var _x, _y =0 - //console.log(x) if ($("#units").text()=="MM"){ _x = originX+x*scale/25.4 _y = originY-y*scale/25.4 @@ -55,8 +53,8 @@ function positionUpdate(x,y,z){ _y = originY-y*scale _z = z*scale/2*360 } - sled.center(_x, _y); - //sled.rotate(_z); + sled.center(_x, _y) + } function homePositionUpdate(x,y){ @@ -70,7 +68,6 @@ function homePositionUpdate(x,y){ _x = originX+x*scale; _y = originY-y*scale } - //console.log("home:"+_x+", "+_y) home.center(_x, _y); } diff --git a/templates/frontpage.html b/templates/frontpage.html index 1b73bbdd..1972b84e 100644 --- a/templates/frontpage.html +++ b/templates/frontpage.html @@ -8,7 +8,7 @@ - + {% endblock %} diff --git a/webcontrol.json b/webcontrol.json index 23c33b60..150f97af 100644 --- a/webcontrol.json +++ b/webcontrol.json @@ -140,7 +140,7 @@ "section": "Advanced Settings", "title": "Home Position Y Coordinate", "type": "string", - "value": "-3.36" + "value": "0.0" }, { "default": 0, @@ -523,7 +523,7 @@ "default": 0.5, "key": "distToMoveZ", "type": "float", - "value": 1.0 + "value": 0.07 }, { "default": "MM", From 69769b01c6177e5b80a0c1a2c8d494d4bc48af96 Mon Sep 17 00:00:00 2001 From: John Boiles Date: Sat, 27 Oct 2018 13:01:09 -0700 Subject: [PATCH 020/685] Smaller generated docker images --- Dockerfile | 36 +++++++++++++++++++++----- requirements.txt | 6 ++--- tools/download_build_install_opencv.sh | 3 ++- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index fef47df3..d72cc929 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM arm32v7/python:3.5.6-slim-stretch +FROM arm32v7/python:3.5.6-slim-stretch as builder # Install dependencies needed for building and running OpenCV RUN apt-get update @@ -34,14 +34,36 @@ RUN chmod +x /download_build_install_opencv.sh && /download_build_install_opencv ADD requirements.txt /requirements.txt # Remove opencv and numpy from requirements (since they're already installed) RUN sed -i '/opencv-python.*/d' /requirements.txt && sed -i '/numpy.*/d' /requirements.txt -RUN pip install -r /requirements.txt +# TODO: Maybe we can cache wheel files outside this container, for more granular reuse when requiremnts.txt changes +RUN pip install -r /requirements.txt +ADD . /WebControl +# Clean up the /WebControl dir a bit to slim it down +# TODO: Is there a more automatic way to do this? +RUN rm -rf /WebControl/.venv && rm -rf /WebControl/.git +# Pre-compile the pyc files (for faster Docker image startup) +RUN python -m compileall /WebControl -# Remove no-longer-needed gevent compilation libraries -# TODO: This seems to also remove libatlas-base-dev which is required by numpy -#RUN apt-get purge -y --auto-remove --allow-remove-essential gcc libevent-dev wget unzip sed -# Copy the source -ADD . /WebControl +FROM arm32v7/python:3.5.6-slim-stretch + +# Pip wheels compiled in the builder +COPY --from=builder /root/.cache /root/.cache +# requirements.txt with opencv and numpy removed +COPY --from=builder /requirements.txt /requirements.txt +# Required shared libraries +COPY --from=builder /usr/local/lib/python3.5/site-packages/cv2.cpython-35m-arm-linux-gnueabihf.so /usr/local/lib/python3.5/site-packages/cv2.cpython-35m-arm-linux-gnueabihf.so +COPY --from=builder /usr/lib/libf77blas.so /usr/lib/libf77blas.so +COPY --from=builder /usr/lib/libf77blas.so.3 /usr/lib/libf77blas.so.3 +COPY --from=builder /usr/lib/libcblas.so.3 /usr/lib/libcblas.so.3 +COPY --from=builder /usr/lib/libatlas.so.3 /usr/lib/libatlas.so.3 +COPY --from=builder /usr/lib/libblas.so.3 /usr/lib/libblas.so.3 +COPY --from=builder /usr/lib/arm-linux-gnueabihf/libgfortran.so.3 /usr/lib/arm-linux-gnueabihf/libgfortran.so.3 +COPY --from=builder /usr/lib/liblapack.so.3 /usr/lib/liblapack.so.3 + +RUN pip install numpy && pip install -r /requirements.txt && rm -rf /root/.cache + +# Copy the pre-compiled source from the builder +COPY --from=builder /WebControl /WebControl WORKDIR /WebControl EXPOSE 5000/tcp diff --git a/requirements.txt b/requirements.txt index f8aa9f27..17d33d5d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,12 +8,12 @@ imutils==0.5.1 itsdangerous==0.24 Jinja2==2.10 MarkupSafe==1.0 -#numpy==1.15.2 -#opencv-python==3.4.3.18 +numpy==1.15.2 +opencv-python==3.4.3.18 pyserial==3.4 python-engineio==2.3.2 python-socketio==2.0.0 schedule==0.5.0 -#scipy==1.1.0 +scipy==1.1.0 six==1.11.0 Werkzeug==0.14.1 diff --git a/tools/download_build_install_opencv.sh b/tools/download_build_install_opencv.sh index b99383b7..0e760343 100644 --- a/tools/download_build_install_opencv.sh +++ b/tools/download_build_install_opencv.sh @@ -32,9 +32,10 @@ cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D BUILD_TESTS=OFF \ -D INSTALL_PYTHON_EXAMPLES=OFF \ -D BUILD_EXAMPLES=OFF \ + -D BUILD_PERF_TESTS=OFF \ .. -make -j4 +make -j$(python3 -c 'import multiprocessing as mp; print(int(mp.cpu_count() * 1.5))') make install ldconfig From c080c744582667cd803438fd9d15853873a570aa Mon Sep 17 00:00:00 2001 From: madgrizzle Date: Mon, 29 Oct 2018 02:27:18 +0000 Subject: [PATCH 021/685] latest --- Actions/actions.py | 20 ++++++++++++++++---- Actions/opticalCalibration.py | 9 +++++++-- config/config.py | 22 +++++++++++++++++----- main.py | 11 +++++++++++ requirements.txt | 6 +++--- templates/setSprockets.html | 5 +++++ 6 files changed, 59 insertions(+), 14 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index 0b5686ac..c7e14177 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -91,6 +91,11 @@ def processAction(self, msg): self.data.ui_queue.put( "Message: Error with setting sprockets zero value" ) + elif msg["data"]["command"] == "setSprocketsDefault": + if not self.setSprocketsDefault(): + self.data.ui_queue.put( + "Message: Error with setting sprockets as default" + ) elif msg["data"]["command"] == "updatePorts": if not self.updatePorts(): self.data.ui_queue.put("Message: Error with updating list of ports") @@ -514,11 +519,10 @@ def setSprockets(self, sprocket, degrees): self.data.gcode_queue.put("G91 ") if ( self.data.config.getValue("Advanced Settings", "chainOverSprocket") - == "Top" + == "Bottom" ): - self.data.gcode_queue.put("B09 " + sprocket + str(degValue) + " ") - else: - self.data.gcode_queue.put("B09 " + sprocket + "-" + str(degValue) + " ") + degValue *= -1.0 + self.data.gcode_queue.put("B09 " + sprocket + str(degValue) + " ") self.data.gcode_queue.put("G90 ") return True except Exception as e: @@ -569,6 +573,14 @@ def setSprocketsZero(self): print(e) return False + def setSprocketsDefault(self): + try: + self.data.gcode_queue.put("B08 ") + return True + except Exception as e: + print(e) + return False + def updatePorts(self): # refresh the list of available comports portsList = [] diff --git a/Actions/opticalCalibration.py b/Actions/opticalCalibration.py index fa499957..3d515906 100644 --- a/Actions/opticalCalibration.py +++ b/Actions/opticalCalibration.py @@ -44,6 +44,11 @@ def stopCut(self): def midpoint(self, ptA, ptB): return ((ptA[0] + ptB[0]) * 0.5, (ptA[1] + ptB[1]) * 0.5) + def distance(self, ptA, ptB): + a = ptA[0]-ptB[0] + b = ptA[1]-ptB[1] + return (math.sqrt((a*a+b*b))) + def removeOutliersAndAverage(self, data): mean = np.mean(data) sd = np.std(data) @@ -186,8 +191,8 @@ def on_CenterOnSquare(self, _dist, findCenter=False): (trbrX, trbrY) = self.midpoint(tr, br) (tltrX, tltrY) = self.midpoint(tl, tr) (blbrX, blbrY) = self.midpoint(bl, br) - xD = dist.euclidean((tlblX, tlblY), (trbrX, trbrY)) / self.markerX - yD = dist.euclidean((tltrX, tltrY), (blbrX, blbrY)) / self.markerY + xD = self.distance((tlblX, tlblY), (trbrX, trbrY)) / self.markerX + yD = self.distance((tltrX, tltrY), (blbrX, blbrY)) / self.markerY if xD == 0: # doing this to catch bad calibrations and stop crashing xD = 1.0 if yD == 0: diff --git a/config/config.py b/config/config.py index c1c5c9ae..9df1e884 100644 --- a/config/config.py +++ b/config/config.py @@ -7,16 +7,28 @@ """ import json import re +import os +from shutil import copyfile +from pathlib import Path + from __main__ import app from DataStructures.makesmithInitFuncs import MakesmithInitFuncs class Config(MakesmithInitFuncs): settings = {} + home = "" def __init__(self): + self.home = str(Path.home()) print("Initializing Configuration") - with open("webcontrol.json", "r") as infile: + if not os.path.isdir(self.home+"/.WebControl"): + print("creating "+self.home+"/.WebControl directory") + os.mkdir(self.home+"/.WebControl") + if not os.path.exists(self.home+"/.WebControl/webcontrol.json"): + print("copying webcontrol.json to "+self.home+"/.WebControl/") + copyfile("webcontrol.json",self.home+"/.WebControl/webcontrol.json") + with open(self.home+"/.WebControl/webcontrol.json", "r") as infile: self.settings = json.load(infile) # self.computeSettings(None, None, None, True); @@ -32,8 +44,8 @@ def updateQuickConfigure(self, result): self.setValue( "Advanced Settings", "chainOverSprocket", result["chainOverSprocket"] ) - self.setValue("Advanced Settings", "motorSpacingX", result["motorSpacingX"]) - self.setValue("Advanced Settings", "motorOffsetY", result["motorOffsetY"]) + self.setValue("Maslow Settings", "motorSpacingX", result["motorSpacingX"]) + self.setValue("Maslow Settings", "motorOffsetY", result["motorOffsetY"]) return True def setValue(self, section, key, value, recursionBreaker=False, isImporting = False): @@ -110,7 +122,7 @@ def setValue(self, section, key, value, recursionBreaker=False, isImporting = Fa if updated: if not recursionBreaker: self.computeSettings(None, None, None, True) - with open("webcontrol.json", "w") as outfile: + with open(self.home+"/.WebControl/webcontrol.json", "w") as outfile: # print ("writing file") json.dump( self.settings, outfile, sort_keys=True, indent=4, ensure_ascii=False @@ -218,7 +230,7 @@ def updateSettings(self, section, result): updated = True if updated: self.computeSettings(None, None, None, True) - with open("webcontrol.json", "w") as outfile: + with open(self.home+"/.WebControl/webcontrol.json", "w") as outfile: json.dump( self.settings, outfile, sort_keys=True, indent=4, ensure_ascii=False ) diff --git a/main.py b/main.py index 6c156231..df35586a 100644 --- a/main.py +++ b/main.py @@ -220,6 +220,15 @@ def quickConfigure(): resp.status_code = 200 return resp +@socketio.on("checkInRequested", namespace="/WebMCP") +def checkInRequested(msg): + socketio.emit("checkIn") + +@socketio.on("connect", namespace="/WebMCP") +def watchdog_connect(): + print("connected") + print(request.sid) + socketio.emit("my response") @socketio.on("my event", namespace="/MaslowCNC") def my_event(msg): @@ -413,6 +422,8 @@ def test_connect(): socketio.emit("my response", {"data": "Connected", "count": 0}) + + @socketio.on("disconnect", namespace="/MaslowCNC") def test_disconnect(): print("Client disconnected") diff --git a/requirements.txt b/requirements.txt index f8aa9f27..17d33d5d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,12 +8,12 @@ imutils==0.5.1 itsdangerous==0.24 Jinja2==2.10 MarkupSafe==1.0 -#numpy==1.15.2 -#opencv-python==3.4.3.18 +numpy==1.15.2 +opencv-python==3.4.3.18 pyserial==3.4 python-engineio==2.3.2 python-socketio==2.0.0 schedule==0.5.0 -#scipy==1.1.0 +scipy==1.1.0 six==1.11.0 Werkzeug==0.14.1 diff --git a/templates/setSprockets.html b/templates/setSprockets.html index 522e62b2..5e9d0299 100644 --- a/templates/setSprockets.html +++ b/templates/setSprockets.html @@ -117,6 +117,11 @@

Right Motor

+
+
+ +
+
{% endblock %} From 285331bf550844205731be0606a74f949dcb97f8 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Mon, 29 Oct 2018 11:20:13 -0400 Subject: [PATCH 022/685] better settings and updated ZAxis manual move notification --- Actions/actions.py | 17 +- Background/UIProcessor.py | 7 +- Background/messageProcessor.py | 2 + Connection/serialPort.py | 4 - Connection/serialPortThread.py | 9 +- config/config.py | 374 +++++++++++++++++---------------- templates/actions.html | 5 +- templates/base.html | 10 +- 8 files changed, 231 insertions(+), 197 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index c7e14177..e9259e62 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -51,7 +51,7 @@ def processAction(self, msg): if not self.testMotors(): self.data.ui_queue.put("Message: Error with testing motors") elif msg["data"]["command"] == "wipeEEPROM": - if not self.wipeEEPROM(): + if not self.wipeEEPROM(msg["data"]["arg"]): self.data.ui_queue.put("Message: Error with wiping EEPROM") elif msg["data"]["command"] == "pauseRun": if not self.pauseRun(): @@ -173,6 +173,10 @@ def home(self): def resetChainLengths(self): try: self.data.gcode_queue.put("B08 ") + if self.data.units == "INCHES": + self.data.gcode_queue.put("G20 ") + else: + self.data.gcode_queue.put("G21 ") return True except Exception as e: print(e) @@ -255,9 +259,16 @@ def testMotors(self): print(e) return False - def wipeEEPROM(self): + def wipeEEPROM(self, extent): try: - self.data.gcode_queue.put("$RST=* ") + if extent == "All": + self.data.gcode_queue.put("$RST=* ") + elif extent == "Settings": + self.data.gcode_queue.put("$RST=$ ") + elif extent == "Maslow": + self.data.gcode_queue.put("$RST=# ") + else: + return False #timer = threading.Timer(6.0, self.data.gcode_queue.put("$$")) #timer.start() return True diff --git a/Background/UIProcessor.py b/Background/UIProcessor.py index e8b5f588..e7b7ba69 100644 --- a/Background/UIProcessor.py +++ b/Background/UIProcessor.py @@ -26,6 +26,7 @@ def start(self, _app): ): # if there is new data to be read message = self.app.data.ui_queue.get() # send message to web for display in appropriate column + zAxisMessage = False if message != "": if message[0] == "<": # print message @@ -40,7 +41,7 @@ def start(self, _app): print("found adjust Z-Axis in message") socketio.emit( "requestedSetting", - {"setting": "pauseButtonSetting", "value": "Resume"}, + {"setting": "pauseButtonSetting", "value": "Resume", "resume": "resume"}, namespace="/MaslowCNC", ) self.activateModal("Notification:", message[9:]) @@ -155,10 +156,10 @@ def setPosOnScreen(self, message): } self.sendPositionMessage(position) - def activateModal(self, title, message): + def activateModal(self, title, message, resume="false"): socketio.emit( "activateModal", - {"title": title, "message": message}, + {"title": title, "message": message, "resume": resume}, namespace="/MaslowCNC", ) diff --git a/Background/messageProcessor.py b/Background/messageProcessor.py index ba059dda..541fb0a7 100644 --- a/Background/messageProcessor.py +++ b/Background/messageProcessor.py @@ -49,6 +49,8 @@ def start(self): if message.find("adjust Z-Axis") != -1: self.data.manualZAxisAdjust = True self.data.ui_queue.put(message) + if message[0:15] == "Message: Unable": + self.data.ui_queue.put(message) elif message[0:6] == "ALARM:": self.data.previousUploadStatus = self.data.uploadFlag self.data.uploadFlag = 0 diff --git a/Connection/serialPort.py b/Connection/serialPort.py index de935137..95b2720e 100644 --- a/Connection/serialPort.py +++ b/Connection/serialPort.py @@ -57,12 +57,8 @@ def connect(self, *args): def openConnection(self, *args): # This function opens the thread which handles the input from the serial port - # It only needs to be run once, it is run by connecting to the machine - # print("Attempting to open connection to controller") if not self.data.connectionStatus: - # self.data.message_queue is the queue which handles passing CAN messages between threads - # print "serialport.self.app.logger="+str(self.app.logger) self.data.ui_queue.put( "Action: connectionStatus:_" + json.dumps({'status': 'disconnected', 'port': 'none'}) ) # the "_" facilitates the parse diff --git a/Connection/serialPortThread.py b/Connection/serialPortThread.py index e94d65da..472d3e65 100644 --- a/Connection/serialPortThread.py +++ b/Connection/serialPortThread.py @@ -80,6 +80,9 @@ def _setupMachineUnits(self): else: self.data.gcode_queue.put("G21 ") + def _requestSettingsUpdate(self): + self.data.gcode_queue.put("$$") + def sendNextLine(self): """ Sends the next line of gcode to the machine @@ -147,9 +150,13 @@ def getmessage(self): # print self.serialInstance.isOpen() self.lastMessageTime = time.time() self.data.connectionStatus = 1 - + print("here0") self._getFirmwareVersion() + print("here1") self._setupMachineUnits() + print("here2") + self._requestSettingsUpdate() + print("here3") while True: diff --git a/config/config.py b/config/config.py index 9df1e884..878cd366 100644 --- a/config/config.py +++ b/config/config.py @@ -10,6 +10,7 @@ import os from shutil import copyfile from pathlib import Path +import time from __main__ import app from DataStructures.makesmithInitFuncs import MakesmithInitFuncs @@ -51,6 +52,7 @@ def updateQuickConfigure(self, result): def setValue(self, section, key, value, recursionBreaker=False, isImporting = False): updated = False found = False + t0=time.time() for x in range(len(self.settings[section])): if self.settings[section][x]["key"].lower() == key.lower(): found = True @@ -63,8 +65,9 @@ def setValue(self, section, key, value, recursionBreaker=False, isImporting = Fa self.syncFirmwareKey( self.settings[section][x]["firmwareKey"], storedValue, isImporting, ) + break except: - pass + break elif self.settings[section][x]["type"] == "int": try: storedValue = self.settings[section][x]["value"] @@ -78,7 +81,7 @@ def setValue(self, section, key, value, recursionBreaker=False, isImporting = Fa isImporting, ) except: - pass + break elif self.settings[section][x]["type"] == "bool": try: if isinstance(value, bool): @@ -106,9 +109,9 @@ def setValue(self, section, key, value, recursionBreaker=False, isImporting = Fa storedValue, isImporting, ) - + break except: - pass + break else: storedValue = self.settings[section][x]["value"] self.settings[section][x]["value"] = value @@ -117,6 +120,7 @@ def setValue(self, section, key, value, recursionBreaker=False, isImporting = Fa self.syncFirmwareKey( self.settings[section][x]["firmwareKey"], storedValue, isImporting, ) + break if not found: print("Did not find " + str(section) + ", " + str(key) + ", " + str(value)) if updated: @@ -129,111 +133,10 @@ def setValue(self, section, key, value, recursionBreaker=False, isImporting = Fa ) def updateSettings(self, section, result): - print("at update Settings") - updated = False - for x in range(len(self.settings[section])): - # print(self.settings[section][x]["key"]) - # print(self.settings[section][x]["type"]) - found = False - for setting in result: - if self.settings[section][x]["key"] == setting: - - if self.settings[section][x]["type"] == "float": - try: - storedValue = self.settings[section][x]["value"] - self.settings[section][x]["value"] = float(result[setting]) - updated = True - if "firmwareKey" in self.settings[section][x]: - self.syncFirmwareKey( - self.settings[section][x]["firmwareKey"], - storedValue, - ) - except: - pass - elif self.settings[section][x]["type"] == "int": - try: - storedValue = self.settings[section][x]["value"] - self.settings[section][x]["value"] = int(result[setting]) - updated = True - if "firmwareKey" in self.settings[section][x]: - self.syncFirmwareKey( - self.settings[section][x]["firmwareKey"], - storedValue, - ) - except: - pass - elif self.settings[section][x]["type"] == "bool": - # print result[setting] - try: - if result[setting] == "on": - storedValue = self.settings[section][x]["value"] - self.settings[section][x]["value"] = 1 - updated = True - if "firmwareKey" in self.settings[section][x]: - # print "syncing1 true bool at:"+str(self.settings[section][x]['firmwareKey']) - self.syncFirmwareKey( - self.settings[section][x]["firmwareKey"], - storedValue, - ) - else: - storedValue = self.settings[section][x]["value"] - self.settings[section][x]["value"] = 0 - updated = True - if "firmwareKey" in self.settings[section][x]: - # print "syncing2 true bool at:"+str(self.settings[section][x]['firmwareKey']) - self.syncFirmwareKey( - self.settings[section][x]["firmwareKey"], - storedValue, - ) - except: - pass - - elif self.settings[section][x]["type"] == "options": - try: - # print(str(result[setting])) - storedValue = self.settings[section][x]["value"] - self.settings[section][x]["value"] = str(result[setting]) - # print(self.settings[section][x]["value"]) - updated = True - if "firmwareKey" in self.settings[section][x]: - self.syncFirmwareKey( - self.settings[section][x]["firmwareKey"], - storedValue, - ) - except: - pass - - else: - storedValue = self.settings[section][x]["value"] - self.settings[section][x]["value"] = result[setting] - updated = True - # print str(storedValue)+", "+str(result[settig]) - if "firmwareKey" in self.settings[section][x]: - # print "firmwareKey:"+str(self.settings[section][x]["firmwareKey"]) - self.syncFirmwareKey( - self.settings[section][x]["firmwareKey"], storedValue - ) - - # print setting+":"+str(result[setting])+"->"+str(settings[section][x]["value"]) - found = True - break - if not found: - # must be a turned off checkbox.. what a pain to figure out - if self.settings[section][x]["type"] == "bool": - storedValue = self.settings[section][x]["value"] - self.settings[section][x]["value"] = 0 - if "firmwareKey" in self.settings[section][x]: - # print "syncing3 false bool at:"+str(self.settings[section][x]['firmwareKey']) - self.syncFirmwareKey( - self.settings[section][x]["firmwareKey"], storedValue - ) - updated = True - if updated: - self.computeSettings(None, None, None, True) - with open(self.home+"/.WebControl/webcontrol.json", "w") as outfile: - json.dump( - self.settings, outfile, sort_keys=True, indent=4, ensure_ascii=False - ) + print("at updateSettings") + for setting in result: + self.setValue(section, setting, result[setting], recursionBreaker=False, isImporting = False) + print("settings updated") def getJSONSettingSection(self, section): """ @@ -304,9 +207,7 @@ def syncFirmwareKey(self, firmwareKey, value, isImporting=False, useStored=False for section in self.settings: for option in self.settings[section]: if "firmwareKey" in option and option["firmwareKey"] == firmwareKey: - # storedValue = self.get(section, option['key']) storedValue = option["value"] - # print("firmwareKey:"+str(firmwareKey)+ " section:"+section+" storedValue:"+str(storedValue)+" value:"+str(value)) if option["key"] == "spindleAutomate": if storedValue == "Servo": storedValue = 1 @@ -324,8 +225,6 @@ def syncFirmwareKey(self, firmwareKey, value, isImporting=False, useStored=False value = 3 else: value = 0 - - # print str(firmwareKey)+": "+str(storedValue)+"?"+str(value) if firmwareKey == 45: # print "firmwareKey = 45" # if storedValue != "": @@ -407,7 +306,7 @@ def parseErrorArray(self, value, asFloat): def sendErrorArray(self, firmwareKey, value, data): # parse out the array from string and then send them using the $O command - xErrors, yErrors = parseErrorArray(value, False) + xErrors, yErrors = self.parseErrorArray(value, False) # now send the array: for x in range(0, 31): # 31 for y in range(0, 15): # 15 @@ -457,66 +356,50 @@ def computeSettings(self, section, key, value, doAll=False): if key == "kinematicsType" or doAll is True: if doAll is True: value = self.getValue("Advanced Settings", "kinematicsType") + currentValue = self.getValue("Computed Settings", "kinematicsTypeComputed") if value == "Quadrilateral": - self.setValue("Computed Settings", "kinematicsTypeComputed", "1", True) + if currentValue != "1": + self.setValue("Computed Settings", "kinematicsTypeComputed", "1", True) + else: + if currentValue != "2": + self.setValue("Computed Settings", "kinematicsTypeComputed", "2", True) + + if key == "gearTeeth" or key == "chainPitch" or key == "leftChainTolerance" or key == "rightChainTolerance" or doAll is True: + if key == "gearTeeth" or key == "chainPitch" or doAll is True: + gearTeeth = float(self.getValue("Advanced Settings", "gearTeeth")) + chainPitch = float(self.getValue("Advanced Settings", "chainPitch")) + distPerRot = gearTeeth * chainPitch + currentdistPerRot = self.getValue("Computed Settings", "distPerRot") + if currentdistPerRot != str(distPerRot): + self.setValue("Computed Settings", "distPerRot", str(distPerRot), True) + + leftChainTolerance = float( + self.getValue("Advanced Settings", "leftChainTolerance") + ) else: - self.setValue("Computed Settings", "kinematicsTypeComputed", "2", True) - - if key == "gearTeeth" or key == "chainPitch" or doAll is True: - gearTeeth = float(self.getValue("Advanced Settings", "gearTeeth")) - chainPitch = float(self.getValue("Advanced Settings", "chainPitch")) - distPerRot = gearTeeth * chainPitch - self.setValue("Computed Settings", "distPerRot", str(distPerRot), True) - leftChainTolerance = float( - self.getValue("Advanced Settings", "leftChainTolerance") - ) - distPerRotLeftChainTolerance = (1 + leftChainTolerance / 100.0) * distPerRot - self.setValue( - "Computed Settings", - "distPerRotLeftChainTolerance", - str("{0:.5f}".format(distPerRotLeftChainTolerance)), - True, - ) - rightChainTolerance = float( - self.getValue("Advanced Settings", "rightChainTolerance") - ) - distPerRotRightChainTolerance = ( - 1 + rightChainTolerance / 100.0 - ) * distPerRot - self.setValue( - "Computed Settings", - "distPerRotRightChainTolerance", - str("{0:.5f}".format(distPerRotRightChainTolerance)), - True, - ) - - if key == "leftChainTolerance" or doAll: - distPerRot = float(self.getValue("Computed Settings", "distPerRot")) - leftChainTolerance = float( - self.getValue("Advanced Settings", "leftChainTolerance") - ) - distPerRotLeftChainTolerance = (1 + leftChainTolerance / 100.0) * distPerRot - self.setValue( - "Computed Settings", - "distPerRotLeftChainTolerance", - str("{0:.5f}".format(distPerRotLeftChainTolerance)), - True, - ) - - if key == "rightChainTolerance" or doAll is True: - distPerRot = float(self.getValue("Computed Settings", "distPerRot")) - rightChainTolerance = float( - self.getValue("Advanced Settings", "rightChainTolerance") - ) - distPerRotRightChainTolerance = ( - 1 + rightChainTolerance / 100.0 - ) * distPerRot - self.setValue( - "Computed Settings", - "distPerRotRightChainTolerance", - str("{0:.5f}".format(distPerRotRightChainTolerance)), - True, - ) + distPerRot = self.getValue("Computed Settings", "distPerRot") + + if key != "rightChainTolerance" or doAll is True: #i.e., its gearTeeth, chainPitch, leftChainTolerance or doAll is True + currentdistPerRotLeftChainTolerance = self.getValue("Computed Settings", "distPerRotLeftChainTolerance") + distPerRotLeftChainTolerance = (1 + leftChainTolerance / 100.0) * distPerRot + if currentdistPerRotLeftChainTolerance != str("{0:.5f}".format(distPerRotLeftChainTolerance)): + self.setValue( + "Computed Settings", + "distPerRotLeftChainTolerance", + str("{0:.5f}".format(distPerRotLeftChainTolerance)), + True, + ) + if key != "leftChainTolerance" or doAll is True: + currentdistPerRotRightChainTolerance = self.getValue("Computed Settings", "distPerRotRightChainTolerance") + rightChainTolerance = float(self.getValue("Advanced Settings", "rightChainTolerance")) + distPerRotRightChainTolerance = (1 + rightChainTolerance / 100.0) * distPerRot + if currentdistPerRotRightChainTolerance != str("{0:.5f}".format(distPerRotRightChainTolerance)): + self.setValue( + "Computed Settings", + "distPerRotRightChainTolerance", + str("{0:.5f}".format(distPerRotRightChainTolerance)), + True, + ) if key == "enablePosPIDValues" or doAll is True: for key in ("KpPos", "KiPos", "KdPos", "propWeight"): @@ -524,14 +407,18 @@ def computeSettings(self, section, key, value, doAll=False): value = float(self.getValue("Advanced Settings", key)) else: value = self.getDefaultValue("Advanced Settings", key) - self.setValue("Computed Settings", key + "Main", value, True) + currentValue = self.getValue("Computed Settings", key + "Main") + if currentValue != value: + self.setValue("Computed Settings", key + "Main", value, True) # updated computed values for z-axis for key in ("KpPosZ", "KiPosZ", "KdPosZ", "propWeightZ"): if int(self.getValue("Advanced Settings", "enablePosPIDValues")) == 1: value = float(self.getValue("Advanced Settings", key)) else: value = self.getDefaultValue("Advanced Settings", key) - self.setValue("Computed Settings", key, value, True) + currentValue = self.getValue("Computed Settings", key) + if currentValue != value: + self.setValue("Computed Settings", key, value, True) if key == "enableVPIDValues" or doAll is True: for key in ("KpV", "KiV", "KdV"): @@ -539,28 +426,151 @@ def computeSettings(self, section, key, value, doAll=False): value = float(self.getValue("Advanced Settings", key)) else: value = self.getDefaultValue("Advanced Settings", key) - self.setValue("Computed Settings", key + "Main", value, True) + currentValue = self.getValue("Computed Settings", key + "Main") + if currentValue != value: + self.setValue("Computed Settings", key + "Main", value, True) # updated computed values for z-axis for key in ("KpVZ", "KiVZ", "KdVZ"): if int(self.getValue("Advanced Settings", "enablePosPIDValues")) == 1: value = float(self.getValue("Advanced Settings", key)) else: value = self.getDefaultValue("Advanced Settings", key) - self.setValue("Computed Settings", key, value, True) + currentValue = self.getValue("Computed Settings", key) + if currentValue != value: + self.setValue("Computed Settings", key, value, True) if key == "chainOverSprocket" or doAll is True: if doAll is True: value = self.getValue("Advanced Settings", "chainOverSprocket") - # print(value) + currentValue = self.getValue("Computed Settings","chainOverSprocketComputed") if value == "Top": - self.setValue("Computed Settings", "chainOverSprocketComputed", 1, True) + if currentValue != 1: + self.setValue("Computed Settings", "chainOverSprocketComputed", 1, True) elif value == "Bottom": - self.setValue("Computed Settings", "chainOverSprocketComputed", 2, True) + if currentValue != 2: + self.setValue("Computed Settings", "chainOverSprocketComputed", 2, True) if key == "fPWM" or doAll is True: + if doAll is True: + value = self.getValue("Advanced Settings", "fPWM") + currentValue = self.getValue("Computed Settings", "fPWMComputed") if value == "31,000Hz": - self.setValue("Computed Settings", "fPWMComputed", 1, True) + if currentValue != 1: + self.setValue("Computed Settings", "fPWMComputed", 1, True) elif value == "4,100Hz": - self.setValue("Computed Settings", "fPWMComputed", 2, True) + if currentValue != 2: + self.setValue("Computed Settings", "fPWMComputed", 2, True) else: - self.setValue("Computed Settings", "fPWMComputed", 3, True) + if currentValue != 3: + self.setValue("Computed Settings", "fPWMComputed", 3, True) + + +''' + def updateSettingsOld(self, section, result): + + print("at update Settings") + updated = False + for x in range(len(self.settings[section])): + # print(self.settings[section][x]["key"]) + # print(self.settings[section][x]["type"]) + found = False + for setting in result: + if self.settings[section][x]["key"] == setting: + + if self.settings[section][x]["type"] == "float": + try: + storedValue = self.settings[section][x]["value"] + self.settings[section][x]["value"] = float(result[setting]) + updated = True + if "firmwareKey" in self.settings[section][x]: + self.syncFirmwareKey( + self.settings[section][x]["firmwareKey"], + storedValue, + ) + except: + pass + elif self.settings[section][x]["type"] == "int": + try: + storedValue = self.settings[section][x]["value"] + self.settings[section][x]["value"] = int(result[setting]) + updated = True + if "firmwareKey" in self.settings[section][x]: + self.syncFirmwareKey( + self.settings[section][x]["firmwareKey"], + storedValue, + ) + except: + pass + elif self.settings[section][x]["type"] == "bool": + # print result[setting] + try: + if result[setting] == "on": + storedValue = self.settings[section][x]["value"] + self.settings[section][x]["value"] = 1 + updated = True + if "firmwareKey" in self.settings[section][x]: + # print "syncing1 true bool at:"+str(self.settings[section][x]['firmwareKey']) + self.syncFirmwareKey( + self.settings[section][x]["firmwareKey"], + storedValue, + ) + else: + storedValue = self.settings[section][x]["value"] + self.settings[section][x]["value"] = 0 + updated = True + if "firmwareKey" in self.settings[section][x]: + # print "syncing2 true bool at:"+str(self.settings[section][x]['firmwareKey']) + self.syncFirmwareKey( + self.settings[section][x]["firmwareKey"], + storedValue, + ) + except: + pass + + elif self.settings[section][x]["type"] == "options": + try: + # print(str(result[setting])) + storedValue = self.settings[section][x]["value"] + self.settings[section][x]["value"] = str(result[setting]) + # print(self.settings[section][x]["value"]) + updated = True + if "firmwareKey" in self.settings[section][x]: + self.syncFirmwareKey( + self.settings[section][x]["firmwareKey"], + storedValue, + ) + except: + pass + + else: + storedValue = self.settings[section][x]["value"] + self.settings[section][x]["value"] = result[setting] + updated = True + # print str(storedValue)+", "+str(result[settig]) + if "firmwareKey" in self.settings[section][x]: + # print "firmwareKey:"+str(self.settings[section][x]["firmwareKey"]) + self.syncFirmwareKey( + self.settings[section][x]["firmwareKey"], storedValue + ) + + # print setting+":"+str(result[setting])+"->"+str(settings[section][x]["value"]) + found = True + break + if not found: + # must be a turned off checkbox.. what a pain to figure out + if self.settings[section][x]["type"] == "bool": + storedValue = self.settings[section][x]["value"] + self.settings[section][x]["value"] = 0 + if "firmwareKey" in self.settings[section][x]: + # print "syncing3 false bool at:"+str(self.settings[section][x]['firmwareKey']) + self.syncFirmwareKey( + self.settings[section][x]["firmwareKey"], storedValue + ) + updated = True + if updated: + self.computeSettings(None, None, None, True) + with open(self.home+"/.WebControl/webcontrol.json", "w") as outfile: + json.dump( + self.settings, outfile, sort_keys=True, indent=4, ensure_ascii=False + ) +''' \ No newline at end of file diff --git a/templates/actions.html b/templates/actions.html index b7e906a4..fa92498b 100644 --- a/templates/actions.html +++ b/templates/actions.html @@ -19,8 +19,9 @@

Diagnostics

- - + + +
diff --git a/templates/base.html b/templates/base.html index 85f257bb..69006a3c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -84,7 +84,13 @@ console.log("Static Modal") $('#notificationModal').modal({backdrop: 'static', keyboard: false}) } else { - $('#notificationModal').modal() + if (msg.resume="resume"){ + $('#resumeButton').show(); + $('#notificationModal').modal(); + } else { + $('#resumeButton').hide(); + $('#notificationModal').modal(); + } } }); @@ -224,13 +230,13 @@

Modal body text goes here.

- {% block javascript %}{% endblock %} From a092f1db347ff9d1b40bab1724554124967e4d5b Mon Sep 17 00:00:00 2001 From: John Hogan Date: Mon, 29 Oct 2018 13:49:14 -0400 Subject: [PATCH 023/685] much better settings action and fixed zaxis message --- Background/UIProcessor.py | 11 +- File/importFile.py | 18 +- config/config.py | 6 +- defaultwebcontrol.json | 905 ++++++++++++++++++++++++++++++++++++ main.py | 13 +- static/scripts/frontpage.js | 6 +- templates/base.html | 14 +- templates/frontpage.html | 2 +- 8 files changed, 947 insertions(+), 28 deletions(-) create mode 100644 defaultwebcontrol.json diff --git a/Background/UIProcessor.py b/Background/UIProcessor.py index e7b7ba69..4ba8a4e3 100644 --- a/Background/UIProcessor.py +++ b/Background/UIProcessor.py @@ -12,9 +12,16 @@ class UIProcessor: def start(self, _app): self.app = _app + print("starting UI") with self.app.app_context(): while True: time.sleep(0.001) + if self.app.data.config.firstRun: + print("here at firstRun") + self.app.data.config.firstRun = False + time.sleep(2) + self.activateModal("Notification:", + "New installation detected. If you have an existing groundcontrol.ini file you would like to import, please do so now by pressing Actions->Import groundcontrol.ini file before doing anything else.") if self.app.data.opticalCalibrationImageUpdated is True: self.sendCalibrationMessage( "OpticalCalibrationImageUpdated", @@ -41,10 +48,10 @@ def start(self, _app): print("found adjust Z-Axis in message") socketio.emit( "requestedSetting", - {"setting": "pauseButtonSetting", "value": "Resume", "resume": "resume"}, + {"setting": "pauseButtonSetting", "value": "Resume"}, namespace="/MaslowCNC", ) - self.activateModal("Notification:", message[9:]) + self.activateModal("Notification:", message[9:], "resume") elif message[0:7] == "Action:": if message.find("unitsUpdate") != -1: units = self.app.data.config.getValue( diff --git a/File/importFile.py b/File/importFile.py index aa9911e9..6eb4cf2f 100644 --- a/File/importFile.py +++ b/File/importFile.py @@ -35,21 +35,21 @@ def importGCini(self, filename): if section != "": setting = [x.strip() for x in line.split("=")] # print(section+"->"+setting[0]+":"+setting[1]) - if setting[0] != "comport" and setting[0] != "homex" and setting[0] != "homey": + if True: #if setting[0] != "comport" and setting[0] != "homex" and setting[0] != "homey": self.data.config.setValue( section, setting[0], setting[1], True, isImporting=True, - ) # True to prevent recomputing settings everytime. + ) print("computing settings") self.data.config.computeSettings(None, None, None, True) #self.data.config.setValue("Advanced Settings","positionErrorLimit", 2000) ##go through and manually push the critical settings so position can be calculated. - print("syncing specific values") - self.data.config.syncFirmwareKey(11, 0, isImporting=False, useStored=True) - self.data.config.syncFirmwareKey(2, 0, isImporting=False, useStored=True) - self.data.config.syncFirmwareKey(3, 0, isImporting=False, useStored=True) - self.data.config.syncFirmwareKey(8, 0, isImporting=False, useStored=True) - self.data.config.syncFirmwareKey(37, 0, isImporting=False, useStored=True) - print("synced specific values") + #print("syncing specific values") + #self.data.config.syncFirmwareKey(11, 0, isImporting=False, useStored=True) + #self.data.config.syncFirmwareKey(2, 0, isImporting=False, useStored=True) + #self.data.config.syncFirmwareKey(3, 0, isImporting=False, useStored=True) + #self.data.config.syncFirmwareKey(8, 0, isImporting=False, useStored=True) + #self.data.config.syncFirmwareKey(37, 0, isImporting=False, useStored=True) + #print("synced specific values") self.data.gcode_queue.put("$$") except: print("Import File Error") diff --git a/config/config.py b/config/config.py index 878cd366..f63f10b1 100644 --- a/config/config.py +++ b/config/config.py @@ -19,6 +19,7 @@ class Config(MakesmithInitFuncs): settings = {} home = "" + firstRun = False def __init__(self): self.home = str(Path.home()) @@ -27,8 +28,9 @@ def __init__(self): print("creating "+self.home+"/.WebControl directory") os.mkdir(self.home+"/.WebControl") if not os.path.exists(self.home+"/.WebControl/webcontrol.json"): - print("copying webcontrol.json to "+self.home+"/.WebControl/") - copyfile("webcontrol.json",self.home+"/.WebControl/webcontrol.json") + print("copying defaultwebcontrol.json to "+self.home+"/.WebControl/") + copyfile("defaultwebcontrol.json",self.home+"/.WebControl/webcontrol.json") + self.firstRun = True with open(self.home+"/.WebControl/webcontrol.json", "r") as infile: self.settings = json.load(infile) # self.computeSettings(None, None, None, True); diff --git a/defaultwebcontrol.json b/defaultwebcontrol.json new file mode 100644 index 00000000..10422444 --- /dev/null +++ b/defaultwebcontrol.json @@ -0,0 +1,905 @@ +{ + "Advanced Settings": [ + { + "default": 0.0, + "desc": "Max depth the z axis should plunge in order to find the touch probe\ndefault setting: 0.0", + "key": "maxTouchProbePlungeDistance", + "section": "Advanced Settings", + "title": "Max touch Z-axis plunge", + "type": "string", + "value": "50" + }, + { + "default": 8113.73, + "desc": "The number of encoder steps per revolution of the left or right motor\ndefault setting: 8113.73", + "firmwareKey": 12, + "key": "encoderSteps", + "section": "Advanced Settings", + "title": "Encoder Steps per Revolution", + "type": "string", + "value": "8113.73" + }, + { + "default": 10, + "desc": "The number of teeth on the gear of the left or right motor\ndefault setting: 10", + "key": "gearTeeth", + "section": "Advanced Settings", + "title": "Gear Teeth", + "type": "string", + "value": "10" + }, + { + "default": 6.35, + "desc": "The distance between chain roller centers\ndefault setting: 6.35", + "key": "chainPitch", + "section": "Advanced Settings", + "title": "Chain Pitch", + "type": "string", + "value": "6.35" + }, + { + "default": 0, + "desc": "The tolerance adjustment for the left chain length, in percent\ndefault setting: 0", + "key": "leftChainTolerance", + "section": "Advanced Settings", + "title": "Chain Tolerance, Left Chain", + "type": "string", + "value": "0" + }, + { + "default": 0, + "desc": "The tolerance adjustment for the right chain length, in percent\ndefault setting: 0", + "key": "rightChainTolerance", + "section": "Advanced Settings", + "title": "Chain Tolerance, Right Chain", + "type": "string", + "value": "0" + }, + { + "default": "Top", + "desc": "On which side of the motor sprockets do the chains leave from to connect to the sled\ndefault setting: Top", + "key": "chainOverSprocket", + "options": [ + "Top", + "Bottom" + ], + "section": "Advanced Settings", + "title": "Top/Bottom Chain Feed", + "type": "options", + "value": "Bottom" + }, + { + "default": 1650, + "desc": "The length in mm that will be extended during chain calibration\ndefault setting: 1650", + "firmwareKey": 11, + "key": "chainExtendLength", + "section": "Advanced Settings", + "title": "Extend Chain Distance", + "type": "string", + "value": "1650" + }, + { + "default": 3360, + "desc": "The length in mm of your chains, used to define the kinematics search space\ndefault setting: 3360", + "firmwareKey": 10, + "key": "chainLength", + "section": "Advanced Settings", + "title": "Chain Length", + "type": "string", + "value": "3360" + }, + { + "default": 7560.0, + "desc": "The number of encoder steps per revolution of the z-axis\ndefault setting: 7560.0", + "firmwareKey": 20, + "key": "zEncoderSteps", + "section": "Advanced Settings", + "title": "Z-Axis Encoder Steps per Revolution", + "type": "string", + "value": "7560.0" + }, + { + "default": "None", + "desc": "How should the spindle start and stop automatically based on gcode? Leave off for none, or set external servo control, or external relay control, active high or low.\ndefault setting: None", + "firmwareKey": 17, + "key": "spindleAutomate", + "options": [ + "None", + "Servo", + "Relay_High", + "Relay_Low" + ], + "section": "Advanced Settings", + "title": "Spindle Automation", + "type": "options", + "value": "None" + }, + { + "default": 800, + "desc": "The maximum feedrate in mm/min that machine is capable of sustaining. Setting this value too high will cause movements to start before the prior movement finishes.\ndefault setting: 800", + "firmwareKey": 15, + "key": "maxFeedrate", + "section": "Advanced Settings", + "title": "Max Feedrate", + "type": "string", + "value": "800" + }, + { + "default": 0.0, + "desc": "The X coordinate of the home position\ndefault setting: 0.0", + "key": "homeX", + "section": "Advanced Settings", + "title": "Home Position X Coordinate", + "type": "string", + "value": "0.0" + }, + { + "default": 0.0, + "desc": "The X coordinate of the home position\ndefault setting: 0.0", + "key": "homeY", + "section": "Advanced Settings", + "title": "Home Position Y Coordinate", + "type": "string", + "value": "0.0" + }, + { + "default": 0, + "desc": "Truncate floating point numbers at the specified number of decimal places\ndefault setting: 0", + "key": "truncate", + "section": "Advanced Settings", + "title": "Truncate Floating Point Numbers", + "type": "bool", + "value": 0 + }, + { + "default": 4, + "desc": "If truncate floating point numbers is enabled, the number of digits after the decimal place to preserve\ndefault setting: 4", + "key": "digits", + "section": "Advanced Settings", + "title": "Floating Point Precision", + "type": "string", + "value": "4" + }, + { + "default": "Triangular", + "desc": "Switch between trapezoidal and triangular kinematics\ndefault setting: Triangular", + "key": "kinematicsType", + "options": [ + "Quadrilateral", + "Triangular" + ], + "section": "Advanced Settings", + "title": "Kinematics Type", + "type": "options", + "value": "Triangular" + }, + { + "default": 139.1, + "desc": "The distance between where the chains attach and the center of the router bit in mm\ndefault setting: 140", + "firmwareKey": 8, + "key": "rotationRadius", + "section": "Advanced Settings", + "title": "Rotation Radius for Triangular Kinematics", + "type": "string", + "value": "139.1" + }, + { + "default": 0, + "desc": "The scaled value computed by the calibration process to calculate chain sag based on sled weight, chain weight, and workspace angle\ndefault setting: 0", + "firmwareKey": 37, + "key": "chainSagCorrection", + "section": "Advanced Settings", + "title": "Chain Sag Correction Value for Triangular Kinematics", + "type": "string", + "value": "33" + }, + { + "default": 0, + "desc": "Enable modifying x,y coordinates during calculations to account for errors determined by optical calibration\ndefault setting: 0", + "firmwareKey": 44, + "key": "enableOpticalCalibration", + "section": "Advanced Settings", + "title": "Use Calibration Error Matrix (Experimental)", + "type": "bool", + "value": 0 + }, + { + "default": 0, + "desc": "Selects use interpolation of calibration error matrix or curve fit\ndefault setting: 0", + "firmwareKey": 46, + "key": "useInterpolationOrCurve", + "section": "Advanced Settings", + "title": "Use Interpolation (True) or Curve Fit (False) (Experimental)", + "type": "bool", + "value": 0 + }, + { + "default": 0, + "desc": "Experimental adjustment for top beam tilt in degrees\ndefault setting: 0", + "firmwareKey": 43, + "key": "topBeamTilt", + "section": "Advanced Settings", + "title": "Top Beam Tilt (Experimental)", + "type": "string", + "value": "0" + }, + { + "default": 0, + "desc": "Enable using custom values for the positional PID controller. Turning this off will return to the default values\ndefault setting: 0", + "key": "enablePosPIDValues", + "section": "Advanced Settings", + "title": "Enable Custom Positional PID Values", + "type": "bool", + "value": 0 + }, + { + "default": 1300, + "desc": "The proportional constant for the position PID controller\ndefault setting: 1300", + "key": "KpPos", + "section": "Advanced Settings", + "title": "Kp Position", + "type": "string", + "value": "1300" + }, + { + "default": 0, + "desc": "The integral constant for the position PID controller\ndefault setting: 0", + "key": "KiPos", + "section": "Advanced Settings", + "title": "Ki Position", + "type": "string", + "value": "0" + }, + { + "default": 34, + "desc": "The derivative constant for the position PID controller\ndefault setting: 34", + "key": "KdPos", + "section": "Advanced Settings", + "title": "Kd Position", + "type": "string", + "value": "34" + }, + { + "default": 1300, + "desc": "The proportional constant for the position Z-Axis PID controller\ndefault setting: 1300", + "key": "KpPosZ", + "section": "Advanced Settings", + "title": "Kp Position Z-Axis", + "type": "string", + "value": "1300" + }, + { + "default": 0, + "desc": "The integral constant for the position Z-Axis PID controller\ndefault setting: 0", + "key": "KiPosZ", + "section": "Advanced Settings", + "title": "Ki Position Z-Axis", + "type": "string", + "value": "0" + }, + { + "default": 34, + "desc": "The derivative constant for the position Z-Axis PID controller\ndefault setting: 34", + "key": "KdPosZ", + "section": "Advanced Settings", + "title": "Kd Position Z-Axis", + "type": "string", + "value": "34" + }, + { + "default": 1, + "desc": "The ratio of Proportional on Error (1) to Proportional on Measure (0)\ndefault setting: 1", + "key": "propWeight", + "section": "Advanced Settings", + "title": "Proportional Weighting", + "type": "string", + "value": "1" + }, + { + "default": 0, + "desc": "Enable using custom values for the Velocity PID controller. Turning this off will return to the default values\ndefault setting: 0", + "key": "enableVPIDValues", + "section": "Advanced Settings", + "title": "Enable Custom Velocity PID Values", + "type": "bool", + "value": 0 + }, + { + "default": 5, + "desc": "The proportional constant for the velocity PID controller\ndefault setting: 5", + "key": "KpV", + "section": "Advanced Settings", + "title": "Kp Velocity", + "type": "string", + "value": "5" + }, + { + "default": 0, + "desc": "The integral constant for the velocity PID controller\ndefault setting: 0", + "key": "KiV", + "section": "Advanced Settings", + "title": "Ki Velocity", + "type": "string", + "value": "0" + }, + { + "default": 0.28, + "desc": "The derivative constant for the velocity PID controller\ndefault setting: 0.28", + "key": "KdV", + "section": "Advanced Settings", + "title": "Kd Velocity", + "type": "string", + "value": "0.28" + }, + { + "default": 5, + "desc": "The proportional constant for the Z-axis velocity PID controller\ndefault setting: 5", + "key": "KpVZ", + "section": "Advanced Settings", + "title": "Kp Velocity Z-Axis", + "type": "string", + "value": "5" + }, + { + "default": 0, + "desc": "The integral constant for the Z-axis velocity PID controller\ndefault setting: 0", + "key": "KiVZ", + "section": "Advanced Settings", + "title": "Ki Velocity Z-Axis", + "type": "string", + "value": "0" + }, + { + "default": 0.28, + "desc": "The derivative constant for the Z-axis velocity PID controller\ndefault setting: 0.28", + "key": "KdVZ", + "section": "Advanced Settings", + "title": "Kd Velocity Z-Axis", + "type": "string", + "value": "0.28" + }, + { + "default": 1, + "desc": "The ratio of Proportional on Error (1) to Proportional on Measure (0)\ndefault setting: 1", + "key": "propWeightZ", + "section": "Advanced Settings", + "title": "Proportional Weighting for Z-Axis", + "type": "string", + "value": "1" + }, + { + "default": "490Hz", + "desc": "The PWM frequence used for motor speed control\ndefault setting: 490Hz", + "key": "fPWM", + "options": [ + "490Hz", + "4,100Hz", + "31,000Hz" + ], + "section": "Advanced Settings", + "title": "PWM frequency for motor control", + "type": "options", + "value": "490Hz" + }, + { + "default": 2.0, + "desc": "If the position of the sled varies from the expected position by more than this amount, cutting wil be stopped. Program must be restarted to take effect.\ndefault setting: 2.0", + "firmwareKey": 42, + "key": "positionErrorLimit", + "section": "Advanced Settings", + "title": "Position Error Limit", + "type": "string", + "value": "2.0" + } + ], + "Computed Settings": [ + { + "firmwareKey": 7, + "key": "kinematicsTypeComputed", + "type": "string", + "value": "2" + }, + { + "firmwareKey": 13, + "key": "distPerRot", + "type": "string", + "value": "63.5" + }, + { + "firmwareKey": 21, + "key": "KpPosMain", + "type": "string", + "value": 1300 + }, + { + "firmwareKey": 22, + "key": "KiPosMain", + "type": "string", + "value": 0 + }, + { + "firmwareKey": 23, + "key": "KdPosMain", + "type": "string", + "value": 34 + }, + { + "firmwareKey": 24, + "key": "propWeightMain", + "type": "string", + "value": 1 + }, + { + "firmwareKey": 29, + "key": "KpPosZ", + "type": "string", + "value": 1300 + }, + { + "firmwareKey": 30, + "key": "KiPosZ", + "type": "string", + "value": 0 + }, + { + "firmwareKey": 31, + "key": "KdPosZ", + "type": "string", + "value": 34 + }, + { + "firmwareKey": 32, + "key": "propWeightZ", + "type": "string", + "value": 1 + }, + { + "firmwareKey": 25, + "key": "KpVMain", + "type": "string", + "value": 5 + }, + { + "firmwareKey": 26, + "key": "KiVMain", + "type": "string", + "value": 0 + }, + { + "firmwareKey": 27, + "key": "KdVMain", + "type": "string", + "value": 0.28 + }, + { + "firmwareKey": 33, + "key": "KpVZ", + "type": "string", + "value": 5 + }, + { + "firmwareKey": 34, + "key": "KiVZ", + "type": "string", + "value": 0 + }, + { + "firmwareKey": 35, + "key": "KdVZ", + "type": "string", + "value": 0.28 + }, + { + "firmwareKey": 38, + "key": "chainOverSprocketComputed", + "type": "string", + "value": 2 + }, + { + "firmwareKey": 39, + "key": "fPWMComputed", + "type": "string", + "value": 3 + }, + { + "firmwareKey": 40, + "key": "distPerRotLeftChainTolerance", + "type": "string", + "value": "63.50000" + }, + { + "firmwareKey": 41, + "key": "distPerRotRightChainTolerance", + "type": "string", + "value": "63.50000" + }, + { + "default": 1.0, + "key": "distToMove", + "type": "float", + "value": 1.0 + }, + { + "default": 0.5, + "key": "distToMoveZ", + "type": "float", + "value": 0.5 + }, + { + "default": "MM", + "key": "units", + "type": "string", + "value": "MM" + }, + { + "default": "MM", + "key": "unitsZ", + "type": "string", + "value": "MM" + } + ], + "Maslow Settings": [ + { + "default": "", + "desc": "Select the COM port to connect to machine\ndefault setting: ", + "key": "COMport", + "section": "Maslow Settings", + "title": "Serial Connection", + "type": "string", + "value": "" + }, + { + "default": 2978.4, + "desc": "The horizontal distance between the center of the motor shafts in MM.\ndefault setting: 2978.4", + "firmwareKey": 2, + "key": "motorSpacingX", + "section": "Maslow Settings", + "title": "Distance Between Motors", + "type": "string", + "value": "2978.4" + }, + { + "default": 2438.4, + "desc": "The width of the machine working area (normally 8 feet).\ndefault setting: 2438.4", + "firmwareKey": 0, + "key": "bedWidth", + "section": "Maslow Settings", + "title": "Work Area Width in MM", + "type": "string", + "value": "2438.4" + }, + { + "default": 1219.2, + "desc": "The Height of the machine working area (normally 4 feet).\ndefault setting: 1219.2", + "firmwareKey": 1, + "key": "bedHeight", + "section": "Maslow Settings", + "title": "Work Area Height in MM", + "type": "string", + "value": "1219.2" + }, + { + "default": 463, + "desc": "The vertical distance from the edge of the work area to the level of the motors.\ndefault setting: 463", + "firmwareKey": 3, + "key": "motorOffsetY", + "section": "Maslow Settings", + "title": "Motor Offset Height in MM", + "type": "string", + "value": "463" + }, + { + "default": 310, + "desc": "The horizontal distance between the points where the chains mount to the sled.\ndefault setting: 310", + "firmwareKey": 4, + "key": "sledWidth", + "section": "Maslow Settings", + "title": "Distance Between Sled Mounting Points", + "type": "string", + "value": "310" + }, + { + "default": 139, + "desc": "The vertical distance between where the chains mount on the sled to the cutting tool.\ndefault setting: 139", + "firmwareKey": 5, + "key": "sledHeight", + "section": "Maslow Settings", + "title": "Vertical Distance Sled Mounts to Cutter", + "type": "string", + "value": "139" + }, + { + "default": 79, + "desc": "How far below the cutting bit is the center of gravity. This can be found by resting the sled on a round object and observing where it balances.\ndefault setting: 79", + "firmwareKey": 6, + "key": "sledCG", + "section": "Maslow Settings", + "title": "Center Of Gravity", + "type": "string", + "value": "79" + }, + { + "default": 0, + "desc": "Does the machine have an automatic z-axis?\ndefault setting: 0", + "firmwareKey": 16, + "key": "zAxis", + "section": "Maslow Settings", + "title": "z-axis installed", + "type": "bool", + "value": 0 + }, + { + "default": 3.17, + "desc": "The number of mm moved per rotation of the z-axis\ndefault setting: 3.17", + "firmwareKey": 19, + "key": "zDistPerRot", + "section": "Maslow Settings", + "title": "Z-Axis Pitch", + "type": "string", + "value": "3.17" + }, + { + "default": "", + "desc": "The path to the open file\\ndefault setting: your home directory", + "key": "openFile", + "section": "Maslow Settings", + "title": "Open File", + "type": "string", + "value": "" + }, + { + "default": "", + "desc": "User defined gcode bound to the Macro 1 button\ndefault setting: ", + "key": "macro1", + "section": "Maslow Settings", + "title": "Macro 1", + "type": "string", + "value": "" + }, + { + "default": "Macro 1", + "desc": "User defined title for the Macro 1 button\ndefault setting: Macro 1", + "key": "macro1_title", + "section": "Maslow Settings", + "title": "Macro 1 Title", + "type": "string", + "value": "Macro 1" + }, + { + "default": "", + "desc": "User defined gcode bound to the Macro 2 button\ndefault setting: ", + "key": "macro2", + "section": "Maslow Settings", + "title": "Macro 2", + "type": "string", + "value": "" + }, + { + "default": "Macro 2", + "desc": "User defined title for the Macro 2 button\ndefault setting: Macro 2", + "key": "macro2_title", + "section": "Maslow Settings", + "title": "Macro 2 Title", + "type": "string", + "value": "Macro 2" + }, + { + "default": 5, + "desc": "The vertical distance above the work area to raise the z-axis for safe travel. Used by 'Home', 'Return to Center' and 'z-Axis' settings.\ndefault setting: 5", + "key": "zAxisSafeHeight", + "section": "Maslow Settings", + "title": "Z-Axis Safe Travel Height in MM", + "type": "string", + "value": "5" + }, + { + "default": 0, + "desc": "Buffer gcode on arduino to increase execution speed. Requres restart to take effect. Experimental.\ndefault setting: 0", + "key": "bufferOn", + "section": "Maslow Settings", + "title": "Buffer Gcode", + "type": "bool", + "value": 0 + } + ], + "Optical Calibration Settings": [ + { + "default": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0", + "firmwareKey": 45, + "key": "xyErrorArray", + "type": "string", + "value": "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" + }, + { + "default": "0", + "firmwareKey": 47, + "key": "calX0", + "type": "string", + "value": "0" + }, + { + "default": "0", + "firmwareKey": 48, + "key": "calX1", + "type": "string", + "value": "0" + }, + { + "default": "0", + "firmwareKey": 49, + "key": "calX2", + "type": "string", + "value": "0" + }, + { + "default": "0", + "firmwareKey": 50, + "key": "calX3", + "type": "string", + "value": "0" + }, + { + "default": "0", + "firmwareKey": 51, + "key": "calX4", + "type": "string", + "value": "0" + }, + { + "default": "0", + "firmwareKey": 52, + "key": "calX5", + "type": "string", + "value": "0" + }, + { + "default": "0", + "firmwareKey": 53, + "key": "calY0", + "type": "string", + "value": "0" + }, + { + "default": "0", + "firmwareKey": 54, + "key": "calY1", + "type": "string", + "value": "0" + }, + { + "default": "0", + "firmwareKey": 55, + "key": "calY2", + "type": "string", + "value": "0" + }, + { + "default": "0", + "firmwareKey": 56, + "key": "calY3", + "type": "string", + "value": "0" + }, + { + "default": "0", + "firmwareKey": 57, + "key": "calY4", + "type": "string", + "value": "0" + }, + { + "default": "0", + "firmwareKey": 58, + "key": "calY5", + "type": "string", + "value": "0" + }, + { + "default": "0", + "key": "opticalCenterX", + "type": "string", + "value": "0" + }, + { + "default": "0", + "key": "opticalCenterY", + "type": "string", + "value": "0" + }, + { + "default": "1.0", + "key": "scaleX", + "type": "string", + "value": "1.0" + }, + { + "default": "1.0", + "key": "scaleY", + "type": "string", + "value": "1.0" + }, + { + "default": 5, + "key": "gaussianBlurValue", + "type": "int", + "value": 5 + }, + { + "default": 50.0, + "key": "cannyLowValue", + "type": "float", + "value": 50.0 + }, + { + "default": 100.0, + "key": "cannyHighValue", + "type": "float", + "value": 100.0 + }, + { + "default": 0, + "key": "autoScanDirection", + "type": "int", + "value": 0 + }, + { + "default": 15.24, + "key": "markerX", + "type": "float", + "value": 15.24 + }, + { + "default": 15.24, + "key": "markerY", + "type": "float", + "value": 15.24 + } + ], + "WebControl Settings": [ + { + "default": 0, + "desc": "When resizing the window, automatically reset the Gcode canvas to be centered and zoomed out. Program must be restarted to take effect.\ndefault setting: 0", + "key": "centerCanvasOnResize", + "section": "WebControl Settings", + "title": "Center Canvas on Window Resize", + "type": "bool", + "value": 0 + }, + { + "default": "pageup", + "desc": "Pressing this key will zoom in. Note combinations of keys like 'shift' + '=' may not work as expected. Program must be restarted to take effect.\ndefault setting: pageup", + "key": "zoomIn", + "section": "WebControl Settings", + "title": "Zoom In", + "type": "string", + "value": "pageup" + }, + { + "default": "pagedown", + "desc": "Pressing this key will zoom in. Note combinations of keys like 'shift' + '=' may not work as expected. Program must be restarted to take effect.\ndefault setting: pagedown", + "key": "zoomOut", + "section": "WebControl Settings", + "title": "Zoom Out", + "type": "string", + "value": "pagedown" + }, + { + "default": ".nc, .ngc, .text, .gcode", + "desc": "Valid file extensions for Ground Control to open. Comma separated list.\ndefault setting: .nc, .ngc, .text, .gcode", + "key": "validExtensions", + "section": "WebControl Settings", + "title": "Valid File Extensions", + "type": "string", + "value": ".nc, .ngc, .text, .gcode" + }, + { + "default": ".45", + "desc": "Zoom scale for 'Reset View' command.\ndefault setting: .45", + "key": "viewScale", + "section": "WebControl Settings", + "title": "Reset View Scale", + "type": "string", + "value": ".45" + } + ] +} \ No newline at end of file diff --git a/main.py b/main.py index df35586a..9e8d2e6f 100644 --- a/main.py +++ b/main.py @@ -29,6 +29,7 @@ float(app.data.config.getValue("Advanced Settings", "homeX")), float(app.data.config.getValue("Advanced Settings", "homeY")), ] +app.data.firstRun = False # app.previousPosX = 0.0 # app.previousPosY = 0.0 @@ -50,6 +51,8 @@ def run_schedule(): app.th1.daemon = True app.th1.start() +app.uithread = None + # write settings file to disk: # from settings import settings # settings = settings.getJSONSettings() @@ -64,10 +67,12 @@ def run_schedule(): def index(template): # print template current_app._get_current_object() - thread = socketio.start_background_task( - app.UIProcessor.start, current_app._get_current_object() - ) - thread.start() + if app.uithread == None: + app.uithread = socketio.start_background_task( + app.UIProcessor.start, current_app._get_current_object() + ) + app.uithread.start() + if not app.data.connectionStatus: app.data.serialPort.openConnection() if template == "mobile/": diff --git a/static/scripts/frontpage.js b/static/scripts/frontpage.js index 112a5272..b3c1af18 100644 --- a/static/scripts/frontpage.js +++ b/static/scripts/frontpage.js @@ -33,9 +33,9 @@ sled.add(draw.circle(3*scale).stroke({width:.1,color:"#F00"}).fill({color:"#fff" sled.center(originX,originY) var home = draw.group() -home.add(draw.line(1.5*scale,-0.0*scale,1.5*scale,3.0*scale).stroke({width:.1,color:"#0F0"})) -home.add(draw.line(-0.0*scale,1.5*scale,3.0*scale,1.5*scale).stroke({width:.1,color:"#0F0"})) -home.add(draw.circle(3*scale).stroke({width:.1,color:"#0F0"}).fill({color:"#fff",opacity:0})) +home.add(draw.line(0.75*scale,-0.0*scale,0.75*scale,1.5*scale).stroke({width:.1,color:"#0F0"})) +home.add(draw.line(-0.0*scale,0.75*scale,1.5*scale,0.75*scale).stroke({width:.1,color:"#0F0"})) +home.add(draw.circle(1.5*scale).stroke({width:.1,color:"#0F0"}).fill({color:"#fff",opacity:0})) home.center(originX,originY) / diff --git a/templates/base.html b/templates/base.html index 69006a3c..ffcf5434 100644 --- a/templates/base.html +++ b/templates/base.html @@ -80,17 +80,17 @@ $('#notificationModal').data('name',msg.title); $('#notificationModalTitle').html("

"+msg.title+""+msg.message+"

"); + console.log(msg.resume) + if (msg.resume=="resume"){ + $('#resumeButton').show(); + } else { + $('#resumeButton').hide(); + } if (msg.mode=="static"){ console.log("Static Modal") $('#notificationModal').modal({backdrop: 'static', keyboard: false}) } else { - if (msg.resume="resume"){ - $('#resumeButton').show(); - $('#notificationModal').modal(); - } else { - $('#resumeButton').hide(); - $('#notificationModal').modal(); - } + $('#notificationModal').modal(); } }); diff --git a/templates/frontpage.html b/templates/frontpage.html index 1972b84e..b0b295fb 100644 --- a/templates/frontpage.html +++ b/templates/frontpage.html @@ -8,7 +8,7 @@ - + {% endblock %} From bd64033aac2373b7db074859ac57d1ed4c5995fb Mon Sep 17 00:00:00 2001 From: John Hogan Date: Tue, 30 Oct 2018 12:59:50 -0400 Subject: [PATCH 024/685] UI process started upon socket (re)connect, not loading of a webpage. Much better. --- File/importFile.py | 17 +++-------------- defaultwebcontrol.json | 12 ++++++------ main.py | 32 ++++++++++++-------------------- templates/actions.html | 8 -------- templates/base.html | 13 ++++++++----- 5 files changed, 29 insertions(+), 53 deletions(-) diff --git a/File/importFile.py b/File/importFile.py index 6eb4cf2f..c347a663 100644 --- a/File/importFile.py +++ b/File/importFile.py @@ -34,22 +34,11 @@ def importGCini(self, filename): else: if section != "": setting = [x.strip() for x in line.split("=")] - # print(section+"->"+setting[0]+":"+setting[1]) - if True: #if setting[0] != "comport" and setting[0] != "homex" and setting[0] != "homey": - self.data.config.setValue( - section, setting[0], setting[1], True, isImporting=True, - ) + self.data.config.setValue( + section, setting[0], setting[1], True, isImporting=True, + ) print("computing settings") self.data.config.computeSettings(None, None, None, True) - #self.data.config.setValue("Advanced Settings","positionErrorLimit", 2000) - ##go through and manually push the critical settings so position can be calculated. - #print("syncing specific values") - #self.data.config.syncFirmwareKey(11, 0, isImporting=False, useStored=True) - #self.data.config.syncFirmwareKey(2, 0, isImporting=False, useStored=True) - #self.data.config.syncFirmwareKey(3, 0, isImporting=False, useStored=True) - #self.data.config.syncFirmwareKey(8, 0, isImporting=False, useStored=True) - #self.data.config.syncFirmwareKey(37, 0, isImporting=False, useStored=True) - #print("synced specific values") self.data.gcode_queue.put("$$") except: print("Import File Error") diff --git a/defaultwebcontrol.json b/defaultwebcontrol.json index 10422444..198ad50a 100644 --- a/defaultwebcontrol.json +++ b/defaultwebcontrol.json @@ -520,22 +520,22 @@ "value": 1.0 }, { - "default": 0.5, + "default": 0.1, "key": "distToMoveZ", "type": "float", - "value": 0.5 + "value": 0.1 }, { - "default": "MM", + "default": "INCHES", "key": "units", "type": "string", - "value": "MM" + "value": "INCHES" }, { - "default": "MM", + "default": "INCHES", "key": "unitsZ", "type": "string", - "value": "MM" + "value": "INCHES" } ], "Maslow Settings": [ diff --git a/main.py b/main.py index 9e8d2e6f..62d9db01 100644 --- a/main.py +++ b/main.py @@ -53,28 +53,10 @@ def run_schedule(): app.uithread = None -# write settings file to disk: -# from settings import settings -# settings = settings.getJSONSettings() -# with open('webcontrol.json', 'w') as outfile: -# json.dump(settings,outfile, sort_keys=True, indent=4, ensure_ascii=False) - -# read settings file from disk: - - @app.route("/") @mobile_template("{mobile/}") def index(template): - # print template current_app._get_current_object() - if app.uithread == None: - app.uithread = socketio.start_background_task( - app.UIProcessor.start, current_app._get_current_object() - ) - app.uithread.start() - - if not app.data.connectionStatus: - app.data.serialPort.openConnection() if template == "mobile/": return render_template("frontpage_mobile.html") else: @@ -86,7 +68,6 @@ def maslowSettings(): if request.method == "POST": result = request.form app.data.config.updateSettings("Maslow Settings", result) - # setValues = app.data.config.getJSONSettingSection("Maslow Settings") message = {"status": 200} resp = jsonify(message) resp.status_code = 200 @@ -229,20 +210,24 @@ def quickConfigure(): def checkInRequested(msg): socketio.emit("checkIn") + @socketio.on("connect", namespace="/WebMCP") def watchdog_connect(): print("connected") print(request.sid) socketio.emit("my response") + @socketio.on("my event", namespace="/MaslowCNC") def my_event(msg): print(msg["data"]) + @socketio.on("modalClosed", namespace="/MaslowCNC") def modalClosed(msg): socketio.emit("closeModals", {"data": {"title": msg["data"]}}, namespace="/MaslowCNC") + @socketio.on("requestPage", namespace="/MaslowCNC") def requestPage(msg): if msg["data"]["page"] == "maslowSettings": @@ -424,9 +409,16 @@ def requestPage(msg): def test_connect(): print("connected") print(request.sid) - socketio.emit("my response", {"data": "Connected", "count": 0}) + if app.uithread == None: + app.uithread = socketio.start_background_task( + app.UIProcessor.start, current_app._get_current_object() + ) + app.uithread.start() + if not app.data.connectionStatus: + app.data.serialPort.openConnection() + socketio.emit("my response", {"data": "Connected", "count": 0}) @socketio.on("disconnect", namespace="/MaslowCNC") diff --git a/templates/actions.html b/templates/actions.html index fa92498b..70e53e31 100644 --- a/templates/actions.html +++ b/templates/actions.html @@ -2,14 +2,6 @@ {% block content %}
-
-
-
-

Connection

- -
-
-
diff --git a/templates/base.html b/templates/base.html index ffcf5434..919d56bd 100644 --- a/templates/base.html +++ b/templates/base.html @@ -3,7 +3,7 @@ {% block title %}{% endblock %} - WebControl - + @@ -12,11 +12,14 @@ var controllerMessages = []; $(document).ready(function(){ namespace = '/MaslowCNC'; // change to an empty string to use the global namespace - // the socket.io documentation recommends sending an explicit package upon connection // this is specially important when using the global namespace - socket = io.connect('http://' + document.domain + ':' + location.port + namespace); + socket = io.connect('http://' + document.domain + ':' + location.port + namespace, {'forceNew':true}); + setListeners(); + }); + function setListeners(){ + console.log("setting Listeners"); socket.on('connect', function(msg) { socket.emit('my event', {data: 'I\'m connected!'}); $("#clientStatus").text("Connected"); @@ -24,7 +27,6 @@ checkForGCodeUpdate(); }); - socket.on('disconnect', function(msg) { $("#clientStatus").text("Not Connected"); $("#clientStatus").removeClass('btn-success').addClass('btn-outline-danger'); @@ -126,7 +128,8 @@ socket.emit('modalClosed', {data:name}); }); - }); + } + function action(command, arg, arg1){ console.log("action="+command); socket.emit('action',{data:{command:command,arg:arg, arg1:arg1}}); From 713bb7af29ccb01e53247024140cf52be465ef34 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Tue, 30 Oct 2018 15:47:40 -0400 Subject: [PATCH 025/685] move moved to actions --- Actions/actions.py | 6 ++++++ main.py | 26 ++++++-------------------- templates/frontpage.html | 16 ++++++++-------- templates/frontpage_mobile.html | 16 ++++++++-------- 4 files changed, 28 insertions(+), 36 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index e9259e62..dfa9989e 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -16,6 +16,12 @@ def processAction(self, msg): if msg["data"]["command"] == "resetChainLengths": if not self.resetChainLengths(): self.data.ui_queue.put("Message: Error with resetting chain lengths.") + elif msg["data"]["command"] == "move": + if not self.move(msg["data"]["arg"], float(msg["data"]["arg1"])): + self.data.ui_queue.put("Message: Error with initiating move.") + elif msg["data"]["command"] == "move": + if not self.moveZ(msg["data"]["arg"], float(msg["data"]["arg1"])): + self.data.ui_queue.put("Message: Error with initiating Z-Axis move.") elif msg["data"]["command"] == "reportSettings": self.data.gcode_queue.put("$$") elif msg["data"]["command"] == "home": diff --git a/main.py b/main.py index 62d9db01..a4c79611 100644 --- a/main.py +++ b/main.py @@ -35,13 +35,13 @@ app.UIProcessor = UIProcessor() -## this runs the scheduler to check for connections +## this defines the schedule for running the serial port open connection def run_schedule(): while 1: schedule.run_pending() time.sleep(1) - +## this runs the scheduler to check for connections app.th = threading.Thread(target=run_schedule) app.th.daemon = True app.th.start() @@ -51,6 +51,7 @@ def run_schedule(): app.th1.daemon = True app.th1.start() +## uithread set to None.. will be activated upon first websocket connection app.uithread = None @app.route("/") @@ -206,11 +207,12 @@ def quickConfigure(): resp.status_code = 200 return resp +#Watchdog socketio.. not working yet. @socketio.on("checkInRequested", namespace="/WebMCP") def checkInRequested(msg): socketio.emit("checkIn") - +#Watchdog socketio.. not working yet. @socketio.on("connect", namespace="/WebMCP") def watchdog_connect(): print("connected") @@ -431,25 +433,9 @@ def command(msg): app.data.actions.processAction(msg) -@socketio.on("move", namespace="/MaslowCNC") -def move(msg): - if not app.data.actions.move( - msg["data"]["direction"], float(msg["data"]["distToMove"]) - ): - app.data.ui_queue.put("Message: Error with move") - - -@socketio.on("moveZ", namespace="/MaslowCNC") -def moveZ(msg): - if not app.data.actions.moveZ( - msg["data"]["direction"], float(msg["data"]["distToMoveZ"]) - ): - app.data.ui_queue.put("Message: Error with Z-Axis move") - - @socketio.on("settingRequest", namespace="/MaslowCNC") def settingRequest(msg): - # didn't move to actions.. this request is just to send it computed values + # didn't move to actions.. this request is just to send it computed values.. keeping it here makes it faster than putting it through the UIProcessor if msg["data"] == "units": units = app.data.config.getValue("Computed Settings", "units") socketio.emit( diff --git a/templates/frontpage.html b/templates/frontpage.html index b0b295fb..3cea0dc1 100644 --- a/templates/frontpage.html +++ b/templates/frontpage.html @@ -22,39 +22,39 @@

Controls

- +
- +
- +
- +
- +
- +
- +
- +
diff --git a/templates/frontpage_mobile.html b/templates/frontpage_mobile.html index e2c130c5..45763f48 100644 --- a/templates/frontpage_mobile.html +++ b/templates/frontpage_mobile.html @@ -18,24 +18,24 @@

Controls

-
-
-
-
@@ -45,24 +45,24 @@

Controls

-
-
-
-
From 43555cb00351d905f9797c6be3d914cd0094a0af Mon Sep 17 00:00:00 2001 From: madgrizzle Date: Wed, 31 Oct 2018 01:57:40 +0000 Subject: [PATCH 026/685] continue work on optical calibration --- Actions/actions.py | 12 ++++++++++++ Actions/opticalCalibration.py | 14 ++++++++++++++ DataStructures/logger.py | 4 ++-- templates/opticalCalibration.html | 7 +++++++ 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index dfa9989e..e4256d52 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -16,6 +16,9 @@ def processAction(self, msg): if msg["data"]["command"] == "resetChainLengths": if not self.resetChainLengths(): self.data.ui_queue.put("Message: Error with resetting chain lengths.") + elif msg["data"]["command"] == "testImage": + if not self.testImage(): + self.data.ui_queue.put("Message: Error with test image.") elif msg["data"]["command"] == "move": if not self.move(msg["data"]["arg"], float(msg["data"]["arg1"])): self.data.ui_queue.put("Message: Error with initiating move.") @@ -668,3 +671,12 @@ def macro(self, number): except Exception as e: print(e) return False + + def testImage(self): + try: + self.data.opticalCalibration.testImage() + return True + except Exception as e: + print(e) + return False + \ No newline at end of file diff --git a/Actions/opticalCalibration.py b/Actions/opticalCalibration.py index 3d515906..ca2bb57c 100644 --- a/Actions/opticalCalibration.py +++ b/Actions/opticalCalibration.py @@ -351,3 +351,17 @@ def on_Calibrate(self, args): print("Analyzing Images") self.on_AutoHome(False) return True + + def testImage(self): + if self.camera is None: + print("Starting Camera") + self.camera = cv2.VideoCapture(0) + (grabbed, image) = self.camera.read() + imgencode = cv2.imencode(".png", image)[1] + stringData = base64.b64encode(imgencode).decode() + self.data.opticalCalibrationImage = stringData + self.data.opticalCalibrationImageUpdated = True + print("Releasing Camera") + self.camera.release() + self.camera = None + return True diff --git a/DataStructures/logger.py b/DataStructures/logger.py index ef3fc43f..1c75af35 100644 --- a/DataStructures/logger.py +++ b/DataStructures/logger.py @@ -48,7 +48,7 @@ def writeToLog(self, message): except: pass - if len(self.messageBuffer) > 0: + if len(self.messageBuffer) > 500: t = threading.Thread( target=self.writeToFile, args=(self.messageBuffer, True, "write") ) @@ -56,7 +56,7 @@ def writeToLog(self, message): t.start() self.messageBuffer = "" - if len(self.amessageBuffer) > 0: + if len(self.amessageBuffer) > 500: t = threading.Thread( target=self.writeToFile, args=(self.amessageBuffer, False, "write") ) diff --git a/templates/opticalCalibration.html b/templates/opticalCalibration.html index 19dd54e6..b93793b4 100644 --- a/templates/opticalCalibration.html +++ b/templates/opticalCalibration.html @@ -112,6 +112,13 @@

Calibration Extents

Calibration

+
+
+ +
+
+
+
From d2364987c330173b9c8141da04a4ce93eab08da6 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Wed, 31 Oct 2018 08:32:41 -0400 Subject: [PATCH 027/685] moved requestPage and requestSetting out of main and into webPageProcessor class to clean up main.py --- Background/UIProcessor.py | 3 +- WebPageProcessor/__init__.py | 0 WebPageProcessor/webPageProcessor.py | 167 +++++++++++++++++++++ main.py | 212 ++------------------------- templates/base.html | 2 +- 5 files changed, 180 insertions(+), 204 deletions(-) create mode 100644 WebPageProcessor/__init__.py create mode 100644 WebPageProcessor/webPageProcessor.py diff --git a/Background/UIProcessor.py b/Background/UIProcessor.py index 4ba8a4e3..db49b7db 100644 --- a/Background/UIProcessor.py +++ b/Background/UIProcessor.py @@ -3,7 +3,7 @@ import time import math import json - +from flask import render_template class UIProcessor: @@ -184,3 +184,4 @@ def sendCalibrationMessage(self, message, data): socketio.emit( "calibrationMessage", {"msg": message, "data": data}, namespace="/MaslowCNC" ) + diff --git a/WebPageProcessor/__init__.py b/WebPageProcessor/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/WebPageProcessor/webPageProcessor.py b/WebPageProcessor/webPageProcessor.py new file mode 100644 index 00000000..bb0f4745 --- /dev/null +++ b/WebPageProcessor/webPageProcessor.py @@ -0,0 +1,167 @@ +from __main__ import socketio + +import time +import math +import json +from flask import render_template + +class WebPageProcessor: + + data = None + + def __init__(self, data): + self.data = data + + def createWebPage(self, pageID, isMobile): + # returns a page and a bool specifying whether the user has to click close to exit modal + if pageID == "maslowSettings": + setValues = self.data.config.getJSONSettingSection("Maslow Settings") + # because this page allows you to select the comport from a list that is not stored in webcontrol.json, we need to package and send the list of comports + # Todo:? change it to store the list? + ports = self.data.comPorts + if isMobile: + page = render_template( + "settings_mobile.html", + title="Maslow Settings", + settings=setValues, + ports=ports, + pageID="maslowSettings", + ) + else: + page = render_template( + "settings.html", + title="Maslow Settings", + settings=setValues, + ports=ports, + pageID="maslowSettings", + ) + return page, "Maslow Settings", False + elif pageID == "advancedSettings": + setValues = self.data.config.getJSONSettingSection("Advanced Settings") + if isMobile: + page = render_template( + "settings_mobile.html", + title="Advanced Settings", + settings=setValues, + pageID="advancedSettings", + ) + else: + page = render_template( + "settings.html", + title="Advanced Settings", + settings=setValues, + pageID="advancedSettings", + ) + return page, "Advanced Settings", False + elif pageID == "webControlSettings": + setValues = self.data.config.getJSONSettingSection("WebControl Settings") + if isMobile: + page = render_template( + "settings_mobile.html", + title="WebControl Settings", + settings=setValues, + pageID="webControlSettings", + ) + else: + page = render_template( + "settings.html", + title="WebControl Settings", + settings=setValues, + pageID="webControlSettings", + ) + return page, "WebControl Settings", False + elif pageID == "openGCode": + lastSelectedFile = self.data.config.getValue("Maslow Settings", "openFile") + files = [f for f in listdir("gcode") if isfile(join("gcode", f))] + page = render_template( + "openGCode.html", files=files, lastSelectedFile=lastSelectedFile + ) + return page, "Open GCode", False + elif pageID == "uploadGCode": + validExtensions = self.data.config.getValue( + "WebControl Settings", "validExtensions" + ) + page = render_template("uploadGCode.html", validExtensions=validExtensions) + return page, "Upload GCode", False + elif pageID == "importGCini": + page = render_template("importFile.html") + return page, "Import groundcontrol.ini", False + elif pageID == "actions": + page = render_template("actions.html") + return page, "Actions", False + elif pageID == "zAxis": + socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") + distToMoveZ = self.data.config.getValue("Computed Settings", "distToMoveZ") + unitsZ = self.data.config.getValue("Computed Settings", "unitsZ") + page = render_template("zaxis.html", distToMoveZ=distToMoveZ, unitsZ=unitsZ) + return page, "Z-Axis", False + elif pageID == "setSprockets": + socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") + page = render_template("setSprockets.html") + return page, "Set Sprockets", False + elif pageID == "triangularCalibration": + socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") + motorYoffset = self.data.config.getValue("Maslow Settings", "motorOffsetY") + rotationRadius = self.data.config.getValue("Advanced Settings", "rotationRadius") + chainSagCorrection = self.data.config.getValue( + "Advanced Settings", "chainSagCorrection" + ) + page = render_template( + "triangularCalibration.html", + pageID="triangularCalibration", + motorYoffset=motorYoffset, + rotationRadius=rotationRadius, + chainSagCorrection=chainSagCorrection, + ) + return page, "Triangular Calibration", True + elif pageID == "opticalCalibration": + socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") + page = render_template("opticalCalibration.html", pageID="opticalCalibration") + return page, "Optical Calibration", True + elif pageID == "quickConfigure": + socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") + motorOffsetY = self.data.config.getValue("Maslow Settings", "motorOffsetY") + rotationRadius = self.data.config.getValue("Advanced Settings", "rotationRadius") + kinematicsType = self.data.config.getValue("Advanced Settings", "kinematicsType") + if kinematicsType != "Quadrilateral": + if abs(float(rotationRadius) - 138.4) < 0.01: + kinematicsType = "Ring" + else: + kinematicsType = "Custom" + motorSpacingX = self.data.config.getValue("Maslow Settings", "motorSpacingX") + chainOverSprocket = self.data.config.getValue( + "Advanced Settings", "chainOverSprocket" + ) + print("MotorOffsetY=" + str(motorOffsetY)) + page = render_template( + "quickConfigure.html", + pageID="quickConfigure", + motorOffsetY=motorOffsetY, + rotationRadius=rotationRadius, + kinematicsType=kinematicsType, + motorSpacingX=motorSpacingX, + chainOverSprocket=chainOverSprocket, + ) + return page, "Quick Configure", False + + def processSettingRequest(self, setting): + if setting == "units": + units = self.data.config.getValue("Computed Settings", "units") + return setting,units + if setting == "distToMove": + distToMove = self.data.config.getValue("Computed Settings", "distToMove") + return setting, distToMove + if setting == "unitsZ": + unitsZ = self.data.config.getValue("Computed Settings", "unitsZ") + return setting, unitsZ + if setting == "distToMoveZ": + distToMoveZ = self.data.config.getValue("Computed Settings", "distToMoveZ") + return setting, distToMoveZ + if setting == "homePosition": + homeX = self.data.config.getValue("Advanced Settings", "homeX") + homeY = self.data.config.getValue("Advanced Settings", "homeY") + position = {"xval": homeX, "yval": homeY} + self.data.ui_queue.put( + "Action: homePositionMessage:_" + json.dumps(position) + ) # the "_" facilitates the parse + return None, None diff --git a/main.py b/main.py index a4c79611..c3c28d8e 100644 --- a/main.py +++ b/main.py @@ -15,6 +15,7 @@ from Background.UIProcessor import UIProcessor # do this after socketio is declared from DataStructures.data import Data from Connection.nonVisibleWidgets import NonVisibleWidgets +from WebPageProcessor.webPageProcessor import WebPageProcessor from os import listdir from os.path import isfile, join @@ -34,6 +35,7 @@ # app.previousPosY = 0.0 app.UIProcessor = UIProcessor() +app.webPageProcessor = WebPageProcessor(app.data) ## this defines the schedule for running the serial port open connection def run_schedule(): @@ -232,180 +234,15 @@ def modalClosed(msg): @socketio.on("requestPage", namespace="/MaslowCNC") def requestPage(msg): - if msg["data"]["page"] == "maslowSettings": - setValues = app.data.config.getJSONSettingSection("Maslow Settings") - # because this page allows you to select the comport from a list that is not stored in webcontrol.json, we need to package and send the list of comports - # Todo:? change it to store the list? - ports = app.data.comPorts - if msg["data"]["isMobile"]: - page = render_template( - "settings_mobile.html", - title="Maslow Settings", - settings=setValues, - ports=ports, - pageID="maslowSettings", - ) - else: - page = render_template( - "settings.html", - title="Maslow Settings", - settings=setValues, - ports=ports, - pageID="maslowSettings", - ) - socketio.emit( - "activateModal", - {"title": "Maslow Settings", "message": page}, - namespace="/MaslowCNC", - ) - elif msg["data"]["page"] == "advancedSettings": - setValues = app.data.config.getJSONSettingSection("Advanced Settings") - if msg["data"]["isMobile"]: - page = render_template( - "settings_mobile.html", - title="Advanced Settings", - settings=setValues, - pageID="advancedSettings", - ) - else: - page = render_template( - "settings.html", - title="Advanced Settings", - settings=setValues, - pageID="advancedSettings", - ) - socketio.emit( - "activateModal", - {"title": "Advanced Settings", "message": page}, - namespace="/MaslowCNC", - ) - elif msg["data"]["page"] == "webControlSettings": - setValues = app.data.config.getJSONSettingSection("WebControl Settings") - if msg["data"]["isMobile"]: - page = render_template( - "settings_mobile.html", - title="WebControl Settings", - settings=setValues, - pageID="webControlSettings", - ) - else: - page = render_template( - "settings.html", - title="WebControl Settings", - settings=setValues, - pageID="webControlSettings", - ) - socketio.emit( - "activateModal", - {"title": "WebControl Settings", "message": page}, - namespace="/MaslowCNC", - ) - elif msg["data"]["page"] == "openGCode": - lastSelectedFile = app.data.config.getValue("Maslow Settings", "openFile") - files = [f for f in listdir("gcode") if isfile(join("gcode", f))] - page = render_template( - "openGCode.html", files=files, lastSelectedFile=lastSelectedFile - ) - socketio.emit( - "activateModal", {"title": "GCode", "message": page}, namespace="/MaslowCNC" - ) - elif msg["data"]["page"] == "uploadGCode": - validExtensions = app.data.config.getValue( - "WebControl Settings", "validExtensions" - ) - page = render_template("uploadGCode.html", validExtensions=validExtensions) - socketio.emit( - "activateModal", {"title": "GCode", "message": page}, namespace="/MaslowCNC" - ) - elif msg["data"]["page"] == "importGCini": - page = render_template("importFile.html") - socketio.emit( - "activateModal", - {"title": "Import File", "message": page}, - namespace="/MaslowCNC", - ) - elif msg["data"]["page"] == "actions": - page = render_template("actions.html") - socketio.emit( - "activateModal", - {"title": "Actions", "message": page}, - namespace="/MaslowCNC", - ) - elif msg["data"]["page"] == "zAxis": - socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") - distToMoveZ = app.data.config.getValue("Computed Settings", "distToMoveZ") - unitsZ = app.data.config.getValue("Computed Settings", "unitsZ") - page = render_template("zaxis.html", distToMoveZ=distToMoveZ, unitsZ=unitsZ) + try: + page, title, isStatic = app.webPageProcessor.createWebPage(msg["data"]["page"],msg["data"]["isMobile"]) socketio.emit( "activateModal", - {"title": "Z-Axis", "message": page}, + {"title": title, "message": page, "isStatic": isStatic}, namespace="/MaslowCNC", ) - elif msg["data"]["page"] == "setSprockets": - socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") - page = render_template("setSprockets.html") - socketio.emit( - "activateModal", - {"title": "Z-Axis", "message": page}, - namespace="/MaslowCNC", - ) - elif msg["data"]["page"] == "triangularCalibration": - socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") - motorYoffset = app.data.config.getValue("Maslow Settings", "motorOffsetY") - rotationRadius = app.data.config.getValue("Advanced Settings", "rotationRadius") - chainSagCorrection = app.data.config.getValue( - "Advanced Settings", "chainSagCorrection" - ) - page = render_template( - "triangularCalibration.html", - pageID="triangularCalibration", - motorYoffset=motorYoffset, - rotationRadius=rotationRadius, - chainSagCorrection=chainSagCorrection, - ) - socketio.emit( - "activateModal", - {"title": "Triangular Calibration", "message": page}, - namespace="/MaslowCNC", - ) - elif msg["data"]["page"] == "opticalCalibration": - socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") - page = render_template("opticalCalibration.html", pageID="opticalCalibration") - socketio.emit( - "activateModal", - {"title": "Optical Calibration", "message": page, "mode": "static"}, - namespace="/MaslowCNC", - ) - elif msg["data"]["page"] == "quickConfigure": - socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") - motorOffsetY = app.data.config.getValue("Maslow Settings", "motorOffsetY") - rotationRadius = app.data.config.getValue("Advanced Settings", "rotationRadius") - kinematicsType = app.data.config.getValue("Advanced Settings", "kinematicsType") - if kinematicsType != "Quadrilateral": - if abs(float(rotationRadius) - 138.4) < 0.01: - kinematicsType = "Ring" - else: - kinematicsType = "Custom" - motorSpacingX = app.data.config.getValue("Maslow Settings", "motorSpacingX") - chainOverSprocket = app.data.config.getValue( - "Advanced Settings", "chainOverSprocket" - ) - print("MotorOffsetY=" + str(motorOffsetY)) - page = render_template( - "quickConfigure.html", - pageID="quickConfigure", - motorOffsetY=motorOffsetY, - rotationRadius=rotationRadius, - kinematicsType=kinematicsType, - motorSpacingX=motorSpacingX, - chainOverSprocket=chainOverSprocket, - ) - socketio.emit( - "activateModal", - {"title": "Quick Configure", "message": page}, - namespace="/MaslowCNC", - ) - + except Exception as e: + print(e) @socketio.on("connect", namespace="/MaslowCNC") def test_connect(): @@ -436,42 +273,13 @@ def command(msg): @socketio.on("settingRequest", namespace="/MaslowCNC") def settingRequest(msg): # didn't move to actions.. this request is just to send it computed values.. keeping it here makes it faster than putting it through the UIProcessor - if msg["data"] == "units": - units = app.data.config.getValue("Computed Settings", "units") - socketio.emit( - "requestedSetting", - {"setting": msg["data"], "value": units}, - namespace="/MaslowCNC", - ) - if msg["data"] == "distToMove": - distToMove = app.data.config.getValue("Computed Settings", "distToMove") + setting, value = app.webPageProcessor.processSettingRequest(msg["data"]) + if setting is not None: socketio.emit( "requestedSetting", - {"setting": msg["data"], "value": distToMove}, + {"setting": setting, "value": value}, namespace="/MaslowCNC", ) - if msg["data"] == "unitsZ": - unitsZ = app.data.config.getValue("Computed Settings", "unitsZ") - socketio.emit( - "requestedSetting", - {"setting": msg["data"], "value": unitsZ}, - namespace="/MaslowCNC", - ) - if msg["data"] == "distToMoveZ": - distToMoveZ = app.data.config.getValue("Computed Settings", "distToMoveZ") - socketio.emit( - "requestedSetting", - {"setting": msg["data"], "value": distToMoveZ}, - namespace="/MaslowCNC", - ) - if msg["data"] == "homePosition": - homeX = app.data.config.getValue("Advanced Settings", "homeX") - homeY = app.data.config.getValue("Advanced Settings", "homeY") - position = {"xval": homeX, "yval": homeY} - app.data.ui_queue.put( - "Action: homePositionMessage:_" + json.dumps(position) - ) # the "_" facilitates the parse - @socketio.on("updateSetting", namespace="/MaslowCNC") def updateSetting(msg): diff --git a/templates/base.html b/templates/base.html index 919d56bd..7020fcfc 100644 --- a/templates/base.html +++ b/templates/base.html @@ -88,7 +88,7 @@ } else { $('#resumeButton').hide(); } - if (msg.mode=="static"){ + if (msg.isStatic==true){ console.log("Static Modal") $('#notificationModal').modal({backdrop: 'static', keyboard: false}) } else { From 66d813433267c0297e725cf208c5719e6eea1db5 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Wed, 31 Oct 2018 14:11:59 -0400 Subject: [PATCH 028/685] lots of work on optical calibration. --- Actions/actions.py | 15 ++- Actions/opticalCalibration.py | 94 ++++++++++---- Background/UIProcessor.py | 6 + DataStructures/data.py | 3 + WebPageProcessor/webPageProcessor.py | 17 ++- defaultwebcontrol.json | 46 +++++-- templates/opticalCalibration.html | 188 ++++++++++++++++++++++----- 7 files changed, 294 insertions(+), 75 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index e4256d52..30c78056 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -16,9 +16,6 @@ def processAction(self, msg): if msg["data"]["command"] == "resetChainLengths": if not self.resetChainLengths(): self.data.ui_queue.put("Message: Error with resetting chain lengths.") - elif msg["data"]["command"] == "testImage": - if not self.testImage(): - self.data.ui_queue.put("Message: Error with test image.") elif msg["data"]["command"] == "move": if not self.move(msg["data"]["arg"], float(msg["data"]["arg1"])): self.data.ui_queue.put("Message: Error with initiating move.") @@ -125,9 +122,15 @@ def processAction(self, msg): self.data.ui_queue.put( "Message: Error with starting optical calibration" ) - elif msg["data"]["command"] == "restartWebControl": - print("restarting WebControl") - os._exit() + elif msg["data"]["command"] == "saveOpticalCalibrationConfiguration": + print("here") + if not self.data.opticalCalibration.saveOpticalCalibrationConfiguration(msg["data"]["arg"]): + self.data.ui_queue.put( + "Message: Error with saving optical calibration configuration" + ) + elif msg["data"]["command"] == "testOpticalCalibration": + if not self.data.opticalCalibration.testImage(msg["data"]["arg"]): + self.data.ui_queue.put("Message: Error with test image.") def defineHome(self): try: diff --git a/Actions/opticalCalibration.py b/Actions/opticalCalibration.py index ca2bb57c..f861c602 100644 --- a/Actions/opticalCalibration.py +++ b/Actions/opticalCalibration.py @@ -75,16 +75,45 @@ def simplifyContour(self, c, sides=4): return _c def setCalibrationSettings(self, args): - self.markerX = float(args["markerX"]) * 25.4 - self.markerY = float(args["markerY"]) * 25.4 - self.centerX = float(args["centerX"]) - self.centerY = float(args["centerY"]) + self.markerX = float(args["markerX"]) + self.markerY = float(args["markerY"]) + self.opticalCenter = (float(args["opticalCenterX"]), float(args["opticalCenterY"])) self.scaleX = float(args["scaleX"]) self.scaleY = float(args["scaleY"]) self.tlX = int(args["tlX"]) self.tlY = int(args["tlY"]) self.brX = int(args["brX"]) self.brY = int(args["brY"]) + self.autoScanDirection = int(args["autoScanDirection"]) + self.gaussianBlurValue = int(args["gaussianBlurValue"]) + self.cannyLowValue = float(args["cannyLowValue"]) + self.cannyHighValue = float(args["cannyHighValue"]) + + def saveOpticalCalibrationConfiguration(self, args): + print("Saving Configuration") + try: + print(args) + self.data.config.setValue("Optical Calibration Settings", "opticalCenterX", float(args["opticalCenterX"])) + self.data.config.setValue("Optical Calibration Settings", "opticalCenterY", float(args["opticalCenterY"])) + self.data.config.setValue("Optical Calibration Settings", "scaleX", float(args["scaleX"])) + self.data.config.setValue("Optical Calibration Settings", "scaleY", float(args["scaleY"])) + self.data.config.setValue("Optical Calibration Settings", "gaussianBlurValue", + int(args["gaussianBlurValue"])) + self.data.config.setValue("Optical Calibration Settings", "cannyLowValue", float(args["cannyLowValue"])) + self.data.config.setValue("Optical Calibration Settings", "cannyHighValue", float(args["cannyHighValue"])) + self.data.config.setValue("Optical Calibration Settings", "autoScanDirection", + int(args["autoScanDirection"])) + self.data.config.setValue("Optical Calibration Settings", "markerX", float(args["markerX"])) + self.data.config.setValue("Optical Calibration Settings", "markerY", float(args["markerY"])) + self.data.config.setValue("Optical Calibration Settings", "tlX", int(args["tlX"])) + self.data.config.setValue("Optical Calibration Settings", "tlY", int(args["tlY"])) + self.data.config.setValue("Optical Calibration Settings", "brX", int(args["brX"])) + self.data.config.setValue("Optical Calibration Settings", "brY", int(args["brY"])) + self.data.config.setValue("Optical Calibration Settings", "calibrationExtents", args["calibrationExtents"]) + except Exception as e: + print(e) + return False + return True def translatePoint(self, xB, yB, xA, yA, angle): cosa = math.cos((angle) * 3.141592 / 180.0) @@ -115,7 +144,7 @@ def HomeIn(self): # request a measurement self.data.gcode_queue.put("B10 L") - def on_CenterOnSquare(self, _dist, findCenter=False): + def processImage(self, findCenter=False): dxList = np.zeros(shape=(10)) dyList = np.zeros(shape=(10)) @@ -230,20 +259,22 @@ def on_CenterOnSquare(self, _dist, findCenter=False): avgDi, stdDi = self.removeOutliersAndAverage(diList) avgxB, stdxB = self.removeOutliersAndAverage(xBList) avgyB, stdyB = self.removeOutliersAndAverage(yBList) - print("avgDx, stdDx:" + str(avgDx) + ", " + str(stdDx)) - print("avgDy, stdDy:" + str(avgDy) + ", " + str(stdDy)) - print("avgDy, stdDy:" + str(avgDy) + ", " + str(stdDy)) - print("avgxB, stdxB:" + str(avgxB) + ", " + str(stdxB)) - print("avgyB, stdyB:" + str(avgyB) + ", " + str(stdyB)) - imgencode = cv2.imencode(".png", orig)[1] + return avgDx, avgDy, avgDi, orig + else: + return None, None, None, edged + + def on_CenterOnSquare(self, _dist, findCenter=False): + + avgDx, avgDy, avgDi, image = self.processImage(findCenter) + + if avgDx is not None: + imgencode = cv2.imencode(".png", image)[1] stringData = base64.b64encode(imgencode).decode() self.data.opticalCalibrationImage = stringData self.data.opticalCalibrationImageUpdated = True self.HomingX += avgDx self.HomingY += avgDy - if ((abs(avgDx) >= 0.125) or (abs(avgDy) >= 0.125)) and ( - findCenter == False - ): + if ((abs(avgDx) >= 0.125) or (abs(avgDy) >= 0.125)) and ( not findCenter ): print("Adjusting Location") self.HomeIn() else: @@ -252,14 +283,9 @@ def on_CenterOnSquare(self, _dist, findCenter=False): if self.inMeasureOnlyMode: self.measuredErrorsX[self.HomingPosX + 15][7 - self.HomingPosY] = xS self.measuredErrorsY[self.HomingPosX + 15][7 - self.HomingPosY] = yS - elif findCenter == False: + elif not findCenter: self.calErrorsX[self.HomingPosX + 15][7 - self.HomingPosY] = xS self.calErrorsY[self.HomingPosX + 15][7 - self.HomingPosY] = yS - # else: - # self.ids.centerX.text = "%.1f" % avgxB - # self.ids.centerY.text = "%.1f" % avgyB - # self.opticalCenter = (avgxB, avgyB) - # self.updateScreenValues(self.HomingPosX, self.HomingPosY) if self.inAutoMode: self.on_AutoHome() else: @@ -267,7 +293,8 @@ def on_CenterOnSquare(self, _dist, findCenter=False): print("Releasing Camera") self.camera.release() print("Done") - return False + else: + return False def on_AutoHome(self, measureMode=False): @@ -335,6 +362,7 @@ def on_AutoHome(self, measureMode=False): def on_Calibrate(self, args): print("Initializing") self.setCalibrationSettings(args) + self.saveOpticalCalibrationConfiguration(args) print( "Extents:" + str(self.tlX) @@ -352,16 +380,26 @@ def on_Calibrate(self, args): self.on_AutoHome(False) return True - def testImage(self): + def testImage(self, args): + print("at Test Image") + self.setCalibrationSettings(args) if self.camera is None: print("Starting Camera") self.camera = cv2.VideoCapture(0) - (grabbed, image) = self.camera.read() - imgencode = cv2.imencode(".png", image)[1] - stringData = base64.b64encode(imgencode).decode() - self.data.opticalCalibrationImage = stringData - self.data.opticalCalibrationImageUpdated = True + avgDx, avgDy, avgDi, image = self.processImage(False) print("Releasing Camera") self.camera.release() self.camera = None - return True + if avgDx is not None: + imgencode = cv2.imencode(".png", image)[1] + stringData = base64.b64encode(imgencode).decode() + self.data.opticalCalibrationTestImage = stringData + self.data.opticalCalibrationTestImageUpdated = True + return True + else: + imgencode = cv2.imencode(".png", image)[1] + stringData = base64.b64encode(imgencode).decode() + self.data.opticalCalibrationTestImage = stringData + self.data.opticalCalibrationTestImageUpdated = True + return True + diff --git a/Background/UIProcessor.py b/Background/UIProcessor.py index db49b7db..f2dbf633 100644 --- a/Background/UIProcessor.py +++ b/Background/UIProcessor.py @@ -28,6 +28,12 @@ def start(self, _app): self.app.data.opticalCalibrationImage, ) self.app.data.opticalCalibrationImageUpdated = False + if self.app.data.opticalCalibrationTestImageUpdated is True: + self.sendCalibrationMessage( + "OpticalCalibrationTestImageUpdated", + self.app.data.opticalCalibrationTestImage, + ) + self.app.data.opticalCalibrationTestImageUpdated = False while ( not self.app.data.ui_queue.empty() ): # if there is new data to be read diff --git a/DataStructures/data.py b/DataStructures/data.py index f4898197..7ae3b14a 100644 --- a/DataStructures/data.py +++ b/DataStructures/data.py @@ -73,6 +73,9 @@ class Data: opticalCalibration = None # points to the optical calibration object opticalCalibrationImage = None # stores the current image opticalCalibrationImageUpdated = False # stores whether its been updated or not + opticalCalibrationTestImage = None # stores the current image + opticalCalibrationTestImageUpdated = False # stores whether its been updated or not + """ Colors diff --git a/WebPageProcessor/webPageProcessor.py b/WebPageProcessor/webPageProcessor.py index bb0f4745..01ce2bf8 100644 --- a/WebPageProcessor/webPageProcessor.py +++ b/WebPageProcessor/webPageProcessor.py @@ -116,7 +116,22 @@ def createWebPage(self, pageID, isMobile): return page, "Triangular Calibration", True elif pageID == "opticalCalibration": socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") - page = render_template("opticalCalibration.html", pageID="opticalCalibration") + opticalCenterX = self.data.config.getValue("Optical Calibration Settings", "opticalCenterX") + opticalCenterY = self.data.config.getValue("Optical Calibration Settings", "opticalCenterY") + scaleX = self.data.config.getValue("Optical Calibration Settings", "scaleX") + scaleY = self.data.config.getValue("Optical Calibration Settings", "scaleY") + gaussianBlurValue = self.data.config.getValue("Optical Calibration Settings", "gaussianBlurValue") + cannyLowValue = self.data.config.getValue("Optical Calibration Settings", "cannyLowValue") + cannyHighValue = self.data.config.getValue("Optical Calibration Settings", "cannyHighValue") + autoScanDirection = self.data.config.getValue("Optical Calibration Settings", "autoScanDirection") + markerX = self.data.config.getValue("Optical Calibration Settings", "markerX") + markerY = self.data.config.getValue("Optical Calibration Settings", "markerY") + tlX = self.data.config.getValue("Optical Calibration Settings", "tlX") + tlY = self.data.config.getValue("Optical Calibration Settings", "tlY") + brX = self.data.config.getValue("Optical Calibration Settings", "brX") + brY = self.data.config.getValue("Optical Calibration Settings", "brY") + calibrationExtents = self.data.config.getValue("Optical Calibration Settings", "calibrationExtents") + page = render_template("opticalCalibration.html", pageID="opticalCalibration", opticalCenterX=opticalCenterX, opticalCenterY=opticalCenterY, scaleX=scaleX, scaleY=scaleY, gaussianBlurValue=gaussianBlurValue, cannyLowValue=cannyLowValue, cannyHighValue=cannyHighValue, autoScanDirection=autoScanDirection, markerX=markerX, markerY=markerY, tlX=tlX, tlY=tlY, brX=brX, brY=brY, calibrationExtents=calibrationExtents) return page, "Optical Calibration", True elif pageID == "quickConfigure": socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") diff --git a/defaultwebcontrol.json b/defaultwebcontrol.json index 198ad50a..54c25e5f 100644 --- a/defaultwebcontrol.json +++ b/defaultwebcontrol.json @@ -795,16 +795,16 @@ "value": "0" }, { - "default": "0", + "default": "320", "key": "opticalCenterX", "type": "string", - "value": "0" + "value": "320" }, { - "default": "0", + "default": "240", "key": "opticalCenterY", "type": "string", - "value": "0" + "value": "240" }, { "default": "1.0", @@ -843,16 +843,46 @@ "value": 0 }, { - "default": 15.24, + "default": 0.6, "key": "markerX", "type": "float", - "value": 15.24 + "value": 0.6 }, { - "default": 15.24, + "default": 0.6, "key": "markerY", "type": "float", - "value": 15.24 + "value": 0.6 + }, + { + "default": -15, + "key": "tlX", + "type": "int", + "value": -15 + }, + { + "default": 7, + "key": "tlY", + "type": "int", + "value": 7 + }, + { + "default": 15, + "key": "brX", + "type": "int", + "value": 15 + }, + { + "default": -7, + "key": "brY", + "type": "int", + "value": -7 + }, + { + "default": "Full Area", + "key": "calibrationExtents", + "type": "string", + "value": "Full Area" } ], "WebControl Settings": [ diff --git a/templates/opticalCalibration.html b/templates/opticalCalibration.html index b93793b4..cae42cdf 100644 --- a/templates/opticalCalibration.html +++ b/templates/opticalCalibration.html @@ -13,14 +13,14 @@

- + Enter value in inches only
- + Enter value in inches only
@@ -29,14 +29,14 @@

- + Enter something like 1.0028
- + Enter something like 1.0028
@@ -44,19 +44,20 @@

- - + + Enter something like 300
- - + + Enter something like 200
+

@@ -72,21 +73,22 @@

Calibration Extents

- + +
- - Enter something like -15 + + Range from +15 to -15 (+ is right, - is left)
- - Enter something like 7 + + Range from +7 to -7 (+ is up, - is down)
@@ -94,31 +96,86 @@

Calibration Extents

- - Enter something like 15 + + Range from +15 to -15 (+ is right, - is left)
- - Enter something like -7 + + Range from +7 to -7 (+ is up, - is down)
+
+
+
+ + +
+
+
+
-
-
-

Calibration

-
+
+ +
+
+
- +
+ + + 0-255 +
+
+ + + 0-255 +
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Calibration

@@ -160,32 +217,47 @@

Sled Position

function process(processName){ var markerX = $("#markerX").val(); var markerY = $("#markerY").val(); - var centerX = $("#centerX").val(); - var centerY = $("#centerY").val(); + var opticalCenterX = $("#opticalCenterX").val(); + var opticalCenterY = $("#opticalCenterY").val(); var scaleX = $("#scaleX").val(); var scaleY = $("#scaleY").val(); var tlX = $("#tlX").val(); var tlY = $("#tlY").val(); var brX = $("#brX").val(); var brY = $("#brY").val(); + var calibrationExtents = $("#calibrationExtents option:selected").val() + var cannyLowValue = $("#cannyLowValue").val(); + var cannyHighValue = $("#cannyHighValue").val(); + var gaussianBlurValue = $("#gaussianBlurValue option:selected").val() + var autoScanDirection = $("#autoScanDirection option:selected").val() var parameters = {markerX:markerX, markerY:markerY, - centerX:centerX, - centerY:centerY, + opticalCenterX:opticalCenterX, + opticalCenterY:opticalCenterY, scaleX:scaleX, scaleY:scaleY, tlX:tlX, tlY:tlY, brX:brX, - brY:brY}; - action('optical_Calibrate',parameters); + brY:brY, + calibrationExtents:calibrationExtents, + cannyLowValue:cannyLowValue, + cannyHighValue:cannyHighValue, + gaussianBlurValue:gaussianBlurValue, + autoScanDirection:autoScanDirection + }; + if (processName=="testImage") + action('testOpticalCalibration', parameters) + else + action('optical_Calibrate',parameters); } function processCalibrationMessage(msg){ - //console.log(msg.msg) - //console.log(msg.data) - $("#imageDiv").html("") - //console.log(msg.data.length) + console.log(msg.msg); + if(msg.msg=="OpticalCalibrationImageUpdated") + $("#imageDiv").html("") + if(msg.msg=="OpticalCalibrationTestImageUpdated") + $("#testImageDiv").html("") } $(document).ready(function () { @@ -198,31 +270,40 @@

Sled Position

$("#tlY").val(7); $("#brX").val(0); $("#brY").val(0); + enableCustomExtents(true); break; case "Bottom Left": $("#tlX").val(-15); $("#tlY").val(0); $("#brX").val(0); $("#brY").val(-7); + enableCustomExtents(true); break; case "Top Right": $("#tlX").val(0); $("#tlY").val(7); $("#brX").val(15); $("#brY").val(0); + enableCustomExtents(true); break; case "Bottom Right": $("#tlX").val(0); $("#tlY").val(0); $("#brX").val(15); $("#brY").val(-7); + enableCustomExtents(true); break; case "Full Area": $("#tlX").val(-15); $("#tlY").val(7); $("#brX").val(15); $("#brY").val(-7); + enableCustomExtents(true); break; + case "Custom": + enableCustomExtents(false); + break; + default: $("#tlX").val(-15); $("#tlY").val(7); @@ -234,5 +315,48 @@

Sled Position

console.log("here1"); drawCalibration(); }); + +function enableCustomExtents(value){ + $("#tlX").prop("disabled", value); + $("#tlY").prop("disabled", value); + $("#brX").prop("disabled", value); + $("#brY").prop("disabled", value); +} + +function saveConfiguration(){ + var markerX = $("#markerX").val(); + var markerY = $("#markerY").val(); + var opticalCenterX = $("#opticalCenterX").val(); + var opticalCenterY = $("#opticalCenterY").val(); + var scaleX = $("#scaleX").val(); + var scaleY = $("#scaleY").val(); + var tlX = $("#tlX").val(); + var tlY = $("#tlY").val(); + var brX = $("#brX").val(); + var brY = $("#brY").val(); + var calibrationExtents = $("#calibrationExtents option:selected").val() + var cannyLowValue = $("#cannyLowValue").val(); + var cannyHighValue = $("#cannyHighValue").val(); + var gaussianBlurValue = $("#gaussianBlurValue option:selected").val(); + var autoScanDirection = $("#autoScanDirection option:selected").val(); + var parameters = {markerX:markerX, + markerY:markerY, + opticalCenterX:opticalCenterX, + opticalCenterY:opticalCenterY, + scaleX:scaleX, + scaleY:scaleY, + tlX:tlX, + tlY:tlY, + brX:brX, + brY:brY, + calibrationExtents:calibrationExtents, + cannyLowValue:cannyLowValue, + cannyHighValue:cannyHighValue, + gaussianBlurValue:gaussianBlurValue, + autoScanDirection:autoScanDirection + }; + action('saveOpticalCalibrationConfiguration',parameters); +} + {% endblock %} From 621597994bbc6f2077d19e637391cc3c6643e4db Mon Sep 17 00:00:00 2001 From: John Hogan Date: Wed, 31 Oct 2018 14:44:33 -0400 Subject: [PATCH 029/685] adjustments --- Actions/actions.py | 15 ++++++++++++++- templates/opticalCalibration.html | 22 +++++++++++++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index 30c78056..a238e1c1 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -131,6 +131,9 @@ def processAction(self, msg): elif msg["data"]["command"] == "testOpticalCalibration": if not self.data.opticalCalibration.testImage(msg["data"]["arg"]): self.data.ui_queue.put("Message: Error with test image.") + elif msg["data"]["command"] == "adjustCenter": + if not self.adjustCenter(msg["data"]["arg"]): + self.data.ui_queue.put("Message: Error with adjusting center.") def defineHome(self): try: @@ -682,4 +685,14 @@ def testImage(self): except Exception as e: print(e) return False - \ No newline at end of file + + def adjustCenter(self, dist): + try: + motorOffsetY = float(self.data.config.getValue("Maslow Settings","motorOffsetY"))+dist + self.data.config.setValue('Maslow Settings', 'motorOffsetY', str(motorOffsetY)) + if not self.returnToCenter(): + return False + return True + except Exception as e: + print(e) + return False \ No newline at end of file diff --git a/templates/opticalCalibration.html b/templates/opticalCalibration.html index cae42cdf..32e41d32 100644 --- a/templates/opticalCalibration.html +++ b/templates/opticalCalibration.html @@ -159,7 +159,19 @@

- +
+
+ +
+
+ +
+
+
+
+
+
+
@@ -178,18 +190,18 @@

Calibration

- +
- +
- +
- +
From 8c6827a187c353e00388467a843f0ca73b643a6f Mon Sep 17 00:00:00 2001 From: John Hogan Date: Thu, 1 Nov 2018 15:37:04 -0400 Subject: [PATCH 030/685] Big push on optical calibration --- Actions/actions.py | 47 ++++- Actions/opticalCalibration.py | 264 +++++++++++++++++++++------ Background/UIProcessor.py | 7 + WebPageProcessor/webPageProcessor.py | 22 +-- config/config.py | 6 +- main.py | 2 +- static/favicon.ico | Bin 0 -> 1150 bytes static/scripts/frontpage.js | 6 +- static/scripts/zAxis.js | 4 +- templates/base.html | 7 +- templates/opticalCalibration.html | 174 +++++++++++++++++- 11 files changed, 443 insertions(+), 96 deletions(-) create mode 100644 static/favicon.ico diff --git a/Actions/actions.py b/Actions/actions.py index a238e1c1..a3a5d8dc 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -131,6 +131,34 @@ def processAction(self, msg): elif msg["data"]["command"] == "testOpticalCalibration": if not self.data.opticalCalibration.testImage(msg["data"]["arg"]): self.data.ui_queue.put("Message: Error with test image.") + elif msg["data"]["command"] == "saveAndSendOpticalCalibration": + if not self.data.opticalCalibration.saveAndSend(): + self.data.ui_queue.put("Message: Error with saving and sending calibration matrix.") + elif msg["data"]["command"] == "reloadCalibration": + errorX, errorY, curveX, curveY = self.data.opticalCalibration.reloadCalibration() + if errorX is None or errorY is None or curveX is None or curveY is None: + self.data.ui_queue.put("Message: Error with (re)loading calibration.") + else: + data = {"errorX": errorX, "errorY": errorY} + self.data.ui_queue.put( + "Action: updateOpticalCalibrationError:_" + json.dumps(data) + ) + #data = {"curveX": curveX, "curveY": curveY} + #self.data.ui_queue.put( + # "Action: updateOpticalCalibrationCurve:_" + json.dumps(data) + #) + elif msg["data"]["command"] == "clearCalibration": + if not self.data.opticalCalibration.clearCalibration(): + self.data.ui_queue.put("Message: Error with clearing calibration.") + elif msg["data"]["command"] == "curveFitOpticalCalibration": + curveX, curveY = self.data.opticalCalibration.surfaceFit() + if curveX is None or curveY is None: + self.data.ui_queue.put("Message: Error with curve fitting calibration data.") + else: + data = {"curveX":curveX, "curveY":curveY} + self.data.ui_queue.put( + "Action: updateOpticalCalibrationCurve:_" + json.dumps(data) + ) elif msg["data"]["command"] == "adjustCenter": if not self.adjustCenter(msg["data"]["arg"]): self.data.ui_queue.put("Message: Error with adjusting center.") @@ -695,4 +723,21 @@ def adjustCenter(self, dist): return True except Exception as e: print(e) - return False \ No newline at end of file + return False + + def processSettingRequest(self, section, setting): + try: + if setting == "homePosition": + homeX = self.data.config.getValue("Advanced Settings", "homeX") + homeY = self.data.config.getValue("Advanced Settings", "homeY") + position = {"xval": homeX, "yval": homeY} + self.data.ui_queue.put( + "Action: homePositionMessage:_" + json.dumps(position) + ) # the "_" facilitates the parse + return None, None + else: + retval = self.data.config.getValue(section, setting) + return setting, retval + except Exception as e: + pass + return None, None \ No newline at end of file diff --git a/Actions/opticalCalibration.py b/Actions/opticalCalibration.py index f861c602..c578fa9d 100644 --- a/Actions/opticalCalibration.py +++ b/Actions/opticalCalibration.py @@ -30,10 +30,51 @@ class OpticalCalibration(MakesmithInitFuncs): matrixSize = (31, 15) calErrorsX = np.zeros(matrixSize) calErrorsY = np.zeros(matrixSize) + xCurve = np.zeros(shape=(6)) # coefficients for quadratic curve + yCurve = np.zeros(shape=(6)) # coefficients for quadratic curve inAutoMode = False inMeasureOnlyMode = False autoScanDirection = 0 + def __init__(self): + # can't do much because data hasn't been initialized yet + pass + + def reloadCalibration(self): + try: + xyErrors = self.data.config.getValue('Optical Calibration Settings', 'xyErrorArray') + self.calErrorsX, self.calErrorsY = self.data.config.parseErrorArray(xyErrors, True) + self.xCurve[0] = float(self.data.config.getValue('Optical Calibration Settings', 'calX0')) + self.xCurve[1] = float(self.data.config.getValue('Optical Calibration Settings', 'calX1')) + self.xCurve[2] = float(self.data.config.getValue('Optical Calibration Settings', 'calX2')) + self.xCurve[3] = float(self.data.config.getValue('Optical Calibration Settings', 'calX3')) + self.xCurve[4] = float(self.data.config.getValue('Optical Calibration Settings', 'calX4')) + self.xCurve[5] = float(self.data.config.getValue('Optical Calibration Settings', 'calX5')) + self.yCurve[0] = float(self.data.config.getValue('Optical Calibration Settings', 'calY0')) + self.yCurve[1] = float(self.data.config.getValue('Optical Calibration Settings', 'calY1')) + self.yCurve[2] = float(self.data.config.getValue('Optical Calibration Settings', 'calY2')) + self.yCurve[3] = float(self.data.config.getValue('Optical Calibration Settings', 'calY3')) + self.yCurve[4] = float(self.data.config.getValue('Optical Calibration Settings', 'calY4')) + self.yCurve[5] = float(self.data.config.getValue('Optical Calibration Settings', 'calY5')) + print("reloaded calibration data") + return self.calErrorsX, self.calErrorsY, self.xCurve, self.yCurve + except Exception as e: + print(e) + return None, None, None, None + + + def clearCalibration(self): + try: + self.calErrorsX = np.zeros(self.matrixSize) + self.calErrorsY = np.zeros(self.matrixSize) + self.xCurve = np.zeros(shape=(6)) # coefficients for quadratic curve + self.yCurve = np.zeros(shape=(6)) # coefficients for quadratic curve + return True + except Exception as e: + print(e) + return False + + def stopCut(self): self.data.quick_queue.put("!") with self.data.gcode_queue.mutex: @@ -135,6 +176,8 @@ def HomeIn(self): self.HomingPosX * 3.0, self.HomingPosY * 3.0, _posX, _posY ) ) + self.on_AutoHome() + ''' self.data.units = "INCHES" self.data.gcode_queue.put("G20 ") self.data.gcode_queue.put("G90 ") @@ -143,6 +186,7 @@ def HomeIn(self): self.data.measureRequest = self.on_CenterOnSquare # request a measurement self.data.gcode_queue.put("B10 L") + ''' def processImage(self, findCenter=False): @@ -297,67 +341,70 @@ def on_CenterOnSquare(self, _dist, findCenter=False): return False def on_AutoHome(self, measureMode=False): - - minX = self.tlX - maxX = self.brX - minY = self.tlY - maxY = self.brY - if measureMode == True: - print("Measure Only") - self.inMeasureOnlyMode = True - if self.inAutoMode == False: - self.HomingX = 0.0 - self.HomingY = 0.0 - self.HomingPosX = minX - self.HomingPosY = minY - self.HomingScanDirection = 1 - self.inAutoMode = True - self.HomeIn() - else: - # note, the self.HomingX and self.HomingY are not reinitialzed here - # The rationale is that the offset for the previous registration point is - # probably a good starting point for this registration point.. - if self.autoScanDirection == 0: # horizontal - print("Horizontal Scan") - if self.inMeasureOnlyMode: - self.HomingX = 0.0 - self.HomingY = 0.0 - self.HomingPosX += self.HomingScanDirection - if (self.HomingPosX == maxX + 1) or (self.HomingPosX == minX - 1): - if self.HomingPosX == maxX + 1: - self.HomingPosX = maxX + try: + minX = self.tlX + maxX = self.brX + minY = self.tlY + maxY = self.brY + if measureMode == True: + print("Measure Only") + self.inMeasureOnlyMode = True + if self.inAutoMode == False: + self.HomingX = 0.0 + self.HomingY = 0.0 + self.HomingPosX = minX + self.HomingPosY = minY + self.HomingScanDirection = 1 + self.inAutoMode = True + self.HomeIn() + else: + # note, the self.HomingX and self.HomingY are not reinitialzed here + # The rationale is that the offset for the previous registration point is + # probably a good starting point for this registration point.. + if self.autoScanDirection == 0: # horizontal + if self.inMeasureOnlyMode: + self.HomingX = 0.0 + self.HomingY = 0.0 + self.HomingPosX += self.HomingScanDirection + if (self.HomingPosX == maxX + 1) or (self.HomingPosX == minX - 1): + if self.HomingPosX == maxX + 1: + self.HomingPosX = maxX + else: + self.HomingPosX = minX + self.HomingScanDirection *= -1 + self.HomingPosY -= 1 + if self.HomingPosY >= maxY: + self.HomingY -= 7.0 # drop down 7 mm for next square's guess (only) + self.HomeIn() else: - self.HomingPosX = minX - self.HomingScanDirection *= -1 - self.HomingPosY -= 1 - if self.HomingPosY > maxY - 1: - self.HomingY -= 7.0 # drop down 7 mm for next square's guess (only) - self.HomeIn() - else: - self.inAutoMode = False - print("Calibration Completed") - # self.printCalibrationErrorValue() - else: # vertical - print("Vertical Scan") - if self.inMeasureOnlyMode: - self.HomingX = 0.0 - self.HomingY = 0.0 - self.HomingPosY -= self.HomingScanDirection - if (self.HomingPosY == maxY - 1) or (self.HomingPosY == minY + 1): - if self.HomingPosY == minY + 1: - self.HomingPosY = minY + self.inAutoMode = False + print("Releasing Camera") + self.camera.release() + print("Calibration Completed") + # self.printCalibrationErrorValue() + else: # vertical + print("Vertical Scan") + if self.inMeasureOnlyMode: + self.HomingX = 0.0 + self.HomingY = 0.0 + self.HomingPosY -= self.HomingScanDirection + if (self.HomingPosY == maxY - 1) or (self.HomingPosY == minY + 1): + if self.HomingPosY == minY + 1: + self.HomingPosY = minY + else: + self.HomingPosY = maxY + self.HomingScanDirection *= -1 + self.HomingPosX += 1 + if self.HomingPosX <= maxX: + self.HomingY -= 7.0 # drop down 7 mm for next square's guess (only) + self.HomeIn() else: - self.HomingPosY = maxY - self.HomingScanDirection *= -1 - self.HomingPosX += 1 - if self.HomingPosX != maxX + 1: - self.HomingY -= 7.0 # drop down 7 mm for next square's guess (only) - self.HomeIn() - else: - self.inAutoMode = False - print("Releasing Camera") - self.camera.release() - print("Calibration Completed") + self.inAutoMode = False + print("Releasing Camera") + self.camera.release() + print("Calibration Completed") + except Exception as e: + print(e) def on_Calibrate(self, args): print("Initializing") @@ -403,3 +450,102 @@ def testImage(self, args): self.data.opticalCalibrationTestImageUpdated = True return True + def on_SaveCSV(self): + outFile = open("calibrationValues.csv","w") + line = "" + for y in range(7, -8, -1): + line = "" + for x in range(-15, 16, +1): + line += "{:.2f},".format(self.calErrorsX[x+15][7-y]) + line +="\n" + outFile.write(line) + outFile.write("\n") + for y in range(7, -8, -1): + line = "" + for x in range(-15, 16, +1): + line += "{:.2f},".format(self.calErrorsY[x+15][7-y]) + line +="\n" + outFile.write(line) + outFile.close() + + + def saveAndSend(self): + try: + _str = "" + _strcomma = "" + for z in range(2): + for y in range(15): + for x in range(31): + if ((x == 30) and (y == 14) and (z == 1)): + _strcomma = "" + else: + _strcomma = "," + if (z == 0): + _str += str(int(self.calErrorsX[x][y] * 1000)) + _strcomma + else: + _str += str(int(self.calErrorsY[x][y] * 1000)) + _strcomma + # print _str + + self.data.config.setValue('Optical Calibration Settings', 'calX0', str(self.xCurve[0])) + self.data.config.setValue('Optical Calibration Settings', 'calX1', str(self.xCurve[1])) + self.data.config.setValue('Optical Calibration Settings', 'calX2', str(self.xCurve[2])) + self.data.config.setValue('Optical Calibration Settings', 'calX3', str(self.xCurve[3])) + self.data.config.setValue('Optical Calibration Settings', 'calX4', str(self.xCurve[4])) + self.data.config.setValue('Optical Calibration Settings', 'calX5', str(self.xCurve[5])) + self.data.config.setValue('Optical Calibration Settings', 'calY0', str(self.yCurve[0])) + self.data.config.setValue('Optical Calibration Settings', 'calY1', str(self.yCurve[1])) + self.data.config.setValue('Optical Calibration Settings', 'calY2', str(self.yCurve[2])) + self.data.config.setValue('Optical Calibration Settings', 'calY3', str(self.yCurve[3])) + self.data.config.setValue('Optical Calibration Settings', 'calY4', str(self.yCurve[4])) + self.data.config.setValue('Optical Calibration Settings', 'calY5', str(self.yCurve[5])) + + self.data.config.setValue('Optical Calibration Settings', 'xyErrorArray', _str) + return True + except Exception as e: + print(e) + return False + + def surfaceFit(self): + # set data into proper format + try: + dataX = np.zeros(((15 * 31), 3)) + dataY = np.zeros(((15 * 31), 3)) + for y in range(7, -8, -1): + for x in range(-15, 16, +1): + dataX[(7 - y) * 31 + (x + 15)][0] = float(x * 3.0 * 25.4) + dataY[(7 - y) * 31 + (x + 15)][0] = float(x * 3.0 * 25.4) + dataX[(7 - y) * 31 + (x + 15)][1] = float(y * 3.0 * 25.4) + dataY[(7 - y) * 31 + (x + 15)][1] = float(y * 3.0 * 25.4) + dataX[(7 - y) * 31 + (x + 15)][2] = self.calErrorsX[x + 15][7 - y] + dataY[(7 - y) * 31 + (x + 15)][2] = self.calErrorsY[x + 15][7 - y] + # surface fit X Errors + xA = np.c_[np.ones(dataX.shape[0]), dataX[:, :2], np.prod(dataX[:, :2], axis=1), dataX[:, :2] ** 2] + self.xCurve, _, _, _ = np.linalg.lstsq(xA, dataX[:, 2], rcond=None) + xB = dataX[:, 2] + xSStot = ((xB - xB.mean()) ** 2).sum() + xSSres = ((xB - np.dot(xA, self.xCurve)) ** 2).sum() + if (xSStot != 0): + xR2 = 1.0 - xSSres / xSStot + else: + xR2 = 0.0 + # surface fit Y Errors + + yA = np.c_[np.ones(dataY.shape[0]), dataY[:, :2], np.prod(dataY[:, :2], axis=1), dataY[:, :2] ** 2] + self.yCurve, _, _, _ = np.linalg.lstsq(yA, dataY[:, 2], rcond=None) + yB = dataY[:, 2] + ySStot = ((yB - yB.mean()) ** 2).sum() + ySSres = ((yB - np.dot(yA, self.yCurve)) ** 2).sum() + if (ySStot != 0): + yR2 = 1.0 - ySSres / ySStot + else: + yR2 = 0.0 + + print(self.xCurve) + print(xR2) + print(self.yCurve) + print(yR2) + return self.xCurve.tolist(), self.yCurve.tolist() + except Exception as e: + print(e) + return None, None + diff --git a/Background/UIProcessor.py b/Background/UIProcessor.py index f2dbf633..8fe1c481 100644 --- a/Background/UIProcessor.py +++ b/Background/UIProcessor.py @@ -129,6 +129,13 @@ def start(self, _app): if message.find("connectionStatus") != -1: msg = message.split("_") socketio.emit("controllerStatus", msg[1], namespace="/MaslowCNC") + if message.find("updateOpticalCalibrationCurve") != -1: + msg = message.split("_") + self.sendCalibrationMessage("updateOpticalCalibrationCurve", msg[1]) + if message.find("updateOpticalCalibrationError") != -1: + msg = message.split("_") + self.sendCalibrationMessage("updateOpticalCalibrationError", msg[1]) + elif message[0:6] == "ALARM:": self.activateModal("Notification:", message[7:]) elif message == "ok\r\n": diff --git a/WebPageProcessor/webPageProcessor.py b/WebPageProcessor/webPageProcessor.py index 01ce2bf8..03f9f008 100644 --- a/WebPageProcessor/webPageProcessor.py +++ b/WebPageProcessor/webPageProcessor.py @@ -159,24 +159,4 @@ def createWebPage(self, pageID, isMobile): ) return page, "Quick Configure", False - def processSettingRequest(self, setting): - if setting == "units": - units = self.data.config.getValue("Computed Settings", "units") - return setting,units - if setting == "distToMove": - distToMove = self.data.config.getValue("Computed Settings", "distToMove") - return setting, distToMove - if setting == "unitsZ": - unitsZ = self.data.config.getValue("Computed Settings", "unitsZ") - return setting, unitsZ - if setting == "distToMoveZ": - distToMoveZ = self.data.config.getValue("Computed Settings", "distToMoveZ") - return setting, distToMoveZ - if setting == "homePosition": - homeX = self.data.config.getValue("Advanced Settings", "homeX") - homeY = self.data.config.getValue("Advanced Settings", "homeY") - position = {"xval": homeX, "yval": homeY} - self.data.ui_queue.put( - "Action: homePositionMessage:_" + json.dumps(position) - ) # the "_" facilitates the parse - return None, None + diff --git a/config/config.py b/config/config.py index f63f10b1..506ef343 100644 --- a/config/config.py +++ b/config/config.py @@ -228,9 +228,9 @@ def syncFirmwareKey(self, firmwareKey, value, isImporting=False, useStored=False else: value = 0 if firmwareKey == 45: - # print "firmwareKey = 45" - # if storedValue != "": - # self.sendErrorArray(firmwareKey, storedValue, data) + print("firmwareKey = 45") + if storedValue != "": + self.sendErrorArray(firmwareKey, storedValue, data) pass elif useStored is True: app.data.gcode_queue.put( diff --git a/main.py b/main.py index c3c28d8e..8f12e9cb 100644 --- a/main.py +++ b/main.py @@ -273,7 +273,7 @@ def command(msg): @socketio.on("settingRequest", namespace="/MaslowCNC") def settingRequest(msg): # didn't move to actions.. this request is just to send it computed values.. keeping it here makes it faster than putting it through the UIProcessor - setting, value = app.webPageProcessor.processSettingRequest(msg["data"]) + setting, value = app.data.actions.processSettingRequest(msg["data"]["section"],msg["data"]["setting"]) if setting is not None: socketio.emit( "requestedSetting", diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..243a100758f140832dedd34708db5cf7c6c40d73 GIT binary patch literal 1150 zcmaJ=TTc^F5FR3lZ-ysd_0gZ^k5I#dG0_-fOw`20L==^TVj3<1f{?njP+Houy|Ha6 zg%)ZlPGm+ubt1ZD#JG&d_ZvlI zV$L;R zzz*ikk2wQ5kW=I7rwiPxe&xgD4to*9H`3my^QrNzJ(#w*N_5laP;Py}<@4RH+!s1= zKWg!fr2-!$suEK?+Q(e<+;lvyMl*6g^$z(cwq`%c*YykTEpi;2KDus`>+>$R;uV=E>K5O{EkC$F$P?aQyEN@2hpg`>TBf_gJxE9j>d~pw_+8|1aK1XBEW3zPLfOca - {% block title %}{% endblock %} - WebControl + {% block title %}{% endblock %}WebControl + @@ -146,9 +147,9 @@ socket.emit('moveZ',{data:{direction:direction,distToMoveZ:distToMoveZ}}); } - function settingRequest(setting){ + function settingRequest(section,setting){ console.log("requesting..") - socket.emit('settingRequest',{data:setting}); + socket.emit('settingRequest',{data:{section:section,setting:setting}}); } function requestPage(page){ diff --git a/templates/opticalCalibration.html b/templates/opticalCalibration.html index 32e41d32..06a09ea9 100644 --- a/templates/opticalCalibration.html +++ b/templates/opticalCalibration.html @@ -185,6 +185,67 @@

+
+ +
+
+
+
+ +
+
+
+
+

X-Curve

+
+
+
+
+
+

Y-Curve

+
+
+
+ +
+
+
+
+ +
+
+ +
+
+

X-Error

+
+
+
+
+
+

Y-Error

+
+
+
+
+
+

XY-Error

+
+
+
+ + +
+
+

Calibration

@@ -196,6 +257,14 @@

Calibration

+
+
+ +
+
+ +
+
@@ -224,8 +293,12 @@

Sled Position

{% block javascript %} + @@ -222,7 +223,7 @@
diff --git a/templates/pidTuning.html b/templates/pidTuning.html new file mode 100644 index 00000000..64865d92 --- /dev/null +++ b/templates/pidTuning.html @@ -0,0 +1,296 @@ + +{% block content %} +
+
+
+

Top Left Motor

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+

Top Right Motor

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+

Bottom Left Motor

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+

Bottom Right Motor

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+
+

Velocity Testing

+
+
+
+ +
+ + + + +
+
+
+
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+ +
+
+
+
+{% endblock %} + +{% block javascript %} + + + +{% endblock %} From abdc41aeebd54e660d157e069f54e9e94cd5aa50 Mon Sep 17 00:00:00 2001 From: madgrizzle Date: Mon, 13 May 2019 21:21:53 -0400 Subject: [PATCH 131/685] continue work on pidtuning page --- Actions/actions.py | 18 ++- Background/UIProcessor.py | 11 ++ Background/messageProcessor.py | 14 ++ DataStructures/data.py | 2 + config/config.py | 1 + static/scripts/baseSocket.js | 5 +- static/scripts/pidTuning.js | 58 +++++++ templates/pidTuning.html | 283 ++++++++++++++++++--------------- templates/settings.html | 35 +++- 9 files changed, 292 insertions(+), 135 deletions(-) create mode 100644 static/scripts/pidTuning.js diff --git a/Actions/actions.py b/Actions/actions.py index 25a73143..cb40616d 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -191,6 +191,9 @@ def processAction(self, msg): elif msg["data"]["command"] == "shutdown": if not self.shutdown(): self.data.ui_queue1.put("Alert", "Alert", "Error with shutting down.") + elif msg["data"]["command"] == "vExecute": + if not self.velocityPIDTest(msg["data"]["arg"]): + self.data.ui_queue1.put("Alert", "Alert", "Error with executing velocity PID test.") except Exception as e: print (str(e)) @@ -1101,4 +1104,17 @@ def queryCamera(self): return True except Exception as e: self.data.console_queue.put(str(e)) - return False \ No newline at end of file + return False + + def velocityPIDTest(self, parameters): + try: + print(parameters) + print(parameters["KpV"]) + gcodeString = "B13 "+parameters["vMotor"]+" S"+parameters["vStart"]+" F"+parameters["vStop"]+" I"+parameters["vSteps"]+" V"+parameters["vVersion"] + print(gcodeString) + self.data.gcode_queue.put(gcodeString) + return True + except Exception as e: + self.data.console_queue.put(str(e)) + return False + diff --git a/Background/UIProcessor.py b/Background/UIProcessor.py index 6e32fb4d..98b83b56 100644 --- a/Background/UIProcessor.py +++ b/Background/UIProcessor.py @@ -160,6 +160,15 @@ def sendCameraMessage(self, message, _data=""): "message", {"command":"cameraMessage", "data": data, "dataFormat": "json"}, namespace="/MaslowCNC" ) + def updatePIDData(self, message, _data=""): + + data = json.dumps({"command": message, "data": _data}) + print(data) + socketio.emit( + "message", {"command":"updatePIDData", "data": data, "dataFormat": "json"}, namespace="/MaslowCNC" + ) + + def sendGcodeUpdate(self): if self.app.data.compressedGCode3D is not None: self.app.data.console_queue.put("Sending Gcode compressed") @@ -203,6 +212,8 @@ def processMessage(self, _message): self.sendCalibrationMessage("updateTimer", json.loads(msg["data"])) elif msg["message"] == "updateCamera": self.sendCameraMessage("updateCamera", json.loads(msg["data"])) + elif msg["message"] == "updatePIDData": + self.updatePIDData("updatePIDData", json.loads(msg["data"])) else: if msg["message"] == "setAsPause": msg["message"] = "requestedSetting" diff --git a/Background/messageProcessor.py b/Background/messageProcessor.py index b4315d67..dc4dc66f 100644 --- a/Background/messageProcessor.py +++ b/Background/messageProcessor.py @@ -99,6 +99,20 @@ def start(self): ) elif message == "ok\r\n": pass # displaying all the 'ok' messages clutters up the display + elif message[0:26] == "--PID Velocity Test Stop--": + self.data.inPIDVelocityTest = False + print("test stopped") + print(self.data.PIDVelocityTestData) + data = json.dumps({"result": "velocity", "data": self.data.PIDVelocityTestData}) + self.data.ui_queue1.put("Action","updatePIDData",data) + #send data + elif self.data.inPIDVelocityTest: + if message.find("Kp=") == -1: + self.data.PIDVelocityTestData.append(float(message)) + elif message[0:27] == "--PID Velocity Test Start--": + self.data.inPIDVelocityTest = True + self.data.PIDVelocityTestData = [] + print("test started") else: self.data.ui_controller_queue.put(message) diff --git a/DataStructures/data.py b/DataStructures/data.py index 58e4957c..c839a66f 100644 --- a/DataStructures/data.py +++ b/DataStructures/data.py @@ -72,6 +72,8 @@ class Data: connectionStatus = 0 # is the calibration process currently underway 0 -> false calibrationInProcess = False + inPIDVelocityTest = False + inPIDPositionTest = False """ Pointers to Objects diff --git a/config/config.py b/config/config.py index 79f9b7f8..08db21c9 100644 --- a/config/config.py +++ b/config/config.py @@ -327,6 +327,7 @@ def syncFirmwareKey(self, firmwareKey, value, isImporting=False, useStored=False value = 0 if firmwareKey == 45: + print(self.data.controllerFirmwareVersion) self.data.console_queue.put("firmwareKey = 45") if storedValue != "": self.sendErrorArray(firmwareKey, storedValue, data) diff --git a/static/scripts/baseSocket.js b/static/scripts/baseSocket.js index 3dff2b2c..a8bccb54 100644 --- a/static/scripts/baseSocket.js +++ b/static/scripts/baseSocket.js @@ -137,7 +137,10 @@ //completed updateCalibrationImage(data); break; - + case 'updatePIDData': + //completed + updatePIDData(data); + break; default: console.log("!!!!!!"); console.log("uncaught action:"+msg.command); diff --git a/static/scripts/pidTuning.js b/static/scripts/pidTuning.js new file mode 100644 index 00000000..be70569e --- /dev/null +++ b/static/scripts/pidTuning.js @@ -0,0 +1,58 @@ + +var _xError = []; +var _yError = []; +var _xValues = []; +var colorwayLayout = ['#313131','#3D019D','#3810DC','#2D47F9','#2503FF','#2ADEF6','#60FDFA','#AEFDFF','#BBBBBB','#FFFDA9','#FAFD5B','#F7DA29','#FF8E25','#F8432D','#D90D39','#D7023D','#313131'] + + + + + +function updateVErrorCurve(data) { + console.log(data) + xCurve = data.curveX; + yCurve = data.curveY; + $('#curveChartButton').removeClass('btn-secondary').addClass('btn-primary'); + $('#curveFitButton').removeClass('btn-primary').addClass('btn-secondary'); +} + +function updatePIDData(msg){ + vErrorPlot = document.getElementById('vErrorPlot'); + data = JSON.parse(msg.data) + console.log(data); + if ($("#vErrorPlot").html()!="") + while (vErrorPlot.data.length>0) + Plotly.deleteTraces(vErrorPlot, [0]); + Plotly.plot(vErrorPlot, [{y: data.data }], {title: "Velocity Error", showlegend: false, colorway: colorwayLayout } ); +} + + + +$(document).ready(function () { + +}); + + + +function vExecute(){ + var vMotor = $('#vMotor input:radio:checked').val(); + var vStart= $("#vStart").val(); + var vStop= $("#vStop").val(); + var vSteps= $("#vSteps").val(); + var vVersion= $("#vVersion").val(); + var KpV = $('#KpV').val(); + var KiV = $('#KiV').val(); + var KdV = $('#KdV').val(); + var parameters = {vMotor: vMotor, + vStart: vStart, + vStop: vStop, + vSteps: vSteps, + vVersion: vVersion, + KpV: KpV, + KiV: KiV, + KdV: KdV + }; + console.log(parameters); + action('vExecute',parameters); +} + diff --git a/templates/pidTuning.html b/templates/pidTuning.html index 64865d92..92ff18b5 100644 --- a/templates/pidTuning.html +++ b/templates/pidTuning.html @@ -6,25 +6,25 @@

Top Left Motor

-
-
-
- @@ -32,25 +32,25 @@

Top Left Motor

-
-
-
- @@ -61,25 +61,25 @@

Top Left Motor

Top Right Motor

-
-
-
- @@ -87,25 +87,25 @@

Top Right Motor

-
-
-
- @@ -114,117 +114,117 @@

Top Right Motor

-
-

Bottom Left Motor

-
-
- -
-
- -
-
- -
-
- -
-
-
-
- -
-
- -
-
- -
-
- -
-
-
-
-

Bottom Right Motor

-
-
- -
-
- -
-
- +
+

Bottom Left Motor

+
+
+ +
+
+ +
+
+ +
+
+ +
-
- +
+
+ +
+
+ +
+
+ +
+
+ +
-
-
- -
-
- -
-
- +
+

Bottom Right Motor

+
+
+ +
+
+ +
+
+ +
+
+ +
-
- +
+
+ +
+
+ +
+
+ +
+
+ +
-
@@ -235,16 +235,16 @@

Velocity Testing

@@ -282,7 +282,38 @@

Velocity Testing

- +
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+ +
+
+
+
+

Velocity Testing Results

+
+
+
@@ -290,7 +321,7 @@

Velocity Testing

{% endblock %} {% block javascript %} - + {% endblock %} diff --git a/templates/settings.html b/templates/settings.html index 5969e7cf..6fd7f52a 100644 --- a/templates/settings.html +++ b/templates/settings.html @@ -7,12 +7,33 @@
  • -

    {{setting.title}}

    -

    {{setting.desc}}

    +

    {{setting.title}}

    +

    {{setting.desc}}

    - {% if setting.type=="options" %} - + {% if ports|length == 0 %} + + {% else %} + {% for port in ports %} + + {% endfor %} + {% endif %} + +
    + +
    +
    + {% elif setting.type=="options" %} + {% elif setting.type=="bool" %} - + {% else %} - + {% endif %}
  • @@ -40,4 +61,4 @@

    {{setting.title}}

    {% block javascript %} -{% endblock %} +{% endblock %} \ No newline at end of file From 1c71a4a95bf7ddd6530b31cd80b38ca2201fb756 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Tue, 14 May 2019 10:32:53 -0400 Subject: [PATCH 132/685] update PID Testing --- Actions/actions.py | 17 +- Background/messageProcessor.py | 23 +- static/scripts/pidTuning.js | 46 ++- templates/pidTuning.html | 727 +++++++++++++++++++-------------- 4 files changed, 507 insertions(+), 306 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index cb40616d..dc29f1b6 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -191,9 +191,13 @@ def processAction(self, msg): elif msg["data"]["command"] == "shutdown": if not self.shutdown(): self.data.ui_queue1.put("Alert", "Alert", "Error with shutting down.") - elif msg["data"]["command"] == "vExecute": + elif msg["data"]["command"] == "executeVelocityPIDTest": if not self.velocityPIDTest(msg["data"]["arg"]): self.data.ui_queue1.put("Alert", "Alert", "Error with executing velocity PID test.") + elif msg["data"]["command"] == "executePositionPIDTest": + if not self.positionPIDTest(msg["data"]["arg"]): + self.data.ui_queue1.put("Alert", "Alert", "Error with executing velocity PID test.") + except Exception as e: print (str(e)) @@ -1118,3 +1122,14 @@ def velocityPIDTest(self, parameters): self.data.console_queue.put(str(e)) return False + def positionPIDTest(self, parameters): + try: + print(parameters) + print(parameters["KpP"]) + gcodeString = "B14 "+parameters["pMotor"]+" S"+parameters["pStart"]+" F"+parameters["pStop"]+" I"+parameters["pSteps"]+" V"+parameters["pVersion"] + print(gcodeString) + self.data.gcode_queue.put(gcodeString) + return True + except Exception as e: + self.data.console_queue.put(str(e)) + return False diff --git a/Background/messageProcessor.py b/Background/messageProcessor.py index dc4dc66f..de1ba32b 100644 --- a/Background/messageProcessor.py +++ b/Background/messageProcessor.py @@ -99,9 +99,11 @@ def start(self): ) elif message == "ok\r\n": pass # displaying all the 'ok' messages clutters up the display + + ### Velocity PID Testing Processing### elif message[0:26] == "--PID Velocity Test Stop--": self.data.inPIDVelocityTest = False - print("test stopped") + print("PID velocity test stopped") print(self.data.PIDVelocityTestData) data = json.dumps({"result": "velocity", "data": self.data.PIDVelocityTestData}) self.data.ui_queue1.put("Action","updatePIDData",data) @@ -112,7 +114,24 @@ def start(self): elif message[0:27] == "--PID Velocity Test Start--": self.data.inPIDVelocityTest = True self.data.PIDVelocityTestData = [] - print("test started") + print("PID velocity test started") + ### END ### + ### Position PID Testing Processing### + elif message[0:26] == "--PID Position Test Stop--": + self.data.inPIDPositionTest = False + print("PID position test stopped") + print(self.data.PIDPositionTestData) + data = json.dumps({"result": "position", "data": self.data.PIDPositionTestData}) + self.data.ui_queue1.put("Action", "updatePIDData", data) + #send data + elif self.data.inPIDPositionTest: + if message.find("Kp=") == -1: + self.data.PIDPositionTestData.append(float(message)) + elif message[0:27] == "--PID Position Test Start--": + self.data.inPIDPositionTest = True + self.data.PIDPositionTestData = [] + print("PID position test started") + ### END ### else: self.data.ui_controller_queue.put(message) diff --git a/static/scripts/pidTuning.js b/static/scripts/pidTuning.js index be70569e..34bc5e6c 100644 --- a/static/scripts/pidTuning.js +++ b/static/scripts/pidTuning.js @@ -17,13 +17,23 @@ function updateVErrorCurve(data) { } function updatePIDData(msg){ - vErrorPlot = document.getElementById('vErrorPlot'); data = JSON.parse(msg.data) - console.log(data); - if ($("#vErrorPlot").html()!="") - while (vErrorPlot.data.length>0) - Plotly.deleteTraces(vErrorPlot, [0]); - Plotly.plot(vErrorPlot, [{y: data.data }], {title: "Velocity Error", showlegend: false, colorway: colorwayLayout } ); + if data.result == "velocity": + vErrorPlot = document.getElementById('vErrorPlot'); + data = JSON.parse(msg.data) + console.log(data); + if ($("#vErrorPlot").html()!="") + while (vErrorPlot.data.length>0) + Plotly.deleteTraces(vErrorPlot, [0]); + Plotly.plot(vErrorPlot, [{y: data.data }], {title: "Velocity Error", showlegend: false, colorway: colorwayLayout } ); + if data.result == "position": + pErrorPlot = document.getElementById('pErrorPlot'); + data = JSON.parse(msg.data) + console.log(data); + if ($("#pErrorPlot").html()!="") + while (pErrorPlot.data.length>0) + Plotly.deleteTraces(pErrorPlot, [0]); + Plotly.plot(pErrorPlot, [{y: data.data }], {title: "Position Error", showlegend: false, colorway: colorwayLayout } ); } @@ -53,6 +63,28 @@ function vExecute(){ KdV: KdV }; console.log(parameters); - action('vExecute',parameters); + action('executeVelocityPIDTest',parameters); +} + +function pExecute(){ + var pMotor = $('#pMotor input:radio:checked').val(); + var pStart= $("#pStart").val(); + var pStop= $("#pStop").val(); + var pSteps= $("#pSteps").val(); + var pVersion= $("#pVersion").val(); + var KpP = $('#KpP').val(); + var KiP = $('#KiP').val(); + var KdP = $('#KdP').val(); + var parameters = {pMotor: pMotor, + pStart: pStart, + pStop: pStop, + pSteps: pSteps, + pVersion: pVersion, + KpP: KpP, + KiP: KiP, + KdP: KdP + }; + console.log(parameters); + action('executePositionPIDTest',parameters); } diff --git a/templates/pidTuning.html b/templates/pidTuning.html index 92ff18b5..6d88aa12 100644 --- a/templates/pidTuning.html +++ b/templates/pidTuning.html @@ -1,322 +1,457 @@ {% block content %}
    -
    -
    -

    Top Left Motor

    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -

    Top Right Motor

    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -

    Bottom Left Motor

    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -

    Bottom Right Motor

    -
    -
    - -
    -
    - -
    -
    - -
    -
    - +
    + +
    +
    +
    +
    +
    +

    Top Left Motor

    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - +
    +
    +
    +

    Top Right Motor

    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    -
    -
    -
    -
    -

    Velocity Testing

    -
    -
    -
    - -
    - - - - +
    +
    +
    +
    +

    Bottom Left Motor

    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    -
    -
    -
    - - - -
    -
    -
    -
    - - - +
    +
    +
    +

    Bottom Right Motor

    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    -
    -
    -
    - - - -
    -
    -
    -
    - - - -
    +
    +
    +
    +
    + +
    +
    +
    +
    +

    Settings

    +
    +
    +
    + +
    + + + + +
    +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + +
    +
    +
    +
    -
    -
    -
    -
    - - - -
    +
    +
    +
    +

    Test Results

    +
    +
    -
    -
    - - - -
    -
    -
    - - - -
    -
    -
    - +
    -
    -
    -

    Velocity Testing Results

    -
    -
    +
    +
    + +
    +
    +
    +
    +

    Settings

    +
    +
    +
    + +
    + + + + +
    +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + +
    +
    +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + +
    +
    +
    + +
    +
    +
    +
    +

    Test Results

    +
    +
    +
    +
    -
    +
    {% endblock %} From a8181f2dfbdf56ac8a96b71285e1531bd9dcd2ae Mon Sep 17 00:00:00 2001 From: John Hogan Date: Tue, 14 May 2019 14:52:04 -0400 Subject: [PATCH 133/685] update PID Testing, again --- Actions/actions.py | 25 ++++++++++++++++++++++++- Background/messageProcessor.py | 16 ++++------------ DataStructures/data.py | 2 ++ static/scripts/pidTuning.js | 28 ++++++++++++++++++++++------ templates/pidTuning.html | 2 +- 5 files changed, 53 insertions(+), 20 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index dc29f1b6..d67baf32 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -199,7 +199,7 @@ def processAction(self, msg): self.data.ui_queue1.put("Alert", "Alert", "Error with executing velocity PID test.") except Exception as e: - print (str(e)) + print(str(e)) def shutdown(self): @@ -1116,6 +1116,7 @@ def velocityPIDTest(self, parameters): print(parameters["KpV"]) gcodeString = "B13 "+parameters["vMotor"]+" S"+parameters["vStart"]+" F"+parameters["vStop"]+" I"+parameters["vSteps"]+" V"+parameters["vVersion"] print(gcodeString) + self.data.PIDVelocityTestVersion = parameters["vVersion"] self.data.gcode_queue.put(gcodeString) return True except Exception as e: @@ -1128,8 +1129,30 @@ def positionPIDTest(self, parameters): print(parameters["KpP"]) gcodeString = "B14 "+parameters["pMotor"]+" S"+parameters["pStart"]+" F"+parameters["pStop"]+" I"+parameters["pSteps"]+" V"+parameters["pVersion"] print(gcodeString) + self.data.PIDPositionTestVersion = parameters["pVersion"] self.data.gcode_queue.put(gcodeString) return True except Exception as e: self.data.console_queue.put(str(e)) return False + + def velocityPIDTestRun(self, command, msg): + try: + if command == 'stop': + self.data.inPIDVelocityTest = False + print("PID velocity test stopped") + print(self.data.PIDVelocityTestData) + data = json.dumps({"result": "velocity", "version": self.data.PIDVelocityTestVersion, "data": self.data.PIDVelocityTestData}) + self.data.ui_queue1.put("Action", "updatePIDData", data) + if command == 'running': + if msg.find("Kp=") == -1: + self.data.PIDVelocityTestData.append(float(msg)) + if command == 'start': + self.data.inPIDVelocityTest = True + self.data.PIDVelocityTestData = [] + print("PID velocity test started") + except Exception as e: + self.data.console_queue.put(str(e)) + return False + + diff --git a/Background/messageProcessor.py b/Background/messageProcessor.py index de1ba32b..10558f20 100644 --- a/Background/messageProcessor.py +++ b/Background/messageProcessor.py @@ -102,26 +102,18 @@ def start(self): ### Velocity PID Testing Processing### elif message[0:26] == "--PID Velocity Test Stop--": - self.data.inPIDVelocityTest = False - print("PID velocity test stopped") - print(self.data.PIDVelocityTestData) - data = json.dumps({"result": "velocity", "data": self.data.PIDVelocityTestData}) - self.data.ui_queue1.put("Action","updatePIDData",data) - #send data + self.data.actions.velocityPIDTestRun("stop", "") elif self.data.inPIDVelocityTest: - if message.find("Kp=") == -1: - self.data.PIDVelocityTestData.append(float(message)) + self.data.actions.velocityPIDTestRun("running", message) elif message[0:27] == "--PID Velocity Test Start--": - self.data.inPIDVelocityTest = True - self.data.PIDVelocityTestData = [] - print("PID velocity test started") + self.data.actions.velocityPIDTestRun("start", "") ### END ### ### Position PID Testing Processing### elif message[0:26] == "--PID Position Test Stop--": self.data.inPIDPositionTest = False print("PID position test stopped") print(self.data.PIDPositionTestData) - data = json.dumps({"result": "position", "data": self.data.PIDPositionTestData}) + data = json.dumps({"result": "position", "version": self.data.PIDPositionTestVersion, "data": self.data.PIDPositionTestData}) self.data.ui_queue1.put("Action", "updatePIDData", data) #send data elif self.data.inPIDPositionTest: diff --git a/DataStructures/data.py b/DataStructures/data.py index c839a66f..3ec6d7f6 100644 --- a/DataStructures/data.py +++ b/DataStructures/data.py @@ -74,6 +74,8 @@ class Data: calibrationInProcess = False inPIDVelocityTest = False inPIDPositionTest = False + PIDVelocityTestVersion = 0 + PIDPositionTestVersion = 0 """ Pointers to Objects diff --git a/static/scripts/pidTuning.js b/static/scripts/pidTuning.js index 34bc5e6c..8186d0b7 100644 --- a/static/scripts/pidTuning.js +++ b/static/scripts/pidTuning.js @@ -17,23 +17,39 @@ function updateVErrorCurve(data) { } function updatePIDData(msg){ - data = JSON.parse(msg.data) - if data.result == "velocity": + data = JSON.parse(msg.data); + if (data.result == "velocity"){ vErrorPlot = document.getElementById('vErrorPlot'); - data = JSON.parse(msg.data) console.log(data); if ($("#vErrorPlot").html()!="") while (vErrorPlot.data.length>0) Plotly.deleteTraces(vErrorPlot, [0]); - Plotly.plot(vErrorPlot, [{y: data.data }], {title: "Velocity Error", showlegend: false, colorway: colorwayLayout } ); - if data.result == "position": + if (data.version == "2") + { + var _setpoint = []; + var _input = []; + var _output = []; + for (var x = 0; x0) Plotly.deleteTraces(pErrorPlot, [0]); Plotly.plot(pErrorPlot, [{y: data.data }], {title: "Position Error", showlegend: false, colorway: colorwayLayout } ); + } } diff --git a/templates/pidTuning.html b/templates/pidTuning.html index 6d88aa12..eabe86b1 100644 --- a/templates/pidTuning.html +++ b/templates/pidTuning.html @@ -456,7 +456,7 @@

    Test Results

    {% endblock %} {% block javascript %} - + {% endblock %} From 58bb67be90840050af45c5bb20a38fe1f8de9b03 Mon Sep 17 00:00:00 2001 From: madgrizzle Date: Wed, 15 May 2019 12:32:31 +0100 Subject: [PATCH 134/685] update --- Actions/actions.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Actions/actions.py b/Actions/actions.py index d67baf32..40161a2e 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -102,6 +102,9 @@ def processAction(self, msg): elif msg["data"]["command"] == "setSprockets": if not self.setSprockets(msg["data"]["arg"], msg["data"]["arg1"]): self.data.ui_queue1.put("Alert", "Alert", "Error with setting sprocket") + elif msg["data"]["command"] == "rotateSprocket": + if not self.rotateSprocket(msg["data"]["arg"], msg["data"]["arg1"]): + self.data.ui_queue1.put("Alert", "Alert", "Error with setting sprocket") elif msg["data"]["command"] == "setSprocketsAutomatic": if not self.setSprocketsAutomatic(): self.data.ui_queue1.put("Alert", "Alert", "Error with setting sprockets automatically") @@ -619,6 +622,18 @@ def updateSetting(self, setting, value, fromGcode = False): self.data.console_queue.put(str(e)) return False + def rotateSprocket(self, sprocket, time): + try: + if time > 0: + self.data.gcode_queue.put("B11 "+sprocket+" S100 T"+str(time)) + else: + self.data.gcode_queue.put("B11 "+sprocket+" S-100 T"+str(abs(time))) + return True + except Exception as e: + self.data.console_queue.put(str(e)) + return False + + def setSprockets(self, sprocket, degrees): try: degValue = round( From b8b5a32a445a6f8787154bdb0521beb516899837 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Wed, 15 May 2019 11:08:52 -0400 Subject: [PATCH 135/685] update PID Testing, againx2 --- Actions/actions.py | 33 ++++++++++++++++++++++++++++++++- Background/messageProcessor.py | 16 +++++----------- static/scripts/pidTuning.js | 4 ++-- templates/pidTuning.html | 6 +++--- 4 files changed, 42 insertions(+), 17 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index 40161a2e..29081177 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -1129,6 +1129,9 @@ def velocityPIDTest(self, parameters): try: print(parameters) print(parameters["KpV"]) + self.data.config.setValue("Advanced Settings", "KpV", float(parameters["KpV"])) + self.data.config.setValue("Advanced Settings", "KiV", float(parameters["KiV"])) + self.data.config.setValue("Advanced Settings", "KdV", float(parameters["KdV"])) gcodeString = "B13 "+parameters["vMotor"]+" S"+parameters["vStart"]+" F"+parameters["vStop"]+" I"+parameters["vSteps"]+" V"+parameters["vVersion"] print(gcodeString) self.data.PIDVelocityTestVersion = parameters["vVersion"] @@ -1142,6 +1145,10 @@ def positionPIDTest(self, parameters): try: print(parameters) print(parameters["KpP"]) + self.data.config.setValue("Advanced Settings", "KpPos", float(parameters["KpP"])) + self.data.config.setValue("Advanced Settings", "KiPos", float(parameters["KiP"])) + self.data.config.setValue("Advanced Settings", "KdPos", float(parameters["KdP"])) + gcodeString = "B14 "+parameters["pMotor"]+" S"+parameters["pStart"]+" F"+parameters["pStop"]+" I"+parameters["pSteps"]+" V"+parameters["pVersion"] print(gcodeString) self.data.PIDPositionTestVersion = parameters["pVersion"] @@ -1161,7 +1168,10 @@ def velocityPIDTestRun(self, command, msg): self.data.ui_queue1.put("Action", "updatePIDData", data) if command == 'running': if msg.find("Kp=") == -1: - self.data.PIDVelocityTestData.append(float(msg)) + if self.data.PIDVelocityTestVersion == "2": + self.data.PIDVelocityTestData.append(msg) + else: + self.data.PIDVelocityTestData.append(float(msg)) if command == 'start': self.data.inPIDVelocityTest = True self.data.PIDVelocityTestData = [] @@ -1170,4 +1180,25 @@ def velocityPIDTestRun(self, command, msg): self.data.console_queue.put(str(e)) return False + def positionPIDTestRun(self, command, msg): + try: + if command == 'stop': + self.data.inPIDPositionTest = False + print("PID position test stopped") + print(self.data.PIDPositionTestData) + data = json.dumps({"result": "position", "version": self.data.PIDPositionTestVersion, "data": self.data.PIDPositionTestData}) + self.data.ui_queue1.put("Action", "updatePIDData", data) + if command == 'running': + if msg.find("Kp=") == -1: + if self.data.PIDPositionTestVersion == "2": + self.data.PIDPositionTestData.append(msg) + else: + self.data.PIDPositionTestData.append(float(msg)) + if command == 'start': + self.data.inPIDPositionTest = True + self.data.PIDPositionTestData = [] + print("PID position test started") + except Exception as e: + self.data.console_queue.put(str(e)) + return False diff --git a/Background/messageProcessor.py b/Background/messageProcessor.py index 10558f20..a006e78a 100644 --- a/Background/messageProcessor.py +++ b/Background/messageProcessor.py @@ -108,22 +108,16 @@ def start(self): elif message[0:27] == "--PID Velocity Test Start--": self.data.actions.velocityPIDTestRun("start", "") ### END ### + ### Position PID Testing Processing### elif message[0:26] == "--PID Position Test Stop--": - self.data.inPIDPositionTest = False - print("PID position test stopped") - print(self.data.PIDPositionTestData) - data = json.dumps({"result": "position", "version": self.data.PIDPositionTestVersion, "data": self.data.PIDPositionTestData}) - self.data.ui_queue1.put("Action", "updatePIDData", data) - #send data + self.data.actions.positionPIDTestRun("stop", "") elif self.data.inPIDPositionTest: - if message.find("Kp=") == -1: - self.data.PIDPositionTestData.append(float(message)) + self.data.actions.positionPIDTestRun("running", message) elif message[0:27] == "--PID Position Test Start--": - self.data.inPIDPositionTest = True - self.data.PIDPositionTestData = [] - print("PID position test started") + self.data.actions.positionPIDTestRun("start", "") ### END ### + else: self.data.ui_controller_queue.put(message) diff --git a/static/scripts/pidTuning.js b/static/scripts/pidTuning.js index 8186d0b7..7cfd2a4a 100644 --- a/static/scripts/pidTuning.js +++ b/static/scripts/pidTuning.js @@ -61,7 +61,7 @@ $(document).ready(function () { function vExecute(){ - var vMotor = $('#vMotor input:radio:checked').val(); + var vMotor = $('#vMotor label.active input').val(); var vStart= $("#vStart").val(); var vStop= $("#vStop").val(); var vSteps= $("#vSteps").val(); @@ -83,7 +83,7 @@ function vExecute(){ } function pExecute(){ - var pMotor = $('#pMotor input:radio:checked').val(); + var pMotor = $('#pMotor label:active input').val(); var pStart= $("#pStart").val(); var pStop= $("#pStop").val(); var pSteps= $("#pSteps").val(); diff --git a/templates/pidTuning.html b/templates/pidTuning.html index eabe86b1..b75861e6 100644 --- a/templates/pidTuning.html +++ b/templates/pidTuning.html @@ -267,7 +267,7 @@

    Settings

    +
    +
    +
    + + + +
    +
    +
    @@ -456,7 +465,7 @@

    Test Results

    {% endblock %} {% block javascript %} - + {% endblock %} From b6fc6e99eeebc92750673037d075d27c3d74244e Mon Sep 17 00:00:00 2001 From: John Hogan Date: Thu, 16 May 2019 11:30:54 -0400 Subject: [PATCH 137/685] update PID Testing, againx3 --- Actions/actions.py | 8 ++++++-- WebPageProcessor/webPageProcessor.py | 18 +++++++++++++++++- static/scripts/pidTuning.js | 24 +++++++++++++++++++++++- templates/pidTuning.html | 2 +- 4 files changed, 47 insertions(+), 5 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index 13776471..f590276b 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -317,6 +317,8 @@ def startRun(self): def stopRun(self): try: self.data.console_queue.put("stopping run") + self.data.inPIDPositionTest = False + self.data.inPIDVelocityTest = False self.data.uploadFlag = 0 self.data.gcodeIndex = 0 self.data.quick_queue.put("!") @@ -1170,7 +1172,8 @@ def velocityPIDTestRun(self, command, msg): if command == 'running': if msg.find("Kp=") == -1: if self.data.PIDVelocityTestVersion == "2": - self.data.PIDVelocityTestData.append(msg) + if msg.find("setpoint") == -1: + self.data.PIDVelocityTestData.append(msg) else: self.data.PIDVelocityTestData.append(float(msg)) if command == 'start': @@ -1193,7 +1196,8 @@ def positionPIDTestRun(self, command, msg): if command == 'running': if msg.find("Kp=") == -1: if self.data.PIDPositionTestVersion == "2": - self.data.PIDPositionTestData.append(msg) + if msg.find("setpoint") == -1: + self.data.PIDPositionTestData.append(msg) else: self.data.PIDPositionTestData.append(float(msg)) if command == 'start': diff --git a/WebPageProcessor/webPageProcessor.py b/WebPageProcessor/webPageProcessor.py index 357fc47e..8a94549e 100644 --- a/WebPageProcessor/webPageProcessor.py +++ b/WebPageProcessor/webPageProcessor.py @@ -253,6 +253,22 @@ def createWebPage(self, pageID, isMobile, args): page = render_template("sendGcode.html") return page, "Send GCode", False, "medium", "content", False elif pageID == "pidTuning": - page = render_template("pidTuning.html") + KpP = self.data.config.getValue("Advanced Settings", "KpPos") + KiP = self.data.config.getValue("Advanced Settings", "KiPos") + KdP = self.data.config.getValue("Advanced Settings", "KdPos") + KpV = self.data.config.getValue("Advanced Settings", "KpV") + KiV = self.data.config.getValue("Advanced Settings", "KiV") + KdV = self.data.config.getValue("Advanced Settings", "KdV") + vVersion = "1" + pVersion = "1" + page = render_template("pidTuning.html", + KpP=KpP, + KiP=KiP, + KdP=KdP, + KpV=KpV, + KiV=KiV, + KdV=KdV, + vVersion=vVersion, + pVersion=pVersion) return page, "PID Tuning", False, "large", "content", False diff --git a/static/scripts/pidTuning.js b/static/scripts/pidTuning.js index f26c4ac4..0db7f9af 100644 --- a/static/scripts/pidTuning.js +++ b/static/scripts/pidTuning.js @@ -48,7 +48,29 @@ function updatePIDData(msg){ if ($("#pErrorPlot").html()!="") while (pErrorPlot.data.length>0) Plotly.deleteTraces(pErrorPlot, [0]); - Plotly.plot(pErrorPlot, [{y: data.data }], {title: "Position Error", showlegend: false, colorway: colorwayLayout } ); + if (data.version == "2") + { + var _setpoint = []; + var _input = []; + var _output = []; + var _rpminput = []; + var _voltage = []; + for (var x = 0; xTest Results

    {% endblock %} {% block javascript %} - + {% endblock %} From 64dbc892dac938bd8c07f58caac478c2e7099297 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Fri, 17 May 2019 15:09:54 -0400 Subject: [PATCH 138/685] alert update --- Actions/actions.py | 1 + Background/UIProcessor.py | 13 ++++++++++- static/scripts/base.js | 2 +- static/scripts/baseSocket.js | 6 +++++ static/scripts/frontpage3d.js | 14 ++++++++++++ static/styles/frontpage.css | 41 +++++++++++++++++++++++++++++++++++ templates/base.html | 7 ++---- templates/frontpage3d.html | 10 ++++++--- 8 files changed, 84 insertions(+), 10 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index f590276b..3348eccf 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -326,6 +326,7 @@ def stopRun(self): self.data.gcode_queue.queue.clear() # TODO: app.onUploadFlagChange(self.stopRun, 0) self.data.console_queue.put("Gcode stopped") + self.data.ui_queue1.put("Action", "clearAlert", "") return True except Exception as e: self.data.console_queue.put(str(e)) diff --git a/Background/UIProcessor.py b/Background/UIProcessor.py index 98b83b56..7aeca895 100644 --- a/Background/UIProcessor.py +++ b/Background/UIProcessor.py @@ -76,7 +76,8 @@ def start(self, _app): elif message[0:6] == "ALARM:": if message.find("The sled is not keeping up") != -1: pass - self.activateModal("Alarm:", message[7:], "alarm", resume="clear") + self.sendAlert("Alarm: Sled Not Keeping Up") + #self.activateModal("Alarm:", message[7:], "alarm", resume="clear") elif message == "ok\r\n": pass # displaying all the 'ok' messages clutters up the display else: @@ -135,6 +136,12 @@ def activateModal(self, title, message, modalType, resume="false", progress="fal namespace="/MaslowCNC", ) + def sendAlert(self, message): + data = json.dumps({"message":message}) + socketio.emit("message", {"command": "alert", "data": data, "dataFormat": "json"}, + namespace="/MaslowCNC", + ) + def sendControllerMessage(self, message): socketio.emit("message", {"command": "controllerMessage", "data": json.dumps(message), "dataFormat": "json"}, namespace="/MaslowCNC") @@ -214,6 +221,10 @@ def processMessage(self, _message): self.sendCameraMessage("updateCamera", json.loads(msg["data"])) elif msg["message"] == "updatePIDData": self.updatePIDData("updatePIDData", json.loads(msg["data"])) + elif msg["message"] == "clearAlert": + msg["data"] = json.dumps({"data":""}) + socketio.emit("message", {"command": msg["message"], "data": msg["data"], "dataFormat": "json"}, + namespace="/MaslowCNC") else: if msg["message"] == "setAsPause": msg["message"] = "requestedSetting" diff --git a/static/scripts/base.js b/static/scripts/base.js index a3c7f52d..b8f05753 100644 --- a/static/scripts/base.js +++ b/static/scripts/base.js @@ -83,7 +83,7 @@ function processActivateModal(data){ $modal.data('name',data.title); $modalTitle.html("

    "+data.title+""+data.message+"

    "); + $modalText.html(JSON.parse(data.message)); if (data.isStatic==true){ console.log("Static Modal") diff --git a/static/scripts/baseSocket.js b/static/scripts/baseSocket.js index a8bccb54..94e16aee 100644 --- a/static/scripts/baseSocket.js +++ b/static/scripts/baseSocket.js @@ -141,6 +141,12 @@ //completed updatePIDData(data); break; + case 'alert': + processAlert(data); + break; + case 'clearAlert': + clearAlert(data); + break; default: console.log("!!!!!!"); console.log("uncaught action:"+msg.command); diff --git a/static/scripts/frontpage3d.js b/static/scripts/frontpage3d.js index 125ad09d..9f211f2d 100644 --- a/static/scripts/frontpage3d.js +++ b/static/scripts/frontpage3d.js @@ -209,6 +209,7 @@ function pauseRun(){ } } + function processRequestedSetting(data){ //console.log(msg); if (data.setting=="pauseButtonSetting"){ @@ -544,4 +545,17 @@ function processControllerMessage(data){ $('#controllerMessage').append(message+"
    "); }); $('#controllerMessage').scrollBottom(); +} + +function processAlert(data){ + console.log("alert received"); + $("#alerts").text(data.message); + $("#alerts").removeClass('alert-success').addClass('alert-danger'); + $("#stopButton").addClass('stopbutton'); +} + +function clearAlert(data){ + console.log("clearing alert"); + $("#alerts").text("Alert cleared."); + $("#alerts").removeClass('alert-danger').addClass('alert-success'); } \ No newline at end of file diff --git a/static/styles/frontpage.css b/static/styles/frontpage.css index 686f284c..e3baaefb 100644 --- a/static/styles/frontpage.css +++ b/static/styles/frontpage.css @@ -71,3 +71,44 @@ html, body{ width: 100%; height: 200; } + + +.stopbutton { + background-color: #004A7F; + -webkit-border-radius: 10px; + border-radius: 10px; + border: none; + color: #FFFFFF; + cursor: pointer; + display: inline-block; + padding: 5px 10px; + text-align: center; + text-decoration: none; + -webkit-animation: glowing 1500ms infinite; + -moz-animation: glowing 1500ms infinite; + -o-animation: glowing 1500ms infinite; + animation: glowing 1500ms infinite; +} +@-webkit-keyframes glowing { + 0% { background-color: #B20000; -webkit-box-shadow: 0 0 3px #B20000; } + 50% { background-color: #FF0000; -webkit-box-shadow: 0 0 40px #FF0000; } + 100% { background-color: #B20000; -webkit-box-shadow: 0 0 3px #B20000; } +} + +@-moz-keyframes glowing { + 0% { background-color: #B20000; -moz-box-shadow: 0 0 3px #B20000; } + 50% { background-color: #FF0000; -moz-box-shadow: 0 0 40px #FF0000; } + 100% { background-color: #B20000; -moz-box-shadow: 0 0 3px #B20000; } +} + +@-o-keyframes glowing { + 0% { background-color: #B20000; box-shadow: 0 0 3px #B20000; } + 50% { background-color: #FF0000; box-shadow: 0 0 40px #FF0000; } + 100% { background-color: #B20000; box-shadow: 0 0 3px #B20000; } +} + +@keyframes glowing { + 0% { background-color: #B20000; box-shadow: 0 0 3px #B20000; } + 50% { background-color: #FF0000; box-shadow: 0 0 40px #FF0000; } + 100% { background-color: #B20000; box-shadow: 0 0 3px #B20000; } +} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 9ca2086f..5428b64d 100644 --- a/templates/base.html +++ b/templates/base.html @@ -8,8 +8,8 @@ - - + + @@ -76,7 +76,6 @@

    @@ -110,7 +109,6 @@
    -

    Controls

    @@ -91,6 +90,11 @@

    Controls

    +
    +
    +
    No alerts
    +
    +
    @@ -99,7 +103,7 @@

    Controls

    - +
    From 58770507007d6d56a9effc55fd1d2867c47e6f0f Mon Sep 17 00:00:00 2001 From: John Hogan Date: Fri, 17 May 2019 15:23:12 -0400 Subject: [PATCH 139/685] alert mobiles --- static/scripts/base.js | 6 +++++- static/scripts/frontpage3dcontrols.js | 13 +++++++++++++ templates/base.html | 2 +- templates/frontpage3d_mobile.html | 9 +++++++-- templates/frontpage3d_mobilecontrols.html | 12 +++++++++--- 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/static/scripts/base.js b/static/scripts/base.js index b8f05753..a07d0d2f 100644 --- a/static/scripts/base.js +++ b/static/scripts/base.js @@ -23,6 +23,7 @@ function processControllerStatus(data){ function processActivateModal(data){ var $modal, $modalTitle, $modalText + var message if (data.modalType == "content"){ $modal = $('#contentModal'); $modalDialog = $('#contentDialog'); @@ -33,6 +34,7 @@ function processActivateModal(data){ } else { $('#footerSubmit').hide(); } + message = data.message; } else if (data.modalType == "alarm") { $modal = $('#alarmModal'); @@ -44,6 +46,7 @@ function processActivateModal(data){ } else { $('#clearButton').hide(); } + message = JSON.parse(data.message); } else{ $modal = $('#notificationModal'); @@ -65,6 +68,7 @@ function processActivateModal(data){ } else { $('#notificationCircle').hide(); } + message = JSON.parse(data.message); } $modalDialog.removeClass('modal-lg'); $modalDialog.removeClass('modal-sm'); @@ -83,7 +87,7 @@ function processActivateModal(data){ $modal.data('name',data.title); $modalTitle.html("

    "+data.title+""); }); $('#controllerMessage').scrollBottom(); +} + +function processAlert(data){ + console.log("alert received"); + $("#alerts").text(data.message); + $("#alerts").removeClass('alert-success').addClass('alert-danger'); + $("#stopButton").addClass('stopbutton'); +} + +function clearAlert(data){ + console.log("clearing alert"); + $("#alerts").text("Alert cleared."); + $("#alerts").removeClass('alert-danger').addClass('alert-success'); } \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 5428b64d..2b15a856 100644 --- a/templates/base.html +++ b/templates/base.html @@ -9,7 +9,7 @@ - + diff --git a/templates/frontpage3d_mobile.html b/templates/frontpage3d_mobile.html index 882b8625..699c2ed8 100644 --- a/templates/frontpage3d_mobile.html +++ b/templates/frontpage3d_mobile.html @@ -10,7 +10,7 @@ - + {% endblock %} @@ -95,6 +95,11 @@

    Controls

    +
    +
    +
    No alerts
    +
    +
    @@ -103,7 +108,7 @@

    Controls

    - +
    diff --git a/templates/frontpage3d_mobilecontrols.html b/templates/frontpage3d_mobilecontrols.html index 6cf58f8e..b2a63354 100644 --- a/templates/frontpage3d_mobilecontrols.html +++ b/templates/frontpage3d_mobilecontrols.html @@ -1,13 +1,13 @@ {% extends 'base.html' %} {% block header %} - + {% endblock %} {% block javascript %} - + {% endblock %} @@ -92,6 +92,12 @@

    Controls

    +
    +
    +
    No alerts
    +
    +
    +
    @@ -100,7 +106,7 @@

    Controls

    - +
    From d8305f9349cdec9234121ef300f291eade99ff25 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Fri, 17 May 2019 15:51:19 -0400 Subject: [PATCH 140/685] pid tuning page --- templates/pidTuning.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/templates/pidTuning.html b/templates/pidTuning.html index e8be9647..427840ab 100644 --- a/templates/pidTuning.html +++ b/templates/pidTuning.html @@ -128,7 +128,7 @@

    Top Right Motor

    -
    +
    @@ -272,12 +273,13 @@

    Settings

    -
    @@ -373,12 +375,14 @@

    Settings

    + From bcf8c295be37656ad2b819aa02e3ed7cffbc875e Mon Sep 17 00:00:00 2001 From: madgrizzle Date: Thu, 23 May 2019 01:58:18 +0100 Subject: [PATCH 141/685] update --- static/scripts/base.js | 4 ++-- templates/frontpage3d.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/static/scripts/base.js b/static/scripts/base.js index a07d0d2f..ab05948c 100644 --- a/static/scripts/base.js +++ b/static/scripts/base.js @@ -46,7 +46,7 @@ function processActivateModal(data){ } else { $('#clearButton').hide(); } - message = JSON.parse(data.message); + message = data.mesage; //JSON.parse(data.message); } else{ $modal = $('#notificationModal'); @@ -68,7 +68,7 @@ function processActivateModal(data){ } else { $('#notificationCircle').hide(); } - message = JSON.parse(data.message); + message = data.message; //JSON.parse(data.message); } $modalDialog.removeClass('modal-lg'); $modalDialog.removeClass('modal-sm'); diff --git a/templates/frontpage3d.html b/templates/frontpage3d.html index c8b42416..ef987975 100644 --- a/templates/frontpage3d.html +++ b/templates/frontpage3d.html @@ -10,7 +10,7 @@ - + {% endblock %} From 9d68528ec0b26714de0d6f1ed8352a1b620aedba Mon Sep 17 00:00:00 2001 From: madgrizzle Date: Thu, 23 May 2019 02:08:36 +0100 Subject: [PATCH 142/685] update --- Actions/actions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index 3348eccf..0901d872 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -1135,7 +1135,7 @@ def velocityPIDTest(self, parameters): self.data.config.setValue("Advanced Settings", "KpV", parameters["KpV"]) self.data.config.setValue("Advanced Settings", "KiV", parameters["KiV"]) self.data.config.setValue("Advanced Settings", "KdV", parameters["KdV"]) - gcodeString = "B13 "+parameters["vMotor"]+" S"+parameters["vStart"]+" F"+parameters["vStop"]+" I"+parameters["vSteps"]+" V"+parameters["vVersion"] + gcodeString = "B13 "+parameters["vMotor"]+"1 S"+parameters["vStart"]+" F"+parameters["vStop"]+" I"+parameters["vSteps"]+" V"+parameters["vVersion"] print(gcodeString) self.data.PIDVelocityTestVersion = parameters["vVersion"] self.data.gcode_queue.put(gcodeString) @@ -1152,7 +1152,7 @@ def positionPIDTest(self, parameters): self.data.config.setValue("Advanced Settings", "KiPos", parameters["KiP"]) self.data.config.setValue("Advanced Settings", "KdPos", parameters["KdP"]) - gcodeString = "B14 "+parameters["pMotor"]+" S"+parameters["pStart"]+" F"+parameters["pStop"]+" I"+parameters["pSteps"]+" T"+parameters["pTime"]+" V"+parameters["pVersion"] + gcodeString = "B14 "+parameters["pMotor"]+"1 S"+parameters["pStart"]+" F"+parameters["pStop"]+" I"+parameters["pSteps"]+" T"+parameters["pTime"]+" V"+parameters["pVersion"] print(gcodeString) self.data.PIDPositionTestVersion = parameters["pVersion"] self.data.gcode_queue.put(gcodeString) From 2eb7431d8594c0403997e11b950ce6bf0b68465a Mon Sep 17 00:00:00 2001 From: John Hogan Date: Thu, 23 May 2019 15:56:12 -0400 Subject: [PATCH 143/685] updates --- Background/UIProcessor.py | 10 ++++++++++ static/scripts/frontpage3d.js | 2 +- static/styles/frontpage.css | 2 +- templates/frontpage3d.html | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Background/UIProcessor.py b/Background/UIProcessor.py index 7aeca895..43afeb08 100644 --- a/Background/UIProcessor.py +++ b/Background/UIProcessor.py @@ -71,12 +71,22 @@ def start(self, _app): if message.find("adjust Z-Axis") != -1: self.app.data.console_queue.put("found adjust Z-Axis in message") self.activateModal("Notification:", message[9:], "notification", resume="resume") + elif message.find("Unable to find valid") != -1: + self.sendAlert(message); else: self.activateModal("Notification:", message[9:], "notification") elif message[0:6] == "ALARM:": + if message.find("The sled is not keeping up") != -1: + self.sendAlert("Alarm: Sled Not Keeping Up") + elif message.find("Position Lost") != -1: + self.sendAlert("Alarm: Position Lost. Reset Chains.") + else: + self.sendAlert(message); + elif message[0:6] == "Unable to": if message.find("The sled is not keeping up") != -1: pass self.sendAlert("Alarm: Sled Not Keeping Up") + #self.activateModal("Alarm:", message[7:], "alarm", resume="clear") elif message == "ok\r\n": pass # displaying all the 'ok' messages clutters up the display diff --git a/static/scripts/frontpage3d.js b/static/scripts/frontpage3d.js index 9f211f2d..36d984eb 100644 --- a/static/scripts/frontpage3d.js +++ b/static/scripts/frontpage3d.js @@ -549,7 +549,7 @@ function processControllerMessage(data){ function processAlert(data){ console.log("alert received"); - $("#alerts").text(data.message); + $("#alerts").html(""+data.message+""); $("#alerts").removeClass('alert-success').addClass('alert-danger'); $("#stopButton").addClass('stopbutton'); } diff --git a/static/styles/frontpage.css b/static/styles/frontpage.css index e3baaefb..4ed7ec49 100644 --- a/static/styles/frontpage.css +++ b/static/styles/frontpage.css @@ -5,7 +5,7 @@ } .scrollText { - height: 300px; + height: 250px; overflow-y: scroll; } diff --git a/templates/frontpage3d.html b/templates/frontpage3d.html index ef987975..d89f7d31 100644 --- a/templates/frontpage3d.html +++ b/templates/frontpage3d.html @@ -10,7 +10,7 @@ - + {% endblock %} From 76bd6f2079d5a8bb1f0730045864fa65ed543a89 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Fri, 28 Jun 2019 11:34:40 -0400 Subject: [PATCH 144/685] updates for start of oc2 --- Actions/opticalCalibration.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Actions/opticalCalibration.py b/Actions/opticalCalibration.py index 690cc4f0..b0600caa 100644 --- a/Actions/opticalCalibration.py +++ b/Actions/opticalCalibration.py @@ -720,3 +720,33 @@ def sort_contours(self, cnts, method="left-to-right"): (cnts, boundingBoxes) = zip(*sorted(zip(cnts, boundingBoxes), key=lambda b: b[1][i], reverse=reverse)) # return the list of sorted contours and bounding boxes return cnts, boundingBoxes + + + +#import numpy as np +#import cv2 +#import cv2.aruco as aruco +#import pickle +#import itertools + +#aruco_dict = aruco.Dictionary_get(cv2.aruco.DICT_6X6_50) +#aruco_dict = aruco.Dictionary_create(96*48,6) +#aruco_dict_bytes = aruco_dict.bytesList +#aruco_dict_markerSize = aruco_dict.markerSize +#aruco_dict_maxCorrectionBits = aruco_dict.maxCorrectionBits +#aruco_board = aruco.GridBoard_create(16,16,0.04, 0.01, aruco_dict) +#img = aruco.drawPlanarBoard(aruco_board,(2048,1024)) +#aruco_store = (aruco_dict_bytes,aruco_dict_markerSize,aruco_dict_maxCorrectionBits) +#aruco_store_pickle = pickle.dump(aruco_store,open("aruco_dictionary.p","wb")) + +#aruco_store_depickle = pickle.load(open("aruco_dictionary.p","rb")) +#aruco_dict = aruco.Dictionary_create(5*5,6) +#aruco_dict.bytesList = aruco_store_depickle[0] +#aruco_dict.markerSize = aruco_store_depickle[1] +#aruco_dict.maxCorrectionBits = aruco_store_depickle[2] +#aruco_board = aruco.GridBoard_create(96,48,0.04, 0.01, aruco_dict) +#img = aruco.drawPlanarBoard(aruco_board,(2048,1024)) +#cv2.imwrite("aruco_board.png",img) +#cv2.imshow('frame',img) +#cv2.waitKey(0) +#cv2.destroyAllWindows() \ No newline at end of file From ec931adc1131e2825790f4a316760e70aa67bb33 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Tue, 6 Aug 2019 16:00:44 -0400 Subject: [PATCH 145/685] updates to begin work on holey maslow without optical calibration --- Actions/actions.py | 1 - Actions/opticalCalibration.py | 30 ------------------------------ Connection/nonVisibleWidgets.py | 8 ++++---- DataStructures/data.py | 10 +++++----- Dockerfile | 12 ++++++++++-- main.py | 5 +++++ requirements.txt | 3 +++ 7 files changed, 27 insertions(+), 42 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index 0901d872..310e87be 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -1,5 +1,4 @@ -from DataStructures.makesmithInitFuncs import MakesmithInitFuncs from DataStructures.makesmithInitFuncs import MakesmithInitFuncs import os diff --git a/Actions/opticalCalibration.py b/Actions/opticalCalibration.py index b0600caa..690cc4f0 100644 --- a/Actions/opticalCalibration.py +++ b/Actions/opticalCalibration.py @@ -720,33 +720,3 @@ def sort_contours(self, cnts, method="left-to-right"): (cnts, boundingBoxes) = zip(*sorted(zip(cnts, boundingBoxes), key=lambda b: b[1][i], reverse=reverse)) # return the list of sorted contours and bounding boxes return cnts, boundingBoxes - - - -#import numpy as np -#import cv2 -#import cv2.aruco as aruco -#import pickle -#import itertools - -#aruco_dict = aruco.Dictionary_get(cv2.aruco.DICT_6X6_50) -#aruco_dict = aruco.Dictionary_create(96*48,6) -#aruco_dict_bytes = aruco_dict.bytesList -#aruco_dict_markerSize = aruco_dict.markerSize -#aruco_dict_maxCorrectionBits = aruco_dict.maxCorrectionBits -#aruco_board = aruco.GridBoard_create(16,16,0.04, 0.01, aruco_dict) -#img = aruco.drawPlanarBoard(aruco_board,(2048,1024)) -#aruco_store = (aruco_dict_bytes,aruco_dict_markerSize,aruco_dict_maxCorrectionBits) -#aruco_store_pickle = pickle.dump(aruco_store,open("aruco_dictionary.p","wb")) - -#aruco_store_depickle = pickle.load(open("aruco_dictionary.p","rb")) -#aruco_dict = aruco.Dictionary_create(5*5,6) -#aruco_dict.bytesList = aruco_store_depickle[0] -#aruco_dict.markerSize = aruco_store_depickle[1] -#aruco_dict.maxCorrectionBits = aruco_store_depickle[2] -#aruco_board = aruco.GridBoard_create(96,48,0.04, 0.01, aruco_dict) -#img = aruco.drawPlanarBoard(aruco_board,(2048,1024)) -#cv2.imwrite("aruco_board.png",img) -#cv2.imshow('frame',img) -#cv2.waitKey(0) -#cv2.destroyAllWindows() \ No newline at end of file diff --git a/Connection/nonVisibleWidgets.py b/Connection/nonVisibleWidgets.py index 7e94a4f4..79fc41f6 100644 --- a/Connection/nonVisibleWidgets.py +++ b/Connection/nonVisibleWidgets.py @@ -4,7 +4,7 @@ from File.importFile import ImportFile from Actions.actions import Actions from Actions.triangularCalibration import TriangularCalibration -from Actions.opticalCalibration import OpticalCalibration +#from Actions.opticalCalibration import OpticalCalibration from Background.messageProcessor import MessageProcessor from Background.WebMCPProcessor import WebMCPProcessor from Background.WebMCPProcessor import ConsoleProcessor @@ -23,7 +23,7 @@ class NonVisibleWidgets(MakesmithInitFuncs): importFile = ImportFile() actions = Actions() triangularCalibration = TriangularCalibration() - opticalCalibration = OpticalCalibration() +# opticalCalibration = OpticalCalibration() messageProcessor = MessageProcessor() mcpProcessor = WebMCPProcessor() consoleProcessor = ConsoleProcessor() @@ -48,7 +48,7 @@ def setUpData(self, data): data.importFile = self.importFile data.actions = self.actions data.triangularCalibration = self.triangularCalibration - data.opticalCalibration = self.opticalCalibration +# data.opticalCalibration = self.opticalCalibration data.messageProcessor = self.messageProcessor data.mcpProcessor = self.mcpProcessor data.consoleProcessor = self.consoleProcessor @@ -59,7 +59,7 @@ def setUpData(self, data): self.importFile.setUpData(data) self.actions.setUpData(data) self.triangularCalibration.setUpData(data) - self.opticalCalibration.setUpData(data) +# self.opticalCalibration.setUpData(data) self.messageProcessor.setUpData(data) self.mcpProcessor.setUpData(data) self.consoleProcessor.setUpData(data) diff --git a/DataStructures/data.py b/DataStructures/data.py index 3ec6d7f6..45f9236e 100644 --- a/DataStructures/data.py +++ b/DataStructures/data.py @@ -83,11 +83,11 @@ class Data: serialPort = None # this is a pointer to the program serial port object requestSerialClose = False # this is used to request the serialThread to gracefully close the port triangularCalibration = None # points to the triangular calibration object - opticalCalibration = None # points to the optical calibration object - opticalCalibrationImage = None # stores the current image - opticalCalibrationImageUpdated = False # stores whether its been updated or not - opticalCalibrationTestImage = None # stores the current image - opticalCalibrationTestImageUpdated = False # stores whether its been updated or not +# opticalCalibration = None # points to the optical calibration object +# opticalCalibrationImage = None # stores the current image +# opticalCalibrationImageUpdated = False # stores whether its been updated or not +# opticalCalibrationTestImage = None # stores the current image +# opticalCalibrationTestImageUpdated = False # stores whether its been updated or not cameraImage = None cameraImageUpdated = False continuousCamera = False diff --git a/Dockerfile b/Dockerfile index 38a8313c..01a30d45 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,8 +26,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ RUN pip install numpy==1.16.2 # Build OpenCV -ADD tools/download_build_install_opencv.sh /download_build_install_opencv.sh -RUN chmod +x /download_build_install_opencv.sh && /download_build_install_opencv.sh +# ADD tools/download_build_install_opencv.sh /download_build_install_opencv.sh +# RUN chmod +x /download_build_install_opencv.sh && /download_build_install_opencv.sh # Get other python dependencies ADD requirements.txt /requirements.txt @@ -46,6 +46,14 @@ RUN apt-get update \ && pio platform install --with-package framework-arduinoavr atmelavr \ && pio lib -g install "Servo" +ARG schmittjoshc_firmware_repo=https://github.com/schmittjoshc/Firmware.git +ARG schmittjoshc_firmware_sha=bf4350ffd9bc154832505fc0125abd2c4c04dba7 +RUN git clone $schmittjoshc_firmware_repo firmware/schmittjoshc \ + && cd firmware/schmittjoshc \ + && git checkout $schmittjoshc_firmware_sha \ + && pio run -e megaatmega2560 \ + && mkdir build \ + && mv .pioenvs/megaatmega2560/firmware.hex build/$schmittjoshc_firmware_sha-$(sed -n -e 's/^.*VERSIONNUMBER //p' cnc_ctrl_v1/Maslow.h).hex ARG madgrizzle_firmware_repo=https://github.com/madgrizzle/Firmware.git ARG madgrizzle_firmware_sha=bf4350ffd9bc154832505fc0125abd2c4c04dba7 #ARG madgrizzle_firmware_sha=95f7d4b5c431dec162d2e2eec7c6e42530298c4b diff --git a/main.py b/main.py index f9ca66a7..5fa798e0 100644 --- a/main.py +++ b/main.py @@ -22,6 +22,11 @@ from os.path import isfile, join + + + + + app.data = Data() app.nonVisibleWidgets = NonVisibleWidgets() app.nonVisibleWidgets.setUpData(app.data) diff --git a/requirements.txt b/requirements.txt index 501b9be3..aaebccff 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,9 +9,12 @@ Jinja2>=2.10.1 MarkupSafe==1.0 numpy==1.16.2 opencv-python==3.4.3.18 +opencv-contrib-python=3.4.3.18 pyserial==3.4 python-engineio==2.3.2 python-socketio==2.0.0 schedule==0.5.0 six==1.11.0 Werkzeug==0.14.1 + + From 94fe1cfbad8018ac890f513e09e27e1b568e0029 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Wed, 7 Aug 2019 15:53:03 -0400 Subject: [PATCH 146/685] only send position updates over websockets when needed. --- Actions/actions.py | 2 ++ Background/UIProcessor.py | 50 ++++++++++++++++----------- DataStructures/data.py | 7 ++++ main.py | 1 - static/scripts/baseSocket.js | 3 ++ static/scripts/frontpage3d.js | 6 ++-- static/scripts/frontpage3dcontrols.js | 6 ++-- templates/screenAction.html | 1 - 8 files changed, 48 insertions(+), 28 deletions(-) diff --git a/Actions/actions.py b/Actions/actions.py index 310e87be..2c240bb6 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -845,6 +845,8 @@ def processSettingRequest(self, section, setting): except Exception as e: self.data.console_queue.put(str(e)) else: + if setting == "units": + self.data.xval_prev = -99999.0 #force a new position send retval = self.data.config.getValue(section, setting) return setting, retval except Exception as e: diff --git a/Background/UIProcessor.py b/Background/UIProcessor.py index 43afeb08..e83d1873 100644 --- a/Background/UIProcessor.py +++ b/Background/UIProcessor.py @@ -23,12 +23,12 @@ def start(self, _app): time.sleep(2) self.activateModal("Notification:", "New installation detected. If you have an existing groundcontrol.ini file you would like to import, please do so now by pressing Actions->Import groundcontrol.ini file before doing anything else.","notification") - if self.app.data.opticalCalibrationImageUpdated is True: - self.sendCalibrationImage( - "OpticalCalibrationImageUpdated", - self.app.data.opticalCalibrationImage, - ) - self.app.data.opticalCalibrationImageUpdated = False + #if self.app.data.opticalCalibrationImageUpdated is True: + # self.sendCalibrationImage( + # "OpticalCalibrationImageUpdated", + # self.app.data.opticalCalibrationImage, + # ) + # self.app.data.opticalCalibrationImageUpdated = False if self.app.data.cameraImageUpdated is True: if time.time()-self.lastCameraTime > .25: self.sendCameraMessage( @@ -37,12 +37,12 @@ def start(self, _app): ) self.app.data.cameraImageUpdated = False self.lastCameraTime = time.time() - if self.app.data.opticalCalibrationTestImageUpdated is True: - self.sendCalibrationImage( - "OpticalCalibrationTestImageUpdated", - self.app.data.opticalCalibrationTestImage, - ) - self.app.data.opticalCalibrationTestImageUpdated = False + #if self.app.data.opticalCalibrationTestImageUpdated is True: + # self.sendCalibrationImage( + # "OpticalCalibrationTestImageUpdated", + # self.app.data.opticalCalibrationTestImage, + # ) + # self.app.data.opticalCalibrationTestImageUpdated = False while ( not self.app.data.ui_controller_queue.empty() or not self.app.data.ui_queue1.empty()): # if there is new data to be read if not self.app.data.ui_controller_queue.empty(): message = self.app.data.ui_controller_queue.get() @@ -124,21 +124,31 @@ def setPosOnScreen(self, message): if math.isnan(self.app.data.zval): self.sendControllerMessage("Unable to resolve z Kinematics.") self.app.data.zval = 0 + except: self.app.data.console_queue.put("One Machine Position Report Command Misread") return + xdiff = abs(self.app.data.xval - self.app.data.xval_prev) + ydiff = abs(self.app.data.yval - self.app.data.yval_prev) + zdiff = abs(self.app.data.zval - self.app.data.zval_prev) + percentComplete = '%.1f' % math.fabs(100 * (self.app.data.gcodeIndex / (len(self.app.data.gcode) - 1))) + "%" - position = { - "xval": self.app.data.xval, - "yval": self.app.data.yval, - "zval": self.app.data.zval, - "pcom": percentComplete, - "state": state - } + if (xdiff + ydiff + zdiff) > 0.01: + position = { + "xval": self.app.data.xval, + "yval": self.app.data.yval, + "zval": self.app.data.zval, + "pcom": percentComplete, + "state": state + } + self.sendPositionMessage(position) + self.app.data.xval_prev = self.app.data.xval + self.app.data.yval_prev = self.app.data.yval + self.app.data.zval_prev = self.app.data.zval + #self.app.data.console_queue.put("Update position") - self.sendPositionMessage(position) def activateModal(self, title, message, modalType, resume="false", progress="false"): data = json.dumps({"title": title, "message": message, "resume": resume, "progress": progress, "modalSize": "small", "modalType": modalType}) diff --git a/DataStructures/data.py b/DataStructures/data.py index 45f9236e..a78c0919 100644 --- a/DataStructures/data.py +++ b/DataStructures/data.py @@ -130,8 +130,15 @@ class Data: xval = 0.0 yval = 0.0 zval = 0.0 + xval_prev = -99990.0 + yval_prev = -99990.0 + zval_prev = -99990.0 + pausedzval = 0.0 + """ + GCode Position Values + """ previousPosX = 0.0 previousPosY = 0.0 previousPosZ = 0.0 diff --git a/main.py b/main.py index 5fa798e0..bed638be 100644 --- a/main.py +++ b/main.py @@ -367,7 +367,6 @@ def test_connect(): socketio.emit("my response", {"data": "Connected", "count": 0}) - @socketio.on("disconnect", namespace="/MaslowCNC") def test_disconnect(): app.data.console_queue.put("Client disconnected") diff --git a/static/scripts/baseSocket.js b/static/scripts/baseSocket.js index 94e16aee..640d0b4b 100644 --- a/static/scripts/baseSocket.js +++ b/static/scripts/baseSocket.js @@ -16,6 +16,9 @@ $("#clientStatus").text("Connected"); $("#clientStatus").removeClass('alert-danger').addClass('alert-success'); $("#mobileClientStatus").removeClass('alert-danger').addClass('alert-success'); + settingRequest("Computed Settings","units"); + settingRequest("Computed Settings","distToMove"); + settingRequest("Computed Settings","homePosition"); //checkForGCodeUpdate(); // don't think this is needed here anymore.. called by frontpage.js }); diff --git a/static/scripts/frontpage3d.js b/static/scripts/frontpage3d.js index 36d984eb..43c175ef 100644 --- a/static/scripts/frontpage3d.js +++ b/static/scripts/frontpage3d.js @@ -181,9 +181,9 @@ function unitSwitch(){ } $(document).ready(function(){ - settingRequest("Computed Settings","units"); - settingRequest("Computed Settings","distToMove"); - settingRequest("Computed Settings","homePosition"); + //settingRequest("Computed Settings","units"); + //settingRequest("Computed Settings","distToMove"); + //settingRequest("Computed Settings","homePosition"); action("statusRequest","cameraStatus"); checkForGCodeUpdate(); var controllerMessage = document.getElementById('controllerMessage'); diff --git a/static/scripts/frontpage3dcontrols.js b/static/scripts/frontpage3dcontrols.js index cfd02f3e..b90d809b 100644 --- a/static/scripts/frontpage3dcontrols.js +++ b/static/scripts/frontpage3dcontrols.js @@ -10,9 +10,9 @@ function unitSwitch(){ } $(document).ready(function(){ - settingRequest("Computed Settings","units"); - settingRequest("Computed Settings","distToMove"); - settingRequest("Computed Settings","homePosition"); + //settingRequest("Computed Settings","units"); + //settingRequest("Computed Settings","distToMove"); + //settingRequest("Computed Settings","homePosition"); var controllerMessage = document.getElementById('controllerMessage'); controllerMessage.scrollTop = controllerMessage.scrollHeight; }); diff --git a/templates/screenAction.html b/templates/screenAction.html index 2e6ca535..e900a6fa 100644 --- a/templates/screenAction.html +++ b/templates/screenAction.html @@ -1,7 +1,6 @@ {% block content %}
    -

    Left Motor

    +
    diff --git a/templates/frontpage3d.html b/templates/frontpage3d.html index d89f7d31..bf68109f 100644 --- a/templates/frontpage3d.html +++ b/templates/frontpage3d.html @@ -150,6 +150,23 @@
    Sled:
    +
    +
    +
    Error:
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    Home:
    diff --git a/templates/frontpage3d_mobile.html b/templates/frontpage3d_mobile.html index 699c2ed8..10625d51 100644 --- a/templates/frontpage3d_mobile.html +++ b/templates/frontpage3d_mobile.html @@ -153,6 +153,22 @@
    Position
    +
    +
    +
    Error:
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    Home:
    diff --git a/templates/frontpage3d_mobilecontrols.html b/templates/frontpage3d_mobilecontrols.html index b2a63354..8411582c 100644 --- a/templates/frontpage3d_mobilecontrols.html +++ b/templates/frontpage3d_mobilecontrols.html @@ -151,6 +151,21 @@
    Position
    +
    +
    +
    Error:
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    Home:
    diff --git a/templates/holeyCalibration.html b/templates/holeyCalibration.html new file mode 100644 index 00000000..60a5b6ee --- /dev/null +++ b/templates/holeyCalibration.html @@ -0,0 +1,10 @@ + +{% block content %} + +{% endblock %} + +{% block javascript %} + + + +{% endblock %} From 253ea8e96aa7405c79cbc130662d19b9bbc027e2 Mon Sep 17 00:00:00 2001 From: John Hogan Date: Fri, 9 Aug 2019 15:48:50 -0400 Subject: [PATCH 148/685] Holey calibration and start on editor --- Actions/actions.py | 25 ++++ Actions/holeyCalibration.py | 191 +++++++++++++++++++++------ Connection/nonVisibleWidgets.py | 2 + DataStructures/data.py | 1 + WebPageProcessor/webPageProcessor.py | 28 +++- config/config.py | 59 ++++++--- defaultwebcontrol.json | 22 ++- main.py | 28 ++++ static/scripts/ace.js | 16 +++ static/scripts/mode-javascript.js | 7 + static/scripts/theme-twilight.js | 7 + static/scripts/worker-javascript.js | 1 + static/styles/base.css | 14 +- templates/base.html | 9 +- templates/editGCode.html | 17 +++ templates/holeyCalibration.html | 113 +++++++++++++++- templates/importFile.html | 1 + templates/triangularCalibration.html | 2 +- 18 files changed, 465 insertions(+), 78 deletions(-) create mode 100644 static/scripts/ace.js create mode 100644 static/scripts/mode-javascript.js create mode 100644 static/scripts/theme-twilight.js create mode 100644 static/scripts/worker-javascript.js create mode 100644 templates/editGCode.html diff --git a/Actions/actions.py b/Actions/actions.py index 2c240bb6..2946b019 100644 --- a/Actions/actions.py +++ b/Actions/actions.py @@ -21,6 +21,12 @@ def processAction(self, msg): elif msg["data"]["command"] == "acceptTriangularCalibrationResults": if not self.data.triangularCalibration.acceptTriangularCalibrationResults(): self.data.ui_queue1.put("Alert", "Alert", "Error with accepting triangular calibration results.") + if msg["data"]["command"] == "cutHoleyCalibrationPattern": + if not self.data.holeyCalibration.CutTestPattern(): + self.data.ui_queue1.put("Alert", "Alert", "Error with cutting holey calibration pattern.") + elif msg["data"]["command"] == "acceptHoleyCalibrationResults": + if not self.data.holeyCalibration.acceptCalibrationResults(): + self.data.ui_queue1.put("Alert", "Alert", "Error with accepting holey calibration results.") elif msg["data"]["command"] == "resetChainLengths": if not self.resetChainLengths(): self.data.ui_queue1.put("Alert", "Alert", "Error with resetting chain lengths.") @@ -769,6 +775,25 @@ def calibrate(self, result): self.data.console_queue.put(str(e)) return False + def holeyCalibrate(self, result): + try: + motorYoffsetEst, distanceBetweenMotors, leftChainTolerance, rightChainTolerance, calibrationError = self.data.holeyCalibration.Calibrate( + result + ) + if not motorYoffsetEst: + return False + return ( + motorYoffsetEst, + distanceBetweenMotors, + leftChainTolerance, + rightChainTolerance, + calibrationError, + ) + except Exception as e: + self.data.console_queue.put(str(e)) + return False + + def sendGcode(self, gcode): try: self.data.gcode_queue.put(gcode) diff --git a/Actions/holeyCalibration.py b/Actions/holeyCalibration.py index 12ff01dd..81bd98f8 100644 --- a/Actions/holeyCalibration.py +++ b/Actions/holeyCalibration.py @@ -21,12 +21,12 @@ def __init__(self): # can't do much because data hasn't been initialized yet pass - SP_D = 3601.2 - SP_motorOffsetY = 468.4 - SP_rotationDiskRadius = 139.1 + SP_D = 3629.025 + SP_motorOffsetY = 503.4 + SP_rotationDiskRadius = 138.1 SP_leftChainTolerance = 0 SP_rightChainTolerance = 0 - SP_sledWeight = 97.9 # N + SP_sledWeight = 109.47 # N SP_chainOverSprocket = False Opt_D = 3601.2 @@ -58,6 +58,7 @@ def __init__(self): OptimizationOutput = 0 kin = kinematics.Kinematics() + kin.isQuadKinematics = False # Define function with input of (ideal lengths and) machine parameters (delta) and output of length error def LengthDeltaFromIdeal(self, @@ -84,19 +85,22 @@ def ValidateMeasurement(self, Meas, idx): else: return Meas > 0.0 - def CutTestPattern(self, data): - print('Cutting Holey Calibration Test Pattern') - data.gcode_queue.put("G21") - data.gcode_queue.put("G90") # Switch to absolute mode - data.gcode_queue.put("G40") - data.gcode_queue.put("G17") - data.gcode_queue.put("M3") + def CutTestPattern(self): + self.data.console_queue.put('Cutting Holey Calibration Test Pattern') + self.data.gcode_queue.put("G21") + self.data.gcode_queue.put("G90") # Switch to absolute mode + self.data.gcode_queue.put("G40") + self.data.gcode_queue.put("G17") + self.data.gcode_queue.put("M3") for idx in self.CutOrder: x, y = self.IdealCoordinates[idx] - print('cutting index: ' + str(idx + 1)) - CutHole(data, x, y) - data.gcode_queue.put("G0 X0 Y0") - data.gcode_queue.put("M5") + self.data.console_queue.put('cutting index: ' + str(idx + 1)) + self.data.gcode_queue.put("G0 X" + str(x) + " Y" + str(y)) + self.data.gcode_queue.put("G0 Z-5") + self.data.gcode_queue.put("G0 Z5") + + self.data.gcode_queue.put("G0 X0 Y0") + self.data.gcode_queue.put("M5") def CalculateMeasurements(self, HolePositions): # aH1x,aH1y,aH2x,aH2y,aH3x,aH3y,aH4x,aH4y,aH5x,aH5y,aH6x,aH6y @@ -104,10 +108,10 @@ def CalculateMeasurements(self, HolePositions): for StartHoleIdx, EndHoleIdx in self.MeasurementMap: x1, y1 = HolePositions[StartHoleIdx - 1] x2, y2 = HolePositions[EndHoleIdx - 1] - Measurements.append(GeometricLength(x1, y1, x2, y2)) + Measurements.append(self.GeometricLength(x1, y1, x2, y2)) ToTopHole = 1 Measurements.append( - GeometricLength(HolePositions[ToTopHole][0], HolePositions[ToTopHole][1], HolePositions[ToTopHole][0], + self.GeometricLength(HolePositions[ToTopHole][0], HolePositions[ToTopHole][1], HolePositions[ToTopHole][0], self.kin.machineHeight / 2)) return numpy.array(Measurements) @@ -145,46 +149,52 @@ def InitializeIdealXyCoordinates(self): def SetMeasurements(self, Measurements): self.MeasuredLengthArray = numpy.array(Measurements) - def Calibrate(self): + def Calibrate(self, result): + self.InitializeIdealXyCoordinates() + measurements = self.processMeasurements(result) + self.SetMeasurements(measurements) self.OptimizationOutput = least_squares(self.LengthDeltaFromIdeal, numpy.array([0, 0, 0, 0]), jac='2-point', diff_step=.1, ftol=1e-11) Deltas = self.OptimizationOutput.x - self.Opt_D = Deltas[0] + self.SP_D - self.Opt_motorOffsetY = Deltas[1] + self.SP_motorOffsetY - self.Opt_leftChainTolerance = Deltas[2] + self.SP_leftChainTolerance - self.Opt_rightChainTolerance = Deltas[3] + self.SP_rightChainTolerance + self.Opt_D = round(Deltas[0] + self.SP_D,5) + self.Opt_motorOffsetY = round(Deltas[1] + self.SP_motorOffsetY,5) + self.Opt_leftChainTolerance = round(Deltas[2] + self.SP_leftChainTolerance,5) + self.Opt_rightChainTolerance = round(Deltas[3] + self.SP_rightChainTolerance,5) self.kin.D = self.Opt_D self.kin.motorOffsetY = self.Opt_motorOffsetY self.kin.leftChainTolerance = self.Opt_leftChainTolerance self.kin.rightChainTolerance = self.Opt_rightChainTolerance self.kin.recomputeGeometry() + self.ReportCalibration() + return self.Opt_motorOffsetY, self.Opt_D, self.Opt_leftChainTolerance, self.Opt_rightChainTolerance, 1 + def ReportCalibration(self): - print('Optimized Errors') + self.data.console_queue.put('Optimized Errors') for idx, pts, ms, cal, er in zip( range(self.MeasuredLengthArray.size), self.MeasurementMap, self.MeasuredLengthArray, self.CalibratedLengths(), self.CalibratedLengthError()): - print(('\tIndex : {}' + + self.data.console_queue.put(('\tIndex : {}' + '\n\t\tPoints Span : {} to {}' + '\n\t\tMeasured Distance : {}' + '\n\t\tCalibrated Distance: {}' + '\n\t\tDistance Error : {}').format( idx, pts[0], pts[1], ms, cal, er)) - print("") - print("Distance Between Motors:") - print(self.Opt_D) - print("") - print("Motor Y Offset:") - print(self.Opt_motorOffsetY) - print("") - print("Left Chain Tolerance:") - print(self.Opt_leftChainTolerance) - print("") - print("Right Chain Tolerance:") - print(self.Opt_rightChainTolerance) + self.data.console_queue.put("") + self.data.console_queue.put("Distance Between Motors:") + self.data.console_queue.put(self.Opt_D) + self.data.console_queue.put("") + self.data.console_queue.put("Motor Y Offset:") + self.data.console_queue.put(self.Opt_motorOffsetY) + self.data.console_queue.put("") + self.data.console_queue.put("Left Chain Tolerance:") + self.data.console_queue.put(self.Opt_leftChainTolerance) + self.data.console_queue.put("") + self.data.console_queue.put("Right Chain Tolerance:") + self.data.console_queue.put(self.Opt_rightChainTolerance) def CalibratedLengths(self): return self.MeasuredLengthArray - self.OptimizationOutput.fun @@ -220,11 +230,106 @@ def SimulateMeasurement(self, D, motorOffsetY, leftChainTolerance, rightChainTol self.SetMeasurements(Measurements) -def GeometricLength(x1,y1,x2,y2): - return math.sqrt(math.pow(x1-x2,2) + math.pow(y1-y2,2)) + def processMeasurements(self, result): + measurements = [] + try: + M1 = float(result["M1"]) + self.data.console_queue.put(M1) + measurements.append(M1) + except: + self.data.message_queue.put("Message: Please enter a number for the distance M1." ) + return False + try: + M2 = float(result["M2"]) + self.data.console_queue.put(M2) + measurements.append(M2) + except: + self.data.message_queue.put("Message: Please enter a number for the distance M2." ) + return False + try: + M3 = float(result["M3"]) + self.data.console_queue.put(M3) + measurements.append(M3) + except: + self.data.message_queue.put("Message: Please enter a number for the distance M3." ) + return False + try: + M4 = float(result["M4"]) + self.data.console_queue.put(M4) + measurements.append(M4) + except: + self.data.message_queue.put("Message: Please enter a number for the distance M4." ) + return False + try: + M5 = float(result["M5"]) + self.data.console_queue.put(M5) + measurements.append(M5) + except: + self.data.message_queue.put("Message: Please enter a number for the distance M5." ) + return False + try: + M6 = float(result["M6"]) + self.data.console_queue.put(M6) + measurements.append(M6) + except: + self.data.message_queue.put("Message: Please enter a number for the distance M6." ) + return False + try: + M7 = float(result["M7"]) + self.data.console_queue.put(M7) + measurements.append(M7) + except: + self.data.message_queue.put("Message: Please enter a number for the distance M7." ) + return False + try: + M8 = float(result["M8"]) + self.data.console_queue.put(M8) + measurements.append(M8) + except: + self.data.message_queue.put("Message: Please enter a number for the distance M8.") + return False + try: + M9 = float(result["M9"]) + self.data.console_queue.put(M9) + measurements.append(M9) + except: + self.data.message_queue.put("Message: Please enter a number for the distance M9." ) + return False + try: + M10 = float(result["M10"]) + self.data.console_queue.put(M10) + measurements.append(M10) + except: + self.data.message_queue.put("Message: Please enter a number for the distance M10." ) + return False + try: + M11 = float(result["M11"]) + self.data.console_queue.put(M11) + measurements.append(M11) + except: + self.data.message_queue.put("Message: Please enter a number for the distance M11." ) + return False + try: + M12 = float(result["M12"]) + self.data.console_queue.put(M12) + measurements.append(M12) + except: + self.data.message_queue.put("Message: Please enter a number for the distance M12." ) + return False + return measurements + + def GeometricLength(self,x1,y1,x2,y2): + return math.sqrt(math.pow(x1-x2,2) + math.pow(y1-y2,2)) + + def acceptCalibrationResults(self): + self.data.config.setValue('Maslow Settings', 'motorOffsetY', str(self.Opt_motorOffsetY)) + self.data.config.setValue('Maslow Settings', 'motorSpacingX', str(self.Opt_D)) + self.data.config.setValue('Advanced Settings', 'leftChainTolerance', str(self.Opt_leftChainTolerance)) + self.data.config.setValue('Advanced Settings', 'rightChainTolerance', str(self.Opt_rightChainTolerance)) + + self.data.gcode_queue.put("G21 ") + self.data.gcode_queue.put("G90 ") + self.data.gcode_queue.put("G40 ") + self.data.gcode_queue.put("G0 X0 Y0 ") + return True -def CutHole(data,x,y): - print('Cutting point, x='+str(x)+', y='+str(y)) - data.gcode_queue.put("G0 X"+str(x)+" Y"+str(y)) - data.gcode_queue.put("G0 Z-5") - data.gcode_queue.put("G0 Z5") \ No newline at end of file diff --git a/Connection/nonVisibleWidgets.py b/Connection/nonVisibleWidgets.py index 2cf9e8a0..15f86dd3 100644 --- a/Connection/nonVisibleWidgets.py +++ b/Connection/nonVisibleWidgets.py @@ -50,6 +50,7 @@ def setUpData(self, data): data.importFile = self.importFile data.actions = self.actions data.triangularCalibration = self.triangularCalibration + data.holeyCalibration = self.holeyCalibration # data.opticalCalibration = self.opticalCalibration data.messageProcessor = self.messageProcessor data.mcpProcessor = self.mcpProcessor @@ -61,6 +62,7 @@ def setUpData(self, data): self.importFile.setUpData(data) self.actions.setUpData(data) self.triangularCalibration.setUpData(data) + self.holeyCalibration.setUpData(data) # self.opticalCalibration.setUpData(data) self.messageProcessor.setUpData(data) self.mcpProcessor.setUpData(data) diff --git a/DataStructures/data.py b/DataStructures/data.py index 814e8e0e..8aeb706e 100644 --- a/DataStructures/data.py +++ b/DataStructures/data.py @@ -83,6 +83,7 @@ class Data: serialPort = None # this is a pointer to the program serial port object requestSerialClose = False # this is used to request the serialThread to gracefully close the port triangularCalibration = None # points to the triangular calibration object + holeyCalibration = None # points to the triangular calibration object # opticalCalibration = None # points to the optical calibration object # opticalCalibrationImage = None # stores the current image # opticalCalibrationImageUpdated = False # stores whether its been updated or not diff --git a/WebPageProcessor/webPageProcessor.py b/WebPageProcessor/webPageProcessor.py index 4ae49b4f..d378f7d1 100644 --- a/WebPageProcessor/webPageProcessor.py +++ b/WebPageProcessor/webPageProcessor.py @@ -218,8 +218,20 @@ def createWebPage(self, pageID, isMobile, args): page = render_template("opticalCalibration.html", pageID="opticalCalibration", opticalCenterX=opticalCenterX, opticalCenterY=opticalCenterY, scaleX=scaleX, scaleY=scaleY, gaussianBlurValue=gaussianBlurValue, cannyLowValue=cannyLowValue, cannyHighValue=cannyHighValue, autoScanDirection=autoScanDirection, markerX=markerX, markerY=markerY, tlX=tlX, tlY=tlY, brX=brX, brY=brY, calibrationExtents=calibrationExtents, isMobile=isMobile, positionTolerance=positionTolerance) return page, "Optical Calibration", True, "large", "content", False elif pageID == "holeyCalibration": - page = render_template("holeyCalibration.html", pageID="holeyCalibration") - return page, "Holey Calibration", True, "large", "content", False + socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") + motorYoffset = self.data.config.getValue("Maslow Settings", "motorOffsetY") + distanceBetweenMotors = self.data.config.getValue("Maslow Settings", "motorSpacingX") + leftChainTolerance = self.data.config.getValue("Advanced Settings", "leftChainTolerance") + rightChainTolerance = self.data.config.getValue("Advanced Settings", "rightChainTolerance") + page = render_template( + "holeyCalibration.html", + pageID="holeyCalibration", + motorYoffset=motorYoffset, + distanceBetweenMotors=distanceBetweenMotors, + leftChainTolerance=leftChainTolerance, + rightChainTolerance=rightChainTolerance, + ) + return page, "Holey Calibration", True, "medium", "content", False elif pageID == "quickConfigure": socketio.emit("closeModals", {"data": {"title": "Actions"}}, namespace="/MaslowCNC") motorOffsetY = self.data.config.getValue("Maslow Settings", "motorOffsetY") @@ -252,9 +264,10 @@ def createWebPage(self, pageID, isMobile, args): elif pageID == "viewGcode": page = render_template("viewGcode.html", gcode=self.data.gcode) return page, "View GCode", False, "medium", "content", False - elif pageID == "sendGcode": - page = render_template("sendGcode.html") - return page, "Send GCode", False, "medium", "content", False + elif pageID == "editGCode": + text = self.gcodePreProcessor() + page = render_template("editGCode.html", gcode=text) + return page, "Edit GCode", False, "medium", "content", "footerSubmit" elif pageID == "pidTuning": KpP = self.data.config.getValue("Advanced Settings", "KpPos") KiP = self.data.config.getValue("Advanced Settings", "KiPos") @@ -275,3 +288,8 @@ def createWebPage(self, pageID, isMobile, args): pVersion=pVersion) return page, "PID Tuning", False, "large", "content", False + def gcodePreProcessor(self): + text = "" + for line in self.data.gcode: + text=text+line+"\n" + return text diff --git a/config/config.py b/config/config.py index 08db21c9..8b0fdc80 100644 --- a/config/config.py +++ b/config/config.py @@ -8,6 +8,7 @@ import json import re import os +import math from shutil import copyfile from pathlib import Path import time @@ -327,27 +328,29 @@ def syncFirmwareKey(self, firmwareKey, value, isImporting=False, useStored=False value = 0 if firmwareKey == 45: - print(self.data.controllerFirmwareVersion) - self.data.console_queue.put("firmwareKey = 45") - if storedValue != "": - self.sendErrorArray(firmwareKey, storedValue, data) - pass + if self.data.controllerFirmwareVersion >= 100: + print(self.data.controllerFirmwareVersion) + self.data.console_queue.put("firmwareKey = 45") + if storedValue != "": + self.sendErrorArray(firmwareKey, storedValue, data) + pass elif useStored is True: - app.data.gcode_queue.put( - "$" + str(firmwareKey) + "=" + str(storedValue) - ) + strValue = self.firmwareKeyString(firmwareKey,storedValue) + app.data.gcode_queue.put(strValue) + #app.data.gcode_queue.put("$" + str(firmwareKey) + "=" + str(storedValue)) elif firmwareKey >= 47 and firmwareKey <= 58: - if not self.isPercentClose(float(storedValue), float(value)): - if not isImporting: - app.data.gcode_queue.put( - "$" + str(firmwareKey) + "=" + str(storedValue) - ) - else: - break + if self.data.controllerFirmwareVersion >= 100: + if not self.isPercentClose(float(storedValue), float(value)): + if not isImporting: + strValue = self.firmwareKeyString(firmwareKey, storedValue) + app.data.gcode_queue.put(strValue) + # app.data.gcode_queue.put("$" + str(firmwareKey) + "=" + str(storedValue)) + else: + break elif not self.isClose(float(storedValue), float(value)) and not isImporting: - app.data.gcode_queue.put( - "$" + str(firmwareKey) + "=" + str(storedValue) - ) + strValue = self.firmwareKeyString(firmwareKey, storedValue) + app.data.gcode_queue.put(strValue) + # app.data.gcode_queue.put("$" + str(firmwareKey) + "=" + str(storedValue)) else: break return @@ -575,3 +578,23 @@ def processChange(self, key, value): ### TODO: This does not currently fire on bools ## if key == "fps" or key == "videoSize" or key=="cameraSleep": self.data.camera.changeSetting(key, value) + + + def firmwareKeyString(self, firmwareKey, value): + strValue = self.firmwareKeyValue(value) + gc = "$" + str(firmwareKey) + "=" + strValue + return gc + + + def firmwareKeyValue(self, value): + try: + de = math.log(abs(value), 10) + ru = math.ceil(de) + except: + ru = 0 + fmt = '{:' + str(int(max(max(7 - ru, 7), abs(ru)))) + '.' + str(int(6 - ru)) + 'f}' + try: + return fmt.format(value) + except: + print('firmwareKeyString Exception: value = ' + str(value)) + return str(value) \ No newline at end of file diff --git a/defaultwebcontrol.json b/defaultwebcontrol.json index 5538694f..92822792 100644 --- a/defaultwebcontrol.json +++ b/defaultwebcontrol.json @@ -57,6 +57,16 @@ "value": "0", "firmwareKey": 41 }, + { + "default": 5.1685e-6, + "desc": "Elasticity of the Chain [mm/mm/N]\ndefault setting: 5.1685e-6", + "key": "chainElasticity", + "section": "Advanced Settings", + "title": "Chain Elasticity", + "type": "float", + "value": 5.1685e-6, + "firmwareKey": 75 + }, { "default": "Top", "desc": "On which side of the motor sprockets do the chains leave from to connect to the sled\ndefault setting: Top", @@ -198,7 +208,7 @@ { "default": 0, "desc": "Enable modifying x,y coordinates during calculations to account for errors determined by optical calibration\ndefault setting: 0", - "firmwareKey": 44, + "firmwareKey": 144, "key": "enableOpticalCalibration", "section": "Advanced Settings", "title": "Use Calibration Error Matrix (Experimental)", @@ -600,6 +610,16 @@ "type": "string", "value": "310" }, + { + "default": 97.9, + "desc": "Weight of sled [N].\ndefault setting: 97.9", + "firmwareKey": 76, + "key": "sledWeight", + "section": "Maslow Settings", + "title": "Sled Weight", + "type": "float", + "value": 97.9 + }, { "default": 139, "desc": "The vertical distance between where the chains mount on the sled to the cutting tool.\ndefault setting: 139", diff --git a/main.py b/main.py index 55722c8a..9a14597f 100644 --- a/main.py +++ b/main.py @@ -259,6 +259,34 @@ def triangularCalibration(): resp.status_code = 500 return resp +@app.route("/holeyCalibration", methods=["POST"]) +def holeyCalibration(): + app.data.logger.resetIdler() + if request.method == "POST": + result = request.form + motorYoffsetEst, distanceBetweenMotors, leftChainTolerance, rightChainTolerance, calibrationError = app.data.actions.holeyCalibrate( + result + ) + # print(returnVal) + if motorYoffsetEst: + message = { + "status": 200, + "data": { + "motorYoffset": motorYoffsetEst, + "distanceBetweenMotors": distanceBetweenMotors, + "leftChainTolerance": leftChainTolerance, + "rightChainTolerance": rightChainTolerance, + "calibrationError": calibrationError + }, + } + resp = jsonify(message) + resp.status_code = 200 + return resp + else: + message = {"status": 500} + resp = jsonify(message) + resp.status_code = 500 + return resp @app.route("/opticalCalibration", methods=["POST"]) def opticalCalibration(): diff --git a/static/scripts/ace.js b/static/scripts/ace.js new file mode 100644 index 00000000..a8416404 --- /dev/null +++ b/static/scripts/ace.js @@ -0,0 +1,16 @@ +(function(){function o(n){var i=e;n&&(e[n]||(e[n]={}),i=e[n]);if(!i.define||!i.define.packaged)t.original=i.define,i.define=t,i.define.packaged=!0;if(!i.require||!i.require.packaged)r.original=i.require,i.require=r,i.require.packaged=!0}var ACE_NAMESPACE = "ace",e=function(){return this}();!e&&typeof window!="undefined"&&(e=window);if(!ACE_NAMESPACE&&typeof requirejs!="undefined")return;var t=function(e,n,r){if(typeof e!="string"){t.original?t.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(r=n),t.modules[e]||(t.payloads[e]=r,t.modules[e]=null)};t.modules={},t.payloads={};var n=function(e,t,n){if(typeof t=="string"){var i=s(e,t);if(i!=undefined)return n&&n(),i}else if(Object.prototype.toString.call(t)==="[object Array]"){var o=[];for(var u=0,a=t.length;u1&&u(t,"")>-1&&(a=RegExp(this.source,r.replace.call(o(this),"g","")),r.replace.call(e.slice(t.index),a,function(){for(var e=1;et.index&&this.lastIndex--}return t},s||(RegExp.prototype.test=function(e){var t=r.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t})}),ace.define("ace/lib/es5-shim",["require","exports","module"],function(e,t,n){function r(){}function w(e){try{return Object.defineProperty(e,"sentinel",{}),"sentinel"in e}catch(t){}}function H(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function B(e){var t=typeof e;return e===null||t==="undefined"||t==="boolean"||t==="number"||t==="string"}function j(e){var t,n,r;if(B(e))return e;n=e.valueOf;if(typeof n=="function"){t=n.call(e);if(B(t))return t}r=e.toString;if(typeof r=="function"){t=r.call(e);if(B(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError("Function.prototype.bind called on incompatible "+n);var i=u.call(arguments,1),s=function(){if(this instanceof s){var e=n.apply(this,i.concat(u.call(arguments)));return Object(e)===e?e:this}return n.apply(t,i.concat(u.call(arguments)))};return n.prototype&&(r.prototype=n.prototype,s.prototype=new r,r.prototype=null),s});var i=Function.prototype.call,s=Array.prototype,o=Object.prototype,u=s.slice,a=i.bind(o.toString),f=i.bind(o.hasOwnProperty),l,c,h,p,d;if(d=f(o,"__defineGetter__"))l=i.bind(o.__defineGetter__),c=i.bind(o.__defineSetter__),h=i.bind(o.__lookupGetter__),p=i.bind(o.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,"XXX"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+ta)for(h=l;h--;)this[f+h]=this[a+h];if(s&&e===c)this.length=c,this.push.apply(this,i);else{this.length=c+s;for(h=0;h>>0;if(a(t)!="[object Function]")throw new TypeError;while(++s>>0,s=Array(i),o=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var u=0;u>>0,s=[],o,u=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var f=0;f>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var s=0,o;if(arguments.length>=2)o=arguments[1];else do{if(s in r){o=r[s++];break}if(++s>=i)throw new TypeError("reduce of empty array with no initial value")}while(!0);for(;s>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");var s,o=i-1;if(arguments.length>=2)s=arguments[1];else do{if(o in r){s=r[o--];break}if(--o<0)throw new TypeError("reduceRight of empty array with no initial value")}while(!0);do o in this&&(s=t.call(void 0,s,r[o],o,n));while(o--);return s});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=H(arguments[1])),i=i>=0?i:Math.max(0,r+i);for(;i>>0;if(!r)return-1;var i=r-1;arguments.length>1&&(i=Math.min(i,H(arguments[1]))),i=i>=0?i:r-Math.abs(i);for(;i>=0;i--)if(i in n&&t===n[i])return i;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(t){return t.__proto__||(t.constructor?t.constructor.prototype:o)});if(!Object.getOwnPropertyDescriptor){var y="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(t,n){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(y+t);if(!f(t,n))return;var r,i,s;r={enumerable:!0,configurable:!0};if(d){var u=t.__proto__;t.__proto__=o;var i=h(t,n),s=p(t,n);t.__proto__=u;if(i||s)return i&&(r.get=i),s&&(r.set=s),r}return r.value=t[n],r}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(t){return Object.keys(t)});if(!Object.create){var b;Object.prototype.__proto__===null?b=function(){return{__proto__:null}}:b=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(t,n){var r;if(t===null)r=b();else{if(typeof t!="object")throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var i=function(){};i.prototype=t,r=new i,r.__proto__=t}return n!==void 0&&Object.defineProperties(r,n),r}}if(Object.defineProperty){var E=w({}),S=typeof document=="undefined"||w(document.createElement("div"));if(!E||!S)var x=Object.defineProperty}if(!Object.defineProperty||x){var T="Property description must be an object: ",N="Object.defineProperty called on non-object: ",C="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(t,n,r){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(N+t);if(typeof r!="object"&&typeof r!="function"||r===null)throw new TypeError(T+r);if(x)try{return x.call(Object,t,n,r)}catch(i){}if(f(r,"value"))if(d&&(h(t,n)||p(t,n))){var s=t.__proto__;t.__proto__=o,delete t[n],t[n]=r.value,t.__proto__=s}else t[n]=r.value;else{if(!d)throw new TypeError(C);f(r,"get")&&l(t,n,r.get),f(r,"set")&&c(t,n,r.set)}return t}}Object.defineProperties||(Object.defineProperties=function(t,n){for(var r in n)f(n,r)&&Object.defineProperty(t,r,n[r]);return t}),Object.seal||(Object.seal=function(t){return t}),Object.freeze||(Object.freeze=function(t){return t});try{Object.freeze(function(){})}catch(k){Object.freeze=function(t){return function(n){return typeof n=="function"?n:t(n)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(t){return t}),Object.isSealed||(Object.isSealed=function(t){return!1}),Object.isFrozen||(Object.isFrozen=function(t){return!1}),Object.isExtensible||(Object.isExtensible=function(t){if(Object(t)===t)throw new TypeError;var n="";while(f(t,n))n+="?";t[n]=!0;var r=f(t,n);return delete t[n],r});if(!Object.keys){var L=!0,A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],O=A.length;for(var M in{toString:null})L=!1;Object.keys=function I(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Object.keys called on a non-object");var I=[];for(var t in e)f(e,t)&&I.push(t);if(L)for(var n=0,r=O;n=0?parseFloat((s.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((s.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=s.match(/ Gecko\/\d+/),t.isOpera=typeof opera=="object"&&Object.prototype.toString.call(window.opera)=="[object Opera]",t.isWebKit=parseFloat(s.split("WebKit/")[1])||undefined,t.isChrome=parseFloat(s.split(" Chrome/")[1])||undefined,t.isEdge=parseFloat(s.split(" Edge/")[1])||undefined,t.isAIR=s.indexOf("AdobeAIR")>=0,t.isIPad=s.indexOf("iPad")>=0,t.isAndroid=s.indexOf("Android")>=0,t.isChromeOS=s.indexOf(" CrOS ")>=0,t.isIOS=/iPad|iPhone|iPod/.test(s)&&!window.MSStream,t.isIOS&&(t.isMac=!0),t.isMobile=t.isIPad||t.isAndroid}),ace.define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("./useragent"),i="http://www.w3.org/1999/xhtml";t.buildDom=function o(e,t,n){if(typeof e=="string"&&e){var r=document.createTextNode(e);return t&&t.appendChild(r),r}if(!Array.isArray(e))return e;if(typeof e[0]!="string"||!e[0]){var i=[];for(var s=0;s=1.5:!0;if(typeof document!="undefined"){var s=document.createElement("div");t.HI_DPI&&s.style.transform!==undefined&&(t.HAS_CSS_TRANSFORMS=!0),!r.isEdge&&typeof s.style.animationName!="undefined"&&(t.HAS_CSS_ANIMATION=!0),s=null}t.HAS_CSS_TRANSFORMS?t.translate=function(e,t,n){e.style.transform="translate("+Math.round(t)+"px, "+Math.round(n)+"px)"}:t.translate=function(e,t,n){e.style.top=Math.round(n)+"px",e.style.left=Math.round(t)+"px"}}),ace.define("ace/lib/oop",["require","exports","module"],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),ace.define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(e,t,n){"use strict";var r=e("./oop"),i=function(){var e={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,"super":8,meta:8,command:8,cmd:8},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",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}},t,n;for(n in e.FUNCTION_KEYS)t=e.FUNCTION_KEYS[n].toLowerCase(),e[t]=parseInt(n,10);for(n in e.PRINTABLE_KEYS)t=e.PRINTABLE_KEYS[n].toLowerCase(),e[t]=parseInt(n,10);return r.mixin(e,e.MODIFIER_KEYS),r.mixin(e,e.PRINTABLE_KEYS),r.mixin(e,e.FUNCTION_KEYS),e.enter=e["return"],e.escape=e.esc,e.del=e["delete"],e[173]="-",function(){var t=["cmd","ctrl","alt","shift"];for(var n=Math.pow(2,t.length);n--;)e.KEY_MODS[n]=t.filter(function(t){return n&e.KEY_MODS[t]}).join("-")+"-"}(),e.KEY_MODS[0]="",e.KEY_MODS[-1]="input-",e}();r.mixin(t,i),t.keyCodeToString=function(e){var t=i[e];return typeof t!="string"&&(t=String.fromCharCode(e)),t.toLowerCase()}}),ace.define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";function a(e,t,n){var a=u(t);if(!i.isMac&&s){t.getModifierState&&(t.getModifierState("OS")||t.getModifierState("Win"))&&(a|=8);if(s.altGr){if((3&a)==3)return;s.altGr=0}if(n===18||n===17){var f="location"in t?t.location:t.keyLocation;if(n===17&&f===1)s[n]==1&&(o=t.timeStamp);else if(n===18&&a===3&&f===2){var l=t.timeStamp-o;l<50&&(s.altGr=!0)}}}n in r.MODIFIER_KEYS&&(n=-1),a&8&&n>=91&&n<=93&&(n=-1);if(!a&&n===13){var f="location"in t?t.location:t.keyLocation;if(f===3){e(t,a,-n);if(t.defaultPrevented)return}}if(i.isChromeOS&&a&8){e(t,a,n);if(t.defaultPrevented)return;a&=-9}return!!a||n in r.FUNCTION_KEYS||n in r.PRINTABLE_KEYS?e(t,a,n):!1}function f(){s=Object.create(null)}var r=e("./keys"),i=e("./useragent"),s=null,o=0;t.addListener=function(e,t,n){if(e.addEventListener)return e.addEventListener(t,n,!1);if(e.attachEvent){var r=function(){n.call(e,window.event)};n._wrapper=r,e.attachEvent("on"+t,r)}},t.removeListener=function(e,t,n){if(e.removeEventListener)return e.removeEventListener(t,n,!1);e.detachEvent&&e.detachEvent("on"+t,n._wrapper||n)},t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},t.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},t.getButton=function(e){return e.type=="dblclick"?0:e.type=="contextmenu"||i.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.preventDefault?e.button:{1:0,2:2,4:1}[e.button]},t.capture=function(e,n,r){function i(e){n&&n(e),r&&r(e),t.removeListener(document,"mousemove",n,!0),t.removeListener(document,"mouseup",i,!0),t.removeListener(document,"dragstart",i,!0)}return t.addListener(document,"mousemove",n,!0),t.addListener(document,"mouseup",i,!0),t.addListener(document,"dragstart",i,!0),i},t.addMouseWheelListener=function(e,n){"onmousewheel"in e?t.addListener(e,"mousewheel",function(e){var t=8;e.wheelDeltaX!==undefined?(e.wheelX=-e.wheelDeltaX/t,e.wheelY=-e.wheelDeltaY/t):(e.wheelX=0,e.wheelY=-e.wheelDelta/t),n(e)}):"onwheel"in e?t.addListener(e,"wheel",function(e){var t=.35;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=e.deltaX*t||0,e.wheelY=e.deltaY*t||0;break;case e.DOM_DELTA_LINE:case e.DOM_DELTA_PAGE:e.wheelX=(e.deltaX||0)*5,e.wheelY=(e.deltaY||0)*5}n(e)}):t.addListener(e,"DOMMouseScroll",function(e){e.axis&&e.axis==e.HORIZONTAL_AXIS?(e.wheelX=(e.detail||0)*5,e.wheelY=0):(e.wheelX=0,e.wheelY=(e.detail||0)*5),n(e)})},t.addMultiMouseDownListener=function(e,n,r,s){function c(e){t.getButton(e)!==0?o=0:e.detail>1?(o++,o>4&&(o=1)):o=1;if(i.isIE){var c=Math.abs(e.clientX-u)>5||Math.abs(e.clientY-a)>5;if(!f||c)o=1;f&&clearTimeout(f),f=setTimeout(function(){f=null},n[o-1]||600),o==1&&(u=e.clientX,a=e.clientY)}e._clicks=o,r[s]("mousedown",e);if(o>4)o=0;else if(o>1)return r[s](l[o],e)}function h(e){o=2,f&&clearTimeout(f),f=setTimeout(function(){f=null},n[o-1]||600),r[s]("mousedown",e),r[s](l[o],e)}var o=0,u,a,f,l={2:"dblclick",3:"tripleclick",4:"quadclick"};Array.isArray(e)||(e=[e]),e.forEach(function(e){t.addListener(e,"mousedown",c),i.isOldIE&&t.addListener(e,"dblclick",h)})};var u=!i.isMac||!i.isOpera||"KeyboardEvent"in window?function(e){return 0|(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0)}:function(e){return 0|(e.metaKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.ctrlKey?8:0)};t.getModifierString=function(e){return r.KEY_MODS[u(e)]},t.addCommandKeyListener=function(e,n){var r=t.addListener;if(i.isOldGecko||i.isOpera&&!("KeyboardEvent"in window)){var o=null;r(e,"keydown",function(e){o=e.keyCode}),r(e,"keypress",function(e){return a(n,e,o)})}else{var u=null;r(e,"keydown",function(e){s[e.keyCode]=(s[e.keyCode]||0)+1;var t=a(n,e,e.keyCode);return u=e.defaultPrevented,t}),r(e,"keypress",function(e){u&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),u=null)}),r(e,"keyup",function(e){s[e.keyCode]=null}),s||(f(),r(window,"focus",f))}};if(typeof window=="object"&&window.postMessage&&!i.isOldIE){var l=1;t.nextTick=function(e,n){n=n||window;var r="zero-timeout-message-"+l++,i=function(s){s.data==r&&(t.stopPropagation(s),t.removeListener(n,"message",i),e())};t.addListener(n,"message",i),n.postMessage(r,"*")}}t.$idleBlocked=!1,t.onIdle=function(e,n){return setTimeout(function r(){t.$idleBlocked?setTimeout(r,100):e()},n)},t.$idleBlockId=null,t.blockIdle=function(e){t.$idleBlockId&&clearTimeout(t.$idleBlockId),t.$idleBlocked=!0,t.$idleBlockId=setTimeout(function(){t.$idleBlocked=!1},e||100)},t.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),t.nextFrame?t.nextFrame=t.nextFrame.bind(window):t.nextFrame=function(e){setTimeout(e,17)}}),ace.define("ace/range",["require","exports","module"],function(e,t,n){"use strict";var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?tthis.end.column?1:0:ethis.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.rowt)var r={row:t+1,column:0};else if(this.start.row0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n63,l=400,c=e("../lib/keys"),h=c.KEY_MODS,p=i.isIOS,d=p?/\s/:/\n/,v=function(e,t){function W(){x=!0,n.blur(),n.focus(),x=!1}function V(e){e.keyCode==27&&n.value.lengthC&&T[s]=="\n")o=c.end;else if(rC&&T.slice(0,s).split("\n").length>2)o=c.down;else if(s>C&&T[s-1]==" ")o=c.right,u=h.option;else if(s>C||s==C&&C!=N&&r==s)o=c.right;r!==s&&(u|=h.shift),o&&(t.onCommandKey(null,u,o),N=r,C=s,A(""))};document.addEventListener("selectionchange",s),t.on("destroy",function(){document.removeEventListener("selectionchange",s)})}var n=s.createElement("textarea");n.className="ace_text-input",n.setAttribute("wrap","off"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck",!1),n.style.opacity="0",e.insertBefore(n,e.firstChild);var v=!1,m=!1,g=!1,y=!1,b="",w=!0,E=!1;i.isMobile||(n.style.fontSize="1px");var S=!1,x=!1,T="",N=0,C=0;try{var k=document.activeElement===n}catch(L){}r.addListener(n,"blur",function(e){if(x)return;t.onBlur(e),k=!1}),r.addListener(n,"focus",function(e){if(x)return;k=!0;if(i.isEdge)try{if(!document.hasFocus())return}catch(e){}t.onFocus(e),i.isEdge?setTimeout(A):A()}),this.$focusScroll=!1,this.focus=function(){if(b||f||this.$focusScroll=="browser")return n.focus({preventScroll:!0});var e=n.style.top;n.style.position="fixed",n.style.top="0px";try{var t=n.getBoundingClientRect().top!=0}catch(r){return}var i=[];if(t){var s=n.parentElement;while(s&&s.nodeType==1)i.push(s),s.setAttribute("ace_nocontext",!0),!s.parentElement&&s.getRootNode?s=s.getRootNode().host:s=s.parentElement}n.focus({preventScroll:!0}),t&&i.forEach(function(e){e.removeAttribute("ace_nocontext")}),setTimeout(function(){n.style.position="",n.style.top=="0px"&&(n.style.top=e)},0)},this.blur=function(){n.blur()},this.isFocused=function(){return k},t.on("beforeEndOperation",function(){if(t.curOp&&t.curOp.command.name=="insertstring")return;g&&(T=n.value="",z()),A()});var A=p?function(e){if(!k||v&&!e||y)return;e||(e="");var r="\n ab"+e+"cde fg\n";r!=n.value&&(n.value=T=r);var i=4,s=4+(e.length||(t.selection.isEmpty()?0:1));(N!=i||C!=s)&&n.setSelectionRange(i,s),N=i,C=s}:function(){if(g||y)return;if(!k&&!D)return;g=!0;var e=t.selection,r=e.getRange(),i=e.cursor.row,s=r.start.column,o=r.end.column,u=t.session.getLine(i);if(r.start.row!=i){var a=t.session.getLine(i-1);s=r.start.rowi+1?f.length:o,o+=u.length+1,u=u+"\n"+f}u.length>l&&(s=T.length&&e.value===T&&T&&e.selectionEnd!==C},M=function(e){if(g)return;v?v=!1:O(n)&&(t.selectAll(),A())},_=null;this.setInputHandler=function(e){_=e},this.getInputHandler=function(){return _};var D=!1,P=function(e,r){D&&(D=!1);if(m)return A(),e&&t.onPaste(e),m=!1,"";var i=n.selectionStart,s=n.selectionEnd,o=N,u=T.length-C,a=e,f=e.length-i,l=e.length-s,c=0;while(o>0&&T[c]==e[c])c++,o--;a=a.slice(c),c=1;while(u>0&&T.length-c>N-1&&T[T.length-c]==e[e.length-c])c++,u--;return f-=c-1,l-=c-1,a=a.slice(0,a.length-c+1),!r&&f==a.length&&!o&&!u&&!l?"":(y=!0,a&&!o&&!u&&!f&&!l||S?t.onTextInput(a):t.onTextInput(a,{extendLeft:o,extendRight:u,restoreStart:f,restoreEnd:l}),y=!1,T=e,N=i,C=s,a)},H=function(e){if(g)return U();var t=n.value,r=P(t,!0);(t.length>l+100||d.test(r))&&A()},B=function(e,t,n){var r=e.clipboardData||window.clipboardData;if(!r||u)return;var i=a||n?"Text":"text/plain";try{return t?r.setData(i,t)!==!1:r.getData(i)}catch(e){if(!n)return B(e,t,!0)}},j=function(e,i){var s=t.getCopyText();if(!s)return r.preventDefault(e);B(e,s)?(p&&(A(s),v=s,setTimeout(function(){v=!1},10)),i?t.onCut():t.onCopy(),r.preventDefault(e)):(v=!0,n.value=s,n.select(),setTimeout(function(){v=!1,A(),i?t.onCut():t.onCopy()}))},F=function(e){j(e,!0)},I=function(e){j(e,!1)},q=function(e){var s=B(e);typeof s=="string"?(s&&t.onPaste(s,e),i.isIE&&setTimeout(A),r.preventDefault(e)):(n.value="",m=!0)};r.addCommandKeyListener(n,t.onCommandKey.bind(t)),r.addListener(n,"select",M),r.addListener(n,"input",H),r.addListener(n,"cut",F),r.addListener(n,"copy",I),r.addListener(n,"paste",q),(!("oncut"in n)||!("oncopy"in n)||!("onpaste"in n))&&r.addListener(e,"keydown",function(e){if(i.isMac&&!e.metaKey||!e.ctrlKey)return;switch(e.keyCode){case 67:I(e);break;case 86:q(e);break;case 88:F(e)}});var R=function(e){if(g||!t.onCompositionStart||t.$readOnly)return;g={};if(S)return;setTimeout(U,0),t.on("mousedown",W);var r=t.getSelectionRange();r.end.row=r.start.row,r.end.column=r.start.column,g.markerRange=r,g.selectionStart=N,t.onCompositionStart(g),g.useTextareaForIME?(n.value="",T="",N=0,C=0):(n.msGetInputContext&&(g.context=n.msGetInputContext()),n.getInputContext&&(g.context=n.getInputContext()))},U=function(){if(!g||!t.onCompositionUpdate||t.$readOnly)return;if(S)return W();if(g.useTextareaForIME)t.onCompositionUpdate(n.value);else{var e=n.value;P(e),g.markerRange&&(g.context&&(g.markerRange.start.column=g.selectionStart=g.context.compositionStartOffset),g.markerRange.end.column=g.markerRange.start.column+C-g.selectionStart)}},z=function(e){if(!t.onCompositionEnd||t.$readOnly)return;g=!1,t.onCompositionEnd(),t.off("mousedown",W),e&&H()},X=o.delayedCall(U,50).schedule.bind(null,null);r.addListener(n,"compositionstart",R),r.addListener(n,"compositionupdate",U),r.addListener(n,"keyup",V),r.addListener(n,"keydown",X),r.addListener(n,"compositionend",z),this.getElement=function(){return n},this.setCommandMode=function(e){S=e,n.readOnly=!1},this.setReadOnly=function(e){S||(n.readOnly=e)},this.setCopyWithEmptySelection=function(e){E=e},this.onContextMenu=function(e){D=!0,A(),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,o){b||(b=n.style.cssText),n.style.cssText=(o?"z-index:100000;":"")+(i.isIE?"opacity:0.1;":"")+"text-indent: -"+(N+C)*t.renderer.characterWidth*.5+"px;";var u=t.container.getBoundingClientRect(),a=s.computedStyle(t.container),f=u.top+(parseInt(a.borderTopWidth)||0),l=u.left+(parseInt(u.borderLeftWidth)||0),c=u.bottom-f-n.clientHeight-2,h=function(e){s.translate(n,e.clientX-l-2,Math.min(e.clientY-f-2,c))};h(e);if(e.type!="mousedown")return;t.renderer.$isMousePressed=!0,clearTimeout($),i.isWin&&r.capture(t.container,h,J)},this.onContextMenuClose=J;var $,K=function(e){t.textInput.onContextMenu(e),J()};r.addListener(n,"mouseup",K),r.addListener(n,"mousedown",function(e){e.preventDefault(),J()}),r.addListener(t.renderer.scroller,"contextmenu",K),r.addListener(n,"contextmenu",K),p&&Q(e,t,n)};t.TextInput=v}),ace.define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(e,t,n){"use strict";function o(e){e.$clickSelection=null;var t=e.editor;t.setDefaultHandler("mousedown",this.onMouseDown.bind(e)),t.setDefaultHandler("dblclick",this.onDoubleClick.bind(e)),t.setDefaultHandler("tripleclick",this.onTripleClick.bind(e)),t.setDefaultHandler("quadclick",this.onQuadClick.bind(e)),t.setDefaultHandler("mousewheel",this.onMouseWheel.bind(e));var n=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];n.forEach(function(t){e[t]=this[t]},this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}function u(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}function a(e,t){if(e.start.row==e.end.row)var n=2*t.column-e.start.column-e.end.column;else if(e.start.row==e.end.row-1&&!e.start.column&&!e.end.column)var n=t.column-4;else var n=2*t.row-e.start.row-e.end.row;return n<0?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}var r=e("../lib/useragent"),i=0,s=550;(function(){this.onMouseDown=function(e){var t=e.inSelection(),n=e.getDocumentPosition();this.mousedownEvent=e;var i=this.editor,s=e.getButton();if(s!==0){var o=i.getSelectionRange(),u=o.isEmpty();(u||s==1)&&i.selection.moveToPosition(n),s==2&&(i.textInput.onContextMenu(e.domEvent),r.isMozilla||e.preventDefault());return}this.mousedownEvent.time=Date.now();if(t&&!i.isFocused()){i.focus();if(this.$focusTimeout&&!this.$clickSelection&&!i.inMultiSelectMode){this.setState("focusWait"),this.captureMouse(e);return}}return this.captureMouse(e),this.startSelect(n,e.domEvent._clicks>1),e.preventDefault()},this.startSelect=function(e,t){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var n=this.editor;if(!this.mousedownEvent)return;this.mousedownEvent.getShiftKey()?n.selection.selectToPosition(e):t||n.selection.moveToPosition(e),t||this.select(),n.renderer.scroller.setCapture&&n.renderer.scroller.setCapture(),n.setStyle("ace_selecting"),this.setState("select")},this.select=function(){var e,t=this.editor,n=t.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var r=this.$clickSelection.comparePoint(n);if(r==-1)e=this.$clickSelection.end;else if(r==1)e=this.$clickSelection.start;else{var i=a(this.$clickSelection,n);n=i.cursor,e=i.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(n),t.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(e){var t,n=this.editor,r=n.renderer.screenToTextCoordinates(this.x,this.y),i=n.selection[e](r.row,r.column);if(this.$clickSelection){var s=this.$clickSelection.comparePoint(i.start),o=this.$clickSelection.comparePoint(i.end);if(s==-1&&o<=0){t=this.$clickSelection.end;if(i.end.row!=r.row||i.end.column!=r.column)r=i.start}else if(o==1&&s>=0){t=this.$clickSelection.start;if(i.start.row!=r.row||i.start.column!=r.column)r=i.end}else if(s==-1&&o==1)r=i.end,t=i.start;else{var u=a(this.$clickSelection,r);r=u.cursor,t=u.anchor}n.selection.setSelectionAnchor(t.row,t.column)}n.selection.selectToPosition(r),n.renderer.scrollCursorIntoView()},this.selectEnd=this.selectAllEnd=this.selectByWordsEnd=this.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting"),this.editor.renderer.scroller.releaseCapture&&this.editor.renderer.scroller.releaseCapture()},this.focusWait=function(){var e=u(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),t=Date.now();(e>i||t-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},this.onDoubleClick=function(e){var t=e.getDocumentPosition(),n=this.editor,r=n.session,i=r.getBracketRange(t);i?(i.isEmpty()&&(i.start.column--,i.end.column++),this.setState("select")):(i=n.selection.getWordRange(t.row,t.column),this.setState("selectByWords")),this.$clickSelection=i,this.select()},this.onTripleClick=function(e){var t=e.getDocumentPosition(),n=this.editor;this.setState("selectByLines");var r=n.getSelectionRange();r.isMultiLine()&&r.contains(t.row,t.column)?(this.$clickSelection=n.selection.getLineRange(r.start.row),this.$clickSelection.end=n.selection.getLineRange(r.end.row).end):this.$clickSelection=n.selection.getLineRange(t.row),this.select()},this.onQuadClick=function(e){var t=this.editor;t.selectAll(),this.$clickSelection=t.getSelectionRange(),this.setState("selectAll")},this.onMouseWheel=function(e){if(e.getAccelKey())return;e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var t=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var n=this.$lastScroll,r=e.domEvent.timeStamp,i=r-n.t,o=i?e.wheelX/i:n.vx,u=i?e.wheelY/i:n.vy;i=1&&t.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(f=!0),a<=1&&t.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(f=!0);if(f)n.allowed=r;else if(r-n.allowedt.session.documentToScreenRow(l.row,l.column))return c()}if(f==s)return;f=s.text.join("
    "),i.setHtml(f),i.show(),t._signal("showGutterTooltip",i),t.on("mousewheel",c);if(e.$tooltipFollowsMouse)h(u);else{var p=u.domEvent.target,d=p.getBoundingClientRect(),v=i.getElement().style;v.left=d.right+"px",v.top=d.bottom+"px"}}function c(){o&&(o=clearTimeout(o)),f&&(i.hide(),f=null,t._signal("hideGutterTooltip",i),t.removeEventListener("mousewheel",c))}function h(e){i.setPosition(e.x,e.y)}var t=e.editor,n=t.renderer.$gutterLayer,i=new a(t.container);e.editor.setDefaultHandler("guttermousedown",function(r){if(!t.isFocused()||r.getButton()!=0)return;var i=n.getRegion(r);if(i=="foldWidgets")return;var s=r.getDocumentPosition().row,o=t.session.selection;if(r.getShiftKey())o.selectTo(s,0);else{if(r.domEvent.detail==2)return t.selectAll(),r.preventDefault();e.$clickSelection=t.selection.getLineRange(s)}return e.setState("selectByLines"),e.captureMouse(r),r.preventDefault()});var o,u,f;e.editor.setDefaultHandler("guttermousemove",function(t){var n=t.domEvent.target||t.domEvent.srcElement;if(r.hasCssClass(n,"ace_fold-widget"))return c();f&&e.$tooltipFollowsMouse&&h(t),u=t;if(o)return;o=setTimeout(function(){o=null,u&&!e.isMousePressed?l():c()},50)}),s.addListener(t.renderer.$gutter,"mouseout",function(e){u=null;if(!f||o)return;o=setTimeout(function(){o=null,c()},50)}),t.on("changeSession",c)}function a(e){o.call(this,e)}var r=e("../lib/dom"),i=e("../lib/oop"),s=e("../lib/event"),o=e("../tooltip").Tooltip;i.inherits(a,o),function(){this.setPosition=function(e,t){var n=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,i=this.getWidth(),s=this.getHeight();e+=15,t+=15,e+i>n&&(e-=e+i-n),t+s>r&&(t-=20+s),o.prototype.setPosition.call(this,e,t)}}.call(a.prototype),t.GutterHandler=u}),ace.define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=t.MouseEvent=function(e,t){this.domEvent=e,this.editor=t,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1};(function(){this.stopPropagation=function(){r.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){r.preventDefault(this.domEvent),this.defaultPrevented=!0},this.stop=function(){this.stopPropagation(),this.preventDefault()},this.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},this.inSelection=function(){if(this.$inSelection!==null)return this.$inSelection;var e=this.editor,t=e.getSelectionRange();if(t.isEmpty())this.$inSelection=!1;else{var n=this.getDocumentPosition();this.$inSelection=t.contains(n.row,n.column)}return this.$inSelection},this.getButton=function(){return r.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=i.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(s.prototype)}),ace.define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";function f(e){function T(e,n){var r=Date.now(),i=!n||e.row!=n.row,s=!n||e.column!=n.column;if(!S||i||s)t.moveCursorToPosition(e),S=r,x={x:p,y:d};else{var o=l(x.x,x.y,p,d);o>a?S=null:r-S>=u&&(t.renderer.scrollCursorIntoView(),S=null)}}function N(e,n){var r=Date.now(),i=t.renderer.layerConfig.lineHeight,s=t.renderer.layerConfig.characterWidth,u=t.renderer.scroller.getBoundingClientRect(),a={x:{left:p-u.left,right:u.right-p},y:{top:d-u.top,bottom:u.bottom-d}},f=Math.min(a.x.left,a.x.right),l=Math.min(a.y.top,a.y.bottom),c={row:e.row,column:e.column};f/s<=2&&(c.column+=a.x.left=o&&t.renderer.scrollCursorIntoView(c):E=r:E=null}function C(){var e=g;g=t.renderer.screenToTextCoordinates(p,d),T(g,e),N(g,e)}function k(){m=t.selection.toOrientedRange(),h=t.session.addMarker(m,"ace_selection",t.getSelectionStyle()),t.clearSelection(),t.isFocused()&&t.renderer.$cursorLayer.setBlinking(!1),clearInterval(v),C(),v=setInterval(C,20),y=0,i.addListener(document,"mousemove",O)}function L(){clearInterval(v),t.session.removeMarker(h),h=null,t.selection.fromOrientedRange(m),t.isFocused()&&!w&&t.$resetCursorStyle(),m=null,g=null,y=0,E=null,S=null,i.removeListener(document,"mousemove",O)}function O(){A==null&&(A=setTimeout(function(){A!=null&&h&&L()},20))}function M(e){var t=e.types;return!t||Array.prototype.some.call(t,function(e){return e=="text/plain"||e=="Text"})}function _(e){var t=["copy","copymove","all","uninitialized"],n=["move","copymove","linkmove","all","uninitialized"],r=s.isMac?e.altKey:e.ctrlKey,i="uninitialized";try{i=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var o="none";return r&&t.indexOf(i)>=0?o="copy":n.indexOf(i)>=0?o="move":t.indexOf(i)>=0&&(o="copy"),o}var t=e.editor,n=r.createElement("img");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",s.isOpera&&(n.style.cssText="width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;");var f=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];f.forEach(function(t){e[t]=this[t]},this),t.addEventListener("mousedown",this.onMouseDown.bind(e));var c=t.container,h,p,d,v,m,g,y=0,b,w,E,S,x;this.onDragStart=function(e){if(this.cancelDrag||!c.draggable){var r=this;return setTimeout(function(){r.startSelect(),r.captureMouse(e)},0),e.preventDefault()}m=t.getSelectionRange();var i=e.dataTransfer;i.effectAllowed=t.getReadOnly()?"copy":"copyMove",s.isOpera&&(t.container.appendChild(n),n.scrollTop=0),i.setDragImage&&i.setDragImage(n,0,0),s.isOpera&&t.container.removeChild(n),i.clearData(),i.setData("Text",t.session.getTextRange()),w=!0,this.setState("drag")},this.onDragEnd=function(e){c.draggable=!1,w=!1,this.setState(null);if(!t.getReadOnly()){var n=e.dataTransfer.dropEffect;!b&&n=="move"&&t.session.remove(t.getSelectionRange()),t.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return p=e.clientX,d=e.clientY,h||k(),y++,e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragOver=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return p=e.clientX,d=e.clientY,h||(k(),y++),A!==null&&(A=null),e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragLeave=function(e){y--;if(y<=0&&h)return L(),b=null,i.preventDefault(e)},this.onDrop=function(e){if(!g)return;var n=e.dataTransfer;if(w)switch(b){case"move":m.contains(g.row,g.column)?m={start:g,end:g}:m=t.moveText(m,g);break;case"copy":m=t.moveText(m,g,!0)}else{var r=n.getData("Text");m={start:g,end:t.session.insert(g,r)},t.focus(),b=null}return L(),i.preventDefault(e)},i.addListener(c,"dragstart",this.onDragStart.bind(e)),i.addListener(c,"dragend",this.onDragEnd.bind(e)),i.addListener(c,"dragenter",this.onDragEnter.bind(e)),i.addListener(c,"dragover",this.onDragOver.bind(e)),i.addListener(c,"dragleave",this.onDragLeave.bind(e)),i.addListener(c,"drop",this.onDrop.bind(e));var A=null}function l(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}var r=e("../lib/dom"),i=e("../lib/event"),s=e("../lib/useragent"),o=200,u=200,a=5;(function(){this.dragWait=function(){var e=Date.now()-this.mousedownEvent.time;e>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var e=this.editor.container;e.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(e){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor,t=e.container;t.draggable=!0,e.renderer.$cursorLayer.setBlinking(!1),e.setStyle("ace_dragging");var n=s.isWin?"default":"move";e.renderer.setCursorStyle(n),this.setState("dragReady")},this.onMouseDrag=function(e){var t=this.editor.container;if(s.isIE&&this.state=="dragReady"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>3&&t.dragDrop()}if(this.state==="dragWait"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>0&&(t.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(!this.$dragEnabled)return;this.mousedownEvent=e;var t=this.editor,n=e.inSelection(),r=e.getButton(),i=e.domEvent.detail||1;if(i===1&&r===0&&n){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var o=e.domEvent.target||e.domEvent.srcElement;"unselectable"in o&&(o.unselectable="on");if(t.getDragDelay()){if(s.isWebKit){this.cancelDrag=!0;var u=t.container;u.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}).call(f.prototype),t.DragdropHandler=f}),ace.define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event"],function(e,t,n){"use strict";var r=e("./mouse_event").MouseEvent;t.addTouchListeners=function(e,t){function m(){a=null,clearTimeout(a),t.selection.isEmpty()&&t.selection.moveToPosition(c),n="wait"}function g(){a=null,clearTimeout(a),t.selection.moveToPosition(c);var e=h>=2?t.selection.getLineRange(c.row):t.session.getBracketRange(c);e&&!e.isEmpty()?t.selection.setRange(e):t.selection.selectWord(),n="wait"}function y(){l+=60,f=setInterval(function(){l--<=0&&(clearInterval(f),f=null),Math.abs(p)<.01&&(p=0),Math.abs(d)<.01&&(d=0),l<20&&(p=.9*p),l<20&&(d=.9*d),t.renderer.scrollBy(10*p,10*d)},10)}var n="scroll",i,s,o,u,a,f,l=0,c,h=0,p=0,d=0,v;e.addEventListener("contextmenu",function(e){if(!v)return;var n=t.textInput.getElement();n.focus()}),e.addEventListener("touchstart",function(e){var f=e.touches;if(a||f.length>1){clearTimeout(a),a=null,n="zoom";return}v=t.$mouseHandler.isMousePressed=!0;var y=f[0];i=y.clientX,s=y.clientY,p=d=0,e.clientX=y.clientX,e.clientY=y.clientY;var b=e.timeStamp;u=b;var w=new r(e,t);c=w.getDocumentPosition();if(b-o<500&&f.length==1&&!l)h++,e.preventDefault(),e.button=0,g();else{h=0,a=setTimeout(m,450);var E=t.selection.cursor,S=t.selection.isEmpty()?E:t.selection.anchor,x=t.renderer.$cursorLayer.getPixelPosition(E,!0),T=t.renderer.$cursorLayer.getPixelPosition(S,!0),N=t.renderer.scroller.getBoundingClientRect(),C=t.renderer.layerConfig.lineHeight,k=t.renderer.layerConfig.lineHeight,L=function(e,t){return e/=k,t=t/C-.75,e*e+t*t},A=L(e.clientX-N.left-x.left,e.clientY-N.top-x.top),O=L(e.clientX-N.left-T.left,e.clientY-N.top-T.top);A<3.5&&O<3.5&&(n=A>O?"cursor":"anchor"),O<3.5?n="anchor":A<3.5?n="cursor":n="scroll"}o=b}),e.addEventListener("touchend",function(e){v=t.$mouseHandler.isMousePressed=!1,f&&clearInterval(f),n=="zoom"?(n="",l=0):a?(t.selection.moveToPosition(c),l=0):n=="scroll"&&(y(),e.preventDefault()),clearTimeout(a),a=null}),e.addEventListener("touchmove",function(e){a&&(clearTimeout(a),a=null);var o=e.touches;if(o.length>1||n=="zoom")return;var f=o[0],l=i-f.clientX,c=s-f.clientY;if(n=="wait"){if(!(l*l+c*c>4))return e.preventDefault();n="cursor"}i=f.clientX,s=f.clientY,e.clientX=f.clientX,e.clientY=f.clientY;var h=e.timeStamp,v=h-u;u=h;if(n=="scroll"){var m=new r(e,t);m.speed=1,m.wheelX=l,m.wheelY=c,10*Math.abs(l)1&&(i=n[n.length-2]);var o=a[t+"Path"];return o==null?o=a.basePath:r=="/"&&(t=r=""),o&&o.slice(-1)!="/"&&(o+="/"),o+t+r+i+this.get("suffix")},t.setModuleUrl=function(e,t){return a.$moduleUrls[e]=t},t.$loading={},t.loadModule=function(n,r){var i,o;Array.isArray(n)&&(o=n[0],n=n[1]);try{i=e(n)}catch(u){}if(i&&!t.$loading[n])return r&&r(i);t.$loading[n]||(t.$loading[n]=[]),t.$loading[n].push(r);if(t.$loading[n].length>1)return;var a=function(){e([n],function(e){t._emit("load.module",{name:n,module:e});var r=t.$loading[n];t.$loading[n]=null,r.forEach(function(t){t&&t(e)})})};if(!t.get("packaged"))return a();s.loadScript(t.moduleUrl(n,o),a),f()};var f=function(){!a.basePath&&!a.workerPath&&!a.modePath&&!a.themePath&&!Object.keys(a.$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"),f=function(){})};t.init=l,t.version="1.4.5"}),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(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=e("./default_handlers").DefaultHandlers,o=e("./default_gutter_handler").GutterHandler,u=e("./mouse_event").MouseEvent,a=e("./dragdrop_handler").DragdropHandler,f=e("./touch_handler").addTouchListeners,l=e("../config"),c=function(e){var t=this;this.editor=e,new s(this),new o(this),new a(this);var n=function(t){var n=!document.hasFocus||!document.hasFocus()||!e.isFocused()&&document.activeElement==(e.textInput&&e.textInput.getElement());n&&window.focus(),e.focus()},u=e.renderer.getMouseEventTarget();r.addListener(u,"click",this.onMouseEvent.bind(this,"click")),r.addListener(u,"mousemove",this.onMouseMove.bind(this,"mousemove")),r.addMultiMouseDownListener([u,e.renderer.scrollBarV&&e.renderer.scrollBarV.inner,e.renderer.scrollBarH&&e.renderer.scrollBarH.inner,e.textInput&&e.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent"),r.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel")),f(e.container,e);var l=e.renderer.$gutter;r.addListener(l,"mousedown",this.onMouseEvent.bind(this,"guttermousedown")),r.addListener(l,"click",this.onMouseEvent.bind(this,"gutterclick")),r.addListener(l,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick")),r.addListener(l,"mousemove",this.onMouseEvent.bind(this,"guttermousemove")),r.addListener(u,"mousedown",n),r.addListener(l,"mousedown",n),i.isIE&&e.renderer.scrollBarV&&(r.addListener(e.renderer.scrollBarV.element,"mousedown",n),r.addListener(e.renderer.scrollBarH.element,"mousedown",n)),e.on("mousemove",function(n){if(t.state||t.$dragDelay||!t.$dragEnabled)return;var r=e.renderer.screenToTextCoordinates(n.x,n.y),i=e.session.selection.getRange(),s=e.renderer;!i.isEmpty()&&i.insideStart(r.row,r.column)?s.setCursorStyle("default"):s.setCursorStyle("")})};(function(){this.onMouseEvent=function(e,t){this.editor._emit(e,new u(t,this.editor))},this.onMouseMove=function(e,t){var n=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;if(!n||!n.length)return;this.editor._emit(e,new u(t,this.editor))},this.onMouseWheel=function(e,t){var n=new u(t,this.editor);n.speed=this.$scrollSpeed*2,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},this.setState=function(e){this.state=e},this.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var n=this.editor,s=this.editor.renderer;s.$isMousePressed=!0;var o=this,a=function(e){if(!e)return;if(i.isWebKit&&!e.which&&o.releaseMouse)return o.releaseMouse();o.x=e.clientX,o.y=e.clientY,t&&t(e),o.mouseEvent=new u(e,o.editor),o.$mouseMoved=!0},f=function(e){n.off("beforeEndOperation",c),clearInterval(h),l(),o[o.state+"End"]&&o[o.state+"End"](e),o.state="",o.isMousePressed=s.$isMousePressed=!1,s.$keepTextAreaAtCursor&&s.$moveTextAreaToCursor(),o.$onCaptureMouseMove=o.releaseMouse=null,e&&o.onMouseEvent("mouseup",e),n.endOperation()},l=function(){o[o.state]&&o[o.state](),o.$mouseMoved=!1};if(i.isOldIE&&e.domEvent.type=="dblclick")return setTimeout(function(){f(e)});var c=function(e){if(!o.releaseMouse)return;n.curOp.command.name&&n.curOp.selectionChanged&&(o[o.state+"End"]&&o[o.state+"End"](),o.state="",o.releaseMouse())};n.on("beforeEndOperation",c),n.startOperation({command:{name:"mouse"}}),o.$onCaptureMouseMove=a,o.releaseMouse=r.capture(this.editor.container,a,f);var h=setInterval(l,20)},this.releaseMouse=null,this.cancelContextMenu=function(){var e=function(t){if(t&&t.domEvent&&t.domEvent.type!="contextmenu")return;this.editor.off("nativecontextmenu",e),t&&t.domEvent&&r.stopEvent(t.domEvent)}.bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)}}).call(c.prototype),l.defineOptions(c.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:i.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),t.MouseHandler=c}),ace.define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";function i(e){e.on("click",function(t){var n=t.getDocumentPosition(),i=e.session,s=i.getFoldAt(n.row,n.column,1);s&&(t.getAccelKey()?i.removeFold(s):i.expandFold(s),t.stop());var o=t.domEvent&&t.domEvent.target;o&&r.hasCssClass(o,"ace_inline_button")&&r.hasCssClass(o,"ace_toggle_wrap")&&(i.setOption("wrap",!i.getUseWrapMode()),e.renderer.scrollCursorIntoView())}),e.on("gutterclick",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n=="foldWidgets"){var r=t.getDocumentPosition().row,i=e.session;i.foldWidgets&&i.foldWidgets[r]&&e.session.onFoldWidgetClick(r,t),e.isFocused()||e.focus(),t.stop()}}),e.on("gutterdblclick",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n=="foldWidgets"){var r=t.getDocumentPosition().row,i=e.session,s=i.getParentFoldRangeData(r,!0),o=s.range||s.firstRange;if(o){r=o.start.row;var u=i.getFoldAt(r,i.getLine(r).length,1);u?i.removeFold(u):(i.addFold("...",o),e.renderer.scrollCursorIntoView({row:o.start.row,column:0}))}t.stop()}})}var r=e("../lib/dom");t.FoldHandler=i}),ace.define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,t,n){"use strict";var r=e("../lib/keys"),i=e("../lib/event"),s=function(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)};(function(){this.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},this.setKeyboardHandler=function(e){var t=this.$handlers;if(t[t.length-1]==e)return;while(t[t.length-1]&&t[t.length-1]!=this.$defaultHandler)this.removeKeyboardHandler(t[t.length-1]);this.addKeyboardHandler(e,1)},this.addKeyboardHandler=function(e,t){if(!e)return;typeof e=="function"&&!e.handleKeyboard&&(e.handleKeyboard=e);var n=this.$handlers.indexOf(e);n!=-1&&this.$handlers.splice(n,1),t==undefined?this.$handlers.push(e):this.$handlers.splice(t,0,e),n==-1&&e.attach&&e.attach(this.$editor)},this.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return t==-1?!1:(this.$handlers.splice(t,1),e.detach&&e.detach(this.$editor),!0)},this.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},this.getStatusText=function(){var e=this.$data,t=e.editor;return this.$handlers.map(function(n){return n.getStatusText&&n.getStatusText(t,e)||""}).filter(Boolean).join(" ")},this.$callKeyboardHandlers=function(e,t,n,r){var s,o=!1,u=this.$editor.commands;for(var a=this.$handlers.length;a--;){s=this.$handlers[a].handleKeyboard(this.$data,e,t,n,r);if(!s||!s.command)continue;s.command=="null"?o=!0:o=u.exec(s.command,this.$editor,s.args,r),o&&r&&e!=-1&&s.passEvent!=1&&s.command.passEvent!=1&&i.stopEvent(r);if(o)break}return!o&&e==-1&&(s={command:"insertstring"},o=u.exec("insertstring",this.$editor,t)),o&&this.$editor._signal&&this.$editor._signal("keyboardActivity",s),o},this.onCommandKey=function(e,t,n){var i=r.keyCodeToString(n);this.$callKeyboardHandlers(t,i,n,e)},this.onTextInput=function(e){this.$callKeyboardHandlers(-1,e)}}).call(s.prototype),t.KeyBinding=s}),ace.define("ace/lib/bidiutil",["require","exports","module"],function(e,t,n){"use strict";function F(e,t,n,r){var i=s?d:p,c=null,h=null,v=null,m=0,g=null,y=null,b=-1,w=null,E=null,T=[];if(!r)for(w=0,r=[];w0)if(g==16){for(w=b;w-1){for(w=b;w=0;C--){if(r[C]!=N)break;t[C]=s}}}function I(e,t,n){if(o=e){u=i+1;while(u=e)u++;for(a=i,l=u-1;a=t.length||(o=n[r-1])!=b&&o!=w||(c=t[r+1])!=b&&c!=w)return E;return u&&(c=w),c==o?c:E;case k:o=r>0?n[r-1]:S;if(o==b&&r+10&&n[r-1]==b)return b;if(u)return E;p=r+1,h=t.length;while(p=1425&&d<=2303||d==64286;o=t[p];if(v&&(o==y||o==T))return y}if(r<1||(o=t[r-1])==S)return E;return n[r-1];case S:return u=!1,f=!0,s;case x:return l=!0,E;case O:case M:case D:case P:case _:u=!1;case H:return E}}function R(e){var t=e.charCodeAt(0),n=t>>8;return n==0?t>191?g:B[t]:n==5?/[\u0591-\u05f4]/.test(e)?y:g:n==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e)?A:/[\u0660-\u0669\u066b-\u066c]/.test(e)?w:t==1642?L:/[\u06f0-\u06f9]/.test(e)?b:T:n==32&&t<=8287?j[t&255]:n==254?t>=65136?T:E:E}function U(e){return e>="\u064b"&&e<="\u0655"}var r=["\u0621","\u0641"],i=["\u063a","\u064a"],s=0,o=0,u=!1,a=!1,f=!1,l=!1,c=!1,h=!1,p=[[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]],d=[[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]],v=0,m=1,g=0,y=1,b=2,w=3,E=4,S=5,x=6,T=7,N=8,C=9,k=10,L=11,A=12,O=13,M=14,_=15,D=16,P=17,H=18,B=[H,H,H,H,H,H,H,H,H,x,S,x,N,S,H,H,H,H,H,H,H,H,H,H,H,H,H,H,S,S,S,x,N,E,E,L,L,L,E,E,E,E,E,k,C,k,C,C,b,b,b,b,b,b,b,b,b,b,C,E,E,E,E,E,E,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,E,E,E,E,E,E,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,E,E,E,E,H,H,H,H,H,H,S,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,C,E,L,L,L,L,E,E,E,E,g,E,E,H,E,E,L,L,b,b,E,g,E,E,E,b,g,E,E,E,E,E],j=[N,N,N,N,N,N,N,N,N,N,N,H,H,H,g,y,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,N,S,O,M,_,D,P,C,L,L,L,L,L,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,C,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,N];t.L=g,t.R=y,t.EN=b,t.ON_R=3,t.AN=4,t.R_H=5,t.B=6,t.RLE=7,t.DOT="\u00b7",t.doBidiReorder=function(e,n,r){if(e.length<2)return{};var i=e.split(""),o=new Array(i.length),u=new Array(i.length),a=[];s=r?m:v,F(i,a,i.length,n);for(var f=0;fT&&n[f]0&&i[f-1]==="\u0644"&&/\u0622|\u0623|\u0625|\u0627/.test(i[f])&&(a[f-1]=a[f]=t.R_H,f++);i[i.length-1]===t.DOT&&(a[i.length-1]=t.B),i[0]==="\u202b"&&(a[0]=t.RLE);for(var f=0;f=0&&(e=this.session.$docRowCache[n])}return e},this.getSplitIndex=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var n,r=this.session.$getRowCacheIndex(t,this.currentRow);while(this.currentRow-e>0){n=this.session.$getRowCacheIndex(t,this.currentRow-e-1);if(n!==r)break;r=n,e++}}else e=this.currentRow;return e},this.updateRowLine=function(e,t){e===undefined&&(e=this.getDocumentRow());var n=e===this.session.getLength()-1,s=n?this.EOF:this.EOL;this.wrapIndent=0,this.line=this.session.getLine(e),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE;if(this.session.$useWrapMode){var o=this.session.$wrapData[e];o&&(t===undefined&&(t=this.getSplitIndex()),t>0&&o.length?(this.wrapIndent=o.indent,this.wrapOffset=this.wrapIndent*this.charWidths[r.L],this.line=tt?this.session.getOverwrite()?e:e-1:t,i=r.getVisualFromLogicalIdx(n,this.bidiMap),s=this.bidiMap.bidiLevels,o=0;!this.session.getOverwrite()&&e<=t&&s[i]%2!==0&&i++;for(var u=0;ut&&s[i]%2===0&&(o+=this.charWidths[s[i]]),this.wrapIndent&&(o+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(o+=this.rtlLineOffset),o},this.getSelections=function(e,t){var n=this.bidiMap,r=n.bidiLevels,i,s=[],o=0,u=Math.min(e,t)-this.wrapIndent,a=Math.max(e,t)-this.wrapIndent,f=!1,l=!1,c=0;this.wrapIndent&&(o+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var h,p=0;p=u&&hn+s/2){n+=s;if(r===i.length-1){s=0;break}s=this.charWidths[i[++r]]}return r>0&&i[r-1]%2!==0&&i[r]%2===0?(e0&&i[r-1]%2===0&&i[r]%2!==0?t=1+(e>n?this.bidiMap.logicalFromVisual[r]:this.bidiMap.logicalFromVisual[r-1]):this.isRtlDir&&r===i.length-1&&s===0&&i[r-1]%2===0||!this.isRtlDir&&r===0&&i[r]%2!==0?t=1+this.bidiMap.logicalFromVisual[r]:(r>0&&i[r-1]%2!==0&&s!==0&&r--,t=this.bidiMap.logicalFromVisual[r]),t===0&&this.isRtlDir&&t++,t+this.wrapIndent}}).call(o.prototype),t.BidiHandler=o}),ace.define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/lang"),s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=function(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var t=this;this.cursor.on("change",function(e){t.$cursorChanged=!0,t.$silent||t._emit("changeCursor"),!t.$isEmpty&&!t.$silent&&t._emit("changeSelection"),!t.$keepDesiredColumnOnChange&&e.old.column!=e.value.column&&(t.$desiredColumn=null)}),this.anchor.on("change",function(){t.$anchorChanged=!0,!t.$isEmpty&&!t.$silent&&t._emit("changeSelection")})};(function(){r.implement(this,s),this.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},this.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},this.getCursor=function(){return this.lead.getPosition()},this.setSelectionAnchor=function(e,t){this.$isEmpty=!1,this.anchor.setPosition(e,t)},this.getAnchor=this.getSelectionAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},this.getSelectionLead=function(){return this.lead.getPosition()},this.isBackwards=function(){var e=this.anchor,t=this.lead;return e.row>t.row||e.row==t.row&&e.column>t.column},this.getRange=function(){var e=this.anchor,t=this.lead;return this.$isEmpty?o.fromPoints(t,t):this.isBackwards()?o.fromPoints(t,e):o.fromPoints(e,t)},this.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},this.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},this.setRange=this.setSelectionRange=function(e,t){var n=t?e.end:e.start,r=t?e.start:e.end;this.$setSelection(n.row,n.column,r.row,r.column)},this.$setSelection=function(e,t,n,r){var i=this.$isEmpty,s=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,t),this.cursor.setPosition(n,r),this.$isEmpty=!o.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||i!=this.$isEmpty||s)&&this._emit("changeSelection")},this.$moveSelection=function(e){var t=this.lead;this.$isEmpty&&this.setSelectionAnchor(t.row,t.column),e.call(this)},this.selectTo=function(e,t){this.$moveSelection(function(){this.moveCursorTo(e,t)})},this.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},this.moveTo=function(e,t){this.clearSelection(),this.moveCursorTo(e,t)},this.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},this.selectUp=function(){this.$moveSelection(this.moveCursorUp)},this.selectDown=function(){this.$moveSelection(this.moveCursorDown)},this.selectRight=function(){this.$moveSelection(this.moveCursorRight)},this.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},this.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},this.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},this.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},this.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},this.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},this.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},this.getWordRange=function(e,t){if(typeof t=="undefined"){var n=e||this.lead;e=n.row,t=n.column}return this.session.getWordRange(e,t)},this.selectWord=function(){this.setSelectionRange(this.getWordRange())},this.selectAWord=function(){var e=this.getCursor(),t=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(t)},this.getLineRange=function(e,t){var n=typeof e=="number"?e:this.lead.row,r,i=this.session.getFoldLine(n);return i?(n=i.start.row,r=i.end.row):r=n,t===!0?new o(n,0,r,this.session.getLine(r).length):new o(n,0,r+1,0)},this.selectLine=function(){this.setSelectionRange(this.getLineRange())},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.wouldMoveIntoSoftTab=function(e,t,n){var r=e.column,i=e.column+t;return n<0&&(r=e.column-t,i=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(r,i).split(" ").length-1==t},this.moveCursorLeft=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,-1))this.moveCursorTo(t.start.row,t.start.column);else if(e.column===0)e.row>0&&this.moveCursorTo(e.row-1,this.doc.getLine(e.row-1).length);else{var n=this.session.getTabSize();this.wouldMoveIntoSoftTab(e,n,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-n):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,1))this.moveCursorTo(t.end.row,t.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row0&&(t.column=r)}}this.moveCursorTo(t.row,t.column)},this.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,t=this.doc.getLine(e).length;this.moveCursorTo(e,t)},this.moveCursorFileStart=function(){this.moveCursorTo(0,0)},this.moveCursorLongWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var i=this.session.getFoldAt(e,t,1);if(i){this.moveCursorTo(i.end.row,i.end.column);return}this.session.nonTokenRe.exec(r)&&(t+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,r=n.substring(t));if(t>=n.length){this.moveCursorTo(e,n.length),this.moveCursorRight(),e0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(s)&&(t-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,t)},this.$shortWordEndIndex=function(e){var t=0,n,r=/\s/,i=this.session.tokenRe;i.lastIndex=0;if(this.session.tokenRe.exec(e))t=this.session.tokenRe.lastIndex;else{while((n=e[t])&&r.test(n))t++;if(t<1){i.lastIndex=0;while((n=e[t])&&!i.test(n)){i.lastIndex=0,t++;if(r.test(n)){if(t>2){t--;break}while((n=e[t])&&r.test(n))t++;if(t>2)break}}}}return i.lastIndex=0,t},this.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t),i=this.session.getFoldAt(e,t,1);if(i)return this.moveCursorTo(i.end.row,i.end.column);if(t==n.length){var s=this.doc.getLength();do e++,r=this.doc.getLine(e);while(e0&&/^\s*$/.test(r));t=r.length,/\s+$/.test(r)||(r="")}var s=i.stringReverse(r),o=this.$shortWordEndIndex(s);return this.moveCursorTo(e,t-o)},this.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},this.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},this.moveCursorBy=function(e,t){var n=this.session.documentToScreenPosition(this.lead.row,this.lead.column),r;t===0&&(e!==0&&(this.session.$bidiHandler.isBidiRow(n.row,this.lead.row)?(r=this.session.$bidiHandler.getPosLeft(n.column),n.column=Math.round(r/this.session.$bidiHandler.charWidths[0])):r=n.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?n.column=this.$desiredColumn:this.$desiredColumn=n.column);var i=this.session.screenToDocumentPosition(n.row+e,n.column,r);e!==0&&t===0&&i.row===this.lead.row&&i.column===this.lead.column&&this.session.lineWidgets&&this.session.lineWidgets[i.row]&&(i.row>0||e>0)&&i.row++,this.moveCursorTo(i.row,i.column+t,t===0)},this.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},this.moveCursorTo=function(e,t,n){var r=this.session.getFoldAt(e,t,1);r&&(e=r.start.row,t=r.start.column),this.$keepDesiredColumnOnChange=!0;var i=this.session.getLine(e);/[\uDC00-\uDFFF]/.test(i.charAt(t))&&i.charAt(t-1)&&(this.lead.row==e&&this.lead.column==t+1?t-=1:t+=1),this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,n||(this.$desiredColumn=null)},this.moveCursorToScreen=function(e,t,n){var r=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(r.row,r.column,n)},this.detach=function(){this.lead.detach(),this.anchor.detach(),this.session=this.doc=null},this.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},this.toOrientedRange=function(e){var t=this.getRange();return e?(e.start.column=t.start.column,e.start.row=t.start.row,e.end.column=t.end.column,e.end.row=t.end.row):e=t,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},this.getRangeOfMovements=function(e){var t=this.getCursor();try{e(this);var n=this.getCursor();return o.fromPoints(t,n)}catch(r){return o.fromPoints(t,t)}finally{this.moveCursorToPosition(t)}},this.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var t=e.clone();return t.isBackwards=e.cursor==e.start,t});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},this.fromJSON=function(e){if(e.start==undefined){if(this.rangeList&&e.length>1){this.toSingleRange(e[0]);for(var t=e.length;t--;){var n=o.fromPoints(e[t].start,e[t].end);e[t].isBackwards&&(n.cursor=n.start),this.addRange(n,!0)}return}e=e[0]}this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},this.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var t=this.ranges.length;t--;)if(!this.ranges[t].isEqual(e[t]))return!1;return!0}}).call(u.prototype),t.Selection=u}),ace.define("ace/tokenizer",["require","exports","module","ace/config"],function(e,t,n){"use strict";var r=e("./config"),i=2e3,s=function(e){this.states=e,this.regExps={},this.matchMappings={};for(var t in this.states){var n=this.states[t],r=[],i=0,s=this.matchMappings[t]={defaultToken:"text"},o="g",u=[];for(var a=0;a1?f.onMatch=this.$applyToken:f.onMatch=f.token),c>1&&(/\\\d/.test(f.regex)?l=f.regex.replace(/\\([0-9]+)/g,function(e,t){return"\\"+(parseInt(t,10)+i+1)}):(c=1,l=this.removeCapturingGroups(f.regex)),!f.splitRegex&&typeof f.token!="string"&&u.push(f)),s[i]=a,i+=c,r.push(l),f.onMatch||(f.onMatch=null)}r.length||(s[0]=0,r.push("$")),u.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,o)},this),this.regExps[t]=new RegExp("("+r.join(")|(")+")|($)",o)}};(function(){this.$setMaxTokenCount=function(e){i=e|0},this.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),n=this.token.apply(this,t);if(typeof n=="string")return[{type:n,value:e}];var r=[];for(var i=0,s=n.length;il){var g=e.substring(l,m-v.length);h.type==p?h.value+=g:(h.type&&f.push(h),h={type:p,value:g})}for(var y=0;yi){c>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:t,line:e});while(l1&&n[0]!==r&&n.unshift("#tmp",r),{tokens:f,state:n.length?n:r}},this.reportError=r.reportError}).call(s.prototype),t.Tokenizer=s}),ace.define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../lib/lang"),i=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}};(function(){this.addRules=function(e,t){if(!t){for(var n in e)this.$rules[n]=e[n];return}for(var n in e){var r=e[n];for(var i=0;i=this.$rowTokens.length){this.$row+=1,e||(e=this.$session.getLength());if(this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},this.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},this.getCurrentTokenRow=function(){return this.$row},this.getCurrentTokenColumn=function(){var e=this.$rowTokens,t=this.$tokenIndex,n=e[t].start;if(n!==undefined)return n;n=0;while(t>0)t-=1,n+=e[t].value.length;return n},this.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},this.getCurrentTokenRange=function(){var e=this.$rowTokens[this.$tokenIndex],t=this.getCurrentTokenColumn();return new r(this.$row,t,this.$row,t+e.value.length)}}).call(i.prototype),t.TokenIterator=i}),ace.define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("../../token_iterator").TokenIterator,o=e("../../lib/lang"),u=["text","paren.rparen","punctuation.operator"],a=["text","paren.rparen","punctuation.operator","comment"],f,l={},c={'"':'"',"'":"'"},h=function(e){var t=-1;e.multiSelect&&(t=e.selection.index,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},p=function(e,t,n,r){var i=e.end.row-e.start.row;return{text:n+t+r,selection:[0,e.start.column+1,i,e.end.column+(i?0:1)]}},d=function(e){this.add("braces","insertion",function(t,n,r,i,s){var u=r.getCursorPosition(),a=i.doc.getLine(u.row);if(s=="{"){h(r);var l=r.getSelectionRange(),c=i.doc.getTextRange(l);if(c!==""&&c!=="{"&&r.getWrapBehavioursEnabled())return p(l,c,"{","}");if(d.isSaneInsertion(r,i))return/[\]\}\)]/.test(a[u.column])||r.inMultiSelectMode||e&&e.braces?(d.recordAutoInsert(r,i,"}"),{text:"{}",selection:[1,1]}):(d.recordMaybeInsert(r,i,"{"),{text:"{",selection:[1,1]})}else if(s=="}"){h(r);var v=a.substring(u.column,u.column+1);if(v=="}"){var m=i.$findOpeningBracket("}",{column:u.column+1,row:u.row});if(m!==null&&d.isAutoInsertedClosing(u,a,s))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else{if(s=="\n"||s=="\r\n"){h(r);var g="";d.isMaybeInsertedClosing(u,a)&&(g=o.stringRepeat("}",f.maybeInsertedBrackets),d.clearMaybeInsertedClosing());var v=a.substring(u.column,u.column+1);if(v==="}"){var y=i.findMatchingBracket({row:u.row,column:u.column+1},"}");if(!y)return null;var b=this.$getIndent(i.getLine(y.row))}else{if(!g){d.clearMaybeInsertedClosing();return}var b=this.$getIndent(a)}var w=b+i.getTabString();return{text:"\n"+w+"\n"+b+g,selection:[1,w.length,1,w.length]}}d.clearMaybeInsertedClosing()}}),this.add("braces","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="{"){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u=="}")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,t,n,r,i){if(i=="("){h(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return p(s,o,"(",")");if(d.isSaneInsertion(n,r))return d.recordAutoInsert(n,r,")"),{text:"()",selection:[1,1]}}else if(i==")"){h(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==")"){var l=r.$findOpeningBracket(")",{column:u.column+1,row:u.row});if(l!==null&&d.isAutoInsertedClosing(u,a,i))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="("){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==")")return i.end.column++,i}}),this.add("brackets","insertion",function(e,t,n,r,i){if(i=="["){h(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return p(s,o,"[","]");if(d.isSaneInsertion(n,r))return d.recordAutoInsert(n,r,"]"),{text:"[]",selection:[1,1]}}else if(i=="]"){h(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f=="]"){var l=r.$findOpeningBracket("]",{column:u.column+1,row:u.row});if(l!==null&&d.isAutoInsertedClosing(u,a,i))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="["){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u=="]")return i.end.column++,i}}),this.add("string_dquotes","insertion",function(e,t,n,r,i){var s=r.$mode.$quotes||c;if(i.length==1&&s[i]){if(this.lineCommentStart&&this.lineCommentStart.indexOf(i)!=-1)return;h(n);var o=i,u=n.getSelectionRange(),a=r.doc.getTextRange(u);if(a!==""&&(a.length!=1||!s[a])&&n.getWrapBehavioursEnabled())return p(u,a,o,o);if(!a){var f=n.getCursorPosition(),l=r.doc.getLine(f.row),d=l.substring(f.column-1,f.column),v=l.substring(f.column,f.column+1),m=r.getTokenAt(f.row,f.column),g=r.getTokenAt(f.row,f.column+1);if(d=="\\"&&m&&/escape/.test(m.type))return null;var y=m&&/string|escape/.test(m.type),b=!g||/string|escape/.test(g.type),w;if(v==o)w=y!==b,w&&/string\.end/.test(g.type)&&(w=!1);else{if(y&&!b)return null;if(y&&b)return null;var E=r.$mode.tokenRe;E.lastIndex=0;var S=E.test(d);E.lastIndex=0;var x=E.test(d);if(S||x)return null;if(v&&!/[\s;,.})\]\\]/.test(v))return null;var T=l[f.column-2];if(!(d!=o||T!=o&&!E.test(T)))return null;w=!0}return{text:w?o+o:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,n,r,i){var s=r.$mode.$quotes||c,o=r.doc.getTextRange(i);if(!i.isMultiLine()&&s.hasOwnProperty(o)){h(n);var u=r.doc.getLine(i.start.row),a=u.substring(i.start.column+1,i.start.column+2);if(a==o)return i.end.column++,i}})};d.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||"text",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||"text",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||"text",a)},d.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},d.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},d.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},d.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},d.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},d.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},d.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(d,i),t.CstyleBehaviour=d}),ace.define("ace/unicode",["require","exports","module"],function(e,t,n){"use strict";var r=[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],i=0,s=[];for(var o=0;o2?r%f!=f-1:r%f==0}}var E=Infinity;w(function(e,t){var n=e.search(/\S/);n!==-1?(ne.length&&(E=e.length)}),u==Infinity&&(u=E,s=!1,o=!1),l&&u%f!=0&&(u=Math.floor(u/f)*f),w(o?m:v)},this.toggleBlockComment=function(e,t,n,r){var i=this.blockComment;if(!i)return;!i.start&&i[0]&&(i=i[0]);var s=new f(t,r.row,r.column),o=s.getCurrentToken(),u=t.selection,a=t.selection.toOrientedRange(),c,h;if(o&&/comment/.test(o.type)){var p,d;while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.start);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;p=new l(m,g,m,g+i.start.length);break}o=s.stepBackward()}var s=new f(t,r.row,r.column),o=s.getCurrentToken();while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.end);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;d=new l(m,g,m,g+i.end.length);break}o=s.stepForward()}d&&t.remove(d),p&&(t.remove(p),c=p.start.row,h=-i.start.length)}else h=i.start.length,c=n.start.row,t.insert(n.end,i.end),t.insert(n.start,i.start);a.start.row==c&&(a.start.column+=h),a.end.row==c&&(a.end.column+=h),t.selection.fromOrientedRange(a)},this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.autoOutdent=function(e,t,n){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){this.$embeds=[],this.$modes={};for(var t in e)if(e[t]){var n=e[t],i=n.prototype.$id,s=r.$modes[i];s||(r.$modes[i]=s=new n),r.$modes[t]||(r.$modes[t]=s),this.$embeds.push(t),this.$modes[t]=s}var o=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"];for(var t=0;t=0&&t.row=0&&t.column<=e[t.row].length}function s(e,t){t.action!="insert"&&t.action!="remove"&&r(t,"delta.action must be 'insert' or 'remove'"),t.lines instanceof Array||r(t,"delta.lines must be an Array"),(!t.start||!t.end)&&r(t,"delta.start/end must be an present");var n=t.start;i(e,t.start)||r(t,"delta.start must be contained in document");var s=t.end;t.action=="remove"&&!i(e,s)&&r(t,"delta.end must contained in document for 'remove' actions");var o=s.row-n.row,u=s.column-(o==0?n.column:0);(o!=t.lines.length-1||t.lines[o].length!=u)&&r(t,"delta.range must match delta lines")}t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,s=e[r]||"";switch(t.action){case"insert":var o=t.lines;if(o.length===1)e[r]=s.substring(0,i)+t.lines[0]+s.substring(i);else{var u=[r,1].concat(t.lines);e.splice.apply(e,u),e[r]=s.substring(0,i)+e[r],e[r+t.lines.length-1]+=s.substring(i)}break;case"remove":var a=t.end.column,f=t.end.row;r===f?e[r]=s.substring(0,i)+s.substring(a):e.splice(r,f-r+1,s.substring(0,i)+e[f].substring(a))}}}),ace.define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n=="undefined"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){function e(e,t,n){var r=n?e.column<=t.column:e.columnthis.row)return;var n=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),ace.define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=e("./anchor").Anchor,a=function(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new u(this,e,t)},"aaa".split(/a/).length===0?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal("changeNewLineMode")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e=="\r\n"||e=="\r"||e=="\n"},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();e===undefined?e=n:e<0?e=0:e>=n&&(e=n-1,t=undefined);var r=this.getLine(e);return t==undefined&&(t=r.length),t=Math.min(Math.max(t,0),r.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e0,r=t=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){e instanceof o||(e=o.fromPoints(e.start,e.end));if(t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var n;return t?n=this.insert(e.start,t):n=e.start,n},this.applyDeltas=function(e){for(var t=0;t=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n=e.action=="insert";if(n?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))return;n&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(i(this.$lines,e,t),this._signal("change",e))},this.$splitAndapplyLargeDelta=function(e,t){var n=e.lines,r=n.length-t+1,i=e.start.row,s=e.start.column;for(var o=0,u=0;o20){n.running=setTimeout(n.$worker,20);break}}n.currentLine=t,r==-1&&(r=t),s<=r&&n.fireUpdateEvent(s,r)}};(function(){r.implement(this,i),this.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},this.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},this.fireUpdateEvent=function(e,t){var n={first:e,last:t};this._signal("update",{data:n})},this.start=function(e){this.currentLine=Math.min(e||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)},this.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},this.$updateOnChange=function(e){var t=e.start.row,n=e.end.row-t;if(n===0)this.lines[t]=null;else if(e.action=="remove")this.lines.splice(t,n+1,null),this.states.splice(t,n+1,null);else{var r=Array(n+1);r.unshift(t,1),this.lines.splice.apply(this.lines,r),this.states.splice.apply(this.states,r)}this.currentLine=Math.min(t,this.currentLine,this.doc.getLength()),this.stop()},this.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},this.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},this.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},this.$tokenizeRow=function(e){var t=this.doc.getLine(e),n=this.states[e-1],r=this.tokenizer.getLineTokens(t,n,e);return this.states[e]+""!=r.state+""?(this.states[e]=r.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=r.tokens}}).call(s.prototype),t.BackgroundTokenizer=s}),ace.define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./range").Range,o=function(e,t,n){this.setRegexp(e),this.clazz=t,this.type=n||"text"};(function(){this.MAX_RANGES=500,this.setRegexp=function(e){if(this.regExp+""==e+"")return;this.regExp=e,this.cache=[]},this.update=function(e,t,n,i){if(!this.regExp)return;var o=i.firstRow,u=i.lastRow;for(var a=o;a<=u;a++){var f=this.cache[a];f==null&&(f=r.getMatchOffsets(n.getLine(a),this.regExp),f.length>this.MAX_RANGES&&(f=f.slice(0,this.MAX_RANGES)),f=f.map(function(e){return new s(a,e.offset,a,e.offset+e.length)}),this.cache[a]=f.length?f:"");for(var l=f.length;l--;)t.drawSingleLineMarker(e,f[l].toScreenRange(n),this.clazz,i)}}}).call(o.prototype),t.SearchHighlight=o}),ace.define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,t,n){"use strict";function i(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var n=t[t.length-1];this.range=new r(t[0].start.row,t[0].start.column,n.end.row,n.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}var r=e("../range").Range;(function(){this.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(t){t.start.row+=e,t.end.row+=e})},this.addFold=function(e){if(e.sameRow){if(e.start.rowthis.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort(function(e,t){return-e.range.compareEnd(t.start.row,t.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):this.range.compareStart(e.end.row,e.end.column)<0&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else{if(e.end.row!=this.start.row)throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column}e.foldLine=this},this.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},this.walk=function(e,t,n){var r=0,i=this.folds,s,o,u,a=!0;t==null&&(t=this.end.row,n=this.end.column);for(var f=0;f0)continue;var a=i(e,o.start);return u===0?t&&a!==0?-s-2:s:a>0||a===0&&!t?s:-s-1}return-s-1},this.add=function(e){var t=!e.isEmpty(),n=this.pointIndex(e.start,t);n<0&&(n=-n-1);var r=this.pointIndex(e.end,t,n);return r<0?r=-r-1:r++,this.ranges.splice(n,r-n,e)},this.addList=function(e){var t=[];for(var n=e.length;n--;)t.push.apply(t,this.add(e[n]));return t},this.substractPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges.splice(t,1)},this.merge=function(){var e=[],t=this.ranges;t=t.sort(function(e,t){return i(e.start,t.start)});var n=t[0],r;for(var s=1;s=0},this.containsPoint=function(e){return this.pointIndex(e)>=0},this.rangeAtPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges[t]},this.clipRows=function(e,t){var n=this.ranges;if(n[0].start.row>t||n[n.length-1].start.row=r)break}if(e.action=="insert"){var f=i-r,l=-t.column+n.column;for(;or)break;a.start.row==r&&a.start.column>=t.column&&(a.start.column!=t.column||!this.$insertRight)&&(a.start.column+=l,a.start.row+=f);if(a.end.row==r&&a.end.column>=t.column){if(a.end.column==t.column&&this.$insertRight)continue;a.end.column==t.column&&l>0&&oa.start.column&&a.end.column==s[o+1].start.column&&(a.end.column-=l),a.end.column+=l,a.end.row+=f}}}else{var f=r-i,l=t.column-n.column;for(;oi)break;if(a.end.rowt.column)a.end.column=t.column,a.end.row=t.row}else a.end.column+=l,a.end.row+=f;else a.end.row>i&&(a.end.row+=f);if(a.start.rowt.column)a.start.column=t.column,a.start.row=t.row}else a.start.column+=l,a.start.row+=f;else a.start.row>i&&(a.start.row+=f)}}if(f!=0&&o=e)return i;if(i.end.row>e)return null}return null},this.getNextFoldLine=function(e,t){var n=this.$foldData,r=0;t&&(r=n.indexOf(t)),r==-1&&(r=0);for(r;r=e)return i}return null},this.getFoldedRowCount=function(e,t){var n=this.$foldData,r=t-e+1;for(var i=0;i=t){u=e?r-=t-u:r=0);break}o>=e&&(u>=e?r-=o-u:r-=o-e+1)}return r},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,t){return e.start.row-t.start.row}),e},this.addFold=function(e,t){var n=this.$foldData,r=!1,o;e instanceof s?o=e:(o=new s(t,e),o.collapseChildren=t.collapseChildren),this.$clipRangeToDocument(o.range);var u=o.start.row,a=o.start.column,f=o.end.row,l=o.end.column,c=this.getFoldAt(u,a,1),h=this.getFoldAt(f,l,-1);if(c&&h==c)return c.addSubFold(o);c&&!c.range.isStart(u,a)&&this.removeFold(c),h&&!h.range.isEnd(f,l)&&this.removeFold(h);var p=this.getFoldsInRange(o.range);p.length>0&&(this.removeFolds(p),p.forEach(function(e){o.addSubFold(e)}));for(var d=0;d0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,t){var n,i;e==null?(n=new r(0,0,this.getLength(),0),t=!0):typeof e=="number"?n=new r(e,0,e,this.getLine(e).length):"row"in e?n=r.fromPoints(e,e):n=e,i=this.getFoldsInRangeList(n);if(t)this.removeFolds(i);else{var s=i;while(s.length)this.expandFolds(s),s=this.getFoldsInRangeList(n)}if(i.length)return i},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var n=this.getFoldLine(e,t);return n?n.end.row:e},this.getRowFoldStart=function(e,t){var n=this.getFoldLine(e,t);return n?n.start.row:e},this.getFoldDisplayLine=function(e,t,n,r,i){r==null&&(r=e.start.row),i==null&&(i=0),t==null&&(t=e.end.row),n==null&&(n=this.getLine(t).length);var s=this.doc,o="";return e.walk(function(e,t,n,u){if(tl)break}while(s&&a.test(s.type));s=i.stepBackward()}else s=i.getCurrentToken();return f.end.row=i.getCurrentTokenRow(),f.end.column=i.getCurrentTokenColumn()+s.value.length-2,f}},this.foldAll=function(e,t,n){n==undefined&&(n=1e5);var r=this.foldWidgets;if(!r)return;t=t||this.getLength(),e=e||0;for(var i=e;i=e){i=s.end.row;try{var o=this.addFold("...",s);o&&(o.collapseChildren=n)}catch(u){}}}},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle="markbegin",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw new Error("invalid fold style: "+e+"["+Object.keys(this.$foldStyles).join(", ")+"]");if(this.$foldStyle==e)return;this.$foldStyle=e,e=="manual"&&this.unfold();var t=this.$foldMode;this.$setFolding(null),this.$setFolding(t)},this.$setFolding=function(e){if(this.$foldMode==e)return;this.$foldMode=e,this.off("change",this.$updateFoldWidgets),this.off("tokenizerUpdate",this.$tokenizerUpdateFoldWidgets),this._signal("changeAnnotation");if(!e||this.$foldStyle=="manual"){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,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(e,t){var n=this.foldWidgets;if(!n||t&&n[e])return{};var r=e-1,i;while(r>=0){var s=n[r];s==null&&(s=n[r]=this.getFoldWidget(r));if(s=="start"){var o=this.getFoldWidgetRange(r);i||(i=o);if(o&&o.end.row>=e)break}r--}return{range:r!==-1&&o,firstRange:i}},this.onFoldWidgetClick=function(e,t){t=t.domEvent;var n={children:t.shiftKey,all:t.ctrlKey||t.metaKey,siblings:t.altKey},r=this.$toggleFoldWidget(e,n);if(!r){var i=t.target||t.srcElement;i&&/ace_fold-widget/.test(i.className)&&(i.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,t){if(!this.getFoldWidget)return;var n=this.getFoldWidget(e),r=this.getLine(e),i=n==="end"?-1:1,s=this.getFoldAt(e,i===-1?0:r.length,i);if(s)return t.children||t.all?this.removeFold(s):this.expandFold(s),s;var o=this.getFoldWidgetRange(e,!0);if(o&&!o.isMultiLine()){s=this.getFoldAt(o.start.row,o.start.column,1);if(s&&o.isEqual(s.range))return this.removeFold(s),s}if(t.siblings){var u=this.getParentFoldRangeData(e);if(u.range)var a=u.range.start.row+1,f=u.range.end.row;this.foldAll(a,f,t.all?1e4:0)}else t.children?(f=o?o.end.row:this.getLength(),this.foldAll(e+1,f,t.all?1e4:0)):o&&(t.all&&(o.collapseChildren=1e4),this.addFold("...",o));return o},this.toggleFoldWidget=function(e){var t=this.selection.getCursor().row;t=this.getRowFoldStart(t);var n=this.$toggleFoldWidget(t,{});if(n)return;var r=this.getParentFoldRangeData(t,!0);n=r.range||r.firstRange;if(n){t=n.start.row;var i=this.getFoldAt(t,this.getLine(t).length,1);i?this.removeFold(i):this.addFold("...",n)}},this.updateFoldWidgets=function(e){var t=e.start.row,n=e.end.row-t;if(n===0)this.foldWidgets[t]=null;else if(e.action=="remove")this.foldWidgets.splice(t,n+1,null);else{var r=Array(n+1);r.unshift(t,1),this.foldWidgets.splice.apply(this.foldWidgets,r)}},this.tokenizerUpdateFoldWidgets=function(e){var t=e.data;t.first!=t.last&&this.foldWidgets.length>t.first&&this.foldWidgets.splice(t.first,this.foldWidgets.length)}}var r=e("../range").Range,i=e("./fold_line").FoldLine,s=e("./fold").Fold,o=e("../token_iterator").TokenIterator;t.Folding=u}),ace.define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(e,t,n){"use strict";function s(){this.findMatchingBracket=function(e,t){if(e.column==0)return null;var n=t||this.getLine(e.row).charAt(e.column-1);if(n=="")return null;var r=n.match(/([\(\[\{])|([\)\]\}])/);return r?r[1]?this.$findClosingBracket(r[1],e):this.$findOpeningBracket(r[2],e):null},this.getBracketRange=function(e){var t=this.getLine(e.row),n=!0,r,s=t.charAt(e.column-1),o=s&&s.match(/([\(\[\{])|([\)\]\}])/);o||(s=t.charAt(e.column),e={row:e.row,column:e.column+1},o=s&&s.match(/([\(\[\{])|([\)\]\}])/),n=!1);if(!o)return null;if(o[1]){var u=this.$findClosingBracket(o[1],e);if(!u)return null;r=i.fromPoints(e,u),n||(r.end.column++,r.start.column--),r.cursor=r.end}else{var u=this.$findOpeningBracket(o[2],e);if(!u)return null;r=i.fromPoints(u,e),n||(r.start.column++,r.end.column--),r.cursor=r.start}return r},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)")+")+"));var a=t.column-o.getCurrentTokenColumn()-2,f=u.value;for(;;){while(a>=0){var l=f.charAt(a);if(l==i){s-=1;if(s==0)return{row:o.getCurrentTokenRow(),column:a+o.getCurrentTokenColumn()}}else l==e&&(s+=1);a-=1}do u=o.stepBackward();while(u&&!n.test(u.type));if(u==null)break;f=u.value,a=f.length-1}return null},this.$findClosingBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)")+")+"));var a=t.column-o.getCurrentTokenColumn();for(;;){var f=u.value,l=f.length;while(a=4352&&e<=4447||e>=4515&&e<=4519||e>=4602&&e<=4607||e>=9001&&e<=9002||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12283||e>=12288&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12589||e>=12593&&e<=12686||e>=12688&&e<=12730||e>=12736&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=13054||e>=13056&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=55216&&e<=55238||e>=55243&&e<=55291||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510}r.implement(this,u),this.setDocument=function(e){this.doc&&this.doc.removeListener("change",this.$onChange),this.doc=e,e.on("change",this.$onChange),this.bgTokenizer&&this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},this.getDocument=function(){return this.doc},this.$resetRowCache=function(e){if(!e){this.$docRowCache=[],this.$screenRowCache=[];return}var t=this.$docRowCache.length,n=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>n&&(this.$docRowCache.splice(n,t),this.$screenRowCache.splice(n,t))},this.$getRowCacheIndex=function(e,t){var n=0,r=e.length-1;while(n<=r){var i=n+r>>1,s=e[i];if(t>s)n=i+1;else{if(!(t=t)break}return r=n[s],r?(r.index=s,r.start=i-r.value.length,r):null},this.setUndoManager=function(e){this.$undoManager=e,this.$informUndoManager&&this.$informUndoManager.cancel();if(e){var t=this;e.addSession(this),this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.mergeUndoDeltas=!1},this.$informUndoManager=i.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},this.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},this.$defaultUndoManager={undo:function(){},redo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?i.stringRepeat(" ",this.getTabSize()):" "},this.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},this.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},this.setTabSize=function(e){this.setOption("tabSize",e)},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize===0},this.setNavigateWithinSoftTabs=function(e){this.setOption("navigateWithinSoftTabs",e)},this.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},this.$overwrite=!1,this.setOverwrite=function(e){this.setOption("overwrite",e)},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.addGutterDecoration=function(e,t){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+t,this._signal("changeBreakpoint",{})},this.removeGutterDecoration=function(e,t){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+t,""),this._signal("changeBreakpoint",{})},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(e){this.$breakpoints=[];for(var t=0;t0&&(r=!!n.charAt(t-1).match(this.tokenRe)),r||(r=!!n.charAt(t).match(this.tokenRe));if(r)var i=this.tokenRe;else if(/^\s+$/.test(n.slice(t-1,t+1)))var i=/\s/;else var i=this.nonTokenRe;var s=t;if(s>0){do s--;while(s>=0&&n.charAt(s).match(i));s++}var o=t;while(oe&&(e=t.screenWidth)}),this.lineWidgetWidth=e},this.$computeWidth=function(e){if(this.$modified||e){this.$modified=!1;if(this.$useWrapMode)return this.screenWidth=this.$wrapLimit;var t=this.doc.getAllLines(),n=this.$rowLengthCache,r=0,i=0,s=this.$foldData[i],o=s?s.start.row:Infinity,u=t.length;for(var a=0;ao){a=s.end.row+1;if(a>=u)break;s=this.$foldData[i++],o=s?s.start.row:Infinity}n[a]==null&&(n[a]=this.$getStringScreenWidth(t[a])[0]),n[a]>r&&(r=n[a])}this.screenWidth=r}},this.getLine=function(e){return this.doc.getLine(e)},this.getLines=function(e,t){return this.doc.getLines(e,t)},this.getLength=function(){return this.doc.getLength()},this.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},this.insert=function(e,t){return this.doc.insert(e,t)},this.remove=function(e){return this.doc.remove(e)},this.removeFullLines=function(e,t){return this.doc.removeFullLines(e,t)},this.undoChanges=function(e,t){if(!e.length)return;this.$fromUndo=!0;for(var n=e.length-1;n!=-1;n--){var r=e[n];r.action=="insert"||r.action=="remove"?this.doc.revertDelta(r):r.folds&&this.addFolds(r.folds)}!t&&this.$undoSelect&&(e.selectionBefore?this.selection.fromJSON(e.selectionBefore):this.selection.setRange(this.$getUndoSelection(e,!0))),this.$fromUndo=!1},this.redoChanges=function(e,t){if(!e.length)return;this.$fromUndo=!0;for(var n=0;ne.end.column&&(s.start.column+=u),s.end.row==e.end.row&&s.end.column>e.end.column&&(s.end.column+=u)),o&&s.start.row>=e.end.row&&(s.start.row+=o,s.end.row+=o)}s.end=this.insert(s.start,r);if(i.length){var a=e.start,f=s.start,o=f.row-a.row,u=f.column-a.column;this.addFolds(i.map(function(e){return e=e.clone(),e.start.row==a.row&&(e.start.column+=u),e.end.row==a.row&&(e.end.column+=u),e.start.row+=o,e.end.row+=o,e}))}return s},this.indentRows=function(e,t,n){n=n.replace(/\t/g,this.getTabString());for(var r=e;r<=t;r++)this.doc.insertInLine({row:r,column:0},n)},this.outdentRows=function(e){var t=e.collapseRows(),n=new l(0,0,0,0),r=this.getTabSize();for(var i=t.start.row;i<=t.end.row;++i){var s=this.getLine(i);n.start.row=i,n.end.row=i;for(var o=0;o0){var r=this.getRowFoldEnd(t+n);if(r>this.doc.getLength()-1)return 0;var i=r-t}else{e=this.$clipRowToDocument(e),t=this.$clipRowToDocument(t);var i=t-e+1}var s=new l(e,0,t,Number.MAX_VALUE),o=this.getFoldsInRange(s).map(function(e){return e=e.clone(),e.start.row+=i,e.end.row+=i,e}),u=n==0?this.doc.getLines(e,t):this.doc.removeFullLines(e,t);return this.doc.insertFullLines(e+i,u),o.length&&this.addFolds(o),i},this.moveLinesUp=function(e,t){return this.$moveLines(e,t,-1)},this.moveLinesDown=function(e,t){return this.$moveLines(e,t,1)},this.duplicateLines=function(e,t){return this.$moveLines(e,t,0)},this.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},this.$clipColumnToRow=function(e,t){return t<0?0:Math.min(this.doc.getLine(e).length,t)},this.$clipPositionToDocument=function(e,t){t=Math.max(0,t);if(e<0)e=0,t=0;else{var n=this.doc.getLength();e>=n?(e=n-1,t=this.doc.getLine(n-1).length):t=Math.min(this.doc.getLine(e).length,t)}return{row:e,column:t}},this.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var t=this.doc.getLength()-1;return e.end.row>t?(e.end.row=t,e.end.column=this.doc.getLine(t).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},this.$wrapLimit=80,this.$useWrapMode=!1,this.$wrapLimitRange={min:null,max:null},this.setUseWrapMode=function(e){if(e!=this.$useWrapMode){this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0);if(e){var t=this.getLength();this.$wrapData=Array(t),this.$updateWrapData(0,t-1)}this._signal("changeWrapMode")}},this.getUseWrapMode=function(){return this.$useWrapMode},this.setWrapLimitRange=function(e,t){if(this.$wrapLimitRange.min!==e||this.$wrapLimitRange.max!==t)this.$wrapLimitRange={min:e,max:t},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode")},this.adjustWrapLimit=function(e,t){var n=this.$wrapLimitRange;n.max<0&&(n={min:t,max:t});var r=this.$constrainWrapLimit(e,n.min,n.max);return r!=this.$wrapLimit&&r>1?(this.$wrapLimit=r,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},this.$constrainWrapLimit=function(e,t,n){return t&&(e=Math.max(t,e)),n&&(e=Math.min(n,e)),e},this.getWrapLimit=function(){return this.$wrapLimit},this.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},this.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},this.$updateInternalDataOnChange=function(e){var t=this.$useWrapMode,n=e.action,r=e.start,i=e.end,s=r.row,o=i.row,u=o-s,a=null;this.$updating=!0;if(u!=0)if(n==="remove"){this[t?"$wrapData":"$rowLengthCache"].splice(s,u);var f=this.$foldData;a=this.getFoldsInRange(e),this.removeFolds(a);var l=this.getFoldLine(i.row),c=0;if(l){l.addRemoveChars(i.row,i.column,r.column-i.column),l.shiftRow(-u);var h=this.getFoldLine(s);h&&h!==l&&(h.merge(l),l=h),c=f.indexOf(l)+1}for(c;c=i.row&&l.shiftRow(-u)}o=s}else{var p=Array(u);p.unshift(s,0);var d=t?this.$wrapData:this.$rowLengthCache;d.splice.apply(d,p);var f=this.$foldData,l=this.getFoldLine(s),c=0;if(l){var v=l.range.compareInside(r.row,r.column);v==0?(l=l.split(r.row,r.column),l&&(l.shiftRow(u),l.addRemoveChars(o,0,i.column-r.column))):v==-1&&(l.addRemoveChars(s,0,i.column-r.column),l.shiftRow(u)),c=f.indexOf(l)+1}for(c;c=s&&l.shiftRow(u)}}else{u=Math.abs(e.start.column-e.end.column),n==="remove"&&(a=this.getFoldsInRange(e),this.removeFolds(a),u=-u);var l=this.getFoldLine(s);l&&l.addRemoveChars(s,r.column,u)}return t&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,t?this.$updateWrapData(s,o):this.$updateRowLengthCache(s,o),a},this.$updateRowLengthCache=function(e,t,n){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},this.$updateWrapData=function(e,t){var r=this.doc.getAllLines(),i=this.getTabSize(),o=this.$wrapData,u=this.$wrapLimit,a,f,l=e;t=Math.min(t,r.length-1);while(l<=t)f=this.getFoldLine(l,f),f?(a=[],f.walk(function(e,t,i,o){var u;if(e!=null){u=this.$getDisplayTokens(e,a.length),u[0]=n;for(var f=1;fr-b){var w=f+r-b;if(e[w-1]>=c&&e[w]>=c){y(w);continue}if(e[w]==n||e[w]==s){for(w;w!=f-1;w--)if(e[w]==n)break;if(w>f){y(w);continue}w=f+r;for(w;w>2)),f-1);while(w>E&&e[w]E&&e[w]E&&e[w]==a)w--}else while(w>E&&e[w]E){y(++w);continue}w=f+r,e[w]==t&&w--,y(w-b)}return o},this.$getDisplayTokens=function(n,r){var i=[],s;r=r||0;for(var o=0;o39&&u<48||u>57&&u<64?i.push(a):u>=4352&&m(u)?i.push(e,t):i.push(e)}return i},this.$getStringScreenWidth=function(e,t,n){if(t==0)return[0,0];t==null&&(t=Infinity),n=n||0;var r,i;for(i=0;i=4352&&m(r)?n+=2:n+=1;if(n>t)break}return[n,i]},this.lineWidgets=null,this.getRowLength=function(e){if(this.lineWidgets)var t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0;else t=0;return!this.$useWrapMode||!this.$wrapData[e]?1+t:this.$wrapData[e].length+1+t},this.getRowLineCount=function(e){return!this.$useWrapMode||!this.$wrapData[e]?1:this.$wrapData[e].length+1},this.getRowWrapIndent=function(e){if(this.$useWrapMode){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE),n=this.$wrapData[t.row];return n.length&&n[0]=0)var u=f[l],i=this.$docRowCache[l],h=e>f[c-1];else var h=!c;var p=this.getLength()-1,d=this.getNextFoldLine(i),v=d?d.start.row:Infinity;while(u<=e){a=this.getRowLength(i);if(u+a>e||i>=p)break;u+=a,i++,i>v&&(i=d.end.row+1,d=this.getNextFoldLine(i,d),v=d?d.start.row:Infinity),h&&(this.$docRowCache.push(i),this.$screenRowCache.push(u))}if(d&&d.start.row<=i)r=this.getFoldDisplayLine(d),i=d.start.row;else{if(u+a<=e||i>p)return{row:p,column:this.getLine(p).length};r=this.getLine(i),d=null}var m=0,g=Math.floor(e-u);if(this.$useWrapMode){var y=this.$wrapData[i];y&&(o=y[g],g>0&&y.length&&(m=y.indent,s=y[g-1]||y[y.length-1],r=r.substring(s)))}return n!==undefined&&this.$bidiHandler.isBidiRow(u+g,i,g)&&(t=this.$bidiHandler.offsetToCol(n)),s+=this.$getStringScreenWidth(r,t-m)[1],this.$useWrapMode&&s>=o&&(s=o-1),d?d.idxToPosition(s):{row:i,column:s}},this.documentToScreenPosition=function(e,t){if(typeof t=="undefined")var n=this.$clipPositionToDocument(e.row,e.column);else n=this.$clipPositionToDocument(e,t);e=n.row,t=n.column;var r=0,i=null,s=null;s=this.getFoldAt(e,t,1),s&&(e=s.start.row,t=s.start.column);var o,u=0,a=this.$docRowCache,f=this.$getRowCacheIndex(a,e),l=a.length;if(l&&f>=0)var u=a[f],r=this.$screenRowCache[f],c=e>a[l-1];else var c=!l;var h=this.getNextFoldLine(u),p=h?h.start.row:Infinity;while(u=p){o=h.end.row+1;if(o>e)break;h=this.getNextFoldLine(o,h),p=h?h.start.row:Infinity}else o=u+1;r+=this.getRowLength(u),u=o,c&&(this.$docRowCache.push(u),this.$screenRowCache.push(r))}var d="";h&&u>=p?(d=this.getFoldDisplayLine(h,e,t),i=h.start.row):(d=this.getLine(e).substring(0,t),i=e);var v=0;if(this.$useWrapMode){var m=this.$wrapData[i];if(m){var g=0;while(d.length>=m[g])r++,g++;d=d.substring(m[g-1]||0,d.length),v=g>0?m.indent:0}}return{row:r,column:v+this.$getStringScreenWidth(d)[0]}},this.documentToScreenColumn=function(e,t){return this.documentToScreenPosition(e,t).column},this.documentToScreenRow=function(e,t){return this.documentToScreenPosition(e,t).row},this.getScreenLength=function(){var e=0,t=null;if(!this.$useWrapMode){e=this.getLength();var n=this.$foldData;for(var r=0;ro&&(s=t.end.row+1,t=this.$foldData[r++],o=t?t.start.row:Infinity)}}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},this.$setFontMetrics=function(e){if(!this.$enableVarChar)return;this.$getStringScreenWidth=function(t,n,r){if(n===0)return[0,0];n||(n=Infinity),r=r||0;var i,s;for(s=0;sn)break}return[r,s]}},this.destroy=function(){this.bgTokenizer&&(this.bgTokenizer.setDocument(null),this.bgTokenizer=null),this.$stopWorker()},this.isFullWidth=m}.call(d.prototype),e("./edit_session/folding").Folding.call(d.prototype),e("./edit_session/bracket_match").BracketMatch.call(d.prototype),o.defineOptions(d.prototype,"session",{wrap:{set:function(e){!e||e=="off"?e=!1:e=="free"?e=!0:e=="printMargin"?e=-1:typeof e=="string"&&(e=parseInt(e,10)||!1);if(this.$wrap==e)return;this.$wrap=e;if(!e)this.setUseWrapMode(!1);else{var t=typeof e=="number"?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}},get:function(){return this.getUseWrapMode()?this.$wrap==-1?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){e=e=="auto"?this.$mode.type!="text":e!="text",e!=this.$wrapAsCode&&(this.$wrapAsCode=e,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(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){e=parseInt(e),e>0&&this.$tabSize!==e&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(e){this.setFoldStyle(e)},handlesSet:!0},overwrite:{set:function(e){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId},handlesSet:!0}}),t.EditSession=d}),ace.define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";function u(e,t){function n(e){return/\w/.test(e)||t.regExp?"\\b":""}return n(e[0])+e+n(e[e.length-1])}var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./range").Range,o=function(){this.$options={}};(function(){this.set=function(e){return i.mixin(this.$options,e),this},this.getOptions=function(){return r.copyObject(this.$options)},this.setOptions=function(e){this.$options=e},this.find=function(e){var t=this.$options,n=this.$matchIterator(e,t);if(!n)return!1;var r=null;return n.forEach(function(e,n,i,o){return r=new s(e,n,i,o),n==o&&t.start&&t.start.start&&t.skipCurrent!=0&&r.isEqual(t.start)?(r=null,!1):!0}),r},this.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var n=t.range,i=n?e.getLines(n.start.row,n.end.row):e.doc.getAllLines(),o=[],u=t.re;if(t.$isMultiLine){var a=u.length,f=i.length-a,l;e:for(var c=u.offset||0;c<=f;c++){for(var h=0;hv)continue;o.push(l=new s(c,v,c+a-1,m)),a>2&&(c=c+a-2)}}else for(var g=0;gE&&o[h].end.row==n.end.row)h--;o=o.slice(g,h+1);for(g=0,h=o.length;g=u;n--)if(c(n,Number.MAX_VALUE,e))return;if(t.wrap==0)return;for(n=a,u=o.row;n>=u;n--)if(c(n,Number.MAX_VALUE,e))return};else var f=function(e){var n=o.row;if(c(n,o.column,e))return;for(n+=1;n<=a;n++)if(c(n,0,e))return;if(t.wrap==0)return;for(n=u,a=o.row;n<=a;n++)if(c(n,0,e))return};if(t.$isMultiLine)var l=n.length,c=function(t,i,s){var o=r?t-l+1:t;if(o<0)return;var u=e.getLine(o),a=u.search(n[0]);if(!r&&ai)return;if(s(o,a,o+l-1,c))return!0};else if(r)var c=function(t,r,i){var s=e.getLine(t),o=[],u,a=0;n.lastIndex=0;while(u=n.exec(s)){var f=u[0].length;a=u.index;if(!f){if(a>=s.length)break;n.lastIndex=a+=1}if(u.index+f>r)break;o.push(u.index,f)}for(var l=o.length-1;l>=0;l-=2){var c=o[l-1],f=o[l];if(i(t,c,t,c+f))return!0}};else var c=function(t,r,i){var s=e.getLine(t),o,u;n.lastIndex=r;while(u=n.exec(s)){var a=u[0].length;o=u.index;if(i(t,o,t,o+a))return!0;if(!a){n.lastIndex=o+=1;if(o>=s.length)return!1}}};return{forEach:f}}}).call(o.prototype),t.Search=o}),ace.define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";function o(e,t){this.platform=t||(i.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=!0}function u(e,t){o.call(this,e,t),this.$singleCommand=!1}var r=e("../lib/keys"),i=e("../lib/useragent"),s=r.KEY_MODS;u.prototype=o.prototype,function(){function e(e){return typeof e=="object"&&e.bindKey&&e.bindKey.position||(e.isDefault?-100:0)}this.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},this.removeCommand=function(e,t){var n=e&&(typeof e=="string"?e:e.name);e=this.commands[n],t||delete this.commands[n];var r=this.commandKeyBinding;for(var i in r){var s=r[i];if(s==e)delete r[i];else if(Array.isArray(s)){var o=s.indexOf(e);o!=-1&&(s.splice(o,1),s.length==1&&(r[i]=s[0]))}}},this.bindKey=function(e,t,n){typeof e=="object"&&e&&(n==undefined&&(n=e.position),e=e[this.platform]);if(!e)return;if(typeof t=="function")return this.addCommand({exec:t,bindKey:e,name:t.name||e});e.split("|").forEach(function(e){var r="";if(e.indexOf(" ")!=-1){var i=e.split(/\s+/);e=i.pop(),i.forEach(function(e){var t=this.parseKeys(e),n=s[t.hashId]+t.key;r+=(r?" ":"")+n,this._addCommandToBinding(r,"chainKeys")},this),r+=" "}var o=this.parseKeys(e),u=s[o.hashId]+o.key;this._addCommandToBinding(r+u,t,n)},this)},this._addCommandToBinding=function(t,n,r){var i=this.commandKeyBinding,s;if(!n)delete i[t];else if(!i[t]||this.$singleCommand)i[t]=n;else{Array.isArray(i[t])?(s=i[t].indexOf(n))!=-1&&i[t].splice(s,1):i[t]=[i[t]],typeof r!="number"&&(r=e(n));var o=i[t];for(s=0;sr)break}o.splice(s,0,n)}},this.addCommands=function(e){e&&Object.keys(e).forEach(function(t){var n=e[t];if(!n)return;if(typeof n=="string")return this.bindKey(n,t);typeof n=="function"&&(n={exec:n});if(typeof n!="object")return;n.name||(n.name=t),this.addCommand(n)},this)},this.removeCommands=function(e){Object.keys(e).forEach(function(t){this.removeCommand(e[t])},this)},this.bindKeys=function(e){Object.keys(e).forEach(function(t){this.bindKey(t,e[t])},this)},this._buildKeyHash=function(e){this.bindKey(e.bindKey,e)},this.parseKeys=function(e){var t=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(e){return e}),n=t.pop(),i=r[n];if(r.FUNCTION_KEYS[i])n=r.FUNCTION_KEYS[i].toLowerCase();else{if(!t.length)return{key:n,hashId:-1};if(t.length==1&&t[0]=="shift")return{key:n.toUpperCase(),hashId:-1}}var s=0;for(var o=t.length;o--;){var u=r.KEY_MODS[t[o]];if(u==null)return typeof console!="undefined"&&console.error("invalid modifier "+t[o]+" in "+e),!1;s|=u}return{key:n,hashId:s}},this.findKeyCommand=function(t,n){var r=s[t]+n;return this.commandKeyBinding[r]},this.handleKeyboard=function(e,t,n,r){if(r<0)return;var i=s[t]+n,o=this.commandKeyBinding[i];e.$keyChain&&(e.$keyChain+=" "+i,o=this.commandKeyBinding[e.$keyChain]||o);if(o)if(o=="chainKeys"||o[o.length-1]=="chainKeys")return e.$keyChain=e.$keyChain||i,{command:"null"};if(e.$keyChain)if(!!t&&t!=4||n.length!=1){if(t==-1||r>0)e.$keyChain=""}else e.$keyChain=e.$keyChain.slice(0,-i.length-1);return{command:o}},this.getStatusText=function(e,t){return t.$keyChain||""}}.call(o.prototype),t.HashHandler=o,t.MultiHashHandler=u}),ace.define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../keyboard/hash_handler").MultiHashHandler,s=e("../lib/event_emitter").EventEmitter,o=function(e,t){i.call(this,t,e),this.byName=this.commands,this.setDefaultHandler("exec",function(e){return e.command.exec(e.editor,e.args||{})})};r.inherits(o,i),function(){r.implement(this,s),this.exec=function(e,t,n){if(Array.isArray(e)){for(var r=e.length;r--;)if(this.exec(e[r],t,n))return!0;return!1}typeof e=="string"&&(e=this.commands[e]);if(!e)return!1;if(t&&t.$readOnly&&!e.readOnly)return!1;if(this.$checkCommandState!=0&&e.isAvailable&&!e.isAvailable(t))return!1;var i={editor:t,command:e,args:n};return i.returnValue=this._emit("exec",i),this._signal("afterExec",i),i.returnValue===!1?!1:!0},this.toggleRecording=function(e){if(this.$inReplay)return;return e&&e._emit("changeStatus"),this.recording?(this.macro.pop(),this.removeEventListener("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(e){this.macro.push([e.command,e.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},this.replay=function(e){if(this.$inReplay||!this.macro)return;if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(t){typeof t=="string"?this.exec(t,e):this.exec(t[0],e,t[1])},this)}finally{this.$inReplay=!1}},this.trimMacro=function(e){return e.map(function(e){return typeof e[0]!="string"&&(e[0]=e[0].name),e[1]||(e=e[0]),e})}}.call(o.prototype),t.CommandManager=o}),ace.define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(e,t,n){"use strict";function o(e,t){return{win:e,mac:t}}var r=e("../lib/lang"),i=e("../config"),s=e("../range").Range;t.commands=[{name:"showSettingsMenu",bindKey:o("Ctrl-,","Command-,"),exec:function(e){i.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",bindKey:o("Alt-E","F4"),exec:function(e){i.loadModule("./ext/error_marker",function(t){t.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",bindKey:o("Alt-Shift-E","Shift-F4"),exec:function(e){i.loadModule("./ext/error_marker",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:o("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:o(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:o("Ctrl-L","Command-L"),exec:function(e,t){typeof t=="number"&&!isNaN(t)&&e.gotoLine(t),e.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:o("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:o("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",bindKey:o("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",bindKey:o("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:o(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:o("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:o("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:o("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:o("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:o("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:o("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:o("Ctrl-F","Command-F"),exec:function(e){i.loadModule("ace/ext/searchbox",function(t){t.Search(e)})},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:o("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",description:"Go to start",bindKey:o("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",description:"Select up",bindKey:o("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:o("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",description:"Select to end",bindKey:o("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",description:"Go to end",bindKey:o("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",description:"Select down",bindKey:o("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:o("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:o("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:o("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:o("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",description:"Go to line start",bindKey:o("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:o("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:o("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:o("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:o("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:o("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",description:"Go to line end",bindKey:o("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:o("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:o("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:o(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:o("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:o(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:o("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:o("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:o("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:o("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:o("Ctrl-P","Ctrl-P"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:o("Ctrl-Shift-P","Ctrl-Shift-P"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:o("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",description:"Pass keys to browser",bindKey:o(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",description:"Copy",exec:function(e){},readOnly:!0},{name:"cut",description:"Cut",exec:function(e){var t=e.$copyWithEmptySelection&&e.selection.isEmpty(),n=t?e.selection.getLineRange():e.selection.getRange();e._emit("cut",n),n.isEmpty()||e.session.remove(n),e.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(e,t){e.$handlePaste(t)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:o("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:o("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:o("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:o("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:o("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:o("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:o("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:o("Ctrl-H","Command-Option-F"),exec:function(e){i.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",description:"Undo",bindKey:o("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",description:"Redo",bindKey:o("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:o("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:o("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:o("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:o("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:o("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:o("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:o("Shift-Delete",null),exec:function(e){if(!e.selection.isEmpty())return!1;e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:o("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:o("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:o("Ctrl-Shift-Backspace",null),exec:function(e){var t=e.selection.getRange();t.start.column=0,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:o("Ctrl-Shift-Delete",null),exec:function(e){var t=e.selection.getRange();t.end.column=Number.MAX_VALUE,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:o("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:o("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:o("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:o("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:o("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:o("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(e,t){e.insert(r.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:o(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:o("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:o("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:o("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"expandtoline",description:"Expand to line",bindKey:o("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"joinlines",description:"Join lines",bindKey:o(null,null),exec:function(e){var t=e.selection.isBackwards(),n=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),i=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),o=e.session.doc.getLine(n.row).length,u=e.session.doc.getTextRange(e.selection.getRange()),a=u.replace(/\n\s*/," ").length,f=e.session.doc.getLine(n.row);for(var l=n.row+1;l<=i.row+1;l++){var c=r.stringTrimLeft(r.stringTrimRight(e.session.doc.getLine(l)));c.length!==0&&(c=" "+c),f+=c}i.row+10?(e.selection.moveCursorTo(n.row,n.column),e.selection.selectTo(n.row,n.column+a)):(o=e.session.doc.getLine(n.row).length>o?o+1:o,e.selection.moveCursorTo(n.row,o))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:o(null,null),exec:function(e){var t=e.session.doc.getLength()-1,n=e.session.doc.getLine(t).length,r=e.selection.rangeList.ranges,i=[];r.length<1&&(r=[e.selection.getRange()]);for(var o=0;o=i.lastRow||r.end.row<=i.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break;default:}n=="animate"&&this.renderer.animateScrolling(this.curOp.scrollTop)}var s=this.selection.toJSON();this.curOp.selectionAfter=s,this.$lastSel=this.selection.toJSON(),this.session.getUndoManager().addSelection(s),this.prevOp=this.curOp,this.curOp=null}},this.$mergeableCommands=["backspace","del","insertstring"],this.$historyTracker=function(e){if(!this.$mergeUndoDeltas)return;var t=this.prevOp,n=this.$mergeableCommands,r=t.command&&e.command.name==t.command.name;if(e.command.name=="insertstring"){var i=e.args;this.mergeNextCommand===undefined&&(this.mergeNextCommand=!0),r=r&&this.mergeNextCommand&&(!/\s/.test(i)||/\s/.test(t.args)),this.mergeNextCommand=!0}else r=r&&n.indexOf(e.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(r=!1),r?this.session.mergeUndoDeltas=!0:n.indexOf(e.command.name)!==-1&&(this.sequenceStartTime=Date.now())},this.setKeyboardHandler=function(e,t){if(e&&typeof e=="string"&&e!="ace"){this.$keybindingId=e;var n=this;g.loadModule(["keybinding",e],function(r){n.$keybindingId==e&&n.keyBinding.setKeyboardHandler(r&&r.handler),t&&t()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e),t&&t()},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(e){if(this.session==e)return;this.curOp&&this.endOperation(),this.curOp={};var t=this.session;if(t){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange);var n=this.session.getSelection();n.off("changeCursor",this.$onCursorChange),n.off("changeSelection",this.$onSelectionChange)}this.session=e,e?(this.$onDocumentChange=this.onDocumentChange.bind(this),e.on("change",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.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=e.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),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(e)),this._signal("changeSession",{session:e,oldSession:t}),this.curOp=null,t&&t._signal("changeEditor",{oldEditor:this}),e&&e._signal("changeEditor",{editor:this}),e&&e.bgTokenizer&&e.bgTokenizer.scheduleStart()},this.getSession=function(){return this.session},this.setValue=function(e,t){return this.session.doc.setValue(e),t?t==1?this.navigateFileEnd():t==-1&&this.navigateFileStart():this.selectAll(),e},this.getValue=function(){return this.session.getValue()},this.getSelection=function(){return this.selection},this.resize=function(e){this.renderer.onResize(e)},this.setTheme=function(e,t){this.renderer.setTheme(e,t)},this.getTheme=function(){return this.renderer.getTheme()},this.setStyle=function(e){this.renderer.setStyle(e)},this.unsetStyle=function(e){this.renderer.unsetStyle(e)},this.getFontSize=function(){return this.getOption("fontSize")||i.computedStyle(this.container).fontSize},this.setFontSize=function(e){this.setOption("fontSize",e)},this.$highlightBrackets=function(){this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),this.session.$bracketHighlight=null);if(this.$highlightPending)return;var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var t=e.session;if(!t||!t.bgTokenizer)return;var n=t.findMatchingBracket(e.getCursorPosition());if(n)var r=new p(n.row,n.column,n.row,n.column+1);else if(t.$mode.getMatching)var r=t.$mode.getMatching(e.session);r&&(t.$bracketHighlight=t.addMarker(r,"ace_bracket","text"))},50)},this.$highlightTags=function(){if(this.$highlightTagPending)return;var e=this;this.$highlightTagPending=!0,setTimeout(function(){e.$highlightTagPending=!1;var t=e.session;if(!t||!t.bgTokenizer)return;var n=e.getCursorPosition(),r=new y(e.session,n.row,n.column),i=r.getCurrentToken();if(!i||!/\b(?:tag-open|tag-name)/.test(i.type)){t.removeMarker(t.$tagHighlight),t.$tagHighlight=null;return}if(i.type.indexOf("tag-open")!=-1){i=r.stepForward();if(!i)return}var s=i.value,o=0,u=r.stepBackward();if(u.value=="<"){do u=i,i=r.stepForward(),i&&i.value===s&&i.type.indexOf("tag-name")!==-1&&(u.value==="<"?o++:u.value==="=0)}else{do i=u,u=r.stepBackward(),i&&i.value===s&&i.type.indexOf("tag-name")!==-1&&(u.value==="<"?o++:u.value==="1)&&(t=!1)}if(e.$highlightLineMarker&&!t)e.removeMarker(e.$highlightLineMarker.id),e.$highlightLineMarker=null;else if(!e.$highlightLineMarker&&t){var n=new p(t.row,t.column,t.row,Infinity);n.id=e.addMarker(n,"ace_active-line","screenLine"),e.$highlightLineMarker=n}else t&&(e.$highlightLineMarker.start.row=t.row,e.$highlightLineMarker.end.row=t.row,e.$highlightLineMarker.start.column=t.column,e._signal("changeBackMarker"))},this.onSelectionChange=function(e){var t=this.session;t.$selectionMarker&&t.removeMarker(t.$selectionMarker),t.$selectionMarker=null;if(!this.selection.isEmpty()){var n=this.selection.getRange(),r=this.getSelectionStyle();t.$selectionMarker=t.addMarker(n,"ace_selection",r)}else this.$updateHighlightActiveLine();var i=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(i),this._signal("changeSelection")},this.$getSelectionHighLightRegexp=function(){var e=this.session,t=this.getSelectionRange();if(t.isEmpty()||t.isMultiLine())return;var n=t.start.column,r=t.end.column,i=e.getLine(t.start.row),s=i.substring(n,r);if(s.length>5e3||!/[\w\d]/.test(s))return;var o=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:s}),u=i.substring(n-1,r+1);if(!o.test(u))return;return o},this.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},this.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},this.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},this.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},this.onChangeMode=function(e){this.renderer.updateText(),this._emit("changeMode",e)},this.onChangeWrapLimit=function(){this.renderer.updateFull()},this.onChangeWrapMode=function(){this.renderer.onResize(!0)},this.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},this.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},this.getCopyText=function(){var e=this.getSelectedText(),t=this.session.doc.getNewLineCharacter(),n=!1;if(!e&&this.$copyWithEmptySelection){n=!0;var r=this.selection.getAllRanges();for(var i=0;is.length||i.length<2||!i[1])return this.commands.exec("insertstring",this,t);for(var o=s.length;o--;){var u=s[o];u.isEmpty()||r.remove(u),r.insert(u.start,i[o])}}},this.execCommand=function(e,t){return this.commands.exec(e,this,t)},this.insert=function(e,t){var n=this.session,r=n.getMode(),i=this.getCursorPosition();if(this.getBehavioursEnabled()&&!t){var s=r.transformAction(n.getState(i.row),"insertion",this,n,e);s&&(e!==s.text&&(this.inVirtualSelectionMode||(this.session.mergeUndoDeltas=!1,this.mergeNextCommand=!1)),e=s.text)}e==" "&&(e=this.session.getTabString());if(!this.selection.isEmpty()){var o=this.getSelectionRange();i=this.session.remove(o),this.clearSelection()}else if(this.session.getOverwrite()&&e.indexOf("\n")==-1){var o=new p.fromPoints(i,i);o.end.column+=e.length,this.session.remove(o)}if(e=="\n"||e=="\r\n"){var u=n.getLine(i.row);if(i.column>u.search(/\S|$/)){var a=u.substr(i.column).search(/\S|$/);n.doc.removeInLine(i.row,i.column,i.column+a)}}this.clearSelection();var f=i.column,l=n.getState(i.row),u=n.getLine(i.row),c=r.checkOutdent(l,u,e),h=n.insert(i,e);s&&s.selection&&(s.selection.length==2?this.selection.setSelectionRange(new p(i.row,f+s.selection[0],i.row,f+s.selection[1])):this.selection.setSelectionRange(new p(i.row+s.selection[0],s.selection[1],i.row+s.selection[2],s.selection[3])));if(n.getDocument().isNewLine(e)){var d=r.getNextLineIndent(l,u.slice(0,i.column),n.getTabString());n.insert({row:i.row+1,column:0},d)}c&&r.autoOutdent(l,n,i.row)},this.onTextInput=function(e,t){if(!t)return this.keyBinding.onTextInput(e);this.startOperation({command:{name:"insertstring"}});var n=this.applyComposition.bind(this,e,t);this.selection.rangeCount?this.forEachSelection(n):n(),this.endOperation()},this.applyComposition=function(e,t){if(t.extendLeft||t.extendRight){var n=this.selection.getRange();n.start.column-=t.extendLeft,n.end.column+=t.extendRight,this.selection.setRange(n),!e&&!n.isEmpty()&&this.remove()}(e||!this.selection.isEmpty())&&this.insert(e,!0);if(t.restoreStart||t.restoreEnd){var n=this.selection.getRange();n.start.column-=t.restoreStart,n.end.column-=t.restoreEnd,this.selection.setRange(n)}},this.onCommandKey=function(e,t,n){this.keyBinding.onCommandKey(e,t,n)},this.setOverwrite=function(e){this.session.setOverwrite(e)},this.getOverwrite=function(){return this.session.getOverwrite()},this.toggleOverwrite=function(){this.session.toggleOverwrite()},this.setScrollSpeed=function(e){this.setOption("scrollSpeed",e)},this.getScrollSpeed=function(){return this.getOption("scrollSpeed")},this.setDragDelay=function(e){this.setOption("dragDelay",e)},this.getDragDelay=function(){return this.getOption("dragDelay")},this.setSelectionStyle=function(e){this.setOption("selectionStyle",e)},this.getSelectionStyle=function(){return this.getOption("selectionStyle")},this.setHighlightActiveLine=function(e){this.setOption("highlightActiveLine",e)},this.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.setHighlightSelectedWord=function(e){this.setOption("highlightSelectedWord",e)},this.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},this.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},this.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},this.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},this.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},this.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.setReadOnly=function(e){this.setOption("readOnly",e)},this.getReadOnly=function(){return this.getOption("readOnly")},this.setBehavioursEnabled=function(e){this.setOption("behavioursEnabled",e)},this.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},this.setWrapBehavioursEnabled=function(e){this.setOption("wrapBehavioursEnabled",e)},this.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},this.setShowFoldWidgets=function(e){this.setOption("showFoldWidgets",e)},this.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.remove=function(e){this.selection.isEmpty()&&(e=="left"?this.selection.selectLeft():this.selection.selectRight());var t=this.getSelectionRange();if(this.getBehavioursEnabled()){var n=this.session,r=n.getState(t.start.row),i=n.getMode().transformAction(r,"deletion",this,n,t);if(t.end.column===0){var s=n.getTextRange(t);if(s[s.length-1]=="\n"){var o=n.getLine(t.end.row);/^\s+$/.test(o)&&(t.end.column=o.length)}}i&&(t=i)}this.session.remove(t),this.clearSelection()},this.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},this.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(e)},this.transposeLetters=function(){if(!this.selection.isEmpty())return;var e=this.getCursorPosition(),t=e.column;if(t===0)return;var n=this.session.getLine(e.row),r,i;tt.toLowerCase()?1:0});var i=new p(0,0,0,0);for(var r=e.first;r<=e.last;r++){var s=t.getLine(r);i.start.row=r,i.end.row=r,i.end.column=s.length,t.replace(i,n[r-e.first])}},this.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),t=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,t.first,t.last)},this.toggleBlockComment=function(){var e=this.getCursorPosition(),t=this.session.getState(e.row),n=this.getSelectionRange();this.session.getMode().toggleBlockComment(t,this.session,n,e)},this.getNumberAt=function(e,t){var n=/[\-]?[0-9]+(?:\.[0-9]+)?/g;n.lastIndex=0;var r=this.session.getLine(e);while(n.lastIndex=t){var s={value:i[0],start:i.index,end:i.index+i[0].length};return s}}return null},this.modifyNumber=function(e){var t=this.selection.getCursor().row,n=this.selection.getCursor().column,r=new p(t,n-1,t,n),i=this.session.getTextRange(r);if(!isNaN(parseFloat(i))&&isFinite(i)){var s=this.getNumberAt(t,n);if(s){var o=s.value.indexOf(".")>=0?s.start+s.value.indexOf(".")+1:s.end,u=s.start+s.value.length-o,a=parseFloat(s.value);a*=Math.pow(10,u),o!==s.end&&n=u&&o<=a&&(n=t,f.selection.clearSelection(),f.moveCursorTo(e,u+r),f.selection.selectTo(e,a+r)),u=a});var l=this.$toggleWordPairs,c;for(var h=0;hp+1)break;p=d.last}l--,u=this.session.$moveLines(h,p,t?0:e),t&&e==-1&&(c=l+1);while(c<=l)o[c].moveBy(u,0),c++;t||(u=0),a+=u}i.fromOrientedRange(i.ranges[0]),i.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},this.$getSelectedRows=function(e){return e=(e||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(e.start.row),last:this.session.getRowFoldEnd(e.end.row)}},this.onCompositionStart=function(e){this.renderer.showComposition(e)},this.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&e<=this.getLastVisibleRow()},this.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&e<=this.renderer.getLastFullyVisibleRow()},this.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},this.$moveByPage=function(e,t){var n=this.renderer,r=this.renderer.layerConfig,i=e*Math.floor(r.height/r.lineHeight);t===!0?this.selection.$moveSelection(function(){this.moveCursorBy(i,0)}):t===!1&&(this.selection.moveCursorBy(i,0),this.selection.clearSelection());var s=n.scrollTop;n.scrollBy(0,i*r.lineHeight),t!=null&&n.scrollCursorIntoView(null,.5),n.animateScrolling(s)},this.selectPageDown=function(){this.$moveByPage(1,!0)},this.selectPageUp=function(){this.$moveByPage(-1,!0)},this.gotoPageDown=function(){this.$moveByPage(1,!1)},this.gotoPageUp=function(){this.$moveByPage(-1,!1)},this.scrollPageDown=function(){this.$moveByPage(1)},this.scrollPageUp=function(){this.$moveByPage(-1)},this.scrollToRow=function(e){this.renderer.scrollToRow(e)},this.scrollToLine=function(e,t,n,r){this.renderer.scrollToLine(e,t,n,r)},this.centerSelection=function(){var e=this.getSelectionRange(),t={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(t,.5)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},this.getSelectionRange=function(){return this.selection.getRange()},this.selectAll=function(){this.selection.selectAll()},this.clearSelection=function(){this.selection.clearSelection()},this.moveCursorTo=function(e,t){this.selection.moveCursorTo(e,t)},this.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},this.jumpToMatching=function(e,t){var n=this.getCursorPosition(),r=new y(this.session,n.row,n.column),i=r.getCurrentToken(),s=i||r.stepForward();if(!s)return;var o,u=!1,a={},f=n.column-s.start,l,c={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(s.value.match(/[{}()\[\]]/g))for(;f=0;--s)this.$tryReplace(n[s],e)&&r++;return this.selection.setSelectionRange(i),r},this.$tryReplace=function(e,t){var n=this.session.getTextRange(e);return t=this.$search.replace(n,t),t!==null?(e.end=this.session.replace(e,t),e):null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(e,t,n){t||(t={}),typeof e=="string"||e instanceof RegExp?t.needle=e:typeof e=="object"&&r.mixin(t,e);var i=this.selection.getRange();t.needle==null&&(e=this.session.getTextRange(i)||this.$search.$options.needle,e||(i=this.session.getWordRange(i.start.row,i.start.column),e=this.session.getTextRange(i)),this.$search.set({needle:e})),this.$search.set(t),t.start||this.$search.set({start:i});var s=this.$search.find(this.session);if(t.preventScroll)return s;if(s)return this.revealRange(s,n),s;t.backwards?i.start=i.end:i.end=i.start,this.selection.setRange(i)},this.findNext=function(e,t){this.find({skipCurrent:!0,backwards:!1},e,t)},this.findPrevious=function(e,t){this.find(e,{skipCurrent:!0,backwards:!0},t)},this.revealRange=function(e,t){this.session.unfold(e),this.selection.setSelectionRange(e);var n=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),t!==!1&&this.renderer.animateScrolling(n)},this.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},this.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},this.destroy=function(){this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy()},this.setAutoScrollEditorIntoView=function(e){if(!e)return;var t,n=this,r=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var i=this.$scrollAnchor;i.style.cssText="position:absolute",this.container.insertBefore(i,this.container.firstChild);var s=this.on("changeSelection",function(){r=!0}),o=this.renderer.on("beforeRender",function(){r&&(t=n.renderer.container.getBoundingClientRect())}),u=this.renderer.on("afterRender",function(){if(r&&t&&(n.isFocused()||n.searchBox&&n.searchBox.isFocused())){var e=n.renderer,s=e.$cursorLayer.$pixelPos,o=e.layerConfig,u=s.top-o.offset;s.top>=0&&u+t.top<0?r=!0:s.topwindow.innerHeight?r=!1:r=null,r!=null&&(i.style.top=u+"px",i.style.left=s.left+"px",i.style.height=o.lineHeight+"px",i.scrollIntoView(r)),r=t=null}});this.setAutoScrollEditorIntoView=function(e){if(e)return;delete this.setAutoScrollEditorIntoView,this.off("changeSelection",s),this.renderer.off("afterRender",u),this.renderer.off("beforeRender",o)}},this.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",t=this.renderer.$cursorLayer;if(!t)return;t.setSmoothBlinking(/smooth/.test(e)),t.isBlinking=!this.$readOnly&&e!="wide",i.setCssClass(t.element,"ace_slim-cursors",/slim/.test(e))},this.prompt=function(e,t,n){var r=this;g.loadModule("./ext/prompt",function(i){i.prompt(r,e,t,n)})}}.call(w.prototype),g.defineOptions(w.prototype,"editor",{selectionStyle:{set:function(e){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:e})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(e){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(e){this.textInput.setReadOnly(e),this.$resetCursorStyle()},initialValue:!1},copyWithEmptySelection:{set:function(e){this.textInput.setCopyWithEmptySelection(e)},initialValue:!1},cursorStyle:{set:function(e){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},autoScrollEditorIntoView:{set:function(e){this.setAutoScrollEditorIntoView(e)}},keyboardHandler:{set:function(e){this.setKeyboardHandler(e)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(e){this.session.setValue(e)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(e){this.setSession(e)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(e){this.renderer.$gutterLayer.setShowLineNumbers(e),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),e&&this.$relativeLineNumbers?E.attach(this):E.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(e){this.$showLineNumbers&&e?E.attach(this):E.detach(this)}},hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var E={getText:function(e,t){return(Math.abs(e.selection.lead.row-t)||t+1+(t<9?"\u00b7":""))+""},getWidth:function(e,t,n){return Math.max(t.toString().length,(n.lastRow+1).toString().length,2)*n.characterWidth},update:function(e,t){t.renderer.$loop.schedule(t.renderer.CHANGE_GUTTER)},attach:function(e){e.renderer.$gutterLayer.$renderer=this,e.on("changeSelection",this.update),this.update(null,e)},detach:function(e){e.renderer.$gutterLayer.$renderer==this&&(e.renderer.$gutterLayer.$renderer=null),e.off("changeSelection",this.update),this.update(null,e)}};t.Editor=w}),ace.define("ace/undomanager",["require","exports","module","ace/range"],function(e,t,n){"use strict";function i(e,t){for(var n=t;n--;){var r=e[n];if(r&&!r[0].ignore){while(n0){a.row+=i,a.column+=a.row==r.row?s:0;continue}!t&&l<=0&&(a.row=n.row,a.column=n.column,l===0&&(a.bias=1))}}function f(e){return{row:e.row,column:e.column}}function l(e){return{start:f(e.start),end:f(e.end),action:e.action,lines:e.lines.slice()}}function c(e){e=e||this;if(Array.isArray(e))return e.map(c).join("\n");var t="";e.action?(t=e.action=="insert"?"+":"-",t+="["+e.lines+"]"):e.value&&(Array.isArray(e.value)?t=e.value.map(h).join("\n"):t=h(e.value)),e.start&&(t+=h(e));if(e.id||e.rev)t+=" ("+(e.id||e.rev)+")";return t}function h(e){return e.start.row+":"+e.start.column+"=>"+e.end.row+":"+e.end.column}function p(e,t){var n=e.action=="insert",r=t.action=="insert";if(n&&r)if(o(t.start,e.end)>=0)m(t,e,-1);else{if(!(o(t.start,e.start)<=0))return null;m(e,t,1)}else if(n&&!r)if(o(t.start,e.end)>=0)m(t,e,-1);else{if(!(o(t.end,e.start)<=0))return null;m(e,t,-1)}else if(!n&&r)if(o(t.start,e.start)>=0)m(t,e,1);else{if(!(o(t.start,e.start)<=0))return null;m(e,t,1)}else if(!n&&!r)if(o(t.start,e.start)>=0)m(t,e,1);else{if(!(o(t.end,e.start)<=0))return null;m(e,t,-1)}return[t,e]}function d(e,t){for(var n=e.length;n--;)for(var r=0;r=0?m(e,t,-1):o(e.start,t.start)<=0?m(t,e,1):(m(e,s.fromPoints(t.start,e.start),-1),m(t,e,1));else if(!n&&r)o(t.start,e.end)>=0?m(t,e,-1):o(t.start,e.start)<=0?m(e,t,1):(m(t,s.fromPoints(e.start,t.start),-1),m(e,t,1));else if(!n&&!r)if(o(t.start,e.end)>=0)m(t,e,-1);else{if(!(o(t.end,e.start)<=0)){var i,u;return o(e.start,t.start)<0&&(i=e,e=y(e,t.start)),o(e.end,t.end)>0&&(u=y(e,t.end)),g(t.end,e.start,e.end,-1),u&&!i&&(e.lines=u.lines,e.start=u.start,e.end=u.end,u=e),[t,i,u].filter(Boolean)}m(e,t,-1)}return[t,e]}function m(e,t,n){g(e.start,t.start,t.end,n),g(e.end,t.start,t.end,n)}function g(e,t,n,r){e.row==(r==1?t:n).row&&(e.column+=r*(n.column-t.column)),e.row+=r*(n.row-t.row)}function y(e,t){var n=e.lines,r=e.end;e.end=f(t);var i=e.end.row-e.start.row,s=n.splice(i,n.length),o=i?t.column:t.column-e.start.column;n.push(s[0].substring(0,o)),s[0]=s[0].substr(o);var u={start:f(t),end:r,lines:s,action:e.action};return u}function b(e,t){t=l(t);for(var n=e.length;n--;){var r=e[n];for(var i=0;i0},this.canRedo=function(){return this.$redoStack.length>0},this.bookmark=function(e){e==undefined&&(e=this.$rev),this.mark=e},this.isAtBookmark=function(){return this.$rev===this.mark},this.toJSON=function(){},this.fromJSON=function(){},this.hasUndo=this.canUndo,this.hasRedo=this.canRedo,this.isClean=this.isAtBookmark,this.markClean=this.bookmark,this.$prettyPrint=function(e){return e?c(e):c(this.$undoStack)+"\n---\n"+c(this.$redoStack)}}).call(r.prototype);var s=e("./range").Range,o=s.comparePoints,u=s.comparePoints;t.UndoManager=r}),ace.define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../lib/dom"),i=function(e,t){this.element=e,this.canvasHeight=t||5e5,this.element.style.height=this.canvasHeight*2+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0};(function(){this.moveContainer=function(e){r.translate(this.element,0,-(e.firstRowScreen*e.lineHeight%this.canvasHeight)-e.offset*this.$offsetCoefficient)},this.pageChanged=function(e,t){return Math.floor(e.firstRowScreen*e.lineHeight/this.canvasHeight)!==Math.floor(t.firstRowScreen*t.lineHeight/this.canvasHeight)},this.computeLineTop=function(e,t,n){var r=t.firstRowScreen*t.lineHeight,i=Math.floor(r/this.canvasHeight),s=n.documentToScreenRow(e,0)*t.lineHeight;return s-i*this.canvasHeight},this.computeLineHeight=function(e,t,n){return t.lineHeight*n.getRowLength(e)},this.getLength=function(){return this.cells.length},this.get=function(e){return this.cells[e]},this.shift=function(){this.$cacheCell(this.cells.shift())},this.pop=function(){this.$cacheCell(this.cells.pop())},this.push=function(e){if(Array.isArray(e)){this.cells.push.apply(this.cells,e);var t=r.createFragment(this.element);for(var n=0;ns&&(a=i.end.row+1,i=t.getNextFoldLine(a,i),s=i?i.start.row:Infinity);if(a>r){while(this.$lines.getLength()>u+1)this.$lines.pop();break}o=this.$lines.get(++u),o?o.row=a:(o=this.$lines.createCell(a,e,this.session,f),this.$lines.push(o)),this.$renderCell(o,e,i,a),a++}this._signal("afterRender"),this.$updateGutterWidth(e)},this.$updateGutterWidth=function(e){var t=this.session,n=t.gutterRenderer||this.$renderer,r=t.$firstLineNumber,i=this.$lines.last()?this.$lines.last().text:"";if(this.$fixedWidth||t.$useWrapMode)i=t.getLength()+r-1;var s=n?n.getWidth(t,i,e):i.toString().length*e.characterWidth,o=this.$padding||this.$computePadding();s+=o.left+o.right,s!==this.gutterWidth&&!isNaN(s)&&(this.gutterWidth=s,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",s))},this.$updateCursorRow=function(){if(!this.$highlightGutterLine)return;var e=this.session.selection.getCursor();if(this.$cursorRow===e.row)return;this.$cursorRow=e.row},this.updateLineHighlight=function(){if(!this.$highlightGutterLine)return;var e=this.session.selection.cursor.row;this.$cursorRow=e;if(this.$cursorCell&&this.$cursorCell.row==e)return;this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var t=this.$lines.cells;this.$cursorCell=null;for(var n=0;n=this.$cursorRow){if(r.row>this.$cursorRow){var i=this.session.getFoldLine(this.$cursorRow);if(!(n>0&&i&&i.start.row==t[n-1].row))break;r=t[n-1]}r.element.className="ace_gutter-active-line "+r.element.className,this.$cursorCell=r;break}}},this.scrollLines=function(e){var t=this.config;this.config=e,this.$updateCursorRow();if(this.$lines.pageChanged(t,e))return this.update(e);this.$lines.moveContainer(e);var n=Math.min(e.lastRow+e.gutterOffset,this.session.getLength()-1),r=this.oldLastRow;this.oldLastRow=n;if(!t||r0;i--)this.$lines.shift();if(r>n)for(var i=this.session.getFoldedRowCount(n+1,r);i>0;i--)this.$lines.pop();e.firstRowr&&this.$lines.push(this.$renderLines(e,r+1,n)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(e)},this.$renderLines=function(e,t,n){var r=[],i=t,s=this.session.getNextFoldLine(i),o=s?s.start.row:Infinity;for(;;){i>o&&(i=s.end.row+1,s=this.session.getNextFoldLine(i,s),o=s?s.start.row:Infinity);if(i>n)break;var u=this.$lines.createCell(i,e,this.session,f);this.$renderCell(u,e,s,i),r.push(u),i++}return r},this.$renderCell=function(e,t,n,i){var s=e.element,o=this.session,u=s.childNodes[0],a=s.childNodes[1],f=o.$firstLineNumber,l=o.$breakpoints,c=o.$decorations,h=o.gutterRenderer||this.$renderer,p=this.$showFoldWidgets&&o.foldWidgets,d=n?n.start.row:Number.MAX_VALUE,v="ace_gutter-cell ";this.$highlightGutterLine&&(i==this.$cursorRow||n&&i=d&&this.$cursorRow<=n.end.row)&&(v+="ace_gutter-active-line ",this.$cursorCell!=e&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=e)),l[i]&&(v+=l[i]),c[i]&&(v+=c[i]),this.$annotations[i]&&(v+=this.$annotations[i].className),s.className!=v&&(s.className=v);if(p){var m=p[i];m==null&&(m=p[i]=o.getFoldWidget(i))}if(m){var v="ace_fold-widget ace_"+m;m=="start"&&i==d&&in.right-t.right)return"foldWidgets"}}).call(a.prototype),t.Gutter=a}),ace.define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../range").Range,i=e("../lib/dom"),s=function(e){this.element=i.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)};(function(){function e(e,t,n,r){return(e?1:0)|(t?2:0)|(n?4:0)|(r?8:0)}this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setMarkers=function(e){this.markers=e},this.elt=function(e,t){var n=this.i!=-1&&this.element.childNodes[this.i];n?this.i++:(n=document.createElement("div"),this.element.appendChild(n),this.i=-1),n.style.cssText=t,n.className=e},this.update=function(e){if(!e)return;this.config=e,this.i=0;var t;for(var n in this.markers){var r=this.markers[n];if(!r.range){r.update(t,this,this.session,e);continue}var i=r.range.clipRows(e.firstRow,e.lastRow);if(i.isEmpty())continue;i=i.toScreenRange(this.session);if(r.renderer){var s=this.$getTop(i.start.row,e),o=this.$padding+i.start.column*e.characterWidth;r.renderer(t,i,o,s,e)}else r.type=="fullLine"?this.drawFullLineMarker(t,i,r.clazz,e):r.type=="screenLine"?this.drawScreenLineMarker(t,i,r.clazz,e):i.isMultiLine()?r.type=="text"?this.drawTextMarker(t,i,r.clazz,e):this.drawMultiLineMarker(t,i,r.clazz,e):this.drawSingleLineMarker(t,i,r.clazz+" ace_start"+" ace_br15",e)}if(this.i!=-1)while(this.ip,l==f),s,l==f?0:1,o)},this.drawMultiLineMarker=function(e,t,n,r,i){var s=this.$padding,o=r.lineHeight,u=this.$getTop(t.start.row,r),a=s+t.start.column*r.characterWidth;i=i||"";if(this.session.$bidiHandler.isBidiRow(t.start.row)){var f=t.clone();f.end.row=f.start.row,f.end.column=this.session.getLine(f.start.row).length,this.drawBidiSingleLineMarker(e,f,n+" ace_br1 ace_start",r,null,i)}else this.elt(n+" ace_br1 ace_start","height:"+o+"px;"+"right:0;"+"top:"+u+"px;left:"+a+"px;"+(i||""));if(this.session.$bidiHandler.isBidiRow(t.end.row)){var f=t.clone();f.start.row=f.end.row,f.start.column=0,this.drawBidiSingleLineMarker(e,f,n+" ace_br12",r,null,i)}else{u=this.$getTop(t.end.row,r);var l=t.end.column*r.characterWidth;this.elt(n+" ace_br12","height:"+o+"px;"+"width:"+l+"px;"+"top:"+u+"px;"+"left:"+s+"px;"+(i||""))}o=(t.end.row-t.start.row-1)*r.lineHeight;if(o<=0)return;u=this.$getTop(t.start.row+1,r);var c=(t.start.column?1:0)|(t.end.column?0:8);this.elt(n+(c?" ace_br"+c:""),"height:"+o+"px;"+"right:0;"+"top:"+u+"px;"+"left:"+s+"px;"+(i||""))},this.drawSingleLineMarker=function(e,t,n,r,i,s){if(this.session.$bidiHandler.isBidiRow(t.start.row))return this.drawBidiSingleLineMarker(e,t,n,r,i,s);var o=r.lineHeight,u=(t.end.column+(i||0)-t.start.column)*r.characterWidth,a=this.$getTop(t.start.row,r),f=this.$padding+t.start.column*r.characterWidth;this.elt(n,"height:"+o+"px;"+"width:"+u+"px;"+"top:"+a+"px;"+"left:"+f+"px;"+(s||""))},this.drawBidiSingleLineMarker=function(e,t,n,r,i,s){var o=r.lineHeight,u=this.$getTop(t.start.row,r),a=this.$padding,f=this.session.$bidiHandler.getSelections(t.start.column,t.end.column);f.forEach(function(e){this.elt(n,"height:"+o+"px;"+"width:"+e.width+(i||0)+"px;"+"top:"+u+"px;"+"left:"+(a+e.left)+"px;"+(s||""))},this)},this.drawFullLineMarker=function(e,t,n,r,i){var s=this.$getTop(t.start.row,r),o=r.lineHeight;t.start.row!=t.end.row&&(o+=this.$getTop(t.end.row,r)-s),this.elt(n,"height:"+o+"px;"+"top:"+s+"px;"+"left:0;right:0;"+(i||""))},this.drawScreenLineMarker=function(e,t,n,r,i){var s=this.$getTop(t.start.row,r),o=r.lineHeight;this.elt(n,"height:"+o+"px;"+"top:"+s+"px;"+"left:0;right:0;"+(i||""))}}).call(s.prototype),t.Marker=s}),ace.define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../lib/dom"),s=e("../lib/lang"),o=e("./lines").Lines,u=e("../lib/event_emitter").EventEmitter,a=function(e){this.dom=i,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new o(this.element)};(function(){r.implement(this,u),this.EOF_CHAR="\u00b6",this.EOL_CHAR_LF="\u00ac",this.EOL_CHAR_CRLF="\u00a4",this.EOL_CHAR=this.EOL_CHAR_LF,this.TAB_CHAR="\u2014",this.SPACE_CHAR="\u00b7",this.$padding=0,this.MAX_LINE_LENGTH=1e4,this.$updateEolChar=function(){var e=this.session.doc,t=e.getNewLineCharacter()=="\n"&&e.getNewLineMode()!="windows",n=t?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=n)return this.EOL_CHAR=n,!0},this.setPadding=function(e){this.$padding=e,this.element.style.margin="0 "+e+"px"},this.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},this.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},this.$setFontMetrics=function(e){this.$fontMetrics=e,this.$fontMetrics.on("changeCharacterSize",function(e){this._signal("changeCharacterSize",e)}.bind(this)),this.$pollSizeChanges()},this.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},this.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},this.setSession=function(e){this.session=e,e&&this.$computeTabString()},this.showInvisibles=!1,this.setShowInvisibles=function(e){return this.showInvisibles==e?!1:(this.showInvisibles=e,this.$computeTabString(),!0)},this.displayIndentGuides=!0,this.setDisplayIndentGuides=function(e){return this.displayIndentGuides==e?!1:(this.displayIndentGuides=e,this.$computeTabString(),!0)},this.$tabStrings=[],this.onChangeTabSize=this.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;var t=this.$tabStrings=[0];for(var n=1;nl&&(u=a.end.row+1,a=this.session.getNextFoldLine(u,a),l=a?a.start.row:Infinity);if(u>i)break;var c=s[o++];if(c){this.dom.removeChildren(c),this.$renderLine(c,u,u==l?a:!1);var h=e.lineHeight*this.session.getRowLength(u)+"px";c.style.height!=h&&(f=!0,c.style.height=h)}u++}if(f)while(o0;i--)this.$lines.shift();if(t.lastRow>e.lastRow)for(var i=this.session.getFoldedRowCount(e.lastRow+1,t.lastRow);i>0;i--)this.$lines.pop();e.firstRowt.lastRow&&this.$lines.push(this.$renderLinesFragment(e,t.lastRow+1,e.lastRow))},this.$renderLinesFragment=function(e,t,n){var r=[],s=t,o=this.session.getNextFoldLine(s),u=o?o.start.row:Infinity;for(;;){s>u&&(s=o.end.row+1,o=this.session.getNextFoldLine(s,o),u=o?o.start.row:Infinity);if(s>n)break;var a=this.$lines.createCell(s,e,this.session),f=a.element;this.dom.removeChildren(f),i.setStyle(f.style,"height",this.$lines.computeLineHeight(s,e,this.session)+"px"),i.setStyle(f.style,"top",this.$lines.computeLineTop(s,e,this.session)+"px"),this.$renderLine(f,s,s==u?o:!1),this.$useLineGroups()?f.className="ace_line_group":f.className="ace_line",r.push(a),s++}return r},this.update=function(e){this.$lines.moveContainer(e),this.config=e;var t=e.firstRow,n=e.lastRow,r=this.$lines;while(r.getLength())r.pop();r.push(this.$renderLinesFragment(e,t,n))},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderToken=function(e,t,n,r){var i=this,o=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC]+)|(\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,u=this.dom.createFragment(this.element),a,f=0;while(a=o.exec(r)){var l=a[1],c=a[2],h=a[3],p=a[4],d=a[5];if(!i.showInvisibles&&c)continue;var v=f!=a.index?r.slice(f,a.index):"";f=a.index+a[0].length,v&&u.appendChild(this.dom.createTextNode(v,this.element));if(l){var m=i.session.getScreenTabSize(t+a.index);u.appendChild(i.$tabStrings[m].cloneNode(!0)),t+=m-1}else if(c)if(i.showInvisibles){var g=this.dom.createElement("span");g.className="ace_invisible ace_invisible_space",g.textContent=s.stringRepeat(i.SPACE_CHAR,c.length),u.appendChild(g)}else u.appendChild(this.com.createTextNode(c,this.element));else if(h){var g=this.dom.createElement("span");g.className="ace_invisible ace_invisible_space ace_invalid",g.textContent=s.stringRepeat(i.SPACE_CHAR,h.length),u.appendChild(g)}else if(p){var y=i.showInvisibles?i.SPACE_CHAR:"";t+=1;var g=this.dom.createElement("span");g.style.width=i.config.characterWidth*2+"px",g.className=i.showInvisibles?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",g.textContent=i.showInvisibles?i.SPACE_CHAR:"",u.appendChild(g)}else if(d){t+=1;var g=this.dom.createElement("span");g.style.width=i.config.characterWidth*2+"px",g.className="ace_cjk",g.textContent=d,u.appendChild(g)}}u.appendChild(this.dom.createTextNode(f?r.slice(f):r,this.element));if(!this.$textToken[n.type]){var b="ace_"+n.type.replace(/\./g," ace_"),g=this.dom.createElement("span");n.type=="fold"&&(g.style.width=n.value.length*this.config.characterWidth+"px"),g.className=b,g.appendChild(u),e.appendChild(g)}else e.appendChild(u);return t+r.length},this.renderIndentGuide=function(e,t,n){var r=t.search(this.$indentGuideRe);if(r<=0||r>=n)return t;if(t[0]==" "){r-=r%this.tabSize;var i=r/this.tabSize;for(var s=0;s=o)u=this.$renderToken(a,u,l,c.substring(0,o-r)),c=c.substring(o-r),r=o,a=this.$createLineElement(),e.appendChild(a),a.appendChild(this.dom.createTextNode(s.stringRepeat("\u00a0",n.indent),this.element)),i++,u=0,o=n[i]||Number.MAX_VALUE;c.length!=0&&(r+=c.length,u=this.$renderToken(a,u,l,c))}}n[n.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(a,u,null,"",!0)},this.$renderSimpleLine=function(e,t){var n=0,r=t[0],i=r.value;this.displayIndentGuides&&(i=this.renderIndentGuide(e,i)),i&&(n=this.$renderToken(e,n,r,i));for(var s=1;sthis.MAX_LINE_LENGTH)return this.$renderOverflowMessage(e,n,r,i);n=this.$renderToken(e,n,r,i)}},this.$renderOverflowMessage=function(e,t,n,r,i){n&&this.$renderToken(e,t,n,r.slice(0,this.MAX_LINE_LENGTH-t));var s=this.dom.createElement("span");s.className="ace_inline_button ace_keyword ace_toggle_wrap",s.textContent=i?"":"",e.appendChild(s)},this.$renderLine=function(e,t,n){!n&&n!=0&&(n=this.session.getFoldLine(t));if(n)var r=this.$getFoldLineTokens(t,n);else var r=this.session.getTokens(t);var i=e;if(r.length){var s=this.session.getRowSplitData(t);if(s&&s.length){this.$renderWrappedLine(e,r,s);var i=e.lastChild}else{var i=e;this.$useLineGroups()&&(i=this.$createLineElement(),e.appendChild(i)),this.$renderSimpleLine(i,r)}}else this.$useLineGroups()&&(i=this.$createLineElement(),e.appendChild(i));if(this.showInvisibles&&i){n&&(t=n.end.row);var o=this.dom.createElement("span");o.className="ace_invisible ace_invisible_eol",o.textContent=t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,i.appendChild(o)}},this.$getFoldLineTokens=function(e,t){function i(e,t,n){var i=0,s=0;while(s+e[i].value.lengthn-t&&(o=o.substring(0,n-t)),r.push({type:e[i].type,value:o}),s=t+o.length,i+=1}while(sn?r.push({type:e[i].type,value:o.substring(0,n-s)}):r.push(e[i]),s+=o.length,i+=1}}var n=this.session,r=[],s=n.getTokens(e);return t.walk(function(e,t,o,u,a){e!=null?r.push({type:"fold",value:e}):(a&&(s=n.getTokens(t)),s.length&&i(s,u,o))},t.end.row,this.session.getLine(t.end.row).length),r},this.$useLineGroups=function(){return this.session.getUseWrapMode()},this.destroy=function(){}}).call(a.prototype),t.Text=a}),ace.define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../lib/dom"),i=function(e){this.element=r.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),r.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)};(function(){this.$updateOpacity=function(e){var t=this.cursors;for(var n=t.length;n--;)r.setStyle(t[n].style,"opacity",e?"":"0")},this.$startCssAnimation=function(){var e=this.cursors;for(var t=e.length;t--;)e[t].style.animationDuration=this.blinkInterval+"ms";setTimeout(function(){r.addCssClass(this.element,"ace_animate-blinking")}.bind(this))},this.$stopCssAnimation=function(){r.removeCssClass(this.element,"ace_animate-blinking")},this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},this.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},this.setSmoothBlinking=function(e){e!=this.smoothBlinking&&(this.smoothBlinking=e,r.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.restartTimer())},this.addCursor=function(){var e=r.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},this.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},this.hideCursor=function(){this.isVisible=!1,r.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.showCursor=function(){this.isVisible=!0,r.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.restartTimer=function(){var e=this.$updateCursors;clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&r.removeCssClass(this.element,"ace_smooth-blinking"),e(!0);if(!this.isBlinking||!this.blinkInterval||!this.isVisible){this.$stopCssAnimation();return}this.smoothBlinking&&setTimeout(function(){r.addCssClass(this.element,"ace_smooth-blinking")}.bind(this));if(r.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var t=function(){this.timeoutId=setTimeout(function(){e(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){e(!0),t()},this.blinkInterval),t()}},this.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var n=this.session.documentToScreenPosition(e),r=this.$padding+(this.session.$bidiHandler.isBidiRow(n.row,e.row)?this.session.$bidiHandler.getPosLeft(n.column):n.column*this.config.characterWidth),i=(n.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:r,top:i}},this.isCursorInView=function(e,t){return e.top>=0&&e.tope.height+e.offset||o.top<0)&&n>1)continue;var u=this.cursors[i++]||this.addCursor(),a=u.style;this.drawCursor?this.drawCursor(u,o,e,t[n],this.session):this.isCursorInView(o,e)?(r.setStyle(a,"display","block"),r.translate(u,o.left,o.top),r.setStyle(a,"width",Math.round(e.characterWidth)+"px"),r.setStyle(a,"height",e.lineHeight+"px")):r.setStyle(a,"display","none")}while(this.cursors.length>i)this.removeCursor();var f=this.session.getOverwrite();this.$setOverwrite(f),this.$pixelPos=o,this.restartTimer()},this.drawCursor=null,this.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?r.addCssClass(this.element,"ace_overwrite-cursors"):r.removeCssClass(this.element,"ace_overwrite-cursors"))},this.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)}}).call(i.prototype),t.Cursor=i}),ace.define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter,u=32768,a=function(e){this.element=i.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+this.classSuffix,this.inner=i.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent="\u00a0",this.element.appendChild(this.inner),e.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)};(function(){r.implement(this,o),this.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1}}).call(a.prototype);var f=function(e,t){a.call(this,e),this.scrollTop=0,this.scrollHeight=0,t.$scrollbarWidth=this.width=i.scrollbarWidth(e.ownerDocument),this.inner.style.width=this.element.style.width=(this.width||15)+5+"px",this.$minWidth=0};r.inherits(f,a),function(){this.classSuffix="-v",this.onScroll=function(){if(!this.skipEvent){this.scrollTop=this.element.scrollTop;if(this.coeff!=1){var e=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-e)/(this.coeff-e)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},this.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},this.setHeight=function(e){this.element.style.height=e+"px"},this.setInnerHeight=this.setScrollHeight=function(e){this.scrollHeight=e,e>u?(this.coeff=u/e,e=u):this.coeff!=1&&(this.coeff=1),this.inner.style.height=e+"px"},this.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=e,this.element.scrollTop=e*this.coeff)}}.call(f.prototype);var l=function(e,t){a.call(this,e),this.scrollLeft=0,this.height=t.$scrollbarWidth,this.inner.style.height=this.element.style.height=(this.height||15)+5+"px"};r.inherits(l,a),function(){this.classSuffix="-h",this.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},this.getHeight=function(){return this.isVisible?this.height:0},this.setWidth=function(e){this.element.style.width=e+"px"},this.setInnerWidth=function(e){this.inner.style.width=e+"px"},this.setScrollWidth=function(e){this.inner.style.width=e+"px"},this.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)}}.call(l.prototype),t.ScrollBar=f,t.ScrollBarV=f,t.ScrollBarH=l,t.VScrollBar=f,t.HScrollBar=l}),ace.define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,t,n){"use strict";var r=e("./lib/event"),i=function(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=t||window;var n=this;this._flush=function(e){n.pending=!1;var t=n.changes;t&&(r.blockIdle(100),n.changes=0,n.onRender(t));if(n.changes){if(n.$recursionLimit--<0)return;n.schedule()}else n.$recursionLimit=2}};(function(){this.schedule=function(e){this.changes=this.changes|e,this.changes&&!this.pending&&(r.nextFrame(this._flush),this.pending=!0)},this.clear=function(e){var t=this.changes;return this.changes=0,t}}).call(i.prototype),t.RenderLoop=i}),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(e,t,n){var r=e("../lib/oop"),i=e("../lib/dom"),s=e("../lib/lang"),o=e("../lib/event"),u=e("../lib/useragent"),a=e("../lib/event_emitter").EventEmitter,f=256,l=typeof ResizeObserver=="function",c=200,h=t.FontMetrics=function(e){this.el=i.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=i.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=i.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),this.$measureNode.innerHTML=s.stringRepeat("X",f),this.$characterSize={width:0,height:0},l?this.$addObserver():this.checkForSizeChanges()};(function(){r.implement(this,a),this.$characterSize={width:0,height:0},this.$setMeasureNodeStyles=function(e,t){e.width=e.height="auto",e.left=e.top="0px",e.visibility="hidden",e.position="absolute",e.whiteSpace="pre",u.isIE<8?e["font-family"]="inherit":e.font="inherit",e.overflow=t?"hidden":"visible"},this.checkForSizeChanges=function(e){e===undefined&&(e=this.$measureSizes());if(e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var t=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=t&&t.width===e.width&&t.height===e.height,this._emit("changeCharacterSize",{data:e})}},this.$addObserver=function(){var e=this;this.$observer=new window.ResizeObserver(function(t){var n=t[0].contentRect;e.checkForSizeChanges({height:n.height,width:n.width/f})}),this.$observer.observe(this.$measureNode)},this.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=o.onIdle(function t(){e.checkForSizeChanges(),o.onIdle(t,500)},500)},this.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},this.$measureSizes=function(e){var t={height:(e||this.$measureNode).clientHeight,width:(e||this.$measureNode).clientWidth/f};return t.width===0||t.height===0?null:t},this.$measureCharWidth=function(e){this.$main.innerHTML=s.stringRepeat(e,f);var t=this.$main.getBoundingClientRect();return t.width/f},this.getCharacterWidth=function(e){var t=this.charSizes[e];return t===undefined&&(t=this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),t},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},this.$getZoom=function e(t){return t?(window.getComputedStyle(t).zoom||1)*e(t.parentElement):1},this.$initTransformMeasureNodes=function(){var e=function(e,t){return["div",{style:"position: absolute;top:"+e+"px;left:"+t+"px;"}]};this.els=i.buildDom([e(0,0),e(c,0),e(0,c),e(c,c)],this.el)},this.transformCoordinates=function(e,t){function r(e,t,n){var r=e[1]*t[0]-e[0]*t[1];return[(-t[1]*n[0]+t[0]*n[1])/r,(+e[1]*n[0]-e[0]*n[1])/r]}function i(e,t){return[e[0]-t[0],e[1]-t[1]]}function s(e,t){return[e[0]+t[0],e[1]+t[1]]}function o(e,t){return[e*t[0],e*t[1]]}function u(e){var t=e.getBoundingClientRect();return[t.left,t.top]}if(e){var n=this.$getZoom(this.el);e=o(1/n,e)}this.els||this.$initTransformMeasureNodes();var a=u(this.els[0]),f=u(this.els[1]),l=u(this.els[2]),h=u(this.els[3]),p=r(i(h,f),i(h,l),i(s(f,l),s(h,a))),d=o(1+p[0],i(f,a)),v=o(1+p[1],i(l,a));if(t){var m=t,g=p[0]*m[0]/c+p[1]*m[1]/c+1,y=s(o(m[0],d),o(m[1],v));return s(o(1/g/c,y),a)}var b=i(e,a),w=r(i(d,o(p[0],b)),i(v,o(p[1],b)),b);return o(c,w)}}).call(h.prototype)}),ace.define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./config"),o=e("./layer/gutter").Gutter,u=e("./layer/marker").Marker,a=e("./layer/text").Text,f=e("./layer/cursor").Cursor,l=e("./scrollbar").HScrollBar,c=e("./scrollbar").VScrollBar,h=e("./renderloop").RenderLoop,p=e("./layer/font_metrics").FontMetrics,d=e("./lib/event_emitter").EventEmitter,v='.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;font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'source-code-pro\', monospace;direction: ltr;text-align: left;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.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;}.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_selecting, .ace_selecting * {cursor: text !important;}.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 {box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;}.ace_gutter-cell {position: absolute;top: 0;left: 0;right: 0;padding-left: 19px;padding-right: 6px;background-repeat: no-repeat;}.ace_gutter-cell.ace_error {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 {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-position: 2px center;}.ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");background-position: 2px center;}.ace_dark .ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");}.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;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;perspective: 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;word-wrap: normal;white-space: pre;height: 100%;width: 100%;box-sizing: border-box;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;will-change: transform;}.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;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_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_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: #FFF;background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));border: 1px solid gray;border-radius: 1px;box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);color: black;max-width: 100%;padding: 3px 4px;position: fixed;z-index: 999999;box-sizing: border-box;cursor: default;white-space: pre;word-wrap: break-word;line-height: normal;font-style: normal;font-weight: normal;letter-spacing: normal;pointer-events: none;}.ace_folding-enabled > .ace_gutter-cell {padding-right: 13px;}.ace_fold-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;}.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);}.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;}',m=e("./lib/useragent"),g=m.isIE;i.importCssString(v,"ace_editor.css");var y=function(e,t){var n=this;this.container=e||i.createElement("div"),i.addCssClass(this.container,"ace_editor"),i.HI_DPI&&i.addCssClass(this.container,"ace_hidpi"),this.setTheme(t),this.$gutter=i.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden",!0),this.scroller=i.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=i.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new o(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new u(this.content);var r=this.$textLayer=new a(this.content);this.canvas=r.element,this.$markerFront=new u(this.content),this.$cursorLayer=new f(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new c(this.container,this),this.scrollBarH=new l(this.container,this),this.scrollBarV.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollTop(e.data-n.scrollMargin.top)}),this.scrollBarH.addEventListener("scroll",function(e){n.$scrollAnimation||n.session.setScrollLeft(e.data-n.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new p(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.addEventListener("changeCharacterSize",function(e){n.updateCharacterSize(),n.onResize(!0,n.gutterWidth,n.$size.width,n.$size.height),n._signal("changeCharacterSize",e)}),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=!m.isIOS,this.$loop=new h(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),s.resetOptions(this),s._signal("renderer",this)};(function(){this.CHANGE_CURSOR=1,this.CHANGE_MARKER=2,this.CHANGE_GUTTER=4,this.CHANGE_SCROLL=8,this.CHANGE_LINES=16,this.CHANGE_TEXT=32,this.CHANGE_SIZE=64,this.CHANGE_MARKER_BACK=128,this.CHANGE_MARKER_FRONT=256,this.CHANGE_FULL=512,this.CHANGE_H_SCROLL=1024,r.implement(this,d),this.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()},this.setSession=function(e){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=e,e&&this.scrollMargin.top&&e.getScrollTop()<=0&&e.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e);if(!e)return;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)},this.updateLines=function(e,t,n){t===undefined&&(t=Infinity),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRowthis.layerConfig.lastRow)return;this.$loop.schedule(this.CHANGE_LINES)},this.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},this.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},this.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},this.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},this.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},this.$changes=0,this.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},this.onResize=function(e,t,n,r){if(this.resizing>2)return;this.resizing>0?this.resizing++:this.resizing=e?1:0;var i=this.container;r||(r=i.clientHeight||i.scrollHeight),n||(n=i.clientWidth||i.scrollWidth);var s=this.$updateCachedSize(e,t,n,r);if(!this.$size.scrollerHeight||!n&&!r)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(s|this.$changes,!0):this.$loop.schedule(s|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarV.scrollLeft=this.scrollBarV.scrollTop=null},this.$updateCachedSize=function(e,t,n,r){r-=this.$extraHeight||0;var s=0,o=this.$size,u={width:o.width,height:o.height,scrollerHeight:o.scrollerHeight,scrollerWidth:o.scrollerWidth};r&&(e||o.height!=r)&&(o.height=r,s|=this.CHANGE_SIZE,o.scrollerHeight=o.height,this.$horizScroll&&(o.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",s|=this.CHANGE_SCROLL);if(n&&(e||o.width!=n)){s|=this.CHANGE_SIZE,o.width=n,t==null&&(t=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=t,i.setStyle(this.scrollBarH.element.style,"left",t+"px"),i.setStyle(this.scroller.style,"left",t+this.margin.left+"px"),o.scrollerWidth=Math.max(0,n-t-this.scrollBarV.getWidth()-this.margin.h),i.setStyle(this.$gutter.style,"left",this.margin.left+"px");var a=this.scrollBarV.getWidth()+"px";i.setStyle(this.scrollBarH.element.style,"right",a),i.setStyle(this.scroller.style,"right",a),i.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight());if(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)s|=this.CHANGE_FULL}return o.$dirty=!n||!r,s&&this._signal("resize",u),s},this.onGutterResize=function(e){var t=this.$showGutter?e:0;t!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,t,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()},this.adjustWrapLimit=function(){var e=this.$size.scrollerWidth-this.$padding*2,t=Math.floor(e/this.characterWidth);return this.session.adjustWrapLimit(t,this.$showPrintMargin&&this.$printMarginColumn)},this.setAnimatedScroll=function(e){this.setOption("animatedScroll",e)},this.getAnimatedScroll=function(){return this.$animatedScroll},this.setShowInvisibles=function(e){this.setOption("showInvisibles",e),this.session.$bidiHandler.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.getOption("showInvisibles")},this.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},this.setDisplayIndentGuides=function(e){this.setOption("displayIndentGuides",e)},this.setShowPrintMargin=function(e){this.setOption("showPrintMargin",e)},this.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},this.setPrintMarginColumn=function(e){this.setOption("printMarginColumn",e)},this.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},this.getShowGutter=function(){return this.getOption("showGutter")},this.setShowGutter=function(e){return this.setOption("showGutter",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.$updatePrintMargin=function(){if(!this.$showPrintMargin&&!this.$printMarginEl)return;if(!this.$printMarginEl){var e=i.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=i.createElement("div"),this.$printMarginEl.className="ace_print-margin",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var t=this.$printMarginEl.style;t.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",t.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&this.session.$wrap==-1&&this.adjustWrapLimit()},this.getContainerElement=function(){return this.container},this.getMouseEventTarget=function(){return this.scroller},this.getTextAreaContainer=function(){return this.container},this.$moveTextAreaToCursor=function(){if(this.$isMousePressed)return;var e=this.textarea.style,t=this.$composition;if(!this.$keepTextAreaAtCursor&&!t){i.translate(this.textarea,-100,0);return}var n=this.$cursorLayer.$pixelPos;if(!n)return;t&&t.markerRange&&(n=this.$cursorLayer.getPixelPosition(t.markerRange.start,!0));var r=this.layerConfig,s=n.top,o=n.left;s-=r.offset;var u=t&&t.useTextareaForIME?this.lineHeight:g?0:1;if(s<0||s>r.height-u){i.translate(this.textarea,0,0);return}var a=1;if(!t)s+=this.lineHeight;else if(t.useTextareaForIME){var f=this.textarea.value;a=this.characterWidth*this.session.$getStringScreenWidth(f)[0],u+=2}else s+=this.lineHeight+2;o-=this.scrollLeft,o>this.$size.scrollerWidth-a&&(o=this.$size.scrollerWidth-a),o+=this.gutterWidth+this.margin.left,i.setStyle(e,"height",u+"px"),i.setStyle(e,"width",a+"px"),i.translate(this.textarea,Math.min(o,this.$size.scrollerWidth-a),Math.min(s,this.$size.height-u))},this.getFirstVisibleRow=function(){return this.layerConfig.firstRow},this.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},this.getLastFullyVisibleRow=function(){var e=this.layerConfig,t=e.lastRow,n=this.session.documentToScreenRow(t,0)*e.lineHeight;return n-this.session.getScrollTop()>e.height-e.lineHeight?t-1:t},this.getLastVisibleRow=function(){return this.layerConfig.lastRow},this.$padding=null,this.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},this.setScrollMargin=function(e,t,n,r){var i=this.scrollMargin;i.top=e|0,i.bottom=t|0,i.right=r|0,i.left=n|0,i.v=i.top+i.bottom,i.h=i.left+i.right,i.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-i.top),this.updateFull()},this.setMargin=function(e,t,n,r){var i=this.margin;i.top=e|0,i.bottom=t|0,i.right=r|0,i.left=n|0,i.v=i.top+i.bottom,i.h=i.left+i.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},this.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},this.setHScrollBarAlwaysVisible=function(e){this.setOption("hScrollBarAlwaysVisible",e)},this.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},this.setVScrollBarAlwaysVisible=function(e){this.setOption("vScrollBarAlwaysVisible",e)},this.$updateScrollBarV=function(){var e=this.layerConfig.maxHeight,t=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(e-=(t-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>e-t&&(e=this.scrollTop+t,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(e+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},this.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},this.$frozen=!1,this.freeze=function(){this.$frozen=!0},this.unfreeze=function(){this.$frozen=!1},this.$renderChanges=function(e,t){this.$changes&&(e|=this.$changes,this.$changes=0);if(!this.session||!this.container.offsetWidth||this.$frozen||!e&&!t){this.$changes|=e;return}if(this.$size.$dirty)return this.$changes|=e,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender"),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var n=this.layerConfig;if(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL){e|=this.$computeLayerConfig()|this.$loop.clear();if(n.firstRow!=this.layerConfig.firstRow&&n.firstRowScreen==this.layerConfig.firstRowScreen){var r=this.scrollTop+(n.firstRow-this.layerConfig.firstRow)*this.lineHeight;r>0&&(this.scrollTop=r,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig()|this.$loop.clear())}n=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),i.translate(this.content,-this.scrollLeft,-n.offset);var s=n.width+2*this.$padding+"px",o=n.minHeight+"px";i.setStyle(this.content.style,"width",s),i.setStyle(this.content.style,"height",o)}e&this.CHANGE_H_SCROLL&&(i.translate(this.content,-this.scrollLeft,-n.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller":"ace_scroller ace_scroll-left");if(e&this.CHANGE_FULL){this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this._signal("afterRender");return}if(e&this.CHANGE_SCROLL){e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(n):this.$textLayer.scrollLines(n),this.$showGutter&&(e&this.CHANGE_GUTTER||e&this.CHANGE_LINES?this.$gutterLayer.update(n):this.$gutterLayer.scrollLines(n)),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this._signal("afterRender");return}e&this.CHANGE_TEXT?(this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n)):e&this.CHANGE_LINES?(this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(n):e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER?this.$showGutter&&this.$gutterLayer.update(n):e&this.CHANGE_CURSOR&&this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(n),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(n),this.$moveTextAreaToCursor()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(n),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(n),this._signal("afterRender")},this.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,t=this.$maxLines*this.lineHeight,n=Math.min(t,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(n+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&n>this.$maxPixelHeight&&(n=this.$maxPixelHeight);var r=n<=2*this.lineHeight,i=!r&&e>t;if(n!=this.desiredHeight||this.$size.height!=this.desiredHeight||i!=this.$vScroll){i!=this.$vScroll&&(this.$vScroll=i,this.scrollBarV.setVisible(i));var s=this.container.clientWidth;this.container.style.height=n+"px",this.$updateCachedSize(!0,this.$gutterWidth,s,n),this.desiredHeight=n,this._signal("autosize")}},this.$computeLayerConfig=function(){var e=this.session,t=this.$size,n=t.height<=2*this.lineHeight,r=this.session.getScreenLength(),i=r*this.lineHeight,s=this.$getLongestLine(),o=!n&&(this.$hScrollBarAlwaysVisible||t.scrollerWidth-s-2*this.$padding<0),u=this.$horizScroll!==o;u&&(this.$horizScroll=o,this.scrollBarH.setVisible(o));var a=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var f=t.scrollerHeight+this.lineHeight,l=!this.$maxLines&&this.$scrollPastEnd?(t.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;i+=l;var c=this.scrollMargin;this.session.setScrollTop(Math.max(-c.top,Math.min(this.scrollTop,i-t.scrollerHeight+c.bottom))),this.session.setScrollLeft(Math.max(-c.left,Math.min(this.scrollLeft,s+2*this.$padding-t.scrollerWidth+c.right)));var h=!n&&(this.$vScrollBarAlwaysVisible||t.scrollerHeight-i+l<0||this.scrollTop>c.top),p=a!==h;p&&(this.$vScroll=h,this.scrollBarV.setVisible(h));var d=this.scrollTop%this.lineHeight,v=Math.ceil(f/this.lineHeight)-1,m=Math.max(0,Math.round((this.scrollTop-d)/this.lineHeight)),g=m+v,y,b,w=this.lineHeight;m=e.screenToDocumentRow(m,0);var E=e.getFoldLine(m);E&&(m=E.start.row),y=e.documentToScreenRow(m,0),b=e.getRowLength(m)*w,g=Math.min(e.screenToDocumentRow(g,0),e.getLength()-1),f=t.scrollerHeight+e.getRowLength(g)*w+b,d=this.scrollTop-y*w;var S=0;if(this.layerConfig.width!=s||u)S=this.CHANGE_H_SCROLL;if(u||p)S|=this.$updateCachedSize(!0,this.gutterWidth,t.width,t.height),this._signal("scrollbarVisibilityChanged"),p&&(s=this.$getLongestLine());return this.layerConfig={width:s,padding:this.$padding,firstRow:m,firstRowScreen:y,lastRow:g,lineHeight:w,characterWidth:this.characterWidth,minHeight:f,maxHeight:i,offset:d,gutterOffset:w?Math.max(0,Math.ceil((d+t.height-t.scrollerHeight)/w)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(s-this.$padding),S},this.$updateLines=function(){if(!this.$changedLines)return;var e=this.$changedLines.firstRow,t=this.$changedLines.lastRow;this.$changedLines=null;var n=this.layerConfig;if(e>n.lastRow+1)return;if(tthis.$textLayer.MAX_LINE_LENGTH&&(e=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(e*this.characterWidth))},this.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},this.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},this.addGutterDecoration=function(e,t){this.$gutterLayer.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){this.$gutterLayer.removeGutterDecoration(e,t)},this.updateBreakpoints=function(e){this.$loop.schedule(this.CHANGE_GUTTER)},this.setAnnotations=function(e){this.$gutterLayer.setAnnotations(e),this.$loop.schedule(this.CHANGE_GUTTER)},this.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},this.hideCursor=function(){this.$cursorLayer.hideCursor()},this.showCursor=function(){this.$cursorLayer.showCursor()},this.scrollSelectionIntoView=function(e,t,n){this.scrollCursorIntoView(e,n),this.scrollCursorIntoView(t,n)},this.scrollCursorIntoView=function(e,t,n){if(this.$size.scrollerHeight===0)return;var r=this.$cursorLayer.getPixelPosition(e),i=r.left,s=r.top,o=n&&n.top||0,u=n&&n.bottom||0,a=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;a+o>s?(t&&a+o>s+this.lineHeight&&(s-=t*this.$size.scrollerHeight),s===0&&(s=-this.scrollMargin.top),this.session.setScrollTop(s)):a+this.$size.scrollerHeight-ui?(i=1-this.scrollMargin.top)return!0;if(t>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom)return!0;if(e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left)return!0;if(e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},this.pixelToScreenCoordinates=function(e,t){var n;if(this.$hasCssTransforms){n={top:0,left:0};var r=this.$fontMetrics.transformCoordinates([e,t]);e=r[1]-this.gutterWidth-this.margin.left,t=r[0]}else n=this.scroller.getBoundingClientRect();var i=e+this.scrollLeft-n.left-this.$padding,s=i/this.characterWidth,o=Math.floor((t+this.scrollTop-n.top)/this.lineHeight),u=this.$blockCursor?Math.floor(s):Math.round(s);return{row:o,column:u,side:s-u>0?1:-1,offsetX:i}},this.screenToTextCoordinates=function(e,t){var n;if(this.$hasCssTransforms){n={top:0,left:0};var r=this.$fontMetrics.transformCoordinates([e,t]);e=r[1]-this.gutterWidth-this.margin.left,t=r[0]}else n=this.scroller.getBoundingClientRect();var i=e+this.scrollLeft-n.left-this.$padding,s=i/this.characterWidth,o=this.$blockCursor?Math.floor(s):Math.round(s),u=Math.floor((t+this.scrollTop-n.top)/this.lineHeight);return this.session.screenToDocumentPosition(u,Math.max(o,0),i)},this.textToScreenCoordinates=function(e,t){var n=this.scroller.getBoundingClientRect(),r=this.session.documentToScreenPosition(e,t),i=this.$padding+(this.session.$bidiHandler.isBidiRow(r.row,e)?this.session.$bidiHandler.getPosLeft(r.column):Math.round(r.column*this.characterWidth)),s=r.row*this.lineHeight;return{pageX:n.left+i-this.scrollLeft,pageY:n.top+s-this.scrollTop}},this.visualizeFocus=function(){i.addCssClass(this.container,"ace_focus")},this.visualizeBlur=function(){i.removeCssClass(this.container,"ace_focus")},this.showComposition=function(e){this.$composition=e,e.cssText||(e.cssText=this.textarea.style.cssText),e.useTextareaForIME=this.$useTextareaForIME,this.$useTextareaForIME?(i.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):e.markerId=this.session.addMarker(e.markerRange,"ace_composition_marker","text")},this.setCompositionText=function(e){var t=this.session.selection.cursor;this.addToken(e,"composition_placeholder",t.row,t.column),this.$moveTextAreaToCursor()},this.hideComposition=function(){if(!this.$composition)return;this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),i.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText,this.$composition=null,this.$cursorLayer.element.style.display=""},this.addToken=function(e,t,n,r){var i=this.session;i.bgTokenizer.lines[n]=null;var s={type:t,value:e},o=i.getTokens(n);if(r==null)o.push(s);else{var u=0;for(var a=0;a50&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e})}}).call(f.prototype);var l=function(e,t,n){var r=null,i=!1,u=Object.create(s),a=[],l=new f({messageBuffer:a,terminate:function(){},postMessage:function(e){a.push(e);if(!r)return;i?setTimeout(c):c()}});l.setEmitSync=function(e){i=e};var c=function(){var e=a.shift();e.command?r[e.command].apply(r,e.args):e.event&&u._signal(e.event,e.data)};return u.postMessage=function(e){l.onMessage({data:e})},u.callback=function(e,t){this.postMessage({type:"call",id:t,data:e})},u.emit=function(e,t){this.postMessage({type:"event",name:e,data:t})},o.loadModule(["worker",t],function(e){r=new e[n](u);while(a.length)c()}),l};t.UIWorkerClient=l,t.WorkerClient=f,t.createWorker=a}),ace.define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,t,n){"use strict";var r=e("./range").Range,i=e("./lib/event_emitter").EventEmitter,s=e("./lib/oop"),o=function(e,t,n,r,i,s){var o=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=i,this.othersClass=s,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate),this.$others=r,this.$onCursorChange=function(){setTimeout(function(){o.onCursorChange()})},this.$pos=n;var u=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=u.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)};(function(){s.implement(this,i),this.setup=function(){var e=this,t=this.doc,n=this.session;this.selectionBefore=n.selection.toJSON(),n.selection.inMultiSelectMode&&n.selection.toSingleRange(),this.pos=t.createAnchor(this.$pos.row,this.$pos.column);var i=this.pos;i.$insertRight=!0,i.detach(),i.markerId=n.addMarker(new r(i.row,i.column,i.row,i.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(n){var r=t.createAnchor(n.row,n.column);r.$insertRight=!0,r.detach(),e.others.push(r)}),n.setUndoSelect(!1)},this.showOtherMarkers=function(){if(this.othersActive)return;var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(n){n.markerId=e.addMarker(new r(n.row,n.column,n.row,n.column+t.length),t.othersClass,null,!1)})},this.hideOtherMarkers=function(){if(!this.othersActive)return;this.othersActive=!1;for(var e=0;e=this.pos.column&&t.start.column<=this.pos.column+this.length+1,s=t.start.column-this.pos.column;this.updateAnchors(e),i&&(this.length+=n);if(i&&!this.session.$fromUndo)if(e.action==="insert")for(var o=this.others.length-1;o>=0;o--){var u=this.others[o],a={row:u.row,column:u.column+s};this.doc.insertMergedLines(a,e.lines)}else if(e.action==="remove")for(var o=this.others.length-1;o>=0;o--){var u=this.others[o],a={row:u.row,column:u.column+s};this.doc.remove(new r(a.row,a.column,a.row,a.column-n))}this.$updating=!1,this.updateMarkers()},this.updateAnchors=function(e){this.pos.onChange(e);for(var t=this.others.length;t--;)this.others[t].onChange(e);this.updateMarkers()},this.updateMarkers=function(){if(this.$updating)return;var e=this,t=this.session,n=function(n,i){t.removeMarker(n.markerId),n.markerId=t.addMarker(new r(n.row,n.column,n.row,n.column+e.length),i,null,!1)};n(this.pos,this.mainClass);for(var i=this.others.length;i--;)n(this.others[i],this.othersClass)},this.onCursorChange=function(e){if(this.$updating||!this.session)return;var t=this.session.selection.getCursor();t.row===this.pos.row&&t.column>=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))},this.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.removeEventListener("change",this.$onUpdate),this.session.selection.removeEventListener("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},this.cancel=function(){if(this.$undoStackDepth===-1)return;var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth;for(var n=0;n1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),t||this.fromOrientedRange(e)},this.toSingleRange=function(e){e=e||this.ranges[0];var t=this.rangeList.removeAll();t.length&&this.$onRemoveRange(t),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var t=this.rangeList.substractPoint(e);if(t)return this.$onRemoveRange(t),t[0]},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length&&this.$onRemoveRange(e)},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal("addRange",{range:e})},this.$onRemoveRange=function(e){this.rangeCount=this.rangeList.ranges.length;if(this.rangeCount==1&&this.inMultiSelectMode){var t=this.rangeList.ranges.pop();e.push(t),this.rangeCount=0}for(var n=e.length;n--;){var r=this.ranges.indexOf(e[n]);this.ranges.splice(r,1)}this._signal("removeRange",{ranges:e}),this.rangeCount===0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),t=t||this.ranges[0],t&&!t.isEqual(this.getRange())&&this.fromOrientedRange(t)},this.$initRangeList=function(){if(this.rangeList)return;this.rangeList=new r,this.ranges=[],this.rangeCount=0},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],n=i.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var n=this.getRange(),r=this.isBackwards(),s=n.start.row,o=n.end.row;if(s==o){if(r)var u=n.end,a=n.start;else var u=n.start,a=n.end;this.addRange(i.fromPoints(a,a)),this.addRange(i.fromPoints(u,u));return}var f=[],l=this.getLineRange(s,!0);l.start.column=n.start.column,f.push(l);for(var c=s+1;c1){var e=this.rangeList.ranges,t=e[e.length-1],n=i.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var r=this.session.documentToScreenPosition(this.cursor),s=this.session.documentToScreenPosition(this.anchor),o=this.rectangularRangeBlock(r,s);o.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,t,n){var r=[],s=e.column0)g--;if(g>0){var y=0;while(r[y].isEmpty())y++}for(var b=g;b>=y;b--)r[b].isEmpty()&&r.splice(b,1)}return r}}.call(s.prototype);var d=e("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var t=this.getSelectionStyle();return e.marker=this.session.addMarker(e,"ace_selection",t),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(!e.marker)return;this.session.removeMarker(e.marker);var t=this.session.$selectionMarkers.indexOf(e);t!=-1&&this.session.$selectionMarkers.splice(t,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length},this.removeSelectionMarkers=function(e){var t=this.session.$selectionMarkers;for(var n=e.length;n--;){var r=e[n];if(!r.marker)continue;this.session.removeMarker(r.marker);var i=t.indexOf(r);i!=-1&&t.splice(i,1)}this.session.selectionMarkerCount=t.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(e){if(this.inMultiSelectMode)return;this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(f.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onSingleSelect=function(e){if(this.session.multiSelect.inVirtualMode)return;this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(f.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection")},this.$onMultiSelectExec=function(e){var t=e.command,n=e.editor;if(!n.multiSelect)return;if(!t.multiSelectAction){var r=t.exec(n,e.args||{});n.multiSelect.addRange(n.multiSelect.toOrientedRange()),n.multiSelect.mergeOverlappingRanges()}else t.multiSelectAction=="forEach"?r=n.forEachSelection(t,e.args):t.multiSelectAction=="forEachLine"?r=n.forEachSelection(t,e.args,!0):t.multiSelectAction=="single"?(n.exitMultiSelectMode(),r=t.exec(n,e.args||{})):r=t.multiSelectAction(n,e.args||{});return r},this.forEachSelection=function(e,t,n){if(this.inVirtualSelectionMode)return;var r=n&&n.keepOrder,i=n==1||n&&n.$byLines,o=this.session,u=this.selection,a=u.rangeList,f=(r?u:a).ranges,l;if(!f.length)return e.exec?e.exec(this,t||{}):e(this,t||{});var c=u._eventRegistry;u._eventRegistry={};var h=new s(o);this.inVirtualSelectionMode=!0;for(var p=f.length;p--;){if(i)while(p>0&&f[p].start.row==f[p-1].end.row)p--;h.fromOrientedRange(f[p]),h.index=p,this.selection=o.selection=h;var d=e.exec?e.exec(this,t||{}):e(this,t||{});!l&&d!==undefined&&(l=d),h.toOrientedRange(f[p])}h.detach(),this.selection=o.selection=u,this.inVirtualSelectionMode=!1,u._eventRegistry=c,u.mergeOverlappingRanges(),u.ranges[0]&&u.fromOrientedRange(u.ranges[0]);var v=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),v&&v.from==v.to&&this.renderer.animateScrolling(v.from),l},this.exitMultiSelectMode=function(){if(!this.inMultiSelectMode||this.inVirtualSelectionMode)return;this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var t=this.multiSelect.rangeList.ranges,n=[];for(var r=0;r0);u<0&&(u=0),f>=c&&(f=c-1)}var p=this.session.removeFullLines(u,f);p=this.$reAlignText(p,l),this.session.insert({row:u,column:0},p.join("\n")+"\n"),l||(o.start.column=0,o.end.column=p[p.length-1].length),this.selection.setRange(o)}else{s.forEach(function(e){t.substractPoint(e.cursor)});var d=0,v=Infinity,m=n.map(function(t){var n=t.cursor,r=e.getLine(n.row),i=r.substr(n.column).search(/\S/g);return i==-1&&(i=0),n.column>d&&(d=n.column),io?e.insert(r,a.stringRepeat(" ",s-o)):e.remove(new i(r.row,r.column,r.row,r.column-s+o)),t.start.column=t.end.column=d,t.start.row=t.end.row=r.row,t.cursor=t.end}),t.fromOrientedRange(n[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(e,t){function u(e){return a.stringRepeat(" ",e)}function f(e){return e[2]?u(i)+e[2]+u(s-e[2].length+o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function l(e){return e[2]?u(i+s-e[2].length)+e[2]+u(o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function c(e){return e[2]?u(i)+e[2]+u(o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}var n=!0,r=!0,i,s,o;return e.map(function(e){var t=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return t?i==null?(i=t[1].length,s=t[2].length,o=t[3].length,t):(i+s+o!=t[1].length+t[2].length+t[3].length&&(r=!1),i!=t[1].length&&(n=!1),i>t[1].length&&(i=t[1].length),st[3].length&&(o=t[3].length),t):[e]}).map(t?f:n?r?l:f:c)}}).call(d.prototype),t.onSessionChange=function(e){var t=e.session;t&&!t.multiSelect&&(t.$selectionMarkers=[],t.selection.$initRangeList(),t.multiSelect=t.selection),this.multiSelect=t&&t.multiSelect;var n=e.oldSession;n&&(n.multiSelect.off("addRange",this.$onAddRange),n.multiSelect.off("removeRange",this.$onRemoveRange),n.multiSelect.off("multiSelect",this.$onMultiSelect),n.multiSelect.off("singleSelect",this.$onSingleSelect),n.multiSelect.lead.off("change",this.$checkMultiselectChange),n.multiSelect.anchor.off("change",this.$checkMultiselectChange)),t&&(t.multiSelect.on("addRange",this.$onAddRange),t.multiSelect.on("removeRange",this.$onRemoveRange),t.multiSelect.on("multiSelect",this.$onMultiSelect),t.multiSelect.on("singleSelect",this.$onSingleSelect),t.multiSelect.lead.on("change",this.$checkMultiselectChange),t.multiSelect.anchor.on("change",this.$checkMultiselectChange)),t&&this.inMultiSelectMode!=t.selection.inMultiSelectMode&&(t.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},t.MultiSelect=m,e("./config").defineOptions(d.prototype,"editor",{enableMultiselect:{set:function(e){m(this),e?(this.on("changeSession",this.$multiselectOnSessionChange),this.on("mousedown",o)):(this.off("changeSession",this.$multiselectOnSessionChange),this.off("mousedown",o))},value:!0},enableBlockSelect:{set:function(e){this.$blockSelectEnabled=e},value:!0}})}),ace.define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../../range").Range,i=t.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);return this.foldingStartMarker.test(r)?"start":t=="markbeginend"&&this.foldingStopMarker&&this.foldingStopMarker.test(r)?"end":""},this.getFoldWidgetRange=function(e,t,n){return null},this.indentationBlock=function(e,t,n){var i=/\S/,s=e.getLine(t),o=s.search(i);if(o==-1)return;var u=n||s.length,a=e.getLength(),f=t,l=t;while(++tf){var h=e.getLine(l).length;return new r(f,u,l,h)}},this.openingBracketBlock=function(e,t,n,i,s){var o={row:n,column:i+1},u=e.$findClosingBracket(t,o,s);if(!u)return;var a=e.foldWidgets[u.row];return a==null&&(a=e.getFoldWidget(u.row)),a=="start"&&u.row>o.row&&(u.row--,u.column=e.getLine(u.row).length),r.fromPoints(o,u)},this.closingBracketBlock=function(e,t,n,i,s){var o={row:n,column:i},u=e.$findOpeningBracket(t,o);if(!u)return;return u.column++,o.column--,r.fromPoints(u,o)}}).call(i.prototype)}),ace.define("ace/theme/textmate",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";t.isDark=!1,t.cssClass="ace-tm",t.cssText='.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;}',t.$id="ace/theme/textmate";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}),ace.define("ace/line_widgets",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/range"],function(e,t,n){"use strict";function o(e){this.session=e,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)}var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./range").Range;(function(){this.getRowLength=function(e){var t;return this.lineWidgets?t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0:t=0,!this.$useWrapMode||!this.$wrapData[e]?1+t:this.$wrapData[e].length+1+t},this.$getWidgetScreenLength=function(){var e=0;return this.lineWidgets.forEach(function(t){t&&t.rowCount&&!t.hidden&&(e+=t.rowCount)}),e},this.$onChangeEditor=function(e){this.attach(e.editor)},this.attach=function(e){e&&e.widgetManager&&e.widgetManager!=this&&e.widgetManager.detach();if(this.editor==e)return;this.detach(),this.editor=e,e&&(e.widgetManager=this,e.renderer.on("beforeRender",this.measureWidgets),e.renderer.on("afterRender",this.renderWidgets))},this.detach=function(e){var t=this.editor;if(!t)return;this.editor=null,t.widgetManager=null,t.renderer.off("beforeRender",this.measureWidgets),t.renderer.off("afterRender",this.renderWidgets);var n=this.session.lineWidgets;n&&n.forEach(function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))})},this.updateOnFold=function(e,t){var n=t.lineWidgets;if(!n||!e.action)return;var r=e.data,i=r.start.row,s=r.end.row,o=e.action=="add";for(var u=i+1;u0&&!r[i])i--;this.firstRow=n.firstRow,this.lastRow=n.lastRow,t.$cursorLayer.config=n;for(var o=i;o<=s;o++){var u=r[o];if(!u||!u.el)continue;if(u.hidden){u.el.style.top=-100-(u.pixelHeight||0)+"px";continue}u._inDocument||(u._inDocument=!0,t.container.appendChild(u.el));var a=t.$cursorLayer.getPixelPosition({row:o,column:0},!0).top;u.coverLine||(a+=n.lineHeight*this.session.getRowLineCount(u.row)),u.el.style.top=a-n.offset+"px";var f=u.coverGutter?0:t.gutterWidth;u.fixedWidth||(f-=t.scrollLeft),u.el.style.left=f+"px",u.fullWidth&&u.screenWidth&&(u.el.style.minWidth=n.width+2*n.padding+"px"),u.fixedWidth?u.el.style.right=t.scrollBar.getWidth()+"px":u.el.style.right=""}}}).call(o.prototype),t.LineWidgets=o}),ace.define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range"],function(e,t,n){"use strict";function o(e,t,n){var r=0,i=e.length-1;while(r<=i){var s=r+i>>1,o=n(t,e[s]);if(o>0)r=s+1;else{if(!(o<0))return s;i=s-1}}return-(r+1)}function u(e,t,n){var r=e.getAnnotations().sort(s.comparePoints);if(!r.length)return;var i=o(r,{row:t,column:-1},s.comparePoints);i<0&&(i=-i-1),i>=r.length?i=n>0?0:r.length-1:i===0&&n<0&&(i=r.length-1);var u=r[i];if(!u||!n)return;if(u.row===t){do u=r[i+=n];while(u&&u.row===t);if(!u)return r.slice()}var a=[];t=u.row;do a[n<0?"unshift":"push"](u),u=r[i+=n];while(u&&u.row==t);return a.length&&a}var r=e("../line_widgets").LineWidgets,i=e("../lib/dom"),s=e("../range").Range;t.showErrorMarker=function(e,t){var n=e.session;n.widgetManager||(n.widgetManager=new r(n),n.widgetManager.attach(e));var s=e.getCursorPosition(),o=s.row,a=n.widgetManager.getWidgetsAtRow(o).filter(function(e){return e.type=="errorMarker"})[0];a?a.destroy():o-=t;var f=u(n,o,t),l;if(f){var c=f[0];s.column=(c.pos&&typeof c.column!="number"?c.pos.sc:c.column)||0,s.row=c.row,l=e.renderer.$gutterLayer.$annotations[s.row]}else{if(a)return;l={text:["Looks good!"],className:"ace_ok"}}e.session.unfold(s.row),e.selection.moveToPosition(s);var h={row:s.row,fixedWidth:!0,coverGutter:!0,el:i.createElement("div"),type:"errorMarker"},p=h.el.appendChild(i.createElement("div")),d=h.el.appendChild(i.createElement("div"));d.className="error_widget_arrow "+l.className;var v=e.renderer.$cursorLayer.getPixelPosition(s).left;d.style.left=v+e.renderer.gutterWidth-5+"px",h.el.className="error_widget_wrapper",p.className="error_widget "+l.className,p.innerHTML=l.text.join("
    "),p.appendChild(i.createElement("div"));var m=function(e,t,n){if(t===0&&(n==="esc"||n==="return"))return h.destroy(),{command:"null"}};h.destroy=function(){if(e.$mouseHandler.isMousePressed)return;e.keyBinding.removeKeyboardHandler(m),n.widgetManager.removeLineWidget(h),e.off("changeSelection",h.destroy),e.off("changeSession",h.destroy),e.off("mouseup",h.destroy),e.off("change",h.destroy)},e.keyBinding.addKeyboardHandler(m),e.on("changeSelection",h.destroy),e.on("changeSession",h.destroy),e.on("mouseup",h.destroy),e.on("change",h.destroy),e.session.widgetManager.addLineWidget(h),h.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:h.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; }","")}),ace.define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","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"],function(e,t,n){"use strict";e("./lib/fixoldbrowsers");var r=e("./lib/dom"),i=e("./lib/event"),s=e("./range").Range,o=e("./editor").Editor,u=e("./edit_session").EditSession,a=e("./undomanager").UndoManager,f=e("./virtual_renderer").VirtualRenderer;e("./worker/worker_client"),e("./keyboard/hash_handler"),e("./placeholder"),e("./multi_select"),e("./mode/folding/fold_mode"),e("./theme/textmate"),e("./ext/error_marker"),t.config=e("./config"),t.require=e,typeof define=="function"&&(t.define=define),t.edit=function(e,n){if(typeof e=="string"){var s=e;e=document.getElementById(s);if(!e)throw new Error("ace.edit can't find div #"+s)}if(e&&e.env&&e.env.editor instanceof o)return e.env.editor;var u="";if(e&&/input|textarea/i.test(e.tagName)){var a=e;u=a.value,e=r.createElement("pre"),a.parentNode.replaceChild(e,a)}else e&&(u=e.textContent,e.innerHTML="");var l=t.createEditSession(u),c=new o(new f(e),l,n),h={document:l,editor:c,onResize:c.resize.bind(c,null)};return a&&(h.textarea=a),i.addListener(window,"resize",h.onResize),c.on("destroy",function(){i.removeListener(window,"resize",h.onResize),h.editor.container.env=null}),c.container.env=c.env=h,c},t.createEditSession=function(e,t){var n=new u(e,t);return n.setUndoManager(new a),n},t.Range=s,t.Editor=o,t.EditSession=u,t.UndoManager=a,t.VirtualRenderer=f,t.version=t.config.version}); (function() { + ace.require(["ace/ace"], function(a) { + if (a) { + a.config.init(true); + a.define = ace.define; + } + if (!window.ace) + window.ace = a; + for (var key in a) if (a.hasOwnProperty(key)) + window.ace[key] = a[key]; + window.ace["default"] = window.ace; + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = window.ace; + } + }); + })(); diff --git a/static/scripts/mode-javascript.js b/static/scripts/mode-javascript.js new file mode 100644 index 00000000..0d7446ff --- /dev/null +++ b/static/scripts/mode-javascript.js @@ -0,0 +1,7 @@ +ace.define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},s.getTagRule(),{defaultToken:"comment.doc",caseInsensitive:!0}]}};r.inherits(s,i),s.getTagRule=function(e){return{token:"comment.doc.tag.storage.type",regex:"\\b(?:TODO|FIXME|XXX|HACK)\\b"}},s.getStartRule=function(e){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:e}},s.getEndRule=function(e){return{token:"comment.doc",regex:"\\*\\/",next:e}},t.DocCommentHighlightRules=s}),ace.define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";function a(){var e=o.replace("\\d","\\d\\-"),t={onMatch:function(e,t,n){var r=e.charAt(1)=="/"?2:1;if(r==1)t!=this.nextState?n.unshift(this.next,this.nextState,0):n.unshift(this.next),n[2]++;else if(r==2&&t==this.nextState){n[1]--;if(!n[1]||n[1]<0)n.shift(),n.shift()}return[{type:"meta.tag.punctuation."+(r==1?"":"end-")+"tag-open.xml",value:e.slice(0,r)},{type:"meta.tag.tag-name.xml",value:e.substr(r)}]},regex:"",onMatch:function(e,t,n){return t==n[0]&&n.shift(),e.length==2&&(n[0]==this.nextState&&n[1]--,(!n[1]||n[1]<0)&&n.splice(0,2)),this.next=n[0]||"start",[{type:this.token,value:e}]},nextState:"jsx"},n,f("jsxAttributes"),{token:"entity.other.attribute-name.xml",regex:e},{token:"keyword.operator.attribute-equals.xml",regex:"="},{token:"text.tag-whitespace.xml",regex:"\\s+"},{token:"string.attribute-value.xml",regex:"'",stateName:"jsx_attr_q",push:[{token:"string.attribute-value.xml",regex:"'",next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},{token:"string.attribute-value.xml",regex:'"',stateName:"jsx_attr_qq",push:[{token:"string.attribute-value.xml",regex:'"',next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},t],this.$rules.reference=[{token:"constant.language.escape.reference.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}]}function f(e){return[{token:"comment",regex:/\/\*/,next:[i.getTagRule(),{token:"comment",regex:"\\*\\/",next:e||"pop"},{defaultToken:"comment",caseInsensitive:!0}]},{token:"comment",regex:"\\/\\/",next:[i.getTagRule(),{token:"comment",regex:"$|^",next:e||"pop"},{defaultToken:"comment",caseInsensitive:!0}]}]}var r=e("../lib/oop"),i=e("./doc_comment_highlight_rules").DocCommentHighlightRules,s=e("./text_highlight_rules").TextHighlightRules,o="[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*",u=function(e){var t=this.createKeywordMapper({"variable.language":"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document",keyword:"const|yield|import|get|set|async|await|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static","storage.type":"const|let|var|function","constant.language":"null|Infinity|NaN|undefined","support.function":"alert","constant.language.boolean":"true|false"},"identifier"),n="case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void",r="\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|u{[0-9a-fA-F]{1,6}}|[0-2][0-7]{0,2}|3[0-7][0-7]?|[4-7][0-7]?|.)";this.$rules={no_regex:[i.getStartRule("doc-start"),f("no_regex"),{token:"string",regex:"'(?=.)",next:"qstring"},{token:"string",regex:'"(?=.)',next:"qqstring"},{token:"constant.numeric",regex:/0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/},{token:"constant.numeric",regex:/(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/},{token:["storage.type","punctuation.operator","support.function","punctuation.operator","entity.name.function","text","keyword.operator"],regex:"("+o+")(\\.)(prototype)(\\.)("+o+")(\\s*)(=)",next:"function_arguments"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+o+")(\\.)("+o+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+o+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","entity.name.function","text","paren.lparen"],regex:"("+o+")(\\.)("+o+")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","text","entity.name.function","text","paren.lparen"],regex:"(function)(\\s+)("+o+")(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","punctuation.operator","text","storage.type","text","paren.lparen"],regex:"("+o+")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["text","text","storage.type","text","paren.lparen"],regex:"(:)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:"keyword",regex:"from(?=\\s*('|\"))"},{token:"keyword",regex:"(?:"+n+")\\b",next:"start"},{token:["support.constant"],regex:/that\b/},{token:["storage.type","punctuation.operator","support.function.firebug"],regex:/(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/},{token:t,regex:o},{token:"punctuation.operator",regex:/[.](?![.])/,next:"property"},{token:"storage.type",regex:/=>/,next:"start"},{token:"keyword.operator",regex:/--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,next:"start"},{token:"punctuation.operator",regex:/[?:,;.]/,next:"start"},{token:"paren.lparen",regex:/[\[({]/,next:"start"},{token:"paren.rparen",regex:/[\])}]/},{token:"comment",regex:/^#!.*$/}],property:[{token:"text",regex:"\\s+"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","entity.name.function","text","paren.lparen"],regex:"("+o+")(\\.)("+o+")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",next:"function_arguments"},{token:"punctuation.operator",regex:/[.](?![.])/},{token:"support.function",regex:/(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/},{token:"support.function.dom",regex:/(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/},{token:"support.constant",regex:/(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/},{token:"identifier",regex:o},{regex:"",token:"empty",next:"no_regex"}],start:[i.getStartRule("doc-start"),f("start"),{token:"string.regexp",regex:"\\/",next:"regex"},{token:"text",regex:"\\s+|^$",next:"start"},{token:"empty",regex:"",next:"no_regex"}],regex:[{token:"regexp.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"string.regexp",regex:"/[sxngimy]*",next:"no_regex"},{token:"invalid",regex:/\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/},{token:"constant.language.escape",regex:/\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/},{token:"constant.language.delimiter",regex:/\|/},{token:"constant.language.escape",regex:/\[\^?/,next:"regex_character_class"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp"}],regex_character_class:[{token:"regexp.charclass.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"constant.language.escape",regex:"]",next:"regex"},{token:"constant.language.escape",regex:"-"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp.charachterclass"}],function_arguments:[{token:"variable.parameter",regex:o},{token:"punctuation.operator",regex:"[, ]+"},{token:"punctuation.operator",regex:"$"},{token:"empty",regex:"",next:"no_regex"}],qqstring:[{token:"constant.language.escape",regex:r},{token:"string",regex:"\\\\$",consumeLineEnd:!0},{token:"string",regex:'"|$',next:"no_regex"},{defaultToken:"string"}],qstring:[{token:"constant.language.escape",regex:r},{token:"string",regex:"\\\\$",consumeLineEnd:!0},{token:"string",regex:"'|$",next:"no_regex"},{defaultToken:"string"}]};if(!e||!e.noES6)this.$rules.no_regex.unshift({regex:"[{}]",onMatch:function(e,t,n){this.next=e=="{"?this.nextState:"";if(e=="{"&&n.length)n.unshift("start",t);else if(e=="}"&&n.length){n.shift(),this.next=n.shift();if(this.next.indexOf("string")!=-1||this.next.indexOf("jsx")!=-1)return"paren.quasi.end"}return e=="{"?"paren.lparen":"paren.rparen"},nextState:"start"},{token:"string.quasi.start",regex:/`/,push:[{token:"constant.language.escape",regex:r},{token:"paren.quasi.start",regex:/\${/,push:"start"},{token:"string.quasi.end",regex:/`/,next:"pop"},{defaultToken:"string.quasi"}]}),(!e||e.jsx!=0)&&a.call(this);this.embedRules(i,"doc-",[i.getEndRule("no_regex")]),this.normalizeRules()};r.inherits(u,s),t.JavaScriptHighlightRules=u}),ace.define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),ace.define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),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(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++tf)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++no)return new i(o,r,l,t.length)}}.call(o.prototype)}),ace.define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./javascript_highlight_rules").JavaScriptHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("../worker/worker_client").WorkerClient,a=e("./behaviour/cstyle").CstyleBehaviour,f=e("./folding/cstyle").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.$quotes={'"':'"',"'":"'","`":"`"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type=="comment")return r;if(e=="start"||e=="no_regex"){var u=t.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);u&&(r+=n)}else if(e=="doc-start"){if(o=="start"||o=="no_regex")return"";var u=t.match(/^\s*(\/?)\*/);u&&(u[1]&&(r+=" "),r+="* ")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u(["ace"],"ace/mode/javascript_worker","JavaScriptWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/javascript"}.call(l.prototype),t.Mode=l}); (function() { + ace.require(["ace/mode/javascript"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); diff --git a/static/scripts/theme-twilight.js b/static/scripts/theme-twilight.js new file mode 100644 index 00000000..ab4ad334 --- /dev/null +++ b/static/scripts/theme-twilight.js @@ -0,0 +1,7 @@ +ace.define("ace/theme/twilight",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-twilight",t.cssText=".ace-twilight .ace_gutter {background: #232323;color: #E2E2E2}.ace-twilight .ace_print-margin {width: 1px;background: #232323}.ace-twilight {background-color: #141414;color: #F8F8F8}.ace-twilight .ace_cursor {color: #A7A7A7}.ace-twilight .ace_marker-layer .ace_selection {background: rgba(221, 240, 255, 0.20)}.ace-twilight.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #141414;}.ace-twilight .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-twilight .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(255, 255, 255, 0.25)}.ace-twilight .ace_marker-layer .ace_active-line {background: rgba(255, 255, 255, 0.031)}.ace-twilight .ace_gutter-active-line {background-color: rgba(255, 255, 255, 0.031)}.ace-twilight .ace_marker-layer .ace_selected-word {border: 1px solid rgba(221, 240, 255, 0.20)}.ace-twilight .ace_invisible {color: rgba(255, 255, 255, 0.25)}.ace-twilight .ace_keyword,.ace-twilight .ace_meta {color: #CDA869}.ace-twilight .ace_constant,.ace-twilight .ace_constant.ace_character,.ace-twilight .ace_constant.ace_character.ace_escape,.ace-twilight .ace_constant.ace_other,.ace-twilight .ace_heading,.ace-twilight .ace_markup.ace_heading,.ace-twilight .ace_support.ace_constant {color: #CF6A4C}.ace-twilight .ace_invalid.ace_illegal {color: #F8F8F8;background-color: rgba(86, 45, 86, 0.75)}.ace-twilight .ace_invalid.ace_deprecated {text-decoration: underline;font-style: italic;color: #D2A8A1}.ace-twilight .ace_support {color: #9B859D}.ace-twilight .ace_fold {background-color: #AC885B;border-color: #F8F8F8}.ace-twilight .ace_support.ace_function {color: #DAD085}.ace-twilight .ace_list,.ace-twilight .ace_markup.ace_list,.ace-twilight .ace_storage {color: #F9EE98}.ace-twilight .ace_entity.ace_name.ace_function,.ace-twilight .ace_meta.ace_tag,.ace-twilight .ace_variable {color: #AC885B}.ace-twilight .ace_string {color: #8F9D6A}.ace-twilight .ace_string.ace_regexp {color: #E9C062}.ace-twilight .ace_comment {font-style: italic;color: #5F5A60}.ace-twilight .ace_variable {color: #7587A6}.ace-twilight .ace_xml-pe {color: #494949}.ace-twilight .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMQERFpYLC1tf0PAAgOAnPnhxyiAAAAAElFTkSuQmCC) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { + ace.require(["ace/theme/twilight"], function(m) { + if (typeof module == "object" && typeof exports == "object" && module) { + module.exports = m; + } + }); + })(); diff --git a/static/scripts/worker-javascript.js b/static/scripts/worker-javascript.js new file mode 100644 index 00000000..3e88229c --- /dev/null +++ b/static/scripts/worker-javascript.js @@ -0,0 +1 @@ +"no use strict";!function(e){function t(e,t){var n=e,r="";while(n){var i=t[n];if(typeof i=="string")return i+r;if(i)return i.location.replace(/\/*$/,"/")+(r||i.main||i.name);if(i===!1)return"";var s=n.lastIndexOf("/");if(s===-1)break;r=n.substr(s)+r,n=n.slice(0,s)}return e}if(typeof e.window!="undefined"&&e.document)return;if(e.require&&e.define)return;e.console||(e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console),e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){postMessage({type:"error",data:{message:e,data:i.data,file:t,line:n,col:r,stack:i.stack}})},e.normalizeModule=function(t,n){if(n.indexOf("!")!==-1){var r=n.split("!");return e.normalizeModule(t,r[0])+"!"+e.normalizeModule(t,r[1])}if(n.charAt(0)=="."){var i=t.split("/").slice(0,-1).join("/");n=(i?i+"/":"")+n;while(n.indexOf(".")!==-1&&s!=n){var s=n;n=n.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return n},e.require=function(r,i){i||(i=r,r=null);if(!i.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");i=e.normalizeModule(r,i);var s=e.require.modules[i];if(s)return s.initialized||(s.initialized=!0,s.exports=s.factory().exports),s.exports;if(!e.require.tlns)return console.log("unable to load "+i);var o=t(i,e.require.tlns);return o.slice(-3)!=".js"&&(o+=".js"),e.require.id=i,e.require.modules[i]={},importScripts(o),e.require(r,i)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!="string"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id);if(typeof r!="function"){e.require.modules[t]={exports:r,initialized:!0};return}n.length||(n=["require","exports","module"]);var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.slice(0,r.length).map(function(t){switch(t){case"require":return i;case"exports":return e.exports;case"module":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},require.tlns={},e.initBaseUrls=function(t){for(var n in t)require.tlns[n]=t[n]},e.initSender=function(){var n=e.require("ace/lib/event_emitter").EventEmitter,r=e.require("ace/lib/oop"),i=function(){};return function(){r.implement(this,n),this.callback=function(e,t){postMessage({type:"call",id:t,data:e})},this.emit=function(e,t){postMessage({type:"event",name:e,data:t})}}.call(i.prototype),new i};var n=e.main=null,r=e.sender=null;e.onmessage=function(t){var i=t.data;if(i.event&&r)r._signal(i.event,i.data);else if(i.command)if(n[i.command])n[i.command].apply(n,i.args);else{if(!e[i.command])throw new Error("Unknown command:"+i.command);e[i.command].apply(e,i.args)}else if(i.init){e.initBaseUrls(i.tlns),require("ace/lib/es5-shim"),r=e.sender=e.initSender();var s=require(i.module)[i.classname];n=e.main=new s(r)}}}(this),ace.define("ace/lib/oop",[],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),ace.define("ace/range",[],function(e,t,n){"use strict";var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?tthis.end.column?1:0:ethis.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.rowt)var r={row:t+1,column:0};else if(this.start.row=0&&t.row=0&&t.column<=e[t.row].length}function s(e,t){t.action!="insert"&&t.action!="remove"&&r(t,"delta.action must be 'insert' or 'remove'"),t.lines instanceof Array||r(t,"delta.lines must be an Array"),(!t.start||!t.end)&&r(t,"delta.start/end must be an present");var n=t.start;i(e,t.start)||r(t,"delta.start must be contained in document");var s=t.end;t.action=="remove"&&!i(e,s)&&r(t,"delta.end must contained in document for 'remove' actions");var o=s.row-n.row,u=s.column-(o==0?n.column:0);(o!=t.lines.length-1||t.lines[o].length!=u)&&r(t,"delta.range must match delta lines")}t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,s=e[r]||"";switch(t.action){case"insert":var o=t.lines;if(o.length===1)e[r]=s.substring(0,i)+t.lines[0]+s.substring(i);else{var u=[r,1].concat(t.lines);e.splice.apply(e,u),e[r]=s.substring(0,i)+e[r],e[r+t.lines.length-1]+=s.substring(i)}break;case"remove":var a=t.end.column,f=t.end.row;r===f?e[r]=s.substring(0,i)+s.substring(a):e.splice(r,f-r+1,s.substring(0,i)+e[f].substring(a))}}}),ace.define("ace/lib/event_emitter",[],function(e,t,n){"use strict";var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!="object"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;othis.row)return;var n=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})},this.detach=function(){this.document.removeEventListener("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),ace.define("ace/document",[],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=e("./anchor").Anchor,a=function(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new u(this,e,t)},"aaa".split(/a/).length===0?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal("changeNewLineMode")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e=="\r\n"||e=="\r"||e=="\n"},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();e===undefined?e=n:e<0?e=0:e>=n&&(e=n-1,t=undefined);var r=this.getLine(e);return t==undefined&&(t=r.length),t=Math.min(Math.max(t,0),r.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e0,r=t=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){e instanceof o||(e=o.fromPoints(e.start,e.end));if(t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var n;return t?n=this.insert(e.start,t):n=e.start,n},this.applyDeltas=function(e){for(var t=0;t=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n=e.action=="insert";if(n?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))return;n&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(i(this.$lines,e,t),this._signal("change",e))},this.$splitAndapplyLargeDelta=function(e,t){var n=e.lines,r=n.length-t+1,i=e.start.row,s=e.start.column;for(var o=0,u=0;o0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),typeof console.trace=="function"&&console.trace())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var n,r,s,u;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;n=this._events[e],s=n.length,r=-1;if(n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(u=s;u-->0;)if(n[u]===t||n[u].listener&&n[u].listener===t){r=u;break}if(r<0)return this;n.length===1?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[e]&&delete this._events[e],this;if(arguments.length===0){for(t in this._events){if(t==="removeListener")continue;this.removeAllListeners(t)}return this.removeAllListeners("removeListener"),this._events={},this}n=this._events[e];if(i(n))this.removeListener(e,n);else while(n.length)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return!this._events||!this._events[e]?t=[]:i(this._events[e])?t=[this._events[e]]:t=this._events[e].slice(),t},r.listenerCount=function(e,t){var n;return!e._events||!e._events[t]?n=0:i(e._events[t])?n=1:n=e._events[t].length,n}},{}],"/node_modules/jshint/data/ascii-identifier-data.js":[function(e,t,n){var r=[];for(var i=0;i<128;i++)r[i]=i===36||i>=65&&i<=90||i===95||i>=97&&i<=122;var s=[];for(var i=0;i<128;i++)s[i]=r[i]||i>=48&&i<=57;t.exports={asciiIdentifierStartTable:r,asciiIdentifierPartTable:s}},{}],"/node_modules/jshint/lodash.js":[function(e,t,n){(function(e){(function(){function $(e,t,n){var r=e.length,i=n?r:-1;while(n?i--:++ir&&(r=i)}return r}function Dt(e,t){var n=-1,r=e.length;while(++ns?0:s+t),n=n===r||n>s?s:+n||0,n<0&&(n+=s),s=t>n?0:n-t>>>0,t>>>=0;var o=Array(s);while(++i>>1,o=e[s];(n?o<=t:o2&&n[i-2],o=i>2&&n[2],u=i>1&&n[i-1];typeof s=="function"?(s=on(s,u,5),i-=2):(s=typeof u=="function"?u:null,i-=s?1:0),o&&Tn(n[0],n[1],o)&&(s=i<3?null:s,i=1);while(++rf))return!1;while(c&&++a-1&&e%1==0&&e-1&&e%1==0&&e<=Nt}function kn(e){return e===e&&(e===0?1/e>0:!Jn(e))}function Ln(e){var t,n=Ct.support;if(!Y(e)||rt.call(e)!=d||!nt.call(e,"constructor")&&(t=e.constructor,typeof t=="function"&&!(t instanceof t)))return!1;var i;return Ut(e,function(e,t){i=t}),i===r||nt.call(e,i)}function An(e){var t=ir(e),n=t.length,r=n&&e.length,i=Ct.support,s=r&&Cn(r)&&(Xn(e)||i.nonEnumArgs&&Wn(e)),o=-1,u=[];while(++o>>0,r=Array(n);while(++t-1:gn(e,t,n)>-1):!1}function qn(e,t,n){var r=Xn(e)?Ot:qt;return t=mn(t,n,3),r(e,function(e,n,r){return!t(e,n,r)})}function Rn(e,t,n){var i=Xn(e)?Dt:tn;n&&Tn(e,t,n)&&(t=null);if(typeof t!="function"||n!==r)t=mn(t,n,3);return i(e,t)}function Un(e,t){if(typeof e!="function")throw new TypeError(s);return t=yt(t===r?e.length-1:+t||0,0),function(){var n=arguments,r=-1,i=yt(n.length-t,0),s=Array(i);while(++r0;while(++r>>1,Tt=dt?dt.BYTES_PER_ELEMENT:0,Nt=Math.pow(2,53)-1,kt=Ct.support={};(function(e){var t=function(){this.x=e},n={0:e,length:e},r=[];t.prototype={valueOf:e,y:e};for(var i in new t)r.push(i);kt.funcDecomp=/\bthis\b/.test(function(){return this}),kt.funcNames=typeof Function.name=="string";try{kt.nonEnumArgs=!ht.call(arguments,1)}catch(s){kt.nonEnumArgs=!0}})(1,0);var Ht=vt||function(e,t){return t==null?e:Bt(t,bn(t),Bt(t,rr(t),e))},It=fn(zt),Rt=ln();ot||(un=!st||!pt?fr(null):function(e){var t=e.byteLength,n=dt?ut(t/Tt):0,r=n*Tt,i=new st(t);if(n){var s=new dt(i,0,n);s.set(new dt(e,0,n))}return t!=r&&(s=new pt(i,r),s.set(new pt(e,r))),i});var yn=Yt("length"),bn=at?function(e){return at(On(e))}:fr([]),_n=cn(!0),jn=Un(Bn),Fn=hn(At,It),Xn=mt||function(e){return Y(e)&&Cn(e.length)&&rt.call(e)==u},$n=K(/x/)||pt&&!K(pt)?function(e){return rt.call(e)==c}:K,Gn=ft?function(e){if(!e||rt.call(e)!=d)return!1;var t=e.valueOf,n=Kn(t)&&(n=ft(t))&&ft(n);return n?e==n||ft(e)==n:Ln(e)}:Ln,tr=an(function(e,t,n){return n?Pt(e,t,n):Ht(e,t)}),rr=gt?function(e){if(e)var t=e.constructor,n=e.length;return typeof t=="function"&&t.prototype===e||typeof e!="function"&&Cn(n)?An(e):Jn(e)?gt(e):[]}:An,sr=an(Qt);Ct.assign=tr,Ct.callback=ar,Ct.constant=fr,Ct.forEach=Fn,Ct.keys=rr,Ct.keysIn=ir,Ct.merge=sr,Ct.property=cr,Ct.reject=qn,Ct.restParam=Un,Ct.slice=Hn,Ct.toPlainObject=er,Ct.unzip=Bn,Ct.values=or,Ct.zip=jn,Ct.each=Fn,Ct.extend=tr,Ct.iteratee=ar,Ct.clone=zn,Ct.escapeRegExp=ur,Ct.findLastIndex=_n,Ct.has=nr,Ct.identity=lr,Ct.includes=In,Ct.indexOf=Dn,Ct.isArguments=Wn,Ct.isArray=Xn,Ct.isEmpty=Vn,Ct.isFunction=$n,Ct.isNative=Kn,Ct.isNumber=Qn,Ct.isObject=Jn,Ct.isPlainObject=Gn,Ct.isString=Yn,Ct.isTypedArray=Zn,Ct.last=Pn,Ct.some=Rn,Ct.any=Rn,Ct.contains=In,Ct.include=In,Ct.VERSION=i,q&&R?X?(R.exports=Ct)._=Ct:q._=Ct:V._=Ct}).call(this)}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],"/node_modules/jshint/src/jshint.js":[function(e,t,n){var r=e("../lodash"),i=e("events"),s=e("./vars.js"),o=e("./messages.js"),u=e("./lex.js").Lexer,a=e("./reg.js"),f=e("./state.js").state,l=e("./style.js"),c=e("./options.js"),h=e("./scope-manager.js"),p=function(){"use strict";function k(e,t){return e=e.trim(),/^[+-]W\d{3}$/g.test(e)?!0:c.validNames.indexOf(e)===-1&&t.type!=="jslint"&&!r.has(c.removed,e)?(q("E001",t,e),!1):!0}function L(e){return Object.prototype.toString.call(e)==="[object String]"}function A(e,t){return e?!e.identifier||e.value!==t?!1:!0:!1}function O(e){if(!e.reserved)return!1;var t=e.meta;if(t&&t.isFutureReservedWord&&f.inES5()){if(!t.es5)return!1;if(t.strictOnly&&!f.option.strict&&!f.isStrict())return!1;if(e.isProperty)return!1}return!0}function M(e,t){return e.replace(/\{([^{}]*)\}/g,function(e,n){var r=t[n];return typeof r=="string"||typeof r=="number"?r:e})}function D(e,t){Object.keys(t).forEach(function(n){if(r.has(p.blacklist,n))return;e[n]=t[n]})}function P(){if(f.option.enforceall){for(var e in c.bool.enforcing)f.option[e]===undefined&&!c.noenforceall[e]&&(f.option[e]=!0);for(var t in c.bool.relaxing)f.option[t]===undefined&&(f.option[t]=!1)}}function H(){P(),!f.option.esversion&&!f.option.moz&&(f.option.es3?f.option.esversion=3:f.option.esnext?f.option.esversion=6:f.option.esversion=5),f.inES5()&&D(S,s.ecmaIdentifiers[5]),f.inES6()&&D(S,s.ecmaIdentifiers[6]),f.option.module&&(f.option.strict===!0&&(f.option.strict="global"),f.inES6()||F("W134",f.tokens.next,"module",6)),f.option.couch&&D(S,s.couch),f.option.qunit&&D(S,s.qunit),f.option.rhino&&D(S,s.rhino),f.option.shelljs&&(D(S,s.shelljs),D(S,s.node)),f.option.typed&&D(S,s.typed),f.option.phantom&&(D(S,s.phantom),f.option.strict===!0&&(f.option.strict="global")),f.option.prototypejs&&D(S,s.prototypejs),f.option.node&&(D(S,s.node),D(S,s.typed),f.option.strict===!0&&(f.option.strict="global")),f.option.devel&&D(S,s.devel),f.option.dojo&&D(S,s.dojo),f.option.browser&&(D(S,s.browser),D(S,s.typed)),f.option.browserify&&(D(S,s.browser),D(S,s.typed),D(S,s.browserify),f.option.strict===!0&&(f.option.strict="global")),f.option.nonstandard&&D(S,s.nonstandard),f.option.jasmine&&D(S,s.jasmine),f.option.jquery&&D(S,s.jquery),f.option.mootools&&D(S,s.mootools),f.option.worker&&D(S,s.worker),f.option.wsh&&D(S,s.wsh),f.option.globalstrict&&f.option.strict!==!1&&(f.option.strict="global"),f.option.yui&&D(S,s.yui),f.option.mocha&&D(S,s.mocha)}function B(e,t,n){var r=Math.floor(t/f.lines.length*100),i=o.errors[e].desc;throw{name:"JSHintError",line:t,character:n,message:i+" ("+r+"% scanned).",raw:i,code:e}}function j(){var e=f.ignoredLines;if(r.isEmpty(e))return;p.errors=r.reject(p.errors,function(t){return e[t.line]})}function F(e,t,n,r,i,s){var u,a,l,c;if(/^W\d{3}$/.test(e)){if(f.ignored[e])return;c=o.warnings[e]}else/E\d{3}/.test(e)?c=o.errors[e]:/I\d{3}/.test(e)&&(c=o.info[e]);return t=t||f.tokens.next||{},t.id==="(end)"&&(t=f.tokens.curr),a=t.line||0,u=t.from||0,l={id:"(error)",raw:c.desc,code:c.code,evidence:f.lines[a-1]||"",line:a,character:u,scope:p.scope,a:n,b:r,c:i,d:s},l.reason=M(c.desc,l),p.errors.push(l),j(),p.errors.length>=f.option.maxerr&&B("E043",a,u),l}function I(e,t,n,r,i,s,o){return F(e,{line:t,from:n},r,i,s,o)}function q(e,t,n,r,i,s){F(e,t,n,r,i,s)}function R(e,t,n,r,i,s,o){return q(e,{line:t,from:n},r,i,s,o)}function U(e,t){var n;return n={id:"(internal)",elem:e,value:t},p.internals.push(n),n}function z(){var e=f.tokens.next,t=e.body.match(/(-\s+)?[^\s,:]+(?:\s*:\s*(-\s+)?[^\s,]+)?/g)||[],i={};if(e.type==="globals"){t.forEach(function(n,r){n=n.split(":");var s=(n[0]||"").trim(),o=(n[1]||"").trim();if(s==="-"||!s.length){if(r>0&&r===t.length-1)return;q("E002",e);return}s.charAt(0)==="-"?(s=s.slice(1),o=!1,p.blacklist[s]=s,delete S[s]):i[s]=o==="true"}),D(S,i);for(var s in i)r.has(i,s)&&(n[s]=e)}e.type==="exported"&&t.forEach(function(n,r){if(!n.length){if(r>0&&r===t.length-1)return;q("E002",e);return}f.funct["(scope)"].addExported(n)}),e.type==="members"&&(E=E||{},t.forEach(function(e){var t=e.charAt(0),n=e.charAt(e.length-1);t===n&&(t==='"'||t==="'")&&(e=e.substr(1,e.length-2).replace('\\"','"')),E[e]=!1}));var o=["maxstatements","maxparams","maxdepth","maxcomplexity","maxerr","maxlen","indent"];if(e.type==="jshint"||e.type==="jslint")t.forEach(function(t){t=t.split(":");var n=(t[0]||"").trim(),i=(t[1]||"").trim();if(!k(n,e))return;if(o.indexOf(n)>=0){if(i!=="false"){i=+i;if(typeof i!="number"||!isFinite(i)||i<=0||Math.floor(i)!==i){q("E032",e,t[1].trim());return}f.option[n]=i}else f.option[n]=n==="indent"?4:!1;return}if(n==="validthis"){if(f.funct["(global)"])return void q("E009");if(i!=="true"&&i!=="false")return void q("E002",e);f.option.validthis=i==="true";return}if(n==="quotmark"){switch(i){case"true":case"false":f.option.quotmark=i==="true";break;case"double":case"single":f.option.quotmark=i;break;default:q("E002",e)}return}if(n==="shadow"){switch(i){case"true":f.option.shadow=!0;break;case"outer":f.option.shadow="outer";break;case"false":case"inner":f.option.shadow="inner";break;default:q("E002",e)}return}if(n==="unused"){switch(i){case"true":f.option.unused=!0;break;case"false":f.option.unused=!1;break;case"vars":case"strict":f.option.unused=i;break;default:q("E002",e)}return}if(n==="latedef"){switch(i){case"true":f.option.latedef=!0;break;case"false":f.option.latedef=!1;break;case"nofunc":f.option.latedef="nofunc";break;default:q("E002",e)}return}if(n==="ignore"){switch(i){case"line":f.ignoredLines[e.line]=!0,j();break;default:q("E002",e)}return}if(n==="strict"){switch(i){case"true":f.option.strict=!0;break;case"false":f.option.strict=!1;break;case"func":case"global":case"implied":f.option.strict=i;break;default:q("E002",e)}return}n==="module"&&(zt(f.funct)||q("E055",f.tokens.next,"module"));var s={es3:3,es5:5,esnext:6};if(r.has(s,n)){switch(i){case"true":f.option.moz=!1,f.option.esversion=s[n];break;case"false":f.option.moz||(f.option.esversion=5);break;default:q("E002",e)}return}if(n==="esversion"){switch(i){case"5":f.inES5(!0)&&F("I003");case"3":case"6":f.option.moz=!1,f.option.esversion=+i;break;case"2015":f.option.moz=!1,f.option.esversion=6;break;default:q("E002",e)}zt(f.funct)||q("E055",f.tokens.next,"esversion");return}var u=/^([+-])(W\d{3})$/g.exec(n);if(u){f.ignored[u[2]]=u[1]==="-";return}var a;if(i==="true"||i==="false"){e.type==="jslint"?(a=c.renamed[n]||n,f.option[a]=i==="true",c.inverted[a]!==undefined&&(f.option[a]=!f.option[a])):f.option[n]=i==="true",n==="newcap"&&(f.option["(explicitNewcap)"]=!0);return}q("E002",e)}),H()}function W(e){var t=e||0,n=y.length,r;if(t="a"&&t<="z"||t>="A"&&t<="Z")e.identifier=e.reserved=!0;return e}function ut(e,t){var n=nt(e,150);return ot(n),n.nud=typeof t=="function"?t:function(){this.arity="unary",this.right=Q(150);if(this.id==="++"||this.id==="--")f.option.plusplus?F("W016",this,this.id):this.right&&(!this.right.identifier||O(this.right))&&this.right.id!=="."&&this.right.id!=="["&&F("W017",this),this.right&&this.right.isMetaProperty?q("E031",this):this.right&&this.right.identifier&&f.funct["(scope)"].block.modify(this.right.value,this);return this},n}function at(e,t){var n=rt(e);return n.type=e,n.nud=t,n}function ft(e,t){var n=at(e,t);return n.identifier=!0,n.reserved=!0,n}function lt(e,t){var n=at(e,t&&t.nud||function(){return this});return t=t||{},t.isFutureReservedWord=!0,n.value=e,n.identifier=!0,n.reserved=!0,n.meta=t,n}function ct(e,t){return ft(e,function(){return typeof t=="function"&&t(this),this})}function ht(e,t,n,r){var i=nt(e,n);return ot(i),i.infix=!0,i.led=function(i){return r||Y(f.tokens.prev,f.tokens.curr),(e==="in"||e==="instanceof")&&i.id==="!"&&F("W018",i,"!"),typeof t=="function"?t(i,this):(this.left=i,this.right=Q(n),this)},i}function pt(e){var t=nt(e,42);return t.led=function(e){return Y(f.tokens.prev,f.tokens.curr),this.left=e,this.right=Xt({type:"arrow",loneArg:e}),this},t}function dt(e,t){var n=nt(e,100);return n.led=function(e){Y(f.tokens.prev,f.tokens.curr),this.left=e;var n=this.right=Q(100);return A(e,"NaN")||A(n,"NaN")?F("W019",this):t&&t.apply(this,[e,n]),(!e||!n)&&B("E041",f.tokens.curr.line),e.id==="!"&&F("W018",e,"!"),n.id==="!"&&F("W018",n,"!"),this},n}function vt(e){return e&&(e.type==="(number)"&&+e.value===0||e.type==="(string)"&&e.value===""||e.type==="null"&&!f.option.eqnull||e.type==="true"||e.type==="false"||e.type==="undefined")}function gt(e,t,n){var i;return n.option.notypeof?!1:!e||!t?!1:(i=n.inES6()?mt.es6:mt.es3,t.type==="(identifier)"&&t.value==="typeof"&&e.type==="(string)"?!r.contains(i,e.value):!1)}function yt(e,t){var n=!1;return e.type==="this"&&t.funct["(context)"]===null?n=!0:e.type==="(identifier)"&&(t.option.node&&e.value==="global"?n=!0:t.option.browser&&(e.value==="window"||e.value==="document")&&(n=!0)),n}function bt(e){function n(e){if(typeof e!="object")return;return e.right==="prototype"?e:n(e.left)}function r(e){while(!e.identifier&&typeof e.left=="object")e=e.left;if(e.identifier&&t.indexOf(e.value)>=0)return e.value}var t=["Array","ArrayBuffer","Boolean","Collator","DataView","Date","DateTimeFormat","Error","EvalError","Float32Array","Float64Array","Function","Infinity","Intl","Int16Array","Int32Array","Int8Array","Iterator","Number","NumberFormat","Object","RangeError","ReferenceError","RegExp","StopIteration","String","SyntaxError","TypeError","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","URIError"],i=n(e);if(i)return r(i)}function wt(e,t,n){var r=n&&n.allowDestructuring;t=t||e;if(f.option.freeze){var i=bt(e);i&&F("W121",e,i)}return e.identifier&&!e.isMetaProperty&&f.funct["(scope)"].block.reassign(e.value,e),e.id==="."?((!e.left||e.left.value==="arguments"&&!f.isStrict())&&F("E031",t),f.nameStack.set(f.tokens.prev),!0):e.id==="{"||e.id==="["?(r&&f.tokens.curr.left.destructAssign?f.tokens.curr.left.destructAssign.forEach(function(e){e.id&&f.funct["(scope)"].block.modify(e.id,e.token)}):e.id==="{"||!e.left?F("E031",t):e.left.value==="arguments"&&!f.isStrict()&&F("E031",t),e.id==="["&&f.nameStack.set(e.right),!0):e.isMetaProperty?(q("E031",t),!0):e.identifier&&!O(e)?(f.funct["(scope)"].labeltype(e.value)==="exception"&&F("W022",e),f.nameStack.set(e),!0):(e===f.syntax["function"]&&F("W023",f.tokens.curr),!1)}function Et(e,t,n){var r=ht(e,typeof t=="function"?t:function(e,t){t.left=e;if(e&&wt(e,t,{allowDestructuring:!0}))return t.right=Q(10),t;q("E031",t)},n);return r.exps=!0,r.assign=!0,r}function St(e,t,n){var r=nt(e,n);return ot(r),r.led=typeof t=="function"?t:function(e){return f.option.bitwise&&F("W016",this,this.id),this.left=e,this.right=Q(n),this},r}function xt(e){return Et(e,function(e,t){f.option.bitwise&&F("W016",t,t.id);if(e&&wt(e,t))return t.right=Q(10),t;q("E031",t)},20)}function Tt(e){var t=nt(e,150);return t.led=function(e){return f.option.plusplus?F("W016",this,this.id):(!e.identifier||O(e))&&e.id!=="."&&e.id!=="["&&F("W017",this),e.isMetaProperty?q("E031",this):e&&e.identifier&&f.funct["(scope)"].block.modify(e.value,e),this.left=e,this},t}function Nt(e,t,n){if(!f.tokens.next.identifier)return;n||V();var r=f.tokens.curr,i=f.tokens.curr.value;return O(r)?t&&f.inES5()?i:e&&i==="undefined"?i:(F("W024",f.tokens.curr,f.tokens.curr.id),i):i}function Ct(e,t){var n=Nt(e,t,!1);if(n)return n;if(f.tokens.next.value==="..."){f.inES6(!0)||F("W119",f.tokens.next,"spread/rest operator","6"),V();if(pn(f.tokens.next,"...")){F("E024",f.tokens.next,"...");while(pn(f.tokens.next,"..."))V()}if(!f.tokens.next.identifier){F("E024",f.tokens.curr,"...");return}return Ct(e,t)}q("E030",f.tokens.next,f.tokens.next.value),f.tokens.next.id!==";"&&V()}function kt(e){var t=0,n;if(f.tokens.next.id!==";"||e.inBracelessBlock)return;for(;;){do n=W(t),t+=1;while(n.id!=="(end)"&&n.id==="(comment)");if(n.reach)return;if(n.id!=="(endline)"){if(n.id==="function"){f.option.latedef===!0&&F("W026",n);break}F("W027",n,n.value,e.value);break}}}function Lt(){if(f.tokens.next.id!==";"){if(f.tokens.next.isUnclosed)return V();var e=G(f.tokens.next)===f.tokens.curr.line&&f.tokens.next.id!=="(end)",t=pn(f.tokens.next,"}");e&&!t?R("E058",f.tokens.curr.line,f.tokens.curr.character):f.option.asi||(t&&!f.option.lastsemic||!e)&&I("W033",f.tokens.curr.line,f.tokens.curr.character)}else V(";")}function At(){var e=g,t,n=f.tokens.next,r=!1;if(n.id===";"){V(";");return}var i=O(n);i&&n.meta&&n.meta.isFutureReservedWord&&W().id===":"&&(F("W024",n,n.id),i=!1),n.identifier&&!i&&W().id===":"&&(V(),V(":"),r=!0,f.funct["(scope)"].stack(),f.funct["(scope)"].block.addBreakLabel(n.value,{token:f.tokens.curr}),!f.tokens.next.labelled&&f.tokens.next.value!=="{"&&F("W028",f.tokens.next,n.value,f.tokens.next.value),f.tokens.next.label=n.value,n=f.tokens.next);if(n.id==="{"){var s=f.funct["(verb)"]==="case"&&f.tokens.curr.value===":";_t(!0,!0,!1,!1,s);return}return t=Q(0,!0),t&&(!t.identifier||t.value!=="function")&&(t.type!=="(punctuator)"||!t.left||!t.left.identifier||t.left.value!=="function")&&!f.isStrict()&&f.option.strict==="global"&&F("E007"),n.block||(!f.option.expr&&(!t||!t.exps)?F("W030",f.tokens.curr):f.option.nonew&&t&&t.left&&t.id==="("&&t.left.id==="new"&&F("W031",n),Lt()),g=e,r&&f.funct["(scope)"].unstack(),t}function Ot(){var e=[],t;while(!f.tokens.next.reach&&f.tokens.next.id!=="(end)")f.tokens.next.id===";"?(t=W(),(!t||t.id!=="("&&t.id!=="[")&&F("W032"),V(";")):e.push(At());return e}function Mt(){var e,t,n;while(f.tokens.next.id==="(string)"){t=W(0);if(t.id==="(endline)"){e=1;do n=W(e++);while(n.id==="(endline)");if(n.id===";")t=n;else{if(n.value==="["||n.value===".")break;(!f.option.asi||n.value==="(")&&F("W033",f.tokens.next)}}else{if(t.id==="."||t.id==="[")break;t.id!==";"&&F("W033",t)}V();var r=f.tokens.curr.value;(f.directive[r]||r==="use strict"&&f.option.strict==="implied")&&F("W034",f.tokens.curr,r),f.directive[r]=!0,t.id===";"&&V(";")}f.isStrict()&&(f.option["(explicitNewcap)"]||(f.option.newcap=!0),f.option.undef=!0)}function _t(e,t,n,i,s){var o,u=m,a=g,l,c,h,p;m=e,c=f.tokens.next;var d=f.funct["(metrics)"];d.nestedBlockDepth+=1,d.verifyMaxNestedBlockDepthPerFunction();if(f.tokens.next.id==="{"){V("{"),f.funct["(scope)"].stack(),h=f.tokens.curr.line;if(f.tokens.next.id!=="}"){g+=f.option.indent;while(!e&&f.tokens.next.from>g)g+=f.option.indent;if(n){l={};for(p in f.directive)r.has(f.directive,p)&&(l[p]=f.directive[p]);Mt(),f.option.strict&&f.funct["(context)"]["(global)"]&&!l["use strict"]&&!f.isStrict()&&F("E007")}o=Ot(),d.statementCount+=o.length,g-=f.option.indent}V("}",c),n&&(f.funct["(scope)"].validateParams(),l&&(f.directive=l)),f.funct["(scope)"].unstack(),g=a}else if(!e)if(n){f.funct["(scope)"].stack(),l={},t&&!i&&!f.inMoz()&&q("W118",f.tokens.curr,"function closure expressions");if(!t)for(p in f.directive)r.has(f.directive,p)&&(l[p]=f.directive[p]);Q(10),f.option.strict&&f.funct["(context)"]["(global)"]&&!l["use strict"]&&!f.isStrict()&&F("E007"),f.funct["(scope)"].unstack()}else q("E021",f.tokens.next,"{",f.tokens.next.value);else f.funct["(noblockscopedvar)"]=f.tokens.next.id!=="for",f.funct["(scope)"].stack(),(!t||f.option.curly)&&F("W116",f.tokens.next,"{",f.tokens.next.value),f.tokens.next.inBracelessBlock=!0,g+=f.option.indent,o=[At()],g-=f.option.indent,f.funct["(scope)"].unstack(),delete f.funct["(noblockscopedvar)"];switch(f.funct["(verb)"]){case"break":case"continue":case"return":case"throw":if(s)break;default:f.funct["(verb)"]=null}return m=u,e&&f.option.noempty&&(!o||o.length===0)&&F("W035",f.tokens.prev),d.nestedBlockDepth-=1,o}function Dt(e){E&&typeof E[e]!="boolean"&&F("W036",f.tokens.curr,e),typeof w[e]=="number"?w[e]+=1:w[e]=1}function Bt(){var e={};e.exps=!0,f.funct["(comparray)"].stack();var t=!1;return f.tokens.next.value!=="for"&&(t=!0,f.inMoz()||F("W116",f.tokens.next,"for",f.tokens.next.value),f.funct["(comparray)"].setState("use"),e.right=Q(10)),V("for"),f.tokens.next.value==="each"&&(V("each"),f.inMoz()||F("W118",f.tokens.curr,"for each")),V("("),f.funct["(comparray)"].setState("define"),e.left=Q(130),r.contains(["in","of"],f.tokens.next.value)?V():q("E045",f.tokens.curr),f.funct["(comparray)"].setState("generate"),Q(10),V(")"),f.tokens.next.value==="if"&&(V("if"),V("("),f.funct["(comparray)"].setState("filter"),e.filter=Q(10),V(")")),t||(f.funct["(comparray)"].setState("use"),e.right=Q(10)),V("]"),f.funct["(comparray)"].unstack(),e}function jt(){return f.funct["(statement)"]&&f.funct["(statement)"].type==="class"||f.funct["(context)"]&&f.funct["(context)"]["(verb)"]==="class"}function Ft(e){return e.identifier||e.id==="(string)"||e.id==="(number)"}function It(e){var t,n=!0;return typeof e=="object"?t=e:(n=e,t=Nt(!1,!0,n)),t?typeof t=="object"&&(t.id==="(string)"||t.id==="(identifier)"?t=t.value:t.id==="(number)"&&(t=t.value.toString())):f.tokens.next.id==="(string)"?(t=f.tokens.next.value,n||V()):f.tokens.next.id==="(number)"&&(t=f.tokens.next.value.toString(),n||V()),t==="hasOwnProperty"&&F("W001"),t}function qt(e){function h(e){f.funct["(scope)"].addParam.apply(f.funct["(scope)"],e)}var t,n=[],i,s=[],o,u=!1,a=!1,l=0,c=e&&e.loneArg;if(c&&c.identifier===!0)return f.funct["(scope)"].addParam(c.value,c),{arity:1,params:[c.value]};t=f.tokens.next,(!e||!e.parsedOpening)&&V("(");if(f.tokens.next.id===")"){V(")");return}for(;;){l++;var p=[];if(r.contains(["{","["],f.tokens.next.id)){s=Gt();for(o in s)o=s[o],o.id&&(n.push(o.id),p.push([o.id,o.token]))}else{pn(f.tokens.next,"...")&&(a=!0),i=Ct(!0);if(i)n.push(i),p.push([i,f.tokens.curr]);else while(!hn(f.tokens.next,[",",")"]))V()}u&&f.tokens.next.id!=="="&&q("W138",f.tokens.current),f.tokens.next.id==="="&&(f.inES6()||F("W119",f.tokens.next,"default parameters","6"),V("="),u=!0,Q(10)),p.forEach(h);if(f.tokens.next.id!==",")return V(")",t),{arity:l,params:n};a&&F("W131",f.tokens.next),tt()}}function Rt(e,t,n){var i={"(name)":e,"(breakage)":0,"(loopage)":0,"(tokens)":{},"(properties)":{},"(catch)":!1,"(global)":!1,"(line)":null,"(character)":null,"(metrics)":null,"(statement)":null,"(context)":null,"(scope)":null,"(comparray)":null,"(generator)":null,"(arrow)":null,"(params)":null};return t&&r.extend(i,{"(line)":t.line,"(character)":t.character,"(metrics)":Vt(t)}),r.extend(i,n),i["(context)"]&&(i["(scope)"]=i["(context)"]["(scope)"],i["(comparray)"]=i["(context)"]["(comparray)"]),i}function Ut(e){return"(scope)"in e}function zt(e){return e["(global)"]&&!e["(verb)"]}function Wt(e){function i(){if(f.tokens.curr.template&&f.tokens.curr.tail&&f.tokens.curr.context===t)return!0;var e=f.tokens.next.template&&f.tokens.next.tail&&f.tokens.next.context===t;return e&&V(),e||f.tokens.next.isUnclosed}var t=this.context,n=this.noSubst,r=this.depth;if(!n)while(!i())!f.tokens.next.template||f.tokens.next.depth>r?Q(0):V();return{id:"(template)",type:"(template)",tag:e}}function Xt(e){var t,n,r,i,s,o,u,a,l=f.option,c=f.ignored;e&&(r=e.name,i=e.statement,s=e.classExprBinding,o=e.type==="generator",u=e.type==="arrow",a=e.ignoreLoopFunc),f.option=Object.create(f.option),f.ignored=Object.create(f.ignored),f.funct=Rt(r||f.nameStack.infer(),f.tokens.next,{"(statement)":i,"(context)":f.funct,"(arrow)":u,"(generator)":o}),t=f.funct,n=f.tokens.curr,n.funct=f.funct,v.push(f.funct),f.funct["(scope)"].stack("functionouter");var h=r||s;h&&f.funct["(scope)"].block.add(h,s?"class":"function",f.tokens.curr,!1),f.funct["(scope)"].stack("functionparams");var p=qt(e);return p?(f.funct["(params)"]=p.params,f.funct["(metrics)"].arity=p.arity,f.funct["(metrics)"].verifyMaxParametersPerFunction()):f.funct["(metrics)"].arity=0,u&&(f.inES6(!0)||F("W119",f.tokens.curr,"arrow function syntax (=>)","6"),e.loneArg||V("=>")),_t(!1,!0,!0,u),!f.option.noyield&&o&&f.funct["(generator)"]!=="yielded"&&F("W124",f.tokens.curr),f.funct["(metrics)"].verifyMaxStatementsPerFunction(),f.funct["(metrics)"].verifyMaxComplexityPerFunction(),f.funct["(unusedOption)"]=f.option.unused,f.option=l,f.ignored=c,f.funct["(last)"]=f.tokens.curr.line,f.funct["(lastcharacter)"]=f.tokens.curr.character,f.funct["(scope)"].unstack(),f.funct["(scope)"].unstack(),f.funct=f.funct["(context)"],!a&&!f.option.loopfunc&&f.funct["(loopage)"]&&t["(isCapturing)"]&&F("W083",n),t}function Vt(e){return{statementCount:0,nestedBlockDepth:-1,ComplexityCount:1,arity:0,verifyMaxStatementsPerFunction:function(){f.option.maxstatements&&this.statementCount>f.option.maxstatements&&F("W071",e,this.statementCount)},verifyMaxParametersPerFunction:function(){r.isNumber(f.option.maxparams)&&this.arity>f.option.maxparams&&F("W072",e,this.arity)},verifyMaxNestedBlockDepthPerFunction:function(){f.option.maxdepth&&this.nestedBlockDepth>0&&this.nestedBlockDepth===f.option.maxdepth+1&&F("W073",null,this.nestedBlockDepth)},verifyMaxComplexityPerFunction:function(){var t=f.option.maxcomplexity,n=this.ComplexityCount;t&&n>t&&F("W074",e,n)}}}function $t(){f.funct["(metrics)"].ComplexityCount+=1}function Jt(e){var t,n;e&&(t=e.id,n=e.paren,t===","&&(e=e.exprs[e.exprs.length-1])&&(t=e.id,n=n||e.paren));switch(t){case"=":case"+=":case"-=":case"*=":case"%=":case"&=":case"|=":case"^=":case"/=":!n&&!f.option.boss&&F("W084")}}function Kt(e){if(f.inES5())for(var t in e)e[t]&&e[t].setterToken&&!e[t].getterToken&&F("W078",e[t].setterToken)}function Qt(e,t){if(pn(f.tokens.next,".")){var n=f.tokens.curr.id;V(".");var r=Ct();return f.tokens.curr.isMetaProperty=!0,e!==r?q("E057",f.tokens.prev,n,r):t(),f.tokens.curr}}function Gt(e){var t=e&&e.assignment;return f.inES6()||F("W104",f.tokens.curr,t?"destructuring assignment":"destructuring binding","6"),Yt(e)}function Yt(e){var t,n=[],r=e&&e.openingParsed,i=e&&e.assignment,s=i?{assignment:i}:null,o=r?f.tokens.curr:f.tokens.next,u=function(){var e;if(hn(f.tokens.next,["[","{"])){t=Yt(s);for(var r in t)r=t[r],n.push({id:r.id,token:r.token})}else if(pn(f.tokens.next,","))n.push({id:null,token:f.tokens.curr});else{if(!pn(f.tokens.next,"(")){var o=pn(f.tokens.next,"...");if(i){var a=o?W(0):f.tokens.next;a.identifier||F("E030",a,a.value);var l=Q(155);l&&(wt(l),l.identifier&&(e=l.value))}else e=Ct();return e&&n.push({id:e,token:f.tokens.curr}),o}V("("),u(),V(")")}return!1},a=function(){var e;pn(f.tokens.next,"[")?(V("["),Q(10),V("]"),V(":"),u()):f.tokens.next.id==="(string)"||f.tokens.next.id==="(number)"?(V(),V(":"),u()):(e=Ct(),pn(f.tokens.next,":")?(V(":"),u()):e&&(i&&wt(f.tokens.curr),n.push({id:e,token:f.tokens.curr})))};if(pn(o,"[")){r||V("["),pn(f.tokens.next,"]")&&F("W137",f.tokens.curr);var l=!1;while(!pn(f.tokens.next,"]"))u()&&!l&&pn(f.tokens.next,",")&&(F("W130",f.tokens.next),l=!0),pn(f.tokens.next,"=")&&(pn(f.tokens.prev,"...")?V("]"):V("="),f.tokens.next.id==="undefined"&&F("W080",f.tokens.prev,f.tokens.prev.value),Q(10)),pn(f.tokens.next,"]")||V(",");V("]")}else if(pn(o,"{")){r||V("{"),pn(f.tokens.next,"}")&&F("W137",f.tokens.curr);while(!pn(f.tokens.next,"}")){a(),pn(f.tokens.next,"=")&&(V("="),f.tokens.next.id==="undefined"&&F("W080",f.tokens.prev,f.tokens.prev.value),Q(10));if(!pn(f.tokens.next,"}")){V(",");if(pn(f.tokens.next,"}"))break}}V("}")}return n}function Zt(e,t){var n=t.first;if(!n)return;r.zip(e,Array.isArray(n)?n:[n]).forEach(function(e){var t=e[0],n=e[1];t&&n?t.first=n:t&&t.first&&!n&&F("W080",t.first,t.first.value)})}function en(e,t,n){var i=n&&n.prefix,s=n&&n.inexport,o=e==="let",u=e==="const",a,l,c,h;f.inES6()||F("W104",f.tokens.curr,e,"6"),o&&f.tokens.next.value==="("?(f.inMoz()||F("W118",f.tokens.next,"let block"),V("("),f.funct["(scope)"].stack(),h=!0):f.funct["(noblockscopedvar)"]&&q("E048",f.tokens.curr,u?"Const":"Let"),t.first=[];for(;;){var p=[];r.contains(["{","["],f.tokens.next.value)?(a=Gt(),l=!1):(a=[{id:Ct(),token:f.tokens.curr}],l=!0),!i&&u&&f.tokens.next.id!=="="&&F("E012",f.tokens.curr,f.tokens.curr.value);for(var d in a)a.hasOwnProperty(d)&&(d=a[d],f.funct["(scope)"].block.isGlobal()&&S[d.id]===!1&&F("W079",d.token,d.id),d.id&&!f.funct["(noblockscopedvar)"]&&(f.funct["(scope)"].addlabel(d.id,{type:e,token:d.token}),p.push(d.token),l&&s&&f.funct["(scope)"].setExported(d.token.value,d.token)));f.tokens.next.id==="="&&(V("="),!i&&f.tokens.next.id==="undefined"&&F("W080",f.tokens.prev,f.tokens.prev.value),!i&&W(0).id==="="&&f.tokens.next.identifier&&F("W120",f.tokens.next,f.tokens.next.value),c=Q(i?120:10),l?a[0].first=c:Zt(p,c)),t.first=t.first.concat(p);if(f.tokens.next.id!==",")break;tt()}return h&&(V(")"),_t(!0,!0),t.block=!0,f.funct["(scope)"].unstack()),t}function sn(e){return f.inES6()||F("W104",f.tokens.curr,"class","6"),e?(this.name=Ct(),f.funct["(scope)"].addlabel(this.name,{type:"class",token:f.tokens.curr})):f.tokens.next.identifier&&f.tokens.next.value!=="extends"?(this.name=Ct(),this.namedExpr=!0):this.name=f.nameStack.infer(),on(this),this}function on(e){var t=f.inClassBody;f.tokens.next.value==="extends"&&(V("extends"),e.heritage=Q(10)),f.inClassBody=!0,V("{"),e.body=un(e),V("}"),f.inClassBody=t}function un(e){var t,n,r,i,s=Object.create(null),o=Object.create(null),u;for(var a=0;f.tokens.next.id!=="}";++a){t=f.tokens.next,n=!1,r=!1,i=null;if(t.id===";"){F("W032"),V(";");continue}t.id==="*"&&(r=!0,V("*"),t=f.tokens.next);if(t.id==="[")t=cn(),u=!0;else{if(!Ft(t)){F("W052",f.tokens.next,f.tokens.next.value||f.tokens.next.type),V();continue}V(),u=!1;if(t.identifier&&t.value==="static"){pn(f.tokens.next,"*")&&(r=!0,V("*"));if(Ft(f.tokens.next)||f.tokens.next.id==="[")u=f.tokens.next.id==="[",n=!0,t=f.tokens.next,f.tokens.next.id==="["?t=cn():V()}t.identifier&&(t.value==="get"||t.value==="set")&&(Ft(f.tokens.next)||f.tokens.next.id==="[")&&(u=f.tokens.next.id==="[",i=t,t=f.tokens.next,f.tokens.next.id==="["?t=cn():V())}if(!pn(f.tokens.next,"(")){q("E054",f.tokens.next,f.tokens.next.value);while(f.tokens.next.id!=="}"&&!pn(f.tokens.next,"("))V();f.tokens.next.value!=="("&&Xt({statement:e})}u||(i?ln(i.value,n?o:s,t.value,t,!0,n):(t.value==="constructor"?f.nameStack.set(e):f.nameStack.set(t),fn(n?o:s,t.value,t,!0,n)));if(i&&t.value==="constructor"){var l=i.value==="get"?"class getter method":"class setter method";q("E049",t,l,"constructor")}else t.value==="prototype"&&q("E049",t,"class method","prototype");It(t),Xt({statement:e,type:r?"generator":null,classExprBinding:e.namedExpr?e.name:null})}Kt(s)}function fn(e,t,n,r,i){var s=["key","class method","static class method"];s=s[(r||!1)+(i||!1)],n.identifier&&(t=n.value),e[t]&&t!=="__proto__"?F("W075",f.tokens.next,s,t):e[t]=Object.create(null),e[t].basic=!0,e[t].basictkn=n}function ln(e,t,n,r,i,s){var o=e==="get"?"getterToken":"setterToken",u="";i?(s&&(u+="static "),u+=e+"ter method"):u="key",f.tokens.curr.accessorType=e,f.nameStack.set(r),t[n]?(t[n].basic||t[n][o])&&n!=="__proto__"&&F("W075",f.tokens.next,u,n):t[n]=Object.create(null),t[n][o]=r}function cn(){V("["),f.inES6()||F("W119",f.tokens.curr,"computed property names","6");var e=Q(10);return V("]"),e}function hn(e,t){return e.type==="(punctuator)"?r.contains(t,e.value):!1}function pn(e,t){return e.type==="(punctuator)"&&e.value===t}function dn(){var e=an();e.notJson?(!f.inES6()&&e.isDestAssign&&F("W104",f.tokens.curr,"destructuring assignment","6"),Ot()):(f.option.laxbreak=!0,f.jsonMode=!0,mn())}function mn(){function e(){var e={},t=f.tokens.next;V("{");if(f.tokens.next.id!=="}")for(;;){if(f.tokens.next.id==="(end)")q("E026",f.tokens.next,t.line);else{if(f.tokens.next.id==="}"){F("W094",f.tokens.curr);break}f.tokens.next.id===","?q("E028",f.tokens.next):f.tokens.next.id!=="(string)"&&F("W095",f.tokens.next,f.tokens.next.value)}e[f.tokens.next.value]===!0?F("W075",f.tokens.next,"key",f.tokens.next.value):f.tokens.next.value==="__proto__"&&!f.option.proto||f.tokens.next.value==="__iterator__"&&!f.option.iterator?F("W096",f.tokens.next,f.tokens.next.value):e[f.tokens.next.value]=!0,V(),V(":"),mn();if(f.tokens.next.id!==",")break;V(",")}V("}")}function t(){var e=f.tokens.next;V("[");if(f.tokens.next.id!=="]")for(;;){if(f.tokens.next.id==="(end)")q("E027",f.tokens.next,e.line);else{if(f.tokens.next.id==="]"){F("W094",f.tokens.curr);break}f.tokens.next.id===","&&q("E028",f.tokens.next)}mn();if(f.tokens.next.id!==",")break;V(",")}V("]")}switch(f.tokens.next.id){case"{":e();break;case"[":t();break;case"true":case"false":case"null":case"(number)":case"(string)":V();break;case"-":V("-"),V("(number)");break;default:q("E003",f.tokens.next)}}var e,t={"<":!0,"<=":!0,"==":!0,"===":!0,"!==":!0,"!=":!0,">":!0,">=":!0,"+":!0,"-":!0,"*":!0,"/":!0,"%":!0},n,d=["closure","exception","global","label","outer","unused","var"],v,m,g,y,b,w,E,S,x,T,N=[],C=new i.EventEmitter,mt={};mt.legacy=["xml","unknown"],mt.es3=["undefined","boolean","number","string","function","object"],mt.es3=mt.es3.concat(mt.legacy),mt.es6=mt.es3.concat("symbol"),at("(number)",function(){return this}),at("(string)",function(){return this}),f.syntax["(identifier)"]={type:"(identifier)",lbp:0,identifier:!0,nud:function(){var e=this.value;return f.tokens.next.id==="=>"?this:(f.funct["(comparray)"].check(e)||f.funct["(scope)"].block.use(e,f.tokens.curr),this)},led:function(){q("E033",f.tokens.next,f.tokens.next.value)}};var Pt={lbp:0,identifier:!1,template:!0};f.syntax["(template)"]=r.extend({type:"(template)",nud:Wt,led:Wt,noSubst:!1},Pt),f.syntax["(template middle)"]=r.extend({type:"(template middle)",middle:!0,noSubst:!1},Pt),f.syntax["(template tail)"]=r.extend({type:"(template tail)",tail:!0,noSubst:!1},Pt),f.syntax["(no subst template)"]=r.extend({type:"(template)",nud:Wt,led:Wt,noSubst:!0,tail:!0},Pt),at("(regexp)",function(){return this}),rt("(endline)"),rt("(begin)"),rt("(end)").reach=!0,rt("(error)").reach=!0,rt("}").reach=!0,rt(")"),rt("]"),rt('"').reach=!0,rt("'").reach=!0,rt(";"),rt(":").reach=!0,rt("#"),ft("else"),ft("case").reach=!0,ft("catch"),ft("default").reach=!0,ft("finally"),ct("arguments",function(e){f.isStrict()&&f.funct["(global)"]&&F("E008",e)}),ct("eval"),ct("false"),ct("Infinity"),ct("null"),ct("this",function(e){f.isStrict()&&!jt()&&!f.option.validthis&&(f.funct["(statement)"]&&f.funct["(name)"].charAt(0)>"Z"||f.funct["(global)"])&&F("W040",e)}),ct("true"),ct("undefined"),Et("=","assign",20),Et("+=","assignadd",20),Et("-=","assignsub",20),Et("*=","assignmult",20),Et("/=","assigndiv",20).nud=function(){q("E014")},Et("%=","assignmod",20),xt("&="),xt("|="),xt("^="),xt("<<="),xt(">>="),xt(">>>="),ht(",",function(e,t){var n;t.exprs=[e],f.option.nocomma&&F("W127");if(!tt({peek:!0}))return t;for(;;){if(!(n=Q(10)))break;t.exprs.push(n);if(f.tokens.next.value!==","||!tt())break}return t},10,!0),ht("?",function(e,t){return $t(),t.left=e,t.right=Q(10),V(":"),t["else"]=Q(10),t},30);var Ht=40;ht("||",function(e,t){return $t(),t.left=e,t.right=Q(Ht),t},Ht),ht("&&","and",50),St("|","bitor",70),St("^","bitxor",80),St("&","bitand",90),dt("==",function(e,t){var n=f.option.eqnull&&((e&&e.value)==="null"||(t&&t.value)==="null");switch(!0){case!n&&f.option.eqeqeq:this.from=this.character,F("W116",this,"===","==");break;case vt(e):F("W041",this,"===",e.value);break;case vt(t):F("W041",this,"===",t.value);break;case gt(t,e,f):F("W122",this,t.value);break;case gt(e,t,f):F("W122",this,e.value)}return this}),dt("===",function(e,t){return gt(t,e,f)?F("W122",this,t.value):gt(e,t,f)&&F("W122",this,e.value),this}),dt("!=",function(e,t){var n=f.option.eqnull&&((e&&e.value)==="null"||(t&&t.value)==="null");return!n&&f.option.eqeqeq?(this.from=this.character,F("W116",this,"!==","!=")):vt(e)?F("W041",this,"!==",e.value):vt(t)?F("W041",this,"!==",t.value):gt(t,e,f)?F("W122",this,t.value):gt(e,t,f)&&F("W122",this,e.value),this}),dt("!==",function(e,t){return gt(t,e,f)?F("W122",this,t.value):gt(e,t,f)&&F("W122",this,e.value),this}),dt("<"),dt(">"),dt("<="),dt(">="),St("<<","shiftleft",120),St(">>","shiftright",120),St(">>>","shiftrightunsigned",120),ht("in","in",120),ht("instanceof","instanceof",120),ht("+",function(e,t){var n;return t.left=e,t.right=n=Q(130),e&&n&&e.id==="(string)"&&n.id==="(string)"?(e.value+=n.value,e.character=n.character,!f.option.scripturl&&a.javascriptURL.test(e.value)&&F("W050",e),e):t},130),ut("+","num"),ut("+++",function(){return F("W007"),this.arity="unary",this.right=Q(150),this}),ht("+++",function(e){return F("W007"),this.left=e,this.right=Q(130),this},130),ht("-","sub",130),ut("-","neg"),ut("---",function(){return F("W006"),this.arity="unary",this.right=Q(150),this}),ht("---",function(e){return F("W006"),this.left=e,this.right=Q(130),this},130),ht("*","mult",140),ht("/","div",140),ht("%","mod",140),Tt("++"),ut("++","preinc"),f.syntax["++"].exps=!0,Tt("--"),ut("--","predec"),f.syntax["--"].exps=!0,ut("delete",function(){var e=Q(10);return e?(e.id!=="."&&e.id!=="["&&F("W051"),this.first=e,e.identifier&&!f.isStrict()&&(e.forgiveUndef=!0),this):this}).exps=!0,ut("~",function(){return f.option.bitwise&&F("W016",this,"~"),this.arity="unary",this.right=Q(150),this}),ut("...",function(){return f.inES6(!0)||F("W119",this,"spread/rest operator","6"),!f.tokens.next.identifier&&f.tokens.next.type!=="(string)"&&!hn(f.tokens.next,["[","("])&&q("E030",f.tokens.next,f.tokens.next.value),Q(150),this}),ut("!",function(){return this.arity="unary",this.right=Q(150),this.right||B("E041",this.line||0),t[this.right.id]===!0&&F("W018",this,"!"),this}),ut("typeof",function(){var e=Q(150);return this.first=this.right=e,e||B("E041",this.line||0,this.character||0),e.identifier&&(e.forgiveUndef=!0),this}),ut("new",function(){var e=Qt("target",function(){f.inES6(!0)||F("W119",f.tokens.prev,"new.target","6");var e,t=f.funct;while(t){e=!t["(global)"];if(!t["(arrow)"])break;t=t["(context)"]}e||F("W136",f.tokens.prev,"new.target")});if(e)return e;var t=Q(155),n;if(t&&t.id!=="function")if(t.identifier){t["new"]=!0;switch(t.value){case"Number":case"String":case"Boolean":case"Math":case"JSON":F("W053",f.tokens.prev,t.value);break;case"Symbol":f.inES6()&&F("W053",f.tokens.prev,t.value);break;case"Function":f.option.evil||F("W054");break;case"Date":case"RegExp":case"this":break;default:t.id!=="function"&&(n=t.value.substr(0,1),f.option.newcap&&(n<"A"||n>"Z")&&!f.funct["(scope)"].isPredefined(t.value)&&F("W055",f.tokens.curr))}}else t.id!=="."&&t.id!=="["&&t.id!=="("&&F("W056",f.tokens.curr);else f.option.supernew||F("W057",this);return f.tokens.next.id!=="("&&!f.option.supernew&&F("W058",f.tokens.curr,f.tokens.curr.value),this.first=this.right=t,this}),f.syntax["new"].exps=!0,ut("void").exps=!0,ht(".",function(e,t){var n=Ct(!1,!0);return typeof n=="string"&&Dt(n),t.left=e,t.right=n,n&&n==="hasOwnProperty"&&f.tokens.next.value==="="&&F("W001"),!e||e.value!=="arguments"||n!=="callee"&&n!=="caller"?!f.option.evil&&e&&e.value==="document"&&(n==="write"||n==="writeln")&&F("W060",e):f.option.noarg?F("W059",e,n):f.isStrict()&&q("E008"),!f.option.evil&&(n==="eval"||n==="execScript")&&yt(e,f)&&F("W061"),t},160,!0),ht("(",function(e,t){f.option.immed&&e&&!e.immed&&e.id==="function"&&F("W062");var n=0,r=[];e&&e.type==="(identifier)"&&e.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)&&"Array Number String Boolean Date Object Error Symbol".indexOf(e.value)===-1&&(e.value==="Math"?F("W063",e):f.option.newcap&&F("W064",e));if(f.tokens.next.id!==")")for(;;){r[r.length]=Q(10),n+=1;if(f.tokens.next.id!==",")break;tt()}return V(")"),typeof e=="object"&&(!f.inES5()&&e.value==="parseInt"&&n===1&&F("W065",f.tokens.curr),f.option.evil||(e.value==="eval"||e.value==="Function"||e.value==="execScript"?(F("W061",e),r[0]&&[0].id==="(string)"&&U(e,r[0].value)):!r[0]||r[0].id!=="(string)"||e.value!=="setTimeout"&&e.value!=="setInterval"?r[0]&&r[0].id==="(string)"&&e.value==="."&&e.left.value==="window"&&(e.right==="setTimeout"||e.right==="setInterval")&&(F("W066",e),U(e,r[0].value)):(F("W066",e),U(e,r[0].value))),!e.identifier&&e.id!=="."&&e.id!=="["&&e.id!=="=>"&&e.id!=="("&&e.id!=="&&"&&e.id!=="||"&&e.id!=="?"&&(!f.inES6()||!e["(name)"])&&F("W067",t)),t.left=e,t},155,!0).exps=!0,ut("(",function(){var e=f.tokens.next,t,n=-1,r,i,s,o,u=1,a=f.tokens.curr,l=f.tokens.prev,c=!f.option.singleGroups;do e.value==="("?u+=1:e.value===")"&&(u-=1),n+=1,t=e,e=W(n);while((u!==0||t.value!==")")&&e.value!==";"&&e.type!=="(end)");f.tokens.next.id==="function"&&(i=f.tokens.next.immed=!0);if(e.value==="=>")return Xt({type:"arrow",parsedOpening:!0});var h=[];if(f.tokens.next.id!==")")for(;;){h.push(Q(10));if(f.tokens.next.id!==",")break;f.option.nocomma&&F("W127"),tt()}V(")",this),f.option.immed&&h[0]&&h[0].id==="function"&&f.tokens.next.id!=="("&&f.tokens.next.id!=="."&&f.tokens.next.id!=="["&&F("W068",this);if(!h.length)return;return h.length>1?(r=Object.create(f.syntax[","]),r.exprs=h,s=h[0],o=h[h.length-1],c||(c=l.assign||l.delim)):(r=s=o=h[0],c||(c=a.beginsStmt&&(r.id==="{"||i||Ut(r))||i&&(!J()||f.tokens.prev.id!=="}")||Ut(r)&&!J()||r.id==="{"&&l.id==="=>"||r.type==="(number)"&&pn(e,".")&&/^\d+$/.test(r.value))),r&&(!c&&(s.left||s.right||r.exprs)&&(c=!K(l)&&s.lbp<=l.lbp||!J()&&o.lbp"),ht("[",function(e,t){var n=Q(10),r;return n&&n.type==="(string)"&&(!f.option.evil&&(n.value==="eval"||n.value==="execScript")&&yt(e,f)&&F("W061"),Dt(n.value),!f.option.sub&&a.identifier.test(n.value)&&(r=f.syntax[n.value],(!r||!O(r))&&F("W069",f.tokens.prev,n.value))),V("]",t),n&&n.value==="hasOwnProperty"&&f.tokens.next.value==="="&&F("W001"),t.left=e,t.right=n,t},160,!0),ut("[",function(){var e=an();if(e.isCompArray)return!f.option.esnext&&!f.inMoz()&&F("W118",f.tokens.curr,"array comprehension"),Bt();if(e.isDestAssign)return this.destructAssign=Gt({openingParsed:!0,assignment:!0}),this;var t=f.tokens.curr.line!==G(f.tokens.next);this.first=[],t&&(g+=f.option.indent,f.tokens.next.from===g+f.option.indent&&(g+=f.option.indent));while(f.tokens.next.id!=="(end)"){while(f.tokens.next.id===","){if(!f.option.elision){if(!!f.inES5()){F("W128");do V(",");while(f.tokens.next.id===",");continue}F("W070")}V(",")}if(f.tokens.next.id==="]")break;this.first.push(Q(10));if(f.tokens.next.id!==",")break;tt({allowTrailing:!0});if(f.tokens.next.id==="]"&&!f.inES5()){F("W070",f.tokens.curr);break}}return t&&(g-=f.option.indent),V("]",this),this}),function(e){e.nud=function(){var e,t,n,r,i,s=!1,o,u=Object.create(null);e=f.tokens.curr.line!==G(f.tokens.next),e&&(g+=f.option.indent,f.tokens.next.from===g+f.option.indent&&(g+=f.option.indent));var a=an();if(a.isDestAssign)return this.destructAssign=Gt({openingParsed:!0,assignment:!0}),this;for(;;){if(f.tokens.next.id==="}")break;o=f.tokens.next.value;if(!f.tokens.next.identifier||X().id!==","&&X().id!=="}")if(W().id===":"||o!=="get"&&o!=="set"){f.tokens.next.value==="*"&&f.tokens.next.type==="(punctuator)"?(f.inES6()||F("W104",f.tokens.next,"generator functions","6"),V("*"),s=!0):s=!1;if(f.tokens.next.id==="[")n=cn(),f.nameStack.set(n);else{f.nameStack.set(f.tokens.next),n=It(),fn(u,n,f.tokens.next);if(typeof n!="string")break}f.tokens.next.value==="("?(f.inES6()||F("W104",f.tokens.curr,"concise methods","6"),Xt({type:s?"generator":null})):(V(":"),Q(10))}else V(o),f.inES5()||q("E034"),n=It(),!n&&!f.inES6()&&q("E035"),n&&ln(o,u,n,f.tokens.curr),i=f.tokens.next,t=Xt(),r=t["(params)"],o==="get"&&n&&r?F("W076",i,r[0],n):o==="set"&&n&&(!r||r.length!==1)&&F("W077",i,n);else f.inES6()||F("W104",f.tokens.next,"object short notation","6"),n=It(!0),fn(u,n,f.tokens.next),Q(10);Dt(n);if(f.tokens.next.id!==",")break;tt({allowTrailing:!0,property:!0}),f.tokens.next.id===","?F("W070",f.tokens.curr):f.tokens.next.id==="}"&&!f.inES5()&&F("W070",f.tokens.curr)}return e&&(g-=f.option.indent),V("}",this),Kt(u),this},e.fud=function(){q("E036",f.tokens.curr)}}(rt("{"));var tn=it("const",function(e){return en("const",this,e)});tn.exps=!0;var nn=it("let",function(e){return en("let",this,e)});nn.exps=!0;var rn=it("var",function(e){var t=e&&e.prefix,n=e&&e.inexport,i,o,u,a=e&&e.implied,l=!e||!e.ignore;this.first=[];for(;;){var c=[];r.contains(["{","["],f.tokens.next.value)?(i=Gt(),o=!1):(i=[{id:Ct(),token:f.tokens.curr}],o=!0),(!t||!a)&&l&&f.option.varstmt&&F("W132",this),this.first=this.first.concat(c);for(var h in i)i.hasOwnProperty(h)&&(h=i[h],!a&&f.funct["(global)"]&&(S[h.id]===!1?F("W079",h.token,h.id):f.option.futurehostile===!1&&(!f.inES5()&&s.ecmaIdentifiers[5][h.id]===!1||!f.inES6()&&s.ecmaIdentifiers[6][h.id]===!1)&&F("W129",h.token,h.id)),h.id&&(a==="for"?(f.funct["(scope)"].has(h.id)||l&&F("W088",h.token,h.id),f.funct["(scope)"].block.use(h.id,h.token)):(f.funct["(scope)"].addlabel(h.id,{type:"var",token:h.token}),o&&n&&f.funct["(scope)"].setExported(h.id,h.token)),c.push(h.token)));f.tokens.next.id==="="&&(f.nameStack.set(f.tokens.curr),V("="),!t&&l&&!f.funct["(loopage)"]&&f.tokens.next.id==="undefined"&&F("W080",f.tokens.prev,f.tokens.prev.value),W(0).id==="="&&f.tokens.next.identifier&&(!t&&l&&!f.funct["(params)"]||f.funct["(params)"].indexOf(f.tokens.next.value)===-1)&&F("W120",f.tokens.next,f.tokens.next.value),u=Q(t?120:10),o?i[0].first=u:Zt(c,u));if(f.tokens.next.id!==",")break;tt()}return this});rn.exps=!0,st("class",function(){return sn.call(this,!0)}),st("function",function(e){var t=e&&e.inexport,n=!1;f.tokens.next.value==="*"&&(V("*"),f.inES6({strict:!0})?n=!0:F("W119",f.tokens.curr,"function*","6")),m&&F("W082",f.tokens.curr);var r=Nt();return f.funct["(scope)"].addlabel(r,{type:"function",token:f.tokens.curr}),r===undefined?F("W025"):t&&f.funct["(scope)"].setExported(r,f.tokens.prev),Xt({name:r,statement:this,type:n?"generator":null,ignoreLoopFunc:m}),f.tokens.next.id==="("&&f.tokens.next.line===f.tokens.curr.line&&q("E039"),this}),ut("function",function(){var e=!1;f.tokens.next.value==="*"&&(f.inES6()||F("W119",f.tokens.curr,"function*","6"),V("*"),e=!0);var t=Nt();return Xt({name:t,type:e?"generator":null}),this}),st("if",function(){var e=f.tokens.next;$t(),f.condition=!0,V("(");var t=Q(0);Jt(t);var n=null;f.option.forin&&f.forinifcheckneeded&&(f.forinifcheckneeded=!1,n=f.forinifchecks[f.forinifchecks.length-1],t.type==="(punctuator)"&&t.value==="!"?n.type="(negative)":n.type="(positive)"),V(")",e),f.condition=!1;var r=_t(!0,!0);return n&&n.type==="(negative)"&&r&&r[0]&&r[0].type==="(identifier)"&&r[0].value==="continue"&&(n.type="(negative-with-continue)"),f.tokens.next.id==="else"&&(V("else"),f.tokens.next.id==="if"||f.tokens.next.id==="switch"?At():_t(!0,!0)),this}),st("try",function(){function t(){V("catch"),V("("),f.funct["(scope)"].stack("catchparams");if(hn(f.tokens.next,["[","{"])){var e=Gt();r.each(e,function(e){e.id&&f.funct["(scope)"].addParam(e.id,e,"exception")})}else f.tokens.next.type!=="(identifier)"?F("E030",f.tokens.next,f.tokens.next.value):f.funct["(scope)"].addParam(Ct(),f.tokens.curr,"exception");f.tokens.next.value==="if"&&(f.inMoz()||F("W118",f.tokens.curr,"catch filter"),V("if"),Q(0)),V(")"),_t(!1),f.funct["(scope)"].unstack()}var e;_t(!0);while(f.tokens.next.id==="catch")$t(),e&&!f.inMoz()&&F("W118",f.tokens.next,"multiple catch blocks"),t(),e=!0;if(f.tokens.next.id==="finally"){V("finally"),_t(!0);return}return e||q("E021",f.tokens.next,"catch",f.tokens.next.value),this}),st("while",function(){var e=f.tokens.next;return f.funct["(breakage)"]+=1,f.funct["(loopage)"]+=1,$t(),V("("),Jt(Q(0)),V(")",e),_t(!0,!0),f.funct["(breakage)"]-=1,f.funct["(loopage)"]-=1,this}).labelled=!0,st("with",function(){var e=f.tokens.next;return f.isStrict()?q("E010",f.tokens.curr):f.option.withstmt||F("W085",f.tokens.curr),V("("),Q(0),V(")",e),_t(!0,!0),this}),st("switch",function(){var e=f.tokens.next,t=!1,n=!1;f.funct["(breakage)"]+=1,V("("),Jt(Q(0)),V(")",e),e=f.tokens.next,V("{"),f.tokens.next.from===g&&(n=!0),n||(g+=f.option.indent),this.cases=[];for(;;)switch(f.tokens.next.id){case"case":switch(f.funct["(verb)"]){case"yield":case"break":case"case":case"continue":case"return":case"switch":case"throw":break;default:f.tokens.curr.caseFallsThrough||F("W086",f.tokens.curr,"case")}V("case"),this.cases.push(Q(0)),$t(),t=!0,V(":"),f.funct["(verb)"]="case";break;case"default":switch(f.funct["(verb)"]){case"yield":case"break":case"continue":case"return":case"throw":break;default:this.cases.length&&(f.tokens.curr.caseFallsThrough||F("W086",f.tokens.curr,"default"))}V("default"),t=!0,V(":");break;case"}":n||(g-=f.option.indent),V("}",e),f.funct["(breakage)"]-=1,f.funct["(verb)"]=undefined;return;case"(end)":q("E023",f.tokens.next,"}");return;default:g+=f.option.indent;if(t)switch(f.tokens.curr.id){case",":q("E040");return;case":":t=!1,Ot();break;default:q("E025",f.tokens.curr);return}else{if(f.tokens.curr.id!==":"){q("E021",f.tokens.next,"case",f.tokens.next.value);return}V(":"),q("E024",f.tokens.curr,":"),Ot()}g-=f.option.indent}return this}).labelled=!0,it("debugger",function(){return f.option.debug||F("W087",this),this}).exps=!0,function(){var e=it("do",function(){f.funct["(breakage)"]+=1,f.funct["(loopage)"]+=1,$t(),this.first=_t(!0,!0),V("while");var e=f.tokens.next;return V("("),Jt(Q(0)),V(")",e),f.funct["(breakage)"]-=1,f.funct["(loopage)"]-=1,this});e.labelled=!0,e.exps=!0}(),st("for",function(){var e,t=f.tokens.next,n=!1,i=null;t.value==="each"&&(i=t,V("each"),f.inMoz()||F("W118",f.tokens.curr,"for each")),$t(),V("(");var s,o=0,u=["in","of"],a=0,l,c;hn(f.tokens.next,["{","["])&&++a;do{s=W(o),++o,hn(s,["{","["])?++a:hn(s,["}","]"])&&--a;if(a<0)break;a===0&&(!l&&pn(s,",")?l=s:!c&&pn(s,"=")&&(c=s))}while(a>0||!r.contains(u,s.value)&&s.value!==";"&&s.type!=="(end)");if(r.contains(u,s.value)){!f.inES6()&&s.value==="of"&&F("W104",s,"for of","6");var h=!c&&!l;c&&q("W133",l,s.value,"initializer is forbidden"),l&&q("W133",l,s.value,"more than one ForBinding"),f.tokens.next.id==="var"?(V("var"),f.tokens.curr.fud({prefix:!0})):f.tokens.next.id==="let"||f.tokens.next.id==="const"?(V(f.tokens.next.id),n=!0,f.funct["(scope)"].stack(),f.tokens.curr.fud({prefix:!0})):Object.create(rn).fud({prefix:!0,implied:"for",ignore:!h}),V(s.value),Q(20),V(")",t),s.value==="in"&&f.option.forin&&(f.forinifcheckneeded=!0,f.forinifchecks===undefined&&(f.forinifchecks=[]),f.forinifchecks.push({type:"(none)"})),f.funct["(breakage)"]+=1,f.funct["(loopage)"]+=1,e=_t(!0,!0);if(s.value==="in"&&f.option.forin){if(f.forinifchecks&&f.forinifchecks.length>0){var p=f.forinifchecks.pop();(e&&e.length>0&&(typeof e[0]!="object"||e[0].value!=="if")||p.type==="(positive)"&&e.length>1||p.type==="(negative)")&&F("W089",this)}f.forinifcheckneeded=!1}f.funct["(breakage)"]-=1,f.funct["(loopage)"]-=1}else{i&&q("E045",i);if(f.tokens.next.id!==";")if(f.tokens.next.id==="var")V("var"),f.tokens.curr.fud();else if(f.tokens.next.id==="let")V("let"),n=!0,f.funct["(scope)"].stack(),f.tokens.curr.fud();else for(;;){Q(0,"for");if(f.tokens.next.id!==",")break;l()}Z(f.tokens.curr),V(";"),f.funct["(loopage)"]+=1,f.tokens.next.id!==";"&&Jt(Q(0)),Z(f.tokens.curr),V(";"),f.tokens.next.id===";"&&q("E021",f.tokens.next,")",";");if(f.tokens.next.id!==")")for(;;){Q(0,"for");if(f.tokens.next.id!==",")break;l()}V(")",t),f.funct["(breakage)"]+=1,_t(!0,!0),f.funct["(breakage)"]-=1,f.funct["(loopage)"]-=1}return n&&f.funct["(scope)"].unstack(),this}).labelled=!0,it("break",function(){var e=f.tokens.next.value;return f.option.asi||Z(this),f.tokens.next.id!==";"&&!f.tokens.next.reach&&f.tokens.curr.line===G(f.tokens.next)?(f.funct["(scope)"].funct.hasBreakLabel(e)||F("W090",f.tokens.next,e),this.first=f.tokens.next,V()):f.funct["(breakage)"]===0&&F("W052",f.tokens.next,this.value),kt(this),this}).exps=!0,it("continue",function(){var e=f.tokens.next.value;return f.funct["(breakage)"]===0&&F("W052",f.tokens.next,this.value),f.funct["(loopage)"]||F("W052",f.tokens.next,this.value),f.option.asi||Z(this),f.tokens.next.id!==";"&&!f.tokens.next.reach&&f.tokens.curr.line===G(f.tokens.next)&&(f.funct["(scope)"].funct.hasBreakLabel(e)||F("W090",f.tokens.next,e),this.first=f.tokens.next,V()),kt(this),this}).exps=!0,it("return",function(){return this.line===G(f.tokens.next)?f.tokens.next.id!==";"&&!f.tokens.next.reach&&(this.first=Q(0),this.first&&this.first.type==="(punctuator)"&&this.first.value==="="&&!this.first.paren&&!f.option.boss&&I("W093",this.first.line,this.first.character)):f.tokens.next.type==="(punctuator)"&&["[","{","+","-"].indexOf(f.tokens.next.value)>-1&&Z(this),kt(this),this}).exps=!0,function(e){e.exps=!0,e.lbp=25}(ut("yield",function(){var e=f.tokens.prev;f.inES6(!0)&&!f.funct["(generator)"]?("(catch)"!==f.funct["(name)"]||!f.funct["(context)"]["(generator)"])&&q("E046",f.tokens.curr,"yield"):f.inES6()||F("W104",f.tokens.curr,"yield","6"),f.funct["(generator)"]="yielded";var t=!1;f.tokens.next.value==="*"&&(t=!0,V("*"));if(this.line===G(f.tokens.next)||!f.inMoz()){if(t||f.tokens.next.id!==";"&&!f.option.asi&&!f.tokens.next.reach&&f.tokens.next.nud)Y(f.tokens.curr,f.tokens.next),this.first=Q(10),this.first.type==="(punctuator)"&&this.first.value==="="&&!this.first.paren&&!f.option.boss&&I("W093",this.first.line,this.first.character);f.inMoz()&&f.tokens.next.id!==")"&&(e.lbp>30||!e.assign&&!J()||e.id==="yield")&&q("E050",this)}else f.option.asi||Z(this);return this})),it("throw",function(){return Z(this),this.first=Q(20),kt(this),this}).exps=!0,it("import",function(){f.inES6()||F("W119",f.tokens.curr,"import","6");if(f.tokens.next.type==="(string)")return V("(string)"),this;if(f.tokens.next.identifier){this.name=Ct(),f.funct["(scope)"].addlabel(this.name,{type:"const",token:f.tokens.curr});if(f.tokens.next.value!==",")return V("from"),V("(string)"),this;V(",")}if(f.tokens.next.id==="*")V("*"),V("as"),f.tokens.next.identifier&&(this.name=Ct(),f.funct["(scope)"].addlabel(this.name,{type:"const",token:f.tokens.curr}));else{V("{");for(;;){if(f.tokens.next.value==="}"){V("}");break}var e;f.tokens.next.type==="default"?(e="default",V("default")):e=Ct(),f.tokens.next.value==="as"&&(V("as"),e=Ct()),f.funct["(scope)"].addlabel(e,{type:"const",token:f.tokens.curr});if(f.tokens.next.value!==","){if(f.tokens.next.value==="}"){V("}");break}q("E024",f.tokens.next,f.tokens.next.value);break}V(",")}}return V("from"),V("(string)"),this}).exps=!0,it("export",function(){var e=!0,t,n;f.inES6()||(F("W119",f.tokens.curr,"export","6"),e=!1),f.funct["(scope)"].block.isGlobal()||(q("E053",f.tokens.curr),e=!1);if(f.tokens.next.value==="*")return V("*"),V("from"),V("(string)"),this;if(f.tokens.next.type==="default"){f.nameStack.set(f.tokens.next),V("default");var r=f.tokens.next.id;if(r==="function"||r==="class")this.block=!0;return t=W(),Q(10),n=t.value,this.block&&(f.funct["(scope)"].addlabel(n,{type:r,token:t}),f.funct["(scope)"].setExported(n,t)),this}if(f.tokens.next.value==="{"){V("{");var i=[];for(;;){f.tokens.next.identifier||q("E030",f.tokens.next,f.tokens.next.value),V(),i.push(f.tokens.curr),f.tokens.next.value==="as"&&(V("as"),f.tokens.next.identifier||q("E030",f.tokens.next,f.tokens.next.value),V());if(f.tokens.next.value!==","){if(f.tokens.next.value==="}"){V("}");break}q("E024",f.tokens.next,f.tokens.next.value);break}V(",")}return f.tokens.next.value==="from"?(V("from"),V("(string)")):e&&i.forEach(function(e){f.funct["(scope)"].setExported(e.value,e)}),this}if(f.tokens.next.id==="var")V("var"),f.tokens.curr.fud({inexport:!0});else if(f.tokens.next.id==="let")V("let"),f.tokens.curr.fud({inexport:!0});else if(f.tokens.next.id==="const")V("const"),f.tokens.curr.fud({inexport:!0});else if(f.tokens.next.id==="function")this.block=!0,V("function"),f.syntax["function"].fud({inexport:!0});else if(f.tokens.next.id==="class"){this.block=!0,V("class");var s=f.tokens.next;f.syntax["class"].fud(),f.funct["(scope)"].setExported(s.value,s)}else q("E024",f.tokens.next,f.tokens.next.value);return this}).exps=!0,lt("abstract"),lt("boolean"),lt("byte"),lt("char"),lt("class",{es5:!0,nud:sn}),lt("double"),lt("enum",{es5:!0}),lt("export",{es5:!0}),lt("extends",{es5:!0}),lt("final"),lt("float"),lt("goto"),lt("implements",{es5:!0,strictOnly:!0}),lt("import",{es5:!0}),lt("int"),lt("interface",{es5:!0,strictOnly:!0}),lt("long"),lt("native"),lt("package",{es5:!0,strictOnly:!0}),lt("private",{es5:!0,strictOnly:!0}),lt("protected",{es5:!0,strictOnly:!0}),lt("public",{es5:!0,strictOnly:!0}),lt("short"),lt("static",{es5:!0,strictOnly:!0}),lt("super",{es5:!0}),lt("synchronized"),lt("transient"),lt("volatile");var an=function(){var e,t,n,r=-1,i=0,s={};hn(f.tokens.curr,["[","{"])&&(i+=1);do{n=r===-1?f.tokens.curr:e,e=r===-1?f.tokens.next:W(r),t=W(r+1),r+=1,hn(e,["[","{"])?i+=1:hn(e,["]","}"])&&(i-=1);if(i===1&&e.identifier&&e.value==="for"&&!pn(n,".")){s.isCompArray=!0,s.notJson=!0;break}if(i===0&&hn(e,["}","]"])){if(t.value==="="){s.isDestAssign=!0,s.notJson=!0;break}if(t.value==="."){s.notJson=!0;break}}pn(e,";")&&(s.isBlock=!0,s.notJson=!0)}while(i>0&&e.id!=="(end)");return s},vn=function(){function i(e){var t=n.variables.filter(function(t){if(t.value===e)return t.undef=!1,e}).length;return t!==0}function s(e){var t=n.variables.filter(function(t){if(t.value===e&&!t.undef)return t.unused===!0&&(t.unused=!1),e}).length;return t===0}var e=function(){this.mode="use",this.variables=[]},t=[],n;return{stack:function(){n=new e,t.push(n)},unstack:function(){n.variables.filter(function(e){e.unused&&F("W098",e.token,e.raw_text||e.value),e.undef&&f.funct["(scope)"].block.use(e.value,e.token)}),t.splice(-1,1),n=t[t.length-1]},setState:function(e){r.contains(["use","define","generate","filter"],e)&&(n.mode=e)},check:function(e){if(!n)return;return n&&n.mode==="use"?(s(e)&&n.variables.push({funct:f.funct,token:f.tokens.curr,value:e,undef:!0,unused:!1}),!0):n&&n.mode==="define"?(i(e)||n.variables.push({funct:f.funct,token:f.tokens.curr,value:e,undef:!1,unused:!0}),!0):n&&n.mode==="generate"?(f.funct["(scope)"].block.use(e,f.tokens.curr),!0):n&&n.mode==="filter"?(s(e)&&f.funct["(scope)"].block.use(e,f.tokens.curr),!0):!1}}},gn=function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},yn=function(t,i,o){function U(e,t){if(!e)return;!Array.isArray(e)&&typeof e=="object"&&(e=Object.keys(e)),e.forEach(t)}var a,l,c,d,A,O,M={},P={};i=r.clone(i),f.reset(),i&&i.scope?p.scope=i.scope:(p.errors=[],p.undefs=[],p.internals=[],p.blacklist={},p.scope="(main)"),S=Object.create(null),D(S,s.ecmaIdentifiers[3]),D(S,s.reservedVars),D(S,o||{}),n=Object.create(null);var j=Object.create(null);if(i){U(i.predef||null,function(e){var t,n;e[0]==="-"?(t=e.slice(1),p.blacklist[t]=t,delete S[t]):(n=Object.getOwnPropertyDescriptor(i.predef,e),S[e]=n?n.value:!1)}),U(i.exported||null,function(e){j[e]=!0}),delete i.predef,delete i.exported,O=Object.keys(i);for(c=0;c0&&(e.implieds=u),T.length>0&&(e.urls=T),o=f.funct["(scope)"].getUsedOrDefinedGlobals(),o.length>0&&(e.globals=o);for(r=1;r0&&(e.unused=a);for(s in w)if(typeof w[s]=="number"){e.member=w;break}return e},yn.jshint=yn,yn}();typeof n=="object"&&n&&(n.JSHINT=p)},{"../lodash":"/node_modules/jshint/lodash.js","./lex.js":"/node_modules/jshint/src/lex.js","./messages.js":"/node_modules/jshint/src/messages.js","./options.js":"/node_modules/jshint/src/options.js","./reg.js":"/node_modules/jshint/src/reg.js","./scope-manager.js":"/node_modules/jshint/src/scope-manager.js","./state.js":"/node_modules/jshint/src/state.js","./style.js":"/node_modules/jshint/src/style.js","./vars.js":"/node_modules/jshint/src/vars.js",events:"/node_modules/browserify/node_modules/events/events.js"}],"/node_modules/jshint/src/lex.js":[function(e,t,n){"use strict";function h(){var e=[];return{push:function(t){e.push(t)},check:function(){for(var t=0;t0&&this.context[this.context.length-1].type===e},pushContext:function(e){this.context.push({type:e})},popContext:function(){return this.context.pop()},isContext:function(e){return this.context.length>0&&this.context[this.context.length-1]===e},currentContext:function(){return this.context.length>0&&this.context[this.context.length-1]},getLines:function(){return this._lines=o.lines,this._lines},setLines:function(e){this._lines=e,o.lines=this._lines},peek:function(e){return this.input.charAt(e||0)},skip:function(e){e=e||1,this.char+=e,this.input=this.input.slice(e)},on:function(e,t){e.split(" ").forEach(function(e){this.emitter.on(e,t)}.bind(this))},trigger:function(){this.emitter.emit.apply(this.emitter,Array.prototype.slice.call(arguments))},triggerAsync:function(e,t,n,r){n.push(function(){r()&&this.trigger(e,t)}.bind(this))},scanPunctuator:function(){var e=this.peek(),t,n,r;switch(e){case".":if(/^[0-9]$/.test(this.peek(1)))return null;if(this.peek(1)==="."&&this.peek(2)===".")return{type:l.Punctuator,value:"..."};case"(":case")":case";":case",":case"[":case"]":case":":case"~":case"?":return{type:l.Punctuator,value:e};case"{":return this.pushContext(c.Block),{type:l.Punctuator,value:e};case"}":return this.inContext(c.Block)&&this.popContext(),{type:l.Punctuator,value:e};case"#":return{type:l.Punctuator,value:e};case"":return null}return t=this.peek(1),n=this.peek(2),r=this.peek(3),e===">"&&t===">"&&n===">"&&r==="="?{type:l.Punctuator,value:">>>="}:e==="="&&t==="="&&n==="="?{type:l.Punctuator,value:"==="}:e==="!"&&t==="="&&n==="="?{type:l.Punctuator,value:"!=="}:e===">"&&t===">"&&n===">"?{type:l.Punctuator,value:">>>"}:e==="<"&&t==="<"&&n==="="?{type:l.Punctuator,value:"<<="}:e===">"&&t===">"&&n==="="?{type:l.Punctuator,value:">>="}:e==="="&&t===">"?{type:l.Punctuator,value:e+t}:e===t&&"+-<>&|".indexOf(e)>=0?{type:l.Punctuator,value:e+t}:"<>=!+-*%&|^".indexOf(e)>=0?t==="="?{type:l.Punctuator,value:e+t}:{type:l.Punctuator,value:e}:e==="/"?t==="="?{type:l.Punctuator,value:"/="}:{type:l.Punctuator,value:"/"}:null},scanComments:function(){function u(e,t,n){var r=["jshint","jslint","members","member","globals","global","exported"],i=!1,u=e+t,a="plain";return n=n||{},n.isMultiline&&(u+="*/"),t=t.replace(/\n/g," "),e==="/*"&&s.fallsThrough.test(t)&&(i=!0,a="falls through"),r.forEach(function(n){if(i)return;if(e==="//"&&n!=="jshint")return;t.charAt(n.length)===" "&&t.substr(0,n.length)===n&&(i=!0,e+=n,t=t.substr(n.length)),!i&&t.charAt(0)===" "&&t.charAt(n.length+1)===" "&&t.substr(1,n.length)===n&&(i=!0,e=e+" "+n,t=t.substr(n.length+1));if(!i)return;switch(n){case"member":a="members";break;case"global":a="globals";break;default:var r=t.split(":").map(function(e){return e.replace(/^\s+/,"").replace(/\s+$/,"")});if(r.length===2)switch(r[0]){case"ignore":switch(r[1]){case"start":o.ignoringLinterErrors=!0,i=!1;break;case"end":o.ignoringLinterErrors=!1,i=!1}}a=n}}),{type:l.Comment,commentType:a,value:u,body:t,isSpecial:i,isMultiline:n.isMultiline||!1,isMalformed:n.isMalformed||!1}}var e=this.peek(),t=this.peek(1),n=this.input.substr(2),r=this.line,i=this.char,o=this;if(e==="*"&&t==="/")return this.trigger("error",{code:"E018",line:r,character:i}),this.skip(2),null;if(e!=="/"||t!=="*"&&t!=="/")return null;if(t==="/")return this.skip(this.input.length),u("//",n);var a="";if(t==="*"){this.inComment=!0,this.skip(2);while(this.peek()!=="*"||this.peek(1)!=="/")if(this.peek()===""){a+="\n";if(!this.nextLine())return this.trigger("error",{code:"E017",line:r,character:i}),this.inComment=!1,u("/*",a,{isMultiline:!0,isMalformed:!0})}else a+=this.peek(),this.skip();return this.skip(2),this.inComment=!1,u("/*",a,{isMultiline:!0})}},scanKeyword:function(){var e=/^[a-zA-Z_$][a-zA-Z0-9_$]*/.exec(this.input),t=["if","in","do","var","for","new","try","let","this","else","case","void","with","enum","while","break","catch","throw","const","yield","class","super","return","typeof","delete","switch","export","import","default","finally","extends","function","continue","debugger","instanceof"];return e&&t.indexOf(e[0])>=0?{type:l.Keyword,value:e[0]}:null},scanIdentifier:function(){function i(e){return e>256}function s(e){return e>256}function o(e){return/^[0-9a-fA-F]$/.test(e)}function p(e){return e.replace(/\\u([0-9a-fA-F]{4})/g,function(e,t){return String.fromCharCode(parseInt(t,16))})}var e="",t=0,n,r,u=function(){t+=1;if(this.peek(t)!=="u")return null;var e=this.peek(t+1),n=this.peek(t+2),r=this.peek(t+3),i=this.peek(t+4),u;return o(e)&&o(n)&&o(r)&&o(i)?(u=parseInt(e+n+r+i,16),f[u]||s(u)?(t+=5,"\\u"+e+n+r+i):null):null}.bind(this),c=function(){var e=this.peek(t),n=e.charCodeAt(0);return n===92?u():n<128?a[n]?(t+=1,e):null:i(n)?(t+=1,e):null}.bind(this),h=function(){var e=this.peek(t),n=e.charCodeAt(0);return n===92?u():n<128?f[n]?(t+=1,e):null:s(n)?(t+=1,e):null}.bind(this);r=c();if(r===null)return null;e=r;for(;;){r=h();if(r===null)break;e+=r}switch(e){case"true":case"false":n=l.BooleanLiteral;break;case"null":n=l.NullLiteral;break;default:n=l.Identifier}return{type:n,value:p(e),text:e,tokenLength:e.length}},scanNumericLiteral:function(){function f(e){return/^[0-9]$/.test(e)}function c(e){return/^[0-7]$/.test(e)}function h(e){return/^[01]$/.test(e)}function p(e){return/^[0-9a-fA-F]$/.test(e)}function d(e){return e==="$"||e==="_"||e==="\\"||e>="a"&&e<="z"||e>="A"&&e<="Z"}var e=0,t="",n=this.input.length,r=this.peek(e),i,s=f,u=10,a=!1;if(r!=="."&&!f(r))return null;if(r!=="."){t=this.peek(e),e+=1,r=this.peek(e);if(t==="0"){if(r==="x"||r==="X")s=p,u=16,e+=1,t+=r;if(r==="o"||r==="O")s=c,u=8,o.inES6(!0)||this.trigger("warning",{code:"W119",line:this.line,character:this.char,data:["Octal integer literal","6"]}),e+=1,t+=r;if(r==="b"||r==="B")s=h,u=2,o.inES6(!0)||this.trigger("warning",{code:"W119",line:this.line,character:this.char,data:["Binary integer literal","6"]}),e+=1,t+=r;c(r)&&(s=c,u=8,a=!0,i=!1,e+=1,t+=r),!c(r)&&f(r)&&(e+=1,t+=r)}while(e=0&&i<=7&&o.isStrict()});break;case"u":var s=this.input.substr(1,4),u=parseInt(s,16);isNaN(u)&&this.trigger("warning",{code:"W052",line:this.line,character:this.char,data:["u"+s]}),r=String.fromCharCode(u),n=5;break;case"v":this.triggerAsync("warning",{code:"W114",line:this.line,character:this.char,data:["\\v"]},e,function(){return o.jsonMode}),r="\x0b";break;case"x":var a=parseInt(this.input.substr(1,2),16);this.triggerAsync("warning",{code:"W114",line:this.line,character:this.char,data:["\\x-"]},e,function(){return o.jsonMode}),r=String.fromCharCode(a),n=3;break;case"\\":r="\\\\";break;case'"':r='\\"';break;case"/":break;case"":t=!0,r=""}return{"char":r,jump:n,allowNewLine:t}},scanTemplateLiteral:function(e){var t,n="",r,i=this.line,s=this.char,u=this.templateStarts.length;if(!o.inES6(!0))return null;if(this.peek()==="`")t=l.TemplateHead,this.templateStarts.push({line:this.line,"char":this.char}),u=this.templateStarts.length,this.skip(1),this.pushContext(c.Template);else{if(!this.inContext(c.Template)||this.peek()!=="}")return null;t=l.TemplateMiddle}while(this.peek()!=="`"){while((r=this.peek())===""){n+="\n";if(!this.nextLine()){var a=this.templateStarts.pop();return this.trigger("error",{code:"E052",line:a.line,character:a.char}),{type:t,value:n,startLine:i,startChar:s,isUnclosed:!0,depth:u,context:this.popContext()}}}if(r==="$"&&this.peek(1)==="{")return n+="${",this.skip(2),{type:t,value:n,startLine:i,startChar:s,isUnclosed:!1,depth:u,context:this.currentContext()};if(r==="\\"){var f=this.scanEscapeSequence(e);n+=f.char,this.skip(f.jump)}else r!=="`"&&(n+=r,this.skip(1))}return t=t===l.TemplateHead?l.NoSubstTemplate:l.TemplateTail,this.skip(1),this.templateStarts.pop(),{type:t,value:n,startLine:i,startChar:s,isUnclosed:!1,depth:u,context:this.popContext()}},scanStringLiteral:function(e){var t=this.peek();if(t!=='"'&&t!=="'")return null;this.triggerAsync("warning",{code:"W108",line:this.line,character:this.char},e,function(){return o.jsonMode&&t!=='"'});var n="",r=this.line,i=this.char,s=!1;this.skip();while(this.peek()!==t)if(this.peek()===""){s?(s=!1,this.triggerAsync("warning",{code:"W043",line:this.line,character:this.char},e,function(){return!o.option.multistr}),this.triggerAsync("warning",{code:"W042",line:this.line,character:this.char},e,function(){return o.jsonMode&&o.option.multistr})):this.trigger("warning",{code:"W112",line:this.line,character:this.char});if(!this.nextLine())return this.trigger("error",{code:"E029",line:r,character:i}),{type:l.StringLiteral,value:n,startLine:r,startChar:i,isUnclosed:!0,quote:t}}else{s=!1;var u=this.peek(),a=1;u<" "&&this.trigger("warning",{code:"W113",line:this.line,character:this.char,data:[""]});if(u==="\\"){var f=this.scanEscapeSequence(e);u=f.char,a=f.jump,s=f.allowNewLine}n+=u,this.skip(a)}return this.skip(),{type:l.StringLiteral,value:n,startLine:r,startChar:i,isUnclosed:!1,quote:t}},scanRegExp:function(){var e=0,t=this.input.length,n=this.peek(),r=n,i="",s=[],o=!1,u=!1,a,f=function(){n<" "&&(o=!0,this.trigger("warning",{code:"W048",line:this.line,character:this.char})),n==="<"&&(o=!0,this.trigger("warning",{code:"W049",line:this.line,character:this.char,data:[n]}))}.bind(this);if(!this.prereg||n!=="/")return null;e+=1,a=!1;while(e=this.getLines().length)return!1;this.input=this.getLines()[this.line],this.line+=1,this.char=1,this.from=1;var t=this.input.trim(),n=function(){return r.some(arguments,function(e){return t.indexOf(e)===0})},i=function(){return r.some(arguments,function(e){return t.indexOf(e,t.length-e.length)!==-1})};this.ignoringLinterErrors===!0&&!n("/*","//")&&(!this.inComment||!i("*/"))&&(this.input=""),e=this.scanNonBreakingSpaces(),e>=0&&this.trigger("warning",{code:"W125",line:this.line,character:e+1}),this.input=this.input.replace(/\t/g,o.tab),e=this.scanUnsafeChars(),e>=0&&this.trigger("warning",{code:"W100",line:this.line,character:e});if(!this.ignoringLinterErrors&&o.option.maxlen&&o.option.maxlen=0;--t){var n=a[t]["(labels)"];if(n[e])return n}}function x(e){for(var t=a.length-1;t>=0;t--){var n=a[t];if(n["(usages)"][e])return n["(usages)"][e];if(n===l)break}return!1}function T(t,n){if(e.option.shadow!=="outer")return;var r=l["(type)"]==="global",i=u["(type)"]==="functionparams",s=!r;for(var o=0;o1?a[a.length-2]:null,n=u===l,i=u["(type)"]==="functionparams",f=u["(type)"]==="functionouter",p,d,g=u["(usages)"],y=u["(labels)"],E=Object.keys(g);g.__proto__&&E.indexOf("__proto__")===-1&&E.push("__proto__");for(p=0;p=0;s--){var o=a[s];if(o["(labels)"][e]&&(!n||o["(labels)"][e]["(blockscoped)"]))return o["(labels)"][e]["(type)"];var u=r?a[s-1]:o;if(u&&u["(type)"]==="functionparams")return null}return null},hasBreakLabel:function(e){for(var t=a.length-1;t>=0;t--){var n=a[t];if(n["(breakLabels)"][e])return!0;if(n["(type)"]==="functionparams")return!1}return!1},has:function(e,t){return Boolean(this.labeltype(e,t))},add:function(e,t,n,r){u["(labels)"][e]={"(type)":t,"(token)":n,"(blockscoped)":!1,"(function)":l,"(unused)":r}}},block:{isGlobal:function(){return u["(type)"]==="global"},use:function(t,n){var r=l["(parent)"];r&&r["(labels)"][t]&&r["(labels)"][t]["(type)"]==="param"&&(C.funct.has(t,{excludeParams:!0,onlyBlockscoped:!0})||(r["(labels)"][t]["(unused)"]=!1)),n&&(e.ignored.W117||e.option.undef===!1)&&(n.ignoreUndef=!0),g(t),n&&(n["(function)"]=l,u["(usages)"][t]["(tokens)"].push(n))},reassign:function(e,t){this.modify(e,t),u["(usages)"][e]["(reassigned)"].push(t)},modify:function(e,t){g(e),u["(usages)"][e]["(modified)"].push(t)},add:function(e,t,n,r){u["(labels)"][e]={"(type)":t,"(token)":n,"(blockscoped)":!0,"(unused)":r}},addBreakLabel:function(t,n){var r=n.token;C.funct.hasBreakLabel(t)?v("E011",r,t):e.option.shadow==="outer"&&(C.funct.has(t)?v("W004",r,t):T(t,r)),u["(breakLabels)"][t]=r}}};return C};t.exports=o},{"../lodash":"/node_modules/jshint/lodash.js",events:"/node_modules/browserify/node_modules/events/events.js"}],"/node_modules/jshint/src/state.js":[function(e,t,n){"use strict";var r=e("./name-stack.js"),i={syntax:{},isStrict:function(){return this.directive["use strict"]||this.inClassBody||this.option.module||this.option.strict==="implied"},inMoz:function(){return this.option.moz},inES6:function(){return this.option.moz||this.option.esversion>=6},inES5:function(e){return e?(!this.option.esversion||this.option.esversion===5)&&!this.option.moz:!this.option.esversion||this.option.esversion>=5||this.option.moz},reset:function(){this.tokens={prev:null,next:null,curr:null},this.option={},this.funct=null,this.ignored={},this.directive={},this.jsonMode=!1,this.jsonWarnings=[],this.lines=[],this.tab="",this.cache={},this.ignoredLines={},this.forinifcheckneeded=!1,this.nameStack=new r,this.inClassBody=!1}};n.state=i},{"./name-stack.js":"/node_modules/jshint/src/name-stack.js"}],"/node_modules/jshint/src/style.js":[function(e,t,n){"use strict";n.register=function(e){e.on("Identifier",function(n){if(e.getOption("proto"))return;n.name==="__proto__"&&e.warn("W103",{line:n.line,"char":n.char,data:[n.name,"6"]})}),e.on("Identifier",function(n){if(e.getOption("iterator"))return;n.name==="__iterator__"&&e.warn("W103",{line:n.line,"char":n.char,data:[n.name]})}),e.on("Identifier",function(n){if(!e.getOption("camelcase"))return;n.name.replace(/^_+|_+$/g,"").indexOf("_")>-1&&!n.name.match(/^[A-Z0-9_]*$/)&&e.warn("W106",{line:n.line,"char":n.from,data:[n.name]})}),e.on("String",function(n){var r=e.getOption("quotmark"),i;if(!r)return;r==="single"&&n.quote!=="'"&&(i="W109"),r==="double"&&n.quote!=='"'&&(i="W108"),r===!0&&(e.getCache("quotmark")||e.setCache("quotmark",n.quote),e.getCache("quotmark")!==n.quote&&(i="W110")),i&&e.warn(i,{line:n.line,"char":n.char})}),e.on("Number",function(n){n.value.charAt(0)==="."&&e.warn("W008",{line:n.line,"char":n.char,data:[n.value]}),n.value.substr(n.value.length-1)==="."&&e.warn("W047",{line:n.line,"char":n.char,data:[n.value]}),/^00+/.test(n.value)&&e.warn("W046",{line:n.line,"char":n.char,data:[n.value]})}),e.on("String",function(n){var r=/^(?:javascript|jscript|ecmascript|vbscript|livescript)\s*:/i;if(e.getOption("scripturl"))return;r.test(n.value)&&e.warn("W107",{line:n.line,"char":n.char})})}},{}],"/node_modules/jshint/src/vars.js":[function(e,t,n){"use strict";n.reservedVars={arguments:!1,NaN:!1},n.ecmaIdentifiers={3:{Array:!1,Boolean:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,isFinite:!1,isNaN:!1,Math:!1,Number:!1,Object:!1,parseInt:!1,parseFloat:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,String:!1,SyntaxError:!1,TypeError:!1,URIError:!1},5:{JSON:!1},6:{Map:!1,Promise:!1,Proxy:!1,Reflect:!1,Set:!1,Symbol:!1,WeakMap:!1,WeakSet:!1}},n.browser={Audio:!1,Blob:!1,addEventListener:!1,applicationCache:!1,atob:!1,blur:!1,btoa:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,CSS:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,Comment:!1,CustomEvent:!1,DOMParser:!1,defaultStatus:!1,Document:!1,document:!1,DocumentFragment:!1,Element:!1,ElementTimeControl:!1,Event:!1,event:!1,fetch:!1,FileReader:!1,FormData:!1,focus:!1,frames:!1,getComputedStyle:!1,HTMLElement:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLCollection:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTemplateElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,history:!1,Image:!1,Intl:!1,length:!1,localStorage:!1,location:!1,matchMedia:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,Node:!1,NodeFilter:!1,NodeList:!1,Notification:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,Option:!1,parent:!1,performance:!1,print:!1,Range:!1,requestAnimationFrame:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,status:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimationElement:!1,SVGCSSRule:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLineElement:!1,SVGLinearGradientElement:!1,SVGLocatable:!1,SVGMPathElement:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGSVGElement:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformList:!1,SVGTransformable:!1,SVGURIReference:!1,SVGUnitTypes:!1,SVGUseElement:!1,SVGVKernElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGZoomAndPan:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TimeEvent:!1,top:!1,URL:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},n.devel={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},n.worker={importScripts:!0,postMessage:!0,self:!0,FileReaderSync:!0},n.nonstandard={escape:!1,unescape:!1},n.couch={require:!1,respond:!1,getRow:!1,emit:!1,send:!1,start:!1,sum:!1,log:!1,exports:!1,module:!1,provides:!1},n.node={__filename:!1,__dirname:!1,GLOBAL:!1,global:!1,module:!1,require:!1,Buffer:!0,console:!0,exports:!0,process:!0,setTimeout:!0,clearTimeout:!0,setInterval:!0,clearInterval:!0,setImmediate:!0,clearImmediate:!0},n.browserify={__filename:!1,__dirname:!1,global:!1,module:!1,require:!1,Buffer:!0,exports:!0,process:!0},n.phantom={phantom:!0,require:!0,WebPage:!0,console:!0,exports:!0},n.qunit={asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,"throws":!1},n.rhino={defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},n.shelljs={target:!1,echo:!1,exit:!1,cd:!1,pwd:!1,ls:!1,find:!1,cp:!1,rm:!1,mv:!1,mkdir:!1,test:!1,cat:!1,sed:!1,grep:!1,which:!1,dirs:!1,pushd:!1,popd:!1,env:!1,exec:!1,chmod:!1,config:!1,error:!1,tempdir:!1},n.typed={ArrayBuffer:!1,ArrayBufferView:!1,DataView:!1,Float32Array:!1,Float64Array:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1},n.wsh={ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WSH:!0,WScript:!0,XDomainRequest:!0},n.dojo={dojo:!1,dijit:!1,dojox:!1,define:!1,require:!1},n.jquery={$:!1,jQuery:!1},n.mootools={$:!1,$$:!1,Asset:!1,Browser:!1,Chain:!1,Class:!1,Color:!1,Cookie:!1,Core:!1,Document:!1,DomReady:!1,DOMEvent:!1,DOMReady:!1,Drag:!1,Element:!1,Elements:!1,Event:!1,Events:!1,Fx:!1,Group:!1,Hash:!1,HtmlTable:!1,IFrame:!1,IframeShim:!1,InputValidator:!1,instanceOf:!1,Keyboard:!1,Locale:!1,Mask:!1,MooTools:!1,Native:!1,Options:!1,OverText:!1,Request:!1,Scroller:!1,Slick:!1,Slider:!1,Sortables:!1,Spinner:!1,Swiff:!1,Tips:!1,Type:!1,typeOf:!1,URI:!1,Window:!1},n.prototypejs={$:!1,$$:!1,$A:!1,$F:!1,$H:!1,$R:!1,$break:!1,$continue:!1,$w:!1,Abstract:!1,Ajax:!1,Class:!1,Enumerable:!1,Element:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Selector:!1,Template:!1,Toggle:!1,Try:!1,Autocompleter:!1,Builder:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Scriptaculous:!1},n.yui={YUI:!1,Y:!1,YUI_config:!1},n.mocha={mocha:!1,describe:!1,xdescribe:!1,it:!1,xit:!1,context:!1,xcontext:!1,before:!1,after:!1,beforeEach:!1,afterEach:!1,suite:!1,test:!1,setup:!1,teardown:!1,suiteSetup:!1,suiteTeardown:!1},n.jasmine={jasmine:!1,describe:!1,xdescribe:!1,it:!1,xit:!1,beforeEach:!1,afterEach:!1,setFixtures:!1,loadFixtures:!1,spyOn:!1,expect:!1,runs:!1,waitsFor:!1,waits:!1,beforeAll:!1,afterAll:!1,fail:!1,fdescribe:!1,fit:!1,pending:!1}},{}]},{},["/node_modules/jshint/src/jshint.js"])}),ace.define("ace/mode/javascript_worker",[],function(require,exports,module){"use strict";function startRegex(e){return RegExp("^("+e.join("|")+")")}var oop=require("../lib/oop"),Mirror=require("../worker/mirror").Mirror,lint=require("./javascript/jshint").JSHINT,disabledWarningsRe=startRegex(["Bad for in variable '(.+)'.",'Missing "use strict"']),errorsRe=startRegex(["Unexpected","Expected ","Confusing (plus|minus)","\\{a\\} unterminated regular expression","Unclosed ","Unmatched ","Unbegun comment","Bad invocation","Missing space after","Missing operator at"]),infoRe=startRegex(["Expected an assignment","Bad escapement of EOL","Unexpected comma","Unexpected space","Missing radix parameter.","A leading decimal point can","\\['{a}'\\] is better written in dot notation.","'{a}' used out of scope"]),JavaScriptWorker=exports.JavaScriptWorker=function(e){Mirror.call(this,e),this.setTimeout(500),this.setOptions()};oop.inherits(JavaScriptWorker,Mirror),function(){this.setOptions=function(e){this.options=e||{esnext:!0,moz:!0,devel:!0,browser:!0,node:!0,laxcomma:!0,laxbreak:!0,lastsemic:!0,onevar:!1,passfail:!1,maxerr:100,expr:!0,multistr:!0,globalstrict:!0},this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.changeOptions=function(e){oop.mixin(this.options,e),this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.isValidJS=function(str){try{eval("throw 0;"+str)}catch(e){if(e===0)return!0}return!1},this.onUpdate=function(){var e=this.doc.getValue();e=e.replace(/^#!.*\n/,"\n");if(!e)return this.sender.emit("annotate",[]);var t=[],n=this.isValidJS(e)?"warning":"error";lint(e,this.options,this.options.globals);var r=lint.errors,i=!1;for(var s=0;s0||-1)*Math.floor(Math.abs(e))),e}function B(e){var t=typeof e;return e===null||t==="undefined"||t==="boolean"||t==="number"||t==="string"}function j(e){var t,n,r;if(B(e))return e;n=e.valueOf;if(typeof n=="function"){t=n.call(e);if(B(t))return t}r=e.toString;if(typeof r=="function"){t=r.call(e);if(B(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!="function")throw new TypeError("Function.prototype.bind called on incompatible "+n);var i=u.call(arguments,1),s=function(){if(this instanceof s){var e=n.apply(this,i.concat(u.call(arguments)));return Object(e)===e?e:this}return n.apply(t,i.concat(u.call(arguments)))};return n.prototype&&(r.prototype=n.prototype,s.prototype=new r,r.prototype=null),s});var i=Function.prototype.call,s=Array.prototype,o=Object.prototype,u=s.slice,a=i.bind(o.toString),f=i.bind(o.hasOwnProperty),l,c,h,p,d;if(d=f(o,"__defineGetter__"))l=i.bind(o.__defineGetter__),c=i.bind(o.__defineSetter__),h=i.bind(o.__lookupGetter__),p=i.bind(o.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,"XXX"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+ta)for(h=l;h--;)this[f+h]=this[a+h];if(s&&e===c)this.length=c,this.push.apply(this,i);else{this.length=c+s;for(h=0;h>>0;if(a(t)!="[object Function]")throw new TypeError;while(++s>>0,s=Array(i),o=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var u=0;u>>0,s=[],o,u=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var f=0;f>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o>>0,s=arguments[1];if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");for(var o=0;o>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduce of empty array with no initial value");var s=0,o;if(arguments.length>=2)o=arguments[1];else do{if(s in r){o=r[s++];break}if(++s>=i)throw new TypeError("reduce of empty array with no initial value")}while(!0);for(;s>>0;if(a(t)!="[object Function]")throw new TypeError(t+" is not a function");if(!i&&arguments.length==1)throw new TypeError("reduceRight of empty array with no initial value");var s,o=i-1;if(arguments.length>=2)s=arguments[1];else do{if(o in r){s=r[o--];break}if(--o<0)throw new TypeError("reduceRight of empty array with no initial value")}while(!0);do o in this&&(s=t.call(void 0,s,r[o],o,n));while(o--);return s});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(t){var n=g&&a(this)=="[object String]"?this.split(""):F(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=H(arguments[1])),i=i>=0?i:Math.max(0,r+i);for(;i>>0;if(!r)return-1;var i=r-1;arguments.length>1&&(i=Math.min(i,H(arguments[1]))),i=i>=0?i:r-Math.abs(i);for(;i>=0;i--)if(i in n&&t===n[i])return i;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(t){return t.__proto__||(t.constructor?t.constructor.prototype:o)});if(!Object.getOwnPropertyDescriptor){var y="Object.getOwnPropertyDescriptor called on a non-object: ";Object.getOwnPropertyDescriptor=function(t,n){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(y+t);if(!f(t,n))return;var r,i,s;r={enumerable:!0,configurable:!0};if(d){var u=t.__proto__;t.__proto__=o;var i=h(t,n),s=p(t,n);t.__proto__=u;if(i||s)return i&&(r.get=i),s&&(r.set=s),r}return r.value=t[n],r}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(t){return Object.keys(t)});if(!Object.create){var b;Object.prototype.__proto__===null?b=function(){return{__proto__:null}}:b=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(t,n){var r;if(t===null)r=b();else{if(typeof t!="object")throw new TypeError("typeof prototype["+typeof t+"] != 'object'");var i=function(){};i.prototype=t,r=new i,r.__proto__=t}return n!==void 0&&Object.defineProperties(r,n),r}}if(Object.defineProperty){var E=w({}),S=typeof document=="undefined"||w(document.createElement("div"));if(!E||!S)var x=Object.defineProperty}if(!Object.defineProperty||x){var T="Property description must be an object: ",N="Object.defineProperty called on non-object: ",C="getters & setters can not be defined on this javascript engine";Object.defineProperty=function(t,n,r){if(typeof t!="object"&&typeof t!="function"||t===null)throw new TypeError(N+t);if(typeof r!="object"&&typeof r!="function"||r===null)throw new TypeError(T+r);if(x)try{return x.call(Object,t,n,r)}catch(i){}if(f(r,"value"))if(d&&(h(t,n)||p(t,n))){var s=t.__proto__;t.__proto__=o,delete t[n],t[n]=r.value,t.__proto__=s}else t[n]=r.value;else{if(!d)throw new TypeError(C);f(r,"get")&&l(t,n,r.get),f(r,"set")&&c(t,n,r.set)}return t}}Object.defineProperties||(Object.defineProperties=function(t,n){for(var r in n)f(n,r)&&Object.defineProperty(t,r,n[r]);return t}),Object.seal||(Object.seal=function(t){return t}),Object.freeze||(Object.freeze=function(t){return t});try{Object.freeze(function(){})}catch(k){Object.freeze=function(t){return function(n){return typeof n=="function"?n:t(n)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(t){return t}),Object.isSealed||(Object.isSealed=function(t){return!1}),Object.isFrozen||(Object.isFrozen=function(t){return!1}),Object.isExtensible||(Object.isExtensible=function(t){if(Object(t)===t)throw new TypeError;var n="";while(f(t,n))n+="?";t[n]=!0;var r=f(t,n);return delete t[n],r});if(!Object.keys){var L=!0,A=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],O=A.length;for(var M in{toString:null})L=!1;Object.keys=function I(e){if(typeof e!="object"&&typeof e!="function"||e===null)throw new TypeError("Object.keys called on a non-object");var I=[];for(var t in e)f(e,t)&&I.push(t);if(L)for(var n=0,r=O;n - + @@ -32,8 +32,7 @@ Open Upload Clear GCode - View - Send + View/Edit
    - -