ember-inspector 4.13.1-alpha.2025.7.3 → 4.13.1-alpha.2025.7.30

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 (234) hide show
  1. package/app/index.html +1 -1
  2. package/app/styles/app.scss +1 -0
  3. package/dist/bookmarklet/load_inspector.js +1 -0
  4. package/dist/bookmarklet/panes-3-16-0/assets/{chunk.524.12f8b1dc0628d8e548c0.js → chunk.524.984a16186ec2ee340140.js} +4 -4
  5. package/dist/{firefox/panes-3-16-0/assets/chunk.582.8a5f06f7065ffe209555.js → bookmarklet/panes-3-16-0/assets/chunk.582.866bd83d4661b3b843fd.js} +5 -5
  6. package/dist/bookmarklet/panes-3-16-0/assets/ember-inspector.css +835 -0
  7. package/dist/bookmarklet/panes-3-16-0/assets/ember-inspector.js +42 -4
  8. package/dist/bookmarklet/panes-3-16-0/assets/vendor.css +0 -836
  9. package/dist/bookmarklet/panes-3-16-0/assets/vendor.js +3967 -4019
  10. package/dist/bookmarklet/panes-3-16-0/base-object-HAEdWjmg.js +59 -0
  11. package/dist/bookmarklet/panes-3-16-0/basic-DfbgtngO.js +144 -0
  12. package/dist/bookmarklet/panes-3-16-0/basic-debug.js +6 -0
  13. package/dist/bookmarklet/panes-3-16-0/bookmarklet-debug.js +34 -0
  14. package/dist/bookmarklet/panes-3-16-0/chrome-debug.js +12 -0
  15. package/dist/bookmarklet/panes-3-16-0/ember.js +108 -0
  16. package/dist/bookmarklet/panes-3-16-0/ember_debug.js +22 -10646
  17. package/dist/bookmarklet/panes-3-16-0/evented-BCTya3yE.js +62 -0
  18. package/dist/bookmarklet/panes-3-16-0/firefox-debug.js +32 -0
  19. package/dist/bookmarklet/panes-3-16-0/index.html +3 -3
  20. package/dist/bookmarklet/panes-3-16-0/internals-CRmXMEzb.js +12 -0
  21. package/dist/bookmarklet/panes-3-16-0/main.js +7642 -0
  22. package/dist/bookmarklet/panes-3-16-0/port.js +108 -0
  23. package/dist/bookmarklet/panes-3-16-0/profile-node.js +60 -0
  24. package/dist/bookmarklet/panes-3-16-0/promise-assembler.js +218 -0
  25. package/dist/bookmarklet/panes-3-16-0/runloop-CF-Qpqgy.js +1138 -0
  26. package/dist/bookmarklet/panes-3-16-0/start-inspector-BPAW_WLv.js +376 -0
  27. package/dist/bookmarklet/panes-3-16-0/type-check.js +119 -0
  28. package/dist/bookmarklet/panes-3-16-0/version.js +90 -0
  29. package/dist/bookmarklet/panes-3-16-0/versions.js +4 -0
  30. package/dist/bookmarklet/panes-3-16-0/web-extension-C3pMNVSY.js +144 -0
  31. package/dist/bookmarklet/panes-3-16-0/websocket-debug.js +60 -0
  32. package/dist/chrome/content-script.js +1 -0
  33. package/dist/chrome/manifest.json +3 -3
  34. package/dist/{firefox/panes-3-16-0/assets/chunk.524.12f8b1dc0628d8e548c0.js → chrome/panes-3-16-0/assets/chunk.524.984a16186ec2ee340140.js} +4 -4
  35. package/dist/{bookmarklet/panes-3-16-0/assets/chunk.582.8a5f06f7065ffe209555.js → chrome/panes-3-16-0/assets/chunk.582.866bd83d4661b3b843fd.js} +5 -5
  36. package/dist/chrome/panes-3-16-0/assets/ember-inspector.css +835 -0
  37. package/dist/chrome/panes-3-16-0/assets/ember-inspector.js +42 -4
  38. package/dist/chrome/panes-3-16-0/assets/vendor.css +0 -836
  39. package/dist/chrome/panes-3-16-0/assets/vendor.js +3967 -4019
  40. package/dist/chrome/panes-3-16-0/base-object-HAEdWjmg.js +59 -0
  41. package/dist/chrome/panes-3-16-0/basic-DfbgtngO.js +144 -0
  42. package/dist/chrome/panes-3-16-0/basic-debug.js +6 -0
  43. package/dist/chrome/panes-3-16-0/bookmarklet-debug.js +34 -0
  44. package/dist/chrome/panes-3-16-0/chrome-debug.js +12 -0
  45. package/dist/chrome/panes-3-16-0/ember.js +108 -0
  46. package/dist/chrome/panes-3-16-0/ember_debug.js +12 -10658
  47. package/dist/chrome/panes-3-16-0/evented-BCTya3yE.js +62 -0
  48. package/dist/chrome/panes-3-16-0/firefox-debug.js +32 -0
  49. package/dist/chrome/panes-3-16-0/index.html +3 -3
  50. package/dist/chrome/panes-3-16-0/internals-CRmXMEzb.js +12 -0
  51. package/dist/chrome/panes-3-16-0/main.js +7642 -0
  52. package/dist/chrome/panes-3-16-0/port.js +108 -0
  53. package/dist/chrome/panes-3-16-0/profile-node.js +60 -0
  54. package/dist/chrome/panes-3-16-0/promise-assembler.js +218 -0
  55. package/dist/chrome/panes-3-16-0/runloop-CF-Qpqgy.js +1138 -0
  56. package/dist/chrome/panes-3-16-0/start-inspector-BPAW_WLv.js +376 -0
  57. package/dist/chrome/panes-3-16-0/type-check.js +119 -0
  58. package/dist/chrome/panes-3-16-0/version.js +90 -0
  59. package/dist/chrome/panes-3-16-0/versions.js +4 -0
  60. package/dist/chrome/panes-3-16-0/web-extension-C3pMNVSY.js +144 -0
  61. package/dist/chrome/panes-3-16-0/websocket-debug.js +60 -0
  62. package/dist/firefox/content-script.js +1 -0
  63. package/dist/firefox/manifest.json +3 -3
  64. package/dist/{chrome/panes-3-16-0/assets/chunk.524.12f8b1dc0628d8e548c0.js → firefox/panes-3-16-0/assets/chunk.524.984a16186ec2ee340140.js} +4 -4
  65. package/dist/{websocket/assets/chunk.582.8a5f06f7065ffe209555.js → firefox/panes-3-16-0/assets/chunk.582.866bd83d4661b3b843fd.js} +5 -5
  66. package/dist/firefox/panes-3-16-0/assets/ember-inspector.css +835 -0
  67. package/dist/firefox/panes-3-16-0/assets/ember-inspector.js +42 -4
  68. package/dist/firefox/panes-3-16-0/assets/vendor.css +0 -836
  69. package/dist/firefox/panes-3-16-0/assets/vendor.js +3967 -4019
  70. package/dist/firefox/panes-3-16-0/base-object-HAEdWjmg.js +59 -0
  71. package/dist/firefox/panes-3-16-0/basic-DfbgtngO.js +144 -0
  72. package/dist/firefox/panes-3-16-0/basic-debug.js +6 -0
  73. package/dist/firefox/panes-3-16-0/bookmarklet-debug.js +34 -0
  74. package/dist/firefox/panes-3-16-0/chrome-debug.js +12 -0
  75. package/dist/firefox/panes-3-16-0/ember.js +108 -0
  76. package/dist/firefox/panes-3-16-0/ember_debug.js +28 -10654
  77. package/dist/firefox/panes-3-16-0/evented-BCTya3yE.js +62 -0
  78. package/dist/firefox/panes-3-16-0/firefox-debug.js +32 -0
  79. package/dist/firefox/panes-3-16-0/index.html +3 -3
  80. package/dist/firefox/panes-3-16-0/internals-CRmXMEzb.js +12 -0
  81. package/dist/firefox/panes-3-16-0/main.js +7642 -0
  82. package/dist/firefox/panes-3-16-0/port.js +108 -0
  83. package/dist/firefox/panes-3-16-0/profile-node.js +60 -0
  84. package/dist/firefox/panes-3-16-0/promise-assembler.js +218 -0
  85. package/dist/firefox/panes-3-16-0/runloop-CF-Qpqgy.js +1138 -0
  86. package/dist/firefox/panes-3-16-0/start-inspector-BPAW_WLv.js +376 -0
  87. package/dist/firefox/panes-3-16-0/type-check.js +119 -0
  88. package/dist/firefox/panes-3-16-0/version.js +90 -0
  89. package/dist/firefox/panes-3-16-0/versions.js +4 -0
  90. package/dist/firefox/panes-3-16-0/web-extension-C3pMNVSY.js +144 -0
  91. package/dist/firefox/panes-3-16-0/websocket-debug.js +60 -0
  92. package/dist/websocket/assets/{chunk.524.12f8b1dc0628d8e548c0.js → chunk.524.984a16186ec2ee340140.js} +4 -4
  93. package/dist/{chrome/panes-3-16-0/assets/chunk.582.8a5f06f7065ffe209555.js → websocket/assets/chunk.582.866bd83d4661b3b843fd.js} +5 -5
  94. package/dist/websocket/assets/ember-inspector.css +835 -0
  95. package/dist/websocket/assets/ember-inspector.js +42 -4
  96. package/dist/websocket/assets/vendor.css +0 -836
  97. package/dist/websocket/assets/vendor.js +3967 -4019
  98. package/dist/websocket/base-object-HAEdWjmg.js +59 -0
  99. package/dist/websocket/basic-DfbgtngO.js +144 -0
  100. package/dist/websocket/basic-debug.js +6 -0
  101. package/dist/websocket/bookmarklet-debug.js +34 -0
  102. package/dist/websocket/chrome-debug.js +12 -0
  103. package/dist/websocket/ember.js +108 -0
  104. package/dist/websocket/ember_debug.js +36 -10634
  105. package/dist/websocket/evented-BCTya3yE.js +62 -0
  106. package/dist/websocket/firefox-debug.js +32 -0
  107. package/dist/websocket/index.html +3 -3
  108. package/dist/websocket/internals-CRmXMEzb.js +12 -0
  109. package/dist/websocket/main.js +7642 -0
  110. package/dist/websocket/port.js +108 -0
  111. package/dist/websocket/profile-node.js +60 -0
  112. package/dist/websocket/promise-assembler.js +218 -0
  113. package/dist/websocket/runloop-CF-Qpqgy.js +1138 -0
  114. package/dist/websocket/start-inspector-BPAW_WLv.js +376 -0
  115. package/dist/websocket/type-check.js +119 -0
  116. package/dist/websocket/version.js +90 -0
  117. package/dist/websocket/versions.js +4 -0
  118. package/dist/websocket/web-extension-C3pMNVSY.js +144 -0
  119. package/dist/websocket/websocket-debug.js +60 -0
  120. package/ember-cli-build.js +28 -91
  121. package/ember_debug/adapters/basic.js +9 -29
  122. package/ember_debug/adapters/web-extension.js +4 -4
  123. package/ember_debug/adapters/websocket.js +2 -2
  124. package/ember_debug/container-debug.js +1 -1
  125. package/ember_debug/data-debug.js +2 -2
  126. package/ember_debug/debug-port.js +1 -1
  127. package/ember_debug/deprecation-debug.js +6 -6
  128. package/ember_debug/entrypoints/basic-debug.js +6 -0
  129. package/ember_debug/entrypoints/bookmarklet-debug.js +6 -0
  130. package/ember_debug/entrypoints/chrome-debug.js +6 -0
  131. package/ember_debug/entrypoints/firefox-debug.js +6 -0
  132. package/ember_debug/entrypoints/websocket-debug.js +6 -0
  133. package/ember_debug/general-debug.js +3 -3
  134. package/ember_debug/lib/boot-ember-inspector.js +9 -0
  135. package/ember_debug/lib/get-applications.js +27 -0
  136. package/ember_debug/lib/load-ember-debug-in-webpage.js +30 -0
  137. package/ember_debug/lib/send-apps.js +14 -0
  138. package/ember_debug/lib/send-version-miss.js +39 -0
  139. package/ember_debug/lib/setup-instance-initializer.js +16 -0
  140. package/ember_debug/lib/start-inspector.js +211 -0
  141. package/ember_debug/lib/version-test.js +73 -0
  142. package/ember_debug/lib/versions.js +3 -0
  143. package/ember_debug/libs/capture-render-tree.js +1 -1
  144. package/ember_debug/libs/promise-assembler.js +4 -4
  145. package/ember_debug/libs/render-tree.js +5 -5
  146. package/ember_debug/libs/source-map.js +1 -1
  147. package/ember_debug/libs/view-inspection.js +3 -3
  148. package/ember_debug/main.js +17 -20
  149. package/ember_debug/models/profile-manager.js +5 -6
  150. package/ember_debug/models/profile-node.js +1 -1
  151. package/ember_debug/models/promise.js +2 -2
  152. package/ember_debug/object-inspector.js +9 -9
  153. package/ember_debug/package.json +3 -1
  154. package/ember_debug/port.js +4 -4
  155. package/ember_debug/promise-debug.js +4 -4
  156. package/ember_debug/render-debug.js +5 -5
  157. package/ember_debug/rollup.config.js +5 -29
  158. package/ember_debug/route-debug.js +7 -7
  159. package/ember_debug/services/session.js +1 -1
  160. package/ember_debug/utils/ember/object/internals.js +1 -6
  161. package/ember_debug/utils/ember/runloop.js +2 -7
  162. package/ember_debug/utils/ember-object-names.js +2 -2
  163. package/ember_debug/utils/ember.js +72 -28
  164. package/ember_debug/utils/get-object-name.js +1 -1
  165. package/ember_debug/utils/type-check.js +2 -2
  166. package/ember_debug/view-debug.js +4 -4
  167. package/package.json +5 -9
  168. package/skeletons/bookmarklet/load_inspector.js +1 -0
  169. package/skeletons/web-extension/content-script.js +1 -0
  170. package/skeletons/web-extension/manifest.json +3 -3
  171. package/tests/ember_debug/profile-manager-test.js +1 -3
  172. package/tests/index.html +1 -2
  173. package/tests/integration/injection-test.js +3 -3
  174. package/tests/test-helper.js +0 -3
  175. package/ember_debug/utils/ember/debug.js +0 -21
  176. package/ember_debug/utils/ember/instrumentation.js +0 -11
  177. package/ember_debug/utils/rsvp.js +0 -14
  178. package/ember_debug/vendor/loader.js +0 -54
  179. package/ember_debug/vendor/startup-wrapper.js +0 -402
  180. package/lib/ui/app/components/ui/disclosure-triangle.js +0 -1
  181. package/lib/ui/app/components/ui/disclosure.js +0 -1
  182. package/lib/ui/app/components/ui/drag-handle.js +0 -1
  183. package/lib/ui/app/components/ui/draggable-column.js +0 -1
  184. package/lib/ui/app/components/ui/empty-message.js +0 -1
  185. package/lib/ui/app/components/ui/error-page.js +0 -1
  186. package/lib/ui/app/components/ui/open-links-in-new-window.js +0 -1
  187. package/lib/ui/app/components/ui/resizable-column.js +0 -1
  188. package/lib/ui/app/components/ui/send-to-console.js +0 -1
  189. package/lib/ui/app/components/ui/toolbar-clear-button.js +0 -1
  190. package/lib/ui/app/components/ui/toolbar-divider.js +0 -1
  191. package/lib/ui/app/components/ui/toolbar-reload-button.js +0 -1
  192. package/lib/ui/app/components/ui/toolbar-search-field.js +0 -1
  193. package/lib/ui/app/components/ui/warning-message.js +0 -1
  194. package/lib/ui/index.js +0 -34
  195. package/lib/ui/package.json +0 -13
  196. /package/{lib/ui/addon/components → app/components/ui}/disclosure-triangle.hbs +0 -0
  197. /package/{lib/ui/addon/components → app/components/ui}/disclosure.hbs +0 -0
  198. /package/{lib/ui/addon/components → app/components/ui}/disclosure.js +0 -0
  199. /package/{lib/ui/addon/components → app/components/ui}/drag-handle.hbs +0 -0
  200. /package/{lib/ui/addon/components → app/components/ui}/drag-handle.js +0 -0
  201. /package/{lib/ui/addon/components → app/components/ui}/draggable-column.hbs +0 -0
  202. /package/{lib/ui/addon/components → app/components/ui}/draggable-column.js +0 -0
  203. /package/{lib/ui/addon/components → app/components/ui}/empty-message.hbs +0 -0
  204. /package/{lib/ui/addon/components → app/components/ui}/error-page.hbs +0 -0
  205. /package/{lib/ui/addon/components → app/components/ui}/open-links-in-new-window.hbs +0 -0
  206. /package/{lib/ui/addon/components → app/components/ui}/open-links-in-new-window.js +0 -0
  207. /package/{lib/ui/addon/components → app/components/ui}/resizable-column.hbs +0 -0
  208. /package/{lib/ui/addon/components → app/components/ui}/resizable-column.js +0 -0
  209. /package/{lib/ui/addon/components → app/components/ui}/send-to-console.hbs +0 -0
  210. /package/{lib/ui/addon/components → app/components/ui}/toolbar-clear-button.hbs +0 -0
  211. /package/{lib/ui/addon/components → app/components/ui}/toolbar-divider.hbs +0 -0
  212. /package/{lib/ui/addon/components → app/components/ui}/toolbar-reload-button.hbs +0 -0
  213. /package/{lib/ui/addon/components → app/components/ui}/toolbar-search-field.hbs +0 -0
  214. /package/{lib/ui/addon/components → app/components/ui}/toolbar-search-field.js +0 -0
  215. /package/{lib/ui/addon/components → app/components/ui}/warning-message.hbs +0 -0
  216. /package/{lib/ui/addon/styles → app/styles/ui}/_disclosure-triangle.scss +0 -0
  217. /package/{lib/ui/addon/styles → app/styles/ui}/_drag-handle.scss +0 -0
  218. /package/{lib/ui/addon/styles → app/styles/ui}/_empty-message.scss +0 -0
  219. /package/{lib/ui/addon/styles → app/styles/ui}/_error-page.scss +0 -0
  220. /package/{lib/ui/addon/styles → app/styles/ui}/_goto-source.scss +0 -0
  221. /package/{lib/ui/addon/styles → app/styles/ui}/_list.scss +0 -0
  222. /package/{lib/ui/addon/styles → app/styles/ui}/_nav.scss +0 -0
  223. /package/{lib/ui/addon/styles → app/styles/ui}/_object-inspector-toggle.scss +0 -0
  224. /package/{lib/ui/addon/styles → app/styles/ui}/_pill.scss +0 -0
  225. /package/{lib/ui/addon/styles → app/styles/ui}/_send-to-console.scss +0 -0
  226. /package/{lib/ui/addon/styles → app/styles/ui}/_split.scss +0 -0
  227. /package/{lib/ui/addon/styles/addon.scss → app/styles/ui/_ui.scss} +0 -0
  228. /package/{lib/ui/addon/styles → app/styles/ui}/_warning.scss +0 -0
  229. /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_checkbox.scss +0 -0
  230. /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_divider.scss +0 -0
  231. /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_icon-button.scss +0 -0
  232. /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_index.scss +0 -0
  233. /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_radio.scss +0 -0
  234. /package/{lib/ui/addon/styles → app/styles/ui}/toolbar/_search.scss +0 -0
