pdf_find_controller.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2019 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.PDFFindController = exports.FindState = void 0;
  27. var _ui_utils = require("./ui_utils");
  28. var _pdf = require("../pdf");
  29. var _pdf_find_utils = require("./pdf_find_utils");
  30. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  31. 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); } }
  32. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  33. var FindState = {
  34. FOUND: 0,
  35. NOT_FOUND: 1,
  36. WRAPPED: 2,
  37. PENDING: 3
  38. };
  39. exports.FindState = FindState;
  40. var FIND_TIMEOUT = 250;
  41. var MATCH_SCROLL_OFFSET_TOP = -50;
  42. var MATCH_SCROLL_OFFSET_LEFT = -400;
  43. var CHARACTERS_TO_NORMALIZE = {
  44. "\u2018": '\'',
  45. "\u2019": '\'',
  46. "\u201A": '\'',
  47. "\u201B": '\'',
  48. "\u201C": '"',
  49. "\u201D": '"',
  50. "\u201E": '"',
  51. "\u201F": '"',
  52. "\xBC": '1/4',
  53. "\xBD": '1/2',
  54. "\xBE": '3/4'
  55. };
  56. var normalizationRegex = null;
  57. function normalize(text) {
  58. if (!normalizationRegex) {
  59. var replace = Object.keys(CHARACTERS_TO_NORMALIZE).join('');
  60. normalizationRegex = new RegExp("[".concat(replace, "]"), 'g');
  61. }
  62. return text.replace(normalizationRegex, function (ch) {
  63. return CHARACTERS_TO_NORMALIZE[ch];
  64. });
  65. }
  66. var PDFFindController =
  67. /*#__PURE__*/
  68. function () {
  69. function PDFFindController(_ref) {
  70. var linkService = _ref.linkService,
  71. _ref$eventBus = _ref.eventBus,
  72. eventBus = _ref$eventBus === void 0 ? (0, _ui_utils.getGlobalEventBus)() : _ref$eventBus;
  73. _classCallCheck(this, PDFFindController);
  74. this._linkService = linkService;
  75. this._eventBus = eventBus;
  76. this._reset();
  77. eventBus.on('findbarclose', this._onFindBarClose.bind(this));
  78. }
  79. _createClass(PDFFindController, [{
  80. key: "setDocument",
  81. value: function setDocument(pdfDocument) {
  82. if (this._pdfDocument) {
  83. this._reset();
  84. }
  85. if (!pdfDocument) {
  86. return;
  87. }
  88. this._pdfDocument = pdfDocument;
  89. this._firstPageCapability.resolve();
  90. }
  91. }, {
  92. key: "executeCommand",
  93. value: function executeCommand(cmd, state) {
  94. var _this = this;
  95. if (!state) {
  96. return;
  97. }
  98. var pdfDocument = this._pdfDocument;
  99. if (this._state === null || this._shouldDirtyMatch(cmd, state)) {
  100. this._dirtyMatch = true;
  101. }
  102. this._state = state;
  103. if (cmd !== 'findhighlightallchange') {
  104. this._updateUIState(FindState.PENDING);
  105. }
  106. this._firstPageCapability.promise.then(function () {
  107. if (!_this._pdfDocument || pdfDocument && _this._pdfDocument !== pdfDocument) {
  108. return;
  109. }
  110. _this._extractText();
  111. var findbarClosed = !_this._highlightMatches;
  112. var pendingTimeout = !!_this._findTimeout;
  113. if (_this._findTimeout) {
  114. clearTimeout(_this._findTimeout);
  115. _this._findTimeout = null;
  116. }
  117. if (cmd === 'find') {
  118. _this._findTimeout = setTimeout(function () {
  119. _this._nextMatch();
  120. _this._findTimeout = null;
  121. }, FIND_TIMEOUT);
  122. } else if (_this._dirtyMatch) {
  123. _this._nextMatch();
  124. } else if (cmd === 'findagain') {
  125. _this._nextMatch();
  126. if (findbarClosed && _this._state.highlightAll) {
  127. _this._updateAllPages();
  128. }
  129. } else if (cmd === 'findhighlightallchange') {
  130. if (pendingTimeout) {
  131. _this._nextMatch();
  132. } else {
  133. _this._highlightMatches = true;
  134. }
  135. _this._updateAllPages();
  136. } else {
  137. _this._nextMatch();
  138. }
  139. });
  140. }
  141. }, {
  142. key: "scrollMatchIntoView",
  143. value: function scrollMatchIntoView(_ref2) {
  144. var _ref2$element = _ref2.element,
  145. element = _ref2$element === void 0 ? null : _ref2$element,
  146. _ref2$pageIndex = _ref2.pageIndex,
  147. pageIndex = _ref2$pageIndex === void 0 ? -1 : _ref2$pageIndex,
  148. _ref2$matchIndex = _ref2.matchIndex,
  149. matchIndex = _ref2$matchIndex === void 0 ? -1 : _ref2$matchIndex;
  150. if (!this._scrollMatches || !element) {
  151. return;
  152. } else if (matchIndex === -1 || matchIndex !== this._selected.matchIdx) {
  153. return;
  154. } else if (pageIndex === -1 || pageIndex !== this._selected.pageIdx) {
  155. return;
  156. }
  157. this._scrollMatches = false;
  158. var spot = {
  159. top: MATCH_SCROLL_OFFSET_TOP,
  160. left: MATCH_SCROLL_OFFSET_LEFT
  161. };
  162. (0, _ui_utils.scrollIntoView)(element, spot, true);
  163. }
  164. }, {
  165. key: "_reset",
  166. value: function _reset() {
  167. this._highlightMatches = false;
  168. this._scrollMatches = false;
  169. this._pdfDocument = null;
  170. this._pageMatches = [];
  171. this._pageMatchesLength = [];
  172. this._state = null;
  173. this._selected = {
  174. pageIdx: -1,
  175. matchIdx: -1
  176. };
  177. this._offset = {
  178. pageIdx: null,
  179. matchIdx: null,
  180. wrapped: false
  181. };
  182. this._extractTextPromises = [];
  183. this._pageContents = [];
  184. this._matchesCountTotal = 0;
  185. this._pagesToSearch = null;
  186. this._pendingFindMatches = Object.create(null);
  187. this._resumePageIdx = null;
  188. this._dirtyMatch = false;
  189. clearTimeout(this._findTimeout);
  190. this._findTimeout = null;
  191. this._firstPageCapability = (0, _pdf.createPromiseCapability)();
  192. }
  193. }, {
  194. key: "_shouldDirtyMatch",
  195. value: function _shouldDirtyMatch(cmd, state) {
  196. if (state.query !== this._state.query) {
  197. return true;
  198. }
  199. switch (cmd) {
  200. case 'findagain':
  201. var pageNumber = this._selected.pageIdx + 1;
  202. var linkService = this._linkService;
  203. if (pageNumber >= 1 && pageNumber <= linkService.pagesCount && pageNumber !== linkService.page && !linkService.isPageVisible(pageNumber)) {
  204. return true;
  205. }
  206. return false;
  207. case 'findhighlightallchange':
  208. return false;
  209. }
  210. return true;
  211. }
  212. }, {
  213. key: "_prepareMatches",
  214. value: function _prepareMatches(matchesWithLength, matches, matchesLength) {
  215. function isSubTerm(matchesWithLength, currentIndex) {
  216. var currentElem = matchesWithLength[currentIndex];
  217. var nextElem = matchesWithLength[currentIndex + 1];
  218. if (currentIndex < matchesWithLength.length - 1 && currentElem.match === nextElem.match) {
  219. currentElem.skipped = true;
  220. return true;
  221. }
  222. for (var i = currentIndex - 1; i >= 0; i--) {
  223. var prevElem = matchesWithLength[i];
  224. if (prevElem.skipped) {
  225. continue;
  226. }
  227. if (prevElem.match + prevElem.matchLength < currentElem.match) {
  228. break;
  229. }
  230. if (prevElem.match + prevElem.matchLength >= currentElem.match + currentElem.matchLength) {
  231. currentElem.skipped = true;
  232. return true;
  233. }
  234. }
  235. return false;
  236. }
  237. matchesWithLength.sort(function (a, b) {
  238. return a.match === b.match ? a.matchLength - b.matchLength : a.match - b.match;
  239. });
  240. for (var i = 0, len = matchesWithLength.length; i < len; i++) {
  241. if (isSubTerm(matchesWithLength, i)) {
  242. continue;
  243. }
  244. matches.push(matchesWithLength[i].match);
  245. matchesLength.push(matchesWithLength[i].matchLength);
  246. }
  247. }
  248. }, {
  249. key: "_isEntireWord",
  250. value: function _isEntireWord(content, startIdx, length) {
  251. if (startIdx > 0) {
  252. var first = content.charCodeAt(startIdx);
  253. var limit = content.charCodeAt(startIdx - 1);
  254. if ((0, _pdf_find_utils.getCharacterType)(first) === (0, _pdf_find_utils.getCharacterType)(limit)) {
  255. return false;
  256. }
  257. }
  258. var endIdx = startIdx + length - 1;
  259. if (endIdx < content.length - 1) {
  260. var last = content.charCodeAt(endIdx);
  261. var _limit = content.charCodeAt(endIdx + 1);
  262. if ((0, _pdf_find_utils.getCharacterType)(last) === (0, _pdf_find_utils.getCharacterType)(_limit)) {
  263. return false;
  264. }
  265. }
  266. return true;
  267. }
  268. }, {
  269. key: "_calculatePhraseMatch",
  270. value: function _calculatePhraseMatch(query, pageIndex, pageContent, entireWord) {
  271. var matches = [];
  272. var queryLen = query.length;
  273. var matchIdx = -queryLen;
  274. while (true) {
  275. matchIdx = pageContent.indexOf(query, matchIdx + queryLen);
  276. if (matchIdx === -1) {
  277. break;
  278. }
  279. if (entireWord && !this._isEntireWord(pageContent, matchIdx, queryLen)) {
  280. continue;
  281. }
  282. matches.push(matchIdx);
  283. }
  284. this._pageMatches[pageIndex] = matches;
  285. }
  286. }, {
  287. key: "_calculateWordMatch",
  288. value: function _calculateWordMatch(query, pageIndex, pageContent, entireWord) {
  289. var matchesWithLength = [];
  290. var queryArray = query.match(/\S+/g);
  291. for (var i = 0, len = queryArray.length; i < len; i++) {
  292. var subquery = queryArray[i];
  293. var subqueryLen = subquery.length;
  294. var matchIdx = -subqueryLen;
  295. while (true) {
  296. matchIdx = pageContent.indexOf(subquery, matchIdx + subqueryLen);
  297. if (matchIdx === -1) {
  298. break;
  299. }
  300. if (entireWord && !this._isEntireWord(pageContent, matchIdx, subqueryLen)) {
  301. continue;
  302. }
  303. matchesWithLength.push({
  304. match: matchIdx,
  305. matchLength: subqueryLen,
  306. skipped: false
  307. });
  308. }
  309. }
  310. this._pageMatchesLength[pageIndex] = [];
  311. this._pageMatches[pageIndex] = [];
  312. this._prepareMatches(matchesWithLength, this._pageMatches[pageIndex], this._pageMatchesLength[pageIndex]);
  313. }
  314. }, {
  315. key: "_calculateMatch",
  316. value: function _calculateMatch(pageIndex) {
  317. var pageContent = this._pageContents[pageIndex];
  318. var query = this._query;
  319. var _this$_state = this._state,
  320. caseSensitive = _this$_state.caseSensitive,
  321. entireWord = _this$_state.entireWord,
  322. phraseSearch = _this$_state.phraseSearch;
  323. if (query.length === 0) {
  324. return;
  325. }
  326. if (!caseSensitive) {
  327. pageContent = pageContent.toLowerCase();
  328. query = query.toLowerCase();
  329. }
  330. if (phraseSearch) {
  331. this._calculatePhraseMatch(query, pageIndex, pageContent, entireWord);
  332. } else {
  333. this._calculateWordMatch(query, pageIndex, pageContent, entireWord);
  334. }
  335. if (this._state.highlightAll) {
  336. this._updatePage(pageIndex);
  337. }
  338. if (this._resumePageIdx === pageIndex) {
  339. this._resumePageIdx = null;
  340. this._nextPageMatch();
  341. }
  342. var pageMatchesCount = this._pageMatches[pageIndex].length;
  343. if (pageMatchesCount > 0) {
  344. this._matchesCountTotal += pageMatchesCount;
  345. this._updateUIResultsCount();
  346. }
  347. }
  348. }, {
  349. key: "_extractText",
  350. value: function _extractText() {
  351. var _this2 = this;
  352. if (this._extractTextPromises.length > 0) {
  353. return;
  354. }
  355. var promise = Promise.resolve();
  356. var _loop = function _loop(i, ii) {
  357. var extractTextCapability = (0, _pdf.createPromiseCapability)();
  358. _this2._extractTextPromises[i] = extractTextCapability.promise;
  359. promise = promise.then(function () {
  360. return _this2._pdfDocument.getPage(i + 1).then(function (pdfPage) {
  361. return pdfPage.getTextContent({
  362. normalizeWhitespace: true
  363. });
  364. }).then(function (textContent) {
  365. var textItems = textContent.items;
  366. var strBuf = [];
  367. for (var j = 0, jj = textItems.length; j < jj; j++) {
  368. strBuf.push(textItems[j].str);
  369. }
  370. _this2._pageContents[i] = normalize(strBuf.join(''));
  371. extractTextCapability.resolve(i);
  372. }, function (reason) {
  373. console.error("Unable to get text content for page ".concat(i + 1), reason);
  374. _this2._pageContents[i] = '';
  375. extractTextCapability.resolve(i);
  376. });
  377. });
  378. };
  379. for (var i = 0, ii = this._linkService.pagesCount; i < ii; i++) {
  380. _loop(i, ii);
  381. }
  382. }
  383. }, {
  384. key: "_updatePage",
  385. value: function _updatePage(index) {
  386. if (this._scrollMatches && this._selected.pageIdx === index) {
  387. this._linkService.page = index + 1;
  388. }
  389. this._eventBus.dispatch('updatetextlayermatches', {
  390. source: this,
  391. pageIndex: index
  392. });
  393. }
  394. }, {
  395. key: "_updateAllPages",
  396. value: function _updateAllPages() {
  397. this._eventBus.dispatch('updatetextlayermatches', {
  398. source: this,
  399. pageIndex: -1
  400. });
  401. }
  402. }, {
  403. key: "_nextMatch",
  404. value: function _nextMatch() {
  405. var _this3 = this;
  406. var previous = this._state.findPrevious;
  407. var currentPageIndex = this._linkService.page - 1;
  408. var numPages = this._linkService.pagesCount;
  409. this._highlightMatches = true;
  410. if (this._dirtyMatch) {
  411. this._dirtyMatch = false;
  412. this._selected.pageIdx = this._selected.matchIdx = -1;
  413. this._offset.pageIdx = currentPageIndex;
  414. this._offset.matchIdx = null;
  415. this._offset.wrapped = false;
  416. this._resumePageIdx = null;
  417. this._pageMatches.length = 0;
  418. this._pageMatchesLength.length = 0;
  419. this._matchesCountTotal = 0;
  420. this._updateAllPages();
  421. for (var i = 0; i < numPages; i++) {
  422. if (this._pendingFindMatches[i] === true) {
  423. continue;
  424. }
  425. this._pendingFindMatches[i] = true;
  426. this._extractTextPromises[i].then(function (pageIdx) {
  427. delete _this3._pendingFindMatches[pageIdx];
  428. _this3._calculateMatch(pageIdx);
  429. });
  430. }
  431. }
  432. if (this._query === '') {
  433. this._updateUIState(FindState.FOUND);
  434. return;
  435. }
  436. if (this._resumePageIdx) {
  437. return;
  438. }
  439. var offset = this._offset;
  440. this._pagesToSearch = numPages;
  441. if (offset.matchIdx !== null) {
  442. var numPageMatches = this._pageMatches[offset.pageIdx].length;
  443. if (!previous && offset.matchIdx + 1 < numPageMatches || previous && offset.matchIdx > 0) {
  444. offset.matchIdx = previous ? offset.matchIdx - 1 : offset.matchIdx + 1;
  445. this._updateMatch(true);
  446. return;
  447. }
  448. this._advanceOffsetPage(previous);
  449. }
  450. this._nextPageMatch();
  451. }
  452. }, {
  453. key: "_matchesReady",
  454. value: function _matchesReady(matches) {
  455. var offset = this._offset;
  456. var numMatches = matches.length;
  457. var previous = this._state.findPrevious;
  458. if (numMatches) {
  459. offset.matchIdx = previous ? numMatches - 1 : 0;
  460. this._updateMatch(true);
  461. return true;
  462. }
  463. this._advanceOffsetPage(previous);
  464. if (offset.wrapped) {
  465. offset.matchIdx = null;
  466. if (this._pagesToSearch < 0) {
  467. this._updateMatch(false);
  468. return true;
  469. }
  470. }
  471. return false;
  472. }
  473. }, {
  474. key: "_nextPageMatch",
  475. value: function _nextPageMatch() {
  476. if (this._resumePageIdx !== null) {
  477. console.error('There can only be one pending page.');
  478. }
  479. var matches = null;
  480. do {
  481. var pageIdx = this._offset.pageIdx;
  482. matches = this._pageMatches[pageIdx];
  483. if (!matches) {
  484. this._resumePageIdx = pageIdx;
  485. break;
  486. }
  487. } while (!this._matchesReady(matches));
  488. }
  489. }, {
  490. key: "_advanceOffsetPage",
  491. value: function _advanceOffsetPage(previous) {
  492. var offset = this._offset;
  493. var numPages = this._linkService.pagesCount;
  494. offset.pageIdx = previous ? offset.pageIdx - 1 : offset.pageIdx + 1;
  495. offset.matchIdx = null;
  496. this._pagesToSearch--;
  497. if (offset.pageIdx >= numPages || offset.pageIdx < 0) {
  498. offset.pageIdx = previous ? numPages - 1 : 0;
  499. offset.wrapped = true;
  500. }
  501. }
  502. }, {
  503. key: "_updateMatch",
  504. value: function _updateMatch() {
  505. var found = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  506. var state = FindState.NOT_FOUND;
  507. var wrapped = this._offset.wrapped;
  508. this._offset.wrapped = false;
  509. if (found) {
  510. var previousPage = this._selected.pageIdx;
  511. this._selected.pageIdx = this._offset.pageIdx;
  512. this._selected.matchIdx = this._offset.matchIdx;
  513. state = wrapped ? FindState.WRAPPED : FindState.FOUND;
  514. if (previousPage !== -1 && previousPage !== this._selected.pageIdx) {
  515. this._updatePage(previousPage);
  516. }
  517. }
  518. this._updateUIState(state, this._state.findPrevious);
  519. if (this._selected.pageIdx !== -1) {
  520. this._scrollMatches = true;
  521. this._updatePage(this._selected.pageIdx);
  522. }
  523. }
  524. }, {
  525. key: "_onFindBarClose",
  526. value: function _onFindBarClose(evt) {
  527. var _this4 = this;
  528. var pdfDocument = this._pdfDocument;
  529. this._firstPageCapability.promise.then(function () {
  530. if (!_this4._pdfDocument || pdfDocument && _this4._pdfDocument !== pdfDocument) {
  531. return;
  532. }
  533. if (_this4._findTimeout) {
  534. clearTimeout(_this4._findTimeout);
  535. _this4._findTimeout = null;
  536. }
  537. if (_this4._resumePageIdx) {
  538. _this4._resumePageIdx = null;
  539. _this4._dirtyMatch = true;
  540. }
  541. _this4._updateUIState(FindState.FOUND);
  542. _this4._highlightMatches = false;
  543. _this4._updateAllPages();
  544. });
  545. }
  546. }, {
  547. key: "_requestMatchesCount",
  548. value: function _requestMatchesCount() {
  549. var _this$_selected = this._selected,
  550. pageIdx = _this$_selected.pageIdx,
  551. matchIdx = _this$_selected.matchIdx;
  552. var current = 0,
  553. total = this._matchesCountTotal;
  554. if (matchIdx !== -1) {
  555. for (var i = 0; i < pageIdx; i++) {
  556. current += this._pageMatches[i] && this._pageMatches[i].length || 0;
  557. }
  558. current += matchIdx + 1;
  559. }
  560. if (current < 1 || current > total) {
  561. current = total = 0;
  562. }
  563. return {
  564. current: current,
  565. total: total
  566. };
  567. }
  568. }, {
  569. key: "_updateUIResultsCount",
  570. value: function _updateUIResultsCount() {
  571. this._eventBus.dispatch('updatefindmatchescount', {
  572. source: this,
  573. matchesCount: this._requestMatchesCount()
  574. });
  575. }
  576. }, {
  577. key: "_updateUIState",
  578. value: function _updateUIState(state, previous) {
  579. this._eventBus.dispatch('updatefindcontrolstate', {
  580. source: this,
  581. state: state,
  582. previous: previous,
  583. matchesCount: this._requestMatchesCount()
  584. });
  585. }
  586. }, {
  587. key: "highlightMatches",
  588. get: function get() {
  589. return this._highlightMatches;
  590. }
  591. }, {
  592. key: "pageMatches",
  593. get: function get() {
  594. return this._pageMatches;
  595. }
  596. }, {
  597. key: "pageMatchesLength",
  598. get: function get() {
  599. return this._pageMatchesLength;
  600. }
  601. }, {
  602. key: "selected",
  603. get: function get() {
  604. return this._selected;
  605. }
  606. }, {
  607. key: "state",
  608. get: function get() {
  609. return this._state;
  610. }
  611. }, {
  612. key: "_query",
  613. get: function get() {
  614. if (this._state.query !== this._rawQuery) {
  615. this._rawQuery = this._state.query;
  616. this._normalizedQuery = normalize(this._state.query);
  617. }
  618. return this._normalizedQuery;
  619. }
  620. }]);
  621. return PDFFindController;
  622. }();
  623. exports.PDFFindController = PDFFindController;