root 1 year ago
parent
commit
28c79e8248
100 changed files with 6 additions and 22551 deletions
  1. 5 5
      src/renderer/cocoblockly-x/index.html
  2. 1 1
      src/renderer/cocoblockly-x/index.js
  3. BIN
      src/renderer/cocoblockly-x/python/.DS_Store
  4. 0 0
      src/renderer/cocoblockly-x/python/.gitignore
  5. 0 3
      src/renderer/cocoblockly-x/python/.gitmodules
  6. 0 4
      src/renderer/cocoblockly-x/python/.vscode/settings.json
  7. 0 9
      src/renderer/cocoblockly-x/python/20190114_python-blockly_plotting-temp-data.py
  8. 0 201
      src/renderer/cocoblockly-x/python/LICENSE
  9. 0 103
      src/renderer/cocoblockly-x/python/README.md
  10. 0 5
      src/renderer/cocoblockly-x/python/WebADB/.gitignore
  11. 0 9
      src/renderer/cocoblockly-x/python/WebADB/bootstrap.js
  12. 0 16
      src/renderer/cocoblockly-x/python/WebADB/index.html
  13. 0 0
      src/renderer/cocoblockly-x/python/WebADB/src/adb.js
  14. 0 0
      src/renderer/cocoblockly-x/python/WebADB/src/auth.js
  15. 0 69
      src/renderer/cocoblockly-x/python/WebADB/src/connector.js
  16. 0 20
      src/renderer/cocoblockly-x/python/WebADB/src/constants.js
  17. 0 102
      src/renderer/cocoblockly-x/python/WebADB/src/interface.js
  18. 0 108
      src/renderer/cocoblockly-x/python/WebADB/src/message.js
  19. 0 1217
      src/renderer/cocoblockly-x/python/ardublockly.css
  20. 0 423
      src/renderer/cocoblockly-x/python/ardublockly_blockly.js
  21. 0 157
      src/renderer/cocoblockly-x/python/ardublockly_lang.js
  22. 0 1247
      src/renderer/cocoblockly-x/python/ardublockly_toolbox.js
  23. 0 216
      src/renderer/cocoblockly-x/python/ardublocklyserver_ajax.js
  24. BIN
      src/renderer/cocoblockly-x/python/block/.DS_Store
  25. 0 14
      src/renderer/cocoblockly-x/python/block/.gitignore
  26. 0 54
      src/renderer/cocoblockly-x/python/block/.travis.yml
  27. 0 27
      src/renderer/cocoblockly-x/python/block/AUTHORS
  28. 0 44
      src/renderer/cocoblockly-x/python/block/CONTRIBUTING
  29. 0 176
      src/renderer/cocoblockly-x/python/block/LICENSE
  30. 0 38
      src/renderer/cocoblockly-x/python/block/README.md
  31. 0 111
      src/renderer/cocoblockly-x/python/block/all_tests.html
  32. 0 602
      src/renderer/cocoblockly-x/python/block/alltests.js
  33. 0 32
      src/renderer/cocoblockly-x/python/block/browser_capabilities.js
  34. 0 293
      src/renderer/cocoblockly-x/python/block/closure/bin/build/closurebuilder.py
  35. 0 189
      src/renderer/cocoblockly-x/python/block/closure/bin/build/depstree.py
  36. 0 127
      src/renderer/cocoblockly-x/python/block/closure/bin/build/depstree_test.py
  37. 0 212
      src/renderer/cocoblockly-x/python/block/closure/bin/build/depswriter.py
  38. 0 62
      src/renderer/cocoblockly-x/python/block/closure/bin/build/depswriter_test.py
  39. 0 161
      src/renderer/cocoblockly-x/python/block/closure/bin/build/jscompiler.py
  40. 0 122
      src/renderer/cocoblockly-x/python/block/closure/bin/build/jscompiler_test.py
  41. 0 132
      src/renderer/cocoblockly-x/python/block/closure/bin/build/source.py
  42. 0 165
      src/renderer/cocoblockly-x/python/block/closure/bin/build/source_test.py
  43. 0 78
      src/renderer/cocoblockly-x/python/block/closure/bin/build/treescan.py
  44. 0 590
      src/renderer/cocoblockly-x/python/block/closure/bin/calcdeps.py
  45. 0 39
      src/renderer/cocoblockly-x/python/block/closure/bin/labs/code/closure.el
  46. 0 31
      src/renderer/cocoblockly-x/python/block/closure/bin/labs/code/closure_test.el
  47. 0 171
      src/renderer/cocoblockly-x/python/block/closure/bin/labs/code/generate_jsdoc.py
  48. 0 167
      src/renderer/cocoblockly-x/python/block/closure/bin/labs/code/generate_jsdoc_test.py
  49. 0 31
      src/renderer/cocoblockly-x/python/block/closure/bin/labs/code/run_el_tests.sh
  50. 0 28
      src/renderer/cocoblockly-x/python/block/closure/bin/labs/code/run_py_tests.sh
  51. 0 25
      src/renderer/cocoblockly-x/python/block/closure/bin/logos/logo.svg
  52. 0 25
      src/renderer/cocoblockly-x/python/block/closure/bin/logos/logoandlabel.svg
  53. 0 221
      src/renderer/cocoblockly-x/python/block/closure/bin/scopify.py
  54. 0 82
      src/renderer/cocoblockly-x/python/block/closure/css/inlay/g-base.css
  55. 0 173
      src/renderer/cocoblockly-x/python/block/closure/css/inlay/g-fixed.css
  56. 0 253
      src/renderer/cocoblockly-x/python/block/closure/css/inlay/g-ratio.css
  57. 0 121
      src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/announcer.js
  58. 0 28
      src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/announcer_test.html
  59. 0 137
      src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/announcer_test.js
  60. 0 424
      src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/aria.js
  61. 0 28
      src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/aria_test.html
  62. 0 301
      src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/aria_test.js
  63. 0 389
      src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/attributes.js
  64. 0 63
      src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/datatables.js
  65. 0 219
      src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/roles.js
  66. 0 1665
      src/renderer/cocoblockly-x/python/block/closure/goog/array/array.js
  67. 0 25
      src/renderer/cocoblockly-x/python/block/closure/goog/array/array_test.html
  68. 0 1826
      src/renderer/cocoblockly-x/python/block/closure/goog/array/array_test.js
  69. 0 369
      src/renderer/cocoblockly-x/python/block/closure/goog/asserts/asserts.js
  70. 0 23
      src/renderer/cocoblockly-x/python/block/closure/goog/asserts/asserts_test.html
  71. 0 272
      src/renderer/cocoblockly-x/python/block/closure/goog/asserts/asserts_test.js
  72. 0 272
      src/renderer/cocoblockly-x/python/block/closure/goog/async/animationdelay.js
  73. 0 24
      src/renderer/cocoblockly-x/python/block/closure/goog/async/animationdelay_test.html
  74. 0 89
      src/renderer/cocoblockly-x/python/block/closure/goog/async/animationdelay_test.js
  75. 0 227
      src/renderer/cocoblockly-x/python/block/closure/goog/async/conditionaldelay.js
  76. 0 23
      src/renderer/cocoblockly-x/python/block/closure/goog/async/conditionaldelay_test.html
  77. 0 218
      src/renderer/cocoblockly-x/python/block/closure/goog/async/conditionaldelay_test.js
  78. 0 206
      src/renderer/cocoblockly-x/python/block/closure/goog/async/debouncer.js
  79. 0 23
      src/renderer/cocoblockly-x/python/block/closure/goog/async/debouncer_test.html
  80. 0 187
      src/renderer/cocoblockly-x/python/block/closure/goog/async/debouncer_test.js
  81. 0 193
      src/renderer/cocoblockly-x/python/block/closure/goog/async/delay.js
  82. 0 23
      src/renderer/cocoblockly-x/python/block/closure/goog/async/delay_test.html
  83. 0 173
      src/renderer/cocoblockly-x/python/block/closure/goog/async/delay_test.js
  84. 0 83
      src/renderer/cocoblockly-x/python/block/closure/goog/async/freelist.js
  85. 0 78
      src/renderer/cocoblockly-x/python/block/closure/goog/async/freelist_test.js
  86. 0 266
      src/renderer/cocoblockly-x/python/block/closure/goog/async/nexttick.js
  87. 0 23
      src/renderer/cocoblockly-x/python/block/closure/goog/async/nexttick_test.html
  88. 0 244
      src/renderer/cocoblockly-x/python/block/closure/goog/async/nexttick_test.js
  89. 0 136
      src/renderer/cocoblockly-x/python/block/closure/goog/async/run.js
  90. 0 144
      src/renderer/cocoblockly-x/python/block/closure/goog/async/run_test.js
  91. 0 198
      src/renderer/cocoblockly-x/python/block/closure/goog/async/throttle.js
  92. 0 23
      src/renderer/cocoblockly-x/python/block/closure/goog/async/throttle_test.html
  93. 0 161
      src/renderer/cocoblockly-x/python/block/closure/goog/async/throttle_test.js
  94. 0 138
      src/renderer/cocoblockly-x/python/block/closure/goog/async/workqueue.js
  95. 0 90
      src/renderer/cocoblockly-x/python/block/closure/goog/async/workqueue_test.js
  96. 0 2921
      src/renderer/cocoblockly-x/python/block/closure/goog/base.js
  97. 0 21
      src/renderer/cocoblockly-x/python/block/closure/goog/base_module_test.html
  98. 0 146
      src/renderer/cocoblockly-x/python/block/closure/goog/base_module_test.js
  99. 0 34
      src/renderer/cocoblockly-x/python/block/closure/goog/base_test.html
  100. 0 1907
      src/renderer/cocoblockly-x/python/block/closure/goog/base_test.js

+ 5 - 5
src/renderer/cocoblockly-x/index.html

@@ -622,7 +622,7 @@
                         </a> -->
                     </li>
                     <!-- App Center demo -->
-                    <li>
+                    <li style="display:none">
                         <a id="app_center_title" href="#app_center_modal" class="modal-trigger lang_resize"
                             style="position:relative">
                             <span id="app_center_title_demo">
@@ -631,7 +631,7 @@
                             </span>
                         </a>
                     </li>
-                    <li>
+                    <li style="display:none">
                         <a id="nav_learn" class='dropdown-button lang_resize' data-activates="learn_board"
                             style="position:relative">
                             <!-- <i class="material-icons left" style="margin-right: 5px;font-size: 34px;">help_outline</i> -->
@@ -772,7 +772,7 @@
                     <!-- <li>
                         <span class="vertical-separator"></span>
                     </li> -->
-                    <li>
+                    <li  style="display:none">
                         <a id="nav_account" href="#login_modal" class="modal-trigger lang_resize"
                             style="position:relative"
                             onclick="$('#api-key').html(''); $('#api-key').html($('#cloud_events').val()); document.getElementById('api-key').value = $('#cloud_events').val();">
@@ -1203,7 +1203,7 @@
                 </div>
             </div>
             <ul id="icon-tool" class="card-icon-area">
-                <li class="card-icon active hidden" onclick="changeSideCard('code')">
+                <li style=" display:none" class="card-icon active hidden" onclick="changeSideCard('code')">
                     <i class="material-icons media">build</i>
                 </li>
                 <li class="card-icon hidden" onclick="changeSideCard('monitor')">
@@ -1291,7 +1291,7 @@
                 <div><span class="translatable_copyright" style="color:#fff;">CocoRobo LTD © 2023 Copyright</span></div>
 
                 <div style="">
-                    <span id="update_log" style="cursor: pointer;">
+                    <span id="update_log" style="cursor: pointer; display:none">
                         <span class="translatable_update_logs" style="color: #fff;">更新日志</span>
                         <i class="material-icons sketch_name_icon"
                             style="margin-left:5px;cursor: pointer;position: relative;top: 7px;">message</i>

+ 1 - 1
src/renderer/cocoblockly-x/index.js

@@ -12,7 +12,7 @@ function initLanguage(langKey) {
 $("#modal_logout_btn").on("click", function () {
   // logout();
 });
-document.domain = "cocorobo.cn";
+//document.domain = "cocorobo.cn";
 function logout() {
   $.ajax(`${CCB.base_url}api/logout`, {
     type: "GET",

BIN
src/renderer/cocoblockly-x/python/.DS_Store


+ 0 - 0
src/renderer/cocoblockly-x/python/.gitignore


+ 0 - 3
src/renderer/cocoblockly-x/python/.gitmodules

@@ -1,3 +0,0 @@
-[submodule "python-tutor"]
-	path = python-tutor
-	url = https://github.com/pgbovine/OnlinePythonTutor.git

+ 0 - 4
src/renderer/cocoblockly-x/python/.vscode/settings.json

@@ -1,4 +0,0 @@
-{
-    "python.pythonPath": "C:\\Users\\Administrator\\AppData\\Local\\Programs\\Python\\Python37\\python.exe",
-    "git.ignoreLimitWarning": true
-}

+ 0 - 9
src/renderer/cocoblockly-x/python/20190114_python-blockly_plotting-temp-data.py

@@ -1,9 +0,0 @@
-import matplotlib.pyplot as plt
-
-
-AvgTemp = []
-for temp in ___:
-    AvgTemp.append(temp["Avg Temp"])
-print(AvgTemp)
-plt.plot(AvgTemp)
-plt.show()

+ 0 - 201
src/renderer/cocoblockly-x/python/LICENSE

@@ -1,201 +0,0 @@
-Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "{}"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright {yyyy} {name of copyright owner}
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.

+ 0 - 103
src/renderer/cocoblockly-x/python/README.md

@@ -1,103 +0,0 @@
-corgis-blockly
-==============
-
-![CORGIS BlockPy](/images/blockly-corgi-logo.png?raw=true "CORGIS BlockPy")
-
-BlockPy is a web-based Python environment that lets you work with blocks, text, or both. Designed for Data Science and equipped with powerful tools like the State Explorer and Guided Feedback, the goal of BlockPy is to let you solve authentic, real-world problems.
-
-The goal of BlockPy is to give you a gentle introduction to Python but eventually mature you into a more serious programming environment (such as Spyder or PyCharm). Long-term, we may support some game/animation design stuff that Scratch/Snap does, but that's not the real goal.
-
-The BlockPy project is aimed at solving some hard technical problems: having a block-based environment for a dynamic language can be tricky - are a given pair of square brackets representing list indexing or dictionary indexing? Our goal is to use advanced program analysis techniques to provide excellent support to learners.
-
-Overview
---------
-
-The core architecture of BlockPy is a synthesis of:
-
-* Blockly: a visual library for manipulating a block canvas that can generate equivalent textual code in a variety of languages
-* Skulpt: an in-browser Python-to-JavaScript compiler/intepreter, that aims to emulate the full language with precision if not speed.
-
-By combining these two technologies, we end up with a powerful system for writing Python code quickly. Everything is meant to run locally in the client, so there's no complexity of sandboxing students' code on the server.
-
-The major innovations are:
-
-* PythonToBlocks: by parsing the AST generated by Skulpt, we can build equivalent Blockly code, effectively allowing round-trips between text and blocks.
-* CORGIS Datsets: new blocks access real-world datasets (although currently these are only cached versions, for performance reasons).
-* Interactive Guided Problems: Problem text is given to students, along with teacher provided code that can do analysis on the students' code and make suggestions (e.g., observing that they haven't printed anything yet).
-* Data Explorer: The data explorer allows users to walk through their code.
-
-Installation
-------------
-
-First, clone it locally. This could take a little while.
-
-    > git clone https://github.com/RealTimeWeb/blockpy.git
-    
-
-You'll need to build Skulpt and Blockly. Both of these depend on the Closure Compiler, so you'll need to put that in the empty `closure-library` folder. You can follow the [Blockly instructions here] (https://developers.google.com/blockly/hacking/closure) , but the gist will be:
-
-    > wget https://github.com/google/closure-library/zipball/master -O closure.zip
-    > unzip closure.zip
-    
-CD into the new blockpy directory
-
-    > cd blockpy/
-
-And add the relevant subtree information to your .git/config:
-
-    > vi .git/config
-
-Replace the contents of that file with the information found here: http://pastebin.com/raw/QWpJjgU3 (TODO: show the actual commands used to set this)
-
-Next, you'll need to build Blockly:
-
-    > cp blockly/msg/en.js en.js
-    > cd blockly
-    > python build.py
-    > cd ..
-    > mv en.js blockly/msg/en.js
-    
-
-And then you'll build Skulpt:
-
-    > cd skulpt
-    > python skulpt.py dist
-    > cd ..
-    
-If you are on windows, you may encounter the message "No gzip executable", you can safely ignore this.
-    
-And now you should be able to try out the example file!
-
-    > start blockpy_new.html
-    
-The server has its own requirements.txt and uses a `python manage.py runserver`
-
-If you make edits to either Blockly or Skulpt, you'll need to rerun their build commands. Simiarly, if you edit ``src/interface.html`` than you'll need to rebuild it:
-
-    > python build.py
-    
-Otherwise, you should be able to edit the ``src/*.js`` files freely. To get a sense of the dependencies, check out the ``blockpy_new.html`` file and then the ``src/main.js`` file. These should be good starting points.
-
-
-Commands
---------
-
-Both Blockly and Skulpt are subtrees.
-
-Push changes to the subtrees' repos: 
-
-    > git subtree push --prefix=skulpt/ --squash skulpt master
-    > git subtree push --prefix=blockly/ --squash blockly master
-    > git subtree push --prefix=server/ --squash server master
-    > git subtree push --prefix=server/static/blockly-games --squash blockly_games master
-    
-Pull changes from upstream repos (e.g., official Blockly and Skulpt, our production server):
-
-    > git subtree pull --prefix=skulpt --squash skulpt_upstream master
-    > git subtree pull --prefix=blockly --squash blockly_upstream master
-    > git subtree pull --prefix=server --squash server master
-    > git subtree pull --prefix=server/static/blockly-games --squash blockly_games master
-    
-Note: if you get an error about a "fatal entry", make sure you don't have a trailing slash on the prefix!
-
-        

+ 0 - 5
src/renderer/cocoblockly-x/python/WebADB/.gitignore

@@ -1,5 +0,0 @@
-# JetBrains
-.idea/
-
-# pyenv
-.python-version

+ 0 - 9
src/renderer/cocoblockly-x/python/WebADB/bootstrap.js

@@ -1,9 +0,0 @@
-
-
-import {AdbInterface} from "./src/interface.js";
-
-document.getElementById('inputCatcher').addEventListener('click', async e => {
-    let adb_interface = await AdbInterface.new_device();
-    console.log(adb_interface);
-    await adb_interface.connect();
-}, false);

+ 0 - 16
src/renderer/cocoblockly-x/python/WebADB/index.html

@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-  <meta charset="UTF-8">
-  <script src="bootstrap.js" type="module"></script>
-  <style>
-    #inputCatcher {
-      width: 100vw;
-      height: 100vh;
-    }
-  </style>
-</head>
-<body>
-  <div id="inputCatcher">Click to begin ADB</div>
-</body>
-</html>

+ 0 - 0
src/renderer/cocoblockly-x/python/WebADB/src/adb.js


+ 0 - 0
src/renderer/cocoblockly-x/python/WebADB/src/auth.js


+ 0 - 69
src/renderer/cocoblockly-x/python/WebADB/src/connector.js

@@ -1,69 +0,0 @@
-import * as constants from './constants.js';
-
-export class AdbConnector {
-    constructor(device) {
-        this.device = device;
-    }
-
-    static async request_device(vendorId=undefined, productId=undefined) {
-        let base_filter = {
-            classCode: constants.INTERFACE_CLASS,
-            subclassCode: constants.INTERFACE_SUBCLASS,
-            protocolCode: constants.INTERFACE_PROTOCOL,
-        };
-        if (vendorId !== undefined) base_filter['vendorId'] = vendorId;
-        if (productId !== undefined) base_filter['productId'] = productId;
-
-        return await navigator.usb.requestDevice({filters: [base_filter]});
-    }
-
-    async connect_to_interface() {
-        if (!this.device.opened) await this.device.open();
-        let connected_interface_number = null;
-        for (let configuration of this.device.configurations) {
-            for (let usb_interface of configuration.interfaces) {
-                let adb_alternate = AdbConnector.get_adb_alternate(usb_interface);
-                if (adb_alternate) {
-                    await this.device.selectConfiguration(configuration.configurationValue);
-                    await this.device.claimInterface(usb_interface.interfaceNumber);
-                    await this.device.selectAlternateInterface(
-                        usb_interface.interfaceNumber, adb_alternate.alternateSetting
-                    );
-                    connected_interface_number = usb_interface.interfaceNumber;
-                    break;
-                }
-            }
-        }
-        return connected_interface_number;
-    }
-    static get_endpoint_numbers(adb_alternate) {
-        console.log(adb_alternate);
-        let read_endpoint = null,
-            write_endpoint = null;
-        for (let endpoint of adb_alternate.endpoints) {
-            if (endpoint.type === 'bulk') {
-                if (endpoint.direction === 'in') {
-                    read_endpoint = endpoint.endpointNumber;
-                } else if (endpoint.direction === 'out') {
-                    write_endpoint = endpoint.endpointNumber;
-                }
-            }
-        }
-        return {
-            read: read_endpoint,
-            write: write_endpoint,
-        };
-    }
-    static get_adb_alternate(usb_interface) {
-        for (let alternate of usb_interface.alternates) {
-            if (
-                alternate.interfaceClass === constants.INTERFACE_CLASS
-                && alternate.interfaceSubclass === constants.INTERFACE_SUBCLASS
-                && alternate.interfaceProtocol === constants.INTERFACE_PROTOCOL
-            ) {
-                return alternate;
-            }
-        }
-        return null;
-    }
-}

+ 0 - 20
src/renderer/cocoblockly-x/python/WebADB/src/constants.js

@@ -1,20 +0,0 @@
-
-// from adb.h
-export const
-    INTERFACE_CLASS = 0xFF,
-    INTERFACE_SUBCLASS = 0x42,
-    INTERFACE_PROTOCOL = 0x01,
-    VERSION = 0x01000000,
-    MAX_ADB_DATA = 4096,
-    AUTH_TOKEN = 1,
-    AUTH_SIGNATURE = 2,
-    AUTH_RSAPUBLICKEY = 3;
-
-export const
-    A_SYNC = 0x434e5953, //1129208147
-    A_CNXN = 0x4e584e43, //1314410051
-    A_AUTH = 0x48545541, //1213486401
-    A_OPEN = 0x4e45504f, //1313165391
-    A_OKAY = 0x59414b4f, //1497451343
-    A_CLSE = 0x45534c43, //1163086915
-    A_WRTE = 0x45545257; //1163154007

+ 0 - 102
src/renderer/cocoblockly-x/python/WebADB/src/interface.js

@@ -1,102 +0,0 @@
-import {AdbConnector} from './connector.js';
-import {AdbMessage, AdbResponse, CONNECTION, AUTH, MESSAGE_SIZE} from "./message.js";
-import {MAX_ADB_DATA, VERSION} from "./constants.js";
-import {AUTH_RSAPUBLICKEY, AUTH_SIGNATURE, AUTH_TOKEN} from "./constants.js";
-
-
-export class AdbInterface {
-    constructor(device, interface_number, read_endpoint, write_endpoint) {
-        this.device = device;
-        this._interface_number = interface_number;
-        this._read_endpoint = read_endpoint;
-        this._write_endpoint = write_endpoint;
-
-        this.banner = "WebADB";
-        this._rsa_key = null;
-    }
-
-    async get_rsa_key() {
-        if (!this._rsa_key) {
-            this._rsa_key = await window.crypto.subtle.generateKey(
-                {
-                    name: "RSASSA-PKCS1-v1_5",
-                    modulusLength: 2048,
-                    publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
-                    hash: {name: "SHA-1"},
-                },
-                false,
-                ["sign", "verify"],
-            )
-        }
-        return this._rsa_key;
-    }
-
-    static async new_device() {
-        let device = await AdbConnector.request_device(),
-            connector = new AdbConnector(device),
-            interface_number = await connector.connect_to_interface(),
-            alternate = device.configuration.interfaces[interface_number].alternate,
-            endpoints = AdbConnector.get_endpoint_numbers(alternate);
-        //console.log('clearing');
-        //await device.clearHalt('in', endpoints['read']);
-        console.log('clearing');
-        //await device.clearHalt('out', endpoints['write']);
-        console.log('cleared');
-        return new AdbInterface(
-            device,
-            interface_number,
-            endpoints['read'],
-            endpoints['write'],
-        );
-    }
-
-    async connect(read_attempts=5) {
-        let msg = new AdbMessage(CONNECTION, VERSION, MAX_ADB_DATA, `host::${this.banner}\0`);
-        await msg.send(this);
-        let final_response = null;
-        for (let attempt=0; attempt < read_attempts; attempt++) {
-            let response = await AdbResponse.from_device(this);
-            if ([CONNECTION, AUTH].indexOf(response.command) !== -1) {
-                final_response = response;
-                break;
-            }
-        }
-        if (!final_response) throw Error("Can't read connection response");
-        if (final_response.command === AUTH) {
-            await this.handle_auth(final_response);
-        }
-    }
-    async handle_auth(auth_response) {
-        let banner = auth_response.data,
-            rsa_key = await this.get_rsa_key(),
-            signed_token = await window.crypto.subtle.sign('RSASSA-PKCS1-v1_5', rsa_key.privateKey, banner),
-            msg, response;
-        if (!auth_response.arg0 === AUTH_TOKEN) {
-            throw Error("Unknown auth response");
-        }
-
-        console.log(signed_token);
-        msg = new AdbMessage(AUTH, AUTH_SIGNATURE, 0, signed_token);
-        await msg.send(this);
-        console.log('sent');
-        response = await AdbResponse.from_device(this);
-        console.log(response);
-
-        if (response.command === CONNECTION)
-            return;
-
-        msg = new AdbMessage(AUTH, AUTH_RSAPUBLICKEY, 0, rsa_key.publicKey + '\0');
-        await msg.send(this);
-        response = await AdbResponse.from_device(this);
-        if (response.command !== CONNECTION)
-            console.log(response);
-    }
-
-    async send(buffer) {
-        return await this.device.transferOut(this._write_endpoint, buffer);
-    }
-    async read(data_length) {
-        let resp = await this.device.transferIn(this._read_endpoint, data_length);
-        return resp;
-    }
-}

+ 0 - 108
src/renderer/cocoblockly-x/python/WebADB/src/message.js

@@ -1,108 +0,0 @@
-export {AdbMessage, AdbResponse, SYNC, CONNECTION, AUTH, OPEN, OKAY, CLOSE, WRITE, MESSAGE_SIZE};
-
-import * as constants from './constants.js';
-
-const
-    SYNC = constants.A_SYNC,
-    CONNECTION = constants.A_CNXN,
-    AUTH = constants.A_AUTH,
-    OPEN = constants.A_OPEN,
-    OKAY = constants.A_OKAY,
-    CLOSE = constants.A_CLSE,
-    WRITE = constants.A_CLSE;
-
-// messages are 6*ints
-const MESSAGE_SIZE = 6*4;
-
-class AdbMessage {
-    constructor(command, arg0, arg1, data) {
-        this.wire_id = command;
-        this.magic = this.wire_id ^ 0xFFFFFFFF;
-        this.arg0 = arg0;
-        this.arg1 = arg1;
-        if (typeof data === 'string') data = (new TextEncoder()).encode(data);
-        this.data = data;
-        console.log(this);
-    }
-
-    get checksum() {
-        let text_encoder = new TextEncoder(),
-            encoded_data = this.data, //text_encoder.encode(this.data),
-            sum_data = encoded_data.reduce((acc, cur) => {
-            return acc + cur;
-        }, 0);
-        return sum_data & 0xFFFFFFFF;
-    }
-
-    pack() {
-        // construct a message of 6 32bit little-endian integers
-        let ab = new ArrayBuffer(MESSAGE_SIZE),
-            dv = new DataView(ab);
-        dv.setInt32(0, this.wire_id, true);
-        dv.setInt32(4, this.arg0, true);
-        dv.setInt32(8, this.arg1, true);
-        dv.setInt32(12, this.data.length, true);
-        dv.setInt32(16, this.checksum, true);
-        dv.setInt32(20, this.magic, true);
-        return dv;
-    }
-
-    async send(adb_interface) {
-        let packed_message = this.pack(),
-            text_encoder = new TextEncoder();
-        await adb_interface.send(packed_message);
-        if (this.data) {
-            let encoded_data = this.data;//text_encoder.encode(this.data);
-            await adb_interface.send(encoded_data);
-        }
-    }
-}
-
-class AdbResponse {
-    constructor(transfer_result) {
-        let dv = transfer_result.data;
-
-        this.command = dv.getInt32(0, true);
-        this.arg0 = dv.getInt32(4, true);
-        this.arg1 = dv.getInt32(8, true);
-        this.data_length = dv.getInt32(12, true);
-        this.checksum = dv.getInt32(16, true);
-        this.magic = dv.getInt32(20, true);
-        this.data = null;
-    }
-
-    static async from_device(adb_interface) {
-        let transfer_result = await adb_interface.read(MESSAGE_SIZE),
-            adb_response = new AdbResponse(transfer_result);
-        console.log('fd', adb_response);
-        await adb_response.fetch_data(adb_interface);
-        console.log(adb_response);
-        return adb_response;
-    }
-
-    get text() {
-        if (!this.data) return '';
-        let text_decoder = new TextDecoder();
-        return text_decoder.decode(this.data);
-    }
-
-    async fetch_data(adb_interface) {
-        let data_left = this.data_length,
-            final_data = new ArrayBuffer(this.data_length),
-            data_view = new Int8Array(final_data),
-            view_position = 0;
-
-        while(data_left > 0) {
-            let response = (await adb_interface.read(data_left)).data,
-                received_length = response.byteLength;
-            data_left -= received_length;
-            for (let i=0; i < received_length; i++) {
-                data_view.set(
-                    [response.getInt8(i, true)],
-                    view_position++,
-                );
-            }
-        }
-        this.data = final_data;
-    }
-}

+ 0 - 1217
src/renderer/cocoblockly-x/python/ardublockly.css

@@ -1,1217 +0,0 @@
-/**
- * @license Licensed under the Apache License, Version 2.0 (the "License"):
- *          http://www.apache.org/licenses/LICENSE-2.0
- *
- * @fileoverview CSS file for the Ardublockly application.
- *
- * There are a lot of '!important' tags in this file as a lot of the rules set
- * here go against the css rules from the Materialize framework.
- */
-
-/******************/
-
-/*  Font sources  */
-
-/******************/
-
-@font-face {
-    font-family: "GT Walsheim Pro Trial";
-    /*
-    src: url("font/gt/GT-Walsheim-Pro-Trial-Regular.otf") format("opentype");
-*/
-}
-
-@font-face {
-    font-family: "GT Walsheim Pro Trial Bold";
-    src: url("font/gt/GT-Walsheim-Pro-Trial-Bold.otf") format("opentype");
-}
-
-/**********/
-
-/*  HTML  */
-
-/**********/
-
-html, body {
-    height: 100% !important;
-    padding: 0;
-    margin: 0;
-}
-
-body {
-    background-color: #fff;
-    -moz-user-select: -moz-none;
-    -khtml-user-select: none;
-    -webkit-user-select: none;
-    -ms-user-select: none;
-    user-select: none;
-}
-
-/*********************/
-
-/*  Arduino Colours  */
-
-/*********************/
-
-.arduino_teal {
-    background-color: #2c4fcd;
-}
-
-.arduino_teal_dark {
-    background-color: #2c4fcd;
-    /* background-color: #00878F; from community logo */
-}
-
-.arduino_teal_light {
-    background-color: #2c4fcd;
-}
-
-.arduino_orange {
-    background-color: #E47128;
-}
-
-.arduino_yellow {
-    /* background-color: rgba(255, 204, 51, 1); */
-    background-color: #f7c11e;
-    /* background-color: #E5AD24; from community logo */
-}
-
-.arduino_brown {
-    background-color: #8C7965;
-}
-
-.arduino_red {
-    background-color: #e03021;
-}
-
-/********************/
-
-/*  Navigation bar  */
-
-/********************/
-
-.nav-fixed {
-    border-radius: 0;
-    position: inherit;
-    margin-bottom: 30px;
-    z-index: 997 !important;
-}
-
-@media only screen and (min-width: 993px) {
-    body {
-        padding-top: 64px;
-    }
-    .nav-fixed {
-        position: fixed;
-        right: 0;
-        left: 0;
-        top: 0;
-        margin-bottom: 0px;
-        z-index: 997;
-    }
-}
-
-div.side-nav {
-    background-color: #eeeeee;
-    border-radius: 0px 0px 25px 0px;
-    border-left: 4px solid #ffffff;
-    border-bottom: 4px solid #dddddd;
-    border-right: 4px solid #dddddd;
-    border-bottom: 4px solid #dddddd;
-    line-height: 25px;
-}
-
-/* Side nav Logo */
-
-ul.side-nav li.logo {
-    text-align: center;
-    margin: 0px !important;
-    padding: 0px 0px !important;
-    border: none !important;
-    height: 145px;
-    background-color: transparent;
-}
-
-ul.side-nav li.logo:hover {
-    background-color: transparent;
-}
-
-ul.side-nav li.side-menu-end {
-    background-color: #eeeeee;
-    border-radius: 0px 0px 25px 0px;
-    border-left: 4px solid #ffffff;
-    border-bottom: 4px solid #dddddd;
-    border-right: 4px solid #dddddd;
-    border-bottom: 4px solid #dddddd;
-    line-height: 25px;
-}
-
-/************************************/
-
-/*  Blocks, Arduino, and XML areas  */
-
-/************************************/
-
-.content {
-    margin: 0;
-    padding: 0;
-    width: 100%;
-    background-color: #ffffff;
-}
-
-.height_transition {
-    transition: height 0.2s ease-out;
-    -ms-transition: height 0.2s ease-out;
-    -moz-transition: height 0.2s ease-out;
-    -webkit-transition: height 0.2s ease-out;
-}
-
-#blocks_panel {
-    padding: 0px;
-    position: relative !important;
-    min-height: 480px;
-}
-
-.blocks_panel_large {
-    height: -moz-calc(100vh - 111px);
-    /* Firefox  */
-    height: -webkit-calc(100vh - 111px);
-    /* WebKit   */
-    height: -o-calc(100vh - 111px);
-    /* Opera    */
-    height: calc(100vh - 111px);
-    /* Standard */
-}
-
-.blocks_panel_small {
-    height: -moz-calc(100vh - 350px);
-    /* Firefox  */
-    height: -webkit-calc(100vh - 350px);
-    /* WebKit   */
-    height: -o-calc(100vh - 350px);
-    /* Opera    */
-    height: calc(100vh - 350px);
-    /* Standard */
-}
-
-#content_blocks {
-    margin: 0;
-    padding: 0;
-    min-height: 480px;
-    height: -moz-calc(100vh - 111px);
-    /* Firefox  */
-    height: -webkit-calc(100vh - 111px);
-    /* WebKit   */
-    height: -o-calc(100vh - 111px);
-    /* Opera    */
-    height: calc(100vh - 111px);
-    /* Standard */
-}
-
-#content_xml {
-    resize: none;
-    outline: none;
-    border: none;
-    padding: 0px 0px;
-    font-family: monospace;
-    font-size: smaller;
-    overflow: hidden;
-    font-style: 0.2em !important;
-    min-height: 384px;
-    overflow: auto;
-}
-
-.content_xml_large {
-    height: -moz-calc(100vh - 286px);
-    /* Firefox  */
-    height: -webkit-calc(100vh - 286px);
-    /* WebKit   */
-    height: -o-calc(100vh - 286px);
-    /* Opera    */
-    height: calc(100vh - 286px);
-    /* Standard */
-}
-
-.content_xml_small {
-    height: -moz-calc(100vh - 446px);
-    /* Firefox  */
-    height: -webkit-calc(100vh - 446px);
-    /* WebKit   */
-    height: -o-calc(100vh - 446px);
-    /* Opera    */
-    height: calc(100vh - 446px);
-    /* Standard */
-}
-
-/* The materialize framework changes height of the div to show or hide */
-
-/* the collapsible elements. */
-
-#content_arduino {
-    resize: none;
-    outline: none;
-    border: none;
-    padding: 8px 8px;
-    font-size: 0.9rem;
-    font-family: monospace;
-    overflow: auto;
-    -moz-user-select: text;
-    -khtml-user-select: text;
-    -webkit-user-select: text;
-    -ms-user-select: text;
-    user-select: text;
-}
-
-.content_arduino_large {
-    height: -moz-calc(100vh - 280px);
-    /* Firefox  */
-    height: -webkit-calc(100vh - 280px);
-    /* WebKit   */
-    height: -o-calc(100vh - 280px);
-    /* Opera    */
-    height: calc(100vh - 280px);
-    /* Standard */
-}
-
-.content_arduino_small {
-    height: -moz-calc(100vh - 443px);
-    /* Firefox  */
-    height: -webkit-calc(100vh - 443px);
-    /* WebKit   */
-    height: -o-calc(100vh - 443px);
-    /* Opera    */
-    height: calc(100vh - 443px);
-    /* Standard */
-}
-
-/* serial monitor card form */
-
-div.card-serialMonitor {
-    height: 100%;
-    width: auto;
-    top: 0;
-    right: 0;
-    transition: 0.5s;
-    padding-top: 0px;
-}
-
-.content_arduino_SMonitor {
-    resize: none;
-    outline: none;
-    border: none;
-    padding: 0px 0px;
-    font-size: 0.9rem;
-    font-family: Nunito, sans-serif;
-    overflow: auto;
-    -moz-user-select: text;
-    -khtml-user-select: text;
-    -webkit-user-select: text;
-    -ms-user-select: text;
-    user-select: text;
-}
-
-content_arduino_SMonitor textarea {
-    height: -moz-calc(100vh - 595px);
-    /* Firefox  */
-    height: -webkit-calc(100vh - 595px);
-    /* WebKit   */
-    height: -o-calc(100vh - 595px);
-    /* Opera    */
-    height: calc(100vh - 595px);
-}
-
-/************************/
-
-/*  Modals and content  */
-
-/************************/
-
-/* Large modal section blocks */
-
-.modal_section {
-    margin: 24px 0px;
-    width: 100%;
-}
-
-/* Blocks tick label as a title */
-
-.modal_label_title {
-    font-size: 1.6rem !important;
-    color: black;
-}
-
-/* Blocks modal divider */
-
-#blocks_menu_body .divider {
-    margin-top: 4px;
-    margin-bottom: 8px;
-}
-
-/* Footer buttons padding */
-
-.modal_right_button {
-    margin: 0px 0px 0px 48px !important;
-}
-
-/* Small modal responsive design */
-
-.modal_small {
-    height: auto !important;
-    min-height: 200px;
-}
-
-.modal_small .modal-content {
-    margin-top: 0;
-    padding-top: 12px;
-    margin-bottom: 0;
-    padding-bottom: 0;
-}
-
-.modal_small input {
-    width: 100%;
-}
-
-.modal_small form {
-    height: auto !important;
-    min-height: 150px;
-}
-
-@media only screen and (min-width: 0) {
-    .modal_small {
-        max-width: 75% !important;
-        width: 75% !important;
-    }
-}
-
-@media only screen and (min-width: 601px) {
-    .modal_small {
-        max-width: 55% !important;
-        width: 55% !important;
-    }
-}
-
-@media only screen and (min-width: 993px) {
-    .modal_small {
-        max-width: 35% !important;
-        width: 35% !important;
-    }
-}
-
-/*******************************/
-
-/*  Modals for Serial Monitor  */
-
-/*******************************/
-
-.modal_serialMonitor {
-    height: auto !important;
-    min-height: 200px;
-    width: 500px;
-    position: fixed;
-    z-index: 1002;
-    overflow: hidden;
-    margin: 10px, 0, 10px, 0;
-}
-
-.modal_serialMonitor .modal-content {
-    margin-top: 0;
-    padding-top: 2px;
-    margin-right: 0;
-    padding-bottom: 1px;
-    margin-bottom: 0;
-    padding-bottom: 2px;
-    margin-left: 0;
-    padding-left: 1px;
-}
-
-.modal_serialMonitor .row {
-    margin-top: 0;
-    padding-top: 0;
-    margin-right: 0;
-    padding-bottom: 1px;
-    margin-bottom: 0;
-    padding-bottom: 0;
-    margin-left: 0;
-    padding-left: 1px;
-}
-
-.modal_serialMonitor input {
-    width: 90%;
-}
-
-.modal_serialMonitor form {
-    height: auto !important;
-    min-height: 150px;
-}
-
-.modal_serialMonitor .btn, .btn-large, .btn-flat {
-    border: none;
-    border-radius: 1px;
-    display: inline-block;
-    height: 36px;
-    line-height: 36px;
-    padding: 0 1rem;
-    text-transform: uppercase;
-    vertical-align: middle;
-    -webkit-tap-highlight-color: transparent;
-}
-
-/*******************************/
-
-/*  Sidebar for Serial Monitor  */
-
-/*******************************/
-
-.side-nav-serialMonitor .btn-title {
-    border: none;
-    border-radius: 0.2px;
-    display: inline-block;
-    background-color: #ffffff;
-    height: 36px;
-    line-height: 36px;
-    padding: 0 1rem;
-    text-transform: uppercase;
-    vertical-align: middle;
-    -webkit-tap-highlight-color: transparent;
-}
-
-.side-nav-serialMonitor .btn, .btn-flat {
-    border: none;
-    border-radius: 0.2px;
-    display: inline-block;
-    height: 36px;
-    line-height: 36px;
-    padding: 0 1rem;
-    vertical-align: middle;
-    -webkit-tap-highlight-color: transparent;
-}
-
-.side-nav-serialMonitor .row {
-    margin-top: 0;
-    padding-top: 0;
-    margin-right: 0;
-    padding-bottom: 1px;
-    margin-bottom: 3px;
-    padding-bottom: 0;
-    margin-left: 0;
-    padding-left: 2px;
-}
-
-.side-nav-serialMonitor [type="checkbox"].filled-in:checked+label:after {
-    top: 0;
-    width: 20px;
-    height: 20px;
-    border: 2px solid #64B5F6;
-    background-color: #64B5F6;
-    z-index: 0;
-}
-
-/*******************************/
-
-/*  Card for sidebar icon */
-
-/*******************************/
-
-.card-icon-area {
-    /* border-top: 1px solid #ddd; */
-    border-right: 1px solid #ddd;
-    border-left: 6px solid #3258cd;
-    /* border-bottom: 1px solid #ddd; */
-    background-color: #fff;
-    margin: 0;
-    width: 45px;
-    height: auto !important;
-    z-index: 995;
-    overflow: hidden;
-}
-
-.card-icon {
-    margin: 0;
-    width: 40px;
-    height: 40px;
-    border-bottom: 1px solid #ddd;
-    z-index: 9999;
-}
-
-/*******************************/
-
-/*  Card for Serial Monitor  */
-
-/*******************************/
-
-.card-serialMonitor .btn-title {
-    border: none;
-    border-radius: 0.2px;
-    display: inline-block;
-    background-color: #ffffff;
-    height: 36px;
-    line-height: 36px;
-    padding: 0 1rem;
-    vertical-align: middle;
-    -webkit-tap-highlight-color: transparent;
-}
-
-.card-serialMonitor .btn, .btn-flat {
-    border: none;
-    border-radius: 2px;
-    display: inline-block;
-    height: 35px;
-    line-height: 32px;
-    padding: 0.25rem 0.5rem;
-    vertical-align: middle;
-    -webkit-tap-highlight-color: transparent;
-}
-
-.card-serialMonitor .input-field {
-    position: relative;
-    margin-top: 0;
-}
-
-.card-serialMonitor .code-header {
-    height: 45px;
-    padding: 0px 6px;
-    border-bottom: 1px solid #ddd;
-}
-
-.card-serialMonitor .code-header {
-    color: #000200;
-}
-
-.card-serialMonitor .code-header .code-header-logo {
-    width: 3rem;
-    font-size: 1.6rem;
-    line-height: 2.5rem;
-    font-weight: bold;
-    display: block;
-    float: left;
-    text-align: center;
-    margin-right: 1rem;
-}
-
-.card-serialMonitor [type="checkbox"].filled-in:checked+label:after {
-    top: 0;
-    width: 20px;
-    height: 20px;
-    border: 2px solid #64B5F6;
-    background-color: #64B5F6;
-}
-
-/*****************/
-
-/*  Sketch name  */
-
-/*****************/
-
-.sketch_name_wrapper {
-    display: inline-block;
-    padding-left: 30px;
-}
-
-.sketch_name_icon {
-    display: inline !important;
-    font-size: 1.2rem !important;
-    padding-top: 3px;
-    margin-left: -5px;
-}
-
-.sketch_name {
-    width: auto !important;
-    max-width: 400px;
-    line-height: 64px;
-    height: 2rem !important;
-    font-size: 1.2rem !important;
-    border-bottom: 0px solid #EEE !important;
-    font-style: italic;
-}
-
-.sketch_name:focus {
-    border-bottom: 1px solid #EEE !important;
-}
-
-@media only screen and (min-width: 0px) and (max-width: 600px) {
-    .sketch_name {
-        max-width: 200px;
-    }
-    /* Remove the "Ardublockly title only leaving the sketch name */
-    .app_title {
-        display: none;
-    }
-}
-
-@media only screen and (min-width: 600px) {
-    .sketch_name {
-        max-width: 275px;
-    }
-}
-
-@media only screen and (min-width: 993px) {
-    .sketch_name {
-        max-width: 350px;
-    }
-}
-
-/************/
-
-/*  Others  */
-
-/************/
-
-/* Edit logo for code and xml collapsibles */
-
-.collapsible_logo {
-    width: 3rem;
-    font-size: 1.6rem;
-    line-height: 3rem;
-    font-weight: bold;
-    display: block;
-    float: left;
-    text-align: center;
-    margin-right: 1rem;
-}
-
-/* Colours for the new and deleted code highlighting */
-
-.code_highlight_new {
-    background-color: rgba(255, 204, 51, 0.5);
-    /* Arduino yellow 50% */
-}
-
-.code_highlight_deleted {
-    background-color: #FDBEBE;
-}
-
-/*****************************/
-
-/*  Overwriting Blockly CSS  */
-
-/*****************************/
-
-/* Blockly text for the following components:  */
-
-.blocklyTreeLabel,
-/* Toolbox        */
-
-.blocklyText,
-/* Block          */
-
-.goog-menuitem-content {
-    /* Drop down menu */
-    font-family: "Nunito", sans-serif!important;
-}
-
-/* Entire Blockly area, Toolbox dranw on top */
-
-.blocklySvg {
-    border-width: 0 !important;
-}
-
-/* Toolbox */
-
-.blocklyToolboxDiv {
-    border-color: #fcfcfc !important;
-    border-width: 0px 1px 0px 0px !important;
-    -webkit-border-radius: 0px 4px 4px 0px !important;
-    -moz-border-radius: 4px 4px 0px 0px !important;
-    border-radius: 0px 4px 4px 0px !important;
-    border: none !important;
-    margin: 0px !important;
-    padding: 0px 0px 0px 0px !important;
-    background: rgba(236, 241, 247, 0.8) !important;
-    /* background: rgba(47, 105, 202, .05) !important; */
-    -webkit-box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.05), 0 2px 10px 0 rgba(0, 0, 0, 0.05);
-    -moz-box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.05), 0 2px 10px 0 rgba(0, 0, 0, 0.05);
-    box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.05), 0 2px 10px 0 rgba(0, 0, 0, 0.05);
-    overflow: hidden !important;
-}
-
-.blocklyTreeRoot {
-    background: none !important;
-    border: none !important;
-    /*margin: 36px 0px 0px 0px !important;*/
-    margin: 0px 0px 0px 0px !important;
-    padding: 0px 1px !important;
-    height: 100%;
-    /* Standard */
-    overflow-x: hidden;
-    overflow-y: auto;
-}
-
-.blocklyTreeRow {
-    background: none !important;
-    border: none !important;
-    margin: 0px 0px !important;
-    padding: 0px 16px 0px 0px !important;
-    box-sizing: content-box !important;
-    padding-left: 0px !important;
-}
-
-.blocklyTreeSelected {
-    background-color: rgba(208, 240, 255, 0.75) !important;
-    /* arduino orange */
-    border: 5px #000 solid;
-}
-
-.blocklyTreeRow:not(.blocklyTreeSelected):hover, .blocklyTreeRowHover {
-    background-color: rgba(208, 240, 255, 0.75) !important;
-    /* arduino yellow */
-}
-
-.blocklyTreeSeparator {
-    padding: 0px !important;
-    margin: 0px !important;
-}
-
-/* Toolbox second column with blocks*/
-
-.blocklyFlyoutBackground {
-    fill: #d0f0ffbf !important;
-    fill-opacity: 0.9 !important;
-    -webkit-border-radius: 0px 4px 4px 0px !important;
-    -moz-border-radius: 0px 4px 4px 0px !important;
-    border-radius: 0px 4px 4px 0px !important;
-}
-
-/* Blockly scrollbars */
-
-.blocklyScrollbarKnob {
-    fill: #a1b2f0 !important;
-    fill-opacity: 0.7 !important;
-}
-
-.blocklyScrollbarBackground {
-    stroke-width: 0px !important;
-    fill: none !important;
-}
-
-/*********************************/
-
-/*  Overwriting Materialize CSS  */
-
-/*********************************/
-
-/* Modify container to have a larger width in all resolutions */
-
-.container {
-    width: 90%;
-    max-width: initial !important;
-    /*padding-left: 1.5rem;
-    padding-right: 1.5rem;*/
-    z-index: 997;
-}
-
-.navcontainer {
-    width: 90%;
-    max-width: initial !important;
-    padding-left: 1.5rem;
-    padding-right: 1.5rem;
-    z-index: 997;
-}
-
-@media only screen and (min-width: 601px) {
-    .container {
-        width: 95%;
-    }
-}
-
-@media only screen and (min-width: 993px) {
-    .container {
-        width: 100%;
-    }
-}
-
-@media only screen and (min-width: 1380px) {
-    .container {
-        width: 100%;
-    }
-}
-
-/* Maximize horizontal space for mobile */
-
-@media only screen and (min-width: 0px) and (max-width: 600px) {
-    body {
-        padding-top: 0px;
-    }
-    /* Expand to all visible horizontal space */
-    .container {
-        width: 100% !important;
-        padding: 0 !important;
-        margin: 0 !important;
-    }
-    nav {
-        margin: 0 !important;
-        padding: 0px 12px !important;
-    }
-    /* remove space between cards and navigation bar */
-    .col {
-        margin-top: -8px;
-    }
-}
-
-/* Increase the text size of the side menu */
-
-div.side-nav {
-    padding: 0px !important;
-    line-height: 100px !important;
-}
-
-ul.side-nav {
-    padding: 0px !important;
-    line-height: 64px !important;
-}
-
-ul.side-nav i {
-    font-size: 1.8rem !important;
-}
-
-ul.side-nav .collapsible {
-    margin: 0 !important;
-}
-
-/* Set the background effect in the side menu */
-
-ul.side-nav {
-    background-color: transparent;
-    box-shadow: none !important;
-}
-
-ul.side-nav li {
-    background-color: #eeeeee;
-}
-
-ul.side-nav li {
-    background-color: #eeeeee;
-    box-sizing: border-box;
-    -moz-box-sizing: border-box;
-    -webkit-box-sizing: border-box;
-    border-right: 2px solid #dddddd;
-    border-left: 2px solid #ffffff;
-}
-
-ul.side-nav li ul li ul {
-    cursor: pointer;
-    border: none !important;
-}
-
-ul.side-nav li ul li ul li {
-    border: none !important;
-}
-
-/* Add extra margin to the side menu button*/
-
-.button-collapse {
-    margin-right: 16px;
-}
-
-/* Increase the size of Materialize Modal in small resolutions */
-
-@media only screen and (max-width: 600px) {
-    .modal {
-        width: 80% !important;
-        max-width: 80% !important;
-    }
-}
-
-/* Why the hell does button large has a predefined background colour !! */
-
-.btn-large:hover {
-    background-color: inherit;
-}
-
-/* Circle clipper (loading animation) thickness */
-
-.circle-clipper .circle {
-    border-width: 4px;
-}
-
-/* Materialize messes with these, so reset them here */
-
-.blocklyHtmlInput {
-    border: none !important;
-    border-radius: 4px !important;
-    font-family: sans-serif !important;
-    height: 100% !important;
-    margin: 0 !important;
-    outline: none !important;
-    padding: 0 1px !important;
-    width: 100% !important;
-    background-color: white !important;
-}
-
-/*set switch button color*/
-
-.switch {
-    margin-right: 10px;
-}
-
-.switch label .lever:after {
-    background-color: #4d8bed;
-}
-
-.switch label .lever {
-    background-color: #D7D7D7;
-}
-
-.switch label input[type=checkbox]:checked+.lever {
-    background-color: #26a69a;
-}
-
-.switch label input[type=checkbox]:checked+.lever:after {
-    background-color: #26a69a;
-}
-
-/* add indicator to toolbox items */
-
-#\:1 {
-    border-left: 10px solid #4c97ff;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* list */
-
-#\:3 {
-    border-left: 10px solid #9d64fd;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* loops */
-
-#\:5 {
-    border-left: 10px solid #5472ea;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* math */
-
-#\:7 {
-    border-left: 10px solid #ffab2f;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* variables */
-
-#\:9 {
-    border-left: 10px solid #33cc99;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* text */
-
-#\:b {
-    border-left: 10px solid #40bfe4;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* lists */
-
-#\:d {
-    border-left: 10px solid #ff6381;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* functions */
-
-#\:f {
-    border-left: 10px solid #ff8b2c;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* i/o */
-
-#\:h {
-    border-left: 10px solid #ffd62c;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* time */
-
-#\:j {
-    border-left: 10px solid #27c04f;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* communication */
-
-#\:l {
-    padding-top: 0px;
-    border-left: #50ec7a
-}
-
-/*newly added*/
-
-/*
-.blocklyTreeSelected {
-  background-color: #2c4fce !important;
-}*/
-
-#\:l>.blocklyTreeRow {
-    background-color: #4d8bed !important;
-    color: #ffffff;
-}
-
-/* add indicator to wifi_toolbox items */
-
-/* logic */
-
-#\:2a {
-    border-left: 10px solid #4c97ff;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* loops */
-
-#\:2c {
-    border-left: 10px solid #9d64fd;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* math */
-
-#\:2e {
-    border-left: 10px solid #5472ea;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* variables */
-
-#\:2g {
-    border-left: 10px solid #ffab2f;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* text */
-
-#\:2i {
-    border-left: 10px solid #33cc99;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* lists */
-
-#\:2k {
-    border-left: 10px solid #40bfe4;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* functions */
-
-#\:2m {
-    border-left: 10px solid #ff6381;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* time */
-
-#\:2o {
-    border-left: 10px solid #ffd62c;
-    border-bottom: 1px solid #eaeaea;
-}
-
-/* communication */
-
-#\:2q {
-    border-left: 10px solid #27c04f;
-    border-bottom: 1px solid #eaeaea;
-}
-
-#\:2s {
-    padding-top: 0px;
-}
-
-#\:2s>.blocklyTreeRow {
-    background-color: #e44c4c !important;
-    color: #ffffff;
-}
-
-.switch_tooltip {
-    top: -10px;
-    background-color: black;
-    color: white;
-    border-radius: 5px;
-    opacity: 0;
-    position: absolute;
-    -webkit-transition: opacity 0.5s;
-    -moz-transition: opacity 0.5s;
-    -ms-transition: opacity 0.5s;
-    -o-transition: opacity 0.5s;
-    transition: opacity 0.5s;
-}
-
-.switch:hover .tooltip {
-    opacity: 1;
-}
-
-.add_margin {
-    margin: 0 10px 0 10px;
-}
-
-.blocklyTreeRoot {
-    height: 100%;
-}
-
-.resize {
-    width: 90%;
-    margin: 10px 5% 10px 5%;
-    height: 30px;
-    background-color: #5b8ae7;
-}
-
-.languages_logo {
-    width: 36px;
-    margin-top: 14px;
-}
-
-.lang_resize {
-    height: 64px;
-}
-
-.status_detector {
-    display: inline-block;
-    margin-left: 50px;
-}
-
-.board_detector, .port_detector {
-    display: inline-block;
-    /*overwrite modal_section class*/
-    margin: 0 10px;
-    width: auto;
-}
-
-.board_detector {
-    width: 250px;
-}
-
-.button_toggle_toolbox_on {
-    position: absolute;
-    margin: 0 !important;
-    padding: 0 !important;
-    left: 12px;
-    top: 8px;
-    text-align: center;
-    font-size: 1.5rem !important;
-    z-index: 5;
-    border-color: #e0e0e0 !important;
-    border-width: 1px !important;
-    -webkit-border-radius: 4px 4px 4px 4px !important;
-    -moz-border-radius: 4px 4px 4px 4px !important;
-    border-radius: 4px 4px 4px 4px !important;
-    background: rgba(98, 174, 178, .2) !important;
-    /* Arduino Light Teal */
-    -webkit-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
-    -moz-box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
-    box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
-    transition: background 0.3s linear, box-shadow 0.3s linear, border-width 0.3s linear;
-    -ms-transition: background 0.3s linear, box-shadow 0.3s linear, border-width 0.3s linear;
-    -moz-transition: background 0.3s linear, -moz-box-shadow 0.3s linear, border-width 0.3s linear;
-    -webkit-transition: background 0.3s linear, -webkit-box-shadow 0.3s linear, border-width 0.3s linear;
-}
-
-.button_toggle_toolbox_off {
-    position: absolute;
-    margin: 0 !important;
-    padding: 0px !important;
-    left: 12px;
-    top: 8px;
-    text-align: center;
-    font-size: 1.5rem !important;
-    z-index: 5;
-}

+ 0 - 423
src/renderer/cocoblockly-x/python/ardublockly_blockly.js

@@ -1,423 +0,0 @@
-/**
- * @license Licensed under the Apache License, Version 2.0 (the "License"):
- *          http://www.apache.org/licenses/LICENSE-2.0
- *
- * @fileoverview Ardublockly JavaScript for the Blockly resources and bindings.
- */
-'use strict';
-
-/** Create a namespace for the application. */
-var Ardublockly = Ardublockly || {};
-
-/**
- * Blockly main workspace.
- * @type Blockly.WorkspaceSvg
- */
-Ardublockly.workspace = null;
-
-/**
- * Blockly workspace toolbox XML.
- * @type Element
- */
-Ardublockly.xmlTree = null;
-
-Ardublockly.injectBlockly = function (blocklyEl, toolboxXml, blocklyPath) {
-    // Remove any trailing slashes in the blockly path
-    if (blocklyPath.substr(-1) === '/') {
-        blocklyPath = blocklyPath.slice(0, -1);
-    }
-    // Ardublockly.xmlTree = Blockly.Xml.textToDom(toolboxXml);
-
-    // The Toolbox menu language is edited directly from the XML nodes.
-    Ardublockly.updateToolboxLanguage(toolboxXml);
-    Ardublockly.workspace = Blockly.inject(blocklyEl, {
-        collapse: true,
-        comments: true,
-        css: true,
-        disable: true,
-        grid: false,
-        maxBlocks: Infinity,
-        media: blocklyPath + '/media/',
-        rtl: false,
-        scrollbars: true,
-        sounds: true,
-        toolbox: Ardublockly.xmlTree,
-        trashcan: true,
-        zoom: {
-            controls: true,
-            wheel: false,
-            startScale: 1.0,
-            maxScale: 2,
-            minScale: 0.2,
-            scaleSpeed: 1.2
-        }
-    });
-
-};
-
-/** Binds the event listeners relevant to Blockly. */
-Ardublockly.bindBlocklyEventListeners = function () {
-    blockpy.components.editor.blockly.addChangeListener(Ardublockly.renderContent);
-
-    // Ensure the Blockly workspace resizes accordingly
-    window.addEventListener('resize',
-        function () { Blockly.asyncSvgResize(blockpy.components.editor.blockly); }, false);
-};
-
-/** @return {!string} Generated Arduino code from the Blockly workspace. */
-Ardublockly.generateArduino = function () {
-    return Blockly.Python.workspaceToCode(blockpy.components.editor.blockly);
-};
-
-/** @return {!string} Generated XML code from the Blockly workspace. */
-Ardublockly.generateXml = function () {
-    var xmlDom = Blockly.Xml.workspaceToDom(blockpy.components.editor.blockly);
-    //add tag for different mode 
-    var tag = CCB.mode ? "main" : "wifi"
-    var xmlText = tag + "$" + Blockly.Xml.domToPrettyText(xmlDom);
-    return xmlText;
-};
-
-
-Ardublockly.loadXmlBlockFile = function (xmlFile, cbSuccess, cbError) {
-    var request = Ardublockly.ajaxRequest();
-    var requestCb = function () {
-        if (request.readyState == 4) {
-            if (request.status == 200) {
-                var result_xml = request.responseText;
-                //if file has tag(main/wifi)
-                if (request.responseText.indexOf('$') == 4) {
-                    result_xml = request.responseText.substr(5);
-                }
-                var success = Ardublockly.replaceBlocksfromXml(result_xml);
-                cbSuccess(success);
-            } else {
-                cbError();
-            }
-        }
-    };
-    try {
-        request.open('GET', xmlFile, true);
-        request.onreadystatechange = requestCb;
-        request.send(null);
-    } catch (e) {
-        cbError();
-    }
-};
-
-
-Ardublockly.replaceBlocksfromXml = function (blocksXml) {
-    var xmlDom = null;
-    try {
-        xmlDom = Blockly.Xml.textToDom(blocksXml);
-    } catch (e) {
-        return false;
-    }
-    blockpy.components.editor.blockly.clear();
-    var sucess = false;
-    if (xmlDom) {
-        sucess = Ardublockly.loadBlocksfromXmlDom(xmlDom);
-    }
-    return sucess;
-};
-
-/**
- * Parses the XML from its argument input to generate and add blocks to the
- * Blockly workspace.
- * @param {!string} blocksXmlDom String of XML DOM code for the blocks.
- * @return {!boolean} Indicates if the XML into blocks parse was successful.
- */
-Ardublockly.loadBlocksfromXmlDom = function (blocksXmlDom) {
-    // try {
-    //     Blockly.Xml.domToWorkspace(blocksXmlDom, blockpy.components.editor.blockly);
-    // } catch (e) {
-    //     return false;
-    // }
-    // return true;
-    Blockly.Xml.domToWorkspace(blocksXmlDom, blockpy.components.editor.blockly);
-    return !Blockly.Xml.getLoadingXmlErr();
-};
-
-/**
- * Save blocks into session storage. Note that MSIE 11 does not support
- * sessionStorage on file:// URLs.
- */
-Ardublockly.saveSessionStorageBlocks = function () {
-    if (window.sessionStorage) {
-        var xml = Blockly.Xml.workspaceToDom(blockpy.components.editor.blockly);
-        var text = Blockly.Xml.domToText(xml);
-        window.sessionStorage.loadOnceBlocks = text;
-    }
-};
-
-/** Load blocks saved on session storage and deletes them from storage. */
-Ardublockly.loadSessionStorageBlocks = function () {
-    try {
-        var loadOnce = window.sessionStorage.loadOnceBlocks;
-    } catch (e) {
-        // Firefox sometimes throws a SecurityError when accessing sessionStorage.
-        // Restarting Firefox fixes this, so it looks like a bug.
-        var loadOnce = null;
-    }
-    if (loadOnce) {
-        delete window.sessionStorage.loadOnceBlocks;
-        var xml = Blockly.Xml.textToDom(loadOnce);
-        Blockly.Xml.domToWorkspace(xml, blockpy.components.editor.blockly);
-    }
-};
-
-
-/**
- * Save blocks into local storage. Note that MSIE 11 does not support
- * LocalStorage on file:// URLs.
- */
-Ardublockly.saveLocalStorageBlocks = function () {
-    if (window.sessionStorage) {
-        var xml = Blockly.Xml.workspaceToDom(blockpy.components.editor.blockly);
-        var text = Blockly.Xml.domToText(xml);
-        window.localStorage.loadOnceBlocks = text;
-    }
-};
-/** Load blocks saved on loacl storage and deletes them from storage. */
-Ardublockly.loadLocalStorageBlocks = function () {
-    try {
-        var loadOnce = window.localStorage.loadOnceBlocks;
-    } catch (e) {
-        // Firefox sometimes throws a SecurityError when accessing sessionStorage.
-        // Restarting Firefox fixes this, so it looks like a bug.
-        var loadOnce = null;
-    }
-    if (loadOnce) {
-        delete window.localStorage.loadOnceBlocks;
-        var xml = Blockly.Xml.textToDom(loadOnce);
-        Blockly.Xml.domToWorkspace(xml, blockpy.components.editor.blockly);
-    }
-};
-
-/** Discard all blocks from the workspace. */
-Ardublockly.discardAllBlocks = function () {
-    var blockCount = blockpy.components.editor.blockly.getAllBlocks().length;
-    var is_delete = false;
-    if (blockCount == 1) {
-        blockpy.components.editor.blockly.clear();
-        Ardublockly.renderContent();
-    } else if (blockCount > 1) {
-        Ardublockly.alertMessage(
-            Ardublockly.getLocalStr('discardBlocksTitle'),
-            Ardublockly.getLocalStr('discardBlocksBody').replace('%1', blockCount),
-            true,
-            function () {
-                blockpy.components.editor.blockly.clear();
-                Ardublockly.renderContent();
-            });
-    }
-};
-
-/** @return {!boolean} Indicates if the Blockly workspace has blocks. */
-Ardublockly.isWorkspaceEmpty = function () {
-    return blockpy.components.editor.blockly.getAllBlocks().length ? false : true;
-};
-
-/**
- * Changes the Arduino board profile if different from the currently set one.
- * @param {string} newBoard Name of the new profile to set.
- */
-Ardublockly.changeBlocklyArduinoBoard = function (newBoard) {
-    if (Blockly.Python.Boards.selected !== Blockly.Python.Boards[newBoard]) {
-        Blockly.Python.Boards.changeBoard(blockpy.components.editor.blockly, newBoard);
-    }
-};
-
-/** Update the toolbox categories language. */
-Ardublockly.updateToolboxLanguage = function (data) {
-    var categories = ['catLogic', 'catLoops', 'catMath', 'catText',
-        'catVariables', 'catDefine', 'catFunctions', 'catInputOutput',
-        'catTime', 'catAudio', 'catMotors', 'catComms', 'catFASTLED', 'catTouch', 'catHCI',
-        'catENV', 'catMOTOR', 'catROBOT', 'catLists', 'catMOTION', 'catMainWifi',
-        'catCloudData', 'catWifiClient', 'catWifiWebServices', 'catWifiComms', 'catNetwork', 'catEasyMode', 'catBlynk', "ExtendedFunction"
-    ];
-    Ardublockly.xmlTree = Blockly.Xml.textToDom(data)
-    var categoryNodes = Ardublockly.xmlTree.getElementsByTagName('category');
-    for (var i = 0, cat; cat = categoryNodes[i]; i++) {
-        var catId = cat.getAttribute('id');
-        var catText = Ardublockly.getLocalStr(catId);
-        if (catText) {
-            cat.setAttribute('name', catText);
-        }
-    }
-};
-
-/**
- * Adds a category to the current toolbox.
- * @param {!string} categoryTitle Toolbox category title.
- * @param {!Element} categoryDom Toolbox category to add add the end of tree.
- */
-Ardublockly.addToolboxCategory = function (categoryTitle, categoryDom) {
-    categoryDom.id = 'cat' + categoryTitle.replace(/\s+/g, '');
-    categoryDom.setAttribute('name', categoryTitle);
-    Ardublockly.xmlTree.appendChild(document.createElement('sep'));
-    Ardublockly.xmlTree.appendChild(categoryDom);
-    blockpy.components.editor.blockly.updateToolbox(Ardublockly.xmlTree);
-};
-
-/**
- * Removes a category to the current toolbox.
- * @param {!String} categoryTitle Toolbox category name to remove from tree.
- */
-Ardublockly.removeToolboxCategory = function (categoryTitle) {
-    var categoryId = 'cat' + categoryTitle.replace(/\s+/g, '');
-    var categoryNodes = Ardublockly.xmlTree.getElementsByTagName('category');
-    for (var i = 0; i < categoryNodes.length; i++) {
-        if (categoryNodes[i].getAttribute('id') === categoryId) {
-            var previousNode = categoryNodes[i].previousElementSibling;
-            Ardublockly.xmlTree.removeChild(categoryNodes[i]);
-            if (previousNode && previousNode.nodeName == 'sep') {
-                Ardublockly.xmlTree.removeChild(previousNode);
-            }
-        }
-    }
-    blockpy.components.editor.blockly.updateToolbox(Ardublockly.xmlTree);
-};
-
-/** Closes the toolbox block container sub-menu. */
-Ardublockly.blocklyCloseToolbox = function () {
-    blockpy.components.editor.blockly.toolbox_.flyout_.hide();
-};
-
-/** @return {!integer} The width of the blockly workspace toolbox. */
-Ardublockly.blocklyToolboxWidth = function () {
-    return blockpy.components.editor.blockly.toolbox_.width;
-};
-
-/** @return {!boolean} Indicates if a block is currently being dragged. */
-Ardublockly.blocklyIsDragging = function () {
-    return (Blockly.dragMode_ != 0) ? true : false;
-};
-
-
-Ardublockly.blocklyCut = function () {
-    if (Blockly.selected) {
-        Blockly.copy_(Blockly.selected);
-        Blockly.selected.dispose(true, true);
-    }
-};
-
-
-Ardublockly.blocklyCopy = function () {
-    if (Blockly.selected) {
-        Blockly.copy_(Blockly.selected);
-    }
-};
-
-
-Ardublockly.blocklyPaste = function () {
-    if (Blockly.clipboardXml_) {
-        Blockly.hideChaff();
-        Blockly.clipboardSource_.paste(Blockly.clipboardXml_);
-    }
-};
-
-
-Ardublockly.blocklyDelete = function () {
-    if (Blockly.selected && Blockly.selected.isDeletable()) {
-        Blockly.hideChaff();
-        Blockly.selected.dispose(true, true);
-    }
-};
-
-/** @return {XMLHttpRequest} An XML HTTP Request multi-browser compatible. */
-Ardublockly.ajaxRequest = function () {
-    var request;
-    try {
-        // Firefox, Chrome, IE7+, Opera, Safari
-        request = new XMLHttpRequest();
-    } catch (e) {
-        try {
-            // IE6 and earlier
-            request = new ActiveXObject('Msxml2.XMLHTTP');
-        } catch (e) {
-            try {
-                request = new ActiveXObject('Microsoft.XMLHTTP');
-            } catch (e) {
-                throw 'Your browser does not support AJAX';
-                request = null;
-            }
-        }
-    }
-    return request;
-};
-
-
-
-/**
- * get a workspace snapshot on blocks
- * handle with blocks imgs with onload function twice
- * in order to convert img into base64 format data for download
- * @param {String} name name of pic to store as 
- */
-Ardublockly.workspace_capture = async function (name) {
-    let _header = window.location.protocol + "//"
-    let _href = window.location.origin + "/";
-    let ws = blockpy.components.editor.blockly.svgBlockCanvas_.cloneNode(true);
-    ws.removeAttribute("width");
-    ws.removeAttribute("height");
-    ws.removeAttribute("transform");
-    let styleElem = document.createElementNS("http://www.w3.org/2000/svg", "style");
-    styleElem.textContent = Blockly.Css.CONTENT.join('');
-    ws.insertBefore(styleElem, ws.firstChild);
-    let bbox = blockpy.components.editor.blockly.svgBlockCanvas_.getBBox();
-    let canvas = document.createElement("canvas");
-    // canvas.width = Math.ceil(bbox.width + 120);
-    // canvas.height = Math.ceil(bbox.height + 50);
-    canvas.width = Math.ceil(Math.abs(bbox.x) + bbox.width + 120);
-    canvas.height = Math.ceil(Math.abs(bbox.y) + bbox.height + 50);
-    canvas.appendChild(ws);
-    let ctx = canvas.getContext("2d");
-    let xml = new XMLSerializer().serializeToString(ws);
-    let test = /xlink:href="[a-zA-z]+:\/\/[^\s]*"/g;
-    let test1 = /xlink:href="[^\s]*"/g;
-    let arr = xml.match(test1)
-    if (arr != null) {
-        let loadImage = function () {
-            return new Promise((resolve) => {
-                let length = arr.length;
-                let count = 0;
-                for (let i = 0; i < length; i++) {
-                    let dataURL;
-                    let canvas_inline = document.createElement("canvas");
-                    let ctx1 = canvas_inline.getContext("2d");
-                    let image_item = new Image();
-                    image_item.setAttribute("src", _header + arr[i].replace("xlink:href=\"", _href).replace("\"", ""));
-                    image_item.onload = function () {
-                        //convert image to base64
-                        canvas_inline.width = image_item.width;
-                        canvas_inline.height = image_item.height;
-                        ctx1.drawImage(image_item, 0, 0);
-                        dataURL = canvas_inline.toDataURL("image/png", 1);
-                        xml = xml.replace(arr[i], "xlink:href=\"" + dataURL + "\"");
-                        count++;
-                    }
-                }
-                let timer = setInterval(() => {
-                    if (count == length) {
-                        return resolve(true);
-                        clearInterval(timer);
-                    }
-                });
-            });
-        }
-        await loadImage();
-    }
-    xml = '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  width="' + canvas.width + '" height="' + canvas.height + '" viewBox="' + bbox.x + ' ' + bbox.y + ' ' + canvas.width + ' ' + canvas.height + '"><rect width="100%" height="100%" fill="white"></rect>' + xml + '</svg>';
-    var img = new Image();
-    img.setAttribute("src", 'data:image/svg+xml;base64,' + btoa(unescape(encodeURIComponent(xml))));
-    img.onload = function () {
-        ctx.drawImage(img, 5, 5);
-        var canvasdata = canvas.toDataURL("image/png", 1);
-        var a = document.createElement("a");
-        a.download = name + ".png";
-        a.href = canvasdata;
-        document.body.appendChild(a);
-        a.click();
-    }
-}

+ 0 - 157
src/renderer/cocoblockly-x/python/ardublockly_lang.js

@@ -1,157 +0,0 @@
-/**
- * @license Licensed under the Apache License, Version 2.0 (the "License"):
- *          http://www.apache.org/licenses/LICENSE-2.0
- *
- * @fileoverview Functions related to language and localisation.
- */
-'use strict';
-
-/** Create a namespace for the application. */
-var Ardublockly = Ardublockly || {};
-
-/** Lookup for names of supported languages. Keys in ISO 639 format. */
-Ardublockly.LANGUAGE_NAME = {
-  'en': 'English',
-  'zh-hant': '繁体中文',
-  'zh-hans': '简体中文'
-};
-
-/**
- * Selected language, default English.
- * @type {string}
- */
-Ardublockly.LANG = 'en';
-
-/**
- * We keep a local copy of the default language in case translations cannot
- * be found in the injected language file.
- * @type {Object}
- */
-Ardublockly.DEFAULT_LANG_TEXT = {};
-
-
-/** Initialize the page language. */
-Ardublockly.initLanguage = function () {
-  // Save the current default language ID to check if it has been changed
-  var defaultLang = Ardublockly.LANG;
-
-  // Check server settings and url language, url gets priority
-  Ardublockly.LANG = Ardublockly.getUrlLanguage() ||
-    Ardublockly.getLanguageSetting() || Ardublockly.LANG;
-
-  //if (defaultLang !== Ardublockly.LANG) {
-  Ardublockly.injectLanguageJsSources(Ardublockly.LANG);
-  Ardublockly.duplicateDefaultLang();
-  Ardublockly.updateLanguageText();
-  //}
-};
-
-/**
- * Get the language previously set by the user from the server settings.
- * @return {string} Language saved in the server settings.
- */
-Ardublockly.getLanguageSetting = function () {
-  //TODO: Server feature still to be implemented, for now return default
-  return null;
-};
-
-/**
- * Get the language selected from the URL, format '?lang=en'.
- * @return {string} Selected language.
- */
-Ardublockly.getUrlLanguage = function () {
-  var langKey = 'lang';
-  var val = location.search.match(new RegExp('[?&]' + langKey + '=([^&]+)'));
-  var language = val ? decodeURIComponent(val[1].replace(/\+/g, '%20')) : '';
-  if (Ardublockly.LANGUAGE_NAME[language] == null) { language = 'en'; }
-  return language;
-};
-
-/**
- * Because new languages are injected by overwriting Ardublockly.LOCALISED_TEXT
- * we keep a local copy of the default language (included in the html header) so
- * that we can still retrieve these strings if the translation cannot be found.
- */
-Ardublockly.duplicateDefaultLang = function () {
-  for (var textId in Ardublockly.LOCALISED_TEXT) {
-    Ardublockly.DEFAULT_LANG_TEXT[textId] = Ardublockly.LOCALISED_TEXT[textId];
-  }
-};
-
-/** Updates the page text strings with the new language. */
-Ardublockly.updateLanguageText = function () {
-  for (var textId in Ardublockly.LOCALISED_TEXT) {
-    var textStrings = document.getElementsByClassName('translatable_' + textId);
-    for (var i = 0; i < textStrings.length; i++) {
-      textStrings[i].innerHTML = Ardublockly.getLocalStr(textId);
-    }
-  }
-};
-
-/**
- * Injects the language JavaScript files into the html head element.
- * @param {string} langKey Dictionary key for the language to inject, must also
- *     be JS file name.
- */
-Ardublockly.injectLanguageJsSources = function (langKey) {
-  var head = document.getElementsByTagName('head')[0];
-
-  // Retrieve and inject Ardublockly translations synchronously
-  var appLangJsLoad = document.createElement('script');
-  var request = ArdublocklyServer.createAjaxRequest();
-  var appLangJdPath = 'msg/' + langKey + '.js';
-  try {
-    request.open('GET', appLangJdPath, false);
-    request.send('');
-    appLangJsLoad.text = request.responseText;
-  } catch (e) {
-    // Display an alert to indicate we cannot load languages
-    Ardublockly.alertMessage(
-      Ardublockly.getLocalStr('noServerTitle'),
-      Ardublockly.getLocalStr('noServerNoLangBody'),
-      false);
-    // But still asynchronous lazy load so at least some text gets translated
-    appLangJsLoad.src = appLangJdPath;
-  }
-  head.appendChild(appLangJsLoad);
-
-  // Retrieve and inject Blockly translations asynchronously
-  var blocklyLangJsLoad = document.createElement('script');
-  blocklyLangJsLoad.src = '../blockly/msg/js/' + langKey + '.js';
-  head.appendChild(blocklyLangJsLoad);
-};
-
-/** Saves the blocks and reloads with a different language. */
-Ardublockly.changeLanguage = function () {
-  // Store the blocks for the duration of the reload only
-  // Ardublockly.saveSessionStorageBlocks();
-
-  var languageMenu = document.getElementById('language');
-  var newLang = encodeURIComponent(
-    languageMenu.options[languageMenu.selectedIndex].value);
-  var search = window.location.search;
-  if (search.length <= 1) {
-    search = '?lang=' + newLang;
-  } else if (search.match(/[?&]lang=[^&]*/)) {
-    search = search.replace(/([?&]lang=)[^&]*/, '$1' + newLang);
-  } else {
-    search = search.replace(/\?/, '?lang=' + newLang + '&');
-  }
-
-  window.location = window.location.protocol + '//' +
-    window.location.host + window.location.pathname + search;
-};
-
-/**
- * Finds and returns the requests string in the localised language.
- * If the translation is not returned, it fetches the original language string.
- * @param {string} stringId
- * @return {!string} The localised, original, or an empty string.
- */
-Ardublockly.getLocalStr = function (stringId) {
-  var text = Ardublockly.LOCALISED_TEXT[stringId];
-  if (!text) {
-    console.log('Localised text string ID "' + stringId + '" does not exists!');
-  }
-  return text || Ardublockly.DEFAULT_LANG_TEXT[stringId] || '';
-};

+ 0 - 1247
src/renderer/cocoblockly-x/python/ardublockly_toolbox.js

@@ -1,1247 +0,0 @@
-// /**
-//  * @license Licensed under the Apache License, Version 2.0 (the "License"):
-//  *          http://www.apache.org/licenses/LICENSE-2.0
-//  *
-//  * @fileoverview XML toolbox embedded into a JavaScript text string.
-//  */
-// 'use strict';
-
-// /** Create a namespace for the application. */
-// var Ardublockly = Ardublockly || {};
-
-// // let workspaceTopBlocks = blockpy.components.editor.blockly && 
-// //     blockpy.components.editor.blockly.getTopBlocks();
-// // let touchMatch = '<block type="touchMatch';
-// // console.log(workspaceTopBlocks);
-// // if (workspaceTopBlocks) {
-// //     for (var i = 0; i < workspaceTopBlocks.length; i++) {
-// //         if (workspaceTopBlocks[i].getTouchMatchInstance && 
-// //             workspaceTopBlocks[i].getTouchMatchInstance()) {
-// //             touchMatch += ' disabled="true"';
-// //         }
-// //     }
-// // }
-// // touchMatch += '></block>';
-
-// Ardublockly.TOOLBOX_XML =
-//     '<xml>' +
-//     '  <sep></sep>' +
-//     // '<category id="catBasic" name="Basic">'+
-//     '  <category id="catLogic" name="Logic">' +
-//     '    <block type="controls_if"></block>' +
-//     '    <block type="logic_compare"></block>' +
-//     '    <block type="logic_operation"></block>' +
-//     '    <block type="logic_negate"></block>' +
-//     '    <block type="logic_boolean"></block>' +
-//     '    <block type="logic_null"></block>' +
-//     '    <block type="logic_ternary"></block>' +
-//     '    <block type="switch_statement"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     '  <category id="catLoops" name="Loops">' +
-//     '    <block type="controls_repeat_ext">' +
-//     '      <value name="TIMES">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">10</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="controls_whileUntil"></block>' +
-//     '    <block type="controls_for">' +
-//     '      <value name="FROM">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">1</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="TO">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">10</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="BY">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">1</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="controls_flow_statements"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     '  <category id="catMath" name="Math">' +
-//     '    <block type="math_number"></block>' +
-//     '    <block type="math_arithmetic"></block>' +
-//     '    <block type="math_single"></block>' +
-//     '    <block type="math_trig"></block>' +
-//     '    <block type="math_constant"></block>' +
-//     '    <block type="math_number_property"></block>' +
-//     '    <block type="math_change">' +
-//     '      <value name="DELTA">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">1</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="math_round"></block>' +
-//     '    <block type="math_modulo"></block>' +
-//     '    <block type="math_constrain">' +
-//     '      <value name="LOW">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">1</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="HIGH">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">100</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="math_random_int">' +
-//     '      <value name="FROM">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">1</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="TO">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">100</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="math_random_float"></block>' +
-//     '    <block type="base_map"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     '  <category id="catVariables" name="Variables">' +
-//     '    <block type="variables_get"></block>' +
-//     '    <block type="variables_set"></block>' +
-//     '    <block type="variables_set_type"></block>' +
-//     '    <block type="variables_set">' +
-//     '      <value name="VALUE">' +
-//     '        <block type="variables_set_type"></block>' +
-//     '      </value>' +
-//     '    </block>' +
-
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     '  <category id="catText" name="Text">' +
-//     '    <block type="text"></block>' +
-//     '    <block type="text_join"></block>' +
-//     '    <block type="text_append">' +
-//     '      <value name="TEXT">' +
-//     '        <block type="text"></block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="text_length"></block>' +
-//     '    <block type="text_isEmpty"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     //---------------- list blocks  ---------------//
-
-//     '  <category id="catLists" name="Lists">' +
-//     '    <block type="lists_variable_set">' +
-//     '      <value name="VALUE">' +
-//     '        <block type="lists_create_with">' +
-//     '          <value name="ADD0">' +
-//     '             <block type="math_number">' +
-//     '                <field name="NUM">0</field>' +
-//     '             </block>' +
-//     '          </value>' +
-//     '          <value name="ADD1">' +
-//     '             <block type="math_number">' +
-//     '                <field name="NUM">0</field>' +
-//     '             </block>' +
-//     '          </value>' +
-//     '          <value name="ADD2">' +
-//     '             <block type="math_number">' +
-//     '                <field name="NUM">0</field>' +
-//     '             </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="lists_create_with">' +
-//     '      <value name="ADD0">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="ADD1">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="ADD2">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="lists_create_with2">' +
-//     '      <value name="ADD0">' +
-//     '        <block type="text">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="ADD1">' +
-//     '        <block type="text">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-
-//     '    <block type="lists_length">' +
-//     '      <value name="VAR">' +
-//     '        <block type="variables_get">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="lists_getIndex">' +
-//     '      <value name="VAR">' +
-//     '        <block type="variables_get">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="AT">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-
-//     '    <block type="lists_setIndex">' +
-//     '      <value name="VAR">' +
-//     '        <block type="variables_get">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="AT">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="TO">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-
-//     '    <block type="lists_setIndex">' +
-//     '      <value name="VAR">' +
-//     '        <block type="variables_get">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="AT">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="TO">' +
-//     '        <block type="text">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '  </category>' +
-
-//     '  <sep></sep>' +
-
-//     '  <category id="catFunctions" name="Functions" custom="PROCEDURE"></category>' +
-//     '  <sep></sep>' +
-//     //--------------Input & Output blocks----------------// 
-//     '  <category id="catInputOutput" name="Input/Output">' +
-//     '    <block type="io_digitalwrite">' +
-//     '      <value name="PIN">' +
-//     '        <block type="io_dropdown_digital">' +
-//     //'          <field name="SELECTPIN">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="STATE">' +
-//     '        <block type="io_highlow"></block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="io_digitalread">' +
-//     '      <value name="PIN">' +
-//     '        <block type="io_dropdown_digital">' +
-//     //'          <field name="SELECTPIN">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="io_builtin_led">' +
-//     '      <value name="STATE">' +
-//     '        <block type="io_highlow"></block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="io_pwmwrite">' +
-//     '      <value name="PIN">' +
-//     '        <block type="io_dropdown_pwm">' +
-//     //'          <field name="SELECTPIN">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="PWMVALUE">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="io_analogread">' +
-//     '      <value name="PIN">' +
-//     '        <block type="io_dropdown_analog">' +
-//     //'          <field name="SELECTPIN">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="io_highlow"></block>' +
-//     '    <block type="io_pulsein">' +
-//     '      <value name="PULSETYPE">' +
-//     '        <block type="io_highlow"></block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="io_pulsetimeout">' +
-//     '      <value name="PULSETYPE">' +
-//     '        <block type="io_highlow"></block>' +
-//     '      </value>' +
-//     '      <value name="TIMEOUT">' +
-//     '        <block type="math_number"></block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     '  <category id="catTime" name="Time">' +
-//     '    <block type="time_delay">' +
-//     '      <value name="DELAY_TIME_MILI">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">1000</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="time_delaymicros">' +
-//     '      <value name="DELAY_TIME_MICRO">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">100</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="time_millis"></block>' +
-//     '    <block type="time_micros"></block>' +
-//     '    <block type="infinite_loop"></block>' +
-//     '    <block type="time_everySecond">' +
-//     '      <value name="TIME">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">5</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="time_everyMilliSecond">' +
-//     '      <value name="TIME">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">500</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="time_chrono_setup"></block>' +
-//     '    <block type="time_chrono_reset"></block>' +
-//     '    <block type="time_chrono_elapsed"></block>' +
-//     '    <block type="time_chrono_timeCheck">' +
-//     '      <value name="TIME">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">1000</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     '  <category id="catComms" name="Comms">' +
-//     '    <block type="serial_setup"></block>' +
-//     '    <block type="serial_print"></block>' +
-//     '    <block type="serial1_write"></block>' +
-//  //   '    <block type="serial1_read"></block>' +
-//  //   '    <block type="serial1_available"></block>' +
-
-//     // '    <block type="spi_setup"></block>' +
-//     // '    <block type="spi_transfer"></block>' +
-//     // '    <block type="spi_transfer_return"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     /*   
-//      * coco mod here
-//      */
-//     '<category id="catCocoMod" name="Modules">' +
-//     // -------------- Sensor 101 blocks --------------- //
-//     '  <category id="catBasic" name="Sensor 101">' +
-//     '	<sep></sep>' +
-//     '	 <category class="examples" name="Marquee" id="basicMarquee"></category>' +
-//     '	<sep></sep>' +
-//     '	 <category name="8 Bit Music" id="basic8Bit"></category>' +
-//     '	<sep></sep>' +
-//     '	 <category name="Knob To Notes" id="baxicKnobSound"></category>' +
-//     '    <block type="read_button">' +
-//     '      <value name="PINSNUM">' +
-//     '        <block type="basic101_dropdown_button">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="read_knob">' +
-//     '      <value name="PINSNUM">' +
-//     '        <block type="basic101_dropdown_knob">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="digital_light">' +
-//     '      <value name="PINSNUM">' +
-//     '        <block type="basic101_dropdown_digital_light">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="analog_light">' +
-//     '      <value name="PINSNUM">' +
-//     '        <block type="basic101_dropdown_analog_light">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="BRIGHTNESS">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">220</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="nolight">' +
-//     '      <value name="PINSNUM">' +
-//     '        <block type="basic101_dropdown_nolight">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="tone">' +
-//     '      <value name="PINSNUM">' +
-//     '        <block type="basic101_dropdown_tone">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="FREQUENCY">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">220</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="notone">' +
-//     '      <value name="PINSNUM">' +
-//     '        <block type="basic101_dropdown_notone">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '        <block type="basic101_dropdown_tone">' +
-//     '        </block>' +
-//     '    <block type="counter_button_setup">' +
-//     '      <value name="PINSNUM">' +
-//     '        <block type="basic101_counter_dropdown_button">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="read_counter">' +
-//     '      <value name="PINSNUM">' +
-//     '        <block type="basic101_counter_dropdown_button">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     // -------------- LEDLight blocks -------------- //
-//     '  <category id="catFASTLED" name="Light">' +
-//     '	<sep></sep>' +
-//     '	 <category name="Heart" id="ledHeart"></category>' +
-//     '	 <block type="led_neopixel_setup"></block>' +
-//     '	 <block type="led_set_width_height">' +
-//     '      <value name="WIDTH">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="HEIGHT">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '	 <block type="led_set_position">' +
-//     '      <value name="POSX">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="POSY">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="led_setrotation"></block>' +
-//     '	 <block type="led_setbright">' +
-//     '      <value name="BRIGHTNESS">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">220</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="led_set_color"></block>' +
-//     '    <block type="led_set_colorRGB">' +
-//     '      <value name="RED_VAL">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="GREEN_VAL">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="BLUE_VAL">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="led_drawpixel">' +
-//     '      <value name="COLOR">' +
-//     '        <block type="led_set_color"></block>' +
-//     '      </value>' +
-//     '      <value name="POS">' +
-//     '        <block type="led_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="led_draw_strip">' +
-//     '      <value name="COLOR">' +
-//     '        <block type="led_set_color"></block>' +
-//     '      </value>' +
-//     '      <value name="LOC">' +
-//     '        <block type="math_number">' +
-//     '           <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="led_drawline">' +
-//     '      <value name="COLOR">' +
-//     '        <block type="led_set_color"></block>' +
-//     '      </value>' +
-//     '      <value name="POSA">' +
-//     '        <block type="led_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="POSB">' +
-//     '        <block type="led_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">4</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">4</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="led_drawrect">' +
-//     '      <value name="COLOR">' +
-//     '        <block type="led_set_color">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="SIZE">' +
-//     '        <block type="led_set_width_height">' +
-//     '          <value name="WIDTH">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">5</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="HEIGHT">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">5</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="POS">' +
-//     '        <block type="led_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     // '    <block type="led_drawWord_5x5">' +
-//     // '      <value name="WORD">' +
-//     // '        <block type="text"></block>' +
-//     // '      </value>' +
-//     // '      <value name="COLOR">' +
-//     // '        <block type="set_color"></block>' +
-//     // '      </value>' +
-//     // '    </block>' +
-//     '    <block type="led_text_input">' +
-//     '      <value name="TEXT">' +
-//     '        <block type="text"></block>' +
-//     '      </value>' +
-//     '      <value name="COLOR">' +
-//     '        <block type="led_set_color"></block>' +
-//     '      </value>' +
-//     '      <value name="POS">' +
-//     '        <block type="led_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     // '    <block type="led_text_input"></block>'+
-//     // '    <block type="led_text">' +
-//     // '      <value name="text_color">' +
-//     // '        <block type="set_color">'+
-//     // '        </block>' +
-//     // '      </value>' +
-//     // '      <value name="back_color">' +
-//     // '        <block type="set_color">'+
-//     // '        </block>' +
-//     // '      </value>' +
-//     // '    </block>'+
-//     // '    <block type="led_scrolling_text">' +
-//     // '      <value name="led_scrolling_color">' +
-//     // '        <block type="set_color">'+
-//     // '        </block>' +
-//     // '      </value>' +
-//     // '    </block>'+
-//     '    <block type="led_draw_emotion">' +
-//     '      <value name="COLOR">' +
-//     '        <block type="led_set_color"></block>' +
-//     '      </value>' +
-//     '      <value name="POS">' +
-//     '        <block type="led_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">1</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">1</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="led_pattern_5x5"></block>' +
-//     '    <block type="led_showall"></block>' +
-//     '    <block type="led_clear"></block>' +
-
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     // -------------- Motor blocks -------------- //
-//     '  <category id="catMOTOR" name="Motor">' +
-//     '	 <category name="Movement" id="motorMovement"></category>' +
-//     '	 <sep></sep>' +
-//     '	 <category name="Obstacle Voiding" id="motorObstacleVoiding"></category>' +
-//     // '	<sep></sep>' +
-//     // '	 <category name="Line Tracking" id="motorTrackLine"></category>' +
-//     // '	<sep></sep>' +
-//     '    <block type="motor_setup"></block>' +
-//     '    <block type="motor_speed"></block>' +
-//     '    <block type="motorA_move_clockwise">' +
-//     '      <value name="SPEED">' +
-//     '        <block type="motor_speed">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     // '    <block type="motorA_move_anticlockwise">' +
-//     // '      <value name="SPEED">' +
-//     // '        <block type="motor_speed">' +
-//     // '        </block>' +
-//     // '      </value>' +
-//     // '    </block>' +
-//     '    <block type="motorB_move_clockwise">' +
-//     '      <value name="SPEED">' +
-//     '        <block type="motor_speed">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     // '    <block type="motorB_move_anticlockwise">' +
-//     // '      <value name="SPEED">' +
-//     // '        <block type="motor_speed">' +
-//     // '        </block>' +
-//     // '      </value>' +
-//     // '    </block>' +
-//     '    <block type="motor_stop"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     // -------------- Servo blocks -------------- //
-//     '  <category id="catServo" name="Servo">' +
-//     '	 <category name="Full Rotation" id="fullRotate"></category>' +
-//     '    <block type="servo_setup"></block>' +
-//     '    <block type="servo_write">' +
-//     '      <value name="SERVO_ANGLE">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">90</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="servo_read"></block>' +
-//     '    <block type="robot_setup"></block>' +
-//     '    <block type="robot_set_movement">' +
-//     '      <value name="MOVEMENT">' +
-//     '        <block type="robot_movement">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="TEMPO">' +
-//     '        <block type="robot_tempo">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="robot_movement"></block>' +
-//     '    <block type="robot_tempo"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     // -------------- Music blocks -------------- //
-//     '  <category id="catMusic" name="Music">' +
-//     // '    <category id="paper_piano_cocoblockly" name="Music Keyboard"></category>'+
-//     // '	 <sep></sep>' +
-//     '    <category id="music_play_melody" name="Play Melody"></category>' +
-//     '	<sep></sep>' +
-//     '    <category id="music_play_mp3" name="Play MP3"></category>' +
-//     '	 <block type="MusicMidiSetup"></block>' +
-//     '    <block type="MusicSetVolume"></block>' +
-//     '    <block type="MusicSetInstrument"></block>' +
-//     '    <block type="MusicNote"></block>' +
-//     '    <block type="MusicBeat"></block>' +
-//     '    <block type="MusicPlayTone">' +
-//     '      <value name="NOTE">' +
-//     '        <block type="MusicNote">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="DURATION">' +
-//     '        <block type="MusicBeat">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="MusicRest">' +
-//     '      <value name="BEAT">' +
-//     '        <block type="MusicBeat">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="Music_mp3_setup">' +
-//     '    </block>' +
-//     '    <block type="Music_mp3_playOneWithName">' +
-//     '    </block>' +
-//     '    <block type="Music_mp3_playSetting">' +
-//     '    </block>' +
-//     '    <block type="Music_mp3_getCurrentVolume">' +
-//     '    </block>' +
-//     '    <block type="Music_mp3_setCurrentVolume">' +
-//     '    </block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     // -------------- Touch Sensor blocks -------------- //
-//     '  <category id="catTouch" name="Touch" custom="TOUCH" colour="30">' +
-//     // '    <category id="paper_piano_cocoblockly" name="Music Keyboard"></category>'+
-//     // '	 <sep></sep>' +
-//     '    <category id="touch_light" name="Touch Light"></category>' +
-//     '  </category>' +
-
-//     // '  <category id="catTouch" name="Touch">' +
-//     // // '    <category id="paper_piano_cocoblockly" name="Music Keyboard"></category>'+
-//     // // '	 <sep></sep>' +
-//     // '    <category id="touch_light" name="Touch Light"></category>' +
-//     // '    <block type="touch_setup_1"></block>' +
-//     // '    <block type="touch_each"></block>' +
-//     // '  </category>' +
-
-//     '  <sep></sep>' +
-
-//     // -------------- HCI blocks -------------- //
-//     '  <category id="catHCI" name="HCI">' +
-//     '    <category id="hci_basic" name="HCI mouse"></category>' +
-//     '    <block type="HID_setup"></block>' +
-//     '    <block type="HID_mouse_move"></block>' +
-//     '    <block type="HID_mouse_click"></block>' +
-//     '    <block type="HID_mouse_press"></block>' +
-//     '    <block type="HID_mouse_release"></block>' +
-//     '    <block type="HID_keyboard_press"></block>' +
-//     '    <block type="HID_keyboard_release"></block>' +
-//     '    <block type="HID_keyboard_releaseAll"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     // -------------- screen blocks -------------- //
-//     '  <category id="catScreen" name="Screen">' +
-//     '	 <category name="Showreel" id="screenShowreel"></category>' +
-//     '	 <sep></sep>' +
-//     '	 <category name="ENV SHOW SCREEN" id="EnvShowScreen"></category>' +
-//     '    <block type="lcd_setup"></block>' +
-//     '	 <block type="lcd_set_width_height">' +
-//     '      <value name="WIDTH">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="HEIGHT">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '	 <block type="lcd_set_position">' +
-//     '      <value name="POSX">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="POSY">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="lcd_drawline">' +
-//     '      <value name="COLOR">' +
-//     '        <block type="lcd_set_color">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="POSA">' +
-//     '        <block type="lcd_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="POSB">' +
-//     '        <block type="lcd_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">50</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">50</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="lcd_drawrect">' +
-//     '      <value name="COLOR">' +
-//     '        <block type="lcd_set_color">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="SIZE">' +
-//     '        <block type="lcd_set_width_height">' +
-//     '          <value name="WIDTH">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">50</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="HEIGHT">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">50</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="POS">' +
-//     '        <block type="lcd_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="lcd_drawcircle">' +
-//     '      <value name="COLOR">' +
-//     '        <block type="lcd_set_color">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="POS">' +
-//     '        <block type="lcd_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="RADIUS">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">30</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="lcd_drawtriangle">' +
-//     '      <value name="COLOR">' +
-//     '        <block type="lcd_set_color">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="POSA">' +
-//     '        <block type="lcd_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">20</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">40</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="POSB">' +
-//     '        <block type="lcd_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">40</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">20</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="POSC">' +
-//     '        <block type="lcd_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">20</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">20</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="lcd_text">' +
-//     '      <value name="INPUT">' +
-//     '        <block type="text"></block>' +
-//     '      </value>' +
-//     '      <value name="COLOR">' +
-//     '        <block type="lcd_set_color">' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="POS">' +
-//     '        <block type="lcd_set_position">' +
-//     '          <value name="POSX">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">10</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="POSY">' +
-//     '            <block type="math_number">' +
-//     '              <field name="NUM">10</field>' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="SIZE">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">1</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="lcd_rotation"></block>' +
-//     '    <block type="lcd_clear"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     // -------------- env sensor blocks -------------- //
-//     '  <category id="catENV" name="Env Sensor">' +
-//     '	 <category name="ENV SHOW SCREEN" id="EnvShowScreen"></category>' +
-//     '	 <sep></sep>' +
-//     '	 <category name="ENV Light Color" id="EnvLigtColor"></category>' +
-//     '    <block type="env_init"></block>' +
-//     //'    <block type="iot_read_val"></block>' +
-//     '    <block type="iot_read_mic">' +
-//     '       <field name="env_sensor_mic">A2</field>' +
-//     '    </block>' +
-//     '    <block type="iot_read_light">' +
-//     '       <field name="env_sensor_light">A1</field>' +
-//     '    </block>' +
-//     '    <block type="iot_read_humid">' +
-//     '       <field name="env_sensor_humid">4</field>' +
-//     '    </block>' +
-//     '    <block type="iot_read_temp">' +
-//     '       <field name="env_sensor_temp">4</field>' +
-//     '    </block>' +
-//     '    <block type="iot_set_rgb">' +
-//     '       <field name="env_sensor_rgbPin_r">9</field>' +
-//     '       <field name="env_sensor_rgbPin_g">10</field>' +
-//     '       <field name="env_sensor_rgbPin_b">11</field>' +
-//     '      <value name="RED_VAL">' +
-
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="GREEN_VAL">' +
-
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '      <value name="BLUE_VAL">' +
-//     //'       <field name="env_sensor_rgbPin_b">11</field>' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="iot_buzzer">' +
-//     '      <value name="FREQUENCY">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">220</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="iot_nobuzzer"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     // -------------- third-party sensor blocks -------------- //
-//     '  <category id="catTD" name="Sensors">' +
-//     '	 <category name="GPS SHOW" id="GPSShowScreen"></category>' +
-//     '  <sep></sep>' +
-//     '    <block type="sonar_setup"></block>' +
-//     '    <block type="sonar_read_dist"></block>' +
-//     '    <block type="infraredRay_setup"></block>' +
-//     '    <block type="infraredRay_receive_val"></block>' +
-//     '    <block type="infraredRay_send_val"></block>' +
-//     '    <block type="controls_if">' +
-//     '      <value name="IF0">' +
-//     '        <block type="logic_compare">' +
-//     '          <value name="A">' +
-//     '            <block type="infraredRay_receive_val">' +
-//     '            </block>' +
-//     '          </value>' +
-//     '          <value name="B">' +
-//     '            <block type="infraredRay_send_val">' +
-//     '            </block>' +
-//     '          </value>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     // /* Water Temperature */
-//     '    <block type="water_temp_sensor_setup"></block>' +
-//     '    <block type="water_temp_sensor_get_value"></block>' +
-//     // /* CO2 Sensor */
-//     '    <block type="thirdparty_co2_sensor_setup"></block>' +
-//     '    <block type="thirdparty_co2_sensor_get_co2"></block>' +
-//     '    <block type="thirdparty_co2_sensor_get_tvoc"></block>' +
-//     // /* RTC */
-//     '    <block type="RTC_setup"></block>' +
-//     '    <block type="RTC_setDateTime"></block>' +
-//     '    <block type="RTC_getDate"></block>' +
-//     '    <block type="RTC_getTime"></block>' +
-//     '    <block type="RTC_getWeek"></block>' +
-//     /* PulseSensor */
-//     '    <block type="PulseSensor_setup"></block>' +
-//     '    <block type="PulseSensor_getBPM"></block>' +
-//     '    <block type="PulseSensor_Heart_Beats"></block>' +
-//     '    <block type="PulseSensor_Heart_noBeats"></block>' +
-//     '    <block type="PulseSensor_print"></block>' +
-//     /* Encoder */
-//     '    <block type="Encoder_Setup"></block>' +
-//     '    <block type="Encoder_getRotationSpeed"></block>' +
-//     /*RFID*/
-//     '    <block type="RFID_Setup"></block>' +
-//     '    <block type="RFID_ReadID"></block>' +
-    
-//     // /*GPS*/
-//     '    <block type="GPS_setup"></block>' +
-//     '    <block type="GPS_getLatitude"></block>' +
-//     '    <block type="GPS_getLongitude"></block>' +
-//     // /* NRF */
-//     '    <block type="thirdparty_nrf24l01_setup"></block>' +
-//     '    <block type="thirdparty_nrf24l01_send_data"></block>' +
-//     '    <block type="thirdparty_nrf24l01_receive_data"></block>' +
-//     '    <block type="thirdparty_nrf24l01_data_received"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     // -------------- colour blocks -------------- //
-//     '  <category id="catColour" name="Colour">' +
-//     '    <block type="color_analyzer_setup"></block>' +
-//     // '    <block type="set_color"></block>' +
-//     '    <block type="read_r"></block>' +
-//     '    <block type="read_g"></block>' +
-//     '    <block type="read_b"></block>' +
-//     // '    <block type="set_colorRGB">' +
-//     // '      <value name="RED_VAL">' +
-//     // '        <block type="math_number">' +
-//     // '          <field name="NUM">0</field>' +
-//     // '        </block>' +
-//     // '      </value>' +
-//     // '      <value name="GREEN_VAL">' +
-//     // '        <block type="math_number">' +
-//     // '          <field name="NUM">0</field>' +
-//     // '        </block>' +
-//     // '      </value>' +
-//     // '      <value name="BLUE_VAL">' +
-//     // '        <block type="math_number">' +
-//     // '          <field name="NUM">0</field>' +
-//     // '        </block>' +
-//     // '      </value>' +
-//     // '    </block>' +
-//     // '    <block type="isColorRGB">' +
-//     // '    </block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     // -------------- bluetooth blocks -------------- //
-//     '  <category id="catBluetooth" name="Bluetooth">' +
-//     '	 <category name="Robot Car Remote Control" id="robotRemoteControl"></category>' +
-//     '    <sep></sep>' +
-//     '	 <category name="Robot Arm Remote Control" id="robotArmRemoteControl"></category>' +
-//     '    <block type="bluetooth_setup"></block>' +
-//     '    <block type="bluetooth_text_getCommand"></block>' +
-//     '    <block type="bluetooth_number_getCommand"></block>' +
-//     '    <block type="bluetooth_list_getCommand"></block>' +
-//     '    <block type="bluetooth_intercomms_send_old">'+
-//     '      <value name="ADD0">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="bluetooth_intercomms_receive_old"></block>' +
-//     '    <block type="bluetooth_intercomms_receive_getData_old"></block>' +
-// /*    '    <block type="bluetooth_intercomms_send">'+
-//     '      <value name="ADD0">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="bluetooth_intercomms_receive"></block>' +
-//     '    <block type="bluetooth_intercomms_receive_getData"></block>' +*/
-//     '    <block type="bluetooth_at_slave"></block>' +
-//     '    <block type="bluetooth_at_master"></block>' +    
-//     '    <block type="bluetooth_at_interaction"></block>' +   
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     //---------------- motion blocks-----------------//
-//     '  <category id="catMOTION" name="Motion">' +
-//     '	 <category name="Motion Show Led" id="MotionShowLed"></category>' +
-//     '    <block type="motion_setup"></block>' +
-//     '    <block type="motion_onshake"></block>' +
-//     '    <block type="motion_onDirection"></block>' +
-//     '    <block type="motion_getRotation_ypr"></block>' +
-//     '    <block type="motion_getAcceleration"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     //---------------- mainwifi blocks-----------------//
-//     '  <category id="catMainWifi" name="WiFi">' +
-//     '	 <category name="Main env data transfer" id="MainEnvDataTransfer"></category>' +
-//     '    <block type="MainEasymode_transfer2_send">' +
-//     '      <value name="ADD0">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="MainEasymode_transfer2_receive">' +
-//     '    </block>' +
-//     '    <block type="MainEasymode_transfer2_receive_getValue">' +
-//     '    </block>' +
-// /*    '    <block type="MainEasymode_transfer2_send_old">' +
-//     '      <value name="ADD0">' +
-//     '        <block type="math_number">' +
-//     '          <field name="NUM">0</field>' +
-//     '        </block>' +
-//     '      </value>' +
-//     '    </block>' +
-//     '    <block type="MainEasymode_transfer2_receive_old">' +
-//     '    </block>' +
-//     '    <block type="MainEasymode_transfer2_receive_getValue_old">' +
-//     '    </block>' + */
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     //---------------- NBIoT blocks-----------------//
-//     //'  <category id="catNBIoT" name="NBIoT">' +
-//     '    <block type="NBIoT_setup"></block>' +
-//     '    <block type="NBIoT_enable"></block>' +
-//     '    <block type="controls_if">' +
-//     '      <value name="IF0">' +
-//     '        <block type="NBIoT_powered_on"></block>' +
-//     '      </value>' +
-//     '    </block>'+
-//     '    <block type="controls_if">' +
-//     '      <value name="IF0">' +
-//     '        <block type="NBIoT_network_connected"></block>' +
-//     '      </value>' +
-//     '    </block>'+
-//     '    <block type="NBIoT_network_connected"></block>' +
-//     '    <block type="NBIoT_powered_on"></block>' +
-//     '    <block type="NBIoT_network_IP"></block>' +
-//     '    <block type="NBIoT_http">'+
-//     '      <value name="ADD0">' +
-//     '          <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '          </block>' +
-//     '       </value>' +
-//     '    </block>' +
-//     '    <block type="NBIoT_http_IFTTT">'+
-//     '      <value name="ADD0">' +
-//     '          <block type="math_number">' +
-//     '              <field name="NUM">0</field>' +
-//     '          </block>' +
-//     '       </value>' +
-//     '    </block>' +
-//     // '    <block type="NBIoT_http_thingspeak"></block>' +
-//     // '    <block type="NBIoT_http_cococloud_get"></block>' +
-//     '  </category>' +
-//     '  <sep></sep>' +
-//     '</category>' +
-//     '<sep></sep>' +
-//     '</xml>';

+ 0 - 216
src/renderer/cocoblockly-x/python/ardublocklyserver_ajax.js

@@ -1,216 +0,0 @@
-/**
- * @license Licensed under the Apache License, Version 2.0 (the "License"):
- *          http://www.apache.org/licenses/LICENSE-2.0
- *
- * @fileoverview Ajax calls to the Ardublockly Server python program.
- */
-'use strict';
-
-/** Create a name space for the application. */
-var ArdublocklyServer = {};
-
-/**
- * Sends Form data to the ArduBlocklyServer using Ajax.
- * @param {!string} url Requestor URL.
- * @param {!string} params Form parameters in the 'var=x&var2=y' format.
- * @param {!function} callback Request callback function.
- */
-ArdublocklyServer.ajaxPostForm = function(url, params, callback) {
-  var request = ArdublocklyServer.createAjaxRequest();
-  try {
-    request.open('POST', url, true);
-    request.setRequestHeader(
-        'Content-type', 'application/x-www-form-urlencoded');
-  } catch (e) {
-    // The request will fail if opening the html directly on a browser, so
-    // let's just send the callback nullified and the front end will deal.
-    callback(null);
-  }
-
-  // The data received is JSON, so it needs to be converted into the right
-  // format to be displayed in the page.
-  request.onreadystatechange = function() {
-    if (request.readyState == 4) {
-      if (request.status == 200) {
-        callback(request.responseText);
-      } else if (request.status == 405) {
-        // return a null element which will be dealt with in the front end
-        callback(null);
-      }
-    }
-  };
-
-  // Send the data
-  try {
-    request.send(params);
-  } catch (e) {
-    // Nullify callback to indicate error
-    callback(null);
-  }
-};
-
-/**
- * Sends plain data to the ArduBlocklyServer using Ajax.
- * @param {!string} url Requester URL.
- * @param {!string} data Plain text currently used to send Arduino code only.
- * @param {!function} callback Request callback function.
- */
-ArdublocklyServer.ajaxPostPlain = function(url, data, callback) {
-  var request = ArdublocklyServer.createAjaxRequest();
-  request.open('POST', url, true);
-  request.setRequestHeader('Content-type', 'text/plain');
-
-  // The data received is JSON, so it needs to be converted into the right
-  // format to be displayed in the page.
-  request.onreadystatechange = function() {
-    if (request.readyState == 4) {
-      if (request.status == 200) {
-        callback(request.responseText);
-      } else if (request.status == 405) {
-        // return a null element which will be dealt with in the front end
-        callback(null);
-      }
-    }
-  };
-
-  // Send the data
-  try {
-    request.send(data);
-  } catch (e) {
-    // The request will fail if opening the html directly on a browser, so
-    // let's just send the callback nullified and the front end will deal.
-    callback(null);
-  }
-};
-
-/**
- * Reads JSON data from the server and forwards formatted JavaScript object.
- * @param {!string} fileLocation Location for the JSON data.
- * @param {!function} jsonDataCb Callback with JSON object or null for error.
- */
-Ardublockly.getJsonData = function(fileLocation, jsonDataCb) {
-  var request = ArdublocklyServer.createAjaxRequest();
-  request.overrideMimeType("application/json");
-  var requestCb = function() {
-    if (request.readyState == 4) {
-      if (request.status == 200) {
-        var jsonObj = null;
-        try {
-          jsonObj = JSON.parse(request.responseText);
-        } catch(e) {
-          console.error('Incorrectly formatted JSON data from ' + fileLocation);
-          throw e;
-        }
-        jsonDataCb(jsonObj);
-      } else {
-        jsonDataCb(null);
-      }
-    }
-  };
-  try {
-    request.open('GET', fileLocation, true);
-    request.onreadystatechange = requestCb;
-    request.send(null);
-  } catch (e) {
-    jsonDataCb(null);
-  }
-};
-
-/** @return {XMLHttpRequest} An XML HTTP Request multi-browser compatible. */
-ArdublocklyServer.createAjaxRequest = function() {
-  var request = false;
-  try {
-    // Firefox, Chrome, IE7+, Opera, Safari
-    request = new XMLHttpRequest();
-  }
-  catch (e) {
-    // IE6 and earlier
-    try {
-      request = new ActiveXObject('Msxml2.XMLHTTP');
-    }
-    catch (e) {
-      try {
-        request = new ActiveXObject('Microsoft.XMLHTTP');
-      }
-      catch (e) {
-        throw 'Your browser does not support AJAX. You will not be able to' +
-              'use all of Ardublockly features.';
-        request = null;
-      }
-    }
-  }
-  return request;
-};
-
-/**
- * Creates an HTML element based on the JSON data received from the server.
- * @param {!string} json_data A string containing the JSON data to be parsed.
- * @return {!element} An HTML element, which type depends on the JSON 'element'
- *                    key (currently only text input or drop down).
- */
-ArdublocklyServer.createElementFromJson = function(json_data) {
-  var parsed_json = JSON.parse(json_data);
-  var element = null;
-
-  if (parsed_json.element == 'text_input') {
-    // Simple text input
-    element = document.createElement('input');
-    element.setAttribute('type', 'text');
-    element.setAttribute('value', parsed_json.display_text);
-  } else if (parsed_json.element == 'dropdown') {
-    // Drop down list of unknown length with a selected item
-    element = document.createElement('select');
-    element.name = parsed_json.response_type;
-    for (var i = 0; i < parsed_json.options.length; i++) {
-      var option = document.createElement('option');
-      option.value = parsed_json.options[i].value;
-      option.text = parsed_json.options[i].display_text;
-      // Check selected option and mark it
-      if (parsed_json.options[i].value == parsed_json.selected) {
-        option.selected = true;
-      }
-      element.appendChild(option);
-    }
-  } else if (parsed_json.element == 'div_ide_output') {
-    // Formatted text for the Arduino IDE CLI output
-    var el_title = document.createElement('h4');
-    el_title.innerHTML = Ardublockly.getLocalStr(parsed_json.conclusion);
-    if (parsed_json.success == true) {
-      el_title.className = 'arduino_dialog_success';
-    } else {
-      el_title.className = 'arduino_dialog_failure';
-    }
-
-    var el_out = document.createElement('span');
-    el_out.className = 'arduino_dialog_out';
-    // If larger than 50 characters then don't bother looking for language key
-    if (parsed_json.output.length < 50) {
-      el_out.innerHTML = Ardublockly.getLocalStr(parsed_json.output) ||
-                         parsed_json.output.split('\n').join('<br />');
-    } else {
-      el_out.innerHTML = parsed_json.output.split('\n').join('<br />');
-    }
-
-    element = document.createElement('div');
-    element.appendChild(el_title);
-    element.appendChild(el_out);
-
-    // Only ouput error message if it was not successful
-    if (parsed_json.success == false) {
-      var el_err = document.createElement('span');
-      el_err.className = 'arduino_dialog_out_error';
-      // If larger than 50 characters then don't bother looking for language key
-      if (parsed_json.output.length < 50) {
-        el_err.innerHTML = Ardublockly.getLocalStr(parsed_json.error_output) ||
-                           parsed_json.error_output.split('\n').join('<br />');
-      } else {
-        el_err.innerHTML = parsed_json.error_output.split('\n').join('<br />');
-      }
-      element.appendChild(el_err);
-    }
-  } else {
-    //TODO: Not recognised, alert the user/developer somehow
-  }
-
-  return element;
-};

BIN
src/renderer/cocoblockly-x/python/block/.DS_Store


+ 0 - 14
src/renderer/cocoblockly-x/python/block/.gitignore

@@ -1,14 +0,0 @@
-# Copyright 2013 The Closure Library Authors
-# Files to be ignored by git.
-
-# Use of this source code is governed by the Apache License, Version 2.0.
-# See the COPYING file for details.
-
-# emacs
-*~
-\#*#
-
-# python
-*.pyc
-
-node_modules/

+ 0 - 54
src/renderer/cocoblockly-x/python/block/.travis.yml

@@ -1,54 +0,0 @@
-# Copyright 2014 The Closure Library Authors. All Rights Reserved.
-#
-# Use of this source code is governed by the Apache License, Version 2.0.
-# See the LICENSE file for details.
-
-language: node_js
-sudo: required
-
-# This is required for Java 8 in non-java image
-dist: trusty
-
-cache:
-  directories:
-    - node_modules
-
-install:
-  # We need jdk8 for JsDossier; but this needs to come first because
-  # otherwise there is no java at all.
-  - jdk_switcher use oraclejdk8
-  - ./scripts/ci/install_closure_deps.sh
-
-before_script:
-  - ./scripts/http/simple_http_server.py 2> /dev/null & sleep 5
-  - ./scripts/ci/sauce_connect.sh
-  # Ensure we point to the version of clang-format that we installed in
-  # install_closure_deps.sh. Travis has an older version on the $PATH and
-  # clang-format-diff.py invokes "clang-format" with no option of specifying
-  # a binary path.
-  - export PATH=$PWD/../clang/bin/:$PATH
-  # Make a directory for gh-pages; will be used by both generate_latest_docs.sh
-  # and deploy_latest_docs.sh.
-  - export GH_PAGES=$(mktemp -d)
-
-script:
-  - ./scripts/ci/generate_latest_docs.sh
-  - ./scripts/ci/compile_closure.sh
-  - ./scripts/ci/lint_pull_request.sh
-  - ./scripts/ci/check_code_format.sh
-  - travis_wait 30 ./scripts/ci/run_all_tests.sh
-
-after_success:
-  - ./scripts/ci/push_latest_docs.sh
-
-env:
-  global:
-    - SAUCE_USERNAME=closure-sauce
-    - SAUCE_ACCESS_KEY=dfd98f70a612-e69a-ad34-6149-3ca056f8
-    - secure: "aEv7CF6ZvD2Fa67yv6yYtgFGjafCkpSP2Y+Dk2AyJCFLF3+L5ZFXpFoCtgYgCWezVDbeGpoojFeCzLu0ycWwnIwJpUQ/C8NBDR/x2Lqz2I6M2PfkEy91UhSE5nXe1RJMnna1715zeBmustiFKjdETWFZrpvxkHixBHbLfY3cJZw="
-
-addons:
-  apt:
-    packages:
-      # Required for jdk_switcher use oraclejdk8
-      - oracle-java8-installer

+ 0 - 27
src/renderer/cocoblockly-x/python/block/AUTHORS

@@ -1,27 +0,0 @@
-# This is a list of contributors to the Closure Library.
-
-# Names should be added to this file like so:
-# Name or Organization <email address>
-
-Google Inc.
-gigmade ltd.
-Mohamed Mansour <hello@mohamedmansour.com>
-Bjorn Tipling <bjorn.tipling@gmail.com>
-SameGoal LLC <help@samegoal.com>
-Guido Tapia <guido.tapia@gmail.com>
-Andrew Mattie <amattie@gmail.com>
-Ilia Mirkin <ibmirkin@gmail.com>
-Ivan Kozik <ivan.kozik@gmail.com>
-Rich Dougherty <rich@rd.gen.nz>
-Chad Killingsworth <chadkillingsworth@missouristate.edu>
-Dan Pupius <dan.pupius@gmail.com>
-Mike Dunn <dunn74@gmail.com>
-Kengo Toda <skypencil@gmail.com>
-Remember The Milk Inc.
-Anish Visaria <anishvisaria98@gmail.com>
-John Huân Vũ <jvu.calpoly@gmail.com>
-Peter Lu <peterlu83+github@gmail.com>
-Filipe Catraia <filipe.catraia@deliveryhero.com>
-Dan Rubalsky <drubalsky@plentakill.com>
-Michael Zhou <zhoumotongxue008@gmail.com>
-mash <mashedcode@users.noreply.github.com>

+ 0 - 44
src/renderer/cocoblockly-x/python/block/CONTRIBUTING

@@ -1,44 +0,0 @@
-Closure Library welcomes patches/pulls for features and bugfixes.
-
-For contributors external to Google, follow the instructions given here:
-
-Notes on Contributions to Closure Library
-
-Google Individual Contributor License
-
-In all cases, contributors must sign a contributor license agreement,
-either for an individual or corporation, before a patch can be
-accepted. Please fill out the agreement for an individual or a
-corporation, as appropriate.
-
-https://developers.google.com/open-source/cla/individual
-https://developers.google.com/open-source/cla/corporate
-
-If you or your organization is not listed there already, you should
-add an entry to the AUTHORS file as part of your patch.
-
-If you plan to add a significant component or large chunk of code, it
-is recommended to bring it up on the discussion list for a design
-discussion before writing code.
-
-If appropriate, write a unit test that demonstrates your patch. Tests are the
-best way to ensure that future contributors do not break your code
-accidentally.
-
-To change the Closure Library source, you must submit a pull request
-in GitHub. See the GitHub documentation here:
-
-https://help.github.com/categories/63/articles
-
-Closure Library developers monitor outstanding pull requests. They may
-request changes on the pull request before accepting. They will also
-verify that the CLA has been signed.
-
-Oftentimes, the pull request will not be directly merged, but patched to
-the internal Google codebase to verify that unit and integration tests
-will pass before submitting (and optionally make changes to the patch to
-match style, fix text, or to make the code or comments clearer). In this
-case, the issue associated with the pull request will be closed when the
-patch is pushed to the repository via the MOE (Make Open Easy) system.
-
-https://github.com/google/MOE/

+ 0 - 176
src/renderer/cocoblockly-x/python/block/LICENSE

@@ -1,176 +0,0 @@
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS

+ 0 - 38
src/renderer/cocoblockly-x/python/block/README.md

@@ -1,38 +0,0 @@
-# Closure Library [![Build Status](https://travis-ci.org/google/closure-library.svg?branch=master)](https://travis-ci.org/google/closure-library)
-
-Closure Library is a powerful, low-level JavaScript library designed
-for building complex and scalable web applications. It is used by many
-Google web applications, such as Google Search, Gmail, Google Docs,
-Google+, Google Maps, and others.
-
-For more information, visit the
-[Google Developers](https://developers.google.com/closure/library) or
-[GitHub](https://github.com/google/closure-library) sites.
-
-Download the latest stable version on our [releases page](https://github.com/google/closure-library/releases).
-
-Developers, please see the
-[Generated API Documentation](https://google.github.io/closure-library/api/).
-
-See also the
-[goog.ui Demos](https://google.github.io/closure-library/source/closure/goog/demos/)
-
-## Using with Node.js
-Install the [official package](https://www.npmjs.com/package/google-closure-library) from npm.
-
-```
-npm install google-closure-library
-```
-
-Require the package and use goog.require normally.
-
-```
-require("google-closure-library");
-
-goog.require("goog.crypt.Sha1");
-
-var sha1 = new goog.crypt.Sha1();
-sha1.update("foobar");
-var hash = sha1.digest();
-```
-

+ 0 - 111
src/renderer/cocoblockly-x/python/block/all_tests.html

@@ -1,111 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-Copyright 2009 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
-<head>
-<title>Closure - All JsUnit Tests</title>
-<script src="closure/goog/base.js"></script>
-<script src="alltests.js"></script>
-<script>
-goog.require('goog.userAgent.product');
-goog.require('goog.testing.MultiTestRunner');
-</script>
-<link rel="stylesheet" href="closure/goog/css/multitestrunner.css" type="text/css">
-<style>
-h1 {
-  font: normal x-large arial, helvetica, sans-serif;
-  margin: 0;
-}
-p, form {
-  font: normal small sans-serif;
-  margin: 0;
-}
-#header {
-  position: absolute;
-  right: 10px;
-  top: 13px;
-}
-#footer {
-  margin-top: 8px;
-}
-a {
-  text-decoration: none;
-}
-a:hover {
-  text-decoration: underline;
-}
-.warning {
-  font-size: 14px;
-  font-weight: bold;
-  width: 80%;
-}
-</style>
-</head>
-<body>
-
-<script>
-  if (goog.userAgent.product.CHROME &&
-      window.location.toString().indexOf('file:') == 0) {
-    document.write(
-        '<div class="warning">' +
-        'WARNING: Due to Chrome\'s security restrictions ' +
-        'this test will not be able to load files off your local disk ' +
-        'unless you start Chrome with:<br>' +
-        '<code>--allow-file-access-from-files</code></div><br>');
-  }
-</script>
-
-<h1>Closure - All JsUnit Tests</h1>
-<p id="header"></p>
-<div id="runner"></div>
-<!--  Use a form so browser persists input values -->
-<form id="footer" onsubmit="return false">
-  Settings:<br>
-  <input type="checkbox" name="hidepasses" id="hidepasses" checked>
-  <label for="hidepasses">Hide passes</label><br>
-  <input type="checkbox" name="parallel" id="parallel" checked>
-  <label for="parallel">Run in parallel</label>
-  <small>(timing stats not available if enabled)</small><br>
-  <input type="text" name="filter" id="filter" value="">
-  <label for="filter">Run only tests for path</label>
-</form>
-<script>
-  var hidePassesInput = document.getElementById('hidepasses');
-  var parallelInput = document.getElementById('parallel');
-  var filterInput = document.getElementById('filter');
-
-  function setFilterFunction() {
-    var matchValue = filterInput.value || '';
-    testRunner.setFilterFunction(function(testPath) {
-      return testPath.indexOf(matchValue) > -1;
-    });
-  }
-
-  // Create a test runner and render it.
-  var testRunner = new goog.testing.MultiTestRunner()
-      .setName(document.title)
-      .setBasePath('./')
-      .setPoolSize(parallelInput.checked ? 8 : 1)
-      .setStatsBucketSizes(5, 500)
-      .setHidePasses(hidePassesInput.checked)
-      //.setVerbosePasses(true)
-      .addTests(_allTests);
-  testRunner.render(document.getElementById('runner'));
-
-  goog.events.listen(hidePassesInput, 'click', function(e) {
-    testRunner.setHidePasses(e.target.checked);
-  });
-
-  goog.events.listen(parallelInput, 'click', function(e) {
-    testRunner.setPoolSize(e.target.checked ? 8 : 1);
-  });
-
-  goog.events.listen(filterInput, 'keyup', setFilterFunction);
-  setFilterFunction();
-</script>
-</body>
-</html>

+ 0 - 602
src/renderer/cocoblockly-x/python/block/alltests.js

@@ -1,602 +0,0 @@
-// Copyright 2009 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-var _allTests = [
-  'closure/goog/a11y/aria/announcer_test.html',
-  'closure/goog/a11y/aria/aria_test.html',
-  'closure/goog/array/array_test.html',
-  'closure/goog/asserts/asserts_test.html',
-  'closure/goog/async/animationdelay_test.html',
-  'closure/goog/async/conditionaldelay_test.html',
-  'closure/goog/async/debouncer_test.html',
-  'closure/goog/async/delay_test.html',
-  'closure/goog/async/nexttick_test.html',
-  'closure/goog/async/throttle_test.html',
-  'closure/goog/base_module_test.html',
-  'closure/goog/base_test.html',
-  'closure/goog/color/alpha_test.html',
-  'closure/goog/color/color_test.html',
-  'closure/goog/crypt/aes_test.html',
-  'closure/goog/crypt/arc4_test.html',
-  'closure/goog/crypt/base64_test.html',
-  'closure/goog/crypt/basen_test.html',
-  'closure/goog/crypt/blobhasher_test.html',
-  'closure/goog/crypt/cbc_test.html',
-  'closure/goog/crypt/crypt_test.html',
-  'closure/goog/crypt/hash32_test.html',
-  'closure/goog/crypt/hmac_test.html',
-  'closure/goog/crypt/md5_test.html',
-  'closure/goog/crypt/pbkdf2_test.html',
-  'closure/goog/crypt/sha1_test.html',
-  'closure/goog/crypt/sha224_test.html',
-  'closure/goog/crypt/sha256_test.html',
-  'closure/goog/crypt/sha2_64bit_test.html',
-  'closure/goog/cssom/cssom_test.html',
-  'closure/goog/cssom/iframe/style_test.html',
-  'closure/goog/datasource/datasource_test.html',
-  'closure/goog/datasource/expr_test.html',
-  'closure/goog/datasource/fastdatanode_test.html',
-  'closure/goog/datasource/jsxmlhttpdatasource_test.html',
-  'closure/goog/date/daterange_test.html',
-  'closure/goog/date/date_test.html',
-  'closure/goog/date/duration_test.html',
-  'closure/goog/date/relative_test.html',
-  'closure/goog/date/relativewithplurals_test.html',
-  'closure/goog/date/utcdatetime_test.html',
-  'closure/goog/debug/console_test.html',
-  'closure/goog/debug/debug_test.html',
-  'closure/goog/debug/debugwindow_test.html',
-  'closure/goog/debug/devcss/devcss_test.html',
-  'closure/goog/debug/enhanceerror_test.html',
-  'closure/goog/debug/entrypointregistry_test.html',
-  'closure/goog/debug/errorhandler_async_test.html',
-  'closure/goog/debug/errorhandler_test.html',
-  'closure/goog/debug/errorreporter_test.html',
-  'closure/goog/debug/error_test.html',
-  'closure/goog/debug/formatter_test.html',
-  'closure/goog/debug/fpsdisplay_test.html',
-  'closure/goog/debug/logbuffer_test.html',
-  'closure/goog/debug/logger_test.html',
-  'closure/goog/debug/logrecordserializer_test.html',
-  'closure/goog/debug/tracer_test.html',
-  'closure/goog/defineclass_test.html',
-  'closure/goog/disposable/disposable_test.html',
-  'closure/goog/dom/abstractrange_test.html',
-  'closure/goog/dom/annotate_test.html',
-  'closure/goog/dom/asserts_test.html',
-  'closure/goog/dom/browserrange/browserrange_test.html',
-  'closure/goog/dom/bufferedviewportsizemonitor_test.html',
-  'closure/goog/dom/classes_quirks_test.html',
-  'closure/goog/dom/classes_test.html',
-  'closure/goog/dom/classlist_test.html',
-  'closure/goog/dom/controlrange_test.html',
-  'closure/goog/dom/dataset_test.html',
-  'closure/goog/dom/dom_test.html',
-  'closure/goog/dom/fontsizemonitor_test.html',
-  'closure/goog/dom/forms_test.html',
-  'closure/goog/dom/iframe_test.html',
-  'closure/goog/dom/inputtype_test.html',
-  'closure/goog/dom/iter_test.html',
-  'closure/goog/dom/multirange_test.html',
-  'closure/goog/dom/nodeiterator_test.html',
-  'closure/goog/dom/nodeoffset_test.html',
-  'closure/goog/dom/pattern/matcher_test.html',
-  'closure/goog/dom/pattern/pattern_test.html',
-  'closure/goog/dom/range_test.html',
-  'closure/goog/dom/safe_test.html',
-  'closure/goog/dom/savedcaretrange_test.html',
-  'closure/goog/dom/savedrange_test.html',
-  'closure/goog/dom/selection_test.html',
-  'closure/goog/dom/tagiterator_test.html',
-  'closure/goog/dom/tagname_test.html',
-  'closure/goog/dom/textrangeiterator_test.html',
-  'closure/goog/dom/textrange_test.html',
-  'closure/goog/dom/vendor_test.html',
-  'closure/goog/dom/viewportsizemonitor_test.html',
-  'closure/goog/dom/xml_test.html',
-  'closure/goog/editor/clicktoeditwrapper_test.html',
-  'closure/goog/editor/contenteditablefield_test.html',
-  'closure/goog/editor/field_test.html',
-  'closure/goog/editor/focus_test.html',
-  'closure/goog/editor/icontent_test.html',
-  'closure/goog/editor/link_test.html',
-  'closure/goog/editor/node_test.html',
-  'closure/goog/editor/plugins/abstractbubbleplugin_test.html',
-  'closure/goog/editor/plugins/abstractdialogplugin_test.html',
-  'closure/goog/editor/plugins/abstracttabhandler_test.html',
-  'closure/goog/editor/plugins/basictextformatter_test.html',
-  'closure/goog/editor/plugins/blockquote_test.html',
-  'closure/goog/editor/plugins/emoticons_test.html',
-  'closure/goog/editor/plugins/enterhandler_test.html',
-  'closure/goog/editor/plugins/firststrong_test.html',
-  'closure/goog/editor/plugins/headerformatter_test.html',
-  'closure/goog/editor/plugins/linkbubble_test.html',
-  'closure/goog/editor/plugins/linkdialogplugin_test.html',
-  'closure/goog/editor/plugins/linkshortcutplugin_test.html',
-  'closure/goog/editor/plugins/listtabhandler_test.html',
-  'closure/goog/editor/plugins/loremipsum_test.html',
-  'closure/goog/editor/plugins/removeformatting_test.html',
-  'closure/goog/editor/plugins/spacestabhandler_test.html',
-  'closure/goog/editor/plugins/tableeditor_test.html',
-  'closure/goog/editor/plugins/tagonenterhandler_test.html',
-  'closure/goog/editor/plugins/undoredomanager_test.html',
-  'closure/goog/editor/plugins/undoredostate_test.html',
-  'closure/goog/editor/plugins/undoredo_test.html',
-  'closure/goog/editor/plugin_test.html',
-  'closure/goog/editor/range_test.html',
-  'closure/goog/editor/seamlessfield_quirks_test.html',
-  'closure/goog/editor/seamlessfield_test.html',
-  'closure/goog/editor/style_test.html',
-  'closure/goog/editor/table_test.html',
-  'closure/goog/events/actioneventwrapper_test.html',
-  'closure/goog/events/actionhandler_test.html',
-  'closure/goog/events/browserevent_test.html',
-  'closure/goog/events/eventhandler_test.html',
-  'closure/goog/events/events_test.html',
-  'closure/goog/events/eventtarget_test.html',
-  'closure/goog/events/eventtarget_via_googevents_test.html',
-  'closure/goog/events/eventtarget_via_w3cinterface_test.html',
-  'closure/goog/events/event_test.html',
-  'closure/goog/events/filedrophandler_test.html',
-  'closure/goog/events/imehandler_test.html',
-  'closure/goog/events/inputhandler_test.html',
-  'closure/goog/events/keycodes_test.html',
-  'closure/goog/events/keyhandler_test.html',
-  'closure/goog/events/listenable_test.html',
-  'closure/goog/events/listenermap_test.html',
-  'closure/goog/events/mousewheelhandler_test.html',
-  'closure/goog/events/onlinelistener_test.html',
-  'closure/goog/events/pastehandler_test.html',
-  'closure/goog/events/wheelhandler_test.html',
-  'closure/goog/format/emailaddress_test.html',
-  'closure/goog/format/format_test.html',
-  'closure/goog/format/htmlprettyprinter_test.html',
-  'closure/goog/format/internationalizedemailaddress_test.html',
-  'closure/goog/format/jsonprettyprinter_test.html',
-  'closure/goog/fs/fs_test.html',
-  'closure/goog/fs/url_test.html',
-  'closure/goog/functions/functions_test.html',
-  'closure/goog/fx/abstractdragdrop_test.html',
-  'closure/goog/fx/anim/anim_test.html',
-  'closure/goog/fx/animationqueue_test.html',
-  'closure/goog/fx/animation_test.html',
-  'closure/goog/fx/css3/transition_test.html',
-  'closure/goog/fx/cssspriteanimation_test.html',
-  'closure/goog/fx/dragdropgroup_test.html',
-  'closure/goog/fx/dragger_test.html',
-  'closure/goog/fx/draglistgroup_test.html',
-  'closure/goog/fx/dragscrollsupport_test.html',
-  'closure/goog/fx/fx_test.html',
-  'closure/goog/graphics/affinetransform_test.html',
-  'closure/goog/graphics/canvasgraphics_test.html',
-  'closure/goog/graphics/ext/coordinates_test.html',
-  'closure/goog/graphics/ext/element_test.html',
-  'closure/goog/graphics/ext/path_test.html',
-  'closure/goog/graphics/paths_test.html',
-  'closure/goog/graphics/path_test.html',
-  'closure/goog/graphics/solidfill_test.html',
-  'closure/goog/graphics/svggraphics_test.html',
-  'closure/goog/history/history_test.html',
-  'closure/goog/history/html5history_test.html',
-  'closure/goog/html/flash_test.html',
-  'closure/goog/html/legacyconversions_test.html',
-  'closure/goog/html/safehtmlformatter_test.html',
-  'closure/goog/html/safehtml_test.html',
-  'closure/goog/html/safescript_test.html',
-  'closure/goog/html/safestylesheet_test.html',
-  'closure/goog/html/safestyle_test.html',
-  'closure/goog/html/safeurl_test.html',
-  'closure/goog/html/silverlight_test.html',
-  'closure/goog/html/trustedresourceurl_test.html',
-  'closure/goog/html/uncheckedconversions_test.html',
-  'closure/goog/html/utils_test.html',
-  'closure/goog/i18n/bidiformatter_test.html',
-  'closure/goog/i18n/bidi_test.html',
-  'closure/goog/i18n/charlistdecompressor_test.html',
-  'closure/goog/i18n/collation_test.html',
-  'closure/goog/i18n/currency_test.html',
-  'closure/goog/i18n/dateintervalformat_test.html',
-  'closure/goog/i18n/datetimeformat_test.html',
-  'closure/goog/i18n/datetimeparse_test.html',
-  'closure/goog/i18n/graphemebreak_test.html',
-  'closure/goog/i18n/messageformat_test.html',
-  'closure/goog/i18n/mime_test.html',
-  'closure/goog/i18n/numberformat_test.html',
-  'closure/goog/i18n/pluralrules_test.html',
-  'closure/goog/i18n/timezone_test.html',
-  'closure/goog/i18n/uchar/localnamefetcher_test.html',
-  'closure/goog/i18n/uchar/remotenamefetcher_test.html',
-  'closure/goog/i18n/uchar_test.html',
-  'closure/goog/iter/es6_test.html',
-  'closure/goog/iter/iter_test.html',
-  'closure/goog/json/hybrid_test.html',
-  'closure/goog/json/json_test.html',
-  'closure/goog/json/processor_test.html',
-  'closure/goog/labs/events/nondisposableeventtarget_test.html',
-  'closure/goog/labs/events/nondisposableeventtarget_via_googevents_test.html',
-  'closure/goog/labs/events/touch_test.html',
-  'closure/goog/labs/format/csv_test.html',
-  'closure/goog/labs/i18n/listformat_test.html',
-  'closure/goog/labs/mock/mock_test.html',
-  'closure/goog/labs/net/image_test.html',
-  'closure/goog/labs/net/webchannel/channelrequest_test.html',
-  'closure/goog/labs/net/webchannel/forwardchannelrequestpool_test.html',
-  'closure/goog/labs/net/webchannel/webchannelbase_test.html',
-  'closure/goog/labs/net/webchannel/webchannelbasetransport_test.html',
-  'closure/goog/labs/net/webchannel/wirev8_test.html',
-  'closure/goog/labs/net/xhr_test.html',
-  'closure/goog/labs/storage/boundedcollectablestorage_test.html',
-  'closure/goog/labs/structs/map_test.html',
-  'closure/goog/labs/structs/multimap_test.html',
-  'closure/goog/labs/style/pixeldensitymonitor_test.html',
-  'closure/goog/labs/testing/assertthat_test.html',
-  'closure/goog/labs/testing/decoratormatcher_test.html',
-  'closure/goog/labs/testing/dictionarymatcher_test.html',
-  'closure/goog/labs/testing/environment_test.html',
-  'closure/goog/labs/testing/json_fuzzing_test.html',
-  'closure/goog/labs/testing/logicmatcher_test.html',
-  'closure/goog/labs/testing/numbermatcher_test.html',
-  'closure/goog/labs/testing/objectmatcher_test.html',
-  'closure/goog/labs/testing/stringmatcher_test.html',
-  'closure/goog/labs/useragent/browser_test.html',
-  'closure/goog/labs/useragent/device_test.html',
-  'closure/goog/labs/useragent/engine_test.html',
-  'closure/goog/labs/useragent/platform_test.html',
-  'closure/goog/labs/useragent/util_test.html',
-  'closure/goog/labs/useragent/verifier_test.html',
-  'closure/goog/locale/countrylanguagenames_test.html',
-  'closure/goog/locale/genericfontnames_test.html',
-  'closure/goog/locale/timezonedetection_test.html',
-  'closure/goog/locale/timezonelist_test.html',
-  'closure/goog/math/affinetransform_test.html',
-  'closure/goog/math/bezier_test.html',
-  'closure/goog/math/box_test.html',
-  'closure/goog/math/coordinate3_test.html',
-  'closure/goog/math/coordinate_test.html',
-  'closure/goog/math/exponentialbackoff_test.html',
-  'closure/goog/math/integer_test.html',
-  'closure/goog/math/interpolator/linear1_test.html',
-  'closure/goog/math/interpolator/pchip1_test.html',
-  'closure/goog/math/interpolator/spline1_test.html',
-  'closure/goog/math/line_test.html',
-  'closure/goog/math/long_test.html',
-  'closure/goog/math/math_test.html',
-  'closure/goog/math/matrix_test.html',
-  'closure/goog/math/paths_test.html',
-  'closure/goog/math/path_test.html',
-  'closure/goog/math/rangeset_test.html',
-  'closure/goog/math/range_test.html',
-  'closure/goog/math/rect_test.html',
-  'closure/goog/math/size_test.html',
-  'closure/goog/math/tdma_test.html',
-  'closure/goog/math/vec2_test.html',
-  'closure/goog/math/vec3_test.html',
-  'closure/goog/memoize/memoize_test.html',
-  'closure/goog/messaging/abstractchannel_test.html',
-  'closure/goog/messaging/bufferedchannel_test.html',
-  'closure/goog/messaging/deferredchannel_test.html',
-  'closure/goog/messaging/loggerclient_test.html',
-  'closure/goog/messaging/loggerserver_test.html',
-  'closure/goog/messaging/messaging_test.html',
-  'closure/goog/messaging/multichannel_test.html',
-  'closure/goog/messaging/portcaller_test.html',
-  'closure/goog/messaging/portchannel_test.html',
-  'closure/goog/messaging/portnetwork_test.html',
-  'closure/goog/messaging/portoperator_test.html',
-  'closure/goog/messaging/respondingchannel_test.html',
-  'closure/goog/module/moduleinfo_test.html',
-  'closure/goog/module/moduleloadcallback_test.html',
-  'closure/goog/module/moduleloader_test.html',
-  'closure/goog/module/modulemanager_test.html',
-  'closure/goog/net/browserchannel_test.html',
-  'closure/goog/net/bulkloader_test.html',
-  'closure/goog/net/channelrequest_test.html',
-  'closure/goog/net/cookies_test.html',
-  'closure/goog/net/corsxmlhttpfactory_test.html',
-  'closure/goog/net/crossdomainrpc_test.html',
-  'closure/goog/net/filedownloader_test.html',
-  'closure/goog/net/iframeio_different_base_test.html',
-  'closure/goog/net/iframeio_test.html',
-  'closure/goog/net/iframeloadmonitor_test.html',
-  'closure/goog/net/imageloader_test.html',
-  'closure/goog/net/ipaddress_test.html',
-  'closure/goog/net/jsloader_test.html',
-  'closure/goog/net/jsonp_test.html',
-  'closure/goog/net/multiiframeloadmonitor_test.html',
-  'closure/goog/net/networktester_test.html',
-  'closure/goog/net/streams/base64streamdecoder_test.html',
-  'closure/goog/net/streams/jsonstreamparser_test.html',
-  'closure/goog/net/streams/pbstreamparser_test.html',
-  'closure/goog/net/streams/xhrnodereadablestream_test.html',
-  'closure/goog/net/streams/xhrstreamreader_test.html',
-  'closure/goog/net/websocket_test.html',
-  'closure/goog/net/xhriopool_test.html',
-  'closure/goog/net/xhrio_test.html',
-  'closure/goog/net/xhrmanager_test.html',
-  'closure/goog/net/xpc/iframepollingtransport_test.html',
-  'closure/goog/net/xpc/nativemessagingtransport_test.html',
-  'closure/goog/object/object_test.html',
-  'closure/goog/positioning/anchoredposition_test.html',
-  'closure/goog/positioning/anchoredviewportposition_test.html',
-  'closure/goog/positioning/clientposition_test.html',
-  'closure/goog/positioning/menuanchoredposition_test.html',
-  'closure/goog/positioning/positioning_test.html',
-  'closure/goog/positioning/viewportclientposition_test.html',
-  'closure/goog/promise/promise_test.html',
-  'closure/goog/proto2/descriptor_test.html',
-  'closure/goog/proto2/fielddescriptor_test.html',
-  'closure/goog/proto2/message_test.html',
-  'closure/goog/proto2/objectserializer_test.html',
-  'closure/goog/proto2/pbliteserializer_test.html',
-  'closure/goog/proto2/proto_test.html',
-  'closure/goog/proto2/textformatserializer_test.html',
-  'closure/goog/proto/serializer_test.html',
-  'closure/goog/pubsub/pubsub_test.html',
-  'closure/goog/pubsub/typedpubsub_test.html',
-  'closure/goog/reflect/reflect_test.html',
-  'closure/goog/result/chain_test.html',
-  'closure/goog/result/combine_test.html',
-  'closure/goog/result/deferredadaptor_test.html',
-  'closure/goog/result/resultutil_test.html',
-  'closure/goog/result/simpleresult_test.html',
-  'closure/goog/result/transform_test.html',
-  'closure/goog/result/wait_test.html',
-  'closure/goog/soy/data_test.html',
-  'closure/goog/soy/renderer_test.html',
-  'closure/goog/soy/soy_test.html',
-  'closure/goog/spell/spellcheck_test.html',
-  'closure/goog/stats/basicstat_test.html',
-  'closure/goog/storage/collectablestorage_test.html',
-  'closure/goog/storage/encryptedstorage_test.html',
-  'closure/goog/storage/expiringstorage_test.html',
-  'closure/goog/storage/mechanism/errorhandlingmechanism_test.html',
-  'closure/goog/storage/mechanism/html5localstorage_test.html',
-  'closure/goog/storage/mechanism/html5sessionstorage_test.html',
-  'closure/goog/storage/mechanism/html5webstorage_test.html',
-  'closure/goog/storage/mechanism/ieuserdata_test.html',
-  'closure/goog/storage/mechanism/mechanismfactory_test.html',
-  'closure/goog/storage/mechanism/prefixedmechanism_test.html',
-  'closure/goog/storage/richstorage_test.html',
-  'closure/goog/storage/storage_test.html',
-  'closure/goog/string/const_test.html',
-  'closure/goog/string/linkify_test.html',
-  'closure/goog/string/newlines_test.html',
-  'closure/goog/string/path_test.html',
-  'closure/goog/string/stringbuffer_test.html',
-  'closure/goog/string/stringformat_test.html',
-  'closure/goog/string/string_test.html',
-  'closure/goog/structs/avltree_test.html',
-  'closure/goog/structs/circularbuffer_test.html',
-  'closure/goog/structs/collection_test.html',
-  'closure/goog/structs/heap_test.html',
-  'closure/goog/structs/inversionmap_test.html',
-  'closure/goog/structs/linkedmap_test.html',
-  'closure/goog/structs/map_test.html',
-  'closure/goog/structs/pool_test.html',
-  'closure/goog/structs/prioritypool_test.html',
-  'closure/goog/structs/priorityqueue_test.html',
-  'closure/goog/structs/quadtree_test.html',
-  'closure/goog/structs/queue_test.html',
-  'closure/goog/structs/set_test.html',
-  'closure/goog/structs/stringset_test.html',
-  'closure/goog/structs/structs_test.html',
-  'closure/goog/structs/treenode_test.html',
-  'closure/goog/structs/trie_test.html',
-  'closure/goog/style/bidi_test.html',
-  'closure/goog/style/cursor_test.html',
-  'closure/goog/style/style_document_scroll_test.html',
-  'closure/goog/style/style_quirks_test.html',
-  'closure/goog/style/style_test.html',
-  'closure/goog/style/style_webkit_scrollbars_test.html',
-  'closure/goog/style/transition_test.html',
-  'closure/goog/testing/asserts_test.html',
-  'closure/goog/testing/async/mockcontrol_test.html',
-  'closure/goog/testing/asynctestcase_async_test.html',
-  'closure/goog/testing/asynctestcase_noasync_test.html',
-  'closure/goog/testing/asynctestcase_test.html',
-  'closure/goog/testing/continuationtestcase_test.html',
-  'closure/goog/testing/deferredtestcase_test.html',
-  'closure/goog/testing/dom_test.html',
-  'closure/goog/testing/editor/dom_test.html',
-  'closure/goog/testing/editor/testhelper_test.html',
-  'closure/goog/testing/events/eventobserver_test.html',
-  'closure/goog/testing/events/events_test.html',
-  'closure/goog/testing/events/matchers_test.html',
-  'closure/goog/testing/events/onlinehandler_test.html',
-  'closure/goog/testing/expectedfailures_test.html',
-  'closure/goog/testing/fs/blob_test.html',
-  'closure/goog/testing/fs/directoryentry_test.html',
-  'closure/goog/testing/fs/entry_test.html',
-  'closure/goog/testing/fs/fileentry_test.html',
-  'closure/goog/testing/fs/filereader_test.html',
-  'closure/goog/testing/fs/filewriter_test.html',
-  'closure/goog/testing/fs/fs_test.html',
-  'closure/goog/testing/fs/integration_test.html',
-  'closure/goog/testing/functionmock_test.html',
-  'closure/goog/testing/i18n/asserts_test.html',
-  'closure/goog/testing/loosemock_test.html',
-  'closure/goog/testing/mockclassfactory_test.html',
-  'closure/goog/testing/mockclock_test.html',
-  'closure/goog/testing/mockcontrol_test.html',
-  'closure/goog/testing/mockmatchers_test.html',
-  'closure/goog/testing/mockrandom_test.html',
-  'closure/goog/testing/mockrange_test.html',
-  'closure/goog/testing/mockstorage_test.html',
-  'closure/goog/testing/mock_test.html',
-  'closure/goog/testing/mockuseragent_test.html',
-  'closure/goog/testing/multitestrunner_test.html',
-  'closure/goog/testing/net/xhrio_test.html',
-  'closure/goog/testing/parallel_closure_test_suite_test.html',
-  'closure/goog/testing/performancetimer_test.html',
-  'closure/goog/testing/propertyreplacer_test.html',
-  'closure/goog/testing/proto2/proto2_test.html',
-  'closure/goog/testing/pseudorandom_test.html',
-  'closure/goog/testing/recordfunction_test.html',
-  'closure/goog/testing/shardingtestcase_test.html',
-  'closure/goog/testing/singleton_test.html',
-  'closure/goog/testing/stacktrace_test.html',
-  'closure/goog/testing/strictmock_test.html',
-  'closure/goog/testing/style/layoutasserts_test.html',
-  'closure/goog/testing/style/style_test.html',
-  'closure/goog/testing/ui/rendererasserts_test.html',
-  'closure/goog/testing/ui/style_test.html',
-  'closure/goog/timer/timer_test.html',
-  'closure/goog/tweak/entries_test.html',
-  'closure/goog/tweak/registry_test.html',
-  'closure/goog/tweak/tweakui_test.html',
-  'closure/goog/ui/ac/ac_test.html',
-  'closure/goog/ui/ac/arraymatcher_test.html',
-  'closure/goog/ui/ac/autocomplete_test.html',
-  'closure/goog/ui/ac/cachingmatcher_test.html',
-  'closure/goog/ui/ac/inputhandler_test.html',
-  'closure/goog/ui/ac/remotearraymatcher_test.html',
-  'closure/goog/ui/ac/renderer_test.html',
-  'closure/goog/ui/ac/richremotearraymatcher_test.html',
-  'closure/goog/ui/advancedtooltip_test.html',
-  'closure/goog/ui/animatedzippy_test.html',
-  'closure/goog/ui/bidiinput_test.html',
-  'closure/goog/ui/buttonrenderer_test.html',
-  'closure/goog/ui/button_test.html',
-  'closure/goog/ui/charcounter_test.html',
-  'closure/goog/ui/charpicker_test.html',
-  'closure/goog/ui/checkbox_test.html',
-  'closure/goog/ui/colormenubuttonrenderer_test.html',
-  'closure/goog/ui/colorpalette_test.html',
-  'closure/goog/ui/combobox_test.html',
-  'closure/goog/ui/component_test.html',
-  'closure/goog/ui/containerrenderer_test.html',
-  'closure/goog/ui/containerscroller_test.html',
-  'closure/goog/ui/container_test.html',
-  'closure/goog/ui/controlrenderer_test.html',
-  'closure/goog/ui/control_test.html',
-  'closure/goog/ui/cookieeditor_test.html',
-  'closure/goog/ui/customcolorpalette_test.html',
-  'closure/goog/ui/datepicker_test.html',
-  'closure/goog/ui/decorate_test.html',
-  'closure/goog/ui/dimensionpickerrenderer_test.html',
-  'closure/goog/ui/dimensionpicker_test.html',
-  'closure/goog/ui/drilldownrow_test.html',
-  'closure/goog/ui/editor/abstractdialog_test.html',
-  'closure/goog/ui/editor/linkdialog_test.html',
-  'closure/goog/ui/editor/toolbarfactory_test.html',
-  'closure/goog/ui/emoji/emojipicker_test.html',
-  'closure/goog/ui/emoji/popupemojipicker_test.html',
-  'closure/goog/ui/emoji/spriteinfo_test.html',
-  'closure/goog/ui/filteredmenu_test.html',
-  'closure/goog/ui/formpost_test.html',
-  'closure/goog/ui/hovercard_test.html',
-  'closure/goog/ui/hsvapalette_test.html',
-  'closure/goog/ui/hsvpalette_test.html',
-  'closure/goog/ui/idletimer_test.html',
-  'closure/goog/ui/iframemask_test.html',
-  'closure/goog/ui/inputdatepicker_test.html',
-  'closure/goog/ui/keyboardshortcuthandler_test.html',
-  'closure/goog/ui/media/flashobject_test.html',
-  'closure/goog/ui/media/flickr_test.html',
-  'closure/goog/ui/media/googlevideo_test.html',
-  'closure/goog/ui/media/mediamodel_test.html',
-  'closure/goog/ui/media/media_test.html',
-  'closure/goog/ui/media/mp3_test.html',
-  'closure/goog/ui/media/photo_test.html',
-  'closure/goog/ui/media/picasa_test.html',
-  'closure/goog/ui/media/vimeo_test.html',
-  'closure/goog/ui/media/youtube_test.html',
-  'closure/goog/ui/menubuttonrenderer_test.html',
-  'closure/goog/ui/menuitemrenderer_test.html',
-  'closure/goog/ui/menuitem_test.html',
-  'closure/goog/ui/menuseparatorrenderer_test.html',
-  'closure/goog/ui/menu_test.html',
-  'closure/goog/ui/mockactivitymonitor_test.html',
-  'closure/goog/ui/modalariavisibilityhelper_test.html',
-  'closure/goog/ui/modalpopup_test.html',
-  'closure/goog/ui/nativebuttonrenderer_test.html',
-  'closure/goog/ui/paletterenderer_test.html',
-  'closure/goog/ui/palette_test.html',
-  'closure/goog/ui/plaintextspellchecker_test.html',
-  'closure/goog/ui/popupbase_test.html',
-  'closure/goog/ui/popupcolorpicker_test.html',
-  'closure/goog/ui/popupdatepicker_test.html',
-  'closure/goog/ui/popupmenu_test.html',
-  'closure/goog/ui/popup_test.html',
-  'closure/goog/ui/prompt_test.html',
-  'closure/goog/ui/rangemodel_test.html',
-  'closure/goog/ui/registry_test.html',
-  'closure/goog/ui/richtextspellchecker_test.html',
-  'closure/goog/ui/roundedpanel_test.html',
-  'closure/goog/ui/scrollfloater_test.html',
-  'closure/goog/ui/selectionmenubutton_test.html',
-  'closure/goog/ui/selectionmodel_test.html',
-  'closure/goog/ui/select_test.html',
-  'closure/goog/ui/serverchart_test.html',
-  'closure/goog/ui/sliderbase_test.html',
-  'closure/goog/ui/splitpane_test.html',
-  'closure/goog/ui/style/app/buttonrenderer_test.html',
-  'closure/goog/ui/style/app/menubuttonrenderer_test.html',
-  'closure/goog/ui/style/app/primaryactionbuttonrenderer_test.html',
-  'closure/goog/ui/submenu_test.html',
-  'closure/goog/ui/tabbarrenderer_test.html',
-  'closure/goog/ui/tabbar_test.html',
-  'closure/goog/ui/tablesorter_test.html',
-  'closure/goog/ui/tabpane_test.html',
-  'closure/goog/ui/tabrenderer_test.html',
-  'closure/goog/ui/tab_test.html',
-  'closure/goog/ui/textarea_test.html',
-  'closure/goog/ui/toolbarcolormenubuttonrenderer_test.html',
-  'closure/goog/ui/toolbarseparatorrenderer_test.html',
-  'closure/goog/ui/toolbar_test.html',
-  'closure/goog/ui/tree/basenode_test.html',
-  'closure/goog/ui/tree/treecontrol_test.html',
-  'closure/goog/ui/tree/typeahead_test.html',
-  'closure/goog/ui/twothumbslider_test.html',
-  'closure/goog/ui/zippy_test.html',
-  'closure/goog/uri/uri_test.html',
-  'closure/goog/uri/utils_test.html',
-  'closure/goog/useragent/adobereader_test.html',
-  'closure/goog/useragent/flash_test.html',
-  'closure/goog/useragent/jscript_test.html',
-  'closure/goog/useragent/platform_test.html',
-  'closure/goog/useragent/product_test.html',
-  'closure/goog/useragent/useragent_quirks_test.html',
-  'closure/goog/useragent/useragent_test.html',
-  'closure/goog/vec/float32array_test.html',
-  'closure/goog/vec/float64array_test.html',
-  'closure/goog/vec/mat3d_test.html',
-  'closure/goog/vec/mat3f_test.html',
-  'closure/goog/vec/mat3_test.html',
-  'closure/goog/vec/mat4d_test.html',
-  'closure/goog/vec/mat4f_test.html',
-  'closure/goog/vec/mat4_test.html',
-  'closure/goog/vec/quaternion_test.html',
-  'closure/goog/vec/ray_test.html',
-  'closure/goog/vec/vec2d_test.html',
-  'closure/goog/vec/vec2f_test.html',
-  'closure/goog/vec/vec2_test.html',
-  'closure/goog/vec/vec3d_test.html',
-  'closure/goog/vec/vec3f_test.html',
-  'closure/goog/vec/vec3_test.html',
-  'closure/goog/vec/vec4d_test.html',
-  'closure/goog/vec/vec4f_test.html',
-  'closure/goog/vec/vec4_test.html',
-  'third_party/closure/goog/dojo/dom/query_test.html',
-  'third_party/closure/goog/loremipsum/text/loremipsum_test.html',
-  'third_party/closure/goog/mochikit/async/deferred_async_test.html',
-  'third_party/closure/goog/mochikit/async/deferredlist_test.html',
-  'third_party/closure/goog/mochikit/async/deferred_test.html'
-];
-
-// If we're running in a nodejs context, export tests. Used when running tests
-// externally on Travis.
-if (typeof module !== 'undefined' && module.exports) {
-  module.exports = _allTests;
-}

+ 0 - 32
src/renderer/cocoblockly-x/python/block/browser_capabilities.js

@@ -1,32 +0,0 @@
-var sauceBrowsers = require('./sauce_browsers.json');
-
-function getBrowserName(browserCap) {
-  var name = browserCap.browserName == 'internet explorer' ?
-      'ie' :
-      browserCap.browserName;
-  var version = browserCap.version || '-latest';
-  return name + version;
-}
-
-function getJobName(browserCap) {
-  var browserName = getBrowserName(browserCap);
-
-  return process.env.TRAVIS_PULL_REQUEST == 'false' ?
-      'CO-' + process.env.TRAVIS_BRANCH + '-' + browserName :
-      'PR-' + process.env.TRAVIS_PULL_REQUEST + '-' + browserName + '-' +
-          process.env.TRAVIS_BRANCH;
-}
-
-function getBrowserCapabilities(browsers) {
-  var caps = [];
-  for (var i = 0; i < browsers.length; i++) {
-    var b = browsers[i];
-    b['tunnel-identifier'] = process.env.TRAVIS_JOB_NUMBER;
-    b['build'] = process.env.TRAVIS_BUILD_NUMBER;
-    b['name'] = getJobName(b);
-    caps.push(b);
-  }
-  return caps;
-}
-
-module.exports = getBrowserCapabilities(sauceBrowsers);

+ 0 - 293
src/renderer/cocoblockly-x/python/block/closure/bin/build/closurebuilder.py

@@ -1,293 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2009 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""Utility for Closure Library dependency calculation.
-
-ClosureBuilder scans source files to build dependency info.  From the
-dependencies, the script can produce a manifest in dependency order,
-a concatenated script, or compiled output from the Closure Compiler.
-
-Paths to files can be expressed as individual arguments to the tool (intended
-for use with find and xargs).  As a convenience, --root can be used to specify
-all JS files below a directory.
-
-usage: %prog [options] [file1.js file2.js ...]
-"""
-
-__author__ = 'nnaze@google.com (Nathan Naze)'
-
-
-import io
-import logging
-import optparse
-import os
-import sys
-
-import depstree
-import jscompiler
-import source
-import treescan
-
-
-def _GetOptionsParser():
-  """Get the options parser."""
-
-  parser = optparse.OptionParser(__doc__)
-  parser.add_option('-i',
-                    '--input',
-                    dest='inputs',
-                    action='append',
-                    default=[],
-                    help='One or more input files to calculate dependencies '
-                    'for.  The namespaces in this file will be combined with '
-                    'those given with the -n flag to form the set of '
-                    'namespaces to find dependencies for.')
-  parser.add_option('-n',
-                    '--namespace',
-                    dest='namespaces',
-                    action='append',
-                    default=[],
-                    help='One or more namespaces to calculate dependencies '
-                    'for.  These namespaces will be combined with those given '
-                    'with the -i flag to form the set of namespaces to find '
-                    'dependencies for.  A Closure namespace is a '
-                    'dot-delimited path expression declared with a call to '
-                    'goog.provide() (e.g. "goog.array" or "foo.bar").')
-  parser.add_option('--root',
-                    dest='roots',
-                    action='append',
-                    default=[],
-                    help='The paths that should be traversed to build the '
-                    'dependencies.')
-  parser.add_option('-o',
-                    '--output_mode',
-                    dest='output_mode',
-                    type='choice',
-                    action='store',
-                    choices=['list', 'script', 'compiled'],
-                    default='list',
-                    help='The type of output to generate from this script. '
-                    'Options are "list" for a list of filenames, "script" '
-                    'for a single script containing the contents of all the '
-                    'files, or "compiled" to produce compiled output with '
-                    'the Closure Compiler.  Default is "list".')
-  parser.add_option('-c',
-                    '--compiler_jar',
-                    dest='compiler_jar',
-                    action='store',
-                    help='The location of the Closure compiler .jar file.')
-  parser.add_option('-f',
-                    '--compiler_flags',
-                    dest='compiler_flags',
-                    default=[],
-                    action='append',
-                    help='Additional flags to pass to the Closure compiler. '
-                    'To pass multiple flags, --compiler_flags has to be '
-                    'specified multiple times.')
-  parser.add_option('-j',
-                    '--jvm_flags',
-                    dest='jvm_flags',
-                    default=[],
-                    action='append',
-                    help='Additional flags to pass to the JVM compiler. '
-                    'To pass multiple flags, --jvm_flags has to be '
-                    'specified multiple times.')
-  parser.add_option('--output_file',
-                    dest='output_file',
-                    action='store',
-                    help=('If specified, write output to this path instead of '
-                          'writing to standard output.'))
-
-  return parser
-
-
-def _GetInputByPath(path, sources):
-  """Get the source identified by a path.
-
-  Args:
-    path: str, A path to a file that identifies a source.
-    sources: An iterable collection of source objects.
-
-  Returns:
-    The source from sources identified by path, if found.  Converts to
-    real paths for comparison.
-  """
-  for js_source in sources:
-    # Convert both to real paths for comparison.
-    if os.path.realpath(path) == os.path.realpath(js_source.GetPath()):
-      return js_source
-
-
-def _GetClosureBaseFile(sources):
-  """Given a set of sources, returns the one base.js file.
-
-  Note that if zero or two or more base.js files are found, an error message
-  will be written and the program will be exited.
-
-  Args:
-    sources: An iterable of _PathSource objects.
-
-  Returns:
-    The _PathSource representing the base Closure file.
-  """
-  base_files = [
-      js_source for js_source in sources if _IsClosureBaseFile(js_source)
-  ]
-
-  if not base_files:
-    logging.error('No Closure base.js file found.')
-    sys.exit(1)
-  if len(base_files) > 1:
-    logging.error('More than one Closure base.js files found at these paths:')
-    for base_file in base_files:
-      logging.error(base_file.GetPath())
-    sys.exit(1)
-  return base_files[0]
-
-
-def _IsClosureBaseFile(js_source):
-  """Returns true if the given _PathSource is the Closure base.js source."""
-  return (os.path.basename(js_source.GetPath()) == 'base.js' and
-          js_source.provides == set(['goog']))
-
-
-class _PathSource(source.Source):
-  """Source file subclass that remembers its file path."""
-
-  def __init__(self, path):
-    """Initialize a source.
-
-    Args:
-      path: str, Path to a JavaScript file.  The source string will be read
-        from this file.
-    """
-    super(_PathSource, self).__init__(source.GetFileContents(path))
-
-    self._path = path
-
-  def __str__(self):
-    return 'PathSource %s' % self._path
-
-  def GetPath(self):
-    """Returns the path."""
-    return self._path
-
-
-def _WrapGoogModuleSource(src):
-  return (u'goog.loadModule(function(exports) {{'
-          '"use strict";'
-          '{0}'
-          '\n'  # terminate any trailing single line comment.
-          ';return exports'
-          '}});\n').format(src)
-
-
-def main():
-  logging.basicConfig(format=(sys.argv[0] + ': %(message)s'),
-                      level=logging.INFO)
-  options, args = _GetOptionsParser().parse_args()
-
-  # Make our output pipe.
-  if options.output_file:
-    out = io.open(options.output_file, 'wb')
-  else:
-    version = sys.version_info[:2]
-    if version >= (3, 0):
-      # Write bytes to stdout
-      out = sys.stdout.buffer
-    else:
-      out = sys.stdout
-
-  sources = set()
-
-  logging.info('Scanning paths...')
-  for path in options.roots:
-    for js_path in treescan.ScanTreeForJsFiles(path):
-      sources.add(_PathSource(js_path))
-
-  # Add scripts specified on the command line.
-  for js_path in args:
-    sources.add(_PathSource(js_path))
-
-  logging.info('%s sources scanned.', len(sources))
-
-  # Though deps output doesn't need to query the tree, we still build it
-  # to validate dependencies.
-  logging.info('Building dependency tree..')
-  tree = depstree.DepsTree(sources)
-
-  input_namespaces = set()
-  inputs = options.inputs or []
-  for input_path in inputs:
-    js_input = _GetInputByPath(input_path, sources)
-    if not js_input:
-      logging.error('No source matched input %s', input_path)
-      sys.exit(1)
-    input_namespaces.update(js_input.provides)
-
-  input_namespaces.update(options.namespaces)
-
-  if not input_namespaces:
-    logging.error('No namespaces found. At least one namespace must be '
-                  'specified with the --namespace or --input flags.')
-    sys.exit(2)
-
-  # The Closure Library base file must go first.
-  base = _GetClosureBaseFile(sources)
-  deps = [base] + tree.GetDependencies(input_namespaces)
-
-  output_mode = options.output_mode
-  if output_mode == 'list':
-    out.writelines([js_source.GetPath() + '\n' for js_source in deps])
-  elif output_mode == 'script':
-    for js_source in deps:
-      src = js_source.GetSource()
-      if js_source.is_goog_module:
-        src = _WrapGoogModuleSource(src)
-      out.write(src.encode('utf-8') + b'\n')
-  elif output_mode == 'compiled':
-    logging.warning("""\
-Closure Compiler now natively understands and orders Closure dependencies and
-is prefererred over using this script for performing JavaScript compilation.
-
-Please migrate your codebase.
-
-See:
-https://github.com/google/closure-compiler/wiki/Managing-Dependencies
-""")
-
-    # Make sure a .jar is specified.
-    if not options.compiler_jar:
-      logging.error('--compiler_jar flag must be specified if --output is '
-                    '"compiled"')
-      sys.exit(2)
-
-    # Will throw an error if the compilation fails.
-    compiled_source = jscompiler.Compile(options.compiler_jar,
-                                         [js_source.GetPath()
-                                          for js_source in deps],
-                                         jvm_flags=options.jvm_flags,
-                                         compiler_flags=options.compiler_flags)
-
-    logging.info('JavaScript compilation succeeded.')
-    out.write(compiled_source.encode('utf-8'))
-
-  else:
-    logging.error('Invalid value for --output flag.')
-    sys.exit(2)
-
-
-if __name__ == '__main__':
-  main()

+ 0 - 189
src/renderer/cocoblockly-x/python/block/closure/bin/build/depstree.py

@@ -1,189 +0,0 @@
-# Copyright 2009 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""Class to represent a full Closure Library dependency tree.
-
-Offers a queryable tree of dependencies of a given set of sources.  The tree
-will also do logical validation to prevent duplicate provides and circular
-dependencies.
-"""
-
-__author__ = 'nnaze@google.com (Nathan Naze)'
-
-
-class DepsTree(object):
-  """Represents the set of dependencies between source files."""
-
-  def __init__(self, sources):
-    """Initializes the tree with a set of sources.
-
-    Args:
-      sources: A set of JavaScript sources.
-
-    Raises:
-      MultipleProvideError: A namespace is provided by muplitple sources.
-      NamespaceNotFoundError: A namespace is required but never provided.
-    """
-
-    self._sources = sources
-    self._provides_map = dict()
-
-    # Ensure nothing was provided twice.
-    for source in sources:
-      for provide in source.provides:
-        if provide in self._provides_map:
-          raise MultipleProvideError(
-              provide, [self._provides_map[provide], source])
-
-        self._provides_map[provide] = source
-
-    # Check that all required namespaces are provided.
-    for source in sources:
-      for require in source.requires:
-        if require not in self._provides_map:
-          raise NamespaceNotFoundError(require, source)
-
-  def GetDependencies(self, required_namespaces):
-    """Get source dependencies, in order, for the given namespaces.
-
-    Args:
-      required_namespaces: A string (for one) or list (for one or more) of
-        namespaces.
-
-    Returns:
-      A list of source objects that provide those namespaces and all
-      requirements, in dependency order.
-
-    Raises:
-      NamespaceNotFoundError: A namespace is requested but doesn't exist.
-      CircularDependencyError: A cycle is detected in the dependency tree.
-    """
-    if isinstance(required_namespaces, str):
-      required_namespaces = [required_namespaces]
-
-    deps_sources = []
-
-    for namespace in required_namespaces:
-      for source in DepsTree._ResolveDependencies(
-          namespace, [], self._provides_map, []):
-        if source not in deps_sources:
-          deps_sources.append(source)
-
-    return deps_sources
-
-  @staticmethod
-  def _ResolveDependencies(required_namespace, deps_list, provides_map,
-                           traversal_path):
-    """Resolve dependencies for Closure source files.
-
-    Follows the dependency tree down and builds a list of sources in dependency
-    order.  This function will recursively call itself to fill all dependencies
-    below the requested namespaces, and then append its sources at the end of
-    the list.
-
-    Args:
-      required_namespace: String of required namespace.
-      deps_list: List of sources in dependency order.  This function will append
-        the required source once all of its dependencies are satisfied.
-      provides_map: Map from namespace to source that provides it.
-      traversal_path: List of namespaces of our path from the root down the
-        dependency/recursion tree.  Used to identify cyclical dependencies.
-        This is a list used as a stack -- when the function is entered, the
-        current namespace is pushed and popped right before returning.
-        Each recursive call will check that the current namespace does not
-        appear in the list, throwing a CircularDependencyError if it does.
-
-    Returns:
-      The given deps_list object filled with sources in dependency order.
-
-    Raises:
-      NamespaceNotFoundError: A namespace is requested but doesn't exist.
-      CircularDependencyError: A cycle is detected in the dependency tree.
-    """
-
-    source = provides_map.get(required_namespace)
-    if not source:
-      raise NamespaceNotFoundError(required_namespace)
-
-    if required_namespace in traversal_path:
-      traversal_path.append(required_namespace)  # do this *after* the test
-
-      # This must be a cycle.
-      raise CircularDependencyError(traversal_path)
-
-    # If we don't have the source yet, we'll have to visit this namespace and
-    # add the required dependencies to deps_list.
-    if source not in deps_list:
-      traversal_path.append(required_namespace)
-
-      for require in source.requires:
-
-        # Append all other dependencies before we append our own.
-        DepsTree._ResolveDependencies(require, deps_list, provides_map,
-                                      traversal_path)
-      deps_list.append(source)
-
-      traversal_path.pop()
-
-    return deps_list
-
-
-class BaseDepsTreeError(Exception):
-  """Base DepsTree error."""
-
-  def __init__(self):
-    Exception.__init__(self)
-
-
-class CircularDependencyError(BaseDepsTreeError):
-  """Raised when a dependency cycle is encountered."""
-
-  def __init__(self, dependency_list):
-    BaseDepsTreeError.__init__(self)
-    self._dependency_list = dependency_list
-
-  def __str__(self):
-    return ('Encountered circular dependency:\n%s\n' %
-            '\n'.join(self._dependency_list))
-
-
-class MultipleProvideError(BaseDepsTreeError):
-  """Raised when a namespace is provided more than once."""
-
-  def __init__(self, namespace, sources):
-    BaseDepsTreeError.__init__(self)
-    self._namespace = namespace
-    self._sources = sources
-
-  def __str__(self):
-    source_strs = map(str, self._sources)
-
-    return ('Namespace "%s" provided more than once in sources:\n%s\n' %
-            (self._namespace, '\n'.join(source_strs)))
-
-
-class NamespaceNotFoundError(BaseDepsTreeError):
-  """Raised when a namespace is requested but not provided."""
-
-  def __init__(self, namespace, source=None):
-    BaseDepsTreeError.__init__(self)
-    self._namespace = namespace
-    self._source = source
-
-  def __str__(self):
-    msg = 'Namespace "%s" never provided.' % self._namespace
-    if self._source:
-      msg += ' Required in %s' % self._source
-    return msg

+ 0 - 127
src/renderer/cocoblockly-x/python/block/closure/bin/build/depstree_test.py

@@ -1,127 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2009 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""Unit test for depstree."""
-
-__author__ = 'nnaze@google.com (Nathan Naze)'
-
-
-import unittest
-
-import depstree
-
-
-def _GetProvides(sources):
-  """Get all namespaces provided by a collection of sources."""
-
-  provides = set()
-  for source in sources:
-    provides.update(source.provides)
-  return provides
-
-
-class MockSource(object):
-  """Mock Source file."""
-
-  def __init__(self, provides, requires):
-    self.provides = set(provides)
-    self.requires = set(requires)
-
-  def __repr__(self):
-    return 'MockSource %s' % self.provides
-
-
-class DepsTreeTestCase(unittest.TestCase):
-  """Unit test for DepsTree.  Tests several common situations and errors."""
-
-  def AssertValidDependencies(self, deps_list):
-    """Validates a dependency list.
-
-    Asserts that a dependency list is valid: For every source in the list,
-    ensure that every require is provided by a source earlier in the list.
-
-    Args:
-      deps_list: A list of sources that should be in dependency order.
-    """
-
-    for i in range(len(deps_list)):
-      source = deps_list[i]
-      previous_provides = _GetProvides(deps_list[:i])
-      for require in source.requires:
-        self.assertTrue(
-            require in previous_provides,
-            'Namespace "%s" not provided before required by %s' % (
-                require, source))
-
-  def testSimpleDepsTree(self):
-    a = MockSource(['A'], ['B', 'C'])
-    b = MockSource(['B'], [])
-    c = MockSource(['C'], ['D'])
-    d = MockSource(['D'], ['E'])
-    e = MockSource(['E'], [])
-
-    tree = depstree.DepsTree([a, b, c, d, e])
-
-    self.AssertValidDependencies(tree.GetDependencies('A'))
-    self.AssertValidDependencies(tree.GetDependencies('B'))
-    self.AssertValidDependencies(tree.GetDependencies('C'))
-    self.AssertValidDependencies(tree.GetDependencies('D'))
-    self.AssertValidDependencies(tree.GetDependencies('E'))
-
-  def testCircularDependency(self):
-    # Circular deps
-    a = MockSource(['A'], ['B'])
-    b = MockSource(['B'], ['C'])
-    c = MockSource(['C'], ['A'])
-
-    tree = depstree.DepsTree([a, b, c])
-
-    self.assertRaises(depstree.CircularDependencyError,
-                      tree.GetDependencies, 'A')
-
-  def testRequiresUndefinedNamespace(self):
-    a = MockSource(['A'], ['B'])
-    b = MockSource(['B'], ['C'])
-    c = MockSource(['C'], ['D'])  # But there is no D.
-
-    def MakeDepsTree():
-      return depstree.DepsTree([a, b, c])
-
-    self.assertRaises(depstree.NamespaceNotFoundError, MakeDepsTree)
-
-  def testDepsForMissingNamespace(self):
-    a = MockSource(['A'], ['B'])
-    b = MockSource(['B'], [])
-
-    tree = depstree.DepsTree([a, b])
-
-    # There is no C.
-    self.assertRaises(depstree.NamespaceNotFoundError,
-                      tree.GetDependencies, 'C')
-
-  def testMultipleRequires(self):
-    a = MockSource(['A'], ['B'])
-    b = MockSource(['B'], ['C'])
-    c = MockSource(['C'], [])
-    d = MockSource(['D'], ['B'])
-
-    tree = depstree.DepsTree([a, b, c, d])
-    self.AssertValidDependencies(tree.GetDependencies(['D', 'A']))
-
-
-if __name__ == '__main__':
-  unittest.main()

+ 0 - 212
src/renderer/cocoblockly-x/python/block/closure/bin/build/depswriter.py

@@ -1,212 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2009 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""Generates out a Closure deps.js file given a list of JavaScript sources.
-
-Paths can be specified as arguments or (more commonly) specifying trees
-with the flags (call with --help for descriptions).
-
-Usage: depswriter.py [path/to/js1.js [path/to/js2.js] ...]
-"""
-
-import json
-import logging
-import optparse
-import os
-import posixpath
-import shlex
-import sys
-
-import source
-import treescan
-
-
-__author__ = 'nnaze@google.com (Nathan Naze)'
-
-
-def MakeDepsFile(source_map):
-  """Make a generated deps file.
-
-  Args:
-    source_map: A dict map of the source path to source.Source object.
-
-  Returns:
-    str, A generated deps file source.
-  """
-
-  # Write in path alphabetical order
-  paths = sorted(source_map.keys())
-
-  lines = []
-
-  for path in paths:
-    js_source = source_map[path]
-
-    # We don't need to add entries that don't provide anything.
-    if js_source.provides:
-      lines.append(_GetDepsLine(path, js_source))
-
-  return ''.join(lines)
-
-
-def _GetDepsLine(path, js_source):
-  """Get a deps.js file string for a source."""
-
-  provides = _ToJsSrc(sorted(js_source.provides))
-  requires = _ToJsSrc(sorted(js_source.requires))
-  module = 'true' if js_source.is_goog_module else 'false'
-
-  return 'goog.addDependency(\'%s\', %s, %s, %s);\n' % (
-      path, provides, requires, module)
-
-
-def _ToJsSrc(arr):
-  """Convert a python arr to a js source string."""
-
-  return json.dumps(arr).replace('"', '\'')
-
-
-def _GetOptionsParser():
-  """Get the options parser."""
-
-  parser = optparse.OptionParser(__doc__)
-
-  parser.add_option('--output_file',
-                    dest='output_file',
-                    action='store',
-                    help=('If specified, write output to this path instead of '
-                          'writing to standard output.'))
-  parser.add_option('--root',
-                    dest='roots',
-                    default=[],
-                    action='append',
-                    help='A root directory to scan for JS source files. '
-                    'Paths of JS files in generated deps file will be '
-                    'relative to this path.  This flag may be specified '
-                    'multiple times.')
-  parser.add_option('--root_with_prefix',
-                    dest='roots_with_prefix',
-                    default=[],
-                    action='append',
-                    help='A root directory to scan for JS source files, plus '
-                    'a prefix (if either contains a space, surround with '
-                    'quotes).  Paths in generated deps file will be relative '
-                    'to the root, but preceded by the prefix.  This flag '
-                    'may be specified multiple times.')
-  parser.add_option('--path_with_depspath',
-                    dest='paths_with_depspath',
-                    default=[],
-                    action='append',
-                    help='A path to a source file and an alternate path to '
-                    'the file in the generated deps file (if either contains '
-                    'a space, surround with whitespace). This flag may be '
-                    'specified multiple times.')
-  return parser
-
-
-def _NormalizePathSeparators(path):
-  """Replaces OS-specific path separators with POSIX-style slashes.
-
-  Args:
-    path: str, A file path.
-
-  Returns:
-    str, The path with any OS-specific path separators (such as backslash on
-      Windows) replaced with URL-compatible forward slashes. A no-op on systems
-      that use POSIX paths.
-  """
-  return path.replace(os.sep, posixpath.sep)
-
-
-def _GetRelativePathToSourceDict(root, prefix=''):
-  """Scans a top root directory for .js sources.
-
-  Args:
-    root: str, Root directory.
-    prefix: str, Prefix for returned paths.
-
-  Returns:
-    dict, A map of relative paths (with prefix, if given), to source.Source
-      objects.
-  """
-  # Remember and restore the cwd when we're done. We work from the root so
-  # that paths are relative from the root.
-  start_wd = os.getcwd()
-  os.chdir(root)
-
-  path_to_source = {}
-  for path in treescan.ScanTreeForJsFiles('.'):
-    prefixed_path = _NormalizePathSeparators(os.path.join(prefix, path))
-    path_to_source[prefixed_path] = source.Source(source.GetFileContents(path))
-
-  os.chdir(start_wd)
-
-  return path_to_source
-
-
-def _GetPair(s):
-  """Return a string as a shell-parsed tuple.  Two values expected."""
-  try:
-    # shlex uses '\' as an escape character, so they must be escaped.
-    s = s.replace('\\', '\\\\')
-    first, second = shlex.split(s)
-    return (first, second)
-  except:
-    raise Exception('Unable to parse input line as a pair: %s' % s)
-
-
-def main():
-  """CLI frontend to MakeDepsFile."""
-  logging.basicConfig(format=(sys.argv[0] + ': %(message)s'),
-                      level=logging.INFO)
-  options, args = _GetOptionsParser().parse_args()
-
-  path_to_source = {}
-
-  # Roots without prefixes
-  for root in options.roots:
-    path_to_source.update(_GetRelativePathToSourceDict(root))
-
-  # Roots with prefixes
-  for root_and_prefix in options.roots_with_prefix:
-    root, prefix = _GetPair(root_and_prefix)
-    path_to_source.update(_GetRelativePathToSourceDict(root, prefix=prefix))
-
-  # Source paths
-  for path in args:
-    path_to_source[path] = source.Source(source.GetFileContents(path))
-
-  # Source paths with alternate deps paths
-  for path_with_depspath in options.paths_with_depspath:
-    srcpath, depspath = _GetPair(path_with_depspath)
-    path_to_source[depspath] = source.Source(source.GetFileContents(srcpath))
-
-  # Make our output pipe.
-  if options.output_file:
-    out = open(options.output_file, 'w')
-  else:
-    out = sys.stdout
-
-  out.write(('// This file was autogenerated by %s.\n' %
-             os.path.basename(__file__)))
-  out.write('// Please do not edit.\n')
-
-  out.write(MakeDepsFile(path_to_source))
-
-
-if __name__ == '__main__':
-  main()

+ 0 - 62
src/renderer/cocoblockly-x/python/block/closure/bin/build/depswriter_test.py

@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2010 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""Unit test for depswriter."""
-
-__author__ = 'johnlenz@google.com (John Lenz)'
-
-
-import unittest
-
-import depswriter
-
-
-class MockSource(object):
-  """Mock Source file."""
-
-  def __init__(self, provides, requires):
-    self.provides = set(provides)
-    self.requires = set(requires)
-    self.is_goog_module = False
-
-  def __repr__(self):
-    return 'MockSource %s' % self.provides
-
-
-class DepsWriterTestCase(unittest.TestCase):
-  """Unit test for depswriter."""
-
-  def testMakeDepsFile(self):
-    sources = {}
-    sources['test.js'] = MockSource(['A'], ['B', 'C'])
-    deps = depswriter.MakeDepsFile(sources)
-
-    self.assertEqual(
-        'goog.addDependency(\'test.js\', [\'A\'], [\'B\', \'C\'], false);\n',
-        deps)
-
-  def testMakeDepsFileUnicode(self):
-    sources = {}
-    sources['test.js'] = MockSource([u'A'], [u'B', u'C'])
-    deps = depswriter.MakeDepsFile(sources)
-
-    self.assertEqual(
-        'goog.addDependency(\'test.js\', [\'A\'], [\'B\', \'C\'], false);\n',
-        deps)
-
-if __name__ == '__main__':
-  unittest.main()

+ 0 - 161
src/renderer/cocoblockly-x/python/block/closure/bin/build/jscompiler.py

@@ -1,161 +0,0 @@
-# Copyright 2010 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""Utility to use the Closure Compiler CLI from Python."""
-
-import logging
-import os
-import re
-import subprocess
-import tempfile
-
-# Pulls just the major and minor version numbers from the first line of
-# 'java -version'. Versions are in the format of [0-9]+(\.[0-9]+)? See:
-# http://openjdk.java.net/jeps/223
-_VERSION_REGEX = re.compile(r'"([0-9]+)(?:\.([0-9]+))?')
-
-
-class JsCompilerError(Exception):
-  """Raised if there's an error in calling the compiler."""
-  pass
-
-
-def _GetJavaVersionString():
-  """Get the version string from the Java VM."""
-  return subprocess.check_output(['java', '-version'], stderr=subprocess.STDOUT)
-
-
-def _ParseJavaVersion(version_string):
-  """Returns a 2-tuple for the current version of Java installed.
-
-  Args:
-    version_string: String of the Java version (e.g. '1.7.2-ea').
-
-  Returns:
-    The major and minor versions, as a 2-tuple (e.g. (1, 7)).
-  """
-  match = _VERSION_REGEX.search(version_string)
-  if match:
-    version = tuple(int(x or 0) for x in match.groups())
-    assert len(version) == 2
-    return version
-
-
-def _JavaSupports32BitMode():
-  """Determines whether the JVM supports 32-bit mode on the platform."""
-  # Suppresses process output to stderr and stdout from showing up in the
-  # console as we're only trying to determine 32-bit JVM support.
-  supported = False
-  try:
-    devnull = open(os.devnull, 'wb')
-    return subprocess.call(
-        ['java', '-d32', '-version'], stdout=devnull, stderr=devnull) == 0
-  except IOError:
-    pass
-  else:
-    devnull.close()
-  return supported
-
-
-def _GetJsCompilerArgs(compiler_jar_path, java_version, jvm_flags):
-  """Assembles arguments for call to JsCompiler."""
-
-  if java_version < (1, 7):
-    raise JsCompilerError('Closure Compiler requires Java 1.7 or higher. '
-                          'Please visit http://www.java.com/getjava')
-
-  args = ['java']
-
-  # Add JVM flags we believe will produce the best performance.  See
-  # https://groups.google.com/forum/#!topic/closure-library-discuss/7w_O9-vzlj4
-
-  # Attempt 32-bit mode if available (Java 7 on Mac OS X does not support 32-bit
-  # mode, for example).
-  if _JavaSupports32BitMode():
-    args += ['-d32']
-
-  # Prefer the "client" VM.
-  args += ['-client']
-
-  # Add JVM flags, if any
-  if jvm_flags:
-    args += jvm_flags
-
-  # Add the application JAR.
-  args += ['-jar', compiler_jar_path]
-
-  return args
-
-
-def _GetFlagFile(source_paths, compiler_flags):
-  """Writes given source paths and compiler flags to a --flagfile.
-
-  The given source_paths will be written as '--js' flags and the compiler_flags
-  are written as-is.
-
-  Args:
-    source_paths: List of string js source paths.
-    compiler_flags: List of string compiler flags.
-
-  Returns:
-    The file to which the flags were written.
-  """
-  args = []
-  for path in source_paths:
-    args += ['--js', path]
-
-  # Add compiler flags, if any.
-  if compiler_flags:
-    args += compiler_flags
-
-  flags_file = tempfile.NamedTemporaryFile(delete=False)
-  flags_file.write(' '.join(args))
-  flags_file.close()
-
-  return flags_file
-
-
-def Compile(compiler_jar_path,
-            source_paths,
-            jvm_flags=None,
-            compiler_flags=None):
-  """Prepares command-line call to Closure Compiler.
-
-  Args:
-    compiler_jar_path: Path to the Closure compiler .jar file.
-    source_paths: Source paths to build, in order.
-    jvm_flags: A list of additional flags to pass on to JVM.
-    compiler_flags: A list of additional flags to pass on to Closure Compiler.
-
-  Returns:
-    The compiled source, as a string, or None if compilation failed.
-  """
-
-  java_version = _ParseJavaVersion(str(_GetJavaVersionString()))
-
-  args = _GetJsCompilerArgs(compiler_jar_path, java_version, jvm_flags)
-
-  # Write source path arguments to flag file for avoiding "The filename or
-  # extension is too long" error in big projects. See
-  # https://github.com/google/closure-library/pull/678
-  flags_file = _GetFlagFile(source_paths, compiler_flags)
-  args += ['--flagfile', flags_file.name]
-
-  logging.info('Compiling with the following command: %s', ' '.join(args))
-
-  try:
-    return subprocess.check_output(args)
-  except subprocess.CalledProcessError:
-    raise JsCompilerError('JavaScript compilation failed.')
-  finally:
-    os.remove(flags_file.name)

+ 0 - 122
src/renderer/cocoblockly-x/python/block/closure/bin/build/jscompiler_test.py

@@ -1,122 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2013 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""Unit test for depstree."""
-
-__author__ = 'nnaze@google.com (Nathan Naze)'
-
-import os
-import unittest
-
-import jscompiler
-
-
-class JsCompilerTestCase(unittest.TestCase):
-  """Unit tests for jscompiler module."""
-
-  def testGetFlagFile(self):
-    flags_file = jscompiler._GetFlagFile(['path/to/src1.js', 'path/to/src2.js'],
-                                         ['--test_compiler_flag'])
-
-    def file_get_contents(filename):
-      with open(filename) as f:
-        content = f.read()
-        f.close()
-        return content
-
-    flags_file_content = file_get_contents(flags_file.name)
-    os.remove(flags_file.name)
-
-    self.assertEqual(
-        '--js path/to/src1.js --js path/to/src2.js --test_compiler_flag',
-        flags_file_content)
-
-  def testGetJsCompilerArgs(self):
-
-    original_check = jscompiler._JavaSupports32BitMode
-    jscompiler._JavaSupports32BitMode = lambda: False
-    args = jscompiler._GetJsCompilerArgs('path/to/jscompiler.jar', (1, 7),
-                                         ['--test_jvm_flag'])
-
-    self.assertEqual([
-        'java', '-client', '--test_jvm_flag', '-jar', 'path/to/jscompiler.jar'
-    ], args)
-
-    def CheckJava15RaisesError():
-      jscompiler._GetJsCompilerArgs('path/to/jscompiler.jar', (1, 5),
-                                    ['--test_jvm_flag'])
-
-    self.assertRaises(jscompiler.JsCompilerError, CheckJava15RaisesError)
-    jscompiler._JavaSupports32BitMode = original_check
-
-  def testGetJsCompilerArgs32BitJava(self):
-
-    original_check = jscompiler._JavaSupports32BitMode
-
-    # Should include the -d32 flag only if 32-bit Java is supported by the
-    # system.
-    jscompiler._JavaSupports32BitMode = lambda: True
-    args = jscompiler._GetJsCompilerArgs('path/to/jscompiler.jar', (1, 7),
-                                         ['--test_jvm_flag'])
-
-    self.assertEqual([
-        'java', '-d32', '-client', '--test_jvm_flag', '-jar',
-        'path/to/jscompiler.jar'
-    ], args)
-
-    # Should exclude the -d32 flag if 32-bit Java is not supported by the
-    # system.
-    jscompiler._JavaSupports32BitMode = lambda: False
-    args = jscompiler._GetJsCompilerArgs('path/to/jscompiler.jar', (1, 7),
-                                         ['--test_jvm_flag'])
-
-    self.assertEqual([
-        'java', '-client', '--test_jvm_flag', '-jar', 'path/to/jscompiler.jar'
-    ], args)
-
-    jscompiler._JavaSupports32BitMode = original_check
-
-  def testGetJavaVersion(self):
-
-    def assertVersion(expected, version_string):
-      self.assertEquals(expected, jscompiler._ParseJavaVersion(version_string))
-
-    assertVersion((9, 0), _TEST_JAVA_JEP_223_VERSION_STRING)
-    assertVersion((1, 7), _TEST_JAVA_VERSION_STRING)
-    assertVersion((1, 6), _TEST_JAVA_NESTED_VERSION_STRING)
-    assertVersion((1, 4), 'java version "1.4.0_03-ea"')
-
-
-_TEST_JAVA_VERSION_STRING = """\
-openjdk version "1.7.0-google-v5"
-OpenJDK Runtime Environment (build 1.7.0-google-v5-64327-39803485)
-OpenJDK Server VM (build 22.0-b10, mixed mode)
-"""
-
-_TEST_JAVA_NESTED_VERSION_STRING = """\
-Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
-java version "1.6.0_35"
-Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428-11M3811)
-Java HotSpot(TM) Client VM (build 20.10-b01-428, mixed mode)
-"""
-
-_TEST_JAVA_JEP_223_VERSION_STRING = """\
-openjdk version "9-Ubuntu"
-OpenJDK Runtime Environment (build 9-Ubuntu+0-9b134-2ubuntu1)
-OpenJDK 64-Bit Server VM (build 9-Ubuntu+0-9b134-2ubuntu1, mixed mode)
-"""
-
-if __name__ == '__main__':
-  unittest.main()

+ 0 - 132
src/renderer/cocoblockly-x/python/block/closure/bin/build/source.py

@@ -1,132 +0,0 @@
-# Copyright 2009 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""Scans a source JS file for its provided and required namespaces.
-
-Simple class to scan a JavaScript file and express its dependencies.
-"""
-
-__author__ = 'nnaze@google.com'
-
-
-import codecs
-import re
-
-_BASE_REGEX_STRING = r'^\s*goog\.%s\(\s*[\'"](.+)[\'"]\s*\)'
-_MODULE_REGEX = re.compile(_BASE_REGEX_STRING % 'module')
-_PROVIDE_REGEX = re.compile(_BASE_REGEX_STRING % 'provide')
-
-_REQUIRE_REGEX_STRING = (r'^\s*(?:(?:var|let|const)\s+[a-zA-Z0-9$_,:{}\s]*'
-                         r'\s*=\s*)?goog\.require\(\s*[\'"](.+)[\'"]\s*\)')
-_REQUIRES_REGEX = re.compile(_REQUIRE_REGEX_STRING)
-
-class Source(object):
-  """Scans a JavaScript source for its provided and required namespaces."""
-
-  # Matches a "/* ... */" comment.
-  # Note: We can't definitively distinguish a "/*" in a string literal without a
-  # state machine tokenizer. We'll assume that a line starting with whitespace
-  # and "/*" is a comment.
-  _COMMENT_REGEX = re.compile(
-      r"""
-      ^\s*   # Start of a new line and whitespace
-      /\*    # Opening "/*"
-      .*?    # Non greedy match of any characters (including newlines)
-      \*/    # Closing "*/""",
-      re.MULTILINE | re.DOTALL | re.VERBOSE)
-
-  def __init__(self, source):
-    """Initialize a source.
-
-    Args:
-      source: str, The JavaScript source.
-    """
-
-    self.provides = set()
-    self.requires = set()
-    self.is_goog_module = False
-
-    self._source = source
-    self._ScanSource()
-
-  def GetSource(self):
-    """Get the source as a string."""
-    return self._source
-
-  @classmethod
-  def _StripComments(cls, source):
-    return cls._COMMENT_REGEX.sub('', source)
-
-  @classmethod
-  def _HasProvideGoogFlag(cls, source):
-    """Determines whether the @provideGoog flag is in a comment."""
-    for comment_content in cls._COMMENT_REGEX.findall(source):
-      if '@provideGoog' in comment_content:
-        return True
-
-    return False
-
-  def _ScanSource(self):
-    """Fill in provides and requires by scanning the source."""
-
-    stripped_source = self._StripComments(self.GetSource())
-
-    source_lines = stripped_source.splitlines()
-    for line in source_lines:
-      match = _PROVIDE_REGEX.match(line)
-      if match:
-        self.provides.add(match.group(1))
-      match = _MODULE_REGEX.match(line)
-      if match:
-        self.provides.add(match.group(1))
-        self.is_goog_module = True
-      match = _REQUIRES_REGEX.match(line)
-      if match:
-        self.requires.add(match.group(1))
-
-    # Closure's base file implicitly provides 'goog'.
-    # This is indicated with the @provideGoog flag.
-    if self._HasProvideGoogFlag(self.GetSource()):
-
-      if len(self.provides) or len(self.requires):
-        raise Exception(
-            'Base file should not provide or require namespaces.')
-
-      self.provides.add('goog')
-
-
-def GetFileContents(path):
-  """Get a file's contents as a string.
-
-  Args:
-    path: str, Path to file.
-
-  Returns:
-    str, Contents of file.
-
-  Raises:
-    IOError: An error occurred opening or reading the file.
-
-  """
-  fileobj = None
-  try:
-    fileobj = codecs.open(path, encoding='utf-8-sig')
-    return fileobj.read()
-  except IOError as error:
-    raise IOError('An error occurred opening or reading the file: %s. %s'
-                  % (path, error))
-  finally:
-    if fileobj is not None:
-      fileobj.close()

+ 0 - 165
src/renderer/cocoblockly-x/python/block/closure/bin/build/source_test.py

@@ -1,165 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2010 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""Unit test for source."""
-
-__author__ = 'nnaze@google.com (Nathan Naze)'
-
-
-import unittest
-
-import source
-
-
-class SourceTestCase(unittest.TestCase):
-  """Unit test for source.  Tests the parser on a known source input."""
-
-  def testSourceScan(self):
-    test_source = source.Source(_TEST_SOURCE)
-
-    self.assertEqual(set(['foo', 'foo.test']),
-                     test_source.provides)
-    self.assertEqual(set(['goog.dom', 'goog.events.EventType']),
-                     test_source.requires)
-    self.assertFalse(test_source.is_goog_module)
-
-  def testSourceScanBase(self):
-    test_source = source.Source(_TEST_BASE_SOURCE)
-
-    self.assertEqual(set(['goog']),
-                     test_source.provides)
-    self.assertEqual(test_source.requires, set())
-    self.assertFalse(test_source.is_goog_module)
-
-  def testSourceScanBadBase(self):
-
-    def MakeSource():
-      source.Source(_TEST_BAD_BASE_SOURCE)
-
-    self.assertRaises(Exception, MakeSource)
-
-  def testSourceScanGoogModule(self):
-    test_source = source.Source(_TEST_MODULE_SOURCE)
-
-    self.assertEqual(set(['foo']),
-                     test_source.provides)
-    self.assertEqual(set(['bar']),
-                     test_source.requires)
-    self.assertTrue(test_source.is_goog_module)
-
-  def testSourceScanModuleAlias(self):
-    test_source = source.Source(_TEST_MODULE_ALIAS_SOURCE)
-
-    self.assertEqual(set(['goog.dom', 'goog.events']), test_source.requires)
-    self.assertTrue(test_source.is_goog_module)
-
-  def testStripComments(self):
-    self.assertEquals(
-        '\nvar foo = function() {}',
-        source.Source._StripComments((
-            '/* This is\n'
-            '  a comment split\n'
-            '  over multiple lines\n'
-            '*/\n'
-            'var foo = function() {}')))
-
-  def testGoogStatementsInComments(self):
-    test_source = source.Source(_TEST_COMMENT_SOURCE)
-
-    self.assertEqual(set(['foo']),
-                     test_source.provides)
-    self.assertEqual(set(['goog.events.EventType']),
-                     test_source.requires)
-    self.assertFalse(test_source.is_goog_module)
-
-  def testHasProvideGoog(self):
-    self.assertTrue(source.Source._HasProvideGoogFlag(_TEST_BASE_SOURCE))
-    self.assertTrue(source.Source._HasProvideGoogFlag(_TEST_BAD_BASE_SOURCE))
-    self.assertFalse(source.Source._HasProvideGoogFlag(_TEST_COMMENT_SOURCE))
-
-
-_TEST_MODULE_ALIAS_SOURCE = """
-goog.module('foo');
-const {createDom: domCreator} = goog.require('goog.dom');
-const {listen} = goog.require('goog.events');
-"""
-
-
-_TEST_MODULE_SOURCE = """
-goog.module('foo');
-var b = goog.require('bar');
-"""
-
-
-_TEST_SOURCE = """// Fake copyright notice
-
-/** Very important comment. */
-
-goog.provide('foo');
-goog.provide('foo.test');
-
-goog.require('goog.dom');
-goog.require('goog.events.EventType');
-
-function foo() {
-  // Set bar to seventeen to increase performance.
-  this.bar = 17;
-}
-"""
-
-_TEST_COMMENT_SOURCE = """// Fake copyright notice
-
-goog.provide('foo');
-
-/*
-goog.provide('foo.test');
- */
-
-/*
-goog.require('goog.dom');
-*/
-
-// goog.require('goog.dom');
-
-goog.require('goog.events.EventType');
-
-function bar() {
-  this.baz = 55;
-}
-"""
-
-_TEST_BASE_SOURCE = """
-/**
- * @fileoverview The base file.
- * @provideGoog
- */
-
-var goog = goog || {};
-"""
-
-_TEST_BAD_BASE_SOURCE = """
-/**
- * @fileoverview The base file.
- * @provideGoog
- */
-
-goog.provide('goog');
-"""
-
-
-if __name__ == '__main__':
-  unittest.main()

+ 0 - 78
src/renderer/cocoblockly-x/python/block/closure/bin/build/treescan.py

@@ -1,78 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2010 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""Shared utility functions for scanning directory trees."""
-
-import os
-import re
-
-
-__author__ = 'nnaze@google.com (Nathan Naze)'
-
-
-# Matches a .js file path.
-_JS_FILE_REGEX = re.compile(r'^.+\.js$')
-
-
-def ScanTreeForJsFiles(root):
-  """Scans a directory tree for JavaScript files.
-
-  Args:
-    root: str, Path to a root directory.
-
-  Returns:
-    An iterable of paths to JS files, relative to cwd.
-  """
-  return ScanTree(root, path_filter=_JS_FILE_REGEX)
-
-
-def ScanTree(root, path_filter=None, ignore_hidden=True):
-  """Scans a directory tree for files.
-
-  Args:
-    root: str, Path to a root directory.
-    path_filter: A regular expression filter.  If set, only paths matching
-      the path_filter are returned.
-    ignore_hidden: If True, do not follow or return hidden directories or files
-      (those starting with a '.' character).
-
-  Yields:
-    A string path to files, relative to cwd.
-  """
-
-  def OnError(os_error):
-    raise os_error
-
-  for dirpath, dirnames, filenames in os.walk(root, onerror=OnError):
-    # os.walk allows us to modify dirnames to prevent decent into particular
-    # directories.  Avoid hidden directories.
-    for dirname in dirnames:
-      if ignore_hidden and dirname.startswith('.'):
-        dirnames.remove(dirname)
-
-    for filename in filenames:
-
-      # nothing that starts with '.'
-      if ignore_hidden and filename.startswith('.'):
-        continue
-
-      fullpath = os.path.join(dirpath, filename)
-
-      if path_filter and not path_filter.match(fullpath):
-        continue
-
-      yield os.path.normpath(fullpath)

+ 0 - 590
src/renderer/cocoblockly-x/python/block/closure/bin/calcdeps.py

@@ -1,590 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2006 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""Calculates JavaScript dependencies without requiring Google's build system.
-
-This tool is deprecated and is provided for legacy users.
-See build/closurebuilder.py and build/depswriter.py for the current tools.
-
-It iterates over a number of search paths and builds a dependency tree.  With
-the inputs provided, it walks the dependency tree and outputs all the files
-required for compilation.
-"""
-
-
-
-
-
-try:
-  import distutils.version
-except ImportError:
-  # distutils is not available in all environments
-  distutils = None
-
-import logging
-import optparse
-import os
-import re
-import subprocess
-import sys
-
-
-_BASE_REGEX_STRING = '^\s*goog\.%s\(\s*[\'"](.+)[\'"]\s*\)'
-req_regex = re.compile(_BASE_REGEX_STRING % 'require')
-prov_regex = re.compile(_BASE_REGEX_STRING % 'provide')
-ns_regex = re.compile('^ns:((\w+\.)*(\w+))$')
-version_regex = re.compile('[\.0-9]+')
-
-
-def IsValidFile(ref):
-  """Returns true if the provided reference is a file and exists."""
-  return os.path.isfile(ref)
-
-
-def IsJsFile(ref):
-  """Returns true if the provided reference is a Javascript file."""
-  return ref.endswith('.js')
-
-
-def IsNamespace(ref):
-  """Returns true if the provided reference is a namespace."""
-  return re.match(ns_regex, ref) is not None
-
-
-def IsDirectory(ref):
-  """Returns true if the provided reference is a directory."""
-  return os.path.isdir(ref)
-
-
-def ExpandDirectories(refs):
-  """Expands any directory references into inputs.
-
-  Description:
-    Looks for any directories in the provided references.  Found directories
-    are recursively searched for .js files, which are then added to the result
-    list.
-
-  Args:
-    refs: a list of references such as files, directories, and namespaces
-
-  Returns:
-    A list of references with directories removed and replaced by any
-    .js files that are found in them. Also, the paths will be normalized.
-  """
-  result = []
-  for ref in refs:
-    if IsDirectory(ref):
-      # Disable 'Unused variable' for subdirs
-      # pylint: disable=unused-variable
-      for (directory, subdirs, filenames) in os.walk(ref):
-        for filename in filenames:
-          if IsJsFile(filename):
-            result.append(os.path.join(directory, filename))
-    else:
-      result.append(ref)
-  return map(os.path.normpath, result)
-
-
-class DependencyInfo(object):
-  """Represents a dependency that is used to build and walk a tree."""
-
-  def __init__(self, filename):
-    self.filename = filename
-    self.provides = []
-    self.requires = []
-
-  def __str__(self):
-    return '%s Provides: %s Requires: %s' % (self.filename,
-                                             repr(self.provides),
-                                             repr(self.requires))
-
-
-def BuildDependenciesFromFiles(files):
-  """Build a list of dependencies from a list of files.
-
-  Description:
-    Takes a list of files, extracts their provides and requires, and builds
-    out a list of dependency objects.
-
-  Args:
-    files: a list of files to be parsed for goog.provides and goog.requires.
-
-  Returns:
-    A list of dependency objects, one for each file in the files argument.
-  """
-  result = []
-  filenames = set()
-  for filename in files:
-    if filename in filenames:
-      continue
-
-    # Python 3 requires the file encoding to be specified
-    if (sys.version_info[0] < 3):
-      file_handle = open(filename, 'r')
-    else:
-      file_handle = open(filename, 'r', encoding='utf8')
-
-    try:
-      dep = CreateDependencyInfo(filename, file_handle)
-      result.append(dep)
-    finally:
-      file_handle.close()
-
-    filenames.add(filename)
-
-  return result
-
-
-def CreateDependencyInfo(filename, source):
-  """Create dependency info.
-
-  Args:
-    filename: Filename for source.
-    source: File-like object containing source.
-
-  Returns:
-    A DependencyInfo object with provides and requires filled.
-  """
-  dep = DependencyInfo(filename)
-  for line in source:
-    if re.match(req_regex, line):
-      dep.requires.append(re.search(req_regex, line).group(1))
-    if re.match(prov_regex, line):
-      dep.provides.append(re.search(prov_regex, line).group(1))
-  return dep
-
-
-def BuildDependencyHashFromDependencies(deps):
-  """Builds a hash for searching dependencies by the namespaces they provide.
-
-  Description:
-    Dependency objects can provide multiple namespaces.  This method enumerates
-    the provides of each dependency and adds them to a hash that can be used
-    to easily resolve a given dependency by a namespace it provides.
-
-  Args:
-    deps: a list of dependency objects used to build the hash.
-
-  Raises:
-    Exception: If a multiple files try to provide the same namepace.
-
-  Returns:
-    A hash table { namespace: dependency } that can be used to resolve a
-    dependency by a namespace it provides.
-  """
-  dep_hash = {}
-  for dep in deps:
-    for provide in dep.provides:
-      if provide in dep_hash:
-        raise Exception('Duplicate provide (%s) in (%s, %s)' % (
-            provide,
-            dep_hash[provide].filename,
-            dep.filename))
-      dep_hash[provide] = dep
-  return dep_hash
-
-
-def CalculateDependencies(paths, inputs):
-  """Calculates the dependencies for given inputs.
-
-  Description:
-    This method takes a list of paths (files, directories) and builds a
-    searchable data structure based on the namespaces that each .js file
-    provides.  It then parses through each input, resolving dependencies
-    against this data structure.  The final output is a list of files,
-    including the inputs, that represent all of the code that is needed to
-    compile the given inputs.
-
-  Args:
-    paths: the references (files, directories) that are used to build the
-      dependency hash.
-    inputs: the inputs (files, directories, namespaces) that have dependencies
-      that need to be calculated.
-
-  Raises:
-    Exception: if a provided input is invalid.
-
-  Returns:
-    A list of all files, including inputs, that are needed to compile the given
-    inputs.
-  """
-  deps = BuildDependenciesFromFiles(paths + inputs)
-  search_hash = BuildDependencyHashFromDependencies(deps)
-  result_list = []
-  seen_list = []
-  for input_file in inputs:
-    if IsNamespace(input_file):
-      namespace = re.search(ns_regex, input_file).group(1)
-      if namespace not in search_hash:
-        raise Exception('Invalid namespace (%s)' % namespace)
-      input_file = search_hash[namespace].filename
-    if not IsValidFile(input_file) or not IsJsFile(input_file):
-      raise Exception('Invalid file (%s)' % input_file)
-    seen_list.append(input_file)
-    file_handle = open(input_file, 'r')
-    try:
-      for line in file_handle:
-        if re.match(req_regex, line):
-          require = re.search(req_regex, line).group(1)
-          ResolveDependencies(require, search_hash, result_list, seen_list)
-    finally:
-      file_handle.close()
-    result_list.append(input_file)
-
-  # All files depend on base.js, so put it first.
-  base_js_path = FindClosureBasePath(paths)
-  if base_js_path:
-    result_list.insert(0, base_js_path)
-  else:
-    logging.warning('Closure Library base.js not found.')
-
-  return result_list
-
-
-def FindClosureBasePath(paths):
-  """Given a list of file paths, return Closure base.js path, if any.
-
-  Args:
-    paths: A list of paths.
-
-  Returns:
-    The path to Closure's base.js file including filename, if found.
-  """
-
-  for path in paths:
-    pathname, filename = os.path.split(path)
-
-    if filename == 'base.js':
-      f = open(path)
-
-      is_base = False
-
-      # Sanity check that this is the Closure base file.  Check that this
-      # is where goog is defined.  This is determined by the @provideGoog
-      # flag.
-      for line in f:
-        if '@provideGoog' in line:
-          is_base = True
-          break
-
-      f.close()
-
-      if is_base:
-        return path
-
-def ResolveDependencies(require, search_hash, result_list, seen_list):
-  """Takes a given requirement and resolves all of the dependencies for it.
-
-  Description:
-    A given requirement may require other dependencies.  This method
-    recursively resolves all dependencies for the given requirement.
-
-  Raises:
-    Exception: when require does not exist in the search_hash.
-
-  Args:
-    require: the namespace to resolve dependencies for.
-    search_hash: the data structure used for resolving dependencies.
-    result_list: a list of filenames that have been calculated as dependencies.
-      This variable is the output for this function.
-    seen_list: a list of filenames that have been 'seen'.  This is required
-      for the dependency->dependent ordering.
-  """
-  if require not in search_hash:
-    raise Exception('Missing provider for (%s)' % require)
-
-  dep = search_hash[require]
-  if not dep.filename in seen_list:
-    seen_list.append(dep.filename)
-    for sub_require in dep.requires:
-      ResolveDependencies(sub_require, search_hash, result_list, seen_list)
-    result_list.append(dep.filename)
-
-
-def GetDepsLine(dep, base_path):
-  """Returns a JS string for a dependency statement in the deps.js file.
-
-  Args:
-    dep: The dependency that we're printing.
-    base_path: The path to Closure's base.js including filename.
-  """
-  return 'goog.addDependency("%s", %s, %s);' % (
-      GetRelpath(dep.filename, base_path), dep.provides, dep.requires)
-
-
-def GetRelpath(path, start):
-  """Return a relative path to |path| from |start|."""
-  # NOTE: Python 2.6 provides os.path.relpath, which has almost the same
-  # functionality as this function. Since we want to support 2.4, we have
-  # to implement it manually. :(
-  path_list = os.path.abspath(os.path.normpath(path)).split(os.sep)
-  start_list = os.path.abspath(
-      os.path.normpath(os.path.dirname(start))).split(os.sep)
-
-  common_prefix_count = 0
-  for i in range(0, min(len(path_list), len(start_list))):
-    if path_list[i] != start_list[i]:
-      break
-    common_prefix_count += 1
-
-  # Always use forward slashes, because this will get expanded to a url,
-  # not a file path.
-  return '/'.join(['..'] * (len(start_list) - common_prefix_count) +
-                  path_list[common_prefix_count:])
-
-
-def PrintLine(msg, out):
-  out.write(msg)
-  out.write('\n')
-
-
-def PrintDeps(source_paths, deps, out):
-  """Print out a deps.js file from a list of source paths.
-
-  Args:
-    source_paths: Paths that we should generate dependency info for.
-    deps: Paths that provide dependency info. Their dependency info should
-        not appear in the deps file.
-    out: The output file.
-
-  Returns:
-    True on success, false if it was unable to find the base path
-    to generate deps relative to.
-  """
-  base_path = FindClosureBasePath(source_paths + deps)
-  if not base_path:
-    return False
-
-  PrintLine('// This file was autogenerated by calcdeps.py', out)
-  excludesSet = set(deps)
-
-  for dep in BuildDependenciesFromFiles(source_paths + deps):
-    if not dep.filename in excludesSet:
-      PrintLine(GetDepsLine(dep, base_path), out)
-
-  return True
-
-
-def PrintScript(source_paths, out):
-  for index, dep in enumerate(source_paths):
-    PrintLine('// Input %d' % index, out)
-    f = open(dep, 'r')
-    PrintLine(f.read(), out)
-    f.close()
-
-
-def GetJavaVersion():
-  """Returns the string for the current version of Java installed."""
-  proc = subprocess.Popen(['java', '-version'], stderr=subprocess.PIPE)
-  proc.wait()
-  version_line = proc.stderr.read().splitlines()[0]
-  return version_regex.search(version_line.decode('utf-8')).group()
-
-
-def FilterByExcludes(options, files):
-  """Filters the given files by the exlusions specified at the command line.
-
-  Args:
-    options: The flags to calcdeps.
-    files: The files to filter.
-  Returns:
-    A list of files.
-  """
-  excludes = []
-  if options.excludes:
-    excludes = ExpandDirectories(options.excludes)
-
-  excludesSet = set(excludes)
-  return [i for i in files if not i in excludesSet]
-
-
-def GetPathsFromOptions(options):
-  """Generates the path files from flag options.
-
-  Args:
-    options: The flags to calcdeps.
-  Returns:
-    A list of files in the specified paths. (strings).
-  """
-
-  search_paths = options.paths
-  if not search_paths:
-    search_paths = ['.']  # Add default folder if no path is specified.
-
-  search_paths = ExpandDirectories(search_paths)
-  return FilterByExcludes(options, search_paths)
-
-
-def GetInputsFromOptions(options):
-  """Generates the inputs from flag options.
-
-  Args:
-    options: The flags to calcdeps.
-  Returns:
-    A list of inputs (strings).
-  """
-  inputs = options.inputs
-  if not inputs:  # Parse stdin
-    logging.info('No inputs specified. Reading from stdin...')
-    inputs = filter(None, [line.strip('\n') for line in sys.stdin.readlines()])
-
-  logging.info('Scanning files...')
-  inputs = ExpandDirectories(inputs)
-
-  return FilterByExcludes(options, inputs)
-
-
-def Compile(compiler_jar_path, source_paths, out, flags=None):
-  """Prepares command-line call to Closure compiler.
-
-  Args:
-    compiler_jar_path: Path to the Closure compiler .jar file.
-    source_paths: Source paths to build, in order.
-    flags: A list of additional flags to pass on to Closure compiler.
-  """
-  args = ['java', '-jar', compiler_jar_path]
-  for path in source_paths:
-    args += ['--js', path]
-
-  if flags:
-    args += flags
-
-  logging.info('Compiling with the following command: %s', ' '.join(args))
-  proc = subprocess.Popen(args, stdout=subprocess.PIPE)
-  (stdoutdata, stderrdata) = proc.communicate()
-  if proc.returncode != 0:
-    logging.error('JavaScript compilation failed.')
-    sys.exit(1)
-  else:
-    out.write(stdoutdata.decode('utf-8'))
-
-
-def main():
-  """The entrypoint for this script."""
-
-  logging.basicConfig(format='calcdeps.py: %(message)s', level=logging.INFO)
-
-  usage = 'usage: %prog [options] arg'
-  parser = optparse.OptionParser(usage)
-  parser.add_option('-i',
-                    '--input',
-                    dest='inputs',
-                    action='append',
-                    help='The inputs to calculate dependencies for. Valid '
-                    'values can be files, directories, or namespaces '
-                    '(ns:goog.net.XhrIo).  Only relevant to "list" and '
-                    '"script" output.')
-  parser.add_option('-p',
-                    '--path',
-                    dest='paths',
-                    action='append',
-                    help='The paths that should be traversed to build the '
-                    'dependencies.')
-  parser.add_option('-d',
-                    '--dep',
-                    dest='deps',
-                    action='append',
-                    help='Directories or files that should be traversed to '
-                    'find required dependencies for the deps file. '
-                    'Does not generate dependency information for names '
-                    'provided by these files. Only useful in "deps" mode.')
-  parser.add_option('-e',
-                    '--exclude',
-                    dest='excludes',
-                    action='append',
-                    help='Files or directories to exclude from the --path '
-                    'and --input flags')
-  parser.add_option('-o',
-                    '--output_mode',
-                    dest='output_mode',
-                    action='store',
-                    default='list',
-                    help='The type of output to generate from this script. '
-                    'Options are "list" for a list of filenames, "script" '
-                    'for a single script containing the contents of all the '
-                    'file, "deps" to generate a deps.js file for all '
-                    'paths, or "compiled" to produce compiled output with '
-                    'the Closure compiler.')
-  parser.add_option('-c',
-                    '--compiler_jar',
-                    dest='compiler_jar',
-                    action='store',
-                    help='The location of the Closure compiler .jar file.')
-  parser.add_option('-f',
-                    '--compiler_flag',
-                    '--compiler_flags', # for backwards compatibility
-                    dest='compiler_flags',
-                    action='append',
-                    help='Additional flag to pass to the Closure compiler. '
-                    'May be specified multiple times to pass multiple flags.')
-  parser.add_option('--output_file',
-                    dest='output_file',
-                    action='store',
-                    help=('If specified, write output to this path instead of '
-                          'writing to standard output.'))
-
-  (options, args) = parser.parse_args()
-
-  search_paths = GetPathsFromOptions(options)
-
-  if options.output_file:
-    out = open(options.output_file, 'w')
-  else:
-    out = sys.stdout
-
-  if options.output_mode == 'deps':
-    result = PrintDeps(search_paths, ExpandDirectories(options.deps or []), out)
-    if not result:
-      logging.error('Could not find Closure Library in the specified paths')
-      sys.exit(1)
-
-    return
-
-  inputs = GetInputsFromOptions(options)
-
-  logging.info('Finding Closure dependencies...')
-  deps = CalculateDependencies(search_paths, inputs)
-  output_mode = options.output_mode
-
-  if output_mode == 'script':
-    PrintScript(deps, out)
-  elif output_mode == 'list':
-    # Just print out a dep per line
-    for dep in deps:
-      PrintLine(dep, out)
-  elif output_mode == 'compiled':
-    # Make sure a .jar is specified.
-    if not options.compiler_jar:
-      logging.error('--compiler_jar flag must be specified if --output is '
-                    '"compiled"')
-      sys.exit(1)
-
-    # User friendly version check.
-    if distutils and not (distutils.version.LooseVersion(GetJavaVersion()) >
-        distutils.version.LooseVersion('1.6')):
-      logging.error('Closure Compiler requires Java 1.6 or higher.')
-      logging.error('Please visit http://www.java.com/getjava')
-      sys.exit(1)
-
-    Compile(options.compiler_jar, deps, out, options.compiler_flags)
-
-  else:
-    logging.error('Invalid value for --output flag.')
-    sys.exit(1)
-
-if __name__ == '__main__':
-  main()

+ 0 - 39
src/renderer/cocoblockly-x/python/block/closure/bin/labs/code/closure.el

@@ -1,39 +0,0 @@
-;; Copyright 2013 The Closure Library Authors. All Rights Reserved.
-;;
-;; Licensed under the Apache License, Version 2.0 (the "License");
-;; you may not use this file except in compliance with the License.
-;; You may obtain a copy of the License at
-;;
-;;      http://www.apache.org/licenses/LICENSE-2.0
-;;
-;; Unless required `by applicable law or agreed to in writing, software
-;; distributed under the License is distributed on an "AS-IS" BASIS,
-;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;; See the License for the specific language governing permissions and
-;; limitations under the License.
-
-;; Closure JS code editing functions for emacs.
-
-;; Author: nnaze@google.com (Nathan Naze)
-
-;; Remember the path of this file, as we will base our paths on it.
-(setq closure-el-path load-file-name)
-
-(defun closure-el-directory ()
-  "Get the directory the closure.el file lives in."
-  (file-name-directory closure-el-path))
-
-(defun closure-generate-jsdoc-path()
-  "The path of the generate_jsdoc.py script."
-  (concat (closure-el-directory) "generate_jsdoc.py"))
-
-(defun closure-insert-jsdoc ()
-  "Insert JSDoc for the next function after the cursor."
-  (interactive)
-  (save-excursion ; Remembers cursor location
-    (call-process-region
-     (point) (point-max)
-     (closure-generate-jsdoc-path)
-     t t)))
-
-(provide 'closure)

+ 0 - 31
src/renderer/cocoblockly-x/python/block/closure/bin/labs/code/closure_test.el

@@ -1,31 +0,0 @@
-;; Copyright 2013 The Closure Library Authors. All Rights Reserved.
-;;
-;; Licensed under the Apache License, Version 2.0 (the "License");
-;; you may not use this file except in compliance with the License.
-;; You may obtain a copy of the License at
-;;
-;;      http://www.apache.org/licenses/LICENSE-2.0
-;;
-;; Unless required `by applicable law or agreed to in writing, software
-;; distributed under the License is distributed on an "AS-IS" BASIS,
-;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;; See the License for the specific language governing permissions and
-;; limitations under the License.
-
-;; Unit tests for closure_test.el
-
-;; Author: nnaze@google.com (Nathan Naze)
-
-(require 'cl)
-
-(setq closure-test-directory (file-name-directory load-file-name))
-
-(load-file (concat closure-test-directory "closure.el"))
-
-(setq closure-el-path "/test/path/closure.el")
-
-(assert (string= "/test/path/" (closure-el-directory)))
-
-(assert (string=
-         "/test/path/generate_jsdoc.py"
-         (closure-generate-jsdoc-path)))

+ 0 - 171
src/renderer/cocoblockly-x/python/block/closure/bin/labs/code/generate_jsdoc.py

@@ -1,171 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2013 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Tool to insert JsDoc before a function.
-
-This script attempts to find the first function passed in to stdin, generate
-JSDoc for it (with argument names and possibly return value), and inject
-it in the string.  This is intended to be used as a subprocess by editors
-such as emacs and vi.
-"""
-
-import re
-import sys
-
-
-# Matches a typical Closure-style function definition.
-_FUNCTION_REGEX = re.compile(r"""
-# Start of line
-^
-
-# Indentation
-(?P<indentation>[ ]*)
-
-# Identifier (handling split across line)
-(?P<identifier>\w+(\s*\.\s*\w+)*)
-
-# "= function"
-\s* = \s* function \s*
-
-# opening paren
-\(
-
-# Function arguments
-(?P<arguments>(?:\s|\w+|,)*)
-
-# closing paren
-\)
-
-# opening bracket
-\s* {
-
-""", re.MULTILINE | re.VERBOSE)
-
-
-def _MatchFirstFunction(script):
-  """Match the first function seen in the script."""
-  return _FUNCTION_REGEX.search(script)
-
-
-def _ParseArgString(arg_string):
-  """Parse an argument string (inside parens) into parameter names."""
-  for arg in arg_string.split(','):
-    arg = arg.strip()
-    if arg:
-      yield arg
-
-
-def _ExtractFunctionBody(script, indentation=0):
-  """Attempt to return the function body."""
-
-  # Real extraction would require a token parser and state machines.
-  # We look for first bracket at the same level of indentation.
-  regex_str = r'{(.*?)^[ ]{%d}}' % indentation
-
-  function_regex = re.compile(regex_str, re.MULTILINE | re.DOTALL)
-  match = function_regex.search(script)
-  if match:
-    return match.group(1)
-
-
-def _ContainsReturnValue(function_body):
-  """Attempt to determine if the function body returns a value."""
-  return_regex = re.compile(r'\breturn\b[^;]')
-
-  # If this matches, we assume they're returning something.
-  return bool(return_regex.search(function_body))
-
-
-def _InsertString(original_string, inserted_string, index):
-  """Insert a string into another string at a given index."""
-  return original_string[0:index] + inserted_string + original_string[index:]
-
-
-def _GenerateJsDoc(args, return_val=False):
-  """Generate JSDoc for a function.
-
-  Args:
-    args: A list of names of the argument.
-    return_val: Whether the function has a return value.
-
-  Returns:
-    The JSDoc as a string.
-  """
-
-  lines = []
-  lines.append('/**')
-
-  lines += [' * @param {} %s' % arg for arg in args]
-
-  if return_val:
-    lines.append(' * @return')
-
-  lines.append(' */')
-
-  return '\n'.join(lines) + '\n'
-
-
-def _IndentString(source_string, indentation):
-  """Indent string some number of characters."""
-  lines = [(indentation * ' ') + line
-           for line in source_string.splitlines(True)]
-  return ''.join(lines)
-
-
-def InsertJsDoc(script):
-  """Attempt to insert JSDoc for the first seen function in the script.
-
-  Args:
-    script: The script, as a string.
-
-  Returns:
-    Returns the new string if function was found and JSDoc inserted. Otherwise
-      returns None.
-  """
-
-  match = _MatchFirstFunction(script)
-  if not match:
-    return
-
-  # Add argument flags.
-  args_string = match.group('arguments')
-  args = _ParseArgString(args_string)
-
-  start_index = match.start(0)
-  function_to_end = script[start_index:]
-
-  lvalue_indentation = len(match.group('indentation'))
-
-  return_val = False
-  function_body = _ExtractFunctionBody(function_to_end, lvalue_indentation)
-  if function_body:
-    return_val = _ContainsReturnValue(function_body)
-
-  jsdoc = _GenerateJsDoc(args, return_val)
-  if lvalue_indentation:
-    jsdoc = _IndentString(jsdoc, lvalue_indentation)
-
-  return _InsertString(script, jsdoc, start_index)
-
-
-if __name__ == '__main__':
-  stdin_script = sys.stdin.read()
-  result = InsertJsDoc(stdin_script)
-
-  if result:
-    sys.stdout.write(result)
-  else:
-    sys.stdout.write(stdin_script)

+ 0 - 167
src/renderer/cocoblockly-x/python/block/closure/bin/labs/code/generate_jsdoc_test.py

@@ -1,167 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright 2013 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required `by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""Unit test for generate_jsdoc."""
-
-__author__ = 'nnaze@google.com (Nathan Naze)'
-
-
-import re
-import unittest
-
-import generate_jsdoc
-
-
-class InsertJsDocTestCase(unittest.TestCase):
-  """Unit test for source.  Tests the parser on a known source input."""
-
-  def testMatchFirstFunction(self):
-    match = generate_jsdoc._MatchFirstFunction(_TEST_SOURCE)
-    self.assertNotEqual(None, match)
-    self.assertEqual('aaa, bbb, ccc', match.group('arguments'))
-
-    match = generate_jsdoc._MatchFirstFunction(_INDENTED_SOURCE)
-    self.assertNotEqual(None, match)
-    self.assertEqual('', match.group('arguments'))
-
-    match = generate_jsdoc._MatchFirstFunction(_ODD_NEWLINES_SOURCE)
-    self.assertEquals('goog.\nfoo.\nbar\n.baz.\nqux',
-                      match.group('identifier'))
-
-  def testParseArgString(self):
-    self.assertEquals(
-        ['foo', 'bar', 'baz'],
-        list(generate_jsdoc._ParseArgString('foo, bar, baz')))
-
-  def testExtractFunctionBody(self):
-    self.assertEquals(
-        '\n  // Function comments.\n  return;\n',
-        generate_jsdoc._ExtractFunctionBody(_TEST_SOURCE))
-
-    self.assertEquals(
-        '\n    var bar = 3;\n    return true;\n',
-        generate_jsdoc._ExtractFunctionBody(_INDENTED_SOURCE, 2))
-
-  def testContainsValueReturn(self):
-    self.assertTrue(generate_jsdoc._ContainsReturnValue(_INDENTED_SOURCE))
-    self.assertFalse(generate_jsdoc._ContainsReturnValue(_TEST_SOURCE))
-
-  def testInsertString(self):
-    self.assertEquals(
-        'abc123def',
-        generate_jsdoc._InsertString('abcdef', '123', 3))
-
-  def testInsertJsDoc(self):
-    self.assertEquals(
-        _EXPECTED_INDENTED_SOURCE,
-        generate_jsdoc.InsertJsDoc(_INDENTED_SOURCE))
-
-    self.assertEquals(
-        _EXPECTED_TEST_SOURCE,
-        generate_jsdoc.InsertJsDoc(_TEST_SOURCE))
-
-    self.assertEquals(
-        _EXPECTED_ODD_NEWLINES_SOURCE,
-        generate_jsdoc.InsertJsDoc(_ODD_NEWLINES_SOURCE))
-
-
-_INDENTED_SOURCE = """\
-  boo.foo.woo = function() {
-    var bar = 3;
-    return true;
-  };
-"""
-
-_EXPECTED_INDENTED_SOURCE = """\
-  /**
-   * @return
-   */
-  boo.foo.woo = function() {
-    var bar = 3;
-    return true;
-  };
-"""
-
-
-_TEST_SOURCE = """\
-
-//  Random comment.
-
-goog.foo.bar = function (aaa, bbb, ccc) {
-  // Function comments.
-  return;
-};
-"""
-
-_EXPECTED_TEST_SOURCE = """\
-
-//  Random comment.
-
-/**
- * @param {} aaa
- * @param {} bbb
- * @param {} ccc
- */
-goog.foo.bar = function (aaa, bbb, ccc) {
-  // Function comments.
-  return;
-};
-"""
-
-_ODD_NEWLINES_SOURCE = """\
-goog.
-foo.
-bar
-.baz.
-qux
-   =
-
- function
-
-(aaa,
-
-bbb, ccc) {
-  // Function comments.
-  return;
-};
-"""
-
-_EXPECTED_ODD_NEWLINES_SOURCE = """\
-/**
- * @param {} aaa
- * @param {} bbb
- * @param {} ccc
- */
-goog.
-foo.
-bar
-.baz.
-qux
-   =
-
- function
-
-(aaa,
-
-bbb, ccc) {
-  // Function comments.
-  return;
-};
-"""
-
-if __name__ == '__main__':
-  unittest.main()

+ 0 - 31
src/renderer/cocoblockly-x/python/block/closure/bin/labs/code/run_el_tests.sh

@@ -1,31 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2013 The Closure Library Authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Wraps the unit tests not using the Google framework so they may be run
-# on the continuous build.
-#
-# Author: nnaze@google.com (Nathan Naze)
-#
-# Wraps the unit tests not using the Google framework so they may be run
-# run on the continuous build.
-
-set -e
-
-source googletest.sh || exit 1
-
-CLOSURE_SRCDIR=$TEST_SRCDIR/google3/javascript/closure/labs/bin/code/
-
-emacs --script $CLOSURE_SRCDIR/closure_test.el

+ 0 - 28
src/renderer/cocoblockly-x/python/block/closure/bin/labs/code/run_py_tests.sh

@@ -1,28 +0,0 @@
-#!/bin/bash
-#
-# Copyright 2013 The Closure Library Authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# Wraps the unit tests not using the Google framework so they may be run
-# on the continuous build.
-
-set -e
-
-source googletest.sh || exit 1
-
-CLOSURE_SRCDIR=$TEST_SRCDIR/google3/javascript/closure/labs/bin/code/
-
-PYTHONPATH=$CLOSURE_SRCDIR
-
-$CLOSURE_SRCDIR/generate_jsdoc_test.py

+ 0 - 25
src/renderer/cocoblockly-x/python/block/closure/bin/logos/logo.svg

@@ -1,25 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
-  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<!--
-Copyright 2013 The Closure Library Authors. All Rights Reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS-IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 9 9">
-  <title>Closure Logo</title>
-  <path d="M2,2 h2 a2,2 0 1 0 -2,2 z" fill="#0066CF" />
-  <path d="M7,2 h-2 a2,2 0 1 1 2,2 z" fill="#FD0100" />
-  <path d="M2,7 h2 a2,2 0 1 1 -2,-2 z" fill="#FEC502" />
-  <path d="M7,7 h-2 a2,2 0 1 0 2,-2 z" fill="#009338" />
-</svg>

+ 0 - 25
src/renderer/cocoblockly-x/python/block/closure/bin/logos/logoandlabel.svg

@@ -1,25 +0,0 @@
-<?xml version="1.0" standalone="no"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
-  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<!--
-Copyright 2013 The Closure Library Authors. All Rights Reserved.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-   http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS-IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<svg xmlns="http://www.w3.org/2000/svg"
-     xmlns:xlink="http://www.w3.org/1999/xlink"
-     viewBox="0 0 200 250">
-  <image x="0" y="0" width="200" height="200" xlink:href="logo.svg" />
-  <text text-anchor="middle" x="100" y="245" font-family="Helvetica"
-        font-size="53" font-weight="bold">Closure</text>
-</svg>

+ 0 - 221
src/renderer/cocoblockly-x/python/block/closure/bin/scopify.py

@@ -1,221 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright 2010 The Closure Library Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS-IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""Automatically converts codebases over to goog.scope.
-
-Usage:
-cd path/to/my/dir;
-../../../../javascript/closure/bin/scopify.py
-
-Scans every file in this directory, recursively. Looks for existing
-goog.scope calls, and goog.require'd symbols. If it makes sense to
-generate a goog.scope call for the file, then we will do so, and
-try to auto-generate some aliases based on the goog.require'd symbols.
-
-Known Issues:
-
-  When a file is goog.scope'd, the file contents will be indented +2.
-  This may put some lines over 80 chars. These will need to be fixed manually.
-
-  We will only try to create aliases for capitalized names. We do not check
-  to see if those names will conflict with any existing locals.
-
-  This creates merge conflicts for every line of every outstanding change.
-  If you intend to run this on your codebase, make sure your team members
-  know. Better yet, send them this script so that they can scopify their
-  outstanding changes and "accept theirs".
-
-  When an alias is "captured", it can no longer be stubbed out for testing.
-  Run your tests.
-
-"""
-
-__author__ = 'nicksantos@google.com (Nick Santos)'
-
-import os.path
-import re
-import sys
-
-REQUIRES_RE = re.compile(r"goog.require\('([^']*)'\)")
-
-# Edit this manually if you want something to "always" be aliased.
-# TODO(nicksantos): Add a flag for this.
-DEFAULT_ALIASES = {}
-
-def Transform(lines):
-  """Converts the contents of a file into javascript that uses goog.scope.
-
-  Arguments:
-    lines: A list of strings, corresponding to each line of the file.
-  Returns:
-    A new list of strings, or None if the file was not modified.
-  """
-  requires = []
-
-  # Do an initial scan to be sure that this file can be processed.
-  for line in lines:
-    # Skip this file if it has already been scopified.
-    if line.find('goog.scope') != -1:
-      return None
-
-    # If there are any global vars or functions, then we also have
-    # to skip the whole file. We might be able to deal with this
-    # more elegantly.
-    if line.find('var ') == 0 or line.find('function ') == 0:
-      return None
-
-    for match in REQUIRES_RE.finditer(line):
-      requires.append(match.group(1))
-
-  if len(requires) == 0:
-    return None
-
-  # Backwards-sort the requires, so that when one is a substring of another,
-  # we match the longer one first.
-  for val in DEFAULT_ALIASES.values():
-    if requires.count(val) == 0:
-      requires.append(val)
-
-  requires.sort()
-  requires.reverse()
-
-  # Generate a map of requires to their aliases
-  aliases_to_globals = DEFAULT_ALIASES.copy()
-  for req in requires:
-    index = req.rfind('.')
-    if index == -1:
-      alias = req
-    else:
-      alias = req[(index + 1):]
-
-    # Don't scopify lowercase namespaces, because they may conflict with
-    # local variables.
-    if alias[0].isupper():
-      aliases_to_globals[alias] = req
-
-  aliases_to_matchers = {}
-  globals_to_aliases = {}
-  for alias, symbol in aliases_to_globals.items():
-    globals_to_aliases[symbol] = alias
-    aliases_to_matchers[alias] = re.compile('\\b%s\\b' % symbol)
-
-  # Insert a goog.scope that aliases all required symbols.
-  result = []
-
-  START = 0
-  SEEN_REQUIRES = 1
-  IN_SCOPE = 2
-
-  mode = START
-  aliases_used = set()
-  insertion_index = None
-  num_blank_lines = 0
-  for line in lines:
-    if mode == START:
-      result.append(line)
-
-      if re.search(REQUIRES_RE, line):
-        mode = SEEN_REQUIRES
-
-    elif mode == SEEN_REQUIRES:
-      if (line and
-          not re.search(REQUIRES_RE, line) and
-          not line.isspace()):
-        # There should be two blank lines before goog.scope
-        result += ['\n'] * 2
-        result.append('goog.scope(function() {\n')
-        insertion_index = len(result)
-        result += ['\n'] * num_blank_lines
-        mode = IN_SCOPE
-      elif line.isspace():
-        # Keep track of the number of blank lines before each block of code so
-        # that we can move them after the goog.scope line if necessary.
-        num_blank_lines += 1
-      else:
-        # Print the blank lines we saw before this code block
-        result += ['\n'] * num_blank_lines
-        num_blank_lines = 0
-        result.append(line)
-
-    if mode == IN_SCOPE:
-      for symbol in requires:
-        if not symbol in globals_to_aliases:
-          continue
-
-        alias = globals_to_aliases[symbol]
-        matcher = aliases_to_matchers[alias]
-        for match in matcher.finditer(line):
-          # Check to make sure we're not in a string.
-          # We do this by being as conservative as possible:
-          # if there are any quote or double quote characters
-          # before the symbol on this line, then bail out.
-          before_symbol = line[:match.start(0)]
-          if before_symbol.count('"') > 0 or before_symbol.count("'") > 0:
-            continue
-
-          line = line.replace(match.group(0), alias)
-          aliases_used.add(alias)
-
-      if line.isspace():
-        # Truncate all-whitespace lines
-        result.append('\n')
-      else:
-        result.append(line)
-
-  if len(aliases_used):
-    aliases_used = [alias for alias in aliases_used]
-    aliases_used.sort()
-    aliases_used.reverse()
-    for alias in aliases_used:
-      symbol = aliases_to_globals[alias]
-      result.insert(insertion_index,
-                    'var %s = %s;\n' % (alias, symbol))
-    result.append('});  // goog.scope\n')
-    return result
-  else:
-    return None
-
-def TransformFileAt(path):
-  """Converts a file into javascript that uses goog.scope.
-
-  Arguments:
-    path: A path to a file.
-  """
-  f = open(path)
-  lines = Transform(f.readlines())
-  if lines:
-    f = open(path, 'w')
-    for l in lines:
-      f.write(l)
-    f.close()
-
-if __name__ == '__main__':
-  args = sys.argv[1:]
-  if not len(args):
-    args = '.'
-
-  for file_name in args:
-    if os.path.isdir(file_name):
-      for root, dirs, files in os.walk(file_name):
-        for name in files:
-          if name.endswith('.js') and \
-              not os.path.islink(os.path.join(root, name)):
-            TransformFileAt(os.path.join(root, name))
-    else:
-      if file_name.endswith('.js') and \
-          not os.path.islink(file_name):
-        TransformFileAt(file_name)

+ 0 - 82
src/renderer/cocoblockly-x/python/block/closure/css/inlay/g-base.css

@@ -1,82 +0,0 @@
-/*
- * Copyright 2007 The Closure Library Authors. All Rights Reserved.
- *
- * Use of this source code is governed by the Apache License, Version 2.0.
- * See the COPYING file for details.
- */
-
-/**
- * CSS Inlay
- * This is the minimum CSS required to use the markup/classname patterns.
- * @author elsigh@google.com (Lindsey Simon)
- * @author ddiaz@google.com (Dustin Diaz)
- */
-
-/**
- * Document container designed for fluid width scaling.
- * Alternative g-doc- fixed-width classes are in gui-fixed.css.
- */
-.g-doc {
-  width: 100%;
-  text-align: left;
-}
-
-/**
- * g-section fundamentally has to clear floats. There are many ways to do this.
- * This technique is nice because it doesn't rely on overflow: hidden, which
- * has the potential to hide your content in situations where a fixed size
- * node takes up too much space (like a big table, or a text input or image.
- * Works in Webkit, IE8, and FF3.
- */
-.g-section {
-  width: 100%;
-  vertical-align: top;
-  display: inline-block;
-}
-
-/**
- * IE7-only hack. Nicely IE7 will clear floats with just block display
- * and hasLayout.
- */
-*:first-child+html .g-section {
-  display: block;
-}
-
-/**
- * IE6 cannot hang with overflow: visible. If we use the IE7 display block
- * trick in IE6 we get severe float drop in nested grids.
- */
-* html .g-section {
-  overflow: hidden;
-}
-
-/* FF2 can't actually hang with overflow: visible. */
-@-moz-document url-prefix() {
-  .g-section {
-    overflow: hidden;
-  }
-}
-
-/**
- * FF3 now needs to be reset after the previous block which affects it as well.
- * We target the tt element in this hack because no one uses it.
- */
-@-moz-document url-prefix() {
-  .g-section,tt:default {
-    overflow: visible;
-  }
-}
-
-/* Forces "hasLayout" fixing a gamut of bugs in <= IE7. */
-.g-section,
-.g-unit {
-  zoom: 1;
-}
-
-/* Used for splitting a template's units text-alignment to the outer edges. */
-.g-split .g-unit {
-  text-align: right;
-}
-.g-split .g-first {
-  text-align: left;
-}

+ 0 - 173
src/renderer/cocoblockly-x/python/block/closure/css/inlay/g-fixed.css

@@ -1,173 +0,0 @@
-/*
- * Copyright 2007 The Closure Library Authors. All Rights Reserved.
- *
- * Use of this source code is governed by the Apache License, Version 2.0.
- * See the COPYING file for details.
- */
-
-/**
- * CSS Inlay
- * Fixed templates
- * @author ddiaz@google.com (Dustin Diaz)
- * @author elsigh@google.com (Lindsey Simon)
- * @fileoverview
- * The nature of these templates is to have one unit be a fixed width
- * and the supplementary unit to take up the rest of the width
- * of its parents' container.
- *
- * Sample Usage:
-  <div class="g-section g-tpl-180">
-    <div class="g-unit g-first">
-      <p>
-        Lorem Ipsum...
-      </p>
-    </div>
-    <div class="g-unit">
-      <p>
-        Lorem Ipsum...
-      </p>
-    </div>
-  </div>
- */
-
-/* Document container designed for 1024x768 */
-/* TODO(ux-webdev): convert this to a straight px value - em assumes reset. */
-.g-doc-1024 {
-  width: 73.074em;
-  min-width: 950px; /* min-width doesn't work in IE6 */
-  margin: 0 auto;
-  text-align: left;
-}
-/* IE 6 */
-* html .g-doc-1024 {
-  width: 71.313em;
-}
-/* IE 7 */
-*+html .g-doc-1024 {
-  width: 71.313em;
-}
-
-/* Document container designed for 800x600 */
-/* TODO(ux-webdev): convert this to a straight px value - em assumes reset. */
-.g-doc-800 {
-  width: 57.69em;
-  min-width: 750px; /* min-width doesn't work in IE6 */
-  margin: 0 auto;
-  text-align: left;
-}
-/* IE 6 */
-* html .g-doc-800 {
-  width: 56.3em;
-}
-/* IE 7 */
-*+html .g-doc-800 {
-  width: 56.3em;
-}
-
-/* 160px */
-.g-tpl-160 .g-unit,
-.g-unit .g-tpl-160 .g-unit,
-.g-unit .g-unit .g-tpl-160 .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-160 .g-unit {
-  margin: 0 0 0 160px;
-  width: auto;
-  float: none;
-}
-.g-unit .g-unit .g-unit .g-tpl-160 .g-first,
-.g-unit .g-unit .g-tpl-160 .g-first,
-.g-unit .g-tpl-160 .g-first,
-.g-tpl-160 .g-first {
-  margin: 0;
-  width: 160px;
-  float: left;
-}
-
-/* 160px alt */
-.g-tpl-160-alt .g-unit,
-.g-unit .g-tpl-160-alt .g-unit,
-.g-unit .g-unit .g-tpl-160-alt .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-160-alt .g-unit {
-  margin: 0 160px 0 0;
-  width: auto;
-  float: none;
-}
-.g-unit .g-unit .g-unit .g-tpl-160-alt .g-first,
-.g-unit .g-unit .g-tpl-160-alt .g-first,
-.g-unit .g-tpl-160-alt .g-first,
-.g-tpl-160-alt .g-first {
-  margin: 0;
-  width: 160px;
-  float: right;
-}
-
-/* 180px */
-.g-tpl-180 .g-unit,
-.g-unit .g-tpl-180 .g-unit,
-.g-unit .g-unit .g-tpl-180 .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-180 .g-unit {
-  margin: 0 0 0 180px;
-  width: auto;
-  float: none;
-}
-.g-unit .g-unit .g-unit .g-tpl-180 .g-first,
-.g-unit .g-unit .g-tpl-180 .g-first,
-.g-unit .g-tpl-180 .g-first,
-.g-tpl-180 .g-first {
-  margin: 0;
-  width: 180px;
-  float: left;
-}
-
-/* 180px alt */
-.g-tpl-180-alt .g-unit,
-.g-unit .g-tpl-180-alt .g-unit,
-.g-unit .g-unit .g-tpl-180-alt .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-180-alt .g-unit {
-  margin: 0 180px 0 0;
-  width: auto;
-  float: none;
-}
-.g-unit .g-unit .g-unit .g-tpl-180-alt .g-first,
-.g-unit .g-unit .g-tpl-180-alt .g-first,
-.g-unit .g-tpl-180-alt .g-first,
-.g-tpl-180-alt .g-first {
-  margin: 0;
-  width: 180px;
-  float: right;
-}
-
-/* 300px */
-.g-tpl-300 .g-unit,
-.g-unit .g-tpl-300 .g-unit,
-.g-unit .g-unit .g-tpl-300 .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-300 .g-unit {
-  margin: 0 0 0 300px;
-  width: auto;
-  float: none;
-}
-.g-unit .g-unit .g-unit .g-tpl-300 .g-first,
-.g-unit .g-unit .g-tpl-300 .g-first,
-.g-unit .g-tpl-300 .g-first,
-.g-tpl-300 .g-first {
-  margin: 0;
-  width: 300px;
-  float: left;
-}
-
-/* 300px alt */
-.g-tpl-300-alt .g-unit,
-.g-unit .g-tpl-300-alt .g-unit,
-.g-unit .g-unit .g-tpl-300-alt .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-300-alt .g-unit {
-  margin: 0 300px 0 0;
-  width: auto;
-  float: none;
-}
-.g-unit .g-unit .g-unit .g-tpl-300-alt .g-first,
-.g-unit .g-unit .g-tpl-300-alt .g-first,
-.g-unit .g-tpl-300-alt .g-first,
-.g-tpl-300-alt .g-first {
-  margin: 0;
-  width: 300px;
-  float: right;
-}

+ 0 - 253
src/renderer/cocoblockly-x/python/block/closure/css/inlay/g-ratio.css

@@ -1,253 +0,0 @@
-/*
- * Copyright 2007 The Closure Library Authors. All Rights Reserved.
- *
- * Use of this source code is governed by the Apache License, Version 2.0.
- * See the COPYING file for details.
- */
-
-/**
- * CSS Inlay
- * Percentage based templates
- * @author ddiaz@google.com (Dustin Diaz)
- * @author elsigh@google.com (Lindsey Simon)
- * @fileoverview
- * The first ten templates are described using the following convention:
- * tpl-LEFT%-RIGHT% and tpl-LEFT%-RIGHT%-alt, where alt switches render order.
- *
- * The rationale for the percentage values are pretty fascinating.
- * Three nine's are needed for a miminal affordance in the gap between units
- * for Opera, while two for IE 5.5 and down.
- * Straight percentages seem to work fine otherwise, but the values here test
- * well cross-browser.
- *
- * Sample Usage:
-  <div class="g-section g-tpl-50-50">
-    <div class="g-unit g-first">
-      <p>
-        Lorem Ipsum...
-      </p>
-    </div>
-    <div class="g-unit">
-      <p>
-        Lorem Ipsum...
-      </p>
-    </div>
-  </div>
- */
-
-/* 25/75 */
-.g-tpl-25-75 .g-unit,
-.g-unit .g-tpl-25-75 .g-unit,
-.g-unit .g-unit .g-tpl-25-75 .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-25-75 .g-unit {
-  width: 74.999%;
-  float: right;
-  margin: 0;
-}
-.g-unit .g-unit .g-unit .g-tpl-25-75 .g-first,
-.g-unit .g-unit .g-tpl-25-75 .g-first,
-.g-unit .g-tpl-25-75 .g-first,
-.g-tpl-25-75 .g-first {
-  width: 24.999%;
-  float: left;
-  margin: 0;
-}
-
-/* 25/75-alt */
-.g-tpl-25-75-alt .g-unit,
-.g-unit .g-tpl-25-75-alt .g-unit,
-.g-unit .g-unit .g-tpl-25-75-alt .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-25-75-alt .g-unit {
-  width: 24.999%;
-  float: left;
-  margin: 0;
-}
-.g-unit .g-unit .g-unit .g-tpl-25-75-alt .g-first,
-.g-unit .g-unit .g-tpl-25-75-alt .g-first,
-.g-unit .g-tpl-25-75-alt .g-first,
-.g-tpl-25-75-alt .g-first {
-  width: 74.999%;
-  float: right;
-  margin: 0;
-}
-
-/* 75/25 */
-.g-tpl-75-25 .g-unit,
-.g-unit .g-tpl-75-25 .g-unit,
-.g-unit .g-unit .g-tpl-75-25 .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-75-25 .g-unit {
-  width: 24.999%;
-  float: right;
-  margin: 0;
-}
-.g-unit .g-unit .g-unit .g-tpl-75-25 .g-first,
-.g-unit .g-unit .g-tpl-75-25 .g-first,
-.g-unit .g-tpl-75-25 .g-first,
-.g-tpl-75-25 .g-first {
-  width: 74.999%;
-  float: left;
-  margin: 0;
-}
-
-/* 75/25-alt */
-.g-tpl-75-25-alt .g-unit,
-.g-unit .g-tpl-75-25-alt .g-unit,
-.g-unit .g-unit .g-tpl-75-25-alt .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-75-25-alt .g-unit {
-  width: 74.999%;
-  float: left;
-  margin: 0;
-}
-.g-unit .g-unit .g-unit .g-tpl-75-25-alt .g-first,
-.g-unit .g-unit .g-tpl-75-25-alt .g-first,
-.g-unit .g-tpl-75-25-alt .g-first,
-.g-tpl-75-25-alt .g-first {
-  width: 24.999%;
-  float: right;
-  margin: 0;
-}
-
-/* 33/67 */
-.g-tpl-33-67  .g-unit,
-.g-unit .g-tpl-33-67  .g-unit,
-.g-unit .g-unit .g-tpl-33-67  .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-33-67  .g-unit {
-  width: 66.999%;
-  float: right;
-  margin: 0;
-}
-.g-unit .g-unit .g-unit .g-tpl-33-67 .g-first,
-.g-unit .g-unit .g-tpl-33-67 .g-first,
-.g-unit .g-tpl-33-67 .g-first,
-.g-tpl-33-67 .g-first {
-  width: 32.999%;
-  float: left;
-  margin: 0;
-}
-
-/* 33/67-alt */
-.g-tpl-33-67-alt .g-unit,
-.g-unit .g-tpl-33-67-alt .g-unit,
-.g-unit .g-unit .g-tpl-33-67-alt .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-33-67-alt .g-unit {
-  width: 32.999%;
-  float: left;
-  margin: 0;
-}
-.g-unit .g-unit .g-unit .g-tpl-33-67-alt .g-first,
-.g-unit .g-unit .g-tpl-33-67-alt .g-first,
-.g-unit .g-tpl-33-67-alt .g-first,
-.g-tpl-33-67-alt .g-first {
-  width: 66.999%;
-  float: right;
-  margin: 0;
-}
-/* 67/33 */
-.g-tpl-67-33 .g-unit,
-.g-unit .g-tpl-67-33 .g-unit,
-.g-unit .g-unit .g-tpl-67-33 .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-67-33 .g-unit {
-  width: 32.999%;
-  float: right;
-  margin: 0;
-}
-.g-unit .g-unit .g-unit .g-tpl-67-33 .g-first,
-.g-unit .g-unit .g-tpl-67-33 .g-first,
-.g-unit .g-tpl-67-33 .g-first,
-.g-tpl-67-33 .g-first {
-  width: 66.999%;
-  float: left;
-  margin: 0;
-}
-
-/* 67/33-alt */
-.g-tpl-67-33-alt .g-unit,
-.g-unit .g-tpl-67-33-alt .g-unit,
-.g-unit .g-unit .g-tpl-67-33-alt .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-67-33-alt .g-unit {
-  width: 66.999%;
-  float: left;
-  margin: 0;
-}
-.g-unit .g-unit .g-unit .g-tpl-67-33-alt .g-first,
-.g-unit .g-unit .g-tpl-67-33-alt .g-first,
-.g-unit .g-tpl-67-33-alt .g-first,
-.g-tpl-67-33-alt .g-first {
-  width: 32.999%;
-  float: right;
-  margin: 0;
-}
-
-/* 50/50 */
-.g-tpl-50-50 .g-unit,
-.g-unit .g-tpl-50-50 .g-unit,
-.g-unit .g-unit .g-tpl-50-50 .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-50-50 .g-unit {
-  width: 49.999%;
-  float: right;
-  margin: 0;
-}
-.g-unit .g-unit .g-unit .g-tpl-50-50 .g-first,
-.g-unit .g-unit .g-tpl-50-50 .g-first,
-.g-unit .g-tpl-50-50 .g-first,
-.g-tpl-50-50 .g-first {
-  width: 49.999%;
-  float: left;
-  margin: 0;
-}
-
-/* 50/50-alt */
-.g-tpl-50-50-alt .g-unit,
-.g-unit .g-tpl-50-50-alt .g-unit,
-.g-unit .g-unit .g-tpl-50-50-alt .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-50-50-alt .g-unit {
-  width: 49.999%;
-  float: left;
-  margin: 0;
-}
-.g-unit .g-unit .g-unit .g-tpl-50-50-alt .g-first,
-.g-unit .g-unit .g-tpl-50-50-alt .g-first,
-.g-unit .g-tpl-50-50-alt .g-first,
-.g-tpl-50-50-alt .g-first {
-  width: 49.999%;
-  float: right;
-  margin: 0;
-}
-
-/**
- * Nest templates contain floating g-units.
- * For these, width needs to be reset from the 100% for inline-block
- * to auto. This fixes an issue with horizontal scrollbars.
- */
-.g-tpl-nest {
-  width: auto;
-}
-/**
- * Making any g-sections inside of g-tpl-nests display inline instead
- * of display block solves an issue where inner sections add up incrementally
- * their widths to set the width of the outer g-unit. This causes all kinds of
- * problems with float-drops and display:inline fixes this.
- */
-.g-tpl-nest .g-section {
-  display: inline;
-}
-
-/* g-tpl-nest for multi unit nesting (float left), say for a menu. */
-.g-tpl-nest .g-unit,
-.g-unit .g-tpl-nest .g-unit,
-.g-unit .g-unit .g-tpl-nest .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-nest .g-unit {
-  float: left;
-  width: auto;
-  margin: 0;
-}
-
-/* g-tpl-nest-alt for multi unit nesting (float right), say for a menu. */
-.g-tpl-nest-alt .g-unit,
-.g-unit .g-tpl-nest-alt .g-unit,
-.g-unit .g-unit .g-tpl-nest-alt .g-unit,
-.g-unit .g-unit .g-unit .g-tpl-nest-alt .g-unit {
-  float: right;
-  width: auto;
-  margin: 0;
-}

+ 0 - 121
src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/announcer.js

@@ -1,121 +0,0 @@
-// Copyright 2007 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-/**
- * @fileoverview Announcer that allows messages to be spoken by assistive
- * technologies.
- */
-
-goog.provide('goog.a11y.aria.Announcer');
-
-goog.require('goog.Disposable');
-goog.require('goog.Timer');
-goog.require('goog.a11y.aria');
-goog.require('goog.a11y.aria.LivePriority');
-goog.require('goog.a11y.aria.State');
-goog.require('goog.dom');
-goog.require('goog.dom.TagName');
-goog.require('goog.object');
-
-
-
-/**
- * Class that allows messages to be spoken by assistive technologies that the
- * user may have active.
- *
- * @param {goog.dom.DomHelper=} opt_domHelper DOM helper.
- * @constructor
- * @extends {goog.Disposable}
- * @final
- */
-goog.a11y.aria.Announcer = function(opt_domHelper) {
-  goog.a11y.aria.Announcer.base(this, 'constructor');
-
-  /**
-   * @type {goog.dom.DomHelper}
-   * @private
-   */
-  this.domHelper_ = opt_domHelper || goog.dom.getDomHelper();
-
-  /**
-   * Map of priority to live region elements to use for communicating updates.
-   * Elements are created on demand.
-   * @type {Object<goog.a11y.aria.LivePriority, !Element>}
-   * @private
-   */
-  this.liveRegions_ = {};
-};
-goog.inherits(goog.a11y.aria.Announcer, goog.Disposable);
-
-
-/** @override */
-goog.a11y.aria.Announcer.prototype.disposeInternal = function() {
-  goog.object.forEach(
-      this.liveRegions_, this.domHelper_.removeNode, this.domHelper_);
-  this.liveRegions_ = null;
-  this.domHelper_ = null;
-  goog.a11y.aria.Announcer.base(this, 'disposeInternal');
-};
-
-
-/**
- * Announce a message to be read by any assistive technologies the user may
- * have active.
- * @param {string} message The message to announce to screen readers.
- * @param {goog.a11y.aria.LivePriority=} opt_priority The priority of the
- *     message. Defaults to POLITE.
- */
-goog.a11y.aria.Announcer.prototype.say = function(message, opt_priority) {
-  var priority = opt_priority || goog.a11y.aria.LivePriority.POLITE;
-  var liveRegion = this.getLiveRegion_(priority);
-  // Resets text content to force a DOM mutation (so that the setTextContent
-  // post-timeout function will be noticed by the screen reader). This is to
-  // avoid the problem of when the same message is "said" twice, which doesn't
-  // trigger a DOM mutation.
-  goog.dom.setTextContent(liveRegion, '');
-  // Uses non-zero timer to make VoiceOver and NVDA work
-  goog.Timer.callOnce(function() {
-    goog.dom.setTextContent(liveRegion, message);
-  }, 1);
-};
-
-
-/**
- * Returns an aria-live region that can be used to communicate announcements.
- * @param {!goog.a11y.aria.LivePriority} priority The required priority.
- * @return {!Element} A live region of the requested priority.
- * @private
- */
-goog.a11y.aria.Announcer.prototype.getLiveRegion_ = function(priority) {
-  var liveRegion = this.liveRegions_[priority];
-  if (liveRegion) {
-    // Make sure the live region is not aria-hidden.
-    goog.a11y.aria.removeState(liveRegion, goog.a11y.aria.State.HIDDEN);
-    return liveRegion;
-  }
-
-  liveRegion = this.domHelper_.createElement(goog.dom.TagName.DIV);
-  // Note that IE has a habit of declaring things that aren't display:none as
-  // invisible to third-party tools like JAWs, so we can't just use height:0.
-  liveRegion.style.position = 'absolute';
-  liveRegion.style.top = '-1000px';
-  liveRegion.style.height = '1px';
-  liveRegion.style.overflow = 'hidden';
-  goog.a11y.aria.setState(liveRegion, goog.a11y.aria.State.LIVE, priority);
-  goog.a11y.aria.setState(liveRegion, goog.a11y.aria.State.ATOMIC, 'true');
-  this.domHelper_.getDocument().body.appendChild(liveRegion);
-  this.liveRegions_[priority] = liveRegion;
-  return liveRegion;
-};

+ 0 - 28
src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/announcer_test.html

@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!--
-Copyright 2008 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
- <!--
-Author:  attila@google.com (Attila Bodis)
--->
- <head>
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta charset="UTF-8" />
-  <title>
-   Closure Unit Tests - goog.a11y.aria announcer
-  </title>
-  <script src="../../base.js">
-  </script>
-  <script>
-    goog.require('goog.a11y.aria.AnnouncerTest');
-  </script>
- </head>
- <body>
-  <div id="sandbox">
-  </div>
- </body>
-</html>

+ 0 - 137
src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/announcer_test.js

@@ -1,137 +0,0 @@
-// Copyright 2008 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-goog.provide('goog.a11y.aria.AnnouncerTest');
-goog.setTestOnly('goog.a11y.aria.AnnouncerTest');
-
-goog.require('goog.a11y.aria');
-goog.require('goog.a11y.aria.Announcer');
-goog.require('goog.a11y.aria.LivePriority');
-goog.require('goog.a11y.aria.State');
-goog.require('goog.array');
-goog.require('goog.dom');
-goog.require('goog.dom.TagName');
-goog.require('goog.dom.iframe');
-goog.require('goog.testing.MockClock');
-goog.require('goog.testing.jsunit');
-
-var sandbox;
-var someDiv;
-var someSpan;
-var mockClock;
-
-function setUp() {
-  sandbox = goog.dom.getElement('sandbox');
-  someDiv = goog.dom.createDom(goog.dom.TagName.DIV, {id: 'someDiv'}, 'DIV');
-  someSpan =
-      goog.dom.createDom(goog.dom.TagName.SPAN, {id: 'someSpan'}, 'SPAN');
-  sandbox.appendChild(someDiv);
-  someDiv.appendChild(someSpan);
-
-  mockClock = new goog.testing.MockClock(true);
-}
-
-function tearDown() {
-  goog.dom.removeChildren(sandbox);
-  someDiv = null;
-  someSpan = null;
-
-  goog.dispose(mockClock);
-}
-
-function testAnnouncerAndDispose() {
-  var text = 'test content';
-  var announcer = new goog.a11y.aria.Announcer(goog.dom.getDomHelper());
-  announcer.say(text);
-  checkLiveRegionContains(text, 'polite');
-  goog.dispose(announcer);
-}
-
-function testAnnouncerTwice() {
-  var text = 'test content1';
-  var text2 = 'test content2';
-  var announcer = new goog.a11y.aria.Announcer(goog.dom.getDomHelper());
-  announcer.say(text);
-  announcer.say(text2);
-  checkLiveRegionContains(text2, 'polite');
-  goog.dispose(announcer);
-}
-
-function testAnnouncerTwiceSameMessage() {
-  var text = 'test content';
-  var announcer = new goog.a11y.aria.Announcer(goog.dom.getDomHelper());
-  announcer.say(text);
-  var firstLiveRegion = getLiveRegion('polite');
-  announcer.say(text, undefined);
-  var secondLiveRegion = getLiveRegion('polite');
-  assertEquals(firstLiveRegion, secondLiveRegion);
-  checkLiveRegionContains(text, 'polite');
-  goog.dispose(announcer);
-}
-
-function testAnnouncerAssertive() {
-  var text = 'test content';
-  var announcer = new goog.a11y.aria.Announcer(goog.dom.getDomHelper());
-  announcer.say(text, goog.a11y.aria.LivePriority.ASSERTIVE);
-  checkLiveRegionContains(text, 'assertive');
-  goog.dispose(announcer);
-}
-
-function testAnnouncerInIframe() {
-  var text = 'test content';
-  var frame = goog.dom.iframe.createWithContent(sandbox);
-  var helper =
-      goog.dom.getDomHelper(goog.dom.getFrameContentDocument(frame).body);
-  var announcer = new goog.a11y.aria.Announcer(helper);
-  announcer.say(text, 'polite', helper);
-  checkLiveRegionContains(text, 'polite', helper);
-  goog.dispose(announcer);
-}
-
-function testAnnouncerWithAriaHidden() {
-  var text = 'test content1';
-  var text2 = 'test content2';
-  var announcer = new goog.a11y.aria.Announcer(goog.dom.getDomHelper());
-  announcer.say(text);
-  // Set aria-hidden attribute on the live region (simulates a modal dialog
-  // being opened).
-  var liveRegion = getLiveRegion('polite');
-  goog.a11y.aria.setState(liveRegion, goog.a11y.aria.State.HIDDEN, true);
-
-  // Announce a new message and make sure that the aria-hidden was removed.
-  announcer.say(text2);
-  checkLiveRegionContains(text2, 'polite');
-  assertEquals(
-      '', goog.a11y.aria.getState(liveRegion, goog.a11y.aria.State.HIDDEN));
-  goog.dispose(announcer);
-}
-
-function getLiveRegion(priority, opt_domHelper) {
-  var dom = opt_domHelper || goog.dom.getDomHelper();
-  var divs = dom.getElementsByTagNameAndClass(goog.dom.TagName.DIV, null);
-  var liveRegions = [];
-  goog.array.forEach(divs, function(div) {
-    if (goog.a11y.aria.getState(div, 'live') == priority) {
-      liveRegions.push(div);
-    }
-  });
-  assertEquals(1, liveRegions.length);
-  return liveRegions[0];
-}
-
-function checkLiveRegionContains(text, priority, opt_domHelper) {
-  var liveRegion = getLiveRegion(priority, opt_domHelper);
-  mockClock.tick(1);
-  assertEquals(text, goog.dom.getTextContent(liveRegion));
-}

+ 0 - 424
src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/aria.js

@@ -1,424 +0,0 @@
-// Copyright 2007 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-/**
- * @fileoverview Utilities for adding, removing and setting ARIA roles and
- * states as defined by W3C ARIA standard: http://www.w3.org/TR/wai-aria/
- * All modern browsers have some form of ARIA support, so no browser checks are
- * performed when adding ARIA to components.
- *
- */
-
-goog.provide('goog.a11y.aria');
-
-goog.require('goog.a11y.aria.Role');
-goog.require('goog.a11y.aria.State');
-goog.require('goog.a11y.aria.datatables');
-goog.require('goog.array');
-goog.require('goog.asserts');
-goog.require('goog.dom');
-goog.require('goog.dom.TagName');
-goog.require('goog.object');
-goog.require('goog.string');
-
-
-/**
- * ARIA states/properties prefix.
- * @private
- */
-goog.a11y.aria.ARIA_PREFIX_ = 'aria-';
-
-
-/**
- * ARIA role attribute.
- * @private
- */
-goog.a11y.aria.ROLE_ATTRIBUTE_ = 'role';
-
-
-/**
- * A list of tag names for which we don't need to set ARIA role and states
- * because they have well supported semantics for screen readers or because
- * they don't contain content to be made accessible.
- * @private
- */
-goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_ = goog.object.createSet([
-  goog.dom.TagName.A, goog.dom.TagName.AREA, goog.dom.TagName.BUTTON,
-  goog.dom.TagName.HEAD, goog.dom.TagName.INPUT, goog.dom.TagName.LINK,
-  goog.dom.TagName.MENU, goog.dom.TagName.META, goog.dom.TagName.OPTGROUP,
-  goog.dom.TagName.OPTION, goog.dom.TagName.PROGRESS, goog.dom.TagName.STYLE,
-  goog.dom.TagName.SELECT, goog.dom.TagName.SOURCE, goog.dom.TagName.TEXTAREA,
-  goog.dom.TagName.TITLE, goog.dom.TagName.TRACK
-]);
-
-
-/**
- * A list of roles which are considered container roles.
- * Container roles are ARIA roles which use the aria-activedescendant property
- * to manage their active descendants or children. See
- * {@link http://www.w3.org/TR/wai-aria/states_and_properties
- * #aria-activedescendant} for more information.
- * @private @const {!Array<goog.a11y.aria.Role>}
- */
-goog.a11y.aria.CONTAINER_ROLES_ = [
-  goog.a11y.aria.Role.COMBOBOX, goog.a11y.aria.Role.GRID,
-  goog.a11y.aria.Role.GROUP, goog.a11y.aria.Role.LISTBOX,
-  goog.a11y.aria.Role.MENU, goog.a11y.aria.Role.MENUBAR,
-  goog.a11y.aria.Role.RADIOGROUP, goog.a11y.aria.Role.ROW,
-  goog.a11y.aria.Role.ROWGROUP, goog.a11y.aria.Role.TAB_LIST,
-  goog.a11y.aria.Role.TEXTBOX, goog.a11y.aria.Role.TOOLBAR,
-  goog.a11y.aria.Role.TREE, goog.a11y.aria.Role.TREEGRID
-];
-
-
-/**
- * Sets the role of an element. If the roleName is
- * empty string or null, the role for the element is removed.
- * We encourage clients to call the goog.a11y.aria.removeRole
- * method instead of setting null and empty string values.
- * Special handling for this case is added to ensure
- * backword compatibility with existing code.
- *
- * @param {!Element} element DOM node to set role of.
- * @param {!goog.a11y.aria.Role|string} roleName role name(s).
- */
-goog.a11y.aria.setRole = function(element, roleName) {
-  if (!roleName) {
-    // Setting the ARIA role to empty string is not allowed
-    // by the ARIA standard.
-    goog.a11y.aria.removeRole(element);
-  } else {
-    if (goog.asserts.ENABLE_ASSERTS) {
-      goog.asserts.assert(
-          goog.object.containsValue(goog.a11y.aria.Role, roleName),
-          'No such ARIA role ' + roleName);
-    }
-    element.setAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_, roleName);
-  }
-};
-
-
-/**
- * Gets role of an element.
- * @param {!Element} element DOM element to get role of.
- * @return {?goog.a11y.aria.Role} ARIA Role name.
- */
-goog.a11y.aria.getRole = function(element) {
-  var role = element.getAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_);
-  return /** @type {goog.a11y.aria.Role} */ (role) || null;
-};
-
-
-/**
- * Removes role of an element.
- * @param {!Element} element DOM element to remove the role from.
- */
-goog.a11y.aria.removeRole = function(element) {
-  element.removeAttribute(goog.a11y.aria.ROLE_ATTRIBUTE_);
-};
-
-
-/**
- * Sets the state or property of an element.
- * @param {!Element} element DOM node where we set state.
- * @param {!(goog.a11y.aria.State|string)} stateName State attribute being set.
- *     Automatically adds prefix 'aria-' to the state name if the attribute is
- *     not an extra attribute.
- * @param {string|boolean|number|!Array<string>} value Value
- * for the state attribute.
- */
-goog.a11y.aria.setState = function(element, stateName, value) {
-  if (goog.isArray(value)) {
-    value = value.join(' ');
-  }
-  var attrStateName = goog.a11y.aria.getAriaAttributeName_(stateName);
-  if (value === '' || value == undefined) {
-    var defaultValueMap = goog.a11y.aria.datatables.getDefaultValuesMap();
-    // Work around for browsers that don't properly support ARIA.
-    // According to the ARIA W3C standard, user agents should allow
-    // setting empty value which results in setting the default value
-    // for the ARIA state if such exists. The exact text from the ARIA W3C
-    // standard (http://www.w3.org/TR/wai-aria/states_and_properties):
-    // "When a value is indicated as the default, the user agent
-    // MUST follow the behavior prescribed by this value when the state or
-    // property is empty or undefined."
-    // The defaultValueMap contains the default values for the ARIA states
-    // and has as a key the goog.a11y.aria.State constant for the state.
-    if (stateName in defaultValueMap) {
-      element.setAttribute(attrStateName, defaultValueMap[stateName]);
-    } else {
-      element.removeAttribute(attrStateName);
-    }
-  } else {
-    element.setAttribute(attrStateName, value);
-  }
-};
-
-
-/**
- * Toggles the ARIA attribute of an element.
- * Meant for attributes with a true/false value, but works with any attribute.
- * If the attribute does not have a true/false value, the following rules apply:
- * A not empty attribute will be removed.
- * An empty attribute will be set to true.
- * @param {!Element} el DOM node for which to set attribute.
- * @param {!(goog.a11y.aria.State|string)} attr ARIA attribute being set.
- *     Automatically adds prefix 'aria-' to the attribute name if the attribute
- *     is not an extra attribute.
- */
-goog.a11y.aria.toggleState = function(el, attr) {
-  var val = goog.a11y.aria.getState(el, attr);
-  if (!goog.string.isEmptyOrWhitespace(goog.string.makeSafe(val)) &&
-      !(val == 'true' || val == 'false')) {
-    goog.a11y.aria.removeState(el, /** @type {!goog.a11y.aria.State} */ (attr));
-    return;
-  }
-  goog.a11y.aria.setState(el, attr, val == 'true' ? 'false' : 'true');
-};
-
-
-/**
- * Remove the state or property for the element.
- * @param {!Element} element DOM node where we set state.
- * @param {!goog.a11y.aria.State} stateName State name.
- */
-goog.a11y.aria.removeState = function(element, stateName) {
-  element.removeAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
-};
-
-
-/**
- * Gets value of specified state or property.
- * @param {!Element} element DOM node to get state from.
- * @param {!goog.a11y.aria.State|string} stateName State name.
- * @return {string} Value of the state attribute.
- */
-goog.a11y.aria.getState = function(element, stateName) {
-  // TODO(user): return properly typed value result --
-  // boolean, number, string, null. We should be able to chain
-  // getState(...) and setState(...) methods.
-
-  var attr =
-      /** @type {string|number|boolean} */ (
-          element.getAttribute(
-              goog.a11y.aria.getAriaAttributeName_(stateName)));
-  var isNullOrUndefined = attr == null || attr == undefined;
-  return isNullOrUndefined ? '' : String(attr);
-};
-
-
-/**
- * Returns the activedescendant element for the input element by
- * using the activedescendant ARIA property of the given element.
- * @param {!Element} element DOM node to get activedescendant
- *     element for.
- * @return {?Element} DOM node of the activedescendant, if found.
- */
-goog.a11y.aria.getActiveDescendant = function(element) {
-  var id =
-      goog.a11y.aria.getState(element, goog.a11y.aria.State.ACTIVEDESCENDANT);
-  return goog.dom.getOwnerDocument(element).getElementById(id);
-};
-
-
-/**
- * Sets the activedescendant ARIA property value for an element.
- * If the activeElement is not null, it should have an id set.
- * @param {!Element} element DOM node to set activedescendant ARIA property to.
- * @param {?Element} activeElement DOM node being set as activedescendant.
- */
-goog.a11y.aria.setActiveDescendant = function(element, activeElement) {
-  var id = '';
-  if (activeElement) {
-    id = activeElement.id;
-    goog.asserts.assert(id, 'The active element should have an id.');
-  }
-
-  goog.a11y.aria.setState(element, goog.a11y.aria.State.ACTIVEDESCENDANT, id);
-};
-
-
-/**
- * Gets the label of the given element.
- * @param {!Element} element DOM node to get label from.
- * @return {string} label The label.
- */
-goog.a11y.aria.getLabel = function(element) {
-  return goog.a11y.aria.getState(element, goog.a11y.aria.State.LABEL);
-};
-
-
-/**
- * Sets the label of the given element.
- * @param {!Element} element DOM node to set label to.
- * @param {string} label The label to set.
- */
-goog.a11y.aria.setLabel = function(element, label) {
-  goog.a11y.aria.setState(element, goog.a11y.aria.State.LABEL, label);
-};
-
-
-/**
- * Asserts that the element has a role set if it's not an HTML element whose
- * semantics is well supported by most screen readers.
- * Only to be used internally by the ARIA library in goog.a11y.aria.*.
- * @param {!Element} element The element to assert an ARIA role set.
- * @param {!IArrayLike<string>} allowedRoles The child roles of
- * the roles.
- */
-goog.a11y.aria.assertRoleIsSetInternalUtil = function(element, allowedRoles) {
-  if (goog.a11y.aria.TAGS_WITH_ASSUMED_ROLES_[element.tagName]) {
-    return;
-  }
-  var elementRole = /** @type {string}*/ (goog.a11y.aria.getRole(element));
-  goog.asserts.assert(
-      elementRole != null, 'The element ARIA role cannot be null.');
-
-  goog.asserts.assert(
-      goog.array.contains(allowedRoles, elementRole),
-      'Non existing or incorrect role set for element.' +
-          'The role set is "' + elementRole + '". The role should be any of "' +
-          allowedRoles + '". Check the ARIA specification for more details ' +
-          'http://www.w3.org/TR/wai-aria/roles.');
-};
-
-
-/**
- * Gets the boolean value of an ARIA state/property.
- * @param {!Element} element The element to get the ARIA state for.
- * @param {!goog.a11y.aria.State|string} stateName the ARIA state name.
- * @return {?boolean} Boolean value for the ARIA state value or null if
- *     the state value is not 'true', not 'false', or not set.
- */
-goog.a11y.aria.getStateBoolean = function(element, stateName) {
-  var attr =
-      /** @type {string|boolean} */ (
-          element.getAttribute(
-              goog.a11y.aria.getAriaAttributeName_(stateName)));
-  goog.asserts.assert(
-      goog.isBoolean(attr) || attr == null || attr == 'true' ||
-      attr == 'false');
-  if (attr == null) {
-    return attr;
-  }
-  return goog.isBoolean(attr) ? attr : attr == 'true';
-};
-
-
-/**
- * Gets the number value of an ARIA state/property.
- * @param {!Element} element The element to get the ARIA state for.
- * @param {!goog.a11y.aria.State|string} stateName the ARIA state name.
- * @return {?number} Number value for the ARIA state value or null if
- *     the state value is not a number or not set.
- */
-goog.a11y.aria.getStateNumber = function(element, stateName) {
-  var attr =
-      /** @type {string|number} */ (
-          element.getAttribute(
-              goog.a11y.aria.getAriaAttributeName_(stateName)));
-  goog.asserts.assert(
-      (attr == null || !isNaN(Number(attr))) && !goog.isBoolean(attr));
-  return attr == null ? null : Number(attr);
-};
-
-
-/**
- * Gets the string value of an ARIA state/property.
- * @param {!Element} element The element to get the ARIA state for.
- * @param {!goog.a11y.aria.State|string} stateName the ARIA state name.
- * @return {?string} String value for the ARIA state value or null if
- *     the state value is empty string or not set.
- */
-goog.a11y.aria.getStateString = function(element, stateName) {
-  var attr =
-      element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
-  goog.asserts.assert(
-      (attr == null || goog.isString(attr)) &&
-      (attr == '' || isNaN(Number(attr))) && attr != 'true' && attr != 'false');
-  return (attr == null || attr == '') ? null : attr;
-};
-
-
-/**
- * Gets array of strings value of the specified state or
- * property for the element.
- * Only to be used internally by the ARIA library in goog.a11y.aria.*.
- * @param {!Element} element DOM node to get state from.
- * @param {!goog.a11y.aria.State} stateName State name.
- * @return {!IArrayLike<string>} string Array
- *     value of the state attribute.
- */
-goog.a11y.aria.getStringArrayStateInternalUtil = function(element, stateName) {
-  var attrValue =
-      element.getAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
-  return goog.a11y.aria.splitStringOnWhitespace_(attrValue);
-};
-
-
-/**
- * Returns true if element has an ARIA state/property, false otherwise.
- * @param {!Element} element The element to get the ARIA state for.
- * @param {!goog.a11y.aria.State|string} stateName the ARIA state name.
- * @return {boolean}
- */
-goog.a11y.aria.hasState = function(element, stateName) {
-  return element.hasAttribute(goog.a11y.aria.getAriaAttributeName_(stateName));
-};
-
-
-/**
- * Returns whether the element has a container ARIA role.
- * Container roles are ARIA roles that use the aria-activedescendant property
- * to manage their active descendants or children. See
- * {@link http://www.w3.org/TR/wai-aria/states_and_properties
- * #aria-activedescendant} for more information.
- * @param {!Element} element
- * @return {boolean}
- */
-goog.a11y.aria.isContainerRole = function(element) {
-  var role = goog.a11y.aria.getRole(element);
-  return goog.array.contains(goog.a11y.aria.CONTAINER_ROLES_, role);
-};
-
-
-/**
- * Splits the input stringValue on whitespace.
- * @param {string} stringValue The value of the string to split.
- * @return {!IArrayLike<string>} string Array
- *     value as result of the split.
- * @private
- */
-goog.a11y.aria.splitStringOnWhitespace_ = function(stringValue) {
-  return stringValue ? stringValue.split(/\s+/) : [];
-};
-
-
-/**
- * Adds the 'aria-' prefix to ariaName.
- * @param {string} ariaName ARIA state/property name.
- * @private
- * @return {string} The ARIA attribute name with added 'aria-' prefix.
- * @throws {Error} If no such attribute exists.
- */
-goog.a11y.aria.getAriaAttributeName_ = function(ariaName) {
-  if (goog.asserts.ENABLE_ASSERTS) {
-    goog.asserts.assert(ariaName, 'ARIA attribute cannot be empty.');
-    goog.asserts.assert(
-        goog.object.containsValue(goog.a11y.aria.State, ariaName),
-        'No such ARIA attribute ' + ariaName);
-  }
-  return goog.a11y.aria.ARIA_PREFIX_ + ariaName;
-};

+ 0 - 28
src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/aria_test.html

@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!--
-Copyright 2008 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
- <!--
-Author:  attila@google.com (Attila Bodis)
--->
- <head>
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta charset="UTF-8" />
-  <title>
-   Closure Unit Tests - goog.a11y.aria
-  </title>
-  <script src="../../base.js">
-  </script>
-  <script>
-    goog.require('goog.a11y.ariaTest');
-  </script>
- </head>
- <body>
-  <div id="sandbox">
-  </div>
- </body>
-</html>

+ 0 - 301
src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/aria_test.js

@@ -1,301 +0,0 @@
-// Copyright 2008 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.goog.provide('goog.a11y.ariaTest');
-
-goog.provide('goog.a11y.ariaTest');
-goog.setTestOnly('goog.a11y.ariaTest');
-
-goog.require('goog.a11y.aria');
-goog.require('goog.a11y.aria.Role');
-goog.require('goog.a11y.aria.State');
-goog.require('goog.dom');
-goog.require('goog.dom.TagName');
-goog.require('goog.testing.jsunit');
-
-var aria = goog.a11y.aria;
-var Role = goog.a11y.aria.Role;
-var State = goog.a11y.aria.State;
-var sandbox;
-var someDiv;
-var someSpan;
-var htmlButton;
-
-function setUp() {
-  sandbox = goog.dom.getElement('sandbox');
-  someDiv = goog.dom.createDom(goog.dom.TagName.DIV, {id: 'someDiv'}, 'DIV');
-  someSpan =
-      goog.dom.createDom(goog.dom.TagName.SPAN, {id: 'someSpan'}, 'SPAN');
-  htmlButton =
-      goog.dom.createDom(goog.dom.TagName.BUTTON, {id: 'someButton'}, 'BUTTON');
-  goog.dom.appendChild(sandbox, someDiv);
-  goog.dom.appendChild(someDiv, someSpan);
-}
-
-function tearDown() {
-  goog.dom.removeChildren(sandbox);
-  someDiv = null;
-  someSpan = null;
-  htmlButton = null;
-}
-
-function testGetSetRole() {
-  assertNull('someDiv\'s role should be null', aria.getRole(someDiv));
-  assertNull('someSpan\'s role should be null', aria.getRole(someSpan));
-
-  aria.setRole(someDiv, Role.MENU);
-  aria.setRole(someSpan, Role.MENU_ITEM);
-
-  assertEquals(
-      'someDiv\'s role should be MENU', Role.MENU, aria.getRole(someDiv));
-  assertEquals(
-      'someSpan\'s role should be MENU_ITEM', Role.MENU_ITEM,
-      aria.getRole(someSpan));
-
-  var div = goog.dom.createElement(goog.dom.TagName.DIV);
-  goog.dom.appendChild(sandbox, div);
-  goog.dom.appendChild(
-      div,
-      goog.dom.createDom(
-          goog.dom.TagName.SPAN, {id: 'anotherSpan', role: Role.CHECKBOX}));
-  assertEquals(
-      'anotherSpan\'s role should be CHECKBOX', Role.CHECKBOX,
-      aria.getRole(goog.dom.getElement('anotherSpan')));
-}
-
-function testGetSetToggleState() {
-  assertThrows('Should throw because no state is specified.', function() {
-    aria.getState(someDiv);
-  });
-  assertThrows('Should throw because no state is specified.', function() {
-    aria.getState(someDiv);
-  });
-  aria.setState(someDiv, State.LABELLEDBY, 'someSpan');
-
-  assertEquals(
-      'someDiv\'s labelledby state should be "someSpan"', 'someSpan',
-      aria.getState(someDiv, State.LABELLEDBY));
-
-  // Test setting for aria-activedescendant with empty value.
-  assertFalse(
-      someDiv.hasAttribute ? someDiv.hasAttribute('aria-activedescendant') :
-                             !!someDiv.getAttribute('aria-activedescendant'));
-  aria.setState(someDiv, State.ACTIVEDESCENDANT, 'someSpan');
-  assertEquals('someSpan', aria.getState(someDiv, State.ACTIVEDESCENDANT));
-  aria.setState(someDiv, State.ACTIVEDESCENDANT, '');
-  assertFalse(
-      someDiv.hasAttribute ? someDiv.hasAttribute('aria-activedescendant') :
-                             !!someDiv.getAttribute('aria-activedescendant'));
-
-  // Test setting state that has a default value to empty value.
-  assertFalse(
-      someDiv.hasAttribute ? someDiv.hasAttribute('aria-relevant') :
-                             !!someDiv.getAttribute('aria-relevant'));
-  aria.setState(someDiv, State.RELEVANT, aria.RelevantValues.TEXT);
-  assertEquals(
-      aria.RelevantValues.TEXT, aria.getState(someDiv, State.RELEVANT));
-  aria.setState(someDiv, State.RELEVANT, '');
-  assertEquals(
-      aria.RelevantValues.ADDITIONS + ' ' + aria.RelevantValues.TEXT,
-      aria.getState(someDiv, State.RELEVANT));
-
-  // Test toggling an attribute that has a true/false value.
-  aria.setState(someDiv, State.EXPANDED, false);
-  assertEquals('false', aria.getState(someDiv, State.EXPANDED));
-  aria.toggleState(someDiv, State.EXPANDED);
-  assertEquals('true', aria.getState(someDiv, State.EXPANDED));
-  aria.setState(someDiv, State.EXPANDED, true);
-  assertEquals('true', aria.getState(someDiv, State.EXPANDED));
-  aria.toggleState(someDiv, State.EXPANDED);
-  assertEquals('false', aria.getState(someDiv, State.EXPANDED));
-
-  // Test toggling an attribute that does not have a true/false value.
-  aria.setState(someDiv, State.RELEVANT, aria.RelevantValues.TEXT);
-  assertEquals(
-      aria.RelevantValues.TEXT, aria.getState(someDiv, State.RELEVANT));
-  aria.toggleState(someDiv, State.RELEVANT);
-  assertEquals('', aria.getState(someDiv, State.RELEVANT));
-  aria.removeState(someDiv, State.RELEVANT);
-  assertEquals('', aria.getState(someDiv, State.RELEVANT));
-  // This is not a valid value, but this is what happens if toggle is misused.
-  aria.toggleState(someDiv, State.RELEVANT);
-  assertEquals('true', aria.getState(someDiv, State.RELEVANT));
-}
-
-function testGetStateString() {
-  aria.setState(someDiv, State.LABEL, 'test_label');
-  aria.setState(
-      someSpan, State.LABEL, aria.getStateString(someDiv, State.LABEL));
-  assertEquals(
-      aria.getState(someDiv, State.LABEL),
-      aria.getState(someSpan, State.LABEL));
-  assertEquals(
-      'The someDiv\'s enum value should be "test_label".', 'test_label',
-      aria.getState(someDiv, State.LABEL));
-  assertEquals(
-      'The someSpan\'s enum value should be "copy move".', 'test_label',
-      aria.getStateString(someSpan, State.LABEL));
-  someDiv.setAttribute('aria-label', '');
-  assertEquals(null, aria.getStateString(someDiv, State.LABEL));
-  aria.setState(someDiv, State.MULTILINE, true);
-  var thrown = false;
-  try {
-    aria.getStateString(someDiv, State.MULTILINE);
-  } catch (e) {
-    thrown = true;
-  }
-  assertTrue('invalid use of getStateString on boolean.', thrown);
-  aria.setState(someDiv, State.LIVE, aria.LivePriority.ASSERTIVE);
-  thrown = false;
-  aria.setState(someDiv, State.LEVEL, 1);
-  try {
-    aria.getStateString(someDiv, State.LEVEL);
-  } catch (e) {
-    thrown = true;
-  }
-  assertTrue('invalid use of getStateString on numbers.', thrown);
-}
-
-
-function testGetStateStringArray() {
-  aria.setState(someDiv, State.LABELLEDBY, ['1', '2']);
-  aria.setState(
-      someSpan, State.LABELLEDBY,
-      aria.getStringArrayStateInternalUtil(someDiv, State.LABELLEDBY));
-  assertEquals(
-      aria.getState(someDiv, State.LABELLEDBY),
-      aria.getState(someSpan, State.LABELLEDBY));
-
-  assertEquals(
-      'The someDiv\'s enum value should be "1 2".', '1 2',
-      aria.getState(someDiv, State.LABELLEDBY));
-  assertEquals(
-      'The someSpan\'s enum value should be "1 2".', '1 2',
-      aria.getState(someSpan, State.LABELLEDBY));
-
-  assertSameElements(
-      'The someDiv\'s enum value should be "1 2".', ['1', '2'],
-      aria.getStringArrayStateInternalUtil(someDiv, State.LABELLEDBY));
-  assertSameElements(
-      'The someSpan\'s enum value should be "1 2".', ['1', '2'],
-      aria.getStringArrayStateInternalUtil(someSpan, State.LABELLEDBY));
-}
-
-
-function testGetStateNumber() {
-  aria.setState(someDiv, State.LEVEL, 1);
-  aria.setState(
-      someSpan, State.LEVEL, aria.getStateNumber(someDiv, State.LEVEL));
-  assertEquals(
-      aria.getState(someDiv, State.LEVEL),
-      aria.getState(someSpan, State.LEVEL));
-  assertEquals(
-      'The someDiv\'s enum value should be "1".', '1',
-      aria.getState(someDiv, State.LEVEL));
-  assertEquals(
-      'The someSpan\'s enum value should be "1".', '1',
-      aria.getState(someSpan, State.LEVEL));
-  assertEquals(
-      'The someDiv\'s enum value should be "1".', 1,
-      aria.getStateNumber(someDiv, State.LEVEL));
-  assertEquals(
-      'The someSpan\'s enum value should be "1".', 1,
-      aria.getStateNumber(someSpan, State.LEVEL));
-  aria.setState(someDiv, State.MULTILINE, true);
-  var thrown = false;
-  try {
-    aria.getStateNumber(someDiv, State.MULTILINE);
-  } catch (e) {
-    thrown = true;
-  }
-  assertTrue('invalid use of getStateNumber on boolean.', thrown);
-  aria.setState(someDiv, State.LIVE, aria.LivePriority.ASSERTIVE);
-  thrown = false;
-  try {
-    aria.getStateBoolean(someDiv, State.LIVE);
-  } catch (e) {
-    thrown = true;
-  }
-  assertTrue('invalid use of getStateNumber on strings.', thrown);
-}
-
-function testGetStateBoolean() {
-  assertNull(aria.getStateBoolean(someDiv, State.MULTILINE));
-
-  aria.setState(someDiv, State.MULTILINE, false);
-  assertFalse(aria.getStateBoolean(someDiv, State.MULTILINE));
-
-  aria.setState(someDiv, State.MULTILINE, true);
-  aria.setState(
-      someSpan, State.MULTILINE,
-      aria.getStateBoolean(someDiv, State.MULTILINE));
-  assertEquals(
-      aria.getState(someDiv, State.MULTILINE),
-      aria.getState(someSpan, State.MULTILINE));
-  assertEquals(
-      'The someDiv\'s enum value should be "true".', 'true',
-      aria.getState(someDiv, State.MULTILINE));
-  assertEquals(
-      'The someSpan\'s enum value should be "true".', 'true',
-      aria.getState(someSpan, State.MULTILINE));
-  assertEquals(
-      'The someDiv\'s enum value should be "true".', true,
-      aria.getStateBoolean(someDiv, State.MULTILINE));
-  assertEquals(
-      'The someSpan\'s enum value should be "true".', true,
-      aria.getStateBoolean(someSpan, State.MULTILINE));
-  aria.setState(someDiv, State.LEVEL, 1);
-  var thrown = false;
-  try {
-    aria.getStateBoolean(someDiv, State.LEVEL);
-  } catch (e) {
-    thrown = true;
-  }
-  assertTrue('invalid use of getStateBoolean on numbers.', thrown);
-  aria.setState(someDiv, State.LIVE, aria.LivePriority.ASSERTIVE);
-  thrown = false;
-  try {
-    aria.getStateBoolean(someDiv, State.LIVE);
-  } catch (e) {
-    thrown = true;
-  }
-  assertTrue('invalid use of getStateBoolean on strings.', thrown);
-}
-
-function testGetSetActiveDescendant() {
-  aria.setActiveDescendant(someDiv, null);
-  assertNull(
-      'someDiv\'s activedescendant should be null',
-      aria.getActiveDescendant(someDiv));
-
-  aria.setActiveDescendant(someDiv, someSpan);
-
-  assertEquals(
-      'someDiv\'s active descendant should be "someSpan"', someSpan,
-      aria.getActiveDescendant(someDiv));
-}
-
-function testGetSetLabel() {
-  assertEquals('someDiv\'s label should be ""', '', aria.getLabel(someDiv));
-
-  aria.setLabel(someDiv, 'somelabel');
-  assertEquals(
-      'someDiv\'s label should be "somelabel"', 'somelabel',
-      aria.getLabel(someDiv));
-}
-
-function testHasState() {
-  aria.setState(someDiv, State.EXPANDED, false);
-  assertTrue(aria.hasState(someDiv, State.EXPANDED));
-  aria.removeState(someDiv, State.EXPANDED);
-  assertFalse(aria.hasState(someDiv, State.EXPANDED));
-}

+ 0 - 389
src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/attributes.js

@@ -1,389 +0,0 @@
-// Copyright 2013 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-/**
- * @fileoverview The file contains generated enumerations for ARIA states
- * and properties as defined by W3C ARIA standard:
- * http://www.w3.org/TR/wai-aria/.
- *
- * This is auto-generated code. Do not manually edit! For more details
- * about how to edit it via the generator check go/closure-ariagen.
- */
-
-goog.provide('goog.a11y.aria.AutoCompleteValues');
-goog.provide('goog.a11y.aria.CheckedValues');
-goog.provide('goog.a11y.aria.DropEffectValues');
-goog.provide('goog.a11y.aria.ExpandedValues');
-goog.provide('goog.a11y.aria.GrabbedValues');
-goog.provide('goog.a11y.aria.InvalidValues');
-goog.provide('goog.a11y.aria.LivePriority');
-goog.provide('goog.a11y.aria.OrientationValues');
-goog.provide('goog.a11y.aria.PressedValues');
-goog.provide('goog.a11y.aria.RelevantValues');
-goog.provide('goog.a11y.aria.SelectedValues');
-goog.provide('goog.a11y.aria.SortValues');
-goog.provide('goog.a11y.aria.State');
-
-
-/**
- * ARIA states and properties.
- * @enum {string}
- */
-goog.a11y.aria.State = {
-  // ARIA property for setting the currently active descendant of an element,
-  // for example the selected item in a list box. Value: ID of an element.
-  ACTIVEDESCENDANT: 'activedescendant',
-
-  // ARIA property that, if true, indicates that all of a changed region should
-  // be presented, instead of only parts. Value: one of {true, false}.
-  ATOMIC: 'atomic',
-
-  // ARIA property to specify that input completion is provided. Value:
-  // one of {'inline', 'list', 'both', 'none'}.
-  AUTOCOMPLETE: 'autocomplete',
-
-  // ARIA state to indicate that an element and its subtree are being updated.
-  // Value: one of {true, false}.
-  BUSY: 'busy',
-
-  // ARIA state for a checked item. Value: one of {'true', 'false', 'mixed',
-  // undefined}.
-  CHECKED: 'checked',
-
-  // ARIA property that identifies the element or elements whose contents or
-  // presence are controlled by this element.
-  // Value: space-separated IDs of other elements.
-  CONTROLS: 'controls',
-
-  // ARIA property that identifies the element or elements that describe
-  // this element. Value: space-separated IDs of other elements.
-  DESCRIBEDBY: 'describedby',
-
-  // ARIA state for a disabled item. Value: one of {true, false}.
-  DISABLED: 'disabled',
-
-  // ARIA property that indicates what functions can be performed when a
-  // dragged object is released on the drop target.  Value: one of
-  // {'copy', 'move', 'link', 'execute', 'popup', 'none'}.
-  DROPEFFECT: 'dropeffect',
-
-  // ARIA state for setting whether the element like a tree node is expanded.
-  // Value: one of {true, false, undefined}.
-  EXPANDED: 'expanded',
-
-  // ARIA property that identifies the next element (or elements) in the
-  // recommended reading order of content. Value: space-separated ids of
-  // elements to flow to.
-  FLOWTO: 'flowto',
-
-  // ARIA state that indicates an element's "grabbed" state in drag-and-drop.
-  // Value: one of {true, false, undefined}.
-  GRABBED: 'grabbed',
-
-  // ARIA property indicating whether the element has a popup.
-  // Value: one of {true, false}.
-  HASPOPUP: 'haspopup',
-
-  // ARIA state indicating that the element is not visible or perceivable
-  // to any user. Value: one of {true, false}.
-  HIDDEN: 'hidden',
-
-  // ARIA state indicating that the entered value does not conform. Value:
-  // one of {false, true, 'grammar', 'spelling'}
-  INVALID: 'invalid',
-
-  // ARIA property that provides a label to override any other text, value, or
-  // contents used to describe this element. Value: string.
-  LABEL: 'label',
-
-  // ARIA property for setting the element which labels another element.
-  // Value: space-separated IDs of elements.
-  LABELLEDBY: 'labelledby',
-
-  // ARIA property for setting the level of an element in the hierarchy.
-  // Value: integer.
-  LEVEL: 'level',
-
-  // ARIA property indicating that an element will be updated, and
-  // describes the types of updates the user agents, assistive technologies,
-  // and user can expect from the live region. Value: one of {'off', 'polite',
-  // 'assertive'}.
-  LIVE: 'live',
-
-  // ARIA property indicating whether a text box can accept multiline input.
-  // Value: one of {true, false}.
-  MULTILINE: 'multiline',
-
-  // ARIA property indicating if the user may select more than one item.
-  // Value: one of {true, false}.
-  MULTISELECTABLE: 'multiselectable',
-
-  // ARIA property indicating if the element is horizontal or vertical.
-  // Value: one of {'vertical', 'horizontal'}.
-  ORIENTATION: 'orientation',
-
-  // ARIA property creating a visual, functional, or contextual parent/child
-  // relationship when the DOM hierarchy can't be used to represent it.
-  // Value: Space-separated IDs of elements.
-  OWNS: 'owns',
-
-  // ARIA property that defines an element's number of position in a list.
-  // Value: integer.
-  POSINSET: 'posinset',
-
-  // ARIA state for a pressed item.
-  // Value: one of {true, false, undefined, 'mixed'}.
-  PRESSED: 'pressed',
-
-  // ARIA property indicating that an element is not editable.
-  // Value: one of {true, false}.
-  READONLY: 'readonly',
-
-  // ARIA property indicating that change notifications within this subtree
-  // of a live region should be announced. Value: one of {'additions',
-  // 'removals', 'text', 'all', 'additions text'}.
-  RELEVANT: 'relevant',
-
-  // ARIA property indicating that user input is required on this element
-  // before a form may be submitted. Value: one of {true, false}.
-  REQUIRED: 'required',
-
-  // ARIA state for setting the currently selected item in the list.
-  // Value: one of {true, false, undefined}.
-  SELECTED: 'selected',
-
-  // ARIA property defining the number of items in a list. Value: integer.
-  SETSIZE: 'setsize',
-
-  // ARIA property indicating if items are sorted. Value: one of {'ascending',
-  // 'descending', 'none', 'other'}.
-  SORT: 'sort',
-
-  // ARIA property for slider maximum value. Value: number.
-  VALUEMAX: 'valuemax',
-
-  // ARIA property for slider minimum value. Value: number.
-  VALUEMIN: 'valuemin',
-
-  // ARIA property for slider active value. Value: number.
-  VALUENOW: 'valuenow',
-
-  // ARIA property for slider active value represented as text.
-  // Value: string.
-  VALUETEXT: 'valuetext'
-};
-
-
-/**
- * ARIA state values for AutoCompleteValues.
- * @enum {string}
- */
-goog.a11y.aria.AutoCompleteValues = {
-  // The system provides text after the caret as a suggestion
-  // for how to complete the field.
-  INLINE: 'inline',
-  // A list of choices appears from which the user can choose,
-  // but the edit box retains focus.
-  LIST: 'list',
-  // A list of choices appears and the currently selected suggestion
-  // also appears inline.
-  BOTH: 'both',
-  // No input completion suggestions are provided.
-  NONE: 'none'
-};
-
-
-/**
- * ARIA state values for DropEffectValues.
- * @enum {string}
- */
-goog.a11y.aria.DropEffectValues = {
-  // A duplicate of the source object will be dropped into the target.
-  COPY: 'copy',
-  // The source object will be removed from its current location
-  // and dropped into the target.
-  MOVE: 'move',
-  // A reference or shortcut to the dragged object
-  // will be created in the target object.
-  LINK: 'link',
-  // A function supported by the drop target is
-  // executed, using the drag source as an input.
-  EXECUTE: 'execute',
-  // There is a popup menu or dialog that allows the user to choose
-  // one of the drag operations (copy, move, link, execute) and any other
-  // drag functionality, such as cancel.
-  POPUP: 'popup',
-  // No operation can be performed; effectively
-  // cancels the drag operation if an attempt is made to drop on this object.
-  NONE: 'none'
-};
-
-
-/**
- * ARIA state values for LivePriority.
- * @enum {string}
- */
-goog.a11y.aria.LivePriority = {
-  // Updates to the region will not be presented to the user
-  // unless the assitive technology is currently focused on that region.
-  OFF: 'off',
-  // (Background change) Assistive technologies SHOULD announce
-  // updates at the next graceful opportunity, such as at the end of
-  // speaking the current sentence or when the user pauses typing.
-  POLITE: 'polite',
-  // This information has the highest priority and assistive
-  // technologies SHOULD notify the user immediately.
-  // Because an interruption may disorient users or cause them to not complete
-  // their current task, authors SHOULD NOT use the assertive value unless the
-  // interruption is imperative.
-  ASSERTIVE: 'assertive'
-};
-
-
-/**
- * ARIA state values for OrientationValues.
- * @enum {string}
- */
-goog.a11y.aria.OrientationValues = {
-  // The element is oriented vertically.
-  VERTICAL: 'vertical',
-  // The element is oriented horizontally.
-  HORIZONTAL: 'horizontal'
-};
-
-
-/**
- * ARIA state values for RelevantValues.
- * @enum {string}
- */
-goog.a11y.aria.RelevantValues = {
-  // Element nodes are added to the DOM within the live region.
-  ADDITIONS: 'additions',
-  // Text or element nodes within the live region are removed from the DOM.
-  REMOVALS: 'removals',
-  // Text is added to any DOM descendant nodes of the live region.
-  TEXT: 'text',
-  // Equivalent to the combination of all values, "additions removals text".
-  ALL: 'all'
-};
-
-
-/**
- * ARIA state values for SortValues.
- * @enum {string}
- */
-goog.a11y.aria.SortValues = {
-  // Items are sorted in ascending order by this column.
-  ASCENDING: 'ascending',
-  // Items are sorted in descending order by this column.
-  DESCENDING: 'descending',
-  // There is no defined sort applied to the column.
-  NONE: 'none',
-  // A sort algorithm other than ascending or descending has been applied.
-  OTHER: 'other'
-};
-
-
-/**
- * ARIA state values for CheckedValues.
- * @enum {string}
- */
-goog.a11y.aria.CheckedValues = {
-  // The selectable element is checked.
-  TRUE: 'true',
-  // The selectable element is not checked.
-  FALSE: 'false',
-  // Indicates a mixed mode value for a tri-state
-  // checkbox or menuitemcheckbox.
-  MIXED: 'mixed',
-  // The element does not support being checked.
-  UNDEFINED: 'undefined'
-};
-
-
-/**
- * ARIA state values for ExpandedValues.
- * @enum {string}
- */
-goog.a11y.aria.ExpandedValues = {
-  // The element, or another grouping element it controls, is expanded.
-  TRUE: 'true',
-  // The element, or another grouping element it controls, is collapsed.
-  FALSE: 'false',
-  // The element, or another grouping element
-  // it controls, is neither expandable nor collapsible; all its
-  // child elements are shown or there are no child elements.
-  UNDEFINED: 'undefined'
-};
-
-
-/**
- * ARIA state values for GrabbedValues.
- * @enum {string}
- */
-goog.a11y.aria.GrabbedValues = {
-  // Indicates that the element has been "grabbed" for dragging.
-  TRUE: 'true',
-  // Indicates that the element supports being dragged.
-  FALSE: 'false',
-  // Indicates that the element does not support being dragged.
-  UNDEFINED: 'undefined'
-};
-
-
-/**
- * ARIA state values for InvalidValues.
- * @enum {string}
- */
-goog.a11y.aria.InvalidValues = {
-  // There are no detected errors in the value.
-  FALSE: 'false',
-  // The value entered by the user has failed validation.
-  TRUE: 'true',
-  // A grammatical error was detected.
-  GRAMMAR: 'grammar',
-  // A spelling error was detected.
-  SPELLING: 'spelling'
-};
-
-
-/**
- * ARIA state values for PressedValues.
- * @enum {string}
- */
-goog.a11y.aria.PressedValues = {
-  // The element is pressed.
-  TRUE: 'true',
-  // The element supports being pressed but is not currently pressed.
-  FALSE: 'false',
-  // Indicates a mixed mode value for a tri-state toggle button.
-  MIXED: 'mixed',
-  // The element does not support being pressed.
-  UNDEFINED: 'undefined'
-};
-
-
-/**
- * ARIA state values for SelectedValues.
- * @enum {string}
- */
-goog.a11y.aria.SelectedValues = {
-  // The selectable element is selected.
-  TRUE: 'true',
-  // The selectable element is not selected.
-  FALSE: 'false',
-  // The element is not selectable.
-  UNDEFINED: 'undefined'
-};

+ 0 - 63
src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/datatables.js

@@ -1,63 +0,0 @@
-// Copyright 2013 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-
-/**
- * @fileoverview The file contains data tables generated from the ARIA
- * standard schema http://www.w3.org/TR/wai-aria/.
- *
- * This is auto-generated code. Do not manually edit!
- */
-
-goog.provide('goog.a11y.aria.datatables');
-
-goog.require('goog.a11y.aria.State');
-goog.require('goog.object');
-
-
-/**
- * A map that contains mapping between an ARIA state and the default value
- * for it. Note that not all ARIA states have default values.
- *
- * @type {Object<!(goog.a11y.aria.State|string), (string|boolean|number)>}
- */
-goog.a11y.aria.DefaultStateValueMap_;
-
-
-/**
- * A method that creates a map that contains mapping between an ARIA state and
- * the default value for it. Note that not all ARIA states have default values.
- *
- * @return {!Object<!(goog.a11y.aria.State|string), (string|boolean|number)>}
- *      The names for each of the notification methods.
- */
-goog.a11y.aria.datatables.getDefaultValuesMap = function() {
-  if (!goog.a11y.aria.DefaultStateValueMap_) {
-    goog.a11y.aria.DefaultStateValueMap_ = goog.object.create(
-        goog.a11y.aria.State.ATOMIC, false, goog.a11y.aria.State.AUTOCOMPLETE,
-        'none', goog.a11y.aria.State.DROPEFFECT, 'none',
-        goog.a11y.aria.State.HASPOPUP, false, goog.a11y.aria.State.LIVE, 'off',
-        goog.a11y.aria.State.MULTILINE, false,
-        goog.a11y.aria.State.MULTISELECTABLE, false,
-        goog.a11y.aria.State.ORIENTATION, 'vertical',
-        goog.a11y.aria.State.READONLY, false, goog.a11y.aria.State.RELEVANT,
-        'additions text', goog.a11y.aria.State.REQUIRED, false,
-        goog.a11y.aria.State.SORT, 'none', goog.a11y.aria.State.BUSY, false,
-        goog.a11y.aria.State.DISABLED, false, goog.a11y.aria.State.HIDDEN,
-        false, goog.a11y.aria.State.INVALID, 'false');
-  }
-
-  return goog.a11y.aria.DefaultStateValueMap_;
-};

+ 0 - 219
src/renderer/cocoblockly-x/python/block/closure/goog/a11y/aria/roles.js

@@ -1,219 +0,0 @@
-// Copyright 2013 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-/**
- * @fileoverview The file contains generated enumerations for ARIA roles
- * as defined by W3C ARIA standard: http://www.w3.org/TR/wai-aria/.
- *
- * This is auto-generated code. Do not manually edit! For more details
- * about how to edit it via the generator check go/closure-ariagen.
- */
-
-goog.provide('goog.a11y.aria.Role');
-
-
-/**
- * ARIA role values.
- * @enum {string}
- */
-goog.a11y.aria.Role = {
-  // ARIA role for an alert element that doesn't need to be explicitly closed.
-  ALERT: 'alert',
-
-  // ARIA role for an alert dialog element that takes focus and must be closed.
-  ALERTDIALOG: 'alertdialog',
-
-  // ARIA role for an application that implements its own keyboard navigation.
-  APPLICATION: 'application',
-
-  // ARIA role for an article.
-  ARTICLE: 'article',
-
-  // ARIA role for a banner containing mostly site content, not page content.
-  BANNER: 'banner',
-
-  // ARIA role for a button element.
-  BUTTON: 'button',
-
-  // ARIA role for a checkbox button element; use with the CHECKED state.
-  CHECKBOX: 'checkbox',
-
-  // ARIA role for a column header of a table or grid.
-  COLUMNHEADER: 'columnheader',
-
-  // ARIA role for a combo box element.
-  COMBOBOX: 'combobox',
-
-  // ARIA role for a supporting section of the document.
-  COMPLEMENTARY: 'complementary',
-
-  // ARIA role for a large perceivable region that contains information
-  // about the parent document.
-  CONTENTINFO: 'contentinfo',
-
-  // ARIA role for a definition of a term or concept.
-  DEFINITION: 'definition',
-
-  // ARIA role for a dialog, some descendant must take initial focus.
-  DIALOG: 'dialog',
-
-  // ARIA role for a directory, like a table of contents.
-  DIRECTORY: 'directory',
-
-  // ARIA role for a part of a page that's a document, not a web application.
-  DOCUMENT: 'document',
-
-  // ARIA role for a landmark region logically considered one form.
-  FORM: 'form',
-
-  // ARIA role for an interactive control of tabular data.
-  GRID: 'grid',
-
-  // ARIA role for a cell in a grid.
-  GRIDCELL: 'gridcell',
-
-  // ARIA role for a group of related elements like tree item siblings.
-  GROUP: 'group',
-
-  // ARIA role for a heading element.
-  HEADING: 'heading',
-
-  // ARIA role for a container of elements that together comprise one image.
-  IMG: 'img',
-
-  // ARIA role for a link.
-  LINK: 'link',
-
-  // ARIA role for a list of non-interactive list items.
-  LIST: 'list',
-
-  // ARIA role for a listbox.
-  LISTBOX: 'listbox',
-
-  // ARIA role for a list item.
-  LISTITEM: 'listitem',
-
-  // ARIA role for a live region where new information is added.
-  LOG: 'log',
-
-  // ARIA landmark role for the main content in a document. Use only once.
-  MAIN: 'main',
-
-  // ARIA role for a live region of non-essential information that changes.
-  MARQUEE: 'marquee',
-
-  // ARIA role for a mathematical expression.
-  MATH: 'math',
-
-  // ARIA role for a popup menu.
-  MENU: 'menu',
-
-  // ARIA role for a menubar element containing menu elements.
-  MENUBAR: 'menubar',
-
-  // ARIA role for menu item elements.
-  MENU_ITEM: 'menuitem',
-
-  // ARIA role for a checkbox box element inside a menu.
-  MENU_ITEM_CHECKBOX: 'menuitemcheckbox',
-
-  // ARIA role for a radio button element inside a menu.
-  MENU_ITEM_RADIO: 'menuitemradio',
-
-  // ARIA landmark role for a collection of navigation links.
-  NAVIGATION: 'navigation',
-
-  // ARIA role for a section ancillary to the main content.
-  NOTE: 'note',
-
-  // ARIA role for option items that are  children of combobox, listbox, menu,
-  // radiogroup, or tree elements.
-  OPTION: 'option',
-
-  // ARIA role for ignorable cosmetic elements with no semantic significance.
-  PRESENTATION: 'presentation',
-
-  // ARIA role for a progress bar element.
-  PROGRESSBAR: 'progressbar',
-
-  // ARIA role for a radio button element.
-  RADIO: 'radio',
-
-  // ARIA role for a group of connected radio button elements.
-  RADIOGROUP: 'radiogroup',
-
-  // ARIA role for an important region of the page.
-  REGION: 'region',
-
-  // ARIA role for a row of cells in a grid.
-  ROW: 'row',
-
-  // ARIA role for a group of one or more rows in a grid.
-  ROWGROUP: 'rowgroup',
-
-  // ARIA role for a row header of a table or grid.
-  ROWHEADER: 'rowheader',
-
-  // ARIA role for a scrollbar element.
-  SCROLLBAR: 'scrollbar',
-
-  // ARIA landmark role for a part of the page providing search functionality.
-  SEARCH: 'search',
-
-  // ARIA role for a menu separator.
-  SEPARATOR: 'separator',
-
-  // ARIA role for a slider.
-  SLIDER: 'slider',
-
-  // ARIA role for a spin button.
-  SPINBUTTON: 'spinbutton',
-
-  // ARIA role for a live region with advisory info less severe than an alert.
-  STATUS: 'status',
-
-  // ARIA role for a tab button.
-  TAB: 'tab',
-
-  // ARIA role for a tab bar (i.e. a list of tab buttons).
-  TAB_LIST: 'tablist',
-
-  // ARIA role for a tab page (i.e. the element holding tab contents).
-  TAB_PANEL: 'tabpanel',
-
-  // ARIA role for a textbox element.
-  TEXTBOX: 'textbox',
-
-  // ARIA role for a textinfo element.
-  TEXTINFO: 'textinfo',
-
-  // ARIA role for an element displaying elapsed time or time remaining.
-  TIMER: 'timer',
-
-  // ARIA role for a toolbar element.
-  TOOLBAR: 'toolbar',
-
-  // ARIA role for a tooltip element.
-  TOOLTIP: 'tooltip',
-
-  // ARIA role for a tree.
-  TREE: 'tree',
-
-  // ARIA role for a grid whose rows can be expanded and collapsed like a tree.
-  TREEGRID: 'treegrid',
-
-  // ARIA role for a tree item that sometimes may be expanded or collapsed.
-  TREEITEM: 'treeitem'
-};

+ 0 - 1665
src/renderer/cocoblockly-x/python/block/closure/goog/array/array.js

@@ -1,1665 +0,0 @@
-// Copyright 2006 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/**
- * @fileoverview Utilities for manipulating arrays.
- *
- * @author arv@google.com (Erik Arvidsson)
- */
-
-
-goog.provide('goog.array');
-
-goog.require('goog.asserts');
-
-
-/**
- * @define {boolean} NATIVE_ARRAY_PROTOTYPES indicates whether the code should
- * rely on Array.prototype functions, if available.
- *
- * The Array.prototype functions can be defined by external libraries like
- * Prototype and setting this flag to false forces closure to use its own
- * goog.array implementation.
- *
- * If your javascript can be loaded by a third party site and you are wary about
- * relying on the prototype functions, specify
- * "--define goog.NATIVE_ARRAY_PROTOTYPES=false" to the JSCompiler.
- *
- * Setting goog.TRUSTED_SITE to false will automatically set
- * NATIVE_ARRAY_PROTOTYPES to false.
- */
-goog.define('goog.NATIVE_ARRAY_PROTOTYPES', goog.TRUSTED_SITE);
-
-
-/**
- * @define {boolean} If true, JSCompiler will use the native implementation of
- * array functions where appropriate (e.g., {@code Array#filter}) and remove the
- * unused pure JS implementation.
- */
-goog.define('goog.array.ASSUME_NATIVE_FUNCTIONS', false);
-
-
-/**
- * Returns the last element in an array without removing it.
- * Same as goog.array.last.
- * @param {IArrayLike<T>|string} array The array.
- * @return {T} Last item in array.
- * @template T
- */
-goog.array.peek = function(array) {
-  return array[array.length - 1];
-};
-
-
-/**
- * Returns the last element in an array without removing it.
- * Same as goog.array.peek.
- * @param {IArrayLike<T>|string} array The array.
- * @return {T} Last item in array.
- * @template T
- */
-goog.array.last = goog.array.peek;
-
-// NOTE(arv): Since most of the array functions are generic it allows you to
-// pass an array-like object. Strings have a length and are considered array-
-// like. However, the 'in' operator does not work on strings so we cannot just
-// use the array path even if the browser supports indexing into strings. We
-// therefore end up splitting the string.
-
-
-/**
- * Returns the index of the first element of an array with a specified value, or
- * -1 if the element is not present in the array.
- *
- * See {@link http://tinyurl.com/developer-mozilla-org-array-indexof}
- *
- * @param {IArrayLike<T>|string} arr The array to be searched.
- * @param {T} obj The object for which we are searching.
- * @param {number=} opt_fromIndex The index at which to start the search. If
- *     omitted the search starts at index 0.
- * @return {number} The index of the first matching array element.
- * @template T
- */
-goog.array.indexOf = goog.NATIVE_ARRAY_PROTOTYPES &&
-        (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.indexOf) ?
-    function(arr, obj, opt_fromIndex) {
-      goog.asserts.assert(arr.length != null);
-
-      return Array.prototype.indexOf.call(arr, obj, opt_fromIndex);
-    } :
-    function(arr, obj, opt_fromIndex) {
-      var fromIndex = opt_fromIndex == null ?
-          0 :
-          (opt_fromIndex < 0 ? Math.max(0, arr.length + opt_fromIndex) :
-                               opt_fromIndex);
-
-      if (goog.isString(arr)) {
-        // Array.prototype.indexOf uses === so only strings should be found.
-        if (!goog.isString(obj) || obj.length != 1) {
-          return -1;
-        }
-        return arr.indexOf(obj, fromIndex);
-      }
-
-      for (var i = fromIndex; i < arr.length; i++) {
-        if (i in arr && arr[i] === obj) return i;
-      }
-      return -1;
-    };
-
-
-/**
- * Returns the index of the last element of an array with a specified value, or
- * -1 if the element is not present in the array.
- *
- * See {@link http://tinyurl.com/developer-mozilla-org-array-lastindexof}
- *
- * @param {!IArrayLike<T>|string} arr The array to be searched.
- * @param {T} obj The object for which we are searching.
- * @param {?number=} opt_fromIndex The index at which to start the search. If
- *     omitted the search starts at the end of the array.
- * @return {number} The index of the last matching array element.
- * @template T
- */
-goog.array.lastIndexOf = goog.NATIVE_ARRAY_PROTOTYPES &&
-        (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.lastIndexOf) ?
-    function(arr, obj, opt_fromIndex) {
-      goog.asserts.assert(arr.length != null);
-
-      // Firefox treats undefined and null as 0 in the fromIndex argument which
-      // leads it to always return -1
-      var fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
-      return Array.prototype.lastIndexOf.call(arr, obj, fromIndex);
-    } :
-    function(arr, obj, opt_fromIndex) {
-      var fromIndex = opt_fromIndex == null ? arr.length - 1 : opt_fromIndex;
-
-      if (fromIndex < 0) {
-        fromIndex = Math.max(0, arr.length + fromIndex);
-      }
-
-      if (goog.isString(arr)) {
-        // Array.prototype.lastIndexOf uses === so only strings should be found.
-        if (!goog.isString(obj) || obj.length != 1) {
-          return -1;
-        }
-        return arr.lastIndexOf(obj, fromIndex);
-      }
-
-      for (var i = fromIndex; i >= 0; i--) {
-        if (i in arr && arr[i] === obj) return i;
-      }
-      return -1;
-    };
-
-
-/**
- * Calls a function for each element in an array. Skips holes in the array.
- * See {@link http://tinyurl.com/developer-mozilla-org-array-foreach}
- *
- * @param {IArrayLike<T>|string} arr Array or array like object over
- *     which to iterate.
- * @param {?function(this: S, T, number, ?): ?} f The function to call for every
- *     element. This function takes 3 arguments (the element, the index and the
- *     array). The return value is ignored.
- * @param {S=} opt_obj The object to be used as the value of 'this' within f.
- * @template T,S
- */
-goog.array.forEach = goog.NATIVE_ARRAY_PROTOTYPES &&
-        (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.forEach) ?
-    function(arr, f, opt_obj) {
-      goog.asserts.assert(arr.length != null);
-
-      Array.prototype.forEach.call(arr, f, opt_obj);
-    } :
-    function(arr, f, opt_obj) {
-      var l = arr.length;  // must be fixed during loop... see docs
-      var arr2 = goog.isString(arr) ? arr.split('') : arr;
-      for (var i = 0; i < l; i++) {
-        if (i in arr2) {
-          f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr);
-        }
-      }
-    };
-
-
-/**
- * Calls a function for each element in an array, starting from the last
- * element rather than the first.
- *
- * @param {IArrayLike<T>|string} arr Array or array
- *     like object over which to iterate.
- * @param {?function(this: S, T, number, ?): ?} f The function to call for every
- *     element. This function
- *     takes 3 arguments (the element, the index and the array). The return
- *     value is ignored.
- * @param {S=} opt_obj The object to be used as the value of 'this'
- *     within f.
- * @template T,S
- */
-goog.array.forEachRight = function(arr, f, opt_obj) {
-  var l = arr.length;  // must be fixed during loop... see docs
-  var arr2 = goog.isString(arr) ? arr.split('') : arr;
-  for (var i = l - 1; i >= 0; --i) {
-    if (i in arr2) {
-      f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr);
-    }
-  }
-};
-
-
-/**
- * Calls a function for each element in an array, and if the function returns
- * true adds the element to a new array.
- *
- * See {@link http://tinyurl.com/developer-mozilla-org-array-filter}
- *
- * @param {IArrayLike<T>|string} arr Array or array
- *     like object over which to iterate.
- * @param {?function(this:S, T, number, ?):boolean} f The function to call for
- *     every element. This function
- *     takes 3 arguments (the element, the index and the array) and must
- *     return a Boolean. If the return value is true the element is added to the
- *     result array. If it is false the element is not included.
- * @param {S=} opt_obj The object to be used as the value of 'this'
- *     within f.
- * @return {!Array<T>} a new array in which only elements that passed the test
- *     are present.
- * @template T,S
- */
-goog.array.filter = goog.NATIVE_ARRAY_PROTOTYPES &&
-        (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.filter) ?
-    function(arr, f, opt_obj) {
-      goog.asserts.assert(arr.length != null);
-
-      return Array.prototype.filter.call(arr, f, opt_obj);
-    } :
-    function(arr, f, opt_obj) {
-      var l = arr.length;  // must be fixed during loop... see docs
-      var res = [];
-      var resLength = 0;
-      var arr2 = goog.isString(arr) ? arr.split('') : arr;
-      for (var i = 0; i < l; i++) {
-        if (i in arr2) {
-          var val = arr2[i];  // in case f mutates arr2
-          if (f.call(/** @type {?} */ (opt_obj), val, i, arr)) {
-            res[resLength++] = val;
-          }
-        }
-      }
-      return res;
-    };
-
-
-/**
- * Calls a function for each element in an array and inserts the result into a
- * new array.
- *
- * See {@link http://tinyurl.com/developer-mozilla-org-array-map}
- *
- * @param {IArrayLike<VALUE>|string} arr Array or array like object
- *     over which to iterate.
- * @param {function(this:THIS, VALUE, number, ?): RESULT} f The function to call
- *     for every element. This function takes 3 arguments (the element,
- *     the index and the array) and should return something. The result will be
- *     inserted into a new array.
- * @param {THIS=} opt_obj The object to be used as the value of 'this' within f.
- * @return {!Array<RESULT>} a new array with the results from f.
- * @template THIS, VALUE, RESULT
- */
-goog.array.map = goog.NATIVE_ARRAY_PROTOTYPES &&
-        (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.map) ?
-    function(arr, f, opt_obj) {
-      goog.asserts.assert(arr.length != null);
-
-      return Array.prototype.map.call(arr, f, opt_obj);
-    } :
-    function(arr, f, opt_obj) {
-      var l = arr.length;  // must be fixed during loop... see docs
-      var res = new Array(l);
-      var arr2 = goog.isString(arr) ? arr.split('') : arr;
-      for (var i = 0; i < l; i++) {
-        if (i in arr2) {
-          res[i] = f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr);
-        }
-      }
-      return res;
-    };
-
-
-/**
- * Passes every element of an array into a function and accumulates the result.
- *
- * See {@link http://tinyurl.com/developer-mozilla-org-array-reduce}
- *
- * For example:
- * var a = [1, 2, 3, 4];
- * goog.array.reduce(a, function(r, v, i, arr) {return r + v;}, 0);
- * returns 10
- *
- * @param {IArrayLike<T>|string} arr Array or array
- *     like object over which to iterate.
- * @param {function(this:S, R, T, number, ?) : R} f The function to call for
- *     every element. This function
- *     takes 4 arguments (the function's previous result or the initial value,
- *     the value of the current array element, the current array index, and the
- *     array itself)
- *     function(previousValue, currentValue, index, array).
- * @param {?} val The initial value to pass into the function on the first call.
- * @param {S=} opt_obj  The object to be used as the value of 'this'
- *     within f.
- * @return {R} Result of evaluating f repeatedly across the values of the array.
- * @template T,S,R
- */
-goog.array.reduce = goog.NATIVE_ARRAY_PROTOTYPES &&
-        (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduce) ?
-    function(arr, f, val, opt_obj) {
-      goog.asserts.assert(arr.length != null);
-      if (opt_obj) {
-        f = goog.bind(f, opt_obj);
-      }
-      return Array.prototype.reduce.call(arr, f, val);
-    } :
-    function(arr, f, val, opt_obj) {
-      var rval = val;
-      goog.array.forEach(arr, function(val, index) {
-        rval = f.call(/** @type {?} */ (opt_obj), rval, val, index, arr);
-      });
-      return rval;
-    };
-
-
-/**
- * Passes every element of an array into a function and accumulates the result,
- * starting from the last element and working towards the first.
- *
- * See {@link http://tinyurl.com/developer-mozilla-org-array-reduceright}
- *
- * For example:
- * var a = ['a', 'b', 'c'];
- * goog.array.reduceRight(a, function(r, v, i, arr) {return r + v;}, '');
- * returns 'cba'
- *
- * @param {IArrayLike<T>|string} arr Array or array
- *     like object over which to iterate.
- * @param {?function(this:S, R, T, number, ?) : R} f The function to call for
- *     every element. This function
- *     takes 4 arguments (the function's previous result or the initial value,
- *     the value of the current array element, the current array index, and the
- *     array itself)
- *     function(previousValue, currentValue, index, array).
- * @param {?} val The initial value to pass into the function on the first call.
- * @param {S=} opt_obj The object to be used as the value of 'this'
- *     within f.
- * @return {R} Object returned as a result of evaluating f repeatedly across the
- *     values of the array.
- * @template T,S,R
- */
-goog.array.reduceRight = goog.NATIVE_ARRAY_PROTOTYPES &&
-        (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.reduceRight) ?
-    function(arr, f, val, opt_obj) {
-      goog.asserts.assert(arr.length != null);
-      goog.asserts.assert(f != null);
-      if (opt_obj) {
-        f = goog.bind(f, opt_obj);
-      }
-      return Array.prototype.reduceRight.call(arr, f, val);
-    } :
-    function(arr, f, val, opt_obj) {
-      var rval = val;
-      goog.array.forEachRight(arr, function(val, index) {
-        rval = f.call(/** @type {?} */ (opt_obj), rval, val, index, arr);
-      });
-      return rval;
-    };
-
-
-/**
- * Calls f for each element of an array. If any call returns true, some()
- * returns true (without checking the remaining elements). If all calls
- * return false, some() returns false.
- *
- * See {@link http://tinyurl.com/developer-mozilla-org-array-some}
- *
- * @param {IArrayLike<T>|string} arr Array or array
- *     like object over which to iterate.
- * @param {?function(this:S, T, number, ?) : boolean} f The function to call for
- *     for every element. This function takes 3 arguments (the element, the
- *     index and the array) and should return a boolean.
- * @param {S=} opt_obj  The object to be used as the value of 'this'
- *     within f.
- * @return {boolean} true if any element passes the test.
- * @template T,S
- */
-goog.array.some = goog.NATIVE_ARRAY_PROTOTYPES &&
-        (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.some) ?
-    function(arr, f, opt_obj) {
-      goog.asserts.assert(arr.length != null);
-
-      return Array.prototype.some.call(arr, f, opt_obj);
-    } :
-    function(arr, f, opt_obj) {
-      var l = arr.length;  // must be fixed during loop... see docs
-      var arr2 = goog.isString(arr) ? arr.split('') : arr;
-      for (var i = 0; i < l; i++) {
-        if (i in arr2 && f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr)) {
-          return true;
-        }
-      }
-      return false;
-    };
-
-
-/**
- * Call f for each element of an array. If all calls return true, every()
- * returns true. If any call returns false, every() returns false and
- * does not continue to check the remaining elements.
- *
- * See {@link http://tinyurl.com/developer-mozilla-org-array-every}
- *
- * @param {IArrayLike<T>|string} arr Array or array
- *     like object over which to iterate.
- * @param {?function(this:S, T, number, ?) : boolean} f The function to call for
- *     for every element. This function takes 3 arguments (the element, the
- *     index and the array) and should return a boolean.
- * @param {S=} opt_obj The object to be used as the value of 'this'
- *     within f.
- * @return {boolean} false if any element fails the test.
- * @template T,S
- */
-goog.array.every = goog.NATIVE_ARRAY_PROTOTYPES &&
-        (goog.array.ASSUME_NATIVE_FUNCTIONS || Array.prototype.every) ?
-    function(arr, f, opt_obj) {
-      goog.asserts.assert(arr.length != null);
-
-      return Array.prototype.every.call(arr, f, opt_obj);
-    } :
-    function(arr, f, opt_obj) {
-      var l = arr.length;  // must be fixed during loop... see docs
-      var arr2 = goog.isString(arr) ? arr.split('') : arr;
-      for (var i = 0; i < l; i++) {
-        if (i in arr2 && !f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr)) {
-          return false;
-        }
-      }
-      return true;
-    };
-
-
-/**
- * Counts the array elements that fulfill the predicate, i.e. for which the
- * callback function returns true. Skips holes in the array.
- *
- * @param {!IArrayLike<T>|string} arr Array or array like object
- *     over which to iterate.
- * @param {function(this: S, T, number, ?): boolean} f The function to call for
- *     every element. Takes 3 arguments (the element, the index and the array).
- * @param {S=} opt_obj The object to be used as the value of 'this' within f.
- * @return {number} The number of the matching elements.
- * @template T,S
- */
-goog.array.count = function(arr, f, opt_obj) {
-  var count = 0;
-  goog.array.forEach(arr, function(element, index, arr) {
-    if (f.call(/** @type {?} */ (opt_obj), element, index, arr)) {
-      ++count;
-    }
-  }, opt_obj);
-  return count;
-};
-
-
-/**
- * Search an array for the first element that satisfies a given condition and
- * return that element.
- * @param {IArrayLike<T>|string} arr Array or array
- *     like object over which to iterate.
- * @param {?function(this:S, T, number, ?) : boolean} f The function to call
- *     for every element. This function takes 3 arguments (the element, the
- *     index and the array) and should return a boolean.
- * @param {S=} opt_obj An optional "this" context for the function.
- * @return {T|null} The first array element that passes the test, or null if no
- *     element is found.
- * @template T,S
- */
-goog.array.find = function(arr, f, opt_obj) {
-  var i = goog.array.findIndex(arr, f, opt_obj);
-  return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i];
-};
-
-
-/**
- * Search an array for the first element that satisfies a given condition and
- * return its index.
- * @param {IArrayLike<T>|string} arr Array or array
- *     like object over which to iterate.
- * @param {?function(this:S, T, number, ?) : boolean} f The function to call for
- *     every element. This function
- *     takes 3 arguments (the element, the index and the array) and should
- *     return a boolean.
- * @param {S=} opt_obj An optional "this" context for the function.
- * @return {number} The index of the first array element that passes the test,
- *     or -1 if no element is found.
- * @template T,S
- */
-goog.array.findIndex = function(arr, f, opt_obj) {
-  var l = arr.length;  // must be fixed during loop... see docs
-  var arr2 = goog.isString(arr) ? arr.split('') : arr;
-  for (var i = 0; i < l; i++) {
-    if (i in arr2 && f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr)) {
-      return i;
-    }
-  }
-  return -1;
-};
-
-
-/**
- * Search an array (in reverse order) for the last element that satisfies a
- * given condition and return that element.
- * @param {IArrayLike<T>|string} arr Array or array
- *     like object over which to iterate.
- * @param {?function(this:S, T, number, ?) : boolean} f The function to call
- *     for every element. This function
- *     takes 3 arguments (the element, the index and the array) and should
- *     return a boolean.
- * @param {S=} opt_obj An optional "this" context for the function.
- * @return {T|null} The last array element that passes the test, or null if no
- *     element is found.
- * @template T,S
- */
-goog.array.findRight = function(arr, f, opt_obj) {
-  var i = goog.array.findIndexRight(arr, f, opt_obj);
-  return i < 0 ? null : goog.isString(arr) ? arr.charAt(i) : arr[i];
-};
-
-
-/**
- * Search an array (in reverse order) for the last element that satisfies a
- * given condition and return its index.
- * @param {IArrayLike<T>|string} arr Array or array
- *     like object over which to iterate.
- * @param {?function(this:S, T, number, ?) : boolean} f The function to call
- *     for every element. This function
- *     takes 3 arguments (the element, the index and the array) and should
- *     return a boolean.
- * @param {S=} opt_obj An optional "this" context for the function.
- * @return {number} The index of the last array element that passes the test,
- *     or -1 if no element is found.
- * @template T,S
- */
-goog.array.findIndexRight = function(arr, f, opt_obj) {
-  var l = arr.length;  // must be fixed during loop... see docs
-  var arr2 = goog.isString(arr) ? arr.split('') : arr;
-  for (var i = l - 1; i >= 0; i--) {
-    if (i in arr2 && f.call(/** @type {?} */ (opt_obj), arr2[i], i, arr)) {
-      return i;
-    }
-  }
-  return -1;
-};
-
-
-/**
- * Whether the array contains the given object.
- * @param {IArrayLike<?>|string} arr The array to test for the presence of the
- *     element.
- * @param {*} obj The object for which to test.
- * @return {boolean} true if obj is present.
- */
-goog.array.contains = function(arr, obj) {
-  return goog.array.indexOf(arr, obj) >= 0;
-};
-
-
-/**
- * Whether the array is empty.
- * @param {IArrayLike<?>|string} arr The array to test.
- * @return {boolean} true if empty.
- */
-goog.array.isEmpty = function(arr) {
-  return arr.length == 0;
-};
-
-
-/**
- * Clears the array.
- * @param {IArrayLike<?>} arr Array or array like object to clear.
- */
-goog.array.clear = function(arr) {
-  // For non real arrays we don't have the magic length so we delete the
-  // indices.
-  if (!goog.isArray(arr)) {
-    for (var i = arr.length - 1; i >= 0; i--) {
-      delete arr[i];
-    }
-  }
-  arr.length = 0;
-};
-
-
-/**
- * Pushes an item into an array, if it's not already in the array.
- * @param {Array<T>} arr Array into which to insert the item.
- * @param {T} obj Value to add.
- * @template T
- */
-goog.array.insert = function(arr, obj) {
-  if (!goog.array.contains(arr, obj)) {
-    arr.push(obj);
-  }
-};
-
-
-/**
- * Inserts an object at the given index of the array.
- * @param {IArrayLike<?>} arr The array to modify.
- * @param {*} obj The object to insert.
- * @param {number=} opt_i The index at which to insert the object. If omitted,
- *      treated as 0. A negative index is counted from the end of the array.
- */
-goog.array.insertAt = function(arr, obj, opt_i) {
-  goog.array.splice(arr, opt_i, 0, obj);
-};
-
-
-/**
- * Inserts at the given index of the array, all elements of another array.
- * @param {IArrayLike<?>} arr The array to modify.
- * @param {IArrayLike<?>} elementsToAdd The array of elements to add.
- * @param {number=} opt_i The index at which to insert the object. If omitted,
- *      treated as 0. A negative index is counted from the end of the array.
- */
-goog.array.insertArrayAt = function(arr, elementsToAdd, opt_i) {
-  goog.partial(goog.array.splice, arr, opt_i, 0).apply(null, elementsToAdd);
-};
-
-
-/**
- * Inserts an object into an array before a specified object.
- * @param {Array<T>} arr The array to modify.
- * @param {T} obj The object to insert.
- * @param {T=} opt_obj2 The object before which obj should be inserted. If obj2
- *     is omitted or not found, obj is inserted at the end of the array.
- * @template T
- */
-goog.array.insertBefore = function(arr, obj, opt_obj2) {
-  var i;
-  if (arguments.length == 2 || (i = goog.array.indexOf(arr, opt_obj2)) < 0) {
-    arr.push(obj);
-  } else {
-    goog.array.insertAt(arr, obj, i);
-  }
-};
-
-
-/**
- * Removes the first occurrence of a particular value from an array.
- * @param {IArrayLike<T>} arr Array from which to remove
- *     value.
- * @param {T} obj Object to remove.
- * @return {boolean} True if an element was removed.
- * @template T
- */
-goog.array.remove = function(arr, obj) {
-  var i = goog.array.indexOf(arr, obj);
-  var rv;
-  if ((rv = i >= 0)) {
-    goog.array.removeAt(arr, i);
-  }
-  return rv;
-};
-
-
-/**
- * Removes the last occurrence of a particular value from an array.
- * @param {!IArrayLike<T>} arr Array from which to remove value.
- * @param {T} obj Object to remove.
- * @return {boolean} True if an element was removed.
- * @template T
- */
-goog.array.removeLast = function(arr, obj) {
-  var i = goog.array.lastIndexOf(arr, obj);
-  if (i >= 0) {
-    goog.array.removeAt(arr, i);
-    return true;
-  }
-  return false;
-};
-
-
-/**
- * Removes from an array the element at index i
- * @param {IArrayLike<?>} arr Array or array like object from which to
- *     remove value.
- * @param {number} i The index to remove.
- * @return {boolean} True if an element was removed.
- */
-goog.array.removeAt = function(arr, i) {
-  goog.asserts.assert(arr.length != null);
-
-  // use generic form of splice
-  // splice returns the removed items and if successful the length of that
-  // will be 1
-  return Array.prototype.splice.call(arr, i, 1).length == 1;
-};
-
-
-/**
- * Removes the first value that satisfies the given condition.
- * @param {IArrayLike<T>} arr Array or array
- *     like object over which to iterate.
- * @param {?function(this:S, T, number, ?) : boolean} f The function to call
- *     for every element. This function
- *     takes 3 arguments (the element, the index and the array) and should
- *     return a boolean.
- * @param {S=} opt_obj An optional "this" context for the function.
- * @return {boolean} True if an element was removed.
- * @template T,S
- */
-goog.array.removeIf = function(arr, f, opt_obj) {
-  var i = goog.array.findIndex(arr, f, opt_obj);
-  if (i >= 0) {
-    goog.array.removeAt(arr, i);
-    return true;
-  }
-  return false;
-};
-
-
-/**
- * Removes all values that satisfy the given condition.
- * @param {IArrayLike<T>} arr Array or array
- *     like object over which to iterate.
- * @param {?function(this:S, T, number, ?) : boolean} f The function to call
- *     for every element. This function
- *     takes 3 arguments (the element, the index and the array) and should
- *     return a boolean.
- * @param {S=} opt_obj An optional "this" context for the function.
- * @return {number} The number of items removed
- * @template T,S
- */
-goog.array.removeAllIf = function(arr, f, opt_obj) {
-  var removedCount = 0;
-  goog.array.forEachRight(arr, function(val, index) {
-    if (f.call(/** @type {?} */ (opt_obj), val, index, arr)) {
-      if (goog.array.removeAt(arr, index)) {
-        removedCount++;
-      }
-    }
-  });
-  return removedCount;
-};
-
-
-/**
- * Returns a new array that is the result of joining the arguments.  If arrays
- * are passed then their items are added, however, if non-arrays are passed they
- * will be added to the return array as is.
- *
- * Note that ArrayLike objects will be added as is, rather than having their
- * items added.
- *
- * goog.array.concat([1, 2], [3, 4]) -> [1, 2, 3, 4]
- * goog.array.concat(0, [1, 2]) -> [0, 1, 2]
- * goog.array.concat([1, 2], null) -> [1, 2, null]
- *
- * There is bug in all current versions of IE (6, 7 and 8) where arrays created
- * in an iframe become corrupted soon (not immediately) after the iframe is
- * destroyed. This is common if loading data via goog.net.IframeIo, for example.
- * This corruption only affects the concat method which will start throwing
- * Catastrophic Errors (#-2147418113).
- *
- * See http://endoflow.com/scratch/corrupted-arrays.html for a test case.
- *
- * Internally goog.array should use this, so that all methods will continue to
- * work on these broken array objects.
- *
- * @param {...*} var_args Items to concatenate.  Arrays will have each item
- *     added, while primitives and objects will be added as is.
- * @return {!Array<?>} The new resultant array.
- */
-goog.array.concat = function(var_args) {
-  return Array.prototype.concat.apply([], arguments);
-};
-
-
-/**
- * Returns a new array that contains the contents of all the arrays passed.
- * @param {...!Array<T>} var_args
- * @return {!Array<T>}
- * @template T
- */
-goog.array.join = function(var_args) {
-  return Array.prototype.concat.apply([], arguments);
-};
-
-
-/**
- * Converts an object to an array.
- * @param {IArrayLike<T>|string} object  The object to convert to an
- *     array.
- * @return {!Array<T>} The object converted into an array. If object has a
- *     length property, every property indexed with a non-negative number
- *     less than length will be included in the result. If object does not
- *     have a length property, an empty array will be returned.
- * @template T
- */
-goog.array.toArray = function(object) {
-  var length = object.length;
-
-  // If length is not a number the following it false. This case is kept for
-  // backwards compatibility since there are callers that pass objects that are
-  // not array like.
-  if (length > 0) {
-    var rv = new Array(length);
-    for (var i = 0; i < length; i++) {
-      rv[i] = object[i];
-    }
-    return rv;
-  }
-  return [];
-};
-
-
-/**
- * Does a shallow copy of an array.
- * @param {IArrayLike<T>|string} arr  Array or array-like object to
- *     clone.
- * @return {!Array<T>} Clone of the input array.
- * @template T
- */
-goog.array.clone = goog.array.toArray;
-
-
-/**
- * Extends an array with another array, element, or "array like" object.
- * This function operates 'in-place', it does not create a new Array.
- *
- * Example:
- * var a = [];
- * goog.array.extend(a, [0, 1]);
- * a; // [0, 1]
- * goog.array.extend(a, 2);
- * a; // [0, 1, 2]
- *
- * @param {Array<VALUE>} arr1  The array to modify.
- * @param {...(Array<VALUE>|VALUE)} var_args The elements or arrays of elements
- *     to add to arr1.
- * @template VALUE
- */
-goog.array.extend = function(arr1, var_args) {
-  for (var i = 1; i < arguments.length; i++) {
-    var arr2 = arguments[i];
-    if (goog.isArrayLike(arr2)) {
-      var len1 = arr1.length || 0;
-      var len2 = arr2.length || 0;
-      arr1.length = len1 + len2;
-      for (var j = 0; j < len2; j++) {
-        arr1[len1 + j] = arr2[j];
-      }
-    } else {
-      arr1.push(arr2);
-    }
-  }
-};
-
-
-/**
- * Adds or removes elements from an array. This is a generic version of Array
- * splice. This means that it might work on other objects similar to arrays,
- * such as the arguments object.
- *
- * @param {IArrayLike<T>} arr The array to modify.
- * @param {number|undefined} index The index at which to start changing the
- *     array. If not defined, treated as 0.
- * @param {number} howMany How many elements to remove (0 means no removal. A
- *     value below 0 is treated as zero and so is any other non number. Numbers
- *     are floored).
- * @param {...T} var_args Optional, additional elements to insert into the
- *     array.
- * @return {!Array<T>} the removed elements.
- * @template T
- */
-goog.array.splice = function(arr, index, howMany, var_args) {
-  goog.asserts.assert(arr.length != null);
-
-  return Array.prototype.splice.apply(arr, goog.array.slice(arguments, 1));
-};
-
-
-/**
- * Returns a new array from a segment of an array. This is a generic version of
- * Array slice. This means that it might work on other objects similar to
- * arrays, such as the arguments object.
- *
- * @param {IArrayLike<T>|string} arr The array from
- * which to copy a segment.
- * @param {number} start The index of the first element to copy.
- * @param {number=} opt_end The index after the last element to copy.
- * @return {!Array<T>} A new array containing the specified segment of the
- *     original array.
- * @template T
- */
-goog.array.slice = function(arr, start, opt_end) {
-  goog.asserts.assert(arr.length != null);
-
-  // passing 1 arg to slice is not the same as passing 2 where the second is
-  // null or undefined (in that case the second argument is treated as 0).
-  // we could use slice on the arguments object and then use apply instead of
-  // testing the length
-  if (arguments.length <= 2) {
-    return Array.prototype.slice.call(arr, start);
-  } else {
-    return Array.prototype.slice.call(arr, start, opt_end);
-  }
-};
-
-
-/**
- * Removes all duplicates from an array (retaining only the first
- * occurrence of each array element).  This function modifies the
- * array in place and doesn't change the order of the non-duplicate items.
- *
- * For objects, duplicates are identified as having the same unique ID as
- * defined by {@link goog.getUid}.
- *
- * Alternatively you can specify a custom hash function that returns a unique
- * value for each item in the array it should consider unique.
- *
- * Runtime: N,
- * Worstcase space: 2N (no dupes)
- *
- * @param {IArrayLike<T>} arr The array from which to remove
- *     duplicates.
- * @param {Array=} opt_rv An optional array in which to return the results,
- *     instead of performing the removal inplace.  If specified, the original
- *     array will remain unchanged.
- * @param {function(T):string=} opt_hashFn An optional function to use to
- *     apply to every item in the array. This function should return a unique
- *     value for each item in the array it should consider unique.
- * @template T
- */
-goog.array.removeDuplicates = function(arr, opt_rv, opt_hashFn) {
-  var returnArray = opt_rv || arr;
-  var defaultHashFn = function(item) {
-    // Prefix each type with a single character representing the type to
-    // prevent conflicting keys (e.g. true and 'true').
-    return goog.isObject(item) ? 'o' + goog.getUid(item) :
-                                 (typeof item).charAt(0) + item;
-  };
-  var hashFn = opt_hashFn || defaultHashFn;
-
-  var seen = {}, cursorInsert = 0, cursorRead = 0;
-  while (cursorRead < arr.length) {
-    var current = arr[cursorRead++];
-    var key = hashFn(current);
-    if (!Object.prototype.hasOwnProperty.call(seen, key)) {
-      seen[key] = true;
-      returnArray[cursorInsert++] = current;
-    }
-  }
-  returnArray.length = cursorInsert;
-};
-
-
-/**
- * Searches the specified array for the specified target using the binary
- * search algorithm.  If no opt_compareFn is specified, elements are compared
- * using <code>goog.array.defaultCompare</code>, which compares the elements
- * using the built in < and > operators.  This will produce the expected
- * behavior for homogeneous arrays of String(s) and Number(s). The array
- * specified <b>must</b> be sorted in ascending order (as defined by the
- * comparison function).  If the array is not sorted, results are undefined.
- * If the array contains multiple instances of the specified target value, any
- * of these instances may be found.
- *
- * Runtime: O(log n)
- *
- * @param {IArrayLike<VALUE>} arr The array to be searched.
- * @param {TARGET} target The sought value.
- * @param {function(TARGET, VALUE): number=} opt_compareFn Optional comparison
- *     function by which the array is ordered. Should take 2 arguments to
- *     compare, and return a negative number, zero, or a positive number
- *     depending on whether the first argument is less than, equal to, or
- *     greater than the second.
- * @return {number} Lowest index of the target value if found, otherwise
- *     (-(insertion point) - 1). The insertion point is where the value should
- *     be inserted into arr to preserve the sorted property.  Return value >= 0
- *     iff target is found.
- * @template TARGET, VALUE
- */
-goog.array.binarySearch = function(arr, target, opt_compareFn) {
-  return goog.array.binarySearch_(
-      arr, opt_compareFn || goog.array.defaultCompare, false /* isEvaluator */,
-      target);
-};
-
-
-/**
- * Selects an index in the specified array using the binary search algorithm.
- * The evaluator receives an element and determines whether the desired index
- * is before, at, or after it.  The evaluator must be consistent (formally,
- * goog.array.map(goog.array.map(arr, evaluator, opt_obj), goog.math.sign)
- * must be monotonically non-increasing).
- *
- * Runtime: O(log n)
- *
- * @param {IArrayLike<VALUE>} arr The array to be searched.
- * @param {function(this:THIS, VALUE, number, ?): number} evaluator
- *     Evaluator function that receives 3 arguments (the element, the index and
- *     the array). Should return a negative number, zero, or a positive number
- *     depending on whether the desired index is before, at, or after the
- *     element passed to it.
- * @param {THIS=} opt_obj The object to be used as the value of 'this'
- *     within evaluator.
- * @return {number} Index of the leftmost element matched by the evaluator, if
- *     such exists; otherwise (-(insertion point) - 1). The insertion point is
- *     the index of the first element for which the evaluator returns negative,
- *     or arr.length if no such element exists. The return value is non-negative
- *     iff a match is found.
- * @template THIS, VALUE
- */
-goog.array.binarySelect = function(arr, evaluator, opt_obj) {
-  return goog.array.binarySearch_(
-      arr, evaluator, true /* isEvaluator */, undefined /* opt_target */,
-      opt_obj);
-};
-
-
-/**
- * Implementation of a binary search algorithm which knows how to use both
- * comparison functions and evaluators. If an evaluator is provided, will call
- * the evaluator with the given optional data object, conforming to the
- * interface defined in binarySelect. Otherwise, if a comparison function is
- * provided, will call the comparison function against the given data object.
- *
- * This implementation purposefully does not use goog.bind or goog.partial for
- * performance reasons.
- *
- * Runtime: O(log n)
- *
- * @param {IArrayLike<?>} arr The array to be searched.
- * @param {function(?, ?, ?): number | function(?, ?): number} compareFn
- *     Either an evaluator or a comparison function, as defined by binarySearch
- *     and binarySelect above.
- * @param {boolean} isEvaluator Whether the function is an evaluator or a
- *     comparison function.
- * @param {?=} opt_target If the function is a comparison function, then
- *     this is the target to binary search for.
- * @param {Object=} opt_selfObj If the function is an evaluator, this is an
- *     optional this object for the evaluator.
- * @return {number} Lowest index of the target value if found, otherwise
- *     (-(insertion point) - 1). The insertion point is where the value should
- *     be inserted into arr to preserve the sorted property.  Return value >= 0
- *     iff target is found.
- * @private
- */
-goog.array.binarySearch_ = function(
-    arr, compareFn, isEvaluator, opt_target, opt_selfObj) {
-  var left = 0;            // inclusive
-  var right = arr.length;  // exclusive
-  var found;
-  while (left < right) {
-    var middle = (left + right) >> 1;
-    var compareResult;
-    if (isEvaluator) {
-      compareResult = compareFn.call(opt_selfObj, arr[middle], middle, arr);
-    } else {
-      // NOTE(dimvar): To avoid this cast, we'd have to use function overloading
-      // for the type of binarySearch_, which the type system can't express yet.
-      compareResult = /** @type {function(?, ?): number} */ (compareFn)(
-          opt_target, arr[middle]);
-    }
-    if (compareResult > 0) {
-      left = middle + 1;
-    } else {
-      right = middle;
-      // We are looking for the lowest index so we can't return immediately.
-      found = !compareResult;
-    }
-  }
-  // left is the index if found, or the insertion point otherwise.
-  // ~left is a shorthand for -left - 1.
-  return found ? left : ~left;
-};
-
-
-/**
- * Sorts the specified array into ascending order.  If no opt_compareFn is
- * specified, elements are compared using
- * <code>goog.array.defaultCompare</code>, which compares the elements using
- * the built in < and > operators.  This will produce the expected behavior
- * for homogeneous arrays of String(s) and Number(s), unlike the native sort,
- * but will give unpredictable results for heterogeneous lists of strings and
- * numbers with different numbers of digits.
- *
- * This sort is not guaranteed to be stable.
- *
- * Runtime: Same as <code>Array.prototype.sort</code>
- *
- * @param {Array<T>} arr The array to be sorted.
- * @param {?function(T,T):number=} opt_compareFn Optional comparison
- *     function by which the
- *     array is to be ordered. Should take 2 arguments to compare, and return a
- *     negative number, zero, or a positive number depending on whether the
- *     first argument is less than, equal to, or greater than the second.
- * @template T
- */
-goog.array.sort = function(arr, opt_compareFn) {
-  // TODO(arv): Update type annotation since null is not accepted.
-  arr.sort(opt_compareFn || goog.array.defaultCompare);
-};
-
-
-/**
- * Sorts the specified array into ascending order in a stable way.  If no
- * opt_compareFn is specified, elements are compared using
- * <code>goog.array.defaultCompare</code>, which compares the elements using
- * the built in < and > operators.  This will produce the expected behavior
- * for homogeneous arrays of String(s) and Number(s).
- *
- * Runtime: Same as <code>Array.prototype.sort</code>, plus an additional
- * O(n) overhead of copying the array twice.
- *
- * @param {Array<T>} arr The array to be sorted.
- * @param {?function(T, T): number=} opt_compareFn Optional comparison function
- *     by which the array is to be ordered. Should take 2 arguments to compare,
- *     and return a negative number, zero, or a positive number depending on
- *     whether the first argument is less than, equal to, or greater than the
- *     second.
- * @template T
- */
-goog.array.stableSort = function(arr, opt_compareFn) {
-  var compArr = new Array(arr.length);
-  for (var i = 0; i < arr.length; i++) {
-    compArr[i] = {index: i, value: arr[i]};
-  }
-  var valueCompareFn = opt_compareFn || goog.array.defaultCompare;
-  function stableCompareFn(obj1, obj2) {
-    return valueCompareFn(obj1.value, obj2.value) || obj1.index - obj2.index;
-  }
-  goog.array.sort(compArr, stableCompareFn);
-  for (var i = 0; i < arr.length; i++) {
-    arr[i] = compArr[i].value;
-  }
-};
-
-
-/**
- * Sort the specified array into ascending order based on item keys
- * returned by the specified key function.
- * If no opt_compareFn is specified, the keys are compared in ascending order
- * using <code>goog.array.defaultCompare</code>.
- *
- * Runtime: O(S(f(n)), where S is runtime of <code>goog.array.sort</code>
- * and f(n) is runtime of the key function.
- *
- * @param {Array<T>} arr The array to be sorted.
- * @param {function(T): K} keyFn Function taking array element and returning
- *     a key used for sorting this element.
- * @param {?function(K, K): number=} opt_compareFn Optional comparison function
- *     by which the keys are to be ordered. Should take 2 arguments to compare,
- *     and return a negative number, zero, or a positive number depending on
- *     whether the first argument is less than, equal to, or greater than the
- *     second.
- * @template T,K
- */
-goog.array.sortByKey = function(arr, keyFn, opt_compareFn) {
-  var keyCompareFn = opt_compareFn || goog.array.defaultCompare;
-  goog.array.sort(
-      arr, function(a, b) { return keyCompareFn(keyFn(a), keyFn(b)); });
-};
-
-
-/**
- * Sorts an array of objects by the specified object key and compare
- * function. If no compare function is provided, the key values are
- * compared in ascending order using <code>goog.array.defaultCompare</code>.
- * This won't work for keys that get renamed by the compiler. So use
- * {'foo': 1, 'bar': 2} rather than {foo: 1, bar: 2}.
- * @param {Array<Object>} arr An array of objects to sort.
- * @param {string} key The object key to sort by.
- * @param {Function=} opt_compareFn The function to use to compare key
- *     values.
- */
-goog.array.sortObjectsByKey = function(arr, key, opt_compareFn) {
-  goog.array.sortByKey(arr, function(obj) { return obj[key]; }, opt_compareFn);
-};
-
-
-/**
- * Tells if the array is sorted.
- * @param {!Array<T>} arr The array.
- * @param {?function(T,T):number=} opt_compareFn Function to compare the
- *     array elements.
- *     Should take 2 arguments to compare, and return a negative number, zero,
- *     or a positive number depending on whether the first argument is less
- *     than, equal to, or greater than the second.
- * @param {boolean=} opt_strict If true no equal elements are allowed.
- * @return {boolean} Whether the array is sorted.
- * @template T
- */
-goog.array.isSorted = function(arr, opt_compareFn, opt_strict) {
-  var compare = opt_compareFn || goog.array.defaultCompare;
-  for (var i = 1; i < arr.length; i++) {
-    var compareResult = compare(arr[i - 1], arr[i]);
-    if (compareResult > 0 || compareResult == 0 && opt_strict) {
-      return false;
-    }
-  }
-  return true;
-};
-
-
-/**
- * Compares two arrays for equality. Two arrays are considered equal if they
- * have the same length and their corresponding elements are equal according to
- * the comparison function.
- *
- * @param {IArrayLike<?>} arr1 The first array to compare.
- * @param {IArrayLike<?>} arr2 The second array to compare.
- * @param {Function=} opt_equalsFn Optional comparison function.
- *     Should take 2 arguments to compare, and return true if the arguments
- *     are equal. Defaults to {@link goog.array.defaultCompareEquality} which
- *     compares the elements using the built-in '===' operator.
- * @return {boolean} Whether the two arrays are equal.
- */
-goog.array.equals = function(arr1, arr2, opt_equalsFn) {
-  if (!goog.isArrayLike(arr1) || !goog.isArrayLike(arr2) ||
-      arr1.length != arr2.length) {
-    return false;
-  }
-  var l = arr1.length;
-  var equalsFn = opt_equalsFn || goog.array.defaultCompareEquality;
-  for (var i = 0; i < l; i++) {
-    if (!equalsFn(arr1[i], arr2[i])) {
-      return false;
-    }
-  }
-  return true;
-};
-
-
-/**
- * 3-way array compare function.
- * @param {!IArrayLike<VALUE>} arr1 The first array to
- *     compare.
- * @param {!IArrayLike<VALUE>} arr2 The second array to
- *     compare.
- * @param {function(VALUE, VALUE): number=} opt_compareFn Optional comparison
- *     function by which the array is to be ordered. Should take 2 arguments to
- *     compare, and return a negative number, zero, or a positive number
- *     depending on whether the first argument is less than, equal to, or
- *     greater than the second.
- * @return {number} Negative number, zero, or a positive number depending on
- *     whether the first argument is less than, equal to, or greater than the
- *     second.
- * @template VALUE
- */
-goog.array.compare3 = function(arr1, arr2, opt_compareFn) {
-  var compare = opt_compareFn || goog.array.defaultCompare;
-  var l = Math.min(arr1.length, arr2.length);
-  for (var i = 0; i < l; i++) {
-    var result = compare(arr1[i], arr2[i]);
-    if (result != 0) {
-      return result;
-    }
-  }
-  return goog.array.defaultCompare(arr1.length, arr2.length);
-};
-
-
-/**
- * Compares its two arguments for order, using the built in < and >
- * operators.
- * @param {VALUE} a The first object to be compared.
- * @param {VALUE} b The second object to be compared.
- * @return {number} A negative number, zero, or a positive number as the first
- *     argument is less than, equal to, or greater than the second,
- *     respectively.
- * @template VALUE
- */
-goog.array.defaultCompare = function(a, b) {
-  return a > b ? 1 : a < b ? -1 : 0;
-};
-
-
-/**
- * Compares its two arguments for inverse order, using the built in < and >
- * operators.
- * @param {VALUE} a The first object to be compared.
- * @param {VALUE} b The second object to be compared.
- * @return {number} A negative number, zero, or a positive number as the first
- *     argument is greater than, equal to, or less than the second,
- *     respectively.
- * @template VALUE
- */
-goog.array.inverseDefaultCompare = function(a, b) {
-  return -goog.array.defaultCompare(a, b);
-};
-
-
-/**
- * Compares its two arguments for equality, using the built in === operator.
- * @param {*} a The first object to compare.
- * @param {*} b The second object to compare.
- * @return {boolean} True if the two arguments are equal, false otherwise.
- */
-goog.array.defaultCompareEquality = function(a, b) {
-  return a === b;
-};
-
-
-/**
- * Inserts a value into a sorted array. The array is not modified if the
- * value is already present.
- * @param {IArrayLike<VALUE>} array The array to modify.
- * @param {VALUE} value The object to insert.
- * @param {function(VALUE, VALUE): number=} opt_compareFn Optional comparison
- *     function by which the array is ordered. Should take 2 arguments to
- *     compare, and return a negative number, zero, or a positive number
- *     depending on whether the first argument is less than, equal to, or
- *     greater than the second.
- * @return {boolean} True if an element was inserted.
- * @template VALUE
- */
-goog.array.binaryInsert = function(array, value, opt_compareFn) {
-  var index = goog.array.binarySearch(array, value, opt_compareFn);
-  if (index < 0) {
-    goog.array.insertAt(array, value, -(index + 1));
-    return true;
-  }
-  return false;
-};
-
-
-/**
- * Removes a value from a sorted array.
- * @param {!IArrayLike<VALUE>} array The array to modify.
- * @param {VALUE} value The object to remove.
- * @param {function(VALUE, VALUE): number=} opt_compareFn Optional comparison
- *     function by which the array is ordered. Should take 2 arguments to
- *     compare, and return a negative number, zero, or a positive number
- *     depending on whether the first argument is less than, equal to, or
- *     greater than the second.
- * @return {boolean} True if an element was removed.
- * @template VALUE
- */
-goog.array.binaryRemove = function(array, value, opt_compareFn) {
-  var index = goog.array.binarySearch(array, value, opt_compareFn);
-  return (index >= 0) ? goog.array.removeAt(array, index) : false;
-};
-
-
-/**
- * Splits an array into disjoint buckets according to a splitting function.
- * @param {Array<T>} array The array.
- * @param {function(this:S, T,number,Array<T>):?} sorter Function to call for
- *     every element.  This takes 3 arguments (the element, the index and the
- *     array) and must return a valid object key (a string, number, etc), or
- *     undefined, if that object should not be placed in a bucket.
- * @param {S=} opt_obj The object to be used as the value of 'this' within
- *     sorter.
- * @return {!Object} An object, with keys being all of the unique return values
- *     of sorter, and values being arrays containing the items for
- *     which the splitter returned that key.
- * @template T,S
- */
-goog.array.bucket = function(array, sorter, opt_obj) {
-  var buckets = {};
-
-  for (var i = 0; i < array.length; i++) {
-    var value = array[i];
-    var key = sorter.call(/** @type {?} */ (opt_obj), value, i, array);
-    if (goog.isDef(key)) {
-      // Push the value to the right bucket, creating it if necessary.
-      var bucket = buckets[key] || (buckets[key] = []);
-      bucket.push(value);
-    }
-  }
-
-  return buckets;
-};
-
-
-/**
- * Creates a new object built from the provided array and the key-generation
- * function.
- * @param {IArrayLike<T>} arr Array or array like object over
- *     which to iterate whose elements will be the values in the new object.
- * @param {?function(this:S, T, number, ?) : string} keyFunc The function to
- *     call for every element. This function takes 3 arguments (the element, the
- *     index and the array) and should return a string that will be used as the
- *     key for the element in the new object. If the function returns the same
- *     key for more than one element, the value for that key is
- *     implementation-defined.
- * @param {S=} opt_obj The object to be used as the value of 'this'
- *     within keyFunc.
- * @return {!Object<T>} The new object.
- * @template T,S
- */
-goog.array.toObject = function(arr, keyFunc, opt_obj) {
-  var ret = {};
-  goog.array.forEach(arr, function(element, index) {
-    ret[keyFunc.call(/** @type {?} */ (opt_obj), element, index, arr)] =
-        element;
-  });
-  return ret;
-};
-
-
-/**
- * Creates a range of numbers in an arithmetic progression.
- *
- * Range takes 1, 2, or 3 arguments:
- * <pre>
- * range(5) is the same as range(0, 5, 1) and produces [0, 1, 2, 3, 4]
- * range(2, 5) is the same as range(2, 5, 1) and produces [2, 3, 4]
- * range(-2, -5, -1) produces [-2, -3, -4]
- * range(-2, -5, 1) produces [], since stepping by 1 wouldn't ever reach -5.
- * </pre>
- *
- * @param {number} startOrEnd The starting value of the range if an end argument
- *     is provided. Otherwise, the start value is 0, and this is the end value.
- * @param {number=} opt_end The optional end value of the range.
- * @param {number=} opt_step The step size between range values. Defaults to 1
- *     if opt_step is undefined or 0.
- * @return {!Array<number>} An array of numbers for the requested range. May be
- *     an empty array if adding the step would not converge toward the end
- *     value.
- */
-goog.array.range = function(startOrEnd, opt_end, opt_step) {
-  var array = [];
-  var start = 0;
-  var end = startOrEnd;
-  var step = opt_step || 1;
-  if (opt_end !== undefined) {
-    start = startOrEnd;
-    end = opt_end;
-  }
-
-  if (step * (end - start) < 0) {
-    // Sign mismatch: start + step will never reach the end value.
-    return [];
-  }
-
-  if (step > 0) {
-    for (var i = start; i < end; i += step) {
-      array.push(i);
-    }
-  } else {
-    for (var i = start; i > end; i += step) {
-      array.push(i);
-    }
-  }
-  return array;
-};
-
-
-/**
- * Returns an array consisting of the given value repeated N times.
- *
- * @param {VALUE} value The value to repeat.
- * @param {number} n The repeat count.
- * @return {!Array<VALUE>} An array with the repeated value.
- * @template VALUE
- */
-goog.array.repeat = function(value, n) {
-  var array = [];
-  for (var i = 0; i < n; i++) {
-    array[i] = value;
-  }
-  return array;
-};
-
-
-/**
- * Returns an array consisting of every argument with all arrays
- * expanded in-place recursively.
- *
- * @param {...*} var_args The values to flatten.
- * @return {!Array<?>} An array containing the flattened values.
- */
-goog.array.flatten = function(var_args) {
-  var CHUNK_SIZE = 8192;
-
-  var result = [];
-  for (var i = 0; i < arguments.length; i++) {
-    var element = arguments[i];
-    if (goog.isArray(element)) {
-      for (var c = 0; c < element.length; c += CHUNK_SIZE) {
-        var chunk = goog.array.slice(element, c, c + CHUNK_SIZE);
-        var recurseResult = goog.array.flatten.apply(null, chunk);
-        for (var r = 0; r < recurseResult.length; r++) {
-          result.push(recurseResult[r]);
-        }
-      }
-    } else {
-      result.push(element);
-    }
-  }
-  return result;
-};
-
-
-/**
- * Rotates an array in-place. After calling this method, the element at
- * index i will be the element previously at index (i - n) %
- * array.length, for all values of i between 0 and array.length - 1,
- * inclusive.
- *
- * For example, suppose list comprises [t, a, n, k, s]. After invoking
- * rotate(array, 1) (or rotate(array, -4)), array will comprise [s, t, a, n, k].
- *
- * @param {!Array<T>} array The array to rotate.
- * @param {number} n The amount to rotate.
- * @return {!Array<T>} The array.
- * @template T
- */
-goog.array.rotate = function(array, n) {
-  goog.asserts.assert(array.length != null);
-
-  if (array.length) {
-    n %= array.length;
-    if (n > 0) {
-      Array.prototype.unshift.apply(array, array.splice(-n, n));
-    } else if (n < 0) {
-      Array.prototype.push.apply(array, array.splice(0, -n));
-    }
-  }
-  return array;
-};
-
-
-/**
- * Moves one item of an array to a new position keeping the order of the rest
- * of the items. Example use case: keeping a list of JavaScript objects
- * synchronized with the corresponding list of DOM elements after one of the
- * elements has been dragged to a new position.
- * @param {!IArrayLike<?>} arr The array to modify.
- * @param {number} fromIndex Index of the item to move between 0 and
- *     {@code arr.length - 1}.
- * @param {number} toIndex Target index between 0 and {@code arr.length - 1}.
- */
-goog.array.moveItem = function(arr, fromIndex, toIndex) {
-  goog.asserts.assert(fromIndex >= 0 && fromIndex < arr.length);
-  goog.asserts.assert(toIndex >= 0 && toIndex < arr.length);
-  // Remove 1 item at fromIndex.
-  var removedItems = Array.prototype.splice.call(arr, fromIndex, 1);
-  // Insert the removed item at toIndex.
-  Array.prototype.splice.call(arr, toIndex, 0, removedItems[0]);
-  // We don't use goog.array.insertAt and goog.array.removeAt, because they're
-  // significantly slower than splice.
-};
-
-
-/**
- * Creates a new array for which the element at position i is an array of the
- * ith element of the provided arrays.  The returned array will only be as long
- * as the shortest array provided; additional values are ignored.  For example,
- * the result of zipping [1, 2] and [3, 4, 5] is [[1,3], [2, 4]].
- *
- * This is similar to the zip() function in Python.  See {@link
- * http://docs.python.org/library/functions.html#zip}
- *
- * @param {...!IArrayLike<?>} var_args Arrays to be combined.
- * @return {!Array<!Array<?>>} A new array of arrays created from
- *     provided arrays.
- */
-goog.array.zip = function(var_args) {
-  if (!arguments.length) {
-    return [];
-  }
-  var result = [];
-  var minLen = arguments[0].length;
-  for (var i = 1; i < arguments.length; i++) {
-    if (arguments[i].length < minLen) {
-      minLen = arguments[i].length;
-    }
-  }
-  for (var i = 0; i < minLen; i++) {
-    var value = [];
-    for (var j = 0; j < arguments.length; j++) {
-      value.push(arguments[j][i]);
-    }
-    result.push(value);
-  }
-  return result;
-};
-
-
-/**
- * Shuffles the values in the specified array using the Fisher-Yates in-place
- * shuffle (also known as the Knuth Shuffle). By default, calls Math.random()
- * and so resets the state of that random number generator. Similarly, may reset
- * the state of the any other specified random number generator.
- *
- * Runtime: O(n)
- *
- * @param {!Array<?>} arr The array to be shuffled.
- * @param {function():number=} opt_randFn Optional random function to use for
- *     shuffling.
- *     Takes no arguments, and returns a random number on the interval [0, 1).
- *     Defaults to Math.random() using JavaScript's built-in Math library.
- */
-goog.array.shuffle = function(arr, opt_randFn) {
-  var randFn = opt_randFn || Math.random;
-
-  for (var i = arr.length - 1; i > 0; i--) {
-    // Choose a random array index in [0, i] (inclusive with i).
-    var j = Math.floor(randFn() * (i + 1));
-
-    var tmp = arr[i];
-    arr[i] = arr[j];
-    arr[j] = tmp;
-  }
-};
-
-
-/**
- * Returns a new array of elements from arr, based on the indexes of elements
- * provided by index_arr. For example, the result of index copying
- * ['a', 'b', 'c'] with index_arr [1,0,0,2] is ['b', 'a', 'a', 'c'].
- *
- * @param {!Array<T>} arr The array to get a indexed copy from.
- * @param {!Array<number>} index_arr An array of indexes to get from arr.
- * @return {!Array<T>} A new array of elements from arr in index_arr order.
- * @template T
- */
-goog.array.copyByIndex = function(arr, index_arr) {
-  var result = [];
-  goog.array.forEach(index_arr, function(index) { result.push(arr[index]); });
-  return result;
-};
-
-
-/**
- * Maps each element of the input array into zero or more elements of the output
- * array.
- *
- * @param {!IArrayLike<VALUE>|string} arr Array or array like object
- *     over which to iterate.
- * @param {function(this:THIS, VALUE, number, ?): !Array<RESULT>} f The function
- *     to call for every element. This function takes 3 arguments (the element,
- *     the index and the array) and should return an array. The result will be
- *     used to extend a new array.
- * @param {THIS=} opt_obj The object to be used as the value of 'this' within f.
- * @return {!Array<RESULT>} a new array with the concatenation of all arrays
- *     returned from f.
- * @template THIS, VALUE, RESULT
- */
-goog.array.concatMap = function(arr, f, opt_obj) {
-  return goog.array.concat.apply([], goog.array.map(arr, f, opt_obj));
-};

+ 0 - 25
src/renderer/cocoblockly-x/python/block/closure/goog/array/array_test.html

@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!--
-Copyright 2006 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
- <head>
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta charset="UTF-8" />
-  <title>
-   Closure Unit Tests - goog.array
-  </title>
-  <script src="../base.js">
-  </script>
-  <script>
-   goog.require('goog.arrayTest');
-  </script>
- </head>
- <body>
-  <div class="foo">
-  </div>
- </body>
-</html>

+ 0 - 1826
src/renderer/cocoblockly-x/python/block/closure/goog/array/array_test.js

@@ -1,1826 +0,0 @@
-// Copyright 2006 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-goog.provide('goog.arrayTest');
-goog.setTestOnly('goog.arrayTest');
-
-goog.require('goog.array');
-goog.require('goog.dom');
-goog.require('goog.dom.TagName');
-goog.require('goog.testing.PropertyReplacer');
-goog.require('goog.testing.jsunit');
-goog.require('goog.testing.recordFunction');
-
-function testArrayLast() {
-  assertEquals(goog.array.last([1, 2, 3]), 3);
-  assertEquals(goog.array.last([1]), 1);
-  assertUndefined(goog.array.last([]));
-}
-
-function testArrayLastWhenDeleted() {
-  var a = [1, 2, 3];
-  delete a[2];
-  assertUndefined(goog.array.last(a));
-}
-
-function testArrayIndexOf() {
-  assertEquals(goog.array.indexOf([0, 1, 2, 3], 1), 1);
-  assertEquals(goog.array.indexOf([0, 1, 1, 1], 1), 1);
-  assertEquals(goog.array.indexOf([0, 1, 2, 3], 4), -1);
-  assertEquals(goog.array.indexOf([0, 1, 2, 3], 1, 1), 1);
-  assertEquals(goog.array.indexOf([0, 1, 2, 3], 1, 2), -1);
-  assertEquals(goog.array.indexOf([0, 1, 2, 3], 1, -3), 1);
-  assertEquals(goog.array.indexOf([0, 1, 2, 3], 1, -2), -1);
-}
-
-function testArrayIndexOfOmitsDeleted() {
-  var a = [0, 1, 2, 3];
-  delete a[1];
-  delete a[3];
-  assertEquals(goog.array.indexOf(a, undefined), -1);
-}
-
-function testArrayIndexOfString() {
-  assertEquals(goog.array.indexOf('abcd', 'd'), 3);
-  assertEquals(goog.array.indexOf('abbb', 'b', 2), 2);
-  assertEquals(goog.array.indexOf('abcd', 'e'), -1);
-  assertEquals(goog.array.indexOf('abcd', 'cd'), -1);
-  assertEquals(goog.array.indexOf('0123', 1), -1);
-}
-
-function testArrayLastIndexOf() {
-  assertEquals(goog.array.lastIndexOf([0, 1, 2, 3], 1), 1);
-  assertEquals(goog.array.lastIndexOf([0, 1, 1, 1], 1), 3);
-  assertEquals(goog.array.lastIndexOf([0, 1, 1, 1], 1, 2), 2);
-}
-
-function testArrayLastIndexOfOmitsDeleted() {
-  var a = [0, 1, 2, 3];
-  delete a[1];
-  delete a[3];
-  assertEquals(goog.array.lastIndexOf(a, undefined), -1);
-}
-
-function testArrayLastIndexOfString() {
-  assertEquals(goog.array.lastIndexOf('abcd', 'b'), 1);
-  assertEquals(goog.array.lastIndexOf('abbb', 'b'), 3);
-  assertEquals(goog.array.lastIndexOf('abbb', 'b', 2), 2);
-  assertEquals(goog.array.lastIndexOf('abcd', 'cd'), -1);
-  assertEquals(goog.array.lastIndexOf('0123', 1), -1);
-}
-
-function testArrayForEachBasic() {
-  var s = '';
-  var a = ['a', 'b', 'c', 'd'];
-  goog.array.forEach(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('Index is not a number', 'number', typeof index);
-    s += val + index;
-  });
-  assertEquals('a0b1c2d3', s);
-}
-
-function testArrayForEachWithEmptyArray() {
-  var a = new Array(100);
-  goog.array.forEach(a, function(val, index, a2) {
-    fail('The function should not be called since no values were assigned.');
-  });
-}
-
-function testArrayForEachWithOnlySomeValuesAsigned() {
-  var count = 0;
-  var a = new Array(1000);
-  a[100] = undefined;
-  goog.array.forEach(a, function(val, index, a2) {
-    assertEquals(100, index);
-    count++;
-  });
-  assertEquals(
-      'Should only call function when a value of array was assigned.', 1,
-      count);
-}
-
-function testArrayForEachWithArrayLikeObject() {
-  var counter = goog.testing.recordFunction();
-  var a = {'length': 1, '0': 0, '100': 100, '101': 102};
-  goog.array.forEach(a, counter);
-  assertEquals(
-      'Number of calls should not exceed the value of its length', 1,
-      counter.getCallCount());
-}
-
-function testArrayForEachOmitsDeleted() {
-  var s = '';
-  var a = ['a', 'b', 'c', 'd'];
-  delete a[1];
-  delete a[3];
-  goog.array.forEach(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('number', typeof index);
-    s += val + index;
-  });
-  assertEquals('a0c2', s);
-}
-
-function testArrayForEachScope() {
-  var scope = {};
-  var a = ['a', 'b', 'c', 'd'];
-  goog.array.forEach(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('number', typeof index);
-    assertEquals(this, scope);
-  }, scope);
-}
-
-function testArrayForEachRight() {
-  var s = '';
-  var a = ['a', 'b', 'c', 'd'];
-  goog.array.forEachRight(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('number', typeof index);
-    s += val + String(index);
-  });
-  assertEquals('d3c2b1a0', s);
-}
-
-function testArrayForEachRightOmitsDeleted() {
-  var s = '';
-  var a = ['a', 'b', 'c', 'd'];
-  delete a[1];
-  delete a[3];
-  goog.array.forEachRight(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('number', typeof index);
-    assertEquals('string', typeof val);
-    s += val + String(index);
-  });
-  assertEquals('c2a0', s);
-}
-
-function testArrayFilter() {
-  var a = [0, 1, 2, 3];
-  a = goog.array.filter(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 1;
-  });
-  assertArrayEquals([2, 3], a);
-}
-
-function testArrayFilterOmitsDeleted() {
-  var a = [0, 1, 2, 3];
-  delete a[1];
-  delete a[3];
-  a = goog.array.filter(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('number', typeof val);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 1;
-  });
-  assertArrayEquals([2], a);
-}
-
-function testArrayFilterPreservesValues() {
-  var a = [0, 1, 2, 3];
-  a = goog.array.filter(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    // sometimes functions might be evil and do something like this, but we
-    // should still use the original values when returning the filtered array
-    a2[index] = a2[index] - 1;
-    return a2[index] >= 1;
-  });
-  assertArrayEquals([2, 3], a);
-}
-
-function testArrayMap() {
-  var a = [0, 1, 2, 3];
-  var result = goog.array.map(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val * val;
-  });
-  assertArrayEquals([0, 1, 4, 9], result);
-}
-
-function testArrayMapOmitsDeleted() {
-  var a = [0, 1, 2, 3];
-  delete a[1];
-  delete a[3];
-  var result = goog.array.map(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('number', typeof val);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val * val;
-  });
-  var expected = [0, 1, 4, 9];
-  delete expected[1];
-  delete expected[3];
-
-  assertArrayEquals(expected, result);
-  assertFalse('1' in result);
-  assertFalse('3' in result);
-}
-
-function testArrayReduce() {
-  var a = [0, 1, 2, 3];
-  assertEquals(6, goog.array.reduce(a, function(rval, val, i, arr) {
-    assertEquals('number', typeof i);
-    assertEquals(a, arr);
-    return rval + val;
-  }, 0));
-
-  var scope = {
-    last: 0,
-    testFn: function(r, v, i, arr) {
-      assertEquals('number', typeof i);
-      assertEquals(a, arr);
-      var l = this.last;
-      this.last = r + v;
-      return this.last + l;
-    }
-  };
-
-  assertEquals(10, goog.array.reduce(a, scope.testFn, 0, scope));
-}
-
-function testArrayReduceOmitDeleted() {
-  var a = [0, 1, 2, 3];
-  delete a[1];
-  delete a[3];
-  assertEquals(2, goog.array.reduce(a, function(rval, val, i, arr) {
-    assertEquals('number', typeof i);
-    assertEquals(a, arr);
-    return rval + val;
-  }, 0));
-
-  var scope = {
-    last: 0,
-    testFn: function(r, v, i, arr) {
-      assertEquals('number', typeof i);
-      assertEquals(a, arr);
-      var l = this.last;
-      this.last = r + v;
-      return this.last + l;
-    }
-  };
-
-  assertEquals(2, goog.array.reduce(a, scope.testFn, 0, scope));
-}
-
-function testArrayReduceRight() {
-  var a = [0, 1, 2, 3, 4];
-  assertEquals('43210', goog.array.reduceRight(a, function(rval, val, i, arr) {
-    assertEquals('number', typeof i);
-    assertEquals(a, arr);
-    return rval + val;
-  }, ''));
-
-  var scope = {
-    last: '',
-    testFn: function(r, v, i, arr) {
-      assertEquals('number', typeof i);
-      assertEquals(a, arr);
-      var l = this.last;
-      this.last = v;
-      return r + v + l;
-    }
-  };
-
-  a = ['a', 'b', 'c'];
-  assertEquals('_cbcab', goog.array.reduceRight(a, scope.testFn, '_', scope));
-}
-
-function testArrayReduceRightOmitsDeleted() {
-  var a = [0, 1, 2, 3, 4];
-  delete a[1];
-  delete a[4];
-  assertEquals('320', goog.array.reduceRight(a, function(rval, val, i, arr) {
-    assertEquals('number', typeof i);
-    assertEquals(a, arr);
-    return rval + val;
-  }, ''));
-
-  scope = {
-    last: '',
-    testFn: function(r, v, i, arr) {
-      assertEquals('number', typeof i);
-      assertEquals(a, arr);
-      var l = this.last;
-      this.last = v;
-      return r + v + l;
-    }
-  };
-
-  a = ['a', 'b', 'c', 'd'];
-  delete a[1];
-  delete a[3];
-  assertEquals('_cac', goog.array.reduceRight(a, scope.testFn, '_', scope));
-}
-
-function testArrayFind() {
-  var a = [0, 1, 2, 3];
-  var b = goog.array.find(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 1;
-  });
-  assertEquals(2, b);
-
-  b = goog.array.find(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 100;
-  });
-  assertNull(b);
-
-  a = 'abCD';
-  b = goog.array.find(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val >= 'A' && val <= 'Z';
-  });
-  assertEquals('C', b);
-
-  a = 'abcd';
-  b = goog.array.find(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val >= 'A' && val <= 'Z';
-  });
-  assertNull(b);
-}
-
-function testArrayFindOmitsDeleted() {
-  var a = [0, 1, 2, 3];
-  delete a[1];
-  delete a[3];
-  var b = goog.array.find(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 1;
-  });
-
-  assertEquals(2, b);
-  b = goog.array.find(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 100;
-  });
-  assertNull(b);
-}
-
-function testArrayFindIndex() {
-  var a = [0, 1, 2, 3];
-  var b = goog.array.findIndex(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 1;
-  });
-  assertEquals(2, b);
-
-  b = goog.array.findIndex(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 100;
-  });
-  assertEquals(-1, b);
-
-  a = 'abCD';
-  b = goog.array.findIndex(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val >= 'A' && val <= 'Z';
-  });
-  assertEquals(2, b);
-
-  a = 'abcd';
-  b = goog.array.findIndex(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val >= 'A' && val <= 'Z';
-  });
-  assertEquals(-1, b);
-}
-
-function testArrayFindIndexOmitsDeleted() {
-  var a = [0, 1, 2, 3];
-  delete a[1];
-  delete a[3];
-  var b = goog.array.findIndex(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 1;
-  });
-  assertEquals(2, b);
-
-  b = goog.array.findIndex(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 100;
-  });
-  assertEquals(-1, b);
-}
-
-function testArrayFindRight() {
-  var a = [0, 1, 2, 3];
-  var b = goog.array.findRight(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val < 3;
-  });
-  assertEquals(2, b);
-  b = goog.array.findRight(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 100;
-  });
-  assertNull(b);
-}
-
-function testArrayFindRightOmitsDeleted() {
-  var a = [0, 1, 2, 3];
-  delete a[1];
-  delete a[3];
-  var b = goog.array.findRight(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val < 3;
-  });
-  assertEquals(2, b);
-  b = goog.array.findRight(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 100;
-  });
-  assertNull(b);
-}
-
-function testArrayFindIndexRight() {
-  var a = [0, 1, 2, 3];
-  var b = goog.array.findIndexRight(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val < 3;
-  });
-  assertEquals(2, b);
-
-  b = goog.array.findIndexRight(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 100;
-  });
-  assertEquals(-1, b);
-
-  a = 'abCD';
-  b = goog.array.findIndexRight(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val >= 'a' && val <= 'z';
-  });
-  assertEquals(1, b);
-
-  a = 'abcd';
-  b = goog.array.findIndexRight(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val >= 'A' && val <= 'Z';
-  });
-  assertEquals(-1, b);
-}
-
-function testArrayFindIndexRightOmitsDeleted() {
-  var a = [0, 1, 2, 3];
-  delete a[1];
-  delete a[3];
-  var b = goog.array.findIndexRight(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val < 3;
-  });
-  assertEquals(2, b);
-  b = goog.array.findIndexRight(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 100;
-  });
-  assertEquals(-1, b);
-}
-
-function testArraySome() {
-  var a = [0, 1, 2, 3];
-  var b = goog.array.some(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 1;
-  });
-  assertTrue(b);
-  b = goog.array.some(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 100;
-  });
-  assertFalse(b);
-}
-
-function testArraySomeOmitsDeleted() {
-  var a = [0, 1, 2, 3];
-  delete a[1];
-  delete a[3];
-  var b = goog.array.some(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('number', typeof val);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 1;
-  });
-  assertTrue(b);
-  b = goog.array.some(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('number', typeof val);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 100;
-  });
-  assertFalse(b);
-}
-
-function testArrayEvery() {
-  var a = [0, 1, 2, 3];
-  var b = goog.array.every(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val >= 0;
-  });
-  assertTrue(b);
-  b = goog.array.every(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 1;
-  });
-  assertFalse(b);
-}
-
-function testArrayEveryOmitsDeleted() {
-  var a = [0, 1, 2, 3];
-  delete a[1];
-  delete a[3];
-  var b = goog.array.every(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('number', typeof val);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val >= 0;
-  });
-  assertTrue(b);
-  b = goog.array.every(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('number', typeof val);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 1;
-  });
-  assertFalse(b);
-}
-
-function testArrayCount() {
-  var a = [0, 1, 2, 3, 4];
-  var context = {};
-  assertEquals(3, goog.array.count(a, function(element, index, array) {
-    assertTrue(goog.isNumber(index));
-    assertEquals(a, array);
-    assertEquals(context, this);
-    return element % 2 == 0;
-  }, context));
-
-  delete a[2];
-  assertEquals('deleted element is ignored', 4, goog.array.count(a, function() {
-    return true;
-  }));
-}
-
-function testArrayContains() {
-  var a = [0, 1, 2, 3];
-  assertTrue('contain, Should contain 3', goog.array.contains(a, 3));
-  assertFalse('contain, Should not contain 4', goog.array.contains(a, 4));
-
-  var s = 'abcd';
-  assertTrue('contain, Should contain d', goog.array.contains(s, 'd'));
-  assertFalse('contain, Should not contain e', goog.array.contains(s, 'e'));
-}
-
-function testArrayContainsOmitsDeleted() {
-  var a = [0, 1, 2, 3];
-  delete a[1];
-  delete a[3];
-  assertFalse(
-      'should not contain undefined', goog.array.contains(a, undefined));
-}
-
-function testArrayInsert() {
-  var a = [0, 1, 2, 3];
-
-  goog.array.insert(a, 4);
-  assertEquals('insert, Should append 4', a[4], 4);
-  goog.array.insert(a, 3);
-  assertEquals('insert, Should not append 3', a.length, 5);
-  assertNotEquals('insert, Should not append 3', a[a.length - 1], 3);
-}
-
-function testArrayInsertAt() {
-  var a = [0, 1, 2, 3];
-
-  goog.array.insertAt(a, 4, 2);
-  assertArrayEquals('insertAt, insert in middle', [0, 1, 4, 2, 3], a);
-  goog.array.insertAt(a, 5, 10);
-  assertArrayEquals(
-      'insertAt, too large value should append', [0, 1, 4, 2, 3, 5], a);
-  goog.array.insertAt(a, 6);
-  assertArrayEquals(
-      'insertAt, null/undefined value should insert at 0',
-      [6, 0, 1, 4, 2, 3, 5], a);
-  goog.array.insertAt(a, 7, -2);
-  assertArrayEquals(
-      'insertAt, negative values start from end', [6, 0, 1, 4, 2, 7, 3, 5], a);
-}
-
-function testArrayInsertArrayAt() {
-  var a = [2, 5];
-  goog.array.insertArrayAt(a, [3, 4], 1);
-  assertArrayEquals('insertArrayAt, insert in middle', [2, 3, 4, 5], a);
-  goog.array.insertArrayAt(a, [0, 1], 0);
-  assertArrayEquals(
-      'insertArrayAt, insert at beginning', [0, 1, 2, 3, 4, 5], a);
-  goog.array.insertArrayAt(a, [6, 7], 6);
-  assertArrayEquals(
-      'insertArrayAt, insert at end', [0, 1, 2, 3, 4, 5, 6, 7], a);
-  goog.array.insertArrayAt(a, ['x'], 4);
-  assertArrayEquals(
-      'insertArrayAt, insert one element', [0, 1, 2, 3, 'x', 4, 5, 6, 7], a);
-  goog.array.insertArrayAt(a, [], 4);
-  assertArrayEquals(
-      'insertArrayAt, insert 0 elements', [0, 1, 2, 3, 'x', 4, 5, 6, 7], a);
-  goog.array.insertArrayAt(a, ['y', 'z']);
-  assertArrayEquals(
-      'insertArrayAt, undefined value should insert at 0',
-      ['y', 'z', 0, 1, 2, 3, 'x', 4, 5, 6, 7], a);
-  goog.array.insertArrayAt(a, ['a'], null);
-  assertArrayEquals(
-      'insertArrayAt, null value should insert at 0',
-      ['a', 'y', 'z', 0, 1, 2, 3, 'x', 4, 5, 6, 7], a);
-  goog.array.insertArrayAt(a, ['b'], 100);
-  assertArrayEquals(
-      'insertArrayAt, too large value should append',
-      ['a', 'y', 'z', 0, 1, 2, 3, 'x', 4, 5, 6, 7, 'b'], a);
-  goog.array.insertArrayAt(a, ['c', 'd'], -2);
-  assertArrayEquals(
-      'insertArrayAt, negative values start from end',
-      ['a', 'y', 'z', 0, 1, 2, 3, 'x', 4, 5, 6, 'c', 'd', 7, 'b'], a);
-}
-
-function testArrayInsertBefore() {
-  var a = ['a', 'b', 'c', 'd'];
-  goog.array.insertBefore(a, 'e', 'b');
-  assertArrayEquals(
-      'insertBefore, with existing element', ['a', 'e', 'b', 'c', 'd'], a);
-  goog.array.insertBefore(a, 'f', 'x');
-  assertArrayEquals(
-      'insertBefore, with non existing element', ['a', 'e', 'b', 'c', 'd', 'f'],
-      a);
-}
-
-function testArrayRemove() {
-  var a = ['a', 'b', 'c', 'd'];
-  goog.array.remove(a, 'c');
-  assertArrayEquals('remove, remove existing element', ['a', 'b', 'd'], a);
-  goog.array.remove(a, 'x');
-  assertArrayEquals('remove, remove non existing element', ['a', 'b', 'd'], a);
-}
-
-function testArrayRemoveLast() {
-  var a = ['c', 'a', 'b', 'c', 'd', 'a'];
-  goog.array.removeLast(a, 'c');
-  var temp = ['c', 'a', 'b', 'd', 'a'];
-  assertArrayEquals('remove, remove existing element', temp, a);
-  goog.array.removeLast(a, 'a');
-  temp = ['c', 'a', 'b', 'd'];
-  assertArrayEquals('remove, remove existing element', temp, a);
-  goog.array.removeLast(a, 'y');
-  temp = ['c', 'a', 'b', 'd'];
-  assertArrayEquals('remove, remove non existing element', temp, a);
-}
-
-function testArrayRemoveAt() {
-  var a = [0, 1, 2, 3];
-  goog.array.removeAt(a, 2);
-  assertArrayEquals('removeAt, remove existing index', [0, 1, 3], a);
-  a = [0, 1, 2, 3];
-  goog.array.removeAt(a, 10);
-  assertArrayEquals('removeAt, remove non existing index', [0, 1, 2, 3], a);
-  a = [0, 1, 2, 3];
-  goog.array.removeAt(a, -2);
-  assertArrayEquals('removeAt, remove with negative index', [0, 1, 3], a);
-}
-
-function testArrayRemoveIf() {
-  var a = [0, 1, 2, 3];
-  var b = goog.array.removeIf(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 1;
-  });
-  assertArrayEquals('removeIf, remove existing element', [0, 1, 3], a);
-
-  a = [0, 1, 2, 3];
-  var b = goog.array.removeIf(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals('index is not a number', 'number', typeof index);
-    return val > 100;
-  });
-  assertArrayEquals('removeIf, remove non-existing element', [0, 1, 2, 3], a);
-}
-
-function testArrayClone() {
-  var a = [0, 1, 2, 3];
-  var a2 = goog.array.clone(a);
-  assertArrayEquals('clone, should be equal', a, a2);
-
-  var b = {0: 0, 1: 1, 2: 2, 3: 3, length: 4};
-  var b2 = goog.array.clone(b);
-  for (var i = 0; i < b.length; i++) {
-    assertEquals('clone, should be equal', b[i], b2[i]);
-  }
-}
-
-function testToArray() {
-  var a = [0, 1, 2, 3];
-  var a2 = goog.array.toArray(a);
-  assertArrayEquals('toArray, should be equal', a, a2);
-
-  var b = {0: 0, 1: 1, 2: 2, 3: 3, length: 4};
-  var b2 = goog.array.toArray(b);
-  for (var i = 0; i < b.length; i++) {
-    assertEquals('toArray, should be equal', b[i], b2[i]);
-  }
-}
-
-function testToArrayOnNonArrayLike() {
-  var nonArrayLike = {};
-  assertArrayEquals(
-      'toArray on non ArrayLike should return an empty array', [],
-      goog.array.toArray(nonArrayLike));
-
-  var nonArrayLike2 = {length: 'hello world'};
-  assertArrayEquals(
-      'toArray on non ArrayLike should return an empty array', [],
-      goog.array.toArray(nonArrayLike2));
-}
-
-function testExtend() {
-  var a = [0, 1];
-  goog.array.extend(a, [2, 3]);
-  var a2 = [0, 1, 2, 3];
-  assertArrayEquals('extend, should be equal', a, a2);
-
-  var b = [0, 1];
-  goog.array.extend(b, 2);
-  var b2 = [0, 1, 2];
-  assertArrayEquals('extend, should be equal', b, b2);
-
-  a = [0, 1];
-  goog.array.extend(a, [2, 3], [4, 5]);
-  a2 = [0, 1, 2, 3, 4, 5];
-  assertArrayEquals('extend, should be equal', a, a2);
-
-  b = [0, 1];
-  goog.array.extend(b, 2, 3);
-  b2 = [0, 1, 2, 3];
-  assertArrayEquals('extend, should be equal', b, b2);
-
-  var c = [0, 1];
-  goog.array.extend(c, 2, [3, 4], 5, [6]);
-  var c2 = [0, 1, 2, 3, 4, 5, 6];
-  assertArrayEquals('extend, should be equal', c, c2);
-
-  var d = [0, 1];
-  var arrayLikeObject = {0: 2, 1: 3, length: 2};
-  goog.array.extend(d, arrayLikeObject);
-  var d2 = [0, 1, 2, 3];
-  assertArrayEquals('extend, should be equal', d, d2);
-
-  var e = [0, 1];
-  var emptyArrayLikeObject = {length: 0};
-  goog.array.extend(e, emptyArrayLikeObject);
-  assertArrayEquals('extend, should be equal', e, e);
-
-  var f = [0, 1];
-  var length3ArrayLikeObject = {0: 2, 1: 4, 2: 8, length: 3};
-  goog.array.extend(f, length3ArrayLikeObject, length3ArrayLikeObject);
-  var f2 = [0, 1, 2, 4, 8, 2, 4, 8];
-  assertArrayEquals('extend, should be equal', f2, f);
-
-  var result = [];
-  var i = 1000000;
-  var bigArray = Array(i);
-  while (i--) {
-    bigArray[i] = i;
-  }
-  goog.array.extend(result, bigArray);
-  assertArrayEquals(bigArray, result);
-}
-
-function testExtendWithArguments() {
-  function f() { return arguments; }
-  var a = [0];
-  var a2 = [0, 1, 2, 3, 4, 5];
-  goog.array.extend(a, f(1, 2, 3), f(4, 5));
-  assertArrayEquals('extend, should be equal', a, a2);
-}
-
-function testExtendWithQuerySelector() {
-  var a = [0];
-  var d = goog.dom.getElementsByTagNameAndClass(goog.dom.TagName.DIV, 'foo');
-  goog.array.extend(a, d);
-  assertEquals(2, a.length);
-}
-
-function testArraySplice() {
-  var a = [0, 1, 2, 3];
-  goog.array.splice(a, 1, 0, 4);
-  assertArrayEquals([0, 4, 1, 2, 3], a);
-  goog.array.splice(a, 1, 1, 5);
-  assertArrayEquals([0, 5, 1, 2, 3], a);
-  goog.array.splice(a, 1, 1);
-  assertArrayEquals([0, 1, 2, 3], a);
-  // var args
-  goog.array.splice(a, 1, 1, 4, 5, 6);
-  assertArrayEquals([0, 4, 5, 6, 2, 3], a);
-}
-
-function testArraySlice() {
-  var a = [0, 1, 2, 3];
-  a = goog.array.slice(a, 1, 3);
-  assertArrayEquals([1, 2], a);
-  a = [0, 1, 2, 3];
-  a = goog.array.slice(a, 1, 6);
-  assertArrayEquals('slice, with too large end', [1, 2, 3], a);
-  a = [0, 1, 2, 3];
-  a = goog.array.slice(a, 1, -1);
-  assertArrayEquals('slice, with negative end', [1, 2], a);
-  a = [0, 1, 2, 3];
-  a = goog.array.slice(a, -2, 3);
-  assertArrayEquals('slice, with negative start', [2], a);
-}
-
-function assertRemovedDuplicates(expected, original) {
-  var tempArr = goog.array.clone(original);
-  goog.array.removeDuplicates(tempArr);
-  assertArrayEquals(expected, tempArr);
-}
-
-function testRemoveDuplicates() {
-  assertRemovedDuplicates([1, 2, 3, 4, 5, 6], [1, 2, 3, 4, 5, 6]);
-  assertRemovedDuplicates(
-      [9, 4, 2, 1, 3, 6, 0, -9], [9, 4, 2, 4, 4, 2, 9, 1, 3, 6, 0, -9]);
-  assertRemovedDuplicates(
-      ['four', 'one', 'two', 'three', 'THREE'],
-      ['four', 'one', 'two', 'one', 'three', 'THREE', 'four', 'two']);
-  assertRemovedDuplicates([], []);
-  assertRemovedDuplicates(
-      ['abc', 'hasOwnProperty', 'toString'],
-      ['abc', 'hasOwnProperty', 'toString', 'abc']);
-
-  var o1 = {}, o2 = {}, o3 = {}, o4 = {};
-  assertRemovedDuplicates([o1, o2, o3, o4], [o1, o1, o2, o3, o2, o4]);
-
-  // Mixed object types.
-  assertRemovedDuplicates([1, '1', 2, '2'], [1, '1', 2, '2']);
-  assertRemovedDuplicates(
-      [true, 'true', false, 'false'], [true, 'true', false, 'false']);
-  assertRemovedDuplicates(['foo'], [String('foo'), 'foo']);
-  assertRemovedDuplicates([12], [Number(12), 12]);
-
-  var obj = {};
-  var uid = goog.getUid(obj);
-  assertRemovedDuplicates([obj, uid], [obj, uid]);
-}
-
-function testRemoveDuplicates_customHashFn() {
-  var object1 = {key: 'foo'};
-  var object2 = {key: 'bar'};
-  var dupeObject = {key: 'foo'};
-  var array = [object1, object2, dupeObject, 'bar'];
-  var hashFn = function(object) {
-    return goog.isObject(object) ? object.key :
-                                   (typeof object).charAt(0) + object;
-  };
-  goog.array.removeDuplicates(array, /* opt_rv */ undefined, hashFn);
-  assertArrayEquals([object1, object2, 'bar'], array);
-}
-
-function testBinaryInsertRemove() {
-  var makeChecker = function(array, fn, opt_compareFn) {
-    return function(value, expectResult, expectArray) {
-      var result = fn(array, value, opt_compareFn);
-      assertEquals(expectResult, result);
-      assertArrayEquals(expectArray, array);
-    }
-  };
-
-  var a = [];
-  var check = makeChecker(a, goog.array.binaryInsert);
-  check(3, true, [3]);
-  check(3, false, [3]);
-  check(1, true, [1, 3]);
-  check(5, true, [1, 3, 5]);
-  check(2, true, [1, 2, 3, 5]);
-  check(2, false, [1, 2, 3, 5]);
-
-  check = makeChecker(a, goog.array.binaryRemove);
-  check(0, false, [1, 2, 3, 5]);
-  check(3, true, [1, 2, 5]);
-  check(1, true, [2, 5]);
-  check(5, true, [2]);
-  check(2, true, []);
-  check(2, false, []);
-
-  // test with custom comparison function, which reverse orders numbers
-  var revNumCompare = function(a, b) { return b - a; };
-
-  check = makeChecker(a, goog.array.binaryInsert, revNumCompare);
-  check(3, true, [3]);
-  check(3, false, [3]);
-  check(1, true, [3, 1]);
-  check(5, true, [5, 3, 1]);
-  check(2, true, [5, 3, 2, 1]);
-  check(2, false, [5, 3, 2, 1]);
-
-  check = makeChecker(a, goog.array.binaryRemove, revNumCompare);
-  check(0, false, [5, 3, 2, 1]);
-  check(3, true, [5, 2, 1]);
-  check(1, true, [5, 2]);
-  check(5, true, [2]);
-  check(2, true, []);
-  check(2, false, []);
-}
-
-function testBinarySearch() {
-  var insertionPoint = function(position) { return -(position + 1) };
-  var pos;
-
-  // test default comparison on array of String(s)
-  var a = [
-    '1000',   '9',   'AB',   'ABC', 'ABCABC', 'ABD', 'ABDA', 'B',
-    'B',      'B',   'C',    'CA',  'CC',     'ZZZ', 'ab',   'abc',
-    'abcabc', 'abd', 'abda', 'b',   'c',      'ca',  'cc',   'zzz'
-  ];
-
-  assertEquals(
-      '\'1000\' should be found at index 0', 0,
-      goog.array.binarySearch(a, '1000'));
-  assertEquals(
-      '\'zzz\' should be found at index ' + (a.length - 1), a.length - 1,
-      goog.array.binarySearch(a, 'zzz'));
-  assertEquals(
-      '\'C\' should be found at index 10', 10, goog.array.binarySearch(a, 'C'));
-  pos = goog.array.binarySearch(a, 'B');
-  assertTrue(
-      '\'B\' should be found at index 7 || 8 || 9',
-      pos == 7 || pos == 8 || pos == 9);
-  pos = goog.array.binarySearch(a, '100');
-  assertTrue('\'100\' should not be found', pos < 0);
-  assertEquals(
-      '\'100\' should have an insertion point of 0', 0, insertionPoint(pos));
-  pos = goog.array.binarySearch(a, 'zzz0');
-  assertTrue('\'zzz0\' should not be found', pos < 0);
-  assertEquals(
-      '\'zzz0\' should have an insertion point of ' + (a.length), a.length,
-      insertionPoint(pos));
-  pos = goog.array.binarySearch(a, 'BA');
-  assertTrue('\'BA\' should not be found', pos < 0);
-  assertEquals(
-      '\'BA\' should have an insertion point of 10', 10, insertionPoint(pos));
-
-  // test 0 length array with default comparison
-  var b = [];
-
-  pos = goog.array.binarySearch(b, 'a');
-  assertTrue('\'a\' should not be found', pos < 0);
-  assertEquals(
-      '\'a\' should have an insertion point of 0', 0, insertionPoint(pos));
-
-  // test single element array with default lexiographical comparison
-  var c = ['only item'];
-
-  assertEquals(
-      '\'only item\' should be found at index 0', 0,
-      goog.array.binarySearch(c, 'only item'));
-  pos = goog.array.binarySearch(c, 'a');
-  assertTrue('\'a\' should not be found', pos < 0);
-  assertEquals(
-      '\'a\' should have an insertion point of 0', 0, insertionPoint(pos));
-  pos = goog.array.binarySearch(c, 'z');
-  assertTrue('\'z\' should not be found', pos < 0);
-  assertEquals(
-      '\'z\' should have an insertion point of 1', 1, insertionPoint(pos));
-
-  // test default comparison on array of Number(s)
-  var d = [
-    -897123.9, -321434.58758, -1321.3124, -324, -9, -3, 0, 0, 0, 0.31255, 5,
-    142.88888708, 334, 342, 453, 54254
-  ];
-
-  assertEquals(
-      '-897123.9 should be found at index 0', 0,
-      goog.array.binarySearch(d, -897123.9));
-  assertEquals(
-      '54254 should be found at index ' + (a.length - 1), d.length - 1,
-      goog.array.binarySearch(d, 54254));
-  assertEquals(
-      '-3 should be found at index 5', 5, goog.array.binarySearch(d, -3));
-  pos = goog.array.binarySearch(d, 0);
-  assertTrue(
-      '0 should be found at index 6 || 7 || 8',
-      pos == 6 || pos == 7 || pos == 8);
-  pos = goog.array.binarySearch(d, -900000);
-  assertTrue('-900000 should not be found', pos < 0);
-  assertEquals(
-      '-900000 should have an insertion point of 0', 0, insertionPoint(pos));
-  pos = goog.array.binarySearch(d, 54255);
-  assertTrue('54255 should not be found', pos < 0);
-  assertEquals(
-      '54255 should have an insertion point of ' + (d.length), d.length,
-      insertionPoint(pos));
-  pos = goog.array.binarySearch(d, 1.1);
-  assertTrue('1.1 should not be found', pos < 0);
-  assertEquals(
-      '1.1 should have an insertion point of 10', 10, insertionPoint(pos));
-
-  // test with custom comparison function, which reverse orders numbers
-  var revNumCompare = function(a, b) { return b - a; };
-
-  var e = [
-    54254, 453, 342, 334, 142.88888708, 5, 0.31255, 0, 0, 0, -3, -9, -324,
-    -1321.3124, -321434.58758, -897123.9
-  ];
-
-  assertEquals(
-      '54254 should be found at index 0', 0,
-      goog.array.binarySearch(e, 54254, revNumCompare));
-  assertEquals(
-      '-897123.9 should be found at index ' + (e.length - 1), e.length - 1,
-      goog.array.binarySearch(e, -897123.9, revNumCompare));
-  assertEquals(
-      '-3 should be found at index 10', 10,
-      goog.array.binarySearch(e, -3, revNumCompare));
-  pos = goog.array.binarySearch(e, 0, revNumCompare);
-  assertTrue(
-      '0 should be found at index 7 || 8 || 9',
-      pos == 7 || pos == 8 || pos == 9);
-  pos = goog.array.binarySearch(e, 54254.1, revNumCompare);
-  assertTrue('54254.1 should not be found', pos < 0);
-  assertEquals(
-      '54254.1 should have an insertion point of 0', 0, insertionPoint(pos));
-  pos = goog.array.binarySearch(e, -897124, revNumCompare);
-  assertTrue('-897124 should not be found', pos < 0);
-  assertEquals(
-      '-897124 should have an insertion point of ' + (e.length), e.length,
-      insertionPoint(pos));
-  pos = goog.array.binarySearch(e, 1.1, revNumCompare);
-  assertTrue('1.1 should not be found', pos < 0);
-  assertEquals(
-      '1.1 should have an insertion point of 6', 6, insertionPoint(pos));
-
-  // test 0 length array with custom comparison function
-  var f = [];
-
-  pos = goog.array.binarySearch(f, 0, revNumCompare);
-  assertTrue('0 should not be found', pos < 0);
-  assertEquals('0 should have an insertion point of 0', 0, insertionPoint(pos));
-
-  // test single element array with custom comparison function
-  var g = [1];
-
-  assertEquals(
-      '1 should be found at index 0', 0,
-      goog.array.binarySearch(g, 1, revNumCompare));
-  pos = goog.array.binarySearch(g, 2, revNumCompare);
-  assertTrue('2 should not be found', pos < 0);
-  assertEquals('2 should have an insertion point of 0', 0, insertionPoint(pos));
-  pos = goog.array.binarySearch(g, 0, revNumCompare);
-  assertTrue('0 should not be found', pos < 0);
-  assertEquals('0 should have an insertion point of 1', 1, insertionPoint(pos));
-
-  assertEquals(
-      'binarySearch should find the index of the first 0', 0,
-      goog.array.binarySearch([0, 0, 1], 0));
-  assertEquals(
-      'binarySearch should find the index of the first 1', 1,
-      goog.array.binarySearch([0, 1, 1], 1));
-}
-
-
-function testBinarySearchPerformance() {
-  // Ensure that Array#slice, Function#apply and Function#call are not called
-  // from within binarySearch, since they have performance implications in IE.
-
-  var propertyReplacer = new goog.testing.PropertyReplacer();
-  propertyReplacer.replace(Array.prototype, 'slice', function() {
-    fail('Should not call Array#slice from binary search.');
-  });
-  propertyReplacer.replace(Function.prototype, 'apply', function() {
-    fail('Should not call Function#apply from binary search.');
-  });
-  propertyReplacer.replace(Function.prototype, 'call', function() {
-    fail('Should not call Function#call from binary search.');
-  });
-
-  try {
-    var array = [1, 5, 7, 11, 13, 16, 19, 24, 28, 31, 33, 36, 40, 50, 52, 55];
-    // Test with the default comparison function.
-    goog.array.binarySearch(array, 48);
-    // Test with a custom comparison function.
-    goog.array.binarySearch(
-        array, 13, function(a, b) { return a > b ? 1 : a < b ? -1 : 0; });
-  } finally {
-    // The test runner uses Function.prototype.apply to call tearDown in the
-    // global context so it has to be reset here.
-    propertyReplacer.reset();
-  }
-}
-
-
-function testBinarySelect() {
-  var insertionPoint = function(position) { return -(position + 1) };
-  var numbers = [
-    -897123.9, -321434.58758, -1321.3124, -324, -9, -3, 0, 0, 0, 0.31255, 5,
-    142.88888708, 334, 342, 453, 54254
-  ];
-  var objects = goog.array.map(numbers, function(n) { return {n: n}; });
-  function makeEvaluator(target) {
-    return function(obj, i, arr) {
-      assertEquals(objects, arr);
-      assertEquals(obj, arr[i]);
-      return target - obj.n;
-    };
-  }
-  assertEquals(
-      '{n:-897123.9} should be found at index 0', 0,
-      goog.array.binarySelect(objects, makeEvaluator(-897123.9)));
-  assertEquals(
-      '{n:54254} should be found at index ' + (objects.length - 1),
-      objects.length - 1,
-      goog.array.binarySelect(objects, makeEvaluator(54254)));
-  assertEquals(
-      '{n:-3} should be found at index 5', 5,
-      goog.array.binarySelect(objects, makeEvaluator(-3)));
-  pos = goog.array.binarySelect(objects, makeEvaluator(0));
-  assertTrue(
-      '{n:0} should be found at index 6 || 7 || 8',
-      pos == 6 || pos == 7 || pos == 8);
-  pos = goog.array.binarySelect(objects, makeEvaluator(-900000));
-  assertTrue('{n:-900000} should not be found', pos < 0);
-  assertEquals(
-      '{n:-900000} should have an insertion point of 0', 0,
-      insertionPoint(pos));
-  pos = goog.array.binarySelect(objects, makeEvaluator('54255'));
-  assertTrue('{n:54255} should not be found', pos < 0);
-  assertEquals(
-      '{n:54255} should have an insertion point of ' + (objects.length),
-      objects.length, insertionPoint(pos));
-  pos = goog.array.binarySelect(objects, makeEvaluator(1.1));
-  assertTrue('{n:1.1} should not be found', pos < 0);
-  assertEquals(
-      '{n:1.1} should have an insertion point of 10', 10, insertionPoint(pos));
-}
-
-
-function testArrayEquals() {
-  // Test argument types.
-  assertFalse('array == not array', goog.array.equals([], null));
-  assertFalse('not array == array', goog.array.equals(null, []));
-  assertFalse('not array == not array', goog.array.equals(null, null));
-
-  // Test with default comparison function.
-  assertTrue('[] == []', goog.array.equals([], []));
-  assertTrue('[1] == [1]', goog.array.equals([1], [1]));
-  assertTrue('["1"] == ["1"]', goog.array.equals(['1'], ['1']));
-  assertFalse('[1] == ["1"]', goog.array.equals([1], ['1']));
-  assertTrue('[null] == [null]', goog.array.equals([null], [null]));
-  assertFalse('[null] == [undefined]', goog.array.equals([null], [undefined]));
-  assertTrue('[1, 2] == [1, 2]', goog.array.equals([1, 2], [1, 2]));
-  assertFalse('[1, 2] == [2, 1]', goog.array.equals([1, 2], [2, 1]));
-  assertFalse('[1, 2] == [1]', goog.array.equals([1, 2], [1]));
-  assertFalse('[1] == [1, 2]', goog.array.equals([1], [1, 2]));
-  assertFalse('[{}] == [{}]', goog.array.equals([{}], [{}]));
-
-  // Test with custom comparison function.
-  var cmp = function(a, b) { return typeof a == typeof b; };
-  assertTrue('[] cmp []', goog.array.equals([], [], cmp));
-  assertTrue('[1] cmp [1]', goog.array.equals([1], [1], cmp));
-  assertTrue('[1] cmp [2]', goog.array.equals([1], [2], cmp));
-  assertTrue('["1"] cmp ["1"]', goog.array.equals(['1'], ['1'], cmp));
-  assertTrue('["1"] cmp ["2"]', goog.array.equals(['1'], ['2'], cmp));
-  assertFalse('[1] cmp ["1"]', goog.array.equals([1], ['1'], cmp));
-  assertTrue('[1, 2] cmp [3, 4]', goog.array.equals([1, 2], [3, 4], cmp));
-  assertFalse('[1] cmp [2, 3]', goog.array.equals([1], [2, 3], cmp));
-  assertTrue('[{}] cmp [{}]', goog.array.equals([{}], [{}], cmp));
-  assertTrue('[{}] cmp [{a: 1}]', goog.array.equals([{}], [{a: 1}], cmp));
-
-  // Test with array-like objects.
-  assertTrue('[5] == obj [5]', goog.array.equals([5], {0: 5, length: 1}));
-  assertTrue('obj [5] == [5]', goog.array.equals({0: 5, length: 1}, [5]));
-  assertTrue(
-      '["x"] == obj ["x"]', goog.array.equals(['x'], {0: 'x', length: 1}));
-  assertTrue(
-      'obj ["x"] == ["x"]', goog.array.equals({0: 'x', length: 1}, ['x']));
-  assertTrue(
-      '[5] == {0: 5, 1: 6, length: 1}',
-      goog.array.equals([5], {0: 5, 1: 6, length: 1}));
-  assertTrue(
-      '{0: 5, 1: 6, length: 1} == [5]',
-      goog.array.equals({0: 5, 1: 6, length: 1}, [5]));
-  assertFalse(
-      '[5, 6] == {0: 5, 1: 6, length: 1}',
-      goog.array.equals([5, 6], {0: 5, 1: 6, length: 1}));
-  assertFalse(
-      '{0: 5, 1: 6, length: 1}, [5, 6]',
-      goog.array.equals({0: 5, 1: 6, length: 1}, [5, 6]));
-  assertTrue(
-      '[5, 6] == obj [5, 6]',
-      goog.array.equals([5, 6], {0: 5, 1: 6, length: 2}));
-  assertTrue(
-      'obj [5, 6] == [5, 6]',
-      goog.array.equals({0: 5, 1: 6, length: 2}, [5, 6]));
-  assertFalse(
-      '{0: 5, 1: 6} == [5, 6]', goog.array.equals({0: 5, 1: 6}, [5, 6]));
-}
-
-
-function testArrayCompare3Basic() {
-  assertEquals(0, goog.array.compare3([], []));
-  assertEquals(0, goog.array.compare3(['111', '222'], ['111', '222']));
-  assertEquals(-1, goog.array.compare3(['111', '222'], ['1111', '']));
-  assertEquals(1, goog.array.compare3(['111', '222'], ['111']));
-  assertEquals(1, goog.array.compare3(['11', '222', '333'], []));
-  assertEquals(-1, goog.array.compare3([], ['11', '222', '333']));
-}
-
-
-function testArrayCompare3ComparatorFn() {
-  function cmp(a, b) { return a - b; };
-  assertEquals(0, goog.array.compare3([], [], cmp));
-  assertEquals(0, goog.array.compare3([8, 4], [8, 4], cmp));
-  assertEquals(-1, goog.array.compare3([4, 3], [5, 0]));
-  assertEquals(1, goog.array.compare3([6, 2], [6]));
-  assertEquals(1, goog.array.compare3([1, 2, 3], []));
-  assertEquals(-1, goog.array.compare3([], [1, 2, 3]));
-}
-
-
-function testSort() {
-  // Test sorting empty array
-  var a = [];
-  goog.array.sort(a);
-  assertEquals(
-      'Sorted empty array is still an empty array (length 0)', 0, a.length);
-
-  // Test sorting homogenous array of String(s) of length > 1
-  var b = [
-    'JUST', '1', 'test', 'Array', 'to', 'test', 'array', 'Sort', 'about', 'NOW',
-    '!!'
-  ];
-  var bSorted = [
-    '!!', '1', 'Array', 'JUST', 'NOW', 'Sort', 'about', 'array', 'test', 'test',
-    'to'
-  ];
-  goog.array.sort(b);
-  assertArrayEquals(bSorted, b);
-
-  // Test sorting already sorted array of String(s) of length > 1
-  goog.array.sort(b);
-  assertArrayEquals(bSorted, b);
-
-  // Test sorting homogenous array of integer Number(s) of length > 1
-  var c = [
-    100, 1, 2000, -1, 0, 1000023, 12312512, -12331, 123, 54325, -38104783,
-    93708, 908, -213, -4, 5423, 0
-  ];
-  var cSorted = [
-    -38104783, -12331, -213, -4, -1, 0, 0, 1, 100, 123, 908, 2000, 5423, 54325,
-    93708, 1000023, 12312512
-  ];
-  goog.array.sort(c);
-  assertArrayEquals(cSorted, c);
-
-  // Test sorting already sorted array of integer Number(s) of length > 1
-  goog.array.sort(c);
-  assertArrayEquals(cSorted, c);
-
-  // Test sorting homogenous array of Number(s) of length > 1
-  var e = [
-    -1321.3124, 0.31255, 54254, 0, 142.88888708, -321434.58758, -324, 453, 334,
-    -3, 5, -9, 342, -897123.9
-  ];
-  var eSorted = [
-    -897123.9, -321434.58758, -1321.3124, -324, -9, -3, 0, 0.31255, 5,
-    142.88888708, 334, 342, 453, 54254
-  ];
-  goog.array.sort(e);
-  assertArrayEquals(eSorted, e);
-
-  // Test sorting already sorted array of Number(s) of length > 1
-  goog.array.sort(e);
-  assertArrayEquals(eSorted, e);
-
-  // Test sorting array of Number(s) of length > 1,
-  // using custom comparison function which does reverse ordering
-  var f = [
-    -1321.3124, 0.31255, 54254, 0, 142.88888708, -321434.58758, -324, 453, 334,
-    -3, 5, -9, 342, -897123.9
-  ];
-  var fSorted = [
-    54254, 453, 342, 334, 142.88888708, 5, 0.31255, 0, -3, -9, -324, -1321.3124,
-    -321434.58758, -897123.9
-  ];
-  goog.array.sort(f, function(a, b) { return b - a; });
-  assertArrayEquals(fSorted, f);
-
-  // Test sorting already sorted array of Number(s) of length > 1
-  // using custom comparison function which does reverse ordering
-  goog.array.sort(f, function(a, b) { return b - a; });
-  assertArrayEquals(fSorted, f);
-
-  // Test sorting array of custom Object(s) of length > 1 that have
-  // an overriden toString
-  function ComparedObject(value) { this.value = value; };
-
-  ComparedObject.prototype.toString = function() { return this.value; };
-
-  var co1 = new ComparedObject('a');
-  var co2 = new ComparedObject('b');
-  var co3 = new ComparedObject('c');
-  var co4 = new ComparedObject('d');
-
-  var g = [co3, co4, co2, co1];
-  var gSorted = [co1, co2, co3, co4];
-  goog.array.sort(g);
-  assertArrayEquals(gSorted, g);
-
-  // Test sorting already sorted array of custom Object(s) of length > 1
-  // that have an overriden toString
-  goog.array.sort(g);
-  assertArrayEquals(gSorted, g);
-
-  // Test sorting an array of custom Object(s) of length > 1 using
-  // a custom comparison function
-  var h = [co4, co2, co1, co3];
-  var hSorted = [co1, co2, co3, co4];
-  goog.array.sort(h, function(a, b) {
-    return a.value > b.value ? 1 : a.value < b.value ? -1 : 0;
-  });
-  assertArrayEquals(hSorted, h);
-
-  // Test sorting already sorted array of custom Object(s) of length > 1
-  // using a custom comparison function
-  goog.array.sort(h);
-  assertArrayEquals(hSorted, h);
-
-  // Test sorting arrays of length 1
-  var i = ['one'];
-  var iSorted = ['one'];
-  goog.array.sort(i);
-  assertArrayEquals(iSorted, i);
-
-  var j = [1];
-  var jSorted = [1];
-  goog.array.sort(j);
-  assertArrayEquals(jSorted, j);
-
-  var k = [1.1];
-  var kSorted = [1.1];
-  goog.array.sort(k);
-  assertArrayEquals(kSorted, k);
-
-  var l = [co3];
-  var lSorted = [co3];
-  goog.array.sort(l);
-  assertArrayEquals(lSorted, l);
-
-  var m = [co2];
-  var mSorted = [co2];
-  goog.array.sort(m, function(a, b) {
-    return a.value > b.value ? 1 : a.value < b.value ? -1 : 0;
-  });
-  assertArrayEquals(mSorted, m);
-}
-
-function testStableSort() {
-  // Test array with custom comparison function
-  var arr = [
-    {key: 3, val: 'a'}, {key: 2, val: 'b'}, {key: 3, val: 'c'},
-    {key: 4, val: 'd'}, {key: 3, val: 'e'}
-  ];
-  var arrClone = goog.array.clone(arr);
-
-  function comparisonFn(obj1, obj2) { return obj1.key - obj2.key; }
-  goog.array.stableSort(arr, comparisonFn);
-  var sortedValues = [];
-  for (var i = 0; i < arr.length; i++) {
-    sortedValues.push(arr[i].val);
-  }
-  var wantedSortedValues = ['b', 'a', 'c', 'e', 'd'];
-  assertArrayEquals(wantedSortedValues, sortedValues);
-
-  // Test array without custom comparison function
-  var arr2 = [];
-  for (var i = 0; i < arrClone.length; i++) {
-    arr2.push({
-      val: arrClone[i].val,
-      toString: goog.partial(function(index) { return arrClone[index].key; }, i)
-    });
-  }
-  goog.array.stableSort(arr2);
-  var sortedValues2 = [];
-  for (var i = 0; i < arr2.length; i++) {
-    sortedValues2.push(arr2[i].val);
-  }
-  assertArrayEquals(wantedSortedValues, sortedValues2);
-}
-
-function testSortByKey() {
-  function Item(value) {
-    this.getValue = function() { return value; };
-  }
-  var keyFn = function(item) { return item.getValue(); };
-
-  // Test without custom key comparison function
-  var arr1 = [new Item(3), new Item(2), new Item(1), new Item(5), new Item(4)];
-  goog.array.sortByKey(arr1, keyFn);
-  var wantedSortedValues1 = [1, 2, 3, 4, 5];
-  for (var i = 0; i < arr1.length; i++) {
-    assertEquals(wantedSortedValues1[i], arr1[i].getValue());
-  }
-
-  // Test with custom key comparison function
-  var arr2 = [new Item(3), new Item(2), new Item(1), new Item(5), new Item(4)];
-  function comparisonFn(key1, key2) { return -(key1 - key2); }
-  goog.array.sortByKey(arr2, keyFn, comparisonFn);
-  var wantedSortedValues2 = [5, 4, 3, 2, 1];
-  for (var i = 0; i < arr2.length; i++) {
-    assertEquals(wantedSortedValues2[i], arr2[i].getValue());
-  }
-}
-
-function testArrayBucketModulus() {
-  // bucket things by modulus
-  var a = {};
-  var b = [];
-
-  function modFive(num) { return num % 5; }
-
-  for (var i = 0; i < 20; i++) {
-    var mod = modFive(i);
-    a[mod] = a[mod] || [];
-    a[mod].push(i);
-    b.push(i);
-  }
-
-  var buckets = goog.array.bucket(b, modFive);
-
-  for (var i = 0; i < 5; i++) {
-    // The order isn't defined, but they should be the same sorted.
-    goog.array.sort(a[i]);
-    goog.array.sort(buckets[i]);
-    assertArrayEquals(a[i], buckets[i]);
-  }
-}
-
-function testArrayBucketEvenOdd() {
-  var a = [1, 2, 3, 4, 5, 6, 7, 8, 9];
-
-  // test even/odd
-  function isEven(value, index, array) {
-    assertEquals(value, array[index]);
-    assertEquals('number', typeof index);
-    assertEquals(a, array);
-    return value % 2 == 0;
-  }
-
-  var b = goog.array.bucket(a, isEven);
-
-  assertArrayEquals(b[true], [2, 4, 6, 8]);
-  assertArrayEquals(b[false], [1, 3, 5, 7, 9]);
-}
-
-function testArrayBucketUsingThisObject() {
-  var a = [1, 2, 3, 4, 5];
-
-  var obj = {specialValue: 2};
-
-  function isSpecialValue(value, index, array) {
-    return value == this.specialValue ? 1 : 0;
-  }
-
-  var b = goog.array.bucket(a, isSpecialValue, obj);
-  assertArrayEquals(b[0], [1, 3, 4, 5]);
-  assertArrayEquals(b[1], [2]);
-}
-
-function testArrayToObject() {
-  var a = [{name: 'a'}, {name: 'b'}, {name: 'c'}, {name: 'd'}];
-
-  function getName(value, index, array) {
-    assertEquals(value, array[index]);
-    assertEquals('number', typeof index);
-    assertEquals(a, array);
-    return value.name;
-  }
-
-  var b = goog.array.toObject(a, getName);
-
-  for (var i = 0; i < a.length; i++) {
-    assertEquals(a[i], b[a[i].name]);
-  }
-}
-
-function testRange() {
-  assertArrayEquals([], goog.array.range(0));
-  assertArrayEquals([], goog.array.range(5, 5, 5));
-  assertArrayEquals([], goog.array.range(-3, -3));
-  assertArrayEquals([], goog.array.range(10, undefined, -1));
-  assertArrayEquals([], goog.array.range(8, 0));
-  assertArrayEquals([], goog.array.range(-5, -10, 3));
-
-  assertArrayEquals([0], goog.array.range(1));
-  assertArrayEquals([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], goog.array.range(10));
-
-  assertArrayEquals([1], goog.array.range(1, 2));
-  assertArrayEquals([-3, -2, -1, 0, 1, 2], goog.array.range(-3, 3));
-
-  assertArrayEquals([4], goog.array.range(4, 40, 400));
-  assertArrayEquals([5, 8, 11, 14], goog.array.range(5, 15, 3));
-  assertArrayEquals([1, -1, -3], goog.array.range(1, -5, -2));
-  assertElementsRoughlyEqual([.2, .3, .4], goog.array.range(.2, .5, .1), 0.001);
-
-  assertArrayEquals([0], goog.array.range(7, undefined, 9));
-  assertArrayEquals([0, 2, 4, 6], goog.array.range(8, undefined, 2));
-}
-
-function testArrayRepeat() {
-  assertArrayEquals([], goog.array.repeat(3, 0));
-  assertArrayEquals([], goog.array.repeat(3, -1));
-  assertArrayEquals([3], goog.array.repeat(3, 1));
-  assertArrayEquals([3, 3, 3], goog.array.repeat(3, 3));
-  assertArrayEquals([null, null], goog.array.repeat(null, 2));
-}
-
-function testArrayFlatten() {
-  assertArrayEquals([1, 2, 3, 4, 5], goog.array.flatten(1, 2, 3, 4, 5));
-  assertArrayEquals([1, 2, 3, 4, 5], goog.array.flatten(1, [2, [3, [4, 5]]]));
-  assertArrayEquals([1, 2, 3, 4], goog.array.flatten(1, [2, [3, [4]]]));
-  assertArrayEquals([1, 2, 3, 4], goog.array.flatten([[[1], 2], 3], 4));
-  assertArrayEquals([1], goog.array.flatten([[1]]));
-  assertArrayEquals([], goog.array.flatten());
-  assertArrayEquals([], goog.array.flatten([]));
-  assertArrayEquals(
-      goog.array.repeat(3, 180002),
-      goog.array.flatten(3, goog.array.repeat(3, 180000), 3));
-  assertArrayEquals(
-      goog.array.repeat(3, 180000),
-      goog.array.flatten([goog.array.repeat(3, 180000)]));
-}
-
-function testSortObjectsByKey() {
-  var sortedArray = buildSortedObjectArray(4);
-  var objects =
-      [sortedArray[1], sortedArray[2], sortedArray[0], sortedArray[3]];
-
-  goog.array.sortObjectsByKey(objects, 'name');
-  validateObjectArray(sortedArray, objects);
-}
-
-function testSortObjectsByKeyWithCompareFunction() {
-  var sortedArray = buildSortedObjectArray(4);
-  var objects =
-      [sortedArray[1], sortedArray[2], sortedArray[0], sortedArray[3]];
-  var descSortedArray =
-      [sortedArray[3], sortedArray[2], sortedArray[1], sortedArray[0]];
-
-  function descCompare(a, b) { return a < b ? 1 : a > b ? -1 : 0; };
-
-  goog.array.sortObjectsByKey(objects, 'name', descCompare);
-  validateObjectArray(descSortedArray, objects);
-}
-
-function buildSortedObjectArray(size) {
-  var objectArray = [];
-  for (var i = 0; i < size; i++) {
-    objectArray.push({'name': 'name_' + i, 'id': 'id_' + (size - i)});
-  }
-
-  return objectArray;
-}
-
-function validateObjectArray(expected, actual) {
-  assertEquals(expected.length, actual.length);
-  for (var i = 0; i < expected.length; i++) {
-    assertEquals(expected[i].name, actual[i].name);
-    assertEquals(expected[i].id, actual[i].id);
-  }
-}
-
-function testIsSorted() {
-  assertTrue(goog.array.isSorted([1, 2, 3]));
-  assertTrue(goog.array.isSorted([1, 2, 2]));
-  assertFalse(goog.array.isSorted([1, 2, 1]));
-
-  assertTrue(goog.array.isSorted([1, 2, 3], null, true));
-  assertFalse(goog.array.isSorted([1, 2, 2], null, true));
-  assertFalse(goog.array.isSorted([1, 2, 1], null, true));
-
-  function compare(a, b) { return b - a; }
-
-  assertFalse(goog.array.isSorted([1, 2, 3], compare));
-  assertTrue(goog.array.isSorted([3, 2, 2], compare));
-}
-
-function assertRotated(expect, array, rotate) {
-  assertArrayEquals(expect, goog.array.rotate(array, rotate));
-}
-
-function testRotate() {
-  assertRotated([], [], 3);
-  assertRotated([1], [1], 3);
-  assertRotated([1, 2, 3, 4, 0], [0, 1, 2, 3, 4], -6);
-  assertRotated([0, 1, 2, 3, 4], [0, 1, 2, 3, 4], -5);
-  assertRotated([4, 0, 1, 2, 3], [0, 1, 2, 3, 4], -4);
-  assertRotated([3, 4, 0, 1, 2], [0, 1, 2, 3, 4], -3);
-  assertRotated([2, 3, 4, 0, 1], [0, 1, 2, 3, 4], -2);
-  assertRotated([1, 2, 3, 4, 0], [0, 1, 2, 3, 4], -1);
-  assertRotated([0, 1, 2, 3, 4], [0, 1, 2, 3, 4], 0);
-  assertRotated([4, 0, 1, 2, 3], [0, 1, 2, 3, 4], 1);
-  assertRotated([3, 4, 0, 1, 2], [0, 1, 2, 3, 4], 2);
-  assertRotated([2, 3, 4, 0, 1], [0, 1, 2, 3, 4], 3);
-  assertRotated([1, 2, 3, 4, 0], [0, 1, 2, 3, 4], 4);
-  assertRotated([0, 1, 2, 3, 4], [0, 1, 2, 3, 4], 5);
-  assertRotated([4, 0, 1, 2, 3], [0, 1, 2, 3, 4], 6);
-}
-
-function testMoveItemWithArray() {
-  var arr = [0, 1, 2, 3];
-  goog.array.moveItem(arr, 1, 3);  // toIndex > fromIndex
-  assertArrayEquals([0, 2, 3, 1], arr);
-  goog.array.moveItem(arr, 2, 0);  // toIndex < fromIndex
-  assertArrayEquals([3, 0, 2, 1], arr);
-  goog.array.moveItem(arr, 1, 1);  // toIndex == fromIndex
-  assertArrayEquals([3, 0, 2, 1], arr);
-  // Out-of-bounds indexes throw assertion errors.
-  assertThrows(function() { goog.array.moveItem(arr, -1, 1); });
-  assertThrows(function() { goog.array.moveItem(arr, 4, 1); });
-  assertThrows(function() { goog.array.moveItem(arr, 1, -1); });
-  assertThrows(function() { goog.array.moveItem(arr, 1, 4); });
-  // The array should not be modified by the out-of-bound calls.
-  assertArrayEquals([3, 0, 2, 1], arr);
-}
-
-function testMoveItemWithArgumentsObject() {
-  var f = function() {
-    goog.array.moveItem(arguments, 0, 1);
-    return arguments;
-  };
-  assertArrayEquals([1, 0], goog.array.toArray(f(0, 1)));
-}
-
-function testConcat() {
-  var a1 = [1, 2, 3];
-  var a2 = [4, 5, 6];
-  var a3 = goog.array.concat(a1, a2);
-  a1.push(1);
-  a2.push(5);
-  assertArrayEquals([1, 2, 3, 4, 5, 6], a3);
-}
-
-function testConcatWithNoSecondArg() {
-  var a1 = [1, 2, 3, 4];
-  var a2 = goog.array.concat(a1);
-  a1.push(5);
-  assertArrayEquals([1, 2, 3, 4], a2);
-}
-
-function testConcatWithNonArrayArgs() {
-  var a1 = [1, 2, 3, 4];
-  var o = {0: 'a', 1: 'b', length: 2};
-  var a2 = goog.array.concat(a1, 5, '10', o);
-  assertArrayEquals([1, 2, 3, 4, 5, '10', o], a2);
-}
-
-function testConcatWithNull() {
-  var a1 = goog.array.concat(null, [1, 2, 3]);
-  var a2 = goog.array.concat([1, 2, 3], null);
-  assertArrayEquals([null, 1, 2, 3], a1);
-  assertArrayEquals([1, 2, 3, null], a2);
-}
-
-function testZip() {
-  var a1 = goog.array.zip([1, 2, 3], [3, 2, 1]);
-  var a2 = goog.array.zip([1, 2], [3, 2, 1]);
-  var a3 = goog.array.zip();
-  assertArrayEquals([[1, 3], [2, 2], [3, 1]], a1);
-  assertArrayEquals([[1, 3], [2, 2]], a2);
-  assertArrayEquals([], a3);
-}
-
-function testShuffle() {
-  // Test array. This array should have unique values for the purposes of this
-  // test case.
-  var testArray = [1, 2, 3, 4, 5];
-  var testArrayCopy = goog.array.clone(testArray);
-
-  // Custom random function, which always returns a value approaching 1,
-  // resulting in a "shuffle" that preserves the order of original array
-  // (for array sizes that we work with here).
-  var noChangeShuffleFunction = function() { return .999999; };
-  goog.array.shuffle(testArray, noChangeShuffleFunction);
-  assertArrayEquals(testArrayCopy, testArray);
-
-  // Custom random function, which always returns 0, resulting in a
-  // deterministic "shuffle" that is predictable but differs from the
-  // original order of the array.
-  var testShuffleFunction = function() { return 0; };
-  goog.array.shuffle(testArray, testShuffleFunction);
-  assertArrayEquals([2, 3, 4, 5, 1], testArray);
-
-  // Test the use of a real random function(no optional RNG is specified).
-  goog.array.shuffle(testArray);
-
-  // Ensure the shuffled array comprises the same elements (without regard to
-  // order).
-  assertSameElements(testArrayCopy, testArray);
-}
-
-function testRemoveAllIf() {
-  var testArray = [9, 1, 9, 2, 9, 3, 4, 9, 9, 9, 5];
-  var expectedArray = [1, 2, 3, 4, 5];
-
-  var actualOutput =
-      goog.array.removeAllIf(testArray, function(el) { return el == 9; });
-
-  assertEquals(6, actualOutput);
-  assertArrayEquals(expectedArray, testArray);
-}
-
-function testRemoveAllIf_noMatches() {
-  var testArray = [1];
-  var expectedArray = [1];
-
-  var actualOutput =
-      goog.array.removeAllIf(testArray, function(el) { return false; });
-
-  assertEquals(0, actualOutput);
-  assertArrayEquals(expectedArray, testArray);
-}
-
-function testCopyByIndex() {
-  var testArray = [1, 2, 'a', 'b', 'c', 'd'];
-  var copyIndexes = [1, 3, 0, 0, 2];
-  var expectedArray = [2, 'b', 1, 1, 'a'];
-
-  var actualOutput = goog.array.copyByIndex(testArray, copyIndexes);
-
-  assertArrayEquals(expectedArray, actualOutput);
-}
-
-function testComparators() {
-  var greater = 42;
-  var smaller = 13;
-
-  assertTrue(goog.array.defaultCompare(smaller, greater) < 0);
-  assertEquals(0, goog.array.defaultCompare(smaller, smaller));
-  assertTrue(goog.array.defaultCompare(greater, smaller) > 0);
-
-  assertTrue(goog.array.inverseDefaultCompare(greater, smaller) < 0);
-  assertEquals(0, goog.array.inverseDefaultCompare(greater, greater));
-  assertTrue(goog.array.inverseDefaultCompare(smaller, greater) > 0);
-}
-
-function testConcatMap() {
-  var a = [0, 1, 2, 0];
-  var context = {};
-  var arraysToReturn = [['x', 'y', 'z'], [], ['a', 'b']];
-  var timesCalled = 0;
-  var result = goog.array.concatMap(a, function(val, index, a2) {
-    assertEquals(a, a2);
-    assertEquals(context, this);
-    assertEquals(timesCalled++, index);
-    assertEquals(a[index], val);
-    return arraysToReturn[val];
-  }, context);
-  assertArrayEquals(['x', 'y', 'z', 'a', 'b', 'x', 'y', 'z'], result);
-}

+ 0 - 369
src/renderer/cocoblockly-x/python/block/closure/goog/asserts/asserts.js

@@ -1,369 +0,0 @@
-// Copyright 2008 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/**
- * @fileoverview Utilities to check the preconditions, postconditions and
- * invariants runtime.
- *
- * Methods in this package should be given special treatment by the compiler
- * for type-inference. For example, <code>goog.asserts.assert(foo)</code>
- * will restrict <code>foo</code> to a truthy value.
- *
- * The compiler has an option to disable asserts. So code like:
- * <code>
- * var x = goog.asserts.assert(foo()); goog.asserts.assert(bar());
- * </code>
- * will be transformed into:
- * <code>
- * var x = foo();
- * </code>
- * The compiler will leave in foo() (because its return value is used),
- * but it will remove bar() because it assumes it does not have side-effects.
- *
- * @author agrieve@google.com (Andrew Grieve)
- */
-
-goog.provide('goog.asserts');
-goog.provide('goog.asserts.AssertionError');
-
-goog.require('goog.debug.Error');
-goog.require('goog.dom.NodeType');
-goog.require('goog.string');
-
-
-/**
- * @define {boolean} Whether to strip out asserts or to leave them in.
- */
-goog.define('goog.asserts.ENABLE_ASSERTS', goog.DEBUG);
-
-
-
-/**
- * Error object for failed assertions.
- * @param {string} messagePattern The pattern that was used to form message.
- * @param {!Array<*>} messageArgs The items to substitute into the pattern.
- * @constructor
- * @extends {goog.debug.Error}
- * @final
- */
-goog.asserts.AssertionError = function(messagePattern, messageArgs) {
-  messageArgs.unshift(messagePattern);
-  goog.debug.Error.call(this, goog.string.subs.apply(null, messageArgs));
-  // Remove the messagePattern afterwards to avoid permanently modifying the
-  // passed in array.
-  messageArgs.shift();
-
-  /**
-   * The message pattern used to format the error message. Error handlers can
-   * use this to uniquely identify the assertion.
-   * @type {string}
-   */
-  this.messagePattern = messagePattern;
-};
-goog.inherits(goog.asserts.AssertionError, goog.debug.Error);
-
-
-/** @override */
-goog.asserts.AssertionError.prototype.name = 'AssertionError';
-
-
-/**
- * The default error handler.
- * @param {!goog.asserts.AssertionError} e The exception to be handled.
- */
-goog.asserts.DEFAULT_ERROR_HANDLER = function(e) {
-  throw e;
-};
-
-
-/**
- * The handler responsible for throwing or logging assertion errors.
- * @private {function(!goog.asserts.AssertionError)}
- */
-goog.asserts.errorHandler_ = goog.asserts.DEFAULT_ERROR_HANDLER;
-
-
-/**
- * Throws an exception with the given message and "Assertion failed" prefixed
- * onto it.
- * @param {string} defaultMessage The message to use if givenMessage is empty.
- * @param {Array<*>} defaultArgs The substitution arguments for defaultMessage.
- * @param {string|undefined} givenMessage Message supplied by the caller.
- * @param {Array<*>} givenArgs The substitution arguments for givenMessage.
- * @throws {goog.asserts.AssertionError} When the value is not a number.
- * @private
- */
-goog.asserts.doAssertFailure_ = function(
-    defaultMessage, defaultArgs, givenMessage, givenArgs) {
-  var message = 'Assertion failed';
-  if (givenMessage) {
-    message += ': ' + givenMessage;
-    var args = givenArgs;
-  } else if (defaultMessage) {
-    message += ': ' + defaultMessage;
-    args = defaultArgs;
-  }
-  // The '' + works around an Opera 10 bug in the unit tests. Without it,
-  // a stack trace is added to var message above. With this, a stack trace is
-  // not added until this line (it causes the extra garbage to be added after
-  // the assertion message instead of in the middle of it).
-  var e = new goog.asserts.AssertionError('' + message, args || []);
-  goog.asserts.errorHandler_(e);
-};
-
-
-/**
- * Sets a custom error handler that can be used to customize the behavior of
- * assertion failures, for example by turning all assertion failures into log
- * messages.
- * @param {function(!goog.asserts.AssertionError)} errorHandler
- */
-goog.asserts.setErrorHandler = function(errorHandler) {
-  if (goog.asserts.ENABLE_ASSERTS) {
-    goog.asserts.errorHandler_ = errorHandler;
-  }
-};
-
-
-/**
- * Checks if the condition evaluates to true if goog.asserts.ENABLE_ASSERTS is
- * true.
- * @template T
- * @param {T} condition The condition to check.
- * @param {string=} opt_message Error message in case of failure.
- * @param {...*} var_args The items to substitute into the failure message.
- * @return {T} The value of the condition.
- * @throws {goog.asserts.AssertionError} When the condition evaluates to false.
- */
-goog.asserts.assert = function(condition, opt_message, var_args) {
-  if (goog.asserts.ENABLE_ASSERTS && !condition) {
-    goog.asserts.doAssertFailure_(
-        '', null, opt_message, Array.prototype.slice.call(arguments, 2));
-  }
-  return condition;
-};
-
-
-/**
- * Fails if goog.asserts.ENABLE_ASSERTS is true. This function is useful in case
- * when we want to add a check in the unreachable area like switch-case
- * statement:
- *
- * <pre>
- *  switch(type) {
- *    case FOO: doSomething(); break;
- *    case BAR: doSomethingElse(); break;
- *    default: goog.asserts.fail('Unrecognized type: ' + type);
- *      // We have only 2 types - "default:" section is unreachable code.
- *  }
- * </pre>
- *
- * @param {string=} opt_message Error message in case of failure.
- * @param {...*} var_args The items to substitute into the failure message.
- * @throws {goog.asserts.AssertionError} Failure.
- */
-goog.asserts.fail = function(opt_message, var_args) {
-  if (goog.asserts.ENABLE_ASSERTS) {
-    goog.asserts.errorHandler_(
-        new goog.asserts.AssertionError(
-            'Failure' + (opt_message ? ': ' + opt_message : ''),
-            Array.prototype.slice.call(arguments, 1)));
-  }
-};
-
-
-/**
- * Checks if the value is a number if goog.asserts.ENABLE_ASSERTS is true.
- * @param {*} value The value to check.
- * @param {string=} opt_message Error message in case of failure.
- * @param {...*} var_args The items to substitute into the failure message.
- * @return {number} The value, guaranteed to be a number when asserts enabled.
- * @throws {goog.asserts.AssertionError} When the value is not a number.
- */
-goog.asserts.assertNumber = function(value, opt_message, var_args) {
-  if (goog.asserts.ENABLE_ASSERTS && !goog.isNumber(value)) {
-    goog.asserts.doAssertFailure_(
-        'Expected number but got %s: %s.', [goog.typeOf(value), value],
-        opt_message, Array.prototype.slice.call(arguments, 2));
-  }
-  return /** @type {number} */ (value);
-};
-
-
-/**
- * Checks if the value is a string if goog.asserts.ENABLE_ASSERTS is true.
- * @param {*} value The value to check.
- * @param {string=} opt_message Error message in case of failure.
- * @param {...*} var_args The items to substitute into the failure message.
- * @return {string} The value, guaranteed to be a string when asserts enabled.
- * @throws {goog.asserts.AssertionError} When the value is not a string.
- */
-goog.asserts.assertString = function(value, opt_message, var_args) {
-  if (goog.asserts.ENABLE_ASSERTS && !goog.isString(value)) {
-    goog.asserts.doAssertFailure_(
-        'Expected string but got %s: %s.', [goog.typeOf(value), value],
-        opt_message, Array.prototype.slice.call(arguments, 2));
-  }
-  return /** @type {string} */ (value);
-};
-
-
-/**
- * Checks if the value is a function if goog.asserts.ENABLE_ASSERTS is true.
- * @param {*} value The value to check.
- * @param {string=} opt_message Error message in case of failure.
- * @param {...*} var_args The items to substitute into the failure message.
- * @return {!Function} The value, guaranteed to be a function when asserts
- *     enabled.
- * @throws {goog.asserts.AssertionError} When the value is not a function.
- */
-goog.asserts.assertFunction = function(value, opt_message, var_args) {
-  if (goog.asserts.ENABLE_ASSERTS && !goog.isFunction(value)) {
-    goog.asserts.doAssertFailure_(
-        'Expected function but got %s: %s.', [goog.typeOf(value), value],
-        opt_message, Array.prototype.slice.call(arguments, 2));
-  }
-  return /** @type {!Function} */ (value);
-};
-
-
-/**
- * Checks if the value is an Object if goog.asserts.ENABLE_ASSERTS is true.
- * @param {*} value The value to check.
- * @param {string=} opt_message Error message in case of failure.
- * @param {...*} var_args The items to substitute into the failure message.
- * @return {!Object} The value, guaranteed to be a non-null object.
- * @throws {goog.asserts.AssertionError} When the value is not an object.
- */
-goog.asserts.assertObject = function(value, opt_message, var_args) {
-  if (goog.asserts.ENABLE_ASSERTS && !goog.isObject(value)) {
-    goog.asserts.doAssertFailure_(
-        'Expected object but got %s: %s.', [goog.typeOf(value), value],
-        opt_message, Array.prototype.slice.call(arguments, 2));
-  }
-  return /** @type {!Object} */ (value);
-};
-
-
-/**
- * Checks if the value is an Array if goog.asserts.ENABLE_ASSERTS is true.
- * @param {*} value The value to check.
- * @param {string=} opt_message Error message in case of failure.
- * @param {...*} var_args The items to substitute into the failure message.
- * @return {!Array<?>} The value, guaranteed to be a non-null array.
- * @throws {goog.asserts.AssertionError} When the value is not an array.
- */
-goog.asserts.assertArray = function(value, opt_message, var_args) {
-  if (goog.asserts.ENABLE_ASSERTS && !goog.isArray(value)) {
-    goog.asserts.doAssertFailure_(
-        'Expected array but got %s: %s.', [goog.typeOf(value), value],
-        opt_message, Array.prototype.slice.call(arguments, 2));
-  }
-  return /** @type {!Array<?>} */ (value);
-};
-
-
-/**
- * Checks if the value is a boolean if goog.asserts.ENABLE_ASSERTS is true.
- * @param {*} value The value to check.
- * @param {string=} opt_message Error message in case of failure.
- * @param {...*} var_args The items to substitute into the failure message.
- * @return {boolean} The value, guaranteed to be a boolean when asserts are
- *     enabled.
- * @throws {goog.asserts.AssertionError} When the value is not a boolean.
- */
-goog.asserts.assertBoolean = function(value, opt_message, var_args) {
-  if (goog.asserts.ENABLE_ASSERTS && !goog.isBoolean(value)) {
-    goog.asserts.doAssertFailure_(
-        'Expected boolean but got %s: %s.', [goog.typeOf(value), value],
-        opt_message, Array.prototype.slice.call(arguments, 2));
-  }
-  return /** @type {boolean} */ (value);
-};
-
-
-/**
- * Checks if the value is a DOM Element if goog.asserts.ENABLE_ASSERTS is true.
- * @param {*} value The value to check.
- * @param {string=} opt_message Error message in case of failure.
- * @param {...*} var_args The items to substitute into the failure message.
- * @return {!Element} The value, likely to be a DOM Element when asserts are
- *     enabled.
- * @throws {goog.asserts.AssertionError} When the value is not an Element.
- */
-goog.asserts.assertElement = function(value, opt_message, var_args) {
-  if (goog.asserts.ENABLE_ASSERTS &&
-      (!goog.isObject(value) || value.nodeType != goog.dom.NodeType.ELEMENT)) {
-    goog.asserts.doAssertFailure_(
-        'Expected Element but got %s: %s.', [goog.typeOf(value), value],
-        opt_message, Array.prototype.slice.call(arguments, 2));
-  }
-  return /** @type {!Element} */ (value);
-};
-
-
-/**
- * Checks if the value is an instance of the user-defined type if
- * goog.asserts.ENABLE_ASSERTS is true.
- *
- * The compiler may tighten the type returned by this function.
- *
- * @param {?} value The value to check.
- * @param {function(new: T, ...)} type A user-defined constructor.
- * @param {string=} opt_message Error message in case of failure.
- * @param {...*} var_args The items to substitute into the failure message.
- * @throws {goog.asserts.AssertionError} When the value is not an instance of
- *     type.
- * @return {T}
- * @template T
- */
-goog.asserts.assertInstanceof = function(value, type, opt_message, var_args) {
-  if (goog.asserts.ENABLE_ASSERTS && !(value instanceof type)) {
-    goog.asserts.doAssertFailure_(
-        'Expected instanceof %s but got %s.',
-        [goog.asserts.getType_(type), goog.asserts.getType_(value)],
-        opt_message, Array.prototype.slice.call(arguments, 3));
-  }
-  return value;
-};
-
-
-/**
- * Checks that no enumerable keys are present in Object.prototype. Such keys
- * would break most code that use {@code for (var ... in ...)} loops.
- */
-goog.asserts.assertObjectPrototypeIsIntact = function() {
-  for (var key in Object.prototype) {
-    goog.asserts.fail(key + ' should not be enumerable in Object.prototype.');
-  }
-};
-
-
-/**
- * Returns the type of a value. If a constructor is passed, and a suitable
- * string cannot be found, 'unknown type name' will be returned.
- * @param {*} value A constructor, object, or primitive.
- * @return {string} The best display name for the value, or 'unknown type name'.
- * @private
- */
-goog.asserts.getType_ = function(value) {
-  if (value instanceof Function) {
-    return value.displayName || value.name || 'unknown type name';
-  } else if (value instanceof Object) {
-    return value.constructor.displayName || value.constructor.name ||
-        Object.prototype.toString.call(value);
-  } else {
-    return value === null ? 'null' : typeof value;
-  }
-};

+ 0 - 23
src/renderer/cocoblockly-x/python/block/closure/goog/asserts/asserts_test.html

@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!--
-Copyright 2008 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
- <head>
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta charset="UTF-8" />
-  <title>
-   Closure Unit Tests - goog.asserts.assert
-  </title>
-  <script src="../base.js">
-  </script>
-  <script>
-    goog.require('goog.assertsTest');
-  </script>
- </head>
- <body>
- </body>
-</html>

+ 0 - 272
src/renderer/cocoblockly-x/python/block/closure/goog/asserts/asserts_test.js

@@ -1,272 +0,0 @@
-// Copyright 2008 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-goog.provide('goog.assertsTest');
-goog.setTestOnly('goog.assertsTest');
-
-goog.require('goog.asserts');
-goog.require('goog.asserts.AssertionError');
-goog.require('goog.dom');
-goog.require('goog.dom.TagName');
-goog.require('goog.string');
-goog.require('goog.testing.jsunit');
-goog.require('goog.userAgent');
-
-/**
- * Test that the function throws an error with the given message.
- * @param {function()} failFunc
- * @param {string} expectedMsg
- */
-function doTestMessage(failFunc, expectedMsg) {
-  var error = assertThrows('failFunc should throw.', failFunc);
-  // Test error message.
-  assertEquals(expectedMsg, error.message);
-}
-
-function testAssert() {
-  // None of them may throw exception
-  goog.asserts.assert(true);
-  goog.asserts.assert(1);
-  goog.asserts.assert([]);
-  goog.asserts.assert({});
-
-  assertThrows('assert(false)', goog.partial(goog.asserts.assert, false));
-  assertThrows('assert(0)', goog.partial(goog.asserts.assert, 0));
-  assertThrows('assert(null)', goog.partial(goog.asserts.assert, null));
-  assertThrows(
-      'assert(undefined)', goog.partial(goog.asserts.assert, undefined));
-
-  // Test error messages.
-  doTestMessage(goog.partial(goog.asserts.assert, false), 'Assertion failed');
-  doTestMessage(
-      goog.partial(goog.asserts.assert, false, 'ouch %s', 1),
-      'Assertion failed: ouch 1');
-}
-
-
-function testFail() {
-  assertThrows('fail()', goog.asserts.fail);
-  // Test error messages.
-  doTestMessage(goog.partial(goog.asserts.fail, false), 'Failure');
-  doTestMessage(
-      goog.partial(goog.asserts.fail, 'ouch %s', 1), 'Failure: ouch 1');
-}
-
-function testNumber() {
-  goog.asserts.assertNumber(1);
-  assertThrows(
-      'assertNumber(null)', goog.partial(goog.asserts.assertNumber, null));
-  // Test error messages.
-  doTestMessage(
-      goog.partial(goog.asserts.assertNumber, null),
-      'Assertion failed: Expected number but got null: null.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertNumber, '1234'),
-      'Assertion failed: Expected number but got string: 1234.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertNumber, null, 'ouch %s', 1),
-      'Assertion failed: ouch 1');
-}
-
-function testString() {
-  assertEquals('1', goog.asserts.assertString('1'));
-  assertThrows(
-      'assertString(null)', goog.partial(goog.asserts.assertString, null));
-  // Test error messages.
-  doTestMessage(
-      goog.partial(goog.asserts.assertString, null),
-      'Assertion failed: Expected string but got null: null.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertString, 1234),
-      'Assertion failed: Expected string but got number: 1234.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertString, null, 'ouch %s', 1),
-      'Assertion failed: ouch 1');
-}
-
-function testFunction() {
-  function f(){};
-  assertEquals(f, goog.asserts.assertFunction(f));
-  assertThrows(
-      'assertFunction(null)', goog.partial(goog.asserts.assertFunction, null));
-  // Test error messages.
-  doTestMessage(
-      goog.partial(goog.asserts.assertFunction, null),
-      'Assertion failed: Expected function but got null: null.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertFunction, 1234),
-      'Assertion failed: Expected function but got number: 1234.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertFunction, null, 'ouch %s', 1),
-      'Assertion failed: ouch 1');
-}
-
-function testObject() {
-  var o = {};
-  assertEquals(o, goog.asserts.assertObject(o));
-  assertThrows(
-      'assertObject(null)', goog.partial(goog.asserts.assertObject, null));
-  // Test error messages.
-  doTestMessage(
-      goog.partial(goog.asserts.assertObject, null),
-      'Assertion failed: Expected object but got null: null.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertObject, 1234),
-      'Assertion failed: Expected object but got number: 1234.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertObject, null, 'ouch %s', 1),
-      'Assertion failed: ouch 1');
-}
-
-function testArray() {
-  var a = [];
-  assertEquals(a, goog.asserts.assertArray(a));
-  assertThrows('assertArray({})', goog.partial(goog.asserts.assertArray, {}));
-  // Test error messages.
-  doTestMessage(
-      goog.partial(goog.asserts.assertArray, null),
-      'Assertion failed: Expected array but got null: null.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertArray, 1234),
-      'Assertion failed: Expected array but got number: 1234.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertArray, null, 'ouch %s', 1),
-      'Assertion failed: ouch 1');
-}
-
-function testBoolean() {
-  assertEquals(true, goog.asserts.assertBoolean(true));
-  assertEquals(false, goog.asserts.assertBoolean(false));
-  assertThrows(goog.partial(goog.asserts.assertBoolean, null));
-  assertThrows(goog.partial(goog.asserts.assertBoolean, 'foo'));
-
-  // Test error messages.
-  doTestMessage(
-      goog.partial(goog.asserts.assertBoolean, null),
-      'Assertion failed: Expected boolean but got null: null.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertBoolean, 1234),
-      'Assertion failed: Expected boolean but got number: 1234.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertBoolean, null, 'ouch %s', 1),
-      'Assertion failed: ouch 1');
-}
-
-function testElement() {
-  assertThrows(goog.partial(goog.asserts.assertElement, null));
-  assertThrows(goog.partial(goog.asserts.assertElement, 'foo'));
-  assertThrows(
-      goog.partial(goog.asserts.assertElement, goog.dom.createTextNode('foo')));
-  var elem = goog.dom.createElement(goog.dom.TagName.DIV);
-  assertEquals(elem, goog.asserts.assertElement(elem));
-}
-
-function testInstanceof() {
-  /** @constructor */
-  var F = function() {};
-  goog.asserts.assertInstanceof(new F(), F);
-  var error = assertThrows(
-      'assertInstanceof({}, F)',
-      goog.partial(goog.asserts.assertInstanceof, {}, F));
-  // IE lacks support for function.name and will fallback to toString().
-  var object = /object/.test(error.message) ? '[object Object]' : 'Object';
-  var name = /F/.test(error.message) ? 'F' : 'unknown type name';
-
-  // Test error messages.
-  doTestMessage(
-      goog.partial(goog.asserts.assertInstanceof, {}, F),
-      'Assertion failed: Expected instanceof ' + name + ' but got ' + object +
-          '.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertInstanceof, {}, F, 'a %s', 1),
-      'Assertion failed: a 1');
-  doTestMessage(
-      goog.partial(goog.asserts.assertInstanceof, null, F),
-      'Assertion failed: Expected instanceof ' + name + ' but got null.');
-  doTestMessage(
-      goog.partial(goog.asserts.assertInstanceof, 5, F), 'Assertion failed: ' +
-          'Expected instanceof ' + name + ' but got number.');
-
-  // Test a constructor a with a name (IE does not support function.name).
-  if (!goog.userAgent.IE) {
-    F = function foo() {};
-    doTestMessage(
-        goog.partial(goog.asserts.assertInstanceof, {}, F),
-        'Assertion failed: Expected instanceof foo but got ' + object + '.');
-  }
-
-  // Test a constructor with a displayName.
-  F.displayName = 'bar';
-  doTestMessage(
-      goog.partial(goog.asserts.assertInstanceof, {}, F),
-      'Assertion failed: Expected instanceof bar but got ' + object + '.');
-}
-
-function testObjectPrototypeIsIntact() {
-  goog.asserts.assertObjectPrototypeIsIntact();
-  var originalToString = Object.prototype.toString;
-  Object.prototype.toString = goog.nullFunction;
-  try {
-    goog.asserts.assertObjectPrototypeIsIntact();
-    Object.prototype.foo = 1;
-    doTestMessage(
-        goog.asserts.assertObjectPrototypeIsIntact,
-        'Failure: foo should not be enumerable in Object.prototype.');
-  } finally {
-    Object.prototype.toString = originalToString;
-    delete Object.prototype.foo;
-  }
-}
-
-function testAssertionError() {
-  var error = new goog.asserts.AssertionError('foo %s %s', [1, 'two']);
-  assertEquals('Wrong message', 'foo 1 two', error.message);
-  assertEquals('Wrong messagePattern', 'foo %s %s', error.messagePattern);
-}
-
-function testFailWithCustomErrorHandler() {
-  try {
-    var handledException;
-    goog.asserts.setErrorHandler(function(e) { handledException = e; });
-
-    var expectedMessage = 'Failure: Gevalt!';
-
-    goog.asserts.fail('Gevalt!');
-    assertTrue('handledException is null.', handledException != null);
-    assertTrue(
-        'Message check failed.  Expected: ' + expectedMessage + ' Actual: ' +
-            handledException.message,
-        goog.string.startsWith(expectedMessage, handledException.message));
-  } finally {
-    goog.asserts.setErrorHandler(goog.asserts.DEFAULT_ERROR_HANDLER);
-  }
-}
-
-function testAssertWithCustomErrorHandler() {
-  try {
-    var handledException;
-    goog.asserts.setErrorHandler(function(e) { handledException = e; });
-
-    var expectedMessage = 'Assertion failed: Gevalt!';
-
-    goog.asserts.assert(false, 'Gevalt!');
-    assertTrue('handledException is null.', handledException != null);
-    assertTrue(
-        'Message check failed.  Expected: ' + expectedMessage + ' Actual: ' +
-            handledException.message,
-        goog.string.startsWith(expectedMessage, handledException.message));
-  } finally {
-    goog.asserts.setErrorHandler(goog.asserts.DEFAULT_ERROR_HANDLER);
-  }
-}

+ 0 - 272
src/renderer/cocoblockly-x/python/block/closure/goog/async/animationdelay.js

@@ -1,272 +0,0 @@
-// Copyright 2012 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/**
- * @fileoverview A delayed callback that pegs to the next animation frame
- * instead of a user-configurable timeout.
- *
- * @author nicksantos@google.com (Nick Santos)
- */
-
-goog.provide('goog.async.AnimationDelay');
-
-goog.require('goog.Disposable');
-goog.require('goog.events');
-goog.require('goog.functions');
-
-
-
-// TODO(nicksantos): Should we factor out the common code between this and
-// goog.async.Delay? I'm not sure if there's enough code for this to really
-// make sense. Subclassing seems like the wrong approach for a variety of
-// reasons. Maybe there should be a common interface?
-
-
-
-/**
- * A delayed callback that pegs to the next animation frame
- * instead of a user configurable timeout. By design, this should have
- * the same interface as goog.async.Delay.
- *
- * Uses requestAnimationFrame and friends when available, but falls
- * back to a timeout of goog.async.AnimationDelay.TIMEOUT.
- *
- * For more on requestAnimationFrame and how you can use it to create smoother
- * animations, see:
- * @see http://paulirish.com/2011/requestanimationframe-for-smart-animating/
- *
- * @param {function(this:THIS, number)} listener Function to call
- *     when the delay completes. Will be passed the timestamp when it's called,
- *     in unix ms.
- * @param {Window=} opt_window The window object to execute the delay in.
- *     Defaults to the global object.
- * @param {THIS=} opt_handler The object scope to invoke the function in.
- * @template THIS
- * @constructor
- * @struct
- * @extends {goog.Disposable}
- * @final
- */
-goog.async.AnimationDelay = function(listener, opt_window, opt_handler) {
-  goog.async.AnimationDelay.base(this, 'constructor');
-
-  /**
-   * Identifier of the active delay timeout, or event listener,
-   * or null when inactive.
-   * @private {goog.events.Key|number}
-   */
-  this.id_ = null;
-
-  /**
-   * If we're using dom listeners.
-   * @private {?boolean}
-   */
-  this.usingListeners_ = false;
-
-  /**
-   * The function that will be invoked after a delay.
-   * @const
-   * @private
-   */
-  this.listener_ = listener;
-
-  /**
-   * The object context to invoke the callback in.
-   * @const
-   * @private {(THIS|undefined)}
-   */
-  this.handler_ = opt_handler;
-
-  /**
-   * @private {Window}
-   */
-  this.win_ = opt_window || window;
-
-  /**
-   * Cached callback function invoked when the delay finishes.
-   * @private {function()}
-   */
-  this.callback_ = goog.bind(this.doAction_, this);
-};
-goog.inherits(goog.async.AnimationDelay, goog.Disposable);
-
-
-/**
- * Default wait timeout for animations (in milliseconds).  Only used for timed
- * animation, which uses a timer (setTimeout) to schedule animation.
- *
- * @type {number}
- * @const
- */
-goog.async.AnimationDelay.TIMEOUT = 20;
-
-
-/**
- * Name of event received from the requestAnimationFrame in Firefox.
- *
- * @type {string}
- * @const
- * @private
- */
-goog.async.AnimationDelay.MOZ_BEFORE_PAINT_EVENT_ = 'MozBeforePaint';
-
-
-/**
- * Starts the delay timer. The provided listener function will be called
- * before the next animation frame.
- */
-goog.async.AnimationDelay.prototype.start = function() {
-  this.stop();
-  this.usingListeners_ = false;
-
-  var raf = this.getRaf_();
-  var cancelRaf = this.getCancelRaf_();
-  if (raf && !cancelRaf && this.win_.mozRequestAnimationFrame) {
-    // Because Firefox (Gecko) runs animation in separate threads, it also saves
-    // time by running the requestAnimationFrame callbacks in that same thread.
-    // Sadly this breaks the assumption of implicit thread-safety in JS, and can
-    // thus create thread-based inconsistencies on counters etc.
-    //
-    // Calling cycleAnimations_ using the MozBeforePaint event instead of as
-    // callback fixes this.
-    //
-    // Trigger this condition only if the mozRequestAnimationFrame is available,
-    // but not the W3C requestAnimationFrame function (as in draft) or the
-    // equivalent cancel functions.
-    this.id_ = goog.events.listen(
-        this.win_, goog.async.AnimationDelay.MOZ_BEFORE_PAINT_EVENT_,
-        this.callback_);
-    this.win_.mozRequestAnimationFrame(null);
-    this.usingListeners_ = true;
-  } else if (raf && cancelRaf) {
-    this.id_ = raf.call(this.win_, this.callback_);
-  } else {
-    this.id_ = this.win_.setTimeout(
-        // Prior to Firefox 13, Gecko passed a non-standard parameter
-        // to the callback that we want to ignore.
-        goog.functions.lock(this.callback_), goog.async.AnimationDelay.TIMEOUT);
-  }
-};
-
-
-/**
- * Starts the delay timer if it's not already active.
- */
-goog.async.AnimationDelay.prototype.startIfNotActive = function() {
-  if (!this.isActive()) {
-    this.start();
-  }
-};
-
-
-/**
- * Stops the delay timer if it is active. No action is taken if the timer is not
- * in use.
- */
-goog.async.AnimationDelay.prototype.stop = function() {
-  if (this.isActive()) {
-    var raf = this.getRaf_();
-    var cancelRaf = this.getCancelRaf_();
-    if (raf && !cancelRaf && this.win_.mozRequestAnimationFrame) {
-      goog.events.unlistenByKey(this.id_);
-    } else if (raf && cancelRaf) {
-      cancelRaf.call(this.win_, /** @type {number} */ (this.id_));
-    } else {
-      this.win_.clearTimeout(/** @type {number} */ (this.id_));
-    }
-  }
-  this.id_ = null;
-};
-
-
-/**
- * Fires delay's action even if timer has already gone off or has not been
- * started yet; guarantees action firing. Stops the delay timer.
- */
-goog.async.AnimationDelay.prototype.fire = function() {
-  this.stop();
-  this.doAction_();
-};
-
-
-/**
- * Fires delay's action only if timer is currently active. Stops the delay
- * timer.
- */
-goog.async.AnimationDelay.prototype.fireIfActive = function() {
-  if (this.isActive()) {
-    this.fire();
-  }
-};
-
-
-/**
- * @return {boolean} True if the delay is currently active, false otherwise.
- */
-goog.async.AnimationDelay.prototype.isActive = function() {
-  return this.id_ != null;
-};
-
-
-/**
- * Invokes the callback function after the delay successfully completes.
- * @private
- */
-goog.async.AnimationDelay.prototype.doAction_ = function() {
-  if (this.usingListeners_ && this.id_) {
-    goog.events.unlistenByKey(this.id_);
-  }
-  this.id_ = null;
-
-  // We are not using the timestamp returned by requestAnimationFrame
-  // because it may be either a Date.now-style time or a
-  // high-resolution time (depending on browser implementation). Using
-  // goog.now() will ensure that the timestamp used is consistent and
-  // compatible with goog.fx.Animation.
-  this.listener_.call(this.handler_, goog.now());
-};
-
-
-/** @override */
-goog.async.AnimationDelay.prototype.disposeInternal = function() {
-  this.stop();
-  goog.async.AnimationDelay.base(this, 'disposeInternal');
-};
-
-
-/**
- * @return {?function(function(number)): number} The requestAnimationFrame
- *     function, or null if not available on this browser.
- * @private
- */
-goog.async.AnimationDelay.prototype.getRaf_ = function() {
-  var win = this.win_;
-  return win.requestAnimationFrame || win.webkitRequestAnimationFrame ||
-      win.mozRequestAnimationFrame || win.oRequestAnimationFrame ||
-      win.msRequestAnimationFrame || null;
-};
-
-
-/**
- * @return {?function(number): undefined} The cancelAnimationFrame function,
- *     or null if not available on this browser.
- * @private
- */
-goog.async.AnimationDelay.prototype.getCancelRaf_ = function() {
-  var win = this.win_;
-  return win.cancelAnimationFrame || win.cancelRequestAnimationFrame ||
-      win.webkitCancelRequestAnimationFrame ||
-      win.mozCancelRequestAnimationFrame || win.oCancelRequestAnimationFrame ||
-      win.msCancelRequestAnimationFrame || null;
-};

+ 0 - 24
src/renderer/cocoblockly-x/python/block/closure/goog/async/animationdelay_test.html

@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!--
-Copyright 2012 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
-
-Author: nicksantos@google.com (Nick Santos)
--->
- <head>
-  <meta charset="UTF-8" />
-  <title>
-   JsUnit tests for goog.async.AnimationDelay
-  </title>
-  <script src="../base.js">
-  </script>
-  <script>
-   goog.require('goog.async.AnimationDelayTest');
-  </script>
- </head>
- <body>
- </body>
-</html>

+ 0 - 89
src/renderer/cocoblockly-x/python/block/closure/goog/async/animationdelay_test.js

@@ -1,89 +0,0 @@
-// Copyright 2012 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-goog.module('goog.async.AnimationDelayTest');
-goog.setTestOnly('goog.async.AnimationDelayTest');
-
-var AnimationDelay = goog.require('goog.async.AnimationDelay');
-var Promise = goog.require('goog.Promise');
-var PropertyReplacer = goog.require('goog.testing.PropertyReplacer');
-var Timer = goog.require('goog.Timer');
-var jsunit = goog.require('goog.testing.jsunit');
-var testSuite = goog.require('goog.testing.testSuite');
-
-var TEST_DELAY = 50;
-var stubs = new PropertyReplacer();
-
-testSuite({
-  tearDown: function() { stubs.reset(); },
-
-  testStart: function() {
-    var resolver = Promise.withResolver();
-    var start = goog.now();
-    var delay = new AnimationDelay(function(end) {
-      assertNotNull(resolver);  // fail if called multiple times
-      resolver.resolve();
-      resolver = null;
-    });
-
-    delay.start();
-
-    return resolver.promise;
-  },
-
-  testStop: function() {
-    var resolver = Promise.withResolver();
-    var start = goog.now();
-    var delay = new AnimationDelay(function(end) { resolver.reject(); });
-
-    delay.start();
-    delay.stop();
-
-    return Timer.promise(TEST_DELAY).then(function() {
-      resolver.resolve();
-      return resolver.promise;
-    });
-  },
-
-  testAlwaysUseGoogNowForHandlerTimestamp: function() {
-    var resolver = Promise.withResolver();
-    var expectedValue = 12345.1;
-    stubs.set(goog, 'now', function() { return expectedValue; });
-
-    var delay = new AnimationDelay(function(timestamp) {
-      assertEquals(expectedValue, timestamp);
-      resolver.resolve();
-    });
-
-    delay.start();
-
-    return resolver.promise;
-  },
-
-  testStartIfActive: function() {
-    var delay = new AnimationDelay(goog.nullFunction);
-    delay.start();
-
-    var startWasCalled = false;
-    stubs.set(AnimationDelay.prototype, 'start', function() {
-      startWasCalled = true;
-    });
-
-    delay.startIfNotActive();
-    assertEquals(startWasCalled, false);
-    delay.stop();
-    delay.startIfNotActive();
-    assertEquals(startWasCalled, true);
-  }
-});

+ 0 - 227
src/renderer/cocoblockly-x/python/block/closure/goog/async/conditionaldelay.js

@@ -1,227 +0,0 @@
-// Copyright 2008 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/**
- * @fileoverview Defines a class useful for handling functions that must be
- * invoked later when some condition holds. Examples include deferred function
- * calls that return a boolean flag whether it succedeed or not.
- *
- * Example:
- *
- *  function deferred() {
- *     var succeeded = false;
- *     // ... custom code
- *     return succeeded;
- *  }
- *
- *  var deferredCall = new goog.async.ConditionalDelay(deferred);
- *  deferredCall.onSuccess = function() {
- *    alert('Success: The deferred function has been successfully executed.');
- *  }
- *  deferredCall.onFailure = function() {
- *    alert('Failure: Time limit exceeded.');
- *  }
- *
- *  // Call the deferred() every 100 msec until it returns true,
- *  // or 5 seconds pass.
- *  deferredCall.start(100, 5000);
- *
- *  // Stop the deferred function call (does nothing if it's not active).
- *  deferredCall.stop();
- *
- */
-
-
-goog.provide('goog.async.ConditionalDelay');
-
-goog.require('goog.Disposable');
-goog.require('goog.async.Delay');
-
-
-
-/**
- * A ConditionalDelay object invokes the associated function after a specified
- * interval delay and checks its return value. If the function returns
- * {@code true} the conditional delay is cancelled and {@see #onSuccess}
- * is called. Otherwise this object keeps to invoke the deferred function until
- * either it returns {@code true} or the timeout is exceeded. In the latter case
- * the {@see #onFailure} method will be called.
- *
- * The interval duration and timeout can be specified each time the delay is
- * started. Calling start on an active delay will reset the timer.
- *
- * @param {function():boolean} listener Function to call when the delay
- *     completes. Should return a value that type-converts to {@code true} if
- *     the call succeeded and this delay should be stopped.
- * @param {Object=} opt_handler The object scope to invoke the function in.
- * @constructor
- * @struct
- * @extends {goog.Disposable}
- */
-goog.async.ConditionalDelay = function(listener, opt_handler) {
-  goog.async.ConditionalDelay.base(this, 'constructor');
-
-  /**
-   * The delay interval in milliseconds to between the calls to the callback.
-   * Note, that the callback may be invoked earlier than this interval if the
-   * timeout is exceeded.
-   * @private {number}
-   */
-  this.interval_ = 0;
-
-  /**
-   * The timeout timestamp until which the delay is to be executed.
-   * A negative value means no timeout.
-   * @private {number}
-   */
-  this.runUntil_ = 0;
-
-  /**
-   * True if the listener has been executed, and it returned {@code true}.
-   * @private {boolean}
-   */
-  this.isDone_ = false;
-
-  /**
-   * The function that will be invoked after a delay.
-   * @private {function():boolean}
-   */
-  this.listener_ = listener;
-
-  /**
-   * The object context to invoke the callback in.
-   * @private {Object|undefined}
-   */
-  this.handler_ = opt_handler;
-
-  /**
-   * The underlying goog.async.Delay delegate object.
-   * @private {goog.async.Delay}
-   */
-  this.delay_ = new goog.async.Delay(
-      goog.bind(this.onTick_, this), 0 /*interval*/, this /*scope*/);
-};
-goog.inherits(goog.async.ConditionalDelay, goog.Disposable);
-
-
-/** @override */
-goog.async.ConditionalDelay.prototype.disposeInternal = function() {
-  this.delay_.dispose();
-  delete this.listener_;
-  delete this.handler_;
-  goog.async.ConditionalDelay.superClass_.disposeInternal.call(this);
-};
-
-
-/**
- * Starts the delay timer. The provided listener function will be called
- * repeatedly after the specified interval until the function returns
- * {@code true} or the timeout is exceeded. Calling start on an active timer
- * will stop the timer first.
- * @param {number=} opt_interval The time interval between the function
- *     invocations (in milliseconds). Default is 0.
- * @param {number=} opt_timeout The timeout interval (in milliseconds). Takes
- *     precedence over the {@code opt_interval}, i.e. if the timeout is less
- *     than the invocation interval, the function will be called when the
- *     timeout is exceeded. A negative value means no timeout. Default is 0.
- */
-goog.async.ConditionalDelay.prototype.start = function(
-    opt_interval, opt_timeout) {
-  this.stop();
-  this.isDone_ = false;
-
-  var timeout = opt_timeout || 0;
-  this.interval_ = Math.max(opt_interval || 0, 0);
-  this.runUntil_ = timeout < 0 ? -1 : (goog.now() + timeout);
-  this.delay_.start(
-      timeout < 0 ? this.interval_ : Math.min(this.interval_, timeout));
-};
-
-
-/**
- * Stops the delay timer if it is active. No action is taken if the timer is not
- * in use.
- */
-goog.async.ConditionalDelay.prototype.stop = function() {
-  this.delay_.stop();
-};
-
-
-/**
- * @return {boolean} True if the delay is currently active, false otherwise.
- */
-goog.async.ConditionalDelay.prototype.isActive = function() {
-  return this.delay_.isActive();
-};
-
-
-/**
- * @return {boolean} True if the listener has been executed and returned
- *     {@code true} since the last call to {@see #start}.
- */
-goog.async.ConditionalDelay.prototype.isDone = function() {
-  return this.isDone_;
-};
-
-
-/**
- * Called when the listener has been successfully executed and returned
- * {@code true}. The {@see #isDone} method should return {@code true} by now.
- * Designed for inheritance, should be overridden by subclasses or on the
- * instances if they care.
- */
-goog.async.ConditionalDelay.prototype.onSuccess = function() {
-  // Do nothing by default.
-};
-
-
-/**
- * Called when this delayed call is cancelled because the timeout has been
- * exceeded, and the listener has never returned {@code true}.
- * Designed for inheritance, should be overridden by subclasses or on the
- * instances if they care.
- */
-goog.async.ConditionalDelay.prototype.onFailure = function() {
-  // Do nothing by default.
-};
-
-
-/**
- * A callback function for the underlying {@code goog.async.Delay} object. When
- * executed the listener function is called, and if it returns {@code true}
- * the delay is stopped and the {@see #onSuccess} method is invoked.
- * If the timeout is exceeded the delay is stopped and the
- * {@see #onFailure} method is called.
- * @private
- */
-goog.async.ConditionalDelay.prototype.onTick_ = function() {
-  var successful = this.listener_.call(this.handler_);
-  if (successful) {
-    this.isDone_ = true;
-    this.onSuccess();
-  } else {
-    // Try to reschedule the task.
-    if (this.runUntil_ < 0) {
-      // No timeout.
-      this.delay_.start(this.interval_);
-    } else {
-      var timeLeft = this.runUntil_ - goog.now();
-      if (timeLeft <= 0) {
-        this.onFailure();
-      } else {
-        this.delay_.start(Math.min(this.interval_, timeLeft));
-      }
-    }
-  }
-};

+ 0 - 23
src/renderer/cocoblockly-x/python/block/closure/goog/async/conditionaldelay_test.html

@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!--
-Copyright 2008 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
- <head>
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta charset="UTF-8" />
-  <title>
-   Closure Unit Tests - goog.async.ConditionalDelay
-  </title>
-  <script src="../base.js">
-  </script>
-  <script>
-   goog.require('goog.async.ConditionalDelayTest');
-  </script>
- </head>
- <body>
- </body>
-</html>

+ 0 - 218
src/renderer/cocoblockly-x/python/block/closure/goog/async/conditionaldelay_test.js

@@ -1,218 +0,0 @@
-// Copyright 2008 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-goog.provide('goog.async.ConditionalDelayTest');
-goog.setTestOnly('goog.async.ConditionalDelayTest');
-
-goog.require('goog.async.ConditionalDelay');
-goog.require('goog.testing.MockClock');
-goog.require('goog.testing.jsunit');
-
-var invoked = false;
-var delay = null;
-var clock = null;
-var returnValue = true;
-var onSuccessCalled = false;
-var onFailureCalled = false;
-
-
-function callback() {
-  invoked = true;
-  return returnValue;
-}
-
-
-function setUp() {
-  clock = new goog.testing.MockClock(true);
-  invoked = false;
-  returnValue = true;
-  onSuccessCalled = false;
-  onFailureCalled = false;
-  delay = new goog.async.ConditionalDelay(callback);
-  delay.onSuccess = function() { onSuccessCalled = true; };
-  delay.onFailure = function() { onFailureCalled = true; };
-}
-
-
-function tearDown() {
-  clock.dispose();
-  delay.dispose();
-}
-
-
-function testDelay() {
-  delay.start(200, 200);
-  assertFalse(invoked);
-
-  clock.tick(100);
-  assertFalse(invoked);
-
-  clock.tick(100);
-  assertTrue(invoked);
-}
-
-
-function testStop() {
-  delay.start(200, 500);
-  assertTrue(delay.isActive());
-
-  clock.tick(100);
-  assertFalse(invoked);
-
-  delay.stop();
-  clock.tick(100);
-  assertFalse(invoked);
-
-  assertFalse(delay.isActive());
-}
-
-
-function testIsActive() {
-  assertFalse(delay.isActive());
-  delay.start(200, 200);
-  assertTrue(delay.isActive());
-  clock.tick(200);
-  assertFalse(delay.isActive());
-}
-
-
-function testRestart() {
-  delay.start(200, 50000);
-  clock.tick(100);
-
-  delay.stop();
-  assertFalse(invoked);
-
-  delay.start(200, 50000);
-  clock.tick(199);
-  assertFalse(invoked);
-
-  clock.tick(1);
-  assertTrue(invoked);
-
-  invoked = false;
-  delay.start(200, 200);
-  clock.tick(200);
-  assertTrue(invoked);
-
-  assertFalse(delay.isActive());
-}
-
-
-function testDispose() {
-  delay.start(200, 200);
-  delay.dispose();
-  assertTrue(delay.isDisposed());
-
-  clock.tick(500);
-  assertFalse(invoked);
-}
-
-
-function testConditionalDelay_Success() {
-  returnValue = false;
-  delay.start(100, 300);
-
-  clock.tick(99);
-  assertFalse(invoked);
-  clock.tick(1);
-  assertTrue(invoked);
-
-  assertTrue(delay.isActive());
-  assertFalse(delay.isDone());
-  assertFalse(onSuccessCalled);
-  assertFalse(onFailureCalled);
-
-  returnValue = true;
-
-  invoked = false;
-  clock.tick(100);
-  assertTrue(invoked);
-
-  assertFalse(delay.isActive());
-  assertTrue(delay.isDone());
-  assertTrue(onSuccessCalled);
-  assertFalse(onFailureCalled);
-
-  invoked = false;
-  clock.tick(200);
-  assertFalse(invoked);
-}
-
-
-function testConditionalDelay_Failure() {
-  returnValue = false;
-  delay.start(100, 300);
-
-  clock.tick(99);
-  assertFalse(invoked);
-  clock.tick(1);
-  assertTrue(invoked);
-
-  assertTrue(delay.isActive());
-  assertFalse(delay.isDone());
-  assertFalse(onSuccessCalled);
-  assertFalse(onFailureCalled);
-
-  invoked = false;
-  clock.tick(100);
-  assertTrue(invoked);
-  assertFalse(onSuccessCalled);
-  assertFalse(onFailureCalled);
-
-  invoked = false;
-  clock.tick(90);
-  assertFalse(invoked);
-  clock.tick(10);
-  assertTrue(invoked);
-
-  assertFalse(delay.isActive());
-  assertFalse(delay.isDone());
-  assertFalse(onSuccessCalled);
-  assertTrue(onFailureCalled);
-}
-
-
-function testInfiniteDelay() {
-  returnValue = false;
-  delay.start(100, -1);
-
-  // Test in a big enough loop.
-  for (var i = 0; i < 1000; ++i) {
-    clock.tick(80);
-    assertTrue(delay.isActive());
-    assertFalse(delay.isDone());
-    assertFalse(onSuccessCalled);
-    assertFalse(onFailureCalled);
-  }
-
-  delay.stop();
-  assertFalse(delay.isActive());
-  assertFalse(delay.isDone());
-  assertFalse(onSuccessCalled);
-  assertFalse(onFailureCalled);
-}
-
-function testCallbackScope() {
-  var callbackCalled = false;
-  var scopeObject = {};
-  function internalCallback() {
-    assertEquals(this, scopeObject);
-    callbackCalled = true;
-    return true;
-  }
-  delay = new goog.async.ConditionalDelay(internalCallback, scopeObject);
-  delay.start(200, 200);
-  clock.tick(201);
-  assertTrue(callbackCalled);
-}

+ 0 - 206
src/renderer/cocoblockly-x/python/block/closure/goog/async/debouncer.js

@@ -1,206 +0,0 @@
-// Copyright 2015 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/**
- * @fileoverview Definition of the goog.async.Debouncer class.
- *
- * @see ../demos/timers.html
- */
-
-goog.provide('goog.async.Debouncer');
-
-goog.require('goog.Disposable');
-goog.require('goog.Timer');
-
-
-
-/**
- * Debouncer will perform a specified action exactly once for any sequence of
- * signals fired repeatedly so long as they are fired less than a specified
- * interval apart (in milliseconds). Whether it receives one signal or multiple,
- * it will always wait until a full interval has elapsed since the last signal
- * before performing the action.
- * @param {function(this: T, ...?)} listener Function to callback when the
- *     action is triggered.
- * @param {number} interval Interval over which to debounce. The listener will
- *     only be called after the full interval has elapsed since the last signal.
- * @param {T=} opt_handler Object in whose scope to call the listener.
- * @constructor
- * @struct
- * @extends {goog.Disposable}
- * @final
- * @template T
- */
-goog.async.Debouncer = function(listener, interval, opt_handler) {
-  goog.async.Debouncer.base(this, 'constructor');
-
-  /**
-   * Function to callback
-   * @const @private {function(this: T, ...?)}
-   */
-  this.listener_ =
-      opt_handler != null ? goog.bind(listener, opt_handler) : listener;
-
-  /**
-   * Interval for the debounce time
-   * @const @private {number}
-   */
-  this.interval_ = interval;
-
-  /**
-   * Cached callback function invoked after the debounce timeout completes
-   * @const @private {!Function}
-   */
-  this.callback_ = goog.bind(this.onTimer_, this);
-
-  /**
-   * Indicates that the action is pending and needs to be fired.
-   * @private {boolean}
-   */
-  this.shouldFire_ = false;
-
-  /**
-   * Indicates the count of nested pauses currently in effect on the debouncer.
-   * When this count is not zero, fired actions will be postponed until the
-   * debouncer is resumed enough times to drop the pause count to zero.
-   * @private {number}
-   */
-  this.pauseCount_ = 0;
-
-  /**
-   * Timer for scheduling the next callback
-   * @private {?number}
-   */
-  this.timer_ = null;
-
-  /**
-   * When set this is a timestamp. On the onfire we want to reschedule the
-   * callback so it ends up at this time.
-   * @private {?number}
-   */
-  this.refireAt_ = null;
-
-  /**
-   * The last arguments passed into {@code fire}.
-   * @private {!IArrayLike}
-   */
-  this.args_ = [];
-};
-goog.inherits(goog.async.Debouncer, goog.Disposable);
-
-
-/**
- * Notifies the debouncer that the action has happened. It will debounce the
- * call so that the callback is only called after the last action in a sequence
- * of actions separated by periods less the interval parameter passed to the
- * constructor, passing the arguments from the last call of this function into
- * the debounced function.
- * @param {...?} var_args Arguments to pass on to the debounced function.
- */
-goog.async.Debouncer.prototype.fire = function(var_args) {
-  this.args_ = arguments;
-  // When this method is called, we need to prevent fire() calls from within the
-  // previous interval from calling the callback. The simplest way of doing this
-  // is to call this.stop() which calls clearTimeout, and then reschedule the
-  // timeout. However clearTimeout and setTimeout are expensive, so we just
-  // leave them untouched and when they do happen we potentially reschedule.
-  this.shouldFire_ = false;
-  if (this.timer_) {
-    this.refireAt_ = goog.now() + this.interval_;
-    return;
-  }
-  this.timer_ = goog.Timer.callOnce(this.callback_, this.interval_);
-};
-
-
-/**
- * Cancels any pending action callback. The debouncer can be restarted by
- * calling {@link #fire}.
- */
-goog.async.Debouncer.prototype.stop = function() {
-  if (this.timer_) {
-    goog.Timer.clear(this.timer_);
-    this.timer_ = null;
-  }
-  this.refireAt_ = null;
-  this.shouldFire_ = false;
-  this.args_ = [];
-};
-
-
-/**
- * Pauses the debouncer. All pending and future action callbacks will be delayed
- * until the debouncer is resumed. Pauses can be nested.
- */
-goog.async.Debouncer.prototype.pause = function() {
-  ++this.pauseCount_;
-};
-
-
-/**
- * Resumes the debouncer. If doing so drops the pausing count to zero, pending
- * action callbacks will be executed as soon as possible, but still no sooner
- * than an interval's delay after the previous call. Future action callbacks
- * will be executed as normal.
- */
-goog.async.Debouncer.prototype.resume = function() {
-  if (!this.pauseCount_) {
-    return;
-  }
-
-  --this.pauseCount_;
-  if (!this.pauseCount_ && this.shouldFire_) {
-    this.doAction_();
-  }
-};
-
-
-/** @override */
-goog.async.Debouncer.prototype.disposeInternal = function() {
-  this.stop();
-  goog.async.Debouncer.base(this, 'disposeInternal');
-};
-
-
-/**
- * Handler for the timer to fire the debouncer.
- * @private
- */
-goog.async.Debouncer.prototype.onTimer_ = function() {
-  // There is a newer call to fire() within the debounce interval.
-  // Reschedule the callback and return.
-  if (this.refireAt_) {
-    this.timer_ =
-        goog.Timer.callOnce(this.callback_, this.refireAt_ - goog.now());
-    this.refireAt_ = null;
-    return;
-  }
-  this.timer_ = null;
-
-  if (!this.pauseCount_) {
-    this.doAction_();
-  } else {
-    this.shouldFire_ = true;
-  }
-};
-
-
-/**
- * Calls the callback.
- * @private
- */
-goog.async.Debouncer.prototype.doAction_ = function() {
-  this.shouldFire_ = false;
-  this.listener_.apply(null, this.args_);
-};

+ 0 - 23
src/renderer/cocoblockly-x/python/block/closure/goog/async/debouncer_test.html

@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!--
-Copyright 2015 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
- <head>
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta charset="UTF-8" />
-  <title>
-   Closure Unit Tests - goog.async.Debouncer
-  </title>
-  <script src="../base.js">
-  </script>
-  <script>
-   goog.require('goog.async.DebouncerTest');
-  </script>
- </head>
- <body>
- </body>
-</html>

+ 0 - 187
src/renderer/cocoblockly-x/python/block/closure/goog/async/debouncer_test.js

@@ -1,187 +0,0 @@
-// Copyright 2015 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-goog.provide('goog.async.DebouncerTest');
-goog.setTestOnly('goog.async.DebouncerTest');
-
-goog.require('goog.array');
-goog.require('goog.async.Debouncer');
-goog.require('goog.testing.MockClock');
-goog.require('goog.testing.jsunit');
-goog.require('goog.testing.recordFunction');
-
-
-function testDebouncerCommandSequences() {
-  // Encoded sequences of commands to perform mapped to expected # of calls.
-  //   f: fire
-  //   w: wait (for the debouncing timer to elapse)
-  //   p: pause
-  //   r: resume
-  //   s: stop
-  var expectedCommandSequenceCalls = {
-    'f': 0,
-    'ff': 0,
-    'fw': 1,
-    'ffw': 1,
-    'fpr': 0,
-    'fsf': 0,
-    'fsw': 0,
-    'fprw': 1,
-    'fpwr': 1,
-    'fsfw': 1,
-    'fswf': 0,
-    'fprfw': 1,
-    'fprsw': 0,
-    'fpswr': 0,
-    'fpwfr': 0,
-    'fpwsr': 0,
-    'fswfw': 1,
-    'fpswrw': 0,
-    'fpwfrw': 1,
-    'fpwsfr': 0,
-    'fpwsrw': 0,
-    'fspwrw': 0,
-    'fpwsfrw': 1,
-    'ffwfwfffw': 3
-  };
-  var interval = 500;
-
-  var mockClock = new goog.testing.MockClock(true);
-  for (var commandSequence in expectedCommandSequenceCalls) {
-    var recordFn = goog.testing.recordFunction();
-    var debouncer = new goog.async.Debouncer(recordFn, interval);
-
-    for (var i = 0; i < commandSequence.length; ++i) {
-      switch (commandSequence[i]) {
-        case 'f':
-          debouncer.fire();
-          break;
-        case 'w':
-          mockClock.tick(interval);
-          break;
-        case 'p':
-          debouncer.pause();
-          break;
-        case 'r':
-          debouncer.resume();
-          break;
-        case 's':
-          debouncer.stop();
-          break;
-      }
-    }
-
-    var expectedCalls = expectedCommandSequenceCalls[commandSequence];
-    assertEquals(
-        'Expected ' + expectedCalls + ' calls for command sequence "' +
-            commandSequence + '" (' +
-            goog.array
-                .map(
-                    commandSequence,
-                    function(command) {
-                      switch (command) {
-                        case 'f':
-                          return 'fire';
-                        case 'w':
-                          return 'wait';
-                        case 'p':
-                          return 'pause';
-                        case 'r':
-                          return 'resume';
-                        case 's':
-                          return 'stop';
-                      }
-                    })
-                .join(' -> ') +
-            ')',
-        expectedCalls, recordFn.getCallCount());
-    debouncer.dispose();
-  }
-  mockClock.uninstall();
-}
-
-
-function testDebouncerScopeBinding() {
-  var interval = 500;
-  var mockClock = new goog.testing.MockClock(true);
-
-  var x = {'y': 0};
-  var debouncer =
-      new goog.async.Debouncer(function() { ++this['y']; }, interval, x);
-  debouncer.fire();
-  assertEquals(0, x['y']);
-
-  mockClock.tick(interval);
-  assertEquals(1, x['y']);
-
-  mockClock.uninstall();
-}
-
-
-function testDebouncerArgumentBinding() {
-  var interval = 500;
-  var mockClock = new goog.testing.MockClock(true);
-
-  var calls = 0;
-  var debouncer = new goog.async.Debouncer(function(a, b, c) {
-    ++calls;
-    assertEquals(3, a);
-    assertEquals('string', b);
-    assertEquals(false, c);
-  }, interval);
-
-  debouncer.fire(3, 'string', false);
-  mockClock.tick(interval);
-  assertEquals(1, calls);
-
-  // fire should always pass the last arguments passed to it into the decorated
-  // function, even if called multiple times.
-  debouncer.fire();
-  mockClock.tick(interval / 2);
-  debouncer.fire(8, null, true);
-  debouncer.fire(3, 'string', false);
-  mockClock.tick(interval);
-  assertEquals(2, calls);
-
-  mockClock.uninstall();
-}
-
-
-function testDebouncerArgumentAndScopeBinding() {
-  var interval = 500;
-  var mockClock = new goog.testing.MockClock(true);
-
-  var x = {'calls': 0};
-  var debouncer = new goog.async.Debouncer(function(a, b, c) {
-    ++this['calls'];
-    assertEquals(3, a);
-    assertEquals('string', b);
-    assertEquals(false, c);
-  }, interval, x);
-
-  debouncer.fire(3, 'string', false);
-  mockClock.tick(interval);
-  assertEquals(1, x['calls']);
-
-  // fire should always pass the last arguments passed to it into the decorated
-  // function, even if called multiple times.
-  debouncer.fire();
-  mockClock.tick(interval / 2);
-  debouncer.fire(8, null, true);
-  debouncer.fire(3, 'string', false);
-  mockClock.tick(interval);
-  assertEquals(2, x['calls']);
-
-  mockClock.uninstall();
-}

+ 0 - 193
src/renderer/cocoblockly-x/python/block/closure/goog/async/delay.js

@@ -1,193 +0,0 @@
-// Copyright 2007 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/**
- * @fileoverview Defines a class useful for handling functions that must be
- * invoked after a delay, especially when that delay is frequently restarted.
- * Examples include delaying before displaying a tooltip, menu hysteresis,
- * idle timers, etc.
- * @author brenneman@google.com (Shawn Brenneman)
- * @see ../demos/timers.html
- */
-
-
-goog.provide('goog.Delay');
-goog.provide('goog.async.Delay');
-
-goog.require('goog.Disposable');
-goog.require('goog.Timer');
-
-
-
-/**
- * A Delay object invokes the associated function after a specified delay. The
- * interval duration can be specified once in the constructor, or can be defined
- * each time the delay is started. Calling start on an active delay will reset
- * the timer.
- *
- * @param {function(this:THIS)} listener Function to call when the
- *     delay completes.
- * @param {number=} opt_interval The default length of the invocation delay (in
- *     milliseconds).
- * @param {THIS=} opt_handler The object scope to invoke the function in.
- * @template THIS
- * @constructor
- * @struct
- * @extends {goog.Disposable}
- * @final
- */
-goog.async.Delay = function(listener, opt_interval, opt_handler) {
-  goog.async.Delay.base(this, 'constructor');
-
-  /**
-   * The function that will be invoked after a delay.
-   * @private {function(this:THIS)}
-   */
-  this.listener_ = listener;
-
-  /**
-   * The default amount of time to delay before invoking the callback.
-   * @type {number}
-   * @private
-   */
-  this.interval_ = opt_interval || 0;
-
-  /**
-   * The object context to invoke the callback in.
-   * @type {Object|undefined}
-   * @private
-   */
-  this.handler_ = opt_handler;
-
-
-  /**
-   * Cached callback function invoked when the delay finishes.
-   * @type {Function}
-   * @private
-   */
-  this.callback_ = goog.bind(this.doAction_, this);
-};
-goog.inherits(goog.async.Delay, goog.Disposable);
-
-
-
-/**
- * A deprecated alias.
- * @deprecated Use goog.async.Delay instead.
- * @constructor
- * @final
- */
-goog.Delay = goog.async.Delay;
-
-
-/**
- * Identifier of the active delay timeout, or 0 when inactive.
- * @type {number}
- * @private
- */
-goog.async.Delay.prototype.id_ = 0;
-
-
-/**
- * Disposes of the object, cancelling the timeout if it is still outstanding and
- * removing all object references.
- * @override
- * @protected
- */
-goog.async.Delay.prototype.disposeInternal = function() {
-  goog.async.Delay.base(this, 'disposeInternal');
-  this.stop();
-  delete this.listener_;
-  delete this.handler_;
-};
-
-
-/**
- * Starts the delay timer. The provided listener function will be called after
- * the specified interval. Calling start on an active timer will reset the
- * delay interval.
- * @param {number=} opt_interval If specified, overrides the object's default
- *     interval with this one (in milliseconds).
- */
-goog.async.Delay.prototype.start = function(opt_interval) {
-  this.stop();
-  this.id_ = goog.Timer.callOnce(
-      this.callback_, goog.isDef(opt_interval) ? opt_interval : this.interval_);
-};
-
-
-/**
- * Starts the delay timer if it's not already active.
- * @param {number=} opt_interval If specified and the timer is not already
- *     active, overrides the object's default interval with this one (in
- *     milliseconds).
- */
-goog.async.Delay.prototype.startIfNotActive = function(opt_interval) {
-  if (!this.isActive()) {
-    this.start(opt_interval);
-  }
-};
-
-
-/**
- * Stops the delay timer if it is active. No action is taken if the timer is not
- * in use.
- */
-goog.async.Delay.prototype.stop = function() {
-  if (this.isActive()) {
-    goog.Timer.clear(this.id_);
-  }
-  this.id_ = 0;
-};
-
-
-/**
- * Fires delay's action even if timer has already gone off or has not been
- * started yet; guarantees action firing. Stops the delay timer.
- */
-goog.async.Delay.prototype.fire = function() {
-  this.stop();
-  this.doAction_();
-};
-
-
-/**
- * Fires delay's action only if timer is currently active. Stops the delay
- * timer.
- */
-goog.async.Delay.prototype.fireIfActive = function() {
-  if (this.isActive()) {
-    this.fire();
-  }
-};
-
-
-/**
- * @return {boolean} True if the delay is currently active, false otherwise.
- */
-goog.async.Delay.prototype.isActive = function() {
-  return this.id_ != 0;
-};
-
-
-/**
- * Invokes the callback function after the delay successfully completes.
- * @private
- */
-goog.async.Delay.prototype.doAction_ = function() {
-  this.id_ = 0;
-  if (this.listener_) {
-    this.listener_.call(this.handler_);
-  }
-};

+ 0 - 23
src/renderer/cocoblockly-x/python/block/closure/goog/async/delay_test.html

@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!--
-Copyright 2007 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
- <head>
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta charset="UTF-8" />
-  <title>
-   Closure Unit Tests - goog.async.Delay
-  </title>
-  <script src="../base.js">
-  </script>
-  <script>
-   goog.require('goog.async.DelayTest');
-  </script>
- </head>
- <body>
- </body>
-</html>

+ 0 - 173
src/renderer/cocoblockly-x/python/block/closure/goog/async/delay_test.js

@@ -1,173 +0,0 @@
-// Copyright 2007 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-goog.provide('goog.async.DelayTest');
-goog.setTestOnly('goog.async.DelayTest');
-
-goog.require('goog.async.Delay');
-goog.require('goog.testing.MockClock');
-goog.require('goog.testing.jsunit');
-
-var invoked = false;
-var delay = null;
-var clock = null;
-
-
-function callback() {
-  invoked = true;
-}
-
-
-function setUp() {
-  clock = new goog.testing.MockClock(true);
-  invoked = false;
-  delay = new goog.async.Delay(callback, 200);
-}
-
-function tearDown() {
-  clock.dispose();
-  delay.dispose();
-}
-
-
-function testDelay() {
-  delay.start();
-  assertFalse(invoked);
-
-  clock.tick(100);
-  assertFalse(invoked);
-
-  clock.tick(100);
-  assertTrue(invoked);
-}
-
-
-function testStop() {
-  delay.start();
-
-  clock.tick(100);
-  assertFalse(invoked);
-
-  delay.stop();
-  clock.tick(100);
-  assertFalse(invoked);
-}
-
-
-function testIsActive() {
-  assertFalse(delay.isActive());
-  delay.start();
-  assertTrue(delay.isActive());
-  clock.tick(200);
-  assertFalse(delay.isActive());
-}
-
-
-function testRestart() {
-  delay.start();
-  clock.tick(100);
-
-  delay.stop();
-  assertFalse(invoked);
-
-  delay.start();
-  clock.tick(199);
-  assertFalse(invoked);
-
-  clock.tick(1);
-  assertTrue(invoked);
-
-  invoked = false;
-  delay.start();
-  clock.tick(200);
-  assertTrue(invoked);
-}
-
-
-function testStartIfNotActive() {
-  delay.startIfNotActive();
-  clock.tick(100);
-
-  delay.stop();
-  assertFalse(invoked);
-
-  delay.startIfNotActive();
-  clock.tick(199);
-  assertFalse(invoked);
-
-  clock.tick(1);
-  assertTrue(invoked);
-
-  invoked = false;
-  delay.start();
-  clock.tick(199);
-
-  assertFalse(invoked);
-
-  delay.startIfNotActive();
-  clock.tick(1);
-
-  assertTrue(invoked);
-}
-
-
-function testOverride() {
-  delay.start(50);
-  clock.tick(49);
-  assertFalse(invoked);
-
-  clock.tick(1);
-  assertTrue(invoked);
-}
-
-
-function testDispose() {
-  delay.start();
-  delay.dispose();
-  assertTrue(delay.isDisposed());
-
-  clock.tick(500);
-  assertFalse(invoked);
-}
-
-
-function testFire() {
-  delay.start();
-
-  clock.tick(50);
-  delay.fire();
-  assertTrue(invoked);
-  assertFalse(delay.isActive());
-
-  invoked = false;
-  clock.tick(200);
-  assertFalse(
-      'Delay fired early with fire call, timeout should have been ' +
-          'cleared',
-      invoked);
-}
-
-function testFireIfActive() {
-  delay.fireIfActive();
-  assertFalse(invoked);
-
-  delay.start();
-  delay.fireIfActive();
-  assertTrue(invoked);
-  invoked = false;
-  clock.tick(300);
-  assertFalse(
-      'Delay fired early with fireIfActive, timeout should have been ' +
-          'cleared',
-      invoked);
-}

+ 0 - 83
src/renderer/cocoblockly-x/python/block/closure/goog/async/freelist.js

@@ -1,83 +0,0 @@
-// Copyright 2015 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/**
- * @fileoverview Simple freelist.
- *
- * An anterative to goog.structs.SimplePool, it imposes the requirement that the
- * objects in the list contain a "next" property that can be used to maintain
- * the pool.
- */
-
-goog.provide('goog.async.FreeList');
-
-
-/**
- * @template ITEM
- */
-goog.async.FreeList = goog.defineClass(null, {
-  /**
-   * @param {function():ITEM} create
-   * @param {function(ITEM):void} reset
-   * @param {number} limit
-   */
-  constructor: function(create, reset, limit) {
-    /** @private @const {number} */
-    this.limit_ = limit;
-    /** @private @const {function()} */
-    this.create_ = create;
-    /** @private @const {function(ITEM):void} */
-    this.reset_ = reset;
-
-    /** @private {number} */
-    this.occupants_ = 0;
-    /** @private {ITEM} */
-    this.head_ = null;
-  },
-
-  /**
-   * @return {ITEM}
-   */
-  get: function() {
-    var item;
-    if (this.occupants_ > 0) {
-      this.occupants_--;
-      item = this.head_;
-      this.head_ = item.next;
-      item.next = null;
-    } else {
-      item = this.create_();
-    }
-    return item;
-  },
-
-  /**
-   * @param {ITEM} item An item available for possible future reuse.
-   */
-  put: function(item) {
-    this.reset_(item);
-    if (this.occupants_ < this.limit_) {
-      this.occupants_++;
-      item.next = this.head_;
-      this.head_ = item;
-    }
-  },
-
-  /**
-   * Visible for testing.
-   * @package
-   * @return {number}
-   */
-  occupants: function() { return this.occupants_; }
-});

+ 0 - 78
src/renderer/cocoblockly-x/python/block/closure/goog/async/freelist_test.js

@@ -1,78 +0,0 @@
-// Copyright 2015 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-goog.provide('goog.async.FreeListTest');
-goog.setTestOnly('goog.async.FreeListTest');
-
-goog.require('goog.async.FreeList');
-goog.require('goog.testing.jsunit');
-
-
-var id = 0;
-var list = null;
-
-function setUp() {
-  var id = 0;
-  var data = 1;
-  list = new goog.async.FreeList(
-      function() {
-        data *= 2;
-        return {id: id++, data: data, next: null};
-      },
-      function(item) { item.data = null; },
-      2);  // max occupancy
-}
-
-
-function tearDown() {
-  list = null;
-}
-
-function testItemsCreatedAsNeeded() {
-  assertEquals(0, list.occupants());
-  var item1 = list.get();
-  assertNotNullNorUndefined(item1);
-  var item2 = list.get();
-  assertNotNullNorUndefined(item2);
-  assertNotEquals(item1, item2);
-  assertEquals(0, list.occupants());
-}
-
-function testMaxOccupancy() {
-  assertEquals(0, list.occupants());
-  var item1 = list.get();
-  var item2 = list.get();
-  var item3 = list.get();
-
-  list.put(item1);
-  list.put(item2);
-  list.put(item3);
-
-  assertEquals(2, list.occupants());
-}
-
-function testRecycling() {
-  assertEquals(0, list.occupants());
-  var item1 = list.get();
-  assertNotNull(item1.data);
-
-  list.put(item1);
-
-  var item2 = list.get();
-
-  // Item recycled
-  assertEquals(item1, item2);
-  // reset method called
-  assertNull(item2.data);
-}

+ 0 - 266
src/renderer/cocoblockly-x/python/block/closure/goog/async/nexttick.js

@@ -1,266 +0,0 @@
-// Copyright 2013 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/**
- * @fileoverview Provides a function to schedule running a function as soon
- * as possible after the current JS execution stops and yields to the event
- * loop.
- *
- */
-
-goog.provide('goog.async.nextTick');
-goog.provide('goog.async.throwException');
-
-goog.require('goog.debug.entryPointRegistry');
-goog.require('goog.dom.TagName');
-goog.require('goog.functions');
-goog.require('goog.labs.userAgent.browser');
-goog.require('goog.labs.userAgent.engine');
-
-
-/**
- * Throw an item without interrupting the current execution context.  For
- * example, if processing a group of items in a loop, sometimes it is useful
- * to report an error while still allowing the rest of the batch to be
- * processed.
- * @param {*} exception
- */
-goog.async.throwException = function(exception) {
-  // Each throw needs to be in its own context.
-  goog.global.setTimeout(function() { throw exception; }, 0);
-};
-
-
-/**
- * Fires the provided callbacks as soon as possible after the current JS
- * execution context. setTimeout(…, 0) takes at least 4ms when called from
- * within another setTimeout(…, 0) for legacy reasons.
- *
- * This will not schedule the callback as a microtask (i.e. a task that can
- * preempt user input or networking callbacks). It is meant to emulate what
- * setTimeout(_, 0) would do if it were not throttled. If you desire microtask
- * behavior, use {@see goog.Promise} instead.
- *
- * @param {function(this:SCOPE)} callback Callback function to fire as soon as
- *     possible.
- * @param {SCOPE=} opt_context Object in whose scope to call the listener.
- * @param {boolean=} opt_useSetImmediate Avoid the IE workaround that
- *     ensures correctness at the cost of speed. See comments for details.
- * @template SCOPE
- */
-goog.async.nextTick = function(callback, opt_context, opt_useSetImmediate) {
-  var cb = callback;
-  if (opt_context) {
-    cb = goog.bind(callback, opt_context);
-  }
-  cb = goog.async.nextTick.wrapCallback_(cb);
-  // Note we do allow callers to also request setImmediate if they are willing
-  // to accept the possible tradeoffs of incorrectness in exchange for speed.
-  // The IE fallback of readystate change is much slower. See useSetImmediate_
-  // for details.
-  if (goog.isFunction(goog.global.setImmediate) &&
-      (opt_useSetImmediate || goog.async.nextTick.useSetImmediate_())) {
-    goog.global.setImmediate(cb);
-    return;
-  }
-
-  // Look for and cache the custom fallback version of setImmediate.
-  if (!goog.async.nextTick.setImmediate_) {
-    goog.async.nextTick.setImmediate_ =
-        goog.async.nextTick.getSetImmediateEmulator_();
-  }
-  goog.async.nextTick.setImmediate_(cb);
-};
-
-
-/**
- * Returns whether should use setImmediate implementation currently on window.
- *
- * window.setImmediate was introduced and currently only supported by IE10+,
- * but due to a bug in the implementation it is not guaranteed that
- * setImmediate is faster than setTimeout nor that setImmediate N is before
- * setImmediate N+1. That is why we do not use the native version if
- * available. We do, however, call setImmediate if it is a non-native function
- * because that indicates that it has been replaced by goog.testing.MockClock
- * which we do want to support.
- * See
- * http://connect.microsoft.com/IE/feedback/details/801823/setimmediate-and-messagechannel-are-broken-in-ie10
- *
- * @return {boolean} Whether to use the implementation of setImmediate defined
- *     on Window.
- * @private
- */
-goog.async.nextTick.useSetImmediate_ = function() {
-  // Not a browser environment.
-  if (!goog.global.Window || !goog.global.Window.prototype) {
-    return true;
-  }
-
-  // MS Edge has window.setImmediate natively, but it's not on Window.prototype.
-  // Also, there's no clean way to detect if the goog.global.setImmediate has
-  // been replaced by mockClock as its replacement also shows up as "[native
-  // code]" when using toString. Therefore, just always use
-  // goog.global.setImmediate for Edge. It's unclear if it suffers the same
-  // issues as IE10/11, but based on
-  // https://dev.modern.ie/testdrive/demos/setimmediatesorting/
-  // it seems they've been working to ensure it's WAI.
-  if (goog.labs.userAgent.browser.isEdge() ||
-      goog.global.Window.prototype.setImmediate != goog.global.setImmediate) {
-    // Something redefined setImmediate in which case we decide to use it (This
-    // is so that we use the mockClock setImmediate).
-    return true;
-  }
-
-  return false;
-};
-
-
-/**
- * Cache for the setImmediate implementation.
- * @type {function(function())}
- * @private
- */
-goog.async.nextTick.setImmediate_;
-
-
-/**
- * Determines the best possible implementation to run a function as soon as
- * the JS event loop is idle.
- * @return {function(function())} The "setImmediate" implementation.
- * @private
- */
-goog.async.nextTick.getSetImmediateEmulator_ = function() {
-  // Create a private message channel and use it to postMessage empty messages
-  // to ourselves.
-  /** @type {!Function|undefined} */
-  var Channel = goog.global['MessageChannel'];
-  // If MessageChannel is not available and we are in a browser, implement
-  // an iframe based polyfill in browsers that have postMessage and
-  // document.addEventListener. The latter excludes IE8 because it has a
-  // synchronous postMessage implementation.
-  if (typeof Channel === 'undefined' && typeof window !== 'undefined' &&
-      window.postMessage && window.addEventListener &&
-      // Presto (The old pre-blink Opera engine) has problems with iframes
-      // and contentWindow.
-      !goog.labs.userAgent.engine.isPresto()) {
-    /** @constructor */
-    Channel = function() {
-      // Make an empty, invisible iframe.
-      var iframe = /** @type {!HTMLIFrameElement} */ (
-          document.createElement(String(goog.dom.TagName.IFRAME)));
-      iframe.style.display = 'none';
-      iframe.src = '';
-      document.documentElement.appendChild(iframe);
-      var win = iframe.contentWindow;
-      var doc = win.document;
-      doc.open();
-      doc.write('');
-      doc.close();
-      // Do not post anything sensitive over this channel, as the workaround for
-      // pages with file: origin could allow that information to be modified or
-      // intercepted.
-      var message = 'callImmediate' + Math.random();
-      // The same origin policy rejects attempts to postMessage from file: urls
-      // unless the origin is '*'.
-      // TODO(b/16335441): Use '*' origin for data: and other similar protocols.
-      var origin = win.location.protocol == 'file:' ?
-          '*' :
-          win.location.protocol + '//' + win.location.host;
-      var onmessage = goog.bind(function(e) {
-        // Validate origin and message to make sure that this message was
-        // intended for us. If the origin is set to '*' (see above) only the
-        // message needs to match since, for example, '*' != 'file://'. Allowing
-        // the wildcard is ok, as we are not concerned with security here.
-        if ((origin != '*' && e.origin != origin) || e.data != message) {
-          return;
-        }
-        this['port1'].onmessage();
-      }, this);
-      win.addEventListener('message', onmessage, false);
-      this['port1'] = {};
-      this['port2'] = {
-        postMessage: function() { win.postMessage(message, origin); }
-      };
-    };
-  }
-  if (typeof Channel !== 'undefined' && !goog.labs.userAgent.browser.isIE()) {
-    // Exclude all of IE due to
-    // http://codeforhire.com/2013/09/21/setimmediate-and-messagechannel-broken-on-internet-explorer-10/
-    // which allows starving postMessage with a busy setTimeout loop.
-    // This currently affects IE10 and IE11 which would otherwise be able
-    // to use the postMessage based fallbacks.
-    var channel = new Channel();
-    // Use a fifo linked list to call callbacks in the right order.
-    var head = {};
-    var tail = head;
-    channel['port1'].onmessage = function() {
-      if (goog.isDef(head.next)) {
-        head = head.next;
-        var cb = head.cb;
-        head.cb = null;
-        cb();
-      }
-    };
-    return function(cb) {
-      tail.next = {cb: cb};
-      tail = tail.next;
-      channel['port2'].postMessage(0);
-    };
-  }
-  // Implementation for IE6 to IE10: Script elements fire an asynchronous
-  // onreadystatechange event when inserted into the DOM.
-  if (typeof document !== 'undefined' &&
-      'onreadystatechange' in
-          document.createElement(String(goog.dom.TagName.SCRIPT))) {
-    return function(cb) {
-      var script = document.createElement(String(goog.dom.TagName.SCRIPT));
-      script.onreadystatechange = function() {
-        // Clean up and call the callback.
-        script.onreadystatechange = null;
-        script.parentNode.removeChild(script);
-        script = null;
-        cb();
-        cb = null;
-      };
-      document.documentElement.appendChild(script);
-    };
-  }
-  // Fall back to setTimeout with 0. In browsers this creates a delay of 5ms
-  // or more.
-  // NOTE(user): This fallback is used for IE11.
-  return function(cb) {
-    goog.global.setTimeout(/** @type {function()} */ (cb), 0);
-  };
-};
-
-
-/**
- * Helper function that is overrided to protect callbacks with entry point
- * monitor if the application monitors entry points.
- * @param {function()} callback Callback function to fire as soon as possible.
- * @return {function()} The wrapped callback.
- * @private
- */
-goog.async.nextTick.wrapCallback_ = goog.functions.identity;
-
-
-// Register the callback function as an entry point, so that it can be
-// monitored for exception handling, etc. This has to be done in this file
-// since it requires special code to handle all browsers.
-goog.debug.entryPointRegistry.register(
-    /**
-     * @param {function(!Function): !Function} transformer The transforming
-     *     function.
-     */
-    function(transformer) { goog.async.nextTick.wrapCallback_ = transformer; });

+ 0 - 23
src/renderer/cocoblockly-x/python/block/closure/goog/async/nexttick_test.html

@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!--
-Copyright 2013 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
- <head>
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta charset="UTF-8" />
-  <title>
-   Closure Unit Tests - goog.async.nextTick
-  </title>
-  <script src="../base.js">
-  </script>
-  <script>
-   goog.require('goog.async.nextTickTest');
-  </script>
- </head>
- <body>
- </body>
-</html>

+ 0 - 244
src/renderer/cocoblockly-x/python/block/closure/goog/async/nexttick_test.js

@@ -1,244 +0,0 @@
-// Copyright 2013 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-goog.provide('goog.async.nextTickTest');
-goog.setTestOnly('goog.async.nextTickTest');
-
-goog.require('goog.Promise');
-goog.require('goog.Timer');
-goog.require('goog.async.nextTick');
-goog.require('goog.debug.ErrorHandler');
-goog.require('goog.debug.entryPointRegistry');
-goog.require('goog.dom');
-goog.require('goog.dom.TagName');
-goog.require('goog.labs.userAgent.browser');
-goog.require('goog.testing.MockClock');
-goog.require('goog.testing.PropertyReplacer');
-goog.require('goog.testing.jsunit');
-
-var clock;
-var propertyReplacer = new goog.testing.PropertyReplacer();
-
-function setUp() {
-  clock = null;
-}
-
-function tearDown() {
-  if (clock) {
-    clock.uninstall();
-  }
-  // Unset the cached setImmediate_ behavior so it's re-evaluated for each test.
-  goog.async.nextTick.setImmediate_ = undefined;
-  propertyReplacer.reset();
-}
-
-
-function testNextTick() {
-  return new goog.Promise(function(resolve, reject) {
-    var c = 0;
-    var max = 100;
-    var async = true;
-    var counterStep = function(i) {
-      async = false;
-      assertEquals('Order correct', i, c);
-      c++;
-      if (c === max) {
-        resolve();
-      }
-    };
-    for (var i = 0; i < max; i++) {
-      goog.async.nextTick(goog.partial(counterStep, i));
-    }
-    assertTrue(async);
-  });
-}
-
-
-function testNextTickSetImmediate() {
-  return new goog.Promise(function(resolve, reject) {
-    var c = 0;
-    var max = 100;
-    var async = true;
-    var counterStep = function(i) {
-      async = false;
-      assertEquals('Order correct', i, c);
-      c++;
-      if (c === max) {
-        resolve();
-      }
-    };
-    for (var i = 0; i < max; i++) {
-      goog.async.nextTick(
-          goog.partial(counterStep, i), undefined,
-          /* opt_useSetImmediate */ true);
-    }
-    assertTrue(async);
-  });
-}
-
-function testNextTickContext() {
-  return new goog.Promise(function(resolve, reject) {
-    var context = {};
-    var c = 0;
-    var max = 10;
-    var async = true;
-    var counterStep = function(i) {
-      async = false;
-      assertEquals('Order correct', i, c);
-      assertEquals(context, this);
-      c++;
-      if (c === max) {
-        resolve();
-      }
-    };
-    for (var i = 0; i < max; i++) {
-      goog.async.nextTick(goog.partial(counterStep, i), context);
-    }
-    assertTrue(async);
-  });
-}
-
-
-function testNextTickMockClock() {
-  clock = new goog.testing.MockClock(true);
-  var result = '';
-  goog.async.nextTick(function() { result += 'a'; });
-  goog.async.nextTick(function() { result += 'b'; });
-  goog.async.nextTick(function() { result += 'c'; });
-  assertEquals('', result);
-  clock.tick(0);
-  assertEquals('abc', result);
-}
-
-
-function testNextTickDoesntSwallowError() {
-  return new goog.Promise(function(resolve, reject) {
-    var sentinel = 'sentinel';
-
-    propertyReplacer.replace(window, 'onerror', function(e) {
-      e = '' + e;
-      // Don't test for contents in IE7, which does not preserve the exception
-      // message.
-      if (e.indexOf('Exception thrown and not caught') == -1) {
-        assertContains(sentinel, e);
-      }
-      resolve();
-      return false;
-    });
-
-    goog.async.nextTick(function() { throw sentinel; });
-  });
-}
-
-
-function testNextTickProtectEntryPoint() {
-  return new goog.Promise(function(resolve, reject) {
-    var errorHandlerCallbackCalled = false;
-    var errorHandler = new goog.debug.ErrorHandler(function() {
-      errorHandlerCallbackCalled = true;
-    });
-
-    // MS Edge will always use goog.global.setImmediate, so ensure we get
-    // to setImmediate_ here. See useSetImmediate_ implementation for details on
-    // Edge special casing.
-    propertyReplacer.set(
-        goog.async.nextTick, 'useSetImmediate_', function() { return false; });
-
-    // This is only testing wrapping the callback with the protected entry
-    // point, so it's okay to replace this function with a fake.
-    propertyReplacer.set(goog.async.nextTick, 'setImmediate_', function(cb) {
-      try {
-        cb();
-        fail('The callback should have thrown an error.');
-      } catch (e) {
-        assertTrue(errorHandlerCallbackCalled);
-        assertTrue(e instanceof goog.debug.ErrorHandler.ProtectedFunctionError);
-      } finally {
-        // Restore setImmediate so it doesn't interfere with Promise behavior.
-        propertyReplacer.reset();
-      }
-      resolve();
-    });
-
-    goog.debug.entryPointRegistry.monitorAll(errorHandler);
-    goog.async.nextTick(function() {
-      throw Error('This should be caught by the protected function.');
-    });
-  });
-}
-
-
-function testNextTick_notStarvedBySetTimeout() {
-  // This test will timeout when affected by
-  // http://codeforhire.com/2013/09/21/setimmediate-and-messagechannel-broken-on-internet-explorer-10/
-  // This test would fail without the fix introduced in cl/72472221
-  // It keeps scheduling 0 timeouts and a single nextTick. If the nextTick
-  // ever fires, the IE specific problem does not occur.
-  var timeout;
-  function busy() {
-    timeout = setTimeout(function() { busy(); }, 0);
-  }
-  busy();
-
-  return new goog.Promise(function(resolve, reject) {
-    goog.async.nextTick(function() {
-      if (timeout) {
-        clearTimeout(timeout);
-      }
-      resolve();
-    });
-  });
-}
-
-
-/**
- * Test a scenario in which the iframe used by the postMessage polyfill gets a
- * message that does not have match what is expected. In this case, the polyfill
- * should not try to invoke a callback (which would result in an error because
- * there would be no callbacks in the linked list).
- */
-function testPostMessagePolyfillDoesNotPumpCallbackQueueIfMessageIsIncorrect() {
-  // EDGE/IE does not use the postMessage polyfill.
-  if (goog.labs.userAgent.browser.isIE() ||
-      goog.labs.userAgent.browser.isEdge()) {
-    return;
-  }
-
-  // Force postMessage polyfill for setImmediate.
-  propertyReplacer.set(window, 'setImmediate', undefined);
-  propertyReplacer.set(window, 'MessageChannel', undefined);
-
-  var callbackCalled = false;
-  goog.async.nextTick(function() { callbackCalled = true; });
-
-  var frame = goog.dom.getElementsByTagName(goog.dom.TagName.IFRAME)[0];
-  frame.contentWindow.postMessage(
-      'bogus message', window.location.protocol + '//' + window.location.host, "*");
-
-  var error = null;
-  frame.contentWindow.onerror = function(e) { error = e; };
-  return goog.Timer.promise(3)
-      .then(function() {
-        assert('Callback should have been called.', callbackCalled);
-        assertNull('An unexpected error was thrown.', error);
-      })
-      .thenAlways(function() { goog.dom.removeNode(frame); });
-}
-
-
-function testBehaviorOnPagesWithOverriddenWindowConstructor() {
-  propertyReplacer.set(goog.global, 'Window', {});
-  testNextTick();
-  testNextTickSetImmediate();
-  testNextTickMockClock();
-}

+ 0 - 136
src/renderer/cocoblockly-x/python/block/closure/goog/async/run.js

@@ -1,136 +0,0 @@
-// Copyright 2013 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-goog.provide('goog.async.run');
-
-goog.require('goog.async.WorkQueue');
-goog.require('goog.async.nextTick');
-goog.require('goog.async.throwException');
-
-
-/**
- * Fires the provided callback just before the current callstack unwinds, or as
- * soon as possible after the current JS execution context.
- * @param {function(this:THIS)} callback
- * @param {THIS=} opt_context Object to use as the "this value" when calling
- *     the provided function.
- * @template THIS
- */
-goog.async.run = function(callback, opt_context) {
-  if (!goog.async.run.schedule_) {
-    goog.async.run.initializeRunner_();
-  }
-  if (!goog.async.run.workQueueScheduled_) {
-    // Nothing is currently scheduled, schedule it now.
-    goog.async.run.schedule_();
-    goog.async.run.workQueueScheduled_ = true;
-  }
-
-  goog.async.run.workQueue_.add(callback, opt_context);
-};
-
-
-/**
- * Initializes the function to use to process the work queue.
- * @private
- */
-goog.async.run.initializeRunner_ = function() {
-  // If native Promises are available in the browser, just schedule the callback
-  // on a fulfilled promise, which is specified to be async, but as fast as
-  // possible.  Use goog.global.Promise instead of just Promise because the
-  // relevant externs may be missing, and don't alias it because this could
-  // confuse the compiler into thinking the polyfill is required when it should
-  // be treated as optional.
-  if (String(goog.global.Promise).indexOf('[native code]') != -1) {
-    var promise = goog.global.Promise.resolve(undefined);
-    goog.async.run.schedule_ = function() {
-      promise.then(goog.async.run.processWorkQueue);
-    };
-  } else {
-    goog.async.run.schedule_ = function() {
-      goog.async.nextTick(goog.async.run.processWorkQueue);
-    };
-  }
-};
-
-
-/**
- * Forces goog.async.run to use nextTick instead of Promise.
- *
- * This should only be done in unit tests. It's useful because MockClock
- * replaces nextTick, but not the browser Promise implementation, so it allows
- * Promise-based code to be tested with MockClock.
- *
- * However, we also want to run promises if the MockClock is no longer in
- * control so we schedule a backup "setTimeout" to the unmocked timeout if
- * provided.
- *
- * @param {function(function())=} opt_realSetTimeout
- */
-goog.async.run.forceNextTick = function(opt_realSetTimeout) {
-  goog.async.run.schedule_ = function() {
-    goog.async.nextTick(goog.async.run.processWorkQueue);
-    if (opt_realSetTimeout) {
-      opt_realSetTimeout(goog.async.run.processWorkQueue);
-    }
-  };
-};
-
-
-/**
- * The function used to schedule work asynchronousely.
- * @private {function()}
- */
-goog.async.run.schedule_;
-
-
-/** @private {boolean} */
-goog.async.run.workQueueScheduled_ = false;
-
-
-/** @private {!goog.async.WorkQueue} */
-goog.async.run.workQueue_ = new goog.async.WorkQueue();
-
-
-if (goog.DEBUG) {
-  /**
-   * Reset the work queue. Only available for tests in debug mode.
-   */
-  goog.async.run.resetQueue = function() {
-    goog.async.run.workQueueScheduled_ = false;
-    goog.async.run.workQueue_ = new goog.async.WorkQueue();
-  };
-}
-
-
-/**
- * Run any pending goog.async.run work items. This function is not intended
- * for general use, but for use by entry point handlers to run items ahead of
- * goog.async.nextTick.
- */
-goog.async.run.processWorkQueue = function() {
-  // NOTE: additional work queue items may be added while processing.
-  var item = null;
-  while (item = goog.async.run.workQueue_.remove()) {
-    try {
-      item.fn.call(item.scope);
-    } catch (e) {
-      goog.async.throwException(e);
-    }
-    goog.async.run.workQueue_.returnUnused(item);
-  }
-
-  // There are no more work items, allow processing to be scheduled again.
-  goog.async.run.workQueueScheduled_ = false;
-};

+ 0 - 144
src/renderer/cocoblockly-x/python/block/closure/goog/async/run_test.js

@@ -1,144 +0,0 @@
-// Copyright 2013 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-goog.provide('goog.async.runTest');
-
-goog.require('goog.async.run');
-goog.require('goog.testing.MockClock');
-goog.require('goog.testing.jsunit');
-goog.require('goog.testing.recordFunction');
-
-goog.setTestOnly('goog.async.runTest');
-
-
-var mockClock;
-var futureCallback1, futureCallback2;
-
-function setUpPage() {
-  mockClock = new goog.testing.MockClock();
-  mockClock.install();
-}
-
-function setUp() {
-  mockClock.reset();
-  futureCallback1 = new goog.testing.recordFunction();
-  futureCallback2 = new goog.testing.recordFunction();
-}
-
-function tearDown() {
-  futureCallback1 = null;
-  futureCallback2 = null;
-}
-
-function tearDownPage() {
-  mockClock.uninstall();
-  goog.dispose(mockClock);
-}
-
-function testCalledAsync() {
-  goog.async.run(futureCallback1);
-  goog.async.run(futureCallback2);
-
-  assertEquals(0, futureCallback1.getCallCount());
-  assertEquals(0, futureCallback2.getCallCount());
-
-  // but the callbacks are scheduled...
-  mockClock.tick();
-
-  // and called.
-  assertEquals(1, futureCallback1.getCallCount());
-  assertEquals(1, futureCallback2.getCallCount());
-
-  // and aren't called a second time.
-  assertEquals(1, futureCallback1.getCallCount());
-  assertEquals(1, futureCallback2.getCallCount());
-}
-
-function testSequenceCalledInOrder() {
-  futureCallback1 = new goog.testing.recordFunction(function() {
-    // called before futureCallback2
-    assertEquals(0, futureCallback2.getCallCount());
-  });
-  futureCallback2 = new goog.testing.recordFunction(function() {
-    // called after futureCallback1
-    assertEquals(1, futureCallback1.getCallCount());
-  });
-  goog.async.run(futureCallback1);
-  goog.async.run(futureCallback2);
-
-  // goog.async.run doesn't call the top callback immediately.
-  assertEquals(0, futureCallback1.getCallCount());
-
-  // but the callbacks are scheduled...
-  mockClock.tick();
-
-  // and called during the same "tick".
-  assertEquals(1, futureCallback1.getCallCount());
-  assertEquals(1, futureCallback2.getCallCount());
-}
-
-function testSequenceScheduledTwice() {
-  goog.async.run(futureCallback1);
-  goog.async.run(futureCallback1);
-
-  // goog.async.run doesn't call the top callback immediately.
-  assertEquals(0, futureCallback1.getCallCount());
-
-  // but the callbacks are scheduled...
-  mockClock.tick();
-
-  // and called twice during the same "tick".
-  assertEquals(2, futureCallback1.getCallCount());
-}
-
-function testSequenceCalledSync() {
-  futureCallback1 = new goog.testing.recordFunction(function() {
-    goog.async.run(futureCallback2);
-    // goog.async.run doesn't call the inner callback immediately.
-    assertEquals(0, futureCallback2.getCallCount());
-  });
-  goog.async.run(futureCallback1);
-
-  // goog.async.run doesn't call the top callback immediately.
-  assertEquals(0, futureCallback1.getCallCount());
-
-  // but the callbacks are scheduled...
-  mockClock.tick();
-
-  // and called during the same "tick".
-  assertEquals(1, futureCallback1.getCallCount());
-  assertEquals(1, futureCallback2.getCallCount());
-}
-
-function testScope() {
-  var aScope = {};
-  goog.async.run(futureCallback1);
-  goog.async.run(futureCallback2, aScope);
-
-  // the callbacks are scheduled...
-  mockClock.tick();
-
-  // and called.
-  assertEquals(1, futureCallback1.getCallCount());
-  assertEquals(1, futureCallback2.getCallCount());
-
-  // and get the correct scope.
-  var last1 = futureCallback1.popLastCall();
-  assertEquals(0, last1.getArguments().length);
-  assertEquals(goog.global, last1.getThis());
-
-  var last2 = futureCallback2.popLastCall();
-  assertEquals(0, last2.getArguments().length);
-  assertEquals(aScope, last2.getThis());
-}

+ 0 - 198
src/renderer/cocoblockly-x/python/block/closure/goog/async/throttle.js

@@ -1,198 +0,0 @@
-// Copyright 2007 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/**
- * @fileoverview Definition of the goog.async.Throttle class.
- *
- * @see ../demos/timers.html
- */
-
-goog.provide('goog.Throttle');
-goog.provide('goog.async.Throttle');
-
-goog.require('goog.Disposable');
-goog.require('goog.Timer');
-
-
-
-/**
- * Throttle will perform an action that is passed in no more than once
- * per interval (specified in milliseconds). If it gets multiple signals
- * to perform the action while it is waiting, it will only perform the action
- * once at the end of the interval.
- * @param {function(this: T, ...?)} listener Function to callback when the
- *     action is triggered.
- * @param {number} interval Interval over which to throttle. The listener can
- *     only be called once per interval.
- * @param {T=} opt_handler Object in whose scope to call the listener.
- * @constructor
- * @struct
- * @extends {goog.Disposable}
- * @final
- * @template T
- */
-goog.async.Throttle = function(listener, interval, opt_handler) {
-  goog.async.Throttle.base(this, 'constructor');
-
-  /**
-   * Function to callback
-   * @type {function(this: T, ...?)}
-   * @private
-   */
-  this.listener_ =
-      opt_handler != null ? goog.bind(listener, opt_handler) : listener;
-
-  /**
-   * Interval for the throttle time
-   * @type {number}
-   * @private
-   */
-  this.interval_ = interval;
-
-  /**
-   * Cached callback function invoked after the throttle timeout completes
-   * @type {Function}
-   * @private
-   */
-  this.callback_ = goog.bind(this.onTimer_, this);
-
-  /**
-   * The last arguments passed into {@code fire}.
-   * @private {!IArrayLike}
-   */
-  this.args_ = [];
-};
-goog.inherits(goog.async.Throttle, goog.Disposable);
-
-
-
-/**
- * A deprecated alias.
- * @deprecated Use goog.async.Throttle instead.
- * @constructor
- * @final
- */
-goog.Throttle = goog.async.Throttle;
-
-
-/**
- * Indicates that the action is pending and needs to be fired.
- * @type {boolean}
- * @private
- */
-goog.async.Throttle.prototype.shouldFire_ = false;
-
-
-/**
- * Indicates the count of nested pauses currently in effect on the throttle.
- * When this count is not zero, fired actions will be postponed until the
- * throttle is resumed enough times to drop the pause count to zero.
- * @type {number}
- * @private
- */
-goog.async.Throttle.prototype.pauseCount_ = 0;
-
-
-/**
- * Timer for scheduling the next callback
- * @type {?number}
- * @private
- */
-goog.async.Throttle.prototype.timer_ = null;
-
-
-/**
- * Notifies the throttle that the action has happened. It will throttle the call
- * so that the callback is not called too often according to the interval
- * parameter passed to the constructor, passing the arguments from the last call
- * of this function into the throttled function.
- * @param {...?} var_args Arguments to pass on to the throttled function.
- */
-goog.async.Throttle.prototype.fire = function(var_args) {
-  this.args_ = arguments;
-  if (!this.timer_ && !this.pauseCount_) {
-    this.doAction_();
-  } else {
-    this.shouldFire_ = true;
-  }
-};
-
-
-/**
- * Cancels any pending action callback. The throttle can be restarted by
- * calling {@link #fire}.
- */
-goog.async.Throttle.prototype.stop = function() {
-  if (this.timer_) {
-    goog.Timer.clear(this.timer_);
-    this.timer_ = null;
-    this.shouldFire_ = false;
-    this.args_ = [];
-  }
-};
-
-
-/**
- * Pauses the throttle.  All pending and future action callbacks will be
- * delayed until the throttle is resumed.  Pauses can be nested.
- */
-goog.async.Throttle.prototype.pause = function() {
-  this.pauseCount_++;
-};
-
-
-/**
- * Resumes the throttle.  If doing so drops the pausing count to zero, pending
- * action callbacks will be executed as soon as possible, but still no sooner
- * than an interval's delay after the previous call.  Future action callbacks
- * will be executed as normal.
- */
-goog.async.Throttle.prototype.resume = function() {
-  this.pauseCount_--;
-  if (!this.pauseCount_ && this.shouldFire_ && !this.timer_) {
-    this.shouldFire_ = false;
-    this.doAction_();
-  }
-};
-
-
-/** @override */
-goog.async.Throttle.prototype.disposeInternal = function() {
-  goog.async.Throttle.base(this, 'disposeInternal');
-  this.stop();
-};
-
-
-/**
- * Handler for the timer to fire the throttle
- * @private
- */
-goog.async.Throttle.prototype.onTimer_ = function() {
-  this.timer_ = null;
-
-  if (this.shouldFire_ && !this.pauseCount_) {
-    this.shouldFire_ = false;
-    this.doAction_();
-  }
-};
-
-
-/**
- * Calls the callback
- * @private
- */
-goog.async.Throttle.prototype.doAction_ = function() {
-  this.timer_ = goog.Timer.callOnce(this.callback_, this.interval_);
-  this.listener_.apply(null, this.args_);
-};

+ 0 - 23
src/renderer/cocoblockly-x/python/block/closure/goog/async/throttle_test.html

@@ -1,23 +0,0 @@
-<!DOCTYPE html>
-<html>
- <!--
-Copyright 2006 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
- <head>
-  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
-  <meta charset="UTF-8" />
-  <title>
-   Closure Unit Tests - goog.async.Throttle
-  </title>
-  <script src="../base.js">
-  </script>
-  <script>
-   goog.require('goog.async.ThrottleTest');
-  </script>
- </head>
- <body>
- </body>
-</html>

+ 0 - 161
src/renderer/cocoblockly-x/python/block/closure/goog/async/throttle_test.js

@@ -1,161 +0,0 @@
-// Copyright 2006 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-goog.provide('goog.async.ThrottleTest');
-goog.setTestOnly('goog.async.ThrottleTest');
-
-goog.require('goog.async.Throttle');
-goog.require('goog.testing.MockClock');
-goog.require('goog.testing.jsunit');
-
-function testThrottle() {
-  var clock = new goog.testing.MockClock(true);
-
-  var callBackCount = 0;
-  var callBackFunction = function() { callBackCount++; };
-
-  var throttle = new goog.async.Throttle(callBackFunction, 100);
-  assertEquals(0, callBackCount);
-  throttle.fire();
-  assertEquals(1, callBackCount);
-  throttle.fire();
-  assertEquals(1, callBackCount);
-  throttle.fire();
-  throttle.fire();
-  assertEquals(1, callBackCount);
-  clock.tick(101);
-  assertEquals(2, callBackCount);
-  clock.tick(101);
-  assertEquals(2, callBackCount);
-
-  throttle.fire();
-  assertEquals(3, callBackCount);
-  throttle.fire();
-  assertEquals(3, callBackCount);
-  throttle.stop();
-  clock.tick(101);
-  assertEquals(3, callBackCount);
-  throttle.fire();
-  assertEquals(4, callBackCount);
-  clock.tick(101);
-  assertEquals(4, callBackCount);
-
-  throttle.fire();
-  throttle.fire();
-  assertEquals(5, callBackCount);
-  throttle.pause();
-  throttle.resume();
-  assertEquals(5, callBackCount);
-  throttle.pause();
-  clock.tick(101);
-  assertEquals(5, callBackCount);
-  throttle.resume();
-  assertEquals(6, callBackCount);
-  clock.tick(101);
-  assertEquals(6, callBackCount);
-  throttle.pause();
-  throttle.fire();
-  assertEquals(6, callBackCount);
-  clock.tick(101);
-  assertEquals(6, callBackCount);
-  throttle.resume();
-  assertEquals(7, callBackCount);
-
-  throttle.pause();
-  throttle.pause();
-  clock.tick(101);
-  throttle.fire();
-  throttle.resume();
-  assertEquals(7, callBackCount);
-  throttle.resume();
-  assertEquals(8, callBackCount);
-
-  throttle.pause();
-  throttle.pause();
-  throttle.fire();
-  throttle.resume();
-  clock.tick(101);
-  assertEquals(8, callBackCount);
-  throttle.resume();
-  assertEquals(9, callBackCount);
-
-  clock.uninstall();
-}
-
-
-function testThrottleScopeBinding() {
-  var interval = 500;
-  var mockClock = new goog.testing.MockClock(true);
-
-  var x = {'y': 0};
-  new goog.async.Throttle(function() { ++this['y']; }, interval, x).fire();
-  assertEquals(1, x['y']);
-
-  mockClock.uninstall();
-}
-
-
-function testThrottleArgumentBinding() {
-  var interval = 500;
-  var mockClock = new goog.testing.MockClock(true);
-
-  var calls = 0;
-  var throttle = new goog.async.Throttle(function(a, b, c) {
-    ++calls;
-    assertEquals(3, a);
-    assertEquals('string', b);
-    assertEquals(false, c);
-  }, interval);
-
-  throttle.fire(3, 'string', false);
-  assertEquals(1, calls);
-
-  // fire should always pass the last arguments passed to it into the decorated
-  // function, even if called multiple times.
-  throttle.fire();
-  mockClock.tick(interval / 2);
-  throttle.fire(8, null, true);
-  throttle.fire(3, 'string', false);
-  mockClock.tick(interval);
-  assertEquals(2, calls);
-
-  mockClock.uninstall();
-}
-
-
-function testThrottleArgumentAndScopeBinding() {
-  var interval = 500;
-  var mockClock = new goog.testing.MockClock(true);
-
-  var x = {'calls': 0};
-  var throttle = new goog.async.Throttle(function(a, b, c) {
-    ++this['calls'];
-    assertEquals(3, a);
-    assertEquals('string', b);
-    assertEquals(false, c);
-  }, interval, x);
-
-  throttle.fire(3, 'string', false);
-  assertEquals(1, x['calls']);
-
-  // fire should always pass the last arguments passed to it into the decorated
-  // function, even if called multiple times.
-  throttle.fire();
-  mockClock.tick(interval / 2);
-  throttle.fire(8, null, true);
-  throttle.fire(3, 'string', false);
-  mockClock.tick(interval);
-  assertEquals(2, x['calls']);
-
-  mockClock.uninstall();
-}

+ 0 - 138
src/renderer/cocoblockly-x/python/block/closure/goog/async/workqueue.js

@@ -1,138 +0,0 @@
-// Copyright 2015 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-goog.provide('goog.async.WorkItem');
-goog.provide('goog.async.WorkQueue');
-
-goog.require('goog.asserts');
-goog.require('goog.async.FreeList');
-
-
-// TODO(johnlenz): generalize the WorkQueue if this is used by more
-// than goog.async.run.
-
-
-
-/**
- * A low GC workqueue. The key elements of this design:
- *   - avoids the need for goog.bind or equivalent by carrying scope
- *   - avoids the need for array reallocation by using a linked list
- *   - minimizes work entry objects allocation by recycling objects
- * @constructor
- * @final
- * @struct
- */
-goog.async.WorkQueue = function() {
-  this.workHead_ = null;
-  this.workTail_ = null;
-};
-
-
-/** @define {number} The maximum number of entries to keep for recycling. */
-goog.define('goog.async.WorkQueue.DEFAULT_MAX_UNUSED', 100);
-
-
-/** @const @private {goog.async.FreeList<goog.async.WorkItem>} */
-goog.async.WorkQueue.freelist_ = new goog.async.FreeList(
-    function() { return new goog.async.WorkItem(); },
-    function(item) { item.reset(); }, goog.async.WorkQueue.DEFAULT_MAX_UNUSED);
-
-
-/**
- * @param {function()} fn
- * @param {Object|null|undefined} scope
- */
-goog.async.WorkQueue.prototype.add = function(fn, scope) {
-  var item = this.getUnusedItem_();
-  item.set(fn, scope);
-
-  if (this.workTail_) {
-    this.workTail_.next = item;
-    this.workTail_ = item;
-  } else {
-    goog.asserts.assert(!this.workHead_);
-    this.workHead_ = item;
-    this.workTail_ = item;
-  }
-};
-
-
-/**
- * @return {goog.async.WorkItem}
- */
-goog.async.WorkQueue.prototype.remove = function() {
-  var item = null;
-
-  if (this.workHead_) {
-    item = this.workHead_;
-    this.workHead_ = this.workHead_.next;
-    if (!this.workHead_) {
-      this.workTail_ = null;
-    }
-    item.next = null;
-  }
-  return item;
-};
-
-
-/**
- * @param {goog.async.WorkItem} item
- */
-goog.async.WorkQueue.prototype.returnUnused = function(item) {
-  goog.async.WorkQueue.freelist_.put(item);
-};
-
-
-/**
- * @return {goog.async.WorkItem}
- * @private
- */
-goog.async.WorkQueue.prototype.getUnusedItem_ = function() {
-  return goog.async.WorkQueue.freelist_.get();
-};
-
-
-
-/**
- * @constructor
- * @final
- * @struct
- */
-goog.async.WorkItem = function() {
-  /** @type {?function()} */
-  this.fn = null;
-  /** @type {Object|null|undefined} */
-  this.scope = null;
-  /** @type {?goog.async.WorkItem} */
-  this.next = null;
-};
-
-
-/**
- * @param {function()} fn
- * @param {Object|null|undefined} scope
- */
-goog.async.WorkItem.prototype.set = function(fn, scope) {
-  this.fn = fn;
-  this.scope = scope;
-  this.next = null;
-};
-
-
-/** Reset the work item so they don't prevent GC before reuse */
-goog.async.WorkItem.prototype.reset = function() {
-  this.fn = null;
-  this.scope = null;
-  this.next = null;
-};

+ 0 - 90
src/renderer/cocoblockly-x/python/block/closure/goog/async/workqueue_test.js

@@ -1,90 +0,0 @@
-// Copyright 2015 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-goog.provide('goog.async.WorkQueueTest');
-goog.setTestOnly('goog.async.WorkQueueTest');
-
-goog.require('goog.async.WorkQueue');
-goog.require('goog.testing.jsunit');
-
-
-var id = 0;
-var queue = null;
-
-
-function setUp() {
-  queue = new goog.async.WorkQueue();
-}
-
-
-function tearDown() {
-  queue = null;
-}
-
-
-function testEntriesReturnedInOrder() {
-  var fn1 = function one() {};
-  var scope1 = {};
-  var fn2 = function two() {};
-  var scope2 = {};
-  queue.add(fn1, scope1);
-  queue.add(fn2, scope2);
-
-  var item = queue.remove();
-  assertEquals(fn1, item.fn);
-  assertEquals(scope1, item.scope);
-  assertNull(item.next);
-
-  item = queue.remove();
-  assertEquals(fn2, item.fn);
-  assertEquals(scope2, item.scope);
-  assertNull(item.next);
-
-  item = queue.remove();
-  assertNull(item);
-}
-
-
-function testReturnedItemReused() {
-  var fn1 = function() {};
-  var scope1 = {};
-
-  var fn2 = function() {};
-  var scope2 = {};
-
-  assertEquals(0, goog.async.WorkQueue.freelist_.occupants());
-
-  queue.add(fn1, scope1);
-  var item1 = queue.remove();
-
-  assertEquals(0, goog.async.WorkQueue.freelist_.occupants());
-
-  queue.returnUnused(item1);
-
-  assertEquals(1, goog.async.WorkQueue.freelist_.occupants());
-
-  queue.add(fn2, scope2);
-
-  assertEquals(0, goog.async.WorkQueue.freelist_.occupants());
-
-  var item2 = queue.remove();
-
-  assertEquals(item1, item2);
-}
-
-
-function testEmptyQueueReturnNull() {
-  var item1 = queue.remove();
-  assertNull(item1);
-}

+ 0 - 2921
src/renderer/cocoblockly-x/python/block/closure/goog/base.js

@@ -1,2921 +0,0 @@
-// Copyright 2006 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-/**
- * @fileoverview Bootstrap for the Google JS Library (Closure).
- *
- * In uncompiled mode base.js will attempt to load Closure's deps file, unless
- * the global <code>CLOSURE_NO_DEPS</code> is set to true.  This allows projects
- * to include their own deps file(s) from different locations.
- *
- * Avoid including base.js more than once. This is strictly discouraged and not
- * supported. goog.require(...) won't work properly in that case.
- *
- * @provideGoog
- */
-
-
-/**
- * @define {boolean} Overridden to true by the compiler.
- */
-var COMPILED = false;
-
-
-/**
- * Base namespace for the Closure library.  Checks to see goog is already
- * defined in the current scope before assigning to prevent clobbering if
- * base.js is loaded more than once.
- *
- * @const
- */
-var goog = goog || {};
-
-
-/**
- * Reference to the global context.  In most cases this will be 'window'.
- */
-goog.global = this;
-
-
-/**
- * A hook for overriding the define values in uncompiled mode.
- *
- * In uncompiled mode, {@code CLOSURE_UNCOMPILED_DEFINES} may be defined before
- * loading base.js.  If a key is defined in {@code CLOSURE_UNCOMPILED_DEFINES},
- * {@code goog.define} will use the value instead of the default value.  This
- * allows flags to be overwritten without compilation (this is normally
- * accomplished with the compiler's "define" flag).
- *
- * Example:
- * <pre>
- *   var CLOSURE_UNCOMPILED_DEFINES = {'goog.DEBUG': false};
- * </pre>
- *
- * @type {Object<string, (string|number|boolean)>|undefined}
- */
-goog.global.CLOSURE_UNCOMPILED_DEFINES;
-
-
-/**
- * A hook for overriding the define values in uncompiled or compiled mode,
- * like CLOSURE_UNCOMPILED_DEFINES but effective in compiled code.  In
- * uncompiled code CLOSURE_UNCOMPILED_DEFINES takes precedence.
- *
- * Also unlike CLOSURE_UNCOMPILED_DEFINES the values must be number, boolean or
- * string literals or the compiler will emit an error.
- *
- * While any @define value may be set, only those set with goog.define will be
- * effective for uncompiled code.
- *
- * Example:
- * <pre>
- *   var CLOSURE_DEFINES = {'goog.DEBUG': false} ;
- * </pre>
- *
- * @type {Object<string, (string|number|boolean)>|undefined}
- */
-goog.global.CLOSURE_DEFINES;
-
-
-/**
- * Returns true if the specified value is not undefined.
- *
- * @param {?} val Variable to test.
- * @return {boolean} Whether variable is defined.
- */
-goog.isDef = function(val) {
-  // void 0 always evaluates to undefined and hence we do not need to depend on
-  // the definition of the global variable named 'undefined'.
-  return val !== void 0;
-};
-
-/**
- * Returns true if the specified value is a string.
- * @param {?} val Variable to test.
- * @return {boolean} Whether variable is a string.
- */
-goog.isString = function(val) {
-  return typeof val == 'string';
-};
-
-
-/**
- * Returns true if the specified value is a boolean.
- * @param {?} val Variable to test.
- * @return {boolean} Whether variable is boolean.
- */
-goog.isBoolean = function(val) {
-  return typeof val == 'boolean';
-};
-
-
-/**
- * Returns true if the specified value is a number.
- * @param {?} val Variable to test.
- * @return {boolean} Whether variable is a number.
- */
-goog.isNumber = function(val) {
-  return typeof val == 'number';
-};
-
-
-/**
- * Builds an object structure for the provided namespace path, ensuring that
- * names that already exist are not overwritten. For example:
- * "a.b.c" -> a = {};a.b={};a.b.c={};
- * Used by goog.provide and goog.exportSymbol.
- * @param {string} name name of the object that this file defines.
- * @param {*=} opt_object the object to expose at the end of the path.
- * @param {Object=} opt_objectToExportTo The object to add the path to; default
- *     is `goog.global`.
- * @private
- */
-goog.exportPath_ = function(name, opt_object, opt_objectToExportTo) {
-  var parts = name.split('.');
-  var cur = opt_objectToExportTo || goog.global;
-
-  // Internet Explorer exhibits strange behavior when throwing errors from
-  // methods externed in this manner.  See the testExportSymbolExceptions in
-  // base_test.html for an example.
-  if (!(parts[0] in cur) && cur.execScript) {
-    cur.execScript('var ' + parts[0]);
-  }
-
-  for (var part; parts.length && (part = parts.shift());) {
-    if (!parts.length && goog.isDef(opt_object)) {
-      // last part and we have an object; use it
-      cur[part] = opt_object;
-    } else if (cur[part] && cur[part] !== Object.prototype[part]) {
-      cur = cur[part];
-    } else {
-      cur = cur[part] = {};
-    }
-  }
-};
-
-
-/**
- * Defines a named value. In uncompiled mode, the value is retrieved from
- * CLOSURE_DEFINES or CLOSURE_UNCOMPILED_DEFINES if the object is defined and
- * has the property specified, and otherwise used the defined defaultValue.
- * When compiled the default can be overridden using the compiler
- * options or the value set in the CLOSURE_DEFINES object.
- *
- * @param {string} name The distinguished name to provide.
- * @param {string|number|boolean} defaultValue
- */
-goog.define = function(name, defaultValue) {
-  var value = defaultValue;
-  if (!COMPILED) {
-    if (goog.global.CLOSURE_UNCOMPILED_DEFINES &&
-        // Anti DOM-clobbering runtime check (b/37736576).
-        /** @type {?} */ (goog.global.CLOSURE_UNCOMPILED_DEFINES).nodeType ===
-            undefined &&
-        Object.prototype.hasOwnProperty.call(
-            goog.global.CLOSURE_UNCOMPILED_DEFINES, name)) {
-      value = goog.global.CLOSURE_UNCOMPILED_DEFINES[name];
-    } else if (
-        goog.global.CLOSURE_DEFINES &&
-        // Anti DOM-clobbering runtime check (b/37736576).
-        /** @type {?} */ (goog.global.CLOSURE_DEFINES).nodeType === undefined &&
-        Object.prototype.hasOwnProperty.call(
-            goog.global.CLOSURE_DEFINES, name)) {
-      value = goog.global.CLOSURE_DEFINES[name];
-    }
-  }
-  goog.exportPath_(name, value);
-};
-
-
-/**
- * @define {boolean} DEBUG is provided as a convenience so that debugging code
- * that should not be included in a production. It can be easily stripped
- * by specifying --define goog.DEBUG=false to the Closure Compiler aka
- * JSCompiler. For example, most toString() methods should be declared inside an
- * "if (goog.DEBUG)" conditional because they are generally used for debugging
- * purposes and it is difficult for the JSCompiler to statically determine
- * whether they are used.
- */
-goog.define('goog.DEBUG', true);
-
-
-/**
- * @define {string} LOCALE defines the locale being used for compilation. It is
- * used to select locale specific data to be compiled in js binary. BUILD rule
- * can specify this value by "--define goog.LOCALE=<locale_name>" as a compiler
- * option.
- *
- * Take into account that the locale code format is important. You should use
- * the canonical Unicode format with hyphen as a delimiter. Language must be
- * lowercase, Language Script - Capitalized, Region - UPPERCASE.
- * There are few examples: pt-BR, en, en-US, sr-Latin-BO, zh-Hans-CN.
- *
- * See more info about locale codes here:
- * http://www.unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers
- *
- * For language codes you should use values defined by ISO 693-1. See it here
- * http://www.w3.org/WAI/ER/IG/ert/iso639.htm. There is only one exception from
- * this rule: the Hebrew language. For legacy reasons the old code (iw) should
- * be used instead of the new code (he).
- *
- */
-goog.define('goog.LOCALE', 'en');  // default to en
-
-
-/**
- * @define {boolean} Whether this code is running on trusted sites.
- *
- * On untrusted sites, several native functions can be defined or overridden by
- * external libraries like Prototype, Datejs, and JQuery and setting this flag
- * to false forces closure to use its own implementations when possible.
- *
- * If your JavaScript can be loaded by a third party site and you are wary about
- * relying on non-standard implementations, specify
- * "--define goog.TRUSTED_SITE=false" to the compiler.
- */
-goog.define('goog.TRUSTED_SITE', true);
-
-
-/**
- * @define {boolean} Whether a project is expected to be running in strict mode.
- *
- * This define can be used to trigger alternate implementations compatible with
- * running in EcmaScript Strict mode or warn about unavailable functionality.
- * @see https://goo.gl/PudQ4y
- *
- */
-goog.define('goog.STRICT_MODE_COMPATIBLE', false);
-
-
-/**
- * @define {boolean} Whether code that calls {@link goog.setTestOnly} should
- *     be disallowed in the compilation unit.
- */
-goog.define('goog.DISALLOW_TEST_ONLY_CODE', COMPILED && !goog.DEBUG);
-
-
-/**
- * @define {boolean} Whether to use a Chrome app CSP-compliant method for
- *     loading scripts via goog.require. @see appendScriptSrcNode_.
- */
-goog.define('goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING', false);
-
-
-/**
- * Defines a namespace in Closure.
- *
- * A namespace may only be defined once in a codebase. It may be defined using
- * goog.provide() or goog.module().
- *
- * The presence of one or more goog.provide() calls in a file indicates
- * that the file defines the given objects/namespaces.
- * Provided symbols must not be null or undefined.
- *
- * In addition, goog.provide() creates the object stubs for a namespace
- * (for example, goog.provide("goog.foo.bar") will create the object
- * goog.foo.bar if it does not already exist).
- *
- * Build tools also scan for provide/require/module statements
- * to discern dependencies, build dependency files (see deps.js), etc.
- *
- * @see goog.require
- * @see goog.module
- * @param {string} name Namespace provided by this file in the form
- *     "goog.package.part".
- */
-goog.provide = function(name) {
-  if (goog.isInModuleLoader_()) {
-    throw Error('goog.provide can not be used within a goog.module.');
-  }
-  if (!COMPILED) {
-    // Ensure that the same namespace isn't provided twice.
-    // A goog.module/goog.provide maps a goog.require to a specific file
-    if (goog.isProvided_(name)) {
-      throw Error('Namespace "' + name + '" already declared.');
-    }
-  }
-
-  goog.constructNamespace_(name);
-};
-
-
-/**
- * @param {string} name Namespace provided by this file in the form
- *     "goog.package.part".
- * @param {Object=} opt_obj The object to embed in the namespace.
- * @private
- */
-goog.constructNamespace_ = function(name, opt_obj) {
-  if (!COMPILED) {
-    delete goog.implicitNamespaces_[name];
-
-    var namespace = name;
-    while ((namespace = namespace.substring(0, namespace.lastIndexOf('.')))) {
-      if (goog.getObjectByName(namespace)) {
-        break;
-      }
-      goog.implicitNamespaces_[namespace] = true;
-    }
-  }
-
-  goog.exportPath_(name, opt_obj);
-};
-
-
-/**
- * Module identifier validation regexp.
- * Note: This is a conservative check, it is very possible to be more lenient,
- *   the primary exclusion here is "/" and "\" and a leading ".", these
- *   restrictions are intended to leave the door open for using goog.require
- *   with relative file paths rather than module identifiers.
- * @private
- */
-goog.VALID_MODULE_RE_ = /^[a-zA-Z_$][a-zA-Z0-9._$]*$/;
-
-
-/**
- * Defines a module in Closure.
- *
- * Marks that this file must be loaded as a module and claims the namespace.
- *
- * A namespace may only be defined once in a codebase. It may be defined using
- * goog.provide() or goog.module().
- *
- * goog.module() has three requirements:
- * - goog.module may not be used in the same file as goog.provide.
- * - goog.module must be the first statement in the file.
- * - only one goog.module is allowed per file.
- *
- * When a goog.module annotated file is loaded, it is enclosed in
- * a strict function closure. This means that:
- * - any variables declared in a goog.module file are private to the file
- * (not global), though the compiler is expected to inline the module.
- * - The code must obey all the rules of "strict" JavaScript.
- * - the file will be marked as "use strict"
- *
- * NOTE: unlike goog.provide, goog.module does not declare any symbols by
- * itself. If declared symbols are desired, use
- * goog.module.declareLegacyNamespace().
- *
- *
- * See the public goog.module proposal: http://goo.gl/Va1hin
- *
- * @param {string} name Namespace provided by this file in the form
- *     "goog.package.part", is expected but not required.
- * @return {void}
- */
-goog.module = function(name) {
-  if (!goog.isString(name) || !name ||
-      name.search(goog.VALID_MODULE_RE_) == -1) {
-    throw Error('Invalid module identifier');
-  }
-  if (!goog.isInModuleLoader_()) {
-    throw Error(
-        'Module ' + name + ' has been loaded incorrectly. Note, ' +
-        'modules cannot be loaded as normal scripts. They require some kind of ' +
-        'pre-processing step. You\'re likely trying to load a module via a ' +
-        'script tag or as a part of a concatenated bundle without rewriting the ' +
-        'module. For more info see: ' +
-        'https://github.com/google/closure-library/wiki/goog.module:-an-ES6-module-like-alternative-to-goog.provide.');
-  }
-  if (goog.moduleLoaderState_.moduleName) {
-    throw Error('goog.module may only be called once per module.');
-  }
-
-  // Store the module name for the loader.
-  goog.moduleLoaderState_.moduleName = name;
-  if (!COMPILED) {
-    // Ensure that the same namespace isn't provided twice.
-    // A goog.module/goog.provide maps a goog.require to a specific file
-    if (goog.isProvided_(name)) {
-      throw Error('Namespace "' + name + '" already declared.');
-    }
-    delete goog.implicitNamespaces_[name];
-  }
-};
-
-
-/**
- * @param {string} name The module identifier.
- * @return {?} The module exports for an already loaded module or null.
- *
- * Note: This is not an alternative to goog.require, it does not
- * indicate a hard dependency, instead it is used to indicate
- * an optional dependency or to access the exports of a module
- * that has already been loaded.
- * @suppress {missingProvide}
- */
-goog.module.get = function(name) {
-  return goog.module.getInternal_(name);
-};
-
-
-/**
- * @param {string} name The module identifier.
- * @return {?} The module exports for an already loaded module or null.
- * @private
- */
-goog.module.getInternal_ = function(name) {
-  if (!COMPILED) {
-    if (name in goog.loadedModules_) {
-      return goog.loadedModules_[name];
-    } else if (!goog.implicitNamespaces_[name]) {
-      var ns = goog.getObjectByName(name);
-      return ns != null ? ns : null;
-    }
-  }
-  return null;
-};
-
-
-/**
- * @private {?{moduleName: (string|undefined), declareLegacyNamespace:boolean}}
- */
-goog.moduleLoaderState_ = null;
-
-
-/**
- * @private
- * @return {boolean} Whether a goog.module is currently being initialized.
- */
-goog.isInModuleLoader_ = function() {
-  return goog.moduleLoaderState_ != null;
-};
-
-
-/**
- * Provide the module's exports as a globally accessible object under the
- * module's declared name.  This is intended to ease migration to goog.module
- * for files that have existing usages.
- * @suppress {missingProvide}
- */
-goog.module.declareLegacyNamespace = function() {
-  if (!COMPILED && !goog.isInModuleLoader_()) {
-    throw new Error(
-        'goog.module.declareLegacyNamespace must be called from ' +
-        'within a goog.module');
-  }
-  if (!COMPILED && !goog.moduleLoaderState_.moduleName) {
-    throw Error(
-        'goog.module must be called prior to ' +
-        'goog.module.declareLegacyNamespace.');
-  }
-  goog.moduleLoaderState_.declareLegacyNamespace = true;
-};
-
-
-/**
- * Marks that the current file should only be used for testing, and never for
- * live code in production.
- *
- * In the case of unit tests, the message may optionally be an exact namespace
- * for the test (e.g. 'goog.stringTest'). The linter will then ignore the extra
- * provide (if not explicitly defined in the code).
- *
- * @param {string=} opt_message Optional message to add to the error that's
- *     raised when used in production code.
- */
-goog.setTestOnly = function(opt_message) {
-  if (goog.DISALLOW_TEST_ONLY_CODE) {
-    opt_message = opt_message || '';
-    throw Error(
-        'Importing test-only code into non-debug environment' +
-        (opt_message ? ': ' + opt_message : '.'));
-  }
-};
-
-
-/**
- * Forward declares a symbol. This is an indication to the compiler that the
- * symbol may be used in the source yet is not required and may not be provided
- * in compilation.
- *
- * The most common usage of forward declaration is code that takes a type as a
- * function parameter but does not need to require it. By forward declaring
- * instead of requiring, no hard dependency is made, and (if not required
- * elsewhere) the namespace may never be required and thus, not be pulled
- * into the JavaScript binary. If it is required elsewhere, it will be type
- * checked as normal.
- *
- * Before using goog.forwardDeclare, please read the documentation at
- * https://github.com/google/closure-compiler/wiki/Bad-Type-Annotation to
- * understand the options and tradeoffs when working with forward declarations.
- *
- * @param {string} name The namespace to forward declare in the form of
- *     "goog.package.part".
- */
-goog.forwardDeclare = function(name) {};
-
-
-/**
- * Forward declare type information. Used to assign types to goog.global
- * referenced object that would otherwise result in unknown type references
- * and thus block property disambiguation.
- */
-goog.forwardDeclare('Document');
-goog.forwardDeclare('HTMLScriptElement');
-goog.forwardDeclare('XMLHttpRequest');
-
-
-if (!COMPILED) {
-  /**
-   * Check if the given name has been goog.provided. This will return false for
-   * names that are available only as implicit namespaces.
-   * @param {string} name name of the object to look for.
-   * @return {boolean} Whether the name has been provided.
-   * @private
-   */
-  goog.isProvided_ = function(name) {
-    return (name in goog.loadedModules_) ||
-        (!goog.implicitNamespaces_[name] &&
-         goog.isDefAndNotNull(goog.getObjectByName(name)));
-  };
-
-  /**
-   * Namespaces implicitly defined by goog.provide. For example,
-   * goog.provide('goog.events.Event') implicitly declares that 'goog' and
-   * 'goog.events' must be namespaces.
-   *
-   * @type {!Object<string, (boolean|undefined)>}
-   * @private
-   */
-  goog.implicitNamespaces_ = {'goog.module': true};
-
-  // NOTE: We add goog.module as an implicit namespace as goog.module is defined
-  // here and because the existing module package has not been moved yet out of
-  // the goog.module namespace. This satisifies both the debug loader and
-  // ahead-of-time dependency management.
-}
-
-
-/**
- * Returns an object based on its fully qualified external name.  The object
- * is not found if null or undefined.  If you are using a compilation pass that
- * renames property names beware that using this function will not find renamed
- * properties.
- *
- * @param {string} name The fully qualified name.
- * @param {Object=} opt_obj The object within which to look; default is
- *     |goog.global|.
- * @return {?} The value (object or primitive) or, if not found, null.
- */
-goog.getObjectByName = function(name, opt_obj) {
-  var parts = name.split('.');
-  var cur = opt_obj || goog.global;
-  for (var part; part = parts.shift();) {
-    if (goog.isDefAndNotNull(cur[part])) {
-      cur = cur[part];
-    } else {
-      return null;
-    }
-  }
-  return cur;
-};
-
-
-/**
- * Globalizes a whole namespace, such as goog or goog.lang.
- *
- * @param {!Object} obj The namespace to globalize.
- * @param {Object=} opt_global The object to add the properties to.
- * @deprecated Properties may be explicitly exported to the global scope, but
- *     this should no longer be done in bulk.
- */
-goog.globalize = function(obj, opt_global) {
-  var global = opt_global || goog.global;
-  for (var x in obj) {
-    global[x] = obj[x];
-  }
-};
-
-
-/**
- * Adds a dependency from a file to the files it requires.
- * @param {string} relPath The path to the js file.
- * @param {!Array<string>} provides An array of strings with
- *     the names of the objects this file provides.
- * @param {!Array<string>} requires An array of strings with
- *     the names of the objects this file requires.
- * @param {boolean|!Object<string>=} opt_loadFlags Parameters indicating
- *     how the file must be loaded.  The boolean 'true' is equivalent
- *     to {'module': 'goog'} for backwards-compatibility.  Valid properties
- *     and values include {'module': 'goog'} and {'lang': 'es6'}.
- */
-goog.addDependency = function(relPath, provides, requires, opt_loadFlags) {
-  if (goog.DEPENDENCIES_ENABLED) {
-    var provide, require;
-    var path = relPath.replace(/\\/g, '/');
-    var deps = goog.dependencies_;
-    if (!opt_loadFlags || typeof opt_loadFlags === 'boolean') {
-      opt_loadFlags = opt_loadFlags ? {'module': 'goog'} : {};
-    }
-    for (var i = 0; provide = provides[i]; i++) {
-      deps.nameToPath[provide] = path;
-      deps.loadFlags[path] = opt_loadFlags;
-    }
-    for (var j = 0; require = requires[j]; j++) {
-      if (!(path in deps.requires)) {
-        deps.requires[path] = {};
-      }
-      deps.requires[path][require] = true;
-    }
-  }
-};
-
-
-
-
-// NOTE(nnaze): The debug DOM loader was included in base.js as an original way
-// to do "debug-mode" development.  The dependency system can sometimes be
-// confusing, as can the debug DOM loader's asynchronous nature.
-//
-// With the DOM loader, a call to goog.require() is not blocking -- the script
-// will not load until some point after the current script.  If a namespace is
-// needed at runtime, it needs to be defined in a previous script, or loaded via
-// require() with its registered dependencies.
-//
-// User-defined namespaces may need their own deps file. For a reference on
-// creating a deps file, see:
-// Externally: https://developers.google.com/closure/library/docs/depswriter
-//
-// Because of legacy clients, the DOM loader can't be easily removed from
-// base.js.  Work is being done to make it disableable or replaceable for
-// different environments (DOM-less JavaScript interpreters like Rhino or V8,
-// for example). See bootstrap/ for more information.
-
-
-/**
- * @define {boolean} Whether to enable the debug loader.
- *
- * If enabled, a call to goog.require() will attempt to load the namespace by
- * appending a script tag to the DOM (if the namespace has been registered).
- *
- * If disabled, goog.require() will simply assert that the namespace has been
- * provided (and depend on the fact that some outside tool correctly ordered
- * the script).
- */
-goog.define('goog.ENABLE_DEBUG_LOADER', true);
-
-
-/**
- * @param {string} msg
- * @private
- */
-goog.logToConsole_ = function(msg) {
-  if (goog.global.console) {
-    goog.global.console['error'](msg);
-  }
-};
-
-
-/**
- * Implements a system for the dynamic resolution of dependencies that works in
- * parallel with the BUILD system. Note that all calls to goog.require will be
- * stripped by the compiler.
- * @see goog.provide
- * @param {string} name Namespace to include (as was given in goog.provide()) in
- *     the form "goog.package.part".
- * @return {?} If called within a goog.module file, the associated namespace or
- *     module otherwise null.
- */
-goog.require = function(name) {
-  // If the object already exists we do not need to do anything.
-  if (!COMPILED) {
-    if (goog.ENABLE_DEBUG_LOADER && goog.IS_OLD_IE_) {
-      goog.maybeProcessDeferredDep_(name);
-    }
-
-    if (goog.isProvided_(name)) {
-      if (goog.isInModuleLoader_()) {
-        return goog.module.getInternal_(name);
-      }
-    } else if (goog.ENABLE_DEBUG_LOADER) {
-      var path = goog.getPathFromDeps_(name);
-      if (path) {
-        goog.writeScripts_(path);
-      } else {
-        var errorMessage = 'goog.require could not find: ' + name;
-        goog.logToConsole_(errorMessage);
-
-        throw Error(errorMessage);
-      }
-    }
-
-    return null;
-  }
-};
-
-
-/**
- * Path for included scripts.
- * @type {string}
- */
-goog.basePath = '';
-
-
-/**
- * A hook for overriding the base path.
- * @type {string|undefined}
- */
-goog.global.CLOSURE_BASE_PATH;
-
-
-/**
- * Whether to attempt to load Closure's deps file. By default, when uncompiled,
- * deps files will attempt to be loaded.
- * @type {boolean|undefined}
- */
-goog.global.CLOSURE_NO_DEPS;
-
-
-/**
- * A function to import a single script. This is meant to be overridden when
- * Closure is being run in non-HTML contexts, such as web workers. It's defined
- * in the global scope so that it can be set before base.js is loaded, which
- * allows deps.js to be imported properly.
- *
- * The function is passed the script source, which is a relative URI. It should
- * return true if the script was imported, false otherwise.
- * @type {(function(string): boolean)|undefined}
- */
-goog.global.CLOSURE_IMPORT_SCRIPT;
-
-
-/**
- * Null function used for default values of callbacks, etc.
- * @return {void} Nothing.
- */
-goog.nullFunction = function() {};
-
-
-/**
- * When defining a class Foo with an abstract method bar(), you can do:
- * Foo.prototype.bar = goog.abstractMethod
- *
- * Now if a subclass of Foo fails to override bar(), an error will be thrown
- * when bar() is invoked.
- *
- * @type {!Function}
- * @throws {Error} when invoked to indicate the method should be overridden.
- */
-goog.abstractMethod = function() {
-  throw Error('unimplemented abstract method');
-};
-
-
-/**
- * Adds a {@code getInstance} static method that always returns the same
- * instance object.
- * @param {!Function} ctor The constructor for the class to add the static
- *     method to.
- */
-goog.addSingletonGetter = function(ctor) {
-  // instance_ is immediately set to prevent issues with sealed constructors
-  // such as are encountered when a constructor is returned as the export object
-  // of a goog.module in unoptimized code.
-  ctor.instance_ = undefined;
-  ctor.getInstance = function() {
-    if (ctor.instance_) {
-      return ctor.instance_;
-    }
-    if (goog.DEBUG) {
-      // NOTE: JSCompiler can't optimize away Array#push.
-      goog.instantiatedSingletons_[goog.instantiatedSingletons_.length] = ctor;
-    }
-    return ctor.instance_ = new ctor;
-  };
-};
-
-
-/**
- * All singleton classes that have been instantiated, for testing. Don't read
- * it directly, use the {@code goog.testing.singleton} module. The compiler
- * removes this variable if unused.
- * @type {!Array<!Function>}
- * @private
- */
-goog.instantiatedSingletons_ = [];
-
-
-/**
- * @define {boolean} Whether to load goog.modules using {@code eval} when using
- * the debug loader.  This provides a better debugging experience as the
- * source is unmodified and can be edited using Chrome Workspaces or similar.
- * However in some environments the use of {@code eval} is banned
- * so we provide an alternative.
- */
-goog.define('goog.LOAD_MODULE_USING_EVAL', true);
-
-
-/**
- * @define {boolean} Whether the exports of goog.modules should be sealed when
- * possible.
- */
-goog.define('goog.SEAL_MODULE_EXPORTS', goog.DEBUG);
-
-
-/**
- * The registry of initialized modules:
- * the module identifier to module exports map.
- * @private @const {!Object<string, ?>}
- */
-goog.loadedModules_ = {};
-
-
-/**
- * True if goog.dependencies_ is available.
- * @const {boolean}
- */
-goog.DEPENDENCIES_ENABLED = !COMPILED && goog.ENABLE_DEBUG_LOADER;
-
-
-/**
- * @define {string} How to decide whether to transpile.  Valid values
- * are 'always', 'never', and 'detect'.  The default ('detect') is to
- * use feature detection to determine which language levels need
- * transpilation.
- */
-// NOTE(user): we could expand this to accept a language level to bypass
-// detection: e.g. goog.TRANSPILE == 'es5' would transpile ES6 files but
-// would leave ES3 and ES5 files alone.
-goog.define('goog.TRANSPILE', 'detect');
-
-
-/**
- * @define {string} Path to the transpiler.  Executing the script at this
- * path (relative to base.js) should define a function $jscomp.transpile.
- */
-goog.define('goog.TRANSPILER', 'transpile.js');
-
-
-if (goog.DEPENDENCIES_ENABLED) {
-  /**
-   * This object is used to keep track of dependencies and other data that is
-   * used for loading scripts.
-   * @private
-   * @type {{
-   *   loadFlags: !Object<string, !Object<string, string>>,
-   *   nameToPath: !Object<string, string>,
-   *   requires: !Object<string, !Object<string, boolean>>,
-   *   visited: !Object<string, boolean>,
-   *   written: !Object<string, boolean>,
-   *   deferred: !Object<string, string>
-   * }}
-   */
-  goog.dependencies_ = {
-    loadFlags: {},  // 1 to 1
-
-    nameToPath: {},  // 1 to 1
-
-    requires: {},  // 1 to many
-
-    // Used when resolving dependencies to prevent us from visiting file twice.
-    visited: {},
-
-    written: {},  // Used to keep track of script files we have written.
-
-    deferred: {}  // Used to track deferred module evaluations in old IEs
-  };
-
-
-  /**
-   * Tries to detect whether is in the context of an HTML document.
-   * @return {boolean} True if it looks like HTML document.
-   * @private
-   */
-  goog.inHtmlDocument_ = function() {
-    /** @type {Document} */
-    var doc = goog.global.document;
-    return doc != null && 'write' in doc;  // XULDocument misses write.
-  };
-
-
-  /**
-   * Tries to detect the base path of base.js script that bootstraps Closure.
-   * @private
-   */
-  goog.findBasePath_ = function() {
-    if (goog.isDef(goog.global.CLOSURE_BASE_PATH) &&
-        // Anti DOM-clobbering runtime check (b/37736576).
-        goog.isString(goog.global.CLOSURE_BASE_PATH)) {
-      goog.basePath = goog.global.CLOSURE_BASE_PATH;
-      return;
-    } else if (!goog.inHtmlDocument_()) {
-      return;
-    }
-    /** @type {Document} */
-    var doc = goog.global.document;
-    // If we have a currentScript available, use it exclusively.
-    var currentScript = doc.currentScript;
-    if (currentScript) {
-      var scripts = [currentScript];
-    } else {
-      var scripts = doc.getElementsByTagName('SCRIPT');
-    }
-    // Search backwards since the current script is in almost all cases the one
-    // that has base.js.
-    for (var i = scripts.length - 1; i >= 0; --i) {
-      var script = /** @type {!HTMLScriptElement} */ (scripts[i]);
-      var src = script.src;
-      var qmark = src.lastIndexOf('?');
-      var l = qmark == -1 ? src.length : qmark;
-      if (src.substr(l - 7, 7) == 'base.js') {
-        goog.basePath = src.substr(0, l - 7);
-        return;
-      }
-    }
-  };
-
-
-  /**
-   * Imports a script if, and only if, that script hasn't already been imported.
-   * (Must be called at execution time)
-   * @param {string} src Script source.
-   * @param {string=} opt_sourceText The optionally source text to evaluate
-   * @private
-   */
-  goog.importScript_ = function(src, opt_sourceText) {
-    var importScript =
-        goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_;
-    if (importScript(src, opt_sourceText)) {
-      goog.dependencies_.written[src] = true;
-    }
-  };
-
-
-  /**
-   * Whether the browser is IE9 or earlier, which needs special handling
-   * for deferred modules.
-   * @const @private {boolean}
-   */
-  goog.IS_OLD_IE_ =
-      !!(!goog.global.atob && goog.global.document && goog.global.document.all);
-
-
-  /**
-   * Whether IE9 or earlier is waiting on a dependency.  This ensures that
-   * deferred modules that have no non-deferred dependencies actually get
-   * loaded, since if we defer them and then never pull in a non-deferred
-   * script, then `goog.loadQueuedModules_` will never be called.  Instead,
-   * if not waiting on anything we simply don't defer in the first place.
-   * @private {boolean}
-   */
-  goog.oldIeWaiting_ = false;
-
-
-  /**
-   * Given a URL initiate retrieval and execution of a script that needs
-   * pre-processing.
-   * @param {string} src Script source URL.
-   * @param {boolean} isModule Whether this is a goog.module.
-   * @param {boolean} needsTranspile Whether this source needs transpilation.
-   * @private
-   */
-  goog.importProcessedScript_ = function(src, isModule, needsTranspile) {
-    // In an attempt to keep browsers from timing out loading scripts using
-    // synchronous XHRs, put each load in its own script block.
-    var bootstrap = 'goog.retrieveAndExec_("' + src + '", ' + isModule + ', ' +
-        needsTranspile + ');';
-
-    goog.importScript_('', bootstrap);
-  };
-
-
-  /** @private {!Array<string>} */
-  goog.queuedModules_ = [];
-
-
-  /**
-   * Return an appropriate module text. Suitable to insert into
-   * a script tag (that is unescaped).
-   * @param {string} srcUrl
-   * @param {string} scriptText
-   * @return {string}
-   * @private
-   */
-  goog.wrapModule_ = function(srcUrl, scriptText) {
-    if (!goog.LOAD_MODULE_USING_EVAL || !goog.isDef(goog.global.JSON)) {
-      return '' +
-          'goog.loadModule(function(exports) {' +
-          '"use strict";' + scriptText +
-          '\n' +  // terminate any trailing single line comment.
-          ';return exports' +
-          '});' +
-          '\n//# sourceURL=' + srcUrl + '\n';
-    } else {
-      return '' +
-          'goog.loadModule(' +
-          goog.global.JSON.stringify(
-              scriptText + '\n//# sourceURL=' + srcUrl + '\n') +
-          ');';
-    }
-  };
-
-  // On IE9 and earlier, it is necessary to handle
-  // deferred module loads. In later browsers, the
-  // code to be evaluated is simply inserted as a script
-  // block in the correct order. To eval deferred
-  // code at the right time, we piggy back on goog.require to call
-  // goog.maybeProcessDeferredDep_.
-  //
-  // The goog.requires are used both to bootstrap
-  // the loading process (when no deps are available) and
-  // declare that they should be available.
-  //
-  // Here we eval the sources, if all the deps are available
-  // either already eval'd or goog.require'd.  This will
-  // be the case when all the dependencies have already
-  // been loaded, and the dependent module is loaded.
-  //
-  // But this alone isn't sufficient because it is also
-  // necessary to handle the case where there is no root
-  // that is not deferred.  For that there we register for an event
-  // and trigger goog.loadQueuedModules_ handle any remaining deferred
-  // evaluations.
-
-  /**
-   * Handle any remaining deferred goog.module evals.
-   * @private
-   */
-  goog.loadQueuedModules_ = function() {
-    var count = goog.queuedModules_.length;
-    if (count > 0) {
-      var queue = goog.queuedModules_;
-      goog.queuedModules_ = [];
-      for (var i = 0; i < count; i++) {
-        var path = queue[i];
-        goog.maybeProcessDeferredPath_(path);
-      }
-    }
-    goog.oldIeWaiting_ = false;
-  };
-
-
-  /**
-   * Eval the named module if its dependencies are
-   * available.
-   * @param {string} name The module to load.
-   * @private
-   */
-  goog.maybeProcessDeferredDep_ = function(name) {
-    if (goog.isDeferredModule_(name) && goog.allDepsAreAvailable_(name)) {
-      var path = goog.getPathFromDeps_(name);
-      goog.maybeProcessDeferredPath_(goog.basePath + path);
-    }
-  };
-
-  /**
-   * @param {string} name The module to check.
-   * @return {boolean} Whether the name represents a
-   *     module whose evaluation has been deferred.
-   * @private
-   */
-  goog.isDeferredModule_ = function(name) {
-    var path = goog.getPathFromDeps_(name);
-    var loadFlags = path && goog.dependencies_.loadFlags[path] || {};
-    var languageLevel = loadFlags['lang'] || 'es3';
-    if (path && (loadFlags['module'] == 'goog' ||
-                 goog.needsTranspile_(languageLevel))) {
-      var abspath = goog.basePath + path;
-      return (abspath) in goog.dependencies_.deferred;
-    }
-    return false;
-  };
-
-  /**
-   * @param {string} name The module to check.
-   * @return {boolean} Whether the name represents a
-   *     module whose declared dependencies have all been loaded
-   *     (eval'd or a deferred module load)
-   * @private
-   */
-  goog.allDepsAreAvailable_ = function(name) {
-    var path = goog.getPathFromDeps_(name);
-    if (path && (path in goog.dependencies_.requires)) {
-      for (var requireName in goog.dependencies_.requires[path]) {
-        if (!goog.isProvided_(requireName) &&
-            !goog.isDeferredModule_(requireName)) {
-          return false;
-        }
-      }
-    }
-    return true;
-  };
-
-
-  /**
-   * @param {string} abspath
-   * @private
-   */
-  goog.maybeProcessDeferredPath_ = function(abspath) {
-    if (abspath in goog.dependencies_.deferred) {
-      var src = goog.dependencies_.deferred[abspath];
-      delete goog.dependencies_.deferred[abspath];
-      goog.globalEval(src);
-    }
-  };
-
-
-  /**
-   * Load a goog.module from the provided URL.  This is not a general purpose
-   * code loader and does not support late loading code, that is it should only
-   * be used during page load. This method exists to support unit tests and
-   * "debug" loaders that would otherwise have inserted script tags. Under the
-   * hood this needs to use a synchronous XHR and is not recommeneded for
-   * production code.
-   *
-   * The module's goog.requires must have already been satisified; an exception
-   * will be thrown if this is not the case. This assumption is that no
-   * "deps.js" file exists, so there is no way to discover and locate the
-   * module-to-be-loaded's dependencies and no attempt is made to do so.
-   *
-   * There should only be one attempt to load a module.  If
-   * "goog.loadModuleFromUrl" is called for an already loaded module, an
-   * exception will be throw.
-   *
-   * @param {string} url The URL from which to attempt to load the goog.module.
-   */
-  goog.loadModuleFromUrl = function(url) {
-    // Because this executes synchronously, we don't need to do any additional
-    // bookkeeping. When "goog.loadModule" the namespace will be marked as
-    // having been provided which is sufficient.
-    goog.retrieveAndExec_(url, true, false);
-  };
-
-
-  /**
-   * Writes a new script pointing to {@code src} directly into the DOM.
-   *
-   * NOTE: This method is not CSP-compliant. @see goog.appendScriptSrcNode_ for
-   * the fallback mechanism.
-   *
-   * @param {string} src The script URL.
-   * @private
-   */
-  goog.writeScriptSrcNode_ = function(src) {
-    goog.global.document.write(
-        '<script type="text/javascript" src="' + src + '"></' +
-        'script>');
-  };
-
-
-  /**
-   * Appends a new script node to the DOM using a CSP-compliant mechanism. This
-   * method exists as a fallback for document.write (which is not allowed in a
-   * strict CSP context, e.g., Chrome apps).
-   *
-   * NOTE: This method is not analogous to using document.write to insert a
-   * <script> tag; specifically, the user agent will execute a script added by
-   * document.write immediately after the current script block finishes
-   * executing, whereas the DOM-appended script node will not be executed until
-   * the entire document is parsed and executed. That is to say, this script is
-   * added to the end of the script execution queue.
-   *
-   * The page must not attempt to call goog.required entities until after the
-   * document has loaded, e.g., in or after the window.onload callback.
-   *
-   * @param {string} src The script URL.
-   * @private
-   */
-  goog.appendScriptSrcNode_ = function(src) {
-    /** @type {Document} */
-    var doc = goog.global.document;
-    var scriptEl =
-        /** @type {HTMLScriptElement} */ (doc.createElement('script'));
-    scriptEl.type = 'text/javascript';
-    scriptEl.src = src;
-    scriptEl.defer = false;
-    scriptEl.async = false;
-    doc.head.appendChild(scriptEl);
-  };
-
-
-  /**
-   * The default implementation of the import function. Writes a script tag to
-   * import the script.
-   *
-   * @param {string} src The script url.
-   * @param {string=} opt_sourceText The optionally source text to evaluate
-   * @return {boolean} True if the script was imported, false otherwise.
-   * @private
-   */
-  goog.writeScriptTag_ = function(src, opt_sourceText) {
-    if (goog.inHtmlDocument_()) {
-      /** @type {!HTMLDocument} */
-      var doc = goog.global.document;
-
-      // If the user tries to require a new symbol after document load,
-      // something has gone terribly wrong. Doing a document.write would
-      // wipe out the page. This does not apply to the CSP-compliant method
-      // of writing script tags.
-      if (!goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING &&
-          doc.readyState == 'complete') {
-        // Certain test frameworks load base.js multiple times, which tries
-        // to write deps.js each time. If that happens, just fail silently.
-        // These frameworks wipe the page between each load of base.js, so this
-        // is OK.
-        var isDeps = /\bdeps.js$/.test(src);
-        if (isDeps) {
-          return false;
-        } else {
-          throw Error('Cannot write "' + src + '" after document load');
-        }
-      }
-
-      if (opt_sourceText === undefined) {
-        if (!goog.IS_OLD_IE_) {
-          if (goog.ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING) {
-            goog.appendScriptSrcNode_(src);
-          } else {
-            goog.writeScriptSrcNode_(src);
-          }
-        } else {
-          goog.oldIeWaiting_ = true;
-          var state = ' onreadystatechange=\'goog.onScriptLoad_(this, ' +
-              ++goog.lastNonModuleScriptIndex_ + ')\' ';
-          doc.write(
-              '<script type="text/javascript" src="' + src + '"' + state +
-              '></' +
-              'script>');
-        }
-      } else {
-        doc.write(
-            '<script type="text/javascript">' +
-            goog.protectScriptTag_(opt_sourceText) + '</' +
-            'script>');
-      }
-      return true;
-    } else {
-      return false;
-    }
-  };
-
-  /**
-   * Rewrites closing script tags in input to avoid ending an enclosing script
-   * tag.
-   *
-   * @param {string} str
-   * @return {string}
-   * @private
-   */
-  goog.protectScriptTag_ = function(str) {
-    return str.replace(/<\/(SCRIPT)/ig, '\\x3c/$1');
-  };
-
-  /**
-   * Determines whether the given language needs to be transpiled.
-   * @param {string} lang
-   * @return {boolean}
-   * @private
-   */
-  goog.needsTranspile_ = function(lang) {
-    if (goog.TRANSPILE == 'always') {
-      return true;
-    } else if (goog.TRANSPILE == 'never') {
-      return false;
-    } else if (!goog.requiresTranspilation_) {
-      goog.requiresTranspilation_ = goog.createRequiresTranspilation_();
-    }
-    if (lang in goog.requiresTranspilation_) {
-      return goog.requiresTranspilation_[lang];
-    } else {
-      throw new Error('Unknown language mode: ' + lang);
-    }
-  };
-
-  /** @private {?Object<string, boolean>} */
-  goog.requiresTranspilation_ = null;
-
-
-  /** @private {number} */
-  goog.lastNonModuleScriptIndex_ = 0;
-
-
-  /**
-   * A readystatechange handler for legacy IE
-   * @param {?} script
-   * @param {number} scriptIndex
-   * @return {boolean}
-   * @private
-   */
-  goog.onScriptLoad_ = function(script, scriptIndex) {
-    // for now load the modules when we reach the last script,
-    // later allow more inter-mingling.
-    if (script.readyState == 'complete' &&
-        goog.lastNonModuleScriptIndex_ == scriptIndex) {
-      goog.loadQueuedModules_();
-    }
-    return true;
-  };
-
-  /**
-   * Resolves dependencies based on the dependencies added using addDependency
-   * and calls importScript_ in the correct order.
-   * @param {string} pathToLoad The path from which to start discovering
-   *     dependencies.
-   * @private
-   */
-  goog.writeScripts_ = function(pathToLoad) {
-    /** @type {!Array<string>} The scripts we need to write this time. */
-    var scripts = [];
-    var seenScript = {};
-    var deps = goog.dependencies_;
-
-    /** @param {string} path */
-    function visitNode(path) {
-      if (path in deps.written) {
-        return;
-      }
-
-      // We have already visited this one. We can get here if we have cyclic
-      // dependencies.
-      if (path in deps.visited) {
-        return;
-      }
-
-      deps.visited[path] = true;
-
-      if (path in deps.requires) {
-        for (var requireName in deps.requires[path]) {
-          // If the required name is defined, we assume that it was already
-          // bootstrapped by other means.
-          if (!goog.isProvided_(requireName)) {
-            if (requireName in deps.nameToPath) {
-              visitNode(deps.nameToPath[requireName]);
-            } else {
-              throw Error('Undefined nameToPath for ' + requireName);
-            }
-          }
-        }
-      }
-
-      if (!(path in seenScript)) {
-        seenScript[path] = true;
-        scripts.push(path);
-      }
-    }
-
-    visitNode(pathToLoad);
-
-    // record that we are going to load all these scripts.
-    for (var i = 0; i < scripts.length; i++) {
-      var path = scripts[i];
-      goog.dependencies_.written[path] = true;
-    }
-
-    // If a module is loaded synchronously then we need to
-    // clear the current inModuleLoader value, and restore it when we are
-    // done loading the current "requires".
-    var moduleState = goog.moduleLoaderState_;
-    goog.moduleLoaderState_ = null;
-
-    for (var i = 0; i < scripts.length; i++) {
-      var path = scripts[i];
-      if (path) {
-        var loadFlags = deps.loadFlags[path] || {};
-        var languageLevel = loadFlags['lang'] || 'es3';
-        var needsTranspile = goog.needsTranspile_(languageLevel);
-        if (loadFlags['module'] == 'goog' || needsTranspile) {
-          goog.importProcessedScript_(
-              goog.basePath + path, loadFlags['module'] == 'goog',
-              needsTranspile);
-        } else {
-          goog.importScript_(goog.basePath + path);
-        }
-      } else {
-        goog.moduleLoaderState_ = moduleState;
-        throw Error('Undefined script input');
-      }
-    }
-
-    // restore the current "module loading state"
-    goog.moduleLoaderState_ = moduleState;
-  };
-
-
-  /**
-   * Looks at the dependency rules and tries to determine the script file that
-   * fulfills a particular rule.
-   * @param {string} rule In the form goog.namespace.Class or project.script.
-   * @return {?string} Url corresponding to the rule, or null.
-   * @private
-   */
-  goog.getPathFromDeps_ = function(rule) {
-    if (rule in goog.dependencies_.nameToPath) {
-      return goog.dependencies_.nameToPath[rule];
-    } else {
-      return null;
-    }
-  };
-
-  goog.findBasePath_();
-
-  // Allow projects to manage the deps files themselves.
-  if (!goog.global.CLOSURE_NO_DEPS) {
-    goog.importScript_(goog.basePath + 'deps.js');
-  }
-}
-
-
-/**
- * @package {?boolean}
- * Visible for testing.
- */
-goog.hasBadLetScoping = null;
-
-
-/**
- * @return {boolean}
- * @package Visible for testing.
- */
-goog.useSafari10Workaround = function() {
-  if (goog.hasBadLetScoping == null) {
-    var hasBadLetScoping;
-    try {
-      hasBadLetScoping = !eval(
-          '"use strict";' +
-          'let x = 1; function f() { return typeof x; };' +
-          'f() == "number";');
-    } catch (e) {
-      // Assume that ES6 syntax isn't supported.
-      hasBadLetScoping = false;
-    }
-    goog.hasBadLetScoping = hasBadLetScoping;
-  }
-  return goog.hasBadLetScoping;
-};
-
-
-/**
- * @param {string} moduleDef
- * @return {string}
- * @package Visible for testing.
- */
-goog.workaroundSafari10EvalBug = function(moduleDef) {
-  return '(function(){' + moduleDef +
-      '\n' +  // Terminate any trailing single line comment.
-      ';' +   // Terminate any trailing expression.
-      '})();\n';
-};
-
-
-/**
- * @param {function(?):?|string} moduleDef The module definition.
- */
-goog.loadModule = function(moduleDef) {
-  // NOTE: we allow function definitions to be either in the from
-  // of a string to eval (which keeps the original source intact) or
-  // in a eval forbidden environment (CSP) we allow a function definition
-  // which in its body must call {@code goog.module}, and return the exports
-  // of the module.
-  var previousState = goog.moduleLoaderState_;
-  try {
-    goog.moduleLoaderState_ = {
-      moduleName: undefined,
-      declareLegacyNamespace: false
-    };
-    var exports;
-    if (goog.isFunction(moduleDef)) {
-      exports = moduleDef.call(undefined, {});
-    } else if (goog.isString(moduleDef)) {
-      if (goog.useSafari10Workaround()) {
-        moduleDef = goog.workaroundSafari10EvalBug(moduleDef);
-      }
-
-      exports = goog.loadModuleFromSource_.call(undefined, moduleDef);
-    } else {
-      throw Error('Invalid module definition');
-    }
-
-    var moduleName = goog.moduleLoaderState_.moduleName;
-    if (!goog.isString(moduleName) || !moduleName) {
-      throw Error('Invalid module name \"' + moduleName + '\"');
-    }
-
-    // Don't seal legacy namespaces as they may be uses as a parent of
-    // another namespace
-    if (goog.moduleLoaderState_.declareLegacyNamespace) {
-      goog.constructNamespace_(moduleName, exports);
-    } else if (
-        goog.SEAL_MODULE_EXPORTS && Object.seal && typeof exports == 'object' &&
-        exports != null) {
-      Object.seal(exports);
-    }
-
-    goog.loadedModules_[moduleName] = exports;
-  } finally {
-    goog.moduleLoaderState_ = previousState;
-  }
-};
-
-
-/**
- * @private @const
- */
-goog.loadModuleFromSource_ = /** @type {function(string):?} */ (function() {
-  // NOTE: we avoid declaring parameters or local variables here to avoid
-  // masking globals or leaking values into the module definition.
-  'use strict';
-  var exports = {};
-  eval(arguments[0]);
-  return exports;
-});
-
-
-/**
- * Normalize a file path by removing redundant ".." and extraneous "." file
- * path components.
- * @param {string} path
- * @return {string}
- * @private
- */
-goog.normalizePath_ = function(path) {
-  var components = path.split('/');
-  var i = 0;
-  while (i < components.length) {
-    if (components[i] == '.') {
-      components.splice(i, 1);
-    } else if (
-        i && components[i] == '..' && components[i - 1] &&
-        components[i - 1] != '..') {
-      components.splice(--i, 2);
-    } else {
-      i++;
-    }
-  }
-  return components.join('/');
-};
-
-
-/**
- * Provides a hook for loading a file when using Closure's goog.require() API
- * with goog.modules.  In particular this hook is provided to support Node.js.
- *
- * @type {(function(string):string)|undefined}
- */
-goog.global.CLOSURE_LOAD_FILE_SYNC;
-
-
-/**
- * Loads file by synchronous XHR. Should not be used in production environments.
- * @param {string} src Source URL.
- * @return {?string} File contents, or null if load failed.
- * @private
- */
-goog.loadFileSync_ = function(src) {
-  if (goog.global.CLOSURE_LOAD_FILE_SYNC) {
-    return goog.global.CLOSURE_LOAD_FILE_SYNC(src);
-  } else {
-    try {
-      /** @type {XMLHttpRequest} */
-      var xhr = new goog.global['XMLHttpRequest']();
-      xhr.open('get', src, false);
-      xhr.send();
-      // NOTE: Successful http: requests have a status of 200, but successful
-      // file: requests may have a status of zero.  Any other status, or a
-      // thrown exception (particularly in case of file: requests) indicates
-      // some sort of error, which we treat as a missing or unavailable file.
-      return xhr.status == 0 || xhr.status == 200 ? xhr.responseText : null;
-    } catch (err) {
-      // No need to rethrow or log, since errors should show up on their own.
-      return null;
-    }
-  }
-};
-
-
-/**
- * Retrieve and execute a script that needs some sort of wrapping.
- * @param {string} src Script source URL.
- * @param {boolean} isModule Whether to load as a module.
- * @param {boolean} needsTranspile Whether to transpile down to ES3.
- * @private
- */
-goog.retrieveAndExec_ = function(src, isModule, needsTranspile) {
-  if (!COMPILED) {
-    // The full but non-canonicalized URL for later use.
-    var originalPath = src;
-    // Canonicalize the path, removing any /./ or /../ since Chrome's debugging
-    // console doesn't auto-canonicalize XHR loads as it does <script> srcs.
-    src = goog.normalizePath_(src);
-
-    var importScript =
-        goog.global.CLOSURE_IMPORT_SCRIPT || goog.writeScriptTag_;
-
-    var scriptText = goog.loadFileSync_(src);
-    if (scriptText == null) {
-      throw new Error('Load of "' + src + '" failed');
-    }
-
-    if (needsTranspile) {
-      scriptText = goog.transpile_.call(goog.global, scriptText, src);
-    }
-
-    if (isModule) {
-      scriptText = goog.wrapModule_(src, scriptText);
-    } else {
-      scriptText += '\n//# sourceURL=' + src;
-    }
-    var isOldIE = goog.IS_OLD_IE_;
-    if (isOldIE && goog.oldIeWaiting_) {
-      goog.dependencies_.deferred[originalPath] = scriptText;
-      goog.queuedModules_.push(originalPath);
-    } else {
-      importScript(src, scriptText);
-    }
-  }
-};
-
-
-/**
- * Lazily retrieves the transpiler and applies it to the source.
- * @param {string} code JS code.
- * @param {string} path Path to the code.
- * @return {string} The transpiled code.
- * @private
- */
-goog.transpile_ = function(code, path) {
-  var jscomp = goog.global['$jscomp'];
-  if (!jscomp) {
-    goog.global['$jscomp'] = jscomp = {};
-  }
-  var transpile = jscomp.transpile;
-  if (!transpile) {
-    var transpilerPath = goog.basePath + goog.TRANSPILER;
-    var transpilerCode = goog.loadFileSync_(transpilerPath);
-    if (transpilerCode) {
-      // This must be executed synchronously, since by the time we know we
-      // need it, we're about to load and write the ES6 code synchronously,
-      // so a normal script-tag load will be too slow.
-      eval(transpilerCode + '\n//# sourceURL=' + transpilerPath);
-      // Even though the transpiler is optional, if $gwtExport is found, it's
-      // a sign the transpiler was loaded and the $jscomp.transpile *should*
-      // be there.
-      if (goog.global['$gwtExport'] && goog.global['$gwtExport']['$jscomp'] &&
-          !goog.global['$gwtExport']['$jscomp']['transpile']) {
-        throw new Error(
-            'The transpiler did not properly export the "transpile" ' +
-            'method. $gwtExport: ' + JSON.stringify(goog.global['$gwtExport']));
-      }
-      // transpile.js only exports a single $jscomp function, transpile. We
-      // grab just that and add it to the existing definition of $jscomp which
-      // contains the polyfills.
-      goog.global['$jscomp'].transpile =
-          goog.global['$gwtExport']['$jscomp']['transpile'];
-      jscomp = goog.global['$jscomp'];
-      transpile = jscomp.transpile;
-    }
-  }
-  if (!transpile) {
-    // The transpiler is an optional component.  If it's not available then
-    // replace it with a pass-through function that simply logs.
-    var suffix = ' requires transpilation but no transpiler was found.';
-    transpile = jscomp.transpile = function(code, path) {
-      // TODO(user): figure out some way to get this error to show up
-      // in test results, noting that the failure may occur in many
-      // different ways, including in loadModule() before the test
-      // runner even comes up.
-      goog.logToConsole_(path + suffix);
-      return code;
-    };
-  }
-  // Note: any transpilation errors/warnings will be logged to the console.
-  return transpile(code, path);
-};
-
-
-//==============================================================================
-// Language Enhancements
-//==============================================================================
-
-
-/**
- * This is a "fixed" version of the typeof operator.  It differs from the typeof
- * operator in such a way that null returns 'null' and arrays return 'array'.
- * @param {?} value The value to get the type of.
- * @return {string} The name of the type.
- */
-goog.typeOf = function(value) {
-  var s = typeof value;
-  if (s == 'object') {
-    if (value) {
-      // Check these first, so we can avoid calling Object.prototype.toString if
-      // possible.
-      //
-      // IE improperly marshals typeof across execution contexts, but a
-      // cross-context object will still return false for "instanceof Object".
-      if (value instanceof Array) {
-        return 'array';
-      } else if (value instanceof Object) {
-        return s;
-      }
-
-      // HACK: In order to use an Object prototype method on the arbitrary
-      //   value, the compiler requires the value be cast to type Object,
-      //   even though the ECMA spec explicitly allows it.
-      var className = Object.prototype.toString.call(
-          /** @type {!Object} */ (value));
-      // In Firefox 3.6, attempting to access iframe window objects' length
-      // property throws an NS_ERROR_FAILURE, so we need to special-case it
-      // here.
-      if (className == '[object Window]') {
-        return 'object';
-      }
-
-      // We cannot always use constructor == Array or instanceof Array because
-      // different frames have different Array objects. In IE6, if the iframe
-      // where the array was created is destroyed, the array loses its
-      // prototype. Then dereferencing val.splice here throws an exception, so
-      // we can't use goog.isFunction. Calling typeof directly returns 'unknown'
-      // so that will work. In this case, this function will return false and
-      // most array functions will still work because the array is still
-      // array-like (supports length and []) even though it has lost its
-      // prototype.
-      // Mark Miller noticed that Object.prototype.toString
-      // allows access to the unforgeable [[Class]] property.
-      //  15.2.4.2 Object.prototype.toString ( )
-      //  When the toString method is called, the following steps are taken:
-      //      1. Get the [[Class]] property of this object.
-      //      2. Compute a string value by concatenating the three strings
-      //         "[object ", Result(1), and "]".
-      //      3. Return Result(2).
-      // and this behavior survives the destruction of the execution context.
-      if ((className == '[object Array]' ||
-           // In IE all non value types are wrapped as objects across window
-           // boundaries (not iframe though) so we have to do object detection
-           // for this edge case.
-           typeof value.length == 'number' &&
-               typeof value.splice != 'undefined' &&
-               typeof value.propertyIsEnumerable != 'undefined' &&
-               !value.propertyIsEnumerable('splice')
-
-               )) {
-        return 'array';
-      }
-      // HACK: There is still an array case that fails.
-      //     function ArrayImpostor() {}
-      //     ArrayImpostor.prototype = [];
-      //     var impostor = new ArrayImpostor;
-      // this can be fixed by getting rid of the fast path
-      // (value instanceof Array) and solely relying on
-      // (value && Object.prototype.toString.vall(value) === '[object Array]')
-      // but that would require many more function calls and is not warranted
-      // unless closure code is receiving objects from untrusted sources.
-
-      // IE in cross-window calls does not correctly marshal the function type
-      // (it appears just as an object) so we cannot use just typeof val ==
-      // 'function'. However, if the object has a call property, it is a
-      // function.
-      if ((className == '[object Function]' ||
-           typeof value.call != 'undefined' &&
-               typeof value.propertyIsEnumerable != 'undefined' &&
-               !value.propertyIsEnumerable('call'))) {
-        return 'function';
-      }
-
-    } else {
-      return 'null';
-    }
-
-  } else if (s == 'function' && typeof value.call == 'undefined') {
-    // In Safari typeof nodeList returns 'function', and on Firefox typeof
-    // behaves similarly for HTML{Applet,Embed,Object}, Elements and RegExps. We
-    // would like to return object for those and we can detect an invalid
-    // function by making sure that the function object has a call method.
-    return 'object';
-  }
-  return s;
-};
-
-
-/**
- * Returns true if the specified value is null.
- * @param {?} val Variable to test.
- * @return {boolean} Whether variable is null.
- */
-goog.isNull = function(val) {
-  return val === null;
-};
-
-
-/**
- * Returns true if the specified value is defined and not null.
- * @param {?} val Variable to test.
- * @return {boolean} Whether variable is defined and not null.
- */
-goog.isDefAndNotNull = function(val) {
-  // Note that undefined == null.
-  return val != null;
-};
-
-
-/**
- * Returns true if the specified value is an array.
- * @param {?} val Variable to test.
- * @return {boolean} Whether variable is an array.
- */
-goog.isArray = function(val) {
-  return goog.typeOf(val) == 'array';
-};
-
-
-/**
- * Returns true if the object looks like an array. To qualify as array like
- * the value needs to be either a NodeList or an object with a Number length
- * property. As a special case, a function value is not array like, because its
- * length property is fixed to correspond to the number of expected arguments.
- * @param {?} val Variable to test.
- * @return {boolean} Whether variable is an array.
- */
-goog.isArrayLike = function(val) {
-  var type = goog.typeOf(val);
-  // We do not use goog.isObject here in order to exclude function values.
-  return type == 'array' || type == 'object' && typeof val.length == 'number';
-};
-
-
-/**
- * Returns true if the object looks like a Date. To qualify as Date-like the
- * value needs to be an object and have a getFullYear() function.
- * @param {?} val Variable to test.
- * @return {boolean} Whether variable is a like a Date.
- */
-goog.isDateLike = function(val) {
-  return goog.isObject(val) && typeof val.getFullYear == 'function';
-};
-
-
-/**
- * Returns true if the specified value is a function.
- * @param {?} val Variable to test.
- * @return {boolean} Whether variable is a function.
- */
-goog.isFunction = function(val) {
-  return goog.typeOf(val) == 'function';
-};
-
-
-/**
- * Returns true if the specified value is an object.  This includes arrays and
- * functions.
- * @param {?} val Variable to test.
- * @return {boolean} Whether variable is an object.
- */
-goog.isObject = function(val) {
-  var type = typeof val;
-  return type == 'object' && val != null || type == 'function';
-  // return Object(val) === val also works, but is slower, especially if val is
-  // not an object.
-};
-
-
-/**
- * Gets a unique ID for an object. This mutates the object so that further calls
- * with the same object as a parameter returns the same value. The unique ID is
- * guaranteed to be unique across the current session amongst objects that are
- * passed into {@code getUid}. There is no guarantee that the ID is unique or
- * consistent across sessions. It is unsafe to generate unique ID for function
- * prototypes.
- *
- * @param {Object} obj The object to get the unique ID for.
- * @return {number} The unique ID for the object.
- */
-goog.getUid = function(obj) {
-  // TODO(arv): Make the type stricter, do not accept null.
-
-  // In Opera window.hasOwnProperty exists but always returns false so we avoid
-  // using it. As a consequence the unique ID generated for BaseClass.prototype
-  // and SubClass.prototype will be the same.
-  return obj[goog.UID_PROPERTY_] ||
-      (obj[goog.UID_PROPERTY_] = ++goog.uidCounter_);
-};
-
-
-/**
- * Whether the given object is already assigned a unique ID.
- *
- * This does not modify the object.
- *
- * @param {!Object} obj The object to check.
- * @return {boolean} Whether there is an assigned unique id for the object.
- */
-goog.hasUid = function(obj) {
-  return !!obj[goog.UID_PROPERTY_];
-};
-
-
-/**
- * Removes the unique ID from an object. This is useful if the object was
- * previously mutated using {@code goog.getUid} in which case the mutation is
- * undone.
- * @param {Object} obj The object to remove the unique ID field from.
- */
-goog.removeUid = function(obj) {
-  // TODO(arv): Make the type stricter, do not accept null.
-
-  // In IE, DOM nodes are not instances of Object and throw an exception if we
-  // try to delete.  Instead we try to use removeAttribute.
-  if (obj !== null && 'removeAttribute' in obj) {
-    obj.removeAttribute(goog.UID_PROPERTY_);
-  }
-
-  try {
-    delete obj[goog.UID_PROPERTY_];
-  } catch (ex) {
-  }
-};
-
-
-/**
- * Name for unique ID property. Initialized in a way to help avoid collisions
- * with other closure JavaScript on the same page.
- * @type {string}
- * @private
- */
-goog.UID_PROPERTY_ = 'closure_uid_' + ((Math.random() * 1e9) >>> 0);
-
-
-/**
- * Counter for UID.
- * @type {number}
- * @private
- */
-goog.uidCounter_ = 0;
-
-
-/**
- * Adds a hash code field to an object. The hash code is unique for the
- * given object.
- * @param {Object} obj The object to get the hash code for.
- * @return {number} The hash code for the object.
- * @deprecated Use goog.getUid instead.
- */
-goog.getHashCode = goog.getUid;
-
-
-/**
- * Removes the hash code field from an object.
- * @param {Object} obj The object to remove the field from.
- * @deprecated Use goog.removeUid instead.
- */
-goog.removeHashCode = goog.removeUid;
-
-
-/**
- * Clones a value. The input may be an Object, Array, or basic type. Objects and
- * arrays will be cloned recursively.
- *
- * WARNINGS:
- * <code>goog.cloneObject</code> does not detect reference loops. Objects that
- * refer to themselves will cause infinite recursion.
- *
- * <code>goog.cloneObject</code> is unaware of unique identifiers, and copies
- * UIDs created by <code>getUid</code> into cloned results.
- *
- * @param {*} obj The value to clone.
- * @return {*} A clone of the input value.
- * @deprecated goog.cloneObject is unsafe. Prefer the goog.object methods.
- */
-goog.cloneObject = function(obj) {
-  var type = goog.typeOf(obj);
-  if (type == 'object' || type == 'array') {
-    if (obj.clone) {
-      return obj.clone();
-    }
-    var clone = type == 'array' ? [] : {};
-    for (var key in obj) {
-      clone[key] = goog.cloneObject(obj[key]);
-    }
-    return clone;
-  }
-
-  return obj;
-};
-
-
-/**
- * A native implementation of goog.bind.
- * @param {?function(this:T, ...)} fn A function to partially apply.
- * @param {T} selfObj Specifies the object which this should point to when the
- *     function is run.
- * @param {...*} var_args Additional arguments that are partially applied to the
- *     function.
- * @return {!Function} A partially-applied form of the function goog.bind() was
- *     invoked as a method of.
- * @template T
- * @private
- */
-goog.bindNative_ = function(fn, selfObj, var_args) {
-  return /** @type {!Function} */ (fn.call.apply(fn.bind, arguments));
-};
-
-
-/**
- * A pure-JS implementation of goog.bind.
- * @param {?function(this:T, ...)} fn A function to partially apply.
- * @param {T} selfObj Specifies the object which this should point to when the
- *     function is run.
- * @param {...*} var_args Additional arguments that are partially applied to the
- *     function.
- * @return {!Function} A partially-applied form of the function goog.bind() was
- *     invoked as a method of.
- * @template T
- * @private
- */
-goog.bindJs_ = function(fn, selfObj, var_args) {
-  if (!fn) {
-    throw new Error();
-  }
-
-  if (arguments.length > 2) {
-    var boundArgs = Array.prototype.slice.call(arguments, 2);
-    return function() {
-      // Prepend the bound arguments to the current arguments.
-      var newArgs = Array.prototype.slice.call(arguments);
-      Array.prototype.unshift.apply(newArgs, boundArgs);
-      return fn.apply(selfObj, newArgs);
-    };
-
-  } else {
-    return function() {
-      return fn.apply(selfObj, arguments);
-    };
-  }
-};
-
-
-/**
- * Partially applies this function to a particular 'this object' and zero or
- * more arguments. The result is a new function with some arguments of the first
- * function pre-filled and the value of this 'pre-specified'.
- *
- * Remaining arguments specified at call-time are appended to the pre-specified
- * ones.
- *
- * Also see: {@link #partial}.
- *
- * Usage:
- * <pre>var barMethBound = goog.bind(myFunction, myObj, 'arg1', 'arg2');
- * barMethBound('arg3', 'arg4');</pre>
- *
- * @param {?function(this:T, ...)} fn A function to partially apply.
- * @param {T} selfObj Specifies the object which this should point to when the
- *     function is run.
- * @param {...*} var_args Additional arguments that are partially applied to the
- *     function.
- * @return {!Function} A partially-applied form of the function goog.bind() was
- *     invoked as a method of.
- * @template T
- * @suppress {deprecated} See above.
- */
-goog.bind = function(fn, selfObj, var_args) {
-  // TODO(nicksantos): narrow the type signature.
-  if (Function.prototype.bind &&
-      // NOTE(nicksantos): Somebody pulled base.js into the default Chrome
-      // extension environment. This means that for Chrome extensions, they get
-      // the implementation of Function.prototype.bind that calls goog.bind
-      // instead of the native one. Even worse, we don't want to introduce a
-      // circular dependency between goog.bind and Function.prototype.bind, so
-      // we have to hack this to make sure it works correctly.
-      Function.prototype.bind.toString().indexOf('native code') != -1) {
-    goog.bind = goog.bindNative_;
-  } else {
-    goog.bind = goog.bindJs_;
-  }
-  return goog.bind.apply(null, arguments);
-};
-
-
-/**
- * Like goog.bind(), except that a 'this object' is not required. Useful when
- * the target function is already bound.
- *
- * Usage:
- * var g = goog.partial(f, arg1, arg2);
- * g(arg3, arg4);
- *
- * @param {Function} fn A function to partially apply.
- * @param {...*} var_args Additional arguments that are partially applied to fn.
- * @return {!Function} A partially-applied form of the function goog.partial()
- *     was invoked as a method of.
- */
-goog.partial = function(fn, var_args) {
-  var args = Array.prototype.slice.call(arguments, 1);
-  return function() {
-    // Clone the array (with slice()) and append additional arguments
-    // to the existing arguments.
-    var newArgs = args.slice();
-    newArgs.push.apply(newArgs, arguments);
-    return fn.apply(this, newArgs);
-  };
-};
-
-
-/**
- * Copies all the members of a source object to a target object. This method
- * does not work on all browsers for all objects that contain keys such as
- * toString or hasOwnProperty. Use goog.object.extend for this purpose.
- * @param {Object} target Target.
- * @param {Object} source Source.
- */
-goog.mixin = function(target, source) {
-  for (var x in source) {
-    target[x] = source[x];
-  }
-
-  // For IE7 or lower, the for-in-loop does not contain any properties that are
-  // not enumerable on the prototype object (for example, isPrototypeOf from
-  // Object.prototype) but also it will not include 'replace' on objects that
-  // extend String and change 'replace' (not that it is common for anyone to
-  // extend anything except Object).
-};
-
-
-/**
- * @return {number} An integer value representing the number of milliseconds
- *     between midnight, January 1, 1970 and the current time.
- */
-goog.now = (goog.TRUSTED_SITE && Date.now) || (function() {
-             // Unary plus operator converts its operand to a number which in
-             // the case of
-             // a date is done by calling getTime().
-             return +new Date();
-           });
-
-
-/**
- * Evals JavaScript in the global scope.  In IE this uses execScript, other
- * browsers use goog.global.eval. If goog.global.eval does not evaluate in the
- * global scope (for example, in Safari), appends a script tag instead.
- * Throws an exception if neither execScript or eval is defined.
- * @param {string} script JavaScript string.
- */
-goog.globalEval = function(script) {
-  if (goog.global.execScript) {
-    goog.global.execScript(script, 'JavaScript');
-  } else if (goog.global.eval) {
-    // Test to see if eval works
-    if (goog.evalWorksForGlobals_ == null) {
-      goog.global.eval('var _evalTest_ = 1;');
-      if (typeof goog.global['_evalTest_'] != 'undefined') {
-        try {
-          delete goog.global['_evalTest_'];
-        } catch (ignore) {
-          // Microsoft edge fails the deletion above in strict mode.
-        }
-        goog.evalWorksForGlobals_ = true;
-      } else {
-        goog.evalWorksForGlobals_ = false;
-      }
-    }
-
-    if (goog.evalWorksForGlobals_) {
-      goog.global.eval(script);
-    } else {
-      /** @type {Document} */
-      var doc = goog.global.document;
-      var scriptElt =
-          /** @type {!HTMLScriptElement} */ (doc.createElement('SCRIPT'));
-      scriptElt.type = 'text/javascript';
-      scriptElt.defer = false;
-      // Note(user): can't use .innerHTML since "t('<test>')" will fail and
-      // .text doesn't work in Safari 2.  Therefore we append a text node.
-      scriptElt.appendChild(doc.createTextNode(script));
-      doc.body.appendChild(scriptElt);
-      doc.body.removeChild(scriptElt);
-    }
-  } else {
-    throw Error('goog.globalEval not available');
-  }
-};
-
-
-/**
- * Indicates whether or not we can call 'eval' directly to eval code in the
- * global scope. Set to a Boolean by the first call to goog.globalEval (which
- * empirically tests whether eval works for globals). @see goog.globalEval
- * @type {?boolean}
- * @private
- */
-goog.evalWorksForGlobals_ = null;
-
-
-/**
- * Optional map of CSS class names to obfuscated names used with
- * goog.getCssName().
- * @private {!Object<string, string>|undefined}
- * @see goog.setCssNameMapping
- */
-goog.cssNameMapping_;
-
-
-/**
- * Optional obfuscation style for CSS class names. Should be set to either
- * 'BY_WHOLE' or 'BY_PART' if defined.
- * @type {string|undefined}
- * @private
- * @see goog.setCssNameMapping
- */
-goog.cssNameMappingStyle_;
-
-
-
-/**
- * A hook for modifying the default behavior goog.getCssName. The function
- * if present, will recieve the standard output of the goog.getCssName as
- * its input.
- *
- * @type {(function(string):string)|undefined}
- */
-goog.global.CLOSURE_CSS_NAME_MAP_FN;
-
-
-/**
- * Handles strings that are intended to be used as CSS class names.
- *
- * This function works in tandem with @see goog.setCssNameMapping.
- *
- * Without any mapping set, the arguments are simple joined with a hyphen and
- * passed through unaltered.
- *
- * When there is a mapping, there are two possible styles in which these
- * mappings are used. In the BY_PART style, each part (i.e. in between hyphens)
- * of the passed in css name is rewritten according to the map. In the BY_WHOLE
- * style, the full css name is looked up in the map directly. If a rewrite is
- * not specified by the map, the compiler will output a warning.
- *
- * When the mapping is passed to the compiler, it will replace calls to
- * goog.getCssName with the strings from the mapping, e.g.
- *     var x = goog.getCssName('foo');
- *     var y = goog.getCssName(this.baseClass, 'active');
- *  becomes:
- *     var x = 'foo';
- *     var y = this.baseClass + '-active';
- *
- * If one argument is passed it will be processed, if two are passed only the
- * modifier will be processed, as it is assumed the first argument was generated
- * as a result of calling goog.getCssName.
- *
- * @param {string} className The class name.
- * @param {string=} opt_modifier A modifier to be appended to the class name.
- * @return {string} The class name or the concatenation of the class name and
- *     the modifier.
- */
-goog.getCssName = function(className, opt_modifier) {
-  // String() is used for compatibility with compiled soy where the passed
-  // className can be non-string objects.
-  if (String(className).charAt(0) == '.') {
-    throw new Error(
-        'className passed in goog.getCssName must not start with ".".' +
-        ' You passed: ' + className);
-  }
-
-  var getMapping = function(cssName) {
-    return goog.cssNameMapping_[cssName] || cssName;
-  };
-
-  var renameByParts = function(cssName) {
-    // Remap all the parts individually.
-    var parts = cssName.split('-');
-    var mapped = [];
-    for (var i = 0; i < parts.length; i++) {
-      mapped.push(getMapping(parts[i]));
-    }
-    return mapped.join('-');
-  };
-
-  var rename;
-  if (goog.cssNameMapping_) {
-    rename =
-        goog.cssNameMappingStyle_ == 'BY_WHOLE' ? getMapping : renameByParts;
-  } else {
-    rename = function(a) {
-      return a;
-    };
-  }
-
-  var result =
-      opt_modifier ? className + '-' + rename(opt_modifier) : rename(className);
-
-  // The special CLOSURE_CSS_NAME_MAP_FN allows users to specify further
-  // processing of the class name.
-  if (goog.global.CLOSURE_CSS_NAME_MAP_FN) {
-    return goog.global.CLOSURE_CSS_NAME_MAP_FN(result);
-  }
-
-  return result;
-};
-
-
-/**
- * Sets the map to check when returning a value from goog.getCssName(). Example:
- * <pre>
- * goog.setCssNameMapping({
- *   "goog": "a",
- *   "disabled": "b",
- * });
- *
- * var x = goog.getCssName('goog');
- * // The following evaluates to: "a a-b".
- * goog.getCssName('goog') + ' ' + goog.getCssName(x, 'disabled')
- * </pre>
- * When declared as a map of string literals to string literals, the JSCompiler
- * will replace all calls to goog.getCssName() using the supplied map if the
- * --process_closure_primitives flag is set.
- *
- * @param {!Object} mapping A map of strings to strings where keys are possible
- *     arguments to goog.getCssName() and values are the corresponding values
- *     that should be returned.
- * @param {string=} opt_style The style of css name mapping. There are two valid
- *     options: 'BY_PART', and 'BY_WHOLE'.
- * @see goog.getCssName for a description.
- */
-goog.setCssNameMapping = function(mapping, opt_style) {
-  goog.cssNameMapping_ = mapping;
-  goog.cssNameMappingStyle_ = opt_style;
-};
-
-
-/**
- * To use CSS renaming in compiled mode, one of the input files should have a
- * call to goog.setCssNameMapping() with an object literal that the JSCompiler
- * can extract and use to replace all calls to goog.getCssName(). In uncompiled
- * mode, JavaScript code should be loaded before this base.js file that declares
- * a global variable, CLOSURE_CSS_NAME_MAPPING, which is used below. This is
- * to ensure that the mapping is loaded before any calls to goog.getCssName()
- * are made in uncompiled mode.
- *
- * A hook for overriding the CSS name mapping.
- * @type {!Object<string, string>|undefined}
- */
-goog.global.CLOSURE_CSS_NAME_MAPPING;
-
-
-if (!COMPILED && goog.global.CLOSURE_CSS_NAME_MAPPING) {
-  // This does not call goog.setCssNameMapping() because the JSCompiler
-  // requires that goog.setCssNameMapping() be called with an object literal.
-  goog.cssNameMapping_ = goog.global.CLOSURE_CSS_NAME_MAPPING;
-}
-
-
-/**
- * Gets a localized message.
- *
- * This function is a compiler primitive. If you give the compiler a localized
- * message bundle, it will replace the string at compile-time with a localized
- * version, and expand goog.getMsg call to a concatenated string.
- *
- * Messages must be initialized in the form:
- * <code>
- * var MSG_NAME = goog.getMsg('Hello {$placeholder}', {'placeholder': 'world'});
- * </code>
- *
- * This function produces a string which should be treated as plain text. Use
- * {@link goog.html.SafeHtmlFormatter} in conjunction with goog.getMsg to
- * produce SafeHtml.
- *
- * @param {string} str Translatable string, places holders in the form {$foo}.
- * @param {Object<string, string>=} opt_values Maps place holder name to value.
- * @return {string} message with placeholders filled.
- */
-goog.getMsg = function(str, opt_values) {
-  if (opt_values) {
-    str = str.replace(/\{\$([^}]+)}/g, function(match, key) {
-      return (opt_values != null && key in opt_values) ? opt_values[key] :
-                                                         match;
-    });
-  }
-  return str;
-};
-
-
-/**
- * Gets a localized message. If the message does not have a translation, gives a
- * fallback message.
- *
- * This is useful when introducing a new message that has not yet been
- * translated into all languages.
- *
- * This function is a compiler primitive. Must be used in the form:
- * <code>var x = goog.getMsgWithFallback(MSG_A, MSG_B);</code>
- * where MSG_A and MSG_B were initialized with goog.getMsg.
- *
- * @param {string} a The preferred message.
- * @param {string} b The fallback message.
- * @return {string} The best translated message.
- */
-goog.getMsgWithFallback = function(a, b) {
-  return a;
-};
-
-
-/**
- * Exposes an unobfuscated global namespace path for the given object.
- * Note that fields of the exported object *will* be obfuscated, unless they are
- * exported in turn via this function or goog.exportProperty.
- *
- * Also handy for making public items that are defined in anonymous closures.
- *
- * ex. goog.exportSymbol('public.path.Foo', Foo);
- *
- * ex. goog.exportSymbol('public.path.Foo.staticFunction', Foo.staticFunction);
- *     public.path.Foo.staticFunction();
- *
- * ex. goog.exportSymbol('public.path.Foo.prototype.myMethod',
- *                       Foo.prototype.myMethod);
- *     new public.path.Foo().myMethod();
- *
- * @param {string} publicPath Unobfuscated name to export.
- * @param {*} object Object the name should point to.
- * @param {Object=} opt_objectToExportTo The object to add the path to; default
- *     is goog.global.
- */
-goog.exportSymbol = function(publicPath, object, opt_objectToExportTo) {
-  goog.exportPath_(publicPath, object, opt_objectToExportTo);
-};
-
-
-/**
- * Exports a property unobfuscated into the object's namespace.
- * ex. goog.exportProperty(Foo, 'staticFunction', Foo.staticFunction);
- * ex. goog.exportProperty(Foo.prototype, 'myMethod', Foo.prototype.myMethod);
- * @param {Object} object Object whose static property is being exported.
- * @param {string} publicName Unobfuscated name to export.
- * @param {*} symbol Object the name should point to.
- */
-goog.exportProperty = function(object, publicName, symbol) {
-  object[publicName] = symbol;
-};
-
-
-/**
- * Inherit the prototype methods from one constructor into another.
- *
- * Usage:
- * <pre>
- * function ParentClass(a, b) { }
- * ParentClass.prototype.foo = function(a) { };
- *
- * function ChildClass(a, b, c) {
- *   ChildClass.base(this, 'constructor', a, b);
- * }
- * goog.inherits(ChildClass, ParentClass);
- *
- * var child = new ChildClass('a', 'b', 'see');
- * child.foo(); // This works.
- * </pre>
- *
- * @param {!Function} childCtor Child class.
- * @param {!Function} parentCtor Parent class.
- */
-goog.inherits = function(childCtor, parentCtor) {
-  /** @constructor */
-  function tempCtor() {}
-  tempCtor.prototype = parentCtor.prototype;
-  childCtor.superClass_ = parentCtor.prototype;
-  childCtor.prototype = new tempCtor();
-  /** @override */
-  childCtor.prototype.constructor = childCtor;
-
-  /**
-   * Calls superclass constructor/method.
-   *
-   * This function is only available if you use goog.inherits to
-   * express inheritance relationships between classes.
-   *
-   * NOTE: This is a replacement for goog.base and for superClass_
-   * property defined in childCtor.
-   *
-   * @param {!Object} me Should always be "this".
-   * @param {string} methodName The method name to call. Calling
-   *     superclass constructor can be done with the special string
-   *     'constructor'.
-   * @param {...*} var_args The arguments to pass to superclass
-   *     method/constructor.
-   * @return {*} The return value of the superclass method/constructor.
-   */
-  childCtor.base = function(me, methodName, var_args) {
-    // Copying using loop to avoid deop due to passing arguments object to
-    // function. This is faster in many JS engines as of late 2014.
-    var args = new Array(arguments.length - 2);
-    for (var i = 2; i < arguments.length; i++) {
-      args[i - 2] = arguments[i];
-    }
-    return parentCtor.prototype[methodName].apply(me, args);
-  };
-};
-
-
-/**
- * Call up to the superclass.
- *
- * If this is called from a constructor, then this calls the superclass
- * constructor with arguments 1-N.
- *
- * If this is called from a prototype method, then you must pass the name of the
- * method as the second argument to this function. If you do not, you will get a
- * runtime error. This calls the superclass' method with arguments 2-N.
- *
- * This function only works if you use goog.inherits to express inheritance
- * relationships between your classes.
- *
- * This function is a compiler primitive. At compile-time, the compiler will do
- * macro expansion to remove a lot of the extra overhead that this function
- * introduces. The compiler will also enforce a lot of the assumptions that this
- * function makes, and treat it as a compiler error if you break them.
- *
- * @param {!Object} me Should always be "this".
- * @param {*=} opt_methodName The method name if calling a super method.
- * @param {...*} var_args The rest of the arguments.
- * @return {*} The return value of the superclass method.
- * @suppress {es5Strict} This method can not be used in strict mode, but
- *     all Closure Library consumers must depend on this file.
- * @deprecated goog.base is not strict mode compatible.  Prefer the static
- *     "base" method added to the constructor by goog.inherits
- *     or ES6 classes and the "super" keyword.
- */
-goog.base = function(me, opt_methodName, var_args) {
-  var caller = arguments.callee.caller;
-
-  if (goog.STRICT_MODE_COMPATIBLE || (goog.DEBUG && !caller)) {
-    throw Error(
-        'arguments.caller not defined.  goog.base() cannot be used ' +
-        'with strict mode code. See ' +
-        'http://www.ecma-international.org/ecma-262/5.1/#sec-C');
-  }
-
-  if (caller.superClass_) {
-    // Copying using loop to avoid deop due to passing arguments object to
-    // function. This is faster in many JS engines as of late 2014.
-    var ctorArgs = new Array(arguments.length - 1);
-    for (var i = 1; i < arguments.length; i++) {
-      ctorArgs[i - 1] = arguments[i];
-    }
-    // This is a constructor. Call the superclass constructor.
-    return caller.superClass_.constructor.apply(me, ctorArgs);
-  }
-
-  // Copying using loop to avoid deop due to passing arguments object to
-  // function. This is faster in many JS engines as of late 2014.
-  var args = new Array(arguments.length - 2);
-  for (var i = 2; i < arguments.length; i++) {
-    args[i - 2] = arguments[i];
-  }
-  var foundCaller = false;
-  for (var ctor = me.constructor; ctor;
-       ctor = ctor.superClass_ && ctor.superClass_.constructor) {
-    if (ctor.prototype[opt_methodName] === caller) {
-      foundCaller = true;
-    } else if (foundCaller) {
-      return ctor.prototype[opt_methodName].apply(me, args);
-    }
-  }
-
-  // If we did not find the caller in the prototype chain, then one of two
-  // things happened:
-  // 1) The caller is an instance method.
-  // 2) This method was not called by the right caller.
-  if (me[opt_methodName] === caller) {
-    return me.constructor.prototype[opt_methodName].apply(me, args);
-  } else {
-    throw Error(
-        'goog.base called from a method of one name ' +
-        'to a method of a different name');
-  }
-};
-
-
-/**
- * Allow for aliasing within scope functions.  This function exists for
- * uncompiled code - in compiled code the calls will be inlined and the aliases
- * applied.  In uncompiled code the function is simply run since the aliases as
- * written are valid JavaScript.
- *
- *
- * @param {function()} fn Function to call.  This function can contain aliases
- *     to namespaces (e.g. "var dom = goog.dom") or classes
- *     (e.g. "var Timer = goog.Timer").
- */
-goog.scope = function(fn) {
-  if (goog.isInModuleLoader_()) {
-    throw Error('goog.scope is not supported within a goog.module.');
-  }
-  fn.call(goog.global);
-};
-
-
-/*
- * To support uncompiled, strict mode bundles that use eval to divide source
- * like so:
- *    eval('someSource;//# sourceUrl sourcefile.js');
- * We need to export the globally defined symbols "goog" and "COMPILED".
- * Exporting "goog" breaks the compiler optimizations, so we required that
- * be defined externally.
- * NOTE: We don't use goog.exportSymbol here because we don't want to trigger
- * extern generation when that compiler option is enabled.
- */
-if (!COMPILED) {
-  goog.global['COMPILED'] = COMPILED;
-}
-
-
-//==============================================================================
-// goog.defineClass implementation
-//==============================================================================
-
-
-/**
- * Creates a restricted form of a Closure "class":
- *   - from the compiler's perspective, the instance returned from the
- *     constructor is sealed (no new properties may be added).  This enables
- *     better checks.
- *   - the compiler will rewrite this definition to a form that is optimal
- *     for type checking and optimization (initially this will be a more
- *     traditional form).
- *
- * @param {Function} superClass The superclass, Object or null.
- * @param {goog.defineClass.ClassDescriptor} def
- *     An object literal describing
- *     the class.  It may have the following properties:
- *     "constructor": the constructor function
- *     "statics": an object literal containing methods to add to the constructor
- *        as "static" methods or a function that will receive the constructor
- *        function as its only parameter to which static properties can
- *        be added.
- *     all other properties are added to the prototype.
- * @return {!Function} The class constructor.
- */
-goog.defineClass = function(superClass, def) {
-  // TODO(johnlenz): consider making the superClass an optional parameter.
-  var constructor = def.constructor;
-  var statics = def.statics;
-  // Wrap the constructor prior to setting up the prototype and static methods.
-  if (!constructor || constructor == Object.prototype.constructor) {
-    constructor = function() {
-      throw Error('cannot instantiate an interface (no constructor defined).');
-    };
-  }
-
-  var cls = goog.defineClass.createSealingConstructor_(constructor, superClass);
-  if (superClass) {
-    goog.inherits(cls, superClass);
-  }
-
-  // Remove all the properties that should not be copied to the prototype.
-  delete def.constructor;
-  delete def.statics;
-
-  goog.defineClass.applyProperties_(cls.prototype, def);
-  if (statics != null) {
-    if (statics instanceof Function) {
-      statics(cls);
-    } else {
-      goog.defineClass.applyProperties_(cls, statics);
-    }
-  }
-
-  return cls;
-};
-
-
-/**
- * @typedef {{
- *   constructor: (!Function|undefined),
- *   statics: (Object|undefined|function(Function):void)
- * }}
- */
-goog.defineClass.ClassDescriptor;
-
-
-/**
- * @define {boolean} Whether the instances returned by goog.defineClass should
- *     be sealed when possible.
- *
- * When sealing is disabled the constructor function will not be wrapped by
- * goog.defineClass, making it incompatible with ES6 class methods.
- */
-goog.define('goog.defineClass.SEAL_CLASS_INSTANCES', goog.DEBUG);
-
-
-/**
- * If goog.defineClass.SEAL_CLASS_INSTANCES is enabled and Object.seal is
- * defined, this function will wrap the constructor in a function that seals the
- * results of the provided constructor function.
- *
- * @param {!Function} ctr The constructor whose results maybe be sealed.
- * @param {Function} superClass The superclass constructor.
- * @return {!Function} The replacement constructor.
- * @private
- */
-goog.defineClass.createSealingConstructor_ = function(ctr, superClass) {
-  if (!goog.defineClass.SEAL_CLASS_INSTANCES) {
-    // Do now wrap the constructor when sealing is disabled. Angular code
-    // depends on this for injection to work properly.
-    return ctr;
-  }
-
-  // Compute whether the constructor is sealable at definition time, rather
-  // than when the instance is being constructed.
-  var superclassSealable = !goog.defineClass.isUnsealable_(superClass);
-
-  /**
-   * @this {Object}
-   * @return {?}
-   */
-  var wrappedCtr = function() {
-    // Don't seal an instance of a subclass when it calls the constructor of
-    // its super class as there is most likely still setup to do.
-    var instance = ctr.apply(this, arguments) || this;
-    instance[goog.UID_PROPERTY_] = instance[goog.UID_PROPERTY_];
-
-    if (this.constructor === wrappedCtr && superclassSealable &&
-        Object.seal instanceof Function) {
-      Object.seal(instance);
-    }
-    return instance;
-  };
-
-  return wrappedCtr;
-};
-
-
-/**
- * @param {Function} ctr The constructor to test.
- * @return {boolean} Whether the constructor has been tagged as unsealable
- *     using goog.tagUnsealableClass.
- * @private
- */
-goog.defineClass.isUnsealable_ = function(ctr) {
-  return ctr && ctr.prototype &&
-      ctr.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_];
-};
-
-
-// TODO(johnlenz): share these values with the goog.object
-/**
- * The names of the fields that are defined on Object.prototype.
- * @type {!Array<string>}
- * @private
- * @const
- */
-goog.defineClass.OBJECT_PROTOTYPE_FIELDS_ = [
-  'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
-  'toLocaleString', 'toString', 'valueOf'
-];
-
-
-// TODO(johnlenz): share this function with the goog.object
-/**
- * @param {!Object} target The object to add properties to.
- * @param {!Object} source The object to copy properties from.
- * @private
- */
-goog.defineClass.applyProperties_ = function(target, source) {
-  // TODO(johnlenz): update this to support ES5 getters/setters
-
-  var key;
-  for (key in source) {
-    if (Object.prototype.hasOwnProperty.call(source, key)) {
-      target[key] = source[key];
-    }
-  }
-
-  // For IE the for-in-loop does not contain any properties that are not
-  // enumerable on the prototype object (for example isPrototypeOf from
-  // Object.prototype) and it will also not include 'replace' on objects that
-  // extend String and change 'replace' (not that it is common for anyone to
-  // extend anything except Object).
-  for (var i = 0; i < goog.defineClass.OBJECT_PROTOTYPE_FIELDS_.length; i++) {
-    key = goog.defineClass.OBJECT_PROTOTYPE_FIELDS_[i];
-    if (Object.prototype.hasOwnProperty.call(source, key)) {
-      target[key] = source[key];
-    }
-  }
-};
-
-
-/**
- * Sealing classes breaks the older idiom of assigning properties on the
- * prototype rather than in the constructor. As such, goog.defineClass
- * must not seal subclasses of these old-style classes until they are fixed.
- * Until then, this marks a class as "broken", instructing defineClass
- * not to seal subclasses.
- * @param {!Function} ctr The legacy constructor to tag as unsealable.
- */
-goog.tagUnsealableClass = function(ctr) {
-  if (!COMPILED && goog.defineClass.SEAL_CLASS_INSTANCES) {
-    ctr.prototype[goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_] = true;
-  }
-};
-
-
-/**
- * Name for unsealable tag property.
- * @const @private {string}
- */
-goog.UNSEALABLE_CONSTRUCTOR_PROPERTY_ = 'goog_defineClass_legacy_unsealable';
-
-
-/**
- * Returns a newly created map from language mode string to a boolean
- * indicating whether transpilation should be done for that mode.
- *
- * Guaranteed invariant:
- * For any two modes, l1 and l2 where l2 is a newer mode than l1,
- * `map[l1] == true` implies that `map[l2] == true`.
- * @private
- * @return {!Object<string, boolean>}
- */
-goog.createRequiresTranspilation_ = function() {
-  var /** !Object<string, boolean> */ requiresTranspilation = {'es3': false};
-  var transpilationRequiredForAllLaterModes = false;
-
-  /**
-   * Adds an entry to requiresTranspliation for the given language mode.
-   *
-   * IMPORTANT: Calls must be made in order from oldest to newest language
-   * mode.
-   * @param {string} modeName
-   * @param {function(): boolean} isSupported Returns true if the JS engine
-   *     supports the given mode.
-   */
-  function addNewerLanguageTranspilationCheck(modeName, isSupported) {
-    if (transpilationRequiredForAllLaterModes) {
-      requiresTranspilation[modeName] = true;
-    } else if (isSupported()) {
-      requiresTranspilation[modeName] = false;
-    } else {
-      requiresTranspilation[modeName] = true;
-      transpilationRequiredForAllLaterModes = true;
-    }
-  }
-
-  /**
-   * Does the given code evaluate without syntax errors and return a truthy
-   * result?
-   */
-  function /** boolean */ evalCheck(/** string */ code) {
-    try {
-      return !!eval(code);
-    } catch (ignored) {
-      return false;
-    }
-  }
-
-  var userAgent = goog.global.navigator && goog.global.navigator.userAgent ?
-      goog.global.navigator.userAgent :
-      '';
-
-  // Identify ES3-only browsers by their incorrect treatment of commas.
-  addNewerLanguageTranspilationCheck('es5', function() {
-    return evalCheck('[1,].length==1');
-  });
-  addNewerLanguageTranspilationCheck('es6', function() {
-    // Edge has a non-deterministic (i.e., not reproducible) bug with ES6:
-    // https://github.com/Microsoft/ChakraCore/issues/1496.
-    var re = /Edge\/(\d+)(\.\d)*/i;
-    var edgeUserAgent = userAgent.match(re);
-    if (edgeUserAgent && Number(edgeUserAgent[1]) < 15) {
-      return false;
-    }
-    // Test es6: [FF50 (?), Edge 14 (?), Chrome 50]
-    //   (a) default params (specifically shadowing locals),
-    //   (b) destructuring, (c) block-scoped functions,
-    //   (d) for-of (const), (e) new.target/Reflect.construct
-    var es6fullTest =
-        'class X{constructor(){if(new.target!=String)throw 1;this.x=42}}' +
-        'let q=Reflect.construct(X,[],String);if(q.x!=42||!(q instanceof ' +
-        'String))throw 1;for(const a of[2,3]){if(a==2)continue;function ' +
-        'f(z={a}){let a=0;return z.a}{function f(){return 0;}}return f()' +
-        '==3}';
-
-    return evalCheck('(()=>{"use strict";' + es6fullTest + '})()');
-  });
-  // TODO(joeltine): Remove es6-impl references for b/31340605.
-  // Consider es6-impl (widely-implemented es6 features) to be supported
-  // whenever es6 is supported. Technically es6-impl is a lower level of
-  // support than es6, but we don't have tests specifically for it.
-  addNewerLanguageTranspilationCheck('es6-impl', function() {
-    return true;
-  });
-  // ** and **= are the only new features in 'es7'
-  addNewerLanguageTranspilationCheck('es7', function() {
-    return evalCheck('2 ** 2 == 4');
-  });
-  // async functions are the only new features in 'es8'
-  addNewerLanguageTranspilationCheck('es8', function() {
-    return evalCheck('async () => 1, true');
-  });
-  return requiresTranspilation;
-};

+ 0 - 21
src/renderer/cocoblockly-x/python/block/closure/goog/base_module_test.html

@@ -1,21 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-Copyright 2006 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
-<head>
-<meta http-equiv="X-UA-Compatible" content="IE=edge">
-<meta charset="UTF-8" />
-<title>Closure Unit Tests - goog.module</title>
-<script src="base.js"></script>
-</head>
-<body>
-
-<script>
-goog.require('goog.baseModuleTest');
-</script>
-</body>
-</html>

+ 0 - 146
src/renderer/cocoblockly-x/python/block/closure/goog/base_module_test.js

@@ -1,146 +0,0 @@
-// Copyright 2006 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-/**
- * @fileoverview Unit tests for Closure's base.js's goog.module support.
- */
-
-goog.module('goog.baseModuleTest');
-goog.setTestOnly('goog.baseModuleTest');
-
-
-// Used to test dynamic loading works, see testRequire*
-var Timer = goog.require('goog.Timer');
-var Replacer = goog.require('goog.testing.PropertyReplacer');
-var jsunit = goog.require('goog.testing.jsunit');
-var testSuite = goog.require('goog.testing.testSuite');
-
-var testModule = goog.require('goog.test_module');
-
-var stubs = new Replacer();
-
-function assertProvideFails(namespace) {
-  assertThrows(
-      'goog.provide(' + namespace + ') should have failed',
-      goog.partial(goog.provide, namespace));
-}
-
-function assertModuleFails(namespace) {
-  assertThrows(
-      'goog.module(' + namespace + ') should have failed',
-      goog.partial(goog.module, namespace));
-}
-
-function assertLoadModule(msg, moduleDef) {
-  assertNotThrows(msg, goog.partial(goog.loadModule, moduleDef));
-}
-
-testSuite({
-  teardown: function() { stubs.reset(); },
-
-  testModuleDecl: function() {
-    // assert that goog.module doesn't modify the global namespace
-    assertUndefined(
-        'module failed to protect global namespace: ' +
-            'goog.baseModuleTest',
-        goog.baseModuleTest);
-  },
-
-  testModuleScoping: function() {
-    // assert test functions are not exported to the global namespace
-    assertNotUndefined('module failed: testModule', testModule);
-    assertFalse(
-        'module failed: testModule',
-        goog.isFunction(goog.global.testModuleScoping));
-  },
-
-  testProvideStrictness1: function() {
-    assertModuleFails('goog.xy');  // not in goog.loadModule
-
-    assertProvideFails('goog.baseModuleTest');  // this file.
-  },
-
-  testProvideStrictness2: function() {
-    // goog.module "provides" a namespace
-    assertTrue(goog.isProvided_('goog.baseModuleTest'));
-  },
-
-  testExportSymbol: function() {
-    // Assert that export symbol works from within a goog.module.
-    var date = new Date();
-
-    assertTrue(typeof nodots == 'undefined');
-    goog.exportSymbol('nodots', date);
-    assertEquals(date, nodots);  // globals are accessible from within a module.
-    nodots = undefined;
-  },
-
-  testLoadModule: function() {
-    assertLoadModule(
-        'Loading a module that exports a typedef should succeed',
-        'goog.module(\'goog.test_module_typedef\');' +
-            'var typedef;' +
-            'exports = typedef;');
-  },
-
-  //=== tests for Require logic ===
-
-  testLegacyRequire: function() {
-    // goog.Timer is a legacy module loaded above
-    assertNotUndefined('goog.Timer should be available', goog.Timer);
-
-    // Verify that a legacy module can be aliases with goog.require
-    assertTrue(
-        'Timer should be the goog.Timer namespace object',
-        goog.Timer === Timer);
-
-    // and its dependencies
-    assertNotUndefined(
-        'goog.events.EventTarget should be available',
-        /** @suppress {missingRequire} */ goog.events.EventTarget);
-  },
-
-  testRequireModule: function() {
-    assertEquals(
-        'module failed to export legacy namespace: ' +
-            'goog.test_module',
-        testModule, goog.test_module);
-    assertUndefined(
-        'module failed to protect global namespace: ' +
-            'goog.test_module_dep',
-        goog.test_module_dep);
-
-    // The test module is available under its alias
-    assertNotUndefined('testModule is loaded', testModule);
-    assertTrue('module failed: testModule', goog.isFunction(testModule));
-
-
-    // Test that any escaping of </script> in test files is correct. Escape the
-    // / in </script> here so that any such code does not affect it here.
-    assertEquals('<\/script>', testModule.CLOSING_SCRIPT_TAG);
-  },
-
-  testThisInModule: goog.bind(
-      function() {
-        // IE9 and below don't support "strict" mode and "undefined" gets
-        // coersed to "window".
-        if (!goog.userAgent.IE || goog.userAgent.isVersionOrHigher('10')) {
-          assertEquals(this, undefined);
-        } else {
-          assertEquals(this, goog.global);
-        }
-      },
-      this)
-});

+ 0 - 34
src/renderer/cocoblockly-x/python/block/closure/goog/base_test.html

@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-Copyright 2006 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
-<head>
-<meta http-equiv="X-UA-Compatible" content="IE=edge">
-<meta charset="UTF-8" />
-<title>Closure Unit Tests - goog.*</title>
-<script>
-  var CLOSURE_DEFINES = {
-    'SOME_DEFINE': 456,
-    'ns.SOME_DEFINE': 456
-  };
-</script>
-<script src="base.js"></script>
-</head>
-<body>
-<div id="elem">
-  <span>One</span>
-  <span id="text">Two</span>
-  <span>Three</span>
-</div>
-
-<iframe name="f1" id="f1" src=""></iframe>
-<iframe name="f2" id="f2" src=""></iframe>
-<script>
-goog.require('goog.baseTest');
-</script>
-</body>
-</html>

+ 0 - 1907
src/renderer/cocoblockly-x/python/block/closure/goog/base_test.js

@@ -1,1907 +0,0 @@
-// Copyright 2006 The Closure Library Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS-IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-
-/**
- * @fileoverview Unit tests for Closure's base.js.
- */
-
-goog.provide('goog.baseTest');
-
-goog.setTestOnly('goog.baseTest');
-
-goog.require('goog.Promise');
-// Used to test dynamic loading works, see testRequire*
-goog.require('goog.Timer');
-goog.require('goog.dom');
-goog.require('goog.dom.TagName');
-goog.require('goog.functions');
-goog.require('goog.object');
-goog.require('goog.test_module');
-goog.require('goog.testing.PropertyReplacer');
-goog.require('goog.testing.jsunit');
-goog.require('goog.testing.recordFunction');
-goog.require('goog.userAgent');
-
-var earlyTestModuleGet = goog.module.get('goog.test_module');
-
-/**
- * @param {?} name
- * @return {?}
- */
-function getFramedVars(name) {
-  var w = window.frames[name];
-  var doc = w.document;
-  doc.open();
-  doc.write(
-      '<script>' +
-      'var a = [0, 1, 2];' +
-      'var o = {a: 0, b: 1};' +
-      'var n = 42;' +
-      'var b = true;' +
-      'var s = "string";' +
-      'var nv = null;' +
-      'var u = undefined;' +
-      'var fv = function(){};' +
-      '</' +
-      'script>');
-  doc.close();
-  return {
-    'array': w.a,
-    'object': w.o,
-    'number': w.n,
-    'boolean': w.b,
-    'string': w.s,
-    'functionVar': w.fv,
-    'nullVar': w.nv,
-    'undefinedVar': w.u
-  };
-}
-
-var framedVars = getFramedVars('f1');
-var framedVars2 = getFramedVars('f2');
-// remove iframe
-var iframeElement = document.getElementById('f2');
-iframeElement.parentNode.removeChild(iframeElement);
-var stubs = new goog.testing.PropertyReplacer();
-var originalGoogBind = goog.bind;
-
-function tearDown() {
-  goog.setCssNameMapping(undefined);
-  stubs.reset();
-  goog.bind = originalGoogBind;
-}
-
-function testLibrary() {
-  assertNotUndefined('\'goog\' not loaded', goog);
-}
-
-function testDefine() {
-  goog.define('SOME_DEFINE', 123);  // overridden by 456
-  assertEquals(SOME_DEFINE, 456);
-
-  goog.define('SOME_OTHER_DEFINE', 123);  // not overridden
-  assertEquals(SOME_OTHER_DEFINE, 123);
-
-  // alias to avoid the being picked up by the deps scanner.
-  var provide = goog.provide;
-  provide('ns');
-
-  goog.define('ns.SOME_DEFINE', 123);  // overridden by 456
-  assertEquals(SOME_DEFINE, 456);
-
-  goog.define('ns.SOME_OTHER_DEFINE', 123);  // not overridden
-  assertEquals(SOME_OTHER_DEFINE, 123);
-}
-
-function testProvide() {
-  // alias to avoid the being picked up by the deps scanner.
-  var provide = goog.provide;
-
-  provide('goog.test.name.space');
-  assertNotUndefined('provide failed: goog.test', goog.test);
-  assertNotUndefined('provide failed: goog.test.name', goog.test.name);
-  assertNotUndefined(
-      'provide failed: goog.test.name.space', goog.test.name.space);
-
-  // ensure that providing 'goog.test.name' doesn't throw an exception
-  provide('goog.test');
-  provide('goog.test.name');
-  delete goog.test;
-}
-
-// "watch" is a native member of Object.prototype on Firefox
-// Ensure it can still be added as a namespace
-function testProvideWatch() {
-  // alias to avoid the being picked up by the deps scanner.
-  var provide = goog.provide;
-
-  provide('goog.yoddle.watch');
-  assertNotUndefined('provide failed: goog.yoddle.watch', goog.yoddle.watch);
-  delete goog.yoddle;
-}
-
-// Namespaces should not conflict with elements added to the window based on
-// their id
-function testConflictingSymbolAndId() {
-  // Create a div with a given id
-  var divElement = document.createElement('div');
-  divElement.id = 'clashingname';
-  document.body.appendChild(divElement);
-
-  // The object at window.clashingname is the element with that id
-  assertEquals(window.clashingname, divElement);
-
-  // Export a symbol to a sub-namespace of that id
-  var symbolObject = {};
-  goog.exportSymbol('clashingname.symbolname', symbolObject);
-
-  // The symbol has been added...
-  assertEquals(window.clashingname.symbolname, symbolObject);
-
-  // ...and has not affected the original div
-  assertEquals(window.clashingname, divElement);
-}
-
-function testProvideStrictness() {
-  // alias to avoid the being picked up by the deps scanner.
-  var provide = goog.provide;
-
-  provide('goog.xy');
-  assertProvideFails('goog.xy');
-
-  provide('goog.xy.z');
-  assertProvideFails('goog.xy');
-
-  window['goog']['xyz'] = 'Bob';
-  assertProvideFails('goog.xyz');
-
-  delete goog.xy;
-  delete goog.xyz;
-}
-
-/** @param {?} namespace */
-function assertProvideFails(namespace) {
-  assertThrows(
-      'goog.provide(' + namespace + ') should have failed',
-      goog.partial(goog.provide, namespace));
-}
-
-function testIsProvided() {
-  // alias to avoid the being picked up by the deps scanner.
-  var provide = goog.provide;
-
-  provide('goog.explicit');
-  assertTrue(goog.isProvided_('goog.explicit'));
-  provide('goog.implicit.explicit');
-  assertFalse(goog.isProvided_('goog.implicit'));
-  assertTrue(goog.isProvided_('goog.implicit.explicit'));
-}
-
-function testGlobalize() {
-  var a = {a: 1, b: 2, c: 3};
-  var b = {};
-  goog.globalize(a, b);
-  assertNotUndefined('Globalize to arbitrary object', b.a);
-  assertNotUndefined('Globalize to arbitrary object', b.b);
-  assertNotUndefined('Globalize to arbitrary object', b.c);
-}
-
-function testExportSymbol() {
-  var date = new Date();
-
-  // alias to avoid the being picked up by the deps scanner.
-  var provide = goog.provide;
-
-  assertTrue(typeof nodots == 'undefined');
-  goog.exportSymbol('nodots', date);
-  assertEquals(date, nodots);
-  nodots = undefined;
-
-  assertTrue(typeof gotcher == 'undefined');
-  goog.exportSymbol('gotcher.dots.right.Here', date);
-  assertEquals(date, gotcher.dots.right.Here);
-  gotcher = undefined;
-
-  provide('an.existing.path');
-  assertNotNull(an.existing.path);
-  goog.exportSymbol('an.existing.path', date);
-  assertEquals(date, an.existing.path);
-  an = undefined;
-
-  var foo = {foo: 'foo'};
-  var bar = {bar: 'bar'};
-  var baz = {baz: 'baz'};
-  goog.exportSymbol('one.two.three.Four', foo);
-  goog.exportSymbol('one.two.three.five', bar);
-  goog.exportSymbol('one.two.six', baz);
-  assertEquals(foo, one.two.three.Four);
-  assertEquals(bar, one.two.three.five);
-  assertEquals(baz, one.two.six);
-
-  var win = {};
-  var fooBar = {foo: 'foo', bar: 'bar'};
-  goog.exportSymbol('one.two.four', fooBar, win);
-  assertEquals(fooBar, win.one.two.four);
-  assertTrue('four' in win.one.two);
-  assertFalse('four' in one.two);
-  one = undefined;
-}
-
-goog.exportSymbol('exceptionTest', function() {
-  throw Error('ERROR');
-});
-
-function testExportSymbolExceptions() {
-  var inner = function() {
-    // If exceptionTest wasn't exported using execScript, IE8 will throw "Object
-    // doesn't support this property or method" instead.
-    exceptionTest();
-  };
-  var e = assertThrows('Exception wasn\'t thrown by exported function', inner);
-  assertEquals('Unexpected error thrown', 'ERROR', e.message);
-}
-
-//=== tests for Require logic ===
-
-function testRequireClosure() {
-  assertNotUndefined('goog.Timer should be available', goog.Timer);
-  /** @suppress {missingRequire} */
-  assertNotUndefined(
-      'goog.events.EventTarget should be available', goog.events.EventTarget);
-}
-
-function testRequireWithExternalDuplicate() {
-  // alias to avoid the being picked up by the deps scanner.
-  var provide = goog.provide;
-
-  // Do a provide without going via goog.require. Then goog.require it
-  // indirectly and ensure it doesn't cause a duplicate script.
-  goog.addDependency('dup.js', ['dup.base'], []);
-  goog.addDependency('dup-child.js', ['dup.base.child'], ['dup.base']);
-  provide('dup.base');
-
-  stubs.set(goog, 'isDocumentFinishedLoading_', false);
-  stubs.set(goog.global, 'CLOSURE_IMPORT_SCRIPT', function(src) {
-    if (src == goog.basePath + 'dup.js') {
-      fail('Duplicate script written!');
-    } else if (src == goog.basePath + 'dup-child.js') {
-      // Allow expected script.
-      return true;
-    } else {
-      // Avoid affecting other state.
-      return false;
-    }
-  });
-
-  // To differentiate this call from the real one.
-  var require = goog.require;
-  require('dup.base.child');
-}
-
-//=== tests for language enhancements ===
-
-function testTypeOf() {
-  assertEquals('array', goog.typeOf([]));
-  assertEquals('string', goog.typeOf('string'));
-  assertEquals('number', goog.typeOf(123));
-  assertEquals('null', goog.typeOf(null));
-  assertEquals('undefined', goog.typeOf(undefined));
-  assertEquals('object', goog.typeOf({}));
-  assertEquals('function', goog.typeOf(function() {}));
-
-  // Make sure that NodeList is not treated as an array... NodeLists should
-  // be of type object but Safari incorrectly reports it as function so a not
-  // equals test will have to suffice here.
-  assertNotEquals('array', goog.typeOf(document.getElementsByName('*')));
-  assertNotEquals('function', goog.typeOf(document.getElementsByName('*')));
-  assertEquals('object', goog.typeOf(document.getElementsByName('*')));
-}
-
-function testTypeOfFramed() {
-  assertEquals('array', goog.typeOf(framedVars.array));
-  assertEquals('string', goog.typeOf(framedVars.string));
-  assertEquals('number', goog.typeOf(framedVars.number));
-  assertEquals('null', goog.typeOf(framedVars.nullVar));
-  assertEquals('undefined', goog.typeOf(framedVars.undefinedVar));
-  assertEquals('object', goog.typeOf(framedVars.object));
-  assertEquals('function', goog.typeOf(framedVars.functionVar));
-
-  // Opera throws when trying to do cross frame typeof on node lists.
-  // IE behaves very strange when it comes to DOM nodes on disconnected frames.
-}
-
-function testTypeOfFramed2() {
-  assertEquals('array', goog.typeOf(framedVars2.array));
-  assertEquals('string', goog.typeOf(framedVars2.string));
-  assertEquals('number', goog.typeOf(framedVars2.number));
-  assertEquals('null', goog.typeOf(framedVars2.nullVar));
-  assertEquals('undefined', goog.typeOf(framedVars2.undefinedVar));
-  assertEquals('object', goog.typeOf(framedVars2.object));
-  assertEquals('function', goog.typeOf(framedVars2.functionVar));
-
-  // Opera throws when trying to do cross frame typeof on node lists.
-  // IE behaves very strange when it comes to DOM nodes on disconnected frames.
-}
-
-function testIsDef() {
-  var defined = 'foo';
-  var nullVar = null;
-  var notDefined;
-
-  assertTrue('defined should be defined', goog.isDef(defined));
-  assertTrue('null should be defined', goog.isDef(nullVar));
-  assertFalse('undefined should not be defined', goog.isDef(notDefined));
-}
-
-function testIsDefAndNotNull() {
-  assertTrue('string is defined and non-null', goog.isDefAndNotNull(''));
-  assertTrue('object is defined and non-null', goog.isDefAndNotNull({}));
-  assertTrue(
-      'function is defined and non-null',
-      goog.isDefAndNotNull(goog.nullFunction));
-  assertTrue('zero is defined and non-null', goog.isDefAndNotNull(0));
-  assertFalse('null', goog.isDefAndNotNull(null));
-  assertFalse('undefined', goog.isDefAndNotNull(undefined));
-}
-
-function testIsNull() {
-  var notNull = 'foo';
-  var nullVar = null;
-  var notDefined;
-
-  assertFalse('defined should not be null', goog.isNull(notNull));
-  assertTrue('null should be null', goog.isNull(nullVar));
-  assertFalse('undefined should not be null', goog.isNull(notDefined));
-}
-
-function testIsArray() {
-  var array = [1, 2, 3];
-  var arrayWithLengthSet = [1, 2, 3];
-  arrayWithLengthSet.length = 2;
-  var objWithArrayFunctions = {slice: function() {}, length: 0};
-  var object = {a: 1, b: 2, c: 3};
-  var nullVar = null;
-  var notDefined;
-  var elem = document.getElementById('elem');
-  var text = document.getElementById('text').firstChild;
-  var impostor = document.body.getElementsByTagName('BOGUS');
-  impostor.push = Array.prototype.push;
-  impostor.pop = Array.prototype.pop;
-  impostor.slice = Array.prototype.slice;
-  impostor.splice = Array.prototype.splice;
-
-  assertTrue('array should be an array', goog.isArray(array));
-  assertTrue(
-      'arrayWithLengthSet should be an array',
-      goog.isArray(arrayWithLengthSet));
-  assertFalse(
-      'object with array functions should not be an array unless ' +
-          'length is not enumerable',
-      goog.isArray(objWithArrayFunctions));
-  assertFalse('object should not be an array', goog.isArray(object));
-  assertFalse('null should not be an array', goog.isArray(nullVar));
-  assertFalse('undefined should not be an array', goog.isArray(notDefined));
-  assertFalse('NodeList should not be an array', goog.isArray(elem.childNodes));
-  assertFalse('TextNode should not be an array', goog.isArray(text));
-  assertTrue(
-      'Array of nodes should be an array',
-      goog.isArray([elem.firstChild, elem.lastChild]));
-  assertFalse('An impostor should not be an array', goog.isArray(impostor));
-}
-
-function testTypeOfAcrossWindow() {
-  if (goog.userAgent.IE && goog.userAgent.isVersionOrHigher('10') &&
-      !goog.userAgent.isVersionOrHigher('11')) {
-    // TODO(johnlenz): This test is flaky on IE10 (passing 90+% of the time).
-    // When it flakes the values are undefined which appears to indicate the
-    // script did not run in the opened window and not a failure of the logic
-    // we are trying to test.
-    return;
-  }
-
-  var w = window.open('', 'blank');
-  if (w) {
-    try {
-      var d = w.document;
-      d.open();
-      d.write(
-          '<script>function fun(){};' +
-          'var arr = [];' +
-          'var x = 42;' +
-          'var s = "";' +
-          'var b = true;' +
-          'var obj = {length: 0, splice: {}, call: {}};' +
-          '</' +
-          'script>');
-      d.close();
-
-      assertEquals('function', goog.typeOf(w.fun));
-      assertEquals('array', goog.typeOf(w.arr));
-      assertEquals('number', goog.typeOf(w.x));
-      assertEquals('string', goog.typeOf(w.s));
-      assertEquals('boolean', goog.typeOf(w.b));
-      assertEquals('object', goog.typeOf(w.obj));
-    } finally {
-      w.close();
-    }
-  }
-}
-
-function testIsArrayLike() {
-  var array = [1, 2, 3];
-  var objectWithNumericLength = {length: 2};
-  var objectWithNonNumericLength = {length: 'a'};
-  var object = {a: 1, b: 2};
-  var nullVar = null;
-  var notDefined;
-  var elem = document.getElementById('elem');
-  var text = document.getElementById('text').firstChild;
-
-  assertTrue('array should be array-like', goog.isArrayLike(array));
-  assertTrue(
-      'obj w/numeric length should be array-like',
-      goog.isArrayLike(objectWithNumericLength));
-  assertFalse(
-      'obj w/non-numeric length should not be array-like',
-      goog.isArrayLike(objectWithNonNumericLength));
-  assertFalse('object should not be array-like', goog.isArrayLike(object));
-  assertFalse('null should not be array-like', goog.isArrayLike(nullVar));
-  assertFalse(
-      'undefined should not be array-like', goog.isArrayLike(notDefined));
-  assertTrue(
-      'NodeList should be array-like', goog.isArrayLike(elem.childNodes));
-  // TODO(attila): Fix isArrayLike to return false for text nodes!
-  // assertFalse('TextNode should not be array-like', goog.isArrayLike(text));
-  assertTrue(
-      'Array of nodes should be array-like',
-      goog.isArrayLike([elem.firstChild, elem.lastChild]));
-}
-
-
-/**
- * Use mock date in testIsDateLike() rather than a real goog.date.Date to
- * minimize dependencies in this unit test.
- */
-function MockGoogDate() {}
-
-/** @return {number} */
-MockGoogDate.prototype.getFullYear = function() {
-  return 2007;
-};
-
-
-function testIsDateLike() {
-  var jsDate = new Date();
-  var googDate = new MockGoogDate();
-  var string = 'foo';
-  var number = 1;
-  var nullVar = null;
-  var notDefined;
-
-  assertTrue('js Date should be date-like', goog.isDateLike(jsDate));
-  assertTrue('goog Date should be date-like', goog.isDateLike(googDate));
-  assertFalse('string should not be date-like', goog.isDateLike(string));
-  assertFalse('number should not be date-like', goog.isDateLike(number));
-  assertFalse('nullVar should not be date-like', goog.isDateLike(nullVar));
-  assertFalse('undefined should not be date-like', goog.isDateLike(notDefined));
-}
-
-function testIsString() {
-  var string = 'foo';
-  var number = 2;
-  var nullVar = null;
-  var notDefined;
-
-  assertTrue('string should be a string', goog.isString(string));
-  assertFalse('number should not be a string', goog.isString(number));
-  assertFalse('null should not be a string', goog.isString(nullVar));
-  assertFalse('undefined should not be a string', goog.isString(notDefined));
-}
-
-function testIsBoolean() {
-  var b = true;
-  var s = 'true';
-  var num = 1;
-  var nullVar = null;
-  var notDefined;
-
-  assertTrue('boolean should be a boolean', goog.isBoolean(b));
-  assertFalse('string should not be a boolean', goog.isBoolean(s));
-  assertFalse('number should not be a boolean', goog.isBoolean(num));
-  assertFalse('null should not be a boolean', goog.isBoolean(nullVar));
-  assertFalse('undefined should not be a boolean', goog.isBoolean(notDefined));
-}
-
-function testIsNumber() {
-  var number = 1;
-  var string = '1';
-  var nullVar = null;
-  var notDefined;
-
-  assertTrue('number should be a number', goog.isNumber(number));
-  assertFalse('string should not be a number', goog.isNumber(string));
-  assertFalse('null should not be a number', goog.isNumber(nullVar));
-  assertFalse('undefined should not be a number', goog.isNumber(notDefined));
-}
-
-function testIsFunction() {
-  var func = function() {
-    return 1;
-  };
-  var object = {a: 1, b: 2};
-  var nullVar = null;
-  var notDefined;
-
-  assertTrue('function should be a function', goog.isFunction(func));
-  assertFalse('object should not be a function', goog.isFunction(object));
-  assertFalse('null should not be a function', goog.isFunction(nullVar));
-  assertFalse(
-      'undefined should not be a function', goog.isFunction(notDefined));
-}
-
-function testIsObject() {
-  var object = {a: 1, b: 2};
-  var string = 'b';
-  var nullVar = null;
-  var notDefined;
-  var array = [0, 1, 2];
-  var fun = function() {};
-
-  assertTrue('object should be an object', goog.isObject(object));
-  assertTrue('array should be an object', goog.isObject(array));
-  assertTrue('function should be an object', goog.isObject(fun));
-  assertFalse('string should not be an object', goog.isObject(string));
-  assertFalse('null should not be an object', goog.isObject(nullVar));
-  assertFalse('undefined should not be an object', goog.isObject(notDefined));
-}
-
-
-//=== tests for unique ID methods ===
-
-function testGetUid() {
-  var a = {};
-  var b = {};
-  var c = {};
-
-  var uid1 = goog.getUid(a);
-  var uid2 = goog.getUid(b);
-  var uid3 = goog.getUid(c);
-
-  assertNotEquals('Unique IDs must be unique', uid1, uid2);
-  assertNotEquals('Unique IDs must be unique', uid1, uid3);
-  assertNotEquals('Unique IDs must be unique', uid2, uid3);
-}
-
-function testHasUid() {
-  var a = {};
-
-  assertFalse(goog.hasUid(a));
-  assertFalse(goog.UID_PROPERTY_ in a);
-
-  var uid = goog.getUid(a);
-  assertTrue(goog.hasUid(a));
-  assertEquals(uid, goog.getUid(a));
-}
-
-function testRemoveUidFromPlainObject() {
-  var a = {};
-  var uid = goog.getUid(a);
-  goog.removeUid(a);
-  assertNotEquals(
-      'An object\'s old and new unique IDs should be different', uid,
-      goog.getUid(a));
-}
-
-function testRemoveUidFromObjectWithoutUid() {
-  var a = {};
-  // Removing a unique ID should not fail even if it did not exist
-  goog.removeUid(a);
-}
-
-function testRemoveUidFromNode() {
-  var node = goog.dom.createElement(goog.dom.TagName.DIV);
-  var nodeUid = goog.getUid(node);
-  goog.removeUid(node);
-  assertNotEquals(
-      'A node\'s old and new unique IDs should be different', nodeUid,
-      goog.getUid(node));
-}
-
-function testConstructorUid() {
-  function BaseClass() {}
-  function SubClass() {}
-  goog.inherits(SubClass, BaseClass);
-
-  var baseClassUid = goog.getUid(BaseClass);
-  var subClassUid = goog.getUid(SubClass);
-
-  assertTrue(
-      'Unique ID of BaseClass must be a number',
-      typeof baseClassUid == 'number');
-  assertTrue(
-      'Unique ID of SubClass must be a number', typeof subClassUid == 'number');
-  assertNotEquals(
-      'Unique IDs of BaseClass and SubClass must differ', baseClassUid,
-      subClassUid);
-  assertNotEquals(
-      'Unique IDs of BaseClass and SubClass instances must differ',
-      goog.getUid(new BaseClass), goog.getUid(new SubClass));
-
-  assertEquals(
-      'Unique IDs of BaseClass.prototype and SubClass.prototype ' +
-          'should differ, but to keep the implementation simple, we do not ' +
-          'handle this edge case.',
-      goog.getUid(BaseClass.prototype), goog.getUid(SubClass.prototype));
-}
-
-
-/**
- * Tests against Chrome bug where the re-created element will have the uid
- * property set but undefined. See bug 1252508.
- */
-function testUidNotUndefinedOnReusedElement() {
-  var div = goog.dom.createElement(goog.dom.TagName.DIV);
-  document.body.appendChild(div);
-  div.innerHTML = '<form id="form"></form>';
-  var span = goog.dom.getElementsByTagName(goog.dom.TagName.FORM, div)[0];
-  goog.getUid(span);
-
-  div.innerHTML = '<form id="form"></form>';
-  var span2 = goog.dom.getElementsByTagName(goog.dom.TagName.FORM, div)[0];
-  assertNotUndefined(goog.getUid(span2));
-}
-
-function testWindowUid() {
-  var uid = goog.getUid(window);
-  assertTrue('window unique id is a number', goog.isNumber(uid));
-  assertEquals('returns the same id second time', uid, goog.getUid(window));
-  goog.removeUid(window);
-  assertNotEquals(
-      'generates new id after the old one is removed', goog.getUid(window));
-}
-
-//=== tests for clone method ===
-
-function testClonePrimitive() {
-  assertEquals(
-      'cloning a primitive should return an equal primitive', 5,
-      goog.cloneObject(5));
-}
-
-function testCloneObjectThatHasACloneMethod() {
-  var original = {
-    name: 'original',
-    clone: function() {
-      return {name: 'clone'};
-    }
-  };
-
-  var clone = goog.cloneObject(original);
-  assertEquals('original', original.name);
-  assertEquals('clone', clone.name);
-}
-
-function testCloneFlatObject() {
-  var original = {a: 1, b: 2, c: 3};
-  var clone = goog.cloneObject(original);
-  assertNotEquals(original, clone);
-  assertEquals(1, clone.a);
-  assertEquals(2, clone.b);
-  assertEquals(3, clone.c);
-}
-
-function testCloneDeepObject() {
-  var original = {a: 1, b: {c: 2, d: 3}, e: {f: {g: 4, h: 5}}};
-  var clone = goog.cloneObject(original);
-
-  assertNotEquals(original, clone);
-  assertNotEquals(original.b, clone.b);
-  assertNotEquals(original.e, clone.e);
-
-  assertEquals(1, clone.a);
-  assertEquals(2, clone.b.c);
-  assertEquals(3, clone.b.d);
-  assertEquals(4, clone.e.f.g);
-  assertEquals(5, clone.e.f.h);
-}
-
-function testCloneFunctions() {
-  var original = {
-    f: function() {
-      return 'hi';
-    }
-  };
-  var clone = goog.cloneObject(original);
-
-  assertNotEquals(original, clone);
-  assertEquals('hi', clone.f());
-  assertEquals(original.f, clone.f);
-}
-
-
-//=== tests for bind() and friends ===
-
-// Function.prototype.bind and Function.prototype.partial are purposefullly
-// not defined in open sourced Closure.  These functions sniff for their
-// presence.
-
-var foo = 'global';
-var obj = {foo: 'obj'};
-
-/**
- * @param {?} arg1
- * @param {?} arg2
- * @return {?}
- */
-function getFoo(arg1, arg2) {
-  return {foo: this.foo, arg1: arg1, arg2: arg2};
-}
-
-function testBindWithoutObj() {
-  if (Function.prototype.bind) {
-    assertEquals(foo, getFoo.bind()().foo);
-  }
-}
-
-function testBindWithObj() {
-  if (Function.prototype.bind) {
-    assertEquals(obj.foo, getFoo.bind(obj)().foo);
-  }
-}
-
-function testBindWithNullObj() {
-  if (Function.prototype.bind) {
-    assertEquals(foo, getFoo.bind()().foo);
-  }
-}
-
-function testBindStaticArgs() {
-  if (Function.prototype.bind) {
-    var fooprime = getFoo.bind(obj, 'hot', 'dog');
-    var res = fooprime();
-    assertEquals(obj.foo, res.foo);
-    assertEquals('hot', res.arg1);
-    assertEquals('dog', res.arg2);
-  }
-}
-
-function testBindDynArgs() {
-  if (Function.prototype.bind) {
-    var res = getFoo.bind(obj)('hot', 'dog');
-    assertEquals(obj.foo, res.foo);
-    assertEquals('hot', res.arg1);
-    assertEquals('dog', res.arg2);
-  }
-}
-
-function testBindCurriedArgs() {
-  if (Function.prototype.bind) {
-    var res = getFoo.bind(obj, 'hot')('dog');
-    assertEquals(obj.foo, res.foo);
-    assertEquals('hot', res.arg1);
-    assertEquals('dog', res.arg2);
-  }
-}
-
-function testBindDoubleBind() {
-  var getFooP = goog.bind(getFoo, obj, 'hot');
-  var getFooP2 = goog.bind(getFooP, null, 'dog');
-
-  var res = getFooP2();
-  assertEquals('res.arg1 should be \'hot\'', 'hot', res.arg1);
-  assertEquals('res.arg2 should be \'dog\'', 'dog', res.arg2);
-}
-
-function testBindWithCall() {
-  var obj = {};
-  var obj2 = {};
-  var f = function() {
-    assertEquals('this should be bound to obj', obj, this);
-  };
-  var b = goog.bind(f, obj);
-  b.call(null);
-  b.call(obj2);
-}
-
-function testBindJs() {
-  assertEquals(1, goog.bindJs_(add, {
-    valueOf: function() {
-      return 1;
-    }
-  })());
-  assertEquals(3, goog.bindJs_(add, null, 1, 2)());
-}
-
-function testBindNative() {
-  if (Function.prototype.bind &&
-      Function.prototype.bind.toString().indexOf('native code') != -1) {
-    assertEquals(1, goog.bindNative_(add, {
-      valueOf: function() {
-        return 1;
-      }
-    })());
-    assertEquals(3, goog.bindNative_(add, null, 1, 2)());
-
-    assertThrows(function() {
-      goog.bindNative_(null, null);
-    });
-  }
-}
-
-function testBindDefault() {
-  assertEquals(1, goog.bind(add, {
-    valueOf: function() {
-      return 1;
-    }
-  })());
-  assertEquals(3, goog.bind(add, null, 1, 2)());
-}
-
-/**
- * @param {...?} var_args
- * @return {?}
- */
-function add(var_args) {
-  var sum = Number(this) || 0;
-  for (var i = 0; i < arguments.length; i++) {
-    sum += arguments[i];
-  }
-  return sum;
-}
-
-function testPartial() {
-  var f = function(x, y) {
-    return x + y;
-  };
-  var g = goog.partial(f, 1);
-  assertEquals(3, g(2));
-
-  var h = goog.partial(f, 1, 2);
-  assertEquals(3, h());
-
-  var i = goog.partial(f);
-  assertEquals(3, i(1, 2));
-}
-
-function testPartialUsesGlobal() {
-  var f = function(x, y) {
-    assertEquals(goog.global, this);
-    return x + y;
-  };
-  var g = goog.partial(f, 1);
-  var h = goog.partial(g, 2);
-  assertEquals(3, h());
-}
-
-function testPartialWithCall() {
-  var obj = {};
-  var f = function(x, y) {
-    assertEquals(obj, this);
-    return x + y;
-  };
-  var g = goog.partial(f, 1);
-  var h = goog.partial(g, 2);
-  assertEquals(3, h.call(obj));
-}
-
-function testPartialAndBind() {
-  // This ensures that this "survives" through a partial.
-  var p = goog.partial(getFoo, 'hot');
-  var b = goog.bind(p, obj, 'dog');
-
-  var res = b();
-  assertEquals(obj.foo, res.foo);
-  assertEquals('hot', res.arg1);
-  assertEquals('dog', res.arg2);
-}
-
-function testBindAndPartial() {
-  // This ensures that this "survives" through a partial.
-  var b = goog.bind(getFoo, obj, 'hot');
-  var p = goog.partial(b, 'dog');
-
-  var res = p();
-  assertEquals(obj.foo, res.foo);
-  assertEquals('hot', res.arg1);
-  assertEquals('dog', res.arg2);
-}
-
-function testPartialMultipleCalls() {
-  var f = goog.testing.recordFunction();
-
-  var a = goog.partial(f, 'foo');
-  var b = goog.partial(a, 'bar');
-
-  a();
-  a();
-  b();
-  b();
-
-  assertEquals(4, f.getCallCount());
-
-  var calls = f.getCalls();
-  assertArrayEquals(['foo'], calls[0].getArguments());
-  assertArrayEquals(['foo'], calls[1].getArguments());
-  assertArrayEquals(['foo', 'bar'], calls[2].getArguments());
-  assertArrayEquals(['foo', 'bar'], calls[3].getArguments());
-}
-
-function testGlobalEval() {
-  goog.globalEval('var foofoofoo = 125;');
-  assertEquals('Var should be globally assigned', 125, goog.global.foofoofoo);
-  var foofoofoo = 128;
-  assertEquals('Global should not have changed', 125, goog.global.foofoofoo);
-
-  // NOTE(user): foofoofoo would normally be available in the function scope,
-  // via the scope chain, but the JsUnit framework seems to do something weird
-  // which makes it not work.
-}
-
-function testGlobalEvalWithHtml() {
-  // Make sure we don't trip on HTML markup in the code
-  goog.global.evalTestResult = 'failed';
-  goog.global.evalTest = function(arg) {
-    goog.global.evalTestResult = arg;
-  };
-
-  goog.globalEval('evalTest("<test>")');
-
-  assertEquals(
-      'Should be able to evaluate strings with HTML in', '<test>',
-      goog.global.evalTestResult);
-}
-
-
-//=== tests for inherits ===
-
-function testInherits() {
-  function Foo() {}
-  function Bar() {}
-  goog.inherits(Bar, Foo);
-  var bar = new Bar();
-
-  assert('object should be instance of constructor', bar instanceof Bar);
-  assert('object should be instance of base constructor', bar instanceof Foo);
-}
-
-function testInherits_constructor() {
-  function Foo() {}
-  function Bar() {}
-  goog.inherits(Bar, Foo);
-  var bar = new Bar();
-
-  assertEquals(
-      'constructor property should match constructor function', Bar,
-      bar.constructor);
-  assertEquals(
-      'Superclass constructor should match constructor function', Foo,
-      Bar.superClass_.constructor);
-}
-
-
-//=== tests for makeSingleton ===
-function testMakeSingleton() {
-  function Foo() {}
-  goog.addSingletonGetter(Foo);
-
-  assertNotNull('Should add get instance function', Foo.getInstance);
-
-  var x = Foo.getInstance();
-  assertNotNull('Should successfully create an object', x);
-
-  var y = Foo.getInstance();
-  assertEquals('Should return the same object', x, y);
-
-  delete Foo.instance_;
-
-  var z = Foo.getInstance();
-  assertNotNull('Should work after clearing for testing', z);
-
-  assertNotEquals(
-      'Should return a different object after clearing for testing', x, z);
-}
-
-
-//=== tests for now ===
-
-function testNow() {
-  var toleranceMilliseconds = 20;  // 10 ms was not enough for IE7.
-  var now1 = new Date().getTime();
-  var now2 = goog.now();
-  assertTrue(Math.abs(now1 - now2) < toleranceMilliseconds);
-}
-
-
-//=== test non-html context ===
-
-function testInHtmlDocument() {
-  var savedGoogGlobal = goog.global;
-  try {
-    goog.global = {};
-    assertFalse(goog.inHtmlDocument_());
-    goog.global.document = {};
-    assertFalse(goog.inHtmlDocument_());
-    goog.global.document.write = function() {};
-    assertTrue(goog.inHtmlDocument_());
-  } finally {
-    // Restore context to respect other tests.
-    goog.global = savedGoogGlobal;
-  }
-}
-
-function testLoadInNonHtmlNotThrows() {
-  var savedGoogGlobal = goog.global;
-  try {
-    goog.global = {};
-    goog.global.document = {};
-    assertFalse(goog.inHtmlDocument_());
-    // The goog code which is executed at load.
-    goog.findBasePath_();
-    goog.writeScriptTag_(goog.basePath + 'deps.js');
-  } finally {
-    // Restore context to respect other tests.
-    goog.global = savedGoogGlobal;
-  }
-}
-
-function testLoadBaseWithQueryParamOk() {
-  var savedGoogGlobal = goog.global;
-  try {
-    goog.global = {};
-    goog.global.document = {
-      write: goog.nullFunction,
-      getElementsByTagName:
-          goog.functions.constant([{src: '/path/to/base.js?zx=5'}])
-    };
-    assertTrue(goog.inHtmlDocument_());
-    goog.findBasePath_();
-    assertEquals('/path/to/', goog.basePath);
-  } finally {
-    // Restore context to respect other tests.
-    goog.global = savedGoogGlobal;
-  }
-}
-
-function testLoadBaseFromGlobalVariableOk() {
-  var savedGoogGlobal = goog.global;
-  try {
-    goog.global = {};
-    goog.global.document = {
-      write: goog.nullFunction,
-      getElementsByTagName:
-          goog.functions.constant([{src: '/path/to/base.js?zx=5'}])
-    };
-    goog.global.CLOSURE_BASE_PATH = '/from/constant/';
-    goog.findBasePath_();
-    assertEquals(goog.global.CLOSURE_BASE_PATH, goog.basePath);
-  } finally {
-    // Restore context to respect other tests.
-    goog.global = savedGoogGlobal;
-  }
-}
-
-function testLoadBaseFromGlobalVariableDOMClobbered() {
-  var savedGoogGlobal = goog.global;
-  try {
-    goog.global = {};
-    goog.global.document = {
-      write: goog.nullFunction,
-      getElementsByTagName:
-          goog.functions.constant([{src: '/path/to/base.js?zx=5'}])
-    };
-    // Make goog.global.CLOSURE_BASE_PATH an object with a toString, like
-    // it would be if it were a DOM clobbered HTMLElement.
-    goog.global.CLOSURE_BASE_PATH = {};
-    goog.global.CLOSURE_BASE_PATH.toString = function() {
-      return '/from/constant/';
-    };
-    goog.findBasePath_();
-    assertEquals('/path/to/', goog.basePath);
-  } finally {
-    // Restore context to respect other tests.
-    goog.global = savedGoogGlobal;
-  }
-}
-
-function testLoadBaseFromCurrentScriptIgnoringOthers() {
-  var savedGoogGlobal = goog.global;
-  try {
-    goog.global = {};
-    goog.global.document = {
-      write: goog.nullFunction,
-      currentScript: {src: '/currentScript/base.js?zx=5'},
-      getElementsByTagName:
-          goog.functions.constant([{src: '/path/to/base.js?zx=5'}])
-    };
-    goog.findBasePath_();
-    assertEquals('/currentScript/', goog.basePath);
-  } finally {
-    // Restore context to respect other tests.
-    goog.global = savedGoogGlobal;
-  }
-}
-
-//=== tests for getmsg ===
-function testGetMsgWithDollarSigns() {
-  var msg = goog.getMsg('{$amount} per minute', {amount: '$0.15'});
-  assertEquals('$0.15 per minute', msg);
-  msg = goog.getMsg('{$amount} per minute', {amount: '$0.$1$5'});
-  assertEquals('$0.$1$5 per minute', msg);
-
-  msg = goog.getMsg('This is a {$rate} sale!', {rate: '$$$$$$$$$$10'});
-  assertEquals('This is a $$$$$$$$$$10 sale!', msg);
-  msg = goog.getMsg(
-      '{$name}! Hamburgers: {$hCost}, Hotdogs: {$dCost}.',
-      {name: 'Burger Bob', hCost: '$0.50', dCost: '$100'});
-  assertEquals('Burger Bob! Hamburgers: $0.50, Hotdogs: $100.', msg);
-}
-
-
-function testGetMsgWithPlaceholders() {
-  var msg = goog.getMsg('{$a} has {$b}', {a: '{$b}', b: 1});
-  assertEquals('{$b} has 1', msg);
-
-  msg = goog.getMsg('{$a}{$b}', {b: ''});
-  assertEquals('{$a}', msg);
-}
-
-
-//=== miscellaneous tests ===
-
-function testGetObjectByName() {
-  var m = {
-    'undefined': undefined,
-    'null': null,
-    emptyString: '',
-    'false': false,
-    'true': true,
-    zero: 0,
-    one: 1,
-    two: {three: 3, four: {five: 5}},
-    'six|seven': '6|7',
-    'eight.nine': 8.9
-  };
-  goog.global.m = m;
-
-  assertNull(goog.getObjectByName('m.undefined'));
-  assertNull(goog.getObjectByName('m.null'));
-  assertEquals(goog.getObjectByName('m.emptyString'), '');
-  assertEquals(goog.getObjectByName('m.false'), false);
-  assertEquals(goog.getObjectByName('m.true'), true);
-  assertEquals(goog.getObjectByName('m.zero'), 0);
-  assertEquals(goog.getObjectByName('m.one'), 1);
-  assertEquals(goog.getObjectByName('m.two.three'), 3);
-  assertEquals(goog.getObjectByName('m.two.four.five'), 5);
-  assertEquals(goog.getObjectByName('m.six|seven'), '6|7');
-  assertNull(goog.getObjectByName('m.eight.nine'));
-  assertNull(goog.getObjectByName('m.notThere'));
-
-  assertEquals(goog.getObjectByName('one', m), 1);
-  assertEquals(goog.getObjectByName('two.three', m), 3);
-  assertEquals(goog.getObjectByName('two.four.five', m), 5);
-  assertEquals(goog.getObjectByName('six|seven', m), '6|7');
-  assertNull(goog.getObjectByName('eight.nine', m));
-  assertNull(goog.getObjectByName('notThere', m));
-}
-
-
-function testGetCssName() {
-  assertEquals('classname', goog.getCssName('classname'));
-  assertEquals('random-classname', goog.getCssName('random-classname'));
-  assertEquals('control-modifier', goog.getCssName('control', 'modifier'));
-
-  goog.setCssNameMapping({'goog': 'a', 'disabled': 'b'}, 'BY_PART');
-  var g = goog.getCssName('goog');
-  assertEquals('a', g);
-  assertEquals('a-b', goog.getCssName(g, 'disabled'));
-  assertEquals('a-b', goog.getCssName('goog-disabled'));
-  assertEquals('a-button', goog.getCssName('goog-button'));
-
-  goog.setCssNameMapping({'goog-button': 'a', 'active': 'b'}, 'BY_WHOLE');
-
-  g = goog.getCssName('goog-button');
-  assertEquals('a', g);
-  assertEquals('a-b', goog.getCssName(g, 'active'));
-  assertEquals('goog-disabled', goog.getCssName('goog-disabled'));
-
-  e = assertThrows(function() {
-    goog.getCssName('.name');
-  });
-  assertEquals(
-      'className passed in goog.getCssName must not start with ".".' +
-          ' You passed: .name',
-      e.message);
-
-  assertNull(goog.getCssName(null));
-}
-
-function testGetCssName_nameMapFn() {
-  assertEquals('classname', goog.getCssName('classname'));
-
-  goog.global.CLOSURE_CSS_NAME_MAP_FN = function(classname) {
-    return classname + '!';
-  };
-
-  assertEquals('classname!', goog.getCssName('classname'));
-}
-
-function testAddDependency() {
-  stubs.set(goog, 'writeScriptTag_', goog.nullFunction);
-
-  goog.addDependency('foo.js', ['testDep.foo'], ['testDep.bar']);
-
-  // alias to avoid the being picked up by the deps scanner.
-  var provide = goog.provide;
-
-  provide('testDep.bar');
-
-  // To differentiate this call from the real one.
-  var require = goog.require;
-
-  // this used to throw an exception
-  require('testDep.foo');
-
-  assertTrue(goog.isObject(testDep.bar));
-
-  // Unset provided namespace so the test can be re-run.
-  testDep = undefined;
-}
-
-function testAddDependencyModule() {
-  var load = goog.testing.recordFunction();
-  stubs.set(goog, 'writeScriptTag_', load);
-
-  goog.addDependency('mod.js', ['testDep.mod'], [], true);
-  goog.addDependency('empty.js', ['testDep.empty'], [], {});
-  goog.addDependency('mod-goog.js', ['testDep.goog'], [], {'module': 'goog'});
-
-  // To differentiate this call from the real one.
-  var require = goog.require;
-
-  var assertModuleLoad = function(module, args) {
-    assertEquals(2, args.length);
-    assertEquals('', args[0]);
-    assertRegExp(
-        '^goog\\.retrieveAndExec_\\(".*/' + module + '", true, false\\);$',
-        args[1]);
-  };
-
-  require('testDep.mod');
-  assertEquals(1, load.getCallCount());
-  assertModuleLoad('mod.js', load.getCalls()[0].getArguments());
-
-  require('testDep.empty');
-  assertEquals(2, load.getCallCount());
-  assertEquals(2, load.getCalls()[1].getArguments().length);
-  assertRegExp('^.*/empty.js$', load.getCalls()[1].getArguments()[0]);
-  assertUndefined(load.getCalls()[1].getArguments()[1]);
-
-  require('testDep.goog');
-  assertEquals(3, load.getCallCount());
-  assertModuleLoad('mod-goog.js', load.getCalls()[2].getArguments());
-
-  // Unset provided namespace so the test can be re-run.
-  testDep = undefined;
-}
-
-function testAddDependencyEs6() {
-  var script = null;
-  var requireTranspilation = false;
-  stubs.set(goog, 'needsTranspile_', function() {
-    return requireTranspilation;
-  });
-  stubs.set(goog, 'writeScriptTag_', function(src, scriptText) {
-    if (script != null) {
-      throw new Error('Multiple scripts written');
-    }
-    script = scriptText;
-  });
-
-  goog.addDependency(
-      'fancy.js', ['testDep.fancy'], [],
-      {'lang': 'es6-impl', 'module': 'goog'});
-  goog.addDependency('super.js', ['testDep.superFancy'], [], {'lang': 'es6'});
-
-  // To differentiate this call from the real one.
-  var require = goog.require;
-
-  requireTranspilation = false;
-  require('testDep.fancy');
-  assertRegExp(
-      /^goog\.retrieveAndExec_\(".*\/fancy\.js", true, false\);$/, script);
-  script = null;
-
-  requireTranspilation = true;
-  require('testDep.superFancy');
-  assertRegExp(
-      /^goog\.retrieveAndExec_\(".*\/super\.js", false, true\);$/, script);
-
-  // Unset provided namespace so the test can be re-run.
-  testDep = undefined;
-}
-
-function testBaseMethod() {
-  function A() {}
-  A.prototype.foo = function(x, y) {
-    return x + y;
-  };
-
-  function B() {}
-  goog.inherits(B, A);
-  B.prototype.foo = function(x, y) {
-    return 2 + goog.base(this, 'foo', x, y);
-  };
-
-  function C() {}
-  goog.inherits(C, B);
-  C.prototype.foo = function(x, y) {
-    return 4 + goog.base(this, 'foo', x, y);
-  };
-
-  var d = new C();
-  d.foo = function(x, y) {
-    return 8 + goog.base(this, 'foo', x, y);
-  };
-
-  assertEquals(15, d.foo(1, 0));
-  assertEquals(16, d.foo(1, 1));
-  assertEquals(16, d.foo(2, 0));
-  assertEquals(7, (new C()).foo(1, 0));
-  assertEquals(3, (new B()).foo(1, 0));
-  assertThrows(function() {
-    goog.base(d, 'foo', 1, 0);
-  });
-
-  delete B.prototype.foo;
-  assertEquals(13, d.foo(1, 0));
-
-  delete C.prototype.foo;
-  assertEquals(9, d.foo(1, 0));
-}
-
-function testBaseMethodAndBaseCtor() {
-  // This will fail on FF4.0 if the following bug is not fixed:
-  // https://bugzilla.mozilla.org/show_bug.cgi?id=586482
-  function A(x, y) {
-    this.foo(x, y);
-  }
-  A.prototype.foo = function(x, y) {
-    this.bar = x + y;
-  };
-
-  function B(x, y) {
-    goog.base(this, x, y);
-  }
-  goog.inherits(B, A);
-  B.prototype.foo = function(x, y) {
-    goog.base(this, 'foo', x, y);
-    this.bar = this.bar * 2;
-  };
-
-  assertEquals(14, new B(3, 4).bar);
-}
-
-function testBaseClass() {
-  function A(x, y) {
-    this.foo = x + y;
-  }
-
-  function B(x, y) {
-    goog.base(this, x, y);
-    this.foo += 2;
-  }
-  goog.inherits(B, A);
-
-  function C(x, y) {
-    goog.base(this, x, y);
-    this.foo += 4;
-  }
-  goog.inherits(C, B);
-
-  function D(x, y) {
-    goog.base(this, x, y);
-    this.foo += 8;
-  }
-  goog.inherits(D, C);
-
-  assertEquals(15, (new D(1, 0)).foo);
-  assertEquals(16, (new D(1, 1)).foo);
-  assertEquals(16, (new D(2, 0)).foo);
-  assertEquals(7, (new C(1, 0)).foo);
-  assertEquals(3, (new B(1, 0)).foo);
-}
-
-function testClassBaseOnMethod() {
-  function A() {}
-  A.prototype.foo = function(x, y) {
-    return x + y;
-  };
-
-  function B() {}
-  goog.inherits(B, A);
-  B.prototype.foo = function(x, y) {
-    return 2 + B.base(this, 'foo', x, y);
-  };
-
-  function C() {}
-  goog.inherits(C, B);
-  C.prototype.foo = function(x, y) {
-    return 4 + C.base(this, 'foo', x, y);
-  };
-
-  var d = new C();
-  assertEquals(7, d.foo(1, 0));
-  assertEquals(8, d.foo(1, 1));
-  assertEquals(8, d.foo(2, 0));
-  assertEquals(3, (new B()).foo(1, 0));
-
-  delete B.prototype.foo;
-  assertEquals(5, d.foo(1, 0));
-
-  delete C.prototype.foo;
-  assertEquals(1, d.foo(1, 0));
-}
-
-function testClassBaseOnConstructor() {
-  function A(x, y) {
-    this.foo = x + y;
-  }
-
-  function B(x, y) {
-    B.base(this, 'constructor', x, y);
-    this.foo += 2;
-  }
-  goog.inherits(B, A);
-
-  function C(x, y) {
-    C.base(this, 'constructor', x, y);
-    this.foo += 4;
-  }
-  goog.inherits(C, B);
-
-  function D(x, y) {
-    D.base(this, 'constructor', x, y);
-    this.foo += 8;
-  }
-  goog.inherits(D, C);
-
-  assertEquals(15, (new D(1, 0)).foo);
-  assertEquals(16, (new D(1, 1)).foo);
-  assertEquals(16, (new D(2, 0)).foo);
-  assertEquals(7, (new C(1, 0)).foo);
-  assertEquals(3, (new B(1, 0)).foo);
-}
-
-function testClassBaseOnMethodAndBaseCtor() {
-  function A(x, y) {
-    this.foo(x, y);
-  }
-  A.prototype.foo = function(x, y) {
-    this.bar = x + y;
-  };
-
-  function B(x, y) {
-    B.base(this, 'constructor', x, y);
-  }
-  goog.inherits(B, A);
-  B.prototype.foo = function(x, y) {
-    B.base(this, 'foo', x, y);
-    this.bar = this.bar * 2;
-  };
-
-  assertEquals(14, new B(3, 4).bar);
-}
-
-function testGoogRequireCheck() {
-  // alias to avoid the being picked up by the deps scanner.
-  var provide = goog.provide;
-
-  stubs.set(goog, 'ENABLE_DEBUG_LOADER', true);
-  stubs.set(goog, 'useStrictRequires', true);
-  stubs.set(goog, 'implicitNamespaces_', {});
-
-  // Aliased so that build tools do not mistake this for an actual call.
-  var require = goog.require;
-  assertThrows('Requiring non-required namespace should fail', function() {
-    require('far.outnotprovided');
-  });
-
-  assertUndefined(goog.global.far);
-  assertEvaluatesToFalse(goog.getObjectByName('far.out'));
-  assertObjectEquals({}, goog.implicitNamespaces_);
-  assertFalse(goog.isProvided_('far.out'));
-
-  provide('far.out');
-
-  assertNotUndefined(far.out);
-  assertEvaluatesToTrue(goog.getObjectByName('far.out'));
-  assertObjectEquals({'far': true}, goog.implicitNamespaces_);
-  assertTrue(goog.isProvided_('far.out'));
-
-  goog.global.far.out = 42;
-  assertEquals(42, goog.getObjectByName('far.out'));
-  assertTrue(goog.isProvided_('far.out'));
-
-  // Empty string should be allowed.
-  goog.global.far.out = '';
-  assertEquals('', goog.getObjectByName('far.out'));
-  assertTrue(goog.isProvided_('far.out'));
-
-  // Null or undefined are not allowed.
-  goog.global.far.out = null;
-  assertNull(goog.getObjectByName('far.out'));
-  assertFalse(goog.isProvided_('far.out'));
-
-  goog.global.far.out = undefined;
-  assertNull(goog.getObjectByName('far.out'));
-  assertFalse(goog.isProvided_('far.out'));
-
-  stubs.reset();
-  delete far;
-}
-
-/**
- * @return {?}
- */
-function diables_testCspSafeGoogRequire() {
-  if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('10')) {
-    return;
-  }
-
-  stubs.set(goog, 'ENABLE_CHROME_APP_SAFE_SCRIPT_LOADING', true);
-
-  // Aliased so that build tools do not mistake this for an actual call.
-  var require = goog.require;
-
-  require('goog.Uri');
-
-  // Set a timeout to allow the user agent to finish parsing this script block,
-  // thus allowing the appended script (via goog.require) to execute.
-  var ASYNC_TIMEOUT_MS = 1000;
-
-  var resolver = goog.Promise.withResolver();
-  window.setTimeout(function() {
-    assertNotUndefined(goog.Uri);
-    resolver.resolve();
-    stubs.reset();
-  }, ASYNC_TIMEOUT_MS);
-
-  return resolver.promise;
-}
-
-function testLateRequireProtection() {
-  if (!document.readyState) return;
-  var e = assertThrows(function() {
-    // To differentiate this call from the real one.
-    var require = goog.require;
-    require('goog.ui.Component');
-  });
-
-  assertContains('after document load', e.message);
-}
-
-function testDefineClass() {
-  var Base = goog.defineClass(null, {
-    constructor: function(foo) {
-      this.foo = foo;
-    },
-    statics: {x: 42},
-    frobnicate: function() {
-      return this.foo + this.foo;
-    }
-  });
-  var Derived = goog.defineClass(Base, {
-    constructor: function() {
-      Derived.base(this, 'constructor', 'bar');
-    },
-    frozzle: function(foo) {
-      this.foo = foo;
-    }
-  });
-
-  assertEquals(42, Base.x);
-  var der = new Derived();
-  assertEquals('barbar', der.frobnicate());
-  der.frozzle('qux');
-  assertEquals('quxqux', der.frobnicate());
-}
-
-function testDefineClass_interface() {
-  /** @interface */
-  var Interface =
-      goog.defineClass(null, {statics: {foo: 'bar'}, qux: function() {}});
-  assertEquals('bar', Interface.foo);
-  assertThrows(function() {
-    new Interface();
-  });
-}
-
-function testDefineClass_seals() {
-  if (!(Object.seal instanceof Function)) return;  // IE<9 doesn't have seal
-  var A = goog.defineClass(null, {constructor: function() {}});
-  var a = new A();
-  try {
-    a.foo = 'bar';
-  } catch (expectedInStrictModeOnly) { /* ignored */
-  }
-  assertEquals(undefined, a.foo);
-}
-
-function testDefineClass_unsealable() {
-  var LegacyBase = function() {};
-  LegacyBase.prototype.foo = null;
-  LegacyBase.prototype.setFoo = function(foo) {
-    this.foo = foo;
-  };
-  goog.tagUnsealableClass(LegacyBase);
-
-  var Derived = goog.defineClass(LegacyBase, {constructor: function() {}});
-
-  var der = new Derived();
-  der.setFoo('bar');
-  assertEquals('bar', der.foo);
-}
-
-function testDefineClass_constructorIsNotWrappedWhenSealingIsDisabled() {
-  var org = goog.defineClass;
-  var ctr = null;
-  var replacement = function(superClass, def) {
-    ctr = def.constructor;
-    return org(superClass, def);
-  };
-  // copy all the properties
-  goog.object.extend(replacement, org);
-  replacement.SEAL_CLASS_INSTANCES = false;
-
-  stubs.replace(goog, 'defineClass', replacement);
-  var MyClass = goog.defineClass(null, {constructor: function() {}});
-  assertEquals('The constructor should not be wrapped.', ctr, MyClass);
-}
-
-function testDefineClass_unsealableConstructorIsWrapped() {
-  var LegacyBase = function() {};
-  LegacyBase.prototype.foo = null;
-  LegacyBase.prototype.setFoo = function(foo) {
-    this.foo = foo;
-  };
-  goog.tagUnsealableClass(LegacyBase);
-
-  var org = goog.defineClass;
-  var ctr = null;
-  var replacement = function(superClass, def) {
-    ctr = def.constructor;
-    return org(superClass, def);
-  };
-  // copy all the properties
-  goog.object.extend(replacement, org);
-
-  stubs.replace(goog, 'defineClass', replacement);
-  var Derived = goog.defineClass(LegacyBase, {constructor: function() {}});
-
-  assertNotEquals('The constructor should be wrapped.', ctr, Derived);
-}
-
-// Validate the behavior of goog.module when used from traditional files.
-function testGoogModuleGet() {
-  // assert that goog.module doesn't modify the global namespace
-  assertUndefined(
-      'module failed to protect global namespace: ' +
-          'goog.test_module_dep',
-      goog.test_module_dep);
-
-  // assert that goog.module with goog.module.declareLegacyNamespace is present.
-  assertNotUndefined(
-      'module failed to declare global namespace: ' +
-          'goog.test_module',
-      goog.test_module);
-
-  // assert that a require'd goog.module is available immediately after the
-  // goog.require call.
-  assertNotUndefined(
-      'module failed to protect global namespace: ' +
-          'goog.test_module_dep',
-      earlyTestModuleGet);
-
-
-  // assert that an non-existent module request doesn't throw and returns null.
-  assertEquals(null, goog.module.get('unrequired.module.id'));
-
-  // Validate the module exports
-  var testModuleExports = goog.module.get('goog.test_module');
-  assertTrue(goog.isFunction(testModuleExports));
-
-  // Test that any escaping of </script> in test files is correct. Escape the
-  // / in </script> here so that any such code does not affect it here.
-  assertEquals('<\/script>', testModuleExports.CLOSING_SCRIPT_TAG);
-
-  // Validate that the module exports object has not changed
-  assertEquals(earlyTestModuleGet, testModuleExports);
-}
-
-
-// Validate the behavior of goog.module when used from traditional files.
-function testGoogLoadModuleByUrl() {
-  if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('10')) {
-    // IE before 10 don't report an error.
-    return;
-  }
-
-  stubs.set(goog, 'loadFileSync_', function(src) {
-    return 'closure load file sync: ' + src;
-  });
-
-  // "goog.loadModuleByUrl" is not a general purpose code loader, it can
-  // not be used to late load code.
-  var err =
-      assertThrows('loadModuleFromUrl should not hide failures', function() {
-        goog.loadModuleFromUrl('bogus url');
-      });
-  assertContains('Cannot write "bogus url" after document load', err.message);
-}
-
-
-function testModuleExportSealed() {
-  if (goog.userAgent.IE && !goog.userAgent.isVersionOrHigher('9')) {
-    // IE before 9 don't support sealing objects
-    return;
-  }
-
-  goog.loadModule('goog.module("a.b.supplied"); exports.foo = {};');
-  var exports0 = goog.module.get('a.b.supplied');
-  assertTrue(Object.isSealed(exports0));
-
-  goog.loadModule('goog.module("a.b.object"); exports = {};');
-  var exports1 = goog.module.get('a.b.object');
-  assertTrue(Object.isSealed(exports1));
-
-
-  goog.loadModule('goog.module("a.b.fn"); exports = function() {};');
-  var exports2 = goog.module.get('a.b.fn');
-  assertFalse(Object.isSealed(exports2));
-}
-
-function testWorkaroundSafari10EvalBug0() {
-  // Validate the safari module loading workaround isn't triggered for
-  // browsers we know it isn't needed.
-  if (goog.userAgent.SAFARI) {
-    return;
-  }
-  assertFalse(goog.useSafari10Workaround());
-}
-
-function testWorkaroundSafari10EvalBug1() {
-  assertEquals(
-      '(function(){' +  // no \n
-          'goog.module(\'foo\');\n' +
-          '\n;})();\n',
-      goog.workaroundSafari10EvalBug(
-          'goog.module(\'foo\');\n'));
-}
-
-
-function testWorkaroundSafari10EvalBug2() {
-  assertEquals(
-      '(function(){' +  // no \n
-          'goog.module(\'foo\');\n' +
-          'alert("//# sourceMappingURL a.b.c.map")\n' +
-          'alert("//# sourceURL a.b.c.js")\n' +
-          '\n;})();\n',
-      goog.workaroundSafari10EvalBug(
-          'goog.module(\'foo\');\n' +
-          'alert("//# sourceMappingURL a.b.c.map")\n' +
-          'alert("//# sourceURL a.b.c.js")\n'));
-}
-
-function testGoogLoadModuleInSafari10() {
-  try {
-    eval('let es6 = 1');
-  } catch (e) {
-    // If ES6 block scope syntax isn't supported, don't run the rest of the
-    // test.
-    return;
-  }
-
-  goog.loadModule(
-      'goog.module("a.safari.test");' +
-      'let x = true;' +
-      'function fn() { return x }' +
-      'exports.fn = fn;');
-  var exports = goog.module.get('a.safari.test');
-
-  // Safari 10 will throw an exception if the module being loaded is eval'd
-  // without a containing function.
-  assertNotThrows(exports.fn);
-}
-
-
-function testLoadFileSync() {
-  var fileContents = goog.loadFileSync_('deps.js');
-  assertTrue(
-      'goog.loadFileSync_ returns string', typeof fileContents === 'string');
-  assertTrue('goog.loadFileSync_ string length > 0', fileContents.length > 0);
-
-  stubs.set(goog.global, 'CLOSURE_LOAD_FILE_SYNC', function(src) {
-    return 'closure load file sync: ' + src;
-  });
-
-  assertEquals(
-      'goog.CLOSURE_LOAD_FILE_SYNC override', goog.loadFileSync_('test url'),
-      'closure load file sync: test url');
-}
-
-
-function testNormalizePath1() {
-  assertEquals('foo/path.js', goog.normalizePath_('./foo/./path.js'));
-  assertEquals('foo/path.js', goog.normalizePath_('bar/../foo/path.js'));
-  assertEquals('bar/path.js', goog.normalizePath_('bar/foo/../path.js'));
-  assertEquals('path.js', goog.normalizePath_('bar/foo/../../path.js'));
-
-  assertEquals('../foo/path.js', goog.normalizePath_('../foo/path.js'));
-  assertEquals('../../foo/path.js', goog.normalizePath_('../../foo/path.js'));
-  assertEquals('../path.js', goog.normalizePath_('../foo/../path.js'));
-  assertEquals('../../path.js', goog.normalizePath_('../foo/../../path.js'));
-
-  assertEquals('/../foo/path.js', goog.normalizePath_('/../foo/path.js'));
-  assertEquals('/path.js', goog.normalizePath_('/foo/../path.js'));
-  assertEquals('/foo/path.js', goog.normalizePath_('/./foo/path.js'));
-
-  assertEquals('//../foo/path.js', goog.normalizePath_('//../foo/path.js'));
-  assertEquals('//path.js', goog.normalizePath_('//foo/../path.js'));
-  assertEquals('//foo/path.js', goog.normalizePath_('//./foo/path.js'));
-
-  assertEquals('http://../x/y.js', goog.normalizePath_('http://../x/y.js'));
-  assertEquals('http://path.js', goog.normalizePath_('http://foo/../path.js'));
-  assertEquals('http://x/path.js', goog.normalizePath_('http://./x/path.js'));
-}
-
-
-
-
-function testGoogModuleNames() {
-  // avoid usage checks
-  var module = goog.module;
-
-  function assertInvalidId(id) {
-    var err = assertThrows(function() {
-      module(id);
-    });
-    assertEquals('Invalid module identifier', err.message);
-  }
-
-  function assertValidId(id) {
-    // This is a cheesy check, but we validate that we don't get an invalid
-    // namespace warning, but instead get a module isn't loaded correctly
-    // error.
-    var err = assertThrows(function() {
-      module(id);
-    });
-    assertTrue(err.message.indexOf('has been loaded incorrectly') != -1);
-  }
-
-  assertInvalidId('/somepath/module.js');
-  assertInvalidId('./module.js');
-  assertInvalidId('1');
-
-  assertValidId('a');
-  assertValidId('a.b');
-  assertValidId('a.b.c');
-  assertValidId('aB.Cd.eF');
-  assertValidId('a1.0E.Fg');
-
-  assertValidId('_');
-  assertValidId('$');
-  assertValidId('_$');
-  assertValidId('$_');
-}

Some files were not shown because too many files changed in this diff