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

2128 lines
101 KiB

  1. /* This file is generated, do not edit directly */
  2. riot.tag2('code-editor', '<div id="vsplit" ref="vsplit"> <div id="split" ref="split"> <input ref="file_input" id="file-input" type="file" style="display: none;"> <div id="tabs"> <button onclick="{this.newtab}" id="newtab">&nbsp;</button><span class="{selected: name==parent.title}" each="{name in list(files)}"><button class="{selected: name==parent.title}" onclick="{parent.switchtab}">{str(name)}</button><button if="{name==parent.title && len(files)>1}" id="closetab" onclick="{parent.closetab}">&nbsp;</button></span><button class="pull-right" id="tray-button" ref="traybutton">&nbsp;</button> </div> <textarea id="code-container" ref="code"></textarea> </div> <iframe allowtransparency="false" ref="vmframe"></iframe> </div>', 'code-editor { display: flex; flex: 1 1; height: 100%; } code-editor .CodeMirror,[data-is="code-editor"] .CodeMirror{ height: 100%; width: 100%; font-size: 15pt; font-family: "Noto Mono", "DejaVu Sans Mono", monospace, "Noto Emoji"; flex: 1 1; } code-editor .CodeMirror-cursor,[data-is="code-editor"] .CodeMirror-cursor{ width: auto; border: 0; background: transparent; background: rgba(0, 200, 0, .4); } code-editor .CodeMirror-linenumber,[data-is="code-editor"] .CodeMirror-linenumber{ font-size: 14pt; } code-editor .cm-s-solarized .CodeMirror-cursor,[data-is="code-editor"] .cm-s-solarized .CodeMirror-cursor{ border: 0; } code-editor .error-marker,[data-is="code-editor"] .error-marker{ border: 1px solid red; background-color: rgba(255, 0, 0,0.2); border-radius: 3px; } code-editor iframe,[data-is="code-editor"] iframe{ border: 0px; display: none; flex: 1 1; } code-editor #split,[data-is="code-editor"] #split{ display: flex; width: 100%; flex-direction: column; flex: 1 1; height: 100%; float: left; } code-editor #vsplit,[data-is="code-editor"] #vsplit{ display: flex; flex-direction: row; flex: 1 1; height: 100%; } code-editor #tabs button,[data-is="code-editor"] #tabs button{ font-size: 13pt; border-radius: 0; padding: 10px 10px; border: 0px; margin: 0px; } code-editor #tabs button.selected,[data-is="code-editor"] #tabs button.selected{ background-color: #282828; } code-editor #tabs span.selected,[data-is="code-editor"] #tabs span.selected{ white-space: nowrap; } code-editor #closetab,[data-is="code-editor"] #closetab{ background-image: url(lib/sugar-web/graphics/icons/actions/entry-cancel-active.svg); background-repeat: no-repeat; background-color: #282828; width: 28px; background-position: center; background-size: 16px 16px; } code-editor #closetab:active,[data-is="code-editor"] #closetab:active{ background-image: url(lib/sugar-web/graphics/icons/actions/entry-cancel.svg); } code-editor #newtab,[data-is="code-editor"] #newtab{ background-image: url(icons/tab-add.svg); background-repeat: no-repeat; width: 28px; background-position: center; background-size: 20px 20px; } code-editor #tray-button,[data-is="code-editor"] #tray-button{ background-image: url(icons/tray-show.svg); background-repeat: no-repeat; width: 28px; background-position: center; background-size: 20px 20px; }', '', function(opts) {
  3. var ρσ_modules = {};
  4. ρσ_modules.re = {};
  5. (function(){
  6. var _ALIAS_MAP, _ASCII_CONTROL_CHARS, _HEX_PAT, _NUM_PAT, _GROUP_PAT, _NAME_PAT, I, IGNORECASE, L, LOCALE, M, MULTILINE, D, DOTALL, U, UNICODE, X, VERBOSE, DEBUG, A, ASCII, supports_unicode, _RE_ESCAPE, _re_cache_map, _re_cache_items, error, has_prop;
  7. _ALIAS_MAP = (function(){
  8. var ρσ_d = {};
  9. ρσ_d["null"] = 0;
  10. ρσ_d["nul"] = 0;
  11. ρσ_d["start of heading"] = 1;
  12. ρσ_d["soh"] = 1;
  13. ρσ_d["start of text"] = 2;
  14. ρσ_d["stx"] = 2;
  15. ρσ_d["end of text"] = 3;
  16. ρσ_d["etx"] = 3;
  17. ρσ_d["end of transmission"] = 4;
  18. ρσ_d["eot"] = 4;
  19. ρσ_d["enquiry"] = 5;
  20. ρσ_d["enq"] = 5;
  21. ρσ_d["acknowledge"] = 6;
  22. ρσ_d["ack"] = 6;
  23. ρσ_d["alert"] = 7;
  24. ρσ_d["bel"] = 7;
  25. ρσ_d["backspace"] = 8;
  26. ρσ_d["bs"] = 8;
  27. ρσ_d["character tabulation"] = 9;
  28. ρσ_d["horizontal tabulation"] = 9;
  29. ρσ_d["ht"] = 9;
  30. ρσ_d["tab"] = 9;
  31. ρσ_d["line feed"] = 10;
  32. ρσ_d["new line"] = 10;
  33. ρσ_d["end of line"] = 10;
  34. ρσ_d["lf"] = 10;
  35. ρσ_d["nl"] = 10;
  36. ρσ_d["eol"] = 10;
  37. ρσ_d["line tabulation"] = 11;
  38. ρσ_d["vertical tabulation"] = 11;
  39. ρσ_d["vt"] = 11;
  40. ρσ_d["form feed"] = 12;
  41. ρσ_d["ff"] = 12;
  42. ρσ_d["carriage return"] = 13;
  43. ρσ_d["cr"] = 13;
  44. ρσ_d["shift out"] = 14;
  45. ρσ_d["locking-shift one"] = 14;
  46. ρσ_d["so"] = 14;
  47. ρσ_d["shift in"] = 15;
  48. ρσ_d["locking-shift zero"] = 15;
  49. ρσ_d["si"] = 15;
  50. ρσ_d["data link escape"] = 16;
  51. ρσ_d["dle"] = 16;
  52. ρσ_d["device control one"] = 17;
  53. ρσ_d["dc1"] = 17;
  54. ρσ_d["device control two"] = 18;
  55. ρσ_d["dc2"] = 18;
  56. ρσ_d["device control three"] = 19;
  57. ρσ_d["dc3"] = 19;
  58. ρσ_d["device control four"] = 20;
  59. ρσ_d["dc4"] = 20;
  60. ρσ_d["negative acknowledge"] = 21;
  61. ρσ_d["nak"] = 21;
  62. ρσ_d["synchronous idle"] = 22;
  63. ρσ_d["syn"] = 22;
  64. ρσ_d["end of transmission block"] = 23;
  65. ρσ_d["etb"] = 23;
  66. ρσ_d["cancel"] = 24;
  67. ρσ_d["can"] = 24;
  68. ρσ_d["end of medium"] = 25;
  69. ρσ_d["eom"] = 25;
  70. ρσ_d["substitute"] = 26;
  71. ρσ_d["sub"] = 26;
  72. ρσ_d["escape"] = 27;
  73. ρσ_d["esc"] = 27;
  74. ρσ_d["information separator four"] = 28;
  75. ρσ_d["file separator"] = 28;
  76. ρσ_d["fs"] = 28;
  77. ρσ_d["information separator three"] = 29;
  78. ρσ_d["group separator"] = 29;
  79. ρσ_d["gs"] = 29;
  80. ρσ_d["information separator two"] = 30;
  81. ρσ_d["record separator"] = 30;
  82. ρσ_d["rs"] = 30;
  83. ρσ_d["information separator one"] = 31;
  84. ρσ_d["unit separator"] = 31;
  85. ρσ_d["us"] = 31;
  86. ρσ_d["sp"] = 32;
  87. ρσ_d["delete"] = 127;
  88. ρσ_d["del"] = 127;
  89. ρσ_d["padding character"] = 128;
  90. ρσ_d["pad"] = 128;
  91. ρσ_d["high octet preset"] = 129;
  92. ρσ_d["hop"] = 129;
  93. ρσ_d["break permitted here"] = 130;
  94. ρσ_d["bph"] = 130;
  95. ρσ_d["no break here"] = 131;
  96. ρσ_d["nbh"] = 131;
  97. ρσ_d["index"] = 132;
  98. ρσ_d["ind"] = 132;
  99. ρσ_d["next line"] = 133;
  100. ρσ_d["nel"] = 133;
  101. ρσ_d["start of selected area"] = 134;
  102. ρσ_d["ssa"] = 134;
  103. ρσ_d["end of selected area"] = 135;
  104. ρσ_d["esa"] = 135;
  105. ρσ_d["character tabulation set"] = 136;
  106. ρσ_d["horizontal tabulation set"] = 136;
  107. ρσ_d["hts"] = 136;
  108. ρσ_d["character tabulation with justification"] = 137;
  109. ρσ_d["horizontal tabulation with justification"] = 137;
  110. ρσ_d["htj"] = 137;
  111. ρσ_d["line tabulation set"] = 138;
  112. ρσ_d["vertical tabulation set"] = 138;
  113. ρσ_d["vts"] = 138;
  114. ρσ_d["partial line forward"] = 139;
  115. ρσ_d["partial line down"] = 139;
  116. ρσ_d["pld"] = 139;
  117. ρσ_d["partial line backward"] = 140;
  118. ρσ_d["partial line up"] = 140;
  119. ρσ_d["plu"] = 140;
  120. ρσ_d["reverse line feed"] = 141;
  121. ρσ_d["reverse index"] = 141;
  122. ρσ_d["ri"] = 141;
  123. ρσ_d["single shift two"] = 142;
  124. ρσ_d["single-shift-2"] = 142;
  125. ρσ_d["ss2"] = 142;
  126. ρσ_d["single shift three"] = 143;
  127. ρσ_d["single-shift-3"] = 143;
  128. ρσ_d["ss3"] = 143;
  129. ρσ_d["device control string"] = 144;
  130. ρσ_d["dcs"] = 144;
  131. ρσ_d["private use one"] = 145;
  132. ρσ_d["private use-1"] = 145;
  133. ρσ_d["pu1"] = 145;
  134. ρσ_d["private use two"] = 146;
  135. ρσ_d["private use-2"] = 146;
  136. ρσ_d["pu2"] = 146;
  137. ρσ_d["set transmit state"] = 147;
  138. ρσ_d["sts"] = 147;
  139. ρσ_d["cancel character"] = 148;
  140. ρσ_d["cch"] = 148;
  141. ρσ_d["message waiting"] = 149;
  142. ρσ_d["mw"] = 149;
  143. ρσ_d["start of guarded area"] = 150;
  144. ρσ_d["start of protected area"] = 150;
  145. ρσ_d["spa"] = 150;
  146. ρσ_d["end of guarded area"] = 151;
  147. ρσ_d["end of protected area"] = 151;
  148. ρσ_d["epa"] = 151;
  149. ρσ_d["start of string"] = 152;
  150. ρσ_d["sos"] = 152;
  151. ρσ_d["single graphic character introducer"] = 153;
  152. ρσ_d["sgc"] = 153;
  153. ρσ_d["single character introducer"] = 154;
  154. ρσ_d["sci"] = 154;
  155. ρσ_d["control sequence introducer"] = 155;
  156. ρσ_d["csi"] = 155;
  157. ρσ_d["string terminator"] = 156;
  158. ρσ_d["st"] = 156;
  159. ρσ_d["operating system command"] = 157;
  160. ρσ_d["osc"] = 157;
  161. ρσ_d["privacy message"] = 158;
  162. ρσ_d["pm"] = 158;
  163. ρσ_d["application program command"] = 159;
  164. ρσ_d["apc"] = 159;
  165. ρσ_d["nbsp"] = 160;
  166. ρσ_d["shy"] = 173;
  167. ρσ_d["latin capital letter gha"] = 418;
  168. ρσ_d["latin small letter gha"] = 419;
  169. ρσ_d["cgj"] = 847;
  170. ρσ_d["alm"] = 1564;
  171. ρσ_d["syriac sublinear colon skewed left"] = 1801;
  172. ρσ_d["kannada letter llla"] = 3294;
  173. ρσ_d["lao letter fo fon"] = 3741;
  174. ρσ_d["lao letter fo fay"] = 3743;
  175. ρσ_d["lao letter ro"] = 3747;
  176. ρσ_d["lao letter lo"] = 3749;
  177. ρσ_d["tibetan mark bka- shog gi mgo rgyan"] = 4048;
  178. ρσ_d["fvs1"] = 6155;
  179. ρσ_d["fvs2"] = 6156;
  180. ρσ_d["fvs3"] = 6157;
  181. ρσ_d["mvs"] = 6158;
  182. ρσ_d["zwsp"] = 8203;
  183. ρσ_d["zwnj"] = 8204;
  184. ρσ_d["zwj"] = 8205;
  185. ρσ_d["lrm"] = 8206;
  186. ρσ_d["rlm"] = 8207;
  187. ρσ_d["lre"] = 8234;
  188. ρσ_d["rle"] = 8235;
  189. ρσ_d["pdf"] = 8236;
  190. ρσ_d["lro"] = 8237;
  191. ρσ_d["rlo"] = 8238;
  192. ρσ_d["nnbsp"] = 8239;
  193. ρσ_d["mmsp"] = 8287;
  194. ρσ_d["wj"] = 8288;
  195. ρσ_d["lri"] = 8294;
  196. ρσ_d["rli"] = 8295;
  197. ρσ_d["fsi"] = 8296;
  198. ρσ_d["pdi"] = 8297;
  199. ρσ_d["weierstrass elliptic function"] = 8472;
  200. ρσ_d["micr on us symbol"] = 9288;
  201. ρσ_d["micr dash symbol"] = 9289;
  202. ρσ_d["leftwards triangle-headed arrow with double vertical stroke"] = 11130;
  203. ρσ_d["rightwards triangle-headed arrow with double vertical stroke"] = 11132;
  204. ρσ_d["yi syllable iteration mark"] = 40981;
  205. ρσ_d["presentation form for vertical right white lenticular bracket"] = 65048;
  206. ρσ_d["vs1"] = 65024;
  207. ρσ_d["vs2"] = 65025;
  208. ρσ_d["vs3"] = 65026;
  209. ρσ_d["vs4"] = 65027;
  210. ρσ_d["vs5"] = 65028;
  211. ρσ_d["vs6"] = 65029;
  212. ρσ_d["vs7"] = 65030;
  213. ρσ_d["vs8"] = 65031;
  214. ρσ_d["vs9"] = 65032;
  215. ρσ_d["vs10"] = 65033;
  216. ρσ_d["vs11"] = 65034;
  217. ρσ_d["vs12"] = 65035;
  218. ρσ_d["vs13"] = 65036;
  219. ρσ_d["vs14"] = 65037;
  220. ρσ_d["vs15"] = 65038;
  221. ρσ_d["vs16"] = 65039;
  222. ρσ_d["byte order mark"] = 65279;
  223. ρσ_d["bom"] = 65279;
  224. ρσ_d["zwnbsp"] = 65279;
  225. ρσ_d["cuneiform sign nu11 tenu"] = 74452;
  226. ρσ_d["cuneiform sign nu11 over nu11 bur over bur"] = 74453;
  227. ρσ_d["byzantine musical symbol fthora skliron chroma vasis"] = 118981;
  228. ρσ_d["vs17"] = 917760;
  229. ρσ_d["vs18"] = 917761;
  230. ρσ_d["vs19"] = 917762;
  231. ρσ_d["vs20"] = 917763;
  232. ρσ_d["vs21"] = 917764;
  233. ρσ_d["vs22"] = 917765;
  234. ρσ_d["vs23"] = 917766;
  235. ρσ_d["vs24"] = 917767;
  236. ρσ_d["vs25"] = 917768;
  237. ρσ_d["vs26"] = 917769;
  238. ρσ_d["vs27"] = 917770;
  239. ρσ_d["vs28"] = 917771;
  240. ρσ_d["vs29"] = 917772;
  241. ρσ_d["vs30"] = 917773;
  242. ρσ_d["vs31"] = 917774;
  243. ρσ_d["vs32"] = 917775;
  244. ρσ_d["vs33"] = 917776;
  245. ρσ_d["vs34"] = 917777;
  246. ρσ_d["vs35"] = 917778;
  247. ρσ_d["vs36"] = 917779;
  248. ρσ_d["vs37"] = 917780;
  249. ρσ_d["vs38"] = 917781;
  250. ρσ_d["vs39"] = 917782;
  251. ρσ_d["vs40"] = 917783;
  252. ρσ_d["vs41"] = 917784;
  253. ρσ_d["vs42"] = 917785;
  254. ρσ_d["vs43"] = 917786;
  255. ρσ_d["vs44"] = 917787;
  256. ρσ_d["vs45"] = 917788;
  257. ρσ_d["vs46"] = 917789;
  258. ρσ_d["vs47"] = 917790;
  259. ρσ_d["vs48"] = 917791;
  260. ρσ_d["vs49"] = 917792;
  261. ρσ_d["vs50"] = 917793;
  262. ρσ_d["vs51"] = 917794;
  263. ρσ_d["vs52"] = 917795;
  264. ρσ_d["vs53"] = 917796;
  265. ρσ_d["vs54"] = 917797;
  266. ρσ_d["vs55"] = 917798;
  267. ρσ_d["vs56"] = 917799;
  268. ρσ_d["vs57"] = 917800;
  269. ρσ_d["vs58"] = 917801;
  270. ρσ_d["vs59"] = 917802;
  271. ρσ_d["vs60"] = 917803;
  272. ρσ_d["vs61"] = 917804;
  273. ρσ_d["vs62"] = 917805;
  274. ρσ_d["vs63"] = 917806;
  275. ρσ_d["vs64"] = 917807;
  276. ρσ_d["vs65"] = 917808;
  277. ρσ_d["vs66"] = 917809;
  278. ρσ_d["vs67"] = 917810;
  279. ρσ_d["vs68"] = 917811;
  280. ρσ_d["vs69"] = 917812;
  281. ρσ_d["vs70"] = 917813;
  282. ρσ_d["vs71"] = 917814;
  283. ρσ_d["vs72"] = 917815;
  284. ρσ_d["vs73"] = 917816;
  285. ρσ_d["vs74"] = 917817;
  286. ρσ_d["vs75"] = 917818;
  287. ρσ_d["vs76"] = 917819;
  288. ρσ_d["vs77"] = 917820;
  289. ρσ_d["vs78"] = 917821;
  290. ρσ_d["vs79"] = 917822;
  291. ρσ_d["vs80"] = 917823;
  292. ρσ_d["vs81"] = 917824;
  293. ρσ_d["vs82"] = 917825;
  294. ρσ_d["vs83"] = 917826;
  295. ρσ_d["vs84"] = 917827;
  296. ρσ_d["vs85"] = 917828;
  297. ρσ_d["vs86"] = 917829;
  298. ρσ_d["vs87"] = 917830;
  299. ρσ_d["vs88"] = 917831;
  300. ρσ_d["vs89"] = 917832;
  301. ρσ_d["vs90"] = 917833;
  302. ρσ_d["vs91"] = 917834;
  303. ρσ_d["vs92"] = 917835;
  304. ρσ_d["vs93"] = 917836;
  305. ρσ_d["vs94"] = 917837;
  306. ρσ_d["vs95"] = 917838;
  307. ρσ_d["vs96"] = 917839;
  308. ρσ_d["vs97"] = 917840;
  309. ρσ_d["vs98"] = 917841;
  310. ρσ_d["vs99"] = 917842;
  311. ρσ_d["vs100"] = 917843;
  312. ρσ_d["vs101"] = 917844;
  313. ρσ_d["vs102"] = 917845;
  314. ρσ_d["vs103"] = 917846;
  315. ρσ_d["vs104"] = 917847;
  316. ρσ_d["vs105"] = 917848;
  317. ρσ_d["vs106"] = 917849;
  318. ρσ_d["vs107"] = 917850;
  319. ρσ_d["vs108"] = 917851;
  320. ρσ_d["vs109"] = 917852;
  321. ρσ_d["vs110"] = 917853;
  322. ρσ_d["vs111"] = 917854;
  323. ρσ_d["vs112"] = 917855;
  324. ρσ_d["vs113"] = 917856;
  325. ρσ_d["vs114"] = 917857;
  326. ρσ_d["vs115"] = 917858;
  327. ρσ_d["vs116"] = 917859;
  328. ρσ_d["vs117"] = 917860;
  329. ρσ_d["vs118"] = 917861;
  330. ρσ_d["vs119"] = 917862;
  331. ρσ_d["vs120"] = 917863;
  332. ρσ_d["vs121"] = 917864;
  333. ρσ_d["vs122"] = 917865;
  334. ρσ_d["vs123"] = 917866;
  335. ρσ_d["vs124"] = 917867;
  336. ρσ_d["vs125"] = 917868;
  337. ρσ_d["vs126"] = 917869;
  338. ρσ_d["vs127"] = 917870;
  339. ρσ_d["vs128"] = 917871;
  340. ρσ_d["vs129"] = 917872;
  341. ρσ_d["vs130"] = 917873;
  342. ρσ_d["vs131"] = 917874;
  343. ρσ_d["vs132"] = 917875;
  344. ρσ_d["vs133"] = 917876;
  345. ρσ_d["vs134"] = 917877;
  346. ρσ_d["vs135"] = 917878;
  347. ρσ_d["vs136"] = 917879;
  348. ρσ_d["vs137"] = 917880;
  349. ρσ_d["vs138"] = 917881;
  350. ρσ_d["vs139"] = 917882;
  351. ρσ_d["vs140"] = 917883;
  352. ρσ_d["vs141"] = 917884;
  353. ρσ_d["vs142"] = 917885;
  354. ρσ_d["vs143"] = 917886;
  355. ρσ_d["vs144"] = 917887;
  356. ρσ_d["vs145"] = 917888;
  357. ρσ_d["vs146"] = 917889;
  358. ρσ_d["vs147"] = 917890;
  359. ρσ_d["vs148"] = 917891;
  360. ρσ_d["vs149"] = 917892;
  361. ρσ_d["vs150"] = 917893;
  362. ρσ_d["vs151"] = 917894;
  363. ρσ_d["vs152"] = 917895;
  364. ρσ_d["vs153"] = 917896;
  365. ρσ_d["vs154"] = 917897;
  366. ρσ_d["vs155"] = 917898;
  367. ρσ_d["vs156"] = 917899;
  368. ρσ_d["vs157"] = 917900;
  369. ρσ_d["vs158"] = 917901;
  370. ρσ_d["vs159"] = 917902;
  371. ρσ_d["vs160"] = 917903;
  372. ρσ_d["vs161"] = 917904;
  373. ρσ_d["vs162"] = 917905;
  374. ρσ_d["vs163"] = 917906;
  375. ρσ_d["vs164"] = 917907;
  376. ρσ_d["vs165"] = 917908;
  377. ρσ_d["vs166"] = 917909;
  378. ρσ_d["vs167"] = 917910;
  379. ρσ_d["vs168"] = 917911;
  380. ρσ_d["vs169"] = 917912;
  381. ρσ_d["vs170"] = 917913;
  382. ρσ_d["vs171"] = 917914;
  383. ρσ_d["vs172"] = 917915;
  384. ρσ_d["vs173"] = 917916;
  385. ρσ_d["vs174"] = 917917;
  386. ρσ_d["vs175"] = 917918;
  387. ρσ_d["vs176"] = 917919;
  388. ρσ_d["vs177"] = 917920;
  389. ρσ_d["vs178"] = 917921;
  390. ρσ_d["vs179"] = 917922;
  391. ρσ_d["vs180"] = 917923;
  392. ρσ_d["vs181"] = 917924;
  393. ρσ_d["vs182"] = 917925;
  394. ρσ_d["vs183"] = 917926;
  395. ρσ_d["vs184"] = 917927;
  396. ρσ_d["vs185"] = 917928;
  397. ρσ_d["vs186"] = 917929;
  398. ρσ_d["vs187"] = 917930;
  399. ρσ_d["vs188"] = 917931;
  400. ρσ_d["vs189"] = 917932;
  401. ρσ_d["vs190"] = 917933;
  402. ρσ_d["vs191"] = 917934;
  403. ρσ_d["vs192"] = 917935;
  404. ρσ_d["vs193"] = 917936;
  405. ρσ_d["vs194"] = 917937;
  406. ρσ_d["vs195"] = 917938;
  407. ρσ_d["vs196"] = 917939;
  408. ρσ_d["vs197"] = 917940;
  409. ρσ_d["vs198"] = 917941;
  410. ρσ_d["vs199"] = 917942;
  411. ρσ_d["vs200"] = 917943;
  412. ρσ_d["vs201"] = 917944;
  413. ρσ_d["vs202"] = 917945;
  414. ρσ_d["vs203"] = 917946;
  415. ρσ_d["vs204"] = 917947;
  416. ρσ_d["vs205"] = 917948;
  417. ρσ_d["vs206"] = 917949;
  418. ρσ_d["vs207"] = 917950;
  419. ρσ_d["vs208"] = 917951;
  420. ρσ_d["vs209"] = 917952;
  421. ρσ_d["vs210"] = 917953;
  422. ρσ_d["vs211"] = 917954;
  423. ρσ_d["vs212"] = 917955;
  424. ρσ_d["vs213"] = 917956;
  425. ρσ_d["vs214"] = 917957;
  426. ρσ_d["vs215"] = 917958;
  427. ρσ_d["vs216"] = 917959;
  428. ρσ_d["vs217"] = 917960;
  429. ρσ_d["vs218"] = 917961;
  430. ρσ_d["vs219"] = 917962;
  431. ρσ_d["vs220"] = 917963;
  432. ρσ_d["vs221"] = 917964;
  433. ρσ_d["vs222"] = 917965;
  434. ρσ_d["vs223"] = 917966;
  435. ρσ_d["vs224"] = 917967;
  436. ρσ_d["vs225"] = 917968;
  437. ρσ_d["vs226"] = 917969;
  438. ρσ_d["vs227"] = 917970;
  439. ρσ_d["vs228"] = 917971;
  440. ρσ_d["vs229"] = 917972;
  441. ρσ_d["vs230"] = 917973;
  442. ρσ_d["vs231"] = 917974;
  443. ρσ_d["vs232"] = 917975;
  444. ρσ_d["vs233"] = 917976;
  445. ρσ_d["vs234"] = 917977;
  446. ρσ_d["vs235"] = 917978;
  447. ρσ_d["vs236"] = 917979;
  448. ρσ_d["vs237"] = 917980;
  449. ρσ_d["vs238"] = 917981;
  450. ρσ_d["vs239"] = 917982;
  451. ρσ_d["vs240"] = 917983;
  452. ρσ_d["vs241"] = 917984;
  453. ρσ_d["vs242"] = 917985;
  454. ρσ_d["vs243"] = 917986;
  455. ρσ_d["vs244"] = 917987;
  456. ρσ_d["vs245"] = 917988;
  457. ρσ_d["vs246"] = 917989;
  458. ρσ_d["vs247"] = 917990;
  459. ρσ_d["vs248"] = 917991;
  460. ρσ_d["vs249"] = 917992;
  461. ρσ_d["vs250"] = 917993;
  462. ρσ_d["vs251"] = 917994;
  463. ρσ_d["vs252"] = 917995;
  464. ρσ_d["vs253"] = 917996;
  465. ρσ_d["vs254"] = 917997;
  466. ρσ_d["vs255"] = 917998;
  467. ρσ_d["vs256"] = 917999;
  468. return ρσ_d;
  469. }).call(this);
  470. _ASCII_CONTROL_CHARS = (function(){
  471. var ρσ_d = {};
  472. ρσ_d["a"] = 7;
  473. ρσ_d["b"] = 8;
  474. ρσ_d["f"] = 12;
  475. ρσ_d["n"] = 10;
  476. ρσ_d["r"] = 13;
  477. ρσ_d["t"] = 9;
  478. ρσ_d["v"] = 11;
  479. return ρσ_d;
  480. }).call(this);
  481. _HEX_PAT = /^[a-fA-F0-9]/;
  482. _NUM_PAT = /^[0-9]/;
  483. _GROUP_PAT = /<([^>]+)>/;
  484. _NAME_PAT = /^[a-zA-Z ]/;
  485. I = IGNORECASE = 2;
  486. L = LOCALE = 4;
  487. M = MULTILINE = 8;
  488. D = DOTALL = 16;
  489. U = UNICODE = 32;
  490. X = VERBOSE = 64;
  491. DEBUG = 128;
  492. A = ASCII = 256;
  493. supports_unicode = RegExp.prototype.unicode !== undefined;
  494. _RE_ESCAPE = /[-\/\\^$*+?.()|[\]{}]/g;
  495. _re_cache_map = {};
  496. _re_cache_items = [];
  497. error = SyntaxError;
  498. has_prop = Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty);
  499. function _expand(groups, repl, group_name_map) {
  500. var i, ans, ch;
  501. i = 0;
  502. function next() {
  503. return repl[i++];
  504. };
  505. function peek() {
  506. return repl[(typeof i === "number" && i < 0) ? repl.length + i : i];
  507. };
  508. function read_digits(count, pat, base, maxval, prefix) {
  509. var ans, greedy, nval;
  510. ans = prefix || "";
  511. greedy = count === Number.MAX_VALUE;
  512. while (count > 0) {
  513. count -= 1;
  514. if (!pat.test(peek())) {
  515. if (greedy) {
  516. break;
  517. }
  518. return ans;
  519. }
  520. ans += next();
  521. }
  522. nval = parseInt(ans, base);
  523. if (nval > maxval) {
  524. return ans;
  525. }
  526. return nval;
  527. };
  528. if (!read_digits.__argnames__) Object.defineProperties(read_digits, {
  529. __argnames__ : {value: ["count", "pat", "base", "maxval", "prefix"]}
  530. });
  531. function read_escape_sequence() {
  532. var q, ans, m, gn, code, name, key;
  533. q = next();
  534. if (!q || q === "\\") {
  535. return "\\";
  536. }
  537. if ("\"'".indexOf(q) !== -1) {
  538. return q;
  539. }
  540. if (_ASCII_CONTROL_CHARS[(typeof q === "number" && q < 0) ? _ASCII_CONTROL_CHARS.length + q : q]) {
  541. return String.fromCharCode(_ASCII_CONTROL_CHARS[(typeof q === "number" && q < 0) ? _ASCII_CONTROL_CHARS.length + q : q]);
  542. }
  543. if ("0" <= q && q <= "9") {
  544. ans = read_digits(Number.MAX_VALUE, _NUM_PAT, 10, Number.MAX_VALUE, q);
  545. if (typeof ans === "number") {
  546. return groups[(typeof ans === "number" && ans < 0) ? groups.length + ans : ans] || "";
  547. }
  548. return "\\" + ans;
  549. }
  550. if (q === "g") {
  551. m = _GROUP_PAT.exec(repl.slice(i));
  552. if (m !== null) {
  553. i += m[0].length;
  554. gn = m[1];
  555. if (isNaN(parseInt(gn, 10))) {
  556. if (!has_prop(group_name_map, gn)) {
  557. return "";
  558. }
  559. gn = (ρσ_expr_temp = group_name_map[(typeof gn === "number" && gn < 0) ? group_name_map.length + gn : gn])[ρσ_expr_temp.length-1];
  560. }
  561. return groups[(typeof gn === "number" && gn < 0) ? groups.length + gn : gn] || "";
  562. }
  563. }
  564. if (q === "x") {
  565. code = read_digits(2, _HEX_PAT, 16, 1114111);
  566. if (typeof code === "number") {
  567. return String.fromCharCode(code);
  568. }
  569. return "\\x" + code;
  570. }
  571. if (q === "u") {
  572. code = read_digits(4, _HEX_PAT, 16, 1114111);
  573. if (typeof code === "number") {
  574. return String.fromCharCode(code);
  575. }
  576. return "\\u" + code;
  577. }
  578. if (q === "U") {
  579. code = read_digits(8, _HEX_PAT, 16, 1114111);
  580. if (typeof code === "number") {
  581. if (code <= 65535) {
  582. return String.fromCharCode(code);
  583. }
  584. code -= 65536;
  585. return String.fromCharCode(55296 + (code >> 10), 56320 + (code & 1023));
  586. }
  587. return "\\U" + code;
  588. }
  589. if (q === "N" && peek() === "{") {
  590. next();
  591. name = "";
  592. while (_NAME_PAT.test(peek())) {
  593. name += next();
  594. }
  595. if (peek() !== "}") {
  596. return "\\N{" + name;
  597. }
  598. next();
  599. key = (name || "").toLowerCase();
  600. if (!name || !has_prop(_ALIAS_MAP, key)) {
  601. return "\\N{" + name + "}";
  602. }
  603. code = _ALIAS_MAP[(typeof key === "number" && key < 0) ? _ALIAS_MAP.length + key : key];
  604. if (code <= 65535) {
  605. return String.fromCharCode(code);
  606. }
  607. code -= 65536;
  608. return String.fromCharCode(55296 + (code >> 10), 56320 + (code & 1023));
  609. }
  610. return "\\" + q;
  611. };
  612. ans = ch = "";
  613. while (ch = next()) {
  614. if (ch === "\\") {
  615. ans += read_escape_sequence();
  616. } else {
  617. ans += ch;
  618. }
  619. }
  620. return ans;
  621. };
  622. if (!_expand.__argnames__) Object.defineProperties(_expand, {
  623. __argnames__ : {value: ["groups", "repl", "group_name_map"]}
  624. });
  625. function transform_regex(source, flags) {
  626. var pos, previous_backslash, in_class, ans, group_map, group_count, ch, extension, close, flag_map, flgs, q, name;
  627. pos = 0;
  628. previous_backslash = in_class = false;
  629. ans = "";
  630. group_map = {};
  631. flags = flags || 0;
  632. group_count = 0;
  633. while (pos < source.length) {
  634. ch = source[pos++];
  635. if (previous_backslash) {
  636. ans += "\\" + ch;
  637. previous_backslash = false;
  638. continue;
  639. }
  640. if (in_class) {
  641. if (ch === "]") {
  642. in_class = false;
  643. }
  644. ans += ch;
  645. continue;
  646. }
  647. if (ch === "\\") {
  648. previous_backslash = true;
  649. continue;
  650. }
  651. if (ch === "[") {
  652. in_class = true;
  653. if (source[(typeof pos === "number" && pos < 0) ? source.length + pos : pos] === "]") {
  654. pos += 1;
  655. ch = "[\\]";
  656. }
  657. } else if (ch === "(") {
  658. if (source[(typeof pos === "number" && pos < 0) ? source.length + pos : pos] === "?") {
  659. extension = source[ρσ_bound_index(pos + 1, source)];
  660. if (extension === "#") {
  661. close = source.indexOf(")", pos + 1);
  662. if (close === -1) {
  663. throw new ValueError("Expecting a closing )");
  664. }
  665. pos = close + 1;
  666. continue;
  667. }
  668. if ("aiLmsux".indexOf(extension) !== -1) {
  669. flag_map = (function(){
  670. var ρσ_d = {};
  671. ρσ_d["a"] = ASCII;
  672. ρσ_d["i"] = IGNORECASE;
  673. ρσ_d["L"] = LOCALE;
  674. ρσ_d["m"] = MULTILINE;
  675. ρσ_d["s"] = DOTALL;
  676. ρσ_d["u"] = UNICODE;
  677. ρσ_d["x"] = VERBOSE;
  678. return ρσ_d;
  679. }).call(this);
  680. close = source.indexOf(")", pos + 1);
  681. if (close === -1) {
  682. throw new SyntaxError("Expecting a closing )");
  683. }
  684. flgs = source.slice(pos + 1, close);
  685. for (var i = 0; i < flgs.length; i++) {
  686. q = flgs[(typeof i === "number" && i < 0) ? flgs.length + i : i];
  687. if (!has_prop(flag_map, q)) {
  688. throw new SyntaxError("Invalid flag: " + q);
  689. }
  690. flags |= flag_map[(typeof q === "number" && q < 0) ? flag_map.length + q : q];
  691. }
  692. pos = close + 1;
  693. continue;
  694. }
  695. if (extension === "<") {
  696. throw new SyntaxError("Look behind assertions are not supported in JavaScript");
  697. }
  698. if (extension === "(") {
  699. throw new SyntaxError("Group existence assertions are not supported in JavaScript");
  700. }
  701. if (extension === "P") {
  702. pos += 2;
  703. q = source[(typeof pos === "number" && pos < 0) ? source.length + pos : pos];
  704. if (q === "<") {
  705. close = source.indexOf(">", pos);
  706. if (close === -1) {
  707. throw new SyntaxError("Named group not closed, expecting >");
  708. }
  709. name = source.slice(pos + 1, close);
  710. if (!has_prop(group_map, name)) {
  711. group_map[(typeof name === "number" && name < 0) ? group_map.length + name : name] = [];
  712. }
  713. group_map[(typeof name === "number" && name < 0) ? group_map.length + name : name].push(++group_count);
  714. pos = close + 1;
  715. } else if (q === "=") {
  716. close = source.indexOf(")", pos);
  717. if (close === -1) {
  718. throw new SyntaxError("Named group back-reference not closed, expecting a )");
  719. }
  720. name = source.slice(pos + 1, close);
  721. if (!isNaN(parseInt(name, 10))) {
  722. ans += "\\" + name;
  723. } else {
  724. if (!has_prop(group_map, name)) {
  725. throw new SyntaxError("Invalid back-reference. The named group: " + name + " has not yet been defined.");
  726. }
  727. ans += "\\" + (ρσ_expr_temp = group_map[(typeof name === "number" && name < 0) ? group_map.length + name : name])[ρσ_expr_temp.length-1];
  728. }
  729. pos = close + 1;
  730. continue;
  731. } else {
  732. throw new SyntaxError("Expecting < or = after (?P");
  733. }
  734. }
  735. } else {
  736. group_count += 1;
  737. }
  738. } else if (ch === "." && flags & DOTALL) {
  739. ans += "[\\s\\S]";
  740. continue;
  741. }
  742. ans += ch;
  743. }
  744. return [ans, flags, group_map];
  745. };
  746. if (!transform_regex.__argnames__) Object.defineProperties(transform_regex, {
  747. __argnames__ : {value: ["source", "flags"]}
  748. });
  749. function MatchObject() {
  750. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  751. MatchObject.prototype.__bind_methods__.call(this);
  752. MatchObject.prototype.__init__.apply(this, arguments);
  753. }
  754. Object.defineProperty(MatchObject.prototype, "__bind_methods__", {value: function () {
  755. this._compute_extents = MatchObject.prototype._compute_extents.bind(this);
  756. this.groups = MatchObject.prototype.groups.bind(this);
  757. this._group_number = MatchObject.prototype._group_number.bind(this);
  758. this._group_val = MatchObject.prototype._group_val.bind(this);
  759. this.group = MatchObject.prototype.group.bind(this);
  760. this.start = MatchObject.prototype.start.bind(this);
  761. this.end = MatchObject.prototype.end.bind(this);
  762. this.span = MatchObject.prototype.span.bind(this);
  763. this.expand = MatchObject.prototype.expand.bind(this);
  764. this.groupdict = MatchObject.prototype.groupdict.bind(this);
  765. this.captures = MatchObject.prototype.captures.bind(this);
  766. this.capturesdict = MatchObject.prototype.capturesdict.bind(this);
  767. }});
  768. MatchObject.prototype.__init__ = function __init__(regex, match, pos, endpos) {
  769. var self = this;
  770. var ρσ_unpack;
  771. self.re = regex;
  772. self.string = match.input;
  773. self._start_pos = match.index;
  774. self._groups = match;
  775. ρσ_unpack = [pos, endpos];
  776. self.pos = ρσ_unpack[0];
  777. self.endpos = ρσ_unpack[1];
  778. };
  779. if (!MatchObject.prototype.__init__.__argnames__) Object.defineProperties(MatchObject.prototype.__init__, {
  780. __argnames__ : {value: ["regex", "match", "pos", "endpos"]}
  781. });
  782. MatchObject.__argnames__ = MatchObject.prototype.__init__.__argnames__;
  783. MatchObject.__handles_kwarg_interpolation__ = MatchObject.prototype.__init__.__handles_kwarg_interpolation__;
  784. MatchObject.prototype._compute_extents = function _compute_extents() {
  785. var self = this;
  786. var match, offset, extent, loc, g;
  787. match = self._groups;
  788. self._start = Array(match.length);
  789. self._end = Array(match.length);
  790. self._start[0] = self._start_pos;
  791. self._end[0] = self._start_pos + match[0].length;
  792. offset = self._start_pos;
  793. extent = match[0];
  794. loc = 0;
  795. for (var i = 1; i < match.length; i++) {
  796. g = match[(typeof i === "number" && i < 0) ? match.length + i : i];
  797. loc = extent.indexOf(g, loc);
  798. if (loc === -1) {
  799. (ρσ_expr_temp = self._start)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = (ρσ_expr_temp = self._start)[ρσ_bound_index(i - 1, ρσ_expr_temp)];
  800. (ρσ_expr_temp = self._end)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = (ρσ_expr_temp = self._end)[ρσ_bound_index(i - 1, ρσ_expr_temp)];
  801. } else {
  802. (ρσ_expr_temp = self._start)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = offset + loc;
  803. loc += g.length;
  804. (ρσ_expr_temp = self._end)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i] = offset + loc;
  805. }
  806. }
  807. };
  808. if (!MatchObject.prototype._compute_extents.__argnames__) Object.defineProperties(MatchObject.prototype._compute_extents, {
  809. __argnames__ : {value: []}
  810. });
  811. MatchObject.prototype.groups = function groups() {
  812. var self = this;
  813. var defval = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? groups.__defaults__.defval : arguments[0];
  814. var ρσ_kwargs_obj = arguments[arguments.length-1];
  815. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  816. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "defval")){
  817. defval = ρσ_kwargs_obj.defval;
  818. }
  819. var ans, val;
  820. ans = [];
  821. for (var i = 1; i < self._groups.length; i++) {
  822. val = (ρσ_expr_temp = self._groups)[(typeof i === "number" && i < 0) ? ρσ_expr_temp.length + i : i];
  823. if (val === undefined) {
  824. val = defval;
  825. }
  826. ans.push(val);
  827. }
  828. return ans;
  829. };
  830. if (!MatchObject.prototype.groups.__defaults__) Object.defineProperties(MatchObject.prototype.groups, {
  831. __defaults__ : {value: {defval:null}},
  832. __handles_kwarg_interpolation__ : {value: true},
  833. __argnames__ : {value: ["defval"]}
  834. });
  835. MatchObject.prototype._group_number = function _group_number(g) {
  836. var self = this;
  837. if (typeof g === "number") {
  838. return g;
  839. }
  840. if (has_prop(self.re.group_name_map, g)) {
  841. return (ρσ_expr_temp = (ρσ_expr_temp = self.re.group_name_map)[(typeof g === "number" && g < 0) ? ρσ_expr_temp.length + g : g])[ρσ_expr_temp.length-1];
  842. }
  843. return g;
  844. };
  845. if (!MatchObject.prototype._group_number.__argnames__) Object.defineProperties(MatchObject.prototype._group_number, {
  846. __argnames__ : {value: ["g"]}
  847. });
  848. MatchObject.prototype._group_val = function _group_val(q, defval) {
  849. var self = this;
  850. var val;
  851. val = undefined;
  852. if (typeof q === "number" && -1 < q && q < self._groups.length) {
  853. val = (ρσ_expr_temp = self._groups)[(typeof q === "number" && q < 0) ? ρσ_expr_temp.length + q : q];
  854. } else {
  855. if (has_prop(self.re.group_name_map, q)) {
  856. val = (ρσ_expr_temp = self._groups)[ρσ_bound_index((ρσ_expr_temp = (ρσ_expr_temp = self.re.group_name_map)[(typeof q === "number" && q < 0) ? ρσ_expr_temp.length + q : q])[ρσ_expr_temp.length-1], ρσ_expr_temp)];
  857. }
  858. }
  859. if (val === undefined) {
  860. val = defval;
  861. }
  862. return val;
  863. };
  864. if (!MatchObject.prototype._group_val.__argnames__) Object.defineProperties(MatchObject.prototype._group_val, {
  865. __argnames__ : {value: ["q", "defval"]}
  866. });
  867. MatchObject.prototype.group = function group() {
  868. var self = this;
  869. var ans, q;
  870. if (arguments.length === 0) {
  871. return self._groups[0];
  872. }
  873. ans = [];
  874. for (var i = 0; i < arguments.length; i++) {
  875. q = arguments[(typeof i === "number" && i < 0) ? arguments.length + i : i];
  876. ans.push(self._group_val(q, null));
  877. }
  878. return (ans.length === 1) ? ans[0] : ans;
  879. };
  880. if (!MatchObject.prototype.group.__argnames__) Object.defineProperties(MatchObject.prototype.group, {
  881. __argnames__ : {value: []}
  882. });
  883. MatchObject.prototype.start = function start(g) {
  884. var self = this;
  885. var val;
  886. if (self._start === undefined) {
  887. self._compute_extents();
  888. }
  889. val = (ρσ_expr_temp = self._start)[ρσ_bound_index(self._group_number(g || 0), ρσ_expr_temp)];
  890. if (val === undefined) {
  891. val = -1;
  892. }
  893. return val;
  894. };
  895. if (!MatchObject.prototype.start.__argnames__) Object.defineProperties(MatchObject.prototype.start, {
  896. __argnames__ : {value: ["g"]}
  897. });
  898. MatchObject.prototype.end = function end(g) {
  899. var self = this;
  900. var val;
  901. if (self._end === undefined) {
  902. self._compute_extents();
  903. }
  904. val = (ρσ_expr_temp = self._end)[ρσ_bound_index(self._group_number(g || 0), ρσ_expr_temp)];
  905. if (val === undefined) {
  906. val = -1;
  907. }
  908. return val;
  909. };
  910. if (!MatchObject.prototype.end.__argnames__) Object.defineProperties(MatchObject.prototype.end, {
  911. __argnames__ : {value: ["g"]}
  912. });
  913. MatchObject.prototype.span = function span(g) {
  914. var self = this;
  915. return ρσ_list_decorate([ self.start(g), self.end(g) ]);
  916. };
  917. if (!MatchObject.prototype.span.__argnames__) Object.defineProperties(MatchObject.prototype.span, {
  918. __argnames__ : {value: ["g"]}
  919. });
  920. MatchObject.prototype.expand = function expand(repl) {
  921. var self = this;
  922. return _expand(repl, this._groups, this.re.group_name_map);
  923. };
  924. if (!MatchObject.prototype.expand.__argnames__) Object.defineProperties(MatchObject.prototype.expand, {
  925. __argnames__ : {value: ["repl"]}
  926. });
  927. MatchObject.prototype.groupdict = function groupdict() {
  928. var self = this;
  929. var defval = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? groupdict.__defaults__.defval : arguments[0];
  930. var ρσ_kwargs_obj = arguments[arguments.length-1];
  931. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  932. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "defval")){
  933. defval = ρσ_kwargs_obj.defval;
  934. }
  935. var gnm, names, ans, name, val;
  936. gnm = self.re.group_name_map;
  937. names = Object.keys(gnm);
  938. ans = {};
  939. for (var i = 0; i < names.length; i++) {
  940. name = names[(typeof i === "number" && i < 0) ? names.length + i : i];
  941. if (has_prop(gnm, name)) {
  942. val = (ρσ_expr_temp = self._groups)[ρσ_bound_index((ρσ_expr_temp = gnm[(typeof name === "number" && name < 0) ? gnm.length + name : name])[ρσ_expr_temp.length-1], ρσ_expr_temp)];
  943. if (val === undefined) {
  944. val = defval;
  945. }
  946. ans[(typeof name === "number" && name < 0) ? ans.length + name : name] = val;
  947. }
  948. }
  949. return ans;
  950. };
  951. if (!MatchObject.prototype.groupdict.__defaults__) Object.defineProperties(MatchObject.prototype.groupdict, {
  952. __defaults__ : {value: {defval:null}},
  953. __handles_kwarg_interpolation__ : {value: true},
  954. __argnames__ : {value: ["defval"]}
  955. });
  956. MatchObject.prototype.captures = function captures(group_name) {
  957. var self = this;
  958. var ans, groups, val;
  959. ans = ρσ_list_decorate([]);
  960. if (!has_prop(self.re.group_name_map, group_name)) {
  961. return ans;
  962. }
  963. groups = (ρσ_expr_temp = self.re.group_name_map)[(typeof group_name === "number" && group_name < 0) ? ρσ_expr_temp.length + group_name : group_name];
  964. for (var i = 0; i < groups.length; i++) {
  965. val = (ρσ_expr_temp = self._groups)[ρσ_bound_index(groups[(typeof i === "number" && i < 0) ? groups.length + i : i], ρσ_expr_temp)];
  966. if (val !== undefined) {
  967. ans.push(val);
  968. }
  969. }
  970. return ans;
  971. };
  972. if (!MatchObject.prototype.captures.__argnames__) Object.defineProperties(MatchObject.prototype.captures, {
  973. __argnames__ : {value: ["group_name"]}
  974. });
  975. MatchObject.prototype.capturesdict = function capturesdict() {
  976. var self = this;
  977. var gnm, names, ans, name;
  978. gnm = self.re.group_name_map;
  979. names = Object.keys(gnm);
  980. ans = {};
  981. for (var i = 0; i < names.length; i++) {
  982. name = names[(typeof i === "number" && i < 0) ? names.length + i : i];
  983. ans[(typeof name === "number" && name < 0) ? ans.length + name : name] = self.captures(name);
  984. }
  985. return ans;
  986. };
  987. if (!MatchObject.prototype.capturesdict.__argnames__) Object.defineProperties(MatchObject.prototype.capturesdict, {
  988. __argnames__ : {value: []}
  989. });
  990. MatchObject.prototype.__repr__ = function __repr__ () {
  991. return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
  992. };
  993. MatchObject.prototype.__str__ = function __str__ () {
  994. return this.__repr__();
  995. };
  996. Object.defineProperty(MatchObject.prototype, "__bases__", {value: []});
  997. function RegexObject() {
  998. if (this.ρσ_object_id === undefined) Object.defineProperty(this, "ρσ_object_id", {"value":++ρσ_object_counter});
  999. RegexObject.prototype.__bind_methods__.call(this);
  1000. RegexObject.prototype.__init__.apply(this, arguments);
  1001. }
  1002. Object.defineProperty(RegexObject.prototype, "__bind_methods__", {value: function () {
  1003. this._do_search = RegexObject.prototype._do_search.bind(this);
  1004. this.search = RegexObject.prototype.search.bind(this);
  1005. this.match = RegexObject.prototype.match.bind(this);
  1006. this.split = RegexObject.prototype.split.bind(this);
  1007. this.findall = RegexObject.prototype.findall.bind(this);
  1008. this.finditer = RegexObject.prototype.finditer.bind(this);
  1009. this.subn = RegexObject.prototype.subn.bind(this);
  1010. this.sub = RegexObject.prototype.sub.bind(this);
  1011. }});
  1012. RegexObject.prototype.__init__ = function __init__(pattern, flags) {
  1013. var self = this;
  1014. var ρσ_unpack, modifiers;
  1015. self.pattern = (ρσ_instanceof(pattern, RegExp)) ? pattern.source : pattern;
  1016. ρσ_unpack = transform_regex(self.pattern, flags);
  1017. ρσ_unpack = ρσ_unpack_asarray(3, ρσ_unpack);
  1018. self.js_pattern = ρσ_unpack[0];
  1019. self.flags = ρσ_unpack[1];
  1020. self.group_name_map = ρσ_unpack[2];
  1021. modifiers = "";
  1022. if (self.flags & IGNORECASE) {
  1023. modifiers += "i";
  1024. }
  1025. if (self.flags & MULTILINE) {
  1026. modifiers += "m";
  1027. }
  1028. if (!(self.flags & ASCII) && supports_unicode) {
  1029. modifiers += "u";
  1030. }
  1031. self._modifiers = modifiers + "g";
  1032. self._pattern = new RegExp(self.js_pattern, self._modifiers);
  1033. };
  1034. if (!RegexObject.prototype.__init__.__argnames__) Object.defineProperties(RegexObject.prototype.__init__, {
  1035. __argnames__ : {value: ["pattern", "flags"]}
  1036. });
  1037. RegexObject.__argnames__ = RegexObject.prototype.__init__.__argnames__;
  1038. RegexObject.__handles_kwarg_interpolation__ = RegexObject.prototype.__init__.__handles_kwarg_interpolation__;
  1039. RegexObject.prototype._do_search = function _do_search(pat, string, pos, endpos) {
  1040. var self = this;
  1041. var n;
  1042. pat.lastIndex = 0;
  1043. if (endpos !== null) {
  1044. string = string.slice(0, endpos);
  1045. }
  1046. while (true) {
  1047. n = pat.exec(string);
  1048. if (n === null) {
  1049. return null;
  1050. }
  1051. if (n.index >= pos) {
  1052. return new MatchObject(self, n, pos, endpos);
  1053. }
  1054. }
  1055. };
  1056. if (!RegexObject.prototype._do_search.__argnames__) Object.defineProperties(RegexObject.prototype._do_search, {
  1057. __argnames__ : {value: ["pat", "string", "pos", "endpos"]}
  1058. });
  1059. RegexObject.prototype.search = function search() {
  1060. var self = this;
  1061. var string = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1062. var pos = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? search.__defaults__.pos : arguments[1];
  1063. var endpos = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? search.__defaults__.endpos : arguments[2];
  1064. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1065. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1066. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "pos")){
  1067. pos = ρσ_kwargs_obj.pos;
  1068. }
  1069. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "endpos")){
  1070. endpos = ρσ_kwargs_obj.endpos;
  1071. }
  1072. return self._do_search(self._pattern, string, pos, endpos);
  1073. };
  1074. if (!RegexObject.prototype.search.__defaults__) Object.defineProperties(RegexObject.prototype.search, {
  1075. __defaults__ : {value: {pos:0, endpos:null}},
  1076. __handles_kwarg_interpolation__ : {value: true},
  1077. __argnames__ : {value: ["string", "pos", "endpos"]}
  1078. });
  1079. RegexObject.prototype.match = function match() {
  1080. var self = this;
  1081. var string = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1082. var pos = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? match.__defaults__.pos : arguments[1];
  1083. var endpos = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? match.__defaults__.endpos : arguments[2];
  1084. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1085. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1086. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "pos")){
  1087. pos = ρσ_kwargs_obj.pos;
  1088. }
  1089. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "endpos")){
  1090. endpos = ρσ_kwargs_obj.endpos;
  1091. }
  1092. return self._do_search(new RegExp("^" + self.js_pattern, self._modifiers), string, pos, endpos);
  1093. };
  1094. if (!RegexObject.prototype.match.__defaults__) Object.defineProperties(RegexObject.prototype.match, {
  1095. __defaults__ : {value: {pos:0, endpos:null}},
  1096. __handles_kwarg_interpolation__ : {value: true},
  1097. __argnames__ : {value: ["string", "pos", "endpos"]}
  1098. });
  1099. RegexObject.prototype.split = function split() {
  1100. var self = this;
  1101. var string = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1102. var maxsplit = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? split.__defaults__.maxsplit : arguments[1];
  1103. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1104. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1105. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "maxsplit")){
  1106. maxsplit = ρσ_kwargs_obj.maxsplit;
  1107. }
  1108. self._pattern.lastIndex = 0;
  1109. return string.split(self._pattern, maxsplit || undefined);
  1110. };
  1111. if (!RegexObject.prototype.split.__defaults__) Object.defineProperties(RegexObject.prototype.split, {
  1112. __defaults__ : {value: {maxsplit:0}},
  1113. __handles_kwarg_interpolation__ : {value: true},
  1114. __argnames__ : {value: ["string", "maxsplit"]}
  1115. });
  1116. RegexObject.prototype.findall = function findall(string) {
  1117. var self = this;
  1118. self._pattern.lastIndex = 0;
  1119. return ρσ_list_decorate(string.match(self._pattern) || []);
  1120. };
  1121. if (!RegexObject.prototype.findall.__argnames__) Object.defineProperties(RegexObject.prototype.findall, {
  1122. __argnames__ : {value: ["string"]}
  1123. });
  1124. RegexObject.prototype.finditer = function finditer(string) {
  1125. var self = this;
  1126. var pat, ans;
  1127. pat = new RegExp(this._pattern.source, this._modifiers);
  1128. ans = {'_string':string, '_r':pat, '_self':self};
  1129. ans[ρσ_iterator_symbol] = function () {
  1130. return this;
  1131. };
  1132. ans["next"] = function () {
  1133. var m;
  1134. m = this._r.exec(this._string);
  1135. if (m === null) {
  1136. return {'done':true};
  1137. }
  1138. return {'done':false, 'value':new MatchObject(this._self, m, 0, null)};
  1139. };
  1140. return ans;
  1141. };
  1142. if (!RegexObject.prototype.finditer.__argnames__) Object.defineProperties(RegexObject.prototype.finditer, {
  1143. __argnames__ : {value: ["string"]}
  1144. });
  1145. RegexObject.prototype.subn = function subn() {
  1146. var self = this;
  1147. var repl = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1148. var string = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
  1149. var count = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? subn.__defaults__.count : arguments[2];
  1150. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1151. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1152. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "count")){
  1153. count = ρσ_kwargs_obj.count;
  1154. }
  1155. var expand, num, matches, m, start, end;
  1156. expand = _expand;
  1157. if (typeof repl === "function") {
  1158. expand = (function() {
  1159. var ρσ_anonfunc = function (m, repl, gnm) {
  1160. return "" + repl(new MatchObject(self, m, 0, null));
  1161. };
  1162. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1163. __argnames__ : {value: ["m", "repl", "gnm"]}
  1164. });
  1165. return ρσ_anonfunc;
  1166. })();
  1167. }
  1168. this._pattern.lastIndex = 0;
  1169. num = 0;
  1170. matches = [];
  1171. while (count < 1 || num < count) {
  1172. m = this._pattern.exec(string);
  1173. if (m === null) {
  1174. break;
  1175. }
  1176. matches.push(m);
  1177. num += 1;
  1178. }
  1179. for (var i = matches.length - 1; i > -1; i--) {
  1180. m = matches[(typeof i === "number" && i < 0) ? matches.length + i : i];
  1181. start = m.index;
  1182. end = start + m[0].length;
  1183. string = string.slice(0, start) + expand(m, repl, self.group_name_map) + string.slice(end);
  1184. }
  1185. return [string, matches.length];
  1186. };
  1187. if (!RegexObject.prototype.subn.__defaults__) Object.defineProperties(RegexObject.prototype.subn, {
  1188. __defaults__ : {value: {count:0}},
  1189. __handles_kwarg_interpolation__ : {value: true},
  1190. __argnames__ : {value: ["repl", "string", "count"]}
  1191. });
  1192. RegexObject.prototype.sub = function sub() {
  1193. var self = this;
  1194. var repl = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1195. var string = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
  1196. var count = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? sub.__defaults__.count : arguments[2];
  1197. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1198. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1199. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "count")){
  1200. count = ρσ_kwargs_obj.count;
  1201. }
  1202. return self.subn(repl, string, count)[0];
  1203. };
  1204. if (!RegexObject.prototype.sub.__defaults__) Object.defineProperties(RegexObject.prototype.sub, {
  1205. __defaults__ : {value: {count:0}},
  1206. __handles_kwarg_interpolation__ : {value: true},
  1207. __argnames__ : {value: ["repl", "string", "count"]}
  1208. });
  1209. RegexObject.prototype.__repr__ = function __repr__ () {
  1210. return "<" + __name__ + "." + this.constructor.name + " #" + this.ρσ_object_id + ">";
  1211. };
  1212. RegexObject.prototype.__str__ = function __str__ () {
  1213. return this.__repr__();
  1214. };
  1215. Object.defineProperty(RegexObject.prototype, "__bases__", {value: []});
  1216. function _get_from_cache(pattern, flags) {
  1217. var key, ans;
  1218. if (ρσ_instanceof(pattern, RegExp)) {
  1219. pattern = pattern.source;
  1220. }
  1221. key = JSON.stringify([pattern, flags]);
  1222. if (has_prop(_re_cache_map, key)) {
  1223. return _re_cache_map[(typeof key === "number" && key < 0) ? _re_cache_map.length + key : key];
  1224. }
  1225. if (_re_cache_items.length >= 100) {
  1226. delete _re_cache_map[_re_cache_items.shift()];
  1227. }
  1228. ans = new RegexObject(pattern, flags);
  1229. _re_cache_map[(typeof key === "number" && key < 0) ? _re_cache_map.length + key : key] = ans;
  1230. _re_cache_items.push(key);
  1231. return ans;
  1232. };
  1233. if (!_get_from_cache.__argnames__) Object.defineProperties(_get_from_cache, {
  1234. __argnames__ : {value: ["pattern", "flags"]}
  1235. });
  1236. function compile() {
  1237. var pattern = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1238. var flags = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? compile.__defaults__.flags : arguments[1];
  1239. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1240. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1241. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "flags")){
  1242. flags = ρσ_kwargs_obj.flags;
  1243. }
  1244. return _get_from_cache(pattern, flags);
  1245. };
  1246. if (!compile.__defaults__) Object.defineProperties(compile, {
  1247. __defaults__ : {value: {flags:0}},
  1248. __handles_kwarg_interpolation__ : {value: true},
  1249. __argnames__ : {value: ["pattern", "flags"]}
  1250. });
  1251. function search() {
  1252. var pattern = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1253. var string = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
  1254. var flags = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? search.__defaults__.flags : arguments[2];
  1255. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1256. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1257. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "flags")){
  1258. flags = ρσ_kwargs_obj.flags;
  1259. }
  1260. return _get_from_cache(pattern, flags).search(string);
  1261. };
  1262. if (!search.__defaults__) Object.defineProperties(search, {
  1263. __defaults__ : {value: {flags:0}},
  1264. __handles_kwarg_interpolation__ : {value: true},
  1265. __argnames__ : {value: ["pattern", "string", "flags"]}
  1266. });
  1267. function match() {
  1268. var pattern = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1269. var string = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
  1270. var flags = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? match.__defaults__.flags : arguments[2];
  1271. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1272. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1273. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "flags")){
  1274. flags = ρσ_kwargs_obj.flags;
  1275. }
  1276. return _get_from_cache(pattern, flags).match(string);
  1277. };
  1278. if (!match.__defaults__) Object.defineProperties(match, {
  1279. __defaults__ : {value: {flags:0}},
  1280. __handles_kwarg_interpolation__ : {value: true},
  1281. __argnames__ : {value: ["pattern", "string", "flags"]}
  1282. });
  1283. function split() {
  1284. var pattern = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1285. var string = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
  1286. var maxsplit = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? split.__defaults__.maxsplit : arguments[2];
  1287. var flags = (arguments[3] === undefined || ( 3 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? split.__defaults__.flags : arguments[3];
  1288. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1289. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1290. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "maxsplit")){
  1291. maxsplit = ρσ_kwargs_obj.maxsplit;
  1292. }
  1293. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "flags")){
  1294. flags = ρσ_kwargs_obj.flags;
  1295. }
  1296. return _get_from_cache(pattern, flags).split(string);
  1297. };
  1298. if (!split.__defaults__) Object.defineProperties(split, {
  1299. __defaults__ : {value: {maxsplit:0, flags:0}},
  1300. __handles_kwarg_interpolation__ : {value: true},
  1301. __argnames__ : {value: ["pattern", "string", "maxsplit", "flags"]}
  1302. });
  1303. function findall() {
  1304. var pattern = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1305. var string = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
  1306. var flags = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? findall.__defaults__.flags : arguments[2];
  1307. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1308. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1309. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "flags")){
  1310. flags = ρσ_kwargs_obj.flags;
  1311. }
  1312. return _get_from_cache(pattern, flags).findall(string);
  1313. };
  1314. if (!findall.__defaults__) Object.defineProperties(findall, {
  1315. __defaults__ : {value: {flags:0}},
  1316. __handles_kwarg_interpolation__ : {value: true},
  1317. __argnames__ : {value: ["pattern", "string", "flags"]}
  1318. });
  1319. function finditer() {
  1320. var pattern = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1321. var string = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
  1322. var flags = (arguments[2] === undefined || ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? finditer.__defaults__.flags : arguments[2];
  1323. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1324. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1325. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "flags")){
  1326. flags = ρσ_kwargs_obj.flags;
  1327. }
  1328. return _get_from_cache(pattern, flags).finditer(string);
  1329. };
  1330. if (!finditer.__defaults__) Object.defineProperties(finditer, {
  1331. __defaults__ : {value: {flags:0}},
  1332. __handles_kwarg_interpolation__ : {value: true},
  1333. __argnames__ : {value: ["pattern", "string", "flags"]}
  1334. });
  1335. function sub() {
  1336. var pattern = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1337. var repl = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
  1338. var string = ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[2];
  1339. var count = (arguments[3] === undefined || ( 3 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? sub.__defaults__.count : arguments[3];
  1340. var flags = (arguments[4] === undefined || ( 4 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? sub.__defaults__.flags : arguments[4];
  1341. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1342. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1343. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "count")){
  1344. count = ρσ_kwargs_obj.count;
  1345. }
  1346. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "flags")){
  1347. flags = ρσ_kwargs_obj.flags;
  1348. }
  1349. return _get_from_cache(pattern, flags).sub(repl, string, count);
  1350. };
  1351. if (!sub.__defaults__) Object.defineProperties(sub, {
  1352. __defaults__ : {value: {count:0, flags:0}},
  1353. __handles_kwarg_interpolation__ : {value: true},
  1354. __argnames__ : {value: ["pattern", "repl", "string", "count", "flags"]}
  1355. });
  1356. function subn() {
  1357. var pattern = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1358. var repl = ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[1];
  1359. var string = ( 2 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[2];
  1360. var count = (arguments[3] === undefined || ( 3 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? subn.__defaults__.count : arguments[3];
  1361. var flags = (arguments[4] === undefined || ( 4 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? subn.__defaults__.flags : arguments[4];
  1362. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1363. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1364. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "count")){
  1365. count = ρσ_kwargs_obj.count;
  1366. }
  1367. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "flags")){
  1368. flags = ρσ_kwargs_obj.flags;
  1369. }
  1370. return _get_from_cache(pattern, flags).subn(repl, string, count);
  1371. };
  1372. if (!subn.__defaults__) Object.defineProperties(subn, {
  1373. __defaults__ : {value: {count:0, flags:0}},
  1374. __handles_kwarg_interpolation__ : {value: true},
  1375. __argnames__ : {value: ["pattern", "repl", "string", "count", "flags"]}
  1376. });
  1377. function escape(string) {
  1378. return string.replace(_RE_ESCAPE, "\\$&");
  1379. };
  1380. if (!escape.__argnames__) Object.defineProperties(escape, {
  1381. __argnames__ : {value: ["string"]}
  1382. });
  1383. function purge() {
  1384. _re_cache_map = {};
  1385. _re_cache_items = [];
  1386. };
  1387. ρσ_modules.re._ALIAS_MAP = _ALIAS_MAP;
  1388. ρσ_modules.re._ASCII_CONTROL_CHARS = _ASCII_CONTROL_CHARS;
  1389. ρσ_modules.re._HEX_PAT = _HEX_PAT;
  1390. ρσ_modules.re._NUM_PAT = _NUM_PAT;
  1391. ρσ_modules.re._GROUP_PAT = _GROUP_PAT;
  1392. ρσ_modules.re._NAME_PAT = _NAME_PAT;
  1393. ρσ_modules.re.I = I;
  1394. ρσ_modules.re.IGNORECASE = IGNORECASE;
  1395. ρσ_modules.re.L = L;
  1396. ρσ_modules.re.LOCALE = LOCALE;
  1397. ρσ_modules.re.M = M;
  1398. ρσ_modules.re.MULTILINE = MULTILINE;
  1399. ρσ_modules.re.D = D;
  1400. ρσ_modules.re.DOTALL = DOTALL;
  1401. ρσ_modules.re.U = U;
  1402. ρσ_modules.re.UNICODE = UNICODE;
  1403. ρσ_modules.re.X = X;
  1404. ρσ_modules.re.VERBOSE = VERBOSE;
  1405. ρσ_modules.re.DEBUG = DEBUG;
  1406. ρσ_modules.re.A = A;
  1407. ρσ_modules.re.ASCII = ASCII;
  1408. ρσ_modules.re.supports_unicode = supports_unicode;
  1409. ρσ_modules.re._RE_ESCAPE = _RE_ESCAPE;
  1410. ρσ_modules.re._re_cache_map = _re_cache_map;
  1411. ρσ_modules.re._re_cache_items = _re_cache_items;
  1412. ρσ_modules.re.error = error;
  1413. ρσ_modules.re.has_prop = has_prop;
  1414. ρσ_modules.re._expand = _expand;
  1415. ρσ_modules.re.transform_regex = transform_regex;
  1416. ρσ_modules.re.MatchObject = MatchObject;
  1417. ρσ_modules.re.RegexObject = RegexObject;
  1418. ρσ_modules.re._get_from_cache = _get_from_cache;
  1419. ρσ_modules.re.compile = compile;
  1420. ρσ_modules.re.search = search;
  1421. ρσ_modules.re.match = match;
  1422. ρσ_modules.re.split = split;
  1423. ρσ_modules.re.findall = findall;
  1424. ρσ_modules.re.finditer = finditer;
  1425. ρσ_modules.re.sub = sub;
  1426. ρσ_modules.re.subn = subn;
  1427. ρσ_modules.re.escape = escape;
  1428. ρσ_modules.re.purge = purge;
  1429. })();
  1430. var tag;
  1431. print("RapydScript-ng " + RapydScript.rs_version);
  1432. var re = ρσ_modules.re;
  1433. tag = this;
  1434. this.marker = null;
  1435. window.files = {};
  1436. function compile() {
  1437. var inputcode = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? compile.__defaults__.inputcode : arguments[0];
  1438. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1439. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1440. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "inputcode")){
  1441. inputcode = ρσ_kwargs_obj.inputcode;
  1442. }
  1443. var editor, options, file, session, result, code;
  1444. editor = window.editor;
  1445. options = (function(){
  1446. var ρσ_d = {};
  1447. ρσ_d["basedir"] = "__stdlib__";
  1448. ρσ_d["bare"] = true;
  1449. ρσ_d["js_version"] = 5;
  1450. ρσ_d["omit_baselib"] = true;
  1451. return ρσ_d;
  1452. }).call(this);
  1453. var ρσ_Iter0 = ρσ_Iterable(window.files);
  1454. for (var ρσ_Index0 = 0; ρσ_Index0 < ρσ_Iter0.length; ρσ_Index0++) {
  1455. file = ρσ_Iter0[ρσ_Index0];
  1456. if (file !== tag.title) {
  1457. (ρσ_expr_temp = RapydScript.file_data)[ρσ_bound_index("__stdlib__/" + file, ρσ_expr_temp)] = (ρσ_expr_temp = window.files)[(typeof file === "number" && file < 0) ? ρσ_expr_temp.length + file : file].getValue();
  1458. }
  1459. }
  1460. session = editor.getDoc();
  1461. if (tag.marker && !inputcode) {
  1462. tag.marker.clear();
  1463. }
  1464. try {
  1465. result = RapydScript.compile(inputcode || editor.getValue(), tag.title, options);
  1466. if (ρσ_in("print;", result)) {
  1467. throw new SyntaxError("Missing parentheses in call to \"print\"");
  1468. }
  1469. } catch (ρσ_Exception) {
  1470. ρσ_last_exception = ρσ_Exception;
  1471. if (ρσ_Exception instanceof Error) {
  1472. var e = ρσ_Exception;
  1473. console.log(e);
  1474. code = "print ('''" + e.name + ": " + e.message + "''')";
  1475. if (e.line && e.col && !inputcode) {
  1476. tag.marker = editor.markText(CodeMirror.Pos(e.line - 1, e.col), CodeMirror.Pos(e.line - 1, e.col + 1), (function(){
  1477. var ρσ_d = {};
  1478. ρσ_d["className"] = "error-marker";
  1479. return ρσ_d;
  1480. }).call(this));
  1481. editor.scrollIntoView(e.line - 1, e.col + 1);
  1482. }
  1483. result = compiler.compile(code);
  1484. } else {
  1485. throw ρσ_Exception;
  1486. }
  1487. }
  1488. return result;
  1489. };
  1490. if (!compile.__defaults__) Object.defineProperties(compile, {
  1491. __defaults__ : {value: {inputcode:null}},
  1492. __handles_kwarg_interpolation__ : {value: true},
  1493. __argnames__ : {value: ["inputcode"]}
  1494. });
  1495. window.compile = compile;
  1496. function init() {
  1497. var editor, iframe;
  1498. editor = CodeMirror.fromTextArea(this.refs.code, (function(){
  1499. var ρσ_d = {};
  1500. ρσ_d["lineNumbers"] = true;
  1501. ρσ_d["matchBrackets"] = true;
  1502. ρσ_d["indentUnit"] = 4;
  1503. ρσ_d["fixedGutter"] = false;
  1504. ρσ_d["mode"] = "python";
  1505. ρσ_d["styleActiveLine"] = true;
  1506. ρσ_d["theme"] = "solarized light";
  1507. return ρσ_d;
  1508. }).call(this));
  1509. editor.setOption("extraKeys", (function(){
  1510. var ρσ_d = {};
  1511. ρσ_d["Ctrl-Enter"] = run;
  1512. ρσ_d["Alt-R"] = run;
  1513. ρσ_d["F9"] = toggle_tray;
  1514. ρσ_d["Tab"] = function () {
  1515. if (editor.somethingSelected()) {
  1516. editor.indentSelection("add");
  1517. } else {
  1518. editor.execCommand("insertSoftTab");
  1519. }
  1520. };
  1521. return ρσ_d;
  1522. }).call(this));
  1523. iframe = this.refs.vmframe;
  1524. function load_datastore(activity) {
  1525. var datastore, savedSession;
  1526. datastore = activity.getDatastoreObject();
  1527. function check_load(error, metadata, data) {
  1528. var parsed_data, new_session, file;
  1529. if (data) {
  1530. window.files = {};
  1531. parsed_data = JSON.parse(data);
  1532. var ρσ_Iter1 = ρσ_Iterable(parsed_data);
  1533. for (var ρσ_Index1 = 0; ρσ_Index1 < ρσ_Iter1.length; ρσ_Index1++) {
  1534. file = ρσ_Iter1[ρσ_Index1];
  1535. if (parsed_data[(typeof file === "number" && file < 0) ? parsed_data.length + file : file]) {
  1536. new_session = CodeMirror.Doc(parsed_data[(typeof file === "number" && file < 0) ? parsed_data.length + file : file]);
  1537. (ρσ_expr_temp = window.files)[(typeof file === "number" && file < 0) ? ρσ_expr_temp.length + file : file] = new_session;
  1538. }
  1539. }
  1540. }
  1541. if (len(window.files) > 0) {
  1542. tag.title = list(parsed_data)[0];
  1543. editor.swapDoc((ρσ_expr_temp = window.files)[ρσ_bound_index(tag.title, ρσ_expr_temp)]);
  1544. editor.setOption("mode", "python");
  1545. }
  1546. tag.update();
  1547. };
  1548. if (!check_load.__argnames__) Object.defineProperties(check_load, {
  1549. __argnames__ : {value: ["error", "metadata", "data"]}
  1550. });
  1551. if (datastore.objectId !== undefined) {
  1552. datastore.loadAsText(check_load);
  1553. } else {
  1554. event_bus.trigger("enable-standalone");
  1555. savedSession = localStorage.getItem("jappySession");
  1556. if (savedSession !== null) {
  1557. check_load(null, null, savedSession);
  1558. }
  1559. }
  1560. tag.update();
  1561. window.activity = activity;
  1562. };
  1563. if (!load_datastore.__argnames__) Object.defineProperties(load_datastore, {
  1564. __argnames__ : {value: ["activity"]}
  1565. });
  1566. event_bus.on("activity-ready", load_datastore);
  1567. function update_tabs() {
  1568. var toolbar_div, toolbar_style, tabs_div, tabs_style, target_size;
  1569. toolbar_div = document.getElementById("main-toolbar");
  1570. if ((getComputedStyle(toolbar_div).display === "none" || typeof getComputedStyle(toolbar_div).display === "object" && ρσ_equals(getComputedStyle(toolbar_div).display, "none"))) {
  1571. return;
  1572. }
  1573. toolbar_style = window.getComputedStyle(toolbar_div);
  1574. tabs_div = document.getElementById("tabs");
  1575. tabs_style = window.getComputedStyle(tabs_div);
  1576. target_size = window.innerHeight - int(toolbar_style.height) - int(tabs_style.height);
  1577. editor.setSize(null, target_size);
  1578. if (ρσ_equals(len(window.files), 0)) {
  1579. tag.title = get_new_untitled();
  1580. window.files = (function(){
  1581. var ρσ_d = {};
  1582. ρσ_d[tag.title] = editor.getDoc();
  1583. return ρσ_d;
  1584. }).call(this);
  1585. }
  1586. };
  1587. this.on("update", update_tabs);
  1588. window.addEventListener("resize", update_tabs);
  1589. function make_do() {
  1590. tag.update();
  1591. };
  1592. event_bus.on("activity-not-ready", make_do);
  1593. function switchtab(e) {
  1594. var editbox;
  1595. if (tag.title !== e.target.innerHTML) {
  1596. tag.title = e.target.innerHTML;
  1597. editor.swapDoc((ρσ_expr_temp = window.files)[ρσ_bound_index(e.target.innerHTML, ρσ_expr_temp)]);
  1598. editor.setOption("mode", "python");
  1599. editor.focus();
  1600. } else {
  1601. e.target.style.display = "none";
  1602. editbox = document.createElement("input");
  1603. editbox.value = tag.title;
  1604. function rename_tab() {
  1605. if (!(ρσ_in(editbox.value, window.files))) {
  1606. (ρσ_expr_temp = window.files)[ρσ_bound_index(editbox.value, ρσ_expr_temp)] = editor.getDoc();
  1607. ρσ_delitem(window.files, tag.title);
  1608. tag.title = editbox.value;
  1609. }
  1610. e.target.style.display = "inline-block";
  1611. e.target.parentNode.removeChild(editbox);
  1612. tag.update();
  1613. editor.focus();
  1614. };
  1615. editbox.onblur = rename_tab;
  1616. editbox.onkeyup = (function() {
  1617. var ρσ_anonfunc = function (e) {
  1618. if ((e.keyCode === 13 || typeof e.keyCode === "object" && ρσ_equals(e.keyCode, 13))) {
  1619. editor.focus();
  1620. }
  1621. if ((e.keyCode === 27 || typeof e.keyCode === "object" && ρσ_equals(e.keyCode, 27))) {
  1622. editbox.value = tag.title;
  1623. editor.focus();
  1624. }
  1625. };
  1626. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1627. __argnames__ : {value: ["e"]}
  1628. });
  1629. return ρσ_anonfunc;
  1630. })();
  1631. e.target.parentNode.insertBefore(editbox, e.target);
  1632. editbox.focus();
  1633. if (tag.title.indexOf(".") > 0) {
  1634. editbox.setSelectionRange(0, tag.title.indexOf("."));
  1635. } else {
  1636. editbox.select();
  1637. }
  1638. }
  1639. };
  1640. if (!switchtab.__argnames__) Object.defineProperties(switchtab, {
  1641. __argnames__ : {value: ["e"]}
  1642. });
  1643. tag.switchtab = switchtab;
  1644. function closetab(e) {
  1645. var file, index;
  1646. if (len(window.files) > 1) {
  1647. file = tag.title;
  1648. index = list(window.files).index(file);
  1649. ρσ_delitem(window.files, file);
  1650. if (ρσ_in("__stdlib__/" + file, RapydScript.file_data)) {
  1651. ρσ_delitem(RapydScript.file_data, ("__stdlib__/" + file));
  1652. }
  1653. if (index > 0) {
  1654. index = index - 1;
  1655. }
  1656. tag.title = (ρσ_expr_temp = list(window.files))[(typeof index === "number" && index < 0) ? ρσ_expr_temp.length + index : index];
  1657. editor.swapDoc((ρσ_expr_temp = window.files)[ρσ_bound_index(tag.title, ρσ_expr_temp)]);
  1658. editor.setOption("mode", "python");
  1659. tag.update();
  1660. editor.focus();
  1661. }
  1662. };
  1663. if (!closetab.__argnames__) Object.defineProperties(closetab, {
  1664. __argnames__ : {value: ["e"]}
  1665. });
  1666. tag.closetab = closetab;
  1667. function get_new_untitled() {
  1668. var file = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? get_new_untitled.__defaults__.file : arguments[0];
  1669. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1670. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1671. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "file")){
  1672. file = ρσ_kwargs_obj.file;
  1673. }
  1674. var basename, extension, i;
  1675. basename = file.substr(0, file.indexOf("."));
  1676. extension = file.substr(file.indexOf("."));
  1677. i = 1;
  1678. while (ρσ_in(file, files)) {
  1679. file = basename + "-" + i + extension;
  1680. i = i + 1;
  1681. }
  1682. return file;
  1683. };
  1684. if (!get_new_untitled.__defaults__) Object.defineProperties(get_new_untitled, {
  1685. __defaults__ : {value: {file:"untitled.pyj"}},
  1686. __handles_kwarg_interpolation__ : {value: true},
  1687. __argnames__ : {value: ["file"]}
  1688. });
  1689. function newtab(e) {
  1690. var file, new_session;
  1691. file = get_new_untitled();
  1692. new_session = CodeMirror.Doc("");
  1693. (ρσ_expr_temp = window.files)[(typeof file === "number" && file < 0) ? ρσ_expr_temp.length + file : file] = new_session;
  1694. editor.swapDoc(new_session);
  1695. editor.setOption("mode", "python");
  1696. editor.focus();
  1697. tag.title = file;
  1698. tag.update();
  1699. };
  1700. if (!newtab.__argnames__) Object.defineProperties(newtab, {
  1701. __argnames__ : {value: ["e"]}
  1702. });
  1703. tag.newtab = newtab;
  1704. function toggle_tray() {
  1705. if ((getComputedStyle(iframe).display === "none" || typeof getComputedStyle(iframe).display === "object" && ρσ_equals(getComputedStyle(iframe).display, "none"))) {
  1706. event_bus.trigger("traybutton-open");
  1707. } else {
  1708. event_bus.trigger("traybutton-close");
  1709. }
  1710. };
  1711. event_bus.on("toggle-tray", toggle_tray);
  1712. this.refs.traybutton.onclick = toggle_tray;
  1713. function traybutton_close() {
  1714. iframe.style.display = "none";
  1715. iframe.style.width = "0%";
  1716. tag.refs.split.style.width = "100%";
  1717. tag.refs.traybutton.style.backgroundImage = "url(icons/tray-show.svg)";
  1718. };
  1719. event_bus.on("traybutton-close", traybutton_close);
  1720. function traybutton_open() {
  1721. iframe.style.display = "block";
  1722. iframe.style.width = "50%";
  1723. iframe.style.height = "100%";
  1724. tag.refs.split.style.width = "50%";
  1725. tag.refs.traybutton.style.backgroundImage = "url(icons/tray-hide.svg)";
  1726. };
  1727. event_bus.on("traybutton-open", traybutton_open);
  1728. function run() {
  1729. var js_output;
  1730. window.state = "run";
  1731. event_bus.trigger("traybutton-open");
  1732. riot.update();
  1733. event_bus.trigger("activity-save");
  1734. js_output = compile();
  1735. function write_script() {
  1736. var script = iframe.contentDocument.createElement("script");
  1737. script.innerHTML = js_output;
  1738. iframe.contentDocument.body.appendChild(script);
  1739. iframe.contentDocument.close();
  1740. };
  1741. iframe.onload = write_script;
  1742. iframe.contentWindow.location = "template.html";
  1743. return iframe;
  1744. };
  1745. event_bus.on("run-code", run);
  1746. function break_code() {
  1747. var iwindow, highestTimeoutId, i, highestIntervalId, inputs;
  1748. iwindow = iframe.contentWindow;
  1749. highestTimeoutId = iwindow.setTimeout(";");
  1750. for (var ρσ_Index2 = 0; ρσ_Index2 < highestTimeoutId; ρσ_Index2++) {
  1751. i = ρσ_Index2;
  1752. iwindow.clearTimeout(i);
  1753. }
  1754. highestIntervalId = iwindow.setInterval(";");
  1755. for (var ρσ_Index3 = 0; ρσ_Index3 < highestIntervalId; ρσ_Index3++) {
  1756. i = ρσ_Index3;
  1757. iwindow.clearInterval(i);
  1758. }
  1759. iwindow.stop();
  1760. iwindow.document.body.style.opacity = "0.5";
  1761. inputs = iwindow.document.getElementsByTagName("input");
  1762. var ρσ_Iter4 = ρσ_Iterable(inputs);
  1763. for (var ρσ_Index4 = 0; ρσ_Index4 < ρσ_Iter4.length; ρσ_Index4++) {
  1764. i = ρσ_Iter4[ρσ_Index4];
  1765. i.disabled = true;
  1766. }
  1767. iwindow.addEventListener("click", (function() {
  1768. var ρσ_anonfunc = function (ev) {
  1769. ev.stopPropagation();
  1770. };
  1771. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1772. __argnames__ : {value: ["ev"]}
  1773. });
  1774. return ρσ_anonfunc;
  1775. })(), true);
  1776. };
  1777. event_bus.on("break-code", break_code);
  1778. function clear_output() {
  1779. iframe.contentWindow.document.getElementById("__terminal__").innerHTML="";
  1780. };
  1781. event_bus.on("clear-output", clear_output);
  1782. function serialize() {
  1783. var result, file;
  1784. result = {};
  1785. var ρσ_Iter5 = ρσ_Iterable(window.files);
  1786. for (var ρσ_Index5 = 0; ρσ_Index5 < ρσ_Iter5.length; ρσ_Index5++) {
  1787. file = ρσ_Iter5[ρσ_Index5];
  1788. result[(typeof file === "number" && file < 0) ? result.length + file : file] = (ρσ_expr_temp = window.files)[(typeof file === "number" && file < 0) ? ρσ_expr_temp.length + file : file].getValue();
  1789. }
  1790. return JSON.stringify(result);
  1791. };
  1792. function save_without_datastore() {
  1793. localStorage.jappySession = serialize();
  1794. };
  1795. function save() {
  1796. var activity = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? save.__defaults__.activity : arguments[0];
  1797. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1798. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1799. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "activity")){
  1800. activity = ρσ_kwargs_obj.activity;
  1801. }
  1802. var datastore;
  1803. if (activity !== undefined) {
  1804. datastore = activity.getDatastoreObject();
  1805. }
  1806. if (activity && datastore.objectId !== undefined) {
  1807. datastore.setDataAsText(serialize());
  1808. function check_save(error) {
  1809. if (error === null) {
  1810. console.log("Saved");
  1811. } else {
  1812. console.log("NOT Saved");
  1813. }
  1814. };
  1815. if (!check_save.__argnames__) Object.defineProperties(check_save, {
  1816. __argnames__ : {value: ["error"]}
  1817. });
  1818. datastore.save(check_save);
  1819. } else {
  1820. save_without_datastore();
  1821. }
  1822. };
  1823. if (!save.__defaults__) Object.defineProperties(save, {
  1824. __defaults__ : {value: {activity:window.activity}},
  1825. __handles_kwarg_interpolation__ : {value: true},
  1826. __argnames__ : {value: ["activity"]}
  1827. });
  1828. event_bus.on("activity-save", save);
  1829. function example_load() {
  1830. var file = ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) ? undefined : arguments[0];
  1831. var execute = (arguments[1] === undefined || ( 1 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? example_load.__defaults__.execute : arguments[1];
  1832. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1833. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1834. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "execute")){
  1835. execute = ρσ_kwargs_obj.execute;
  1836. }
  1837. var url_base;
  1838. if (ρσ_in(file, window.files)) {
  1839. tag.title = file;
  1840. editor.swapDoc((ρσ_expr_temp = window.files)[(typeof file === "number" && file < 0) ? ρσ_expr_temp.length + file : file]);
  1841. editor.setOption("mode", "python");
  1842. tag.update();
  1843. editor.focus();
  1844. if (execute) {
  1845. if (window.innerWidth > 720) {
  1846. event_bus.trigger("run-code");
  1847. } else {
  1848. event_bus.trigger("run-fullscreen");
  1849. }
  1850. }
  1851. return;
  1852. }
  1853. url_base = window.location.protocol;
  1854. requirejs(ρσ_list_decorate([ "text!examples/" + file ]), (function() {
  1855. var ρσ_anonfunc = function (data) {
  1856. var new_session;
  1857. new_session = CodeMirror.Doc(data);
  1858. files[(typeof file === "number" && file < 0) ? files.length + file : file] = new_session;
  1859. editor.swapDoc(new_session);
  1860. editor.setOption("mode", "python");
  1861. tag.title = file;
  1862. tag.update();
  1863. editor.focus();
  1864. if (execute) {
  1865. if (window.innerWidth > 720) {
  1866. event_bus.trigger("run-code");
  1867. } else {
  1868. event_bus.trigger("run-fullscreen");
  1869. }
  1870. }
  1871. };
  1872. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1873. __argnames__ : {value: ["data"]}
  1874. });
  1875. return ρσ_anonfunc;
  1876. })());
  1877. };
  1878. if (!example_load.__defaults__) Object.defineProperties(example_load, {
  1879. __defaults__ : {value: {execute:true}},
  1880. __handles_kwarg_interpolation__ : {value: true},
  1881. __argnames__ : {value: ["file", "execute"]}
  1882. });
  1883. event_bus.on("example-load", example_load);
  1884. function process_file() {
  1885. var file, reader;
  1886. file = tag.refs.file_input.files[0];
  1887. reader = new FileReader;
  1888. if ((file.type === "application/zip" || typeof file.type === "object" && ρσ_equals(file.type, "application/zip"))) {
  1889. JSZip.loadAsync(file).then((function() {
  1890. var ρσ_anonfunc = function (zip) {
  1891. zip.forEach((function() {
  1892. var ρσ_anonfunc = function (relpath, zippedfile) {
  1893. var basepath;
  1894. if (ρσ_equals(relpath.slice(0, 4), "src/") && (relpath !== "src/" && (typeof relpath !== "object" || ρσ_not_equals(relpath, "src/")))) {
  1895. if (ρσ_equals(relpath.slice(-4), ".pyj")) {
  1896. basepath = relpath.slice(4);
  1897. zippedfile.async("text").then((function() {
  1898. var ρσ_anonfunc = function (data) {
  1899. var new_session;
  1900. new_session = CodeMirror.Doc(str(data));
  1901. (ρσ_expr_temp = window.files)[(typeof basepath === "number" && basepath < 0) ? ρσ_expr_temp.length + basepath : basepath] = new_session;
  1902. editor.swapDoc(new_session);
  1903. editor.setOption("mode", "python");
  1904. tag.title = basepath;
  1905. tag.update();
  1906. };
  1907. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1908. __argnames__ : {value: ["data"]}
  1909. });
  1910. return ρσ_anonfunc;
  1911. })());
  1912. }
  1913. }
  1914. };
  1915. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1916. __argnames__ : {value: ["relpath", "zippedfile"]}
  1917. });
  1918. return ρσ_anonfunc;
  1919. })());
  1920. };
  1921. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1922. __argnames__ : {value: ["zip"]}
  1923. });
  1924. return ρσ_anonfunc;
  1925. })());
  1926. } else {
  1927. reader.onload = function () {
  1928. return (function() {
  1929. var ρσ_anonfunc = function (evt) {
  1930. var new_session;
  1931. new_session = CodeMirror.Doc(evt.target.result);
  1932. (ρσ_expr_temp = window.files)[ρσ_bound_index(file.name, ρσ_expr_temp)] = new_session;
  1933. tag.update();
  1934. };
  1935. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  1936. __argnames__ : {value: ["evt"]}
  1937. });
  1938. return ρσ_anonfunc;
  1939. })();
  1940. }();
  1941. reader.readAsText(file);
  1942. }
  1943. };
  1944. tag.refs.file_input.onchange = process_file;
  1945. function import_file() {
  1946. tag.refs.file_input.click();
  1947. };
  1948. event_bus.on("import-file", import_file);
  1949. function restore(e) {
  1950. var code_editor, toolbar, toolbar_height, canvas;
  1951. code_editor = tag.refs.split;
  1952. code_editor.style.display = "block";
  1953. toolbar = document.getElementById("main-toolbar");
  1954. toolbar.style.display = "block";
  1955. e.target.parentNode.removeChild(e.target);
  1956. toolbar_height = window.getComputedStyle(toolbar)["height"];
  1957. canvas = document.getElementById("canvas");
  1958. canvas.style.top = toolbar_height;
  1959. if (window.innerWidth > 720) {
  1960. iframe.style.width = "50%";
  1961. } else {
  1962. window.state = "clean";
  1963. event_bus.trigger("clear-output");
  1964. event_bus.trigger("traybutton-close");
  1965. riot.update();
  1966. }
  1967. };
  1968. if (!restore.__argnames__) Object.defineProperties(restore, {
  1969. __argnames__ : {value: ["e"]}
  1970. });
  1971. function run_fullscreen() {
  1972. var execute = (arguments[0] === undefined || ( 0 === arguments.length-1 && arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true)) ? run_fullscreen.__defaults__.execute : arguments[0];
  1973. var ρσ_kwargs_obj = arguments[arguments.length-1];
  1974. if (ρσ_kwargs_obj === null || typeof ρσ_kwargs_obj !== "object" || ρσ_kwargs_obj [ρσ_kwargs_symbol] !== true) ρσ_kwargs_obj = {};
  1975. if (Object.prototype.hasOwnProperty.call(ρσ_kwargs_obj, "execute")){
  1976. execute = ρσ_kwargs_obj.execute;
  1977. }
  1978. var code_editor, toolbar, canvas, restore_button;
  1979. code_editor = tag.refs.split;
  1980. code_editor.style.display = "none";
  1981. toolbar = document.getElementById("main-toolbar");
  1982. toolbar.style.display = "none";
  1983. canvas = document.getElementById("canvas");
  1984. canvas.style.top = "0";
  1985. if (execute) {
  1986. run();
  1987. }
  1988. restore_button = document.createElement("button");
  1989. restore_button.onclick = restore;
  1990. restore_button.style.opacity = "0.5";
  1991. restore_button.style.position = "fixed";
  1992. restore_button.style.right = restore_button.style.top = "0";
  1993. restore_button.style.padding = "0px";
  1994. restore_button.style["border-radius"] = "0px";
  1995. restore_button.style["background-image"] = "url(icons/view-return.svg)";
  1996. restore_button.style["background-repeat"] = "no-repeat";
  1997. restore_button.style["background-position"] = "center";
  1998. restore_button.style.width = restore_button.style.height = "55px";
  1999. document.body.appendChild(restore_button);
  2000. iframe.style.width = "100%";
  2001. };
  2002. if (!run_fullscreen.__defaults__) Object.defineProperties(run_fullscreen, {
  2003. __defaults__ : {value: {execute:true}},
  2004. __handles_kwarg_interpolation__ : {value: true},
  2005. __argnames__ : {value: ["execute"]}
  2006. });
  2007. event_bus.on("run-fullscreen", run_fullscreen);
  2008. function save_zip() {
  2009. var bundle_name, js_output, url_base;
  2010. event_bus.trigger("activity-save", activity);
  2011. bundle_name = tag.title.slice(0, tag.title.indexOf("."));
  2012. js_output = compile();
  2013. url_base = window.location.protocol;
  2014. requirejs(ρσ_list_decorate([ "text!template" ]), (function() {
  2015. var ρσ_anonfunc = function (data) {
  2016. var script, enc_js, closing_tag, html, external_files, ref, match, zip, name;
  2017. script = iframe.contentDocument.createElement("script");
  2018. script.innerHTML = js_output;
  2019. enc_js = script.outerHTML + "\n";
  2020. closing_tag = data.indexOf("</body>");
  2021. html = data.slice(0, closing_tag) + enc_js + data.slice(closing_tag);
  2022. external_files = ρσ_list_decorate([]);
  2023. var ρσ_Iter6 = ρσ_Iterable(re.findall("script.*src=\"(.*)\"", data));
  2024. for (var ρσ_Index6 = 0; ρσ_Index6 < ρσ_Iter6.length; ρσ_Index6++) {
  2025. match = ρσ_Iter6[ρσ_Index6];
  2026. ref = "text!" + match.slice(match.indexOf("=") + 2, -1);
  2027. ref = ref.replace("lib/", "");
  2028. external_files.append(ref);
  2029. }
  2030. zip = new JSZip;
  2031. zip.file("index.html", html);
  2032. var ρσ_Iter7 = ρσ_Iterable(window.files);
  2033. for (var ρσ_Index7 = 0; ρσ_Index7 < ρσ_Iter7.length; ρσ_Index7++) {
  2034. name = ρσ_Iter7[ρσ_Index7];
  2035. zip.file("src/" + name, (ρσ_expr_temp = window.files)[(typeof name === "number" && name < 0) ? ρσ_expr_temp.length + name : name].getValue());
  2036. }
  2037. requirejs(external_files, function () {
  2038. var data = Array.prototype.slice.call(arguments, 0);
  2039. if (arguments[arguments.length-1] !== null && typeof arguments[arguments.length-1] === "object" && arguments[arguments.length-1] [ρσ_kwargs_symbol] === true) data.pop();
  2040. var index, file;
  2041. index = 0;
  2042. var ρσ_Iter8 = ρσ_Iterable(external_files);
  2043. for (var ρσ_Index8 = 0; ρσ_Index8 < ρσ_Iter8.length; ρσ_Index8++) {
  2044. file = ρσ_Iter8[ρσ_Index8];
  2045. file = file.slice(5);
  2046. if (!(ρσ_in("/", file))) {
  2047. file = "lib/" + file;
  2048. }
  2049. zip.file(file, data[(typeof index === "number" && index < 0) ? data.length + index : index]);
  2050. index = index + 1;
  2051. }
  2052. zip.generateAsync((function(){
  2053. var ρσ_d = {};
  2054. ρσ_d["type"] = "blob";
  2055. return ρσ_d;
  2056. }).call(this)).then((function() {
  2057. var ρσ_anonfunc = function (blob) {
  2058. saveAs(blob, bundle_name + ".zip");
  2059. };
  2060. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2061. __argnames__ : {value: ["blob"]}
  2062. });
  2063. return ρσ_anonfunc;
  2064. })());
  2065. });
  2066. };
  2067. if (!ρσ_anonfunc.__argnames__) Object.defineProperties(ρσ_anonfunc, {
  2068. __argnames__ : {value: ["data"]}
  2069. });
  2070. return ρσ_anonfunc;
  2071. })());
  2072. };
  2073. event_bus.on("save-as-zip", save_zip);
  2074. this.editor = editor;
  2075. window.editor = editor;
  2076. editor.focus();
  2077. };
  2078. this.on("mount", init);
  2079. });