rubyfox-server 2.13.5.1 → 2.16.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (572) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rubyfox/server/data/config/UploadsLock.txt +3 -0
  3. data/lib/rubyfox/server/data/config/admin/admintool.xml +2 -0
  4. data/lib/rubyfox/server/data/config/admin/descriptors/config_room.txt +97 -43
  5. data/lib/rubyfox/server/data/config/admin/descriptors/config_server.txt +307 -93
  6. data/lib/rubyfox/server/data/config/admin/descriptors/config_zone.txt +311 -95
  7. data/lib/rubyfox/server/data/config/admin/descriptors/runtime_game.txt +5 -5
  8. data/lib/rubyfox/server/data/config/admin/descriptors/runtime_mmo.txt +6 -6
  9. data/lib/rubyfox/server/data/config/admin/descriptors/runtime_room.txt +69 -44
  10. data/lib/rubyfox/server/data/config/admin/descriptors/runtime_user.txt +55 -43
  11. data/lib/rubyfox/server/data/config/admin/descriptors/runtime_zone.txt +81 -36
  12. data/lib/rubyfox/server/data/config/admin/gmc/gmc.py +55 -18
  13. data/lib/rubyfox/server/data/config/admin/icons/Analytics.png +0 -0
  14. data/lib/rubyfox/server/data/config/admin/icons/Analytics.svg +1 -0
  15. data/lib/rubyfox/server/data/config/admin/icons/BanManager.png +0 -0
  16. data/lib/rubyfox/server/data/config/admin/icons/BanManager.svg +1 -0
  17. data/lib/rubyfox/server/data/config/admin/icons/BlueBoxMonitor.png +0 -0
  18. data/lib/rubyfox/server/data/config/admin/icons/BlueBoxMonitor.svg +1 -0
  19. data/lib/rubyfox/server/data/config/admin/icons/Console.png +0 -0
  20. data/lib/rubyfox/server/data/config/admin/icons/Console.svg +9 -0
  21. data/lib/rubyfox/server/data/config/admin/icons/Dashboard.png +0 -0
  22. data/lib/rubyfox/server/data/config/admin/icons/Dashboard.svg +1 -0
  23. data/lib/rubyfox/server/data/config/admin/icons/ExtensionManager.png +0 -0
  24. data/lib/rubyfox/server/data/config/admin/icons/ExtensionManager.svg +1 -0
  25. data/lib/rubyfox/server/data/config/admin/icons/LicenseManager.png +0 -0
  26. data/lib/rubyfox/server/data/config/admin/icons/LicenseManager.svg +1 -0
  27. data/lib/rubyfox/server/data/config/admin/icons/LogViewer.png +0 -0
  28. data/lib/rubyfox/server/data/config/admin/icons/LogViewer.svg +1 -0
  29. data/lib/rubyfox/server/data/config/admin/icons/ServerConfigurator.png +0 -0
  30. data/lib/rubyfox/server/data/config/admin/icons/ServerConfigurator.svg +1 -0
  31. data/lib/rubyfox/server/data/config/admin/icons/ServletManager.png +0 -0
  32. data/lib/rubyfox/server/data/config/admin/icons/ServletManager.svg +1 -0
  33. data/lib/rubyfox/server/data/config/admin/icons/ZoneConfigurator.png +0 -0
  34. data/lib/rubyfox/server/data/config/admin/icons/ZoneConfigurator.svg +1 -0
  35. data/lib/rubyfox/server/data/config/admin/icons/ZoneMonitor.png +0 -0
  36. data/lib/rubyfox/server/data/config/admin/icons/ZoneMonitor.svg +1 -0
  37. data/lib/rubyfox/server/data/config/core.xml +2 -2
  38. data/lib/rubyfox/server/data/config/log4j.properties +7 -7
  39. data/lib/rubyfox/server/data/config/server.xml +9 -10
  40. data/lib/rubyfox/server/data/config/wordsFile.txt +0 -2
  41. data/lib/rubyfox/server/data/data/GeoLite2-Country.mmdb +0 -0
  42. data/lib/rubyfox/server/data/{config → data/buddylists/BasicExamples}/.keep +0 -0
  43. data/lib/rubyfox/server/data/data/{buddylists → uploads}/.keep +0 -0
  44. data/lib/rubyfox/server/data/lib/BlueBox.war +0 -0
  45. data/lib/rubyfox/server/data/lib/apache-tomcat/LICENSE +1061 -0
  46. data/lib/rubyfox/server/data/lib/apache-tomcat/NOTICE +68 -0
  47. data/lib/rubyfox/server/data/lib/apache-tomcat/README.md +79 -0
  48. data/lib/rubyfox/server/data/lib/apache-tomcat/RELEASE-NOTES +174 -0
  49. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/bootstrap.jar +0 -0
  50. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/catalina-tasks.xml +39 -0
  51. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/catalina.bat +386 -0
  52. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/catalina.sh +689 -0
  53. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/ciphers.bat +58 -0
  54. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/ciphers.sh +60 -0
  55. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/commons-daemon-native.tar.gz +0 -0
  56. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/commons-daemon.jar +0 -0
  57. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/configtest.bat +58 -0
  58. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/configtest.sh +60 -0
  59. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/daemon.sh +293 -0
  60. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/digest.bat +58 -0
  61. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/digest.sh +60 -0
  62. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/makebase.bat +114 -0
  63. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/makebase.sh +115 -0
  64. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/setclasspath.bat +94 -0
  65. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/setclasspath.sh +98 -0
  66. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/shutdown.bat +58 -0
  67. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/shutdown.sh +60 -0
  68. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/startup.bat +58 -0
  69. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/startup.sh +60 -0
  70. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/tomcat-juli.jar +0 -0
  71. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/tomcat-native.tar.gz +0 -0
  72. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/tool-wrapper.bat +110 -0
  73. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/tool-wrapper.sh +153 -0
  74. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/version.bat +58 -0
  75. data/lib/rubyfox/server/data/lib/apache-tomcat/bin/version.sh +60 -0
  76. data/lib/rubyfox/server/data/lib/apache-tomcat/conf/Catalina/localhost/rewrite.config +1 -0
  77. data/lib/rubyfox/server/data/lib/apache-tomcat/conf/catalina.policy +260 -0
  78. data/lib/rubyfox/server/data/lib/apache-tomcat/conf/catalina.properties +206 -0
  79. data/lib/rubyfox/server/data/lib/apache-tomcat/conf/context.xml +31 -0
  80. data/lib/rubyfox/server/data/lib/apache-tomcat/conf/jaspic-providers.xml +23 -0
  81. data/lib/rubyfox/server/data/lib/apache-tomcat/conf/jaspic-providers.xsd +53 -0
  82. data/lib/rubyfox/server/data/lib/apache-tomcat/conf/keystore.jks +0 -0
  83. data/lib/rubyfox/server/data/lib/apache-tomcat/conf/logging.properties +79 -0
  84. data/lib/rubyfox/server/data/lib/apache-tomcat/conf/server.xml +161 -0
  85. data/lib/rubyfox/server/data/lib/apache-tomcat/conf/tomcat-users.xml +41 -0
  86. data/lib/rubyfox/server/data/lib/apache-tomcat/conf/tomcat-users.xsd +59 -0
  87. data/lib/rubyfox/server/data/lib/apache-tomcat/conf/web.xml +4733 -0
  88. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/annotations-api.jar +0 -0
  89. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/catalina-ant.jar +0 -0
  90. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/catalina-ha.jar +0 -0
  91. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/catalina-ssi.jar +0 -0
  92. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/catalina-storeconfig.jar +0 -0
  93. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/catalina-tribes.jar +0 -0
  94. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/catalina.jar +0 -0
  95. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/ecj-4.15.jar +0 -0
  96. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/el-api.jar +0 -0
  97. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/jasper-el.jar +0 -0
  98. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/jasper.jar +0 -0
  99. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/jaspic-api.jar +0 -0
  100. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/jsp-api.jar +0 -0
  101. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/servlet-api.jar +0 -0
  102. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/sfs2x-ws-helper.jar +0 -0
  103. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-api.jar +0 -0
  104. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-coyote.jar +0 -0
  105. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-dbcp.jar +0 -0
  106. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-i18n-cs.jar +0 -0
  107. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-i18n-de.jar +0 -0
  108. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-i18n-es.jar +0 -0
  109. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-i18n-fr.jar +0 -0
  110. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-i18n-ja.jar +0 -0
  111. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-i18n-ko.jar +0 -0
  112. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-i18n-pt-BR.jar +0 -0
  113. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-i18n-ru.jar +0 -0
  114. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-i18n-zh-CN.jar +0 -0
  115. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-jdbc.jar +0 -0
  116. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-jni.jar +0 -0
  117. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-util-scan.jar +0 -0
  118. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-util.jar +0 -0
  119. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/tomcat-websocket.jar +0 -0
  120. data/lib/rubyfox/server/data/lib/apache-tomcat/lib/websocket-api.jar +0 -0
  121. data/lib/rubyfox/server/data/{extensions → lib/apache-tomcat/logs}/.keep +0 -0
  122. data/lib/rubyfox/server/data/lib/{jetty/lib/ext/.donotdelete → apache-tomcat/temp/safeToDelete.tmp} +0 -0
  123. data/lib/rubyfox/server/data/lib/{jetty/resources → apache-tomcat/work}/.keep +0 -0
  124. data/lib/rubyfox/server/data/lib/commons-collections-3.2.2.jar +0 -0
  125. data/lib/rubyfox/server/data/lib/commons-compress-1.19.jar +0 -0
  126. data/lib/rubyfox/server/data/lib/js/LibApi.js +48 -181
  127. data/lib/rubyfox/server/data/lib/sfs2x-admin.jar +0 -0
  128. data/lib/rubyfox/server/data/lib/sfs2x-core.jar +0 -0
  129. data/lib/rubyfox/server/data/lib/sfs2x-lib.jar +0 -0
  130. data/lib/rubyfox/server/data/lib/sfs2x-util.jar +0 -0
  131. data/lib/rubyfox/server/data/lib/sfs2x.jar +0 -0
  132. data/lib/rubyfox/server/data/sfs2x-service +6 -6
  133. data/lib/rubyfox/server/data/sfs2x-service.vmoptions +1 -1
  134. data/lib/rubyfox/server/data/sfs2x.sh +1 -1
  135. data/lib/rubyfox/server/data/www/BlueBox.war +0 -0
  136. data/lib/rubyfox/server/data/www/HelloServlet/index.jsp +1 -1
  137. data/lib/rubyfox/server/data/www/{root → ROOT}/_css_/default.css +0 -0
  138. data/lib/rubyfox/server/data/www/{root → ROOT}/_css_/reset.css +0 -0
  139. data/lib/rubyfox/server/data/www/{root → ROOT}/_images_/background_gradient.png +0 -0
  140. data/lib/rubyfox/server/data/www/{root → ROOT}/_images_/background_logo.png +0 -0
  141. data/lib/rubyfox/server/data/www/{root → ROOT}/_images_/favicon.png +0 -0
  142. data/lib/rubyfox/server/data/www/{root → ROOT}/_images_/logo_smartfoxserver.png +0 -0
  143. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/_changes-to-default-themes_.txt +15 -0
  144. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/bootstrap.min.css +7 -0
  145. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/custom-bootstrap.min.css +1 -0
  146. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/css/all.min.css +5 -0
  147. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-brands-400.eot +0 -0
  148. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-brands-400.svg +3459 -0
  149. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-brands-400.ttf +0 -0
  150. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-brands-400.woff +0 -0
  151. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
  152. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-regular-400.eot +0 -0
  153. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-regular-400.svg +803 -0
  154. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-regular-400.ttf +0 -0
  155. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-regular-400.woff +0 -0
  156. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
  157. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-solid-900.eot +0 -0
  158. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-solid-900.svg +4527 -0
  159. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-solid-900.ttf +0 -0
  160. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-solid-900.woff +0 -0
  161. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
  162. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/fonts.css +175 -0
  163. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/jquery.scrolling-tabs.min.css +8 -0
  164. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/kendo.custom-bootstrap-v4.css +15280 -0
  165. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/reset.css +54 -0
  166. data/lib/rubyfox/server/data/www/ROOT/admin/assets/css/style.css +1428 -0
  167. data/lib/rubyfox/server/data/www/ROOT/admin/assets/data/countries.geo.json +178 -0
  168. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/FreeMono.otf +0 -0
  169. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/FreeMono.ttf +0 -0
  170. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/FreeMono.woff +0 -0
  171. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/FreeMono.woff2 +0 -0
  172. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-300.ttf +0 -0
  173. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-300.woff +0 -0
  174. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-300.woff2 +0 -0
  175. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-300italic.ttf +0 -0
  176. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-300italic.woff +0 -0
  177. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-300italic.woff2 +0 -0
  178. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-600.ttf +0 -0
  179. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-600.woff +0 -0
  180. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-600.woff2 +0 -0
  181. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-600italic.ttf +0 -0
  182. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-600italic.woff +0 -0
  183. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-600italic.woff2 +0 -0
  184. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-700.ttf +0 -0
  185. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-700.woff +0 -0
  186. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-700.woff2 +0 -0
  187. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-700italic.ttf +0 -0
  188. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-700italic.woff +0 -0
  189. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-700italic.woff2 +0 -0
  190. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-800.ttf +0 -0
  191. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-800.woff +0 -0
  192. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-800.woff2 +0 -0
  193. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-800italic.ttf +0 -0
  194. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-800italic.woff +0 -0
  195. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-800italic.woff2 +0 -0
  196. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-italic.ttf +0 -0
  197. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-italic.woff +0 -0
  198. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-italic.woff2 +0 -0
  199. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-regular.ttf +0 -0
  200. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-regular.woff +0 -0
  201. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/open-sans-v15-cyrillic_greek_cyrillic-ext_vietnamese_latin_latin-ext_greek-ext-regular.woff2 +0 -0
  202. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/roboto-condensed-v16-latin-300.ttf +0 -0
  203. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/roboto-condensed-v16-latin-300.woff +0 -0
  204. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/roboto-condensed-v16-latin-300.woff2 +0 -0
  205. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/roboto-condensed-v16-latin-700.ttf +0 -0
  206. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/roboto-condensed-v16-latin-700.woff +0 -0
  207. data/lib/rubyfox/server/data/www/ROOT/admin/assets/fonts/roboto-condensed-v16-latin-700.woff2 +0 -0
  208. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/analytics-adv/compare.png +0 -0
  209. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/analytics-adv/demographicsChart.png +0 -0
  210. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/analytics-adv/demographicsCompare.png +0 -0
  211. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/analytics-adv/demographicsFilter.png +0 -0
  212. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/analytics-adv/demographicsMap.png +0 -0
  213. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/analytics-adv/demographicsTable.png +0 -0
  214. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/analytics-adv/technologyChart.png +0 -0
  215. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/analytics-adv/technologyCompare.png +0 -0
  216. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/analytics-adv/technologyFilter.png +0 -0
  217. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/analytics-adv/technologyTable.png +0 -0
  218. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/apple-touch-icon-180x180.png +0 -0
  219. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/favicon-16x16.png +0 -0
  220. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/favicon-32x32.png +0 -0
  221. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/favicon-64x64.png +0 -0
  222. data/lib/rubyfox/server/data/www/ROOT/admin/assets/images/logo.png +0 -0
  223. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/application.bundle.js +2208 -0
  224. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-0.bundle.js +7662 -0
  225. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-1.bundle.js +929 -0
  226. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-10.bundle.js +766 -0
  227. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-11.bundle.js +71 -0
  228. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-12.bundle.js +1184 -0
  229. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-12~module-13~module-9.bundle.js +2618 -0
  230. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-13.bundle.js +3315 -0
  231. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-3.bundle.js +280 -0
  232. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-4.bundle.js +1122 -0
  233. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-5.bundle.js +2624 -0
  234. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-6.bundle.js +801 -0
  235. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-7.bundle.js +607 -0
  236. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-8.bundle.js +1221 -0
  237. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/module-9.bundle.js +847 -0
  238. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/vendors~module-0.bundle.js +3240 -0
  239. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/vendors~module-0~module-1~module-13~module-4~module-5~module-7~module-8.bundle.js +17357 -0
  240. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/core/modules/vendors~module-9.bundle.js +807 -0
  241. data/lib/rubyfox/server/data/{lib/jetty/webapps → www/ROOT/admin/assets/js/custom-modules}/.keep +0 -0
  242. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/libs/bootstrap.min.js +7 -0
  243. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/libs/jquery-3.3.1.min.js +2 -0
  244. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/libs/jquery.scrolling-tabs.min.js +8 -0
  245. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/libs/js.cookie.min.js +8 -0
  246. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/libs/kendo.all.min.js +136 -0
  247. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/libs/popper.min.js +5 -0
  248. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/libs/sfs2x-api-1.7.15.js +8 -0
  249. data/lib/rubyfox/server/data/www/ROOT/admin/assets/js/libs/versions-readme.txt +16 -0
  250. data/lib/rubyfox/server/data/www/ROOT/admin/index.html +244 -0
  251. data/lib/rubyfox/server/data/www/ROOT/admin/manifest.json +25 -0
  252. data/lib/rubyfox/server/data/www/ROOT/admin/modules/analytics.html +328 -0
  253. data/lib/rubyfox/server/data/www/ROOT/admin/modules/ban-manager.html +160 -0
  254. data/lib/rubyfox/server/data/www/ROOT/admin/modules/blue-box-monitor.html +37 -0
  255. data/lib/rubyfox/server/data/www/ROOT/admin/modules/console.html +135 -0
  256. data/lib/rubyfox/server/data/www/ROOT/admin/modules/dashboard.html +368 -0
  257. data/lib/rubyfox/server/data/www/ROOT/admin/modules/extension-manager.html +98 -0
  258. data/lib/rubyfox/server/data/www/ROOT/admin/modules/license-manager.html +117 -0
  259. data/lib/rubyfox/server/data/www/ROOT/admin/modules/log-viewer.html +194 -0
  260. data/lib/rubyfox/server/data/www/ROOT/admin/modules/server-configurator.html +55 -0
  261. data/lib/rubyfox/server/data/www/ROOT/admin/modules/servlet-manager.html +98 -0
  262. data/lib/rubyfox/server/data/www/ROOT/admin/modules/zone-configurator.html +62 -0
  263. data/lib/rubyfox/server/data/www/ROOT/admin/modules/zone-monitor.html +346 -0
  264. data/lib/rubyfox/server/data/www/{root → ROOT}/crossdomain.xml +0 -0
  265. data/lib/rubyfox/server/data/www/{root → ROOT}/examples/index.html +0 -0
  266. data/lib/rubyfox/server/data/www/{root → ROOT}/favicon.ico +0 -0
  267. data/lib/rubyfox/server/data/www/{root → ROOT}/favicon.png +0 -0
  268. data/lib/rubyfox/server/data/www/{root → ROOT}/index.html +0 -0
  269. data/lib/rubyfox/server/data/www/host-manager/META-INF/context.xml +24 -0
  270. data/lib/rubyfox/server/data/www/host-manager/WEB-INF/jsp/401.jsp +71 -0
  271. data/lib/rubyfox/server/data/www/host-manager/WEB-INF/jsp/403.jsp +90 -0
  272. data/lib/rubyfox/server/data/www/host-manager/WEB-INF/jsp/404.jsp +62 -0
  273. data/lib/rubyfox/server/data/www/host-manager/WEB-INF/web.xml +131 -0
  274. data/lib/rubyfox/server/data/www/host-manager/images/asf-logo.svg +226 -0
  275. data/lib/rubyfox/server/data/www/host-manager/images/tomcat.gif +0 -0
  276. data/lib/rubyfox/server/data/www/host-manager/index.jsp +18 -0
  277. data/lib/rubyfox/server/data/www/host-manager/manager.xml +26 -0
  278. data/lib/rubyfox/server/data/{logs → www/logsBackup}/.keep +0 -0
  279. data/lib/rubyfox/server/data/www/manager/META-INF/context.xml +24 -0
  280. data/lib/rubyfox/server/data/www/manager/WEB-INF/jsp/401.jsp +80 -0
  281. data/lib/rubyfox/server/data/www/manager/WEB-INF/jsp/403.jsp +100 -0
  282. data/lib/rubyfox/server/data/www/manager/WEB-INF/jsp/404.jsp +63 -0
  283. data/lib/rubyfox/server/data/www/manager/WEB-INF/jsp/connectorCerts.jsp +92 -0
  284. data/lib/rubyfox/server/data/www/manager/WEB-INF/jsp/connectorCiphers.jsp +92 -0
  285. data/lib/rubyfox/server/data/www/manager/WEB-INF/jsp/connectorTrustedCerts.jsp +92 -0
  286. data/lib/rubyfox/server/data/www/manager/WEB-INF/jsp/sessionDetail.jsp +197 -0
  287. data/lib/rubyfox/server/data/www/manager/WEB-INF/jsp/sessionsList.jsp +170 -0
  288. data/lib/rubyfox/server/data/www/manager/WEB-INF/web.xml +195 -0
  289. data/lib/rubyfox/server/data/www/manager/images/asf-logo.svg +226 -0
  290. data/lib/rubyfox/server/data/www/manager/images/tomcat.gif +0 -0
  291. data/lib/rubyfox/server/data/www/manager/index.jsp +18 -0
  292. data/lib/rubyfox/server/data/www/manager/status.xsd +84 -0
  293. data/lib/rubyfox/server/data/www/manager/xform.xsl +125 -0
  294. data/lib/rubyfox/server/version.rb +1 -1
  295. metadata +258 -298
  296. data/lib/rubyfox/server/data/config/ExtensionManagerLock.txt +0 -2
  297. data/lib/rubyfox/server/data/lib/Lib/reindex$py.class +0 -0
  298. data/lib/rubyfox/server/data/lib/jetty/VERSION.txt +0 -9320
  299. data/lib/rubyfox/server/data/lib/jetty/etc/README.spnego +0 -62
  300. data/lib/rubyfox/server/data/lib/jetty/etc/jamon.xml +0 -32
  301. data/lib/rubyfox/server/data/lib/jetty/etc/jdbcRealm.properties +0 -72
  302. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-alpn.xml +0 -32
  303. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-annotations.xml +0 -20
  304. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-cdi.xml +0 -19
  305. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-debug.xml +0 -36
  306. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-debuglog.xml +0 -25
  307. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-deploy.xml +0 -76
  308. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-gcloud-memcached-sessions.xml +0 -27
  309. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-gcloud-session-idmgr.xml +0 -19
  310. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-gcloud-sessions.xml +0 -27
  311. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-gzip.xml +0 -67
  312. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-http-forwarded.xml +0 -17
  313. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-http.xml +0 -47
  314. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-http2.xml +0 -26
  315. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-http2c.xml +0 -18
  316. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-https.xml +0 -29
  317. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-infinispan.xml +0 -39
  318. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-ipaccess.xml +0 -28
  319. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-jaas.xml +0 -16
  320. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-jdbc-sessions.xml +0 -34
  321. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-jmx-remote.xml +0 -40
  322. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-jmx.xml +0 -32
  323. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-logging.xml +0 -36
  324. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-lowresources.xml +0 -22
  325. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-monitor.xml +0 -30
  326. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-nosql.xml +0 -19
  327. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-plus.xml +0 -26
  328. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-proxy-protocol-ssl.xml +0 -10
  329. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-proxy-protocol.xml +0 -10
  330. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-proxy.xml +0 -35
  331. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-requestlog.xml +0 -30
  332. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-rewrite-customizer.xml +0 -17
  333. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-rewrite.xml +0 -31
  334. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-setuid.xml +0 -30
  335. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-spring.xml +0 -61
  336. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-ssl-context.xml +0 -29
  337. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-ssl.xml +0 -58
  338. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-started.xml +0 -15
  339. data/lib/rubyfox/server/data/lib/jetty/etc/jetty-stats.xml +0 -18
  340. data/lib/rubyfox/server/data/lib/jetty/etc/jetty.conf +0 -12
  341. data/lib/rubyfox/server/data/lib/jetty/etc/jetty.xml +0 -195
  342. data/lib/rubyfox/server/data/lib/jetty/etc/jminix.xml +0 -12
  343. data/lib/rubyfox/server/data/lib/jetty/etc/jolokia.xml +0 -16
  344. data/lib/rubyfox/server/data/lib/jetty/etc/keystore +0 -0
  345. data/lib/rubyfox/server/data/lib/jetty/etc/krb5.ini +0 -23
  346. data/lib/rubyfox/server/data/lib/jetty/etc/rewrite-compactpath.xml +0 -10
  347. data/lib/rubyfox/server/data/lib/jetty/etc/spnego.conf +0 -19
  348. data/lib/rubyfox/server/data/lib/jetty/etc/spnego.properties +0 -1
  349. data/lib/rubyfox/server/data/lib/jetty/etc/webdefault.xml +0 -539
  350. data/lib/rubyfox/server/data/lib/jetty/lib/asm-5.0.1.jar +0 -0
  351. data/lib/rubyfox/server/data/lib/jetty/lib/asm-commons-5.0.1.jar +0 -0
  352. data/lib/rubyfox/server/data/lib/jetty/lib/fcgi/fcgi-client-9.3.11.v20160721.jar +0 -0
  353. data/lib/rubyfox/server/data/lib/jetty/lib/fcgi/fcgi-server-9.3.11.v20160721.jar +0 -0
  354. data/lib/rubyfox/server/data/lib/jetty/lib/http2-common-9.3.11.v20160721.jar +0 -0
  355. data/lib/rubyfox/server/data/lib/jetty/lib/http2-hpack-9.3.11.v20160721.jar +0 -0
  356. data/lib/rubyfox/server/data/lib/jetty/lib/http2-server-9.3.11.v20160721.jar +0 -0
  357. data/lib/rubyfox/server/data/lib/jetty/lib/jaspi/javax.security.auth.message-1.0.0.v201108011116.jar +0 -0
  358. data/lib/rubyfox/server/data/lib/jetty/lib/javax-websocket-client-impl-9.3.11.v20160721.jar +0 -0
  359. data/lib/rubyfox/server/data/lib/jetty/lib/javax-websocket-server-impl-9.3.11.v20160721.jar +0 -0
  360. data/lib/rubyfox/server/data/lib/jetty/lib/javax.annotation-api-1.2.jar +0 -0
  361. data/lib/rubyfox/server/data/lib/jetty/lib/javax.websocket-api-1.0.jar +0 -0
  362. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-alpn-server-9.3.11.v20160721.jar +0 -0
  363. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-annotations-9.3.11.v20160721.jar +0 -0
  364. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-client-9.3.11.v20160721.jar +0 -0
  365. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-continuation-9.3.11.v20160721.jar +0 -0
  366. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-deploy-9.3.11.v20160721.jar +0 -0
  367. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-gcloud-memcached-session-manager-9.3.11.v20160721.jar +0 -0
  368. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-gcloud-session-manager-9.3.11.v20160721.jar +0 -0
  369. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-http-9.3.11.v20160721.jar +0 -0
  370. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-infinispan-9.3.11.v20160721.jar +0 -0
  371. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-io-9.3.11.v20160721.jar +0 -0
  372. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-jaas-9.3.11.v20160721.jar +0 -0
  373. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-jaspi-9.3.11.v20160721.jar +0 -0
  374. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-jmx-9.3.11.v20160721.jar +0 -0
  375. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-jndi-9.3.11.v20160721.jar +0 -0
  376. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-nosql-9.3.11.v20160721.jar +0 -0
  377. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-plus-9.3.11.v20160721.jar +0 -0
  378. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-proxy-9.3.11.v20160721.jar +0 -0
  379. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-quickstart-9.3.11.v20160721.jar +0 -0
  380. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-rewrite-9.3.11.v20160721.jar +0 -0
  381. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-schemas-3.1.jar +0 -0
  382. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-security-9.3.11.v20160721.jar +0 -0
  383. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-server-9.3.11.v20160721.jar +0 -0
  384. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-servlet-9.3.11.v20160721.jar +0 -0
  385. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-servlets-9.3.11.v20160721.jar +0 -0
  386. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-util-9.3.11.v20160721.jar +0 -0
  387. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-webapp-9.3.11.v20160721.jar +0 -0
  388. data/lib/rubyfox/server/data/lib/jetty/lib/jetty-xml-9.3.11.v20160721.jar +0 -0
  389. data/lib/rubyfox/server/data/lib/jetty/lib/jndi/javax.mail.glassfish-1.4.1.v201005082020.jar +0 -0
  390. data/lib/rubyfox/server/data/lib/jetty/lib/jndi/javax.transaction-api-1.2.jar +0 -0
  391. data/lib/rubyfox/server/data/lib/jetty/lib/monitor/jetty-monitor-9.3.11.v20160721.jar +0 -0
  392. data/lib/rubyfox/server/data/lib/jetty/lib/org.apache.taglibs.taglibs-standard-impl-1.2.5.jar +0 -0
  393. data/lib/rubyfox/server/data/lib/jetty/lib/org.apache.taglibs.taglibs-standard-spec-1.2.5.jar +0 -0
  394. data/lib/rubyfox/server/data/lib/jetty/lib/org.eclipse.jdt.core.compiler.ecj-4.4.2.jar +0 -0
  395. data/lib/rubyfox/server/data/lib/jetty/lib/org.eclipse.jetty.apache-jsp-9.3.11.v20160721.jar +0 -0
  396. data/lib/rubyfox/server/data/lib/jetty/lib/org.mortbay.jasper.apache-el-8.0.33.jar +0 -0
  397. data/lib/rubyfox/server/data/lib/jetty/lib/org.mortbay.jasper.apache-jsp-8.0.33.jar +0 -0
  398. data/lib/rubyfox/server/data/lib/jetty/lib/servlet-api-3.1.jar +0 -0
  399. data/lib/rubyfox/server/data/lib/jetty/lib/setuid/jetty-setuid-java-1.0.3.jar +0 -0
  400. data/lib/rubyfox/server/data/lib/jetty/lib/setuid/libsetuid-linux.so +0 -0
  401. data/lib/rubyfox/server/data/lib/jetty/lib/setuid/libsetuid-osx.so +0 -0
  402. data/lib/rubyfox/server/data/lib/jetty/lib/spring/jetty-spring-9.3.11.v20160721.jar +0 -0
  403. data/lib/rubyfox/server/data/lib/jetty/lib/start.jar +0 -0
  404. data/lib/rubyfox/server/data/lib/jetty/lib/websocket-api-9.3.11.v20160721.jar +0 -0
  405. data/lib/rubyfox/server/data/lib/jetty/lib/websocket-client-9.3.11.v20160721.jar +0 -0
  406. data/lib/rubyfox/server/data/lib/jetty/lib/websocket-common-9.3.11h.v20160721.jar +0 -0
  407. data/lib/rubyfox/server/data/lib/jetty/lib/websocket-server-9.3.11.v20160721.jar +0 -0
  408. data/lib/rubyfox/server/data/lib/jetty/lib/websocket-servlet-9.3.11.v20160721.jar +0 -0
  409. data/lib/rubyfox/server/data/lib/jetty/license-eplv10-aslv20.html +0 -576
  410. data/lib/rubyfox/server/data/lib/jetty/modules/.donotdelete +0 -0
  411. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0.mod +0 -8
  412. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_05.mod +0 -8
  413. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_101.mod +0 -8
  414. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_102.mod +0 -8
  415. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_11.mod +0 -8
  416. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_20.mod +0 -8
  417. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_25.mod +0 -8
  418. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_31.mod +0 -8
  419. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_40.mod +0 -8
  420. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_45.mod +0 -8
  421. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_51.mod +0 -8
  422. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_60.mod +0 -8
  423. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_65.mod +0 -8
  424. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_66.mod +0 -8
  425. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_71.mod +0 -8
  426. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_72.mod +0 -8
  427. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_73.mod +0 -8
  428. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_74.mod +0 -8
  429. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_77.mod +0 -8
  430. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_91.mod +0 -8
  431. data/lib/rubyfox/server/data/lib/jetty/modules/alpn-impl/alpn-1.8.0_92.mod +0 -8
  432. data/lib/rubyfox/server/data/lib/jetty/modules/alpn.mod +0 -53
  433. data/lib/rubyfox/server/data/lib/jetty/modules/annotations.mod +0 -17
  434. data/lib/rubyfox/server/data/lib/jetty/modules/apache-jsp.mod +0 -10
  435. data/lib/rubyfox/server/data/lib/jetty/modules/apache-jstl.mod +0 -9
  436. data/lib/rubyfox/server/data/lib/jetty/modules/cdi.mod +0 -39
  437. data/lib/rubyfox/server/data/lib/jetty/modules/client.mod +0 -6
  438. data/lib/rubyfox/server/data/lib/jetty/modules/continuation.mod +0 -6
  439. data/lib/rubyfox/server/data/lib/jetty/modules/debug.mod +0 -29
  440. data/lib/rubyfox/server/data/lib/jetty/modules/debuglog.mod +0 -25
  441. data/lib/rubyfox/server/data/lib/jetty/modules/deploy.mod +0 -31
  442. data/lib/rubyfox/server/data/lib/jetty/modules/ext.mod +0 -11
  443. data/lib/rubyfox/server/data/lib/jetty/modules/fcgi.mod +0 -15
  444. data/lib/rubyfox/server/data/lib/jetty/modules/gcloud-memcached-sessions.mod +0 -26
  445. data/lib/rubyfox/server/data/lib/jetty/modules/gcloud-session-idmgr.mod +0 -63
  446. data/lib/rubyfox/server/data/lib/jetty/modules/gcloud-sessions.mod +0 -11
  447. data/lib/rubyfox/server/data/lib/jetty/modules/gzip.mod +0 -23
  448. data/lib/rubyfox/server/data/lib/jetty/modules/hawtio.mod +0 -28
  449. data/lib/rubyfox/server/data/lib/jetty/modules/home-base-warning.mod +0 -7
  450. data/lib/rubyfox/server/data/lib/jetty/modules/http-forwarded.mod +0 -20
  451. data/lib/rubyfox/server/data/lib/jetty/modules/http.mod +0 -39
  452. data/lib/rubyfox/server/data/lib/jetty/modules/http2.mod +0 -20
  453. data/lib/rubyfox/server/data/lib/jetty/modules/http2c.mod +0 -22
  454. data/lib/rubyfox/server/data/lib/jetty/modules/https.mod +0 -14
  455. data/lib/rubyfox/server/data/lib/jetty/modules/infinispan.mod +0 -33
  456. data/lib/rubyfox/server/data/lib/jetty/modules/ipaccess.mod +0 -9
  457. data/lib/rubyfox/server/data/lib/jetty/modules/jaas.mod +0 -17
  458. data/lib/rubyfox/server/data/lib/jetty/modules/jamon.mod +0 -31
  459. data/lib/rubyfox/server/data/lib/jetty/modules/jaspi.mod +0 -10
  460. data/lib/rubyfox/server/data/lib/jetty/modules/jdbc-sessions.mod +0 -27
  461. data/lib/rubyfox/server/data/lib/jetty/modules/jminix.mod +0 -41
  462. data/lib/rubyfox/server/data/lib/jetty/modules/jmx-remote.mod +0 -16
  463. data/lib/rubyfox/server/data/lib/jetty/modules/jmx.mod +0 -13
  464. data/lib/rubyfox/server/data/lib/jetty/modules/jndi.mod +0 -11
  465. data/lib/rubyfox/server/data/lib/jetty/modules/jolokia.mod +0 -19
  466. data/lib/rubyfox/server/data/lib/jetty/modules/jsp.mod +0 -9
  467. data/lib/rubyfox/server/data/lib/jetty/modules/jstl.mod +0 -8
  468. data/lib/rubyfox/server/data/lib/jetty/modules/jvm.mod +0 -22
  469. data/lib/rubyfox/server/data/lib/jetty/modules/logging.mod +0 -36
  470. data/lib/rubyfox/server/data/lib/jetty/modules/lowresources.mod +0 -28
  471. data/lib/rubyfox/server/data/lib/jetty/modules/monitor.mod +0 -13
  472. data/lib/rubyfox/server/data/lib/jetty/modules/nosql.mod +0 -31
  473. data/lib/rubyfox/server/data/lib/jetty/modules/plus.mod +0 -15
  474. data/lib/rubyfox/server/data/lib/jetty/modules/proxy-protocol-ssl.mod +0 -9
  475. data/lib/rubyfox/server/data/lib/jetty/modules/proxy-protocol.mod +0 -9
  476. data/lib/rubyfox/server/data/lib/jetty/modules/proxy.mod +0 -22
  477. data/lib/rubyfox/server/data/lib/jetty/modules/quickstart.mod +0 -11
  478. data/lib/rubyfox/server/data/lib/jetty/modules/requestlog.mod +0 -40
  479. data/lib/rubyfox/server/data/lib/jetty/modules/resources.mod +0 -10
  480. data/lib/rubyfox/server/data/lib/jetty/modules/rewrite-compactpath.mod +0 -10
  481. data/lib/rubyfox/server/data/lib/jetty/modules/rewrite-customizer.mod +0 -24
  482. data/lib/rubyfox/server/data/lib/jetty/modules/rewrite.mod +0 -23
  483. data/lib/rubyfox/server/data/lib/jetty/modules/security.mod +0 -9
  484. data/lib/rubyfox/server/data/lib/jetty/modules/server.mod +0 -79
  485. data/lib/rubyfox/server/data/lib/jetty/modules/servlet.mod +0 -9
  486. data/lib/rubyfox/server/data/lib/jetty/modules/servlets.mod +0 -11
  487. data/lib/rubyfox/server/data/lib/jetty/modules/setuid.mod +0 -19
  488. data/lib/rubyfox/server/data/lib/jetty/modules/spring.mod +0 -17
  489. data/lib/rubyfox/server/data/lib/jetty/modules/ssl.mod +0 -97
  490. data/lib/rubyfox/server/data/lib/jetty/modules/stats.mod +0 -9
  491. data/lib/rubyfox/server/data/lib/jetty/modules/webapp.mod +0 -10
  492. data/lib/rubyfox/server/data/lib/jetty/modules/websocket.mod +0 -12
  493. data/lib/rubyfox/server/data/lib/jetty/notice.html +0 -111
  494. data/lib/rubyfox/server/data/lib/jetty/start.d/README.TXT +0 -24
  495. data/lib/rubyfox/server/data/lib/jetty/start.d/http.ini +0 -7
  496. data/lib/rubyfox/server/data/lib/jetty/start.d/https.ini +0 -10
  497. data/lib/rubyfox/server/data/lib/jetty/start.d/ssl.ini +0 -19
  498. data/lib/rubyfox/server/data/lib/jetty/start.ini +0 -83
  499. data/lib/rubyfox/server/data/www/.keep +0 -0
  500. data/lib/rubyfox/server/data/www/HelloServlet/META-INF/context.xml +0 -2
  501. data/lib/rubyfox/server/data/www/PyServletExample/MyModule$py.class +0 -0
  502. data/lib/rubyfox/server/data/www/PyServletExample/MyModule.py +0 -5
  503. data/lib/rubyfox/server/data/www/PyServletExample/WEB-INF/web.xml +0 -37
  504. data/lib/rubyfox/server/data/www/PyServletExample/errors/404.htm +0 -20
  505. data/lib/rubyfox/server/data/www/PyServletExample/index.py +0 -42
  506. data/lib/rubyfox/server/data/www/root/admin/.keep +0 -0
  507. data/lib/rubyfox/server/data/www/root/admin/AdminTool.swf +0 -0
  508. data/lib/rubyfox/server/data/www/root/admin/ReleaseNotes.txt +0 -192
  509. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/adobeFlashPlayer.png +0 -0
  510. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/advanced.png +0 -0
  511. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/analytics.png +0 -0
  512. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/banManager.png +0 -0
  513. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/bannedIPs.png +0 -0
  514. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/bannedUsernames.png +0 -0
  515. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/bookmarks.png +0 -0
  516. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/bootLog.png +0 -0
  517. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/buddyList.png +0 -0
  518. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/buddyProperties.png +0 -0
  519. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/connection.png +0 -0
  520. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/databaseManager.png +0 -0
  521. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/floodFilter.png +0 -0
  522. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/gameSettings.png +0 -0
  523. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/general.png +0 -0
  524. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/globalServerStatus.png +0 -0
  525. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/hTML5WebSockets.png +0 -0
  526. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/iPDiscovery.png +0 -0
  527. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/iPFilter.png +0 -0
  528. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/jVMSettings.png +0 -0
  529. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/logsDownload.png +0 -0
  530. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/mMOSettings.png +0 -0
  531. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/mailer.png +0 -0
  532. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/permissionsAndEvents.png +0 -0
  533. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/privilegeManager.png +0 -0
  534. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/remoteAdmin.png +0 -0
  535. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/roomExtension.png +0 -0
  536. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/roomVariables.png +0 -0
  537. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/roomsAndGroups.png +0 -0
  538. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/runtimeLog.png +0 -0
  539. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/runtimeRoomSettings.png +0 -0
  540. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/runtimeUserSettings.png +0 -0
  541. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/runtimeZoneSettings.png +0 -0
  542. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/statsApplication.png +0 -0
  543. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/statsDemographics.png +0 -0
  544. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/statsExceptions.png +0 -0
  545. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/statsOverview.png +0 -0
  546. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/statsTechnology.png +0 -0
  547. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/systemQueueStatus.png +0 -0
  548. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/threadPools.png +0 -0
  549. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/userManagement.png +0 -0
  550. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/userVariables.png +0 -0
  551. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/webServer.png +0 -0
  552. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/wordsFilter.png +0 -0
  553. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/zoneExtension.png +0 -0
  554. data/lib/rubyfox/server/data/www/root/admin/assets/icons/tabs/zoneTraffic.png +0 -0
  555. data/lib/rubyfox/server/data/www/root/admin/expressInstall.swf +0 -0
  556. data/lib/rubyfox/server/data/www/root/admin/index.html +0 -124
  557. data/lib/rubyfox/server/data/www/root/admin/modules/Analytics.swf +0 -0
  558. data/lib/rubyfox/server/data/www/root/admin/modules/BanManager.swf +0 -0
  559. data/lib/rubyfox/server/data/www/root/admin/modules/BlueBoxMonitor.swf +0 -0
  560. data/lib/rubyfox/server/data/www/root/admin/modules/Console.swf +0 -0
  561. data/lib/rubyfox/server/data/www/root/admin/modules/Dashboard.swf +0 -0
  562. data/lib/rubyfox/server/data/www/root/admin/modules/ExtensionManager.swf +0 -0
  563. data/lib/rubyfox/server/data/www/root/admin/modules/LicenseManager.swf +0 -0
  564. data/lib/rubyfox/server/data/www/root/admin/modules/LogViewer.swf +0 -0
  565. data/lib/rubyfox/server/data/www/root/admin/modules/ServerConfigurator.swf +0 -0
  566. data/lib/rubyfox/server/data/www/root/admin/modules/ZoneConfigurator.swf +0 -0
  567. data/lib/rubyfox/server/data/www/root/admin/modules/ZoneMonitor.swf +0 -0
  568. data/lib/rubyfox/server/data/www/root/admin/swfobject.js +0 -4
  569. data/lib/rubyfox/server/data/www/root/examples/.keep +0 -0
  570. data/lib/rubyfox/server/data/www/sfs2x-ws.war +0 -0
  571. data/lib/rubyfox/server/data/www/sfs2x-ws.xml +0 -30
  572. data/lib/rubyfox/server/data/zones/BasicExamples.zone.xml +0 -147
