all files / pdfviewer/base/ navigation-pane.js

16.15% Statements 176/1090
4.4% Branches 24/545
8.6% Functions 8/93
16.18% Lines 176/1088
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 15401×   1× 1× 1× 2× 2× 2× 2× 2× 2× 2× 2× 2× 2× 2× 2× 2× 2× 2× 2× 2× 2×                                                                                                                                                               2×     2×                               2×                                     2×                                                                                                                         2×                             2×         2×                                                                                                       2×                                                                                                             2×                               2×     2×                               2×                         2×                                                                               2×               2× 2×   1×                                           1×                                                                                                                                                                                                   1×                       1×                                                                 1×       1×                                                       1×                                                                           1×           1×     1×                                               1×                                               1×           1×           1×     1×     1× 2× 2× 2× 2× 2× 2×                                                                   1×                                                                                                                                           1×                                                   1×                 1×                               1×       1×                                                                                         1×                           1×     1×                                                   1×                           1×                       1×           1×                                                             1×                                           1×         1×                               1×               1×               1×                               1×               1×         1×         1×                   1×       1×                       1×                       1×                       1×                                   1×                                                 1×                     1×                     1×       1×             1× 2×           1×           1×                                   1×             1× 2×           1×         1×         1×                                                                                                             1×                   1×                                   1× 2× 2× 2× 2×   2×       1× 1× 1×     1× 1× 1×   1×     1×     1×     1×     1×     1×                           1×       1×     1× 1× 1× 1×         1×         1×         1×             1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1×   1×     1×   1×    
define(["require", "exports", "../index", "@syncfusion/ej2-base", "@syncfusion/ej2-navigations", "@syncfusion/ej2-popups", "@syncfusion/ej2-notifications", "@syncfusion/ej2-pdf"], function (require, exports, index_1, ej2_base_1, ej2_navigations_1, ej2_popups_1, ej2_notifications_1, ej2_pdf_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var NavigationPane = (function () {
        function NavigationPane(viewer, base) {
            var _this = this;
            this.thumbnailWidthMin = 200;
            this.contentContainerScrollWidth = 33;
            this.closeButtonLeft = 170;
            this.isTooltipCreated = false;
            this.annotationContextMenu = [];
            this.isCommentPanelShow = false;
            this.commentPanelWidthMin = 300;
            this.isThumbnail = false;
            this.isThumbnailAddedProgrammatically = false;
            this.isBookmarkOpenProgrammatically = false;
            this.isNavigationToolbarVisible = false;
            this.isBookmarkListOpen = false;
            this.isNavigationPaneResized = false;
            this.isBookmarkOpen = false;
            this.isThumbnailOpen = false;
            this.restrictUpdateZoomValue = true;
            this.loadImportAnnotation = function (args) {
                var upoadedFiles = args.target.files;
                if (args.target.files[0] !== null) {
                    var uploadedFile = upoadedFiles[0];
                    if (uploadedFile) {
                        _this.pdfViewer.fireImportStart(uploadedFile);
                        var uploadedFileType = uploadedFile.type;
                        if (uploadedFile.name.split('.json').length > 1 && uploadedFileType.includes('json')) {
                            var reader = new FileReader();
                            reader.readAsDataURL(uploadedFile);
                            reader.onload = function (e) {
                                if (e.currentTarget.result) {
                                    var importFile = e.currentTarget.result.split(',')[1];
                                    var annotationData = atob(importFile);
                                    if (annotationData) {
                                        var jsonData = JSON.parse(annotationData);
                                        var firstAnnotation = jsonData.pdfAnnotation[Object.keys(jsonData.pdfAnnotation)[0]];
                                        if ((Object.keys(jsonData.pdfAnnotation).length >= 1) && (firstAnnotation.textMarkupAnnotation ||
                                            firstAnnotation.measureShapeAnnotation || firstAnnotation.freeTextAnnotation ||
                                            firstAnnotation.stampAnnotations || firstAnnotation.signatureInkAnnotation ||
                                            firstAnnotation.stickyNotesAnnotation ||
                                            (firstAnnotation.shapeAnnotation && firstAnnotation.shapeAnnotation[0].Bounds))) {
                                            _this.pdfViewerBase.isPDFViewerJson = true;
                                            _this.pdfViewerBase.importAnnotations(jsonData, index_1.AnnotationDataFormat.Json);
                                        }
                                        else {
                                            _this.pdfViewerBase.isPDFViewerJson = false;
                                            if (!_this.pdfViewerBase.clientSideRendering) {
                                                _this.pdfViewerBase.importAnnotations(importFile, index_1.AnnotationDataFormat.Json);
                                            }
                                            else {
                                                _this.pdfViewerBase.importAnnotations(ej2_pdf_1._decode(importFile), index_1.AnnotationDataFormat.Json);
                                            }
                                        }
                                    }
                                }
                            };
                        }
                        else if (uploadedFile.name.split('.xfdf').length > 1 && (uploadedFileType.includes('xfdf') || args.target.accept.includes('xfdf'))) {
                            var reader = new FileReader();
                            if (!_this.pdfViewerBase.clientSideRendering) {
                                reader.readAsDataURL(uploadedFile);
                            }
                            else {
                                reader.readAsArrayBuffer(uploadedFile);
                            }
                            reader.onload = function (e) {
                                if (e.currentTarget.result) {
                                    if (!_this.pdfViewerBase.clientSideRendering) {
                                        var importFile = e.currentTarget.result.split(',')[1];
                                        var annotationData = atob(importFile);
                                        if (annotationData) {
                                            _this.pdfViewerBase.importAnnotations(importFile, index_1.AnnotationDataFormat.Xfdf, true);
                                        }
                                    }
                                    else {
                                        var importFileByteArray = new Uint8Array(e.currentTarget.result);
                                        if (importFileByteArray) {
                                            _this.pdfViewerBase.importAnnotations(importFileByteArray, index_1.AnnotationDataFormat.Xfdf, true);
                                        }
                                    }
                                }
                            };
                        }
                        else {
                            _this.pdfViewer.fireImportFailed(uploadedFile, _this.pdfViewer.localeObj.getConstant('Import Failed'));
                            if (ej2_base_1.isBlazor()) {
                                var promise = _this.pdfViewer._dotnetInstance.invokeMethodAsync('GetLocaleText', 'PdfViewer_ImportFailed');
                                promise.then(function (value) {
                                    _this.pdfViewerBase.openImportExportNotificationPopup(value);
                                });
                            }
                            else {
                                _this.pdfViewerBase.openImportExportNotificationPopup(_this.pdfViewer.localeObj.getConstant('Import Failed'));
                            }
                        }
                    }
                    args.target.value = '';
                }
            };
            this.resizeIconMouseOver = function (event) {
                event.target.style.cursor = 'e-resize';
            };
            this.resizePanelMouseDown = function (event) {
                var proxy = null;
                proxy = _this;
                proxy.offset = [
                    proxy.sideBarResizer.offsetLeft - event.clientX,
                    proxy.sideBarResizer.offsetTop - event.clientY,
                    proxy.sideBarResizer.offsetParent.clientWidth
                ];
                _this.previousX = event.clientX;
                proxy.isDown = true;
                proxy.isNavigationPaneResized = true;
                proxy.pdfViewerBase.viewerContainer.style.cursor = 'e-resize';
                if (proxy.sideBarContentContainer) {
                    proxy.sideBarContentContainer.style.cursor = 'e-resize';
                }
            };
            this.resizeViewerMouseLeave = function (event) {
                var proxy = null;
                proxy = _this;
                if (proxy.isDown) {
                    setTimeout(function () {
                        proxy.pdfViewerBase.onWindowResize();
                    }, 200);
                }
                proxy.isDown = false;
                if (proxy.isNavigationPaneResized && proxy.sideBarContentContainer) {
                    proxy.pdfViewerBase.viewerContainer.style.cursor = 'default';
                    proxy.sideBarContentContainer.style.cursor = 'default';
                    proxy.isNavigationPaneResized = false;
                }
                if (proxy.commentPanelContainer && proxy.isCommentPanelShow) {
                    _this.commentPanelMouseLeave(event);
                    proxy.isCommentPanelShow = false;
                }
            };
            this.resizePanelMouseMove = function (event) {
                var proxy = null;
                proxy = _this;
                if (!_this.pdfViewerBase.getPopupNoteVisibleStatus()) {
                    var target = event.target;
                    if (_this.pdfViewerBase.skipPreventDefault(target)) {
                        event.preventDefault();
                    }
                    if (proxy.isDown && _this.sideBarContentContainer) {
                        if (_this.pdfViewer.enableRtl) {
                            var currentWidth = _this.previousX - event.clientX;
                            var width = currentWidth + proxy.offset[2];
                            var maxWidth = Math.floor(_this.outerContainerWidth / 2);
                            if (width > maxWidth) {
                                width = maxWidth;
                            }
                            if (width < _this.thumbnailWidthMin) {
                                width = _this.thumbnailWidthMin;
                            }
                            proxy.sideBarResizer.style.right = width + 'px';
                            proxy.sideBarContentContainer.style.width = width + 'px';
                            proxy.sideBarContent.style.width = width + 'px';
                            proxy.sideBarContentSplitter.style.width = width + 'px';
                            proxy.sideBarTitleContainer.style.width = width + 'px';
                            proxy.pdfViewerBase.viewerContainer.style.right = proxy.getViewerContainerLeft() + 'px';
                            proxy.pdfViewerBase.viewerContainer.style.left = proxy.getViewerContainerRight() + 'px';
                        }
                        else {
                            var width = event.clientX + proxy.offset[0];
                            var maxWidth = Math.floor(_this.outerContainerWidth / 2);
                            if (width > maxWidth) {
                                width = maxWidth;
                            }
                            if (width < _this.thumbnailWidthMin) {
                                width = _this.thumbnailWidthMin;
                            }
                            proxy.sideBarResizer.style.left = width + 'px';
                            proxy.closeDiv.style.left = width - proxy.contentContainerScrollWidth + 'px';
                            proxy.sideBarContentContainer.style.width = width + 'px';
                            proxy.sideBarContent.style.width = width + 'px';
                            proxy.sideBarContentSplitter.style.width = width + 'px';
                            proxy.sideBarTitleContainer.style.width = width + 'px';
                            proxy.pdfViewerBase.viewerContainer.style.left = proxy.getViewerContainerLeft() + 'px';
                            proxy.pdfViewerBase.viewerContainer.style.right = proxy.getViewerContainerRight() + 'px';
                        }
                        var viewerWidth = ((proxy.pdfViewer.element.clientWidth > 0 ? proxy.pdfViewer.element.clientWidth :
                            proxy.pdfViewer.element.offsetWidth) - proxy.getViewerContainerLeft() - proxy.getViewerContainerRight());
                        proxy.pdfViewerBase.viewerContainer.style.width = viewerWidth + 'px';
                        proxy.pdfViewerBase.pageContainer.style.width = proxy.pdfViewerBase.viewerContainer.clientWidth + 'px';
                        proxy.pdfViewer.thumbnailViewModule.gotoThumbnailImage(proxy.pdfViewerBase.currentPageNumber - 1);
                        proxy.pdfViewer.thumbnailViewModule.renderViewPortThumbnailImage();
                        proxy.pdfViewerBase.updateZoomValue();
                        if (!proxy.bookmarkButton.children[0].classList.contains('e-pv-bookmark-disable-icon')) {
                            proxy.pdfViewer.bookmarkViewModule.setBookmarkContentHeight();
                        }
                    }
                    else if (proxy.isCommentPanelShow && _this.commentPanelContainer) {
                        _this.updateCommentPanelContainer(event);
                    }
                }
            };
            this.sideToolbarOnClose = function (event) {
                var proxy = null;
                proxy = _this;
                proxy.removeThumbnailSelectionIconTheme();
                proxy.removeBookmarkSelectionIconTheme();
                proxy.updateViewerContainerOnClose();
                proxy.pdfViewerBase.focusViewerContainer();
                proxy.isThumbnailAddedProgrammatically = false;
                proxy.isBookmarkOpenProgrammatically = false;
                proxy.isThumbnail = false;
                proxy.isBookmarkOpen = false;
                proxy.isThumbnailOpen = false;
                proxy.pdfViewer.isBookmarkPanelOpen = false;
                proxy.pdfViewer.isThumbnailViewOpen = false;
            };
            this.organizeButtonOnClick = function (event) {
                if (!ej2_base_1.isNullOrUndefined(_this.pdfViewer.pageOrganizer)) {
                    _this.pdfViewer.pageOrganizer.createOrganizeWindow();
                }
            };
            this.sideToolbarOnClick = function (event) {
                _this.sideBarTitle.textContent = _this.pdfViewer.localeObj.getConstant('Page Thumbnails');
                _this.sideBarContent.setAttribute('aria-label', 'Thumbnail View Panel');
                var proxy = null;
                proxy = _this;
                var bookmarkPane = document.getElementById(_this.pdfViewer.element.id + '_bookmark_view');
                if (bookmarkPane) {
                    proxy.removeBookmarkSelectionIconTheme();
                    bookmarkPane.style.display = 'none';
                }
                document.getElementById(_this.pdfViewer.element.id + '_thumbnail_view').style.display = 'flex';
                if (proxy.sideBarContentContainer) {
                    if (proxy.sideBarContentContainer.style.display !== 'none') {
                        if (proxy.isBookmarkOpen) {
                            proxy.isThumbnailOpen = true;
                            proxy.isThumbnail = true;
                            proxy.setThumbnailSelectionIconTheme();
                            proxy.updateViewerContainerOnExpand();
                            document.getElementById(proxy.pdfViewer.element.id + '_thumbnail_image_' + (proxy.pdfViewerBase.currentPageNumber - 1)).focus();
                            proxy.isThumbnailAddedProgrammatically = true;
                            proxy.pdfViewer.isThumbnailViewOpen = true;
                        }
                        else {
                            proxy.isThumbnailOpen = false;
                            proxy.removeThumbnailSelectionIconTheme();
                            proxy.updateViewerContainerOnClose();
                            proxy.isThumbnailAddedProgrammatically = false;
                            proxy.isThumbnail = false;
                            proxy.pdfViewer.isThumbnailViewOpen = false;
                        }
                    }
                    else {
                        proxy.sideBarContent.focus();
                        proxy.isThumbnailOpen = true;
                        proxy.setThumbnailSelectionIconTheme();
                        proxy.updateViewerContainerOnExpand();
                        proxy.isThumbnail = true;
                        if (!ej2_base_1.isNullOrUndefined(document.getElementById(proxy.pdfViewer.element.id + '_thumbnail_image_' + (proxy.pdfViewerBase.currentPageNumber - 1)))) {
                            document.getElementById(proxy.pdfViewer.element.id + '_thumbnail_image_' + (proxy.pdfViewerBase.currentPageNumber - 1)).focus();
                        }
                        proxy.isThumbnailAddedProgrammatically = true;
                        proxy.pdfViewer.isThumbnailViewOpen = true;
                    }
                }
                proxy.isBookmarkOpen = false;
                proxy.isBookmarkOpenProgrammatically = false;
                if (_this.pdfViewer.annotationModule && _this.pdfViewer.annotationModule.inkAnnotationModule) {
                    var currentPageNumber = parseInt(_this.pdfViewer.annotationModule.inkAnnotationModule.currentPageNumber, 10);
                    _this.pdfViewer.annotationModule.inkAnnotationModule.drawInkAnnotation(currentPageNumber);
                }
                proxy.pdfViewer.isBookmarkPanelOpen = false;
            };
            this.openThumbnailPane = function () {
                if (ej2_base_1.Browser.isDevice && !_this.pdfViewer.enableDesktopMode) {
                    return;
                }
                if (_this.isThumbnailOpen || _this.isThumbnail || _this.isThumbnailAddedProgrammatically) {
                    return;
                }
                var proxy = null;
                proxy = _this;
                var sideBarContent = document.getElementById(_this.pdfViewer.element.id + '_sideBarContent');
                var sideBarContentContainer = document.getElementById(_this.pdfViewer.element.id + '_sideBarContentContainer');
                var viewerContainer = document.getElementById(_this.pdfViewer.element.id + '_viewerContainer');
                var pageContainer = document.getElementById(_this.pdfViewer.element.id + '_pageViewContainer');
                document.getElementById(_this.pdfViewer.element.id + '_thumbnail_view').style.display = 'block';
                proxy.sideBarTitle.textContent = _this.pdfViewer.localeObj.getConstant('Page Thumbnails');
                proxy.sideBarContent.setAttribute('aria-label', 'Thumbnail View Panel');
                proxy.sideBarContent.setAttribute('tabindex', '0');
                var bookmarkPane = document.getElementById(_this.pdfViewer.element.id + '_bookmark_view');
                if (bookmarkPane) {
                    proxy.removeBookmarkSelectionIconTheme();
                    bookmarkPane.style.display = 'none';
                }
                if (sideBarContentContainer && !_this.isThumbnailAddedProgrammatically) {
                    if (proxy.isThumbnail) {
                        sideBarContentContainer.style.display = 'none';
                        viewerContainer.style.width = (proxy.pdfViewer.element.clientWidth > 0 ? proxy.pdfViewer.element.clientWidth : proxy.pdfViewer.element.offsetWidth) + 'px';
                        pageContainer.style.width = viewerContainer.clientWidth + 'px';
                        viewerContainer.style.left = sideBarContentContainer.clientWidth + 'px';
                        proxy.pdfViewerBase.updateZoomValue();
                        proxy.removeThumbnailSelectionIconTheme();
                        proxy.isThumbnail = false;
                        proxy.pdfViewer.isThumbnailViewOpen = false;
                    }
                    else {
                        sideBarContent.focus();
                        proxy.setThumbnailSelectionIconTheme();
                        proxy.updateViewerContainerOnExpand();
                        proxy.isThumbnail = true;
                        proxy.pdfViewerBase.updateZoomValue();
                        if (!ej2_base_1.isNullOrUndefined(proxy.pdfViewer.thumbnailViewModule)) {
                            proxy.pdfViewer.thumbnailViewModule.gotoThumbnailImage(proxy.pdfViewerBase.currentPageNumber - 1);
                        }
                        proxy.isThumbnailAddedProgrammatically = true;
                        proxy.isThumbnailOpen = true;
                        proxy.isBookmarkOpen = false;
                        proxy.isBookmarkOpenProgrammatically = false;
                        proxy.pdfViewer.isBookmarkPanelOpen = false;
                        proxy.pdfViewer.isThumbnailViewOpen = true;
                    }
                }
                if (_this.pdfViewer.annotationModule && _this.pdfViewer.annotationModule.inkAnnotationModule) {
                    var currentPageNumber = parseInt(_this.pdfViewer.annotationModule.inkAnnotationModule.currentPageNumber, 10);
                    _this.pdfViewer.annotationModule.inkAnnotationModule.drawInkAnnotation(currentPageNumber);
                }
            };
            this.closeThumbnailPane = function () {
                if (ej2_base_1.Browser.isDevice && !_this.pdfViewer.enableDesktopMode) {
                    return;
                }
                var proxy = null;
                proxy = _this;
                if (proxy.isThumbnail || proxy.isThumbnailAddedProgrammatically || proxy.isThumbnailOpen) {
                    proxy.sideBarContent.removeAttribute('tabindex');
                    proxy.removeThumbnailSelectionIconTheme();
                    proxy.isThumbnailOpen = false;
                    proxy.updateViewerContainerOnClose();
                    proxy.isThumbnailAddedProgrammatically = false;
                    proxy.isThumbnail = false;
                    proxy.pdfViewer.isThumbnailViewOpen = false;
                }
            };
            this.bookmarkButtonOnClick = function (event) {
                _this.openBookmarkcontentInitially(true);
            };
            this.closeBookmarkPane = function (isAPI) {
                var proxy = _this;
                if (proxy.isBookmarkOpen || proxy.isBookmarkOpenProgrammatically || proxy.isBookmarkListOpen) {
                    if (ej2_base_1.Browser.isDevice && !_this.pdfViewer.enableDesktopMode) {
                        proxy.goBackToToolbar(isAPI);
                    }
                    else {
                        proxy.removeBookmarkSelectionIconTheme();
                        proxy.updateViewerContainerOnClose();
                        proxy.isBookmarkOpen = false;
                        proxy.isBookmarkListOpen = false;
                        proxy.isBookmarkOpenProgrammatically = false;
                        proxy.pdfViewer.isBookmarkPanelOpen = false;
                    }
                }
            };
            this.commentPanelMouseDown = function (event) {
                var proxy = null;
                proxy = _this;
                proxy.offset = [
                    proxy.commentPanelResizer.offsetLeft - event.clientX,
                    proxy.commentPanelResizer.offsetTop - event.clientY,
                    proxy.getViewerContainerRight()
                ];
                _this.isCommentPanelShow = true;
                _this.previousX = event.clientX;
                proxy.pdfViewerBase.viewerContainer.style.cursor = 'e-resize';
                proxy.commentPanelResizer.style.cursor = 'e-resize';
            };
            this.updateCommentPanelContainer = function (event) {
                var proxy = null;
                proxy = _this;
                if (_this.pdfViewer.enableRtl) {
                    var width = event.clientX + proxy.offset[0];
                    var maxWidth = Math.floor(_this.outerContainerWidth / 2);
                    if (width > maxWidth) {
                        width = maxWidth;
                    }
                    if (width < _this.commentPanelWidthMin) {
                        width = _this.commentPanelWidthMin;
                    }
                    proxy.commentPanelResizer.style.left = width + 'px';
                    proxy.commentPanelContainer.style.width = width + 'px';
                    proxy.pdfViewerBase.viewerContainer.style.left = proxy.getViewerContainerRight() + 'px';
                    proxy.pdfViewerBase.viewerContainer.style.right = proxy.getViewerContainerLeft() + 'px';
                }
                else {
                    var currentWidth = _this.previousX - event.clientX;
                    var width = currentWidth + proxy.offset[2];
                    var maxWidth = Math.floor(_this.outerContainerWidth / 2);
                    if (width > maxWidth) {
                        width = maxWidth;
                    }
                    if (width < _this.commentPanelWidthMin) {
                        width = _this.commentPanelWidthMin;
                    }
                    proxy.commentPanelResizer.style.right = width + 'px';
                    proxy.commentPanelContainer.style.width = width + 'px';
                    proxy.pdfViewerBase.viewerContainer.style.right = proxy.getViewerContainerRight() + 'px';
                    proxy.pdfViewerBase.viewerContainer.style.left = proxy.getViewerContainerLeft() + 'px';
                }
                _this.pdfViewer.annotation.stickyNotesAnnotationModule.updateCommentPanelTextTop();
                var viewerWidth = ((proxy.pdfViewer.element.clientWidth > 0 ? proxy.pdfViewer.element.clientWidth :
                    proxy.pdfViewer.element.offsetWidth) - proxy.getViewerContainerLeft() - proxy.getViewerContainerRight());
                proxy.pdfViewerBase.viewerContainer.style.width = viewerWidth + 'px';
                proxy.pdfViewerBase.pageContainer.style.width = proxy.pdfViewerBase.viewerContainer.clientWidth + 'px';
                proxy.calculateCommentPanelWidth();
                proxy.pdfViewerBase.updateZoomValue();
            };
            this.commentPanelMouseLeave = function (event) {
                var proxy = null;
                proxy = _this;
                if (proxy.commentPanelContainer) {
                    proxy.pdfViewerBase.viewerContainer.style.cursor = 'default';
                    proxy.commentPanelContainer.style.cursor = 'default';
                }
            };
            this.pdfViewer = viewer;
            this.pdfViewerBase = base;
        }
        NavigationPane.prototype.initializeNavigationPane = function () {
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                this.createNavigationPane();
            }
            else {
                this.commentPanelContainer = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_commantPanel', className: 'e-pv-mobile-comments-container' });
                this.pdfViewerBase.mainContainer.appendChild(this.commentPanelContainer);
                if (this.pdfViewer.enableRtl) {
                    this.commentPanelContainer.style.left = 0 + 'px';
                }
                else {
                    this.commentPanelContainer.style.right = 0 + 'px';
                }
                this.commentPanelContainer.style.bottom = 0 + 'px';
                this.createCommentPanelTitleContainer();
                this.commentPanelContainer.style.display = 'none';
                this.commentsContentContainer = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_commentscontentcontainer', className: 'e-pv-comments-content-container' });
                this.commentPanelContainer.appendChild(this.commentsContentContainer);
                this.createFileElement(this.commentPanelContainer);
                this.createXFdfFileElement(this.commentPanelContainer);
            }
        };
        NavigationPane.prototype.createNavigationPane = function () {
            var isblazor = ej2_base_1.isBlazor();
            if (!isblazor) {
                this.sideBarToolbar = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_sideBarToolbar', className: 'e-pv-sidebar-toolbar', attrs: { 'role': 'toolbar', 'aria-orientation': 'vertical', 'tabindex': '-1', 'aria-label': 'Sidebar Toolbar' } });
                this.sideBarToolbarSplitter = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_sideBarToolbarSplitter', className: 'e-pv-sidebar-toolbar-splitter' });
                this.sideBarContentContainer = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_sideBarContentContainer', className: 'e-pv-sidebar-content-container' });
                this.sideBarContentSplitter = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_sideBarContentSplitter', className: 'e-pv-sidebar-content-splitter' });
                this.sideBarContent = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_sideBarContent', className: 'e-pv-sidebar-content' });
                this.sideBarTitleContainer = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_sideBarTitleContainer', className: 'e-pv-sidebar-title-container' });
                this.sideBarTitle = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_sideBarTitle', className: 'e-pv-sidebar-title', attrs: { 'tabindex': '-1' } });
                this.sideBarResizer = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_sideBarResizer', className: 'e-pv-sidebar-resizer' });
            }
            else {
                this.sideBarToolbar = this.pdfViewer.element.querySelector('.e-pv-sidebar-toolbar');
                this.sideBarToolbarSplitter = this.pdfViewer.element.querySelector('.e-pv-sidebar-toolbar-splitter');
                this.sideBarContentContainer = this.pdfViewer.element.querySelector('.e-pv-sidebar-content-container');
                this.sideBarContentSplitter = this.pdfViewer.element.querySelector('.e-pv-sidebar-content-splitter');
                this.sideBarContent = this.pdfViewer.element.querySelector('.e-pv-sidebar-content');
                this.sideBarTitleContainer = this.pdfViewer.element.querySelector('.e-pv-sidebar-title-container');
                this.sideBarTitle = this.pdfViewer.element.querySelector('.e-pv-sidebar-title');
                this.sideBarResizer = this.pdfViewer.element.querySelector('.e-pv-sidebar-resizer');
            }
            if (this.sideBarContent) {
                this.sideBarContent.tabIndex = 0;
            }
            this.pdfViewerBase.mainContainer.appendChild(this.sideBarToolbar);
            if (this.pdfViewer.enableRtl) {
                this.sideBarToolbar.style.cssFloat = 'right';
                this.sideBarToolbar.style.right = 1 + 'px';
                this.sideBarToolbar.style.position = 'relative';
            }
            this.pdfViewerBase.mainContainer.appendChild(this.sideBarToolbarSplitter);
            if (this.pdfViewer.enableRtl) {
                this.sideBarToolbarSplitter.classList.add('e-right');
            }
            else {
                this.sideBarToolbarSplitter.classList.add('e-left');
            }
            if (this.pdfViewer.enableRtl) {
                this.sideBarContentContainer.classList.add('e-right');
            }
            else {
                this.sideBarContentContainer.classList.add('e-left');
            }
            this.pdfViewerBase.mainContainer.appendChild(this.sideBarContentContainer);
            if (this.pdfViewer.enableRtl) {
                this.sideBarContentSplitter.style.right = 0 + 'px';
            }
            this.sideBarContentContainer.appendChild(this.sideBarContentSplitter);
            if (this.pdfViewer.enableRtl) {
                this.sideBarContent.style.right = 0 + 'px';
                this.sideBarContent.style.direction = 'rtl';
            }
            this.sideBarContentContainer.appendChild(this.sideBarContent);
            if (this.pdfViewer.enableRtl) {
                this.sideBarTitleContainer.style.right = 0 + 'px';
            }
            if (this.pdfViewer.enableRtl) {
                this.sideBarTitle.classList.add('e-right');
            }
            else {
                this.sideBarTitle.classList.add('e-left');
            }
            this.sideBarTitleContainer.appendChild(this.sideBarTitle);
            this.sideBarContentContainer.appendChild(this.sideBarTitleContainer);
            this.sideBarResizer.addEventListener('mousedown', this.resizePanelMouseDown);
            this.pdfViewerBase.mainContainer.addEventListener('mousemove', this.resizePanelMouseMove);
            this.pdfViewerBase.mainContainer.addEventListener('mouseup', this.resizeViewerMouseLeave);
            if (this.pdfViewer.enableRtl) {
                this.sideBarResizer.classList.add('e-right');
            }
            else {
                this.sideBarResizer.classList.add('e-left');
            }
            this.sideBarContentContainer.appendChild(this.sideBarResizer);
            this.createCommentPanel();
            var controlLeft = this.getViewerContainerLeft();
            var controlRight = this.getViewerContainerRight();
            if (!this.pdfViewer.enableRtl) {
                this.pdfViewerBase.viewerContainer.style.left = controlLeft + 'px';
                this.pdfViewerBase.viewerContainer.style.right = controlRight + 'px';
            }
            this.pdfViewerBase.viewerContainer.style.width = ((this.pdfViewer.element.clientWidth > 0 ? this.pdfViewer.element.clientWidth : this.pdfViewer.element.offsetWidth) - controlLeft - this.commentPanelContainer.clientWidth) + 'px';
            this.sideBarContentContainer.style.display = 'none';
            if (!this.pdfViewer.enableNavigationToolbar) {
                if (!this.pdfViewer.enableRtl) {
                    this.sideBarContentContainer.style.left = '0px';
                }
                else {
                    this.sideBarContentContainer.style.right = '0px';
                }
            }
            this.createSidebarToolBar();
            this.createSidebarTitleCloseButton();
            this.createResizeIcon();
            this.sideBarToolbar.addEventListener('mouseup', this.sideToolbarOnMouseup.bind(this));
            this.sideBarContentContainer.addEventListener('mouseup', this.sideBarTitleOnMouseup.bind(this));
        };
        NavigationPane.prototype.showBookmarksPaneMobile = function () {
            if (this.isBookmarkOpenProgrammatically || this.isBookmarkOpen || this.isBookmarkListOpen) {
                return;
            }
            if (this.pdfViewer.toolbar) {
                this.pdfViewer.toolbar.showToolbar(false);
            }
            this.createNavigationPaneMobile('bookmarks');
            this.isBookmarkOpen = true;
            this.isBookmarkOpenProgrammatically = true;
            this.pdfViewer.isBookmarkPanelOpen = true;
        };
        NavigationPane.prototype.adjustPane = function () {
            if (ej2_base_1.isBlazor()) {
                var splitterElement = this.pdfViewer.element.querySelector('.e-pv-sidebar-toolbar-splitter');
                var sideToolbarElement = this.pdfViewer.element.querySelector('.e-pv-sidebar-toolbar');
                var sideToolbarContent = this.pdfViewer.element.querySelector('.e-pv-sidebar-content-container');
                var toolbarContainer = this.pdfViewer.element.querySelector('.e-pv-toolbar');
                var toolbarHeight = toolbarContainer.getBoundingClientRect().height;
                if (toolbarHeight === 0) {
                    toolbarHeight = parseFloat(window.getComputedStyle(toolbarContainer)['height']) + 1;
                }
                if (!this.pdfViewer.enableToolbar) {
                    toolbarHeight = 0;
                }
                sideToolbarElement.style.top = toolbarHeight + 'px';
                sideToolbarContent.style.top = toolbarHeight + 'px';
                splitterElement.style.top = toolbarHeight + 'px';
                sideToolbarElement.style.height = this.getSideToolbarHeight(toolbarHeight);
                sideToolbarContent.style.height = this.getSideToolbarHeight(toolbarHeight);
                splitterElement.style.height = this.getSideToolbarHeight(toolbarHeight);
                this.pdfViewerBase.viewerContainer.style.height = this.getSideToolbarHeight(toolbarHeight);
            }
            else {
                var splitterElement = this.pdfViewerBase.getElement('_sideBarToolbarSplitter');
                var toolbarContainer = this.pdfViewerBase.getElement('_toolbarContainer');
                var toolbarHeight = toolbarContainer.clientHeight;
                if (toolbarHeight === 0) {
                    toolbarHeight = parseFloat(window.getComputedStyle(toolbarContainer)['height']) + 1;
                }
                this.sideBarToolbar.style.top = toolbarHeight + 'px';
                this.sideBarContentContainer.style.top = toolbarHeight + 'px';
                splitterElement.style.top = toolbarHeight + 'px';
            }
        };
        NavigationPane.prototype.getSideToolbarHeight = function (toolbarHeight) {
            var height = this.pdfViewer.element.getBoundingClientRect().height;
            return (height !== 0) ? height - toolbarHeight + 'px' : '';
        };
        NavigationPane.prototype.createCommentPanel = function () {
            this.commentPanelContainer = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_commantPanel', className: 'e-pv-comment-panel' });
            this.pdfViewerBase.mainContainer.appendChild(this.commentPanelContainer);
            if (this.pdfViewer.enableRtl) {
                this.commentPanelContainer.style.left = 0 + 'px';
            }
            else {
                this.commentPanelContainer.style.right = 0 + 'px';
            }
            this.commentPanelContainer.style.bottom = 0 + 'px';
            this.createCommentPanelTitleContainer();
            this.commentPanelContainer.style.display = 'none';
            this.commentsContentContainer = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_commentscontentcontainer', className: 'e-pv-comments-content-container' });
            this.commentPanelContainer.appendChild(this.commentsContentContainer);
            this.commentPanelResizer = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_commentPanelResizer', className: 'e-pv-comment-panel-resizer' });
            if (this.pdfViewer.enableRtl) {
                this.commentPanelResizer.classList.add('e-left');
            }
            else {
                this.commentPanelResizer.classList.add('e-right');
            }
            this.commentPanelResizer.style.display = 'none';
            this.commentPanelResizer.addEventListener('mousedown', this.commentPanelMouseDown);
            this.pdfViewerBase.mainContainer.appendChild(this.commentPanelResizer);
            this.createCommentPanelResizeIcon();
            this.createFileElement(this.commentPanelContainer);
            this.createXFdfFileElement(this.commentPanelContainer);
        };
        NavigationPane.prototype.createCommentPanelTitleContainer = function () {
            var commentPanelTitleContainer = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_commentPanelTitleContainer', className: 'e-pv-comment-panel-title-container' });
            var commentpanelTilte = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_commentPanelTitle', className: 'e-pv-comment-panel-title', attrs: { 'tabindex': '-1' } });
            if (ej2_base_1.isBlazor()) {
                var promise = this.pdfViewer._dotnetInstance.invokeMethodAsync('GetLocaleText', 'PdfViewer_Comments');
                promise.then(function (value) {
                    commentpanelTilte.innerText = value;
                });
            }
            else {
                commentpanelTilte.innerText = this.pdfViewer.localeObj.getConstant('Comments');
            }
            var annotationButton = ej2_base_1.createElement('button', { id: this.pdfViewer.element.id + '_annotations_btn' });
            annotationButton.setAttribute('aria-label', 'annotation button');
            annotationButton.setAttribute('type', 'button');
            annotationButton.className = 'e-btn e-pv-tbar-btn e-pv-comment-panel-title-close-div e-btn';
            var moreOptionButtonSpan = ej2_base_1.createElement('span', { id: this.pdfViewer.element.id + '_annotation_more_icon', className: 'e-pv-more-icon e-pv-icon' });
            annotationButton.appendChild(moreOptionButtonSpan);
            if (ej2_base_1.Browser.isDevice && !this.pdfViewer.enableDesktopMode && !ej2_base_1.isBlazor()) {
                var commentCloseIconDiv = ej2_base_1.createElement('button');
                commentCloseIconDiv.setAttribute('aria-label', 'annotation button');
                commentCloseIconDiv.setAttribute('type', 'button');
                commentCloseIconDiv.style.borderColor = 'transparent';
                commentCloseIconDiv.style.paddingTop = '11px';
                commentCloseIconDiv.style.paddingBottom = '11px';
                commentCloseIconDiv.style.backgroundColor = 'transparent';
                commentCloseIconDiv.addEventListener('click', this.closeCommentPanelContainer.bind(this));
                commentpanelTilte.style.left = '37px';
                var commentCloseIcon = ej2_base_1.createElement('span', { className: 'e-pv-annotation-tools-close-icon e-pv-icon' });
                commentCloseIconDiv.appendChild(commentCloseIcon);
                commentPanelTitleContainer.appendChild(commentCloseIconDiv);
            }
            commentPanelTitleContainer.appendChild(commentpanelTilte);
            commentPanelTitleContainer.appendChild(annotationButton);
            this.commentPanelContainer.appendChild(commentPanelTitleContainer);
            this.createAnnotationContextMenu();
            annotationButton.addEventListener('click', this.openAnnotationContextMenu.bind(this));
        };
        NavigationPane.prototype.createCommentPanelResizeIcon = function () {
            this.commentPanelResizeIcon = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_commentPanel_resize', className: 'e-pv-resize-icon e-pv-icon' });
            this.setCommentPanelResizeIconTop();
            this.commentPanelResizeIcon.style.position = 'absolute';
            this.commentPanelResizer.appendChild(this.commentPanelResizeIcon);
        };
        NavigationPane.prototype.openAnnotationContextMenu = function (event) {
            this.annotationMenuObj.open(event.clientY, event.clientX, event.currentTarget);
        };
        NavigationPane.prototype.createAnnotationContextMenu = function () {
            this.annotationContextMenu = [
                { text: this.pdfViewer.localeObj.getConstant('Export Annotations') },
                { text: this.pdfViewer.localeObj.getConstant('Import Annotations') },
                { text: this.pdfViewer.localeObj.getConstant('Export XFDF') },
                { text: this.pdfViewer.localeObj.getConstant('Import XFDF') }
            ];
            var annotationMenuElement = ej2_base_1.createElement('ul', { id: this.pdfViewer.element.id + '_annotation_context_menu' });
            this.pdfViewer.element.appendChild(annotationMenuElement);
            this.annotationMenuObj = new ej2_navigations_1.ContextMenu({
                target: '#' + this.pdfViewer.element.id + '_annotations_btn', items: this.annotationContextMenu,
                select: this.annotationMenuItemSelect.bind(this)
            });
            if (this.pdfViewer.enableRtl) {
                this.annotationMenuObj.enableRtl = true;
            }
            this.annotationMenuObj.appendTo(annotationMenuElement);
            if (ej2_base_1.Browser.isDevice && !this.pdfViewer.enableDesktopMode) {
                this.annotationMenuObj.animationSettings.effect = 'ZoomIn';
            }
            else {
                this.annotationMenuObj.animationSettings.effect = 'SlideDown';
            }
        };
        NavigationPane.prototype.annotationMenuItemSelect = function (args) {
            if (this.pdfViewer.annotationModule && this.pdfViewer.annotationModule.inkAnnotationModule) {
                var currentPageNumber = parseInt(this.pdfViewer.annotationModule.inkAnnotationModule.currentPageNumber, 10);
                this.pdfViewer.annotationModule.inkAnnotationModule.drawInkAnnotation(currentPageNumber);
            }
            if (args.item) {
                switch (args.item.text) {
                    case this.pdfViewer.localeObj.getConstant('Export Annotations'):
                        this.pdfViewerBase.exportAnnotations(index_1.AnnotationDataFormat.Json);
                        break;
                    case this.pdfViewer.localeObj.getConstant('Import Annotations'):
                        this.importAnnotationIconClick(args);
                        break;
                    case this.pdfViewer.localeObj.getConstant('Export XFDF'):
                        this.pdfViewerBase.exportAnnotations(index_1.AnnotationDataFormat.Xfdf);
                        break;
                    case this.pdfViewer.localeObj.getConstant('Import XFDF'):
                        this.importXFdfAnnotationIconClick(args);
                        break;
                    default:
                        break;
                }
            }
        };
        NavigationPane.prototype.createFileElement = function (toolbarElement) {
            this.annotationInputElement = ej2_base_1.createElement('input', { id: this.pdfViewer.element.id + '_annotationUploadElement', styles: 'position:fixed; left:-100em', attrs: { 'type': 'file', 'aria-label': 'upload elements' } });
            this.annotationInputElement.setAttribute('accept', '.json');
            toolbarElement.appendChild(this.annotationInputElement);
            this.annotationInputElement.addEventListener('change', this.loadImportAnnotation);
        };
        NavigationPane.prototype.createXFdfFileElement = function (toolbarElement) {
            this.annotationXFdfInputElement = ej2_base_1.createElement('input', { id: this.pdfViewer.element.id + '_annotationXFdfUploadElement', styles: 'position:fixed; left:-100em', attrs: { 'type': 'file', 'aria-label': 'upload elements' } });
            this.annotationXFdfInputElement.setAttribute('accept', '.xfdf');
            toolbarElement.appendChild(this.annotationXFdfInputElement);
            this.annotationXFdfInputElement.addEventListener('change', this.loadImportAnnotation);
        };
        NavigationPane.prototype.importAnnotationIconClick = function (args) {
            this.annotationInputElement.click();
        };
        NavigationPane.prototype.importXFdfAnnotationIconClick = function (args) {
            this.annotationXFdfInputElement.click();
        };
        NavigationPane.prototype.closeCommentPanelContainer = function () {
            var proxy = null;
            proxy = this;
            var viewerContainer = document.getElementById(this.pdfViewer.element.id + '_viewerContainer');
            var pageContainer = document.getElementById(this.pdfViewer.element.id + '_pageViewContainer');
            var commentPanel = document.getElementById(this.pdfViewer.element.id + '_commantPanel');
            Iif (commentPanel) {
                commentPanel.style.display = 'none';
                if (proxy.commentPanelResizer) {
                    proxy.commentPanelResizer.style.display = 'none';
                }
                if (viewerContainer) {
                    if (this.pdfViewer.enableRtl) {
                        viewerContainer.style.left = proxy.getViewerContainerRight() + 'px';
                    }
                    else {
                        viewerContainer.style.right = proxy.getViewerContainerRight() + 'px';
                    }
                    viewerContainer.style.width = ((proxy.pdfViewer.element.clientWidth > 0 ? proxy.pdfViewer.element.clientWidth : proxy.pdfViewer.element.offsetWidth) - proxy.getViewerContainerLeft() - proxy.getViewerContainerRight()) + 'px';
                    pageContainer.style.width = (proxy.pdfViewerBase.viewerContainer.offsetWidth - proxy.getViewerContainerScrollbarWidth()) + 'px';
                }
                if (proxy.pdfViewerBase) {
                    proxy.pdfViewerBase.updateZoomValue();
                }
                if (this.pdfViewer.annotation && this.pdfViewer.annotation.textMarkupAnnotationModule) {
                    this.pdfViewer.annotation.textMarkupAnnotationModule.showHideDropletDiv(true);
                }
                if (ej2_base_1.Browser.isDevice && !ej2_base_1.isBlazor() && !this.pdfViewer.enableDesktopMode) {
                    if (this.pdfViewer.toolbarModule.annotationToolbarModule.toolbar) {
                        this.pdfViewer.toolbarModule.annotationToolbarModule.toolbar.element.style.display = 'block';
                        if (this.pdfViewer.toolbarModule.annotationToolbarModule.propertyToolbar) {
                            this.pdfViewer.toolbarModule.annotationToolbarModule.propertyToolbar.element.style.display = 'block';
                        }
                    }
                    if (this.pdfViewer.toolbarModule.redactionToolbarModule && this.pdfViewer.toolbarModule.redactionToolbarModule.toolbar) {
                        this.pdfViewer.toolbarModule.redactionToolbarModule.toolbar.element.style.display = 'block';
                    }
                }
            }
        };
        NavigationPane.prototype.createNavigationPaneMobile = function (option) {
            var _this = this;
            this.isNavigationToolbarVisible = true;
            this.toolbarElement = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_navigationToolbar', className: 'e-pv-nav-toolbar' });
            this.pdfViewerBase.viewerMainContainer.insertBefore(this.toolbarElement, this.pdfViewerBase.viewerContainer);
            var items;
            if (option === 'search') {
                var searchTemplate = '<div class="e-input-group e-pv-text-search-input-mobile" id="' + this.pdfViewer.element.id +
                    '_search_input_container"><input class="e-input" type="text" placeholder="' +
                    this.pdfViewer.localeObj.getConstant('Find in document') + '" id="' +
                    this.pdfViewer.element.id + '_search_input"></input></div>';
                var searchCountTemplate = "\n                <span class=\"e-pv-search-count\" id=\"" + this.pdfViewer.element.id + "_search_count\"></span>\n            ";
                items = [
                    { prefixIcon: 'e-pv-backward-icon e-pv-icon', tooltipText: this.pdfViewer.localeObj.getConstant('Go Back'), id: this.pdfViewer.element.id + '_backward', click: this.goBackToToolbar.bind(this, null) },
                    { template: searchTemplate },
                    {
                        prefixIcon: 'e-pv-search-icon e-pv-icon', id: this.pdfViewer.element.id + '_search_box-icon',
                        click: function () {
                            var iconElement = _this.pdfViewerBase.getElement('_search_box-icon').firstElementChild;
                            if (iconElement.classList.contains('e-pv-search-close')) {
                                _this.enableSearchItems(false);
                            }
                            _this.pdfViewer.textSearchModule.searchButtonClick(iconElement, _this.searchInput, true);
                            _this.setSearchInputWidth();
                        }
                    },
                    { template: searchCountTemplate },
                    {
                        prefixIcon: this.pdfViewer.enableRtl ? 'e-pv-next-search-icon e-pv-icon' : 'e-pv-prev-search-icon e-pv-icon', id: this.pdfViewer.element.id + '_prev_occurrence',
                        click: function (args) {
                            _this.pdfViewer.textSearchModule.searchPrevious();
                            _this.setSearchInputWidth();
                        }
                    },
                    {
                        prefixIcon: this.pdfViewer.enableRtl ? 'e-pv-prev-search-icon e-pv-icon' : 'e-pv-next-search-icon e-pv-icon', id: this.pdfViewer.element.id + '_next_occurrence',
                        click: function (args) {
                            _this.pdfViewer.textSearchModule.searchNext();
                            _this.setSearchInputWidth();
                        }
                    }
                ];
            }
            else {
                items = [
                    { prefixIcon: 'e-pv-backward-icon e-pv-icon', id: this.pdfViewer.element.id + '_backward', click: this.closeBookmarkPane.bind(this, null) },
                    { text: this.pdfViewer.localeObj.getConstant('Bookmarks') }
                ];
            }
            this.toolbar = new ej2_navigations_1.Toolbar({ items: items, width: '', height: '', overflowMode: 'Popup' });
            if (this.pdfViewer.enableRtl) {
                this.toolbar.enableRtl = true;
            }
            this.toolbar.isStringTemplate = true;
            this.toolbar.appendTo(this.toolbarElement);
            if (option === 'search') {
                var toolbarContainer = this.pdfViewerBase.getElement('_toolbarContainer');
                if (toolbarContainer) {
                    var toolbarHeight = toolbarContainer.clientHeight;
                    if (toolbarHeight === 0) {
                        toolbarHeight = parseFloat(window.getComputedStyle(toolbarContainer)['height']) + 1;
                    }
                    this.pdfViewerBase.toolbarHeight = toolbarHeight;
                }
                this.initiateSearchBox();
            }
            else {
                this.initiateBookmarks();
            }
        };
        NavigationPane.prototype.initiateSearchBox = function () {
            var _this = this;
            this.searchInput = this.pdfViewerBase.getElement('_search_input');
            this.pdfViewer.textSearchModule.searchBtn = this.pdfViewerBase.getElement('_search_box-icon').firstElementChild;
            this.searchInput.addEventListener('keyup', function (event) {
                _this.enableSearchItems(true);
                var searchString = _this.searchInput.value;
                var isEnter = event.key === 'Enter' || event.code === 'Enter';
                if (isEnter) {
                    _this.initiateTextSearch();
                    _this.setSearchInputWidth();
                }
                else {
                    _this.pdfViewer.textSearchModule.resetVariables();
                }
            });
            var searchElement = document.getElementById(this.pdfViewer.element.id + '_search_count');
            var parentContainer = searchElement.parentElement;
            if (parentContainer) {
                parentContainer.style.display = 'none';
            }
            this.pdfViewer.textSearchModule.searchInput = this.searchInput;
            this.setSearchInputWidth();
            this.enableSearchItems(false);
            this.searchInput.focus();
        };
        NavigationPane.prototype.enableSearchItems = function (isEnable) {
            if (!ej2_base_1.isBlazor()) {
                this.toolbar.enableItems(this.pdfViewerBase.getElement('_prev_occurrence').parentElement, isEnable);
                this.toolbar.enableItems(this.pdfViewerBase.getElement('_next_occurrence').parentElement, isEnable);
            }
            else {
                this.pdfViewer._dotnetInstance.invokeMethodAsync('EnableSearchItems', isEnable);
            }
        };
        NavigationPane.prototype.initiateBookmarks = function () {
            if (ej2_base_1.Browser.isDevice && !this.pdfViewer.enableDesktopMode) {
                this.pdfViewerBase.mobileScrollerContainer.style.display = 'none';
                var mobileTool = document.querySelectorAll('.e-pv-mobile-annotation-toolbar');
                for (var i = 0; i < mobileTool.length; i++) {
                    mobileTool[parseInt(i.toString(), 10)].style.display = 'none';
                }
            }
            var bookmarkContainer = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_bookmarks_container', className: 'e-pv-bookmark-container' });
            bookmarkContainer.style.width = '100%';
            bookmarkContainer.style.height = this.pdfViewerBase.viewerContainer.style.height;
            this.pdfViewerBase.getElement('_viewerMainContainer').appendChild(bookmarkContainer);
            this.pdfViewerBase.viewerContainer.style.display = 'none';
            this.isBookmarkListOpen = true;
            this.pdfViewer.bookmarkViewModule.renderBookmarkContentMobile();
        };
        NavigationPane.prototype.initiateTextSearch = function () {
            var inputString = this.searchInput.value;
            this.pdfViewer.textSearchModule.initiateSearch(inputString, true);
        };
        NavigationPane.prototype.goBackToToolbar = function (closeBookmarkView) {
            this.isNavigationToolbarVisible = false;
            if (ej2_base_1.isBlazor() && (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) || !ej2_base_1.isBlazor()) {
                if (this.pdfViewer.textSearchModule) {
                    this.pdfViewer.textSearchModule.cancelTextSearch();
                }
            }
            this.searchInput = null;
            if (this.pdfViewer.bookmarkViewModule.childNavigateCount !== 0 && !closeBookmarkView) {
                this.pdfViewer.bookmarkViewModule.bookmarkList.back();
                this.pdfViewer.bookmarkViewModule.childNavigateCount--;
            }
            else {
                if (closeBookmarkView) {
                    this.pdfViewer.bookmark.childNavigateCount = 0;
                }
                if (this.toolbar != null) {
                    this.toolbar.destroy();
                    this.toolbar = null;
                }
                var bookmarkContainer = this.pdfViewerBase.getElement('_bookmarks_container');
                if (bookmarkContainer) {
                    bookmarkContainer.parentElement.removeChild(bookmarkContainer);
                    if (ej2_base_1.Browser.isDevice && !this.pdfViewer.enableDesktopMode) {
                        this.pdfViewerBase.mobileScrollerContainer.style.display = '';
                    }
                }
                if (this.toolbarElement && this.toolbarElement.parentElement != null) {
                    this.toolbarElement.parentElement.removeChild(this.toolbarElement);
                }
                this.pdfViewerBase.viewerContainer.style.display = 'block';
                this.isBookmarkListOpen = false;
                this.isBookmarkOpenProgrammatically = false;
                this.isBookmarkOpen = false;
                if (!ej2_base_1.isBlazor()) {
                    if (!this.pdfViewer.toolbar.annotationToolbarModule.isMobileAnnotEnabled) {
                        this.pdfViewer.toolbarModule.showToolbar(true);
                    }
                }
                else {
                    this.pdfViewerBase.onWindowResize();
                }
                this.pdfViewer.isBookmarkPanelOpen = false;
            }
        };
        NavigationPane.prototype.setSearchInputWidth = function () {
            var searchInputParent = this.searchInput.parentElement;
            var padding = window.getComputedStyle(searchInputParent.parentElement, null).getPropertyValue('padding-left');
            if (ej2_base_1.isBlazor() && (ej2_base_1.Browser.isDevice && !this.pdfViewer.enableDesktopMode)) {
                this.toolbarElement = this.pdfViewerBase.getElement('_navigationToolbar');
            }
            var width = this.toolbarElement.clientWidth - this.getParentElementSearchBox('_backward').clientWidth
                - this.getParentElementSearchBox('_search_box-icon').clientWidth - this.getParentElementSearchBox('_prev_occurrence').clientWidth
                - this.getParentElementSearchBox('_next_occurrence').clientWidth - this.getParentElementSearchBox('_search_count').clientWidth - 6;
            if (padding !== '') {
                width = width - (parseFloat(padding) * 2);
            }
            searchInputParent.style.width = width + 'px';
        };
        NavigationPane.prototype.getParentElementSearchBox = function (idString) {
            return this.pdfViewerBase.getElement(idString).parentElement;
        };
        NavigationPane.prototype.createTooltipMobile = function (text) {
            if (!this.isTooltipCreated) {
                this.createMobileTooltip(text);
            }
            else {
                if (this.toastObject) {
                    this.toastObject.title = text;
                    var tooltipElement = this.pdfViewerBase.getElement('_container_tooltip');
                    var tooltipChild = tooltipElement.firstElementChild;
                    if (tooltipChild) {
                        tooltipChild.style.width = 'auto';
                        tooltipChild.firstElementChild.firstElementChild.textContent = text;
                    }
                    else {
                        this.isTooltipCreated = false;
                        var tooltipElement_1 = this.pdfViewerBase.getElement('_container_tooltip');
                        if (this.toastObject) {
                            this.toastObject.destroy();
                        }
                        tooltipElement_1.parentElement.removeChild(tooltipElement_1);
                        this.toastObject = null;
                        this.createMobileTooltip(text);
                    }
                }
            }
        };
        NavigationPane.prototype.createMobileTooltip = function (text) {
            var tooltipDiv = ej2_base_1.createElement('div', { className: 'e-pv-container-tooltip', id: this.pdfViewer.element.id + '_container_tooltip' });
            this.pdfViewer.element.appendChild(tooltipDiv);
            this.toastObject = new ej2_notifications_1.Toast({ title: text, target: this.pdfViewer.element, close: this.onTooltipClose.bind(this), position: { X: 0, Y: 0 }, animation: { hide: { duration: 200, effect: 'FadeOut' } } });
            this.toastObject.appendTo(tooltipDiv);
            var y = this.pdfViewer.element.clientHeight * 0.65;
            var x = (this.pdfViewer.element.clientWidth - tooltipDiv.clientWidth) / 2;
            this.isTooltipCreated = true;
            this.toastObject.show({ position: { X: x, Y: y } });
            var tooltipChild = tooltipDiv.firstElementChild;
            if (tooltipChild) {
                tooltipChild.style.width = 'auto';
            }
        };
        NavigationPane.prototype.onTooltipClose = function (args) {
            if (this.pdfViewer.textSearchModule) {
                this.isTooltipCreated = false;
                var tooltipElement = this.pdfViewerBase.getElement('_container_tooltip');
                this.pdfViewer.textSearchModule.isMessagePopupOpened = false;
                if (this.toastObject) {
                    this.toastObject.destroy();
                }
                tooltipElement.parentElement.removeChild(tooltipElement);
                this.toastObject = null;
            }
        };
        NavigationPane.prototype.toolbarResize = function () {
            if (this.searchInput) {
                this.searchInput.style.width = 'auto';
                this.setSearchInputWidth();
            }
        };
        NavigationPane.prototype.createSidebarToolBar = function () {
            if (!ej2_base_1.isBlazor()) {
                var isMac_1 = /ipad|iphone|ipod|mac/.test(navigator.userAgent.toLowerCase()) ? true : false;
                this.thumbnailButton = ej2_base_1.createElement('button', { id: this.pdfViewer.element.id + '_thumbnail-view', attrs: { 'disabled': 'disabled', 'aria-label': 'Page Thumbnails', 'tabindex': '-1' } });
                this.thumbnailButton.className = 'e-pv-tbar-btn e-pv-thumbnail-view-button e-btn';
                this.thumbnailButton.setAttribute('type', 'button');
                var thumbnailButtonSpan = ej2_base_1.createElement('span', { id: this.pdfViewer.element.id + '_thumbnail-view' + '_icon', className: 'e-pv-thumbnail-view-disable-icon e-pv-icon' });
                this.thumbnailButton.appendChild(thumbnailButtonSpan);
                var thumbnailTooltip = new ej2_popups_1.Tooltip({ content: ej2_base_1.initializeCSPTemplate(function () { return this.pdfViewer.localeObj.getConstant('Page Thumbnails') + (isMac_1 ? ' (⌘+⌥+1)' : ' (Ctrl+Alt+1)'); }, this), opensOn: 'Hover', beforeOpen: this.onTooltipBeforeOpen.bind(this) });
                thumbnailTooltip.appendTo(this.thumbnailButton);
                this.bookmarkButton = ej2_base_1.createElement('button', { id: this.pdfViewer.element.id + '_bookmark', attrs: { 'disabled': 'disabled', 'aria-label': 'Bookmarks', 'tabindex': '-1' } });
                this.bookmarkButton.setAttribute('type', 'button');
                this.bookmarkButton.className = 'e-pv-tbar-btn e-pv-bookmark-button e-btn';
                var buttonSpan = ej2_base_1.createElement('span', { id: this.pdfViewer.element.id + '_bookmark' + '_icon', className: 'e-pv-bookmark-disable-icon e-pv-icon' });
                this.bookmarkButton.appendChild(buttonSpan);
                var bookMarkTooltip = new ej2_popups_1.Tooltip({ content: ej2_base_1.initializeCSPTemplate(function () { return this.pdfViewer.localeObj.getConstant('Bookmarks') + (isMac_1 ? ' (⌘+⌥+2)' : ' (Ctrl+Alt+2)'); }, this), opensOn: 'Hover', beforeOpen: this.onTooltipBeforeOpen.bind(this) });
                bookMarkTooltip.appendTo(this.bookmarkButton);
                this.sideBarToolbar.appendChild(this.thumbnailButton);
                this.sideBarToolbar.appendChild(this.bookmarkButton);
                this.addOrganizePageButton(this.pdfViewer.enablePageOrganizer);
            }
            else {
                this.thumbnailButton = this.pdfViewer.element.querySelector('.e-pv-thumbnail-view-button');
                this.bookmarkButton = this.pdfViewer.element.querySelector('.e-pv-bookmark-button');
            }
            this.thumbnailButton.addEventListener('click', this.sideToolbarOnClick);
            this.bookmarkButton.addEventListener('click', this.bookmarkButtonOnClick);
            if (this.organizePageButton) {
                this.organizePageButton.addEventListener('click', this.organizeButtonOnClick);
            }
        };
        NavigationPane.prototype.addOrganizePageButton = function (enablePageOrganizer) {
            if (!ej2_base_1.isNullOrUndefined(this.organizePageButton)) {
                this.organizePageButton.remove();
            }
            if (enablePageOrganizer) {
                var isMac_2 = /ipad|iphone|ipod|mac/.test(navigator.userAgent.toLowerCase()) ? true : false;
                this.organizePageButton = ej2_base_1.createElement('button', { id: this.pdfViewer.element.id + '_organize-view', attrs: { 'disabled': 'disabled', 'aria-label': 'Organize Pages', 'tabindex': '-1' } });
                this.organizePageButton.className = 'e-pv-tbar-btn e-pv-organize-view-button e-btn';
                this.organizePageButton.setAttribute('type', 'button');
                var organizeButtonSpan = ej2_base_1.createElement('span', { id: this.pdfViewer.element.id + '_organize-view' + '_icon', className: 'e-pv-organize-view-disable-icon e-pv-icon' });
                this.organizePageButton.appendChild(organizeButtonSpan);
                var organizeButtonTooltip = new ej2_popups_1.Tooltip({
                    content: ej2_base_1.initializeCSPTemplate(function () { return this.pdfViewer.localeObj.getConstant('Organize Pages') + (isMac_2 ? ' (⌘+⌥+3)' : ' (Ctrl+Alt+3)'); }, this), opensOn: 'Hover', beforeOpen: this.onTooltipBeforeOpen.bind(this)
                });
                organizeButtonTooltip.appendTo(this.organizePageButton);
                this.sideBarToolbar.appendChild(this.organizePageButton);
                this.organizePageButton.addEventListener('click', this.organizeButtonOnClick);
            }
            else {
                this.organizePageButton = null;
            }
        };
        NavigationPane.prototype.onTooltipBeforeOpen = function (args) {
            if (!this.pdfViewer.toolbarSettings.showTooltip || args.target.disabled) {
                args.cancel = true;
            }
        };
        NavigationPane.prototype.enableOrganizeButton = function (isEnable) {
            if (this.organizePageButton) {
                if (isEnable) {
                    this.organizePageButton.removeAttribute('disabled');
                    this.organizePageButton.children[0].classList.remove('e-pv-organize-view-disable-icon');
                    this.organizePageButton.children[0].classList.add('e-pv-organize-view-icon');
                    this.organizePageButton.setAttribute('tabindex', '0');
                }
                else {
                    this.organizePageButton.setAttribute('disabled', 'disabled');
                    this.organizePageButton.children[0].classList.remove('e-pv-organize-view-icon');
                    this.organizePageButton.children[0].classList.add('e-pv-organize-view-disable-icon');
                    this.organizePageButton.setAttribute('tabindex', '-1');
                }
            }
        };
        NavigationPane.prototype.enableThumbnailButton = function () {
            if (this.thumbnailButton) {
                this.thumbnailButton.removeAttribute('disabled');
                this.thumbnailButton.children[0].classList.remove('e-pv-thumbnail-view-disable-icon');
                this.thumbnailButton.children[0].classList.add('e-pv-thumbnail-view-icon');
                this.thumbnailButton.setAttribute('tabindex', '0');
            }
        };
        NavigationPane.prototype.enableBookmarkButton = function () {
            if (this.bookmarkButton) {
                this.bookmarkButton.removeAttribute('disabled');
                this.bookmarkButton.children[0].classList.remove('e-pv-bookmark-disable-icon');
                this.bookmarkButton.children[0].classList.add('e-pv-bookmark-icon');
                this.bookmarkButton.setAttribute('tabindex', '0');
            }
        };
        NavigationPane.prototype.createSidebarTitleCloseButton = function () {
            this.closeDiv = ej2_base_1.createElement('button', { id: this.pdfViewer.element.id + '_close_btn' });
            this.closeDiv.setAttribute('aria-label', 'close button');
            this.closeDiv.setAttribute('type', 'button');
            this.closeDiv.className = 'e-btn e-pv-tbar-btn e-pv-title-close-div e-btn';
            if (this.pdfViewer.enableRtl) {
                this.closeDiv.style.left = 8 + 'px';
            }
            else {
                this.closeDiv.style.left = this.closeButtonLeft + 'px';
            }
            var buttonSpan = ej2_base_1.createElement('span', { id: this.pdfViewer.element.id + '_close' + '_icon', className: 'e-pv-title-close-icon e-pv-icon' });
            this.closeDiv.appendChild(buttonSpan);
            this.sideBarTitleContainer.appendChild(this.closeDiv);
            this.closeDiv.addEventListener('click', this.sideToolbarOnClose);
        };
        NavigationPane.prototype.createResizeIcon = function () {
            this.resizeIcon = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_resize', className: 'e-pv-resize-icon e-pv-icon' });
            this.setResizeIconTop();
            this.resizeIcon.style.position = 'absolute';
            this.resizeIcon.addEventListener('click', this.sideToolbarOnClose);
            this.resizeIcon.addEventListener('mouseover', this.resizeIconMouseOver);
            this.sideBarResizer.appendChild(this.resizeIcon);
        };
        NavigationPane.prototype.setResizeIconTop = function () {
            if (this.sideBarToolbar && this.sideBarToolbar.clientHeight && this.resizeIcon.style.top === '') {
                this.resizeIcon.style.top = (this.sideBarToolbar.clientHeight) / 2 + 'px';
            }
        };
        NavigationPane.prototype.setCommentPanelResizeIconTop = function () {
            if (this.commentPanelContainer && this.commentPanelContainer.clientHeight && this.commentPanelResizeIcon && this.commentPanelResizeIcon.style.top === '') {
                this.commentPanelResizeIcon.style.top = (this.commentPanelContainer.clientHeight) / 2 + 'px';
            }
        };
        Object.defineProperty(NavigationPane.prototype, "outerContainerWidth", {
            get: function () {
                if (!this.mainContainerWidth) {
                    this.mainContainerWidth = this.pdfViewerBase.mainContainer.clientWidth;
                }
                return this.mainContainerWidth;
            },
            enumerable: true,
            configurable: true
        });
        NavigationPane.prototype.getViewerContainerScrollbarWidth = function () {
            return (this.pdfViewerBase.viewerContainer.offsetWidth + this.pdfViewerBase.viewerContainer.offsetLeft) -
                (this.pdfViewerBase.viewerContainer.clientWidth + this.pdfViewerBase.viewerContainer.offsetLeft);
        };
        Object.defineProperty(NavigationPane.prototype, "sideToolbarWidth", {
            get: function () {
                if (this.sideBarToolbar) {
                    return this.sideBarToolbar.clientWidth;
                }
                else {
                    return 0;
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NavigationPane.prototype, "sideBarContentContainerWidth", {
            get: function () {
                if (this.sideBarContentContainer) {
                    return this.sideBarContentContainer.clientWidth;
                }
                else {
                    return 0;
                }
            },
            enumerable: true,
            configurable: true
        });
        Object.defineProperty(NavigationPane.prototype, "commentPanelContainerWidth", {
            get: function () {
                if (this.commentPanelContainer) {
                    return this.commentPanelContainer.offsetWidth;
                }
                else {
                    return 0;
                }
            },
            enumerable: true,
            configurable: true
        });
        NavigationPane.prototype.updateViewerContainerOnClose = function () {
            var proxy = null;
            proxy = this;
            if (proxy.sideBarContentContainer) {
                proxy.sideBarContentContainer.style.display = 'none';
                if (this.pdfViewer.enableRtl) {
                    proxy.pdfViewerBase.viewerContainer.style.right = (proxy.sideToolbarWidth) + 'px';
                }
                else {
                    proxy.pdfViewerBase.viewerContainer.style.left = (proxy.sideToolbarWidth) + 'px';
                }
                proxy.pdfViewerBase.viewerContainer.style.width = ((proxy.pdfViewer.element.clientWidth > 0 ? proxy.pdfViewer.element.clientWidth : proxy.pdfViewer.element.offsetWidth) - proxy.sideToolbarWidth - proxy.getViewerContainerRight()) + 'px';
                proxy.pdfViewerBase.pageContainer.style.width = (proxy.pdfViewerBase.viewerContainer.offsetWidth - proxy.getViewerContainerScrollbarWidth()) + 'px';
                if (this.restrictUpdateZoomValue) {
                    proxy.pdfViewerBase.updateZoomValue();
                }
            }
        };
        NavigationPane.prototype.updateViewerContainerOnExpand = function () {
            var proxy = null;
            proxy = this;
            if (proxy.sideBarContentContainer) {
                if (!ej2_base_1.isNullOrUndefined(this.pdfViewer.thumbnailViewModule) && !this.pdfViewer.thumbnailViewModule.isThubmnailOpen) {
                    proxy.sideBarContentContainer.style.display = 'block';
                }
                if (proxy.pdfViewer.isBookmarkPanelOpen || this.isBookmarkOpen) {
                    proxy.sideBarContentContainer.style.display = 'block';
                }
                if (this.pdfViewer.enableRtl) {
                    proxy.pdfViewerBase.viewerContainer.style.right = proxy.getViewerContainerLeft() + 'px';
                }
                else {
                    proxy.pdfViewerBase.viewerContainer.style.left = proxy.getViewerContainerLeft() + 'px';
                }
                proxy.pdfViewerBase.viewerContainer.style.width = ((proxy.pdfViewer.element.clientWidth > 0 ? proxy.pdfViewer.element.clientWidth : proxy.pdfViewer.element.offsetWidth) - this.getViewerContainerLeft() - this.getViewerContainerRight()) + 'px';
                proxy.pdfViewerBase.pageContainer.style.width = proxy.pdfViewerBase.viewerContainer.clientWidth + 'px';
                proxy.pdfViewerBase.updateZoomValue();
                if (proxy.pdfViewer.enableThumbnail) {
                    proxy.pdfViewer.thumbnailViewModule.gotoThumbnailImage(proxy.pdfViewerBase.currentPageNumber - 1);
                    proxy.pdfViewer.thumbnailViewModule.renderViewPortThumbnailImage();
                }
            }
        };
        NavigationPane.prototype.getViewerContainerLeft = function () {
            if (this.sideToolbarWidth) {
                return (this.sideToolbarWidth + this.sideBarContentContainerWidth);
            }
            else if (this.sideToolbarWidth === 0 && !this.pdfViewer.enableNavigationToolbar) {
                return (this.sideBarContentContainerWidth);
            }
            else {
                return 0;
            }
        };
        NavigationPane.prototype.getViewerContainerRight = function () {
            if (this.commentPanelResizer) {
                return (this.commentPanelContainerWidth + this.commentPanelResizer.clientWidth);
            }
            else if (this.sideToolbarWidth === 0 && !this.pdfViewer.enableNavigationToolbar) {
                return (this.sideBarContentContainerWidth);
            }
            else {
                return 0;
            }
        };
        NavigationPane.prototype.getViewerMainContainerWidth = function () {
            return (this.pdfViewer.element.clientWidth > 0 ? this.pdfViewer.element.clientWidth : this.pdfViewer.element.offsetWidth) -
                this.sideToolbarWidth;
        };
        NavigationPane.prototype.setThumbnailSelectionIconTheme = function () {
            if (this.thumbnailButton) {
                this.thumbnailButton.children[0].classList.remove('e-pv-thumbnail-view-icon');
                this.thumbnailButton.children[0].classList.add('e-pv-thumbnail-view-selection-icon');
                this.thumbnailButton.classList.add('e-pv-thumbnail-view-button-selection');
            }
        };
        NavigationPane.prototype.removeThumbnailSelectionIconTheme = function () {
            Iif (this.thumbnailButton && this.thumbnailButton.children[0]) {
                this.thumbnailButton.children[0].classList.add('e-pv-thumbnail-view-icon');
                this.thumbnailButton.children[0].classList.remove('e-pv-thumbnail-view-selection-icon');
                this.thumbnailButton.classList.remove('e-pv-thumbnail-view-button-selection');
            }
        };
        NavigationPane.prototype.resetThumbnailIcon = function () {
            if (this.thumbnailButton && this.thumbnailButton.children[0]) {
                this.thumbnailButton.children[0].classList.remove('e-pv-thumbnail-view-icon');
                this.thumbnailButton.children[0].classList.add('e-pv-thumbnail-view-disable-icon');
            }
        };
        NavigationPane.prototype.resetThumbnailView = function () {
            if (this.sideBarContentContainer) {
                this.sideBarContentContainer.style.display = 'none';
                if (this.pdfViewer.enableRtl) {
                    this.pdfViewerBase.viewerContainer.style.left = 1 + 'px';
                }
                else {
                    this.pdfViewerBase.viewerContainer.style.left = (this.sideToolbarWidth) + 'px';
                }
                this.pdfViewerBase.viewerContainer.style.width = ((this.pdfViewer.element.clientWidth > 0 ? this.pdfViewer.element.clientWidth : this.pdfViewer.element.offsetWidth) - this.sideToolbarWidth - this.getViewerContainerRight()) + 'px';
                if (this.pdfViewerBase.pageContainer) {
                    this.pdfViewerBase.pageContainer.style.width = this.pdfViewerBase.viewerContainer.clientWidth + 'px';
                }
                this.thumbnailButton.setAttribute('disabled', 'disabled');
                this.removeThumbnailSelectionIconTheme();
                this.resetThumbnailIcon();
            }
        };
        NavigationPane.prototype.setBookmarkSelectionIconTheme = function () {
            if (this.bookmarkButton) {
                this.bookmarkButton.children[0].classList.remove('e-pv-bookmark-icon');
                this.bookmarkButton.children[0].classList.add('e-pv-bookmark-selection-icon');
                this.bookmarkButton.classList.add('e-pv-bookmark-button-selection');
            }
        };
        NavigationPane.prototype.removeBookmarkSelectionIconTheme = function () {
            Iif (this.bookmarkButton && this.bookmarkButton.children[0]) {
                this.bookmarkButton.children[0].classList.add('e-pv-bookmark-icon');
                this.bookmarkButton.children[0].classList.remove('e-pv-bookmark-selection-icon');
                this.bookmarkButton.classList.remove('e-pv-bookmark-button-selection');
            }
        };
        NavigationPane.prototype.sideToolbarOnMouseup = function (event) {
            if (event.target === this.sideBarToolbar) {
                this.pdfViewerBase.focusViewerContainer();
            }
        };
        NavigationPane.prototype.sideBarTitleOnMouseup = function (event) {
            if (event.target === this.sideBarToolbar) {
                this.pdfViewerBase.focusViewerContainer();
            }
        };
        NavigationPane.prototype.openBookmarkcontentInitially = function (isSideToolbarOnClick) {
            var proxy = this;
            if (!(proxy.pdfViewer.bookmark && proxy.pdfViewer.bookmark.bookmarks)) {
                return;
            }
            if (!isSideToolbarOnClick && this.isBookmarkOpen) {
                return;
            }
            if (document.getElementById(proxy.pdfViewer.element.id + '_thumbnail_view')) {
                document.getElementById(proxy.pdfViewer.element.id + '_thumbnail_view').style.display = 'none';
            }
            proxy.removeThumbnailSelectionIconTheme();
            proxy.sideBarTitle.textContent = proxy.pdfViewer.localeObj.getConstant('Bookmarks');
            proxy.sideBarContent.setAttribute('aria-label', 'Bookmark View Panel');
            proxy.sideBarContent.setAttribute('role', 'navigation');
            proxy.pdfViewer.bookmarkViewModule.renderBookmarkcontent();
            if (proxy.sideBarContentContainer && (isSideToolbarOnClick || !proxy.isBookmarkOpenProgrammatically)) {
                if (proxy.sideBarContentContainer.style.display !== 'none') {
                    if (proxy.isThumbnailOpen) {
                        proxy.pdfViewer.isThumbnailViewOpen = false;
                        proxy.setBookmarkSelectionIconTheme();
                        proxy.isBookmarkOpen = true;
                        proxy.updateViewerContainerOnExpand();
                        proxy.isThumbnail = false;
                        proxy.isThumbnailAddedProgrammatically = false;
                        proxy.isBookmarkOpenProgrammatically = true;
                        proxy.pdfViewer.isBookmarkPanelOpen = true;
                    }
                    else {
                        proxy.removeBookmarkSelectionIconTheme();
                        proxy.isBookmarkOpen = false;
                        proxy.updateViewerContainerOnClose();
                        proxy.isBookmarkOpenProgrammatically = false;
                        proxy.pdfViewer.isBookmarkPanelOpen = false;
                    }
                }
                else {
                    proxy.sideBarContent.focus();
                    proxy.setBookmarkSelectionIconTheme();
                    proxy.isBookmarkOpen = true;
                    proxy.updateViewerContainerOnExpand();
                    proxy.isBookmarkOpenProgrammatically = true;
                    proxy.pdfViewer.isThumbnailViewOpen = false;
                    proxy.pdfViewer.isBookmarkPanelOpen = true;
                }
            }
            proxy.isThumbnailOpen = false;
            if (proxy.pdfViewer.annotationModule && proxy.pdfViewer.annotationModule.inkAnnotationModule) {
                var currentPageNumber = parseInt(proxy.pdfViewer.annotationModule.inkAnnotationModule.currentPageNumber, 10);
                proxy.pdfViewer.annotationModule.inkAnnotationModule.drawInkAnnotation(currentPageNumber);
            }
            if (proxy.isBookmarkOpen) {
                document.getElementById(proxy.pdfViewer.element.id + '_bookmark_view').focus();
            }
        };
        NavigationPane.prototype.disableBookmarkButton = function () {
            if (this.sideBarContentContainer && this.bookmarkButton && this.bookmarkButton.children[0]) {
                var bookmarkContent = this.pdfViewer.element.querySelector('.e-pv-bookmark-view');
                if (bookmarkContent) {
                    bookmarkContent.style.display = 'none';
                }
                this.bookmarkButton.setAttribute('disabled', 'disabled');
                this.bookmarkButton.children[0].classList.add('e-pv-bookmark-disable-icon');
            }
        };
        NavigationPane.prototype.calculateCommentPanelWidth = function () {
            var commentTitleCollections = document.getElementsByClassName('e-pv-comment-title');
            var commentTitleMoreIconCollections = document.getElementsByClassName('e-pv-more-options-button e-btn');
            for (var i = 0; i < commentTitleCollections.length; i++) {
                var commentTitleElement = commentTitleCollections[parseInt(i.toString(), 10)];
                var moreIconElement = commentTitleMoreIconCollections[parseInt(i.toString(), 10)];
                if (commentTitleElement.parentElement.clientWidth > 0 && moreIconElement.clientWidth > 0) {
                    commentTitleElement.style.maxWidth = (commentTitleElement.parentElement.clientWidth - moreIconElement.clientWidth) + 'px';
                }
            }
            var replyTitleCollections = document.getElementsByClassName('e-pv-reply-title');
            var replyTitleMoreIconCollections = document.getElementsByClassName('e-pv-more-options-button e-btn');
            for (var j = 0; j < replyTitleCollections.length; j++) {
                var replyTitleElement = replyTitleCollections[parseInt(j.toString(), 10)];
                var elementOfMoreIcon = replyTitleMoreIconCollections[parseInt(j.toString(), 10)];
                replyTitleElement.style.maxWidth = (replyTitleElement.parentElement.clientWidth - elementOfMoreIcon.clientWidth) + 'px';
            }
        };
        NavigationPane.prototype.clear = function () {
            Eif (!ej2_base_1.Browser.isDevice) {
                this.removeBookmarkSelectionIconTheme();
                this.removeThumbnailSelectionIconTheme();
                this.closeCommentPanelContainer();
            }
            Iif (this.commentsContentContainer) {
                this.commentsContentContainer.innerHTML = '';
            }
        };
        NavigationPane.prototype.destroy = function () {
            var _this = this;
            Iif (this.sideBarResizer) {
                this.sideBarResizer.removeEventListener('mousedown', this.resizePanelMouseDown);
            }
            Eif (this.pdfViewerBase.mainContainer) {
                this.pdfViewerBase.mainContainer.removeEventListener('mousemove', this.resizePanelMouseMove);
                this.pdfViewerBase.mainContainer.removeEventListener('mouseup', this.resizeViewerMouseLeave);
            }
            Iif (this.sideBarToolbar) {
                this.sideBarToolbar.removeEventListener('mouseup', this.sideToolbarOnMouseup.bind(this));
            }
            Iif (this.sideBarContentContainer) {
                this.sideBarContentContainer.removeEventListener('mouseup', this.sideBarTitleOnMouseup.bind(this));
            }
            Iif (this.commentPanelResizer) {
                this.commentPanelResizer.removeEventListener('mousedown', this.commentPanelMouseDown);
            }
            Iif (this.annotationInputElement) {
                this.annotationInputElement.removeEventListener('change', this.loadImportAnnotation);
            }
            Iif (this.annotationXFdfInputElement) {
                this.annotationXFdfInputElement.removeEventListener('change', this.loadImportAnnotation);
            }
            Iif (this.searchInput) {
                this.searchInput.removeEventListener('keyup', function (event) {
                    _this.enableSearchItems(true);
                    var searchString = _this.searchInput.value;
                    var isEnter = event.key === 'Enter' || event.code === 'Enter';
                    if (isEnter) {
                        _this.initiateTextSearch();
                        _this.setSearchInputWidth();
                    }
                    else {
                        _this.pdfViewer.textSearchModule.resetVariables();
                    }
                });
            }
            Iif (this.resizeIcon) {
                this.resizeIcon.removeEventListener('click', this.sideToolbarOnClose);
                this.resizeIcon.removeEventListener('mouseover', this.resizeIconMouseOver);
            }
            Iif (this.closeDiv) {
                this.closeDiv.removeEventListener('click', this.sideToolbarOnClose);
            }
            var bookmarkButtonInstance = this.bookmarkButton;
            var thumbnailButtonInstance = this.thumbnailButton;
            var organizeButtonInstance = this.organizePageButton;
            Iif (bookmarkButtonInstance && bookmarkButtonInstance.ej2_instances && bookmarkButtonInstance.ej2_instances.length > 0) {
                bookmarkButtonInstance.removeEventListener('click', this.bookmarkButtonOnClick);
                bookmarkButtonInstance.ej2_instances[0].destroy();
                bookmarkButtonInstance = null;
            }
            Iif (thumbnailButtonInstance && thumbnailButtonInstance.ej2_instances && thumbnailButtonInstance.ej2_instances.length > 0) {
                thumbnailButtonInstance.removeEventListener('click', this.sideToolbarOnClick);
                thumbnailButtonInstance.ej2_instances[0].destroy();
                thumbnailButtonInstance = null;
            }
            Iif (organizeButtonInstance && organizeButtonInstance.ej2_instances && organizeButtonInstance.ej2_instances.length > 0) {
                organizeButtonInstance.removeEventListener('click', this.organizeButtonOnClick);
                organizeButtonInstance.ej2_instances[0].destroy();
                organizeButtonInstance = null;
            }
            Iif (this.annotationMenuObj) {
                var annotationMenuElement = this.annotationMenuObj.element;
                if (annotationMenuElement && annotationMenuElement.ej2_instances && annotationMenuElement.ej2_instances.length > 0) {
                    this.annotationMenuObj.destroy();
                    this.annotationMenuObj = null;
                }
            }
            this.sideBarResizer = null;
            this.sideBarContentSplitter = null;
            this.sideBarTitleContainer = null;
            this.thumbnailWidthMin = null;
            this.mainContainerWidth = null;
            this.closeDiv = null;
            this.resizeIcon = null;
            this.isDown = null;
            this.offset = null;
            this.contentContainerScrollWidth = null;
            this.closeButtonLeft = null;
            this.previousX = null;
            this.toolbarElement = null;
            this.toolbar = null;
            this.searchInput = null;
            this.toastObject = null;
            this.isTooltipCreated = null;
            this.annotationInputElement = null;
            this.annotationXFdfInputElement = null;
            this.annotationContextMenu = null;
            this.isCommentPanelShow = null;
            this.commentPanelWidthMin = null;
            this.commentPanelResizeIcon = null;
            this.isThumbnail = null;
            this.isThumbnailAddedProgrammatically = null;
            this.isBookmarkOpenProgrammatically = null;
            this.sideBarTitle = null;
            this.isNavigationToolbarVisible = null;
            this.isBookmarkListOpen = null;
            this.isNavigationPaneResized = null;
            this.sideBarToolbar = null;
            this.sideBarContent = null;
            this.sideBarContentContainer = null;
            this.sideBarToolbarSplitter = null;
            this.isBookmarkOpen = null;
            this.isThumbnailOpen = null;
            this.commentPanelContainer = null;
            this.commentsContentContainer = null;
            this.accordionContentContainer = null;
            this.commentPanelResizer = null;
            this.restrictUpdateZoomValue = null;
        };
        NavigationPane.prototype.getModuleName = function () {
            return 'NavigationPane';
        };
        return NavigationPane;
    }());
    exports.NavigationPane = NavigationPane;
});