@@ -0,0 +1,1138 @@
1
+ import { Runloop } from './ember.js';
2
+
3
+ function getDefaultExportFromCjs (x) {
4
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
+ }
6
+
7
+ var backburner = {};
8
+
9
+ var hasRequiredBackburner;
10
+
11
+ function requireBackburner () {
12
+ if (hasRequiredBackburner) return backburner;
13
+ hasRequiredBackburner = 1;
14
+
15
+ Object.defineProperty(backburner, '__esModule', {
16
+ value: true
17
+ });
18
+ var SET_TIMEOUT = setTimeout;
19
+ var NOOP = function () {};
20
+ function buildNext(flush) {
21
+ // Using "promises first" here to:
22
+ //
23
+ // 1) Ensure more consistent experience on browsers that
24
+ // have differently queued microtasks (separate queues for
25
+ // MutationObserver vs Promises).
26
+ // 2) Ensure better debugging experiences (it shows up in Chrome
27
+ // call stack as "Promise.then (async)") which is more consistent
28
+ // with user expectations
29
+ //
30
+ // When Promise is unavailable use MutationObserver (mostly so that we
31
+ // still get microtasks on IE11), and when neither MutationObserver and
32
+ // Promise are present use a plain old setTimeout.
33
+ if (typeof Promise === 'function') {
34
+ var autorunPromise = Promise.resolve();
35
+ return function () {
36
+ return autorunPromise.then(flush);
37
+ };
38
+ } else if (typeof MutationObserver === 'function') {
39
+ var iterations = 0;
40
+ var observer = new MutationObserver(flush);
41
+ var node = document.createTextNode('');
42
+ observer.observe(node, {
43
+ characterData: true
44
+ });
45
+ return function () {
46
+ iterations = ++iterations % 2;
47
+ node.data = '' + iterations;
48
+ return iterations;
49
+ };
50
+ } else {
51
+ return function () {
52
+ return SET_TIMEOUT(flush, 0);
53
+ };
54
+ }
55
+ }
56
+ function buildPlatform(flush) {
57
+ var clearNext = NOOP;
58
+ return {
59
+ setTimeout: function setTimeout$1(fn, ms) {
60
+ return setTimeout(fn, ms);
61
+ },
62
+ clearTimeout: function clearTimeout$1(timerId) {
63
+ return clearTimeout(timerId);
64
+ },
65
+ now: function now() {
66
+ return Date.now();
67
+ },
68
+ next: buildNext(flush),
69
+ clearNext: clearNext
70
+ };
71
+ }
72
+ var NUMBER = /\d+/;
73
+ var TIMERS_OFFSET = 6;
74
+ function isCoercableNumber(suspect) {
75
+ var type = typeof suspect;
76
+ return type === 'number' && suspect === suspect || type === 'string' && NUMBER.test(suspect);
77
+ }
78
+ function getOnError(options) {
79
+ return options.onError || options.onErrorTarget && options.onErrorTarget[options.onErrorMethod];
80
+ }
81
+ function findItem(target, method, collection) {
82
+ var index = -1;
83
+ for (var i = 0, l = collection.length; i < l; i += 4) {
84
+ if (collection[i] === target && collection[i + 1] === method) {
85
+ index = i;
86
+ break;
87
+ }
88
+ }
89
+ return index;
90
+ }
91
+ function findTimerItem(target, method, collection) {
92
+ var index = -1;
93
+ for (var i = 2, l = collection.length; i < l; i += 6) {
94
+ if (collection[i] === target && collection[i + 1] === method) {
95
+ index = i - 2;
96
+ break;
97
+ }
98
+ }
99
+ return index;
100
+ }
101
+ function getQueueItems(items, queueItemLength, queueItemPositionOffset) {
102
+ if (queueItemPositionOffset === void 0) queueItemPositionOffset = 0;
103
+ var queueItems = [];
104
+ for (var i = 0; i < items.length; i += queueItemLength) {
105
+ var maybeError = items[i + 3 /* stack */ + queueItemPositionOffset];
106
+ var queueItem = {
107
+ target: items[i + 0 /* target */ + queueItemPositionOffset],
108
+ method: items[i + 1 /* method */ + queueItemPositionOffset],
109
+ args: items[i + 2 /* args */ + queueItemPositionOffset],
110
+ stack: maybeError !== undefined && 'stack' in maybeError ? maybeError.stack : ''
111
+ };
112
+ queueItems.push(queueItem);
113
+ }
114
+ return queueItems;
115
+ }
116
+ function binarySearch(time, timers) {
117
+ var start = 0;
118
+ var end = timers.length - TIMERS_OFFSET;
119
+ var middle;
120
+ var l;
121
+ while (start < end) {
122
+ // since timers is an array of pairs 'l' will always
123
+ // be an integer
124
+ l = (end - start) / TIMERS_OFFSET;
125
+ // compensate for the index in case even number
126
+ // of pairs inside timers
127
+ middle = start + l - l % TIMERS_OFFSET;
128
+ if (time >= timers[middle]) {
129
+ start = middle + TIMERS_OFFSET;
130
+ } else {
131
+ end = middle;
132
+ }
133
+ }
134
+ return time >= timers[start] ? start + TIMERS_OFFSET : start;
135
+ }
136
+ var QUEUE_ITEM_LENGTH = 4;
137
+ var Queue = function Queue(name, options, globalOptions) {
138
+ if (options === void 0) options = {};
139
+ if (globalOptions === void 0) globalOptions = {};
140
+ this._queueBeingFlushed = [];
141
+ this.targetQueues = new Map();
142
+ this.index = 0;
143
+ this._queue = [];
144
+ this.name = name;
145
+ this.options = options;
146
+ this.globalOptions = globalOptions;
147
+ };
148
+ Queue.prototype.stackFor = function stackFor(index) {
149
+ if (index < this._queue.length) {
150
+ var entry = this._queue[index * 3 + QUEUE_ITEM_LENGTH];
151
+ if (entry) {
152
+ return entry.stack;
153
+ } else {
154
+ return null;
155
+ }
156
+ }
157
+ };
158
+ Queue.prototype.flush = function flush(sync) {
159
+ var ref = this.options;
160
+ var before = ref.before;
161
+ var after = ref.after;
162
+ var target;
163
+ var method;
164
+ var args;
165
+ var errorRecordedForStack;
166
+ this.targetQueues.clear();
167
+ if (this._queueBeingFlushed.length === 0) {
168
+ this._queueBeingFlushed = this._queue;
169
+ this._queue = [];
170
+ }
171
+ if (before !== undefined) {
172
+ before();
173
+ }
174
+ var invoke;
175
+ var queueItems = this._queueBeingFlushed;
176
+ if (queueItems.length > 0) {
177
+ var onError = getOnError(this.globalOptions);
178
+ invoke = onError ? this.invokeWithOnError : this.invoke;
179
+ for (var i = this.index; i < queueItems.length; i += QUEUE_ITEM_LENGTH) {
180
+ this.index += QUEUE_ITEM_LENGTH;
181
+ method = queueItems[i + 1];
182
+ // method could have been nullified / canceled during flush
183
+ if (method !== null) {
184
+ //
185
+ //** Attention intrepid developer **
186
+ //
187
+ //To find out the stack of this task when it was scheduled onto
188
+ //the run loop, add the following to your app.js:
189
+ //
190
+ //Ember.run.backburner.DEBUG = true; // NOTE: This slows your app, don't leave it on in production.
191
+ //
192
+ //Once that is in place, when you are at a breakpoint and navigate
193
+ //here in the stack explorer, you can look at `errorRecordedForStack.stack`,
194
+ //which will be the captured stack when this job was scheduled.
195
+ //
196
+ //One possible long-term solution is the following Chrome issue:
197
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=332624
198
+ //
199
+ target = queueItems[i];
200
+ args = queueItems[i + 2];
201
+ errorRecordedForStack = queueItems[i + 3]; // Debugging assistance
202
+ invoke(target, method, args, onError, errorRecordedForStack);
203
+ }
204
+ if (this.index !== this._queueBeingFlushed.length && this.globalOptions.mustYield && this.globalOptions.mustYield()) {
205
+ return 1 /* Pause */;
206
+ }
207
+ }
208
+ }
209
+ if (after !== undefined) {
210
+ after();
211
+ }
212
+ this._queueBeingFlushed.length = 0;
213
+ this.index = 0;
214
+ if (sync !== false && this._queue.length > 0) {
215
+ // check if new items have been added
216
+ this.flush(true);
217
+ }
218
+ };
219
+ Queue.prototype.hasWork = function hasWork() {
220
+ return this._queueBeingFlushed.length > 0 || this._queue.length > 0;
221
+ };
222
+ Queue.prototype.cancel = function cancel(ref) {
223
+ var target = ref.target;
224
+ var method = ref.method;
225
+ var queue = this._queue;
226
+ var targetQueueMap = this.targetQueues.get(target);
227
+ if (targetQueueMap !== undefined) {
228
+ targetQueueMap.delete(method);
229
+ }
230
+ var index = findItem(target, method, queue);
231
+ if (index > -1) {
232
+ queue[index + 1] = null;
233
+ return true;
234
+ }
235
+ // if not found in current queue
236
+ // could be in the queue that is being flushed
237
+ queue = this._queueBeingFlushed;
238
+ index = findItem(target, method, queue);
239
+ if (index > -1) {
240
+ queue[index + 1] = null;
241
+ return true;
242
+ }
243
+ return false;
244
+ };
245
+ Queue.prototype.push = function push(target, method, args, stack) {
246
+ this._queue.push(target, method, args, stack);
247
+ return {
248
+ queue: this,
249
+ target: target,
250
+ method: method
251
+ };
252
+ };
253
+ Queue.prototype.pushUnique = function pushUnique(target, method, args, stack) {
254
+ var localQueueMap = this.targetQueues.get(target);
255
+ if (localQueueMap === undefined) {
256
+ localQueueMap = new Map();
257
+ this.targetQueues.set(target, localQueueMap);
258
+ }
259
+ var index = localQueueMap.get(method);
260
+ if (index === undefined) {
261
+ var queueIndex = this._queue.push(target, method, args, stack) - QUEUE_ITEM_LENGTH;
262
+ localQueueMap.set(method, queueIndex);
263
+ } else {
264
+ var queue = this._queue;
265
+ queue[index + 2] = args; // replace args
266
+ queue[index + 3] = stack; // replace stack
267
+ }
268
+ return {
269
+ queue: this,
270
+ target: target,
271
+ method: method
272
+ };
273
+ };
274
+ Queue.prototype._getDebugInfo = function _getDebugInfo(debugEnabled) {
275
+ if (debugEnabled) {
276
+ var debugInfo = getQueueItems(this._queue, QUEUE_ITEM_LENGTH);
277
+ return debugInfo;
278
+ }
279
+ return undefined;
280
+ };
281
+ Queue.prototype.invoke = function invoke(target, method, args /*, onError, errorRecordedForStack */) {
282
+ if (args === undefined) {
283
+ method.call(target);
284
+ } else {
285
+ method.apply(target, args);
286
+ }
287
+ };
288
+ Queue.prototype.invokeWithOnError = function invokeWithOnError(target, method, args, onError, errorRecordedForStack) {
289
+ try {
290
+ if (args === undefined) {
291
+ method.call(target);
292
+ } else {
293
+ method.apply(target, args);
294
+ }
295
+ } catch (error) {
296
+ onError(error, errorRecordedForStack);
297
+ }
298
+ };
299
+ var DeferredActionQueues = function DeferredActionQueues(queueNames, options) {
300
+ if (queueNames === void 0) queueNames = [];
301
+ this.queues = {};
302
+ this.queueNameIndex = 0;
303
+ this.queueNames = queueNames;
304
+ queueNames.reduce(function (queues, queueName) {
305
+ queues[queueName] = new Queue(queueName, options[queueName], options);
306
+ return queues;
307
+ }, this.queues);
308
+ };
309
+ /**
310
+ * @method schedule
311
+ * @param {String} queueName
312
+ * @param {Any} target
313
+ * @param {Any} method
314
+ * @param {Any} args
315
+ * @param {Boolean} onceFlag
316
+ * @param {Any} stack
317
+ * @return queue
318
+ */
319
+ DeferredActionQueues.prototype.schedule = function schedule(queueName, target, method, args, onceFlag, stack) {
320
+ var queues = this.queues;
321
+ var queue = queues[queueName];
322
+ if (queue === undefined) {
323
+ throw new Error("You attempted to schedule an action in a queue (" + queueName + ") that doesn't exist");
324
+ }
325
+ if (method === undefined || method === null) {
326
+ throw new Error("You attempted to schedule an action in a queue (" + queueName + ") for a method that doesn't exist");
327
+ }
328
+ this.queueNameIndex = 0;
329
+ if (onceFlag) {
330
+ return queue.pushUnique(target, method, args, stack);
331
+ } else {
332
+ return queue.push(target, method, args, stack);
333
+ }
334
+ };
335
+ /**
336
+ * DeferredActionQueues.flush() calls Queue.flush()
337
+ *
338
+ * @method flush
339
+ * @param {Boolean} fromAutorun
340
+ */
341
+ DeferredActionQueues.prototype.flush = function flush(fromAutorun) {
342
+ if (fromAutorun === void 0) fromAutorun = false;
343
+ var queue;
344
+ var queueName;
345
+ var numberOfQueues = this.queueNames.length;
346
+ while (this.queueNameIndex < numberOfQueues) {
347
+ queueName = this.queueNames[this.queueNameIndex];
348
+ queue = this.queues[queueName];
349
+ if (queue.hasWork() === false) {
350
+ this.queueNameIndex++;
351
+ if (fromAutorun && this.queueNameIndex < numberOfQueues) {
352
+ return 1 /* Pause */;
353
+ }
354
+ } else {
355
+ if (queue.flush(false /* async */) === 1 /* Pause */) {
356
+ return 1 /* Pause */;
357
+ }
358
+ }
359
+ }
360
+ };
361
+ /**
362
+ * Returns debug information for the current queues.
363
+ *
364
+ * @method _getDebugInfo
365
+ * @param {Boolean} debugEnabled
366
+ * @returns {IDebugInfo | undefined}
367
+ */
368
+ DeferredActionQueues.prototype._getDebugInfo = function _getDebugInfo(debugEnabled) {
369
+ if (debugEnabled) {
370
+ var debugInfo = {};
371
+ var queue;
372
+ var queueName;
373
+ var numberOfQueues = this.queueNames.length;
374
+ var i = 0;
375
+ while (i < numberOfQueues) {
376
+ queueName = this.queueNames[i];
377
+ queue = this.queues[queueName];
378
+ debugInfo[queueName] = queue._getDebugInfo(debugEnabled);
379
+ i++;
380
+ }
381
+ return debugInfo;
382
+ }
383
+ return;
384
+ };
385
+ function iteratorDrain(fn) {
386
+ var iterator = fn();
387
+ var result = iterator.next();
388
+ while (result.done === false) {
389
+ result.value();
390
+ result = iterator.next();
391
+ }
392
+ }
393
+ var noop = function () {};
394
+ var DISABLE_SCHEDULE = Object.freeze([]);
395
+ function parseArgs() {
396
+ var arguments$1 = arguments;
397
+ var length = arguments.length;
398
+ var args;
399
+ var method;
400
+ var target;
401
+ if (length === 0) ;else if (length === 1) {
402
+ target = null;
403
+ method = arguments[0];
404
+ } else {
405
+ var argsIndex = 2;
406
+ var methodOrTarget = arguments[0];
407
+ var methodOrArgs = arguments[1];
408
+ var type = typeof methodOrArgs;
409
+ if (type === 'function') {
410
+ target = methodOrTarget;
411
+ method = methodOrArgs;
412
+ } else if (methodOrTarget !== null && type === 'string' && methodOrArgs in methodOrTarget) {
413
+ target = methodOrTarget;
414
+ method = target[methodOrArgs];
415
+ } else if (typeof methodOrTarget === 'function') {
416
+ argsIndex = 1;
417
+ target = null;
418
+ method = methodOrTarget;
419
+ }
420
+ if (length > argsIndex) {
421
+ var len = length - argsIndex;
422
+ args = new Array(len);
423
+ for (var i = 0; i < len; i++) {
424
+ args[i] = arguments$1[i + argsIndex];
425
+ }
426
+ }
427
+ }
428
+ return [target, method, args];
429
+ }
430
+ function parseTimerArgs() {
431
+ var ref = parseArgs.apply(void 0, arguments);
432
+ var target = ref[0];
433
+ var method = ref[1];
434
+ var args = ref[2];
435
+ var wait = 0;
436
+ var length = args !== undefined ? args.length : 0;
437
+ if (length > 0) {
438
+ var last = args[length - 1];
439
+ if (isCoercableNumber(last)) {
440
+ wait = parseInt(args.pop(), 10);
441
+ }
442
+ }
443
+ return [target, method, args, wait];
444
+ }
445
+ function parseDebounceArgs() {
446
+ var assign;
447
+ var target;
448
+ var method;
449
+ var isImmediate;
450
+ var args;
451
+ var wait;
452
+ if (arguments.length === 2) {
453
+ method = arguments[0];
454
+ wait = arguments[1];
455
+ target = null;
456
+ } else {
457
+ assign = parseArgs.apply(void 0, arguments), target = assign[0], method = assign[1], args = assign[2];
458
+ if (args === undefined) {
459
+ wait = 0;
460
+ } else {
461
+ wait = args.pop();
462
+ if (!isCoercableNumber(wait)) {
463
+ isImmediate = wait === true;
464
+ wait = args.pop();
465
+ }
466
+ }
467
+ }
468
+ wait = parseInt(wait, 10);
469
+ return [target, method, args, wait, isImmediate];
470
+ }
471
+ var UUID = 0;
472
+ var beginCount = 0;
473
+ var endCount = 0;
474
+ var beginEventCount = 0;
475
+ var endEventCount = 0;
476
+ var runCount = 0;
477
+ var joinCount = 0;
478
+ var deferCount = 0;
479
+ var scheduleCount = 0;
480
+ var scheduleIterableCount = 0;
481
+ var deferOnceCount = 0;
482
+ var scheduleOnceCount = 0;
483
+ var setTimeoutCount = 0;
484
+ var laterCount = 0;
485
+ var throttleCount = 0;
486
+ var debounceCount = 0;
487
+ var cancelTimersCount = 0;
488
+ var cancelCount = 0;
489
+ var autorunsCreatedCount = 0;
490
+ var autorunsCompletedCount = 0;
491
+ var deferredActionQueuesCreatedCount = 0;
492
+ var nestedDeferredActionQueuesCreated = 0;
493
+ var Backburner = function Backburner(queueNames, options) {
494
+ var this$1$1 = this;
495
+ this.DEBUG = false;
496
+ this.currentInstance = null;
497
+ this.instanceStack = [];
498
+ this._eventCallbacks = {
499
+ end: [],
500
+ begin: []
501
+ };
502
+ this._timerTimeoutId = null;
503
+ this._timers = [];
504
+ this._autorun = false;
505
+ this._autorunStack = null;
506
+ this.queueNames = queueNames;
507
+ this.options = options || {};
508
+ if (typeof this.options.defaultQueue === 'string') {
509
+ this._defaultQueue = this.options.defaultQueue;
510
+ } else {
511
+ this._defaultQueue = this.queueNames[0];
512
+ }
513
+ this._onBegin = this.options.onBegin || noop;
514
+ this._onEnd = this.options.onEnd || noop;
515
+ this._boundRunExpiredTimers = this._runExpiredTimers.bind(this);
516
+ this._boundAutorunEnd = function () {
517
+ autorunsCompletedCount++;
518
+ // if the autorun was already flushed, do nothing
519
+ if (this$1$1._autorun === false) {
520
+ return;
521
+ }
522
+ this$1$1._autorun = false;
523
+ this$1$1._autorunStack = null;
524
+ this$1$1._end(true /* fromAutorun */);
525
+ };
526
+ var builder = this.options._buildPlatform || buildPlatform;
527
+ this._platform = builder(this._boundAutorunEnd);
528
+ };
529
+ var prototypeAccessors = {
530
+ counters: {
531
+ configurable: true
532
+ },
533
+ defaultQueue: {
534
+ configurable: true
535
+ }
536
+ };
537
+ prototypeAccessors.counters.get = function () {
538
+ return {
539
+ begin: beginCount,
540
+ end: endCount,
541
+ events: {
542
+ begin: beginEventCount,
543
+ end: endEventCount
544
+ },
545
+ autoruns: {
546
+ created: autorunsCreatedCount,
547
+ completed: autorunsCompletedCount
548
+ },
549
+ run: runCount,
550
+ join: joinCount,
551
+ defer: deferCount,
552
+ schedule: scheduleCount,
553
+ scheduleIterable: scheduleIterableCount,
554
+ deferOnce: deferOnceCount,
555
+ scheduleOnce: scheduleOnceCount,
556
+ setTimeout: setTimeoutCount,
557
+ later: laterCount,
558
+ throttle: throttleCount,
559
+ debounce: debounceCount,
560
+ cancelTimers: cancelTimersCount,
561
+ cancel: cancelCount,
562
+ loops: {
563
+ total: deferredActionQueuesCreatedCount,
564
+ nested: nestedDeferredActionQueuesCreated
565
+ }
566
+ };
567
+ };
568
+ prototypeAccessors.defaultQueue.get = function () {
569
+ return this._defaultQueue;
570
+ };
571
+ /*
572
+ @method begin
573
+ @return instantiated class DeferredActionQueues
574
+ */
575
+ Backburner.prototype.begin = function begin() {
576
+ beginCount++;
577
+ var options = this.options;
578
+ var previousInstance = this.currentInstance;
579
+ var current;
580
+ if (this._autorun !== false) {
581
+ current = previousInstance;
582
+ this._cancelAutorun();
583
+ } else {
584
+ if (previousInstance !== null) {
585
+ nestedDeferredActionQueuesCreated++;
586
+ this.instanceStack.push(previousInstance);
587
+ }
588
+ deferredActionQueuesCreatedCount++;
589
+ current = this.currentInstance = new DeferredActionQueues(this.queueNames, options);
590
+ beginEventCount++;
591
+ this._trigger('begin', current, previousInstance);
592
+ }
593
+ this._onBegin(current, previousInstance);
594
+ return current;
595
+ };
596
+ Backburner.prototype.end = function end() {
597
+ endCount++;
598
+ this._end(false);
599
+ };
600
+ Backburner.prototype.on = function on(eventName, callback) {
601
+ if (typeof callback !== 'function') {
602
+ throw new TypeError("Callback must be a function");
603
+ }
604
+ var callbacks = this._eventCallbacks[eventName];
605
+ if (callbacks !== undefined) {
606
+ callbacks.push(callback);
607
+ } else {
608
+ throw new TypeError("Cannot on() event " + eventName + " because it does not exist");
609
+ }
610
+ };
611
+ Backburner.prototype.off = function off(eventName, callback) {
612
+ var callbacks = this._eventCallbacks[eventName];
613
+ if (!eventName || callbacks === undefined) {
614
+ throw new TypeError("Cannot off() event " + eventName + " because it does not exist");
615
+ }
616
+ var callbackFound = false;
617
+ if (callback) {
618
+ for (var i = 0; i < callbacks.length; i++) {
619
+ if (callbacks[i] === callback) {
620
+ callbackFound = true;
621
+ callbacks.splice(i, 1);
622
+ i--;
623
+ }
624
+ }
625
+ }
626
+ if (!callbackFound) {
627
+ throw new TypeError("Cannot off() callback that does not exist");
628
+ }
629
+ };
630
+ Backburner.prototype.run = function run() {
631
+ runCount++;
632
+ var ref = parseArgs.apply(void 0, arguments);
633
+ var target = ref[0];
634
+ var method = ref[1];
635
+ var args = ref[2];
636
+ return this._run(target, method, args);
637
+ };
638
+ Backburner.prototype.join = function join() {
639
+ joinCount++;
640
+ var ref = parseArgs.apply(void 0, arguments);
641
+ var target = ref[0];
642
+ var method = ref[1];
643
+ var args = ref[2];
644
+ return this._join(target, method, args);
645
+ };
646
+ /**
647
+ * @deprecated please use schedule instead.
648
+ */
649
+ Backburner.prototype.defer = function defer(queueName, target, method) {
650
+ var ref;
651
+ var args = [],
652
+ len = arguments.length - 3;
653
+ while (len-- > 0) args[len] = arguments[len + 3];
654
+ deferCount++;
655
+ return (ref = this).schedule.apply(ref, [queueName, target, method].concat(args));
656
+ };
657
+ Backburner.prototype.schedule = function schedule(queueName) {
658
+ var _args = [],
659
+ len = arguments.length - 1;
660
+ while (len-- > 0) _args[len] = arguments[len + 1];
661
+ scheduleCount++;
662
+ var ref = parseArgs.apply(void 0, _args);
663
+ var target = ref[0];
664
+ var method = ref[1];
665
+ var args = ref[2];
666
+ var stack = this.DEBUG ? new Error() : undefined;
667
+ return this._ensureInstance().schedule(queueName, target, method, args, false, stack);
668
+ };
669
+ /*
670
+ Defer the passed iterable of functions to run inside the specified queue.
671
+
672
+ @method scheduleIterable
673
+ @param {String} queueName
674
+ @param {Iterable} an iterable of functions to execute
675
+ @return method result
676
+ */
677
+ Backburner.prototype.scheduleIterable = function scheduleIterable(queueName, iterable) {
678
+ scheduleIterableCount++;
679
+ var stack = this.DEBUG ? new Error() : undefined;
680
+ return this._ensureInstance().schedule(queueName, null, iteratorDrain, [iterable], false, stack);
681
+ };
682
+ /**
683
+ * @deprecated please use scheduleOnce instead.
684
+ */
685
+ Backburner.prototype.deferOnce = function deferOnce(queueName, target, method) {
686
+ var ref;
687
+ var args = [],
688
+ len = arguments.length - 3;
689
+ while (len-- > 0) args[len] = arguments[len + 3];
690
+ deferOnceCount++;
691
+ return (ref = this).scheduleOnce.apply(ref, [queueName, target, method].concat(args));
692
+ };
693
+ Backburner.prototype.scheduleOnce = function scheduleOnce(queueName) {
694
+ var _args = [],
695
+ len = arguments.length - 1;
696
+ while (len-- > 0) _args[len] = arguments[len + 1];
697
+ scheduleOnceCount++;
698
+ var ref = parseArgs.apply(void 0, _args);
699
+ var target = ref[0];
700
+ var method = ref[1];
701
+ var args = ref[2];
702
+ var stack = this.DEBUG ? new Error() : undefined;
703
+ return this._ensureInstance().schedule(queueName, target, method, args, true, stack);
704
+ };
705
+ Backburner.prototype.setTimeout = function setTimeout() {
706
+ var ref;
707
+ setTimeoutCount++;
708
+ return (ref = this).later.apply(ref, arguments);
709
+ };
710
+ Backburner.prototype.later = function later() {
711
+ laterCount++;
712
+ var ref = parseTimerArgs.apply(void 0, arguments);
713
+ var target = ref[0];
714
+ var method = ref[1];
715
+ var args = ref[2];
716
+ var wait = ref[3];
717
+ return this._later(target, method, args, wait);
718
+ };
719
+ Backburner.prototype.throttle = function throttle() {
720
+ throttleCount++;
721
+ var ref = parseDebounceArgs.apply(void 0, arguments);
722
+ var target = ref[0];
723
+ var method = ref[1];
724
+ var args = ref[2];
725
+ var wait = ref[3];
726
+ var isImmediate = ref[4];
727
+ if (isImmediate === void 0) isImmediate = true;
728
+ var index = findTimerItem(target, method, this._timers);
729
+ var timerId;
730
+ if (index === -1) {
731
+ timerId = this._later(target, method, isImmediate ? DISABLE_SCHEDULE : args, wait);
732
+ if (isImmediate) {
733
+ this._join(target, method, args);
734
+ }
735
+ } else {
736
+ timerId = this._timers[index + 1];
737
+ var argIndex = index + 4;
738
+ if (this._timers[argIndex] !== DISABLE_SCHEDULE) {
739
+ this._timers[argIndex] = args;
740
+ }
741
+ }
742
+ return timerId;
743
+ };
744
+ Backburner.prototype.debounce = function debounce() {
745
+ debounceCount++;
746
+ var ref = parseDebounceArgs.apply(void 0, arguments);
747
+ var target = ref[0];
748
+ var method = ref[1];
749
+ var args = ref[2];
750
+ var wait = ref[3];
751
+ var isImmediate = ref[4];
752
+ if (isImmediate === void 0) isImmediate = false;
753
+ var _timers = this._timers;
754
+ var index = findTimerItem(target, method, _timers);
755
+ var timerId;
756
+ if (index === -1) {
757
+ timerId = this._later(target, method, isImmediate ? DISABLE_SCHEDULE : args, wait);
758
+ if (isImmediate) {
759
+ this._join(target, method, args);
760
+ }
761
+ } else {
762
+ var executeAt = this._platform.now() + wait;
763
+ var argIndex = index + 4;
764
+ if (_timers[argIndex] === DISABLE_SCHEDULE) {
765
+ args = DISABLE_SCHEDULE;
766
+ }
767
+ timerId = _timers[index + 1];
768
+ var i = binarySearch(executeAt, _timers);
769
+ if (index + TIMERS_OFFSET === i) {
770
+ _timers[index] = executeAt;
771
+ _timers[argIndex] = args;
772
+ } else {
773
+ var stack = this._timers[index + 5];
774
+ this._timers.splice(i, 0, executeAt, timerId, target, method, args, stack);
775
+ this._timers.splice(index, TIMERS_OFFSET);
776
+ }
777
+ if (index === 0) {
778
+ this._reinstallTimerTimeout();
779
+ }
780
+ }
781
+ return timerId;
782
+ };
783
+ Backburner.prototype.cancelTimers = function cancelTimers() {
784
+ cancelTimersCount++;
785
+ this._clearTimerTimeout();
786
+ this._timers = [];
787
+ this._cancelAutorun();
788
+ };
789
+ Backburner.prototype.hasTimers = function hasTimers() {
790
+ return this._timers.length > 0 || this._autorun;
791
+ };
792
+ Backburner.prototype.cancel = function cancel(timer) {
793
+ cancelCount++;
794
+ if (timer === null || timer === undefined) {
795
+ return false;
796
+ }
797
+ var timerType = typeof timer;
798
+ if (timerType === 'number') {
799
+ // we're cancelling a setTimeout or throttle or debounce
800
+ return this._cancelLaterTimer(timer);
801
+ } else if (timerType === 'object' && timer.queue && timer.method) {
802
+ // we're cancelling a deferOnce
803
+ return timer.queue.cancel(timer);
804
+ }
805
+ return false;
806
+ };
807
+ Backburner.prototype.ensureInstance = function ensureInstance() {
808
+ this._ensureInstance();
809
+ };
810
+ /**
811
+ * Returns debug information related to the current instance of Backburner
812
+ *
813
+ * @method getDebugInfo
814
+ * @returns {Object | undefined} Will return and Object containing debug information if
815
+ * the DEBUG flag is set to true on the current instance of Backburner, else undefined.
816
+ */
817
+ Backburner.prototype.getDebugInfo = function getDebugInfo() {
818
+ var this$1$1 = this;
819
+ if (this.DEBUG) {
820
+ return {
821
+ autorun: this._autorunStack,
822
+ counters: this.counters,
823
+ timers: getQueueItems(this._timers, TIMERS_OFFSET, 2),
824
+ instanceStack: [this.currentInstance].concat(this.instanceStack).map(function (deferredActionQueue) {
825
+ return deferredActionQueue && deferredActionQueue._getDebugInfo(this$1$1.DEBUG);
826
+ })
827
+ };
828
+ }
829
+ return undefined;
830
+ };
831
+ Backburner.prototype._end = function _end(fromAutorun) {
832
+ var currentInstance = this.currentInstance;
833
+ var nextInstance = null;
834
+ if (currentInstance === null) {
835
+ throw new Error("end called without begin");
836
+ }
837
+ // Prevent double-finally bug in Safari 6.0.2 and iOS 6
838
+ // This bug appears to be resolved in Safari 6.0.5 and iOS 7
839
+ var finallyAlreadyCalled = false;
840
+ var result;
841
+ try {
842
+ result = currentInstance.flush(fromAutorun);
843
+ } finally {
844
+ if (!finallyAlreadyCalled) {
845
+ finallyAlreadyCalled = true;
846
+ if (result === 1 /* Pause */) {
847
+ var plannedNextQueue = this.queueNames[currentInstance.queueNameIndex];
848
+ this._scheduleAutorun(plannedNextQueue);
849
+ } else {
850
+ this.currentInstance = null;
851
+ if (this.instanceStack.length > 0) {
852
+ nextInstance = this.instanceStack.pop();
853
+ this.currentInstance = nextInstance;
854
+ }
855
+ this._trigger('end', currentInstance, nextInstance);
856
+ this._onEnd(currentInstance, nextInstance);
857
+ }
858
+ }
859
+ }
860
+ };
861
+ Backburner.prototype._join = function _join(target, method, args) {
862
+ if (this.currentInstance === null) {
863
+ return this._run(target, method, args);
864
+ }
865
+ if (target === undefined && args === undefined) {
866
+ return method();
867
+ } else {
868
+ return method.apply(target, args);
869
+ }
870
+ };
871
+ Backburner.prototype._run = function _run(target, method, args) {
872
+ var onError = getOnError(this.options);
873
+ this.begin();
874
+ if (onError) {
875
+ try {
876
+ return method.apply(target, args);
877
+ } catch (error) {
878
+ onError(error);
879
+ } finally {
880
+ this.end();
881
+ }
882
+ } else {
883
+ try {
884
+ return method.apply(target, args);
885
+ } finally {
886
+ this.end();
887
+ }
888
+ }
889
+ };
890
+ Backburner.prototype._cancelAutorun = function _cancelAutorun() {
891
+ if (this._autorun) {
892
+ this._platform.clearNext();
893
+ this._autorun = false;
894
+ this._autorunStack = null;
895
+ }
896
+ };
897
+ Backburner.prototype._later = function _later(target, method, args, wait) {
898
+ var stack = this.DEBUG ? new Error() : undefined;
899
+ var executeAt = this._platform.now() + wait;
900
+ var id = UUID++;
901
+ if (this._timers.length === 0) {
902
+ this._timers.push(executeAt, id, target, method, args, stack);
903
+ this._installTimerTimeout();
904
+ } else {
905
+ // find position to insert
906
+ var i = binarySearch(executeAt, this._timers);
907
+ this._timers.splice(i, 0, executeAt, id, target, method, args, stack);
908
+ // always reinstall since it could be out of sync
909
+ this._reinstallTimerTimeout();
910
+ }
911
+ return id;
912
+ };
913
+ Backburner.prototype._cancelLaterTimer = function _cancelLaterTimer(timer) {
914
+ for (var i = 1; i < this._timers.length; i += TIMERS_OFFSET) {
915
+ if (this._timers[i] === timer) {
916
+ this._timers.splice(i - 1, TIMERS_OFFSET);
917
+ if (i === 1) {
918
+ this._reinstallTimerTimeout();
919
+ }
920
+ return true;
921
+ }
922
+ }
923
+ return false;
924
+ };
925
+ /**
926
+ Trigger an event. Supports up to two arguments. Designed around
927
+ triggering transition events from one run loop instance to the
928
+ next, which requires an argument for theinstance and then
929
+ an argument for the next instance.
930
+
931
+ @private
932
+ @method _trigger
933
+ @param {String} eventName
934
+ @param {any} arg1
935
+ @param {any} arg2
936
+ */
937
+ Backburner.prototype._trigger = function _trigger(eventName, arg1, arg2) {
938
+ var callbacks = this._eventCallbacks[eventName];
939
+ if (callbacks !== undefined) {
940
+ for (var i = 0; i < callbacks.length; i++) {
941
+ callbacks[i](arg1, arg2);
942
+ }
943
+ }
944
+ };
945
+ Backburner.prototype._runExpiredTimers = function _runExpiredTimers() {
946
+ this._timerTimeoutId = null;
947
+ if (this._timers.length > 0) {
948
+ this.begin();
949
+ this._scheduleExpiredTimers();
950
+ this.end();
951
+ }
952
+ };
953
+ Backburner.prototype._scheduleExpiredTimers = function _scheduleExpiredTimers() {
954
+ var timers = this._timers;
955
+ var i = 0;
956
+ var l = timers.length;
957
+ var defaultQueue = this._defaultQueue;
958
+ var n = this._platform.now();
959
+ for (; i < l; i += TIMERS_OFFSET) {
960
+ var executeAt = timers[i];
961
+ if (executeAt > n) {
962
+ break;
963
+ }
964
+ var args = timers[i + 4];
965
+ if (args !== DISABLE_SCHEDULE) {
966
+ var target = timers[i + 2];
967
+ var method = timers[i + 3];
968
+ var stack = timers[i + 5];
969
+ this.currentInstance.schedule(defaultQueue, target, method, args, false, stack);
970
+ }
971
+ }
972
+ timers.splice(0, i);
973
+ this._installTimerTimeout();
974
+ };
975
+ Backburner.prototype._reinstallTimerTimeout = function _reinstallTimerTimeout() {
976
+ this._clearTimerTimeout();
977
+ this._installTimerTimeout();
978
+ };
979
+ Backburner.prototype._clearTimerTimeout = function _clearTimerTimeout() {
980
+ if (this._timerTimeoutId === null) {
981
+ return;
982
+ }
983
+ this._platform.clearTimeout(this._timerTimeoutId);
984
+ this._timerTimeoutId = null;
985
+ };
986
+ Backburner.prototype._installTimerTimeout = function _installTimerTimeout() {
987
+ if (this._timers.length === 0) {
988
+ return;
989
+ }
990
+ var minExpiresAt = this._timers[0];
991
+ var n = this._platform.now();
992
+ var wait = Math.max(0, minExpiresAt - n);
993
+ this._timerTimeoutId = this._platform.setTimeout(this._boundRunExpiredTimers, wait);
994
+ };
995
+ Backburner.prototype._ensureInstance = function _ensureInstance() {
996
+ var currentInstance = this.currentInstance;
997
+ if (currentInstance === null) {
998
+ this._autorunStack = this.DEBUG ? new Error() : undefined;
999
+ currentInstance = this.begin();
1000
+ this._scheduleAutorun(this.queueNames[0]);
1001
+ }
1002
+ return currentInstance;
1003
+ };
1004
+ Backburner.prototype._scheduleAutorun = function _scheduleAutorun(plannedNextQueue) {
1005
+ autorunsCreatedCount++;
1006
+ var next = this._platform.next;
1007
+ var flush = this.options.flush;
1008
+ if (flush) {
1009
+ flush(plannedNextQueue, next);
1010
+ } else {
1011
+ next();
1012
+ }
1013
+ this._autorun = true;
1014
+ };
1015
+ Object.defineProperties(Backburner.prototype, prototypeAccessors);
1016
+ Backburner.Queue = Queue;
1017
+ Backburner.buildPlatform = buildPlatform;
1018
+ Backburner.buildNext = buildNext;
1019
+ backburner.buildPlatform = buildPlatform;
1020
+ backburner.default = Backburner;
1021
+ return backburner;
1022
+ }
1023
+
1024
+ var backburnerExports = requireBackburner();
1025
+ var Backburner = /*@__PURE__*/getDefaultExportFromCjs(backburnerExports);
1026
+
1027
+ let currentRunLoop = null;
1028
+ function _getCurrentRunLoop() {
1029
+ return currentRunLoop;
1030
+ }
1031
+ const _backburner$1 = new Backburner(['actions', 'afterRender'], {
1032
+ defaultQueue: 'actions'
1033
+ });
1034
+ function run$1(...args) {
1035
+ return _backburner$1.run(...args);
1036
+ }
1037
+ function join$1(methodOrTarget, methodOrArg, ...additionalArgs) {
1038
+ return _backburner$1.join(methodOrTarget, methodOrArg, ...additionalArgs);
1039
+ }
1040
+ function bind(...curried) {
1041
+ return (...args) => join$1(...curried.concat(args));
1042
+ }
1043
+ function begin() {
1044
+ _backburner$1.begin();
1045
+ }
1046
+ function end() {
1047
+ _backburner$1.end();
1048
+ }
1049
+ function schedule(...args) {
1050
+ // @ts-expect-error TS doesn't like the rest args here
1051
+ return _backburner$1.schedule(...args);
1052
+ }
1053
+ // Used by global test teardown
1054
+ function _hasScheduledTimers() {
1055
+ return _backburner$1.hasTimers();
1056
+ }
1057
+ // Used by global test teardown
1058
+ function _cancelTimers() {
1059
+ _backburner$1.cancelTimers();
1060
+ }
1061
+ function later$1(...args) {
1062
+ return _backburner$1.later(...args);
1063
+ }
1064
+ function once(...args) {
1065
+ // @ts-expect-error TS doesn't like the rest args here
1066
+ return _backburner$1.scheduleOnce('actions', ...args);
1067
+ }
1068
+ function scheduleOnce$1(...args) {
1069
+ // @ts-expect-error TS doesn't like the rest args here
1070
+ return _backburner$1.scheduleOnce(...args);
1071
+ }
1072
+ function next(...args) {
1073
+ return _backburner$1.later(...args, 1);
1074
+ }
1075
+ function cancel$1(timer) {
1076
+ return _backburner$1.cancel(timer);
1077
+ }
1078
+ function debounce$1(...args) {
1079
+ // @ts-expect-error TS doesn't like the rest args here
1080
+ return _backburner$1.debounce(...args);
1081
+ }
1082
+ function throttle(...args) {
1083
+ // @ts-expect-error TS doesn't like the rest args here
1084
+ return _backburner$1.throttle(...args);
1085
+ }
1086
+
1087
+ var runloop = /*#__PURE__*/Object.freeze({
1088
+ __proto__: null,
1089
+ _backburner: _backburner$1,
1090
+ _cancelTimers: _cancelTimers,
1091
+ _getCurrentRunLoop: _getCurrentRunLoop,
1092
+ _hasScheduledTimers: _hasScheduledTimers,
1093
+ begin: begin,
1094
+ bind: bind,
1095
+ cancel: cancel$1,
1096
+ debounce: debounce$1,
1097
+ end: end,
1098
+ join: join$1,
1099
+ later: later$1,
1100
+ next: next,
1101
+ once: once,
1102
+ run: run$1,
1103
+ schedule: schedule,
1104
+ scheduleOnce: scheduleOnce$1,
1105
+ throttle: throttle
1106
+ });
1107
+
1108
+ // it could happen that runloop is available but _backburner is not exported (dead code)
1109
+ // then we need to use our own.
1110
+ let module = runloop;
1111
+ let _backburner = _backburner$1;
1112
+ const keys = ['cancel', 'debounce', 'join', 'later', 'scheduleOnce'];
1113
+ if (Runloop) {
1114
+ module = Runloop;
1115
+ _backburner = Runloop._backburner || Runloop.backburner;
1116
+ }
1117
+ if (!keys.every(k => k in module)) {
1118
+ module = runloop;
1119
+ }
1120
+
1121
+ // if it is our own, run a internal to trigger `end`
1122
+ // required in object inspector & render debug
1123
+ function loop() {
1124
+ _backburner.later('actions', loop, 300);
1125
+ }
1126
+ if (_backburner === _backburner$1) {
1127
+ loop();
1128
+ }
1129
+ let run = run$1;
1130
+ let {
1131
+ cancel,
1132
+ debounce,
1133
+ join,
1134
+ later,
1135
+ scheduleOnce
1136
+ } = module;
1137
+
1138
+ export { _backburner as _, cancel as c, debounce as d, join as j, later as l, run as r, scheduleOnce as s };