@angular/platform-browser 0.0.0-6 → 2.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (546) hide show
  1. package/bundles/platform-browser.umd.js +4685 -0
  2. package/bundles/platform-browser.umd.min.js +4 -0
  3. package/core_private.d.ts +27 -1
  4. package/core_private.js +16 -0
  5. package/core_private.js.map +1 -1
  6. package/core_private.metadata.json +1 -1
  7. package/esm/core_private.d.ts +27 -1
  8. package/esm/core_private.js +16 -0
  9. package/esm/core_private.js.map +1 -1
  10. package/esm/core_private.metadata.json +1 -1
  11. package/esm/index.d.ts +22 -1
  12. package/esm/index.js +25 -1
  13. package/esm/index.js.map +1 -1
  14. package/esm/index.metadata.json +1 -0
  15. package/esm/private_export.d.ts +21 -21
  16. package/esm/private_export.js +11 -21
  17. package/esm/private_export.js.map +1 -1
  18. package/esm/private_export.metadata.json +1 -0
  19. package/esm/src/browser/browser_adapter.d.ts +6 -0
  20. package/esm/src/browser/browser_adapter.js +146 -76
  21. package/esm/src/browser/browser_adapter.js.map +1 -1
  22. package/esm/src/browser/generic_browser_adapter.js +4 -4
  23. package/esm/src/browser/generic_browser_adapter.js.map +1 -1
  24. package/esm/src/browser/location/browser_platform_location.d.ts +1 -5
  25. package/esm/src/browser/location/browser_platform_location.js +16 -3
  26. package/esm/src/browser/location/browser_platform_location.js.map +1 -1
  27. package/esm/src/browser/location/browser_platform_location.metadata.json +1 -1
  28. package/esm/src/browser/location/history.d.ts +1 -0
  29. package/esm/src/browser/location/history.js +4 -0
  30. package/esm/src/browser/location/history.js.map +1 -0
  31. package/esm/src/browser/location/history.metadata.json +1 -0
  32. package/esm/src/browser/testability.d.ts +1 -1
  33. package/esm/src/browser/testability.js +7 -5
  34. package/esm/src/browser/testability.js.map +1 -1
  35. package/esm/src/browser/title.d.ts +2 -0
  36. package/esm/src/browser/title.js +2 -0
  37. package/esm/src/browser/title.js.map +1 -1
  38. package/esm/src/browser/tools/common_tools.js +2 -2
  39. package/esm/src/browser/tools/common_tools.js.map +1 -1
  40. package/esm/src/browser/tools/tools.d.ts +1 -1
  41. package/esm/src/browser/tools/tools.js +2 -1
  42. package/esm/src/browser/tools/tools.js.map +1 -1
  43. package/esm/src/browser.d.ts +15 -0
  44. package/esm/src/browser.js +76 -0
  45. package/esm/src/browser.js.map +1 -0
  46. package/esm/src/browser.metadata.json +1 -0
  47. package/esm/src/dom/debug/by.d.ts +2 -2
  48. package/esm/src/dom/debug/by.js +1 -1
  49. package/esm/src/dom/debug/by.js.map +1 -1
  50. package/esm/src/dom/debug/ng_probe.js +10 -19
  51. package/esm/src/dom/debug/ng_probe.js.map +1 -1
  52. package/esm/src/dom/debug/ng_probe.metadata.json +1 -1
  53. package/esm/src/dom/dom_adapter.d.ts +7 -5
  54. package/esm/src/dom/dom_adapter.js +1 -1
  55. package/esm/src/dom/dom_adapter.js.map +1 -1
  56. package/esm/src/dom/dom_adapter.metadata.json +1 -0
  57. package/esm/src/dom/dom_animate_player.d.ts +9 -0
  58. package/esm/src/dom/dom_animate_player.js +1 -0
  59. package/esm/src/dom/dom_animate_player.js.map +1 -0
  60. package/esm/src/dom/dom_renderer.d.ts +9 -19
  61. package/esm/src/dom/dom_renderer.js +29 -61
  62. package/esm/src/dom/dom_renderer.js.map +1 -1
  63. package/esm/src/dom/dom_renderer.metadata.json +1 -1
  64. package/esm/src/dom/dom_tokens.js.map +1 -1
  65. package/esm/src/dom/dom_tokens.metadata.json +1 -1
  66. package/esm/src/dom/events/dom_events.js +3 -2
  67. package/esm/src/dom/events/dom_events.js.map +1 -1
  68. package/esm/src/dom/events/dom_events.metadata.json +1 -1
  69. package/esm/src/dom/events/event_manager.d.ts +1 -3
  70. package/esm/src/dom/events/event_manager.js +9 -8
  71. package/esm/src/dom/events/event_manager.js.map +1 -1
  72. package/esm/src/dom/events/event_manager.metadata.json +1 -1
  73. package/esm/src/dom/events/hammer_common.js +1 -1
  74. package/esm/src/dom/events/hammer_common.js.map +1 -1
  75. package/esm/src/dom/events/hammer_gestures.js +10 -6
  76. package/esm/src/dom/events/hammer_gestures.js.map +1 -1
  77. package/esm/src/dom/events/hammer_gestures.metadata.json +1 -1
  78. package/esm/src/dom/events/key_events.d.ts +0 -2
  79. package/esm/src/dom/events/key_events.js +5 -3
  80. package/esm/src/dom/events/key_events.js.map +1 -1
  81. package/esm/src/dom/events/key_events.metadata.json +1 -1
  82. package/esm/src/dom/shared_styles_host.d.ts +0 -6
  83. package/esm/src/dom/shared_styles_host.js +5 -1
  84. package/esm/src/dom/shared_styles_host.js.map +1 -1
  85. package/esm/src/dom/shared_styles_host.metadata.json +1 -1
  86. package/esm/src/dom/util.js +3 -3
  87. package/esm/src/dom/util.js.map +1 -1
  88. package/esm/src/dom/util.metadata.json +1 -0
  89. package/esm/src/dom/web_animations_driver.d.ts +4 -0
  90. package/esm/src/dom/web_animations_driver.js +118 -0
  91. package/esm/src/dom/web_animations_driver.js.map +1 -0
  92. package/esm/src/dom/web_animations_player.d.ts +20 -0
  93. package/esm/src/dom/web_animations_player.js +42 -0
  94. package/esm/src/dom/web_animations_player.js.map +1 -0
  95. package/esm/src/facade/async.d.ts +90 -0
  96. package/esm/src/facade/async.js +137 -0
  97. package/esm/src/facade/async.js.map +1 -0
  98. package/esm/src/facade/base_wrapped_exception.js +4 -4
  99. package/esm/src/facade/base_wrapped_exception.js.map +1 -1
  100. package/esm/src/facade/browser.js +2 -2
  101. package/esm/src/facade/browser.js.map +1 -1
  102. package/esm/src/facade/browser.metadata.json +1 -1
  103. package/esm/src/facade/collection.js +1 -1
  104. package/esm/src/facade/collection.js.map +1 -1
  105. package/esm/src/facade/collection.metadata.json +1 -1
  106. package/esm/src/facade/exception_handler.d.ts +2 -11
  107. package/esm/src/facade/exception_handler.js +8 -7
  108. package/esm/src/facade/exception_handler.js.map +1 -1
  109. package/esm/src/facade/exceptions.d.ts +4 -0
  110. package/esm/src/facade/exceptions.js +6 -2
  111. package/esm/src/facade/exceptions.js.map +1 -1
  112. package/esm/src/facade/exceptions.metadata.json +1 -0
  113. package/esm/src/facade/lang.d.ts +6 -4
  114. package/esm/src/facade/lang.js +12 -11
  115. package/esm/src/facade/lang.js.map +1 -1
  116. package/esm/src/facade/lang.metadata.json +1 -1
  117. package/esm/src/facade/promise.d.ts +17 -0
  118. package/esm/src/facade/promise.js +41 -0
  119. package/esm/src/facade/promise.js.map +1 -0
  120. package/esm/src/security/dom_sanitization_service.d.ts +98 -0
  121. package/esm/src/security/dom_sanitization_service.js +108 -0
  122. package/esm/src/security/dom_sanitization_service.js.map +1 -0
  123. package/esm/src/security/dom_sanitization_service.metadata.json +1 -0
  124. package/esm/src/security/html_sanitizer.d.ts +5 -0
  125. package/esm/src/security/html_sanitizer.js +233 -0
  126. package/esm/src/security/html_sanitizer.js.map +1 -0
  127. package/esm/src/security/style_sanitizer.d.ts +5 -0
  128. package/esm/src/security/style_sanitizer.js +81 -0
  129. package/esm/src/security/style_sanitizer.js.map +1 -0
  130. package/esm/src/security/url_sanitizer.d.ts +1 -0
  131. package/esm/src/security/url_sanitizer.js +40 -0
  132. package/esm/src/security/url_sanitizer.js.map +1 -0
  133. package/esm/src/web_workers/shared/api.d.ts +2 -0
  134. package/esm/src/web_workers/shared/api.js +3 -0
  135. package/esm/src/web_workers/shared/api.js.map +1 -0
  136. package/esm/src/web_workers/shared/api.metadata.json +1 -0
  137. package/esm/src/web_workers/shared/client_message_broker.d.ts +51 -0
  138. package/esm/src/web_workers/shared/client_message_broker.js +156 -0
  139. package/esm/src/web_workers/shared/client_message_broker.js.map +1 -0
  140. package/esm/src/web_workers/shared/client_message_broker.metadata.json +1 -0
  141. package/esm/src/web_workers/shared/message_bus.d.ts +82 -0
  142. package/esm/src/web_workers/shared/message_bus.js +10 -0
  143. package/esm/src/web_workers/shared/message_bus.js.map +1 -0
  144. package/esm/src/web_workers/shared/messaging_api.d.ts +7 -0
  145. package/esm/src/web_workers/shared/messaging_api.js +8 -0
  146. package/esm/src/web_workers/shared/messaging_api.js.map +1 -0
  147. package/esm/src/web_workers/shared/messaging_api.metadata.json +1 -0
  148. package/esm/src/web_workers/shared/post_message_bus.d.ts +41 -0
  149. package/esm/src/web_workers/shared/post_message_bus.js +133 -0
  150. package/esm/src/web_workers/shared/post_message_bus.js.map +1 -0
  151. package/esm/src/web_workers/shared/post_message_bus.metadata.json +1 -0
  152. package/esm/src/web_workers/shared/render_store.d.ts +11 -0
  153. package/esm/src/web_workers/shared/render_store.js +40 -0
  154. package/esm/src/web_workers/shared/render_store.js.map +1 -0
  155. package/esm/src/web_workers/shared/render_store.metadata.json +1 -0
  156. package/esm/src/web_workers/shared/serialized_types.d.ts +12 -0
  157. package/esm/src/web_workers/shared/serialized_types.js +16 -0
  158. package/esm/src/web_workers/shared/serialized_types.js.map +1 -0
  159. package/esm/src/web_workers/shared/serializer.d.ts +18 -0
  160. package/esm/src/web_workers/shared/serializer.js +110 -0
  161. package/esm/src/web_workers/shared/serializer.js.map +1 -0
  162. package/esm/src/web_workers/shared/serializer.metadata.json +1 -0
  163. package/esm/src/web_workers/shared/service_message_broker.d.ts +48 -0
  164. package/esm/src/web_workers/shared/service_message_broker.js +88 -0
  165. package/esm/src/web_workers/shared/service_message_broker.js.map +1 -0
  166. package/esm/src/web_workers/shared/service_message_broker.metadata.json +1 -0
  167. package/esm/src/web_workers/ui/event_dispatcher.d.ts +8 -0
  168. package/esm/src/web_workers/ui/event_dispatcher.js +104 -0
  169. package/esm/src/web_workers/ui/event_dispatcher.js.map +1 -0
  170. package/esm/src/web_workers/ui/event_serializer.d.ts +15 -0
  171. package/esm/src/web_workers/ui/event_serializer.js +53 -0
  172. package/esm/src/web_workers/ui/event_serializer.js.map +1 -0
  173. package/esm/src/web_workers/ui/event_serializer.metadata.json +1 -0
  174. package/esm/src/web_workers/ui/location_providers.d.ts +14 -0
  175. package/esm/src/web_workers/ui/location_providers.js +19 -0
  176. package/esm/src/web_workers/ui/location_providers.js.map +1 -0
  177. package/esm/src/web_workers/ui/location_providers.metadata.json +1 -0
  178. package/esm/src/web_workers/ui/platform_location.d.ts +16 -0
  179. package/esm/src/web_workers/ui/platform_location.js +49 -0
  180. package/esm/src/web_workers/ui/platform_location.js.map +1 -0
  181. package/esm/src/web_workers/ui/platform_location.metadata.json +1 -0
  182. package/esm/src/web_workers/ui/renderer.d.ts +35 -0
  183. package/esm/src/web_workers/ui/renderer.js +122 -0
  184. package/esm/src/web_workers/ui/renderer.js.map +1 -0
  185. package/esm/src/web_workers/ui/renderer.metadata.json +1 -0
  186. package/esm/src/web_workers/worker/event_deserializer.d.ts +5 -0
  187. package/esm/src/web_workers/worker/event_deserializer.js +6 -0
  188. package/esm/src/web_workers/worker/event_deserializer.js.map +1 -0
  189. package/esm/src/web_workers/worker/event_deserializer.metadata.json +1 -0
  190. package/esm/src/web_workers/worker/location_providers.d.ts +17 -0
  191. package/esm/src/web_workers/worker/location_providers.js +20 -0
  192. package/esm/src/web_workers/worker/location_providers.js.map +1 -0
  193. package/esm/src/web_workers/worker/location_providers.metadata.json +1 -0
  194. package/esm/src/web_workers/worker/platform_location.d.ts +23 -0
  195. package/esm/src/web_workers/worker/platform_location.js +111 -0
  196. package/esm/src/web_workers/worker/platform_location.js.map +1 -0
  197. package/esm/src/web_workers/worker/platform_location.metadata.json +1 -0
  198. package/esm/src/web_workers/worker/renderer.d.ts +55 -0
  199. package/esm/src/web_workers/worker/renderer.js +227 -0
  200. package/esm/src/web_workers/worker/renderer.js.map +1 -0
  201. package/esm/src/web_workers/worker/renderer.metadata.json +1 -0
  202. package/esm/src/web_workers/worker/worker_adapter.d.ts +132 -0
  203. package/esm/src/web_workers/worker/worker_adapter.js +192 -0
  204. package/esm/src/web_workers/worker/worker_adapter.js.map +1 -0
  205. package/esm/src/worker_app.d.ts +13 -0
  206. package/esm/src/worker_app.js +68 -0
  207. package/esm/src/worker_app.js.map +1 -0
  208. package/esm/src/worker_app.metadata.json +1 -0
  209. package/esm/src/worker_render.d.ts +35 -0
  210. package/esm/src/worker_render.js +147 -0
  211. package/esm/src/worker_render.js.map +1 -0
  212. package/esm/src/worker_render.metadata.json +1 -0
  213. package/esm/testing/browser.d.ts +8 -0
  214. package/esm/testing/browser.js +38 -0
  215. package/esm/testing/browser.js.map +1 -0
  216. package/esm/testing/browser.metadata.json +1 -0
  217. package/esm/testing/browser_util.d.ts +1 -0
  218. package/esm/testing/browser_util.js +11 -6
  219. package/esm/testing/browser_util.js.map +1 -1
  220. package/esm/testing/browser_util.metadata.json +1 -1
  221. package/esm/testing/e2e_util.d.ts +4 -0
  222. package/esm/testing/e2e_util.js +21 -0
  223. package/esm/testing/e2e_util.js.map +1 -0
  224. package/esm/testing/e2e_util.metadata.json +1 -0
  225. package/esm/testing/matchers.js +24 -22
  226. package/esm/testing/matchers.js.map +1 -1
  227. package/esm/testing/matchers.metadata.json +1 -1
  228. package/esm/testing.d.ts +1 -2
  229. package/esm/testing.js +1 -2
  230. package/esm/testing.js.map +1 -1
  231. package/esm/testing_e2e.d.ts +1 -0
  232. package/esm/testing_e2e.js +2 -0
  233. package/esm/testing_e2e.js.map +1 -0
  234. package/index.d.ts +22 -1
  235. package/index.js +50 -1
  236. package/index.js.map +1 -1
  237. package/index.metadata.json +1 -0
  238. package/package.json +8 -4
  239. package/private_export.d.ts +21 -21
  240. package/private_export.js +11 -21
  241. package/private_export.js.map +1 -1
  242. package/private_export.metadata.json +1 -0
  243. package/src/browser/browser_adapter.d.ts +6 -0
  244. package/src/browser/browser_adapter.js +144 -76
  245. package/src/browser/browser_adapter.js.map +1 -1
  246. package/src/browser/generic_browser_adapter.js +4 -4
  247. package/src/browser/generic_browser_adapter.js.map +1 -1
  248. package/src/browser/location/browser_platform_location.d.ts +1 -5
  249. package/src/browser/location/browser_platform_location.js +16 -3
  250. package/src/browser/location/browser_platform_location.js.map +1 -1
  251. package/src/browser/location/browser_platform_location.metadata.json +1 -1
  252. package/src/browser/location/history.d.ts +1 -0
  253. package/src/browser/location/history.js +6 -0
  254. package/src/browser/location/history.js.map +1 -0
  255. package/src/browser/location/history.metadata.json +1 -0
  256. package/src/browser/testability.d.ts +1 -1
  257. package/src/browser/testability.js +7 -5
  258. package/src/browser/testability.js.map +1 -1
  259. package/src/browser/title.d.ts +2 -0
  260. package/src/browser/title.js +2 -0
  261. package/src/browser/title.js.map +1 -1
  262. package/src/browser/tools/common_tools.js +2 -2
  263. package/src/browser/tools/common_tools.js.map +1 -1
  264. package/src/browser/tools/tools.d.ts +1 -1
  265. package/src/browser/tools/tools.js +2 -1
  266. package/src/browser/tools/tools.js.map +1 -1
  267. package/src/browser.d.ts +15 -0
  268. package/src/browser.js +78 -0
  269. package/src/browser.js.map +1 -0
  270. package/src/browser.metadata.json +1 -0
  271. package/src/dom/debug/by.d.ts +2 -2
  272. package/src/dom/debug/by.js +1 -1
  273. package/src/dom/debug/by.js.map +1 -1
  274. package/src/dom/debug/ng_probe.js +9 -18
  275. package/src/dom/debug/ng_probe.js.map +1 -1
  276. package/src/dom/debug/ng_probe.metadata.json +1 -1
  277. package/src/dom/dom_adapter.d.ts +7 -5
  278. package/src/dom/dom_adapter.js +1 -1
  279. package/src/dom/dom_adapter.js.map +1 -1
  280. package/src/dom/dom_adapter.metadata.json +1 -0
  281. package/src/dom/dom_animate_player.d.ts +9 -0
  282. package/src/dom/dom_animate_player.js +2 -0
  283. package/src/dom/dom_animate_player.js.map +1 -0
  284. package/src/dom/dom_renderer.d.ts +9 -19
  285. package/src/dom/dom_renderer.js +29 -61
  286. package/src/dom/dom_renderer.js.map +1 -1
  287. package/src/dom/dom_renderer.metadata.json +1 -1
  288. package/src/dom/dom_tokens.js.map +1 -1
  289. package/src/dom/dom_tokens.metadata.json +1 -1
  290. package/src/dom/events/dom_events.js +3 -2
  291. package/src/dom/events/dom_events.js.map +1 -1
  292. package/src/dom/events/dom_events.metadata.json +1 -1
  293. package/src/dom/events/event_manager.d.ts +1 -3
  294. package/src/dom/events/event_manager.js +8 -7
  295. package/src/dom/events/event_manager.js.map +1 -1
  296. package/src/dom/events/event_manager.metadata.json +1 -1
  297. package/src/dom/events/hammer_common.js +1 -1
  298. package/src/dom/events/hammer_common.js.map +1 -1
  299. package/src/dom/events/hammer_gestures.js +9 -5
  300. package/src/dom/events/hammer_gestures.js.map +1 -1
  301. package/src/dom/events/hammer_gestures.metadata.json +1 -1
  302. package/src/dom/events/key_events.d.ts +0 -2
  303. package/src/dom/events/key_events.js +5 -3
  304. package/src/dom/events/key_events.js.map +1 -1
  305. package/src/dom/events/key_events.metadata.json +1 -1
  306. package/src/dom/shared_styles_host.d.ts +0 -6
  307. package/src/dom/shared_styles_host.js +5 -1
  308. package/src/dom/shared_styles_host.js.map +1 -1
  309. package/src/dom/shared_styles_host.metadata.json +1 -1
  310. package/src/dom/util.js +3 -3
  311. package/src/dom/util.js.map +1 -1
  312. package/src/dom/util.metadata.json +1 -0
  313. package/src/dom/web_animations_driver.d.ts +4 -0
  314. package/src/dom/web_animations_driver.js +123 -0
  315. package/src/dom/web_animations_driver.js.map +1 -0
  316. package/src/dom/web_animations_player.d.ts +20 -0
  317. package/src/dom/web_animations_player.js +46 -0
  318. package/src/dom/web_animations_player.js.map +1 -0
  319. package/src/facade/async.d.ts +90 -0
  320. package/src/facade/async.js +160 -0
  321. package/src/facade/async.js.map +1 -0
  322. package/src/facade/base_wrapped_exception.js +4 -4
  323. package/src/facade/base_wrapped_exception.js.map +1 -1
  324. package/src/facade/browser.js +2 -2
  325. package/src/facade/browser.js.map +1 -1
  326. package/src/facade/browser.metadata.json +1 -1
  327. package/src/facade/collection.js.map +1 -1
  328. package/src/facade/collection.metadata.json +1 -1
  329. package/src/facade/exception_handler.d.ts +2 -11
  330. package/src/facade/exception_handler.js +8 -7
  331. package/src/facade/exception_handler.js.map +1 -1
  332. package/src/facade/exceptions.d.ts +4 -0
  333. package/src/facade/exceptions.js +6 -2
  334. package/src/facade/exceptions.js.map +1 -1
  335. package/src/facade/exceptions.metadata.json +1 -0
  336. package/src/facade/lang.d.ts +6 -4
  337. package/src/facade/lang.js +12 -11
  338. package/src/facade/lang.js.map +1 -1
  339. package/src/facade/lang.metadata.json +1 -1
  340. package/src/facade/promise.d.ts +17 -0
  341. package/src/facade/promise.js +49 -0
  342. package/src/facade/promise.js.map +1 -0
  343. package/src/security/dom_sanitization_service.d.ts +98 -0
  344. package/src/security/dom_sanitization_service.js +150 -0
  345. package/src/security/dom_sanitization_service.js.map +1 -0
  346. package/src/security/dom_sanitization_service.metadata.json +1 -0
  347. package/src/security/html_sanitizer.d.ts +5 -0
  348. package/src/security/html_sanitizer.js +246 -0
  349. package/src/security/html_sanitizer.js.map +1 -0
  350. package/src/security/style_sanitizer.d.ts +5 -0
  351. package/src/security/style_sanitizer.js +83 -0
  352. package/src/security/style_sanitizer.js.map +1 -0
  353. package/src/security/url_sanitizer.d.ts +1 -0
  354. package/src/security/url_sanitizer.js +42 -0
  355. package/src/security/url_sanitizer.js.map +1 -0
  356. package/src/web_workers/shared/api.d.ts +2 -0
  357. package/src/web_workers/shared/api.js +4 -0
  358. package/src/web_workers/shared/api.js.map +1 -0
  359. package/src/web_workers/shared/api.metadata.json +1 -0
  360. package/src/web_workers/shared/client_message_broker.d.ts +51 -0
  361. package/src/web_workers/shared/client_message_broker.js +184 -0
  362. package/src/web_workers/shared/client_message_broker.js.map +1 -0
  363. package/src/web_workers/shared/client_message_broker.metadata.json +1 -0
  364. package/src/web_workers/shared/message_bus.d.ts +82 -0
  365. package/src/web_workers/shared/message_bus.js +15 -0
  366. package/src/web_workers/shared/message_bus.js.map +1 -0
  367. package/src/web_workers/shared/messaging_api.d.ts +7 -0
  368. package/src/web_workers/shared/messaging_api.js +9 -0
  369. package/src/web_workers/shared/messaging_api.js.map +1 -0
  370. package/src/web_workers/shared/messaging_api.metadata.json +1 -0
  371. package/src/web_workers/shared/post_message_bus.d.ts +41 -0
  372. package/src/web_workers/shared/post_message_bus.js +147 -0
  373. package/src/web_workers/shared/post_message_bus.js.map +1 -0
  374. package/src/web_workers/shared/post_message_bus.metadata.json +1 -0
  375. package/src/web_workers/shared/render_store.d.ts +11 -0
  376. package/src/web_workers/shared/render_store.js +43 -0
  377. package/src/web_workers/shared/render_store.js.map +1 -0
  378. package/src/web_workers/shared/render_store.metadata.json +1 -0
  379. package/src/web_workers/shared/serialized_types.d.ts +12 -0
  380. package/src/web_workers/shared/serialized_types.js +19 -0
  381. package/src/web_workers/shared/serialized_types.js.map +1 -0
  382. package/src/web_workers/shared/serializer.d.ts +18 -0
  383. package/src/web_workers/shared/serializer.js +119 -0
  384. package/src/web_workers/shared/serializer.js.map +1 -0
  385. package/src/web_workers/shared/serializer.metadata.json +1 -0
  386. package/src/web_workers/shared/service_message_broker.d.ts +48 -0
  387. package/src/web_workers/shared/service_message_broker.js +114 -0
  388. package/src/web_workers/shared/service_message_broker.js.map +1 -0
  389. package/src/web_workers/shared/service_message_broker.metadata.json +1 -0
  390. package/src/web_workers/ui/event_dispatcher.d.ts +8 -0
  391. package/src/web_workers/ui/event_dispatcher.js +107 -0
  392. package/src/web_workers/ui/event_dispatcher.js.map +1 -0
  393. package/src/web_workers/ui/event_serializer.d.ts +15 -0
  394. package/src/web_workers/ui/event_serializer.js +59 -0
  395. package/src/web_workers/ui/event_serializer.js.map +1 -0
  396. package/src/web_workers/ui/event_serializer.metadata.json +1 -0
  397. package/src/web_workers/ui/location_providers.d.ts +14 -0
  398. package/src/web_workers/ui/location_providers.js +20 -0
  399. package/src/web_workers/ui/location_providers.js.map +1 -0
  400. package/src/web_workers/ui/location_providers.metadata.json +1 -0
  401. package/src/web_workers/ui/platform_location.d.ts +16 -0
  402. package/src/web_workers/ui/platform_location.js +52 -0
  403. package/src/web_workers/ui/platform_location.js.map +1 -0
  404. package/src/web_workers/ui/platform_location.metadata.json +1 -0
  405. package/src/web_workers/ui/renderer.d.ts +35 -0
  406. package/src/web_workers/ui/renderer.js +131 -0
  407. package/src/web_workers/ui/renderer.js.map +1 -0
  408. package/src/web_workers/ui/renderer.metadata.json +1 -0
  409. package/src/web_workers/worker/event_deserializer.d.ts +5 -0
  410. package/src/web_workers/worker/event_deserializer.js +8 -0
  411. package/src/web_workers/worker/event_deserializer.js.map +1 -0
  412. package/src/web_workers/worker/event_deserializer.metadata.json +1 -0
  413. package/src/web_workers/worker/location_providers.d.ts +17 -0
  414. package/src/web_workers/worker/location_providers.js +21 -0
  415. package/src/web_workers/worker/location_providers.js.map +1 -0
  416. package/src/web_workers/worker/location_providers.metadata.json +1 -0
  417. package/src/web_workers/worker/platform_location.d.ts +23 -0
  418. package/src/web_workers/worker/platform_location.js +134 -0
  419. package/src/web_workers/worker/platform_location.js.map +1 -0
  420. package/src/web_workers/worker/platform_location.metadata.json +1 -0
  421. package/src/web_workers/worker/renderer.d.ts +55 -0
  422. package/src/web_workers/worker/renderer.js +241 -0
  423. package/src/web_workers/worker/renderer.js.map +1 -0
  424. package/src/web_workers/worker/renderer.metadata.json +1 -0
  425. package/src/web_workers/worker/worker_adapter.d.ts +132 -0
  426. package/src/web_workers/worker/worker_adapter.js +208 -0
  427. package/src/web_workers/worker/worker_adapter.js.map +1 -0
  428. package/src/worker_app.d.ts +13 -0
  429. package/src/worker_app.js +71 -0
  430. package/src/worker_app.js.map +1 -0
  431. package/src/worker_app.metadata.json +1 -0
  432. package/src/worker_render.d.ts +35 -0
  433. package/src/worker_render.js +153 -0
  434. package/src/worker_render.js.map +1 -0
  435. package/src/worker_render.metadata.json +1 -0
  436. package/testing/browser.d.ts +8 -0
  437. package/testing/browser.js +39 -0
  438. package/testing/browser.js.map +1 -0
  439. package/testing/browser.metadata.json +1 -0
  440. package/testing/browser_util.d.ts +1 -0
  441. package/testing/browser_util.js +14 -5
  442. package/testing/browser_util.js.map +1 -1
  443. package/testing/browser_util.metadata.json +1 -1
  444. package/testing/e2e_util.d.ts +4 -0
  445. package/testing/e2e_util.js +24 -0
  446. package/testing/e2e_util.js.map +1 -0
  447. package/testing/e2e_util.metadata.json +1 -0
  448. package/testing/matchers.js +24 -22
  449. package/testing/matchers.js.map +1 -1
  450. package/testing/matchers.metadata.json +1 -1
  451. package/testing.d.ts +1 -2
  452. package/testing.js +1 -2
  453. package/testing.js.map +1 -1
  454. package/testing_e2e.d.ts +1 -0
  455. package/testing_e2e.js +6 -0
  456. package/testing_e2e.js.map +1 -0
  457. package/esm/platform-browser.umd.js.map +0 -1
  458. package/esm/src/animate/animation.d.ts +0 -82
  459. package/esm/src/animate/animation.js +0 -173
  460. package/esm/src/animate/animation.js.map +0 -1
  461. package/esm/src/animate/animation_builder.d.ts +0 -15
  462. package/esm/src/animate/animation_builder.js +0 -24
  463. package/esm/src/animate/animation_builder.js.map +0 -1
  464. package/esm/src/animate/animation_builder.metadata.json +0 -1
  465. package/esm/src/animate/browser_details.d.ts +0 -10
  466. package/esm/src/animate/browser_details.js +0 -60
  467. package/esm/src/animate/browser_details.js.map +0 -1
  468. package/esm/src/animate/browser_details.metadata.json +0 -1
  469. package/esm/src/animate/css_animation_builder.d.ts +0 -66
  470. package/esm/src/animate/css_animation_builder.js +0 -84
  471. package/esm/src/animate/css_animation_builder.js.map +0 -1
  472. package/esm/src/animate/css_animation_options.d.ts +0 -20
  473. package/esm/src/animate/css_animation_options.js +0 -11
  474. package/esm/src/animate/css_animation_options.js.map +0 -1
  475. package/esm/src/browser_common.d.ts +0 -20
  476. package/esm/src/browser_common.js +0 -76
  477. package/esm/src/browser_common.js.map +0 -1
  478. package/esm/src/browser_common.metadata.json +0 -1
  479. package/esm/src/facade/math.d.ts +0 -2
  480. package/esm/src/facade/math.js +0 -4
  481. package/esm/src/facade/math.js.map +0 -1
  482. package/esm/src/facade/math.metadata.json +0 -1
  483. package/esm/src/platform_browser.d.ts +0 -9
  484. package/esm/src/platform_browser.js +0 -17
  485. package/esm/src/platform_browser.js.map +0 -1
  486. package/esm/src/platform_browser_static.d.ts +0 -16
  487. package/esm/src/platform_browser_static.js +0 -32
  488. package/esm/src/platform_browser_static.js.map +0 -1
  489. package/esm/src/platform_browser_static.metadata.json +0 -1
  490. package/esm/testing/animation_builder_mock.d.ts +0 -6
  491. package/esm/testing/animation_builder_mock.js +0 -35
  492. package/esm/testing/animation_builder_mock.js.map +0 -1
  493. package/esm/testing/animation_builder_mock.metadata.json +0 -1
  494. package/esm/testing/browser_static.d.ts +0 -10
  495. package/esm/testing/browser_static.js +0 -53
  496. package/esm/testing/browser_static.js.map +0 -1
  497. package/esm/testing/browser_static.metadata.json +0 -1
  498. package/esm/testing/dom_test_component_renderer.d.ts +0 -9
  499. package/esm/testing/dom_test_component_renderer.js +0 -27
  500. package/esm/testing/dom_test_component_renderer.js.map +0 -1
  501. package/esm/testing/dom_test_component_renderer.metadata.json +0 -1
  502. package/platform-browser.umd.js +0 -2488
  503. package/src/animate/animation.d.ts +0 -82
  504. package/src/animate/animation.js +0 -183
  505. package/src/animate/animation.js.map +0 -1
  506. package/src/animate/animation_builder.d.ts +0 -15
  507. package/src/animate/animation_builder.js +0 -27
  508. package/src/animate/animation_builder.js.map +0 -1
  509. package/src/animate/animation_builder.metadata.json +0 -1
  510. package/src/animate/browser_details.d.ts +0 -10
  511. package/src/animate/browser_details.js +0 -66
  512. package/src/animate/browser_details.js.map +0 -1
  513. package/src/animate/browser_details.metadata.json +0 -1
  514. package/src/animate/css_animation_builder.d.ts +0 -66
  515. package/src/animate/css_animation_builder.js +0 -87
  516. package/src/animate/css_animation_builder.js.map +0 -1
  517. package/src/animate/css_animation_options.d.ts +0 -20
  518. package/src/animate/css_animation_options.js +0 -14
  519. package/src/animate/css_animation_options.js.map +0 -1
  520. package/src/browser_common.d.ts +0 -20
  521. package/src/browser_common.js +0 -85
  522. package/src/browser_common.js.map +0 -1
  523. package/src/browser_common.metadata.json +0 -1
  524. package/src/facade/math.d.ts +0 -2
  525. package/src/facade/math.js +0 -5
  526. package/src/facade/math.js.map +0 -1
  527. package/src/facade/math.metadata.json +0 -1
  528. package/src/platform_browser.d.ts +0 -9
  529. package/src/platform_browser.js +0 -39
  530. package/src/platform_browser.js.map +0 -1
  531. package/src/platform_browser_static.d.ts +0 -16
  532. package/src/platform_browser_static.js +0 -42
  533. package/src/platform_browser_static.js.map +0 -1
  534. package/src/platform_browser_static.metadata.json +0 -1
  535. package/testing/animation_builder_mock.d.ts +0 -6
  536. package/testing/animation_builder_mock.js +0 -53
  537. package/testing/animation_builder_mock.js.map +0 -1
  538. package/testing/animation_builder_mock.metadata.json +0 -1
  539. package/testing/browser_static.d.ts +0 -10
  540. package/testing/browser_static.js +0 -55
  541. package/testing/browser_static.js.map +0 -1
  542. package/testing/browser_static.metadata.json +0 -1
  543. package/testing/dom_test_component_renderer.d.ts +0 -9
  544. package/testing/dom_test_component_renderer.js +0 -36
  545. package/testing/dom_test_component_renderer.js.map +0 -1
  546. package/testing/dom_test_component_renderer.metadata.json +0 -1