@@ -0,0 +1,3240 @@
1
+ /*! (c) gotoAndPlay | All rights reserved */
2
+ (window["webpackJsonpapplication"] = window["webpackJsonpapplication"] || []).push([["vendors~module-0"],{
3
+
4
+ /***/ "./node_modules/chroma-js/chroma.js":
5
+ /*!******************************************!*\
6
+ !*** ./node_modules/chroma-js/chroma.js ***!
7
+ \******************************************/
8
+ /*! no static exports found */
9
+ /***/ (function(module, exports, __webpack_require__) {
10
+
11
+ /**
12
+ * chroma.js - JavaScript library for color conversions
13
+ *
14
+ * Copyright (c) 2011-2019, Gregor Aisch
15
+ * All rights reserved.
16
+ *
17
+ * Redistribution and use in source and binary forms, with or without
18
+ * modification, are permitted provided that the following conditions are met:
19
+ *
20
+ * 1. Redistributions of source code must retain the above copyright notice, this
21
+ * list of conditions and the following disclaimer.
22
+ *
23
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
24
+ * this list of conditions and the following disclaimer in the documentation
25
+ * and/or other materials provided with the distribution.
26
+ *
27
+ * 3. The name Gregor Aisch may not be used to endorse or promote products
28
+ * derived from this software without specific prior written permission.
29
+ *
30
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
31
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
32
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
33
+ * DISCLAIMED. IN NO EVENT SHALL GREGOR AISCH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
34
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
35
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
37
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
38
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
39
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40
+ *
41
+ * -------------------------------------------------------
42
+ *
43
+ * chroma.js includes colors from colorbrewer2.org, which are released under
44
+ * the following license:
45
+ *
46
+ * Copyright (c) 2002 Cynthia Brewer, Mark Harrower,
47
+ * and The Pennsylvania State University.
48
+ *
49
+ * Licensed under the Apache License, Version 2.0 (the "License");
50
+ * you may not use this file except in compliance with the License.
51
+ * You may obtain a copy of the License at
52
+ * http://www.apache.org/licenses/LICENSE-2.0
53
+ *
54
+ * Unless required by applicable law or agreed to in writing,
55
+ * software distributed under the License is distributed on an
56
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
57
+ * either express or implied. See the License for the specific
58
+ * language governing permissions and limitations under the License.
59
+ *
60
+ * ------------------------------------------------------
61
+ *
62
+ * Named colors are taken from X11 Color Names.
63
+ * http://www.w3.org/TR/css3-color/#svg-color
64
+ *
65
+ * @preserve
66
+ */
67
+
68
+ (function (global, factory) {
69
+ true ? module.exports = factory() :
70
+ undefined;
71
+ }(this, (function () { 'use strict';
72
+
73
+ var limit = function (x, min, max) {
74
+ if ( min === void 0 ) min=0;
75
+ if ( max === void 0 ) max=1;
76
+
77
+ return x < min ? min : x > max ? max : x;
78
+ };
79
+
80
+ var clip_rgb = function (rgb) {
81
+ rgb._clipped = false;
82
+ rgb._unclipped = rgb.slice(0);
83
+ for (var i=0; i<=3; i++) {
84
+ if (i < 3) {
85
+ if (rgb[i] < 0 || rgb[i] > 255) { rgb._clipped = true; }
86
+ rgb[i] = limit(rgb[i], 0, 255);
87
+ } else if (i === 3) {
88
+ rgb[i] = limit(rgb[i], 0, 1);
89
+ }
90
+ }
91
+ return rgb;
92
+ };
93
+
94
+ // ported from jQuery's $.type
95
+ var classToType = {};
96
+ for (var i = 0, list = ['Boolean', 'Number', 'String', 'Function', 'Array', 'Date', 'RegExp', 'Undefined', 'Null']; i < list.length; i += 1) {
97
+ var name = list[i];
98
+
99
+ classToType[("[object " + name + "]")] = name.toLowerCase();
100
+ }
101
+ var type = function(obj) {
102
+ return classToType[Object.prototype.toString.call(obj)] || "object";
103
+ };
104
+
105
+ var unpack = function (args, keyOrder) {
106
+ if ( keyOrder === void 0 ) keyOrder=null;
107
+
108
+ // if called with more than 3 arguments, we return the arguments
109
+ if (args.length >= 3) { return Array.prototype.slice.call(args); }
110
+ // with less than 3 args we check if first arg is object
111
+ // and use the keyOrder string to extract and sort properties
112
+ if (type(args[0]) == 'object' && keyOrder) {
113
+ return keyOrder.split('')
114
+ .filter(function (k) { return args[0][k] !== undefined; })
115
+ .map(function (k) { return args[0][k]; });
116
+ }
117
+ // otherwise we just return the first argument
118
+ // (which we suppose is an array of args)
119
+ return args[0];
120
+ };
121
+
122
+ var last = function (args) {
123
+ if (args.length < 2) { return null; }
124
+ var l = args.length-1;
125
+ if (type(args[l]) == 'string') { return args[l].toLowerCase(); }
126
+ return null;
127
+ };
128
+
129
+ var PI = Math.PI;
130
+
131
+ var utils = {
132
+ clip_rgb: clip_rgb,
133
+ limit: limit,
134
+ type: type,
135
+ unpack: unpack,
136
+ last: last,
137
+ PI: PI,
138
+ TWOPI: PI*2,
139
+ PITHIRD: PI/3,
140
+ DEG2RAD: PI / 180,
141
+ RAD2DEG: 180 / PI
142
+ };
143
+
144
+ var input = {
145
+ format: {},
146
+ autodetect: []
147
+ };
148
+
149
+ var last$1 = utils.last;
150
+ var clip_rgb$1 = utils.clip_rgb;
151
+ var type$1 = utils.type;
152
+
153
+
154
+ var Color = function Color() {
155
+ var args = [], len = arguments.length;
156
+ while ( len-- ) args[ len ] = arguments[ len ];
157
+
158
+ var me = this;
159
+ if (type$1(args[0]) === 'object' &&
160
+ args[0].constructor &&
161
+ args[0].constructor === this.constructor) {
162
+ // the argument is already a Color instance
163
+ return args[0];
164
+ }
165
+
166
+ // last argument could be the mode
167
+ var mode = last$1(args);
168
+ var autodetect = false;
169
+
170
+ if (!mode) {
171
+ autodetect = true;
172
+ if (!input.sorted) {
173
+ input.autodetect = input.autodetect.sort(function (a,b) { return b.p - a.p; });
174
+ input.sorted = true;
175
+ }
176
+ // auto-detect format
177
+ for (var i = 0, list = input.autodetect; i < list.length; i += 1) {
178
+ var chk = list[i];
179
+
180
+ mode = chk.test.apply(chk, args);
181
+ if (mode) { break; }
182
+ }
183
+ }
184
+
185
+ if (input.format[mode]) {
186
+ var rgb = input.format[mode].apply(null, autodetect ? args : args.slice(0,-1));
187
+ me._rgb = clip_rgb$1(rgb);
188
+ } else {
189
+ throw new Error('unknown format: '+args);
190
+ }
191
+
192
+ // add alpha channel
193
+ if (me._rgb.length === 3) { me._rgb.push(1); }
194
+ };
195
+
196
+ Color.prototype.toString = function toString () {
197
+ if (type$1(this.hex) == 'function') { return this.hex(); }
198
+ return ("[" + (this._rgb.join(',')) + "]");
199
+ };
200
+
201
+ var Color_1 = Color;
202
+
203
+ var chroma = function () {
204
+ var args = [], len = arguments.length;
205
+ while ( len-- ) args[ len ] = arguments[ len ];
206
+
207
+ return new (Function.prototype.bind.apply( chroma.Color, [ null ].concat( args) ));
208
+ };
209
+
210
+ chroma.Color = Color_1;
211
+ chroma.version = '2.1.0';
212
+
213
+ var chroma_1 = chroma;
214
+
215
+ var unpack$1 = utils.unpack;
216
+ var max = Math.max;
217
+
218
+ var rgb2cmyk = function () {
219
+ var args = [], len = arguments.length;
220
+ while ( len-- ) args[ len ] = arguments[ len ];
221
+
222
+ var ref = unpack$1(args, 'rgb');
223
+ var r = ref[0];
224
+ var g = ref[1];
225
+ var b = ref[2];
226
+ r = r / 255;
227
+ g = g / 255;
228
+ b = b / 255;
229
+ var k = 1 - max(r,max(g,b));
230
+ var f = k < 1 ? 1 / (1-k) : 0;
231
+ var c = (1-r-k) * f;
232
+ var m = (1-g-k) * f;
233
+ var y = (1-b-k) * f;
234
+ return [c,m,y,k];
235
+ };
236
+
237
+ var rgb2cmyk_1 = rgb2cmyk;
238
+
239
+ var unpack$2 = utils.unpack;
240
+
241
+ var cmyk2rgb = function () {
242
+ var args = [], len = arguments.length;
243
+ while ( len-- ) args[ len ] = arguments[ len ];
244
+
245
+ args = unpack$2(args, 'cmyk');
246
+ var c = args[0];
247
+ var m = args[1];
248
+ var y = args[2];
249
+ var k = args[3];
250
+ var alpha = args.length > 4 ? args[4] : 1;
251
+ if (k === 1) { return [0,0,0,alpha]; }
252
+ return [
253
+ c >= 1 ? 0 : 255 * (1-c) * (1-k), // r
254
+ m >= 1 ? 0 : 255 * (1-m) * (1-k), // g
255
+ y >= 1 ? 0 : 255 * (1-y) * (1-k), // b
256
+ alpha
257
+ ];
258
+ };
259
+
260
+ var cmyk2rgb_1 = cmyk2rgb;
261
+
262
+ var unpack$3 = utils.unpack;
263
+ var type$2 = utils.type;
264
+
265
+
266
+
267
+ Color_1.prototype.cmyk = function() {
268
+ return rgb2cmyk_1(this._rgb);
269
+ };
270
+
271
+ chroma_1.cmyk = function () {
272
+ var args = [], len = arguments.length;
273
+ while ( len-- ) args[ len ] = arguments[ len ];
274
+
275
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['cmyk']) ));
276
+ };
277
+
278
+ input.format.cmyk = cmyk2rgb_1;
279
+
280
+ input.autodetect.push({
281
+ p: 2,
282
+ test: function () {
283
+ var args = [], len = arguments.length;
284
+ while ( len-- ) args[ len ] = arguments[ len ];
285
+
286
+ args = unpack$3(args, 'cmyk');
287
+ if (type$2(args) === 'array' && args.length === 4) {
288
+ return 'cmyk';
289
+ }
290
+ }
291
+ });
292
+
293
+ var unpack$4 = utils.unpack;
294
+ var last$2 = utils.last;
295
+ var rnd = function (a) { return Math.round(a*100)/100; };
296
+
297
+ /*
298
+ * supported arguments:
299
+ * - hsl2css(h,s,l)
300
+ * - hsl2css(h,s,l,a)
301
+ * - hsl2css([h,s,l], mode)
302
+ * - hsl2css([h,s,l,a], mode)
303
+ * - hsl2css({h,s,l,a}, mode)
304
+ */
305
+ var hsl2css = function () {
306
+ var args = [], len = arguments.length;
307
+ while ( len-- ) args[ len ] = arguments[ len ];
308
+
309
+ var hsla = unpack$4(args, 'hsla');
310
+ var mode = last$2(args) || 'lsa';
311
+ hsla[0] = rnd(hsla[0] || 0);
312
+ hsla[1] = rnd(hsla[1]*100) + '%';
313
+ hsla[2] = rnd(hsla[2]*100) + '%';
314
+ if (mode === 'hsla' || (hsla.length > 3 && hsla[3]<1)) {
315
+ hsla[3] = hsla.length > 3 ? hsla[3] : 1;
316
+ mode = 'hsla';
317
+ } else {
318
+ hsla.length = 3;
319
+ }
320
+ return (mode + "(" + (hsla.join(',')) + ")");
321
+ };
322
+
323
+ var hsl2css_1 = hsl2css;
324
+
325
+ var unpack$5 = utils.unpack;
326
+
327
+ /*
328
+ * supported arguments:
329
+ * - rgb2hsl(r,g,b)
330
+ * - rgb2hsl(r,g,b,a)
331
+ * - rgb2hsl([r,g,b])
332
+ * - rgb2hsl([r,g,b,a])
333
+ * - rgb2hsl({r,g,b,a})
334
+ */
335
+ var rgb2hsl = function () {
336
+ var args = [], len = arguments.length;
337
+ while ( len-- ) args[ len ] = arguments[ len ];
338
+
339
+ args = unpack$5(args, 'rgba');
340
+ var r = args[0];
341
+ var g = args[1];
342
+ var b = args[2];
343
+
344
+ r /= 255;
345
+ g /= 255;
346
+ b /= 255;
347
+
348
+ var min = Math.min(r, g, b);
349
+ var max = Math.max(r, g, b);
350
+
351
+ var l = (max + min) / 2;
352
+ var s, h;
353
+
354
+ if (max === min){
355
+ s = 0;
356
+ h = Number.NaN;
357
+ } else {
358
+ s = l < 0.5 ? (max - min) / (max + min) : (max - min) / (2 - max - min);
359
+ }
360
+
361
+ if (r == max) { h = (g - b) / (max - min); }
362
+ else if (g == max) { h = 2 + (b - r) / (max - min); }
363
+ else if (b == max) { h = 4 + (r - g) / (max - min); }
364
+
365
+ h *= 60;
366
+ if (h < 0) { h += 360; }
367
+ if (args.length>3 && args[3]!==undefined) { return [h,s,l,args[3]]; }
368
+ return [h,s,l];
369
+ };
370
+
371
+ var rgb2hsl_1 = rgb2hsl;
372
+
373
+ var unpack$6 = utils.unpack;
374
+ var last$3 = utils.last;
375
+
376
+
377
+ var round = Math.round;
378
+
379
+ /*
380
+ * supported arguments:
381
+ * - rgb2css(r,g,b)
382
+ * - rgb2css(r,g,b,a)
383
+ * - rgb2css([r,g,b], mode)
384
+ * - rgb2css([r,g,b,a], mode)
385
+ * - rgb2css({r,g,b,a}, mode)
386
+ */
387
+ var rgb2css = function () {
388
+ var args = [], len = arguments.length;
389
+ while ( len-- ) args[ len ] = arguments[ len ];
390
+
391
+ var rgba = unpack$6(args, 'rgba');
392
+ var mode = last$3(args) || 'rgb';
393
+ if (mode.substr(0,3) == 'hsl') {
394
+ return hsl2css_1(rgb2hsl_1(rgba), mode);
395
+ }
396
+ rgba[0] = round(rgba[0]);
397
+ rgba[1] = round(rgba[1]);
398
+ rgba[2] = round(rgba[2]);
399
+ if (mode === 'rgba' || (rgba.length > 3 && rgba[3]<1)) {
400
+ rgba[3] = rgba.length > 3 ? rgba[3] : 1;
401
+ mode = 'rgba';
402
+ }
403
+ return (mode + "(" + (rgba.slice(0,mode==='rgb'?3:4).join(',')) + ")");
404
+ };
405
+
406
+ var rgb2css_1 = rgb2css;
407
+
408
+ var unpack$7 = utils.unpack;
409
+ var round$1 = Math.round;
410
+
411
+ var hsl2rgb = function () {
412
+ var assign;
413
+
414
+ var args = [], len = arguments.length;
415
+ while ( len-- ) args[ len ] = arguments[ len ];
416
+ args = unpack$7(args, 'hsl');
417
+ var h = args[0];
418
+ var s = args[1];
419
+ var l = args[2];
420
+ var r,g,b;
421
+ if (s === 0) {
422
+ r = g = b = l*255;
423
+ } else {
424
+ var t3 = [0,0,0];
425
+ var c = [0,0,0];
426
+ var t2 = l < 0.5 ? l * (1+s) : l+s-l*s;
427
+ var t1 = 2 * l - t2;
428
+ var h_ = h / 360;
429
+ t3[0] = h_ + 1/3;
430
+ t3[1] = h_;
431
+ t3[2] = h_ - 1/3;
432
+ for (var i=0; i<3; i++) {
433
+ if (t3[i] < 0) { t3[i] += 1; }
434
+ if (t3[i] > 1) { t3[i] -= 1; }
435
+ if (6 * t3[i] < 1)
436
+ { c[i] = t1 + (t2 - t1) * 6 * t3[i]; }
437
+ else if (2 * t3[i] < 1)
438
+ { c[i] = t2; }
439
+ else if (3 * t3[i] < 2)
440
+ { c[i] = t1 + (t2 - t1) * ((2 / 3) - t3[i]) * 6; }
441
+ else
442
+ { c[i] = t1; }
443
+ }
444
+ (assign = [round$1(c[0]*255),round$1(c[1]*255),round$1(c[2]*255)], r = assign[0], g = assign[1], b = assign[2]);
445
+ }
446
+ if (args.length > 3) {
447
+ // keep alpha channel
448
+ return [r,g,b,args[3]];
449
+ }
450
+ return [r,g,b,1];
451
+ };
452
+
453
+ var hsl2rgb_1 = hsl2rgb;
454
+
455
+ var RE_RGB = /^rgb\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*\)$/;
456
+ var RE_RGBA = /^rgba\(\s*(-?\d+),\s*(-?\d+)\s*,\s*(-?\d+)\s*,\s*([01]|[01]?\.\d+)\)$/;
457
+ var RE_RGB_PCT = /^rgb\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/;
458
+ var RE_RGBA_PCT = /^rgba\(\s*(-?\d+(?:\.\d+)?)%,\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/;
459
+ var RE_HSL = /^hsl\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*\)$/;
460
+ var RE_HSLA = /^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/;
461
+
462
+ var round$2 = Math.round;
463
+
464
+ var css2rgb = function (css) {
465
+ css = css.toLowerCase().trim();
466
+ var m;
467
+
468
+ if (input.format.named) {
469
+ try {
470
+ return input.format.named(css);
471
+ } catch (e) {
472
+ // eslint-disable-next-line
473
+ }
474
+ }
475
+
476
+ // rgb(250,20,0)
477
+ if ((m = css.match(RE_RGB))) {
478
+ var rgb = m.slice(1,4);
479
+ for (var i=0; i<3; i++) {
480
+ rgb[i] = +rgb[i];
481
+ }
482
+ rgb[3] = 1; // default alpha
483
+ return rgb;
484
+ }
485
+
486
+ // rgba(250,20,0,0.4)
487
+ if ((m = css.match(RE_RGBA))) {
488
+ var rgb$1 = m.slice(1,5);
489
+ for (var i$1=0; i$1<4; i$1++) {
490
+ rgb$1[i$1] = +rgb$1[i$1];
491
+ }
492
+ return rgb$1;
493
+ }
494
+
495
+ // rgb(100%,0%,0%)
496
+ if ((m = css.match(RE_RGB_PCT))) {
497
+ var rgb$2 = m.slice(1,4);
498
+ for (var i$2=0; i$2<3; i$2++) {
499
+ rgb$2[i$2] = round$2(rgb$2[i$2] * 2.55);
500
+ }
501
+ rgb$2[3] = 1; // default alpha
502
+ return rgb$2;
503
+ }
504
+
505
+ // rgba(100%,0%,0%,0.4)
506
+ if ((m = css.match(RE_RGBA_PCT))) {
507
+ var rgb$3 = m.slice(1,5);
508
+ for (var i$3=0; i$3<3; i$3++) {
509
+ rgb$3[i$3] = round$2(rgb$3[i$3] * 2.55);
510
+ }
511
+ rgb$3[3] = +rgb$3[3];
512
+ return rgb$3;
513
+ }
514
+
515
+ // hsl(0,100%,50%)
516
+ if ((m = css.match(RE_HSL))) {
517
+ var hsl = m.slice(1,4);
518
+ hsl[1] *= 0.01;
519
+ hsl[2] *= 0.01;
520
+ var rgb$4 = hsl2rgb_1(hsl);
521
+ rgb$4[3] = 1;
522
+ return rgb$4;
523
+ }
524
+
525
+ // hsla(0,100%,50%,0.5)
526
+ if ((m = css.match(RE_HSLA))) {
527
+ var hsl$1 = m.slice(1,4);
528
+ hsl$1[1] *= 0.01;
529
+ hsl$1[2] *= 0.01;
530
+ var rgb$5 = hsl2rgb_1(hsl$1);
531
+ rgb$5[3] = +m[4]; // default alpha = 1
532
+ return rgb$5;
533
+ }
534
+ };
535
+
536
+ css2rgb.test = function (s) {
537
+ return RE_RGB.test(s) ||
538
+ RE_RGBA.test(s) ||
539
+ RE_RGB_PCT.test(s) ||
540
+ RE_RGBA_PCT.test(s) ||
541
+ RE_HSL.test(s) ||
542
+ RE_HSLA.test(s);
543
+ };
544
+
545
+ var css2rgb_1 = css2rgb;
546
+
547
+ var type$3 = utils.type;
548
+
549
+
550
+
551
+
552
+ Color_1.prototype.css = function(mode) {
553
+ return rgb2css_1(this._rgb, mode);
554
+ };
555
+
556
+ chroma_1.css = function () {
557
+ var args = [], len = arguments.length;
558
+ while ( len-- ) args[ len ] = arguments[ len ];
559
+
560
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['css']) ));
561
+ };
562
+
563
+ input.format.css = css2rgb_1;
564
+
565
+ input.autodetect.push({
566
+ p: 5,
567
+ test: function (h) {
568
+ var rest = [], len = arguments.length - 1;
569
+ while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
570
+
571
+ if (!rest.length && type$3(h) === 'string' && css2rgb_1.test(h)) {
572
+ return 'css';
573
+ }
574
+ }
575
+ });
576
+
577
+ var unpack$8 = utils.unpack;
578
+
579
+ input.format.gl = function () {
580
+ var args = [], len = arguments.length;
581
+ while ( len-- ) args[ len ] = arguments[ len ];
582
+
583
+ var rgb = unpack$8(args, 'rgba');
584
+ rgb[0] *= 255;
585
+ rgb[1] *= 255;
586
+ rgb[2] *= 255;
587
+ return rgb;
588
+ };
589
+
590
+ chroma_1.gl = function () {
591
+ var args = [], len = arguments.length;
592
+ while ( len-- ) args[ len ] = arguments[ len ];
593
+
594
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['gl']) ));
595
+ };
596
+
597
+ Color_1.prototype.gl = function() {
598
+ var rgb = this._rgb;
599
+ return [rgb[0]/255, rgb[1]/255, rgb[2]/255, rgb[3]];
600
+ };
601
+
602
+ var unpack$9 = utils.unpack;
603
+
604
+ var rgb2hcg = function () {
605
+ var args = [], len = arguments.length;
606
+ while ( len-- ) args[ len ] = arguments[ len ];
607
+
608
+ var ref = unpack$9(args, 'rgb');
609
+ var r = ref[0];
610
+ var g = ref[1];
611
+ var b = ref[2];
612
+ var min = Math.min(r, g, b);
613
+ var max = Math.max(r, g, b);
614
+ var delta = max - min;
615
+ var c = delta * 100 / 255;
616
+ var _g = min / (255 - delta) * 100;
617
+ var h;
618
+ if (delta === 0) {
619
+ h = Number.NaN;
620
+ } else {
621
+ if (r === max) { h = (g - b) / delta; }
622
+ if (g === max) { h = 2+(b - r) / delta; }
623
+ if (b === max) { h = 4+(r - g) / delta; }
624
+ h *= 60;
625
+ if (h < 0) { h += 360; }
626
+ }
627
+ return [h, c, _g];
628
+ };
629
+
630
+ var rgb2hcg_1 = rgb2hcg;
631
+
632
+ var unpack$a = utils.unpack;
633
+ var floor = Math.floor;
634
+
635
+ /*
636
+ * this is basically just HSV with some minor tweaks
637
+ *
638
+ * hue.. [0..360]
639
+ * chroma .. [0..1]
640
+ * grayness .. [0..1]
641
+ */
642
+
643
+ var hcg2rgb = function () {
644
+ var assign, assign$1, assign$2, assign$3, assign$4, assign$5;
645
+
646
+ var args = [], len = arguments.length;
647
+ while ( len-- ) args[ len ] = arguments[ len ];
648
+ args = unpack$a(args, 'hcg');
649
+ var h = args[0];
650
+ var c = args[1];
651
+ var _g = args[2];
652
+ var r,g,b;
653
+ _g = _g * 255;
654
+ var _c = c * 255;
655
+ if (c === 0) {
656
+ r = g = b = _g;
657
+ } else {
658
+ if (h === 360) { h = 0; }
659
+ if (h > 360) { h -= 360; }
660
+ if (h < 0) { h += 360; }
661
+ h /= 60;
662
+ var i = floor(h);
663
+ var f = h - i;
664
+ var p = _g * (1 - c);
665
+ var q = p + _c * (1 - f);
666
+ var t = p + _c * f;
667
+ var v = p + _c;
668
+ switch (i) {
669
+ case 0: (assign = [v, t, p], r = assign[0], g = assign[1], b = assign[2]); break
670
+ case 1: (assign$1 = [q, v, p], r = assign$1[0], g = assign$1[1], b = assign$1[2]); break
671
+ case 2: (assign$2 = [p, v, t], r = assign$2[0], g = assign$2[1], b = assign$2[2]); break
672
+ case 3: (assign$3 = [p, q, v], r = assign$3[0], g = assign$3[1], b = assign$3[2]); break
673
+ case 4: (assign$4 = [t, p, v], r = assign$4[0], g = assign$4[1], b = assign$4[2]); break
674
+ case 5: (assign$5 = [v, p, q], r = assign$5[0], g = assign$5[1], b = assign$5[2]); break
675
+ }
676
+ }
677
+ return [r, g, b, args.length > 3 ? args[3] : 1];
678
+ };
679
+
680
+ var hcg2rgb_1 = hcg2rgb;
681
+
682
+ var unpack$b = utils.unpack;
683
+ var type$4 = utils.type;
684
+
685
+
686
+
687
+
688
+
689
+
690
+ Color_1.prototype.hcg = function() {
691
+ return rgb2hcg_1(this._rgb);
692
+ };
693
+
694
+ chroma_1.hcg = function () {
695
+ var args = [], len = arguments.length;
696
+ while ( len-- ) args[ len ] = arguments[ len ];
697
+
698
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hcg']) ));
699
+ };
700
+
701
+ input.format.hcg = hcg2rgb_1;
702
+
703
+ input.autodetect.push({
704
+ p: 1,
705
+ test: function () {
706
+ var args = [], len = arguments.length;
707
+ while ( len-- ) args[ len ] = arguments[ len ];
708
+
709
+ args = unpack$b(args, 'hcg');
710
+ if (type$4(args) === 'array' && args.length === 3) {
711
+ return 'hcg';
712
+ }
713
+ }
714
+ });
715
+
716
+ var unpack$c = utils.unpack;
717
+ var last$4 = utils.last;
718
+ var round$3 = Math.round;
719
+
720
+ var rgb2hex = function () {
721
+ var args = [], len = arguments.length;
722
+ while ( len-- ) args[ len ] = arguments[ len ];
723
+
724
+ var ref = unpack$c(args, 'rgba');
725
+ var r = ref[0];
726
+ var g = ref[1];
727
+ var b = ref[2];
728
+ var a = ref[3];
729
+ var mode = last$4(args) || 'auto';
730
+ if (a === undefined) { a = 1; }
731
+ if (mode === 'auto') {
732
+ mode = a < 1 ? 'rgba' : 'rgb';
733
+ }
734
+ r = round$3(r);
735
+ g = round$3(g);
736
+ b = round$3(b);
737
+ var u = r << 16 | g << 8 | b;
738
+ var str = "000000" + u.toString(16); //#.toUpperCase();
739
+ str = str.substr(str.length - 6);
740
+ var hxa = '0' + round$3(a * 255).toString(16);
741
+ hxa = hxa.substr(hxa.length - 2);
742
+ switch (mode.toLowerCase()) {
743
+ case 'rgba': return ("#" + str + hxa);
744
+ case 'argb': return ("#" + hxa + str);
745
+ default: return ("#" + str);
746
+ }
747
+ };
748
+
749
+ var rgb2hex_1 = rgb2hex;
750
+
751
+ var RE_HEX = /^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/;
752
+ var RE_HEXA = /^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/;
753
+
754
+ var hex2rgb = function (hex) {
755
+ if (hex.match(RE_HEX)) {
756
+ // remove optional leading #
757
+ if (hex.length === 4 || hex.length === 7) {
758
+ hex = hex.substr(1);
759
+ }
760
+ // expand short-notation to full six-digit
761
+ if (hex.length === 3) {
762
+ hex = hex.split('');
763
+ hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2];
764
+ }
765
+ var u = parseInt(hex, 16);
766
+ var r = u >> 16;
767
+ var g = u >> 8 & 0xFF;
768
+ var b = u & 0xFF;
769
+ return [r,g,b,1];
770
+ }
771
+
772
+ // match rgba hex format, eg #FF000077
773
+ if (hex.match(RE_HEXA)) {
774
+ if (hex.length === 5 || hex.length === 9) {
775
+ // remove optional leading #
776
+ hex = hex.substr(1);
777
+ }
778
+ // expand short-notation to full eight-digit
779
+ if (hex.length === 4) {
780
+ hex = hex.split('');
781
+ hex = hex[0]+hex[0]+hex[1]+hex[1]+hex[2]+hex[2]+hex[3]+hex[3];
782
+ }
783
+ var u$1 = parseInt(hex, 16);
784
+ var r$1 = u$1 >> 24 & 0xFF;
785
+ var g$1 = u$1 >> 16 & 0xFF;
786
+ var b$1 = u$1 >> 8 & 0xFF;
787
+ var a = Math.round((u$1 & 0xFF) / 0xFF * 100) / 100;
788
+ return [r$1,g$1,b$1,a];
789
+ }
790
+
791
+ // we used to check for css colors here
792
+ // if _input.css? and rgb = _input.css hex
793
+ // return rgb
794
+
795
+ throw new Error(("unknown hex color: " + hex));
796
+ };
797
+
798
+ var hex2rgb_1 = hex2rgb;
799
+
800
+ var type$5 = utils.type;
801
+
802
+
803
+
804
+
805
+ Color_1.prototype.hex = function(mode) {
806
+ return rgb2hex_1(this._rgb, mode);
807
+ };
808
+
809
+ chroma_1.hex = function () {
810
+ var args = [], len = arguments.length;
811
+ while ( len-- ) args[ len ] = arguments[ len ];
812
+
813
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hex']) ));
814
+ };
815
+
816
+ input.format.hex = hex2rgb_1;
817
+ input.autodetect.push({
818
+ p: 4,
819
+ test: function (h) {
820
+ var rest = [], len = arguments.length - 1;
821
+ while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
822
+
823
+ if (!rest.length && type$5(h) === 'string' && [3,4,5,6,7,8,9].indexOf(h.length) >= 0) {
824
+ return 'hex';
825
+ }
826
+ }
827
+ });
828
+
829
+ var unpack$d = utils.unpack;
830
+ var TWOPI = utils.TWOPI;
831
+ var min = Math.min;
832
+ var sqrt = Math.sqrt;
833
+ var acos = Math.acos;
834
+
835
+ var rgb2hsi = function () {
836
+ var args = [], len = arguments.length;
837
+ while ( len-- ) args[ len ] = arguments[ len ];
838
+
839
+ /*
840
+ borrowed from here:
841
+ http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/rgb2hsi.cpp
842
+ */
843
+ var ref = unpack$d(args, 'rgb');
844
+ var r = ref[0];
845
+ var g = ref[1];
846
+ var b = ref[2];
847
+ r /= 255;
848
+ g /= 255;
849
+ b /= 255;
850
+ var h;
851
+ var min_ = min(r,g,b);
852
+ var i = (r+g+b) / 3;
853
+ var s = i > 0 ? 1 - min_/i : 0;
854
+ if (s === 0) {
855
+ h = NaN;
856
+ } else {
857
+ h = ((r-g)+(r-b)) / 2;
858
+ h /= sqrt((r-g)*(r-g) + (r-b)*(g-b));
859
+ h = acos(h);
860
+ if (b > g) {
861
+ h = TWOPI - h;
862
+ }
863
+ h /= TWOPI;
864
+ }
865
+ return [h*360,s,i];
866
+ };
867
+
868
+ var rgb2hsi_1 = rgb2hsi;
869
+
870
+ var unpack$e = utils.unpack;
871
+ var limit$1 = utils.limit;
872
+ var TWOPI$1 = utils.TWOPI;
873
+ var PITHIRD = utils.PITHIRD;
874
+ var cos = Math.cos;
875
+
876
+ /*
877
+ * hue [0..360]
878
+ * saturation [0..1]
879
+ * intensity [0..1]
880
+ */
881
+ var hsi2rgb = function () {
882
+ var args = [], len = arguments.length;
883
+ while ( len-- ) args[ len ] = arguments[ len ];
884
+
885
+ /*
886
+ borrowed from here:
887
+ http://hummer.stanford.edu/museinfo/doc/examples/humdrum/keyscape2/hsi2rgb.cpp
888
+ */
889
+ args = unpack$e(args, 'hsi');
890
+ var h = args[0];
891
+ var s = args[1];
892
+ var i = args[2];
893
+ var r,g,b;
894
+
895
+ if (isNaN(h)) { h = 0; }
896
+ if (isNaN(s)) { s = 0; }
897
+ // normalize hue
898
+ if (h > 360) { h -= 360; }
899
+ if (h < 0) { h += 360; }
900
+ h /= 360;
901
+ if (h < 1/3) {
902
+ b = (1-s)/3;
903
+ r = (1+s*cos(TWOPI$1*h)/cos(PITHIRD-TWOPI$1*h))/3;
904
+ g = 1 - (b+r);
905
+ } else if (h < 2/3) {
906
+ h -= 1/3;
907
+ r = (1-s)/3;
908
+ g = (1+s*cos(TWOPI$1*h)/cos(PITHIRD-TWOPI$1*h))/3;
909
+ b = 1 - (r+g);
910
+ } else {
911
+ h -= 2/3;
912
+ g = (1-s)/3;
913
+ b = (1+s*cos(TWOPI$1*h)/cos(PITHIRD-TWOPI$1*h))/3;
914
+ r = 1 - (g+b);
915
+ }
916
+ r = limit$1(i*r*3);
917
+ g = limit$1(i*g*3);
918
+ b = limit$1(i*b*3);
919
+ return [r*255, g*255, b*255, args.length > 3 ? args[3] : 1];
920
+ };
921
+
922
+ var hsi2rgb_1 = hsi2rgb;
923
+
924
+ var unpack$f = utils.unpack;
925
+ var type$6 = utils.type;
926
+
927
+
928
+
929
+
930
+
931
+
932
+ Color_1.prototype.hsi = function() {
933
+ return rgb2hsi_1(this._rgb);
934
+ };
935
+
936
+ chroma_1.hsi = function () {
937
+ var args = [], len = arguments.length;
938
+ while ( len-- ) args[ len ] = arguments[ len ];
939
+
940
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hsi']) ));
941
+ };
942
+
943
+ input.format.hsi = hsi2rgb_1;
944
+
945
+ input.autodetect.push({
946
+ p: 2,
947
+ test: function () {
948
+ var args = [], len = arguments.length;
949
+ while ( len-- ) args[ len ] = arguments[ len ];
950
+
951
+ args = unpack$f(args, 'hsi');
952
+ if (type$6(args) === 'array' && args.length === 3) {
953
+ return 'hsi';
954
+ }
955
+ }
956
+ });
957
+
958
+ var unpack$g = utils.unpack;
959
+ var type$7 = utils.type;
960
+
961
+
962
+
963
+
964
+
965
+
966
+ Color_1.prototype.hsl = function() {
967
+ return rgb2hsl_1(this._rgb);
968
+ };
969
+
970
+ chroma_1.hsl = function () {
971
+ var args = [], len = arguments.length;
972
+ while ( len-- ) args[ len ] = arguments[ len ];
973
+
974
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hsl']) ));
975
+ };
976
+
977
+ input.format.hsl = hsl2rgb_1;
978
+
979
+ input.autodetect.push({
980
+ p: 2,
981
+ test: function () {
982
+ var args = [], len = arguments.length;
983
+ while ( len-- ) args[ len ] = arguments[ len ];
984
+
985
+ args = unpack$g(args, 'hsl');
986
+ if (type$7(args) === 'array' && args.length === 3) {
987
+ return 'hsl';
988
+ }
989
+ }
990
+ });
991
+
992
+ var unpack$h = utils.unpack;
993
+ var min$1 = Math.min;
994
+ var max$1 = Math.max;
995
+
996
+ /*
997
+ * supported arguments:
998
+ * - rgb2hsv(r,g,b)
999
+ * - rgb2hsv([r,g,b])
1000
+ * - rgb2hsv({r,g,b})
1001
+ */
1002
+ var rgb2hsl$1 = function () {
1003
+ var args = [], len = arguments.length;
1004
+ while ( len-- ) args[ len ] = arguments[ len ];
1005
+
1006
+ args = unpack$h(args, 'rgb');
1007
+ var r = args[0];
1008
+ var g = args[1];
1009
+ var b = args[2];
1010
+ var min_ = min$1(r, g, b);
1011
+ var max_ = max$1(r, g, b);
1012
+ var delta = max_ - min_;
1013
+ var h,s,v;
1014
+ v = max_ / 255.0;
1015
+ if (max_ === 0) {
1016
+ h = Number.NaN;
1017
+ s = 0;
1018
+ } else {
1019
+ s = delta / max_;
1020
+ if (r === max_) { h = (g - b) / delta; }
1021
+ if (g === max_) { h = 2+(b - r) / delta; }
1022
+ if (b === max_) { h = 4+(r - g) / delta; }
1023
+ h *= 60;
1024
+ if (h < 0) { h += 360; }
1025
+ }
1026
+ return [h, s, v]
1027
+ };
1028
+
1029
+ var rgb2hsv = rgb2hsl$1;
1030
+
1031
+ var unpack$i = utils.unpack;
1032
+ var floor$1 = Math.floor;
1033
+
1034
+ var hsv2rgb = function () {
1035
+ var assign, assign$1, assign$2, assign$3, assign$4, assign$5;
1036
+
1037
+ var args = [], len = arguments.length;
1038
+ while ( len-- ) args[ len ] = arguments[ len ];
1039
+ args = unpack$i(args, 'hsv');
1040
+ var h = args[0];
1041
+ var s = args[1];
1042
+ var v = args[2];
1043
+ var r,g,b;
1044
+ v *= 255;
1045
+ if (s === 0) {
1046
+ r = g = b = v;
1047
+ } else {
1048
+ if (h === 360) { h = 0; }
1049
+ if (h > 360) { h -= 360; }
1050
+ if (h < 0) { h += 360; }
1051
+ h /= 60;
1052
+
1053
+ var i = floor$1(h);
1054
+ var f = h - i;
1055
+ var p = v * (1 - s);
1056
+ var q = v * (1 - s * f);
1057
+ var t = v * (1 - s * (1 - f));
1058
+
1059
+ switch (i) {
1060
+ case 0: (assign = [v, t, p], r = assign[0], g = assign[1], b = assign[2]); break
1061
+ case 1: (assign$1 = [q, v, p], r = assign$1[0], g = assign$1[1], b = assign$1[2]); break
1062
+ case 2: (assign$2 = [p, v, t], r = assign$2[0], g = assign$2[1], b = assign$2[2]); break
1063
+ case 3: (assign$3 = [p, q, v], r = assign$3[0], g = assign$3[1], b = assign$3[2]); break
1064
+ case 4: (assign$4 = [t, p, v], r = assign$4[0], g = assign$4[1], b = assign$4[2]); break
1065
+ case 5: (assign$5 = [v, p, q], r = assign$5[0], g = assign$5[1], b = assign$5[2]); break
1066
+ }
1067
+ }
1068
+ return [r,g,b,args.length > 3?args[3]:1];
1069
+ };
1070
+
1071
+ var hsv2rgb_1 = hsv2rgb;
1072
+
1073
+ var unpack$j = utils.unpack;
1074
+ var type$8 = utils.type;
1075
+
1076
+
1077
+
1078
+
1079
+
1080
+
1081
+ Color_1.prototype.hsv = function() {
1082
+ return rgb2hsv(this._rgb);
1083
+ };
1084
+
1085
+ chroma_1.hsv = function () {
1086
+ var args = [], len = arguments.length;
1087
+ while ( len-- ) args[ len ] = arguments[ len ];
1088
+
1089
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hsv']) ));
1090
+ };
1091
+
1092
+ input.format.hsv = hsv2rgb_1;
1093
+
1094
+ input.autodetect.push({
1095
+ p: 2,
1096
+ test: function () {
1097
+ var args = [], len = arguments.length;
1098
+ while ( len-- ) args[ len ] = arguments[ len ];
1099
+
1100
+ args = unpack$j(args, 'hsv');
1101
+ if (type$8(args) === 'array' && args.length === 3) {
1102
+ return 'hsv';
1103
+ }
1104
+ }
1105
+ });
1106
+
1107
+ var labConstants = {
1108
+ // Corresponds roughly to RGB brighter/darker
1109
+ Kn: 18,
1110
+
1111
+ // D65 standard referent
1112
+ Xn: 0.950470,
1113
+ Yn: 1,
1114
+ Zn: 1.088830,
1115
+
1116
+ t0: 0.137931034, // 4 / 29
1117
+ t1: 0.206896552, // 6 / 29
1118
+ t2: 0.12841855, // 3 * t1 * t1
1119
+ t3: 0.008856452, // t1 * t1 * t1
1120
+ };
1121
+
1122
+ var unpack$k = utils.unpack;
1123
+ var pow = Math.pow;
1124
+
1125
+ var rgb2lab = function () {
1126
+ var args = [], len = arguments.length;
1127
+ while ( len-- ) args[ len ] = arguments[ len ];
1128
+
1129
+ var ref = unpack$k(args, 'rgb');
1130
+ var r = ref[0];
1131
+ var g = ref[1];
1132
+ var b = ref[2];
1133
+ var ref$1 = rgb2xyz(r,g,b);
1134
+ var x = ref$1[0];
1135
+ var y = ref$1[1];
1136
+ var z = ref$1[2];
1137
+ var l = 116 * y - 16;
1138
+ return [l < 0 ? 0 : l, 500 * (x - y), 200 * (y - z)];
1139
+ };
1140
+
1141
+ var rgb_xyz = function (r) {
1142
+ if ((r /= 255) <= 0.04045) { return r / 12.92; }
1143
+ return pow((r + 0.055) / 1.055, 2.4);
1144
+ };
1145
+
1146
+ var xyz_lab = function (t) {
1147
+ if (t > labConstants.t3) { return pow(t, 1 / 3); }
1148
+ return t / labConstants.t2 + labConstants.t0;
1149
+ };
1150
+
1151
+ var rgb2xyz = function (r,g,b) {
1152
+ r = rgb_xyz(r);
1153
+ g = rgb_xyz(g);
1154
+ b = rgb_xyz(b);
1155
+ var x = xyz_lab((0.4124564 * r + 0.3575761 * g + 0.1804375 * b) / labConstants.Xn);
1156
+ var y = xyz_lab((0.2126729 * r + 0.7151522 * g + 0.0721750 * b) / labConstants.Yn);
1157
+ var z = xyz_lab((0.0193339 * r + 0.1191920 * g + 0.9503041 * b) / labConstants.Zn);
1158
+ return [x,y,z];
1159
+ };
1160
+
1161
+ var rgb2lab_1 = rgb2lab;
1162
+
1163
+ var unpack$l = utils.unpack;
1164
+ var pow$1 = Math.pow;
1165
+
1166
+ /*
1167
+ * L* [0..100]
1168
+ * a [-100..100]
1169
+ * b [-100..100]
1170
+ */
1171
+ var lab2rgb = function () {
1172
+ var args = [], len = arguments.length;
1173
+ while ( len-- ) args[ len ] = arguments[ len ];
1174
+
1175
+ args = unpack$l(args, 'lab');
1176
+ var l = args[0];
1177
+ var a = args[1];
1178
+ var b = args[2];
1179
+ var x,y,z, r,g,b_;
1180
+
1181
+ y = (l + 16) / 116;
1182
+ x = isNaN(a) ? y : y + a / 500;
1183
+ z = isNaN(b) ? y : y - b / 200;
1184
+
1185
+ y = labConstants.Yn * lab_xyz(y);
1186
+ x = labConstants.Xn * lab_xyz(x);
1187
+ z = labConstants.Zn * lab_xyz(z);
1188
+
1189
+ r = xyz_rgb(3.2404542 * x - 1.5371385 * y - 0.4985314 * z); // D65 -> sRGB
1190
+ g = xyz_rgb(-0.9692660 * x + 1.8760108 * y + 0.0415560 * z);
1191
+ b_ = xyz_rgb(0.0556434 * x - 0.2040259 * y + 1.0572252 * z);
1192
+
1193
+ return [r,g,b_,args.length > 3 ? args[3] : 1];
1194
+ };
1195
+
1196
+ var xyz_rgb = function (r) {
1197
+ return 255 * (r <= 0.00304 ? 12.92 * r : 1.055 * pow$1(r, 1 / 2.4) - 0.055)
1198
+ };
1199
+
1200
+ var lab_xyz = function (t) {
1201
+ return t > labConstants.t1 ? t * t * t : labConstants.t2 * (t - labConstants.t0)
1202
+ };
1203
+
1204
+ var lab2rgb_1 = lab2rgb;
1205
+
1206
+ var unpack$m = utils.unpack;
1207
+ var type$9 = utils.type;
1208
+
1209
+
1210
+
1211
+
1212
+
1213
+
1214
+ Color_1.prototype.lab = function() {
1215
+ return rgb2lab_1(this._rgb);
1216
+ };
1217
+
1218
+ chroma_1.lab = function () {
1219
+ var args = [], len = arguments.length;
1220
+ while ( len-- ) args[ len ] = arguments[ len ];
1221
+
1222
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['lab']) ));
1223
+ };
1224
+
1225
+ input.format.lab = lab2rgb_1;
1226
+
1227
+ input.autodetect.push({
1228
+ p: 2,
1229
+ test: function () {
1230
+ var args = [], len = arguments.length;
1231
+ while ( len-- ) args[ len ] = arguments[ len ];
1232
+
1233
+ args = unpack$m(args, 'lab');
1234
+ if (type$9(args) === 'array' && args.length === 3) {
1235
+ return 'lab';
1236
+ }
1237
+ }
1238
+ });
1239
+
1240
+ var unpack$n = utils.unpack;
1241
+ var RAD2DEG = utils.RAD2DEG;
1242
+ var sqrt$1 = Math.sqrt;
1243
+ var atan2 = Math.atan2;
1244
+ var round$4 = Math.round;
1245
+
1246
+ var lab2lch = function () {
1247
+ var args = [], len = arguments.length;
1248
+ while ( len-- ) args[ len ] = arguments[ len ];
1249
+
1250
+ var ref = unpack$n(args, 'lab');
1251
+ var l = ref[0];
1252
+ var a = ref[1];
1253
+ var b = ref[2];
1254
+ var c = sqrt$1(a * a + b * b);
1255
+ var h = (atan2(b, a) * RAD2DEG + 360) % 360;
1256
+ if (round$4(c*10000) === 0) { h = Number.NaN; }
1257
+ return [l, c, h];
1258
+ };
1259
+
1260
+ var lab2lch_1 = lab2lch;
1261
+
1262
+ var unpack$o = utils.unpack;
1263
+
1264
+
1265
+
1266
+ var rgb2lch = function () {
1267
+ var args = [], len = arguments.length;
1268
+ while ( len-- ) args[ len ] = arguments[ len ];
1269
+
1270
+ var ref = unpack$o(args, 'rgb');
1271
+ var r = ref[0];
1272
+ var g = ref[1];
1273
+ var b = ref[2];
1274
+ var ref$1 = rgb2lab_1(r,g,b);
1275
+ var l = ref$1[0];
1276
+ var a = ref$1[1];
1277
+ var b_ = ref$1[2];
1278
+ return lab2lch_1(l,a,b_);
1279
+ };
1280
+
1281
+ var rgb2lch_1 = rgb2lch;
1282
+
1283
+ var unpack$p = utils.unpack;
1284
+ var DEG2RAD = utils.DEG2RAD;
1285
+ var sin = Math.sin;
1286
+ var cos$1 = Math.cos;
1287
+
1288
+ var lch2lab = function () {
1289
+ var args = [], len = arguments.length;
1290
+ while ( len-- ) args[ len ] = arguments[ len ];
1291
+
1292
+ /*
1293
+ Convert from a qualitative parameter h and a quantitative parameter l to a 24-bit pixel.
1294
+ These formulas were invented by David Dalrymple to obtain maximum contrast without going
1295
+ out of gamut if the parameters are in the range 0-1.
1296
+
1297
+ A saturation multiplier was added by Gregor Aisch
1298
+ */
1299
+ var ref = unpack$p(args, 'lch');
1300
+ var l = ref[0];
1301
+ var c = ref[1];
1302
+ var h = ref[2];
1303
+ if (isNaN(h)) { h = 0; }
1304
+ h = h * DEG2RAD;
1305
+ return [l, cos$1(h) * c, sin(h) * c]
1306
+ };
1307
+
1308
+ var lch2lab_1 = lch2lab;
1309
+
1310
+ var unpack$q = utils.unpack;
1311
+
1312
+
1313
+
1314
+ var lch2rgb = function () {
1315
+ var args = [], len = arguments.length;
1316
+ while ( len-- ) args[ len ] = arguments[ len ];
1317
+
1318
+ args = unpack$q(args, 'lch');
1319
+ var l = args[0];
1320
+ var c = args[1];
1321
+ var h = args[2];
1322
+ var ref = lch2lab_1 (l,c,h);
1323
+ var L = ref[0];
1324
+ var a = ref[1];
1325
+ var b_ = ref[2];
1326
+ var ref$1 = lab2rgb_1 (L,a,b_);
1327
+ var r = ref$1[0];
1328
+ var g = ref$1[1];
1329
+ var b = ref$1[2];
1330
+ return [r, g, b, args.length > 3 ? args[3] : 1];
1331
+ };
1332
+
1333
+ var lch2rgb_1 = lch2rgb;
1334
+
1335
+ var unpack$r = utils.unpack;
1336
+
1337
+
1338
+ var hcl2rgb = function () {
1339
+ var args = [], len = arguments.length;
1340
+ while ( len-- ) args[ len ] = arguments[ len ];
1341
+
1342
+ var hcl = unpack$r(args, 'hcl').reverse();
1343
+ return lch2rgb_1.apply(void 0, hcl);
1344
+ };
1345
+
1346
+ var hcl2rgb_1 = hcl2rgb;
1347
+
1348
+ var unpack$s = utils.unpack;
1349
+ var type$a = utils.type;
1350
+
1351
+
1352
+
1353
+
1354
+
1355
+
1356
+ Color_1.prototype.lch = function() { return rgb2lch_1(this._rgb); };
1357
+ Color_1.prototype.hcl = function() { return rgb2lch_1(this._rgb).reverse(); };
1358
+
1359
+ chroma_1.lch = function () {
1360
+ var args = [], len = arguments.length;
1361
+ while ( len-- ) args[ len ] = arguments[ len ];
1362
+
1363
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['lch']) ));
1364
+ };
1365
+ chroma_1.hcl = function () {
1366
+ var args = [], len = arguments.length;
1367
+ while ( len-- ) args[ len ] = arguments[ len ];
1368
+
1369
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['hcl']) ));
1370
+ };
1371
+
1372
+ input.format.lch = lch2rgb_1;
1373
+ input.format.hcl = hcl2rgb_1;
1374
+
1375
+ ['lch','hcl'].forEach(function (m) { return input.autodetect.push({
1376
+ p: 2,
1377
+ test: function () {
1378
+ var args = [], len = arguments.length;
1379
+ while ( len-- ) args[ len ] = arguments[ len ];
1380
+
1381
+ args = unpack$s(args, m);
1382
+ if (type$a(args) === 'array' && args.length === 3) {
1383
+ return m;
1384
+ }
1385
+ }
1386
+ }); });
1387
+
1388
+ /**
1389
+ X11 color names
1390
+
1391
+ http://www.w3.org/TR/css3-color/#svg-color
1392
+ */
1393
+
1394
+ var w3cx11 = {
1395
+ aliceblue: '#f0f8ff',
1396
+ antiquewhite: '#faebd7',
1397
+ aqua: '#00ffff',
1398
+ aquamarine: '#7fffd4',
1399
+ azure: '#f0ffff',
1400
+ beige: '#f5f5dc',
1401
+ bisque: '#ffe4c4',
1402
+ black: '#000000',
1403
+ blanchedalmond: '#ffebcd',
1404
+ blue: '#0000ff',
1405
+ blueviolet: '#8a2be2',
1406
+ brown: '#a52a2a',
1407
+ burlywood: '#deb887',
1408
+ cadetblue: '#5f9ea0',
1409
+ chartreuse: '#7fff00',
1410
+ chocolate: '#d2691e',
1411
+ coral: '#ff7f50',
1412
+ cornflower: '#6495ed',
1413
+ cornflowerblue: '#6495ed',
1414
+ cornsilk: '#fff8dc',
1415
+ crimson: '#dc143c',
1416
+ cyan: '#00ffff',
1417
+ darkblue: '#00008b',
1418
+ darkcyan: '#008b8b',
1419
+ darkgoldenrod: '#b8860b',
1420
+ darkgray: '#a9a9a9',
1421
+ darkgreen: '#006400',
1422
+ darkgrey: '#a9a9a9',
1423
+ darkkhaki: '#bdb76b',
1424
+ darkmagenta: '#8b008b',
1425
+ darkolivegreen: '#556b2f',
1426
+ darkorange: '#ff8c00',
1427
+ darkorchid: '#9932cc',
1428
+ darkred: '#8b0000',
1429
+ darksalmon: '#e9967a',
1430
+ darkseagreen: '#8fbc8f',
1431
+ darkslateblue: '#483d8b',
1432
+ darkslategray: '#2f4f4f',
1433
+ darkslategrey: '#2f4f4f',
1434
+ darkturquoise: '#00ced1',
1435
+ darkviolet: '#9400d3',
1436
+ deeppink: '#ff1493',
1437
+ deepskyblue: '#00bfff',
1438
+ dimgray: '#696969',
1439
+ dimgrey: '#696969',
1440
+ dodgerblue: '#1e90ff',
1441
+ firebrick: '#b22222',
1442
+ floralwhite: '#fffaf0',
1443
+ forestgreen: '#228b22',
1444
+ fuchsia: '#ff00ff',
1445
+ gainsboro: '#dcdcdc',
1446
+ ghostwhite: '#f8f8ff',
1447
+ gold: '#ffd700',
1448
+ goldenrod: '#daa520',
1449
+ gray: '#808080',
1450
+ green: '#008000',
1451
+ greenyellow: '#adff2f',
1452
+ grey: '#808080',
1453
+ honeydew: '#f0fff0',
1454
+ hotpink: '#ff69b4',
1455
+ indianred: '#cd5c5c',
1456
+ indigo: '#4b0082',
1457
+ ivory: '#fffff0',
1458
+ khaki: '#f0e68c',
1459
+ laserlemon: '#ffff54',
1460
+ lavender: '#e6e6fa',
1461
+ lavenderblush: '#fff0f5',
1462
+ lawngreen: '#7cfc00',
1463
+ lemonchiffon: '#fffacd',
1464
+ lightblue: '#add8e6',
1465
+ lightcoral: '#f08080',
1466
+ lightcyan: '#e0ffff',
1467
+ lightgoldenrod: '#fafad2',
1468
+ lightgoldenrodyellow: '#fafad2',
1469
+ lightgray: '#d3d3d3',
1470
+ lightgreen: '#90ee90',
1471
+ lightgrey: '#d3d3d3',
1472
+ lightpink: '#ffb6c1',
1473
+ lightsalmon: '#ffa07a',
1474
+ lightseagreen: '#20b2aa',
1475
+ lightskyblue: '#87cefa',
1476
+ lightslategray: '#778899',
1477
+ lightslategrey: '#778899',
1478
+ lightsteelblue: '#b0c4de',
1479
+ lightyellow: '#ffffe0',
1480
+ lime: '#00ff00',
1481
+ limegreen: '#32cd32',
1482
+ linen: '#faf0e6',
1483
+ magenta: '#ff00ff',
1484
+ maroon: '#800000',
1485
+ maroon2: '#7f0000',
1486
+ maroon3: '#b03060',
1487
+ mediumaquamarine: '#66cdaa',
1488
+ mediumblue: '#0000cd',
1489
+ mediumorchid: '#ba55d3',
1490
+ mediumpurple: '#9370db',
1491
+ mediumseagreen: '#3cb371',
1492
+ mediumslateblue: '#7b68ee',
1493
+ mediumspringgreen: '#00fa9a',
1494
+ mediumturquoise: '#48d1cc',
1495
+ mediumvioletred: '#c71585',
1496
+ midnightblue: '#191970',
1497
+ mintcream: '#f5fffa',
1498
+ mistyrose: '#ffe4e1',
1499
+ moccasin: '#ffe4b5',
1500
+ navajowhite: '#ffdead',
1501
+ navy: '#000080',
1502
+ oldlace: '#fdf5e6',
1503
+ olive: '#808000',
1504
+ olivedrab: '#6b8e23',
1505
+ orange: '#ffa500',
1506
+ orangered: '#ff4500',
1507
+ orchid: '#da70d6',
1508
+ palegoldenrod: '#eee8aa',
1509
+ palegreen: '#98fb98',
1510
+ paleturquoise: '#afeeee',
1511
+ palevioletred: '#db7093',
1512
+ papayawhip: '#ffefd5',
1513
+ peachpuff: '#ffdab9',
1514
+ peru: '#cd853f',
1515
+ pink: '#ffc0cb',
1516
+ plum: '#dda0dd',
1517
+ powderblue: '#b0e0e6',
1518
+ purple: '#800080',
1519
+ purple2: '#7f007f',
1520
+ purple3: '#a020f0',
1521
+ rebeccapurple: '#663399',
1522
+ red: '#ff0000',
1523
+ rosybrown: '#bc8f8f',
1524
+ royalblue: '#4169e1',
1525
+ saddlebrown: '#8b4513',
1526
+ salmon: '#fa8072',
1527
+ sandybrown: '#f4a460',
1528
+ seagreen: '#2e8b57',
1529
+ seashell: '#fff5ee',
1530
+ sienna: '#a0522d',
1531
+ silver: '#c0c0c0',
1532
+ skyblue: '#87ceeb',
1533
+ slateblue: '#6a5acd',
1534
+ slategray: '#708090',
1535
+ slategrey: '#708090',
1536
+ snow: '#fffafa',
1537
+ springgreen: '#00ff7f',
1538
+ steelblue: '#4682b4',
1539
+ tan: '#d2b48c',
1540
+ teal: '#008080',
1541
+ thistle: '#d8bfd8',
1542
+ tomato: '#ff6347',
1543
+ turquoise: '#40e0d0',
1544
+ violet: '#ee82ee',
1545
+ wheat: '#f5deb3',
1546
+ white: '#ffffff',
1547
+ whitesmoke: '#f5f5f5',
1548
+ yellow: '#ffff00',
1549
+ yellowgreen: '#9acd32'
1550
+ };
1551
+
1552
+ var w3cx11_1 = w3cx11;
1553
+
1554
+ var type$b = utils.type;
1555
+
1556
+
1557
+
1558
+
1559
+
1560
+ Color_1.prototype.name = function() {
1561
+ var hex = rgb2hex_1(this._rgb, 'rgb');
1562
+ for (var i = 0, list = Object.keys(w3cx11_1); i < list.length; i += 1) {
1563
+ var n = list[i];
1564
+
1565
+ if (w3cx11_1[n] === hex) { return n.toLowerCase(); }
1566
+ }
1567
+ return hex;
1568
+ };
1569
+
1570
+ input.format.named = function (name) {
1571
+ name = name.toLowerCase();
1572
+ if (w3cx11_1[name]) { return hex2rgb_1(w3cx11_1[name]); }
1573
+ throw new Error('unknown color name: '+name);
1574
+ };
1575
+
1576
+ input.autodetect.push({
1577
+ p: 5,
1578
+ test: function (h) {
1579
+ var rest = [], len = arguments.length - 1;
1580
+ while ( len-- > 0 ) rest[ len ] = arguments[ len + 1 ];
1581
+
1582
+ if (!rest.length && type$b(h) === 'string' && w3cx11_1[h.toLowerCase()]) {
1583
+ return 'named';
1584
+ }
1585
+ }
1586
+ });
1587
+
1588
+ var unpack$t = utils.unpack;
1589
+
1590
+ var rgb2num = function () {
1591
+ var args = [], len = arguments.length;
1592
+ while ( len-- ) args[ len ] = arguments[ len ];
1593
+
1594
+ var ref = unpack$t(args, 'rgb');
1595
+ var r = ref[0];
1596
+ var g = ref[1];
1597
+ var b = ref[2];
1598
+ return (r << 16) + (g << 8) + b;
1599
+ };
1600
+
1601
+ var rgb2num_1 = rgb2num;
1602
+
1603
+ var type$c = utils.type;
1604
+
1605
+ var num2rgb = function (num) {
1606
+ if (type$c(num) == "number" && num >= 0 && num <= 0xFFFFFF) {
1607
+ var r = num >> 16;
1608
+ var g = (num >> 8) & 0xFF;
1609
+ var b = num & 0xFF;
1610
+ return [r,g,b,1];
1611
+ }
1612
+ throw new Error("unknown num color: "+num);
1613
+ };
1614
+
1615
+ var num2rgb_1 = num2rgb;
1616
+
1617
+ var type$d = utils.type;
1618
+
1619
+
1620
+
1621
+ Color_1.prototype.num = function() {
1622
+ return rgb2num_1(this._rgb);
1623
+ };
1624
+
1625
+ chroma_1.num = function () {
1626
+ var args = [], len = arguments.length;
1627
+ while ( len-- ) args[ len ] = arguments[ len ];
1628
+
1629
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['num']) ));
1630
+ };
1631
+
1632
+ input.format.num = num2rgb_1;
1633
+
1634
+ input.autodetect.push({
1635
+ p: 5,
1636
+ test: function () {
1637
+ var args = [], len = arguments.length;
1638
+ while ( len-- ) args[ len ] = arguments[ len ];
1639
+
1640
+ if (args.length === 1 && type$d(args[0]) === 'number' && args[0] >= 0 && args[0] <= 0xFFFFFF) {
1641
+ return 'num';
1642
+ }
1643
+ }
1644
+ });
1645
+
1646
+ var unpack$u = utils.unpack;
1647
+ var type$e = utils.type;
1648
+ var round$5 = Math.round;
1649
+
1650
+ Color_1.prototype.rgb = function(rnd) {
1651
+ if ( rnd === void 0 ) rnd=true;
1652
+
1653
+ if (rnd === false) { return this._rgb.slice(0,3); }
1654
+ return this._rgb.slice(0,3).map(round$5);
1655
+ };
1656
+
1657
+ Color_1.prototype.rgba = function(rnd) {
1658
+ if ( rnd === void 0 ) rnd=true;
1659
+
1660
+ return this._rgb.slice(0,4).map(function (v,i) {
1661
+ return i<3 ? (rnd === false ? v : round$5(v)) : v;
1662
+ });
1663
+ };
1664
+
1665
+ chroma_1.rgb = function () {
1666
+ var args = [], len = arguments.length;
1667
+ while ( len-- ) args[ len ] = arguments[ len ];
1668
+
1669
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['rgb']) ));
1670
+ };
1671
+
1672
+ input.format.rgb = function () {
1673
+ var args = [], len = arguments.length;
1674
+ while ( len-- ) args[ len ] = arguments[ len ];
1675
+
1676
+ var rgba = unpack$u(args, 'rgba');
1677
+ if (rgba[3] === undefined) { rgba[3] = 1; }
1678
+ return rgba;
1679
+ };
1680
+
1681
+ input.autodetect.push({
1682
+ p: 3,
1683
+ test: function () {
1684
+ var args = [], len = arguments.length;
1685
+ while ( len-- ) args[ len ] = arguments[ len ];
1686
+
1687
+ args = unpack$u(args, 'rgba');
1688
+ if (type$e(args) === 'array' && (args.length === 3 ||
1689
+ args.length === 4 && type$e(args[3]) == 'number' && args[3] >= 0 && args[3] <= 1)) {
1690
+ return 'rgb';
1691
+ }
1692
+ }
1693
+ });
1694
+
1695
+ /*
1696
+ * Based on implementation by Neil Bartlett
1697
+ * https://github.com/neilbartlett/color-temperature
1698
+ */
1699
+
1700
+ var log = Math.log;
1701
+
1702
+ var temperature2rgb = function (kelvin) {
1703
+ var temp = kelvin / 100;
1704
+ var r,g,b;
1705
+ if (temp < 66) {
1706
+ r = 255;
1707
+ g = -155.25485562709179 - 0.44596950469579133 * (g = temp-2) + 104.49216199393888 * log(g);
1708
+ b = temp < 20 ? 0 : -254.76935184120902 + 0.8274096064007395 * (b = temp-10) + 115.67994401066147 * log(b);
1709
+ } else {
1710
+ r = 351.97690566805693 + 0.114206453784165 * (r = temp-55) - 40.25366309332127 * log(r);
1711
+ g = 325.4494125711974 + 0.07943456536662342 * (g = temp-50) - 28.0852963507957 * log(g);
1712
+ b = 255;
1713
+ }
1714
+ return [r,g,b,1];
1715
+ };
1716
+
1717
+ var temperature2rgb_1 = temperature2rgb;
1718
+
1719
+ /*
1720
+ * Based on implementation by Neil Bartlett
1721
+ * https://github.com/neilbartlett/color-temperature
1722
+ **/
1723
+
1724
+
1725
+ var unpack$v = utils.unpack;
1726
+ var round$6 = Math.round;
1727
+
1728
+ var rgb2temperature = function () {
1729
+ var args = [], len = arguments.length;
1730
+ while ( len-- ) args[ len ] = arguments[ len ];
1731
+
1732
+ var rgb = unpack$v(args, 'rgb');
1733
+ var r = rgb[0], b = rgb[2];
1734
+ var minTemp = 1000;
1735
+ var maxTemp = 40000;
1736
+ var eps = 0.4;
1737
+ var temp;
1738
+ while (maxTemp - minTemp > eps) {
1739
+ temp = (maxTemp + minTemp) * 0.5;
1740
+ var rgb$1 = temperature2rgb_1(temp);
1741
+ if ((rgb$1[2] / rgb$1[0]) >= (b / r)) {
1742
+ maxTemp = temp;
1743
+ } else {
1744
+ minTemp = temp;
1745
+ }
1746
+ }
1747
+ return round$6(temp);
1748
+ };
1749
+
1750
+ var rgb2temperature_1 = rgb2temperature;
1751
+
1752
+ Color_1.prototype.temp =
1753
+ Color_1.prototype.kelvin =
1754
+ Color_1.prototype.temperature = function() {
1755
+ return rgb2temperature_1(this._rgb);
1756
+ };
1757
+
1758
+ chroma_1.temp =
1759
+ chroma_1.kelvin =
1760
+ chroma_1.temperature = function () {
1761
+ var args = [], len = arguments.length;
1762
+ while ( len-- ) args[ len ] = arguments[ len ];
1763
+
1764
+ return new (Function.prototype.bind.apply( Color_1, [ null ].concat( args, ['temp']) ));
1765
+ };
1766
+
1767
+ input.format.temp =
1768
+ input.format.kelvin =
1769
+ input.format.temperature = temperature2rgb_1;
1770
+
1771
+ var type$f = utils.type;
1772
+
1773
+ Color_1.prototype.alpha = function(a, mutate) {
1774
+ if ( mutate === void 0 ) mutate=false;
1775
+
1776
+ if (a !== undefined && type$f(a) === 'number') {
1777
+ if (mutate) {
1778
+ this._rgb[3] = a;
1779
+ return this;
1780
+ }
1781
+ return new Color_1([this._rgb[0], this._rgb[1], this._rgb[2], a], 'rgb');
1782
+ }
1783
+ return this._rgb[3];
1784
+ };
1785
+
1786
+ Color_1.prototype.clipped = function() {
1787
+ return this._rgb._clipped || false;
1788
+ };
1789
+
1790
+ Color_1.prototype.darken = function(amount) {
1791
+ if ( amount === void 0 ) amount=1;
1792
+
1793
+ var me = this;
1794
+ var lab = me.lab();
1795
+ lab[0] -= labConstants.Kn * amount;
1796
+ return new Color_1(lab, 'lab').alpha(me.alpha(), true);
1797
+ };
1798
+
1799
+ Color_1.prototype.brighten = function(amount) {
1800
+ if ( amount === void 0 ) amount=1;
1801
+
1802
+ return this.darken(-amount);
1803
+ };
1804
+
1805
+ Color_1.prototype.darker = Color_1.prototype.darken;
1806
+ Color_1.prototype.brighter = Color_1.prototype.brighten;
1807
+
1808
+ Color_1.prototype.get = function(mc) {
1809
+ var ref = mc.split('.');
1810
+ var mode = ref[0];
1811
+ var channel = ref[1];
1812
+ var src = this[mode]();
1813
+ if (channel) {
1814
+ var i = mode.indexOf(channel);
1815
+ if (i > -1) { return src[i]; }
1816
+ throw new Error(("unknown channel " + channel + " in mode " + mode));
1817
+ } else {
1818
+ return src;
1819
+ }
1820
+ };
1821
+
1822
+ var type$g = utils.type;
1823
+ var pow$2 = Math.pow;
1824
+
1825
+ var EPS = 1e-7;
1826
+ var MAX_ITER = 20;
1827
+
1828
+ Color_1.prototype.luminance = function(lum) {
1829
+ if (lum !== undefined && type$g(lum) === 'number') {
1830
+ if (lum === 0) {
1831
+ // return pure black
1832
+ return new Color_1([0,0,0,this._rgb[3]], 'rgb');
1833
+ }
1834
+ if (lum === 1) {
1835
+ // return pure white
1836
+ return new Color_1([255,255,255,this._rgb[3]], 'rgb');
1837
+ }
1838
+ // compute new color using...
1839
+ var cur_lum = this.luminance();
1840
+ var mode = 'rgb';
1841
+ var max_iter = MAX_ITER;
1842
+
1843
+ var test = function (low, high) {
1844
+ var mid = low.interpolate(high, 0.5, mode);
1845
+ var lm = mid.luminance();
1846
+ if (Math.abs(lum - lm) < EPS || !max_iter--) {
1847
+ // close enough
1848
+ return mid;
1849
+ }
1850
+ return lm > lum ? test(low, mid) : test(mid, high);
1851
+ };
1852
+
1853
+ var rgb = (cur_lum > lum ? test(new Color_1([0,0,0]), this) : test(this, new Color_1([255,255,255]))).rgb();
1854
+ return new Color_1(rgb.concat( [this._rgb[3]]));
1855
+ }
1856
+ return rgb2luminance.apply(void 0, (this._rgb).slice(0,3));
1857
+ };
1858
+
1859
+
1860
+ var rgb2luminance = function (r,g,b) {
1861
+ // relative luminance
1862
+ // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
1863
+ r = luminance_x(r);
1864
+ g = luminance_x(g);
1865
+ b = luminance_x(b);
1866
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b;
1867
+ };
1868
+
1869
+ var luminance_x = function (x) {
1870
+ x /= 255;
1871
+ return x <= 0.03928 ? x/12.92 : pow$2((x+0.055)/1.055, 2.4);
1872
+ };
1873
+
1874
+ var interpolator = {};
1875
+
1876
+ var type$h = utils.type;
1877
+
1878
+
1879
+ var mix = function (col1, col2, f) {
1880
+ if ( f === void 0 ) f=0.5;
1881
+ var rest = [], len = arguments.length - 3;
1882
+ while ( len-- > 0 ) rest[ len ] = arguments[ len + 3 ];
1883
+
1884
+ var mode = rest[0] || 'lrgb';
1885
+ if (!interpolator[mode] && !rest.length) {
1886
+ // fall back to the first supported mode
1887
+ mode = Object.keys(interpolator)[0];
1888
+ }
1889
+ if (!interpolator[mode]) {
1890
+ throw new Error(("interpolation mode " + mode + " is not defined"));
1891
+ }
1892
+ if (type$h(col1) !== 'object') { col1 = new Color_1(col1); }
1893
+ if (type$h(col2) !== 'object') { col2 = new Color_1(col2); }
1894
+ return interpolator[mode](col1, col2, f)
1895
+ .alpha(col1.alpha() + f * (col2.alpha() - col1.alpha()));
1896
+ };
1897
+
1898
+ Color_1.prototype.mix =
1899
+ Color_1.prototype.interpolate = function(col2, f) {
1900
+ if ( f === void 0 ) f=0.5;
1901
+ var rest = [], len = arguments.length - 2;
1902
+ while ( len-- > 0 ) rest[ len ] = arguments[ len + 2 ];
1903
+
1904
+ return mix.apply(void 0, [ this, col2, f ].concat( rest ));
1905
+ };
1906
+
1907
+ Color_1.prototype.premultiply = function(mutate) {
1908
+ if ( mutate === void 0 ) mutate=false;
1909
+
1910
+ var rgb = this._rgb;
1911
+ var a = rgb[3];
1912
+ if (mutate) {
1913
+ this._rgb = [rgb[0]*a, rgb[1]*a, rgb[2]*a, a];
1914
+ return this;
1915
+ } else {
1916
+ return new Color_1([rgb[0]*a, rgb[1]*a, rgb[2]*a, a], 'rgb');
1917
+ }
1918
+ };
1919
+
1920
+ Color_1.prototype.saturate = function(amount) {
1921
+ if ( amount === void 0 ) amount=1;
1922
+
1923
+ var me = this;
1924
+ var lch = me.lch();
1925
+ lch[1] += labConstants.Kn * amount;
1926
+ if (lch[1] < 0) { lch[1] = 0; }
1927
+ return new Color_1(lch, 'lch').alpha(me.alpha(), true);
1928
+ };
1929
+
1930
+ Color_1.prototype.desaturate = function(amount) {
1931
+ if ( amount === void 0 ) amount=1;
1932
+
1933
+ return this.saturate(-amount);
1934
+ };
1935
+
1936
+ var type$i = utils.type;
1937
+
1938
+ Color_1.prototype.set = function(mc, value, mutate) {
1939
+ if ( mutate === void 0 ) mutate=false;
1940
+
1941
+ var ref = mc.split('.');
1942
+ var mode = ref[0];
1943
+ var channel = ref[1];
1944
+ var src = this[mode]();
1945
+ if (channel) {
1946
+ var i = mode.indexOf(channel);
1947
+ if (i > -1) {
1948
+ if (type$i(value) == 'string') {
1949
+ switch(value.charAt(0)) {
1950
+ case '+': src[i] += +value; break;
1951
+ case '-': src[i] += +value; break;
1952
+ case '*': src[i] *= +(value.substr(1)); break;
1953
+ case '/': src[i] /= +(value.substr(1)); break;
1954
+ default: src[i] = +value;
1955
+ }
1956
+ } else if (type$i(value) === 'number') {
1957
+ src[i] = value;
1958
+ } else {
1959
+ throw new Error("unsupported value for Color.set");
1960
+ }
1961
+ var out = new Color_1(src, mode);
1962
+ if (mutate) {
1963
+ this._rgb = out._rgb;
1964
+ return this;
1965
+ }
1966
+ return out;
1967
+ }
1968
+ throw new Error(("unknown channel " + channel + " in mode " + mode));
1969
+ } else {
1970
+ return src;
1971
+ }
1972
+ };
1973
+
1974
+ var rgb$1 = function (col1, col2, f) {
1975
+ var xyz0 = col1._rgb;
1976
+ var xyz1 = col2._rgb;
1977
+ return new Color_1(
1978
+ xyz0[0] + f * (xyz1[0]-xyz0[0]),
1979
+ xyz0[1] + f * (xyz1[1]-xyz0[1]),
1980
+ xyz0[2] + f * (xyz1[2]-xyz0[2]),
1981
+ 'rgb'
1982
+ )
1983
+ };
1984
+
1985
+ // register interpolator
1986
+ interpolator.rgb = rgb$1;
1987
+
1988
+ var sqrt$2 = Math.sqrt;
1989
+ var pow$3 = Math.pow;
1990
+
1991
+ var lrgb = function (col1, col2, f) {
1992
+ var ref = col1._rgb;
1993
+ var x1 = ref[0];
1994
+ var y1 = ref[1];
1995
+ var z1 = ref[2];
1996
+ var ref$1 = col2._rgb;
1997
+ var x2 = ref$1[0];
1998
+ var y2 = ref$1[1];
1999
+ var z2 = ref$1[2];
2000
+ return new Color_1(
2001
+ sqrt$2(pow$3(x1,2) * (1-f) + pow$3(x2,2) * f),
2002
+ sqrt$2(pow$3(y1,2) * (1-f) + pow$3(y2,2) * f),
2003
+ sqrt$2(pow$3(z1,2) * (1-f) + pow$3(z2,2) * f),
2004
+ 'rgb'
2005
+ )
2006
+ };
2007
+
2008
+ // register interpolator
2009
+ interpolator.lrgb = lrgb;
2010
+
2011
+ var lab$1 = function (col1, col2, f) {
2012
+ var xyz0 = col1.lab();
2013
+ var xyz1 = col2.lab();
2014
+ return new Color_1(
2015
+ xyz0[0] + f * (xyz1[0]-xyz0[0]),
2016
+ xyz0[1] + f * (xyz1[1]-xyz0[1]),
2017
+ xyz0[2] + f * (xyz1[2]-xyz0[2]),
2018
+ 'lab'
2019
+ )
2020
+ };
2021
+
2022
+ // register interpolator
2023
+ interpolator.lab = lab$1;
2024
+
2025
+ var _hsx = function (col1, col2, f, m) {
2026
+ var assign, assign$1;
2027
+
2028
+ var xyz0, xyz1;
2029
+ if (m === 'hsl') {
2030
+ xyz0 = col1.hsl();
2031
+ xyz1 = col2.hsl();
2032
+ } else if (m === 'hsv') {
2033
+ xyz0 = col1.hsv();
2034
+ xyz1 = col2.hsv();
2035
+ } else if (m === 'hcg') {
2036
+ xyz0 = col1.hcg();
2037
+ xyz1 = col2.hcg();
2038
+ } else if (m === 'hsi') {
2039
+ xyz0 = col1.hsi();
2040
+ xyz1 = col2.hsi();
2041
+ } else if (m === 'lch' || m === 'hcl') {
2042
+ m = 'hcl';
2043
+ xyz0 = col1.hcl();
2044
+ xyz1 = col2.hcl();
2045
+ }
2046
+
2047
+ var hue0, hue1, sat0, sat1, lbv0, lbv1;
2048
+ if (m.substr(0, 1) === 'h') {
2049
+ (assign = xyz0, hue0 = assign[0], sat0 = assign[1], lbv0 = assign[2]);
2050
+ (assign$1 = xyz1, hue1 = assign$1[0], sat1 = assign$1[1], lbv1 = assign$1[2]);
2051
+ }
2052
+
2053
+ var sat, hue, lbv, dh;
2054
+
2055
+ if (!isNaN(hue0) && !isNaN(hue1)) {
2056
+ // both colors have hue
2057
+ if (hue1 > hue0 && hue1 - hue0 > 180) {
2058
+ dh = hue1-(hue0+360);
2059
+ } else if (hue1 < hue0 && hue0 - hue1 > 180) {
2060
+ dh = hue1+360-hue0;
2061
+ } else{
2062
+ dh = hue1 - hue0;
2063
+ }
2064
+ hue = hue0 + f * dh;
2065
+ } else if (!isNaN(hue0)) {
2066
+ hue = hue0;
2067
+ if ((lbv1 == 1 || lbv1 == 0) && m != 'hsv') { sat = sat0; }
2068
+ } else if (!isNaN(hue1)) {
2069
+ hue = hue1;
2070
+ if ((lbv0 == 1 || lbv0 == 0) && m != 'hsv') { sat = sat1; }
2071
+ } else {
2072
+ hue = Number.NaN;
2073
+ }
2074
+
2075
+ if (sat === undefined) { sat = sat0 + f * (sat1 - sat0); }
2076
+ lbv = lbv0 + f * (lbv1-lbv0);
2077
+ return new Color_1([hue, sat, lbv], m);
2078
+ };
2079
+
2080
+ var lch$1 = function (col1, col2, f) {
2081
+ return _hsx(col1, col2, f, 'lch');
2082
+ };
2083
+
2084
+ // register interpolator
2085
+ interpolator.lch = lch$1;
2086
+ interpolator.hcl = lch$1;
2087
+
2088
+ var num$1 = function (col1, col2, f) {
2089
+ var c1 = col1.num();
2090
+ var c2 = col2.num();
2091
+ return new Color_1(c1 + f * (c2-c1), 'num')
2092
+ };
2093
+
2094
+ // register interpolator
2095
+ interpolator.num = num$1;
2096
+
2097
+ var hcg$1 = function (col1, col2, f) {
2098
+ return _hsx(col1, col2, f, 'hcg');
2099
+ };
2100
+
2101
+ // register interpolator
2102
+ interpolator.hcg = hcg$1;
2103
+
2104
+ var hsi$1 = function (col1, col2, f) {
2105
+ return _hsx(col1, col2, f, 'hsi');
2106
+ };
2107
+
2108
+ // register interpolator
2109
+ interpolator.hsi = hsi$1;
2110
+
2111
+ var hsl$1 = function (col1, col2, f) {
2112
+ return _hsx(col1, col2, f, 'hsl');
2113
+ };
2114
+
2115
+ // register interpolator
2116
+ interpolator.hsl = hsl$1;
2117
+
2118
+ var hsv$1 = function (col1, col2, f) {
2119
+ return _hsx(col1, col2, f, 'hsv');
2120
+ };
2121
+
2122
+ // register interpolator
2123
+ interpolator.hsv = hsv$1;
2124
+
2125
+ var clip_rgb$2 = utils.clip_rgb;
2126
+ var pow$4 = Math.pow;
2127
+ var sqrt$3 = Math.sqrt;
2128
+ var PI$1 = Math.PI;
2129
+ var cos$2 = Math.cos;
2130
+ var sin$1 = Math.sin;
2131
+ var atan2$1 = Math.atan2;
2132
+
2133
+ var average = function (colors, mode, weights) {
2134
+ if ( mode === void 0 ) mode='lrgb';
2135
+ if ( weights === void 0 ) weights=null;
2136
+
2137
+ var l = colors.length;
2138
+ if (!weights) { weights = Array.from(new Array(l)).map(function () { return 1; }); }
2139
+ // normalize weights
2140
+ var k = l / weights.reduce(function(a, b) { return a + b; });
2141
+ weights.forEach(function (w,i) { weights[i] *= k; });
2142
+ // convert colors to Color objects
2143
+ colors = colors.map(function (c) { return new Color_1(c); });
2144
+ if (mode === 'lrgb') {
2145
+ return _average_lrgb(colors, weights)
2146
+ }
2147
+ var first = colors.shift();
2148
+ var xyz = first.get(mode);
2149
+ var cnt = [];
2150
+ var dx = 0;
2151
+ var dy = 0;
2152
+ // initial color
2153
+ for (var i=0; i<xyz.length; i++) {
2154
+ xyz[i] = (xyz[i] || 0) * weights[0];
2155
+ cnt.push(isNaN(xyz[i]) ? 0 : weights[0]);
2156
+ if (mode.charAt(i) === 'h' && !isNaN(xyz[i])) {
2157
+ var A = xyz[i] / 180 * PI$1;
2158
+ dx += cos$2(A) * weights[0];
2159
+ dy += sin$1(A) * weights[0];
2160
+ }
2161
+ }
2162
+
2163
+ var alpha = first.alpha() * weights[0];
2164
+ colors.forEach(function (c,ci) {
2165
+ var xyz2 = c.get(mode);
2166
+ alpha += c.alpha() * weights[ci+1];
2167
+ for (var i=0; i<xyz.length; i++) {
2168
+ if (!isNaN(xyz2[i])) {
2169
+ cnt[i] += weights[ci+1];
2170
+ if (mode.charAt(i) === 'h') {
2171
+ var A = xyz2[i] / 180 * PI$1;
2172
+ dx += cos$2(A) * weights[ci+1];
2173
+ dy += sin$1(A) * weights[ci+1];
2174
+ } else {
2175
+ xyz[i] += xyz2[i] * weights[ci+1];
2176
+ }
2177
+ }
2178
+ }
2179
+ });
2180
+
2181
+ for (var i$1=0; i$1<xyz.length; i$1++) {
2182
+ if (mode.charAt(i$1) === 'h') {
2183
+ var A$1 = atan2$1(dy / cnt[i$1], dx / cnt[i$1]) / PI$1 * 180;
2184
+ while (A$1 < 0) { A$1 += 360; }
2185
+ while (A$1 >= 360) { A$1 -= 360; }
2186
+ xyz[i$1] = A$1;
2187
+ } else {
2188
+ xyz[i$1] = xyz[i$1]/cnt[i$1];
2189
+ }
2190
+ }
2191
+ alpha /= l;
2192
+ return (new Color_1(xyz, mode)).alpha(alpha > 0.99999 ? 1 : alpha, true);
2193
+ };
2194
+
2195
+
2196
+ var _average_lrgb = function (colors, weights) {
2197
+ var l = colors.length;
2198
+ var xyz = [0,0,0,0];
2199
+ for (var i=0; i < colors.length; i++) {
2200
+ var col = colors[i];
2201
+ var f = weights[i] / l;
2202
+ var rgb = col._rgb;
2203
+ xyz[0] += pow$4(rgb[0],2) * f;
2204
+ xyz[1] += pow$4(rgb[1],2) * f;
2205
+ xyz[2] += pow$4(rgb[2],2) * f;
2206
+ xyz[3] += rgb[3] * f;
2207
+ }
2208
+ xyz[0] = sqrt$3(xyz[0]);
2209
+ xyz[1] = sqrt$3(xyz[1]);
2210
+ xyz[2] = sqrt$3(xyz[2]);
2211
+ if (xyz[3] > 0.9999999) { xyz[3] = 1; }
2212
+ return new Color_1(clip_rgb$2(xyz));
2213
+ };
2214
+
2215
+ // minimal multi-purpose interface
2216
+
2217
+ // @requires utils color analyze
2218
+
2219
+
2220
+ var type$j = utils.type;
2221
+
2222
+ var pow$5 = Math.pow;
2223
+
2224
+ var scale = function(colors) {
2225
+
2226
+ // constructor
2227
+ var _mode = 'rgb';
2228
+ var _nacol = chroma_1('#ccc');
2229
+ var _spread = 0;
2230
+ // const _fixed = false;
2231
+ var _domain = [0, 1];
2232
+ var _pos = [];
2233
+ var _padding = [0,0];
2234
+ var _classes = false;
2235
+ var _colors = [];
2236
+ var _out = false;
2237
+ var _min = 0;
2238
+ var _max = 1;
2239
+ var _correctLightness = false;
2240
+ var _colorCache = {};
2241
+ var _useCache = true;
2242
+ var _gamma = 1;
2243
+
2244
+ // private methods
2245
+
2246
+ var setColors = function(colors) {
2247
+ colors = colors || ['#fff', '#000'];
2248
+ if (colors && type$j(colors) === 'string' && chroma_1.brewer &&
2249
+ chroma_1.brewer[colors.toLowerCase()]) {
2250
+ colors = chroma_1.brewer[colors.toLowerCase()];
2251
+ }
2252
+ if (type$j(colors) === 'array') {
2253
+ // handle single color
2254
+ if (colors.length === 1) {
2255
+ colors = [colors[0], colors[0]];
2256
+ }
2257
+ // make a copy of the colors
2258
+ colors = colors.slice(0);
2259
+ // convert to chroma classes
2260
+ for (var c=0; c<colors.length; c++) {
2261
+ colors[c] = chroma_1(colors[c]);
2262
+ }
2263
+ // auto-fill color position
2264
+ _pos.length = 0;
2265
+ for (var c$1=0; c$1<colors.length; c$1++) {
2266
+ _pos.push(c$1/(colors.length-1));
2267
+ }
2268
+ }
2269
+ resetCache();
2270
+ return _colors = colors;
2271
+ };
2272
+
2273
+ var getClass = function(value) {
2274
+ if (_classes != null) {
2275
+ var n = _classes.length-1;
2276
+ var i = 0;
2277
+ while (i < n && value >= _classes[i]) {
2278
+ i++;
2279
+ }
2280
+ return i-1;
2281
+ }
2282
+ return 0;
2283
+ };
2284
+
2285
+ var tMapLightness = function (t) { return t; };
2286
+ var tMapDomain = function (t) { return t; };
2287
+
2288
+ // const classifyValue = function(value) {
2289
+ // let val = value;
2290
+ // if (_classes.length > 2) {
2291
+ // const n = _classes.length-1;
2292
+ // const i = getClass(value);
2293
+ // const minc = _classes[0] + ((_classes[1]-_classes[0]) * (0 + (_spread * 0.5))); // center of 1st class
2294
+ // const maxc = _classes[n-1] + ((_classes[n]-_classes[n-1]) * (1 - (_spread * 0.5))); // center of last class
2295
+ // val = _min + ((((_classes[i] + ((_classes[i+1] - _classes[i]) * 0.5)) - minc) / (maxc-minc)) * (_max - _min));
2296
+ // }
2297
+ // return val;
2298
+ // };
2299
+
2300
+ var getColor = function(val, bypassMap) {
2301
+ var col, t;
2302
+ if (bypassMap == null) { bypassMap = false; }
2303
+ if (isNaN(val) || (val === null)) { return _nacol; }
2304
+ if (!bypassMap) {
2305
+ if (_classes && (_classes.length > 2)) {
2306
+ // find the class
2307
+ var c = getClass(val);
2308
+ t = c / (_classes.length-2);
2309
+ } else if (_max !== _min) {
2310
+ // just interpolate between min/max
2311
+ t = (val - _min) / (_max - _min);
2312
+ } else {
2313
+ t = 1;
2314
+ }
2315
+ } else {
2316
+ t = val;
2317
+ }
2318
+
2319
+ // domain map
2320
+ t = tMapDomain(t);
2321
+
2322
+ if (!bypassMap) {
2323
+ t = tMapLightness(t); // lightness correction
2324
+ }
2325
+
2326
+ if (_gamma !== 1) { t = pow$5(t, _gamma); }
2327
+
2328
+ t = _padding[0] + (t * (1 - _padding[0] - _padding[1]));
2329
+
2330
+ t = Math.min(1, Math.max(0, t));
2331
+
2332
+ var k = Math.floor(t * 10000);
2333
+
2334
+ if (_useCache && _colorCache[k]) {
2335
+ col = _colorCache[k];
2336
+ } else {
2337
+ if (type$j(_colors) === 'array') {
2338
+ //for i in [0.._pos.length-1]
2339
+ for (var i=0; i<_pos.length; i++) {
2340
+ var p = _pos[i];
2341
+ if (t <= p) {
2342
+ col = _colors[i];
2343
+ break;
2344
+ }
2345
+ if ((t >= p) && (i === (_pos.length-1))) {
2346
+ col = _colors[i];
2347
+ break;
2348
+ }
2349
+ if (t > p && t < _pos[i+1]) {
2350
+ t = (t-p)/(_pos[i+1]-p);
2351
+ col = chroma_1.interpolate(_colors[i], _colors[i+1], t, _mode);
2352
+ break;
2353
+ }
2354
+ }
2355
+ } else if (type$j(_colors) === 'function') {
2356
+ col = _colors(t);
2357
+ }
2358
+ if (_useCache) { _colorCache[k] = col; }
2359
+ }
2360
+ return col;
2361
+ };
2362
+
2363
+ var resetCache = function () { return _colorCache = {}; };
2364
+
2365
+ setColors(colors);
2366
+
2367
+ // public interface
2368
+
2369
+ var f = function(v) {
2370
+ var c = chroma_1(getColor(v));
2371
+ if (_out && c[_out]) { return c[_out](); } else { return c; }
2372
+ };
2373
+
2374
+ f.classes = function(classes) {
2375
+ if (classes != null) {
2376
+ if (type$j(classes) === 'array') {
2377
+ _classes = classes;
2378
+ _domain = [classes[0], classes[classes.length-1]];
2379
+ } else {
2380
+ var d = chroma_1.analyze(_domain);
2381
+ if (classes === 0) {
2382
+ _classes = [d.min, d.max];
2383
+ } else {
2384
+ _classes = chroma_1.limits(d, 'e', classes);
2385
+ }
2386
+ }
2387
+ return f;
2388
+ }
2389
+ return _classes;
2390
+ };
2391
+
2392
+
2393
+ f.domain = function(domain) {
2394
+ if (!arguments.length) {
2395
+ return _domain;
2396
+ }
2397
+ _min = domain[0];
2398
+ _max = domain[domain.length-1];
2399
+ _pos = [];
2400
+ var k = _colors.length;
2401
+ if ((domain.length === k) && (_min !== _max)) {
2402
+ // update positions
2403
+ for (var i = 0, list = Array.from(domain); i < list.length; i += 1) {
2404
+ var d = list[i];
2405
+
2406
+ _pos.push((d-_min) / (_max-_min));
2407
+ }
2408
+ } else {
2409
+ for (var c=0; c<k; c++) {
2410
+ _pos.push(c/(k-1));
2411
+ }
2412
+ if (domain.length > 2) {
2413
+ // set domain map
2414
+ var tOut = domain.map(function (d,i) { return i/(domain.length-1); });
2415
+ var tBreaks = domain.map(function (d) { return (d - _min) / (_max - _min); });
2416
+ if (!tBreaks.every(function (val, i) { return tOut[i] === val; })) {
2417
+ tMapDomain = function (t) {
2418
+ if (t <= 0 || t >= 1) { return t; }
2419
+ var i = 0;
2420
+ while (t >= tBreaks[i+1]) { i++; }
2421
+ var f = (t - tBreaks[i]) / (tBreaks[i+1] - tBreaks[i]);
2422
+ var out = tOut[i] + f * (tOut[i+1] - tOut[i]);
2423
+ return out;
2424
+ };
2425
+ }
2426
+
2427
+ }
2428
+ }
2429
+ _domain = [_min, _max];
2430
+ return f;
2431
+ };
2432
+
2433
+ f.mode = function(_m) {
2434
+ if (!arguments.length) {
2435
+ return _mode;
2436
+ }
2437
+ _mode = _m;
2438
+ resetCache();
2439
+ return f;
2440
+ };
2441
+
2442
+ f.range = function(colors, _pos) {
2443
+ setColors(colors, _pos);
2444
+ return f;
2445
+ };
2446
+
2447
+ f.out = function(_o) {
2448
+ _out = _o;
2449
+ return f;
2450
+ };
2451
+
2452
+ f.spread = function(val) {
2453
+ if (!arguments.length) {
2454
+ return _spread;
2455
+ }
2456
+ _spread = val;
2457
+ return f;
2458
+ };
2459
+
2460
+ f.correctLightness = function(v) {
2461
+ if (v == null) { v = true; }
2462
+ _correctLightness = v;
2463
+ resetCache();
2464
+ if (_correctLightness) {
2465
+ tMapLightness = function(t) {
2466
+ var L0 = getColor(0, true).lab()[0];
2467
+ var L1 = getColor(1, true).lab()[0];
2468
+ var pol = L0 > L1;
2469
+ var L_actual = getColor(t, true).lab()[0];
2470
+ var L_ideal = L0 + ((L1 - L0) * t);
2471
+ var L_diff = L_actual - L_ideal;
2472
+ var t0 = 0;
2473
+ var t1 = 1;
2474
+ var max_iter = 20;
2475
+ while ((Math.abs(L_diff) > 1e-2) && (max_iter-- > 0)) {
2476
+ (function() {
2477
+ if (pol) { L_diff *= -1; }
2478
+ if (L_diff < 0) {
2479
+ t0 = t;
2480
+ t += (t1 - t) * 0.5;
2481
+ } else {
2482
+ t1 = t;
2483
+ t += (t0 - t) * 0.5;
2484
+ }
2485
+ L_actual = getColor(t, true).lab()[0];
2486
+ return L_diff = L_actual - L_ideal;
2487
+ })();
2488
+ }
2489
+ return t;
2490
+ };
2491
+ } else {
2492
+ tMapLightness = function (t) { return t; };
2493
+ }
2494
+ return f;
2495
+ };
2496
+
2497
+ f.padding = function(p) {
2498
+ if (p != null) {
2499
+ if (type$j(p) === 'number') {
2500
+ p = [p,p];
2501
+ }
2502
+ _padding = p;
2503
+ return f;
2504
+ } else {
2505
+ return _padding;
2506
+ }
2507
+ };
2508
+
2509
+ f.colors = function(numColors, out) {
2510
+ // If no arguments are given, return the original colors that were provided
2511
+ if (arguments.length < 2) { out = 'hex'; }
2512
+ var result = [];
2513
+
2514
+ if (arguments.length === 0) {
2515
+ result = _colors.slice(0);
2516
+
2517
+ } else if (numColors === 1) {
2518
+ result = [f(0.5)];
2519
+
2520
+ } else if (numColors > 1) {
2521
+ var dm = _domain[0];
2522
+ var dd = _domain[1] - dm;
2523
+ result = __range__(0, numColors, false).map(function (i) { return f( dm + ((i/(numColors-1)) * dd) ); });
2524
+
2525
+ } else { // returns all colors based on the defined classes
2526
+ colors = [];
2527
+ var samples = [];
2528
+ if (_classes && (_classes.length > 2)) {
2529
+ for (var i = 1, end = _classes.length, asc = 1 <= end; asc ? i < end : i > end; asc ? i++ : i--) {
2530
+ samples.push((_classes[i-1]+_classes[i])*0.5);
2531
+ }
2532
+ } else {
2533
+ samples = _domain;
2534
+ }
2535
+ result = samples.map(function (v) { return f(v); });
2536
+ }
2537
+
2538
+ if (chroma_1[out]) {
2539
+ result = result.map(function (c) { return c[out](); });
2540
+ }
2541
+ return result;
2542
+ };
2543
+
2544
+ f.cache = function(c) {
2545
+ if (c != null) {
2546
+ _useCache = c;
2547
+ return f;
2548
+ } else {
2549
+ return _useCache;
2550
+ }
2551
+ };
2552
+
2553
+ f.gamma = function(g) {
2554
+ if (g != null) {
2555
+ _gamma = g;
2556
+ return f;
2557
+ } else {
2558
+ return _gamma;
2559
+ }
2560
+ };
2561
+
2562
+ f.nodata = function(d) {
2563
+ if (d != null) {
2564
+ _nacol = chroma_1(d);
2565
+ return f;
2566
+ } else {
2567
+ return _nacol;
2568
+ }
2569
+ };
2570
+
2571
+ return f;
2572
+ };
2573
+
2574
+ function __range__(left, right, inclusive) {
2575
+ var range = [];
2576
+ var ascending = left < right;
2577
+ var end = !inclusive ? right : ascending ? right + 1 : right - 1;
2578
+ for (var i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
2579
+ range.push(i);
2580
+ }
2581
+ return range;
2582
+ }
2583
+
2584
+ //
2585
+ // interpolates between a set of colors uzing a bezier spline
2586
+ //
2587
+
2588
+ // @requires utils lab
2589
+
2590
+
2591
+
2592
+
2593
+ var bezier = function(colors) {
2594
+ var assign, assign$1, assign$2;
2595
+
2596
+ var I, lab0, lab1, lab2;
2597
+ colors = colors.map(function (c) { return new Color_1(c); });
2598
+ if (colors.length === 2) {
2599
+ // linear interpolation
2600
+ (assign = colors.map(function (c) { return c.lab(); }), lab0 = assign[0], lab1 = assign[1]);
2601
+ I = function(t) {
2602
+ var lab = ([0, 1, 2].map(function (i) { return lab0[i] + (t * (lab1[i] - lab0[i])); }));
2603
+ return new Color_1(lab, 'lab');
2604
+ };
2605
+ } else if (colors.length === 3) {
2606
+ // quadratic bezier interpolation
2607
+ (assign$1 = colors.map(function (c) { return c.lab(); }), lab0 = assign$1[0], lab1 = assign$1[1], lab2 = assign$1[2]);
2608
+ I = function(t) {
2609
+ var lab = ([0, 1, 2].map(function (i) { return ((1-t)*(1-t) * lab0[i]) + (2 * (1-t) * t * lab1[i]) + (t * t * lab2[i]); }));
2610
+ return new Color_1(lab, 'lab');
2611
+ };
2612
+ } else if (colors.length === 4) {
2613
+ // cubic bezier interpolation
2614
+ var lab3;
2615
+ (assign$2 = colors.map(function (c) { return c.lab(); }), lab0 = assign$2[0], lab1 = assign$2[1], lab2 = assign$2[2], lab3 = assign$2[3]);
2616
+ I = function(t) {
2617
+ var lab = ([0, 1, 2].map(function (i) { return ((1-t)*(1-t)*(1-t) * lab0[i]) + (3 * (1-t) * (1-t) * t * lab1[i]) + (3 * (1-t) * t * t * lab2[i]) + (t*t*t * lab3[i]); }));
2618
+ return new Color_1(lab, 'lab');
2619
+ };
2620
+ } else if (colors.length === 5) {
2621
+ var I0 = bezier(colors.slice(0, 3));
2622
+ var I1 = bezier(colors.slice(2, 5));
2623
+ I = function(t) {
2624
+ if (t < 0.5) {
2625
+ return I0(t*2);
2626
+ } else {
2627
+ return I1((t-0.5)*2);
2628
+ }
2629
+ };
2630
+ }
2631
+ return I;
2632
+ };
2633
+
2634
+ var bezier_1 = function (colors) {
2635
+ var f = bezier(colors);
2636
+ f.scale = function () { return scale(f); };
2637
+ return f;
2638
+ };
2639
+
2640
+ /*
2641
+ * interpolates between a set of colors uzing a bezier spline
2642
+ * blend mode formulas taken from http://www.venture-ware.com/kevin/coding/lets-learn-math-photoshop-blend-modes/
2643
+ */
2644
+
2645
+
2646
+
2647
+
2648
+ var blend = function (bottom, top, mode) {
2649
+ if (!blend[mode]) {
2650
+ throw new Error('unknown blend mode ' + mode);
2651
+ }
2652
+ return blend[mode](bottom, top);
2653
+ };
2654
+
2655
+ var blend_f = function (f) { return function (bottom,top) {
2656
+ var c0 = chroma_1(top).rgb();
2657
+ var c1 = chroma_1(bottom).rgb();
2658
+ return chroma_1.rgb(f(c0, c1));
2659
+ }; };
2660
+
2661
+ var each = function (f) { return function (c0, c1) {
2662
+ var out = [];
2663
+ out[0] = f(c0[0], c1[0]);
2664
+ out[1] = f(c0[1], c1[1]);
2665
+ out[2] = f(c0[2], c1[2]);
2666
+ return out;
2667
+ }; };
2668
+
2669
+ var normal = function (a) { return a; };
2670
+ var multiply = function (a,b) { return a * b / 255; };
2671
+ var darken$1 = function (a,b) { return a > b ? b : a; };
2672
+ var lighten = function (a,b) { return a > b ? a : b; };
2673
+ var screen = function (a,b) { return 255 * (1 - (1-a/255) * (1-b/255)); };
2674
+ var overlay = function (a,b) { return b < 128 ? 2 * a * b / 255 : 255 * (1 - 2 * (1 - a / 255 ) * ( 1 - b / 255 )); };
2675
+ var burn = function (a,b) { return 255 * (1 - (1 - b / 255) / (a/255)); };
2676
+ var dodge = function (a,b) {
2677
+ if (a === 255) { return 255; }
2678
+ a = 255 * (b / 255) / (1 - a / 255);
2679
+ return a > 255 ? 255 : a
2680
+ };
2681
+
2682
+ // # add = (a,b) ->
2683
+ // # if (a + b > 255) then 255 else a + b
2684
+
2685
+ blend.normal = blend_f(each(normal));
2686
+ blend.multiply = blend_f(each(multiply));
2687
+ blend.screen = blend_f(each(screen));
2688
+ blend.overlay = blend_f(each(overlay));
2689
+ blend.darken = blend_f(each(darken$1));
2690
+ blend.lighten = blend_f(each(lighten));
2691
+ blend.dodge = blend_f(each(dodge));
2692
+ blend.burn = blend_f(each(burn));
2693
+ // blend.add = blend_f(each(add));
2694
+
2695
+ var blend_1 = blend;
2696
+
2697
+ // cubehelix interpolation
2698
+ // based on D.A. Green "A colour scheme for the display of astronomical intensity images"
2699
+ // http://astron-soc.in/bulletin/11June/289392011.pdf
2700
+
2701
+ var type$k = utils.type;
2702
+ var clip_rgb$3 = utils.clip_rgb;
2703
+ var TWOPI$2 = utils.TWOPI;
2704
+ var pow$6 = Math.pow;
2705
+ var sin$2 = Math.sin;
2706
+ var cos$3 = Math.cos;
2707
+
2708
+
2709
+ var cubehelix = function(start, rotations, hue, gamma, lightness) {
2710
+ if ( start === void 0 ) start=300;
2711
+ if ( rotations === void 0 ) rotations=-1.5;
2712
+ if ( hue === void 0 ) hue=1;
2713
+ if ( gamma === void 0 ) gamma=1;
2714
+ if ( lightness === void 0 ) lightness=[0,1];
2715
+
2716
+ var dh = 0, dl;
2717
+ if (type$k(lightness) === 'array') {
2718
+ dl = lightness[1] - lightness[0];
2719
+ } else {
2720
+ dl = 0;
2721
+ lightness = [lightness, lightness];
2722
+ }
2723
+
2724
+ var f = function(fract) {
2725
+ var a = TWOPI$2 * (((start+120)/360) + (rotations * fract));
2726
+ var l = pow$6(lightness[0] + (dl * fract), gamma);
2727
+ var h = dh !== 0 ? hue[0] + (fract * dh) : hue;
2728
+ var amp = (h * l * (1-l)) / 2;
2729
+ var cos_a = cos$3(a);
2730
+ var sin_a = sin$2(a);
2731
+ var r = l + (amp * ((-0.14861 * cos_a) + (1.78277* sin_a)));
2732
+ var g = l + (amp * ((-0.29227 * cos_a) - (0.90649* sin_a)));
2733
+ var b = l + (amp * (+1.97294 * cos_a));
2734
+ return chroma_1(clip_rgb$3([r*255,g*255,b*255,1]));
2735
+ };
2736
+
2737
+ f.start = function(s) {
2738
+ if ((s == null)) { return start; }
2739
+ start = s;
2740
+ return f;
2741
+ };
2742
+
2743
+ f.rotations = function(r) {
2744
+ if ((r == null)) { return rotations; }
2745
+ rotations = r;
2746
+ return f;
2747
+ };
2748
+
2749
+ f.gamma = function(g) {
2750
+ if ((g == null)) { return gamma; }
2751
+ gamma = g;
2752
+ return f;
2753
+ };
2754
+
2755
+ f.hue = function(h) {
2756
+ if ((h == null)) { return hue; }
2757
+ hue = h;
2758
+ if (type$k(hue) === 'array') {
2759
+ dh = hue[1] - hue[0];
2760
+ if (dh === 0) { hue = hue[1]; }
2761
+ } else {
2762
+ dh = 0;
2763
+ }
2764
+ return f;
2765
+ };
2766
+
2767
+ f.lightness = function(h) {
2768
+ if ((h == null)) { return lightness; }
2769
+ if (type$k(h) === 'array') {
2770
+ lightness = h;
2771
+ dl = h[1] - h[0];
2772
+ } else {
2773
+ lightness = [h,h];
2774
+ dl = 0;
2775
+ }
2776
+ return f;
2777
+ };
2778
+
2779
+ f.scale = function () { return chroma_1.scale(f); };
2780
+
2781
+ f.hue(hue);
2782
+
2783
+ return f;
2784
+ };
2785
+
2786
+ var digits = '0123456789abcdef';
2787
+
2788
+ var floor$2 = Math.floor;
2789
+ var random = Math.random;
2790
+
2791
+ var random_1 = function () {
2792
+ var code = '#';
2793
+ for (var i=0; i<6; i++) {
2794
+ code += digits.charAt(floor$2(random() * 16));
2795
+ }
2796
+ return new Color_1(code, 'hex');
2797
+ };
2798
+
2799
+ var log$1 = Math.log;
2800
+ var pow$7 = Math.pow;
2801
+ var floor$3 = Math.floor;
2802
+ var abs = Math.abs;
2803
+
2804
+
2805
+ var analyze = function (data, key) {
2806
+ if ( key === void 0 ) key=null;
2807
+
2808
+ var r = {
2809
+ min: Number.MAX_VALUE,
2810
+ max: Number.MAX_VALUE*-1,
2811
+ sum: 0,
2812
+ values: [],
2813
+ count: 0
2814
+ };
2815
+ if (type(data) === 'object') {
2816
+ data = Object.values(data);
2817
+ }
2818
+ data.forEach(function (val) {
2819
+ if (key && type(val) === 'object') { val = val[key]; }
2820
+ if (val !== undefined && val !== null && !isNaN(val)) {
2821
+ r.values.push(val);
2822
+ r.sum += val;
2823
+ if (val < r.min) { r.min = val; }
2824
+ if (val > r.max) { r.max = val; }
2825
+ r.count += 1;
2826
+ }
2827
+ });
2828
+
2829
+ r.domain = [r.min, r.max];
2830
+
2831
+ r.limits = function (mode, num) { return limits(r, mode, num); };
2832
+
2833
+ return r;
2834
+ };
2835
+
2836
+
2837
+ var limits = function (data, mode, num) {
2838
+ if ( mode === void 0 ) mode='equal';
2839
+ if ( num === void 0 ) num=7;
2840
+
2841
+ if (type(data) == 'array') {
2842
+ data = analyze(data);
2843
+ }
2844
+ var min = data.min;
2845
+ var max = data.max;
2846
+ var values = data.values.sort(function (a,b) { return a-b; });
2847
+
2848
+ if (num === 1) { return [min,max]; }
2849
+
2850
+ var limits = [];
2851
+
2852
+ if (mode.substr(0,1) === 'c') { // continuous
2853
+ limits.push(min);
2854
+ limits.push(max);
2855
+ }
2856
+
2857
+ if (mode.substr(0,1) === 'e') { // equal interval
2858
+ limits.push(min);
2859
+ for (var i=1; i<num; i++) {
2860
+ limits.push(min+((i/num)*(max-min)));
2861
+ }
2862
+ limits.push(max);
2863
+ }
2864
+
2865
+ else if (mode.substr(0,1) === 'l') { // log scale
2866
+ if (min <= 0) {
2867
+ throw new Error('Logarithmic scales are only possible for values > 0');
2868
+ }
2869
+ var min_log = Math.LOG10E * log$1(min);
2870
+ var max_log = Math.LOG10E * log$1(max);
2871
+ limits.push(min);
2872
+ for (var i$1=1; i$1<num; i$1++) {
2873
+ limits.push(pow$7(10, min_log + ((i$1/num) * (max_log - min_log))));
2874
+ }
2875
+ limits.push(max);
2876
+ }
2877
+
2878
+ else if (mode.substr(0,1) === 'q') { // quantile scale
2879
+ limits.push(min);
2880
+ for (var i$2=1; i$2<num; i$2++) {
2881
+ var p = ((values.length-1) * i$2)/num;
2882
+ var pb = floor$3(p);
2883
+ if (pb === p) {
2884
+ limits.push(values[pb]);
2885
+ } else { // p > pb
2886
+ var pr = p - pb;
2887
+ limits.push((values[pb]*(1-pr)) + (values[pb+1]*pr));
2888
+ }
2889
+ }
2890
+ limits.push(max);
2891
+
2892
+ }
2893
+
2894
+ else if (mode.substr(0,1) === 'k') { // k-means clustering
2895
+ /*
2896
+ implementation based on
2897
+ http://code.google.com/p/figue/source/browse/trunk/figue.js#336
2898
+ simplified for 1-d input values
2899
+ */
2900
+ var cluster;
2901
+ var n = values.length;
2902
+ var assignments = new Array(n);
2903
+ var clusterSizes = new Array(num);
2904
+ var repeat = true;
2905
+ var nb_iters = 0;
2906
+ var centroids = null;
2907
+
2908
+ // get seed values
2909
+ centroids = [];
2910
+ centroids.push(min);
2911
+ for (var i$3=1; i$3<num; i$3++) {
2912
+ centroids.push(min + ((i$3/num) * (max-min)));
2913
+ }
2914
+ centroids.push(max);
2915
+
2916
+ while (repeat) {
2917
+ // assignment step
2918
+ for (var j=0; j<num; j++) {
2919
+ clusterSizes[j] = 0;
2920
+ }
2921
+ for (var i$4=0; i$4<n; i$4++) {
2922
+ var value = values[i$4];
2923
+ var mindist = Number.MAX_VALUE;
2924
+ var best = (void 0);
2925
+ for (var j$1=0; j$1<num; j$1++) {
2926
+ var dist = abs(centroids[j$1]-value);
2927
+ if (dist < mindist) {
2928
+ mindist = dist;
2929
+ best = j$1;
2930
+ }
2931
+ clusterSizes[best]++;
2932
+ assignments[i$4] = best;
2933
+ }
2934
+ }
2935
+
2936
+ // update centroids step
2937
+ var newCentroids = new Array(num);
2938
+ for (var j$2=0; j$2<num; j$2++) {
2939
+ newCentroids[j$2] = null;
2940
+ }
2941
+ for (var i$5=0; i$5<n; i$5++) {
2942
+ cluster = assignments[i$5];
2943
+ if (newCentroids[cluster] === null) {
2944
+ newCentroids[cluster] = values[i$5];
2945
+ } else {
2946
+ newCentroids[cluster] += values[i$5];
2947
+ }
2948
+ }
2949
+ for (var j$3=0; j$3<num; j$3++) {
2950
+ newCentroids[j$3] *= 1/clusterSizes[j$3];
2951
+ }
2952
+
2953
+ // check convergence
2954
+ repeat = false;
2955
+ for (var j$4=0; j$4<num; j$4++) {
2956
+ if (newCentroids[j$4] !== centroids[j$4]) {
2957
+ repeat = true;
2958
+ break;
2959
+ }
2960
+ }
2961
+
2962
+ centroids = newCentroids;
2963
+ nb_iters++;
2964
+
2965
+ if (nb_iters > 200) {
2966
+ repeat = false;
2967
+ }
2968
+ }
2969
+
2970
+ // finished k-means clustering
2971
+ // the next part is borrowed from gabrielflor.it
2972
+ var kClusters = {};
2973
+ for (var j$5=0; j$5<num; j$5++) {
2974
+ kClusters[j$5] = [];
2975
+ }
2976
+ for (var i$6=0; i$6<n; i$6++) {
2977
+ cluster = assignments[i$6];
2978
+ kClusters[cluster].push(values[i$6]);
2979
+ }
2980
+ var tmpKMeansBreaks = [];
2981
+ for (var j$6=0; j$6<num; j$6++) {
2982
+ tmpKMeansBreaks.push(kClusters[j$6][0]);
2983
+ tmpKMeansBreaks.push(kClusters[j$6][kClusters[j$6].length-1]);
2984
+ }
2985
+ tmpKMeansBreaks = tmpKMeansBreaks.sort(function (a,b){ return a-b; });
2986
+ limits.push(tmpKMeansBreaks[0]);
2987
+ for (var i$7=1; i$7 < tmpKMeansBreaks.length; i$7+= 2) {
2988
+ var v = tmpKMeansBreaks[i$7];
2989
+ if (!isNaN(v) && (limits.indexOf(v) === -1)) {
2990
+ limits.push(v);
2991
+ }
2992
+ }
2993
+ }
2994
+ return limits;
2995
+ };
2996
+
2997
+ var analyze_1 = {analyze: analyze, limits: limits};
2998
+
2999
+ var contrast = function (a, b) {
3000
+ // WCAG contrast ratio
3001
+ // see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef
3002
+ a = new Color_1(a);
3003
+ b = new Color_1(b);
3004
+ var l1 = a.luminance();
3005
+ var l2 = b.luminance();
3006
+ return l1 > l2 ? (l1 + 0.05) / (l2 + 0.05) : (l2 + 0.05) / (l1 + 0.05);
3007
+ };
3008
+
3009
+ var sqrt$4 = Math.sqrt;
3010
+ var atan2$2 = Math.atan2;
3011
+ var abs$1 = Math.abs;
3012
+ var cos$4 = Math.cos;
3013
+ var PI$2 = Math.PI;
3014
+
3015
+ var deltaE = function(a, b, L, C) {
3016
+ if ( L === void 0 ) L=1;
3017
+ if ( C === void 0 ) C=1;
3018
+
3019
+ // Delta E (CMC)
3020
+ // see http://www.brucelindbloom.com/index.html?Eqn_DeltaE_CMC.html
3021
+ a = new Color_1(a);
3022
+ b = new Color_1(b);
3023
+ var ref = Array.from(a.lab());
3024
+ var L1 = ref[0];
3025
+ var a1 = ref[1];
3026
+ var b1 = ref[2];
3027
+ var ref$1 = Array.from(b.lab());
3028
+ var L2 = ref$1[0];
3029
+ var a2 = ref$1[1];
3030
+ var b2 = ref$1[2];
3031
+ var c1 = sqrt$4((a1 * a1) + (b1 * b1));
3032
+ var c2 = sqrt$4((a2 * a2) + (b2 * b2));
3033
+ var sl = L1 < 16.0 ? 0.511 : (0.040975 * L1) / (1.0 + (0.01765 * L1));
3034
+ var sc = ((0.0638 * c1) / (1.0 + (0.0131 * c1))) + 0.638;
3035
+ var h1 = c1 < 0.000001 ? 0.0 : (atan2$2(b1, a1) * 180.0) / PI$2;
3036
+ while (h1 < 0) { h1 += 360; }
3037
+ while (h1 >= 360) { h1 -= 360; }
3038
+ var t = (h1 >= 164.0) && (h1 <= 345.0) ? (0.56 + abs$1(0.2 * cos$4((PI$2 * (h1 + 168.0)) / 180.0))) : (0.36 + abs$1(0.4 * cos$4((PI$2 * (h1 + 35.0)) / 180.0)));
3039
+ var c4 = c1 * c1 * c1 * c1;
3040
+ var f = sqrt$4(c4 / (c4 + 1900.0));
3041
+ var sh = sc * (((f * t) + 1.0) - f);
3042
+ var delL = L1 - L2;
3043
+ var delC = c1 - c2;
3044
+ var delA = a1 - a2;
3045
+ var delB = b1 - b2;
3046
+ var dH2 = ((delA * delA) + (delB * delB)) - (delC * delC);
3047
+ var v1 = delL / (L * sl);
3048
+ var v2 = delC / (C * sc);
3049
+ var v3 = sh;
3050
+ return sqrt$4((v1 * v1) + (v2 * v2) + (dH2 / (v3 * v3)));
3051
+ };
3052
+
3053
+ // simple Euclidean distance
3054
+ var distance = function(a, b, mode) {
3055
+ if ( mode === void 0 ) mode='lab';
3056
+
3057
+ // Delta E (CIE 1976)
3058
+ // see http://www.brucelindbloom.com/index.html?Equations.html
3059
+ a = new Color_1(a);
3060
+ b = new Color_1(b);
3061
+ var l1 = a.get(mode);
3062
+ var l2 = b.get(mode);
3063
+ var sum_sq = 0;
3064
+ for (var i in l1) {
3065
+ var d = (l1[i] || 0) - (l2[i] || 0);
3066
+ sum_sq += d*d;
3067
+ }
3068
+ return Math.sqrt(sum_sq);
3069
+ };
3070
+
3071
+ var valid = function () {
3072
+ var args = [], len = arguments.length;
3073
+ while ( len-- ) args[ len ] = arguments[ len ];
3074
+
3075
+ try {
3076
+ new (Function.prototype.bind.apply( Color_1, [ null ].concat( args) ));
3077
+ return true;
3078
+ } catch (e) {
3079
+ return false;
3080
+ }
3081
+ };
3082
+
3083
+ // some pre-defined color scales:
3084
+
3085
+
3086
+
3087
+
3088
+ var scales = {
3089
+ cool: function cool() { return scale([chroma_1.hsl(180,1,.9), chroma_1.hsl(250,.7,.4)]) },
3090
+ hot: function hot() { return scale(['#000','#f00','#ff0','#fff'], [0,.25,.75,1]).mode('rgb') }
3091
+ };
3092
+
3093
+ /**
3094
+ ColorBrewer colors for chroma.js
3095
+
3096
+ Copyright (c) 2002 Cynthia Brewer, Mark Harrower, and The
3097
+ Pennsylvania State University.
3098
+
3099
+ Licensed under the Apache License, Version 2.0 (the "License");
3100
+ you may not use this file except in compliance with the License.
3101
+ You may obtain a copy of the License at
3102
+ http://www.apache.org/licenses/LICENSE-2.0
3103
+
3104
+ Unless required by applicable law or agreed to in writing, software distributed
3105
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
3106
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
3107
+ specific language governing permissions and limitations under the License.
3108
+ */
3109
+
3110
+ var colorbrewer = {
3111
+ // sequential
3112
+ OrRd: ['#fff7ec', '#fee8c8', '#fdd49e', '#fdbb84', '#fc8d59', '#ef6548', '#d7301f', '#b30000', '#7f0000'],
3113
+ PuBu: ['#fff7fb', '#ece7f2', '#d0d1e6', '#a6bddb', '#74a9cf', '#3690c0', '#0570b0', '#045a8d', '#023858'],
3114
+ BuPu: ['#f7fcfd', '#e0ecf4', '#bfd3e6', '#9ebcda', '#8c96c6', '#8c6bb1', '#88419d', '#810f7c', '#4d004b'],
3115
+ Oranges: ['#fff5eb', '#fee6ce', '#fdd0a2', '#fdae6b', '#fd8d3c', '#f16913', '#d94801', '#a63603', '#7f2704'],
3116
+ BuGn: ['#f7fcfd', '#e5f5f9', '#ccece6', '#99d8c9', '#66c2a4', '#41ae76', '#238b45', '#006d2c', '#00441b'],
3117
+ YlOrBr: ['#ffffe5', '#fff7bc', '#fee391', '#fec44f', '#fe9929', '#ec7014', '#cc4c02', '#993404', '#662506'],
3118
+ YlGn: ['#ffffe5', '#f7fcb9', '#d9f0a3', '#addd8e', '#78c679', '#41ab5d', '#238443', '#006837', '#004529'],
3119
+ Reds: ['#fff5f0', '#fee0d2', '#fcbba1', '#fc9272', '#fb6a4a', '#ef3b2c', '#cb181d', '#a50f15', '#67000d'],
3120
+ RdPu: ['#fff7f3', '#fde0dd', '#fcc5c0', '#fa9fb5', '#f768a1', '#dd3497', '#ae017e', '#7a0177', '#49006a'],
3121
+ Greens: ['#f7fcf5', '#e5f5e0', '#c7e9c0', '#a1d99b', '#74c476', '#41ab5d', '#238b45', '#006d2c', '#00441b'],
3122
+ YlGnBu: ['#ffffd9', '#edf8b1', '#c7e9b4', '#7fcdbb', '#41b6c4', '#1d91c0', '#225ea8', '#253494', '#081d58'],
3123
+ Purples: ['#fcfbfd', '#efedf5', '#dadaeb', '#bcbddc', '#9e9ac8', '#807dba', '#6a51a3', '#54278f', '#3f007d'],
3124
+ GnBu: ['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081'],
3125
+ Greys: ['#ffffff', '#f0f0f0', '#d9d9d9', '#bdbdbd', '#969696', '#737373', '#525252', '#252525', '#000000'],
3126
+ YlOrRd: ['#ffffcc', '#ffeda0', '#fed976', '#feb24c', '#fd8d3c', '#fc4e2a', '#e31a1c', '#bd0026', '#800026'],
3127
+ PuRd: ['#f7f4f9', '#e7e1ef', '#d4b9da', '#c994c7', '#df65b0', '#e7298a', '#ce1256', '#980043', '#67001f'],
3128
+ Blues: ['#f7fbff', '#deebf7', '#c6dbef', '#9ecae1', '#6baed6', '#4292c6', '#2171b5', '#08519c', '#08306b'],
3129
+ PuBuGn: ['#fff7fb', '#ece2f0', '#d0d1e6', '#a6bddb', '#67a9cf', '#3690c0', '#02818a', '#016c59', '#014636'],
3130
+ Viridis: ['#440154', '#482777', '#3f4a8a', '#31678e', '#26838f', '#1f9d8a', '#6cce5a', '#b6de2b', '#fee825'],
3131
+
3132
+ // diverging
3133
+
3134
+ Spectral: ['#9e0142', '#d53e4f', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#e6f598', '#abdda4', '#66c2a5', '#3288bd', '#5e4fa2'],
3135
+ RdYlGn: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee08b', '#ffffbf', '#d9ef8b', '#a6d96a', '#66bd63', '#1a9850', '#006837'],
3136
+ RdBu: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#f7f7f7', '#d1e5f0', '#92c5de', '#4393c3', '#2166ac', '#053061'],
3137
+ PiYG: ['#8e0152', '#c51b7d', '#de77ae', '#f1b6da', '#fde0ef', '#f7f7f7', '#e6f5d0', '#b8e186', '#7fbc41', '#4d9221', '#276419'],
3138
+ PRGn: ['#40004b', '#762a83', '#9970ab', '#c2a5cf', '#e7d4e8', '#f7f7f7', '#d9f0d3', '#a6dba0', '#5aae61', '#1b7837', '#00441b'],
3139
+ RdYlBu: ['#a50026', '#d73027', '#f46d43', '#fdae61', '#fee090', '#ffffbf', '#e0f3f8', '#abd9e9', '#74add1', '#4575b4', '#313695'],
3140
+ BrBG: ['#543005', '#8c510a', '#bf812d', '#dfc27d', '#f6e8c3', '#f5f5f5', '#c7eae5', '#80cdc1', '#35978f', '#01665e', '#003c30'],
3141
+ RdGy: ['#67001f', '#b2182b', '#d6604d', '#f4a582', '#fddbc7', '#ffffff', '#e0e0e0', '#bababa', '#878787', '#4d4d4d', '#1a1a1a'],
3142
+ PuOr: ['#7f3b08', '#b35806', '#e08214', '#fdb863', '#fee0b6', '#f7f7f7', '#d8daeb', '#b2abd2', '#8073ac', '#542788', '#2d004b'],
3143
+
3144
+ // qualitative
3145
+
3146
+ Set2: ['#66c2a5', '#fc8d62', '#8da0cb', '#e78ac3', '#a6d854', '#ffd92f', '#e5c494', '#b3b3b3'],
3147
+ Accent: ['#7fc97f', '#beaed4', '#fdc086', '#ffff99', '#386cb0', '#f0027f', '#bf5b17', '#666666'],
3148
+ Set1: ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33', '#a65628', '#f781bf', '#999999'],
3149
+ Set3: ['#8dd3c7', '#ffffb3', '#bebada', '#fb8072', '#80b1d3', '#fdb462', '#b3de69', '#fccde5', '#d9d9d9', '#bc80bd', '#ccebc5', '#ffed6f'],
3150
+ Dark2: ['#1b9e77', '#d95f02', '#7570b3', '#e7298a', '#66a61e', '#e6ab02', '#a6761d', '#666666'],
3151
+ Paired: ['#a6cee3', '#1f78b4', '#b2df8a', '#33a02c', '#fb9a99', '#e31a1c', '#fdbf6f', '#ff7f00', '#cab2d6', '#6a3d9a', '#ffff99', '#b15928'],
3152
+ Pastel2: ['#b3e2cd', '#fdcdac', '#cbd5e8', '#f4cae4', '#e6f5c9', '#fff2ae', '#f1e2cc', '#cccccc'],
3153
+ Pastel1: ['#fbb4ae', '#b3cde3', '#ccebc5', '#decbe4', '#fed9a6', '#ffffcc', '#e5d8bd', '#fddaec', '#f2f2f2'],
3154
+ };
3155
+
3156
+ // add lowercase aliases for case-insensitive matches
3157
+ for (var i$1 = 0, list$1 = Object.keys(colorbrewer); i$1 < list$1.length; i$1 += 1) {
3158
+ var key = list$1[i$1];
3159
+
3160
+ colorbrewer[key.toLowerCase()] = colorbrewer[key];
3161
+ }
3162
+
3163
+ var colorbrewer_1 = colorbrewer;
3164
+
3165
+ // feel free to comment out anything to rollup
3166
+ // a smaller chroma.js built
3167
+
3168
+ // io --> convert colors
3169
+
3170
+
3171
+
3172
+
3173
+
3174
+
3175
+
3176
+
3177
+
3178
+
3179
+
3180
+
3181
+
3182
+
3183
+
3184
+ // operators --> modify existing Colors
3185
+
3186
+
3187
+
3188
+
3189
+
3190
+
3191
+
3192
+
3193
+
3194
+
3195
+ // interpolators
3196
+
3197
+
3198
+
3199
+
3200
+
3201
+
3202
+
3203
+
3204
+
3205
+
3206
+ // generators -- > create new colors
3207
+ chroma_1.average = average;
3208
+ chroma_1.bezier = bezier_1;
3209
+ chroma_1.blend = blend_1;
3210
+ chroma_1.cubehelix = cubehelix;
3211
+ chroma_1.mix = chroma_1.interpolate = mix;
3212
+ chroma_1.random = random_1;
3213
+ chroma_1.scale = scale;
3214
+
3215
+ // other utility methods
3216
+ chroma_1.analyze = analyze_1.analyze;
3217
+ chroma_1.contrast = contrast;
3218
+ chroma_1.deltaE = deltaE;
3219
+ chroma_1.distance = distance;
3220
+ chroma_1.limits = analyze_1.limits;
3221
+ chroma_1.valid = valid;
3222
+
3223
+ // scale
3224
+ chroma_1.scales = scales;
3225
+
3226
+ // colors
3227
+ chroma_1.colors = w3cx11_1;
3228
+ chroma_1.brewer = colorbrewer_1;
3229
+
3230
+ var chroma_js = chroma_1;
3231
+
3232
+ return chroma_js;
3233
+
3234
+ })));
3235
+
3236
+
3237
+ /***/ })
3238
+
3239
+ }]);
3240
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXRzL2pzL2NvcmUvbW9kdWxlcy92ZW5kb3Jzfm1vZHVsZS0wLmJ1bmRsZS5qcyIsInNvdXJjZXMiOlsid2VicGFjazovL2FwcGxpY2F0aW9uLy4vbm9kZV9tb2R1bGVzL2Nocm9tYS1qcy9jaHJvbWEuanMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBjaHJvbWEuanMgLSBKYXZhU2NyaXB0IGxpYnJhcnkgZm9yIGNvbG9yIGNvbnZlcnNpb25zXG4gKlxuICogQ29weXJpZ2h0IChjKSAyMDExLTIwMTksIEdyZWdvciBBaXNjaFxuICogQWxsIHJpZ2h0cyByZXNlcnZlZC5cbiAqXG4gKiBSZWRpc3RyaWJ1dGlvbiBhbmQgdXNlIGluIHNvdXJjZSBhbmQgYmluYXJ5IGZvcm1zLCB3aXRoIG9yIHdpdGhvdXRcbiAqIG1vZGlmaWNhdGlvbiwgYXJlIHBlcm1pdHRlZCBwcm92aWRlZCB0aGF0IHRoZSBmb2xsb3dpbmcgY29uZGl0aW9ucyBhcmUgbWV0OlxuICpcbiAqIDEuIFJlZGlzdHJpYnV0aW9ucyBvZiBzb3VyY2UgY29kZSBtdXN0IHJldGFpbiB0aGUgYWJvdmUgY29weXJpZ2h0IG5vdGljZSwgdGhpc1xuICogbGlzdCBvZiBjb25kaXRpb25zIGFuZCB0aGUgZm9sbG93aW5nIGRpc2NsYWltZXIuXG4gKlxuICogMi4gUmVkaXN0cmlidXRpb25zIGluIGJpbmFyeSBmb3JtIG11c3QgcmVwcm9kdWNlIHRoZSBh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cblxuICAgIHZhciBDb2xvciA9IGZ1bmN0aW9uIENvbG9yKCkge1xuICAgICAgICB2YXIgYXJncyA9IFtdLCBsZW4gPSBhcmd1bWVudHMubGVuZ3RoO1xuICAgICAgICB3aGlsZSAoIGxlbi0tICkgYXJnc1sgbGVuIF0gPSBhcmd1bWVudHNbIGxlbiBdO1xuXG4gICAgICAgIHZhciBtZSA9IHRoaXM7XG4gICAgICAgIGlmICh0eXBlJDEoYXJnc1swXSkgPT09ICdvYmplY3QnICYmXG4gICAgICAgICAgICBhcmdzWzBdLmNvbnN0cnVjdG9yICYmXG4gICAgICAgICAgICBhcmdzWzBdLmNvbnN0cnVjdG9yID09PSB0aGlzLmNvbnN0cnVjdG9yKSB7XG4gICAgICAgICAgICAvLyB0aGUgYXJndW1lbnQgaXMgYWxyZWFkeSBhIENvbG9yIGluc3RhbmNlXG4gICAgICAgICAgICByZXR1cm4gYXJnc1swXTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIGxhc3QgYXJndW1lbnQgY291bGQgYmUgdGhlIG1vZGVcbiAgICAgICAgdmFyIG1vZGUgPSBsYXN0JDEoYXJncyk7XG4gICAgICAgIHZhciBhdXRvZGV0ZWN0ID0gZmFsc2U7XG5cbiAgICAgICAgaWYgKCFtb2RlKSB7XG4gICAgICAgICAgICBhdXRvZGV0ZWN0ID0gdHJ1ZTtcbiAgICAgICAgICAgIGlmICghaW5wdXQuc29ydGVkKSB7XG4gICAgICAgICAgICAgICAgaW5wdXQuYXV0b2RldGVjdCA9IGlucHV0LmF1dG9kZXRlY3Quc29ydChmdW5jdGlvbiAoYSxiKSB7IHJldHVybiBiLnAgLSBhLnA7IH0pO1xuICAgICAgICAgICAgICAgIGlucHV0LnNvcnRlZCA9IHRydWU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICAvLyBhdXRvLWRldGVjdCBmb3JtYXRcbiAgICAgICAgICAgIGZvciAodmFyIGkgPSAwLCBsaXN0ID0gaW5wdXQuYXV0b2RldGVjdDsgaSA8IGxpc3QubGVuZ3RoOyBpICs9IDEpIHtcbiAgICAgICAgICAgICAgICB2YXIgY2hrID0gbGlzdFtpXTtcblxuICAgICAgICAgICAgICAgIG1vZGUgPSBjaGsudGVzdC5hcHBseShjaGssIGFyZ3MpO1xuICAgICAgICAgICAgICAgIGlmIChtb2RlKSB7IGJyZWFrOyB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaW5wdXQuZm9ybWF0W21vZGVdKSB7XG4gICAgICAgICAgICB2YXIgcmdiID0gaW5wdXQuZm9ybWF0W21vZGVdLmFwcGx5KG51bGwsIGF1dG9kZXRlY3QgPyBhcmdzIDogYXJncy5zbGljZSgwLC0xKSk7XG4gICAgICAgICAgICBtZS5fcmdiID0gY2xpcF9yZ2IkMShyZ2IpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCd1bmtub3duIGZvcm1hdDogJythcmdzKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIGFkZCBhbHBoYSBjaGFubmVsXG4gICAgICAgIGlmIChtZS5fcmdiLmxlbmd0aCA9PT0gMykgeyBtZS5fcmdiLnB1c2goMSk7IH1cbiAgICB9O1xuXG4gICAgQ29sb3IucHJvdG90eXBlLnRvU3RyaW5nID0gZnVuY3Rpb24gdG9TdHJpbmcgKCkge1xuICAgICAgICBpZiAodHlwZSQxKHRoaXMuaGV4KSA9PSAnZnVuY3Rpb24nKSB7IHJldHVybiB0aGlzLmhleCgpOyB9XG4gICAgICAgIHJldHVybiAoXCJbXCIgKyAodGhpcy5fcmdiLmpvaW4oJywnKSkgKyBcIl1cIik7XG4gICAgfTtcblxuICAgIHZhciBDb2xvcl8xID0gQ29sb3I7XG5cbiAgICB2YXIgY2hyb21hID0gZnVuY3Rpb24gKCkge1xuICAgIFx0dmFyIGFyZ3MgPSBbXSwgbGVuID0gYXJndW1lbnRzLmxlbmd0aDtcbiAgICBcdHdoaWxlICggbGVuLS0gKSBhcmdzWyBsZW4gXSA9IGFyZ3VtZW50c1sgbGVuIF07XG5cbiAgICBcdHJldHVybiBuZXcgKEZ1bmN0aW9uLnByb3RvdHlwZS5iaW5kLmFwcGx5KCBjaHJvbWEuQ29sb3IsIFsgbnVsbCBdLmNvbmNhdCggYXJncykgKSk7XG4gICAgfTtcblxuICAgIGNocm9tYS5Db2xvciA9IENvbG9yXzE7XG4gICAgY2hyb21hLnZlcnNpb24gPSAnMi4xLjAnO1xuXG4gICAgdmFyIGNocm9tYV8xID0gY2hyb21hO1xuXG4gICAgdmFyIHVucGFjayQxID0gdXRpbHMudW5wYWNrO1xuICAgIHZhciBtYXggPSBNYXRoLm1heDtcblxuICAgIHZhciByZ2IyY215ayA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgdmFyIGFyZ3MgPSBbXSwgbGVuID0gYXJndW1lbnRzLmxlbmd0aDtcbiAgICAgICAgd2hpbGUgKCBsZW4tLSApIGFyZ3NbIGxlbiBdID0gYXJndW1lbnRzWyBsZW4gXTtcblxuICAgICAgICB2YXIgcmVmID0gdW5wYWNrJDEoYXJncywgJ3JnYicpO1xuICAgICAgICB2YXIgciA9IHJlZlswXTtcbiAgICAgICAgdmFyIGcgPSByZWZbMV07XG4gICAgICAgIHZhciBiID0gcmVmWzJdO1xuICAgICAgICByID0gciAvIDI1NTtcbiAgICAgICAgZyA9IGcgLyAyNTU7XG4gICAgICAgIGIgPSBiIC8gMjU1O1xuICAgICAgICB2YXIgayA9IDEgLSBtYXgocixtYXgoZyxiKSk7XG4gICAgICAgIHZhciBmID0gayA8IDEgPyAxIC8gKDEtaykgOiAwO1xuICAgICAgICB2YXIgYyA9ICgxLXItaykgKiBmO1xuICAgICAgICB2YXIgbSA9ICgxLWctaykgKiBmO1xuICAgICAgICB2YXIgeSA9ICgxLWItaykgKiBmO1xuICAgICAgICByZXR1cm4gW2MsbSx5LGtdO1xuICAgIH07XG5cbiAgICB2YXIgcmdiMmNteWtfMSA9IHJnYjJjbXlrO1xuXG4gICAgdmFyIHVucGFjayQyID0gdXRpbHMudW5wYWNrO1xuXG4gICAgdmFyIGNteWsycmdiID0gZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgYXJncyA9IFtdLCBsZW4gPSBhcmd1bWVudHMubGVuZ3RoO1xuICAgICAgICB3aGlsZSAoIGxlbi0tICkgYXJnc1sgbGVuIF0gPSBhcmd1bWVudHNbIGxlbiBdO1xuXG4gICAgICAgIGFyZ3MgPSB1bnBhY2skMihhcmdzLCAnY215aycpO1xuICAgICAgICB2YXIgYyA9IGFyZ3NbMF07XG4gICAgICAgIHZhciBtID0gYXJnc1sxXTtcbiAgICAgICAgdmFyIHkgPSBhcmdzWzJdO1xuICAgICAgICB2YXIgayA9IGFyZ3NbM107XG4gICAgICAgIHZhciBhbHBoYSA9IGFyZ3MubGVuZ3RoID4gNCA/IGFyZ3NbNF0gOiAxO1xuICAgICAgICBpZiAoayA9PT0gMSkgeyByZXR1cm4gWzAsMCwwLGFscGhhXTsgfVxuICAgICAgICByZXR1cm4gW1xuICAgICAgICAgICAgYyA+PSAxID8gMCA6IDI1NSAqICgxLWMpICogKDEtayksIC8vIHJcbiAgICAgICAgICAgIG0gPj0gMSA/IDAgOiAyNTUgKiAoMS1tKSAqICgxLWspLCAvLyBnXG4gICAgICAgICAgICB5ID49IDEgPyAwIDogMjU1ICogKDEteSkgKiAoMS1rKSwgLy8gYlxuICAgICAgICAgICAgYWxwaGFcbiAgICAgICAgXTtcbiAgICB9O1xuXG4gICAgdmFyIGNteWsycmdiXzEgPSBjbXlrMnJnYjtcblxuICAgIHZhciB1bnBhY2skMyA9IHV0aWxzLnVucGFjaztcbiAgICB2YXIgdHlwZSQyID0gdXRpbHMudHlwZTtcblxuXG5cbiAgICBDb2xvcl8xLnByb3RvdHlwZS5jbXlrID0gZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiByZ2IyY215a18xKHRoaXMuX3JnYik7XG4gICAgfTtcblxuICAgIGNocm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gICAvKlxuICAgICAqIHN1cHBvcnRlZCBhcmd1bWVudHM6XG4gICAgICogLSByZ2IyaHNsKHIsZyxiKVxuICAgICAqIC0gcmdiMmhzbChyLGcsYixhKVxuICAgICAqIC0gcmdiMmhzbChbcixnLGJdKVxuICAgICAqIC0gcmdiMmhzbChbcixnLGIsYV0pXG4gICAgICogLSByZ2IyaHNsKHtyLGcsYixhfSlcbiAgICAgKi9cbiAgICB2YXIgcmdiMmhzbCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgdmFyIGFyZ3MgPSBbXSwgbGVuID0gYXJndW1lbnRzLmxlbmd0aDtcbiAgICAgICAgd2hpbGUgKCBsZW4tLSApIGFyZ3NbIGxlbiBdID0gYXJndW1lbnRzWyBsZW4gXTtcblxuICAgICAgICBhcmdzID0gdW5wYWNrJDUoYXJncywgJ3JnYmEnKTtcbiAgICAgICAgdmFyIHIgPSBhcmdzWzBdO1xuICAgICAgICB2YXIgZyA9IGFyZ3NbMV07XG4gICAgICAgIHZhciBiID0gYXJnc1syXTtcblxuICAgICAgICByIC89IDI1NTtcbiAgICAgICAgZyAvPSAyNTU7XG4gICAgICAgIGIgLz0gMjU1O1xuXG4gICAgICAgIHZhciBtaW4gPSBNYXRoLm1pbihyLCBnLCBiKTtcbiAgICAgICAgdmFyIG1heCA9IE1hdGgubWF4KHIsIGcsIGIpO1xuXG4gICAgICAgIHZhciBsID0gKG1heCArIG1pbikgLyAyO1xuICAgICAgICB2YXIgcywgaDtcblxuICAgICAgICBpZiAobWF4ID09PSBtaW4pe1xuICAgICAgICAgICAgcyA9IDA7XG4gICAgICAgICAgICBoID0gTnVtYmVyLk5hTjtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHMgPSBsIDwgMC41ID8gKG1heCAtIG1pbikgLyAobWF4ICsgbWluKSA6IChtYXggLSBtaW4pIC8gKDIgLSBtYXggLSBtaW4pO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKHIgPT0gbWF4KSB7I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biAgICAgICAgdmFyIHMgPSBhcmdzWzFdO1xuICAgICAgICB2YXIgbCA9IGFyZ3NbMl07XG4gICAgICAgIHZhciByLGcsYjtcbiAgICAgICAgaWYgKHMgPT09IDApIHtcbiAgICAgICAgICAgIHIgPSBnID0gYiA9IGwqMjU1O1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdmFyIHQzID0gWzAsMCwwXTtcbiAgICAgICAgICAgIHZhciBjID0gWzAsMCwwXTtcbiAgICAgICAgICAgIHZhciB0MiA9IGwgPCAwLjUgPyBsICogKDErcykgOiBsK3MtbCpzO1xuICAgICAgICAgICAgdmFyIHQxID0gMiAqIGwgLSB0MjtcbiAgICAgICAgICAgIHZhciBoXyA9IGggLyAzNjA7XG4gICAgICAgICAgICB0M1swXSA9IGhfICsgMS8zO1xuICAgICAgICAgICAgdDNbMV0gPSBoXztcbiAgICAgICAgICAgIHQzWzJdID0gaF8gLSAxLzM7XG4gICAgICAgICAgICBmb3IgKHZhciBpPTA7IGk8MzsgaSsrKSB7XG4gICAgICAgICAgICAgICAgaWYgKHQzW2ldIDwgMCkgeyB0M1tpXSArPSAxOyB9XG4gICAgICAgICAgICAgICAgaWYgKHQzW2ldID4gMSkgeyB0M1tpXSAtPSAxOyB9XG4gICAgICAgICAgICAgICAgaWYgKDYgKiB0M1tpXSA8IDEpXG4gICAgICAgICAgICAgICAgICAgIHsgY1tpXSA9IHQxICsgKHQyIC0gdDEpICogNiAqIHQzW2ldOyB9XG4gICAgICAgICAgICAgICAgZWxzZSBpZiAoMiAqIHQzW2ldIDwgMSlcbiAgICAgICAgICAgICAgICAgICAgeyBjW2ldID0gdDI7IH1cbiAgICAgICAgICAgICAgICBlbHNlIGlmICgzICogdDNbaV0gPCAyKVxuICAgICAgICAgICAgICAgICAgICB7IGNbaV0gPSB0MSArICh0MiAtIHQxKSAqICgoMiAvIDMpIC0gdDNbaV0pICogNjsgfVxuICAgICAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICA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FxzKigtP1xcZCsoPzpcXC5cXGQrKT8pLFxccyooLT9cXGQrKD86XFwuXFxkKyk/KSVcXHMqLFxccyooLT9cXGQrKD86XFwuXFxkKyk/KSVcXHMqXFwpJC87XG4gICAgdmFyIFJFX0hTTEEgPSAvXmhzbGFcXChcXHMqKC0/XFxkKyg/OlxcLlxcZCspPyksXFxzKigtP1xcZCsoPzpcXC5cXGQrKT8pJVxccyosXFxzKigtP1xcZCsoPzpcXC5cXGQrKT8pJVxccyosXFxzKihbMDFdfFswMV0/XFwuXFxkKylcXCkkLztcblxuICAgIHZhciByb3VuZCQyID0gTWF0aC5yb3VuZDtcblxuICAgIHZhciBjc3MycmdiID0gZnVuY3Rpb24gKGNzcykge1xuICAgICAgICBjc3MgPSBjc3MudG9Mb3dlckNhc2UoKS50cmltKCk7XG4gICAgICAgIHZhciBtO1xuXG4gICAgICAgIGlmIChpbnB1dC5mb3JtYXQubmFtZWQpIHtcbiAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGlucHV0LmZvcm1hdC5uYW1lZChjc3MpO1xuICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgLy8gcmdiKDI1MCwyMCwwKVxuICAgICAgICBpZiAoKG0gPSBjc3MubWF0Y2goUkVfUkdCKSkpIHtcbiAgICAgICAgICAgIHZhciByZ2IgPSBtLnNsaWNlKDEsNCk7XG4gICAgICAgICAgICBmb3IgKHZhciBpPTA7IGk8MzsgaSsrKSB7XG4gICAgICAgICAgICAgICAgcmdiW2ldID0gK3JnYltpXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJnYlszXSA9IDE7ICAvLyBkZWZhdWx0IGFscGhhXG4gICAgICAgICAgICByZXR1cm4gcmdiO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gcmdiYSgyNTAsMjAsMCwwLjQpXG4gICAgICAgIGlmICgobSA9IGNzcy5tYXRjaChSRV9SR0JBKSkpIHtcbiAgICAgICAgICAgIHZhciByZ2IkMSA9IG0uc2xpY2UoMSw1KTtcbiAgICAgICAgICAgIGZvciAodmFyIGkkMT0wOyBpJDE8NDsgaSQxKyspIHtcbiAgICAgICAgICAgICAgICByZ2IkMVtpJDFdID0gK3JnYiQxW2kkMV07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcmdiJDE7XG4gICAgICAgIH1cblxuICAgICAgICAvLyByZ2IoMTAwJSwwJSwwJSlcbiAgICAgICAgaWYgKChtID0gY3NzLm1hdGNoKFJFX1JHQl9QQ1QpKSkge1xuICAgICAgICAgICAgdmFyIHJnYiQyID0gbS5zbGljZSgxLDQpO1xuICAgICAgICAgICAgZm9yICh2YXIgaSQyPTA7IGkkMjwzOyBpJDIrKykge1xuICAgICAgICAgICAgICAgIHJnYiQyW2kkMl0gPSByb3VuZCQyKHJnYiQyW2kkMl0gKiAyLjU1KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJnYiQyWzNdID0gMTsgIC8vIGRlZmF1bHQgYWxwaGFcbiAgICAgICAgICAgIHJldHVybiByZ2IkMjtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIHJnYmEoMTAwJSwwJSwwJSwwLjQpXG4gICAgICAgIGlmICgobSA9IGNzcy5tYXRjaChSRV9SR0JBX1BDVCkpKSB7XG4gICAgICAgICAgICB2YXIgcmdiJDMgPSBtLnNsaWNlKDEsNSk7XG4gICAgICAgICAgICBmb3IgKHZhciBpJDM9MDsgaSQzPDM7IGkkMysrKSB7XG4gICAgICAgICAgICAgICAgcmdiJDNbaSQzXSA9IHJvdW5kJDIocmdiJDNbaSQzXSAqIDIuNTUpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmdiJDNbM10gPSArcmdiJDNbM107XG4gICAgICAgICAgICByZXR1cm4gcmdiJDM7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBoc2woMCwxMDAlLDUwJSlcbiAgICAgICAgaWYgKChtID0gY3NzLm1hdGNoKFJFX0hTTCkpKSB7XG4gICAgICAgICAgICB2YXIgaHNsID0gbS5zbGljZSgxLDQpO1xuICAgICAgICAgICAgaHNsWzFdICo9IDAuMDE7XG4gICAgICAgICAgICBoc2xbMl0gKj0gMC4wMTtcbiAgICAgICAgICAgIHZhciByZ2IkNCA9IGhzbDJyZ2JfMShoc2wpO1xuICAgICAgICAgICAgcmdiJDRbM10gPSAxO1xuICAgICAgICAgICAgcmV0dXJuIHJnYiQ0O1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gaHNsYSgwLDEwMCUsNTAlLDAuNSlcbiAgICAgICAgaWYgKChtID0gY3NzLm1hdGNoKFJFX0hTTEEpKSkge1xuICAgICAgICAgICAgdmFyIGhzbCQxID0gbS5zbGljZSgxLDQpO1xuICAgICAgICAgICAgaHNsJDFbMV0gKj0gMC4wMTtcbiAgICAgICAgICAgIGhzbCQxWzJdICo9IDAuMDE7XG4gICAgICAgICAgICB2YXIgcmdiJDUgPSBoc2wycmdiXzEoaHNsJDEpO1xuICAgICAgICAgICAgcmdiJDVbM10gPSArbVs0XTsgIC8vIGRlZmF1bHQgYWxwaGEgPSAxXG4gICAgICAgICAgICByZXR1cm4gcmdiJDU7XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgY3NzMnJnYi50ZXN0ID0gZnVuY3Rpb24gKHMpIHtcbiAgICAgICAgcmV0dXJuIFJFX1JHQi50ZXN0KHMpIHx8XG4gICAgICAgICAgICBSRV9SR0JBLnRlc3QocykgfHxcbiAgICAgICAgICAgIFJFX1JHQl9QQ1QudGVzdChzKSB8fFxuICAgICAgICAgICAgUkVfUkdCQV9QQ1QudGVzdChzKSB8fFxuICAgICAgICAgICAgUkVfSFNMLnRlc3QocykgfHxcbiAgICAgICAgICAgIFJFX0hTTEEudGVzdChzKTtcbiAgICB9O1xuXG4gICAgdmFyIGNzcz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VudHNbIGxlbiBdO1xuXG4gICAgICAgIHZhciByZWYgPSB1bnBhY2skOShhcmdzLCAncmdiJyk7XG4gICAgICAgIHZhciByID0gcmVmWzBdO1xuICAgICAgICB2YXIgZyA9IHJlZlsxXTtcbiAgICAgICAgdmFyIGIgPSByZWZbMl07XG4gICAgICAgIHZhciBtaW4gPSBNYXRoLm1pbihyLCBnLCBiKTtcbiAgICAgICAgdmFyIG1heCA9IE1hdGgubWF4KHIsIGcsIGIpO1xuICAgICAgICB2YXIgZGVsdGEgPSBtYXggLSBtaW47XG4gICAgICAgIHZhciBjID0gZGVsdGEgKiAxMDAgLyAyNTU7XG4gICAgICAgIHZhciBfZyA9IG1pbiAvICgyNTUgLSBkZWx0YSkgKiAxMDA7XG4gICAgICAgIHZhciBoO1xuICAgICAgICBpZiAoZGVsdGEgPT09IDApIHtcbiAgICAgICAgICAgIGggPSBOdW1iZXIuTmFOO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgaWYgKHIgPT09IG1heCkgeyBoID0gKGcgLSBiKSAvIGRlbHRhOyB9XG4gICAgICAgICAgICBpZiAoZyA9PT0gbWF4KSB7IGggPSAyKyhiIC0gcikgLyBkZWx0YTsgfVxuICAgICAgICAgICAgaWYgKGIgPT09IG1heCkgeyBoID0gNCsociAtIGcpIC8gZGVsdGE7IH1cbiAgICAgICAgICAgIGggKj0gNjA7XG4gICAgICAgICAgICBpZiAoaCA8IDApIHsgaCArPSAzNjA7IH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gW2gsIGMsIF9nXTtcbiAgICB9O1xuXG4gICAgdmFyIHJnYjJoY2dfMSA9IHJnYjJoY2c7XG5cbiAgICB2YXIgdW5wYWNrJGEgPSB1dGlscy51bnBhY2s7XG4gICAgdmFyIGZsb29yID0gTWF0aC5mbG9vcjtcblxuICAgIC8qXG4gICAgICogdGhpcyBpcyBiYXNpY2FsbHkganVzdCBIU1Ygd2l0aCBzb21lIG1pbm9yIHR3ZWFrc1xuICAgICAqXG4gICAgICogaHVlLi4gWzAuLjM2MF1cbiAgICAgKiBjaHJvbWEgLi4gWzAuLjFdXG4gICAgICogZ3JheW5lc3MgLi4gWzAuLjFdXG4gICAgICovXG5cbiAgICB2YXIgaGNnMnJnYiA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgdmFyIGFzc2lnbiwgYXNzaWduJDEsIGFzc2lnbiQyLCBhc3NpZ24kMywgYXNzaWduJDQsIGFzc2lnbiQ1O1xuXG4gICAgICAgIHZhciBhcmdzID0gW10sIGxlbiA9IGFyZ3VtZW50cy5sZW5ndGg7XG4gICAgICAgIHdoaWxlICggbGVuLS0gKSBhcmdzWyBsZW4gXSA9IGFyZ3VtZW50c1sgbGVuIF07XG4gICAgICAgIGFyZ3MgPSB1bnBhY2skYShhcmdzLCAnaGNnJyk7XG4gICAgICAgIHZhciBoID0gYXJnc1swXTtcbiAgICAgICAgdmFyIGMgPSBhcmdzWzFdO1xuICAgICAgICB2YXIgX2cgPSBhcmdzWzJdO1xuICAgICAgICB2YXIgcixnLGI7XG4gICAgICAgIF9nID0gX2cgKiAyNTU7XG4gICAgICAgIHZhciBfYyA9IGMgKiAyNTU7XG4gICAgICAgIGlmIChjID09PSAwKSB7XG4gICAgICAgICAgICByID0gZyA9IGIgPSBfZztcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGlmIChoID09PSAzNjApIHsgaCA9IDA7IH1cbiAgICAgICAgICAgIGlmIChoID4gMzYwKSB7IGggLT0gMzYwOyB9XG4gICAgICAgICAgICBpZiAoaCA8IDApIHsgaCArPSAzNjA7IH1cbiAgICAgICAgICAgIGggLz0gNjA7XG4gICAgICAgICAgICB2YXIgaSA9IGZsb29yKGgpO1xuICAgICAgICAgICAgdmFyIGYgPSBoIC0gaTtcbiAgICAgICAgICAgIHZhciBwID0gX2cgKiAoMSAtIGMpO1xuICAgICAgICAgICAgdmFyIHEgPSBwICsgX2MgKiAoMSAtIGYpO1xuICAgICAgICAgICAgdmFy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7XG4gICAgICAgICAgICB2YXIgciA9IHUgPj4gMTY7XG4gICAgICAgICAgICB2YXIgZyA9IHUgPj4gOCAmIDB4RkY7XG4gICAgICAgICAgICB2YXIgYiA9IHUgJiAweEZGO1xuICAgICAgICAgICAgcmV0dXJuIFtyLGcsYiwxXTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIG1hdGNoIHJnYmEgaGV4IGZvcm1hdCwgZWcgI0ZGMDAwMDc3XG4gICAgICAgIGlmIChoZXgubWF0Y2goUkVfSEVYQSkpIHtcbiAgICAgICAgICAgIGlmIChoZXgubGVuZ3RoID09PSA1IHx8IGhleC5sZW5ndGggPT09IDkpIHtcbiAgICAgICAgICAgICAgICAvLyByZW1vdmUgb3B0aW9uYWwgbGVhZGluZyAjXG4gICAgICAgICAgICAgICAgaGV4ID0gaGV4LnN1YnN0cigxKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIC8vIGV4cGFuZCBzaG9ydC1ub3RhdGlvbiB0byBmdWxsIGVpZ2h0LWRpZ2l0XG4gICAgICAgICAgICBpZiAoaGV4Lmxlbmd0aCA9PT0gNCkge1xuICAgICAgICAgICAgICAgIGhleCA9IGhleC5zcGxpdCgnJyk7XG4gICAgICAgICAgICAgICAgaGV4ID0gaGV4WzBdK2hleFswXStoZXhbMV0raGV4WzFdK2hleFsyXStoZXhbMl0raGV4WzNdK2hleFszXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciB1JDEgPSBwYXJzZUludChoZXgsIDE2KTtcbiAgICAgICAgICAgIHZhciByJDEgPSB1JDEgPj4gMjQgJiAweEZGO1xuICAgICAgICAgICAgdmFyIGckMSA9IHUkMSA+PiAxNiAmIDB4RkY7XG4gICAgICAgICAgICB2YXIgYiQxID0gdSQxID4+IDggJiAweEZGO1xuICAgICAgICAgICAgdmFyIGEgPSBNYXRoLnJvdW5kKCh1JDEgJiAweEZGKSAvIDB4RkYgKiAxMDApIC8gMTAwO1xuICAgICAgICAgICAgcmV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ICAgICAgdmFyIGg7XG4gICAgICAgIHZhciBtaW5fID0gbWluKHIsZyxiKTtcbiAgICAgICAgdmFyIGkgPSAocitnK2IpIC8gMztcbiAgICAgICAgdmFyIHMgPSBpID4gMCA/IDEgLSBtaW5fL2kgOiAwO1xuICAgICAgICBpZiAocyA9PT0gMCkge1xuICAgICAgICAgICAgaCA9IE5hTjtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGggPSAoKHItZykrKHItYikpIC8gMjtcbiAgICAgICAgICAgIGggLz0gc3FydCgoci1nKSooci1nKSArIChyLWIpKihnLWIpKTtcbiAgICAgICAgICAgIGggPSBhY29zKGgpO1xuICAgICAgICAgICAgaWYgKGIgPiBnKSB7XG4gICAgICAgICAgICAgICAgaCA9IFRXT1BJIC0gaDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGggLz0gVFdPUEk7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIFtoKjM2MCxzLGldO1xuICAgIH07XG5cbiAgICB2YXIgcmdiMmhzaV8xID0gcmdiMmhzaTtcblxuICAgIHZhciB1bnBhY2skZSA9IHV0aWxzLnVucGFjaztcbiAgICB2YXIgbGltaXQkMSA9IHV0aWxzLmxpbWl0O1xuICAgIHZhciBUV09QSSQxID0gdXRpbHMuVFdPUEk7XG4gICAgdmFyIFBJVEhJUkQgPSB1dGlscy5QSVRISVJEO1xuICAgIHZhciBjb3MgPSBNYXRoLmNvcztcblxuICAgIC8qXG4gICAgICogaHVlIFswLi4zNjBdXG4gICAgICogc2F0dXJhdGlvbiBbMC4uMV1cbiAgICAgKiBpbnRlbnNpdHkgWzAuLjFdXG4gICAgICovXG4gICAgdmFyIGhzaTJyZ2IgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHZhciBhcmdzID0gW10sIGxlbiA9IGFyZ3VtZW50cy5sZW5ndGg7XG4gICAgICAgIHdoaWxlICggbGVuLS0gKSBhcmdzWyBsZW4gXSA9IGFyZ3VtZW50c1sgbGVuIF07XG5cbiAgICAgICAgLypcbiAgICAgICAgYm9ycm93ZWQgZnJvbSBoZXJlOlxuICAgICAgICBodHRwOi8vaHVtbWVyLnN0YW5mb3JkLmVkdS9tdXNlaW5mby9kb2MvZXhhbXBsZXMvaHVtZHJ1bS9rZXlzY2FwZTIvaHNpMnJnYi5jcHBcbiAgICAgICAgKi9cbiAgICAgICAgYXJncyA9IHVucGFjayRlKGFyZ3MsICdoc2knKTtcbiAgICAgICAgdmFyIGggPSBhcmdzWzBdO1xuICAgICAgICB2YXIgcyA9IGFyZ3NbMV07XG4gICAgICAgIHZhciBpID0gYXJnc1syXTtcbiAgICAgICAgdmFyIHIsZyxiO1xuXG4gICAgICAgIGlmIChpc05hTihoKSkgeyBoID0gMDsgfVxuICAgICAgICBpZiAoaXNOYU4ocykpIHsgcyA9IDA7IH1cbiAgICAgICAgLy8gbm9ybWFsaXplIGh1ZVxuICAgICAgICBpZiAoaCA+IDM2MCkgeyBoIC09IDM2MDsgfVxuICAgICAgICBpZiAoaCA8IDApIHsgaCArPSAzNjA7IH1cbiAgICAgICAgaCAvPSAzNjA7XG4gICAgICAgIGlmIChoIDwgMS8zKSB7XG4gICAgICAgICAgICBiID0gKDEtcykvMztcbiAgICAgICAgICAgIHIgPSAoMStzKmNvcyhUV09QSSQxKmgpL2NvcyhQSVRISVJELVRXT1BJJDEqaCkpLzM7XG4gICAgICAgICAgICBnID0gMSAtIChiK3IpO1xuICAgICAgICB9IGVsc2UgaWYgKGggPCAyLzMpIHtcbiAgICAgICAgICAgIGggLT0gMS8zO1xuICAgICAgICAgICAgciA9ICgxLXMpLzM7XG4gICAgICAgICAgICBnID0gKDErcypjb3MoVFdPUEkkMSpoKS9jb3MoUElUSElSRC1UV09QSSQxKmgpKS8zO1xuICAgICAgICAgICAgYiA9IDEgLSAocitnKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGggLT0gMi8zO1xuICAgICAgICAgICAgZyA9ICgxLXMpLzM7XG4gICAg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87XG4gICAgICAgIHZhciBoLHMsdjtcbiAgICAgICAgdiA9IG1heF8gLyAyNTUuMDtcbiAgICAgICAgaWYgKG1heF8gPT09IDApIHtcbiAgICAgICAgICAgIGggPSBOdW1iZXIuTmFOO1xuICAgICAgICAgICAgcyA9IDA7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBzID0gZGVsdGEgLyBtYXhfO1xuICAgICAgICAgICAgaWYgKHIgPT09IG1heF8pIHsgaCA9IChnIC0gYikgLyBkZWx0YTsgfVxuICAgICAgICAgICAgaWYgKGcgPT09IG1heF8pIHsgaCA9IDIrKGIgLSByKSAvIGRlbHRhOyB9XG4gICAgICAgICAgICBpZiAoYiA9PT0gbWF4XykgeyBoID0gNCsociAtIGcpIC8gZGVsdGE7IH1cbiAgICAgICAgICAgIGggKj0gNjA7XG4gICAgICAgICAgICBpZiAoaCA8IDApIHsgaCArPSAzNjA7IH1cbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gW2gsIHMsIHZdXG4gICAgfTtcblxuICAgIHZhciByZ2IyaHN2ID0gcmdiMmhzbCQxO1xuXG4gICAgdmFyIHVucGFjayRpID0gdXRpbHMudW5wYWNrO1xuICAgIHZhciBmbG9vciQxID0gTWF0aC5mbG9vcjtcblxuICAgIHZhciBoc3YycmdiID0gZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgYXNzaWduLCBhc3NpZ24kMSwgYXNzaWduJDIsIGFzc2lnbiQzLCBhc3NpZ24kNCwgYXNzaWduJDU7XG5cbiAgICAgICAgdmFyIGFyZ3MgPSBbXSwgbGVuID0gYXJndW1lbnRzLmxlbmd0aDtcbiAgICAgICAgd2hpbGUgKCBsZW4tLSApIGFyZ3NbIGxlbiBdID0gYXJndW1lbnRzWyBsZW4gXTtcbiAgICAgICAgYXJncyA9IHVucGFjayRpKGFyZ3MsICdoc3YnKTtcbiAgICAgICAgdmFyIGggPSBhcmdzWzBdO1xuICAgICAgICB2YXIgcyA9IGFyZ3NbMV07XG4gICAgICAgIHZhciB2ID0gYXJnc1syXTtcbiAgICAgICAgdmFyIHIsZyxiO1xuICAgICAgICB2ICo9IDI1NTtcbiAgICAgICAgaWYgKHMgPT09IDApIHtcbiAgICAgICAgICAgIHIgPSBnID0gYiA9IHY7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBpZiAoaCA9PT0gMzYwKSB7IGggPSAwOyB9XG4gICAgICAgICAgICBpZiAoaCA+IDM2MCkgeyBoIC09IDM2MDsgfVxuICAgICAgICAgICAgaWYgKGggPCAwKSB7IGggKz0gMzYwOyB9XG4gICAgICAgICAgICBoIC89IDYwO1xuXG4gICAgICAgICAgICB2YXIgaSA9IGZsb29yJDEoaCk7XG4gICAgICAgICAgICB2YXIgZiA9IGggLSBpO1xuICAgICAgICAgICAgdmFyIHAgPSB2ICogKDEgLSBzKTtcbiAgICAgICAgICAgIHZhciBxID0gdiAqICgxIC0gcyAqIGYpO1xuICAgICAgICAgICAgdmFyIHQgPSB2ICogKDEgLSBzICogKDEgLSBmKSk7XG5cbiAgICAgICAgICAgIHN3aXRjaCAoaSkge1xuICAgICAgICAgICAgICAgIGNhc2UgMDogKGFzc2lnbiA9IFt2LCB0LCBwXSwgciA9IGFzc2lnblswXSwgZyA9IGFzc2lnblsxXSwgYiA9IGFzc2lnblsyXSk7IGJyZWFrXG4gICAgICAgICAgICAgICAgY2FzZSAxOiAoYXNzaWduJDEgPSBbcSwgdiwgcF0sIHIgPSBhc3NpZ24kMVswXSwgZyA9IGFzc2lnbiQxWzFdLCBiID0gYXNzaWduJDFbMl0pOyBicmVha1xuICAgICAgICAgICAgICAgIGNhc2UgMjogKGFzc2lnbiQyID0gW3AsIHYsIHRdLCByID0gYXNzaWduJDJbMF0sIGcgPSBhc3NpZ24kMlsxXSwgYiA9IGFzc2lnbiQyWzJdKTsgYnJlYWtcbiAgICAgICAgICAgICAgICBjYXNlIDM6IChhc3NpZ24kMyA9IFtwLCBxLCB2XSwgciA9IGFzc2lnbiQzWz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xuXG4gICAgaW5wdXQuYXV0b2RldGVjdC5wdXNoKHtcbiAgICAgICAgcDogMixcbiAgICAgICAgdGVzdDogZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyIGFyZ3MgPSBbXSwgbGVuID0gYXJndW1lbnRzLmxlbmd0aDtcbiAgICAgICAgICAgIHdoaWxlICggbGVuLS0gKSBhcmdzWyBsZW4gXSA9IGFyZ3VtZW50c1sgbGVuIF07XG5cbiAgICAgICAgICAgIGFyZ3MgPSB1bnBhY2skaihhcmdzLCAnaHN2Jyk7XG4gICAgICAgICAgICBpZiAodHlwZSQ4KGFyZ3MpID09PSAnYXJyYXknICYmIGFyZ3MubGVuZ3RoID09PSAzKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuICdoc3YnO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfSk7XG5cbiAgICB2YXIgbGFiQ29uc3RhbnRzID0ge1xuICAgICAgICAvLyBDb3JyZXNwb25kcyByb3VnaGx5IHRvIFJHQiBicmlnaHRlci9kYXJrZXJcbiAgICAgICAgS246IDE4LFxuXG4gICAgICAgIC8vIEQ2NSBzdGFuZGFyZCByZWZlcmVudFxuICAgICAgICBYbjogMC45NTA0NzAsXG4gICAgICAgIFluOiAxLFxuICAgICAgICBabjogMS4wODg4MzAsXG5cbiAgICAgICAgdDA6IDAuMTM3OTMxMDM0LCAgLy8gNCAvIDI5XG4gICAgICAgIHQxOiAwLjIwNjg5NjU1MiwgIC8vIDYgLyAyOVxuICAgICAgICB0MjogMC4xMjg0MTg1NSwgICAvLyAzICogdDEgKiB0MVxuICAgICAgICB0MzogMC4wMDg4NTY0NTIsICAvLyB0MSAqIHQxICogdDFcbiAgICB9O1xuXG4gICAgdmFyIHVucGFjayRrID0gdXRpbHMudW5wYWNrO1xuICAgIHZhciBwb3cgPSBNYXRoLnBvdztcblxuICAgIHZhciByZ2IybGFiID0gZnVuY3Rpb24gKCkge1xuICAgICAgICB2YXIgYXJncyA9IFtdLCB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jayR0ID0gdXRpbHMudW5wYWNrO1xuXG4gICAgdmFyIHJnYjJudW0gPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgIHZhciBhcmdzID0gW10sIGxlbiA9IGFyZ3VtZW50cy5sZW5ndGg7XG4gICAgICAgIHdoaWxlICggbGVuLS0gKSBhcmdzWyBsZW4gXSA9IGFyZ3VtZW50c1sgbGVuIF07XG5cbiAgICAgICAgdmFyIHJlZiA9IHVucGFjayR0KGFyZ3MsICdyZ2InKTtcbiAgICAgICAgdmFyIHIgPSByZWZbMF07XG4gICAgICAgIHZhciBnID0gcmVmWzFdO1xuICAgICAgICB2YXIgYiA9IHJlZlsyXTtcbiAgICAgICAgcmV0dXJuIChyIDw8IDE2KSArIChnIDw8IDgpICsgYjtcbiAgICB9O1xuXG4gICAgdmFyIHJnYjJudW1fMSA9IHJnYjJudW07XG5cbiAgICB2YXIgdHlwZSRjID0gdXRpbHMudHlwZTtcblxuICAgIHZhciBudW0ycmdiID0gZnVuY3Rpb24gKG51bSkge1xuICAgICAgICBpZiAodHlwZSRjKG51bSkgPT0gXCJudW1iZXJcIiAmJiBudW0gPj0gMCAmJiBudW0gPD0gMHhGRkZGRkYpIHtcbiAgICAgICAgICAgIHZhciByID0gbnVtID4+IDE2O1xuICAgICAgICAgICAgdmFyIGcgPSAobnVtID4+IDgpICYgMHhGRjtcbiAgICAgICAgICAgIHZhciBiID0gbnVtICYgMHhGRjtcbiAgICAgICAgICAgIHJldHVybiBbcixnLGIsMV07XG4gICAgICAgIH1cbiAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwidW5rbm93biBudW0gY29sb3I6IFwiK251bSk7XG4gICAgfTtcblxuICAgIHZhciBudW0ycmdiXzEgPSBudW0ycmdiO1xuXG4gICAgdmFyIHR5cGUkZCA9IHV0aWxzLnR5cGU7XG5cblxuXG4gICAgQ29sb3JfMS5wcm90b3R5cGUubnVtID0gZnVuY3Rpb24oKSB7XG4gICAgICAgIHJldHVybiByZ2IybnVtXzEodG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kge1xuICAgICAgICAgICAgdmFyIGkgPSBtb2RlLmluZGV4T2YoY2hhbm5lbCk7XG4gICAgICAgICAgICBpZiAoaSA+IC0xKSB7IHJldHVybiBzcmNbaV07IH1cbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigoXCJ1bmtub3duIGNoYW5uZWwgXCIgKyBjaGFubmVsICsgXCIgaW4gbW9kZSBcIiArIG1vZGUpKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBzcmM7XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgdmFyIHR5cGUkZyA9IHV0aWxzLnR5cGU7XG4gICAgdmFyIHBvdyQyID0gTWF0aC5wb3c7XG5cbiAgICB2YXIgRVBTID0gMWUtNztcbiAgICB2YXIgTUFYX0lURVIgPSAyMDtcblxuICAgIENvbG9yXzEucHJvdG90eXBlLmx1bWluYW5jZSA9IGZ1bmN0aW9uKGx1bSkge1xuICAgICAgICBpZiAobHVtICE9PSB1bmRlZmluZWQgJiYgdHlwZSRnKGx1bSkgPT09ICdudW1iZXInKSB7XG4gICAgICAgICAgICBpZiAobHVtID09PSAwKSB7XG4gICAgICAgICAgICAgICAgLy8gcmV0dXJuIHB1cmUgYmxhY2tcbiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IENvbG9yXzEoWzAsMCwwLHRoaXMuX3JnYlszXV0sICdyZ2InKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChsdW0gPT09IDEpIHtcbiAgICAgICAgICAgICAgICAvLyByZXR1cm4gcHVyZSB3aGl0ZVxuICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQ29sb3JfMShbMjU1LDI1NSwyNTUsdGhpcy5fcmdiWzNdXSwgJ3JnYicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgLy8gY29tcHV0ZSBuZXcgY29sb3IgdXNpbmcuLi5cbiAgICAgICAgICAgIHZhciBjdXJfbHVtID0gdGhpcy5sdW1pbmFuY2UoKT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XIgcmVmID0gbWMuc3BsaXQoJy4nKTtcbiAgICAgICAgdmFyIG1vZGUgPSByZWZbMF07XG4gICAgICAgIHZhciBjaGFubmVsID0gcmVmWzFdO1xuICAgICAgICB2YXIgc3JjID0gdGhpc1ttb2RlXSgpO1xuICAgICAgICBpZiAoY2hhbm5lbCkge1xuICAgICAgICAgICAgdmFyIGkgPSBtb2RlLmluZGV4T2YoY2hhbm5lbCk7XG4gICAgICAgICAgICBpZiAoaSA+IC0xKSB7XG4gICAgICAgICAgICAgICAgaWYgKHR5cGUkaSh2YWx1ZSkgPT0gJ3N0cmluZycpIHtcbiAgICAgICAgICAgICAgICAgICAgc3dpdGNoKHZhbHVlLmNoYXJBdCgwKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnKyc6IHNyY1tpXSArPSArdmFsdWU7IGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnLSc6IHNyY1tpXSArPSArdmFsdWU7IGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnKic6IHNyY1tpXSAqPSArKHZhbHVlLnN1YnN0cigxKSk7IGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgY2FzZSAnLyc6IHNyY1tpXSAvPSArKHZhbHVlLnN1YnN0cigxKSk7IGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgZGVmYXVsdDogc3JjW2ldID0gK3ZhbHVlO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmICh0eXBlJGkodmFsdWUpID09PSAnbnVtYmVyJykge1xuICAgICAgICAgICAgICAgICAgICBzcmNbaV0gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0aHJvdyBuZXcgRXJyb3IoXCJ1bnN1cHBvcnRlZCB2YWx1ZSBmb3IgQ29sb3Iuc2V0XCIpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB2YXIgb3V0ID0gbmV3IENvbG9yXzEoc3JjLCBtb2RlKTtcbiAgICAgICAgICAgICAgICBpZiAobXV0YXRlKSB7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuX3JnYiA9IG91dC5fcmdiO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdGhpcztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgcmV0dXJuIG91dDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcigoXCJ1bmtub3duIGNoYW5uZWwgXCIgKyBjaGFubmVsICsgXCIgaW4gbW9kZSBcIiArIG1vZGUpKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIHJldHVybiBzcmM7XG4gICAgICAgIH1cbiAgICB9O1xuXG4gICAgdmFyIHJnYiQxID0gZnVuY3Rpb24gKGNvbDEsIGNvbDIsIGYpIHtcbiAgICAgICAgdmFyIHh5ejAgPSBjb2wxLl9yZ2I7XG4gICAgICAgIHZhciB4eXoxID0gY29sMi5fcmdiO1xuICAgICAgICByZXR1cm4gbmV3IENvbG9yXzEoXG4gICAgICAgICAgICB4eXowWzBdICsgZiAqICh4eXoxWzBdLXh5ejBbMF0pLFxuICAgICAgICAgICAgeHl6MFsxXSArIGYgKiAoeHl6MVsxXS14eXowWzFdKSxcbiAgICAgICAgICAgIHh5ejBbMl0gKyBmICogKHh5ejFbMl0teHl6MFsyXSksXG4gICAgICAgICAgICAncmdiJ1xuICAgICAgICApXG4gICAgfTtcblxuICAgIC8vIHJlZ2lzdGVyIGludGVycG9sYXRvclxuICAgIGludGVycG9sYXRvci5yZ2IgPSByZ2IkMTtcblxuICAgIHZhciBzcXJ0JDIgPSBNYXRoLnNxcnQ7XG4gICAgdmFyIHBvdyQzID0gTWF0aC5wb3c7XG5cbiAgICB2YXIgbHJnYiA9IGZ1bmN0aW9uIChjb2wxLCBjb2wyLCBmKSB7XG4gICAgICAgIHZhciByZWYgPSBjb2wxLl9yZ2I7XG4gICAgICAgIHZhciB4MSA9IHJlZlswXTtcbiAgICAgICAgdmFyIHkxID0gcmVmWzFdO1xuICAgICAgICB2YXIgejEgPSByZWZbMl07XG4gICAgICAgIHZhciByZWYkMSA9IGNvbDIuX3JnYjtcbiAgICAgICAgdmFyIHgyID0gcmVmJDFbMF07XG4gICAgICAgIHZhciB5MiA9IHJlZiQxWzFdO1xuICAgICAgICB2YXIgejIgPSByZWYkMVsyXTtcbiAgICAgICAgcmV0dXJuIG5ldyBDb2xvcl8xKFxuICAgICAgICAgICAgc3FydCQyKHBvdyQzKHgxLDIpICogKDEtZikgKyBwb3ckMyh4MiwyKSAqIGYpLFxuICAgICAgICAgICAgc3FydCQyKHBvdyQzKHkxLDIpICogKDEtZikgKyBwb3ckMyh5MiwyKSAqIGYpLFxuICAgICAgICAgICAgc3FydCQyKHBvdyQzKHoxLDIpICogKDEtZikgKyBwb3ckMyh6MiwyKSAqIGYpLFxuICAgICAgICAgICAgJ3JnYidcbiAgICAgICAgKVxuICAgIH07XG5cbiAgICAvLyByZWdpc3RlciBpbnRlcnBvbGF0b3JcbiAgICBpbnRlcnBvbGF0b3IubHJnYiA9IGxyZ2I7XG5cbiAgICB2YXIgbGFiJDEgPSBmdW5jdGlvbiAoY29sMSwgY29sMiwgZikge1xuICAgICAgICB2YXIgeHl6MCA9IGNvbDEubGFiKCk7XG4gICAgICAgIHZhciB4eXoxID0gY29sMi5sYWIoKTtcbiAgICAgICAgcmV0dXJuIG5ldyBDb2xvcl8xKFxuICAgICAgICAgICAgeHl6MFswXSArIGYgKiAoeHl6MVswXS14eXowWzBdKSxcbiAgICAgICAgICAgIHh5ejBbMV0gKyBmICogKHh5ejFbMV0teHl6MFsxXSksXG4gICAgICAgICAgICB4eXowWzJdICsgZiAqICh4eXoxWzJdLXh5ejBbMl0pLFxuICAgICAgICAgICAgJ2xhYidcbiAgICAgICAgKVxuICAgIH07XG5cbiAgICAvLyByZWdpc3Rlci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wID0gYXNzaWduWzFdLCBsYnYwID0gYXNzaWduWzJdKTtcbiAgICAgICAgICAgIChhc3NpZ24kMSA9IHh5ejEsIGh1ZTEgPSBhc3NpZ24kMVswXSwgc2F0MSA9IGFzc2lnbiQxWzFdLCBsYnYxID0gYXNzaWduJDFbMl0pO1xuICAgICAgICB9XG5cbiAgICAgICAgdmFyIHNhdCwgaHVlLCBsYnYsIGRoO1xuXG4gICAgICAgIGlmICghaXNOYU4oaHVlMCkgJiYgIWlzTmFOKGh1ZTEpKSB7XG4gICAgICAgICAgICAvLyBib3RoIGNvbG9ycyBoYXZlIGh1ZVxuICAgICAgICAgICAgaWYgKGh1ZTEgPiBodWUwICYmIGh1ZTEgLSBodWUwID4gMTgwKSB7XG4gICAgICAgICAgICAgICAgZGggPSBodWUxLShodWUwKzM2MCk7XG4gICAgICAgICAgICB9IGVsc2UgaWYgKGh1ZTEgPCBodWUwICYmIGh1ZTAgLSBodWUxID4gMTgwKSB7XG4gICAgICAgICAgICAgICAgZGggPSBodWUxKzM2MC1odWUwO1xuICAgICAgICAgICAgfSBlbHNle1xuICAgICAgICAgICAgICAgIGRoID0gaHVlMSAtIGh1ZTA7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBodWUgPSBodWUwICsgZiAqIGRoO1xuICAgICAgICB9IGVsc2UgaWYgKCFpc05hTihodWUwKSkge1xuICAgICAgICAgICAgaHVlID0gaHVlMDtcbiAgICAgICAgICAgIGlmICgobGJ2MSA9PSAxIHx8IGxidjEgPT0gMCkgJiYgbSAhPSAnaHN2JykgeyBzYXQgPSBzYXQwOyB9XG4gICAgICAgIH0gZWxzZSBpZiAoIWlzTmFOKGh1ZTEpKSB7XG4gICAgICAgICAgICBodWUgPSBodWUxO1xuICAgICAgICAgICAgaWYgKChsYnYwID09IDEgfHwgbGJ2MCA9PSAwKSAmJiBtICE9ICdoc3YnKSB7IHNhdCA9IHNhdDE7IH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGh1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6W2ldIC8gMTgwICogUEkkMTtcbiAgICAgICAgICAgICAgICBkeCArPSBjb3MkMihBKSAqIHdlaWdodHNbMF07XG4gICAgICAgICAgICAgICAgZHkgKz0gc2luJDEoQSkgKiB3ZWlnaHRzWzBdO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgdmFyIGFscGhhID0gZmlyc3QuYWxwaGEoKSAqIHdlaWdodHNbMF07XG4gICAgICAgIGNvbG9ycy5mb3JFYWNoKGZ1bmN0aW9uIChjLGNpKSB7XG4gICAgICAgICAgICB2YXIgeHl6MiA9IGMuZ2V0KG1vZGUpO1xuICAgICAgICAgICAgYWxwaGEgKz0gYy5hbHBoYSgpICogd2VpZ2h0c1tjaSsxXTtcbiAgICAgICAgICAgIGZvciAodmFyIGk9MDsgaTx4eXoubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAoIWlzTmFOKHh5ejJbaV0pKSB7XG4gICAgICAgICAgICAgICAgICAgIGNudFtpXSArPSB3ZWlnaHRzW2NpKzFdO1xuICAgICAgICAgICAgICAgICAgICBpZiAobW9kZS5jaGFyQXQoaSkgPT09ICdoJykge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIEEgPSB4eXoyW2ldIC8gMTgwICogUEkkMTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGR4ICs9IGNvcyQyKEEpICogd2VpZ2h0c1tjaSsxXTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGR5ICs9IHNpbiQxKEEpICogd2VpZ2h0c1tjaSsxXTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHh5eltpXSArPSB4eXoyW2ldICogd2VpZ2h0c1tjaSsxXTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG5cbiAgICAgICAgZm9yICh2YXIgaSQxPTA7IGkkMTx4eXoubGVuZ3RoOyBpJDErKykge1xuICAgICAgICAgICAgaWYgKG1vZGUuY2hhckF0KGkkMSkgPT09ICdoJykge1xuICAgICAgICAgICAgICAgIHZhciBBJDEgPSBhdGFuMiQxKGR5IC8gY250W2kkMV0sIGR4IC8gY250W2kkMV0pIC8gUEkkMSAqIDE4MDtcbiAgICAgICAgICAgICAgICB3aGlsZSAoQSQxIDwgMCkgeyBBJDEgKz0gMzYwOyB9XG4gICAgICAgICAgICAgICAgd2hpbGUgKEEkMSA+PSAzNjApIHsgQSQxIC09IDM2MDsgfVxuICAgICAgICAgICAgICAgIHh5eltpJDFdID0gQSQxO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB4eXpbaSQxXSA9IHh5eltpJDFdL2NudFtpJDFdO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGFscGhhIC89IGw7XG4gICAgICAgIHJldHVybiAobmV3IENvbG9yXzEoeHl6LCBtb2RlKSkuYWxwaGEoYWxwaGEgPiAwLjk5OTk5ID8gMSA6IGFscGhhLCB0cnVlKTtcbiAgICB9O1xuXG5cbiAgICB2YXIgX2F2ZXJhZ2VfbHJnYiA9IGZ1bmN0aW9uIChjb2xvcnMsIHdlaWdodHMpIHtcbiAgICAgICAgdmFyIGwgPSBjb2xvcnMubGVuZ3RoO1xuICAgICAgICB2YXIgeHl6ID0gWzAsMCwwLDBdO1xuICAgICAgICBmb3IgKHZhciBpPTA7IGkgPCBjb2xvcnMubGVuZ3RoOyBpKyspIHtcbiAgICAgICAgICAgIHZhciBjb2wgPSBjb2xvcnNbaV07XG4gICAgICAgICAgICB2YXIgZiA9IHdlaWdodHNbaV0gLyBsO1xuICAgICAgICAgICAgdmFyIHJnYiA9IGNvbC5fcmdiO1xuICAgICAgICAgICAgeHl6WzBdICs9IHBvdyQ0KHJnYlswXSwyKSAqIGY7XG4gICAgICAgICAgICB4eXpbMV0gKz0gcG93JDQocmdiWzFdLDIpICogZjtcbiAgICAg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MTtcbiAgICAgICAgdmFyIF9jb3JyZWN0TGlnaHRuZXNzID0gZmFsc2U7XG4gICAgICAgIHZhciBfY29sb3JDYWNoZSA9IHt9O1xuICAgICAgICB2YXIgX3VzZUNhY2hlID0gdHJ1ZTtcbiAgICAgICAgdmFyIF9nYW1tYSA9IDE7XG5cbiAgICAgICAgLy8gcHJpdmF0ZSBtZXRob2RzXG5cbiAgICAgICAgdmFyIHNldENvbG9ycyA9IGZ1bmN0aW9uKGNvbG9ycykge1xuICAgICAgICAgICAgY29sb3JzID0gY29sb3JzIHx8IFsnI2ZmZicsICcjMDAwJ107XG4gICAgICAgICAgICBpZiAoY29sb3JzICYmIHR5cGUkaihjb2xvcnMpID09PSAnc3RyaW5nJyAmJiBjaHJvbWFfMS5icmV3ZXIgJiZcbiAgICAgICAgICAgICAgICBjaHJvbWFfMS5icmV3ZXJbY29sb3JzLnRvTG93ZXJDYXNlKCldKSB7XG4gICAgICAgICAgICAgICAgY29sb3JzID0gY2hyb21hXzEuYnJld2VyW2NvbG9ycy50b0xvd2VyQ2FzZSgpXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmICh0eXBlJGooY29sb3JzKSA9PT0gJ2FycmF5Jykge1xuICAgICAgICAgICAgICAgIC8vIGhhbmRsZSBzaW5nbGUgY29sb3JcbiAgICAgICAgICAgICAgICBpZiAoY29sb3JzLmxlbmd0aCA9PT0gMSkge1xuICAgICAgICAgICAgICAgICAgICBjb2xvcnMgPSBbY29sb3JzWzBdLCBjb2xvcnNbMF1dO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAvLyBtYWtlIGEgY29weSBvZiB0aGUgY29sb3JzXG4gICAgICAgICAgICAgICAgY29sb3JzID0gY29sb3JzLnNsaWNlKDApO1xuICAgICAgICAgICAgICAgIC8vIGNvbnZlcnQgdG8gY2hyb21hIGNsYXNzZXNcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBjPTA7IGM8Y29sb3JzLmxlbmd0aDsgYysrKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbG9yc1tjXSA9IGNocm9tYV8xKGNvbG9yc1tjXSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIC8vIGF1dG8tZmlsbCBjb2xvciBwb3NpdGlvblxuICAgICAgICAgICAgICAgIF9wb3MubGVuZ3RoID0gMDtcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBjJDE9MDsgYyQxPGNvbG9ycy5sZW5ndGg7IGMkMSsrKSB7XG4gICAgICAgICAgICAgICAgICAgIF9wb3MucHVzaChjJDEvKGNvbG9ycy5sZW5ndGgtMSkpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJlc2V0Q2FjaGUoKTtcbiAgICAgICAgICAgIHJldHVybiBfY29sb3JzID0gY29sb3JzO1xuICAgICAgICB9O1xuXG4gICAgICAgIHZhciBnZXRDbGFzcyA9IGZ1bmN0aW9uKHZhbHVlKSB7XG4gICAgICAgICAgICBpZiAoX2NsYXNzZXMgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIHZhciBuID0gX2NsYXNzZXMubGVuZ3RoLTE7XG4gICAgICAgICAgICAgICAgdmFyIGkgPSAwO1xuICAgICAgICAgICAgICAgIHdoaWxlIChpIDwgbiAmJiB2YWx1ZSA+PSBfY2xhc3Nlc1tpXSkge1xuICAgICAgICAgICAgICAgICAgICBpKys7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBpLTE7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gMDtcbiAgICAgICAgfTtcblxuICAgICAgICB2YXIgdE1hcExpZ2h0bmVzcyA9IGZ1bmN0aW9uICh0KSB7IHJldHVybiB0OyB9O1xuICAgICAgICB2YXIgdE1hcERvbWFpbiA9IGZ1bmN0aW9uICh0KSB7IHJldHVybiB0OyB9O1xuXG4gICAgICAgIC8vIGNvbnN0IGNsYXNzaWZ5Vm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biAgICAgICAgICAgIGlmICghYnlwYXNzTWFwKSB7XG4gICAgICAgICAgICAgICAgaWYgKF9jbGFzc2VzICYmIChfY2xhc3Nlcy5sZW5ndGggPiAyKSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBmaW5kIHRoZSBjbGFzc1xuICAgICAgICAgICAgICAgICAgICB2YXIgYyA9IGdldENsYXNzKHZhbCk7XG4gICAgICAgICAgICAgICAgICAgIHQgPSBjIC8gKF9jbGFzc2VzLmxlbmd0aC0yKTtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKF9tYXggIT09IF9taW4pIHtcbiAgICAgICAgICAgICAgICAgICAgLy8ganVzdCBpbnRlcnBvbGF0ZSBiZXR3ZWVuIG1pbi9tYXhcbiAgICAgICAgICAgICAgICAgICAgdCA9ICh2YWwgLSBfbWluKSAvIChfbWF4IC0gX21pbik7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgdCA9IDE7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0ID0gdmFsO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBkb21haW4gbWFwXG4gICAgICAgICAgICB0ID0gdE1hcERvbWFpbih0KTtcblxuICAgICAgICAgICAgaWYgKCFieXBhc3NNYXApIHtcbiAgICAgICAgICAgICAgICB0ID0gdE1hcExpZ2h0bmVzcyh0KTsgIC8vIGxpZ2h0bmVzcyBjb3JyZWN0aW9uXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmIChfZ2FtbWEgIT09IDEpIHsgdCA9IHBvdyQ1KHQsIF9nYW1tYSk7IH1cblxuICAgICAgICAgICAgdCA9IF9wYWRkaW5nWzBdICsgKHQgKiAoMSAtIF9wYWRkaW5nWzBdIC0gX3BhZGRpbmdbMV0pKTtcblxuICAgICAgICAgICAgdCA9IE1hdGgubWluKDEsIE1hdGgubWF4KDAsIHQpKTtcblxuICAgICAgICAgICAgdmFyIGsgPSBNYXRoLmZsb29yKHQgKiAxMDAwMCk7XG5cbiAgICAgICAgICAgIGlmIChfdXNlQ2FjaGUgJiYgX2NvbG9yQ2FjaGVba10pIHtcbiAgICAgICAgICAgICAgICBjb2wgPSBfY29sb3JDYWNoZVtrXTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKHR5cGUkaihfY29sb3JzKSA9PT0gJ2FycmF5Jykge1xuICAgICAgICAgICAgICAgICAgICAvL2ZvciBpIGluIFswLi5fcG9zLmxlbmd0aC0xXVxuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpPTA7IGk8X3Bvcy5sZW5ndGg7IGkrKykge1xuICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHAgPSBfcG9zW2ldO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPD0gcCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbCA9IF9jb2xvcnNbaV07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoKHQgPj0gcCkgJiYgKGkgPT09IChfcG9zLmxlbmd0aC0xKSkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2wgPSBfY29sb3JzW2ldO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPiBwICYmIHQgPCBfcG9zW2krMV0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ID0gKHQtcCkvKF9wb3NbaSsxXS1wKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBjb2wgPSBjaHJvbWFfMS5pbnRlcnBvbGF0ZShfY29sb3JzW2ldLCBfY29sb3JzW2krMV0sIHQsIF9tb2RlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAodHlwZSRqKF9jb2xvcnMpID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbCA9IF9jb2xvcnModCk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChfdXNlQ2FjaGUpIHsgX2NvbG9yQ2FjaGVba10gPSBjb2w7IH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBjb2w7XG4gICAgICAgIH07XG5cbiAgICAgICAgdmFyIHJlc2V0Q2FjaGUgPSBmdW5jdGlvbiAoKSB7IHJldHVybiBfY29sb3JDYWNoZSA9IHt9OyB9O1xuXG4gICAgICAgIHNldENvbG9ycyhjb2xvcnMpO1xuXG4gICAgICAgIC8vIHB1YmxpYyBpbnRlcmZhY2VcblxuICAgICAgICB2YXIgZiA9IGZ1bmN0aW9uKHYpIHtcbiAgICAgICAgICAgIHZhciBjID0gY2hyb21hXzEoZ2V0Q29sb3IodikpO1xuICAgICAgICAgICAgaWYgKF9vdXQgJiYgY1tfb3V0XSkgeyByZXR1cm4gY1tfb3V0XSgpOyB9IGVsc2UgeyByZXR1cm4gYzsgfVxuICAgICAgICB9O1xuXG4gICAgICAgIGYuY2xhc3NlcyA9IGZ1bmN0aW9uKGNsYXNzZXMpIHtcbiAgICAgICAgICAgIGlmIChjbGFzc2VzICE9IG51bGwpIHtcbiAgICAgICAgICAgICAgICBpZiAodHlwZSRqKGNsYXNzZXMpID09PSAnYXJyYXknKSB7XG4gICAgICAgICAgICAgICAgICAgIF9jbGFzc2VzID0gY2xhc3NlcztcbiAgICAgICAgICAgICAgICAgICAgX2RvbWFpbiA9IFtjbGFzc2VzWzBdLCBjbGFzc2VzW2NsYXNzZXMubGVuZ3RoLTFdXTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB2YXIgZCA9IGNocm9tYV8xLmFuYWx5emUoX2RvbWFpbik7XG4gICAgICAgICAgICAgICAgICAgIGlmIChjbGFzc2VzID09PSAwKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBfY2xhc3NlcyA9IFtkLm1pbiwgZC5tYXhdO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgX2NsYXNzZXMgPSBjaHJvbWFfMS5saW1pdHMoZCwgJ2UnLCBjbGFzc2VzKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICByZXR1cm4gZjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBfY2xhc3NlcztcbiAgICAgICAgfTtcblxuXG4gICAgICAgIGYuZG9tYWluID0gZnVuY3Rpb24oZG9tYWluKSB7XG4gICAgICAgICAgICBpZiAoIWFyZ3VtZW50cy5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gX2RvbWFpbjtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF9taW4gPSBkb21haW5bMF07XG4gICAgICAgICAgICBfbWF4ID0gZG9tYWluW2RvbWFpbi5sZW5ndGgtMV07XG4gICAgICAgICAgICBfcG9zID0gW107XG4gICAgICAgICAgICB2YXIgayA9IF9jb2xvcnMubGVuZ3RoO1xuICAgICAgICAgICAgaWYgKChkb21haW4ubGVuZ3RoID09PSBrKSAmJiAoX21pbiAhPT0gX21heCkpIHtcbiAgICAgICAgICAgICAgICAvLyB1cGRhdGUgcG9zaXRpb25zXG4gICAgICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIGxpc3QgPSBBcnJheS5mcm9tKGRvbWFpbik7IGkgPCBsaXN0Lmxlbmd0aDsgaSArPSAxKSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBkID0gbGlzdFtpXTtcblxuICAgICAgICAgICAgICAgICAgX3Bvcy5wdXNoKChkLV9taW4pIC8gKF9tYXgtX21pbikpO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgZm9yICh2YXIgYz0wOyBjPGs7IGMrKykge1xuICAgICAgICAgICAgICAgICAgICBfcG9zLnB1c2goYy8oay0xKSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGlmIChkb21haW4ubGVuZ3RoID4gMikge1xuICAgICAgICAgICAgICAgICAgICAvLyBzZXQgZG9tYWluIG1hcFxuICAgICAgICAgICAgICAgICAgICB2YXIgdE91dCA9IGRvbWFpbi5tYXAoZnVuY3Rpb24gKGQsaSkgeyByZXR1cm4gaS8oZG9tYWluLmxlbmd0aC0xKTsgfSk7XG4gICAgICAgICAgICAgICAgICAgIHZhciB0QnJlYWtzID0gZG9tYWluLm1hcChmdW5jdGlvbiAoZCkgeyByZXR1cm4gKGQgLSBfbWluKSAvIChfbWF4IC0gX21pbik7IH0pO1xuICAgICAgICAgICAgICAgICAgICBpZiAoIXRCcmVha3MuZXZlcnkoZnVuY3Rpb24gKHZhbCwgaSkgeyByZXR1cm4gdE91dFtpXSA9PT0gdmFsOyB9KSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgdE1hcERvbWFpbiA9IGZ1bmN0aW9uICh0KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHQgPD0gMCB8fCB0ID49IDEpIHsgcmV0dXJuIHQ7IH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgaSA9IDA7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKHQgPj0gdEJyZWFrc1tpKzFdKSB7IGkrKzsgfVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHZhciBmID0gKHQgLSB0QnJlYWtzW2ldKSAvICh0QnJlYWtzW2krMV0gLSB0QnJlYWtzW2ldKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2YXIgb3V0ID0gdE91dFtpXSArIGYgKiAodE91dFtpKzFdIC0gdE91dFtpXSk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG91dDtcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIF9kb21haW4gPSBbX21pbiwgX21heF07XG4gICAgICAgICAgICByZXR1cm4gZjtcbiAgICAgICAgfTtcblxuICAgICAgICBmLm1vZGUgPSBmdW5jdGlvbihfbSkge1xuICAgICAgICAgICAgaWYgKCFhcmd1bWVudHMubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIF9tb2RlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgX21vZGUgPSBfbTtcbiAgICAgICAgICAgIHJlc2V0Q2FjaGUoKTtcbiAgICAgICAgICAgIHJldHVybiBmO1xuICAgICAgICB9O1xuXG4gICAgICAgIGYucmFuZ2UgPSBmdW5jdGlvbihjb2xvcnMsIF9wb3MpIHtcbiAgICAgICAgICAgIHNldENvbG9ycyhjb2xvcnMsIF9wb3MpO1xuICAgICAgICAgICAgcmV0dXJuIGY7XG4gICAgICAgIH07XG5cbiAgICAgICAgZi5vdXQgPSBmdW5jdGlvbihfbykge1xuICAgICAgICAgICAgX291dCA9IF9vO1xuICAgICAgICAgICAgcmV0dXJuIGY7XG4gICAgICAgIH07XG5cbiAgICAgICAgZi5zcHJlYWQgPSBmdW5jdGlvbih2YWwpIHtcbiAgICAgICAgICAgIGlmICghYXJndW1lbnRzLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgIHJldHVybiBfc3ByZWFkO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgX3NwcmVhZCA9IHZhbDtcbiAgICAgICAgICAgIHJldHVybiBmO1xuICAgICAgICB9O1xuXG4gICAgICAgIGYuY29ycmVjdExpZ2h0bmVzcyA9IGZ1bmN0aW9uKHYpIHtcbiAgICAgICAgICAgIGlmICh2ID09IG51bGwpIHsgdiA9IHRydWU7IH1cbiAgICAgICAgICAgIF9jb3JyZWN0TGlnaHRuZXNzID0gdjtcbiAgICAgICAgICAgIHJlc2V0Q2FjaGUoKTtcbiAgICAgICAgICAgIGlmIChfY29ycmVjdExpZ2h0bmVzcykge1xuICAgICAgICAgICAgICAgIHRNYXBMaWdodG5lc3MgPSBmdW5jdGlvbih0KSB7XG4gICAgICAgICAgICAgICAgICAgIHZhciBMMCA9IGdldENvbG9yKDAsIHRydWUpLmxhYigpWzBdO1xuICAgICAgICAgICAgICAgICAgICB2YXIgTDEgPSBnZXRDb2xvcigxLCB0cnVlKS5sYWIoKVswXTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIHBvbCA9IEwwID4gTDE7XG4gICAgICAgICAgICAgICAgICAgIHZhciBMX2FjdHVhbCA9IGdldENvbG9yKHQsIHRydWUpLmxhYigpWzBdO1xuICAgICAgICAgICAgICAgICAgICB2YXIgTF9pZGVhbCA9IEwwICsgKChMMSAtIEwwKSAqIHQpO1xuICAgICAgICAgICAgICAgICAgICB2YXIgTF9kaWZmID0gTF9hY3R1YWwgLSBMX2lkZWFsO1xuICAgICAgICAgICAgICAgICAgICB2YXIgdDAgPSAwO1xuICAgICAgICAgICAgICAgICAgICB2YXIgdDEgPSAxO1xuICAgICAgICAgICAgICAgICAgICB2YXIgbWF4X2l0ZXIgPSAyMDtcbiAgICAgICAgICAgICAgICAgICAgd2hpbGUgKChNYXRoLmFicyhMX2RpZmYpID4gMWUtMikgJiYgKG1heF9pdGVyLS0gPiAwKSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgKGZ1bmN0aW9uKCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChwb2wpIHsgTF9kaWZmICo9IC0xOyB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKExfZGlmZiA8IDApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdDAgPSB0O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0ICs9ICh0MSAtIHQpICogMC41O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHQxID0gdDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdCArPSAodDAgLSB0KSAqIDAuNTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgTF9hY3R1YWwgPSBnZXRDb2xvcih0LCB0cnVlKS5sYWIoKVswXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gTF9kaWZmID0gTF9hY3R1YWwgLSBMX2lkZWFsO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSkoKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gdDtcbiAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB0TWFwTGlnaHRuZXNzID0gZnVuY3Rpb24gKHQpIHsgcmV0dXJuIHQ7IH07XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gZjtcbiAgICAgICAgfTtcblxuICAgICAgICBmLnBhZGRpbmcgPSBmdW5jdGlvbihwKSB7XG4gICAgICAgICAgICBpZiAocCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgaWYgKHR5cGUkaihwKSA9PT0gJ251bWJlcicpIHtcbiAgICAgICAgICAgICAgICAgICAgcCA9IFtwLHBdO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBfcGFkZGluZyA9IHA7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGY7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBfcGFkZGluZztcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcblxuICAgICAgICBmLmNvbG9ycyA9IGZ1bmN0aW9uKG51bUNvbG9ycywgb3V0KSB7XG4gICAgICAgICAgICAvLyBJZiBubyBhcmd1bWVudHMgYXJlIGdpdmVuLCByZXR1cm4gdGhlIG9yaWdpbmFsIGNvbG9ycyB0aGF0IHdlcmUgcHJvdmlkZWRcbiAgICAgICAgICAgIGlmIChhcmd1bWVudHMubGVuZ3RoIDwgMikgeyBvdXQgPSAnaGV4JzsgfVxuICAgICAgICAgICAgdmFyIHJlc3VsdCA9IFtdO1xuXG4gICAgICAgICAgICBpZiAoYXJndW1lbnRzLmxlbmd0aCA9PT0gMCkge1xuICAgICAgICAgICAgICAgIHJlc3VsdCA9IF9jb2xvcnMuc2xpY2UoMCk7XG5cbiAgICAgICAgICAgIH0gZWxzZSBpZiAobnVtQ29sb3JzID09PSAxKSB7XG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gW2YoMC41KV07XG5cbiAgICAgICAgICAgIH0gZWxzZSBpZiAobnVtQ29sb3JzID4gMSkge1xuICAgICAgICAgICAgICAgIHZhciBkbSA9IF9kb21haW5bMF07XG4gICAgICAgICAgICAgICAgdmFyIGRkID0gX2RvbWFpblsxXSAtIGRtO1xuICAgICAgICAgICAgICAgIHJlc3VsdCA9IF9fcmFuZ2VfXygwLCBudW1Db2xvcnMsIGZhbHNlKS5tYXAoZnVuY3Rpb24gKGkpIHsgcmV0dXJuIGYoIGRtICsgKChpLyhudW1Db2xvcnMtMSkpICogZGQpICk7IH0pO1xuXG4gICAgICAgICAgICB9IGVsc2UgeyAvLyByZXR1cm5zIGFsbCBjb2xvcnMgYmFzZWQgb24gdGhlIGRlZmluZWQgY2xhc3Nlc1xuICAgICAgICAgICAgICAgIGNvbG9ycyA9IFtdO1xuICAgICAgICAgICAgICAgIHZhciBzYW1wbGVzID0gW107XG4gICAgICAgICAgICAgICAgaWYgKF9jbGFzc2VzICYmIChfY2xhc3Nlcy5sZW5ndGggPiAyKSkge1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBpID0gMSwgZW5kID0gX2NsYXNzZXMubGVuZ3RoLCBhc2MgPSAxIDw9IGVuZDsgYXNjID8gaSA8IGVuZCA6IGkgPiBlbmQ7IGFzYyA/IGkrKyA6IGktLSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgc2FtcGxlcy5wdXNoKChfY2xhc3Nlc1tpLTFdK19jbGFzc2VzW2ldKSowLjUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgc2FtcGxlcyA9IF9kb21haW47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJlc3VsdCA9IHNhbXBsZXMubWFwKGZ1bmN0aW9uICh2KSB7IHJldHVybiBmKHYpOyB9KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGNocm9tYV8xW291dF0pIHtcbiAgICAgICAgICAgICAgICByZXN1bHQgPSByZXN1bHQubWFwKGZ1bmN0aW9uIChjKSB7IHJldHVybiBjW291dF0oKTsgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICB9O1xuXG4gICAgICAgIGYuY2FjaGUgPSBmdW5jdGlvbihjKSB7XG4gICAgICAgICAgICBpZiAoYyAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgX3VzZUNhY2hlID0gYztcbiAgICAgICAgICAgICAgICByZXR1cm4gZjtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIF91c2VDYWNoZTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfTtcblxuICAgICAgICBmLmdhbW1hID0gZnVuY3Rpb24oZykge1xuICAgICAgICAgICAgaWYgKGcgIT0gbnVsbCkge1xuICAgICAgICAgICAgICAgIF9nYW1tYSA9IGc7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGY7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBfZ2FtbWE7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG5cbiAgICAgICAgZi5ub2RhdGEgPSBmdW5jdGlvbihkKSB7XG4gICAgICAgICAgICBpZiAoZCAhPSBudWxsKSB7XG4gICAgICAgICAgICAgICAgX25hY29sID0gY2hyb21hXzEoZCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGY7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHJldHVybiBfbmFjb2w7XG4gICAgICAgICAgICB9XG4gICAgICAgIH07XG5cbiAgICAgICAgcmV0dXJuIGY7XG4gICAgfTtcblxuICAgIGZ1bmN0aW9uIF9fcmFuZ2VfXyhsZWZ0LCByaWdodCwgaW5jbHVzaXZlKSB7XG4gICAgICB2YXIgcmFuZ2UgPSBbXTtcbiAgICAgIHZhciBhc2NlbmRpbmcgPSBsZWZ0IDwgcmlnaHQ7XG4gICAgICB2YXIgZW5kID0gIWluY2x1c2l2ZSA/IHJpZ2h0IDogYXNjZW5kaW5nID8gcmlnaHQgKyAxIDogcmlnaHQgLSAxO1xuICAgICAgZm9yICh2YXIgaSA9IGxlZnQ7IGFzY2VuZGluZyA/IGkgPCBlbmQgOiBpID4gZW5kOyBhc2NlbmRpbmcgPyBpKysgOiBpLS0pIHtcbiAgICAgICAgcmFuZ2UucHVzaChpKTtcbiAgICAgIH1cbiAgICAgIHJldHVybiByYW5nZTtcbiAgICB9XG5cbiAgICAvL1xuICAgIC8vIGludGVycG9sYXRlcyBiZXR3ZWVuIGEgc2V0IG9mIGNvbG9ycyB1emluZyBhIGJlemllciBzcGxpbmVcbiAgICAvL1xuXG4gICAgLy8gQHJlcXVpcmVzIHV0aWxzIGxhYlxuXG5cblxuXG4gICAgdmFyIGJlemllciA9IGZ1bmN0aW9uKGNvbG9ycykge1xuICAgICAgICB2YXIgY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JldHVybiAoKDEtdCkqKDEtdCkgKiBsYWIwW2ldKSArICgyICogKDEtdCkgKiB0ICogbGFiMVtpXSkgKyAodCAqIHQgKiBsYWIyW2ldKTsgfSkpO1xuICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQ29sb3JfMShsYWIsICdsYWInKTtcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0gZWxzZSBpZiAoY29sb3JzLmxlbmd0aCA9PT0gNCkge1xuICAgICAgICAgICAgLy8gY3ViaWMgYmV6aWVyIGludGVycG9sYXRpb25cbiAgICAgICAgICAgIHZhciBsYWIzO1xuICAgICAgICAgICAgKGFzc2lnbiQyID0gY29sb3JzLm1hcChmdW5jdGlvbiAoYykgeyByZXR1cm4gYy5sYWIoKTsgfSksIGxhYjAgPSBhc3NpZ24kMlswXSwgbGFiMSA9IGFzc2lnbiQyWzFdLCBsYWIyID0gYXNzaWduJDJbMl0sIGxhYjMgPSBhc3NpZ24kMlszXSk7XG4gICAgICAgICAgICBJID0gZnVuY3Rpb24odCkge1xuICAgICAgICAgICAgICAgIHZhciBsYWIgPSAoWzAsIDEsIDJdLm1hcChmdW5jdGlvbiAoaSkgeyByZXR1cm4gKCgxLXQpKigxLXQpKigxLXQpICogbGFiMFtpXSkgKyAoMyAqICgxLXQpICogKDEtdCkgKiB0ICogbGFiMVtpXSkgKyAoMyAqICgxLXQpICogdCAqIHQgKiBsYWIyW2ldKSArICh0KnQqdCAqIGxhYjNbaV0pOyB9KSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBDb2xvcl8xKGxhYiwgJ2xhYicpO1xuICAgICAgICAgICAgfTtcbiAgICAgICAgfSBlbHNlIGlmIChjb2xvcnMubGVuZ3RoID09PSA1KSB7XG4gICAgICAgICAgICB2YXIgSTAgPSBiZXppZXIoY29sb3JzLnNsaWNlKDAsIDMpKTtcbiAgICAgICAgICAgIHZhciBJMSA9IGJlemllcihjb2xvcnMuc2xpY2UoMiwgNSkpO1xuICAgICAgICAgICAgSSA9IGZ1bmN0aW9uKHQpIHtcbiAgICAgICAgICAgICAgICBpZiAodCA8IDAuNSkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gSTAodCoyKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gSTEoKHQtMC41KSoyKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9O1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBJO1xuICAgIH07XG5cbiAgICB2YXIgYmV6aWVyXzEgPSBmdW5jdGlvbiAoY29sb3JzKSB7XG4gICAgICAgIHZhciBmID0gYmV6aWVyKGNvbG9ycyk7XG4gICAgICAgIGYuc2NhbGUgPSBmdW5jdGlvbiAoKSB7IHJldHVybiBzY2FsZShmKTsgfTtcbiAgICAgICAgcmV0dXJuIGY7XG4gICAgfTtcblxuICAgIC8qXG4gICAgICogaW50ZXJwb2xhdGVzIGJldHdlZW4gYSBzZXQgb2YgY29sb3JzIHV6aW5nIGEgYmV6aWVyIHNwbGluZVxuICAgICAqIGJsZW5kIG1vZGUgZm9ybXVsYXMgdGFrZW4gZnJvbSBodHRwOi8vd3d3LnZlbnR1cmUtd2FyZS5jb20va2V2aW4vY29kaW5nL2xldHMtbGVhcm4tbWF0aC1waG90b3Nob3AtYmxlbmQtbW9kZXMvXG4gICAgICovXG5cblxuXG5cbiAgICB2YXIgYmxlbmQgPSBmdW5jdGlvbiAoYm90dG9tLCB0b3AsIG1vZGUpIHtcbiAgICAgICAgaWYgKCFibGVuZFttb2RlXSkge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCd1bmtub3duIGJsZW5kIG1vZGUgJyArIG1vZGUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBibGVuZFttb2RlXShib3R0b20sIHRvcCk7XG4gICAgfTtcblxuICAgIHZhciBibGVuZF9mID0gZnVuY3Rpb24gKGYpIHsgcmV0dXJuIGZ1bmN0aW9uIChib3R0b20sdG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XG5cbiAgICAgICAgdmFyIGYgPSBmdW5jdGlvbihmcmFjdCkge1xuICAgICAgICAgICAgdmFyIGEgPSBUV09QSSQyICogKCgoc3RhcnQrMTIwKS8zNjApICsgKHJvdGF0aW9ucyAqIGZyYWN0KSk7XG4gICAgICAgICAgICB2YXIgbCA9IHBvdyQ2KGxpZ2h0bmVzc1swXSArIChkbCAqIGZyYWN0KSwgZ2FtbWEpO1xuICAgICAgICAgICAgdmFyIGggPSBkaCAhPT0gMCA/IGh1ZVswXSArIChmcmFjdCAqIGRoKSA6IGh1ZTtcbiAgICAgICAgICAgIHZhciBhbXAgPSAoaCAqIGwgKiAoMS1sKSkgLyAyO1xuICAgICAgICAgICAgdmFyIGNvc19hID0gY29zJDMoYSk7XG4gICAgICAgICAgICB2YXIgc2luX2EgPSBzaW4kMihhKTtcbiAgICAgICAgICAgIHZhciByID0gbCArIChhbXAgKiAoKC0wLjE0ODYxICogY29zX2EpICsgKDEuNzgyNzcqIHNpbl9hKSkpO1xuICAgICAgICAgICAgdmFyIGcgPSBsICsgKGFtcCAqICgoLTAuMjkyMjcgKiBjb3NfYSkgLSAoMC45MDY0OSogc2luX2EpKSk7XG4gICAgICAgICAgICB2YXIgYiA9IGwgKyAoYW1wICogKCsxLjk3Mjk0ICogY29zX2EpKTtcbiAgICAgICAgICAgIHJldHVybiBjaHJvbWFfMShjbGlwX3JnYiQzKFtyKjI1NSxnKjI1NSxiKjI1NSwxXSkpO1xuICAgICAgICB9O1xuXG4gICAgICAgIGYuc3RhcnQgPSBmdW5jdGlvbihzKSB7XG4gICAgICAgICAgICBpZiAoKHMgPT0gbnVsbCkpIHsgcmV0dXJuIHN0YXJ0OyB9XG4gICAgICAgICAgICBzdGFydCA9IHM7XG4gICAgICAgICAgICByZXR1cm4gZjtcbiAgICAgICAgfTtcblxuICAgICAgICBmLnJvdGF0aW9ucyA9IGZ1bmN0aW9uKHIpIHtcbiAgICAgICAgICAgIGlmICgociA9PSBudWxsKSkgeyByZXR1cm4gcm90YXRpb25zOyB9XG4gICAgICAgICAgICByb3RhdGlvbnMgPSByO1xuICAgICAgICAgICAgcmV0dXJuIGY7XG4gICAgICAgIH07XG5cbiAgICAgICAgZi5nYW1tYSA9IGZ1bmN0aW9uKGcpIHtcbiAgICAgICAgICAgIGlmICgoZyA9PSBudWxsKSkgeyByZXR1cm4gZ2FtbWE7IH1cbiAgICAgICAgICAgIGdhbW1hID0gZztcbiAgICAgICAgICAgIHJldHVybiBmO1xuICAgICAgICB9O1xuXG4gICAgICAgIGYuaHVlID0gZnVuY3Rpb24oaCkge1xuICAgICAgICAgICAgaWYgKChoID09IG51bGwpKSB7IHJldHVybiBodWU7IH1cbiAgICAgICAgICAgIGh1ZSA9IGg7XG4gICAgICAgICAgICBpZiAodHlwZSRrKGh1ZSkgPT09ICdhcnJheScpIHtcbiAgICAgICAgICAgICAgICBkaCA9IGh1ZVsxXSAtIGh1ZVswXTtcbiAgICAgICAgICAgICAgICBpZiAoZGggPT09IDApIHsgaHVlID0gaHVlWzFdOyB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGRoID0gMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBmO1xuICAgICAgICB9O1xuXG4gICAgICAgIGYubGlnaHRuZXNzID0gZnVuY3Rpb24oaCkge1xuICAgICAgICAgICAgaWYgKChoID09IG51bGwpKSB7IHJldHVybiBsaWdodG5lc3M7IH1cbiAgICAgICAgICAgIGlmICh0eXBlJGsoaCkgPT09ICdhcnJheScpIHtcbiAgICAgICAgICAgICAgICBsaWdodG5lc3MgPSBoO1xuICAgICAgICAgICAgICAgIGRsID0gaFsxXSAtIGhbMF07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGxpZ2h0bmVzcyA9IFtoLGhdO1xuICAgICAgICAgICAgICAgIGRsID0gMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiBmO1xuICAgICAgICB9O1x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WN0Jykge1xuICAgICAgICAgICAgZGF0YSA9IE9iamVjdC52YWx1ZXMoZGF0YSk7XG4gICAgICAgIH1cbiAgICAgICAgZGF0YS5mb3JFYWNoKGZ1bmN0aW9uICh2YWwpIHtcbiAgICAgICAgICAgIGlmIChrZXkgJiYgdHlwZSh2YWwpID09PSAnb2JqZWN0JykgeyB2YWwgPSB2YWxba2V5XTsgfVxuICAgICAgICAgICAgaWYgKHZhbCAhPT0gdW5kZWZpbmVkICYmIHZhbCAhPT0gbnVsbCAmJiAhaXNOYU4odmFsKSkge1xuICAgICAgICAgICAgICAgIHIudmFsdWVzLnB1c2godmFsKTtcbiAgICAgICAgICAgICAgICByLnN1bSArPSB2YWw7XG4gICAgICAgICAgICAgICAgaWYgKHZhbCA8IHIubWluKSB7IHIubWluID0gdmFsOyB9XG4gICAgICAgICAgICAgICAgaWYgKHZhbCA+IHIubWF4KSB7IHIubWF4ID0gdmFsOyB9XG4gICAgICAgICAgICAgICAgci5jb3VudCArPSAxO1xuICAgICAgICAgICAgfVxuICAgICAgICB9KTtcblxuICAgICAgICByLmRvbWFpbiA9IFtyLm1pbiwgci5tYXhdO1xuXG4gICAgICAgIHIubGltaXRzID0gZnVuY3Rpb24gKG1vZGUsIG51bSkgeyByZXR1cm4gbGltaXRzKHIsIG1vZGUsIG51bSk7IH07XG5cbiAgICAgICAgcmV0dXJuIHI7XG4gICAgfTtcblxuXG4gICAgdmFyIGxpbWl0cyA9IGZ1bmN0aW9uIChkYXRhLCBtb2RlLCBudW0pIHtcbiAgICAgICAgaWYgKCBtb2RlID09PSB2b2lkIDAgKSBtb2RlPSdlcXVhbCc7XG4gICAgICAgIGlmICggbnVtID09PSB2b2lkIDAgKSBudW09NztcblxuICAgICAgICBpZiAodHlwZShkYXRhKSA9PSAnYXJyYXknKSB7XG4gICAgICAgICAgICBkYXRhID0gYW5hbHl6ZShkYXRhKTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgbWluID0gZGF0YS5taW47XG4gICAgICAgIHZhciBtYXggPSBkYXRhLm1heDtcbiAgICAgICAgdmFyIHZhbHVlcyA9IGRhdGEudmFsdWVzLnNvcnQoZnVuY3Rpb24gKGEsYikgeyByZXR1cm4gYS1iOyB9KTtcblxuICAgICAgICBpZiAobnVtID09PSAxKSB7IHJldHVybiBbbWluLG1heF07IH1cblxuICAgICAgICB2YXIgbGltaXRzID0gW107XG5cbiAgICAgICAgaWYgKG1vZGUuc3Vic3RyKDAsMSkgPT09ICdjJykgeyAvLyBjb250aW51b3VzXG4gICAgICAgICAgICBsaW1pdHMucHVzaChtaW4pO1xuICAgICAgICAgICAgbGltaXRzLnB1c2gobWF4KTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmIChtb2RlLnN1YnN0cigwLDEpID09PSAnZScpIHsgLy8gZXF1YWwgaW50ZXJ2YWxcbiAgICAgICAgICAgIGxpbWl0cy5wdXNoKG1pbik7XG4gICAgICAgICAgICBmb3IgKHZhciBpPTE7IGk8bnVtOyBpKyspIHtcbiAgICAgICAgICAgICAgICBsaW1pdHMucHVzaChtaW4rKChpL251bSkqKG1heC1taW4pKSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBsaW1pdHMucHVzaChtYXgpO1xuICAgICAgICB9XG5cbiAgICAgICAgZWxzZSBpZiAobW9kZS5zdWJzdHIoMCwxKSA9PT0gJ2wnKSB7IC8vIGxvZyBzY2FsZVxuICAgICAgICAgICAgaWYgKG1pbiA8PSAwKSB7XG4gICAgICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKCdMb2dhcml0aG1pYyBzY2FsZXMgYXJlIG9ubHkgcG9zc2libGUgZm9yIHZhbHVlcyA+IDAnKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHZhciBtaW5fbG9nID0gTWF0aC5MT0cxMEUgKiBsb2ckMShtaW4pO1xuICAgICAgICAgICAgdmFyIG1heF9sb2cgPSBNYXRoLkxPRzEwRSAqIGxvZyQxKG1heCk7XG4gICAgICAgICAgICBsaW1pdHMucHVzaChtaW4pO1xuICAgICAgICAgICAgZm9yICh2YXIgaSQxPTE7IGkkMTxudW07IGkkMSsrKSB7XG4gICAgICAgICAgICAgICAgbGltaXRzLnB1c2gocG93JDcoMTAsIG1pbl9sb2cgKyAoKGkkMS9udW0pICogKG1heF9sb2cgLSBtaW5fbG9nKSkpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGxpbWl0cy5wdXNoKG1heCk7XG4gICAgICAgIH1cblxuICAgICAgICBlbHNlIGlmIChtb2RlLnN1YnN0cigwLDEpID09PSAncScpIHsgLy8gcXVhbnRpbGUgc2NhbGVcbiAgICAgICAgICAgIGxpbWl0cy5wdXNoKG1pbik7XG4gICAgICAgICAgICBmb3IgKHZhciBpJDI9MTsgaSQyPG51bTsgaSQyKyspIHtcbiAgICAgICAgICAgICAgICB2YXIgcCA9ICgodmFsdWVzLmxlbmd0aC0xKSAqIGkkMikvbnVtO1xuICAgICAgICAgICAgICAgIHZhciBwYiA9IGZsb29yJDMocCk7XG4gICAgICAgICAgICAgICAgaWYgKHBiID09PSBwKSB7XG4gICAgICAgICAgICAgICAgICAgIGxpbWl0cy5wdXNoKHZhbHVlc1twYl0pO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7IC8vIHAgPiBwYlxuICAgICAgICAgICAgICAgICAgICB2YXIgcHIgPSBwIC0gcGI7XG4gICAgICAgICAgICAgICAgICAgIGxpbWl0cy5wdXNoKCh2YWx1ZXNbcGJdKigxLXByKSkgKyAodmFsdWVzW3BiKzFdKnByKSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgbGltaXRzLnB1c2gobWF4KTtcblxuICAgICAgICB9XG5cbiAgICAgICAgZWxzZSBpZiAobW9kZS5zdWJzdHIoMCwxKSA9PT0gJ2snKSB7IC8vIGstbWVhbnMgY2x1c3RlcmluZ1xuICAgICAgICAgICAgLypcbiAgICAgICAgICAgIGltcGxlbWVudGF0aW9uIGJhc2VkIG9uXG4gICAgICAgICAgICBodHRwOi8vY29kZS5nb29nbGUuY29tL3AvZmlndWUvc291cmNlL2Jyb3dzZS90cnVuay9maWd1ZS5qcyMzMzZcbiAgICAgICAgICAgIHNpbXBsaWZpZWQgZm9yIDEtZCBpbnB1dCB2YWx1ZXNcbiAgICAgICAgICAgICovXG4gICAgICAgICAgICB2YXIgY2x1c3RlcjtcbiAgICAgICAgICAgIHZhciBuID0gdmFsdWVzLmxlbmd0aDtcbiAgICAgICAgICAgIHZhciBhc3NpZ25tZW50cyA9IG5ldyBBcnJheShuKTtcbiAgICAgICAgICAgIHZhciBjbHVzdGVyU2l6ZXMgPSBuZXcgQXJyYXkobnVtKTtcbiAgICAgICAgICAgIHZhciByZXBlYXQgPSB0cnVlO1xuICAgICAgICAgICAgdmFyIG5iX2l0ZXJzID0gMDtcbiAgICAgICAgICAgIHZhciBjZW50cm9pZHMgPSBudWxsO1xuXG4gICAgICAgICAgICAvLyBnZXQgc2VlZCB2YWx1ZXNcbiAgICAgICAgICAgIGNlbnRyb2lkcyA9IFtdO1xuICAgICAgICAgICAgY2VudHJvaWRzLnB1c2gobWluKTtcbiAgICAgICAgICAgIGZvciAodmFyIGkkMz0xOyBpJDM8bnVtOyBpJDMrKykge1xuICAgICAgICAgICAgICAgIGNlbnRyb2lkcy5wdXNoKG1pbiArICgoaSQzL251bSkgKiAobWF4LW1pbikpKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGNlbnRyb2lkcy5wdXNoKG1heCk7XG5cbiAgICAgICAgICAgIHdoaWxlIChyZXBlYXQpIHtcbiAgICAgICAgICAgICAgICAvLyBhc3NpZ25tZW50IHN0ZXBcbiAgICAgICAgICAgICAgICBmb3IgKHZhciBqPTA7IGo8bnVtOyBqKyspIHtcbiAgICAgICAgICAgICAgICAgICAgY2x1c3RlclNpemVzW2pdID0gMDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgZm9yICh2YXIgaSQ0PTA7IGkkNDxuOyBpJDQrKykge1xuICAgICAgICAgICAgICAgICAgICB2YXIgdmFsdWUgPSB2YWx1ZXNbaSQ0XTtcbiAgICAgICAgICAgICAgICAgICAgdmFyIG1pbmRpc3QgPSBOdW1iZXIuTUFYX1ZBTFVFO1xuICAgICAgICAgICAgICAgICAgICB2YXIgYmVzdCA9ICh2b2lkIDApO1xuICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciBqJDE9MDsgaiQxPG51bTsgaiQxKyspIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHZhciBkaXN0ID0gYWJzKGNlbnRyb2lkc1tqJDFdLXZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChkaXN0IDwgbWluZGlzdCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1pbmRpc3QgPSBkaXN0O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlc3QgPSBqJDE7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBjbHVzdGVyU2l6ZXNbYmVzdF0rKztcbiAgICAgICAgICAgICAgICAgICAgICAgIGFzc2lnbm1lbnRzW2kkNF0gPSBiZXN0O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy8gdXBkYXRlIGNlbnRyb2lkcyBzdGVwXG4gICAgICAgICAgICAgICAgdmFyIG5ld0NlbnRyb2lkcyA9IG5ldyBBcnJheShudW0pO1xuICAgICAgICAgICAgICAgIGZvciAodmFyIGokMj0wOyBqJDI8bnVtOyBqJDIrKykge1xuICAgICAgICAgICAgICAgICAgICBuZXdDZW50cm9pZHNbaiQyXSA9IG51bGw7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGZvciAodmFyIGkkNT0wOyBpJDU8bjsgaSQ1KyspIHtcbiAgICAgICAgICAgICAgICAgICAgY2x1c3RlciA9IGFzc2lnbm1lbnRzW2kkNV07XG4gICAgICAgICAgICAgICAgICAgIGlmIChuZXdDZW50cm9pZHNbY2x1c3Rlcl0gPT09IG51bGwpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5ld0NlbnRyb2lkc1tjbHVzdGVyXSA9IHZhbHVlc1tpJDVdO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgbmV3Q2VudHJvaWRzW2NsdXN0ZXJdICs9IHZhbHVlc1tpJDVdO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGZvciAodmFyIGokMz0wOyBqJDM8bnVtOyBqJDMrKykge1xuICAgICAgICAgICAgICAgICAgICBuZXdDZW50cm9pZHNbaiQzXSAqPSAxL2NsdXN0ZXJTaXplc1tqJDNdO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vIGNoZWNrIGNvbnZlcmdlbmNlXG4gICAgICAgICAgICAgICAgcmVwZWF0ID0gZmFsc2U7XG4gICAgICAgICAgICAgICAgZm9yICh2YXIgaiQ0PTA7IGokNDxudW07IGokNCsrKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChuZXdDZW50cm9pZHNbaiQ0XSAhPT0gY2VudHJvaWRzW2okNF0pIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJlcGVhdCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGNlbnRyb2lkcyA9IG5ld0NlbnRyb2lkcztcbiAgICAgICAgICAgICAgICBuYl9pdGVycysrO1xuXG4gICAgICAgICAgICAgICAgaWYgKG5iX2l0ZXJzID4gMjAwKSB7XG4gICAgICAgICAgICAgICAgICAgIHJlcGVhdCA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gZmluaXNoZWQgay1tZWFucyBjbHVzdGVyaW5nXG4gICAgICAgICAgICAvLyB0aGUgbmV4dCBwYXJ0IGlzIGJvcnJvd2VkIGZyb20gZ2FicmllbGZsb3IuaXRcbiAgICAgICAgICAgIHZhciBrQ2x1c3RlcnMgPSB7fTtcbiAgICAgICAgICAgIGZvciAodmFyIGokNT0wOyBqJDU8bnVtOyBqJDUrKykge1xuICAgICAgICAgICAgICAgIGtDbHVzdGVyc1tqJDVdID0gW107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBmb3IgKHZhciBpJDY9MDsgaSQ2PG47IGkkNisrKSB7XG4gICAgICAgICAgICAgICAgY2x1c3RlciA9IGFzc2lnbm1lbnRzW2kkNl07XG4gICAgICAgICAgICAgICAga0NsdXN0ZXJzW2NsdXN0ZXJdLnB1c2godmFsdWVzW2kkNl0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgdmFyIHRtcEtNZWFuc0JyZWFrcyA9IFtdO1xuICAgICAgICAgICAgZm9yICh2YXIgaiQ2PTA7IGokNjxudW07IGokNisrKSB7XG4gICAgICAgICAgICAgICAgdG1wS01lYW5zQnJlYWtzLnB1c2goa0NsdXN0ZXJzW2okNl1bMF0pO1xuICAgICAgICAgICAgICAgIHRtcEtNZWFuc0JyZWFrcy5wdXNoKGtDbHVzdGVyc1tqJDZdW2tDbHVzdGVyc1tqJDZdLmxlbmd0aC0xXSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0bXBLTWVhbnNCcmVha3MgPSB0bXBLTWVhbnNCcmVha3Muc29ydChmdW5jdGlvbiAoYSxiKXsgcmV0dXJuIGEtYjsgfSk7XG4gICAgICAgICAgICBsaW1pdHMucHVzaCh0bXBLTWVhbnNCcmVha3NbMF0pO1xuICAgICAgICAgICAgZm9yICh2YXIgaSQ3PTE7IGkkNyA8IHRtcEtNZWFuc0JyZWFrcy5sZW5ndGg7IGkkNys9IDIpIHtcbiAgICAgICAgICAgICAgICB2YXIgdi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