ui_utils.js 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2017 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * Javascript code in this page
  21. */
  22. 'use strict';
  23. Object.defineProperty(exports, "__esModule", {
  24. value: true
  25. });
  26. exports.waitOnEventOrTimeout = exports.WaitOnType = exports.animationStarted = exports.normalizeWheelEventDelta = exports.binarySearchFirstItem = exports.watchScroll = exports.scrollIntoView = exports.getOutputScale = exports.approximateFraction = exports.getPageSizeInches = exports.roundToDivide = exports.getVisibleElements = exports.parseQueryString = exports.noContextMenuHandler = exports.getPDFFileNameFromURL = exports.ProgressBar = exports.EventBus = exports.NullL10n = exports.TextLayerMode = exports.RendererType = exports.PresentationModeState = exports.cloneObj = exports.isFileSchema = exports.isPortraitOrientation = exports.isValidRotation = exports.VERTICAL_PADDING = exports.SCROLLBAR_PADDING = exports.MAX_AUTO_SCALE = exports.UNKNOWN_SCALE = exports.MAX_SCALE = exports.MIN_SCALE = exports.DEFAULT_SCALE = exports.DEFAULT_SCALE_VALUE = exports.CSS_UNITS = undefined;
  27. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  28. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  29. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  30. var _pdf = require('../pdf');
  31. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  32. var CSS_UNITS = 96.0 / 72.0;
  33. var DEFAULT_SCALE_VALUE = 'auto';
  34. var DEFAULT_SCALE = 1.0;
  35. var MIN_SCALE = 0.10;
  36. var MAX_SCALE = 10.0;
  37. var UNKNOWN_SCALE = 0;
  38. var MAX_AUTO_SCALE = 1.25;
  39. var SCROLLBAR_PADDING = 40;
  40. var VERTICAL_PADDING = 5;
  41. var PresentationModeState = {
  42. UNKNOWN: 0,
  43. NORMAL: 1,
  44. CHANGING: 2,
  45. FULLSCREEN: 3
  46. };
  47. var RendererType = {
  48. CANVAS: 'canvas',
  49. SVG: 'svg'
  50. };
  51. var TextLayerMode = {
  52. DISABLE: 0,
  53. ENABLE: 1,
  54. ENABLE_ENHANCE: 2
  55. };
  56. function formatL10nValue(text, args) {
  57. if (!args) {
  58. return text;
  59. }
  60. return text.replace(/\{\{\s*(\w+)\s*\}\}/g, function (all, name) {
  61. return name in args ? args[name] : '{{' + name + '}}';
  62. });
  63. }
  64. var NullL10n = {
  65. getLanguage: function getLanguage() {
  66. return Promise.resolve('en-us');
  67. },
  68. getDirection: function getDirection() {
  69. return Promise.resolve('ltr');
  70. },
  71. get: function get(property, args, fallback) {
  72. return Promise.resolve(formatL10nValue(fallback, args));
  73. },
  74. translate: function translate(element) {
  75. return Promise.resolve();
  76. }
  77. };
  78. function getOutputScale(ctx) {
  79. var devicePixelRatio = window.devicePixelRatio || 1;
  80. var backingStoreRatio = ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1;
  81. var pixelRatio = devicePixelRatio / backingStoreRatio;
  82. return {
  83. sx: pixelRatio,
  84. sy: pixelRatio,
  85. scaled: pixelRatio !== 1
  86. };
  87. }
  88. function scrollIntoView(element, spot) {
  89. var skipOverflowHiddenElements = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  90. var parent = element.offsetParent;
  91. if (!parent) {
  92. console.error('offsetParent is not set -- cannot scroll');
  93. return;
  94. }
  95. var offsetY = element.offsetTop + element.clientTop;
  96. var offsetX = element.offsetLeft + element.clientLeft;
  97. while (parent.clientHeight === parent.scrollHeight || skipOverflowHiddenElements && getComputedStyle(parent).overflow === 'hidden') {
  98. if (parent.dataset._scaleY) {
  99. offsetY /= parent.dataset._scaleY;
  100. offsetX /= parent.dataset._scaleX;
  101. }
  102. offsetY += parent.offsetTop;
  103. offsetX += parent.offsetLeft;
  104. parent = parent.offsetParent;
  105. if (!parent) {
  106. return;
  107. }
  108. }
  109. if (spot) {
  110. if (spot.top !== undefined) {
  111. offsetY += spot.top;
  112. }
  113. if (spot.left !== undefined) {
  114. offsetX += spot.left;
  115. parent.scrollLeft = offsetX;
  116. }
  117. }
  118. parent.scrollTop = offsetY;
  119. }
  120. function watchScroll(viewAreaElement, callback) {
  121. var debounceScroll = function debounceScroll(evt) {
  122. if (rAF) {
  123. return;
  124. }
  125. rAF = window.requestAnimationFrame(function viewAreaElementScrolled() {
  126. rAF = null;
  127. var currentY = viewAreaElement.scrollTop;
  128. var lastY = state.lastY;
  129. if (currentY !== lastY) {
  130. state.down = currentY > lastY;
  131. }
  132. state.lastY = currentY;
  133. callback(state);
  134. });
  135. };
  136. var state = {
  137. down: true,
  138. lastY: viewAreaElement.scrollTop,
  139. _eventHandler: debounceScroll
  140. };
  141. var rAF = null;
  142. viewAreaElement.addEventListener('scroll', debounceScroll, true);
  143. return state;
  144. }
  145. function parseQueryString(query) {
  146. var parts = query.split('&');
  147. var params = Object.create(null);
  148. for (var i = 0, ii = parts.length; i < ii; ++i) {
  149. var param = parts[i].split('=');
  150. var key = param[0].toLowerCase();
  151. var value = param.length > 1 ? param[1] : null;
  152. params[decodeURIComponent(key)] = decodeURIComponent(value);
  153. }
  154. return params;
  155. }
  156. function binarySearchFirstItem(items, condition) {
  157. var minIndex = 0;
  158. var maxIndex = items.length - 1;
  159. if (items.length === 0 || !condition(items[maxIndex])) {
  160. return items.length;
  161. }
  162. if (condition(items[minIndex])) {
  163. return minIndex;
  164. }
  165. while (minIndex < maxIndex) {
  166. var currentIndex = minIndex + maxIndex >> 1;
  167. var currentItem = items[currentIndex];
  168. if (condition(currentItem)) {
  169. maxIndex = currentIndex;
  170. } else {
  171. minIndex = currentIndex + 1;
  172. }
  173. }
  174. return minIndex;
  175. }
  176. function approximateFraction(x) {
  177. if (Math.floor(x) === x) {
  178. return [x, 1];
  179. }
  180. var xinv = 1 / x;
  181. var limit = 8;
  182. if (xinv > limit) {
  183. return [1, limit];
  184. } else if (Math.floor(xinv) === xinv) {
  185. return [1, xinv];
  186. }
  187. var x_ = x > 1 ? xinv : x;
  188. var a = 0,
  189. b = 1,
  190. c = 1,
  191. d = 1;
  192. while (true) {
  193. var p = a + c,
  194. q = b + d;
  195. if (q > limit) {
  196. break;
  197. }
  198. if (x_ <= p / q) {
  199. c = p;
  200. d = q;
  201. } else {
  202. a = p;
  203. b = q;
  204. }
  205. }
  206. var result = void 0;
  207. if (x_ - a / b < c / d - x_) {
  208. result = x_ === x ? [a, b] : [b, a];
  209. } else {
  210. result = x_ === x ? [c, d] : [d, c];
  211. }
  212. return result;
  213. }
  214. function roundToDivide(x, div) {
  215. var r = x % div;
  216. return r === 0 ? x : Math.round(x - r + div);
  217. }
  218. function getPageSizeInches(_ref) {
  219. var view = _ref.view,
  220. userUnit = _ref.userUnit,
  221. rotate = _ref.rotate;
  222. var _view = _slicedToArray(view, 4),
  223. x1 = _view[0],
  224. y1 = _view[1],
  225. x2 = _view[2],
  226. y2 = _view[3];
  227. var changeOrientation = rotate % 180 !== 0;
  228. var width = (x2 - x1) / 72 * userUnit;
  229. var height = (y2 - y1) / 72 * userUnit;
  230. return {
  231. width: changeOrientation ? height : width,
  232. height: changeOrientation ? width : height
  233. };
  234. }
  235. function getVisibleElements(scrollEl, views) {
  236. var sortByVisibility = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  237. var top = scrollEl.scrollTop,
  238. bottom = top + scrollEl.clientHeight;
  239. var left = scrollEl.scrollLeft,
  240. right = left + scrollEl.clientWidth;
  241. function isElementBottomBelowViewTop(view) {
  242. var element = view.div;
  243. var elementBottom = element.offsetTop + element.clientTop + element.clientHeight;
  244. return elementBottom > top;
  245. }
  246. var visible = [],
  247. view = void 0,
  248. element = void 0;
  249. var currentHeight = void 0,
  250. viewHeight = void 0,
  251. hiddenHeight = void 0,
  252. percentHeight = void 0;
  253. var currentWidth = void 0,
  254. viewWidth = void 0;
  255. var firstVisibleElementInd = views.length === 0 ? 0 : binarySearchFirstItem(views, isElementBottomBelowViewTop);
  256. for (var i = firstVisibleElementInd, ii = views.length; i < ii; i++) {
  257. view = views[i];
  258. element = view.div;
  259. currentHeight = element.offsetTop + element.clientTop;
  260. viewHeight = element.clientHeight;
  261. if (currentHeight > bottom) {
  262. break;
  263. }
  264. currentWidth = element.offsetLeft + element.clientLeft;
  265. viewWidth = element.clientWidth;
  266. if (currentWidth + viewWidth < left || currentWidth > right) {
  267. continue;
  268. }
  269. hiddenHeight = Math.max(0, top - currentHeight) + Math.max(0, currentHeight + viewHeight - bottom);
  270. percentHeight = (viewHeight - hiddenHeight) * 100 / viewHeight | 0;
  271. visible.push({
  272. id: view.id,
  273. x: currentWidth,
  274. y: currentHeight,
  275. view: view,
  276. percent: percentHeight
  277. });
  278. }
  279. var first = visible[0];
  280. var last = visible[visible.length - 1];
  281. if (sortByVisibility) {
  282. visible.sort(function (a, b) {
  283. var pc = a.percent - b.percent;
  284. if (Math.abs(pc) > 0.001) {
  285. return -pc;
  286. }
  287. return a.id - b.id;
  288. });
  289. }
  290. return {
  291. first: first,
  292. last: last,
  293. views: visible
  294. };
  295. }
  296. function noContextMenuHandler(evt) {
  297. evt.preventDefault();
  298. }
  299. function isFileSchema(url) {
  300. var i = 0,
  301. ii = url.length;
  302. while (i < ii && url[i].trim() === '') {
  303. i++;
  304. }
  305. return url.substr(i, 7).toLowerCase() === 'file://';
  306. }
  307. function isDataSchema(url) {
  308. var i = 0,
  309. ii = url.length;
  310. while (i < ii && url[i].trim() === '') {
  311. i++;
  312. }
  313. return url.substr(i, 5).toLowerCase() === 'data:';
  314. }
  315. function getPDFFileNameFromURL(url) {
  316. var defaultFilename = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'document.pdf';
  317. if (isDataSchema(url)) {
  318. console.warn('getPDFFileNameFromURL: ' + 'ignoring "data:" URL for performance reasons.');
  319. return defaultFilename;
  320. }
  321. var reURI = /^(?:(?:[^:]+:)?\/\/[^\/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/;
  322. var reFilename = /[^\/?#=]+\.pdf\b(?!.*\.pdf\b)/i;
  323. var splitURI = reURI.exec(url);
  324. var suggestedFilename = reFilename.exec(splitURI[1]) || reFilename.exec(splitURI[2]) || reFilename.exec(splitURI[3]);
  325. if (suggestedFilename) {
  326. suggestedFilename = suggestedFilename[0];
  327. if (suggestedFilename.includes('%')) {
  328. try {
  329. suggestedFilename = reFilename.exec(decodeURIComponent(suggestedFilename))[0];
  330. } catch (ex) {}
  331. }
  332. }
  333. return suggestedFilename || defaultFilename;
  334. }
  335. function normalizeWheelEventDelta(evt) {
  336. var delta = Math.sqrt(evt.deltaX * evt.deltaX + evt.deltaY * evt.deltaY);
  337. var angle = Math.atan2(evt.deltaY, evt.deltaX);
  338. if (-0.25 * Math.PI < angle && angle < 0.75 * Math.PI) {
  339. delta = -delta;
  340. }
  341. var MOUSE_DOM_DELTA_PIXEL_MODE = 0;
  342. var MOUSE_DOM_DELTA_LINE_MODE = 1;
  343. var MOUSE_PIXELS_PER_LINE = 30;
  344. var MOUSE_LINES_PER_PAGE = 30;
  345. if (evt.deltaMode === MOUSE_DOM_DELTA_PIXEL_MODE) {
  346. delta /= MOUSE_PIXELS_PER_LINE * MOUSE_LINES_PER_PAGE;
  347. } else if (evt.deltaMode === MOUSE_DOM_DELTA_LINE_MODE) {
  348. delta /= MOUSE_LINES_PER_PAGE;
  349. }
  350. return delta;
  351. }
  352. function isValidRotation(angle) {
  353. return Number.isInteger(angle) && angle % 90 === 0;
  354. }
  355. function isPortraitOrientation(size) {
  356. return size.width <= size.height;
  357. }
  358. function cloneObj(obj) {
  359. var result = Object.create(null);
  360. for (var i in obj) {
  361. if (Object.prototype.hasOwnProperty.call(obj, i)) {
  362. result[i] = obj[i];
  363. }
  364. }
  365. return result;
  366. }
  367. var WaitOnType = {
  368. EVENT: 'event',
  369. TIMEOUT: 'timeout'
  370. };
  371. function waitOnEventOrTimeout(_ref2) {
  372. var target = _ref2.target,
  373. name = _ref2.name,
  374. _ref2$delay = _ref2.delay,
  375. delay = _ref2$delay === undefined ? 0 : _ref2$delay;
  376. if ((typeof target === 'undefined' ? 'undefined' : _typeof(target)) !== 'object' || !(name && typeof name === 'string') || !(Number.isInteger(delay) && delay >= 0)) {
  377. return Promise.reject(new Error('waitOnEventOrTimeout - invalid paramaters.'));
  378. }
  379. var capability = (0, _pdf.createPromiseCapability)();
  380. function handler(type) {
  381. if (target instanceof EventBus) {
  382. target.off(name, eventHandler);
  383. } else {
  384. target.removeEventListener(name, eventHandler);
  385. }
  386. if (timeout) {
  387. clearTimeout(timeout);
  388. }
  389. capability.resolve(type);
  390. }
  391. var eventHandler = handler.bind(null, WaitOnType.EVENT);
  392. if (target instanceof EventBus) {
  393. target.on(name, eventHandler);
  394. } else {
  395. target.addEventListener(name, eventHandler);
  396. }
  397. var timeoutHandler = handler.bind(null, WaitOnType.TIMEOUT);
  398. var timeout = setTimeout(timeoutHandler, delay);
  399. return capability.promise;
  400. }
  401. var animationStarted = new Promise(function (resolve) {
  402. window.requestAnimationFrame(resolve);
  403. });
  404. var EventBus = function () {
  405. function EventBus() {
  406. _classCallCheck(this, EventBus);
  407. this._listeners = Object.create(null);
  408. }
  409. _createClass(EventBus, [{
  410. key: 'on',
  411. value: function on(eventName, listener) {
  412. var eventListeners = this._listeners[eventName];
  413. if (!eventListeners) {
  414. eventListeners = [];
  415. this._listeners[eventName] = eventListeners;
  416. }
  417. eventListeners.push(listener);
  418. }
  419. }, {
  420. key: 'off',
  421. value: function off(eventName, listener) {
  422. var eventListeners = this._listeners[eventName];
  423. var i = void 0;
  424. if (!eventListeners || (i = eventListeners.indexOf(listener)) < 0) {
  425. return;
  426. }
  427. eventListeners.splice(i, 1);
  428. }
  429. }, {
  430. key: 'dispatch',
  431. value: function dispatch(eventName) {
  432. var eventListeners = this._listeners[eventName];
  433. if (!eventListeners || eventListeners.length === 0) {
  434. return;
  435. }
  436. var args = Array.prototype.slice.call(arguments, 1);
  437. eventListeners.slice(0).forEach(function (listener) {
  438. listener.apply(null, args);
  439. });
  440. }
  441. }]);
  442. return EventBus;
  443. }();
  444. function clamp(v, min, max) {
  445. return Math.min(Math.max(v, min), max);
  446. }
  447. var ProgressBar = function () {
  448. function ProgressBar(id) {
  449. var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  450. height = _ref3.height,
  451. width = _ref3.width,
  452. units = _ref3.units;
  453. _classCallCheck(this, ProgressBar);
  454. this.visible = true;
  455. this.div = document.querySelector(id + ' .progress');
  456. this.bar = this.div.parentNode;
  457. this.height = height || 100;
  458. this.width = width || 100;
  459. this.units = units || '%';
  460. this.div.style.height = this.height + this.units;
  461. this.percent = 0;
  462. }
  463. _createClass(ProgressBar, [{
  464. key: '_updateBar',
  465. value: function _updateBar() {
  466. if (this._indeterminate) {
  467. this.div.classList.add('indeterminate');
  468. this.div.style.width = this.width + this.units;
  469. return;
  470. }
  471. this.div.classList.remove('indeterminate');
  472. var progressSize = this.width * this._percent / 100;
  473. this.div.style.width = progressSize + this.units;
  474. }
  475. }, {
  476. key: 'setWidth',
  477. value: function setWidth(viewer) {
  478. if (!viewer) {
  479. return;
  480. }
  481. var container = viewer.parentNode;
  482. var scrollbarWidth = container.offsetWidth - viewer.offsetWidth;
  483. if (scrollbarWidth > 0) {
  484. this.bar.setAttribute('style', 'width: calc(100% - ' + scrollbarWidth + 'px);');
  485. }
  486. }
  487. }, {
  488. key: 'hide',
  489. value: function hide() {
  490. if (!this.visible) {
  491. return;
  492. }
  493. this.visible = false;
  494. this.bar.classList.add('hidden');
  495. document.body.classList.remove('loadingInProgress');
  496. }
  497. }, {
  498. key: 'show',
  499. value: function show() {
  500. if (this.visible) {
  501. return;
  502. }
  503. this.visible = true;
  504. document.body.classList.add('loadingInProgress');
  505. this.bar.classList.remove('hidden');
  506. }
  507. }, {
  508. key: 'percent',
  509. get: function get() {
  510. return this._percent;
  511. },
  512. set: function set(val) {
  513. this._indeterminate = isNaN(val);
  514. this._percent = clamp(val, 0, 100);
  515. this._updateBar();
  516. }
  517. }]);
  518. return ProgressBar;
  519. }();
  520. exports.CSS_UNITS = CSS_UNITS;
  521. exports.DEFAULT_SCALE_VALUE = DEFAULT_SCALE_VALUE;
  522. exports.DEFAULT_SCALE = DEFAULT_SCALE;
  523. exports.MIN_SCALE = MIN_SCALE;
  524. exports.MAX_SCALE = MAX_SCALE;
  525. exports.UNKNOWN_SCALE = UNKNOWN_SCALE;
  526. exports.MAX_AUTO_SCALE = MAX_AUTO_SCALE;
  527. exports.SCROLLBAR_PADDING = SCROLLBAR_PADDING;
  528. exports.VERTICAL_PADDING = VERTICAL_PADDING;
  529. exports.isValidRotation = isValidRotation;
  530. exports.isPortraitOrientation = isPortraitOrientation;
  531. exports.isFileSchema = isFileSchema;
  532. exports.cloneObj = cloneObj;
  533. exports.PresentationModeState = PresentationModeState;
  534. exports.RendererType = RendererType;
  535. exports.TextLayerMode = TextLayerMode;
  536. exports.NullL10n = NullL10n;
  537. exports.EventBus = EventBus;
  538. exports.ProgressBar = ProgressBar;
  539. exports.getPDFFileNameFromURL = getPDFFileNameFromURL;
  540. exports.noContextMenuHandler = noContextMenuHandler;
  541. exports.parseQueryString = parseQueryString;
  542. exports.getVisibleElements = getVisibleElements;
  543. exports.roundToDivide = roundToDivide;
  544. exports.getPageSizeInches = getPageSizeInches;
  545. exports.approximateFraction = approximateFraction;
  546. exports.getOutputScale = getOutputScale;
  547. exports.scrollIntoView = scrollIntoView;
  548. exports.watchScroll = watchScroll;
  549. exports.binarySearchFirstItem = binarySearchFirstItem;
  550. exports.normalizeWheelEventDelta = normalizeWheelEventDelta;
  551. exports.animationStarted = animationStarted;
  552. exports.WaitOnType = WaitOnType;
  553. exports.waitOnEventOrTimeout = waitOnEventOrTimeout;