@@ -0,0 +1,4685 @@
1
+ /**
2
+ * @license AngularJS v2.0.0-rc.2
3
+ * (c) 2010-2016 Google, Inc. https://angular.io/
4
+ * License: MIT
5
+ */
6
+ var __extends = (this && this.__extends) || function (d, b) {
7
+ for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
8
+ function __() { this.constructor = d; }
9
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10
+ };
11
+ (function (global, factory) {
12
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('rxjs/Subject'), require('rxjs/observable/PromiseObservable'), require('rxjs/operator/toPromise'), require('rxjs/Observable')) :
13
+ typeof define === 'function' && define.amd ? define(['exports', '@angular/common', '@angular/core', 'rxjs/Subject', 'rxjs/observable/PromiseObservable', 'rxjs/operator/toPromise', 'rxjs/Observable'], factory) :
14
+ (factory((global.ng = global.ng || {}, global.ng.platformBrowser = global.ng.platformBrowser || {}), global.ng.common, global.ng.core, global.Rx, global.Rx, global.Rx.Observable.prototype, global.Rx));
15
+ }(this, function (exports, _angular_common, _angular_core, rxjs_Subject, rxjs_observable_PromiseObservable, rxjs_operator_toPromise, rxjs_Observable) {
16
+ 'use strict';
17
+ var globalScope;
18
+ if (typeof window === 'undefined') {
19
+ if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
20
+ // TODO: Replace any with WorkerGlobalScope from lib.webworker.d.ts #3492
21
+ globalScope = self;
22
+ }
23
+ else {
24
+ globalScope = global;
25
+ }
26
+ }
27
+ else {
28
+ globalScope = window;
29
+ }
30
+ // Need to declare a new variable for global here since TypeScript
31
+ // exports the original value of the symbol.
32
+ var global$1 = globalScope;
33
+ var Date = global$1.Date;
34
+ var _devMode = true;
35
+ function assertionsEnabled() {
36
+ return _devMode;
37
+ }
38
+ // TODO: remove calls to assert in production environment
39
+ // Note: Can't just export this and import in in other files
40
+ // as `assert` is a reserved keyword in Dart
41
+ global$1.assert = function assert(condition) {
42
+ // TODO: to be fixed properly via #2830, noop for now
43
+ };
44
+ function isPresent(obj) {
45
+ return obj !== undefined && obj !== null;
46
+ }
47
+ function isBlank(obj) {
48
+ return obj === undefined || obj === null;
49
+ }
50
+ function isNumber(obj) {
51
+ return typeof obj === 'number';
52
+ }
53
+ function isString(obj) {
54
+ return typeof obj === 'string';
55
+ }
56
+ function isFunction(obj) {
57
+ return typeof obj === 'function';
58
+ }
59
+ function isArray(obj) {
60
+ return Array.isArray(obj);
61
+ }
62
+ function noop() { }
63
+ function stringify(token) {
64
+ if (typeof token === 'string') {
65
+ return token;
66
+ }
67
+ if (token === undefined || token === null) {
68
+ return '' + token;
69
+ }
70
+ if (token.name) {
71
+ return token.name;
72
+ }
73
+ if (token.overriddenName) {
74
+ return token.overriddenName;
75
+ }
76
+ var res = token.toString();
77
+ var newLineIndex = res.indexOf('\n');
78
+ return (newLineIndex === -1) ? res : res.substring(0, newLineIndex);
79
+ }
80
+ // serialize / deserialize enum exist only for consistency with dart API
81
+ // enums in typescript don't need to be serialized
82
+ function serializeEnum(val) {
83
+ return val;
84
+ }
85
+ var StringWrapper = (function () {
86
+ function StringWrapper() {
87
+ }
88
+ StringWrapper.fromCharCode = function (code) { return String.fromCharCode(code); };
89
+ StringWrapper.charCodeAt = function (s, index) { return s.charCodeAt(index); };
90
+ StringWrapper.split = function (s, regExp) { return s.split(regExp); };
91
+ StringWrapper.equals = function (s, s2) { return s === s2; };
92
+ StringWrapper.stripLeft = function (s, charVal) {
93
+ if (s && s.length) {
94
+ var pos = 0;
95
+ for (var i = 0; i < s.length; i++) {
96
+ if (s[i] != charVal)
97
+ break;
98
+ pos++;
99
+ }
100
+ s = s.substring(pos);
101
+ }
102
+ return s;
103
+ };
104
+ StringWrapper.stripRight = function (s, charVal) {
105
+ if (s && s.length) {
106
+ var pos = s.length;
107
+ for (var i = s.length - 1; i >= 0; i--) {
108
+ if (s[i] != charVal)
109
+ break;
110
+ pos--;
111
+ }
112
+ s = s.substring(0, pos);
113
+ }
114
+ return s;
115
+ };
116
+ StringWrapper.replace = function (s, from, replace) {
117
+ return s.replace(from, replace);
118
+ };
119
+ StringWrapper.replaceAll = function (s, from, replace) {
120
+ return s.replace(from, replace);
121
+ };
122
+ StringWrapper.slice = function (s, from, to) {
123
+ if (from === void 0) { from = 0; }
124
+ if (to === void 0) { to = null; }
125
+ return s.slice(from, to === null ? undefined : to);
126
+ };
127
+ StringWrapper.replaceAllMapped = function (s, from, cb) {
128
+ return s.replace(from, function () {
129
+ var matches = [];
130
+ for (var _i = 0; _i < arguments.length; _i++) {
131
+ matches[_i - 0] = arguments[_i];
132
+ }
133
+ // Remove offset & string from the result array
134
+ matches.splice(-2, 2);
135
+ // The callback receives match, p1, ..., pn
136
+ return cb(matches);
137
+ });
138
+ };
139
+ StringWrapper.contains = function (s, substr) { return s.indexOf(substr) != -1; };
140
+ StringWrapper.compare = function (a, b) {
141
+ if (a < b) {
142
+ return -1;
143
+ }
144
+ else if (a > b) {
145
+ return 1;
146
+ }
147
+ else {
148
+ return 0;
149
+ }
150
+ };
151
+ return StringWrapper;
152
+ }());
153
+ var NumberParseError = (function (_super) {
154
+ __extends(NumberParseError, _super);
155
+ function NumberParseError(message) {
156
+ _super.call(this);
157
+ this.message = message;
158
+ }
159
+ NumberParseError.prototype.toString = function () { return this.message; };
160
+ return NumberParseError;
161
+ }(Error));
162
+ var NumberWrapper = (function () {
163
+ function NumberWrapper() {
164
+ }
165
+ NumberWrapper.toFixed = function (n, fractionDigits) { return n.toFixed(fractionDigits); };
166
+ NumberWrapper.equal = function (a, b) { return a === b; };
167
+ NumberWrapper.parseIntAutoRadix = function (text) {
168
+ var result = parseInt(text);
169
+ if (isNaN(result)) {
170
+ throw new NumberParseError('Invalid integer literal when parsing ' + text);
171
+ }
172
+ return result;
173
+ };
174
+ NumberWrapper.parseInt = function (text, radix) {
175
+ if (radix == 10) {
176
+ if (/^(\-|\+)?[0-9]+$/.test(text)) {
177
+ return parseInt(text, radix);
178
+ }
179
+ }
180
+ else if (radix == 16) {
181
+ if (/^(\-|\+)?[0-9ABCDEFabcdef]+$/.test(text)) {
182
+ return parseInt(text, radix);
183
+ }
184
+ }
185
+ else {
186
+ var result = parseInt(text, radix);
187
+ if (!isNaN(result)) {
188
+ return result;
189
+ }
190
+ }
191
+ throw new NumberParseError('Invalid integer literal when parsing ' + text + ' in base ' + radix);
192
+ };
193
+ // TODO: NaN is a valid literal but is returned by parseFloat to indicate an error.
194
+ NumberWrapper.parseFloat = function (text) { return parseFloat(text); };
195
+ Object.defineProperty(NumberWrapper, "NaN", {
196
+ get: function () { return NaN; },
197
+ enumerable: true,
198
+ configurable: true
199
+ });
200
+ NumberWrapper.isNaN = function (value) { return isNaN(value); };
201
+ NumberWrapper.isInteger = function (value) { return Number.isInteger(value); };
202
+ return NumberWrapper;
203
+ }());
204
+ var RegExpWrapper = (function () {
205
+ function RegExpWrapper() {
206
+ }
207
+ RegExpWrapper.create = function (regExpStr, flags) {
208
+ if (flags === void 0) { flags = ''; }
209
+ flags = flags.replace(/g/g, '');
210
+ return new global$1.RegExp(regExpStr, flags + 'g');
211
+ };
212
+ RegExpWrapper.firstMatch = function (regExp, input) {
213
+ // Reset multimatch regex state
214
+ regExp.lastIndex = 0;
215
+ return regExp.exec(input);
216
+ };
217
+ RegExpWrapper.test = function (regExp, input) {
218
+ regExp.lastIndex = 0;
219
+ return regExp.test(input);
220
+ };
221
+ RegExpWrapper.matcher = function (regExp, input) {
222
+ // Reset regex state for the case
223
+ // someone did not loop over all matches
224
+ // last time.
225
+ regExp.lastIndex = 0;
226
+ return { re: regExp, input: input };
227
+ };
228
+ RegExpWrapper.replaceAll = function (regExp, input, replace) {
229
+ var c = regExp.exec(input);
230
+ var res = '';
231
+ regExp.lastIndex = 0;
232
+ var prev = 0;
233
+ while (c) {
234
+ res += input.substring(prev, c.index);
235
+ res += replace(c);
236
+ prev = c.index + c[0].length;
237
+ regExp.lastIndex = prev;
238
+ c = regExp.exec(input);
239
+ }
240
+ res += input.substring(prev);
241
+ return res;
242
+ };
243
+ return RegExpWrapper;
244
+ }());
245
+ var FunctionWrapper = (function () {
246
+ function FunctionWrapper() {
247
+ }
248
+ FunctionWrapper.apply = function (fn, posArgs) { return fn.apply(null, posArgs); };
249
+ FunctionWrapper.bind = function (fn, scope) { return fn.bind(scope); };
250
+ return FunctionWrapper;
251
+ }());
252
+ function print(obj) {
253
+ console.log(obj);
254
+ }
255
+ // Can't be all uppercase as our transpiler would think it is a special directive...
256
+ var Json = (function () {
257
+ function Json() {
258
+ }
259
+ Json.parse = function (s) { return global$1.JSON.parse(s); };
260
+ Json.stringify = function (data) {
261
+ // Dart doesn't take 3 arguments
262
+ return global$1.JSON.stringify(data, null, 2);
263
+ };
264
+ return Json;
265
+ }());
266
+ var DateWrapper = (function () {
267
+ function DateWrapper() {
268
+ }
269
+ DateWrapper.create = function (year, month, day, hour, minutes, seconds, milliseconds) {
270
+ if (month === void 0) { month = 1; }
271
+ if (day === void 0) { day = 1; }
272
+ if (hour === void 0) { hour = 0; }
273
+ if (minutes === void 0) { minutes = 0; }
274
+ if (seconds === void 0) { seconds = 0; }
275
+ if (milliseconds === void 0) { milliseconds = 0; }
276
+ return new Date(year, month - 1, day, hour, minutes, seconds, milliseconds);
277
+ };
278
+ DateWrapper.fromISOString = function (str) { return new Date(str); };
279
+ DateWrapper.fromMillis = function (ms) { return new Date(ms); };
280
+ DateWrapper.toMillis = function (date) { return date.getTime(); };
281
+ DateWrapper.now = function () { return new Date(); };
282
+ DateWrapper.toJson = function (date) { return date.toJSON(); };
283
+ return DateWrapper;
284
+ }());
285
+ function setValueOnPath(global, path, value) {
286
+ var parts = path.split('.');
287
+ var obj = global;
288
+ while (parts.length > 1) {
289
+ var name = parts.shift();
290
+ if (obj.hasOwnProperty(name) && isPresent(obj[name])) {
291
+ obj = obj[name];
292
+ }
293
+ else {
294
+ obj = obj[name] = {};
295
+ }
296
+ }
297
+ if (obj === undefined || obj === null) {
298
+ obj = {};
299
+ }
300
+ obj[parts.shift()] = value;
301
+ }
302
+ var _DOM = null;
303
+ function getDOM() {
304
+ return _DOM;
305
+ }
306
+ function setRootDomAdapter(adapter) {
307
+ if (isBlank(_DOM)) {
308
+ _DOM = adapter;
309
+ }
310
+ }
311
+ /* tslint:disable:requireParameterType */
312
+ /**
313
+ * Provides DOM operations in an environment-agnostic way.
314
+ */
315
+ var DomAdapter = (function () {
316
+ function DomAdapter() {
317
+ this.xhrType = null;
318
+ }
319
+ /** @deprecated */
320
+ DomAdapter.prototype.getXHR = function () { return this.xhrType; };
321
+ Object.defineProperty(DomAdapter.prototype, "attrToPropMap", {
322
+ /**
323
+ * Maps attribute names to their corresponding property names for cases
324
+ * where attribute name doesn't match property name.
325
+ */
326
+ get: function () { return this._attrToPropMap; },
327
+ set: function (value) { this._attrToPropMap = value; },
328
+ enumerable: true,
329
+ configurable: true
330
+ });
331
+ ;
332
+ ;
333
+ return DomAdapter;
334
+ }());
335
+ function supportsState() {
336
+ return !!window.history.pushState;
337
+ }
338
+ var BrowserPlatformLocation = (function (_super) {
339
+ __extends(BrowserPlatformLocation, _super);
340
+ function BrowserPlatformLocation() {
341
+ _super.call(this);
342
+ this._init();
343
+ }
344
+ // This is moved to its own method so that `MockPlatformLocationStrategy` can overwrite it
345
+ /** @internal */
346
+ BrowserPlatformLocation.prototype._init = function () {
347
+ this._location = getDOM().getLocation();
348
+ this._history = getDOM().getHistory();
349
+ };
350
+ Object.defineProperty(BrowserPlatformLocation.prototype, "location", {
351
+ /** @internal */
352
+ get: function () { return this._location; },
353
+ enumerable: true,
354
+ configurable: true
355
+ });
356
+ BrowserPlatformLocation.prototype.getBaseHrefFromDOM = function () { return getDOM().getBaseHref(); };
357
+ BrowserPlatformLocation.prototype.onPopState = function (fn) {
358
+ getDOM().getGlobalEventTarget('window').addEventListener('popstate', fn, false);
359
+ };
360
+ BrowserPlatformLocation.prototype.onHashChange = function (fn) {
361
+ getDOM().getGlobalEventTarget('window').addEventListener('hashchange', fn, false);
362
+ };
363
+ Object.defineProperty(BrowserPlatformLocation.prototype, "pathname", {
364
+ get: function () { return this._location.pathname; },
365
+ set: function (newPath) { this._location.pathname = newPath; },
366
+ enumerable: true,
367
+ configurable: true
368
+ });
369
+ Object.defineProperty(BrowserPlatformLocation.prototype, "search", {
370
+ get: function () { return this._location.search; },
371
+ enumerable: true,
372
+ configurable: true
373
+ });
374
+ Object.defineProperty(BrowserPlatformLocation.prototype, "hash", {
375
+ get: function () { return this._location.hash; },
376
+ enumerable: true,
377
+ configurable: true
378
+ });
379
+ BrowserPlatformLocation.prototype.pushState = function (state, title, url) {
380
+ if (supportsState()) {
381
+ this._history.pushState(state, title, url);
382
+ }
383
+ else {
384
+ this._location.hash = url;
385
+ }
386
+ };
387
+ BrowserPlatformLocation.prototype.replaceState = function (state, title, url) {
388
+ if (supportsState()) {
389
+ this._history.replaceState(state, title, url);
390
+ }
391
+ else {
392
+ this._location.hash = url;
393
+ }
394
+ };
395
+ BrowserPlatformLocation.prototype.forward = function () { this._history.forward(); };
396
+ BrowserPlatformLocation.prototype.back = function () { this._history.back(); };
397
+ return BrowserPlatformLocation;
398
+ }(_angular_common.PlatformLocation));
399
+ /** @nocollapse */
400
+ BrowserPlatformLocation.decorators = [
401
+ { type: _angular_core.Injectable },
402
+ ];
403
+ /** @nocollapse */
404
+ BrowserPlatformLocation.ctorParameters = [];
405
+ /**
406
+ * A service that can be used to get and set the title of a current HTML document.
407
+ *
408
+ * Since an Angular 2 application can't be bootstrapped on the entire HTML document (`<html>` tag)
409
+ * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
410
+ * (representing the `<title>` tag). Instead, this service can be used to set and get the current
411
+ * title value.
412
+ *
413
+ * @experimental
414
+ */
415
+ var Title = (function () {
416
+ function Title() {
417
+ }
418
+ /**
419
+ * Get the title of the current HTML document.
420
+ * @returns {string}
421
+ */
422
+ Title.prototype.getTitle = function () { return getDOM().getTitle(); };
423
+ /**
424
+ * Set the title of the current HTML document.
425
+ * @param newTitle
426
+ */
427
+ Title.prototype.setTitle = function (newTitle) { getDOM().setTitle(newTitle); };
428
+ return Title;
429
+ }());
430
+ /**
431
+ * JS version of browser APIs. This library can only run in the browser.
432
+ */
433
+ var win = typeof window !== 'undefined' && window || {};
434
+ var ChangeDetectionPerfRecord = (function () {
435
+ function ChangeDetectionPerfRecord(msPerTick, numTicks) {
436
+ this.msPerTick = msPerTick;
437
+ this.numTicks = numTicks;
438
+ }
439
+ return ChangeDetectionPerfRecord;
440
+ }());
441
+ /**
442
+ * Entry point for all Angular debug tools. This object corresponds to the `ng`
443
+ * global variable accessible in the dev console.
444
+ */
445
+ var AngularTools = (function () {
446
+ function AngularTools(ref) {
447
+ this.profiler = new AngularProfiler(ref);
448
+ }
449
+ return AngularTools;
450
+ }());
451
+ /**
452
+ * Entry point for all Angular profiling-related debug tools. This object
453
+ * corresponds to the `ng.profiler` in the dev console.
454
+ */
455
+ var AngularProfiler = (function () {
456
+ function AngularProfiler(ref) {
457
+ this.appRef = ref.injector.get(_angular_core.ApplicationRef);
458
+ }
459
+ /**
460
+ * Exercises change detection in a loop and then prints the average amount of
461
+ * time in milliseconds how long a single round of change detection takes for
462
+ * the current state of the UI. It runs a minimum of 5 rounds for a minimum
463
+ * of 500 milliseconds.
464
+ *
465
+ * Optionally, a user may pass a `config` parameter containing a map of
466
+ * options. Supported options are:
467
+ *
468
+ * `record` (boolean) - causes the profiler to record a CPU profile while
469
+ * it exercises the change detector. Example:
470
+ *
471
+ * ```
472
+ * ng.profiler.timeChangeDetection({record: true})
473
+ * ```
474
+ */
475
+ AngularProfiler.prototype.timeChangeDetection = function (config) {
476
+ var record = isPresent(config) && config['record'];
477
+ var profileName = 'Change Detection';
478
+ // Profiler is not available in Android browsers, nor in IE 9 without dev tools opened
479
+ var isProfilerAvailable = isPresent(win.console.profile);
480
+ if (record && isProfilerAvailable) {
481
+ win.console.profile(profileName);
482
+ }
483
+ var start = getDOM().performanceNow();
484
+ var numTicks = 0;
485
+ while (numTicks < 5 || (getDOM().performanceNow() - start) < 500) {
486
+ this.appRef.tick();
487
+ numTicks++;
488
+ }
489
+ var end = getDOM().performanceNow();
490
+ if (record && isProfilerAvailable) {
491
+ // need to cast to <any> because type checker thinks there's no argument
492
+ // while in fact there is:
493
+ //
494
+ // https://developer.mozilla.org/en-US/docs/Web/API/Console/profileEnd
495
+ win.console.profileEnd(profileName);
496
+ }
497
+ var msPerTick = (end - start) / numTicks;
498
+ win.console.log("ran " + numTicks + " change detection cycles");
499
+ win.console.log(NumberWrapper.toFixed(msPerTick, 2) + " ms per check");
500
+ return new ChangeDetectionPerfRecord(msPerTick, numTicks);
501
+ };
502
+ return AngularProfiler;
503
+ }());
504
+ var context = global$1;
505
+ /**
506
+ * Enabled Angular 2 debug tools that are accessible via your browser's
507
+ * developer console.
508
+ *
509
+ * Usage:
510
+ *
511
+ * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
512
+ * 1. Type `ng.` (usually the console will show auto-complete suggestion)
513
+ * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
514
+ * then hit Enter.
515
+ */
516
+ function enableDebugTools(ref) {
517
+ context.ng = new AngularTools(ref);
518
+ return ref;
519
+ }
520
+ /**
521
+ * Disables Angular 2 tools.
522
+ */
523
+ function disableDebugTools() {
524
+ delete context.ng;
525
+ }
526
+ /**
527
+ * Predicates for use with {@link DebugElement}'s query functions.
528
+ */
529
+ var By = (function () {
530
+ function By() {
531
+ }
532
+ /**
533
+ * Match all elements.
534
+ *
535
+ * ## Example
536
+ *
537
+ * {@example platform/dom/debug/ts/by/by.ts region='by_all'}
538
+ */
539
+ By.all = function () { return function (debugElement) { return true; }; };
540
+ /**
541
+ * Match elements by the given CSS selector.
542
+ *
543
+ * ## Example
544
+ *
545
+ * {@example platform/dom/debug/ts/by/by.ts region='by_css'}
546
+ */
547
+ By.css = function (selector) {
548
+ return function (debugElement) {
549
+ return isPresent(debugElement.nativeElement) ?
550
+ getDOM().elementMatches(debugElement.nativeElement, selector) :
551
+ false;
552
+ };
553
+ };
554
+ /**
555
+ * Match elements that have the given directive present.
556
+ *
557
+ * ## Example
558
+ *
559
+ * {@example platform/dom/debug/ts/by/by.ts region='by_directive'}
560
+ */
561
+ By.directive = function (type) {
562
+ return function (debugElement) { return debugElement.providerTokens.indexOf(type) !== -1; };
563
+ };
564
+ return By;
565
+ }());
566
+ var wtfInit = _angular_core.__core_private__.wtfInit;
567
+ var VIEW_ENCAPSULATION_VALUES = _angular_core.__core_private__.VIEW_ENCAPSULATION_VALUES;
568
+ var DebugDomRootRenderer = _angular_core.__core_private__.DebugDomRootRenderer;
569
+ var SecurityContext = _angular_core.__core_private__.SecurityContext;
570
+ var SanitizationService = _angular_core.__core_private__.SanitizationService;
571
+ var NoOpAnimationDriver = _angular_core.__core_private__.NoOpAnimationDriver;
572
+ var AnimationDriver = _angular_core.__core_private__.AnimationDriver;
573
+ var Map$1 = global$1.Map;
574
+ var Set$1 = global$1.Set;
575
+ // Safari and Internet Explorer do not support the iterable parameter to the
576
+ // Map constructor. We work around that by manually adding the items.
577
+ var createMapFromPairs = (function () {
578
+ try {
579
+ if (new Map$1([[1, 2]]).size === 1) {
580
+ return function createMapFromPairs(pairs) { return new Map$1(pairs); };
581
+ }
582
+ }
583
+ catch (e) {
584
+ }
585
+ return function createMapAndPopulateFromPairs(pairs) {
586
+ var map = new Map$1();
587
+ for (var i = 0; i < pairs.length; i++) {
588
+ var pair = pairs[i];
589
+ map.set(pair[0], pair[1]);
590
+ }
591
+ return map;
592
+ };
593
+ })();
594
+ var createMapFromMap = (function () {
595
+ try {
596
+ if (new Map$1(new Map$1())) {
597
+ return function createMapFromMap(m) { return new Map$1(m); };
598
+ }
599
+ }
600
+ catch (e) {
601
+ }
602
+ return function createMapAndPopulateFromMap(m) {
603
+ var map = new Map$1();
604
+ m.forEach(function (v, k) { map.set(k, v); });
605
+ return map;
606
+ };
607
+ })();
608
+ var _clearValues = (function () {
609
+ if ((new Map$1()).keys().next) {
610
+ return function _clearValues(m) {
611
+ var keyIterator = m.keys();
612
+ var k;
613
+ while (!((k = keyIterator.next()).done)) {
614
+ m.set(k.value, null);
615
+ }
616
+ };
617
+ }
618
+ else {
619
+ return function _clearValuesWithForeEach(m) {
620
+ m.forEach(function (v, k) { m.set(k, null); });
621
+ };
622
+ }
623
+ })();
624
+ // Safari doesn't implement MapIterator.next(), which is used is Traceur's polyfill of Array.from
625
+ // TODO(mlaval): remove the work around once we have a working polyfill of Array.from
626
+ var _arrayFromMap = (function () {
627
+ try {
628
+ if ((new Map$1()).values().next) {
629
+ return function createArrayFromMap(m, getValues) {
630
+ return getValues ? Array.from(m.values()) : Array.from(m.keys());
631
+ };
632
+ }
633
+ }
634
+ catch (e) {
635
+ }
636
+ return function createArrayFromMapWithForeach(m, getValues) {
637
+ var res = ListWrapper.createFixedSize(m.size), i = 0;
638
+ m.forEach(function (v, k) {
639
+ res[i] = getValues ? v : k;
640
+ i++;
641
+ });
642
+ return res;
643
+ };
644
+ })();
645
+ /**
646
+ * Wraps Javascript Objects
647
+ */
648
+ var StringMapWrapper = (function () {
649
+ function StringMapWrapper() {
650
+ }
651
+ StringMapWrapper.create = function () {
652
+ // Note: We are not using Object.create(null) here due to
653
+ // performance!
654
+ // http://jsperf.com/ng2-object-create-null
655
+ return {};
656
+ };
657
+ StringMapWrapper.contains = function (map, key) {
658
+ return map.hasOwnProperty(key);
659
+ };
660
+ StringMapWrapper.get = function (map, key) {
661
+ return map.hasOwnProperty(key) ? map[key] : undefined;
662
+ };
663
+ StringMapWrapper.set = function (map, key, value) { map[key] = value; };
664
+ StringMapWrapper.keys = function (map) { return Object.keys(map); };
665
+ StringMapWrapper.values = function (map) {
666
+ return Object.keys(map).reduce(function (r, a) {
667
+ r.push(map[a]);
668
+ return r;
669
+ }, []);
670
+ };
671
+ StringMapWrapper.isEmpty = function (map) {
672
+ for (var prop in map) {
673
+ return false;
674
+ }
675
+ return true;
676
+ };
677
+ StringMapWrapper.delete = function (map, key) { delete map[key]; };
678
+ StringMapWrapper.forEach = function (map, callback) {
679
+ for (var prop in map) {
680
+ if (map.hasOwnProperty(prop)) {
681
+ callback(map[prop], prop);
682
+ }
683
+ }
684
+ };
685
+ StringMapWrapper.merge = function (m1, m2) {
686
+ var m = {};
687
+ for (var attr in m1) {
688
+ if (m1.hasOwnProperty(attr)) {
689
+ m[attr] = m1[attr];
690
+ }
691
+ }
692
+ for (var attr in m2) {
693
+ if (m2.hasOwnProperty(attr)) {
694
+ m[attr] = m2[attr];
695
+ }
696
+ }
697
+ return m;
698
+ };
699
+ StringMapWrapper.equals = function (m1, m2) {
700
+ var k1 = Object.keys(m1);
701
+ var k2 = Object.keys(m2);
702
+ if (k1.length != k2.length) {
703
+ return false;
704
+ }
705
+ var key;
706
+ for (var i = 0; i < k1.length; i++) {
707
+ key = k1[i];
708
+ if (m1[key] !== m2[key]) {
709
+ return false;
710
+ }
711
+ }
712
+ return true;
713
+ };
714
+ return StringMapWrapper;
715
+ }());
716
+ var ListWrapper = (function () {
717
+ function ListWrapper() {
718
+ }
719
+ // JS has no way to express a statically fixed size list, but dart does so we
720
+ // keep both methods.
721
+ ListWrapper.createFixedSize = function (size) { return new Array(size); };
722
+ ListWrapper.createGrowableSize = function (size) { return new Array(size); };
723
+ ListWrapper.clone = function (array) { return array.slice(0); };
724
+ ListWrapper.forEachWithIndex = function (array, fn) {
725
+ for (var i = 0; i < array.length; i++) {
726
+ fn(array[i], i);
727
+ }
728
+ };
729
+ ListWrapper.first = function (array) {
730
+ if (!array)
731
+ return null;
732
+ return array[0];
733
+ };
734
+ ListWrapper.last = function (array) {
735
+ if (!array || array.length == 0)
736
+ return null;
737
+ return array[array.length - 1];
738
+ };
739
+ ListWrapper.indexOf = function (array, value, startIndex) {
740
+ if (startIndex === void 0) { startIndex = 0; }
741
+ return array.indexOf(value, startIndex);
742
+ };
743
+ ListWrapper.contains = function (list, el) { return list.indexOf(el) !== -1; };
744
+ ListWrapper.reversed = function (array) {
745
+ var a = ListWrapper.clone(array);
746
+ return a.reverse();
747
+ };
748
+ ListWrapper.concat = function (a, b) { return a.concat(b); };
749
+ ListWrapper.insert = function (list, index, value) { list.splice(index, 0, value); };
750
+ ListWrapper.removeAt = function (list, index) {
751
+ var res = list[index];
752
+ list.splice(index, 1);
753
+ return res;
754
+ };
755
+ ListWrapper.removeAll = function (list, items) {
756
+ for (var i = 0; i < items.length; ++i) {
757
+ var index = list.indexOf(items[i]);
758
+ list.splice(index, 1);
759
+ }
760
+ };
761
+ ListWrapper.remove = function (list, el) {
762
+ var index = list.indexOf(el);
763
+ if (index > -1) {
764
+ list.splice(index, 1);
765
+ return true;
766
+ }
767
+ return false;
768
+ };
769
+ ListWrapper.clear = function (list) { list.length = 0; };
770
+ ListWrapper.isEmpty = function (list) { return list.length == 0; };
771
+ ListWrapper.fill = function (list, value, start, end) {
772
+ if (start === void 0) { start = 0; }
773
+ if (end === void 0) { end = null; }
774
+ list.fill(value, start, end === null ? list.length : end);
775
+ };
776
+ ListWrapper.equals = function (a, b) {
777
+ if (a.length != b.length)
778
+ return false;
779
+ for (var i = 0; i < a.length; ++i) {
780
+ if (a[i] !== b[i])
781
+ return false;
782
+ }
783
+ return true;
784
+ };
785
+ ListWrapper.slice = function (l, from, to) {
786
+ if (from === void 0) { from = 0; }
787
+ if (to === void 0) { to = null; }
788
+ return l.slice(from, to === null ? undefined : to);
789
+ };
790
+ ListWrapper.splice = function (l, from, length) { return l.splice(from, length); };
791
+ ListWrapper.sort = function (l, compareFn) {
792
+ if (isPresent(compareFn)) {
793
+ l.sort(compareFn);
794
+ }
795
+ else {
796
+ l.sort();
797
+ }
798
+ };
799
+ ListWrapper.toString = function (l) { return l.toString(); };
800
+ ListWrapper.toJSON = function (l) { return JSON.stringify(l); };
801
+ ListWrapper.maximum = function (list, predicate) {
802
+ if (list.length == 0) {
803
+ return null;
804
+ }
805
+ var solution = null;
806
+ var maxValue = -Infinity;
807
+ for (var index = 0; index < list.length; index++) {
808
+ var candidate = list[index];
809
+ if (isBlank(candidate)) {
810
+ continue;
811
+ }
812
+ var candidateValue = predicate(candidate);
813
+ if (candidateValue > maxValue) {
814
+ solution = candidate;
815
+ maxValue = candidateValue;
816
+ }
817
+ }
818
+ return solution;
819
+ };
820
+ ListWrapper.flatten = function (list) {
821
+ var target = [];
822
+ _flattenArray(list, target);
823
+ return target;
824
+ };
825
+ ListWrapper.addAll = function (list, source) {
826
+ for (var i = 0; i < source.length; i++) {
827
+ list.push(source[i]);
828
+ }
829
+ };
830
+ return ListWrapper;
831
+ }());
832
+ function _flattenArray(source, target) {
833
+ if (isPresent(source)) {
834
+ for (var i = 0; i < source.length; i++) {
835
+ var item = source[i];
836
+ if (isArray(item)) {
837
+ _flattenArray(item, target);
838
+ }
839
+ else {
840
+ target.push(item);
841
+ }
842
+ }
843
+ }
844
+ return target;
845
+ }
846
+ // Safari and Internet Explorer do not support the iterable parameter to the
847
+ // Set constructor. We work around that by manually adding the items.
848
+ var createSetFromList = (function () {
849
+ var test = new Set$1([1, 2, 3]);
850
+ if (test.size === 3) {
851
+ return function createSetFromList(lst) { return new Set$1(lst); };
852
+ }
853
+ else {
854
+ return function createSetAndPopulateFromList(lst) {
855
+ var res = new Set$1(lst);
856
+ if (res.size !== lst.length) {
857
+ for (var i = 0; i < lst.length; i++) {
858
+ res.add(lst[i]);
859
+ }
860
+ }
861
+ return res;
862
+ };
863
+ }
864
+ })();
865
+ var SetWrapper = (function () {
866
+ function SetWrapper() {
867
+ }
868
+ SetWrapper.createFromList = function (lst) { return createSetFromList(lst); };
869
+ SetWrapper.has = function (s, key) { return s.has(key); };
870
+ SetWrapper.delete = function (m, k) { m.delete(k); };
871
+ return SetWrapper;
872
+ }());
873
+ /**
874
+ * @stable
875
+ */
876
+ var BaseException$1 = (function (_super) {
877
+ __extends(BaseException$1, _super);
878
+ function BaseException$1(message) {
879
+ if (message === void 0) { message = '--'; }
880
+ _super.call(this, message);
881
+ this.message = message;
882
+ this.stack = (new Error(message)).stack;
883
+ }
884
+ BaseException$1.prototype.toString = function () { return this.message; };
885
+ return BaseException$1;
886
+ }(Error));
887
+ /**
888
+ * A DI Token representing the main rendering context. In a browser this is the DOM Document.
889
+ *
890
+ * Note: Document might not be available in the Application Context when Application and Rendering
891
+ * Contexts are not the same (e.g. when running the application into a Web Worker).
892
+ */
893
+ var DOCUMENT = new _angular_core.OpaqueToken('DocumentToken');
894
+ var SharedStylesHost = (function () {
895
+ function SharedStylesHost() {
896
+ /** @internal */
897
+ this._styles = [];
898
+ /** @internal */
899
+ this._stylesSet = new Set();
900
+ }
901
+ SharedStylesHost.prototype.addStyles = function (styles) {
902
+ var _this = this;
903
+ var additions = [];
904
+ styles.forEach(function (style) {
905
+ if (!SetWrapper.has(_this._stylesSet, style)) {
906
+ _this._stylesSet.add(style);
907
+ _this._styles.push(style);
908
+ additions.push(style);
909
+ }
910
+ });
911
+ this.onStylesAdded(additions);
912
+ };
913
+ SharedStylesHost.prototype.onStylesAdded = function (additions) { };
914
+ SharedStylesHost.prototype.getAllStyles = function () { return this._styles; };
915
+ return SharedStylesHost;
916
+ }());
917
+ /** @nocollapse */
918
+ SharedStylesHost.decorators = [
919
+ { type: _angular_core.Injectable },
920
+ ];
921
+ /** @nocollapse */
922
+ SharedStylesHost.ctorParameters = [];
923
+ var DomSharedStylesHost = (function (_super) {
924
+ __extends(DomSharedStylesHost, _super);
925
+ function DomSharedStylesHost(doc) {
926
+ _super.call(this);
927
+ this._hostNodes = new Set();
928
+ this._hostNodes.add(doc.head);
929
+ }
930
+ /** @internal */
931
+ DomSharedStylesHost.prototype._addStylesToHost = function (styles, host) {
932
+ for (var i = 0; i < styles.length; i++) {
933
+ var style = styles[i];
934
+ getDOM().appendChild(host, getDOM().createStyleElement(style));
935
+ }
936
+ };
937
+ DomSharedStylesHost.prototype.addHost = function (hostNode) {
938
+ this._addStylesToHost(this._styles, hostNode);
939
+ this._hostNodes.add(hostNode);
940
+ };
941
+ DomSharedStylesHost.prototype.removeHost = function (hostNode) { SetWrapper.delete(this._hostNodes, hostNode); };
942
+ DomSharedStylesHost.prototype.onStylesAdded = function (additions) {
943
+ var _this = this;
944
+ this._hostNodes.forEach(function (hostNode) { _this._addStylesToHost(additions, hostNode); });
945
+ };
946
+ return DomSharedStylesHost;
947
+ }(SharedStylesHost));
948
+ /** @nocollapse */
949
+ DomSharedStylesHost.decorators = [
950
+ { type: _angular_core.Injectable },
951
+ ];
952
+ /** @nocollapse */
953
+ DomSharedStylesHost.ctorParameters = [
954
+ { type: undefined, decorators: [{ type: _angular_core.Inject, args: [DOCUMENT,] },] },
955
+ ];
956
+ var EVENT_MANAGER_PLUGINS = new _angular_core.OpaqueToken('EventManagerPlugins');
957
+ var EventManager = (function () {
958
+ function EventManager(plugins, _zone) {
959
+ var _this = this;
960
+ this._zone = _zone;
961
+ plugins.forEach(function (p) { return p.manager = _this; });
962
+ this._plugins = ListWrapper.reversed(plugins);
963
+ }
964
+ EventManager.prototype.addEventListener = function (element, eventName, handler) {
965
+ var plugin = this._findPluginFor(eventName);
966
+ return plugin.addEventListener(element, eventName, handler);
967
+ };
968
+ EventManager.prototype.addGlobalEventListener = function (target, eventName, handler) {
969
+ var plugin = this._findPluginFor(eventName);
970
+ return plugin.addGlobalEventListener(target, eventName, handler);
971
+ };
972
+ EventManager.prototype.getZone = function () { return this._zone; };
973
+ /** @internal */
974
+ EventManager.prototype._findPluginFor = function (eventName) {
975
+ var plugins = this._plugins;
976
+ for (var i = 0; i < plugins.length; i++) {
977
+ var plugin = plugins[i];
978
+ if (plugin.supports(eventName)) {
979
+ return plugin;
980
+ }
981
+ }
982
+ throw new BaseException$1("No event manager plugin found for event " + eventName);
983
+ };
984
+ return EventManager;
985
+ }());
986
+ /** @nocollapse */
987
+ EventManager.decorators = [
988
+ { type: _angular_core.Injectable },
989
+ ];
990
+ /** @nocollapse */
991
+ EventManager.ctorParameters = [
992
+ { type: Array, decorators: [{ type: _angular_core.Inject, args: [EVENT_MANAGER_PLUGINS,] },] },
993
+ { type: _angular_core.NgZone, },
994
+ ];
995
+ var EventManagerPlugin = (function () {
996
+ function EventManagerPlugin() {
997
+ }
998
+ // That is equivalent to having supporting $event.target
999
+ EventManagerPlugin.prototype.supports = function (eventName) { return false; };
1000
+ EventManagerPlugin.prototype.addEventListener = function (element, eventName, handler) {
1001
+ throw 'not implemented';
1002
+ };
1003
+ EventManagerPlugin.prototype.addGlobalEventListener = function (element, eventName, handler) {
1004
+ throw 'not implemented';
1005
+ };
1006
+ return EventManagerPlugin;
1007
+ }());
1008
+ var CAMEL_CASE_REGEXP = /([A-Z])/g;
1009
+ var DASH_CASE_REGEXP = /-([a-z])/g;
1010
+ function camelCaseToDashCase(input) {
1011
+ return StringWrapper.replaceAllMapped(input, CAMEL_CASE_REGEXP, function (m /** TODO #9100 */) { return '-' + m[1].toLowerCase(); });
1012
+ }
1013
+ function dashCaseToCamelCase(input) {
1014
+ return StringWrapper.replaceAllMapped(input, DASH_CASE_REGEXP, function (m /** TODO #9100 */) { return m[1].toUpperCase(); });
1015
+ }
1016
+ var NAMESPACE_URIS = {
1017
+ 'xlink': 'http://www.w3.org/1999/xlink',
1018
+ 'svg': 'http://www.w3.org/2000/svg'
1019
+ };
1020
+ var TEMPLATE_COMMENT_TEXT = 'template bindings={}';
1021
+ var TEMPLATE_BINDINGS_EXP = /^template bindings=(.*)$/g;
1022
+ var DomRootRenderer = (function () {
1023
+ function DomRootRenderer(document, eventManager, sharedStylesHost, animationDriver) {
1024
+ this.document = document;
1025
+ this.eventManager = eventManager;
1026
+ this.sharedStylesHost = sharedStylesHost;
1027
+ this.animationDriver = animationDriver;
1028
+ this.registeredComponents = new Map();
1029
+ }
1030
+ DomRootRenderer.prototype.renderComponent = function (componentProto) {
1031
+ var renderer = this.registeredComponents.get(componentProto.id);
1032
+ if (isBlank(renderer)) {
1033
+ renderer = new DomRenderer(this, componentProto, this.animationDriver);
1034
+ this.registeredComponents.set(componentProto.id, renderer);
1035
+ }
1036
+ return renderer;
1037
+ };
1038
+ return DomRootRenderer;
1039
+ }());
1040
+ var DomRootRenderer_ = (function (_super) {
1041
+ __extends(DomRootRenderer_, _super);
1042
+ function DomRootRenderer_(_document, _eventManager, sharedStylesHost, animationDriver) {
1043
+ _super.call(this, _document, _eventManager, sharedStylesHost, animationDriver);
1044
+ }
1045
+ return DomRootRenderer_;
1046
+ }(DomRootRenderer));
1047
+ /** @nocollapse */
1048
+ DomRootRenderer_.decorators = [
1049
+ { type: _angular_core.Injectable },
1050
+ ];
1051
+ /** @nocollapse */
1052
+ DomRootRenderer_.ctorParameters = [
1053
+ { type: undefined, decorators: [{ type: _angular_core.Inject, args: [DOCUMENT,] },] },
1054
+ { type: EventManager, },
1055
+ { type: DomSharedStylesHost, },
1056
+ { type: AnimationDriver, },
1057
+ ];
1058
+ var DomRenderer = (function () {
1059
+ function DomRenderer(_rootRenderer, componentProto, _animationDriver) {
1060
+ this._rootRenderer = _rootRenderer;
1061
+ this.componentProto = componentProto;
1062
+ this._animationDriver = _animationDriver;
1063
+ this._styles = _flattenStyles(componentProto.id, componentProto.styles, []);
1064
+ if (componentProto.encapsulation !== _angular_core.ViewEncapsulation.Native) {
1065
+ this._rootRenderer.sharedStylesHost.addStyles(this._styles);
1066
+ }
1067
+ if (this.componentProto.encapsulation === _angular_core.ViewEncapsulation.Emulated) {
1068
+ this._contentAttr = _shimContentAttribute(componentProto.id);
1069
+ this._hostAttr = _shimHostAttribute(componentProto.id);
1070
+ }
1071
+ else {
1072
+ this._contentAttr = null;
1073
+ this._hostAttr = null;
1074
+ }
1075
+ }
1076
+ DomRenderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) {
1077
+ var el;
1078
+ if (isString(selectorOrNode)) {
1079
+ el = getDOM().querySelector(this._rootRenderer.document, selectorOrNode);
1080
+ if (isBlank(el)) {
1081
+ throw new BaseException$1("The selector \"" + selectorOrNode + "\" did not match any elements");
1082
+ }
1083
+ }
1084
+ else {
1085
+ el = selectorOrNode;
1086
+ }
1087
+ getDOM().clearNodes(el);
1088
+ return el;
1089
+ };
1090
+ DomRenderer.prototype.createElement = function (parent, name, debugInfo) {
1091
+ var nsAndName = splitNamespace(name);
1092
+ var el = isPresent(nsAndName[0]) ?
1093
+ getDOM().createElementNS(NAMESPACE_URIS[nsAndName[0]], nsAndName[1]) :
1094
+ getDOM().createElement(nsAndName[1]);
1095
+ if (isPresent(this._contentAttr)) {
1096
+ getDOM().setAttribute(el, this._contentAttr, '');
1097
+ }
1098
+ if (isPresent(parent)) {
1099
+ getDOM().appendChild(parent, el);
1100
+ }
1101
+ return el;
1102
+ };
1103
+ DomRenderer.prototype.createViewRoot = function (hostElement) {
1104
+ var nodesParent;
1105
+ if (this.componentProto.encapsulation === _angular_core.ViewEncapsulation.Native) {
1106
+ nodesParent = getDOM().createShadowRoot(hostElement);
1107
+ this._rootRenderer.sharedStylesHost.addHost(nodesParent);
1108
+ for (var i = 0; i < this._styles.length; i++) {
1109
+ getDOM().appendChild(nodesParent, getDOM().createStyleElement(this._styles[i]));
1110
+ }
1111
+ }
1112
+ else {
1113
+ if (isPresent(this._hostAttr)) {
1114
+ getDOM().setAttribute(hostElement, this._hostAttr, '');
1115
+ }
1116
+ nodesParent = hostElement;
1117
+ }
1118
+ return nodesParent;
1119
+ };
1120
+ DomRenderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) {
1121
+ var comment = getDOM().createComment(TEMPLATE_COMMENT_TEXT);
1122
+ if (isPresent(parentElement)) {
1123
+ getDOM().appendChild(parentElement, comment);
1124
+ }
1125
+ return comment;
1126
+ };
1127
+ DomRenderer.prototype.createText = function (parentElement, value, debugInfo) {
1128
+ var node = getDOM().createTextNode(value);
1129
+ if (isPresent(parentElement)) {
1130
+ getDOM().appendChild(parentElement, node);
1131
+ }
1132
+ return node;
1133
+ };
1134
+ DomRenderer.prototype.projectNodes = function (parentElement, nodes) {
1135
+ if (isBlank(parentElement))
1136
+ return;
1137
+ appendNodes(parentElement, nodes);
1138
+ };
1139
+ DomRenderer.prototype.attachViewAfter = function (node, viewRootNodes) { moveNodesAfterSibling(node, viewRootNodes); };
1140
+ DomRenderer.prototype.detachView = function (viewRootNodes) {
1141
+ for (var i = 0; i < viewRootNodes.length; i++) {
1142
+ getDOM().remove(viewRootNodes[i]);
1143
+ }
1144
+ };
1145
+ DomRenderer.prototype.destroyView = function (hostElement, viewAllNodes) {
1146
+ if (this.componentProto.encapsulation === _angular_core.ViewEncapsulation.Native && isPresent(hostElement)) {
1147
+ this._rootRenderer.sharedStylesHost.removeHost(getDOM().getShadowRoot(hostElement));
1148
+ }
1149
+ };
1150
+ DomRenderer.prototype.listen = function (renderElement, name, callback) {
1151
+ return this._rootRenderer.eventManager.addEventListener(renderElement, name, decoratePreventDefault(callback));
1152
+ };
1153
+ DomRenderer.prototype.listenGlobal = function (target, name, callback) {
1154
+ return this._rootRenderer.eventManager.addGlobalEventListener(target, name, decoratePreventDefault(callback));
1155
+ };
1156
+ DomRenderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) {
1157
+ getDOM().setProperty(renderElement, propertyName, propertyValue);
1158
+ };
1159
+ DomRenderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) {
1160
+ var attrNs;
1161
+ var nsAndName = splitNamespace(attributeName);
1162
+ if (isPresent(nsAndName[0])) {
1163
+ attributeName = nsAndName[0] + ':' + nsAndName[1];
1164
+ attrNs = NAMESPACE_URIS[nsAndName[0]];
1165
+ }
1166
+ if (isPresent(attributeValue)) {
1167
+ if (isPresent(attrNs)) {
1168
+ getDOM().setAttributeNS(renderElement, attrNs, attributeName, attributeValue);
1169
+ }
1170
+ else {
1171
+ getDOM().setAttribute(renderElement, attributeName, attributeValue);
1172
+ }
1173
+ }
1174
+ else {
1175
+ if (isPresent(attrNs)) {
1176
+ getDOM().removeAttributeNS(renderElement, attrNs, nsAndName[1]);
1177
+ }
1178
+ else {
1179
+ getDOM().removeAttribute(renderElement, attributeName);
1180
+ }
1181
+ }
1182
+ };
1183
+ DomRenderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) {
1184
+ var dashCasedPropertyName = camelCaseToDashCase(propertyName);
1185
+ if (getDOM().isCommentNode(renderElement)) {
1186
+ var existingBindings = RegExpWrapper.firstMatch(TEMPLATE_BINDINGS_EXP, StringWrapper.replaceAll(getDOM().getText(renderElement), /\n/g, ''));
1187
+ var parsedBindings = Json.parse(existingBindings[1]);
1188
+ parsedBindings[dashCasedPropertyName] = propertyValue;
1189
+ getDOM().setText(renderElement, StringWrapper.replace(TEMPLATE_COMMENT_TEXT, '{}', Json.stringify(parsedBindings)));
1190
+ }
1191
+ else {
1192
+ this.setElementAttribute(renderElement, propertyName, propertyValue);
1193
+ }
1194
+ };
1195
+ DomRenderer.prototype.setElementClass = function (renderElement, className, isAdd) {
1196
+ if (isAdd) {
1197
+ getDOM().addClass(renderElement, className);
1198
+ }
1199
+ else {
1200
+ getDOM().removeClass(renderElement, className);
1201
+ }
1202
+ };
1203
+ DomRenderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) {
1204
+ if (isPresent(styleValue)) {
1205
+ getDOM().setStyle(renderElement, styleName, stringify(styleValue));
1206
+ }
1207
+ else {
1208
+ getDOM().removeStyle(renderElement, styleName);
1209
+ }
1210
+ };
1211
+ DomRenderer.prototype.invokeElementMethod = function (renderElement, methodName, args) {
1212
+ getDOM().invoke(renderElement, methodName, args);
1213
+ };
1214
+ DomRenderer.prototype.setText = function (renderNode, text) { getDOM().setText(renderNode, text); };
1215
+ DomRenderer.prototype.animate = function (element, startingStyles, keyframes, duration, delay, easing) {
1216
+ return this._animationDriver.animate(element, startingStyles, keyframes, duration, delay, easing);
1217
+ };
1218
+ return DomRenderer;
1219
+ }());
1220
+ function moveNodesAfterSibling(sibling /** TODO #9100 */, nodes /** TODO #9100 */) {
1221
+ var parent = getDOM().parentElement(sibling);
1222
+ if (nodes.length > 0 && isPresent(parent)) {
1223
+ var nextSibling = getDOM().nextSibling(sibling);
1224
+ if (isPresent(nextSibling)) {
1225
+ for (var i = 0; i < nodes.length; i++) {
1226
+ getDOM().insertBefore(nextSibling, nodes[i]);
1227
+ }
1228
+ }
1229
+ else {
1230
+ for (var i = 0; i < nodes.length; i++) {
1231
+ getDOM().appendChild(parent, nodes[i]);
1232
+ }
1233
+ }
1234
+ }
1235
+ }
1236
+ function appendNodes(parent /** TODO #9100 */, nodes /** TODO #9100 */) {
1237
+ for (var i = 0; i < nodes.length; i++) {
1238
+ getDOM().appendChild(parent, nodes[i]);
1239
+ }
1240
+ }
1241
+ function decoratePreventDefault(eventHandler) {
1242
+ return function (event /** TODO #9100 */) {
1243
+ var allowDefaultBehavior = eventHandler(event);
1244
+ if (allowDefaultBehavior === false) {
1245
+ // TODO(tbosch): move preventDefault into event plugins...
1246
+ getDOM().preventDefault(event);
1247
+ }
1248
+ };
1249
+ }
1250
+ var COMPONENT_REGEX = /%COMP%/g;
1251
+ var COMPONENT_VARIABLE = '%COMP%';
1252
+ var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
1253
+ var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
1254
+ function _shimContentAttribute(componentShortId) {
1255
+ return StringWrapper.replaceAll(CONTENT_ATTR, COMPONENT_REGEX, componentShortId);
1256
+ }
1257
+ function _shimHostAttribute(componentShortId) {
1258
+ return StringWrapper.replaceAll(HOST_ATTR, COMPONENT_REGEX, componentShortId);
1259
+ }
1260
+ function _flattenStyles(compId, styles, target) {
1261
+ for (var i = 0; i < styles.length; i++) {
1262
+ var style = styles[i];
1263
+ if (isArray(style)) {
1264
+ _flattenStyles(compId, style, target);
1265
+ }
1266
+ else {
1267
+ style = StringWrapper.replaceAll(style, COMPONENT_REGEX, compId);
1268
+ target.push(style);
1269
+ }
1270
+ }
1271
+ return target;
1272
+ }
1273
+ var NS_PREFIX_RE = /^:([^:]+):(.+)/g;
1274
+ function splitNamespace(name) {
1275
+ if (name[0] != ':') {
1276
+ return [null, name];
1277
+ }
1278
+ var match = RegExpWrapper.firstMatch(NS_PREFIX_RE, name);
1279
+ return [match[1], match[2]];
1280
+ }
1281
+ var CORE_TOKENS = {
1282
+ 'ApplicationRef': _angular_core.ApplicationRef,
1283
+ 'NgZone': _angular_core.NgZone
1284
+ };
1285
+ var INSPECT_GLOBAL_NAME = 'ng.probe';
1286
+ var CORE_TOKENS_GLOBAL_NAME = 'ng.coreTokens';
1287
+ /**
1288
+ * Returns a {@link DebugElement} for the given native DOM element, or
1289
+ * null if the given native element does not have an Angular view associated
1290
+ * with it.
1291
+ */
1292
+ function inspectNativeElement(element /** TODO #9100 */) {
1293
+ return _angular_core.getDebugNode(element);
1294
+ }
1295
+ function _createConditionalRootRenderer(rootRenderer /** TODO #9100 */) {
1296
+ if (assertionsEnabled()) {
1297
+ return _createRootRenderer(rootRenderer);
1298
+ }
1299
+ return rootRenderer;
1300
+ }
1301
+ function _createRootRenderer(rootRenderer /** TODO #9100 */) {
1302
+ getDOM().setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
1303
+ getDOM().setGlobalVar(CORE_TOKENS_GLOBAL_NAME, CORE_TOKENS);
1304
+ return new DebugDomRootRenderer(rootRenderer);
1305
+ }
1306
+ /**
1307
+ * Providers which support debugging Angular applications (e.g. via `ng.probe`).
1308
+ */
1309
+ var ELEMENT_PROBE_PROVIDERS = [{ provide: _angular_core.RootRenderer, useFactory: _createConditionalRootRenderer, deps: [DomRootRenderer] }];
1310
+ var DomEventsPlugin = (function (_super) {
1311
+ __extends(DomEventsPlugin, _super);
1312
+ function DomEventsPlugin() {
1313
+ _super.apply(this, arguments);
1314
+ }
1315
+ // This plugin should come last in the list of plugins, because it accepts all
1316
+ // events.
1317
+ DomEventsPlugin.prototype.supports = function (eventName) { return true; };
1318
+ DomEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
1319
+ var zone = this.manager.getZone();
1320
+ var outsideHandler = function (event /** TODO #9100 */) { return zone.runGuarded(function () { return handler(event); }); };
1321
+ return this.manager.getZone().runOutsideAngular(function () { return getDOM().onAndCancel(element, eventName, outsideHandler); });
1322
+ };
1323
+ DomEventsPlugin.prototype.addGlobalEventListener = function (target, eventName, handler) {
1324
+ var element = getDOM().getGlobalEventTarget(target);
1325
+ var zone = this.manager.getZone();
1326
+ var outsideHandler = function (event /** TODO #9100 */) { return zone.runGuarded(function () { return handler(event); }); };
1327
+ return this.manager.getZone().runOutsideAngular(function () { return getDOM().onAndCancel(element, eventName, outsideHandler); });
1328
+ };
1329
+ return DomEventsPlugin;
1330
+ }(EventManagerPlugin));
1331
+ /** @nocollapse */
1332
+ DomEventsPlugin.decorators = [
1333
+ { type: _angular_core.Injectable },
1334
+ ];
1335
+ var _eventNames = {
1336
+ // pan
1337
+ 'pan': true,
1338
+ 'panstart': true,
1339
+ 'panmove': true,
1340
+ 'panend': true,
1341
+ 'pancancel': true,
1342
+ 'panleft': true,
1343
+ 'panright': true,
1344
+ 'panup': true,
1345
+ 'pandown': true,
1346
+ // pinch
1347
+ 'pinch': true,
1348
+ 'pinchstart': true,
1349
+ 'pinchmove': true,
1350
+ 'pinchend': true,
1351
+ 'pinchcancel': true,
1352
+ 'pinchin': true,
1353
+ 'pinchout': true,
1354
+ // press
1355
+ 'press': true,
1356
+ 'pressup': true,
1357
+ // rotate
1358
+ 'rotate': true,
1359
+ 'rotatestart': true,
1360
+ 'rotatemove': true,
1361
+ 'rotateend': true,
1362
+ 'rotatecancel': true,
1363
+ // swipe
1364
+ 'swipe': true,
1365
+ 'swipeleft': true,
1366
+ 'swiperight': true,
1367
+ 'swipeup': true,
1368
+ 'swipedown': true,
1369
+ // tap
1370
+ 'tap': true,
1371
+ };
1372
+ var HammerGesturesPluginCommon = (function (_super) {
1373
+ __extends(HammerGesturesPluginCommon, _super);
1374
+ function HammerGesturesPluginCommon() {
1375
+ _super.call(this);
1376
+ }
1377
+ HammerGesturesPluginCommon.prototype.supports = function (eventName) {
1378
+ eventName = eventName.toLowerCase();
1379
+ return StringMapWrapper.contains(_eventNames, eventName);
1380
+ };
1381
+ return HammerGesturesPluginCommon;
1382
+ }(EventManagerPlugin));
1383
+ var HAMMER_GESTURE_CONFIG = new _angular_core.OpaqueToken('HammerGestureConfig');
1384
+ var HammerGestureConfig = (function () {
1385
+ function HammerGestureConfig() {
1386
+ this.events = [];
1387
+ this.overrides = {};
1388
+ }
1389
+ HammerGestureConfig.prototype.buildHammer = function (element) {
1390
+ var mc = new Hammer(element);
1391
+ mc.get('pinch').set({ enable: true });
1392
+ mc.get('rotate').set({ enable: true });
1393
+ for (var eventName in this.overrides) {
1394
+ mc.get(eventName).set(this.overrides[eventName]);
1395
+ }
1396
+ return mc;
1397
+ };
1398
+ return HammerGestureConfig;
1399
+ }());
1400
+ /** @nocollapse */
1401
+ HammerGestureConfig.decorators = [
1402
+ { type: _angular_core.Injectable },
1403
+ ];
1404
+ var HammerGesturesPlugin = (function (_super) {
1405
+ __extends(HammerGesturesPlugin, _super);
1406
+ function HammerGesturesPlugin(_config) {
1407
+ _super.call(this);
1408
+ this._config = _config;
1409
+ }
1410
+ HammerGesturesPlugin.prototype.supports = function (eventName) {
1411
+ if (!_super.prototype.supports.call(this, eventName) && !this.isCustomEvent(eventName))
1412
+ return false;
1413
+ if (!isPresent(window['Hammer'])) {
1414
+ throw new BaseException$1("Hammer.js is not loaded, can not bind " + eventName + " event");
1415
+ }
1416
+ return true;
1417
+ };
1418
+ HammerGesturesPlugin.prototype.addEventListener = function (element, eventName, handler) {
1419
+ var _this = this;
1420
+ var zone = this.manager.getZone();
1421
+ eventName = eventName.toLowerCase();
1422
+ return zone.runOutsideAngular(function () {
1423
+ // Creating the manager bind events, must be done outside of angular
1424
+ var mc = _this._config.buildHammer(element);
1425
+ var callback = function (eventObj /** TODO #???? */) {
1426
+ zone.runGuarded(function () { handler(eventObj); });
1427
+ };
1428
+ mc.on(eventName, callback);
1429
+ return function () { mc.off(eventName, callback); };
1430
+ });
1431
+ };
1432
+ HammerGesturesPlugin.prototype.isCustomEvent = function (eventName) { return this._config.events.indexOf(eventName) > -1; };
1433
+ return HammerGesturesPlugin;
1434
+ }(HammerGesturesPluginCommon));
1435
+ /** @nocollapse */
1436
+ HammerGesturesPlugin.decorators = [
1437
+ { type: _angular_core.Injectable },
1438
+ ];
1439
+ /** @nocollapse */
1440
+ HammerGesturesPlugin.ctorParameters = [
1441
+ { type: HammerGestureConfig, decorators: [{ type: _angular_core.Inject, args: [HAMMER_GESTURE_CONFIG,] },] },
1442
+ ];
1443
+ var modifierKeys = ['alt', 'control', 'meta', 'shift'];
1444
+ var modifierKeyGetters = {
1445
+ 'alt': function (event) { return event.altKey; },
1446
+ 'control': function (event) { return event.ctrlKey; },
1447
+ 'meta': function (event) { return event.metaKey; },
1448
+ 'shift': function (event) { return event.shiftKey; }
1449
+ };
1450
+ var KeyEventsPlugin = (function (_super) {
1451
+ __extends(KeyEventsPlugin, _super);
1452
+ function KeyEventsPlugin() {
1453
+ _super.call(this);
1454
+ }
1455
+ KeyEventsPlugin.prototype.supports = function (eventName) {
1456
+ return isPresent(KeyEventsPlugin.parseEventName(eventName));
1457
+ };
1458
+ KeyEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
1459
+ var parsedEvent = KeyEventsPlugin.parseEventName(eventName);
1460
+ var outsideHandler = KeyEventsPlugin.eventCallback(element, StringMapWrapper.get(parsedEvent, 'fullKey'), handler, this.manager.getZone());
1461
+ return this.manager.getZone().runOutsideAngular(function () {
1462
+ return getDOM().onAndCancel(element, StringMapWrapper.get(parsedEvent, 'domEventName'), outsideHandler);
1463
+ });
1464
+ };
1465
+ KeyEventsPlugin.parseEventName = function (eventName) {
1466
+ var parts = eventName.toLowerCase().split('.');
1467
+ var domEventName = parts.shift();
1468
+ if ((parts.length === 0) ||
1469
+ !(StringWrapper.equals(domEventName, 'keydown') ||
1470
+ StringWrapper.equals(domEventName, 'keyup'))) {
1471
+ return null;
1472
+ }
1473
+ var key = KeyEventsPlugin._normalizeKey(parts.pop());
1474
+ var fullKey = '';
1475
+ modifierKeys.forEach(function (modifierName) {
1476
+ if (ListWrapper.contains(parts, modifierName)) {
1477
+ ListWrapper.remove(parts, modifierName);
1478
+ fullKey += modifierName + '.';
1479
+ }
1480
+ });
1481
+ fullKey += key;
1482
+ if (parts.length != 0 || key.length === 0) {
1483
+ // returning null instead of throwing to let another plugin process the event
1484
+ return null;
1485
+ }
1486
+ var result = StringMapWrapper.create();
1487
+ StringMapWrapper.set(result, 'domEventName', domEventName);
1488
+ StringMapWrapper.set(result, 'fullKey', fullKey);
1489
+ return result;
1490
+ };
1491
+ KeyEventsPlugin.getEventFullKey = function (event) {
1492
+ var fullKey = '';
1493
+ var key = getDOM().getEventKey(event);
1494
+ key = key.toLowerCase();
1495
+ if (StringWrapper.equals(key, ' ')) {
1496
+ key = 'space'; // for readability
1497
+ }
1498
+ else if (StringWrapper.equals(key, '.')) {
1499
+ key = 'dot'; // because '.' is used as a separator in event names
1500
+ }
1501
+ modifierKeys.forEach(function (modifierName) {
1502
+ if (modifierName != key) {
1503
+ var modifierGetter = StringMapWrapper.get(modifierKeyGetters, modifierName);
1504
+ if (modifierGetter(event)) {
1505
+ fullKey += modifierName + '.';
1506
+ }
1507
+ }
1508
+ });
1509
+ fullKey += key;
1510
+ return fullKey;
1511
+ };
1512
+ KeyEventsPlugin.eventCallback = function (element, fullKey, handler, zone) {
1513
+ return function (event /** TODO #9100 */) {
1514
+ if (StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) {
1515
+ zone.runGuarded(function () { return handler(event); });
1516
+ }
1517
+ };
1518
+ };
1519
+ /** @internal */
1520
+ KeyEventsPlugin._normalizeKey = function (keyName) {
1521
+ // TODO: switch to a StringMap if the mapping grows too much
1522
+ switch (keyName) {
1523
+ case 'esc':
1524
+ return 'escape';
1525
+ default:
1526
+ return keyName;
1527
+ }
1528
+ };
1529
+ return KeyEventsPlugin;
1530
+ }(EventManagerPlugin));
1531
+ /** @nocollapse */
1532
+ KeyEventsPlugin.decorators = [
1533
+ { type: _angular_core.Injectable },
1534
+ ];
1535
+ /** @nocollapse */
1536
+ KeyEventsPlugin.ctorParameters = [];
1537
+ /**
1538
+ * A pattern that recognizes a commonly useful subset of URLs that are safe.
1539
+ *
1540
+ * This regular expression matches a subset of URLs that will not cause script
1541
+ * execution if used in URL context within a HTML document. Specifically, this
1542
+ * regular expression matches if (comment from here on and regex copied from
1543
+ * Soy's EscapingConventions):
1544
+ * (1) Either a protocol in a whitelist (http, https, mailto or ftp).
1545
+ * (2) or no protocol. A protocol must be followed by a colon. The below
1546
+ * allows that by allowing colons only after one of the characters [/?#].
1547
+ * A colon after a hash (#) must be in the fragment.
1548
+ * Otherwise, a colon after a (?) must be in a query.
1549
+ * Otherwise, a colon after a single solidus (/) must be in a path.
1550
+ * Otherwise, a colon after a double solidus (//) must be in the authority
1551
+ * (before port).
1552
+ *
1553
+ * The pattern disallows &, used in HTML entity declarations before
1554
+ * one of the characters in [/?#]. This disallows HTML entities used in the
1555
+ * protocol name, which should never happen, e.g. "h&#116;tp" for "http".
1556
+ * It also disallows HTML entities in the first path part of a relative path,
1557
+ * e.g. "foo&lt;bar/baz". Our existing escaping functions should not produce
1558
+ * that. More importantly, it disallows masking of a colon,
1559
+ * e.g. "javascript&#58;...".
1560
+ *
1561
+ * This regular expression was taken from the Closure sanitization library.
1562
+ */
1563
+ var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
1564
+ /** A pattern that matches safe data URLs. Only matches image and video types. */
1565
+ var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm));base64,[a-z0-9+\/]+=*$/i;
1566
+ function sanitizeUrl(url) {
1567
+ url = String(url);
1568
+ if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN))
1569
+ return url;
1570
+ if (assertionsEnabled())
1571
+ getDOM().log('WARNING: sanitizing unsafe URL value ' + url);
1572
+ return 'unsafe:' + url;
1573
+ }
1574
+ /** A <body> element that can be safely used to parse untrusted HTML. Lazily initialized below. */
1575
+ var inertElement = null;
1576
+ /** Lazily initialized to make sure the DOM adapter gets set before use. */
1577
+ var DOM = null;
1578
+ /** Returns an HTML element that is guaranteed to not execute code when creating elements in it. */
1579
+ function getInertElement() {
1580
+ if (inertElement)
1581
+ return inertElement;
1582
+ DOM = getDOM();
1583
+ // Prefer using <template> element if supported.
1584
+ var templateEl = DOM.createElement('template');
1585
+ if ('content' in templateEl)
1586
+ return templateEl;
1587
+ var doc = DOM.createHtmlDocument();
1588
+ inertElement = DOM.querySelector(doc, 'body');
1589
+ if (inertElement == null) {
1590
+ // usually there should be only one body element in the document, but IE doesn't have any, so we
1591
+ // need to create one.
1592
+ var html = DOM.createElement('html', doc);
1593
+ inertElement = DOM.createElement('body', doc);
1594
+ DOM.appendChild(html, inertElement);
1595
+ DOM.appendChild(doc, html);
1596
+ }
1597
+ return inertElement;
1598
+ }
1599
+ function tagSet(tags) {
1600
+ var res = {};
1601
+ for (var _i = 0, _a = tags.split(','); _i < _a.length; _i++) {
1602
+ var t = _a[_i];
1603
+ res[t.toLowerCase()] = true;
1604
+ }
1605
+ return res;
1606
+ }
1607
+ function merge() {
1608
+ var sets = [];
1609
+ for (var _i = 0; _i < arguments.length; _i++) {
1610
+ sets[_i - 0] = arguments[_i];
1611
+ }
1612
+ var res = {};
1613
+ for (var _a = 0, sets_1 = sets; _a < sets_1.length; _a++) {
1614
+ var s = sets_1[_a];
1615
+ for (var v in s) {
1616
+ if (s.hasOwnProperty(v))
1617
+ res[v] = true;
1618
+ }
1619
+ }
1620
+ return res;
1621
+ }
1622
+ // Good source of info about elements and attributes
1623
+ // http://dev.w3.org/html5/spec/Overview.html#semantics
1624
+ // http://simon.html5.org/html-elements
1625
+ // Safe Void Elements - HTML5
1626
+ // http://dev.w3.org/html5/spec/Overview.html#void-elements
1627
+ var VOID_ELEMENTS = tagSet('area,br,col,hr,img,wbr');
1628
+ // Elements that you can, intentionally, leave open (and which close themselves)
1629
+ // http://dev.w3.org/html5/spec/Overview.html#optional-tags
1630
+ var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr');
1631
+ var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet('rp,rt');
1632
+ var OPTIONAL_END_TAG_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS);
1633
+ // Safe Block Elements - HTML5
1634
+ var BLOCK_ELEMENTS = merge(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet('address,article,' +
1635
+ 'aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
1636
+ 'h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul'));
1637
+ // Inline Elements - HTML5
1638
+ var INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,acronym,b,' +
1639
+ 'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,' +
1640
+ 'samp,small,span,strike,strong,sub,sup,time,tt,u,var'));
1641
+ var VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS);
1642
+ // Attributes that have href and hence need to be sanitized
1643
+ var URI_ATTRS = tagSet('background,cite,href,longdesc,src,xlink:href');
1644
+ var HTML_ATTRS = tagSet('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +
1645
+ 'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +
1646
+ 'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +
1647
+ 'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +
1648
+ 'valign,value,vspace,width');
1649
+ // NB: This currently conciously doesn't support SVG. SVG sanitization has had several security
1650
+ // issues in the past, so it seems safer to leave it out if possible. If support for binding SVG via
1651
+ // innerHTML is required, SVG attributes should be added here.
1652
+ // NB: Sanitization does not allow <form> elements or other active elements (<button> etc). Those
1653
+ // can be sanitized, but they increase security surface area without a legitimate use case, so they
1654
+ // are left out here.
1655
+ var VALID_ATTRS = merge(URI_ATTRS, HTML_ATTRS);
1656
+ /**
1657
+ * SanitizingHtmlSerializer serializes a DOM fragment, stripping out any unsafe elements and unsafe
1658
+ * attributes.
1659
+ */
1660
+ var SanitizingHtmlSerializer = (function () {
1661
+ function SanitizingHtmlSerializer() {
1662
+ this.buf = [];
1663
+ }
1664
+ SanitizingHtmlSerializer.prototype.sanitizeChildren = function (el) {
1665
+ // This cannot use a TreeWalker, as it has to run on Angular's various DOM adapters.
1666
+ // However this code never accesses properties off of `document` before deleting its contents
1667
+ // again, so it shouldn't be vulnerable to DOM clobbering.
1668
+ var current = el.firstChild;
1669
+ while (current) {
1670
+ if (DOM.isElementNode(current)) {
1671
+ this.startElement(current);
1672
+ }
1673
+ else if (DOM.isTextNode(current)) {
1674
+ this.chars(DOM.nodeValue(current));
1675
+ }
1676
+ if (DOM.firstChild(current)) {
1677
+ current = DOM.firstChild(current);
1678
+ continue;
1679
+ }
1680
+ while (current) {
1681
+ // Leaving the element. Walk up and to the right, closing tags as we go.
1682
+ if (DOM.isElementNode(current)) {
1683
+ this.endElement(DOM.nodeName(current).toLowerCase());
1684
+ }
1685
+ if (DOM.nextSibling(current)) {
1686
+ current = DOM.nextSibling(current);
1687
+ break;
1688
+ }
1689
+ current = DOM.parentElement(current);
1690
+ }
1691
+ }
1692
+ return this.buf.join('');
1693
+ };
1694
+ SanitizingHtmlSerializer.prototype.startElement = function (element) {
1695
+ var _this = this;
1696
+ var tagName = DOM.nodeName(element).toLowerCase();
1697
+ tagName = tagName.toLowerCase();
1698
+ if (VALID_ELEMENTS.hasOwnProperty(tagName)) {
1699
+ this.buf.push('<');
1700
+ this.buf.push(tagName);
1701
+ DOM.attributeMap(element).forEach(function (value, attrName) {
1702
+ var lower = attrName.toLowerCase();
1703
+ if (!VALID_ATTRS.hasOwnProperty(lower))
1704
+ return;
1705
+ // TODO(martinprobst): Special case image URIs for data:image/...
1706
+ if (URI_ATTRS[lower])
1707
+ value = sanitizeUrl(value);
1708
+ _this.buf.push(' ');
1709
+ _this.buf.push(attrName);
1710
+ _this.buf.push('="');
1711
+ _this.buf.push(encodeEntities(value));
1712
+ _this.buf.push('"');
1713
+ });
1714
+ this.buf.push('>');
1715
+ }
1716
+ };
1717
+ SanitizingHtmlSerializer.prototype.endElement = function (tagName) {
1718
+ tagName = tagName.toLowerCase();
1719
+ if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) {
1720
+ this.buf.push('</');
1721
+ this.buf.push(tagName);
1722
+ this.buf.push('>');
1723
+ }
1724
+ };
1725
+ SanitizingHtmlSerializer.prototype.chars = function (chars /** TODO #9100 */) { this.buf.push(encodeEntities(chars)); };
1726
+ return SanitizingHtmlSerializer;
1727
+ }());
1728
+ // Regular Expressions for parsing tags and attributes
1729
+ var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
1730
+ // ! to ~ is the ASCII range.
1731
+ var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
1732
+ /**
1733
+ * Escapes all potentially dangerous characters, so that the
1734
+ * resulting string can be safely inserted into attribute or
1735
+ * element text.
1736
+ * @param value
1737
+ * @returns {string} escaped text
1738
+ */
1739
+ function encodeEntities(value /** TODO #9100 */) {
1740
+ return value.replace(/&/g, '&amp;')
1741
+ .replace(SURROGATE_PAIR_REGEXP, function (match /** TODO #9100 */) {
1742
+ var hi = match.charCodeAt(0);
1743
+ var low = match.charCodeAt(1);
1744
+ return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
1745
+ })
1746
+ .replace(NON_ALPHANUMERIC_REGEXP, function (match /** TODO #9100 */) { return '&#' + match.charCodeAt(0) + ';'; })
1747
+ .replace(/</g, '&lt;')
1748
+ .replace(/>/g, '&gt;');
1749
+ }
1750
+ /**
1751
+ * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1'
1752
+ * attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo').
1753
+ *
1754
+ * This is undesirable since we don't want to allow any of these custom attributes. This method
1755
+ * strips them all.
1756
+ */
1757
+ function stripCustomNsAttrs(el) {
1758
+ DOM.attributeMap(el).forEach(function (_, attrName) {
1759
+ if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
1760
+ DOM.removeAttribute(el, attrName);
1761
+ }
1762
+ });
1763
+ for (var _i = 0, _a = DOM.childNodesAsList(el); _i < _a.length; _i++) {
1764
+ var n = _a[_i];
1765
+ if (DOM.isElementNode(n))
1766
+ stripCustomNsAttrs(n);
1767
+ }
1768
+ }
1769
+ /**
1770
+ * Sanitizes the given unsafe, untrusted HTML fragment, and returns HTML text that is safe to add to
1771
+ * the DOM in a browser environment.
1772
+ */
1773
+ function sanitizeHtml(unsafeHtml) {
1774
+ try {
1775
+ var containerEl = getInertElement();
1776
+ // Make sure unsafeHtml is actually a string (TypeScript types are not enforced at runtime).
1777
+ unsafeHtml = unsafeHtml ? String(unsafeHtml) : '';
1778
+ // mXSS protection. Repeatedly parse the document to make sure it stabilizes, so that a browser
1779
+ // trying to auto-correct incorrect HTML cannot cause formerly inert HTML to become dangerous.
1780
+ var mXSSAttempts = 5;
1781
+ var parsedHtml = unsafeHtml;
1782
+ do {
1783
+ if (mXSSAttempts === 0) {
1784
+ throw new Error('Failed to sanitize html because the input is unstable');
1785
+ }
1786
+ mXSSAttempts--;
1787
+ unsafeHtml = parsedHtml;
1788
+ DOM.setInnerHTML(containerEl, unsafeHtml);
1789
+ if (DOM.defaultDoc().documentMode) {
1790
+ // strip custom-namespaced attributes on IE<=11
1791
+ stripCustomNsAttrs(containerEl);
1792
+ }
1793
+ parsedHtml = DOM.getInnerHTML(containerEl);
1794
+ } while (unsafeHtml !== parsedHtml);
1795
+ var sanitizer = new SanitizingHtmlSerializer();
1796
+ var safeHtml = sanitizer.sanitizeChildren(DOM.getTemplateContent(containerEl) || containerEl);
1797
+ // Clear out the body element.
1798
+ var parent_1 = DOM.getTemplateContent(containerEl) || containerEl;
1799
+ for (var _i = 0, _a = DOM.childNodesAsList(parent_1); _i < _a.length; _i++) {
1800
+ var child = _a[_i];
1801
+ DOM.removeChild(parent_1, child);
1802
+ }
1803
+ if (assertionsEnabled() && safeHtml !== unsafeHtml) {
1804
+ DOM.log('WARNING: sanitizing HTML stripped some content.');
1805
+ }
1806
+ return safeHtml;
1807
+ }
1808
+ catch (e) {
1809
+ // In case anything goes wrong, clear out inertElement to reset the entire DOM structure.
1810
+ inertElement = null;
1811
+ throw e;
1812
+ }
1813
+ }
1814
+ /**
1815
+ * Regular expression for safe style values.
1816
+ *
1817
+ * Quotes (" and ') are allowed, but a check must be done elsewhere to ensure they're balanced.
1818
+ *
1819
+ * ',' allows multiple values to be assigned to the same property (e.g. background-attachment or
1820
+ * font-family) and hence could allow multiple values to get injected, but that should pose no risk
1821
+ * of XSS.
1822
+ *
1823
+ * The function expression checks only for XSS safety, not for CSS validity.
1824
+ *
1825
+ * This regular expression was taken from the Closure sanitization library, and augmented for
1826
+ * transformation values.
1827
+ */
1828
+ var VALUES = '[-,."\'%_!# a-zA-Z0-9]+';
1829
+ var TRANSFORMATION_FNS = '(?:matrix|translate|scale|rotate|skew|perspective)(?:X|Y|3d)?';
1830
+ var COLOR_FNS = '(?:rgb|hsl)a?';
1831
+ var FN_ARGS = '\\([-0-9.%, a-zA-Z]+\\)';
1832
+ var SAFE_STYLE_VALUE = new RegExp("^(" + VALUES + "|(?:" + TRANSFORMATION_FNS + "|" + COLOR_FNS + ")" + FN_ARGS + ")$", 'g');
1833
+ /**
1834
+ * Matches a `url(...)` value with an arbitrary argument as long as it does
1835
+ * not contain parentheses.
1836
+ *
1837
+ * The URL value still needs to be sanitized separately.
1838
+ *
1839
+ * `url(...)` values are a very common use case, e.g. for `background-image`. With carefully crafted
1840
+ * CSS style rules, it is possible to construct an information leak with `url` values in CSS, e.g.
1841
+ * by observing whether scroll bars are displayed, or character ranges used by a font face
1842
+ * definition.
1843
+ *
1844
+ * Angular only allows binding CSS values (as opposed to entire CSS rules), so it is unlikely that
1845
+ * binding a URL value without further cooperation from the page will cause an information leak, and
1846
+ * if so, it is just a leak, not a full blown XSS vulnerability.
1847
+ *
1848
+ * Given the common use case, low likelihood of attack vector, and low impact of an attack, this
1849
+ * code is permissive and allows URLs that sanitize otherwise.
1850
+ */
1851
+ var URL_RE = /^url\(([^)]+)\)$/;
1852
+ /**
1853
+ * Checks that quotes (" and ') are properly balanced inside a string. Assumes
1854
+ * that neither escape (\) nor any other character that could result in
1855
+ * breaking out of a string parsing context are allowed;
1856
+ * see http://www.w3.org/TR/css3-syntax/#string-token-diagram.
1857
+ *
1858
+ * This code was taken from the Closure sanitization library.
1859
+ */
1860
+ function hasBalancedQuotes(value) {
1861
+ var outsideSingle = true;
1862
+ var outsideDouble = true;
1863
+ for (var i = 0; i < value.length; i++) {
1864
+ var c = value.charAt(i);
1865
+ if (c === '\'' && outsideDouble) {
1866
+ outsideSingle = !outsideSingle;
1867
+ }
1868
+ else if (c === '"' && outsideSingle) {
1869
+ outsideDouble = !outsideDouble;
1870
+ }
1871
+ }
1872
+ return outsideSingle && outsideDouble;
1873
+ }
1874
+ /**
1875
+ * Sanitizes the given untrusted CSS style property value (i.e. not an entire object, just a single
1876
+ * value) and returns a value that is safe to use in a browser environment.
1877
+ */
1878
+ function sanitizeStyle(value) {
1879
+ value = String(value).trim(); // Make sure it's actually a string.
1880
+ // Single url(...) values are supported, but only for URLs that sanitize cleanly. See above for
1881
+ // reasoning behind this.
1882
+ var urlMatch = URL_RE.exec(value);
1883
+ if ((urlMatch && sanitizeUrl(urlMatch[1]) === urlMatch[1]) ||
1884
+ value.match(SAFE_STYLE_VALUE) && hasBalancedQuotes(value)) {
1885
+ return value; // Safe style values.
1886
+ }
1887
+ if (assertionsEnabled())
1888
+ getDOM().log('WARNING: sanitizing unsafe style value ' + value);
1889
+ return 'unsafe';
1890
+ }
1891
+ /**
1892
+ * DomSanitizationService helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing
1893
+ * values to be safe to use in the different DOM contexts.
1894
+ *
1895
+ * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be
1896
+ * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on
1897
+ * the website.
1898
+ *
1899
+ * In specific situations, it might be necessary to disable sanitization, for example if the
1900
+ * application genuinely needs to produce a `javascript:` style link with a dynamic value in it.
1901
+ * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`
1902
+ * methods, and then binding to that value from the template.
1903
+ *
1904
+ * These situations should be very rare, and extraordinary care must be taken to avoid creating a
1905
+ * Cross Site Scripting (XSS) security bug!
1906
+ *
1907
+ * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as
1908
+ * close as possible to the source of the value, to make it easy to verify no security bug is
1909
+ * created by its use.
1910
+ *
1911
+ * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
1912
+ * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
1913
+ * code. The sanitizer leaves safe values intact.
1914
+ */
1915
+ var DomSanitizationService = (function () {
1916
+ function DomSanitizationService() {
1917
+ }
1918
+ return DomSanitizationService;
1919
+ }());
1920
+ var DomSanitizationServiceImpl = (function (_super) {
1921
+ __extends(DomSanitizationServiceImpl, _super);
1922
+ function DomSanitizationServiceImpl() {
1923
+ _super.apply(this, arguments);
1924
+ }
1925
+ DomSanitizationServiceImpl.prototype.sanitize = function (ctx, value) {
1926
+ if (value == null)
1927
+ return null;
1928
+ switch (ctx) {
1929
+ case SecurityContext.NONE:
1930
+ return value;
1931
+ case SecurityContext.HTML:
1932
+ if (value instanceof SafeHtmlImpl)
1933
+ return value.changingThisBreaksApplicationSecurity;
1934
+ this.checkNotSafeValue(value, 'HTML');
1935
+ return sanitizeHtml(String(value));
1936
+ case SecurityContext.STYLE:
1937
+ if (value instanceof SafeStyleImpl)
1938
+ return value.changingThisBreaksApplicationSecurity;
1939
+ this.checkNotSafeValue(value, 'Style');
1940
+ return sanitizeStyle(value);
1941
+ case SecurityContext.SCRIPT:
1942
+ if (value instanceof SafeScriptImpl)
1943
+ return value.changingThisBreaksApplicationSecurity;
1944
+ this.checkNotSafeValue(value, 'Script');
1945
+ throw new Error('unsafe value used in a script context');
1946
+ case SecurityContext.URL:
1947
+ if (value instanceof SafeUrlImpl)
1948
+ return value.changingThisBreaksApplicationSecurity;
1949
+ this.checkNotSafeValue(value, 'URL');
1950
+ return sanitizeUrl(String(value));
1951
+ case SecurityContext.RESOURCE_URL:
1952
+ if (value instanceof SafeResourceUrlImpl) {
1953
+ return value.changingThisBreaksApplicationSecurity;
1954
+ }
1955
+ this.checkNotSafeValue(value, 'ResourceURL');
1956
+ throw new Error('unsafe value used in a resource URL context');
1957
+ default:
1958
+ throw new Error("Unexpected SecurityContext " + ctx);
1959
+ }
1960
+ };
1961
+ DomSanitizationServiceImpl.prototype.checkNotSafeValue = function (value, expectedType) {
1962
+ if (value instanceof SafeValueImpl) {
1963
+ throw new Error("Required a safe " + expectedType + ", got a " + value.getTypeName());
1964
+ }
1965
+ };
1966
+ DomSanitizationServiceImpl.prototype.bypassSecurityTrustHtml = function (value) { return new SafeHtmlImpl(value); };
1967
+ DomSanitizationServiceImpl.prototype.bypassSecurityTrustStyle = function (value) { return new SafeStyleImpl(value); };
1968
+ DomSanitizationServiceImpl.prototype.bypassSecurityTrustScript = function (value) { return new SafeScriptImpl(value); };
1969
+ DomSanitizationServiceImpl.prototype.bypassSecurityTrustUrl = function (value) { return new SafeUrlImpl(value); };
1970
+ DomSanitizationServiceImpl.prototype.bypassSecurityTrustResourceUrl = function (value) {
1971
+ return new SafeResourceUrlImpl(value);
1972
+ };
1973
+ return DomSanitizationServiceImpl;
1974
+ }(DomSanitizationService));
1975
+ /** @nocollapse */
1976
+ DomSanitizationServiceImpl.decorators = [
1977
+ { type: _angular_core.Injectable },
1978
+ ];
1979
+ var SafeValueImpl = (function () {
1980
+ function SafeValueImpl(changingThisBreaksApplicationSecurity) {
1981
+ this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity;
1982
+ // empty
1983
+ }
1984
+ return SafeValueImpl;
1985
+ }());
1986
+ var SafeHtmlImpl = (function (_super) {
1987
+ __extends(SafeHtmlImpl, _super);
1988
+ function SafeHtmlImpl() {
1989
+ _super.apply(this, arguments);
1990
+ }
1991
+ SafeHtmlImpl.prototype.getTypeName = function () { return 'HTML'; };
1992
+ return SafeHtmlImpl;
1993
+ }(SafeValueImpl));
1994
+ var SafeStyleImpl = (function (_super) {
1995
+ __extends(SafeStyleImpl, _super);
1996
+ function SafeStyleImpl() {
1997
+ _super.apply(this, arguments);
1998
+ }
1999
+ SafeStyleImpl.prototype.getTypeName = function () { return 'Style'; };
2000
+ return SafeStyleImpl;
2001
+ }(SafeValueImpl));
2002
+ var SafeScriptImpl = (function (_super) {
2003
+ __extends(SafeScriptImpl, _super);
2004
+ function SafeScriptImpl() {
2005
+ _super.apply(this, arguments);
2006
+ }
2007
+ SafeScriptImpl.prototype.getTypeName = function () { return 'Script'; };
2008
+ return SafeScriptImpl;
2009
+ }(SafeValueImpl));
2010
+ var SafeUrlImpl = (function (_super) {
2011
+ __extends(SafeUrlImpl, _super);
2012
+ function SafeUrlImpl() {
2013
+ _super.apply(this, arguments);
2014
+ }
2015
+ SafeUrlImpl.prototype.getTypeName = function () { return 'URL'; };
2016
+ return SafeUrlImpl;
2017
+ }(SafeValueImpl));
2018
+ var SafeResourceUrlImpl = (function (_super) {
2019
+ __extends(SafeResourceUrlImpl, _super);
2020
+ function SafeResourceUrlImpl() {
2021
+ _super.apply(this, arguments);
2022
+ }
2023
+ SafeResourceUrlImpl.prototype.getTypeName = function () { return 'ResourceURL'; };
2024
+ return SafeResourceUrlImpl;
2025
+ }(SafeValueImpl));
2026
+ var WebAnimationsPlayer = (function () {
2027
+ function WebAnimationsPlayer(_player, totalTime) {
2028
+ var _this = this;
2029
+ this._player = _player;
2030
+ this.totalTime = totalTime;
2031
+ this._subscriptions = [];
2032
+ this._finished = false;
2033
+ this.parentPlayer = null;
2034
+ // this is required to make the player startable at a later time
2035
+ this.reset();
2036
+ this._player.onfinish = function () { return _this._onFinish(); };
2037
+ }
2038
+ WebAnimationsPlayer.prototype._onFinish = function () {
2039
+ if (!this._finished) {
2040
+ this._finished = true;
2041
+ if (!isPresent(this.parentPlayer)) {
2042
+ this.destroy();
2043
+ }
2044
+ this._subscriptions.forEach(function (fn) { return fn(); });
2045
+ this._subscriptions = [];
2046
+ }
2047
+ };
2048
+ WebAnimationsPlayer.prototype.onDone = function (fn) { this._subscriptions.push(fn); };
2049
+ WebAnimationsPlayer.prototype.play = function () { this._player.play(); };
2050
+ WebAnimationsPlayer.prototype.pause = function () { this._player.pause(); };
2051
+ WebAnimationsPlayer.prototype.finish = function () {
2052
+ this._onFinish();
2053
+ this._player.finish();
2054
+ };
2055
+ WebAnimationsPlayer.prototype.reset = function () { this._player.cancel(); };
2056
+ WebAnimationsPlayer.prototype.restart = function () {
2057
+ this.reset();
2058
+ this.play();
2059
+ };
2060
+ WebAnimationsPlayer.prototype.destroy = function () {
2061
+ this.reset();
2062
+ this._onFinish();
2063
+ };
2064
+ WebAnimationsPlayer.prototype.setPosition = function (p /** TODO #9100 */) { this._player.currentTime = p * this.totalTime; };
2065
+ WebAnimationsPlayer.prototype.getPosition = function () { return this._player.currentTime / this.totalTime; };
2066
+ return WebAnimationsPlayer;
2067
+ }());
2068
+ var WebAnimationsDriver = (function () {
2069
+ function WebAnimationsDriver() {
2070
+ }
2071
+ WebAnimationsDriver.prototype.animate = function (element, startingStyles, keyframes, duration, delay, easing) {
2072
+ var anyElm = element;
2073
+ var formattedSteps = [];
2074
+ var startingStyleLookup = {};
2075
+ if (isPresent(startingStyles) && startingStyles.styles.length > 0) {
2076
+ startingStyleLookup = _populateStyles(anyElm, startingStyles, {});
2077
+ startingStyleLookup['offset'] = 0;
2078
+ formattedSteps.push(startingStyleLookup);
2079
+ }
2080
+ keyframes.forEach(function (keyframe) {
2081
+ var data = _populateStyles(anyElm, keyframe.styles, startingStyleLookup);
2082
+ data['offset'] = keyframe.offset;
2083
+ formattedSteps.push(data);
2084
+ });
2085
+ // this is a special case when only styles are applied as an
2086
+ // animation. When this occurs we want to animate from start to
2087
+ // end with the same values. Removing the offset and having only
2088
+ // start/end values is suitable enough for the web-animations API
2089
+ if (formattedSteps.length == 1) {
2090
+ var start = formattedSteps[0];
2091
+ start['offset'] = null;
2092
+ formattedSteps = [start, start];
2093
+ }
2094
+ var player = this._triggerWebAnimation(anyElm, formattedSteps, { 'duration': duration, 'delay': delay, 'easing': easing, 'fill': 'forwards' });
2095
+ return new WebAnimationsPlayer(player, duration);
2096
+ };
2097
+ /** @internal */
2098
+ WebAnimationsDriver.prototype._triggerWebAnimation = function (elm, keyframes, options) {
2099
+ return elm.animate(keyframes, options);
2100
+ };
2101
+ return WebAnimationsDriver;
2102
+ }());
2103
+ function _populateStyles(element, styles, defaultStyles) {
2104
+ var data = {};
2105
+ styles.styles.forEach(function (entry) {
2106
+ StringMapWrapper.forEach(entry, function (val, prop) {
2107
+ var formattedProp = dashCaseToCamelCase(prop);
2108
+ data[formattedProp] = val == _angular_core.AUTO_STYLE ?
2109
+ _computeStyle(element, formattedProp) :
2110
+ val.toString() + _resolveStyleUnit(val, prop, formattedProp);
2111
+ });
2112
+ });
2113
+ StringMapWrapper.forEach(defaultStyles, function (value, prop) {
2114
+ if (!isPresent(data[prop])) {
2115
+ data[prop] = value;
2116
+ }
2117
+ });
2118
+ return data;
2119
+ }
2120
+ function _resolveStyleUnit(val, userProvidedProp, formattedProp) {
2121
+ var unit = '';
2122
+ if (_isPixelDimensionStyle(formattedProp) && val != 0 && val != '0') {
2123
+ if (isNumber(val)) {
2124
+ unit = 'px';
2125
+ }
2126
+ else if (_findDimensionalSuffix(val.toString()).length == 0) {
2127
+ throw new _angular_core.BaseException('Please provide a CSS unit value for ' + userProvidedProp + ':' + val);
2128
+ }
2129
+ }
2130
+ return unit;
2131
+ }
2132
+ var _$0 = 48;
2133
+ var _$9 = 57;
2134
+ var _$PERIOD = 46;
2135
+ function _findDimensionalSuffix(value) {
2136
+ for (var i = 0; i < value.length; i++) {
2137
+ var c = StringWrapper.charCodeAt(value, i);
2138
+ if ((c >= _$0 && c <= _$9) || c == _$PERIOD)
2139
+ continue;
2140
+ return value.substring(i, value.length);
2141
+ }
2142
+ return '';
2143
+ }
2144
+ function _isPixelDimensionStyle(prop) {
2145
+ switch (prop) {
2146
+ case 'width':
2147
+ case 'height':
2148
+ case 'minWidth':
2149
+ case 'minHeight':
2150
+ case 'maxWidth':
2151
+ case 'maxHeight':
2152
+ case 'left':
2153
+ case 'top':
2154
+ case 'bottom':
2155
+ case 'right':
2156
+ case 'fontSize':
2157
+ case 'outlineWidth':
2158
+ case 'outlineOffset':
2159
+ case 'paddingTop':
2160
+ case 'paddingLeft':
2161
+ case 'paddingBottom':
2162
+ case 'paddingRight':
2163
+ case 'marginTop':
2164
+ case 'marginLeft':
2165
+ case 'marginBottom':
2166
+ case 'marginRight':
2167
+ case 'borderRadius':
2168
+ case 'borderWidth':
2169
+ case 'borderTopWidth':
2170
+ case 'borderLeftWidth':
2171
+ case 'borderRightWidth':
2172
+ case 'borderBottomWidth':
2173
+ case 'textIndent':
2174
+ return true;
2175
+ default:
2176
+ return false;
2177
+ }
2178
+ }
2179
+ function _computeStyle(element, prop) {
2180
+ return getDOM().getComputedStyle(element)[prop];
2181
+ }
2182
+ /**
2183
+ * Provides DOM operations in any browser environment.
2184
+ */
2185
+ var GenericBrowserDomAdapter = (function (_super) {
2186
+ __extends(GenericBrowserDomAdapter, _super);
2187
+ function GenericBrowserDomAdapter() {
2188
+ var _this = this;
2189
+ _super.call(this);
2190
+ this._animationPrefix = null;
2191
+ this._transitionEnd = null;
2192
+ try {
2193
+ var element = this.createElement('div', this.defaultDoc());
2194
+ if (isPresent(this.getStyle(element, 'animationName'))) {
2195
+ this._animationPrefix = '';
2196
+ }
2197
+ else {
2198
+ var domPrefixes = ['Webkit', 'Moz', 'O', 'ms'];
2199
+ for (var i = 0; i < domPrefixes.length; i++) {
2200
+ if (isPresent(this.getStyle(element, domPrefixes[i] + 'AnimationName'))) {
2201
+ this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-';
2202
+ break;
2203
+ }
2204
+ }
2205
+ }
2206
+ var transEndEventNames = {
2207
+ WebkitTransition: 'webkitTransitionEnd',
2208
+ MozTransition: 'transitionend',
2209
+ OTransition: 'oTransitionEnd otransitionend',
2210
+ transition: 'transitionend'
2211
+ };
2212
+ StringMapWrapper.forEach(transEndEventNames, function (value, key) {
2213
+ if (isPresent(_this.getStyle(element, key))) {
2214
+ _this._transitionEnd = value;
2215
+ }
2216
+ });
2217
+ }
2218
+ catch (e) {
2219
+ this._animationPrefix = null;
2220
+ this._transitionEnd = null;
2221
+ }
2222
+ }
2223
+ GenericBrowserDomAdapter.prototype.getDistributedNodes = function (el) { return el.getDistributedNodes(); };
2224
+ GenericBrowserDomAdapter.prototype.resolveAndSetHref = function (el, baseUrl, href) {
2225
+ el.href = href == null ? baseUrl : baseUrl + '/../' + href;
2226
+ };
2227
+ GenericBrowserDomAdapter.prototype.supportsDOMEvents = function () { return true; };
2228
+ GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function () {
2229
+ return isFunction(this.defaultDoc().body.createShadowRoot);
2230
+ };
2231
+ GenericBrowserDomAdapter.prototype.getAnimationPrefix = function () {
2232
+ return isPresent(this._animationPrefix) ? this._animationPrefix : '';
2233
+ };
2234
+ GenericBrowserDomAdapter.prototype.getTransitionEnd = function () { return isPresent(this._transitionEnd) ? this._transitionEnd : ''; };
2235
+ GenericBrowserDomAdapter.prototype.supportsAnimation = function () {
2236
+ return isPresent(this._animationPrefix) && isPresent(this._transitionEnd);
2237
+ };
2238
+ return GenericBrowserDomAdapter;
2239
+ }(DomAdapter));
2240
+ var _attrToPropMap = {
2241
+ 'class': 'className',
2242
+ 'innerHtml': 'innerHTML',
2243
+ 'readonly': 'readOnly',
2244
+ 'tabindex': 'tabIndex'
2245
+ };
2246
+ var DOM_KEY_LOCATION_NUMPAD = 3;
2247
+ // Map to convert some key or keyIdentifier values to what will be returned by getEventKey
2248
+ var _keyMap = {
2249
+ // The following values are here for cross-browser compatibility and to match the W3C standard
2250
+ // cf http://www.w3.org/TR/DOM-Level-3-Events-key/
2251
+ '\b': 'Backspace',
2252
+ '\t': 'Tab',
2253
+ '\x7F': 'Delete',
2254
+ '\x1B': 'Escape',
2255
+ 'Del': 'Delete',
2256
+ 'Esc': 'Escape',
2257
+ 'Left': 'ArrowLeft',
2258
+ 'Right': 'ArrowRight',
2259
+ 'Up': 'ArrowUp',
2260
+ 'Down': 'ArrowDown',
2261
+ 'Menu': 'ContextMenu',
2262
+ 'Scroll': 'ScrollLock',
2263
+ 'Win': 'OS'
2264
+ };
2265
+ // There is a bug in Chrome for numeric keypad keys:
2266
+ // https://code.google.com/p/chromium/issues/detail?id=155654
2267
+ // 1, 2, 3 ... are reported as A, B, C ...
2268
+ var _chromeNumKeyPadMap = {
2269
+ 'A': '1',
2270
+ 'B': '2',
2271
+ 'C': '3',
2272
+ 'D': '4',
2273
+ 'E': '5',
2274
+ 'F': '6',
2275
+ 'G': '7',
2276
+ 'H': '8',
2277
+ 'I': '9',
2278
+ 'J': '*',
2279
+ 'K': '+',
2280
+ 'M': '-',
2281
+ 'N': '.',
2282
+ 'O': '/',
2283
+ '\x60': '0',
2284
+ '\x90': 'NumLock'
2285
+ };
2286
+ /**
2287
+ * A `DomAdapter` powered by full browser DOM APIs.
2288
+ */
2289
+ /* tslint:disable:requireParameterType */
2290
+ var BrowserDomAdapter = (function (_super) {
2291
+ __extends(BrowserDomAdapter, _super);
2292
+ function BrowserDomAdapter() {
2293
+ _super.apply(this, arguments);
2294
+ }
2295
+ BrowserDomAdapter.prototype.parse = function (templateHtml) { throw new Error('parse not implemented'); };
2296
+ BrowserDomAdapter.makeCurrent = function () { setRootDomAdapter(new BrowserDomAdapter()); };
2297
+ BrowserDomAdapter.prototype.hasProperty = function (element /** TODO #9100 */, name) { return name in element; };
2298
+ BrowserDomAdapter.prototype.setProperty = function (el, name, value) { el[name] = value; };
2299
+ BrowserDomAdapter.prototype.getProperty = function (el, name) { return el[name]; };
2300
+ BrowserDomAdapter.prototype.invoke = function (el, methodName, args) {
2301
+ el[methodName].apply(el, args);
2302
+ };
2303
+ // TODO(tbosch): move this into a separate environment class once we have it
2304
+ BrowserDomAdapter.prototype.logError = function (error /** TODO #9100 */) {
2305
+ if (window.console.error) {
2306
+ window.console.error(error);
2307
+ }
2308
+ else {
2309
+ window.console.log(error);
2310
+ }
2311
+ };
2312
+ BrowserDomAdapter.prototype.log = function (error /** TODO #9100 */) { window.console.log(error); };
2313
+ BrowserDomAdapter.prototype.logGroup = function (error /** TODO #9100 */) {
2314
+ if (window.console.group) {
2315
+ window.console.group(error);
2316
+ this.logError(error);
2317
+ }
2318
+ else {
2319
+ window.console.log(error);
2320
+ }
2321
+ };
2322
+ BrowserDomAdapter.prototype.logGroupEnd = function () {
2323
+ if (window.console.groupEnd) {
2324
+ window.console.groupEnd();
2325
+ }
2326
+ };
2327
+ Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", {
2328
+ get: function () { return _attrToPropMap; },
2329
+ enumerable: true,
2330
+ configurable: true
2331
+ });
2332
+ BrowserDomAdapter.prototype.query = function (selector) { return document.querySelector(selector); };
2333
+ BrowserDomAdapter.prototype.querySelector = function (el /** TODO #9100 */, selector) {
2334
+ return el.querySelector(selector);
2335
+ };
2336
+ BrowserDomAdapter.prototype.querySelectorAll = function (el /** TODO #9100 */, selector) {
2337
+ return el.querySelectorAll(selector);
2338
+ };
2339
+ BrowserDomAdapter.prototype.on = function (el /** TODO #9100 */, evt /** TODO #9100 */, listener /** TODO #9100 */) {
2340
+ el.addEventListener(evt, listener, false);
2341
+ };
2342
+ BrowserDomAdapter.prototype.onAndCancel = function (el /** TODO #9100 */, evt /** TODO #9100 */, listener /** TODO #9100 */) {
2343
+ el.addEventListener(evt, listener, false);
2344
+ // Needed to follow Dart's subscription semantic, until fix of
2345
+ // https://code.google.com/p/dart/issues/detail?id=17406
2346
+ return function () { el.removeEventListener(evt, listener, false); };
2347
+ };
2348
+ BrowserDomAdapter.prototype.dispatchEvent = function (el /** TODO #9100 */, evt /** TODO #9100 */) { el.dispatchEvent(evt); };
2349
+ BrowserDomAdapter.prototype.createMouseEvent = function (eventType) {
2350
+ var evt = document.createEvent('MouseEvent');
2351
+ evt.initEvent(eventType, true, true);
2352
+ return evt;
2353
+ };
2354
+ BrowserDomAdapter.prototype.createEvent = function (eventType /** TODO #9100 */) {
2355
+ var evt = document.createEvent('Event');
2356
+ evt.initEvent(eventType, true, true);
2357
+ return evt;
2358
+ };
2359
+ BrowserDomAdapter.prototype.preventDefault = function (evt) {
2360
+ evt.preventDefault();
2361
+ evt.returnValue = false;
2362
+ };
2363
+ BrowserDomAdapter.prototype.isPrevented = function (evt) {
2364
+ return evt.defaultPrevented || isPresent(evt.returnValue) && !evt.returnValue;
2365
+ };
2366
+ BrowserDomAdapter.prototype.getInnerHTML = function (el /** TODO #9100 */) { return el.innerHTML; };
2367
+ BrowserDomAdapter.prototype.getTemplateContent = function (el /** TODO #9100 */) {
2368
+ return 'content' in el && el instanceof HTMLTemplateElement ? el.content : null;
2369
+ };
2370
+ BrowserDomAdapter.prototype.getOuterHTML = function (el /** TODO #9100 */) { return el.outerHTML; };
2371
+ BrowserDomAdapter.prototype.nodeName = function (node) { return node.nodeName; };
2372
+ BrowserDomAdapter.prototype.nodeValue = function (node) { return node.nodeValue; };
2373
+ BrowserDomAdapter.prototype.type = function (node) { return node.type; };
2374
+ BrowserDomAdapter.prototype.content = function (node) {
2375
+ if (this.hasProperty(node, 'content')) {
2376
+ return node.content;
2377
+ }
2378
+ else {
2379
+ return node;
2380
+ }
2381
+ };
2382
+ BrowserDomAdapter.prototype.firstChild = function (el /** TODO #9100 */) { return el.firstChild; };
2383
+ BrowserDomAdapter.prototype.nextSibling = function (el /** TODO #9100 */) { return el.nextSibling; };
2384
+ BrowserDomAdapter.prototype.parentElement = function (el /** TODO #9100 */) { return el.parentNode; };
2385
+ BrowserDomAdapter.prototype.childNodes = function (el /** TODO #9100 */) { return el.childNodes; };
2386
+ BrowserDomAdapter.prototype.childNodesAsList = function (el /** TODO #9100 */) {
2387
+ var childNodes = el.childNodes;
2388
+ var res = ListWrapper.createFixedSize(childNodes.length);
2389
+ for (var i = 0; i < childNodes.length; i++) {
2390
+ res[i] = childNodes[i];
2391
+ }
2392
+ return res;
2393
+ };
2394
+ BrowserDomAdapter.prototype.clearNodes = function (el /** TODO #9100 */) {
2395
+ while (el.firstChild) {
2396
+ el.removeChild(el.firstChild);
2397
+ }
2398
+ };
2399
+ BrowserDomAdapter.prototype.appendChild = function (el /** TODO #9100 */, node /** TODO #9100 */) { el.appendChild(node); };
2400
+ BrowserDomAdapter.prototype.removeChild = function (el /** TODO #9100 */, node /** TODO #9100 */) { el.removeChild(node); };
2401
+ BrowserDomAdapter.prototype.replaceChild = function (el, newChild /** TODO #9100 */, oldChild /** TODO #9100 */) {
2402
+ el.replaceChild(newChild, oldChild);
2403
+ };
2404
+ BrowserDomAdapter.prototype.remove = function (node /** TODO #9100 */) {
2405
+ if (node.parentNode) {
2406
+ node.parentNode.removeChild(node);
2407
+ }
2408
+ return node;
2409
+ };
2410
+ BrowserDomAdapter.prototype.insertBefore = function (el /** TODO #9100 */, node /** TODO #9100 */) {
2411
+ el.parentNode.insertBefore(node, el);
2412
+ };
2413
+ BrowserDomAdapter.prototype.insertAllBefore = function (el /** TODO #9100 */, nodes /** TODO #9100 */) {
2414
+ nodes.forEach(function (n /** TODO #9100 */) { return el.parentNode.insertBefore(n, el); });
2415
+ };
2416
+ BrowserDomAdapter.prototype.insertAfter = function (el /** TODO #9100 */, node /** TODO #9100 */) {
2417
+ el.parentNode.insertBefore(node, el.nextSibling);
2418
+ };
2419
+ BrowserDomAdapter.prototype.setInnerHTML = function (el /** TODO #9100 */, value /** TODO #9100 */) { el.innerHTML = value; };
2420
+ BrowserDomAdapter.prototype.getText = function (el /** TODO #9100 */) { return el.textContent; };
2421
+ // TODO(vicb): removed Element type because it does not support StyleElement
2422
+ BrowserDomAdapter.prototype.setText = function (el /** TODO #9100 */, value) { el.textContent = value; };
2423
+ BrowserDomAdapter.prototype.getValue = function (el /** TODO #9100 */) { return el.value; };
2424
+ BrowserDomAdapter.prototype.setValue = function (el /** TODO #9100 */, value) { el.value = value; };
2425
+ BrowserDomAdapter.prototype.getChecked = function (el /** TODO #9100 */) { return el.checked; };
2426
+ BrowserDomAdapter.prototype.setChecked = function (el /** TODO #9100 */, value) { el.checked = value; };
2427
+ BrowserDomAdapter.prototype.createComment = function (text) { return document.createComment(text); };
2428
+ BrowserDomAdapter.prototype.createTemplate = function (html /** TODO #9100 */) {
2429
+ var t = document.createElement('template');
2430
+ t.innerHTML = html;
2431
+ return t;
2432
+ };
2433
+ BrowserDomAdapter.prototype.createElement = function (tagName /* TODO #9100 */, doc) {
2434
+ if (doc === void 0) { doc = document; }
2435
+ return doc.createElement(tagName);
2436
+ };
2437
+ BrowserDomAdapter.prototype.createElementNS = function (ns /* TODO #9100 */, tagName /* TODO #9100 */, doc) {
2438
+ if (doc === void 0) { doc = document; }
2439
+ return doc.createElementNS(ns, tagName);
2440
+ };
2441
+ BrowserDomAdapter.prototype.createTextNode = function (text, doc) {
2442
+ if (doc === void 0) { doc = document; }
2443
+ return doc.createTextNode(text);
2444
+ };
2445
+ BrowserDomAdapter.prototype.createScriptTag = function (attrName, attrValue, doc) {
2446
+ if (doc === void 0) { doc = document; }
2447
+ var el = doc.createElement('SCRIPT');
2448
+ el.setAttribute(attrName, attrValue);
2449
+ return el;
2450
+ };
2451
+ BrowserDomAdapter.prototype.createStyleElement = function (css, doc) {
2452
+ if (doc === void 0) { doc = document; }
2453
+ var style = doc.createElement('style');
2454
+ this.appendChild(style, this.createTextNode(css));
2455
+ return style;
2456
+ };
2457
+ BrowserDomAdapter.prototype.createShadowRoot = function (el) { return el.createShadowRoot(); };
2458
+ BrowserDomAdapter.prototype.getShadowRoot = function (el) { return el.shadowRoot; };
2459
+ BrowserDomAdapter.prototype.getHost = function (el) { return el.host; };
2460
+ BrowserDomAdapter.prototype.clone = function (node) { return node.cloneNode(true); };
2461
+ BrowserDomAdapter.prototype.getElementsByClassName = function (element /** TODO #9100 */, name) {
2462
+ return element.getElementsByClassName(name);
2463
+ };
2464
+ BrowserDomAdapter.prototype.getElementsByTagName = function (element /** TODO #9100 */, name) {
2465
+ return element.getElementsByTagName(name);
2466
+ };
2467
+ BrowserDomAdapter.prototype.classList = function (element /** TODO #9100 */) {
2468
+ return Array.prototype.slice.call(element.classList, 0);
2469
+ };
2470
+ BrowserDomAdapter.prototype.addClass = function (element /** TODO #9100 */, className) { element.classList.add(className); };
2471
+ BrowserDomAdapter.prototype.removeClass = function (element /** TODO #9100 */, className) {
2472
+ element.classList.remove(className);
2473
+ };
2474
+ BrowserDomAdapter.prototype.hasClass = function (element /** TODO #9100 */, className) {
2475
+ return element.classList.contains(className);
2476
+ };
2477
+ BrowserDomAdapter.prototype.setStyle = function (element /** TODO #9100 */, styleName, styleValue) {
2478
+ element.style[styleName] = styleValue;
2479
+ };
2480
+ BrowserDomAdapter.prototype.removeStyle = function (element /** TODO #9100 */, stylename) {
2481
+ element.style[stylename] = null;
2482
+ };
2483
+ BrowserDomAdapter.prototype.getStyle = function (element /** TODO #9100 */, stylename) {
2484
+ return element.style[stylename];
2485
+ };
2486
+ BrowserDomAdapter.prototype.hasStyle = function (element /** TODO #9100 */, styleName, styleValue) {
2487
+ if (styleValue === void 0) { styleValue = null; }
2488
+ var value = this.getStyle(element, styleName) || '';
2489
+ return styleValue ? value == styleValue : value.length > 0;
2490
+ };
2491
+ BrowserDomAdapter.prototype.tagName = function (element /** TODO #9100 */) { return element.tagName; };
2492
+ BrowserDomAdapter.prototype.attributeMap = function (element /** TODO #9100 */) {
2493
+ var res = new Map();
2494
+ var elAttrs = element.attributes;
2495
+ for (var i = 0; i < elAttrs.length; i++) {
2496
+ var attrib = elAttrs[i];
2497
+ res.set(attrib.name, attrib.value);
2498
+ }
2499
+ return res;
2500
+ };
2501
+ BrowserDomAdapter.prototype.hasAttribute = function (element /** TODO #9100 */, attribute) {
2502
+ return element.hasAttribute(attribute);
2503
+ };
2504
+ BrowserDomAdapter.prototype.hasAttributeNS = function (element /** TODO #9100 */, ns, attribute) {
2505
+ return element.hasAttributeNS(ns, attribute);
2506
+ };
2507
+ BrowserDomAdapter.prototype.getAttribute = function (element /** TODO #9100 */, attribute) {
2508
+ return element.getAttribute(attribute);
2509
+ };
2510
+ BrowserDomAdapter.prototype.getAttributeNS = function (element /** TODO #9100 */, ns, name) {
2511
+ return element.getAttributeNS(ns, name);
2512
+ };
2513
+ BrowserDomAdapter.prototype.setAttribute = function (element /** TODO #9100 */, name, value) {
2514
+ element.setAttribute(name, value);
2515
+ };
2516
+ BrowserDomAdapter.prototype.setAttributeNS = function (element /** TODO #9100 */, ns, name, value) {
2517
+ element.setAttributeNS(ns, name, value);
2518
+ };
2519
+ BrowserDomAdapter.prototype.removeAttribute = function (element /** TODO #9100 */, attribute) {
2520
+ element.removeAttribute(attribute);
2521
+ };
2522
+ BrowserDomAdapter.prototype.removeAttributeNS = function (element /** TODO #9100 */, ns, name) {
2523
+ element.removeAttributeNS(ns, name);
2524
+ };
2525
+ BrowserDomAdapter.prototype.templateAwareRoot = function (el /** TODO #9100 */) {
2526
+ return this.isTemplateElement(el) ? this.content(el) : el;
2527
+ };
2528
+ BrowserDomAdapter.prototype.createHtmlDocument = function () {
2529
+ return document.implementation.createHTMLDocument('fakeTitle');
2530
+ };
2531
+ BrowserDomAdapter.prototype.defaultDoc = function () { return document; };
2532
+ BrowserDomAdapter.prototype.getBoundingClientRect = function (el /** TODO #9100 */) {
2533
+ try {
2534
+ return el.getBoundingClientRect();
2535
+ }
2536
+ catch (e) {
2537
+ return { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 };
2538
+ }
2539
+ };
2540
+ BrowserDomAdapter.prototype.getTitle = function () { return document.title; };
2541
+ BrowserDomAdapter.prototype.setTitle = function (newTitle) { document.title = newTitle || ''; };
2542
+ BrowserDomAdapter.prototype.elementMatches = function (n /** TODO #9100 */, selector) {
2543
+ var matches = false;
2544
+ if (n instanceof HTMLElement) {
2545
+ if (n.matches) {
2546
+ matches = n.matches(selector);
2547
+ }
2548
+ else if (n.msMatchesSelector) {
2549
+ matches = n.msMatchesSelector(selector);
2550
+ }
2551
+ else if (n.webkitMatchesSelector) {
2552
+ matches = n.webkitMatchesSelector(selector);
2553
+ }
2554
+ }
2555
+ return matches;
2556
+ };
2557
+ BrowserDomAdapter.prototype.isTemplateElement = function (el) {
2558
+ return el instanceof HTMLElement && el.nodeName == 'TEMPLATE';
2559
+ };
2560
+ BrowserDomAdapter.prototype.isTextNode = function (node) { return node.nodeType === Node.TEXT_NODE; };
2561
+ BrowserDomAdapter.prototype.isCommentNode = function (node) { return node.nodeType === Node.COMMENT_NODE; };
2562
+ BrowserDomAdapter.prototype.isElementNode = function (node) { return node.nodeType === Node.ELEMENT_NODE; };
2563
+ BrowserDomAdapter.prototype.hasShadowRoot = function (node /** TODO #9100 */) {
2564
+ return node instanceof HTMLElement && isPresent(node.shadowRoot);
2565
+ };
2566
+ BrowserDomAdapter.prototype.isShadowRoot = function (node /** TODO #9100 */) { return node instanceof DocumentFragment; };
2567
+ BrowserDomAdapter.prototype.importIntoDoc = function (node) {
2568
+ var toImport = node;
2569
+ if (this.isTemplateElement(node)) {
2570
+ toImport = this.content(node);
2571
+ }
2572
+ return document.importNode(toImport, true);
2573
+ };
2574
+ BrowserDomAdapter.prototype.adoptNode = function (node) { return document.adoptNode(node); };
2575
+ BrowserDomAdapter.prototype.getHref = function (el) { return el.href; };
2576
+ BrowserDomAdapter.prototype.getEventKey = function (event /** TODO #9100 */) {
2577
+ var key = event.key;
2578
+ if (isBlank(key)) {
2579
+ key = event.keyIdentifier;
2580
+ // keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and
2581
+ // Safari
2582
+ // cf
2583
+ // http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces
2584
+ if (isBlank(key)) {
2585
+ return 'Unidentified';
2586
+ }
2587
+ if (key.startsWith('U+')) {
2588
+ key = String.fromCharCode(parseInt(key.substring(2), 16));
2589
+ if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
2590
+ // There is a bug in Chrome for numeric keypad keys:
2591
+ // https://code.google.com/p/chromium/issues/detail?id=155654
2592
+ // 1, 2, 3 ... are reported as A, B, C ...
2593
+ key = _chromeNumKeyPadMap[key];
2594
+ }
2595
+ }
2596
+ }
2597
+ if (_keyMap.hasOwnProperty(key)) {
2598
+ key = _keyMap[key];
2599
+ }
2600
+ return key;
2601
+ };
2602
+ BrowserDomAdapter.prototype.getGlobalEventTarget = function (target) {
2603
+ if (target == 'window') {
2604
+ return window;
2605
+ }
2606
+ else if (target == 'document') {
2607
+ return document;
2608
+ }
2609
+ else if (target == 'body') {
2610
+ return document.body;
2611
+ }
2612
+ };
2613
+ BrowserDomAdapter.prototype.getHistory = function () { return window.history; };
2614
+ BrowserDomAdapter.prototype.getLocation = function () { return window.location; };
2615
+ BrowserDomAdapter.prototype.getBaseHref = function () {
2616
+ var href = getBaseElementHref();
2617
+ if (isBlank(href)) {
2618
+ return null;
2619
+ }
2620
+ return relativePath(href);
2621
+ };
2622
+ BrowserDomAdapter.prototype.resetBaseElement = function () { baseElement = null; };
2623
+ BrowserDomAdapter.prototype.getUserAgent = function () { return window.navigator.userAgent; };
2624
+ BrowserDomAdapter.prototype.setData = function (element /** TODO #9100 */, name, value) {
2625
+ this.setAttribute(element, 'data-' + name, value);
2626
+ };
2627
+ BrowserDomAdapter.prototype.getData = function (element /** TODO #9100 */, name) {
2628
+ return this.getAttribute(element, 'data-' + name);
2629
+ };
2630
+ BrowserDomAdapter.prototype.getComputedStyle = function (element /** TODO #9100 */) { return getComputedStyle(element); };
2631
+ // TODO(tbosch): move this into a separate environment class once we have it
2632
+ BrowserDomAdapter.prototype.setGlobalVar = function (path, value) { setValueOnPath(global$1, path, value); };
2633
+ BrowserDomAdapter.prototype.requestAnimationFrame = function (callback /** TODO #9100 */) {
2634
+ return window.requestAnimationFrame(callback);
2635
+ };
2636
+ BrowserDomAdapter.prototype.cancelAnimationFrame = function (id) { window.cancelAnimationFrame(id); };
2637
+ BrowserDomAdapter.prototype.supportsWebAnimation = function () {
2638
+ return isFunction(document.body['animate']);
2639
+ };
2640
+ BrowserDomAdapter.prototype.performanceNow = function () {
2641
+ // performance.now() is not available in all browsers, see
2642
+ // http://caniuse.com/#search=performance.now
2643
+ if (isPresent(window.performance) && isPresent(window.performance.now)) {
2644
+ return window.performance.now();
2645
+ }
2646
+ else {
2647
+ return DateWrapper.toMillis(DateWrapper.now());
2648
+ }
2649
+ };
2650
+ BrowserDomAdapter.prototype.supportsCookies = function () { return true; };
2651
+ BrowserDomAdapter.prototype.getCookie = function (name) { return parseCookieValue(document.cookie, name); };
2652
+ BrowserDomAdapter.prototype.setCookie = function (name, value) {
2653
+ // document.cookie is magical, assigning into it assigns/overrides one cookie value, but does
2654
+ // not clear other cookies.
2655
+ document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
2656
+ };
2657
+ return BrowserDomAdapter;
2658
+ }(GenericBrowserDomAdapter));
2659
+ var baseElement = null;
2660
+ function getBaseElementHref() {
2661
+ if (isBlank(baseElement)) {
2662
+ baseElement = document.querySelector('base');
2663
+ if (isBlank(baseElement)) {
2664
+ return null;
2665
+ }
2666
+ }
2667
+ return baseElement.getAttribute('href');
2668
+ }
2669
+ // based on urlUtils.js in AngularJS 1
2670
+ var urlParsingNode = null;
2671
+ function relativePath(url /** TODO #9100 */) {
2672
+ if (isBlank(urlParsingNode)) {
2673
+ urlParsingNode = document.createElement('a');
2674
+ }
2675
+ urlParsingNode.setAttribute('href', url);
2676
+ return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname :
2677
+ '/' + urlParsingNode.pathname;
2678
+ }
2679
+ function parseCookieValue(cookie, name) {
2680
+ name = encodeURIComponent(name);
2681
+ var cookies = cookie.split(';');
2682
+ for (var _i = 0, cookies_1 = cookies; _i < cookies_1.length; _i++) {
2683
+ var cookie_1 = cookies_1[_i];
2684
+ var _a = cookie_1.split('=', 2), key = _a[0], value = _a[1];
2685
+ if (key.trim() === name) {
2686
+ return decodeURIComponent(value);
2687
+ }
2688
+ }
2689
+ return null;
2690
+ }
2691
+ var PublicTestability = (function () {
2692
+ function PublicTestability(testability) {
2693
+ this._testability = testability;
2694
+ }
2695
+ PublicTestability.prototype.isStable = function () { return this._testability.isStable(); };
2696
+ PublicTestability.prototype.whenStable = function (callback) { this._testability.whenStable(callback); };
2697
+ PublicTestability.prototype.findBindings = function (using, provider, exactMatch) {
2698
+ return this.findProviders(using, provider, exactMatch);
2699
+ };
2700
+ PublicTestability.prototype.findProviders = function (using, provider, exactMatch) {
2701
+ return this._testability.findBindings(using, provider, exactMatch);
2702
+ };
2703
+ return PublicTestability;
2704
+ }());
2705
+ var BrowserGetTestability = (function () {
2706
+ function BrowserGetTestability() {
2707
+ }
2708
+ BrowserGetTestability.init = function () { _angular_core.setTestabilityGetter(new BrowserGetTestability()); };
2709
+ BrowserGetTestability.prototype.addToWindow = function (registry) {
2710
+ global$1.getAngularTestability = function (elem, findInAncestors) {
2711
+ if (findInAncestors === void 0) { findInAncestors = true; }
2712
+ var testability = registry.findTestabilityInTree(elem, findInAncestors);
2713
+ if (testability == null) {
2714
+ throw new Error('Could not find testability for element.');
2715
+ }
2716
+ return new PublicTestability(testability);
2717
+ };
2718
+ global$1.getAllAngularTestabilities = function () {
2719
+ var testabilities = registry.getAllTestabilities();
2720
+ return testabilities.map(function (testability) { return new PublicTestability(testability); });
2721
+ };
2722
+ global$1.getAllAngularRootElements = function () { return registry.getAllRootElements(); };
2723
+ var whenAllStable = function (callback /** TODO #9100 */) {
2724
+ var testabilities = global$1.getAllAngularTestabilities();
2725
+ var count = testabilities.length;
2726
+ var didWork = false;
2727
+ var decrement = function (didWork_ /** TODO #9100 */) {
2728
+ didWork = didWork || didWork_;
2729
+ count--;
2730
+ if (count == 0) {
2731
+ callback(didWork);
2732
+ }
2733
+ };
2734
+ testabilities.forEach(function (testability /** TODO #9100 */) {
2735
+ testability.whenStable(decrement);
2736
+ });
2737
+ };
2738
+ if (!global$1.frameworkStabilizers) {
2739
+ global$1.frameworkStabilizers = ListWrapper.createGrowableSize(0);
2740
+ }
2741
+ global$1.frameworkStabilizers.push(whenAllStable);
2742
+ };
2743
+ BrowserGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
2744
+ if (elem == null) {
2745
+ return null;
2746
+ }
2747
+ var t = registry.getTestability(elem);
2748
+ if (isPresent(t)) {
2749
+ return t;
2750
+ }
2751
+ else if (!findInAncestors) {
2752
+ return null;
2753
+ }
2754
+ if (getDOM().isShadowRoot(elem)) {
2755
+ return this.findTestabilityInTree(registry, getDOM().getHost(elem), true);
2756
+ }
2757
+ return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true);
2758
+ };
2759
+ return BrowserGetTestability;
2760
+ }());
2761
+ var BROWSER_PLATFORM_MARKER = new _angular_core.OpaqueToken('BrowserPlatformMarker');
2762
+ /**
2763
+ * A set of providers to initialize the Angular platform in a web browser.
2764
+ *
2765
+ * Used automatically by `bootstrap`, or can be passed to {@link platform}.
2766
+ */
2767
+ var BROWSER_PLATFORM_PROVIDERS = [
2768
+ { provide: BROWSER_PLATFORM_MARKER, useValue: true }, _angular_core.PLATFORM_COMMON_PROVIDERS,
2769
+ { provide: _angular_core.PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true },
2770
+ { provide: _angular_common.PlatformLocation, useClass: BrowserPlatformLocation }
2771
+ ];
2772
+ var BROWSER_SANITIZATION_PROVIDERS = [
2773
+ { provide: SanitizationService, useExisting: DomSanitizationService },
2774
+ { provide: DomSanitizationService, useClass: DomSanitizationServiceImpl },
2775
+ ];
2776
+ /**
2777
+ * A set of providers to initialize an Angular application in a web browser.
2778
+ *
2779
+ * Used automatically by `bootstrap`, or can be passed to {@link PlatformRef.application}.
2780
+ */
2781
+ var BROWSER_APP_PROVIDERS = [
2782
+ _angular_core.APPLICATION_COMMON_PROVIDERS, _angular_common.FORM_PROVIDERS, BROWSER_SANITIZATION_PROVIDERS,
2783
+ { provide: _angular_core.ExceptionHandler, useFactory: _exceptionHandler, deps: [] },
2784
+ { provide: DOCUMENT, useFactory: _document, deps: [] },
2785
+ { provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true },
2786
+ { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true },
2787
+ { provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true },
2788
+ { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig },
2789
+ { provide: DomRootRenderer, useClass: DomRootRenderer_ },
2790
+ { provide: _angular_core.RootRenderer, useExisting: DomRootRenderer },
2791
+ { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
2792
+ { provide: AnimationDriver, useFactory: _resolveDefaultAnimationDriver }, DomSharedStylesHost,
2793
+ _angular_core.Testability, EventManager, ELEMENT_PROBE_PROVIDERS
2794
+ ];
2795
+ function browserPlatform() {
2796
+ if (isBlank(_angular_core.getPlatform())) {
2797
+ _angular_core.createPlatform(_angular_core.ReflectiveInjector.resolveAndCreate(BROWSER_PLATFORM_PROVIDERS));
2798
+ }
2799
+ return _angular_core.assertPlatform(BROWSER_PLATFORM_MARKER);
2800
+ }
2801
+ function initDomAdapter() {
2802
+ BrowserDomAdapter.makeCurrent();
2803
+ wtfInit();
2804
+ BrowserGetTestability.init();
2805
+ }
2806
+ function _exceptionHandler() {
2807
+ return new _angular_core.ExceptionHandler(getDOM());
2808
+ }
2809
+ function _document() {
2810
+ return getDOM().defaultDoc();
2811
+ }
2812
+ function _resolveDefaultAnimationDriver() {
2813
+ if (getDOM().supportsWebAnimation()) {
2814
+ return new WebAnimationsDriver();
2815
+ }
2816
+ return new NoOpAnimationDriver();
2817
+ }
2818
+ var PromiseCompleter = (function () {
2819
+ function PromiseCompleter() {
2820
+ var _this = this;
2821
+ this.promise = new Promise(function (res, rej) {
2822
+ _this.resolve = res;
2823
+ _this.reject = rej;
2824
+ });
2825
+ }
2826
+ return PromiseCompleter;
2827
+ }());
2828
+ var PromiseWrapper = (function () {
2829
+ function PromiseWrapper() {
2830
+ }
2831
+ PromiseWrapper.resolve = function (obj) { return Promise.resolve(obj); };
2832
+ PromiseWrapper.reject = function (obj, _) { return Promise.reject(obj); };
2833
+ // Note: We can't rename this method into `catch`, as this is not a valid
2834
+ // method name in Dart.
2835
+ PromiseWrapper.catchError = function (promise, onError) {
2836
+ return promise.catch(onError);
2837
+ };
2838
+ PromiseWrapper.all = function (promises) {
2839
+ if (promises.length == 0)
2840
+ return Promise.resolve([]);
2841
+ return Promise.all(promises);
2842
+ };
2843
+ PromiseWrapper.then = function (promise, success, rejection) {
2844
+ return promise.then(success, rejection);
2845
+ };
2846
+ PromiseWrapper.wrap = function (computation) {
2847
+ return new Promise(function (res, rej) {
2848
+ try {
2849
+ res(computation());
2850
+ }
2851
+ catch (e) {
2852
+ rej(e);
2853
+ }
2854
+ });
2855
+ };
2856
+ PromiseWrapper.scheduleMicrotask = function (computation) {
2857
+ PromiseWrapper.then(PromiseWrapper.resolve(null), computation, function (_) { });
2858
+ };
2859
+ PromiseWrapper.isPromise = function (obj) { return obj instanceof Promise; };
2860
+ PromiseWrapper.completer = function () { return new PromiseCompleter(); };
2861
+ return PromiseWrapper;
2862
+ }());
2863
+ var ObservableWrapper = (function () {
2864
+ function ObservableWrapper() {
2865
+ }
2866
+ // TODO(vsavkin): when we use rxnext, try inferring the generic type from the first arg
2867
+ ObservableWrapper.subscribe = function (emitter, onNext, onError, onComplete) {
2868
+ if (onComplete === void 0) { onComplete = function () { }; }
2869
+ onError = (typeof onError === 'function') && onError || noop;
2870
+ onComplete = (typeof onComplete === 'function') && onComplete || noop;
2871
+ return emitter.subscribe({ next: onNext, error: onError, complete: onComplete });
2872
+ };
2873
+ ObservableWrapper.isObservable = function (obs) { return !!obs.subscribe; };
2874
+ /**
2875
+ * Returns whether `obs` has any subscribers listening to events.
2876
+ */
2877
+ ObservableWrapper.hasSubscribers = function (obs) { return obs.observers.length > 0; };
2878
+ ObservableWrapper.dispose = function (subscription) { subscription.unsubscribe(); };
2879
+ /**
2880
+ * @deprecated - use callEmit() instead
2881
+ */
2882
+ ObservableWrapper.callNext = function (emitter, value) { emitter.next(value); };
2883
+ ObservableWrapper.callEmit = function (emitter, value) { emitter.emit(value); };
2884
+ ObservableWrapper.callError = function (emitter, error) { emitter.error(error); };
2885
+ ObservableWrapper.callComplete = function (emitter) { emitter.complete(); };
2886
+ ObservableWrapper.fromPromise = function (promise) {
2887
+ return rxjs_observable_PromiseObservable.PromiseObservable.create(promise);
2888
+ };
2889
+ ObservableWrapper.toPromise = function (obj) { return rxjs_operator_toPromise.toPromise.call(obj); };
2890
+ return ObservableWrapper;
2891
+ }());
2892
+ /**
2893
+ * Use by directives and components to emit custom Events.
2894
+ *
2895
+ * ### Examples
2896
+ *
2897
+ * In the following example, `Zippy` alternatively emits `open` and `close` events when its
2898
+ * title gets clicked:
2899
+ *
2900
+ * ```
2901
+ * @Component({
2902
+ * selector: 'zippy',
2903
+ * template: `
2904
+ * <div class="zippy">
2905
+ * <div (click)="toggle()">Toggle</div>
2906
+ * <div [hidden]="!visible">
2907
+ * <ng-content></ng-content>
2908
+ * </div>
2909
+ * </div>`})
2910
+ * export class Zippy {
2911
+ * visible: boolean = true;
2912
+ * @Output() open: EventEmitter<any> = new EventEmitter();
2913
+ * @Output() close: EventEmitter<any> = new EventEmitter();
2914
+ *
2915
+ * toggle() {
2916
+ * this.visible = !this.visible;
2917
+ * if (this.visible) {
2918
+ * this.open.emit(null);
2919
+ * } else {
2920
+ * this.close.emit(null);
2921
+ * }
2922
+ * }
2923
+ * }
2924
+ * ```
2925
+ *
2926
+ * The events payload can be accessed by the parameter `$event` on the components output event
2927
+ * handler:
2928
+ *
2929
+ * ```
2930
+ * <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
2931
+ * ```
2932
+ *
2933
+ * Uses Rx.Observable but provides an adapter to make it work as specified here:
2934
+ * https://github.com/jhusain/observable-spec
2935
+ *
2936
+ * Once a reference implementation of the spec is available, switch to it.
2937
+ * @stable
2938
+ */
2939
+ var EventEmitter = (function (_super) {
2940
+ __extends(EventEmitter, _super);
2941
+ /**
2942
+ * Creates an instance of [EventEmitter], which depending on [isAsync],
2943
+ * delivers events synchronously or asynchronously.
2944
+ */
2945
+ function EventEmitter(isAsync) {
2946
+ if (isAsync === void 0) { isAsync = false; }
2947
+ _super.call(this);
2948
+ this.__isAsync = isAsync;
2949
+ }
2950
+ EventEmitter.prototype.emit = function (value) { _super.prototype.next.call(this, value); };
2951
+ /**
2952
+ * @deprecated - use .emit(value) instead
2953
+ */
2954
+ EventEmitter.prototype.next = function (value) { _super.prototype.next.call(this, value); };
2955
+ EventEmitter.prototype.subscribe = function (generatorOrNext, error, complete) {
2956
+ var schedulerFn;
2957
+ var errorFn = function (err) { return null; };
2958
+ var completeFn = function () { return null; };
2959
+ if (generatorOrNext && typeof generatorOrNext === 'object') {
2960
+ schedulerFn = this.__isAsync ? function (value /** TODO #9100 */) {
2961
+ setTimeout(function () { return generatorOrNext.next(value); });
2962
+ } : function (value /** TODO #9100 */) { generatorOrNext.next(value); };
2963
+ if (generatorOrNext.error) {
2964
+ errorFn = this.__isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } :
2965
+ function (err) { generatorOrNext.error(err); };
2966
+ }
2967
+ if (generatorOrNext.complete) {
2968
+ completeFn = this.__isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } :
2969
+ function () { generatorOrNext.complete(); };
2970
+ }
2971
+ }
2972
+ else {
2973
+ schedulerFn = this.__isAsync ? function (value /** TODO #9100 */) {
2974
+ setTimeout(function () { return generatorOrNext(value); });
2975
+ } : function (value /** TODO #9100 */) { generatorOrNext(value); };
2976
+ if (error) {
2977
+ errorFn =
2978
+ this.__isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); };
2979
+ }
2980
+ if (complete) {
2981
+ completeFn =
2982
+ this.__isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); };
2983
+ }
2984
+ }
2985
+ return _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn);
2986
+ };
2987
+ return EventEmitter;
2988
+ }(rxjs_Subject.Subject));
2989
+ /**
2990
+ * Message Bus is a low level API used to communicate between the UI and the background.
2991
+ * Communication is based on a channel abstraction. Messages published in a
2992
+ * given channel to one MessageBusSink are received on the same channel
2993
+ * by the corresponding MessageBusSource.
2994
+ * @experimental
2995
+ */
2996
+ var MessageBus = (function () {
2997
+ function MessageBus() {
2998
+ }
2999
+ return MessageBus;
3000
+ }());
3001
+ var RenderStore = (function () {
3002
+ function RenderStore() {
3003
+ this._nextIndex = 0;
3004
+ this._lookupById = new Map();
3005
+ this._lookupByObject = new Map();
3006
+ }
3007
+ RenderStore.prototype.allocateId = function () { return this._nextIndex++; };
3008
+ RenderStore.prototype.store = function (obj, id) {
3009
+ this._lookupById.set(id, obj);
3010
+ this._lookupByObject.set(obj, id);
3011
+ };
3012
+ RenderStore.prototype.remove = function (obj) {
3013
+ var index = this._lookupByObject.get(obj);
3014
+ this._lookupByObject.delete(obj);
3015
+ this._lookupById.delete(index);
3016
+ };
3017
+ RenderStore.prototype.deserialize = function (id) {
3018
+ if (id == null) {
3019
+ return null;
3020
+ }
3021
+ if (!this._lookupById.has(id)) {
3022
+ return null;
3023
+ }
3024
+ return this._lookupById.get(id);
3025
+ };
3026
+ RenderStore.prototype.serialize = function (obj) {
3027
+ if (obj == null) {
3028
+ return null;
3029
+ }
3030
+ return this._lookupByObject.get(obj);
3031
+ };
3032
+ return RenderStore;
3033
+ }());
3034
+ /** @nocollapse */
3035
+ RenderStore.decorators = [
3036
+ { type: _angular_core.Injectable },
3037
+ ];
3038
+ /** @nocollapse */
3039
+ RenderStore.ctorParameters = [];
3040
+ // This file contains interface versions of browser types that can be serialized to Plain Old
3041
+ // JavaScript Objects
3042
+ var LocationType = (function () {
3043
+ function LocationType(href, protocol, host, hostname, port, pathname, search, hash, origin) {
3044
+ this.href = href;
3045
+ this.protocol = protocol;
3046
+ this.host = host;
3047
+ this.hostname = hostname;
3048
+ this.port = port;
3049
+ this.pathname = pathname;
3050
+ this.search = search;
3051
+ this.hash = hash;
3052
+ this.origin = origin;
3053
+ }
3054
+ return LocationType;
3055
+ }());
3056
+ // PRIMITIVE is any type that does not need to be serialized (string, number, boolean)
3057
+ // We set it to String so that it is considered a Type.
3058
+ /**
3059
+ * @experimental
3060
+ */
3061
+ var PRIMITIVE = String;
3062
+ var Serializer = (function () {
3063
+ function Serializer(_renderStore) {
3064
+ this._renderStore = _renderStore;
3065
+ }
3066
+ Serializer.prototype.serialize = function (obj, type) {
3067
+ var _this = this;
3068
+ if (!isPresent(obj)) {
3069
+ return null;
3070
+ }
3071
+ if (isArray(obj)) {
3072
+ return obj.map(function (v) { return _this.serialize(v, type); });
3073
+ }
3074
+ if (type == PRIMITIVE) {
3075
+ return obj;
3076
+ }
3077
+ if (type == RenderStoreObject) {
3078
+ return this._renderStore.serialize(obj);
3079
+ }
3080
+ else if (type === _angular_core.RenderComponentType) {
3081
+ return this._serializeRenderComponentType(obj);
3082
+ }
3083
+ else if (type === _angular_core.ViewEncapsulation) {
3084
+ return serializeEnum(obj);
3085
+ }
3086
+ else if (type === LocationType) {
3087
+ return this._serializeLocation(obj);
3088
+ }
3089
+ else {
3090
+ throw new BaseException$1('No serializer for ' + type.toString());
3091
+ }
3092
+ };
3093
+ Serializer.prototype.deserialize = function (map, type, data) {
3094
+ var _this = this;
3095
+ if (!isPresent(map)) {
3096
+ return null;
3097
+ }
3098
+ if (isArray(map)) {
3099
+ var obj = [];
3100
+ map.forEach(function (val) { return obj.push(_this.deserialize(val, type, data)); });
3101
+ return obj;
3102
+ }
3103
+ if (type == PRIMITIVE) {
3104
+ return map;
3105
+ }
3106
+ if (type == RenderStoreObject) {
3107
+ return this._renderStore.deserialize(map);
3108
+ }
3109
+ else if (type === _angular_core.RenderComponentType) {
3110
+ return this._deserializeRenderComponentType(map);
3111
+ }
3112
+ else if (type === _angular_core.ViewEncapsulation) {
3113
+ return VIEW_ENCAPSULATION_VALUES[map];
3114
+ }
3115
+ else if (type === LocationType) {
3116
+ return this._deserializeLocation(map);
3117
+ }
3118
+ else {
3119
+ throw new BaseException$1('No deserializer for ' + type.toString());
3120
+ }
3121
+ };
3122
+ Serializer.prototype._serializeLocation = function (loc) {
3123
+ return {
3124
+ 'href': loc.href,
3125
+ 'protocol': loc.protocol,
3126
+ 'host': loc.host,
3127
+ 'hostname': loc.hostname,
3128
+ 'port': loc.port,
3129
+ 'pathname': loc.pathname,
3130
+ 'search': loc.search,
3131
+ 'hash': loc.hash,
3132
+ 'origin': loc.origin
3133
+ };
3134
+ };
3135
+ Serializer.prototype._deserializeLocation = function (loc) {
3136
+ return new LocationType(loc['href'], loc['protocol'], loc['host'], loc['hostname'], loc['port'], loc['pathname'], loc['search'], loc['hash'], loc['origin']);
3137
+ };
3138
+ Serializer.prototype._serializeRenderComponentType = function (obj) {
3139
+ return {
3140
+ 'id': obj.id,
3141
+ 'templateUrl': obj.templateUrl,
3142
+ 'slotCount': obj.slotCount,
3143
+ 'encapsulation': this.serialize(obj.encapsulation, _angular_core.ViewEncapsulation),
3144
+ 'styles': this.serialize(obj.styles, PRIMITIVE)
3145
+ };
3146
+ };
3147
+ Serializer.prototype._deserializeRenderComponentType = function (map) {
3148
+ return new _angular_core.RenderComponentType(map['id'], map['templateUrl'], map['slotCount'], this.deserialize(map['encapsulation'], _angular_core.ViewEncapsulation), this.deserialize(map['styles'], PRIMITIVE));
3149
+ };
3150
+ return Serializer;
3151
+ }());
3152
+ /** @nocollapse */
3153
+ Serializer.decorators = [
3154
+ { type: _angular_core.Injectable },
3155
+ ];
3156
+ /** @nocollapse */
3157
+ Serializer.ctorParameters = [
3158
+ { type: RenderStore, },
3159
+ ];
3160
+ var RenderStoreObject = (function () {
3161
+ function RenderStoreObject() {
3162
+ }
3163
+ return RenderStoreObject;
3164
+ }());
3165
+ /**
3166
+ * @experimental
3167
+ */
3168
+ var ClientMessageBrokerFactory = (function () {
3169
+ function ClientMessageBrokerFactory() {
3170
+ }
3171
+ return ClientMessageBrokerFactory;
3172
+ }());
3173
+ var ClientMessageBrokerFactory_ = (function (_super) {
3174
+ __extends(ClientMessageBrokerFactory_, _super);
3175
+ function ClientMessageBrokerFactory_(_messageBus, _serializer) {
3176
+ _super.call(this);
3177
+ this._messageBus = _messageBus;
3178
+ this._serializer = _serializer;
3179
+ }
3180
+ /**
3181
+ * Initializes the given channel and attaches a new {@link ClientMessageBroker} to it.
3182
+ */
3183
+ ClientMessageBrokerFactory_.prototype.createMessageBroker = function (channel, runInZone) {
3184
+ if (runInZone === void 0) { runInZone = true; }
3185
+ this._messageBus.initChannel(channel, runInZone);
3186
+ return new ClientMessageBroker_(this._messageBus, this._serializer, channel);
3187
+ };
3188
+ return ClientMessageBrokerFactory_;
3189
+ }(ClientMessageBrokerFactory));
3190
+ /** @nocollapse */
3191
+ ClientMessageBrokerFactory_.decorators = [
3192
+ { type: _angular_core.Injectable },
3193
+ ];
3194
+ /** @nocollapse */
3195
+ ClientMessageBrokerFactory_.ctorParameters = [
3196
+ { type: MessageBus, },
3197
+ { type: Serializer, },
3198
+ ];
3199
+ /**
3200
+ * @experimental
3201
+ */
3202
+ var ClientMessageBroker = (function () {
3203
+ function ClientMessageBroker() {
3204
+ }
3205
+ return ClientMessageBroker;
3206
+ }());
3207
+ var ClientMessageBroker_ = (function (_super) {
3208
+ __extends(ClientMessageBroker_, _super);
3209
+ function ClientMessageBroker_(messageBus, _serializer, channel /** TODO #9100 */) {
3210
+ var _this = this;
3211
+ _super.call(this);
3212
+ this.channel = channel;
3213
+ this._pending = new Map();
3214
+ this._sink = messageBus.to(channel);
3215
+ this._serializer = _serializer;
3216
+ var source = messageBus.from(channel);
3217
+ ObservableWrapper.subscribe(source, function (message) { return _this._handleMessage(message); });
3218
+ }
3219
+ ClientMessageBroker_.prototype._generateMessageId = function (name) {
3220
+ var time = stringify(DateWrapper.toMillis(DateWrapper.now()));
3221
+ var iteration = 0;
3222
+ var id = name + time + stringify(iteration);
3223
+ while (isPresent(this._pending[id])) {
3224
+ id = "" + name + time + iteration;
3225
+ iteration++;
3226
+ }
3227
+ return id;
3228
+ };
3229
+ ClientMessageBroker_.prototype.runOnService = function (args, returnType) {
3230
+ var _this = this;
3231
+ var fnArgs = [];
3232
+ if (isPresent(args.args)) {
3233
+ args.args.forEach(function (argument) {
3234
+ if (argument.type != null) {
3235
+ fnArgs.push(_this._serializer.serialize(argument.value, argument.type));
3236
+ }
3237
+ else {
3238
+ fnArgs.push(argument.value);
3239
+ }
3240
+ });
3241
+ }
3242
+ var promise;
3243
+ var id = null;
3244
+ if (returnType != null) {
3245
+ var completer = PromiseWrapper.completer();
3246
+ id = this._generateMessageId(args.method);
3247
+ this._pending.set(id, completer);
3248
+ PromiseWrapper.catchError(completer.promise, function (err, stack) {
3249
+ print(err);
3250
+ completer.reject(err, stack);
3251
+ });
3252
+ promise = PromiseWrapper.then(completer.promise, function (value) {
3253
+ if (_this._serializer == null) {
3254
+ return value;
3255
+ }
3256
+ else {
3257
+ return _this._serializer.deserialize(value, returnType);
3258
+ }
3259
+ });
3260
+ }
3261
+ else {
3262
+ promise = null;
3263
+ }
3264
+ // TODO(jteplitz602): Create a class for these messages so we don't keep using StringMap #3685
3265
+ var message = { 'method': args.method, 'args': fnArgs };
3266
+ if (id != null) {
3267
+ message['id'] = id;
3268
+ }
3269
+ ObservableWrapper.callEmit(this._sink, message);
3270
+ return promise;
3271
+ };
3272
+ ClientMessageBroker_.prototype._handleMessage = function (message) {
3273
+ var data = new MessageData(message);
3274
+ // TODO(jteplitz602): replace these strings with messaging constants #3685
3275
+ if (StringWrapper.equals(data.type, 'result') || StringWrapper.equals(data.type, 'error')) {
3276
+ var id = data.id;
3277
+ if (this._pending.has(id)) {
3278
+ if (StringWrapper.equals(data.type, 'result')) {
3279
+ this._pending.get(id).resolve(data.value);
3280
+ }
3281
+ else {
3282
+ this._pending.get(id).reject(data.value, null);
3283
+ }
3284
+ this._pending.delete(id);
3285
+ }
3286
+ }
3287
+ };
3288
+ return ClientMessageBroker_;
3289
+ }(ClientMessageBroker));
3290
+ var MessageData = (function () {
3291
+ function MessageData(data) {
3292
+ this.type = StringMapWrapper.get(data, 'type');
3293
+ this.id = this._getValueIfPresent(data, 'id');
3294
+ this.value = this._getValueIfPresent(data, 'value');
3295
+ }
3296
+ /**
3297
+ * Returns the value from the StringMap if present. Otherwise returns null
3298
+ * @internal
3299
+ */
3300
+ MessageData.prototype._getValueIfPresent = function (data, key) {
3301
+ if (StringMapWrapper.contains(data, key)) {
3302
+ return StringMapWrapper.get(data, key);
3303
+ }
3304
+ else {
3305
+ return null;
3306
+ }
3307
+ };
3308
+ return MessageData;
3309
+ }());
3310
+ /**
3311
+ * @experimental
3312
+ */
3313
+ var FnArg = (function () {
3314
+ function FnArg(value /** TODO #9100 */, type) {
3315
+ this.value = value;
3316
+ this.type = type;
3317
+ }
3318
+ return FnArg;
3319
+ }());
3320
+ /**
3321
+ * @experimental
3322
+ */
3323
+ var UiArguments = (function () {
3324
+ function UiArguments(method, args) {
3325
+ this.method = method;
3326
+ this.args = args;
3327
+ }
3328
+ return UiArguments;
3329
+ }());
3330
+ var ServiceMessageBrokerFactory = (function () {
3331
+ function ServiceMessageBrokerFactory() {
3332
+ }
3333
+ return ServiceMessageBrokerFactory;
3334
+ }());
3335
+ var ServiceMessageBrokerFactory_ = (function (_super) {
3336
+ __extends(ServiceMessageBrokerFactory_, _super);
3337
+ function ServiceMessageBrokerFactory_(_messageBus, _serializer) {
3338
+ _super.call(this);
3339
+ this._messageBus = _messageBus;
3340
+ this._serializer = _serializer;
3341
+ }
3342
+ ServiceMessageBrokerFactory_.prototype.createMessageBroker = function (channel, runInZone) {
3343
+ if (runInZone === void 0) { runInZone = true; }
3344
+ this._messageBus.initChannel(channel, runInZone);
3345
+ return new ServiceMessageBroker_(this._messageBus, this._serializer, channel);
3346
+ };
3347
+ return ServiceMessageBrokerFactory_;
3348
+ }(ServiceMessageBrokerFactory));
3349
+ /** @nocollapse */
3350
+ ServiceMessageBrokerFactory_.decorators = [
3351
+ { type: _angular_core.Injectable },
3352
+ ];
3353
+ /** @nocollapse */
3354
+ ServiceMessageBrokerFactory_.ctorParameters = [
3355
+ { type: MessageBus, },
3356
+ { type: Serializer, },
3357
+ ];
3358
+ /**
3359
+ * @experimental
3360
+ */
3361
+ var ServiceMessageBroker = (function () {
3362
+ function ServiceMessageBroker() {
3363
+ }
3364
+ return ServiceMessageBroker;
3365
+ }());
3366
+ /**
3367
+ * Helper class for UIComponents that allows components to register methods.
3368
+ * If a registered method message is received from the broker on the worker,
3369
+ * the UIMessageBroker deserializes its arguments and calls the registered method.
3370
+ * If that method returns a promise, the UIMessageBroker returns the result to the worker.
3371
+ */
3372
+ var ServiceMessageBroker_ = (function (_super) {
3373
+ __extends(ServiceMessageBroker_, _super);
3374
+ function ServiceMessageBroker_(messageBus, _serializer, channel /** TODO #9100 */) {
3375
+ var _this = this;
3376
+ _super.call(this);
3377
+ this._serializer = _serializer;
3378
+ this.channel = channel;
3379
+ this._methods = new Map$1();
3380
+ this._sink = messageBus.to(channel);
3381
+ var source = messageBus.from(channel);
3382
+ ObservableWrapper.subscribe(source, function (message) { return _this._handleMessage(message); });
3383
+ }
3384
+ ServiceMessageBroker_.prototype.registerMethod = function (methodName, signature, method, returnType) {
3385
+ var _this = this;
3386
+ this._methods.set(methodName, function (message) {
3387
+ var serializedArgs = message.args;
3388
+ var numArgs = signature === null ? 0 : signature.length;
3389
+ var deserializedArgs = ListWrapper.createFixedSize(numArgs);
3390
+ for (var i = 0; i < numArgs; i++) {
3391
+ var serializedArg = serializedArgs[i];
3392
+ deserializedArgs[i] = _this._serializer.deserialize(serializedArg, signature[i]);
3393
+ }
3394
+ var promise = FunctionWrapper.apply(method, deserializedArgs);
3395
+ if (isPresent(returnType) && isPresent(promise)) {
3396
+ _this._wrapWebWorkerPromise(message.id, promise, returnType);
3397
+ }
3398
+ });
3399
+ };
3400
+ ServiceMessageBroker_.prototype._handleMessage = function (map) {
3401
+ var message = new ReceivedMessage(map);
3402
+ if (this._methods.has(message.method)) {
3403
+ this._methods.get(message.method)(message);
3404
+ }
3405
+ };
3406
+ ServiceMessageBroker_.prototype._wrapWebWorkerPromise = function (id, promise, type) {
3407
+ var _this = this;
3408
+ PromiseWrapper.then(promise, function (result) {
3409
+ ObservableWrapper.callEmit(_this._sink, { 'type': 'result', 'value': _this._serializer.serialize(result, type), 'id': id });
3410
+ });
3411
+ };
3412
+ return ServiceMessageBroker_;
3413
+ }(ServiceMessageBroker));
3414
+ /**
3415
+ * @experimental
3416
+ */
3417
+ var ReceivedMessage = (function () {
3418
+ function ReceivedMessage(data) {
3419
+ this.method = data['method'];
3420
+ this.args = data['args'];
3421
+ this.id = data['id'];
3422
+ this.type = data['type'];
3423
+ }
3424
+ return ReceivedMessage;
3425
+ }());
3426
+ /**
3427
+ * All channels used by angular's WebWorker components are listed here.
3428
+ * You should not use these channels in your application code.
3429
+ */
3430
+ var RENDERER_CHANNEL = 'ng-Renderer';
3431
+ var EVENT_CHANNEL = 'ng-Events';
3432
+ var ROUTER_CHANNEL = 'ng-Router';
3433
+ // no deserialization is necessary in TS.
3434
+ // This is only here to match dart interface
3435
+ function deserializeGenericEvent(serializedEvent) {
3436
+ return serializedEvent;
3437
+ }
3438
+ var WebWorkerPlatformLocation = (function (_super) {
3439
+ __extends(WebWorkerPlatformLocation, _super);
3440
+ function WebWorkerPlatformLocation(brokerFactory, bus, _serializer) {
3441
+ var _this = this;
3442
+ _super.call(this);
3443
+ this._serializer = _serializer;
3444
+ this._popStateListeners = [];
3445
+ this._hashChangeListeners = [];
3446
+ this._location = null;
3447
+ this._broker = brokerFactory.createMessageBroker(ROUTER_CHANNEL);
3448
+ this._channelSource = bus.from(ROUTER_CHANNEL);
3449
+ ObservableWrapper.subscribe(this._channelSource, function (msg) {
3450
+ var listeners = null;
3451
+ if (StringMapWrapper.contains(msg, 'event')) {
3452
+ var type = msg['event']['type'];
3453
+ if (StringWrapper.equals(type, 'popstate')) {
3454
+ listeners = _this._popStateListeners;
3455
+ }
3456
+ else if (StringWrapper.equals(type, 'hashchange')) {
3457
+ listeners = _this._hashChangeListeners;
3458
+ }
3459
+ if (listeners !== null) {
3460
+ var e_1 = deserializeGenericEvent(msg['event']);
3461
+ // There was a popState or hashChange event, so the location object thas been updated
3462
+ _this._location = _this._serializer.deserialize(msg['location'], LocationType);
3463
+ listeners.forEach(function (fn) { return fn(e_1); });
3464
+ }
3465
+ }
3466
+ });
3467
+ }
3468
+ /** @internal **/
3469
+ WebWorkerPlatformLocation.prototype.init = function () {
3470
+ var _this = this;
3471
+ var args = new UiArguments('getLocation');
3472
+ var locationPromise = this._broker.runOnService(args, LocationType);
3473
+ return PromiseWrapper.then(locationPromise, function (val) {
3474
+ _this._location = val;
3475
+ return true;
3476
+ }, function (err) { throw new BaseException$1(err); });
3477
+ };
3478
+ WebWorkerPlatformLocation.prototype.getBaseHrefFromDOM = function () {
3479
+ throw new BaseException$1('Attempt to get base href from DOM from WebWorker. You must either provide a value for the APP_BASE_HREF token through DI or use the hash location strategy.');
3480
+ };
3481
+ WebWorkerPlatformLocation.prototype.onPopState = function (fn) { this._popStateListeners.push(fn); };
3482
+ WebWorkerPlatformLocation.prototype.onHashChange = function (fn) { this._hashChangeListeners.push(fn); };
3483
+ Object.defineProperty(WebWorkerPlatformLocation.prototype, "pathname", {
3484
+ get: function () {
3485
+ if (this._location === null) {
3486
+ return null;
3487
+ }
3488
+ return this._location.pathname;
3489
+ },
3490
+ set: function (newPath) {
3491
+ if (this._location === null) {
3492
+ throw new BaseException$1('Attempt to set pathname before value is obtained from UI');
3493
+ }
3494
+ this._location.pathname = newPath;
3495
+ var fnArgs = [new FnArg(newPath, PRIMITIVE)];
3496
+ var args = new UiArguments('setPathname', fnArgs);
3497
+ this._broker.runOnService(args, null);
3498
+ },
3499
+ enumerable: true,
3500
+ configurable: true
3501
+ });
3502
+ Object.defineProperty(WebWorkerPlatformLocation.prototype, "search", {
3503
+ get: function () {
3504
+ if (this._location === null) {
3505
+ return null;
3506
+ }
3507
+ return this._location.search;
3508
+ },
3509
+ enumerable: true,
3510
+ configurable: true
3511
+ });
3512
+ Object.defineProperty(WebWorkerPlatformLocation.prototype, "hash", {
3513
+ get: function () {
3514
+ if (this._location === null) {
3515
+ return null;
3516
+ }
3517
+ return this._location.hash;
3518
+ },
3519
+ enumerable: true,
3520
+ configurable: true
3521
+ });
3522
+ WebWorkerPlatformLocation.prototype.pushState = function (state, title, url) {
3523
+ var fnArgs = [new FnArg(state, PRIMITIVE), new FnArg(title, PRIMITIVE), new FnArg(url, PRIMITIVE)];
3524
+ var args = new UiArguments('pushState', fnArgs);
3525
+ this._broker.runOnService(args, null);
3526
+ };
3527
+ WebWorkerPlatformLocation.prototype.replaceState = function (state, title, url) {
3528
+ var fnArgs = [new FnArg(state, PRIMITIVE), new FnArg(title, PRIMITIVE), new FnArg(url, PRIMITIVE)];
3529
+ var args = new UiArguments('replaceState', fnArgs);
3530
+ this._broker.runOnService(args, null);
3531
+ };
3532
+ WebWorkerPlatformLocation.prototype.forward = function () {
3533
+ var args = new UiArguments('forward');
3534
+ this._broker.runOnService(args, null);
3535
+ };
3536
+ WebWorkerPlatformLocation.prototype.back = function () {
3537
+ var args = new UiArguments('back');
3538
+ this._broker.runOnService(args, null);
3539
+ };
3540
+ return WebWorkerPlatformLocation;
3541
+ }(_angular_common.PlatformLocation));
3542
+ /** @nocollapse */
3543
+ WebWorkerPlatformLocation.decorators = [
3544
+ { type: _angular_core.Injectable },
3545
+ ];
3546
+ /** @nocollapse */
3547
+ WebWorkerPlatformLocation.ctorParameters = [
3548
+ { type: ClientMessageBrokerFactory, },
3549
+ { type: MessageBus, },
3550
+ { type: Serializer, },
3551
+ ];
3552
+ /**
3553
+ * Those providers should be added when the router is used in a worker context in addition to the
3554
+ * {@link ROUTER_PROVIDERS} and after them.
3555
+ * @experimental
3556
+ */
3557
+ var WORKER_APP_LOCATION_PROVIDERS = [
3558
+ { provide: _angular_common.PlatformLocation, useClass: WebWorkerPlatformLocation }, {
3559
+ provide: _angular_core.APP_INITIALIZER,
3560
+ useFactory: appInitFnFactory,
3561
+ multi: true,
3562
+ deps: [_angular_common.PlatformLocation, _angular_core.NgZone]
3563
+ }
3564
+ ];
3565
+ function appInitFnFactory(platformLocation, zone) {
3566
+ return function () { return zone.runGuarded(function () { return platformLocation.init(); }); };
3567
+ }
3568
+ var MessageBasedPlatformLocation = (function () {
3569
+ function MessageBasedPlatformLocation(_brokerFactory, _platformLocation, bus, _serializer) {
3570
+ this._brokerFactory = _brokerFactory;
3571
+ this._platformLocation = _platformLocation;
3572
+ this._serializer = _serializer;
3573
+ this._platformLocation.onPopState(FunctionWrapper.bind(this._sendUrlChangeEvent, this));
3574
+ this._platformLocation.onHashChange(FunctionWrapper.bind(this._sendUrlChangeEvent, this));
3575
+ this._broker = this._brokerFactory.createMessageBroker(ROUTER_CHANNEL);
3576
+ this._channelSink = bus.to(ROUTER_CHANNEL);
3577
+ }
3578
+ MessageBasedPlatformLocation.prototype.start = function () {
3579
+ this._broker.registerMethod('getLocation', null, FunctionWrapper.bind(this._getLocation, this), LocationType);
3580
+ this._broker.registerMethod('setPathname', [PRIMITIVE], FunctionWrapper.bind(this._setPathname, this));
3581
+ this._broker.registerMethod('pushState', [PRIMITIVE, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._platformLocation.pushState, this._platformLocation));
3582
+ this._broker.registerMethod('replaceState', [PRIMITIVE, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._platformLocation.replaceState, this._platformLocation));
3583
+ this._broker.registerMethod('forward', null, FunctionWrapper.bind(this._platformLocation.forward, this._platformLocation));
3584
+ this._broker.registerMethod('back', null, FunctionWrapper.bind(this._platformLocation.back, this._platformLocation));
3585
+ };
3586
+ MessageBasedPlatformLocation.prototype._getLocation = function () {
3587
+ return PromiseWrapper.resolve(this._platformLocation.location);
3588
+ };
3589
+ MessageBasedPlatformLocation.prototype._sendUrlChangeEvent = function (e) {
3590
+ var loc = this._serializer.serialize(this._platformLocation.location, LocationType);
3591
+ var serializedEvent = { 'type': e.type };
3592
+ ObservableWrapper.callEmit(this._channelSink, { 'event': serializedEvent, 'location': loc });
3593
+ };
3594
+ MessageBasedPlatformLocation.prototype._setPathname = function (pathname) { this._platformLocation.pathname = pathname; };
3595
+ return MessageBasedPlatformLocation;
3596
+ }());
3597
+ /** @nocollapse */
3598
+ MessageBasedPlatformLocation.decorators = [
3599
+ { type: _angular_core.Injectable },
3600
+ ];
3601
+ /** @nocollapse */
3602
+ MessageBasedPlatformLocation.ctorParameters = [
3603
+ { type: ServiceMessageBrokerFactory, },
3604
+ { type: BrowserPlatformLocation, },
3605
+ { type: MessageBus, },
3606
+ { type: Serializer, },
3607
+ ];
3608
+ /**
3609
+ * A list of {@link Provider}s. To use the router in a Worker enabled application you must
3610
+ * include these providers when setting up the render thread.
3611
+ * @experimental
3612
+ */
3613
+ var WORKER_UI_LOCATION_PROVIDERS = [
3614
+ MessageBasedPlatformLocation, BrowserPlatformLocation,
3615
+ { provide: _angular_core.APP_INITIALIZER, useFactory: initUiLocation, multi: true, deps: [_angular_core.Injector] }
3616
+ ];
3617
+ function initUiLocation(injector) {
3618
+ return function () {
3619
+ var zone = injector.get(_angular_core.NgZone);
3620
+ zone.runGuarded(function () { return injector.get(MessageBasedPlatformLocation).start(); });
3621
+ };
3622
+ }
3623
+ var ON_WEB_WORKER = new _angular_core.OpaqueToken('WebWorker.onWebWorker');
3624
+ var PostMessageBusSink = (function () {
3625
+ function PostMessageBusSink(_postMessageTarget) {
3626
+ this._postMessageTarget = _postMessageTarget;
3627
+ this._channels = StringMapWrapper.create();
3628
+ this._messageBuffer = [];
3629
+ }
3630
+ PostMessageBusSink.prototype.attachToZone = function (zone) {
3631
+ var _this = this;
3632
+ this._zone = zone;
3633
+ this._zone.runOutsideAngular(function () {
3634
+ ObservableWrapper.subscribe(_this._zone.onStable, function (_) { _this._handleOnEventDone(); });
3635
+ });
3636
+ };
3637
+ PostMessageBusSink.prototype.initChannel = function (channel, runInZone) {
3638
+ var _this = this;
3639
+ if (runInZone === void 0) { runInZone = true; }
3640
+ if (StringMapWrapper.contains(this._channels, channel)) {
3641
+ throw new BaseException$1(channel + " has already been initialized");
3642
+ }
3643
+ var emitter = new EventEmitter(false);
3644
+ var channelInfo = new _Channel(emitter, runInZone);
3645
+ this._channels[channel] = channelInfo;
3646
+ emitter.subscribe(function (data) {
3647
+ var message = { channel: channel, message: data };
3648
+ if (runInZone) {
3649
+ _this._messageBuffer.push(message);
3650
+ }
3651
+ else {
3652
+ _this._sendMessages([message]);
3653
+ }
3654
+ });
3655
+ };
3656
+ PostMessageBusSink.prototype.to = function (channel) {
3657
+ if (StringMapWrapper.contains(this._channels, channel)) {
3658
+ return this._channels[channel].emitter;
3659
+ }
3660
+ else {
3661
+ throw new BaseException$1(channel + " is not set up. Did you forget to call initChannel?");
3662
+ }
3663
+ };
3664
+ PostMessageBusSink.prototype._handleOnEventDone = function () {
3665
+ if (this._messageBuffer.length > 0) {
3666
+ this._sendMessages(this._messageBuffer);
3667
+ this._messageBuffer = [];
3668
+ }
3669
+ };
3670
+ PostMessageBusSink.prototype._sendMessages = function (messages) { this._postMessageTarget.postMessage(messages); };
3671
+ return PostMessageBusSink;
3672
+ }());
3673
+ var PostMessageBusSource = (function () {
3674
+ function PostMessageBusSource(eventTarget) {
3675
+ var _this = this;
3676
+ this._channels = StringMapWrapper.create();
3677
+ if (eventTarget) {
3678
+ eventTarget.addEventListener('message', function (ev) { return _this._handleMessages(ev); });
3679
+ }
3680
+ else {
3681
+ // if no eventTarget is given we assume we're in a WebWorker and listen on the global scope
3682
+ var workerScope = self;
3683
+ workerScope.addEventListener('message', function (ev) { return _this._handleMessages(ev); });
3684
+ }
3685
+ }
3686
+ PostMessageBusSource.prototype.attachToZone = function (zone) { this._zone = zone; };
3687
+ PostMessageBusSource.prototype.initChannel = function (channel, runInZone) {
3688
+ if (runInZone === void 0) { runInZone = true; }
3689
+ if (StringMapWrapper.contains(this._channels, channel)) {
3690
+ throw new BaseException$1(channel + " has already been initialized");
3691
+ }
3692
+ var emitter = new EventEmitter(false);
3693
+ var channelInfo = new _Channel(emitter, runInZone);
3694
+ this._channels[channel] = channelInfo;
3695
+ };
3696
+ PostMessageBusSource.prototype.from = function (channel) {
3697
+ if (StringMapWrapper.contains(this._channels, channel)) {
3698
+ return this._channels[channel].emitter;
3699
+ }
3700
+ else {
3701
+ throw new BaseException$1(channel + " is not set up. Did you forget to call initChannel?");
3702
+ }
3703
+ };
3704
+ PostMessageBusSource.prototype._handleMessages = function (ev) {
3705
+ var messages = ev.data;
3706
+ for (var i = 0; i < messages.length; i++) {
3707
+ this._handleMessage(messages[i]);
3708
+ }
3709
+ };
3710
+ PostMessageBusSource.prototype._handleMessage = function (data) {
3711
+ var channel = data.channel;
3712
+ if (StringMapWrapper.contains(this._channels, channel)) {
3713
+ var channelInfo = this._channels[channel];
3714
+ if (channelInfo.runInZone) {
3715
+ this._zone.run(function () { channelInfo.emitter.emit(data.message); });
3716
+ }
3717
+ else {
3718
+ channelInfo.emitter.emit(data.message);
3719
+ }
3720
+ }
3721
+ };
3722
+ return PostMessageBusSource;
3723
+ }());
3724
+ var PostMessageBus = (function () {
3725
+ function PostMessageBus(sink, source) {
3726
+ this.sink = sink;
3727
+ this.source = source;
3728
+ }
3729
+ PostMessageBus.prototype.attachToZone = function (zone) {
3730
+ this.source.attachToZone(zone);
3731
+ this.sink.attachToZone(zone);
3732
+ };
3733
+ PostMessageBus.prototype.initChannel = function (channel, runInZone) {
3734
+ if (runInZone === void 0) { runInZone = true; }
3735
+ this.source.initChannel(channel, runInZone);
3736
+ this.sink.initChannel(channel, runInZone);
3737
+ };
3738
+ PostMessageBus.prototype.from = function (channel) { return this.source.from(channel); };
3739
+ PostMessageBus.prototype.to = function (channel) { return this.sink.to(channel); };
3740
+ return PostMessageBus;
3741
+ }());
3742
+ /** @nocollapse */
3743
+ PostMessageBus.decorators = [
3744
+ { type: _angular_core.Injectable },
3745
+ ];
3746
+ /** @nocollapse */
3747
+ PostMessageBus.ctorParameters = [
3748
+ { type: PostMessageBusSink, },
3749
+ { type: PostMessageBusSource, },
3750
+ ];
3751
+ /**
3752
+ * Helper class that wraps a channel's {@link EventEmitter} and
3753
+ * keeps track of if it should run in the zone.
3754
+ */
3755
+ var _Channel = (function () {
3756
+ function _Channel(emitter, runInZone) {
3757
+ this.emitter = emitter;
3758
+ this.runInZone = runInZone;
3759
+ }
3760
+ return _Channel;
3761
+ }());
3762
+ var MOUSE_EVENT_PROPERTIES = [
3763
+ 'altKey', 'button', 'clientX', 'clientY', 'metaKey', 'movementX', 'movementY', 'offsetX',
3764
+ 'offsetY', 'region', 'screenX', 'screenY', 'shiftKey'
3765
+ ];
3766
+ var KEYBOARD_EVENT_PROPERTIES = [
3767
+ 'altkey', 'charCode', 'code', 'ctrlKey', 'isComposing', 'key', 'keyCode', 'location', 'metaKey',
3768
+ 'repeat', 'shiftKey', 'which'
3769
+ ];
3770
+ var TRANSITION_EVENT_PROPERTIES = ['propertyName', 'elapsedTime', 'pseudoElement'];
3771
+ var EVENT_PROPERTIES = ['type', 'bubbles', 'cancelable'];
3772
+ var NODES_WITH_VALUE = new Set$1(['input', 'select', 'option', 'button', 'li', 'meter', 'progress', 'param', 'textarea']);
3773
+ function serializeGenericEvent(e) {
3774
+ return serializeEvent(e, EVENT_PROPERTIES);
3775
+ }
3776
+ // TODO(jteplitz602): Allow users to specify the properties they need rather than always
3777
+ // adding value and files #3374
3778
+ function serializeEventWithTarget(e) {
3779
+ var serializedEvent = serializeEvent(e, EVENT_PROPERTIES);
3780
+ return addTarget(e, serializedEvent);
3781
+ }
3782
+ function serializeMouseEvent(e) {
3783
+ return serializeEvent(e, MOUSE_EVENT_PROPERTIES);
3784
+ }
3785
+ function serializeKeyboardEvent(e) {
3786
+ var serializedEvent = serializeEvent(e, KEYBOARD_EVENT_PROPERTIES);
3787
+ return addTarget(e, serializedEvent);
3788
+ }
3789
+ function serializeTransitionEvent(e) {
3790
+ var serializedEvent = serializeEvent(e, TRANSITION_EVENT_PROPERTIES);
3791
+ return addTarget(e, serializedEvent);
3792
+ }
3793
+ // TODO(jteplitz602): #3374. See above.
3794
+ function addTarget(e, serializedEvent) {
3795
+ if (NODES_WITH_VALUE.has(e.target.tagName.toLowerCase())) {
3796
+ var target = e.target;
3797
+ serializedEvent['target'] = { 'value': target.value };
3798
+ if (isPresent(target.files)) {
3799
+ serializedEvent['target']['files'] = target.files;
3800
+ }
3801
+ }
3802
+ return serializedEvent;
3803
+ }
3804
+ function serializeEvent(e, properties) {
3805
+ var serialized = {};
3806
+ for (var i = 0; i < properties.length; i++) {
3807
+ var prop = properties[i];
3808
+ serialized[prop] = e[prop];
3809
+ }
3810
+ return serialized;
3811
+ }
3812
+ var EventDispatcher = (function () {
3813
+ function EventDispatcher(_sink, _serializer) {
3814
+ this._sink = _sink;
3815
+ this._serializer = _serializer;
3816
+ }
3817
+ EventDispatcher.prototype.dispatchRenderEvent = function (element, eventTarget, eventName, event) {
3818
+ var serializedEvent;
3819
+ // TODO (jteplitz602): support custom events #3350
3820
+ switch (event.type) {
3821
+ case 'click':
3822
+ case 'mouseup':
3823
+ case 'mousedown':
3824
+ case 'dblclick':
3825
+ case 'contextmenu':
3826
+ case 'mouseenter':
3827
+ case 'mouseleave':
3828
+ case 'mousemove':
3829
+ case 'mouseout':
3830
+ case 'mouseover':
3831
+ case 'show':
3832
+ serializedEvent = serializeMouseEvent(event);
3833
+ break;
3834
+ case 'keydown':
3835
+ case 'keypress':
3836
+ case 'keyup':
3837
+ serializedEvent = serializeKeyboardEvent(event);
3838
+ break;
3839
+ case 'input':
3840
+ case 'change':
3841
+ case 'blur':
3842
+ serializedEvent = serializeEventWithTarget(event);
3843
+ break;
3844
+ case 'abort':
3845
+ case 'afterprint':
3846
+ case 'beforeprint':
3847
+ case 'cached':
3848
+ case 'canplay':
3849
+ case 'canplaythrough':
3850
+ case 'chargingchange':
3851
+ case 'chargingtimechange':
3852
+ case 'close':
3853
+ case 'dischargingtimechange':
3854
+ case 'DOMContentLoaded':
3855
+ case 'downloading':
3856
+ case 'durationchange':
3857
+ case 'emptied':
3858
+ case 'ended':
3859
+ case 'error':
3860
+ case 'fullscreenchange':
3861
+ case 'fullscreenerror':
3862
+ case 'invalid':
3863
+ case 'languagechange':
3864
+ case 'levelfchange':
3865
+ case 'loadeddata':
3866
+ case 'loadedmetadata':
3867
+ case 'obsolete':
3868
+ case 'offline':
3869
+ case 'online':
3870
+ case 'open':
3871
+ case 'orientatoinchange':
3872
+ case 'pause':
3873
+ case 'pointerlockchange':
3874
+ case 'pointerlockerror':
3875
+ case 'play':
3876
+ case 'playing':
3877
+ case 'ratechange':
3878
+ case 'readystatechange':
3879
+ case 'reset':
3880
+ case 'scroll':
3881
+ case 'seeked':
3882
+ case 'seeking':
3883
+ case 'stalled':
3884
+ case 'submit':
3885
+ case 'success':
3886
+ case 'suspend':
3887
+ case 'timeupdate':
3888
+ case 'updateready':
3889
+ case 'visibilitychange':
3890
+ case 'volumechange':
3891
+ case 'waiting':
3892
+ serializedEvent = serializeGenericEvent(event);
3893
+ break;
3894
+ case 'transitionend':
3895
+ serializedEvent = serializeTransitionEvent(event);
3896
+ break;
3897
+ default:
3898
+ throw new BaseException$1(eventName + ' not supported on WebWorkers');
3899
+ }
3900
+ ObservableWrapper.callEmit(this._sink, {
3901
+ 'element': this._serializer.serialize(element, RenderStoreObject),
3902
+ 'eventName': eventName,
3903
+ 'eventTarget': eventTarget,
3904
+ 'event': serializedEvent
3905
+ });
3906
+ // TODO(kegluneq): Eventually, we want the user to indicate from the UI side whether the event
3907
+ // should be canceled, but for now just call `preventDefault` on the original DOM event.
3908
+ return false;
3909
+ };
3910
+ return EventDispatcher;
3911
+ }());
3912
+ var MessageBasedRenderer = (function () {
3913
+ function MessageBasedRenderer(_brokerFactory, _bus, _serializer, _renderStore, _rootRenderer) {
3914
+ this._brokerFactory = _brokerFactory;
3915
+ this._bus = _bus;
3916
+ this._serializer = _serializer;
3917
+ this._renderStore = _renderStore;
3918
+ this._rootRenderer = _rootRenderer;
3919
+ }
3920
+ MessageBasedRenderer.prototype.start = function () {
3921
+ var broker = this._brokerFactory.createMessageBroker(RENDERER_CHANNEL);
3922
+ this._bus.initChannel(EVENT_CHANNEL);
3923
+ this._eventDispatcher = new EventDispatcher(this._bus.to(EVENT_CHANNEL), this._serializer);
3924
+ broker.registerMethod('renderComponent', [_angular_core.RenderComponentType, PRIMITIVE], FunctionWrapper.bind(this._renderComponent, this));
3925
+ broker.registerMethod('selectRootElement', [RenderStoreObject, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._selectRootElement, this));
3926
+ broker.registerMethod('createElement', [RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._createElement, this));
3927
+ broker.registerMethod('createViewRoot', [RenderStoreObject, RenderStoreObject, PRIMITIVE], FunctionWrapper.bind(this._createViewRoot, this));
3928
+ broker.registerMethod('createTemplateAnchor', [RenderStoreObject, RenderStoreObject, PRIMITIVE], FunctionWrapper.bind(this._createTemplateAnchor, this));
3929
+ broker.registerMethod('createText', [RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._createText, this));
3930
+ broker.registerMethod('projectNodes', [RenderStoreObject, RenderStoreObject, RenderStoreObject], FunctionWrapper.bind(this._projectNodes, this));
3931
+ broker.registerMethod('attachViewAfter', [RenderStoreObject, RenderStoreObject, RenderStoreObject], FunctionWrapper.bind(this._attachViewAfter, this));
3932
+ broker.registerMethod('detachView', [RenderStoreObject, RenderStoreObject], FunctionWrapper.bind(this._detachView, this));
3933
+ broker.registerMethod('destroyView', [RenderStoreObject, RenderStoreObject, RenderStoreObject], FunctionWrapper.bind(this._destroyView, this));
3934
+ broker.registerMethod('setElementProperty', [RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._setElementProperty, this));
3935
+ broker.registerMethod('setElementAttribute', [RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._setElementAttribute, this));
3936
+ broker.registerMethod('setBindingDebugInfo', [RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._setBindingDebugInfo, this));
3937
+ broker.registerMethod('setElementClass', [RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._setElementClass, this));
3938
+ broker.registerMethod('setElementStyle', [RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._setElementStyle, this));
3939
+ broker.registerMethod('invokeElementMethod', [RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._invokeElementMethod, this));
3940
+ broker.registerMethod('setText', [RenderStoreObject, RenderStoreObject, PRIMITIVE], FunctionWrapper.bind(this._setText, this));
3941
+ broker.registerMethod('listen', [RenderStoreObject, RenderStoreObject, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._listen, this));
3942
+ broker.registerMethod('listenGlobal', [RenderStoreObject, PRIMITIVE, PRIMITIVE, PRIMITIVE], FunctionWrapper.bind(this._listenGlobal, this));
3943
+ broker.registerMethod('listenDone', [RenderStoreObject, RenderStoreObject], FunctionWrapper.bind(this._listenDone, this));
3944
+ };
3945
+ MessageBasedRenderer.prototype._renderComponent = function (renderComponentType, rendererId) {
3946
+ var renderer = this._rootRenderer.renderComponent(renderComponentType);
3947
+ this._renderStore.store(renderer, rendererId);
3948
+ };
3949
+ MessageBasedRenderer.prototype._selectRootElement = function (renderer, selector, elId) {
3950
+ this._renderStore.store(renderer.selectRootElement(selector, null), elId);
3951
+ };
3952
+ MessageBasedRenderer.prototype._createElement = function (renderer, parentElement, name, elId) {
3953
+ this._renderStore.store(renderer.createElement(parentElement, name, null), elId);
3954
+ };
3955
+ MessageBasedRenderer.prototype._createViewRoot = function (renderer, hostElement, elId) {
3956
+ var viewRoot = renderer.createViewRoot(hostElement);
3957
+ if (this._renderStore.serialize(hostElement) !== elId) {
3958
+ this._renderStore.store(viewRoot, elId);
3959
+ }
3960
+ };
3961
+ MessageBasedRenderer.prototype._createTemplateAnchor = function (renderer, parentElement, elId) {
3962
+ this._renderStore.store(renderer.createTemplateAnchor(parentElement, null), elId);
3963
+ };
3964
+ MessageBasedRenderer.prototype._createText = function (renderer, parentElement, value, elId) {
3965
+ this._renderStore.store(renderer.createText(parentElement, value, null), elId);
3966
+ };
3967
+ MessageBasedRenderer.prototype._projectNodes = function (renderer, parentElement, nodes) {
3968
+ renderer.projectNodes(parentElement, nodes);
3969
+ };
3970
+ MessageBasedRenderer.prototype._attachViewAfter = function (renderer, node, viewRootNodes) {
3971
+ renderer.attachViewAfter(node, viewRootNodes);
3972
+ };
3973
+ MessageBasedRenderer.prototype._detachView = function (renderer, viewRootNodes) {
3974
+ renderer.detachView(viewRootNodes);
3975
+ };
3976
+ MessageBasedRenderer.prototype._destroyView = function (renderer, hostElement, viewAllNodes) {
3977
+ renderer.destroyView(hostElement, viewAllNodes);
3978
+ for (var i = 0; i < viewAllNodes.length; i++) {
3979
+ this._renderStore.remove(viewAllNodes[i]);
3980
+ }
3981
+ };
3982
+ MessageBasedRenderer.prototype._setElementProperty = function (renderer, renderElement, propertyName, propertyValue) {
3983
+ renderer.setElementProperty(renderElement, propertyName, propertyValue);
3984
+ };
3985
+ MessageBasedRenderer.prototype._setElementAttribute = function (renderer, renderElement, attributeName, attributeValue) {
3986
+ renderer.setElementAttribute(renderElement, attributeName, attributeValue);
3987
+ };
3988
+ MessageBasedRenderer.prototype._setBindingDebugInfo = function (renderer, renderElement, propertyName, propertyValue) {
3989
+ renderer.setBindingDebugInfo(renderElement, propertyName, propertyValue);
3990
+ };
3991
+ MessageBasedRenderer.prototype._setElementClass = function (renderer, renderElement, className, isAdd) {
3992
+ renderer.setElementClass(renderElement, className, isAdd);
3993
+ };
3994
+ MessageBasedRenderer.prototype._setElementStyle = function (renderer, renderElement, styleName, styleValue) {
3995
+ renderer.setElementStyle(renderElement, styleName, styleValue);
3996
+ };
3997
+ MessageBasedRenderer.prototype._invokeElementMethod = function (renderer, renderElement, methodName, args) {
3998
+ renderer.invokeElementMethod(renderElement, methodName, args);
3999
+ };
4000
+ MessageBasedRenderer.prototype._setText = function (renderer, renderNode, text) {
4001
+ renderer.setText(renderNode, text);
4002
+ };
4003
+ MessageBasedRenderer.prototype._listen = function (renderer, renderElement, eventName, unlistenId) {
4004
+ var _this = this;
4005
+ var unregisterCallback = renderer.listen(renderElement, eventName, function (event /** TODO #9100 */) { return _this._eventDispatcher.dispatchRenderEvent(renderElement, null, eventName, event); });
4006
+ this._renderStore.store(unregisterCallback, unlistenId);
4007
+ };
4008
+ MessageBasedRenderer.prototype._listenGlobal = function (renderer, eventTarget, eventName, unlistenId) {
4009
+ var _this = this;
4010
+ var unregisterCallback = renderer.listenGlobal(eventTarget, eventName, function (event /** TODO #9100 */) { return _this._eventDispatcher.dispatchRenderEvent(null, eventTarget, eventName, event); });
4011
+ this._renderStore.store(unregisterCallback, unlistenId);
4012
+ };
4013
+ MessageBasedRenderer.prototype._listenDone = function (renderer, unlistenCallback) { unlistenCallback(); };
4014
+ return MessageBasedRenderer;
4015
+ }());
4016
+ /** @nocollapse */
4017
+ MessageBasedRenderer.decorators = [
4018
+ { type: _angular_core.Injectable },
4019
+ ];
4020
+ /** @nocollapse */
4021
+ MessageBasedRenderer.ctorParameters = [
4022
+ { type: ServiceMessageBrokerFactory, },
4023
+ { type: MessageBus, },
4024
+ { type: Serializer, },
4025
+ { type: RenderStore, },
4026
+ { type: _angular_core.RootRenderer, },
4027
+ ];
4028
+ var WORKER_RENDER_PLATFORM_MARKER = new _angular_core.OpaqueToken('WorkerRenderPlatformMarker');
4029
+ var WebWorkerInstance = (function () {
4030
+ function WebWorkerInstance() {
4031
+ }
4032
+ /** @internal */
4033
+ WebWorkerInstance.prototype.init = function (worker, bus) {
4034
+ this.worker = worker;
4035
+ this.bus = bus;
4036
+ };
4037
+ return WebWorkerInstance;
4038
+ }());
4039
+ /** @nocollapse */
4040
+ WebWorkerInstance.decorators = [
4041
+ { type: _angular_core.Injectable },
4042
+ ];
4043
+ /**
4044
+ * @experimental
4045
+ */
4046
+ var WORKER_SCRIPT = new _angular_core.OpaqueToken('WebWorkerScript');
4047
+ /**
4048
+ * A multiple providers used to automatically call the `start()` method after the service is
4049
+ * created.
4050
+ *
4051
+ * TODO(vicb): create an interface for startable services to implement
4052
+ * @experimental
4053
+ */
4054
+ var WORKER_UI_STARTABLE_MESSAGING_SERVICE = new _angular_core.OpaqueToken('WorkerRenderStartableMsgService');
4055
+ /**
4056
+ * * @experimental
4057
+ */
4058
+ var WORKER_UI_PLATFORM_PROVIDERS = [
4059
+ _angular_core.PLATFORM_COMMON_PROVIDERS, { provide: WORKER_RENDER_PLATFORM_MARKER, useValue: true },
4060
+ { provide: _angular_core.PLATFORM_INITIALIZER, useValue: initWebWorkerRenderPlatform, multi: true }
4061
+ ];
4062
+ /**
4063
+ * * @experimental
4064
+ */
4065
+ var WORKER_UI_APPLICATION_PROVIDERS = [
4066
+ _angular_core.APPLICATION_COMMON_PROVIDERS,
4067
+ MessageBasedRenderer,
4068
+ { provide: WORKER_UI_STARTABLE_MESSAGING_SERVICE, useExisting: MessageBasedRenderer, multi: true },
4069
+ BROWSER_SANITIZATION_PROVIDERS,
4070
+ { provide: _angular_core.ExceptionHandler, useFactory: _exceptionHandler$1, deps: [] },
4071
+ { provide: DOCUMENT, useFactory: _document$1, deps: [] },
4072
+ // TODO(jteplitz602): Investigate if we definitely need EVENT_MANAGER on the render thread
4073
+ // #5298
4074
+ { provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true },
4075
+ { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true },
4076
+ { provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true },
4077
+ { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig },
4078
+ { provide: DomRootRenderer, useClass: DomRootRenderer_ },
4079
+ { provide: _angular_core.RootRenderer, useExisting: DomRootRenderer },
4080
+ { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
4081
+ { provide: ServiceMessageBrokerFactory, useClass: ServiceMessageBrokerFactory_ },
4082
+ { provide: ClientMessageBrokerFactory, useClass: ClientMessageBrokerFactory_ },
4083
+ { provide: AnimationDriver, useFactory: _resolveDefaultAnimationDriver$1 },
4084
+ Serializer,
4085
+ { provide: ON_WEB_WORKER, useValue: false },
4086
+ RenderStore,
4087
+ DomSharedStylesHost,
4088
+ _angular_core.Testability,
4089
+ EventManager,
4090
+ WebWorkerInstance,
4091
+ { provide: _angular_core.APP_INITIALIZER, useFactory: initWebWorkerAppFn, multi: true, deps: [_angular_core.Injector] },
4092
+ { provide: MessageBus, useFactory: messageBusFactory, deps: [WebWorkerInstance] }
4093
+ ];
4094
+ function initializeGenericWorkerRenderer(injector) {
4095
+ var bus = injector.get(MessageBus);
4096
+ var zone = injector.get(_angular_core.NgZone);
4097
+ bus.attachToZone(zone);
4098
+ // initialize message services after the bus has been created
4099
+ var services = injector.get(WORKER_UI_STARTABLE_MESSAGING_SERVICE);
4100
+ zone.runGuarded(function () { services.forEach(function (svc /** TODO #9100 */) { svc.start(); }); });
4101
+ }
4102
+ function messageBusFactory(instance) {
4103
+ return instance.bus;
4104
+ }
4105
+ function initWebWorkerRenderPlatform() {
4106
+ BrowserDomAdapter.makeCurrent();
4107
+ wtfInit();
4108
+ BrowserGetTestability.init();
4109
+ }
4110
+ /**
4111
+ * * @experimental
4112
+ */
4113
+ function workerUiPlatform() {
4114
+ if (isBlank(_angular_core.getPlatform())) {
4115
+ _angular_core.createPlatform(_angular_core.ReflectiveInjector.resolveAndCreate(WORKER_UI_PLATFORM_PROVIDERS));
4116
+ }
4117
+ return _angular_core.assertPlatform(WORKER_RENDER_PLATFORM_MARKER);
4118
+ }
4119
+ function _exceptionHandler$1() {
4120
+ return new _angular_core.ExceptionHandler(getDOM());
4121
+ }
4122
+ function _document$1() {
4123
+ return getDOM().defaultDoc();
4124
+ }
4125
+ function initWebWorkerAppFn(injector) {
4126
+ return function () {
4127
+ var scriptUri;
4128
+ try {
4129
+ scriptUri = injector.get(WORKER_SCRIPT);
4130
+ }
4131
+ catch (e) {
4132
+ throw new BaseException$1('You must provide your WebWorker\'s initialization script with the WORKER_SCRIPT token');
4133
+ }
4134
+ var instance = injector.get(WebWorkerInstance);
4135
+ spawnWebWorker(scriptUri, instance);
4136
+ initializeGenericWorkerRenderer(injector);
4137
+ };
4138
+ }
4139
+ /**
4140
+ * Spawns a new class and initializes the WebWorkerInstance
4141
+ */
4142
+ function spawnWebWorker(uri, instance) {
4143
+ var webWorker = new Worker(uri);
4144
+ var sink = new PostMessageBusSink(webWorker);
4145
+ var source = new PostMessageBusSource(webWorker);
4146
+ var bus = new PostMessageBus(sink, source);
4147
+ instance.init(webWorker, bus);
4148
+ }
4149
+ function _resolveDefaultAnimationDriver$1() {
4150
+ // web workers have not been tested or configured to
4151
+ // work with animations just yet...
4152
+ return new NoOpAnimationDriver();
4153
+ }
4154
+ var WebWorkerRootRenderer = (function () {
4155
+ function WebWorkerRootRenderer(messageBrokerFactory, bus, _serializer, _renderStore) {
4156
+ var _this = this;
4157
+ this._serializer = _serializer;
4158
+ this._renderStore = _renderStore;
4159
+ this.globalEvents = new NamedEventEmitter();
4160
+ this._componentRenderers = new Map();
4161
+ this._messageBroker = messageBrokerFactory.createMessageBroker(RENDERER_CHANNEL);
4162
+ bus.initChannel(EVENT_CHANNEL);
4163
+ var source = bus.from(EVENT_CHANNEL);
4164
+ ObservableWrapper.subscribe(source, function (message) { return _this._dispatchEvent(message); });
4165
+ }
4166
+ WebWorkerRootRenderer.prototype._dispatchEvent = function (message) {
4167
+ var eventName = message['eventName'];
4168
+ var target = message['eventTarget'];
4169
+ var event = deserializeGenericEvent(message['event']);
4170
+ if (isPresent(target)) {
4171
+ this.globalEvents.dispatchEvent(eventNameWithTarget(target, eventName), event);
4172
+ }
4173
+ else {
4174
+ var element = this._serializer.deserialize(message['element'], RenderStoreObject);
4175
+ element.events.dispatchEvent(eventName, event);
4176
+ }
4177
+ };
4178
+ WebWorkerRootRenderer.prototype.renderComponent = function (componentType) {
4179
+ var result = this._componentRenderers.get(componentType.id);
4180
+ if (isBlank(result)) {
4181
+ result = new WebWorkerRenderer(this, componentType);
4182
+ this._componentRenderers.set(componentType.id, result);
4183
+ var id = this._renderStore.allocateId();
4184
+ this._renderStore.store(result, id);
4185
+ this.runOnService('renderComponent', [
4186
+ new FnArg(componentType, _angular_core.RenderComponentType),
4187
+ new FnArg(result, RenderStoreObject),
4188
+ ]);
4189
+ }
4190
+ return result;
4191
+ };
4192
+ WebWorkerRootRenderer.prototype.runOnService = function (fnName, fnArgs) {
4193
+ var args = new UiArguments(fnName, fnArgs);
4194
+ this._messageBroker.runOnService(args, null);
4195
+ };
4196
+ WebWorkerRootRenderer.prototype.allocateNode = function () {
4197
+ var result = new WebWorkerRenderNode();
4198
+ var id = this._renderStore.allocateId();
4199
+ this._renderStore.store(result, id);
4200
+ return result;
4201
+ };
4202
+ WebWorkerRootRenderer.prototype.allocateId = function () { return this._renderStore.allocateId(); };
4203
+ WebWorkerRootRenderer.prototype.destroyNodes = function (nodes) {
4204
+ for (var i = 0; i < nodes.length; i++) {
4205
+ this._renderStore.remove(nodes[i]);
4206
+ }
4207
+ };
4208
+ return WebWorkerRootRenderer;
4209
+ }());
4210
+ /** @nocollapse */
4211
+ WebWorkerRootRenderer.decorators = [
4212
+ { type: _angular_core.Injectable },
4213
+ ];
4214
+ /** @nocollapse */
4215
+ WebWorkerRootRenderer.ctorParameters = [
4216
+ { type: ClientMessageBrokerFactory, },
4217
+ { type: MessageBus, },
4218
+ { type: Serializer, },
4219
+ { type: RenderStore, },
4220
+ ];
4221
+ var WebWorkerRenderer = (function () {
4222
+ function WebWorkerRenderer(_rootRenderer, _componentType) {
4223
+ this._rootRenderer = _rootRenderer;
4224
+ this._componentType = _componentType;
4225
+ }
4226
+ WebWorkerRenderer.prototype._runOnService = function (fnName, fnArgs) {
4227
+ var fnArgsWithRenderer = [new FnArg(this, RenderStoreObject)].concat(fnArgs);
4228
+ this._rootRenderer.runOnService(fnName, fnArgsWithRenderer);
4229
+ };
4230
+ WebWorkerRenderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) {
4231
+ var node = this._rootRenderer.allocateNode();
4232
+ this._runOnService('selectRootElement', [new FnArg(selectorOrNode, null), new FnArg(node, RenderStoreObject)]);
4233
+ return node;
4234
+ };
4235
+ WebWorkerRenderer.prototype.createElement = function (parentElement, name, debugInfo) {
4236
+ var node = this._rootRenderer.allocateNode();
4237
+ this._runOnService('createElement', [
4238
+ new FnArg(parentElement, RenderStoreObject), new FnArg(name, null),
4239
+ new FnArg(node, RenderStoreObject)
4240
+ ]);
4241
+ return node;
4242
+ };
4243
+ WebWorkerRenderer.prototype.createViewRoot = function (hostElement) {
4244
+ var viewRoot = this._componentType.encapsulation === _angular_core.ViewEncapsulation.Native ?
4245
+ this._rootRenderer.allocateNode() :
4246
+ hostElement;
4247
+ this._runOnService('createViewRoot', [new FnArg(hostElement, RenderStoreObject), new FnArg(viewRoot, RenderStoreObject)]);
4248
+ return viewRoot;
4249
+ };
4250
+ WebWorkerRenderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) {
4251
+ var node = this._rootRenderer.allocateNode();
4252
+ this._runOnService('createTemplateAnchor', [new FnArg(parentElement, RenderStoreObject), new FnArg(node, RenderStoreObject)]);
4253
+ return node;
4254
+ };
4255
+ WebWorkerRenderer.prototype.createText = function (parentElement, value, debugInfo) {
4256
+ var node = this._rootRenderer.allocateNode();
4257
+ this._runOnService('createText', [
4258
+ new FnArg(parentElement, RenderStoreObject), new FnArg(value, null),
4259
+ new FnArg(node, RenderStoreObject)
4260
+ ]);
4261
+ return node;
4262
+ };
4263
+ WebWorkerRenderer.prototype.projectNodes = function (parentElement, nodes) {
4264
+ this._runOnService('projectNodes', [new FnArg(parentElement, RenderStoreObject), new FnArg(nodes, RenderStoreObject)]);
4265
+ };
4266
+ WebWorkerRenderer.prototype.attachViewAfter = function (node, viewRootNodes) {
4267
+ this._runOnService('attachViewAfter', [new FnArg(node, RenderStoreObject), new FnArg(viewRootNodes, RenderStoreObject)]);
4268
+ };
4269
+ WebWorkerRenderer.prototype.detachView = function (viewRootNodes) {
4270
+ this._runOnService('detachView', [new FnArg(viewRootNodes, RenderStoreObject)]);
4271
+ };
4272
+ WebWorkerRenderer.prototype.destroyView = function (hostElement, viewAllNodes) {
4273
+ this._runOnService('destroyView', [new FnArg(hostElement, RenderStoreObject), new FnArg(viewAllNodes, RenderStoreObject)]);
4274
+ this._rootRenderer.destroyNodes(viewAllNodes);
4275
+ };
4276
+ WebWorkerRenderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) {
4277
+ this._runOnService('setElementProperty', [
4278
+ new FnArg(renderElement, RenderStoreObject), new FnArg(propertyName, null),
4279
+ new FnArg(propertyValue, null)
4280
+ ]);
4281
+ };
4282
+ WebWorkerRenderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) {
4283
+ this._runOnService('setElementAttribute', [
4284
+ new FnArg(renderElement, RenderStoreObject), new FnArg(attributeName, null),
4285
+ new FnArg(attributeValue, null)
4286
+ ]);
4287
+ };
4288
+ WebWorkerRenderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) {
4289
+ this._runOnService('setBindingDebugInfo', [
4290
+ new FnArg(renderElement, RenderStoreObject), new FnArg(propertyName, null),
4291
+ new FnArg(propertyValue, null)
4292
+ ]);
4293
+ };
4294
+ WebWorkerRenderer.prototype.setElementClass = function (renderElement, className, isAdd) {
4295
+ this._runOnService('setElementClass', [
4296
+ new FnArg(renderElement, RenderStoreObject), new FnArg(className, null),
4297
+ new FnArg(isAdd, null)
4298
+ ]);
4299
+ };
4300
+ WebWorkerRenderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) {
4301
+ this._runOnService('setElementStyle', [
4302
+ new FnArg(renderElement, RenderStoreObject), new FnArg(styleName, null),
4303
+ new FnArg(styleValue, null)
4304
+ ]);
4305
+ };
4306
+ WebWorkerRenderer.prototype.invokeElementMethod = function (renderElement, methodName, args) {
4307
+ this._runOnService('invokeElementMethod', [
4308
+ new FnArg(renderElement, RenderStoreObject), new FnArg(methodName, null),
4309
+ new FnArg(args, null)
4310
+ ]);
4311
+ };
4312
+ WebWorkerRenderer.prototype.setText = function (renderNode, text) {
4313
+ this._runOnService('setText', [new FnArg(renderNode, RenderStoreObject), new FnArg(text, null)]);
4314
+ };
4315
+ WebWorkerRenderer.prototype.listen = function (renderElement, name, callback) {
4316
+ var _this = this;
4317
+ renderElement.events.listen(name, callback);
4318
+ var unlistenCallbackId = this._rootRenderer.allocateId();
4319
+ this._runOnService('listen', [
4320
+ new FnArg(renderElement, RenderStoreObject), new FnArg(name, null),
4321
+ new FnArg(unlistenCallbackId, null)
4322
+ ]);
4323
+ return function () {
4324
+ renderElement.events.unlisten(name, callback);
4325
+ _this._runOnService('listenDone', [new FnArg(unlistenCallbackId, null)]);
4326
+ };
4327
+ };
4328
+ WebWorkerRenderer.prototype.listenGlobal = function (target, name, callback) {
4329
+ var _this = this;
4330
+ this._rootRenderer.globalEvents.listen(eventNameWithTarget(target, name), callback);
4331
+ var unlistenCallbackId = this._rootRenderer.allocateId();
4332
+ this._runOnService('listenGlobal', [new FnArg(target, null), new FnArg(name, null), new FnArg(unlistenCallbackId, null)]);
4333
+ return function () {
4334
+ _this._rootRenderer.globalEvents.unlisten(eventNameWithTarget(target, name), callback);
4335
+ _this._runOnService('listenDone', [new FnArg(unlistenCallbackId, null)]);
4336
+ };
4337
+ };
4338
+ WebWorkerRenderer.prototype.animate = function (element, startingStyles, keyframes, duration, delay, easing) {
4339
+ // TODO
4340
+ return null;
4341
+ };
4342
+ return WebWorkerRenderer;
4343
+ }());
4344
+ var NamedEventEmitter = (function () {
4345
+ function NamedEventEmitter() {
4346
+ }
4347
+ NamedEventEmitter.prototype._getListeners = function (eventName) {
4348
+ if (isBlank(this._listeners)) {
4349
+ this._listeners = new Map();
4350
+ }
4351
+ var listeners = this._listeners.get(eventName);
4352
+ if (isBlank(listeners)) {
4353
+ listeners = [];
4354
+ this._listeners.set(eventName, listeners);
4355
+ }
4356
+ return listeners;
4357
+ };
4358
+ NamedEventEmitter.prototype.listen = function (eventName, callback) { this._getListeners(eventName).push(callback); };
4359
+ NamedEventEmitter.prototype.unlisten = function (eventName, callback) {
4360
+ ListWrapper.remove(this._getListeners(eventName), callback);
4361
+ };
4362
+ NamedEventEmitter.prototype.dispatchEvent = function (eventName, event) {
4363
+ var listeners = this._getListeners(eventName);
4364
+ for (var i = 0; i < listeners.length; i++) {
4365
+ listeners[i](event);
4366
+ }
4367
+ };
4368
+ return NamedEventEmitter;
4369
+ }());
4370
+ function eventNameWithTarget(target, eventName) {
4371
+ return target + ":" + eventName;
4372
+ }
4373
+ var WebWorkerRenderNode = (function () {
4374
+ function WebWorkerRenderNode() {
4375
+ this.events = new NamedEventEmitter();
4376
+ }
4377
+ return WebWorkerRenderNode;
4378
+ }());
4379
+ /**
4380
+ * This adapter is required to log error messages.
4381
+ *
4382
+ * Note: other methods all throw as the DOM is not accessible directly in web worker context.
4383
+ */
4384
+ var WorkerDomAdapter = (function (_super) {
4385
+ __extends(WorkerDomAdapter, _super);
4386
+ function WorkerDomAdapter() {
4387
+ _super.apply(this, arguments);
4388
+ }
4389
+ WorkerDomAdapter.makeCurrent = function () { setRootDomAdapter(new WorkerDomAdapter()); };
4390
+ WorkerDomAdapter.prototype.logError = function (error /** TODO #9100 */) {
4391
+ if (console.error) {
4392
+ console.error(error);
4393
+ }
4394
+ else {
4395
+ console.log(error);
4396
+ }
4397
+ };
4398
+ WorkerDomAdapter.prototype.log = function (error /** TODO #9100 */) { console.log(error); };
4399
+ WorkerDomAdapter.prototype.logGroup = function (error /** TODO #9100 */) {
4400
+ if (console.group) {
4401
+ console.group(error);
4402
+ this.logError(error);
4403
+ }
4404
+ else {
4405
+ console.log(error);
4406
+ }
4407
+ };
4408
+ WorkerDomAdapter.prototype.logGroupEnd = function () {
4409
+ if (console.groupEnd) {
4410
+ console.groupEnd();
4411
+ }
4412
+ };
4413
+ WorkerDomAdapter.prototype.hasProperty = function (element /** TODO #9100 */, name) { throw 'not implemented'; };
4414
+ WorkerDomAdapter.prototype.setProperty = function (el, name, value) { throw 'not implemented'; };
4415
+ WorkerDomAdapter.prototype.getProperty = function (el, name) { throw 'not implemented'; };
4416
+ WorkerDomAdapter.prototype.invoke = function (el, methodName, args) { throw 'not implemented'; };
4417
+ WorkerDomAdapter.prototype.getXHR = function () { throw 'not implemented'; };
4418
+ Object.defineProperty(WorkerDomAdapter.prototype, "attrToPropMap", {
4419
+ get: function () { throw 'not implemented'; },
4420
+ set: function (value) { throw 'not implemented'; },
4421
+ enumerable: true,
4422
+ configurable: true
4423
+ });
4424
+ WorkerDomAdapter.prototype.parse = function (templateHtml) { throw 'not implemented'; };
4425
+ WorkerDomAdapter.prototype.query = function (selector) { throw 'not implemented'; };
4426
+ WorkerDomAdapter.prototype.querySelector = function (el /** TODO #9100 */, selector) {
4427
+ throw 'not implemented';
4428
+ };
4429
+ WorkerDomAdapter.prototype.querySelectorAll = function (el /** TODO #9100 */, selector) { throw 'not implemented'; };
4430
+ WorkerDomAdapter.prototype.on = function (el /** TODO #9100 */, evt /** TODO #9100 */, listener /** TODO #9100 */) {
4431
+ throw 'not implemented';
4432
+ };
4433
+ WorkerDomAdapter.prototype.onAndCancel = function (el /** TODO #9100 */, evt /** TODO #9100 */, listener /** TODO #9100 */) {
4434
+ throw 'not implemented';
4435
+ };
4436
+ WorkerDomAdapter.prototype.dispatchEvent = function (el /** TODO #9100 */, evt /** TODO #9100 */) { throw 'not implemented'; };
4437
+ WorkerDomAdapter.prototype.createMouseEvent = function (eventType /** TODO #9100 */) { throw 'not implemented'; };
4438
+ WorkerDomAdapter.prototype.createEvent = function (eventType) { throw 'not implemented'; };
4439
+ WorkerDomAdapter.prototype.preventDefault = function (evt /** TODO #9100 */) { throw 'not implemented'; };
4440
+ WorkerDomAdapter.prototype.isPrevented = function (evt /** TODO #9100 */) { throw 'not implemented'; };
4441
+ WorkerDomAdapter.prototype.getInnerHTML = function (el /** TODO #9100 */) { throw 'not implemented'; };
4442
+ WorkerDomAdapter.prototype.getTemplateContent = function (el /** TODO #9100 */) { throw 'not implemented'; };
4443
+ WorkerDomAdapter.prototype.getOuterHTML = function (el /** TODO #9100 */) { throw 'not implemented'; };
4444
+ WorkerDomAdapter.prototype.nodeName = function (node /** TODO #9100 */) { throw 'not implemented'; };
4445
+ WorkerDomAdapter.prototype.nodeValue = function (node /** TODO #9100 */) { throw 'not implemented'; };
4446
+ WorkerDomAdapter.prototype.type = function (node /** TODO #9100 */) { throw 'not implemented'; };
4447
+ WorkerDomAdapter.prototype.content = function (node /** TODO #9100 */) { throw 'not implemented'; };
4448
+ WorkerDomAdapter.prototype.firstChild = function (el /** TODO #9100 */) { throw 'not implemented'; };
4449
+ WorkerDomAdapter.prototype.nextSibling = function (el /** TODO #9100 */) { throw 'not implemented'; };
4450
+ WorkerDomAdapter.prototype.parentElement = function (el /** TODO #9100 */) { throw 'not implemented'; };
4451
+ WorkerDomAdapter.prototype.childNodes = function (el /** TODO #9100 */) { throw 'not implemented'; };
4452
+ WorkerDomAdapter.prototype.childNodesAsList = function (el /** TODO #9100 */) { throw 'not implemented'; };
4453
+ WorkerDomAdapter.prototype.clearNodes = function (el /** TODO #9100 */) { throw 'not implemented'; };
4454
+ WorkerDomAdapter.prototype.appendChild = function (el /** TODO #9100 */, node /** TODO #9100 */) { throw 'not implemented'; };
4455
+ WorkerDomAdapter.prototype.removeChild = function (el /** TODO #9100 */, node /** TODO #9100 */) { throw 'not implemented'; };
4456
+ WorkerDomAdapter.prototype.replaceChild = function (el /** TODO #9100 */, newNode /** TODO #9100 */, oldNode /** TODO #9100 */) {
4457
+ throw 'not implemented';
4458
+ };
4459
+ WorkerDomAdapter.prototype.remove = function (el /** TODO #9100 */) { throw 'not implemented'; };
4460
+ WorkerDomAdapter.prototype.insertBefore = function (el /** TODO #9100 */, node /** TODO #9100 */) { throw 'not implemented'; };
4461
+ WorkerDomAdapter.prototype.insertAllBefore = function (el /** TODO #9100 */, nodes /** TODO #9100 */) {
4462
+ throw 'not implemented';
4463
+ };
4464
+ WorkerDomAdapter.prototype.insertAfter = function (el /** TODO #9100 */, node /** TODO #9100 */) { throw 'not implemented'; };
4465
+ WorkerDomAdapter.prototype.setInnerHTML = function (el /** TODO #9100 */, value /** TODO #9100 */) { throw 'not implemented'; };
4466
+ WorkerDomAdapter.prototype.getText = function (el /** TODO #9100 */) { throw 'not implemented'; };
4467
+ WorkerDomAdapter.prototype.setText = function (el /** TODO #9100 */, value) { throw 'not implemented'; };
4468
+ WorkerDomAdapter.prototype.getValue = function (el /** TODO #9100 */) { throw 'not implemented'; };
4469
+ WorkerDomAdapter.prototype.setValue = function (el /** TODO #9100 */, value) { throw 'not implemented'; };
4470
+ WorkerDomAdapter.prototype.getChecked = function (el /** TODO #9100 */) { throw 'not implemented'; };
4471
+ WorkerDomAdapter.prototype.setChecked = function (el /** TODO #9100 */, value) { throw 'not implemented'; };
4472
+ WorkerDomAdapter.prototype.createComment = function (text) { throw 'not implemented'; };
4473
+ WorkerDomAdapter.prototype.createTemplate = function (html /** TODO #9100 */) { throw 'not implemented'; };
4474
+ WorkerDomAdapter.prototype.createElement = function (tagName /** TODO #9100 */, doc /** TODO #9100 */) {
4475
+ throw 'not implemented';
4476
+ };
4477
+ WorkerDomAdapter.prototype.createElementNS = function (ns, tagName, doc /** TODO #9100 */) {
4478
+ throw 'not implemented';
4479
+ };
4480
+ WorkerDomAdapter.prototype.createTextNode = function (text, doc /** TODO #9100 */) { throw 'not implemented'; };
4481
+ WorkerDomAdapter.prototype.createScriptTag = function (attrName, attrValue, doc /** TODO #9100 */) {
4482
+ throw 'not implemented';
4483
+ };
4484
+ WorkerDomAdapter.prototype.createStyleElement = function (css, doc /** TODO #9100 */) {
4485
+ throw 'not implemented';
4486
+ };
4487
+ WorkerDomAdapter.prototype.createShadowRoot = function (el /** TODO #9100 */) { throw 'not implemented'; };
4488
+ WorkerDomAdapter.prototype.getShadowRoot = function (el /** TODO #9100 */) { throw 'not implemented'; };
4489
+ WorkerDomAdapter.prototype.getHost = function (el /** TODO #9100 */) { throw 'not implemented'; };
4490
+ WorkerDomAdapter.prototype.getDistributedNodes = function (el /** TODO #9100 */) { throw 'not implemented'; };
4491
+ WorkerDomAdapter.prototype.clone = function (node) { throw 'not implemented'; };
4492
+ WorkerDomAdapter.prototype.getElementsByClassName = function (element /** TODO #9100 */, name) {
4493
+ throw 'not implemented';
4494
+ };
4495
+ WorkerDomAdapter.prototype.getElementsByTagName = function (element /** TODO #9100 */, name) {
4496
+ throw 'not implemented';
4497
+ };
4498
+ WorkerDomAdapter.prototype.classList = function (element /** TODO #9100 */) { throw 'not implemented'; };
4499
+ WorkerDomAdapter.prototype.addClass = function (element /** TODO #9100 */, className) { throw 'not implemented'; };
4500
+ WorkerDomAdapter.prototype.removeClass = function (element /** TODO #9100 */, className) { throw 'not implemented'; };
4501
+ WorkerDomAdapter.prototype.hasClass = function (element /** TODO #9100 */, className) { throw 'not implemented'; };
4502
+ WorkerDomAdapter.prototype.setStyle = function (element /** TODO #9100 */, styleName, styleValue) {
4503
+ throw 'not implemented';
4504
+ };
4505
+ WorkerDomAdapter.prototype.removeStyle = function (element /** TODO #9100 */, styleName) { throw 'not implemented'; };
4506
+ WorkerDomAdapter.prototype.getStyle = function (element /** TODO #9100 */, styleName) { throw 'not implemented'; };
4507
+ WorkerDomAdapter.prototype.hasStyle = function (element /** TODO #9100 */, styleName, styleValue) {
4508
+ throw 'not implemented';
4509
+ };
4510
+ WorkerDomAdapter.prototype.tagName = function (element /** TODO #9100 */) { throw 'not implemented'; };
4511
+ WorkerDomAdapter.prototype.attributeMap = function (element /** TODO #9100 */) { throw 'not implemented'; };
4512
+ WorkerDomAdapter.prototype.hasAttribute = function (element /** TODO #9100 */, attribute) {
4513
+ throw 'not implemented';
4514
+ };
4515
+ WorkerDomAdapter.prototype.hasAttributeNS = function (element /** TODO #9100 */, ns, attribute) {
4516
+ throw 'not implemented';
4517
+ };
4518
+ WorkerDomAdapter.prototype.getAttribute = function (element /** TODO #9100 */, attribute) {
4519
+ throw 'not implemented';
4520
+ };
4521
+ WorkerDomAdapter.prototype.getAttributeNS = function (element /** TODO #9100 */, ns, attribute) {
4522
+ throw 'not implemented';
4523
+ };
4524
+ WorkerDomAdapter.prototype.setAttribute = function (element /** TODO #9100 */, name, value) {
4525
+ throw 'not implemented';
4526
+ };
4527
+ WorkerDomAdapter.prototype.setAttributeNS = function (element /** TODO #9100 */, ns, name, value) {
4528
+ throw 'not implemented';
4529
+ };
4530
+ WorkerDomAdapter.prototype.removeAttribute = function (element /** TODO #9100 */, attribute) { throw 'not implemented'; };
4531
+ WorkerDomAdapter.prototype.removeAttributeNS = function (element /** TODO #9100 */, ns, attribute) {
4532
+ throw 'not implemented';
4533
+ };
4534
+ WorkerDomAdapter.prototype.templateAwareRoot = function (el /** TODO #9100 */) { throw 'not implemented'; };
4535
+ WorkerDomAdapter.prototype.createHtmlDocument = function () { throw 'not implemented'; };
4536
+ WorkerDomAdapter.prototype.defaultDoc = function () { throw 'not implemented'; };
4537
+ WorkerDomAdapter.prototype.getBoundingClientRect = function (el /** TODO #9100 */) { throw 'not implemented'; };
4538
+ WorkerDomAdapter.prototype.getTitle = function () { throw 'not implemented'; };
4539
+ WorkerDomAdapter.prototype.setTitle = function (newTitle) { throw 'not implemented'; };
4540
+ WorkerDomAdapter.prototype.elementMatches = function (n /** TODO #9100 */, selector) { throw 'not implemented'; };
4541
+ WorkerDomAdapter.prototype.isTemplateElement = function (el) { throw 'not implemented'; };
4542
+ WorkerDomAdapter.prototype.isTextNode = function (node /** TODO #9100 */) { throw 'not implemented'; };
4543
+ WorkerDomAdapter.prototype.isCommentNode = function (node /** TODO #9100 */) { throw 'not implemented'; };
4544
+ WorkerDomAdapter.prototype.isElementNode = function (node /** TODO #9100 */) { throw 'not implemented'; };
4545
+ WorkerDomAdapter.prototype.hasShadowRoot = function (node /** TODO #9100 */) { throw 'not implemented'; };
4546
+ WorkerDomAdapter.prototype.isShadowRoot = function (node /** TODO #9100 */) { throw 'not implemented'; };
4547
+ WorkerDomAdapter.prototype.importIntoDoc = function (node) { throw 'not implemented'; };
4548
+ WorkerDomAdapter.prototype.adoptNode = function (node) { throw 'not implemented'; };
4549
+ WorkerDomAdapter.prototype.getHref = function (element /** TODO #9100 */) { throw 'not implemented'; };
4550
+ WorkerDomAdapter.prototype.getEventKey = function (event /** TODO #9100 */) { throw 'not implemented'; };
4551
+ WorkerDomAdapter.prototype.resolveAndSetHref = function (element /** TODO #9100 */, baseUrl, href) {
4552
+ throw 'not implemented';
4553
+ };
4554
+ WorkerDomAdapter.prototype.supportsDOMEvents = function () { throw 'not implemented'; };
4555
+ WorkerDomAdapter.prototype.supportsNativeShadowDOM = function () { throw 'not implemented'; };
4556
+ WorkerDomAdapter.prototype.getGlobalEventTarget = function (target) { throw 'not implemented'; };
4557
+ WorkerDomAdapter.prototype.getHistory = function () { throw 'not implemented'; };
4558
+ WorkerDomAdapter.prototype.getLocation = function () { throw 'not implemented'; };
4559
+ WorkerDomAdapter.prototype.getBaseHref = function () { throw 'not implemented'; };
4560
+ WorkerDomAdapter.prototype.resetBaseElement = function () { throw 'not implemented'; };
4561
+ WorkerDomAdapter.prototype.getUserAgent = function () { throw 'not implemented'; };
4562
+ WorkerDomAdapter.prototype.setData = function (element /** TODO #9100 */, name, value) { throw 'not implemented'; };
4563
+ WorkerDomAdapter.prototype.getComputedStyle = function (element /** TODO #9100 */) { throw 'not implemented'; };
4564
+ WorkerDomAdapter.prototype.getData = function (element /** TODO #9100 */, name) { throw 'not implemented'; };
4565
+ WorkerDomAdapter.prototype.setGlobalVar = function (name, value) { throw 'not implemented'; };
4566
+ WorkerDomAdapter.prototype.requestAnimationFrame = function (callback /** TODO #9100 */) { throw 'not implemented'; };
4567
+ WorkerDomAdapter.prototype.cancelAnimationFrame = function (id /** TODO #9100 */) { throw 'not implemented'; };
4568
+ WorkerDomAdapter.prototype.performanceNow = function () { throw 'not implemented'; };
4569
+ WorkerDomAdapter.prototype.getAnimationPrefix = function () { throw 'not implemented'; };
4570
+ WorkerDomAdapter.prototype.getTransitionEnd = function () { throw 'not implemented'; };
4571
+ WorkerDomAdapter.prototype.supportsAnimation = function () { throw 'not implemented'; };
4572
+ WorkerDomAdapter.prototype.supportsWebAnimation = function () { throw 'not implemented'; };
4573
+ WorkerDomAdapter.prototype.supportsCookies = function () { return false; };
4574
+ WorkerDomAdapter.prototype.getCookie = function (name) { throw 'not implemented'; };
4575
+ WorkerDomAdapter.prototype.setCookie = function (name, value) { throw 'not implemented'; };
4576
+ return WorkerDomAdapter;
4577
+ }(DomAdapter));
4578
+ var PrintLogger = (function () {
4579
+ function PrintLogger() {
4580
+ this.log = print;
4581
+ this.logError = print;
4582
+ this.logGroup = print;
4583
+ }
4584
+ PrintLogger.prototype.logGroupEnd = function () { };
4585
+ return PrintLogger;
4586
+ }());
4587
+ var WORKER_APP_PLATFORM_MARKER = new _angular_core.OpaqueToken('WorkerAppPlatformMarker');
4588
+ /**
4589
+ * @experimental
4590
+ */
4591
+ var WORKER_APP_PLATFORM_PROVIDERS = [_angular_core.PLATFORM_COMMON_PROVIDERS, { provide: WORKER_APP_PLATFORM_MARKER, useValue: true }];
4592
+ /**
4593
+ * @experimental
4594
+ */
4595
+ var WORKER_APP_APPLICATION_PROVIDERS = [
4596
+ _angular_core.APPLICATION_COMMON_PROVIDERS, _angular_common.FORM_PROVIDERS, BROWSER_SANITIZATION_PROVIDERS, Serializer,
4597
+ { provide: ClientMessageBrokerFactory, useClass: ClientMessageBrokerFactory_ },
4598
+ { provide: ServiceMessageBrokerFactory, useClass: ServiceMessageBrokerFactory_ },
4599
+ WebWorkerRootRenderer, { provide: _angular_core.RootRenderer, useExisting: WebWorkerRootRenderer },
4600
+ { provide: ON_WEB_WORKER, useValue: true }, RenderStore,
4601
+ { provide: _angular_core.ExceptionHandler, useFactory: _exceptionHandler$2, deps: [] },
4602
+ { provide: MessageBus, useFactory: createMessageBus, deps: [_angular_core.NgZone] },
4603
+ { provide: _angular_core.APP_INITIALIZER, useValue: setupWebWorker, multi: true }
4604
+ ];
4605
+ /**
4606
+ * @experimental
4607
+ */
4608
+ function workerAppPlatform() {
4609
+ if (isBlank(_angular_core.getPlatform())) {
4610
+ _angular_core.createPlatform(_angular_core.ReflectiveInjector.resolveAndCreate(WORKER_APP_PLATFORM_PROVIDERS));
4611
+ }
4612
+ return _angular_core.assertPlatform(WORKER_APP_PLATFORM_MARKER);
4613
+ }
4614
+ function _exceptionHandler$2() {
4615
+ return new _angular_core.ExceptionHandler(new PrintLogger());
4616
+ }
4617
+ // TODO(jteplitz602) remove this and compile with lib.webworker.d.ts (#3492)
4618
+ var _postMessage = {
4619
+ postMessage: function (message, transferrables) {
4620
+ postMessage(message, transferrables);
4621
+ }
4622
+ };
4623
+ function createMessageBus(zone) {
4624
+ var sink = new PostMessageBusSink(_postMessage);
4625
+ var source = new PostMessageBusSource();
4626
+ var bus = new PostMessageBus(sink, source);
4627
+ bus.attachToZone(zone);
4628
+ return bus;
4629
+ }
4630
+ function setupWebWorker() {
4631
+ WorkerDomAdapter.makeCurrent();
4632
+ }
4633
+ var __platform_browser_private__ = {
4634
+ DomAdapter: DomAdapter,
4635
+ getDOM: getDOM,
4636
+ setRootDomAdapter: setRootDomAdapter,
4637
+ DomRootRenderer: DomRootRenderer,
4638
+ DomRootRenderer_: DomRootRenderer_,
4639
+ DomSharedStylesHost: DomSharedStylesHost,
4640
+ SharedStylesHost: SharedStylesHost
4641
+ };
4642
+ /* @deprecated use BROWSER_PLATFORM_PROVIDERS */
4643
+ var BROWSER_PROVIDERS = BROWSER_PLATFORM_PROVIDERS;
4644
+ exports.BROWSER_PROVIDERS = BROWSER_PROVIDERS;
4645
+ exports.BrowserPlatformLocation = BrowserPlatformLocation;
4646
+ exports.Title = Title;
4647
+ exports.disableDebugTools = disableDebugTools;
4648
+ exports.enableDebugTools = enableDebugTools;
4649
+ exports.By = By;
4650
+ exports.ELEMENT_PROBE_PROVIDERS = ELEMENT_PROBE_PROVIDERS;
4651
+ exports.DOCUMENT = DOCUMENT;
4652
+ exports.DomEventsPlugin = DomEventsPlugin;
4653
+ exports.EVENT_MANAGER_PLUGINS = EVENT_MANAGER_PLUGINS;
4654
+ exports.EventManager = EventManager;
4655
+ exports.HAMMER_GESTURE_CONFIG = HAMMER_GESTURE_CONFIG;
4656
+ exports.HammerGestureConfig = HammerGestureConfig;
4657
+ exports.KeyEventsPlugin = KeyEventsPlugin;
4658
+ exports.DomSanitizationService = DomSanitizationService;
4659
+ exports.SecurityContext = SecurityContext;
4660
+ exports.ClientMessageBroker = ClientMessageBroker;
4661
+ exports.ClientMessageBrokerFactory = ClientMessageBrokerFactory;
4662
+ exports.FnArg = FnArg;
4663
+ exports.UiArguments = UiArguments;
4664
+ exports.ReceivedMessage = ReceivedMessage;
4665
+ exports.ServiceMessageBroker = ServiceMessageBroker;
4666
+ exports.ServiceMessageBrokerFactory = ServiceMessageBrokerFactory;
4667
+ exports.PRIMITIVE = PRIMITIVE;
4668
+ exports.WORKER_APP_LOCATION_PROVIDERS = WORKER_APP_LOCATION_PROVIDERS;
4669
+ exports.WORKER_UI_LOCATION_PROVIDERS = WORKER_UI_LOCATION_PROVIDERS;
4670
+ exports.BROWSER_PLATFORM_PROVIDERS = BROWSER_PLATFORM_PROVIDERS;
4671
+ exports.BROWSER_SANITIZATION_PROVIDERS = BROWSER_SANITIZATION_PROVIDERS;
4672
+ exports.BROWSER_APP_PROVIDERS = BROWSER_APP_PROVIDERS;
4673
+ exports.browserPlatform = browserPlatform;
4674
+ exports.MessageBus = MessageBus;
4675
+ exports.WebWorkerInstance = WebWorkerInstance;
4676
+ exports.WORKER_SCRIPT = WORKER_SCRIPT;
4677
+ exports.WORKER_UI_STARTABLE_MESSAGING_SERVICE = WORKER_UI_STARTABLE_MESSAGING_SERVICE;
4678
+ exports.WORKER_UI_PLATFORM_PROVIDERS = WORKER_UI_PLATFORM_PROVIDERS;
4679
+ exports.WORKER_UI_APPLICATION_PROVIDERS = WORKER_UI_APPLICATION_PROVIDERS;
4680
+ exports.workerUiPlatform = workerUiPlatform;
4681
+ exports.WORKER_APP_PLATFORM_PROVIDERS = WORKER_APP_PLATFORM_PROVIDERS;
4682
+ exports.WORKER_APP_APPLICATION_PROVIDERS = WORKER_APP_APPLICATION_PROVIDERS;
4683
+ exports.workerAppPlatform = workerAppPlatform;
4684
+ exports.__platform_browser_private__ = __platform_browser_private__;
4685
+ }));