all files / pdfviewer/toolbar/ toolbar.js

7.11% Statements 115/1618
0% Branches 0/1364
1.45% Functions 2/138
7.13% Lines 115/1612
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 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 25631×   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×             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", "@syncfusion/ej2-base", "@syncfusion/ej2-navigations", "@syncfusion/ej2-inputs", "@syncfusion/ej2-dropdowns", "../index", "@syncfusion/ej2-popups", "@syncfusion/ej2-splitbuttons", "../base/types", "./formdesigner-toolbar", "./redaction-toolbar"], function (require, exports, ej2_base_1, ej2_navigations_1, ej2_inputs_1, ej2_dropdowns_1, index_1, ej2_popups_1, ej2_splitbuttons_1, types_1, formdesigner_toolbar_1, redaction_toolbar_1) {
    "use strict";
    Object.defineProperty(exports, "__esModule", { value: true });
    var Toolbar = (function () {
        function Toolbar(viewer, viewerBase) {
            var _this = this;
            this.isPageNavigationToolDisabled = false;
            this.isMagnificationToolDisabled = false;
            this.isSelectionToolDisabled = false;
            this.isScrollingToolDisabled = false;
            this.isOpenBtnVisible = true;
            this.isNavigationToolVisible = true;
            this.isMagnificationToolVisible = true;
            this.isSelectionBtnVisible = true;
            this.isScrollingBtnVisible = true;
            this.isDownloadBtnVisible = true;
            this.isPrintBtnVisible = true;
            this.isSearchBtnVisible = true;
            this.isTextSearchBoxDisplayed = false;
            this.updateZoomDropDown = false;
            this.isUndoRedoBtnsVisible = true;
            this.isAnnotationEditBtnVisible = true;
            this.isRedactionEditBtnVisible = true;
            this.isFormDesignerEditBtnVisible = true;
            this.isCommentBtnVisible = true;
            this.isSubmitbtnvisible = true;
            this.toolItems = [];
            this.itemsIndexArray = [];
            this.onToolbarKeydown = function (event) {
                var isSkip = event.key === 'Tab' || event.shiftKey === true || event.key === 'Enter' || event.key === ' ' || event.key === 'ArrowUp' || event.key === 'ArrowDown' || event.key === 'ArrowLeft' || event.key === 'ArrowRight';
                var targetId = event.target.id;
                var customItem = _this.toolItems.filter(function (toolItem) { return toolItem.id === targetId; });
                if (!(targetId === _this.pdfViewer.element.id + '_currentPageInput' || targetId === _this.pdfViewer.element.id + '_zoomDropDown' || customItem.length > 0) && !isSkip) {
                    event.preventDefault();
                    event.stopPropagation();
                }
            };
            this.toolbarClickHandler = function (args) {
                var isKeyBoardEvent = args.originalEvent && args.originalEvent.pointerType !== 'mouse' && args.originalEvent.pointerType !== 'touch';
                if (!ej2_base_1.Browser.isDevice || _this.pdfViewer.enableDesktopMode) {
                    if (args.originalEvent.target === _this.zoomDropdownItem.parentElement.childNodes[1] ||
                        args.originalEvent.target === _this.zoomDropdownItem.parentElement.childNodes[2]) {
                        args.cancel = true;
                    }
                    else if (args.originalEvent.target.id === _this.pdfViewer.element.id + '_openIcon') {
                        var tooltipData = args.originalEvent.target.parentElement.dataset;
                        if (tooltipData && tooltipData.tooltipId) {
                            var tooltipElement = document.getElementById(tooltipData.tooltipId);
                            if (tooltipElement) {
                                tooltipElement.style.display = 'none';
                            }
                        }
                    }
                }
                _this.handleToolbarBtnClick(args, isKeyBoardEvent);
                var targetElement = args.originalEvent.target;
                var customItem = [];
                if (!ej2_base_1.isNullOrUndefined(args.item)) {
                    customItem = _this.toolItems.filter(function (toolItem) { return toolItem.id === args.item.id; });
                }
                if (!ej2_base_1.Browser.isDevice || _this.pdfViewer.enableDesktopMode) {
                    if (!(args.originalEvent.target === _this.zoomDropdownItem.parentElement.childNodes[1] ||
                        args.originalEvent.target === _this.zoomDropdownItem.parentElement.childNodes[2] ||
                        args.originalEvent.target === _this.currentPageBoxElement ||
                        args.originalEvent.target === _this.textSearchItem.childNodes[0] || customItem.length > 0)) {
                        if (!isKeyBoardEvent && targetElement.parentElement.id !== _this.pdfViewer.element.id + '_toolbarContainer_nav' && targetElement.id !== _this.pdfViewer.element.id + '_toolbarContainer_nav') {
                            args.originalEvent.target.blur();
                            _this.pdfViewerBase.focusViewerContainer();
                        }
                    }
                }
                else {
                    args.originalEvent.target.blur();
                    _this.pdfViewerBase.focusViewerContainer();
                }
            };
            this.loadDocument = function (args) {
                var upoadedFiles = args.target.files;
                if (args.target.files[0] !== null) {
                    var uploadedFile = upoadedFiles[0];
                    if (uploadedFile) {
                        _this.uploadedDocumentName = uploadedFile.name;
                        var reader = new FileReader();
                        if (_this.pdfViewerBase.clientSideRendering) {
                            reader.readAsArrayBuffer(uploadedFile);
                        }
                        else {
                            reader.readAsDataURL(uploadedFile);
                        }
                        reader.onload = function (e) {
                            args.target.value = null;
                            var uploadedFileUrl = e.currentTarget.result;
                            _this.pdfViewer.uploadedFileByteArray = new Uint8Array(uploadedFileUrl);
                            if (ej2_base_1.isBlazor()) {
                                _this.pdfViewer._dotnetInstance.invokeMethodAsync('LoadDocumentFromClient', uploadedFileUrl);
                            }
                            else {
                                if (_this.pdfViewerBase.clientSideRendering) {
                                    _this.uploadedFile = _this.pdfViewer.uploadedFileByteArray;
                                    _this.pdfViewerBase.skipOnReload = true;
                                    _this.pdfViewer.load(_this.pdfViewer.uploadedFileByteArray, null);
                                    _this.pdfViewerBase.isSkipDocumentPath = true;
                                    _this.pdfViewer.documentPath = _this.pdfViewer.uploadedFileByteArray;
                                    _this.pdfViewerBase.documentPathByteArray = _this.pdfViewer.documentPath;
                                    _this.pdfViewerBase.skipOnReload = false;
                                }
                                else {
                                    _this.uploadedFile = uploadedFileUrl;
                                    _this.pdfViewer.load(uploadedFileUrl, null);
                                    _this.pdfViewerBase.isSkipDocumentPath = true;
                                    _this.pdfViewer.documentPath = uploadedFileUrl;
                                    _this.pdfViewerBase.documentPathByteArray = _this.pdfViewer.documentPath;
                                }
                            }
                            if (!ej2_base_1.isNullOrUndefined(_this.fileInputElement)) {
                                _this.fileInputElement.value = '';
                            }
                        };
                    }
                }
            };
            this.navigateToPage = function (args) {
                if (args.key === 'Enter' || args.code === 'Enter') {
                    var enteredValue = parseInt(_this.currentPageBoxElement.value, 10);
                    if (enteredValue !== null) {
                        if (enteredValue > 0 && enteredValue <= _this.pdfViewerBase.pageCount) {
                            if (_this.pdfViewer.navigationModule) {
                                _this.pdfViewer.navigationModule.goToPage(enteredValue);
                            }
                        }
                        else {
                            _this.updateCurrentPage(_this.pdfViewerBase.currentPageNumber);
                        }
                    }
                    else {
                        _this.updateCurrentPage(_this.pdfViewerBase.currentPageNumber);
                    }
                    _this.currentPageBoxElement.blur();
                    _this.pdfViewerBase.focusViewerContainer();
                }
            };
            this.textBoxFocusOut = function () {
                if (_this.currentPageBox.value === null || _this.currentPageBox.value >= _this.pdfViewerBase.pageCount ||
                    _this.currentPageBox.value !== _this.pdfViewerBase.currentPageNumber) {
                    _this.updateCurrentPage(_this.pdfViewerBase.currentPageNumber);
                }
            };
            this.pdfViewer = viewer;
            this.pdfViewerBase = viewerBase;
        }
        Toolbar.prototype.intializeToolbar = function (width) {
            var toolbarDiv;
            if (!ej2_base_1.isBlazor()) {
                toolbarDiv = this.createToolbar(width);
            }
            else {
                if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                    toolbarDiv = this.pdfViewer.element.querySelector('.e-pv-toolbar');
                    this.toolbarElement = toolbarDiv;
                }
            }
            var isIE = !!document.documentMode;
            if (isIE) {
                if (ej2_base_1.isBlazor()) {
                    this.pdfViewerBase.blazorUIAdaptor.totalPageElement.classList.add('e-pv-total-page-ms');
                }
                else {
                    if (!ej2_base_1.Browser.isDevice) {
                        this.totalPageItem.classList.add('e-pv-total-page-ms');
                    }
                }
            }
            this.createFileElement(toolbarDiv);
            this.wireEvent();
            if (!ej2_base_1.isBlazor()) {
                this.updateToolbarItems();
                if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                    this.applyToolbarSettings();
                    this.initialEnableItems();
                    this.pdfViewerBase.navigationPane.adjustPane();
                }
                else {
                    this.initialEnableItems();
                }
                if (this.pdfViewer.annotationModule) {
                    this.annotationToolbarModule = new index_1.AnnotationToolbar(this.pdfViewer, this.pdfViewerBase, this);
                    if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                        this.annotationToolbarModule.initializeAnnotationToolbar();
                    }
                }
                if (this.pdfViewer.annotationModule) {
                    this.redactionToolbarModule = new redaction_toolbar_1.RedactionToolbar(this.pdfViewer, this.pdfViewerBase, this);
                    if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                        this.redactionToolbarModule.initializeRedactionToolbar();
                    }
                }
                if (this.pdfViewer.formDesignerModule) {
                    this.formDesignerToolbarModule = new formdesigner_toolbar_1.FormDesignerToolbar(this.pdfViewer, this.pdfViewerBase, this);
                    if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                        this.formDesignerToolbarModule.initializeFormDesignerToolbar();
                    }
                }
            }
            else {
                if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                    this.initialEnableItems();
                    this.pdfViewerBase.navigationPane.adjustPane();
                    if (this.pdfViewer.enableToolbar) {
                        this.bindOpenIconEvent();
                    }
                }
                this.PanElement = document.getElementById(this.pdfViewer.element.id + '_handTool').children[0];
                this.PanElement.classList.add('e-pv-tbar-btn');
                this.SelectToolElement = document.getElementById(this.pdfViewer.element.id + '_selectTool').children[0];
                this.SelectToolElement.classList.add('e-pv-tbar-btn');
                this.CommentElement = document.getElementById(this.pdfViewer.element.id + '_comment').children[0];
                this.CommentElement.classList.add('e-pv-tbar-btn');
                this.annotationToolbarModule = new index_1.AnnotationToolbar(this.pdfViewer, this.pdfViewerBase, this);
                if (this.pdfViewer.enableToolbar && this.pdfViewer.enableAnnotationToolbar ||
                    (this.pdfViewer.enableDesktopMode && ej2_base_1.Browser.isDevice)) {
                    this.annotationToolbarModule.afterAnnotationToolbarCreationInBlazor();
                }
            }
            return toolbarDiv;
        };
        Toolbar.prototype.bindOpenIconEvent = function () {
            var openElement = document.getElementById(this.pdfViewer.element.id + '_open');
            if (openElement) {
                openElement.addEventListener('click', this.openFileDialogBox.bind(this));
            }
        };
        Toolbar.prototype.InitializeMobileToolbarInBlazor = function () {
            var toolbarDiv = this.pdfViewer.element.querySelector('.e-pv-mobile-toolbar');
            this.createFileElement(toolbarDiv);
            this.wireEvent();
        };
        Toolbar.prototype.showToolbar = function (enableToolbar) {
            var toolbar;
            if (!ej2_base_1.isNullOrUndefined(this.toolbarElement)) {
                toolbar = this.toolbarElement;
            }
            if (enableToolbar) {
                if (!ej2_base_1.isNullOrUndefined(toolbar) && !(this.pdfViewerBase.navigationPane &&
                    this.pdfViewerBase.navigationPane.isNavigationToolbarVisible)) {
                    toolbar.style.display = 'block';
                    this.adjustToolbar(ej2_base_1.Browser.isDevice);
                }
                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;
                }
                if ((ej2_base_1.Browser.isDevice && !this.pdfViewer.enableDesktopMode) && this.pdfViewer.toolbarModule &&
                    this.pdfViewer.toolbarModule.annotationToolbarModule) {
                    this.pdfViewer.toolbarModule.annotationToolbarModule.hideMobileAnnotationToolbar();
                }
            }
            else {
                this.pdfViewerBase.toolbarHeight = 0;
                if (enableToolbar) {
                    if (ej2_base_1.Browser.isDevice && this.pdfViewer.toolbarModule.annotationToolbarModule.toolbar) {
                        this.annotationToolbarModule.toolbarCreated = false;
                        this.annotationToolbarModule.adjustMobileViewer();
                        this.pdfViewer.toolbarModule.annotationToolbarModule.toolbar.element.style.display = 'none';
                    }
                    if (ej2_base_1.Browser.isDevice && this.annotationToolbarModule.propertyToolbar) {
                        this.annotationToolbarModule.propertyToolbar.element.style.display = 'none';
                    }
                }
                if (!ej2_base_1.isNullOrUndefined(toolbar)) {
                    toolbar.style.display = 'none';
                    this.adjustToolbar(ej2_base_1.Browser.isDevice);
                }
            }
        };
        Toolbar.prototype.adjustToolbar = function (isDevice) {
            if (this.pdfViewer.toolbarModule && this.pdfViewer.toolbarModule.annotationToolbarModule) {
                if (isDevice) {
                    this.annotationToolbarModule.adjustMobileViewer();
                }
                else {
                    this.annotationToolbarModule.adjustViewer(true);
                }
            }
        };
        Toolbar.prototype.showNavigationToolbar = function (enableNavigationToolbar) {
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                var navigationToolbar = this.pdfViewerBase.navigationPane.sideBarToolbar;
                var navigationToolbarSplitter = this.pdfViewerBase.navigationPane.sideBarToolbarSplitter;
                if (enableNavigationToolbar) {
                    if (!ej2_base_1.isNullOrUndefined(navigationToolbar)) {
                        navigationToolbar.style.display = 'block';
                    }
                    if (!ej2_base_1.isNullOrUndefined(navigationToolbarSplitter)) {
                        navigationToolbarSplitter.style.display = 'block';
                    }
                    if (this.pdfViewerBase.navigationPane.isBookmarkOpen || this.pdfViewerBase.navigationPane.isThumbnailOpen) {
                        this.pdfViewerBase.navigationPane.clear();
                    }
                }
                else {
                    if (!ej2_base_1.isNullOrUndefined(navigationToolbar)) {
                        navigationToolbar.style.display = 'none';
                    }
                    if (!ej2_base_1.isNullOrUndefined(navigationToolbarSplitter)) {
                        navigationToolbarSplitter.style.display = 'none';
                    }
                    if (this.pdfViewerBase.navigationPane.isBookmarkOpen || this.pdfViewerBase.navigationPane.isThumbnailOpen) {
                        this.pdfViewerBase.navigationPane.updateViewerContainerOnClose();
                    }
                }
            }
        };
        Toolbar.prototype.showAnnotationToolbar = function (enableAnnotationToolbar) {
            if (enableAnnotationToolbar) {
                this.annotationToolbarModule.isToolbarHidden = true;
                this.annotationToolbarModule.showAnnotationToolbar(null, false, true);
            }
            else {
                if (this.annotationToolbarModule.toolbarElement.style.display !== 'none') {
                    this.annotationToolbarModule.isToolbarHidden = false;
                    this.annotationToolbarModule.showAnnotationToolbar(null, false, false);
                }
            }
        };
        Toolbar.prototype.showRedactionToolbar = function (enableRedactionToolbar) {
            if (enableRedactionToolbar && this.pdfViewerBase.clientSideRendering) {
                this.redactionToolbarModule.isToolbarHidden = true;
                this.redactionToolbarModule.showRedactionToolbar(null, false, true);
            }
            else {
                this.redactionToolbarModule.isToolbarHidden = false;
                this.redactionToolbarModule.showRedactionToolbar(null, false, false);
            }
        };
        Toolbar.prototype.showToolbarItem = function (items, isVisible) {
            for (var i = 0; i < items.length; i++) {
                switch (items[parseInt(i.toString(), 10)]) {
                    case 'OpenOption':
                        this.showOpenOption(isVisible);
                        break;
                    case 'PageNavigationTool':
                        this.showPageNavigationTool(isVisible);
                        break;
                    case 'MagnificationTool':
                        this.showMagnificationTool(isVisible);
                        break;
                    case 'SelectionTool':
                        this.showSelectionTool(isVisible);
                        break;
                    case 'PanTool':
                        this.showScrollingTool(isVisible);
                        break;
                    case 'DownloadOption':
                        this.showDownloadOption(isVisible);
                        break;
                    case 'PrintOption':
                        this.showPrintOption(isVisible);
                        break;
                    case 'SearchOption':
                        this.showSearchOption(isVisible);
                        break;
                    case 'UndoRedoTool':
                        this.showUndoRedoTool(isVisible);
                        break;
                    case 'AnnotationEditTool':
                        this.showAnnotationEditTool(isVisible);
                        break;
                    case 'RedactionEditTool':
                        this.showRedactionEditTool(isVisible);
                        break;
                    case 'FormDesignerEditTool':
                        this.showFormDesignerEditTool(isVisible);
                        break;
                    case 'CommentTool':
                        this.showCommentOption(isVisible);
                        break;
                    case 'SubmitForm':
                        this.showSubmitForm(isVisible);
                        break;
                    case 'OrganizePagesTool':
                        this.showPageOrganizerToolbar(isVisible);
                        break;
                }
            }
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                this.applyHideToToolbar(true, this.itemsIndexArray[0].endIndex + 1, this.itemsIndexArray[0].endIndex + 1);
                this.applyHideToToolbar(true, this.itemsIndexArray[1].endIndex + 1, this.itemsIndexArray[1].endIndex + 1);
                this.applyHideToToolbar(true, this.itemsIndexArray[2].endIndex + 1, this.itemsIndexArray[2].endIndex + 1);
                this.applyHideToToolbar(true, this.itemsIndexArray[4].endIndex + 1, this.itemsIndexArray[4].endIndex + 1);
                this.applyHideToToolbar(true, this.itemsIndexArray[5].endIndex + 1, this.itemsIndexArray[5].endIndex + 1);
            }
            else {
                this.applyHideToToolbar(true, 1, 1);
                this.applyHideToToolbar(true, 8, 8);
                this.applyHideToToolbar(true, 12, 12);
                this.applyHideToToolbar(true, 15, 15);
            }
            this.showSeparator(items);
        };
        Toolbar.prototype.enableToolbarItem = function (items, isEnable) {
            for (var i = 0; i < items.length; i++) {
                switch (items[parseInt(i.toString(), 10)]) {
                    case 'OpenOption':
                        this.enableOpenOption(isEnable);
                        break;
                    case 'PageNavigationTool':
                        this.isPageNavigationToolDisabled = !isEnable;
                        this.enablePageNavigationTool(isEnable);
                        break;
                    case 'MagnificationTool':
                        this.isMagnificationToolDisabled = isEnable;
                        this.enableMagnificationTool(isEnable);
                        break;
                    case 'SelectionTool':
                        this.isSelectionToolDisabled = isEnable;
                        this.enableSelectionTool(isEnable);
                        break;
                    case 'PanTool':
                        this.isScrollingToolDisabled = isEnable;
                        this.enableScrollingTool(isEnable);
                        break;
                    case 'DownloadOption':
                        this.enableDownloadOption(isEnable);
                        break;
                    case 'PrintOption':
                        this.enablePrintOption(isEnable);
                        break;
                    case 'SearchOption':
                        this.enableSearchOption(isEnable);
                        break;
                    case 'UndoRedoTool':
                        this.enableUndoRedoTool(isEnable);
                        break;
                    case 'AnnotationEditTool':
                        this.enableAnnotationEditTool(isEnable);
                        break;
                    case 'RedactionEditTool':
                        this.enableRedactionEditTool(isEnable);
                        break;
                    case 'FormDesignerEditTool':
                        this.enableFormDesignerEditTool(isEnable);
                        break;
                    case 'CommentTool':
                        this.enableCommentsTool(isEnable);
                        break;
                    case 'OrganizePagesTool':
                        this.enableOrganizePagesButton(isEnable);
                        break;
                    default: {
                        var element = void 0;
                        var item = items[parseInt(i.toString(), 10)];
                        if (item.template) {
                            var match = item.template.match(/id="([^"]+)"/);
                            var id = match ? match[1] : null;
                            element = !ej2_base_1.isNullOrUndefined(id) ? document.getElementById(id) : null;
                            if (element) {
                                this.enableItems(element.parentElement.parentElement, isEnable);
                            }
                        }
                        else {
                            element = !ej2_base_1.isNullOrUndefined(item.id) ? document.getElementById(item.id) : null;
                            if (element) {
                                this.enableItems(element.parentElement, isEnable);
                            }
                        }
                        break;
                    }
                }
            }
        };
        Toolbar.prototype.DisableToolbarItems = function (restrictionSummary, isEnable) {
            switch (restrictionSummary) {
                case 'Print':
                    this.enablePrintOption(isEnable);
                    break;
                case 'CopyContent':
                    this.isSelectionToolDisabled = isEnable;
                    this.enableSelectionTool(isEnable);
                    if (isEnable) {
                        this.pdfViewerBase.initiateTextSelectMode();
                        this.updateInteractionTools(isEnable);
                    }
                    else {
                        this.pdfViewerBase.initiatePanning();
                        this.updateInteractionTools(isEnable);
                    }
                    break;
                case 'EditAnnotations':
                    this.enableAnnotationEditTool(isEnable);
                    if (this.annotationToolbarModule && !this.annotationToolbarModule.isToolbarHidden) {
                        this.annotationToolbarModule.showAnnotationToolbar();
                    }
                    break;
            }
        };
        Toolbar.prototype.showOpenOption = function (enableOpenOption) {
            this.isOpenBtnVisible = enableOpenOption;
            this.applyHideToToolbar(enableOpenOption, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[0]) ?
                this.itemsIndexArray[0].startIndex : 0, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[0]) ? this.itemsIndexArray[0].endIndex : 0);
        };
        Toolbar.prototype.showPageNavigationTool = function (enablePageNavigationTool) {
            this.isNavigationToolVisible = enablePageNavigationTool;
            this.applyHideToToolbar(enablePageNavigationTool, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[1]) ?
                this.itemsIndexArray[1].startIndex : 2, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[1]) ? this.itemsIndexArray[1].endIndex : 7);
        };
        Toolbar.prototype.showMagnificationTool = function (enableMagnificationTool) {
            this.isMagnificationToolVisible = enableMagnificationTool;
            this.applyHideToToolbar(enableMagnificationTool, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[2]) ?
                this.itemsIndexArray[2].startIndex : 9, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[2]) ? this.itemsIndexArray[2].endIndex : 11);
        };
        Toolbar.prototype.showSelectionTool = function (enableSelectionTool) {
            this.isSelectionBtnVisible = enableSelectionTool;
            this.applyHideToToolbar(enableSelectionTool, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[3]) ?
                this.itemsIndexArray[3].startIndex : 13, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[3]) ? this.itemsIndexArray[3].endIndex : 13);
        };
        Toolbar.prototype.showScrollingTool = function (enableScrollingTool) {
            this.isScrollingBtnVisible = enableScrollingTool;
            this.applyHideToToolbar(enableScrollingTool, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[4]) ?
                this.itemsIndexArray[4].startIndex : 14, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[4]) ? this.itemsIndexArray[4].endIndex : 14);
        };
        Toolbar.prototype.showDownloadOption = function (enableDownloadOption) {
            this.isDownloadBtnVisible = enableDownloadOption;
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                this.applyHideToToolbar(enableDownloadOption, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[13]) ?
                    this.itemsIndexArray[13].startIndex : 27, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[13]) ?
                    this.itemsIndexArray[13].endIndex : 27);
            }
            else {
                this.applyHideToToolbar(enableDownloadOption, 6, 6);
            }
        };
        Toolbar.prototype.showPageOrganizerToolbar = function (enablePageOrganizer) {
            if (ej2_base_1.Browser.isDevice && !this.pdfViewer.enableDesktopMode) {
                this.applyHideToToolbar(enablePageOrganizer, 4, 4);
            }
        };
        Toolbar.prototype.showPrintOption = function (enablePrintOption) {
            this.isPrintBtnVisible = enablePrintOption;
            this.applyHideToToolbar(enablePrintOption, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[12]) ?
                this.itemsIndexArray[12].startIndex : 26, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[12]) ?
                this.itemsIndexArray[12].endIndex : 26);
        };
        Toolbar.prototype.showSearchOption = function (enableSearchOption) {
            this.isSearchBtnVisible = enableSearchOption;
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                this.applyHideToToolbar(enableSearchOption, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[8]) ?
                    this.itemsIndexArray[8].startIndex : 22, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[8]) ?
                    this.itemsIndexArray[8].endIndex : 22);
            }
            else {
                this.applyHideToToolbar(enableSearchOption, 7, 7);
            }
        };
        Toolbar.prototype.showUndoRedoTool = function (isEnable) {
            this.isUndoRedoBtnsVisible = isEnable;
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                this.applyHideToToolbar(isEnable, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[5]) ? this.itemsIndexArray[5].startIndex : 16, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[5]) ? this.itemsIndexArray[5].endIndex : 17);
            }
            else {
                this.applyHideToToolbar(isEnable, 2, 3);
            }
        };
        Toolbar.prototype.showCommentOption = function (isEnable) {
            if (!this.pdfViewer.enableStickyNotesAnnotation) {
                this.isCommentBtnVisible = isEnable;
                this.applyHideToToolbar(this.pdfViewer.enableStickyNotesAnnotation, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[6]) ?
                    this.itemsIndexArray[6].startIndex : 18, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[6]) ?
                    this.itemsIndexArray[6].endIndex : 19);
            }
            else {
                this.isCommentBtnVisible = isEnable;
                this.applyHideToToolbar(isEnable, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[6]) ? this.itemsIndexArray[6].startIndex : 18, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[6]) ? this.itemsIndexArray[6].endIndex : 19);
            }
        };
        Toolbar.prototype.showAnnotationEditTool = function (isEnable) {
            this.isAnnotationEditBtnVisible = isEnable;
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                this.applyHideToToolbar(isEnable, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[9]) ?
                    this.itemsIndexArray[9].startIndex : 23, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[9]) ?
                    this.itemsIndexArray[9].endIndex : 23);
            }
            else {
                this.applyHideToToolbar(isEnable, 5, 5);
            }
        };
        Toolbar.prototype.showRedactionEditTool = function (isEnable) {
            this.isRedactionEditBtnVisible = isEnable;
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                this.applyHideToToolbar(isEnable, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[10]) ?
                    this.itemsIndexArray[10].startIndex : 24, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[10]) ?
                    this.itemsIndexArray[10].endIndex : 24);
            }
            else {
                this.applyHideToToolbar(isEnable, 6, 6);
            }
        };
        Toolbar.prototype.showFormDesignerEditTool = function (isEnable) {
            this.isFormDesignerEditBtnVisible = isEnable;
            this.applyHideToToolbar(isEnable, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[11]) ?
                this.itemsIndexArray[11].startIndex : 25, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[11]) ?
                this.itemsIndexArray[11].endIndex : 25);
        };
        Toolbar.prototype.showSubmitForm = function (isEnable) {
            this.isSubmitbtnvisible = isEnable;
            this.applyHideToToolbar(isEnable, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[7]) ?
                this.itemsIndexArray[7].startIndex : 20, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[7]) ?
                this.itemsIndexArray[7].endIndex : 21);
        };
        Toolbar.prototype.enableOpenOption = function (enableOpenOption) {
            this.enableItems(this.openDocumentItem.parentElement, enableOpenOption);
        };
        Toolbar.prototype.enablePageNavigationTool = function (enablePageNavigationTool) {
            this.enableItems(this.firstPageItem.parentElement, enablePageNavigationTool);
            this.enableItems(this.previousPageItem.parentElement, enablePageNavigationTool);
            this.enableItems(this.nextPageItem.parentElement, enablePageNavigationTool);
            this.enableItems(this.lastPageItem.parentElement, enablePageNavigationTool);
            this.currentPageBox.readonly = !enablePageNavigationTool;
        };
        Toolbar.prototype.enableMagnificationTool = function (enableMagnificationTool) {
            this.enableItems(this.zoomInItem.parentElement, enableMagnificationTool);
            this.enableItems(this.zoomOutItem.parentElement, enableMagnificationTool);
            this.zoomDropDown.readonly = !enableMagnificationTool;
        };
        Toolbar.prototype.enableSelectionTool = function (enableSelectionTool) {
            if (this.textSelectItem && this.textSelectItem.parentElement) {
                this.enableItems(this.textSelectItem.parentElement, enableSelectionTool);
            }
        };
        Toolbar.prototype.enableScrollingTool = function (enableScrollingTool) {
            this.enableItems(this.panItem.parentElement, enableScrollingTool);
        };
        Toolbar.prototype.enableDownloadOption = function (enableDownloadOption) {
            if (!ej2_base_1.isNullOrUndefined(this.downloadItem)) {
                this.enableItems(this.downloadItem.parentElement, enableDownloadOption);
            }
        };
        Toolbar.prototype.enablePrintOption = function (enablePrintOption) {
            this.enableItems(this.printItem.parentElement, enablePrintOption);
        };
        Toolbar.prototype.enableSearchOption = function (enableSearchOption) {
            this.enableItems(this.textSearchItem.parentElement, enableSearchOption);
        };
        Toolbar.prototype.enableUndoRedoTool = function (isEnable) {
            if (!ej2_base_1.isNullOrUndefined(this.undoItem) && !ej2_base_1.isNullOrUndefined(this.redoItem)) {
                this.enableItems(this.undoItem.parentElement, isEnable);
                this.enableItems(this.redoItem.parentElement, isEnable);
            }
        };
        Toolbar.prototype.enableAnnotationEditTool = function (isEnable) {
            this.enableItems(this.annotationItem.parentElement, isEnable);
        };
        Toolbar.prototype.enableRedactionEditTool = function (isEnable) {
            if (!ej2_base_1.isNullOrUndefined(this.redactionItem)) {
                this.enableItems(this.redactionItem.parentElement, isEnable);
            }
        };
        Toolbar.prototype.enableFormDesignerEditTool = function (isEnable) {
            if (!ej2_base_1.isNullOrUndefined(this.formDesignerItem)) {
                this.enableItems(this.formDesignerItem.parentElement, isEnable);
            }
        };
        Toolbar.prototype.enableCommentsTool = function (isEnable) {
            if (this.pdfViewer.enableStickyNotesAnnotation && !ej2_base_1.isNullOrUndefined(this.commentItem)) {
                this.enableItems(this.commentItem.parentElement, isEnable);
            }
        };
        Toolbar.prototype.enableOrganizePagesButton = function (isEnable) {
            if (!ej2_base_1.isNullOrUndefined(this.organizePageItem) && !ej2_base_1.isNullOrUndefined(this.organizePageItem.parentElement) &&
                this.pdfViewer.enablePageOrganizer) {
                this.enableItems(this.organizePageItem.parentElement, isEnable);
            }
        };
        Toolbar.prototype.resetToolbar = function () {
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                if (!ej2_base_1.isNullOrUndefined(this.currentPageBox)) {
                    this.currentPageBox.min = 0;
                    this.currentPageBox.value = 0;
                    this.currentPageBox.dataBind();
                }
                this.updateTotalPage();
                this.updateToolbarItems();
                if (this.pdfViewer.toolbarModule && this.annotationToolbarModule) {
                    this.pdfViewer.toolbarModule.annotationToolbarModule.updateFontSizeInIcon(16);
                }
                if (this.annotationToolbarModule) {
                    this.annotationToolbarModule.clear();
                }
                else {
                    if (this.annotationToolbarModule) {
                        if (this.annotationToolbarModule.propertyToolbar) {
                            this.annotationToolbarModule.propertyToolbar.destroy();
                        }
                        var commentsContainer = document.getElementById(this.pdfViewer.element.id + '_commentscontentcontainer');
                        if (commentsContainer) {
                            commentsContainer.innerHTML = '';
                        }
                    }
                }
            }
        };
        Toolbar.prototype.updateToolbarItems = function () {
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                if (this.toolbar) {
                    if (this.pdfViewerBase.pageCount === 0) {
                        this.enableItems(this.downloadItem.parentElement, false);
                        this.enableItems(this.printItem.parentElement, false);
                        this.enableItems(this.commentItem.parentElement, false);
                        this.updateUndoRedoButtons();
                        this.updateNavigationButtons();
                        this.enableItems(this.zoomInItem.parentElement, false);
                        this.enableItems(this.zoomOutItem.parentElement, false);
                        if (this.pdfViewer.magnificationModule) {
                            this.zoomDropDown.readonly = true;
                        }
                        this.enableItems(this.submitItem.parentElement, false);
                        this.toolbar.enableItems(this.pdfViewerBase.getElement('_currentPageInputContainer'), false);
                        this.enableItems(this.pdfViewerBase.getElement('_zoomDropDownContainer'), false);
                        this.enableItems(this.textSelectItem.parentElement, false);
                        this.enableItems(this.annotationItem.parentElement, false);
                        this.enableItems(this.redactionItem.parentElement, false);
                        this.enableItems(this.formDesignerItem.parentElement, false);
                        this.enableItems(this.panItem.parentElement, false);
                        this.enableItems(this.textSearchItem.parentElement, false);
                        this.deSelectItem(this.annotationItem);
                        if (this.annotationToolbarModule && this.pdfViewer.enableAnnotation) {
                            this.annotationToolbarModule.resetToolbar();
                        }
                        this.deSelectItem(this.formDesignerItem);
                        if (this.formDesignerToolbarModule && this.pdfViewer.enableFormDesigner) {
                            this.formDesignerToolbarModule.resetFormDesignerToolbar();
                        }
                        this.deSelectItem(this.redactionItem);
                        if (this.redactionToolbarModule) {
                            this.redactionToolbarModule.resetToolbar();
                        }
                    }
                    else if (this.pdfViewerBase.pageCount > 0) {
                        var obj = this.pdfViewerBase.getElement('_currentPageInputContainer');
                        if (obj) {
                            this.enableItems(this.downloadItem.parentElement, true);
                            this.enableItems(this.printItem.parentElement, true);
                            this.toolbar.enableItems(this.pdfViewerBase.getElement('_currentPageInputContainer'), true);
                            this.enableItems(this.pdfViewerBase.getElement('_zoomDropDownContainer'), true);
                            this.updateUndoRedoButtons();
                            this.updateNavigationButtons();
                            this.updateZoomButtons();
                            if (this.pdfViewer.magnificationModule) {
                                this.zoomDropDown.readonly = false;
                            }
                            this.updateInteractionItems();
                            if (this.pdfViewer.annotationModule && this.pdfViewer.enableAnnotation) {
                                this.enableItems(this.annotationItem.parentElement, true);
                            }
                            if (this.pdfViewer.formDesignerModule && this.pdfViewer.enableFormDesigner) {
                                this.enableItems(this.formDesignerItem.parentElement, true);
                            }
                            if (this.pdfViewer.annotation && this.pdfViewer.annotation.redactionAnnotationModule) {
                                this.enableItems(this.redactionItem.parentElement, true);
                            }
                            if (this.pdfViewer.textSearchModule && this.pdfViewer.enableTextSearch) {
                                this.enableItems(this.textSearchItem.parentElement, true);
                            }
                            if (this.pdfViewer.annotationModule && this.pdfViewer.enableStickyNotesAnnotation) {
                                this.enableItems(this.commentItem.parentElement, true);
                            }
                        }
                    }
                    if (this.pdfViewer.toolbarSettings.annotationToolbarItems) {
                        if (this.pdfViewer.toolbarSettings.annotationToolbarItems.length === 0 ||
                            !this.pdfViewer.annotationModule || !this.pdfViewer.enableAnnotationToolbar) {
                            this.enableToolbarItem(['AnnotationEditTool'], false);
                        }
                    }
                    if (this.pdfViewer.toolbarSettings.formDesignerToolbarItems) {
                        if (this.pdfViewer.toolbarSettings.formDesignerToolbarItems.length === 0 ||
                            !this.pdfViewer.formDesignerModule || !this.pdfViewer.enableFormDesignerToolbar) {
                            this.enableToolbarItem(['FormDesignerEditTool'], false);
                        }
                    }
                    if (this.pdfViewer.toolbarSettings.redactionToolbarItems) {
                        if (this.pdfViewer.toolbarSettings.redactionToolbarItems.length === 0 ||
                            this.pdfViewer.annotation && !this.pdfViewer.annotation.redactionAnnotationModule ||
                            !this.pdfViewer.enableRedactionToolbar) {
                            this.enableToolbarItem(['RedactionEditTool'], false);
                        }
                    }
                    if (!this.pdfViewer.enableDownload) {
                        this.enableDownloadOption(false);
                    }
                    if (!this.pdfViewer.enablePrint) {
                        this.enablePrintOption(false);
                    }
                }
            }
            else {
                if (this.pdfViewerBase.pageCount === 0) {
                    this.enableItems(this.textSearchItem.parentElement, false);
                    this.enableItems(this.moreOptionItem.parentElement, false);
                    this.enableItems(this.annotationItem.parentElement, false);
                    this.enableItems(this.redactionItem.parentElement, false);
                }
                else if (this.pdfViewerBase.pageCount > 0) {
                    if (this.pdfViewer.textSearchModule && this.pdfViewer.enableTextSearch) {
                        this.enableItems(this.textSearchItem.parentElement, true);
                    }
                    this.enableItems(this.moreOptionItem.parentElement, true);
                    if (this.pdfViewer.annotationModule && this.pdfViewer.enableAnnotation) {
                        this.enableItems(this.annotationItem.parentElement, true);
                    }
                    if (this.pdfViewer.annotation && this.pdfViewer.annotation.redactionAnnotationModule &&
                        this.pdfViewer.enableRedactionToolbar) {
                        this.enableItems(this.redactionItem.parentElement, true);
                    }
                    if (!this.pdfViewer.annotationModule || !this.pdfViewer.enableAnnotationToolbar) {
                        this.enableToolbarItem(['AnnotationEditTool'], false);
                    }
                    if (!this.pdfViewer.annotationModule || !this.pdfViewer.enableRedactionToolbar) {
                        this.enableToolbarItem(['RedactionEditTool'], false);
                    }
                    this.updateUndoRedoButtons();
                    if (this.pdfViewer && this.pdfViewer.element && this.pdfViewer.element.id && this.pdfViewer.isAnnotationToolbarVisible) {
                        var annotationId = this.pdfViewer.element.id + '_annotationIcon';
                        this.annotationToolbarModule.createAnnotationToolbarForMobile(annotationId);
                    }
                    if (this.pdfViewer && this.pdfViewer.element && this.pdfViewer.element.id && this.pdfViewer.isRedactionToolbarVisible) {
                        var redactionId = this.pdfViewer.element.id + '_redactionIcon';
                        this.redactionToolbarModule.createRedactionToolbarForMobile(redactionId);
                    }
                }
            }
        };
        Toolbar.prototype.updateNavigationButtons = function () {
            if (this.pdfViewer.navigationModule && !this.isPageNavigationToolDisabled) {
                if (this.pdfViewerBase.pageCount === 0 || (this.pdfViewerBase.currentPageNumber === 1 && this.pdfViewerBase.pageCount === 1)) {
                    this.enableItems(this.firstPageItem.parentElement, false);
                    this.enableItems(this.previousPageItem.parentElement, false);
                    this.enableItems(this.nextPageItem.parentElement, false);
                    this.enableItems(this.lastPageItem.parentElement, false);
                }
                else if (this.pdfViewerBase.currentPageNumber === 1 && this.pdfViewerBase.pageCount > 0) {
                    this.enableItems(this.firstPageItem.parentElement, false);
                    this.enableItems(this.previousPageItem.parentElement, false);
                    this.enableItems(this.nextPageItem.parentElement, true);
                    this.enableItems(this.lastPageItem.parentElement, true);
                }
                else if (this.pdfViewerBase.currentPageNumber === this.pdfViewerBase.pageCount && this.pdfViewerBase.pageCount > 0) {
                    this.enableItems(this.firstPageItem.parentElement, true);
                    this.enableItems(this.previousPageItem.parentElement, true);
                    this.enableItems(this.nextPageItem.parentElement, false);
                    this.enableItems(this.lastPageItem.parentElement, false);
                }
                else if (this.pdfViewerBase.currentPageNumber > 1 && this.pdfViewerBase.currentPageNumber < this.pdfViewerBase.pageCount) {
                    this.enableItems(this.firstPageItem.parentElement, true);
                    this.enableItems(this.previousPageItem.parentElement, true);
                    this.enableItems(this.nextPageItem.parentElement, true);
                    this.enableItems(this.lastPageItem.parentElement, true);
                }
            }
            else {
                this.enableItems(this.firstPageItem.parentElement, false);
                this.enableItems(this.previousPageItem.parentElement, false);
                this.enableItems(this.nextPageItem.parentElement, false);
                this.enableItems(this.lastPageItem.parentElement, false);
                this.currentPageBox.readonly = true;
            }
        };
        Toolbar.prototype.updateZoomButtons = function () {
            if (this.pdfViewer.magnificationModule && !this.isMagnificationToolDisabled && (!ej2_base_1.Browser.isDevice ||
                this.pdfViewer.enableDesktopMode)) {
                if (this.pdfViewer.minZoom != null || this.pdfViewer.maxZoom != null) {
                    if (this.pdfViewer.minZoom === this.pdfViewer.maxZoom && this.pdfViewer.magnificationModule.zoomFactor ===
                        this.pdfViewer.minZoom / 100) {
                        this.enableItems(this.zoomInItem.parentElement, false);
                        this.enableItems(this.zoomOutItem.parentElement, false);
                    }
                    else if (this.pdfViewer.magnificationModule.zoomFactor <= this.pdfViewer.minZoom / 100) {
                        this.enableItems(this.zoomInItem.parentElement, true);
                        this.enableItems(this.zoomOutItem.parentElement, false);
                    }
                    else if (this.pdfViewer.magnificationModule.zoomFactor >= this.pdfViewer.maxZoom / 100) {
                        this.enableItems(this.zoomInItem.parentElement, false);
                        this.enableItems(this.zoomOutItem.parentElement, true);
                    }
                    else {
                        this.enableItems(this.zoomInItem.parentElement, true);
                        this.enableItems(this.zoomOutItem.parentElement, true);
                    }
                }
                else {
                    if (this.pdfViewer.magnificationModule.zoomFactor <= 0.1) {
                        this.enableItems(this.zoomInItem.parentElement, true);
                        this.enableItems(this.zoomOutItem.parentElement, false);
                    }
                    else if (this.pdfViewer.magnificationModule.zoomFactor >= 4) {
                        this.enableItems(this.zoomInItem.parentElement, false);
                        this.enableItems(this.zoomOutItem.parentElement, true);
                    }
                    else {
                        this.enableItems(this.zoomInItem.parentElement, true);
                        this.enableItems(this.zoomOutItem.parentElement, true);
                    }
                }
            }
        };
        Toolbar.prototype.updateUndoRedoButtons = function () {
            if (this.pdfViewer.annotationModule) {
                if (this.pdfViewerBase.pageCount > 0) {
                    if (ej2_base_1.isBlazor()) {
                        this.enableCollectionAvailableInBlazor(this.pdfViewer.annotationModule.actionCollection, 'undo');
                        this.enableCollectionAvailableInBlazor(this.pdfViewer.annotationModule.redoCollection, 'redo');
                    }
                    else {
                        if (!ej2_base_1.isNullOrUndefined(this.undoItem) && !ej2_base_1.isNullOrUndefined(this.undoItem.parentElement)) {
                            this.enableCollectionAvailable(this.pdfViewer.annotationModule.actionCollection, this.undoItem.parentElement);
                            if (this.pdfViewer.annotationModule.actionCollection.length > 0) {
                                this.undoItem.setAttribute('tabindex', '0');
                            }
                            else {
                                this.undoItem.setAttribute('tabindex', '-1');
                            }
                        }
                        if (!ej2_base_1.isNullOrUndefined(this.redoItem) && !ej2_base_1.isNullOrUndefined(this.redoItem.parentElement)) {
                            this.enableCollectionAvailable(this.pdfViewer.annotationModule.redoCollection, this.redoItem.parentElement);
                            if (this.pdfViewer.annotationModule.redoCollection.length > 0) {
                                this.redoItem.setAttribute('tabindex', '0');
                            }
                            else {
                                this.redoItem.setAttribute('tabindex', '-1');
                            }
                        }
                    }
                }
                else {
                    if (ej2_base_1.isBlazor()) {
                        this.pdfViewerBase.blazorUIAdaptor.disableUndoRedoButton();
                    }
                    else {
                        this.disableUndoRedoButtons();
                    }
                }
            }
            else {
                if (ej2_base_1.isBlazor()) {
                    this.pdfViewerBase.blazorUIAdaptor.disableUndoRedoButton();
                }
                else {
                    this.disableUndoRedoButtons();
                }
            }
        };
        Toolbar.prototype.enableCollectionAvailable = function (collection, item) {
            if (collection.length > 0) {
                this.toolbar.enableItems(item, true);
            }
            else {
                this.toolbar.enableItems(item, false);
            }
        };
        Toolbar.prototype.enableCollectionAvailableInBlazor = function (collection, item) {
            if (collection.length > 0) {
                this.pdfViewerBase.blazorUIAdaptor.updateUndoRedoButton(item, true);
            }
            else {
                this.pdfViewerBase.blazorUIAdaptor.updateUndoRedoButton(item, false);
            }
        };
        Toolbar.prototype.disableUndoRedoButtons = function () {
            if (!ej2_base_1.isNullOrUndefined(this.undoItem)) {
                this.enableItems(this.undoItem.parentElement, false);
            }
            if (!ej2_base_1.isNullOrUndefined(this.redoItem)) {
                this.enableItems(this.redoItem.parentElement, false);
            }
        };
        Toolbar.prototype.destroy = function () {
            if (!ej2_base_1.isBlazor()) {
                this.unWireEvent();
                this.destroyComponent();
                if (this.moreDropDown) {
                    this.moreDropDown.destroy();
                }
                if (this.annotationToolbarModule) {
                    this.annotationToolbarModule.destroy();
                }
                if (this.formDesignerToolbarModule) {
                    this.formDesignerToolbarModule.destroy();
                }
                if (this.redactionToolbarModule) {
                    this.redactionToolbarModule.destroy();
                }
                if (this.toolbar) {
                    this.toolbar.destroy();
                }
                if (this.toolbarElement) {
                    this.toolbarElement.parentElement.removeChild(this.toolbarElement);
                }
            }
        };
        Toolbar.prototype.destroyComponent = function () {
            var componentElement = [this.openDocumentItem, this.firstPageItem, this.previousPageItem, this.nextPageItem,
                this.lastPageItem, this.currentPageBoxElement, this.zoomOutItem, this.zoomInItem, this.zoomDropdownItem, this.textSelectItem,
                this.panItem, this.submitItem, this.undoItem, this.redoItem, this.commentItem, this.textSearchItem, this.annotationItem,
                this.redactionItem, this.formDesignerItem, this.printItem, this.downloadItem];
            for (var i = 0; i < componentElement.length; i++) {
                if (componentElement[parseInt(i.toString(), 10)]) {
                    this.destroyDependentComponent(componentElement[parseInt(i.toString(), 10)]);
                }
            }
        };
        Toolbar.prototype.destroyDependentComponent = function (component) {
            if (component.ej2_instances) {
                for (var i = component.ej2_instances.length - 1; i >= 0; i--) {
                    component.ej2_instances[parseInt(i.toString(), 10)].destroy();
                }
            }
        };
        Toolbar.prototype.updateCurrentPage = function (pageIndex) {
            if (this.pdfViewerBase.pageCount > 0) {
                if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                    if (!ej2_base_1.isBlazor()) {
                        if (!ej2_base_1.isNullOrUndefined(this.currentPageBox)) {
                            if (this.currentPageBox.value === pageIndex) {
                                this.currentPageBoxElement.value = pageIndex.toString();
                            }
                            this.currentPageBox.value = pageIndex;
                            this.currentPageBox.dataBind();
                        }
                    }
                    else {
                        this.pdfViewerBase.blazorUIAdaptor.pageChanged(pageIndex);
                    }
                    this.pdfViewerBase.currentPageNumber = pageIndex;
                    this.pdfViewer.currentPageNumber = pageIndex;
                    if (pageIndex === this.pdfViewerBase.pageCount) {
                        this.updateNavigationButtons();
                    }
                }
                else {
                    this.pdfViewerBase.mobileSpanContainer.innerHTML = pageIndex.toString();
                    this.pdfViewerBase.mobilecurrentPageContainer.innerHTML = pageIndex.toString();
                }
            }
        };
        Toolbar.prototype.updateTotalPage = function () {
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                if (this.pdfViewerBase.pageCount > 0) {
                    if (!ej2_base_1.isNullOrUndefined(this.currentPageBox)) {
                        this.currentPageBox.min = 1;
                        this.currentPageBox.dataBind();
                    }
                }
                if (!ej2_base_1.isNullOrUndefined(this.totalPageItem)) {
                    this.totalPageItem.textContent = this.pdfViewer.localeObj.getConstant('of') + this.pdfViewerBase.pageCount.toString();
                }
            }
        };
        Toolbar.prototype.openFileDialogBox = function (event) {
            event.preventDefault();
            this.fileInputElement.click();
        };
        Toolbar.prototype.createToolbar = function (controlWidth) {
            var _this = this;
            this.toolbarElement = ej2_base_1.createElement('div', { id: this.pdfViewer.element.id + '_toolbarContainer', className: 'e-pv-toolbar' });
            this.pdfViewerBase.viewerMainContainer.appendChild(this.toolbarElement);
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                this.toolbar = new ej2_navigations_1.Toolbar({
                    clicked: this.toolbarClickHandler, width: '', height: '', overflowMode: 'Popup', cssClass: 'e-pv-toolbar-scroll',
                    items: this.createToolbarItems(), created: function () {
                        _this.createZoomDropdown();
                        _this.createNumericTextBox();
                        _this.toolbar.refreshOverflow();
                    }
                });
                this.toolbar.isStringTemplate = true;
                if (this.pdfViewer.enableRtl) {
                    this.toolbar.enableRtl = true;
                }
                this.toolbar.appendTo(this.toolbarElement);
                this.applyToolbarSettings();
                this.afterToolbarCreation();
                this.updateTotalPage();
                this.toolbarElement.addEventListener('keydown', this.onToolbarKeydown);
                this.toolbarElement.setAttribute('aria-label', 'Toolbar');
            }
            else {
                this.createToolbarItemsForMobile();
                this.afterToolbarCreationInMobile();
                if (this.pdfViewer.enableRtl) {
                    this.toolbar.enableRtl = true;
                }
                this.applyToolbarSettingsForMobile();
                this.disableUndoRedoButtons();
            }
            return this.toolbarElement;
        };
        Toolbar.prototype.createCustomItem = function (startIndex) {
            if (!ej2_base_1.isNullOrUndefined(this.pdfViewer.toolbarSettings)) {
                if (ej2_base_1.isNullOrUndefined(this.pdfViewer.toolbarSettings.toolbarItems)) {
                    this.pdfViewer.toolbarSettings.toolbarItems = ['OpenOption', 'PageNavigationTool', 'MagnificationTool', 'SelectionTool',
                        'PanTool', 'UndoRedoTool', 'CommentTool', 'SubmitForm', 'SearchOption', 'AnnotationEditTool',
                        'FormDesignerEditTool', 'PrintOption', 'DownloadOption'];
                }
                if (ej2_base_1.isNullOrUndefined(this.pdfViewer.toolbarSettings.annotationToolbarItems)) {
                    this.pdfViewer.toolbarSettings.annotationToolbarItems = ['HighlightTool', 'UnderlineTool', 'StrikethroughTool', 'SquigglyTool',
                        'ColorEditTool', 'OpacityEditTool', 'AnnotationDeleteTool', 'StampAnnotationTool', 'HandWrittenSignatureTool',
                        'InkAnnotationTool', 'ShapeTool', 'CalibrateTool', 'StrokeColorEditTool', 'ThicknessEditTool',
                        'FreeTextAnnotationTool', 'FontFamilyAnnotationTool', 'FontSizeAnnotationTool', 'FontStylesAnnotationTool',
                        'FontAlignAnnotationTool', 'FontColorAnnotationTool', 'CommentPanelTool'];
                }
                if (ej2_base_1.isNullOrUndefined(this.pdfViewer.toolbarSettings.formDesignerToolbarItems)) {
                    this.pdfViewer.toolbarSettings.formDesignerToolbarItems = ['TextboxTool', 'PasswordTool', 'CheckBoxTool',
                        'RadioButtonTool', 'DropdownTool', 'ListboxTool', 'DrawSignatureTool', 'DeleteTool'];
                }
                if (ej2_base_1.isNullOrUndefined(this.pdfViewer.toolbarSettings.redactionToolbarItems)) {
                    this.pdfViewer.toolbarSettings.redactionToolbarItems = ['MarkForRedaction', 'RedactPages', 'RedactionPanel', 'Redact', 'RemoveAnnotation', 'CommentPanel', 'Close'];
                }
                if (ej2_base_1.isNullOrUndefined(this.pdfViewer.toolbarSettings.showTooltip)) {
                    this.pdfViewer.toolbarSettings.showTooltip = false;
                }
            }
            for (var j = startIndex; j < this.pdfViewer.toolbarSettings.toolbarItems.length; j++) {
                if (typeof (this.pdfViewer.toolbarSettings.toolbarItems[parseInt(j.toString(), 10)]) === 'object') {
                    var customToolbarItem = this.pdfViewer.toolbarSettings.toolbarItems[parseInt(j.toString(), 10)];
                    if (!ej2_base_1.isNullOrUndefined(customToolbarItem.prefixIcon) && customToolbarItem.prefixIcon !== '') {
                        customToolbarItem.prefixIcon += ' e-pv-icon';
                    }
                    if ((ej2_base_1.isNullOrUndefined(customToolbarItem.prefixIcon) || customToolbarItem.prefixIcon === '') && ej2_base_1.isNullOrUndefined(customToolbarItem.template)) {
                        var customButton = document.createElement('button');
                        customButton.id = 'Custom';
                        customButton.className = 'e-tbar-btn';
                        customButton.style.fontSize = '14px';
                        var customSpan = document.createElement('span');
                        customSpan.textContent = !ej2_base_1.isNullOrUndefined(customToolbarItem.text) ? customToolbarItem.text : 'Custom Toolbar Item';
                        customButton.appendChild(customSpan);
                        customToolbarItem.template = customButton;
                    }
                    this.toolItems.push(customToolbarItem);
                    if (ej2_base_1.isNullOrUndefined(customToolbarItem.align) || customToolbarItem.align === 'left' || customToolbarItem.align === 'Left') {
                        this.toolItems.push({ type: 'Separator', align: 'Left' });
                    }
                }
                else {
                    break;
                }
            }
        };
        Toolbar.prototype.createToolbarItems = function () {
            var currentPageInputTemplate = this.createCurrentPageInputTemplate();
            var totalPageTemplate = this.createTotalPageTemplate();
            var zoomDropDownTemplateString = this.createZoomDropdownElement();
            var submitButton = document.createElement('button');
            submitButton.id = this.pdfViewer.element.id + '_submitForm';
            submitButton.className = 'e-tbar-btn';
            submitButton.style.fontSize = '15px';
            var spanElement = document.createElement('span');
            spanElement.id = this.pdfViewer.element.id + '_submitFormSpan';
            spanElement.className = 'e-tbar-btn-text e-pv-submitform-text';
            spanElement.textContent = this.pdfViewer.localeObj.getConstant('SubmitForm');
            submitButton.appendChild(spanElement);
            var defaultToolbarOrder = ['OpenOption', 'PageNavigationTool', 'MagnificationTool', 'SelectionTool', 'PanTool', 'UndoRedoTool', 'CommentTool', 'SubmitForm', 'SearchOption', 'AnnotationEditTool', 'RedactionEditTool', 'FormDesignerEditTool', 'PrintOption', 'DownloadOption'];
            for (var i = 0; i < defaultToolbarOrder.length; i++) {
                if (i === 0) {
                    this.createCustomItem(i);
                }
                var toolbarItemOrder = i;
                switch (toolbarItemOrder) {
                    case 0:
                        this.itemsIndexArray.push({ item: 'OpenOption', startIndex: this.toolItems.length, endIndex: this.toolItems.length });
                        this.toolItems.push({ prefixIcon: 'e-pv-open-document-icon e-pv-icon', cssClass: 'e-pv-open-document-container', id: this.pdfViewer.element.id + '_open', text: this.pdfViewer.localeObj.getConstant('Open text'), align: 'Left' });
                        this.toolItems.push({ type: 'Separator', align: 'Left', cssClass: 'e-pv-open-separator-container' });
                        break;
                    case 1:
                        if (!this.pdfViewer.enableRtl) {
                            this.itemsIndexArray.push({ item: 'PageNavigationTool', startIndex: this.toolItems.length, endIndex: this.toolItems.length + 5 });
                            this.toolItems.push({ prefixIcon: 'e-pv-first-page-navigation-icon e-pv-icon', cssClass: 'e-pv-first-page-navigation-container', id: this.pdfViewer.element.id + '_firstPage', text: this.pdfViewer.localeObj.getConstant('First text'), align: 'Left' });
                            this.toolItems.push({ prefixIcon: 'e-pv-previous-page-navigation-icon e-pv-icon', cssClass: 'e-pv-previous-page-navigation-container', id: this.pdfViewer.element.id + '_previousPage', text: this.pdfViewer.localeObj.getConstant('Previous text'), align: 'Left' });
                            this.toolItems.push({ prefixIcon: 'e-pv-next-page-navigation-icon e-pv-icon', cssClass: 'e-pv-next-page-navigation-container', id: this.pdfViewer.element.id + '_nextPage', text: this.pdfViewer.localeObj.getConstant('Next text'), align: 'Left' });
                            this.toolItems.push({ prefixIcon: 'e-pv-last-page-navigation-icon e-pv-icon', cssClass: 'e-pv-last-page-navigation-container', id: this.pdfViewer.element.id + '_lastPage', text: this.pdfViewer.localeObj.getConstant('Last text'), align: 'Left' });
                            this.toolItems.push({ template: currentPageInputTemplate, align: 'Left', cssClass: 'e-pv-current-page-container' });
                            this.toolItems.push({ template: totalPageTemplate, align: 'Left', cssClass: 'e-pv-total-page-container' });
                        }
                        else {
                            this.itemsIndexArray.push({ item: 'PageNavigationTool', startIndex: this.toolItems.length, endIndex: this.toolItems.length + 5 });
                            this.toolItems.push({ prefixIcon: 'e-pv-last-page-navigation-icon e-pv-icon', cssClass: 'e-pv-last-page-navigation-container', id: this.pdfViewer.element.id + '_firstPage', text: this.pdfViewer.localeObj.getConstant('First text'), align: 'Left' });
                            this.toolItems.push({ prefixIcon: 'e-pv-next-page-navigation-icon e-pv-icon', cssClass: 'e-pv-next-page-navigation-container', id: this.pdfViewer.element.id + '_previousPage', text: this.pdfViewer.localeObj.getConstant('Previous text'), align: 'Left' });
                            this.toolItems.push({ prefixIcon: 'e-pv-previous-page-navigation-icon e-pv-icon', cssClass: 'e-pv-previous-page-navigation-container', id: this.pdfViewer.element.id + '_nextPage', text: this.pdfViewer.localeObj.getConstant('Next text'), align: 'Left' });
                            this.toolItems.push({ prefixIcon: 'e-pv-first-page-navigation-icon e-pv-icon', cssClass: 'e-pv-first-page-navigation-container', id: this.pdfViewer.element.id + '_lastPage', text: this.pdfViewer.localeObj.getConstant('Last text'), align: 'Left' });
                            this.toolItems.push({ template: totalPageTemplate, align: 'Left', cssClass: 'e-pv-total-page-container' });
                            this.toolItems.push({ template: currentPageInputTemplate, align: 'Left', cssClass: 'e-pv-current-page-container' });
                        }
                        this.toolItems.push({ type: 'Separator', align: 'Left', cssClass: 'e-pv-navigation-separator-container' });
                        break;
                    case 2:
                        this.itemsIndexArray.push({ item: 'MagnificationTool', startIndex: this.toolItems.length, endIndex: this.toolItems.length + 2 });
                        this.toolItems.push({ prefixIcon: 'e-pv-zoom-out-icon e-pv-icon', cssClass: 'e-pv-zoom-out-container', id: this.pdfViewer.element.id + '_zoomOut', text: this.pdfViewer.localeObj.getConstant('Zoom out text'), align: 'Left' });
                        this.toolItems.push({ prefixIcon: 'e-pv-zoom-in-icon e-pv-icon', cssClass: 'e-pv-zoom-in-container', id: this.pdfViewer.element.id + '_zoomIn', text: this.pdfViewer.localeObj.getConstant('Zoom in text'), align: 'Left' });
                        this.toolItems.push({ template: zoomDropDownTemplateString, cssClass: 'e-pv-zoom-drop-down-container', align: 'Left' });
                        this.toolItems.push({ type: 'Separator', align: 'Left', cssClass: 'e-pv-magnification-separator-container' });
                        break;
                    case 3:
                        this.itemsIndexArray.push({ item: 'SelectionTool', startIndex: this.toolItems.length, endIndex: this.toolItems.length });
                        this.toolItems.push({ prefixIcon: 'e-pv-text-select-tool-icon e-pv-icon', cssClass: 'e-pv-text-select-tool-container', id: this.pdfViewer.element.id + '_selectTool', text: this.pdfViewer.localeObj.getConstant('Selection text') });
                        break;
                    case 4:
                        this.itemsIndexArray.push({ item: 'PanTool', startIndex: this.toolItems.length, endIndex: this.toolItems.length });
                        this.toolItems.push({ prefixIcon: 'e-pv-pan-tool-icon e-pv-icon', cssClass: 'e-pv-pan-tool-container', id: this.pdfViewer.element.id + '_handTool', text: this.pdfViewer.localeObj.getConstant('Pan text') });
                        this.toolItems.push({ type: 'Separator', align: 'Left', cssClass: 'e-pv-pan-separator-container' });
                        break;
                    case 5:
                        this.itemsIndexArray.push({ item: 'UndoRedoTool', startIndex: this.toolItems.length, endIndex: this.toolItems.length + 1 });
                        this.toolItems.push({ prefixIcon: 'e-pv-undo-icon e-pv-icon', cssClass: 'e-pv-undo-container', id: this.pdfViewer.element.id + '_undo', text: this.pdfViewer.localeObj.getConstant('Undo'), align: 'Left' });
                        this.toolItems.push({ prefixIcon: 'e-pv-redo-icon e-pv-icon', cssClass: 'e-pv-redo-container', id: this.pdfViewer.element.id + '_redo', text: this.pdfViewer.localeObj.getConstant('Redo'), align: 'Left' });
                        this.toolItems.push({ type: 'Separator', align: 'Left', cssClass: 'e-pv-undo-separator-container' });
                        break;
                    case 6:
                        this.itemsIndexArray.push({ item: 'CommentTool', startIndex: this.toolItems.length, endIndex: this.toolItems.length + 1 });
                        this.toolItems.push({ prefixIcon: 'e-pv-comment-icon e-pv-icon', cssClass: 'e-pv-comment-container', id: this.pdfViewer.element.id + '_comment', text: this.pdfViewer.localeObj.getConstant('Add Comments'), align: 'Left' });
                        this.toolItems.push({ type: 'Separator', align: 'Left', cssClass: 'e-pv-comment-separator-container' });
                        break;
                    case 7:
                        this.itemsIndexArray.push({ item: 'SubmitForm', startIndex: this.toolItems.length, endIndex: this.toolItems.length });
                        this.toolItems.push({ template: submitButton, cssClass: 'e-pv-submit', align: 'Left' });
                        break;
                    case 8:
                        this.itemsIndexArray.push({ item: 'SearchOption', startIndex: this.toolItems.length, endIndex: this.toolItems.length });
                        this.toolItems.push({ prefixIcon: 'e-pv-text-search-icon e-pv-icon', cssClass: 'e-pv-text-search-container', id: this.pdfViewer.element.id + '_search', text: this.pdfViewer.localeObj.getConstant('Search text'), align: 'Right' });
                        break;
                    case 9:
                        this.itemsIndexArray.push({ item: 'AnnotationEditTool', startIndex: this.toolItems.length, endIndex: this.toolItems.length });
                        this.toolItems.push({ prefixIcon: 'e-pv-annotation-icon e-pv-icon', cssClass: 'e-pv-annotation-container', id: this.pdfViewer.element.id + '_annotation', text: this.pdfViewer.localeObj.getConstant('Annotation Edit text'), align: 'Right' });
                        break;
                    case 10:
                        this.itemsIndexArray.push({ item: 'RedactionEditTool', startIndex: this.toolItems.length, endIndex: this.toolItems.length });
                        this.toolItems.push({ prefixIcon: 'e-pv-redaction-icon e-pv-icon', cssClass: 'e-pv-redaction-container', id: this.pdfViewer.element.id + '_redaction', text: this.pdfViewer.localeObj.getConstant('Redaction'), align: 'Right' });
                        break;
                    case 11:
                        this.itemsIndexArray.push({ item: 'FormDesignerEditTool', startIndex: this.toolItems.length, endIndex: this.toolItems.length });
                        this.toolItems.push({ prefixIcon: 'e-pv-formdesigner-icon e-pv-icon', cssClass: 'e-pv-formdesigner-container', id: this.pdfViewer.element.id + '_formdesigner', text: this.pdfViewer.localeObj.getConstant('FormDesigner Edit text'), align: 'Right' });
                        break;
                    case 12:
                        this.itemsIndexArray.push({ item: 'PrintOption', startIndex: this.toolItems.length, endIndex: this.toolItems.length });
                        this.toolItems.push({ prefixIcon: 'e-pv-print-document-icon e-pv-icon', cssClass: 'e-pv-print-document-container', id: this.pdfViewer.element.id + '_print', text: this.pdfViewer.localeObj.getConstant('Print text'), align: 'Right' });
                        break;
                    case 13:
                        this.itemsIndexArray.push({ item: 'DownloadOption', startIndex: this.toolItems.length, endIndex: this.toolItems.length });
                        this.toolItems.push({ prefixIcon: 'e-pv-download-document-icon e-pv-icon', cssClass: 'e-pv-download-document-container', id: this.pdfViewer.element.id + '_download', text: this.pdfViewer.localeObj.getConstant('Download'), align: 'Right' });
                        break;
                }
                for (var k = 0; k < this.pdfViewer.toolbarSettings.toolbarItems.length; k++) {
                    if (defaultToolbarOrder[parseInt(i.toString(), 10)] ===
                        this.pdfViewer.toolbarSettings.toolbarItems[parseInt(k.toString(), 10)]) {
                        if (typeof (this.pdfViewer.toolbarSettings.toolbarItems[k + 1]) === 'object') {
                            this.createCustomItem(k + 1);
                        }
                        else {
                            break;
                        }
                    }
                }
            }
            return this.toolItems;
        };
        Toolbar.prototype.afterToolbarCreationInMobile = function () {
            this.itemsContainer = this.toolbar.element.childNodes[0];
            this.itemsContainer.id = this.pdfViewer.element.id + '_toolbarItemsContainer';
            this.openDocumentItem = this.addClassToolbarItem('_open', 'e-pv-open-document', this.pdfViewer.localeObj.getConstant('Open'));
            this.undoItem = this.addClassToolbarItem('_undo', 'e-pv-undo', this.pdfViewer.localeObj.getConstant('Undo'));
            this.redoItem = this.addClassToolbarItem('_redo', 'e-pv-redo', this.pdfViewer.localeObj.getConstant('Redo'));
            this.annotationItem = this.addClassToolbarItem('_annotation', 'e-pv-annotation', this.pdfViewer.localeObj.getConstant('Annotation'));
            this.redactionItem = this.addClassToolbarItem('_redaction', 'e-pv-redaction', this.pdfViewer.localeObj.getConstant('Redaction'));
            this.textSearchItem = this.addClassToolbarItem('_search', 'e-pv-text-search', this.pdfViewer.localeObj.getConstant('Text Search'));
        };
        Toolbar.prototype.afterToolbarCreation = function () {
            var isMac = /ipad|iphone|ipod|mac/.test(navigator.userAgent.toLowerCase()) ? true : false;
            this.itemsContainer = this.toolbar.element.childNodes[0];
            this.itemsContainer.id = this.pdfViewer.element.id + '_toolbarItemsContainer';
            this.openDocumentItem = this.addClassToolbarItem('_open', 'e-pv-open-document', this.pdfViewer.localeObj.getConstant('Open') + (isMac ? ' (⌘+O)' : ' (Ctrl+O)'));
            this.undoItem = this.addClassToolbarItem('_undo', 'e-pv-undo', this.pdfViewer.localeObj.getConstant('Undo') + (isMac ? ' (⌘+Z)' : ' (Ctrl+Z)'));
            this.redoItem = this.addClassToolbarItem('_redo', 'e-pv-redo', this.pdfViewer.localeObj.getConstant('Redo') + (isMac ? ' (⌘+Y)' : ' (Ctrl+Y)'));
            if (!this.pdfViewer.enableRtl) {
                this.firstPageItem = this.addClassToolbarItem('_firstPage', 'e-pv-first-page-navigation', this.pdfViewer.localeObj.getConstant('Go To First Page') + (isMac ? ' (⌘+← or ⌘+↑)' : ' (Ctrl+← or Ctrl+↑)'));
                this.previousPageItem = this.addClassToolbarItem('_previousPage', 'e-pv-previous-page-navigation', this.pdfViewer.localeObj.getConstant('Previous Page') + (' (←)'));
                this.nextPageItem = this.addClassToolbarItem('_nextPage', 'e-pv-next-page-navigation', this.pdfViewer.localeObj.getConstant('Next Page') + (' (→)'));
                this.lastPageItem = this.addClassToolbarItem('_lastPage', 'e-pv-last-page-navigation', this.pdfViewer.localeObj.getConstant('Go To Last Page') + (isMac ? ' (⌘+→ or ⌘+↓)' : ' (Ctrl+→ or Ctrl+↓)'));
            }
            else {
                this.firstPageItem = this.addClassToolbarItem('_firstPage', 'e-pv-last-page-navigation', this.pdfViewer.localeObj.getConstant('Go To First Page') + (isMac ? ' (⌘+← or ⌘+↑)' : ' (Ctrl+← or Ctrl+↑)'));
                this.previousPageItem = this.addClassToolbarItem('_previousPage', 'e-pv-next-page-navigation', this.pdfViewer.localeObj.getConstant('Previous Page') + (' (←)'));
                this.nextPageItem = this.addClassToolbarItem('_nextPage', 'e-pv-previous-page-navigation', this.pdfViewer.localeObj.getConstant('Next Page') + (' (→)'));
                this.lastPageItem = this.addClassToolbarItem('_lastPage', 'e-pv-first-page-navigation', this.pdfViewer.localeObj.getConstant('Go To Last Page') + (isMac ? ' (⌘+→ or ⌘+↓)' : ' (Ctrl+→ or Ctrl+↓)'));
            }
            this.zoomOutItem = this.addClassToolbarItem('_zoomOut', 'e-pv-zoom-out', this.pdfViewer.localeObj.getConstant('Zoom Out') + (isMac ? ' (⌘+Minus)' : ' (Ctrl+Minus)'));
            this.zoomInItem = this.addClassToolbarItem('_zoomIn', 'e-pv-zoom-in', this.pdfViewer.localeObj.getConstant('Zoom In') + (isMac ? ' (⌘+Plus)' : ' (Ctrl+Plus)'));
            this.textSelectItem = this.addClassToolbarItem('_selectTool', 'e-pv-text-select-tool', this.pdfViewer.localeObj.getConstant('Text Selection') + (isMac ? ' (⇧+V)' : ' (Shift+V)'));
            this.panItem = this.addClassToolbarItem('_handTool', 'e-pv-pan-tool', this.pdfViewer.localeObj.getConstant('Panning') + (isMac ? ' (⇧+H)' : ' (Shift+H)'));
            this.commentItem = this.addClassToolbarItem('_comment', 'e-pv-comment', this.pdfViewer.localeObj.getConstant('Add Comments'));
            this.textSearchItem = this.addClassToolbarItem('_search', 'e-pv-text-search', this.pdfViewer.localeObj.getConstant('Text Search') + (isMac ? ' (⌘+F)' : ' (Ctrl+F)'));
            this.textSearchItem.setAttribute('aria-label', this.pdfViewer.localeObj.getConstant('Search text'));
            this.annotationItem = this.addClassToolbarItem('_annotation', 'e-pv-annotation', this.pdfViewer.localeObj.getConstant('Annotation') + (isMac ? ' (⌘+⇧+A)' : ' (Ctrl+Shift+A)'));
            this.annotationItem.setAttribute('aria-label', this.pdfViewer.localeObj.getConstant('Annotation Edit text'));
            this.formDesignerItem = this.addClassToolbarItem('_formdesigner', 'e-pv-formdesigner', this.pdfViewer.localeObj.getConstant('FormDesigner'));
            this.redactionItem = this.addClassToolbarItem('_redaction', 'e-pv-redaction', this.pdfViewer.localeObj.getConstant('Redaction'));
            this.printItem = this.addClassToolbarItem('_print', 'e-pv-print-document', this.pdfViewer.localeObj.getConstant('Print') + (isMac ? ' (⌘+P)' : ' (Ctrl+P)'));
            this.downloadItem = this.addClassToolbarItem('_download', 'e-pv-download-document', this.pdfViewer.localeObj.getConstant('Download file') + (isMac ? ' (⌘+S)' : ' (Ctrl+S)'));
            this.zoomDropdownItem = this.pdfViewerBase.getElement('_zoomDropDown');
            this.createTooltip(this.zoomDropdownItem, this.pdfViewer.localeObj.getConstant('Zoom'));
            this.zoomDropdownItem.setAttribute('aria-label', this.pdfViewer.localeObj.getConstant('Zoom'));
            this.addPropertiesToolItemContainer(this.zoomDropdownItem.parentElement.parentElement, null, '_zoomDropDownContainer');
            this.createTooltip(this.currentPageBoxElement, this.pdfViewer.localeObj.getConstant('Page Number') + (isMac ? ' (⌘+G)' : ' (Ctrl+G)'));
            this.currentPageBoxElement.setAttribute('aria-label', this.pdfViewer.localeObj.getConstant('Page Number'));
            this.submitItem = this.pdfViewerBase.getElement('_submitForm');
            this.addPropertiesToolItemContainer(this.submitItem.parentElement, 'e-pv-submit', '_submitFormContainer');
            this.createTooltip(this.submitItem, this.pdfViewer.localeObj.getConstant('SubmitForm'));
            this.submitItem.setAttribute('aria-label', this.pdfViewer.localeObj.getConstant('SubmitForm'));
            this.addPropertiesToolItemContainer(this.currentPageBoxElement.parentElement.parentElement, 'e-pv-current-page-container', '_currentPageInputContainer');
            this.pdfViewerBase.getElement('_currentPageInputContainer').style.minWidth = '20px';
            this.totalPageItem = this.pdfViewerBase.getElement('_totalPage');
            this.addPropertiesToolItemContainer(this.totalPageItem.parentElement, 'e-pv-total-page-container', '_totalPageContainer');
            this.createCustomItemTooltip();
        };
        Toolbar.prototype.createCustomItemTooltip = function () {
            for (var x = 0; x < this.pdfViewer.toolbarSettings.toolbarItems.length; x++) {
                var toolbarItem = this.pdfViewer.toolbarSettings.toolbarItems[parseInt(x.toString(), 10)];
                var id = void 0;
                if (typeof (toolbarItem) === 'object' && toolbarItem.tooltipText) {
                    if (toolbarItem.template) {
                        var match = void 0;
                        if (typeof toolbarItem.template === 'string') {
                            match = toolbarItem.template.match(/id="([^"]+)"/);
                            id = match ? match[1] : null;
                        }
                        else if (toolbarItem.template instanceof HTMLElement) {
                            id = (toolbarItem.template.id ? toolbarItem.template.id : (toolbarItem.id ? toolbarItem.id : null));
                        }
                    }
                    else {
                        id = toolbarItem.id;
                    }
                    if (id) {
                        var element = document.getElementById(id);
                        if (element) {
                            element.title = '';
                            element.parentElement.title = '';
                            element.classList.add('e-popup-text', 'e-pv-tbar-btn');
                            this.createTooltip(element, toolbarItem.tooltipText);
                            if (toolbarItem.template) {
                                var styles = window.getComputedStyle(element);
                                element.style.color = styles.color;
                            }
                        }
                    }
                }
            }
        };
        Toolbar.prototype.addClassToolbarItem = function (idString, className, tooltipText) {
            var element = this.pdfViewerBase.getElement(idString);
            element.classList.add(className);
            element.classList.add('e-pv-tbar-btn');
            element.setAttribute('aria-label', tooltipText);
            element.parentElement.classList.add(className + '-container');
            element.parentElement.classList.add('e-popup-text');
            element.parentElement.id = this.pdfViewer.element.id + idString + 'Container';
            if (element.childNodes.length > 0) {
                var spanElement = element.childNodes[0];
                spanElement.id = this.pdfViewer.element.id + idString + 'Icon';
                spanElement.classList.remove('e-icons');
                spanElement.classList.remove('e-btn-icon');
                if (this.pdfViewer.enableRtl) {
                    spanElement.classList.add('e-right');
                }
                var textElement = element.childNodes[1];
                if (textElement) {
                    if (textElement.classList.contains('e-tbar-btn-text')) {
                        textElement.id = this.pdfViewer.element.id + idString + 'Text';
                    }
                }
            }
            element.style.width = '';
            this.createTooltip(element, tooltipText);
            return element;
        };
        Toolbar.prototype.addPropertiesToolItemContainer = function (element, className, idString) {
            if (className !== null) {
                element.classList.add(className);
            }
            element.classList.add('e-popup-text');
            element.id = this.pdfViewer.element.id + idString;
        };
        Toolbar.prototype.createZoomDropdownElement = function () {
            var zoomDropdownElement = this.createToolbarItem('input', this.pdfViewer.element.id + '_zoomDropDown', null);
            return zoomDropdownElement.outerHTML;
        };
        Toolbar.prototype.createZoomDropdown = function () {
            var proxy = this;
            var minZoom = proxy.pdfViewer.minZoom;
            var maxZoom = proxy.pdfViewer.maxZoom;
            var items = [];
            var zoomValues = [10, 25, 50, 75, 100, 125, 150, 200, 400];
            if (minZoom != null && maxZoom != null && minZoom > maxZoom) {
                var tempZoomValue = maxZoom;
                maxZoom = minZoom;
                minZoom = tempZoomValue;
            }
            if (minZoom != null || maxZoom != null) {
                var isWithinRange = function (zoom) {
                    return (minZoom == null || zoom >= minZoom) && (maxZoom == null || zoom <= maxZoom);
                };
                var idCounter = 0;
                if (minZoom != null && !items.some(function (item) { return parseInt(item.id, 10) === minZoom; })) {
                    items.push({ percent: minZoom + '%', id: idCounter.toString() });
                    idCounter++;
                }
                for (var i = 0; i < zoomValues.length; i++) {
                    var zoom = zoomValues[parseInt(i.toString(), 10)];
                    if (isWithinRange(zoom) && zoom !== minZoom && zoom !== maxZoom) {
                        items.push({ percent: zoom + '%', id: idCounter.toString() });
                        idCounter++;
                    }
                }
                if (maxZoom != null && !items.some(function (item) { return parseInt(item.id, 10) === maxZoom; }) && maxZoom !== minZoom) {
                    items.push({ percent: maxZoom + '%', id: idCounter.toString() });
                    idCounter++;
                }
                items.sort(function (a, b) { return parseInt(a.id, 10) - parseInt(b.id, 10); });
            }
            else {
                items.push({ percent: '10%', id: '0' }, { percent: '35%', id: '1' }, { percent: '50%', id: '2' }, { percent: '75%', id: '3' }, { percent: '100%', id: '4' }, { percent: '125%', id: '5' }, { percent: '150%', id: '6' }, { percent: '200%', id: '7' }, { percent: '400%', id: '8' });
            }
            items.push({ percent: proxy.pdfViewer.localeObj.getConstant('Fit Page'), id: 'fitPage' }, { percent: proxy.pdfViewer.localeObj.getConstant('Fit Width'), id: 'fitWidth' }, { percent: proxy.pdfViewer.localeObj.getConstant('Automatic'), id: 'automatic' });
            if (!proxy.updateZoomDropDown) {
                if (!proxy.pdfViewer.enableRtl) {
                    proxy.zoomDropDown = new ej2_dropdowns_1.ComboBox({
                        dataSource: items, text: '100%', fields: { text: 'percent', value: 'id' }, readonly: true, cssClass: 'e-pv-zoom-drop-down', popupHeight: '450px', showClearButton: false, open: proxy.openZoomDropdown.bind(proxy), select: function (args) {
                            if (args.e.type === 'keydown' && args.itemData.percent !== proxy.zoomDropDown.element.value) {
                                proxy.zoomDropDownChange(proxy.zoomDropDown.element.value);
                                args.cancel = true;
                            }
                        }
                    });
                }
                else {
                    proxy.zoomDropDown = new ej2_dropdowns_1.ComboBox({
                        dataSource: items, text: '100%', enableRtl: true, fields: { text: 'percent', value: 'id' }, readonly: true, cssClass: 'e-pv-zoom-drop-down-rtl', popupHeight: '450px', showClearButton: false, open: proxy.openZoomDropdown.bind(proxy), select: function (args) {
                            if (args.e.type === 'keydown' && args.itemData.percent !== proxy.zoomDropDown.element.value) {
                                proxy.zoomDropDownChange(proxy.zoomDropDown.element.value);
                                args.cancel = true;
                            }
                        }
                    });
                }
                proxy.zoomDropDown.appendTo(proxy.pdfViewerBase.getElement('_zoomDropDown'));
            }
            else {
                if (proxy.zoomDropDown) {
                    proxy.zoomDropDown.dataSource = items;
                    proxy.zoomDropDown.dataBind();
                    var updateValue = items.find(function (i) { return i.percent === proxy.zoomFactor * 100 + '%'; });
                    proxy.zoomDropDown.value = updateValue ? updateValue.id : null;
                }
            }
        };
        Toolbar.prototype.createCurrentPageInputTemplate = function () {
            var goToPageElement = this.createToolbarItem('input', this.pdfViewer.element.id + '_currentPageInput', null);
            return goToPageElement.outerHTML;
        };
        Toolbar.prototype.createTotalPageTemplate = function () {
            var totalPageElement = this.createToolbarItem('span', this.pdfViewer.element.id + '_totalPage', 'e-pv-total-page');
            return totalPageElement.outerHTML;
        };
        Toolbar.prototype.createNumericTextBox = function () {
            this.currentPageBox = new ej2_inputs_1.NumericTextBox({ value: 0, format: '##', cssClass: 'e-pv-current-page-box', showSpinButton: false });
            this.currentPageBoxElement = this.pdfViewerBase.getElement('_currentPageInput');
            this.currentPageBox.appendTo(this.currentPageBoxElement);
        };
        Toolbar.prototype.createToolbarItemsForMobile = function () {
            this.toolbarElement.classList.add('e-pv-mobile-toolbar');
            var template = '<button id="' + this.pdfViewer.element.id + '_more_option" class="e-tbar-btn"></button>';
            this.toolbar = new ej2_navigations_1.Toolbar({
                items: [{ prefixIcon: 'e-pv-open-document-icon e-pv-icon', tooltipText: this.pdfViewer.localeObj.getConstant('Open'), id: this.pdfViewer.element.id + '_open' },
                    { type: 'Separator', align: 'Left' },
                    { prefixIcon: 'e-pv-undo-icon e-pv-icon', tooltipText: this.pdfViewer.localeObj.getConstant('Undo'), id: this.pdfViewer.element.id + '_undo' },
                    { prefixIcon: 'e-pv-redo-icon e-pv-icon', tooltipText: this.pdfViewer.localeObj.getConstant('Redo'), id: this.pdfViewer.element.id + '_redo' },
                    {
                        tooltipText: 'Organize PDF', id: this.pdfViewer.element.id + '_menu_organize',
                        prefixIcon: 'e-pv-organize-view-icon e-pv-icon', align: 'Right',
                        disabled: true
                    },
                    { prefixIcon: 'e-pv-annotation-icon e-pv-icon', cssClass: 'e-pv-annotation-container', tooltipText: this.pdfViewer.localeObj.getConstant('Annotation'), id: this.pdfViewer.element.id + '_annotation', align: 'Right' },
                    { prefixIcon: 'e-pv-redaction-icon e-pv-icon', cssClass: 'e-pv-redaction-container', tooltipText: this.pdfViewer.localeObj.getConstant('Redaction'), id: this.pdfViewer.element.id + '_redaction', align: 'Right' },
                    { prefixIcon: 'e-pv-text-search-icon e-pv-icon', tooltipText: this.pdfViewer.localeObj.getConstant('Text Search'), id: this.pdfViewer.element.id + '_search', align: 'Right' },
                    { template: template, align: 'Right' }
                ], clicked: this.toolbarClickHandler, width: '', height: '', overflowMode: 'Popup'
            });
            this.toolbar.isStringTemplate = true;
            this.toolbar.appendTo(this.toolbarElement);
            this.openDocumentItem = this.pdfViewerBase.getElement('_open');
            this.openDocumentItem.classList.add('e-pv-open-document');
            this.openDocumentItem.firstElementChild.id = this.pdfViewer.element.id + '_openIcon';
            this.annotationItem = this.pdfViewerBase.getElement('_annotation');
            this.annotationItem.classList.add('e-pv-annotation');
            this.annotationItem.firstElementChild.id = this.pdfViewer.element.id + '_annotationIcon';
            this.redactionItem = this.pdfViewerBase.getElement('_redaction');
            this.redactionItem.classList.add('e-pv-redaction');
            this.redactionItem.firstElementChild.id = this.pdfViewer.element.id + '_redactionIcon';
            this.organizePageItem = this.pdfViewerBase.getElement('_menu_organize');
            this.organizePageItem.classList.add('e-pv-organize-view');
            this.annotationItem.firstElementChild.id = this.pdfViewer.element.id + '_organize-view' + '_icon';
            this.textSearchItem = this.pdfViewerBase.getElement('_search');
            this.textSearchItem.classList.add('e-pv-text-search');
            this.textSearchItem.firstElementChild.id = this.pdfViewer.element.id + '_searchIcon';
            this.undoItem = this.pdfViewerBase.getElement('_undo');
            this.undoItem.classList.add('e-pv-undo');
            this.redoItem = this.pdfViewerBase.getElement('_redo');
            this.redoItem.classList.add('e-pv-redo');
            this.redoItem.firstElementChild.id = this.pdfViewer.element.id + '_redoIcon';
            this.undoItem.firstElementChild.id = this.pdfViewer.element.id + '_undoIcon';
            this.createMoreOption(this.pdfViewer.element.id + '_more_option');
        };
        Toolbar.prototype.createMoreOption = function (idString) {
            var _this = this;
            this.moreOptionItem = document.getElementById(idString);
            var items = [
                {
                    text: this.pdfViewer.localeObj.getConstant('Download'), id: this.pdfViewer.element.id + '_menu_download',
                    iconCss: 'e-icons e-pv-download-document-icon e-pv-icon'
                },
                {
                    text: this.pdfViewer.localeObj.getConstant('Bookmarks'), id: this.pdfViewer.element.id + '_menu_bookmarks',
                    iconCss: 'e-icons e-pv-bookmark-icon e-pv-icon'
                }
            ];
            this.moreDropDown = new ej2_splitbuttons_1.DropDownButton({
                items: items, iconCss: 'e-pv-more-icon e-pv-icon', cssClass: 'e-caret-hide',
                open: function (args) {
                    var dropdownButtonPosition = _this.moreDropDown.element.getBoundingClientRect();
                    if (!_this.pdfViewer.enableRtl) {
                        args.element.parentElement.style.left = dropdownButtonPosition.left + dropdownButtonPosition.width - args.element.parentElement.offsetWidth + 'px';
                    }
                }, select: function (args) {
                    switch (args.item.id) {
                        case _this.pdfViewer.element.id + '_menu_download':
                            _this.pdfViewerBase.download();
                            break;
                        case _this.pdfViewer.element.id + '_menu_bookmarks':
                            if (_this.pdfViewerBase.navigationPane) {
                                _this.pdfViewerBase.navigationPane.showBookmarksPaneMobile();
                            }
                            break;
                        default:
                            break;
                    }
                }, beforeItemRender: function (args) {
                    if (args.item.id === _this.pdfViewer.element.id + '_menu_bookmarks') {
                        if (!_this.pdfViewer.bookmarkViewModule || !_this.pdfViewer.bookmarkViewModule.bookmarks) {
                            args.element.classList.add('e-disabled');
                        }
                        else {
                            args.element.classList.remove('e-disabled');
                        }
                    }
                    else if (args.item.id === _this.pdfViewer.element.id + '_menu_download') {
                        if (!_this.pdfViewer.enableDownload) {
                            args.element.classList.add('e-disabled');
                        }
                        else {
                            args.element.classList.remove('e-disabled');
                        }
                    }
                }, close: function (args) {
                    _this.moreOptionItem.blur();
                    _this.pdfViewerBase.focusViewerContainer();
                }
            });
            this.moreDropDown.appendTo('#' + idString);
        };
        Toolbar.prototype.createToolbarItem = function (elementName, id, className) {
            var toolbarItem = ej2_base_1.createElement(elementName, { id: id });
            if (className !== null) {
                toolbarItem.className = className;
            }
            if (elementName === 'input' && id !== this.pdfViewer.element.id + '_zoomDropDown') {
                toolbarItem.type = 'text';
            }
            return toolbarItem;
        };
        Toolbar.prototype.createTooltip = function (toolbarItem, tooltipText) {
            if (tooltipText !== null) {
                var tooltip = new ej2_popups_1.Tooltip({
                    content: ej2_base_1.initializeCSPTemplate(function () { return tooltipText; }), opensOn: 'Hover', beforeOpen: this.onTooltipBeforeOpen.bind(this)
                });
                tooltip.appendTo(toolbarItem);
            }
        };
        Toolbar.prototype.onTooltipBeforeOpen = function (args) {
            if (!this.pdfViewer.toolbarSettings.showTooltip && this.toolbarElement.contains(args.target)) {
                args.cancel = true;
            }
            if (this.annotationToolbarModule) {
                if (!this.pdfViewer.toolbarSettings.showTooltip && ((this.annotationToolbarModule.toolbarElement &&
                    this.annotationToolbarModule.toolbarElement.contains(args.target)) ||
                    (this.annotationToolbarModule.shapeToolbarElement &&
                        this.annotationToolbarModule.shapeToolbarElement.contains(args.target)))) {
                    args.cancel = true;
                }
            }
            if (this.formDesignerToolbarModule) {
                if (!this.pdfViewer.toolbarSettings.showTooltip && (this.formDesignerToolbarModule.toolbarElement &&
                    this.formDesignerToolbarModule.toolbarElement.contains(args.target))) {
                    args.cancel = true;
                }
            }
        };
        Toolbar.prototype.createFileElement = function (toolbarElement) {
            if (toolbarElement) {
                if (!ej2_base_1.isBlazor()) {
                    this.fileInputElement = ej2_base_1.createElement('input', { id: this.pdfViewer.element.id + '_fileUploadElement', styles: 'position:fixed; left:-100em', attrs: { 'type': 'file' } });
                    this.fileInputElement.setAttribute('accept', '.pdf');
                    this.fileInputElement.setAttribute('aria-label', 'file upload element');
                    this.fileInputElement.setAttribute('tabindex', '-1');
                }
                else {
                    this.fileInputElement = this.pdfViewer.element.querySelector('.e-pv-fileupload-element');
                }
                if (toolbarElement) {
                    toolbarElement.appendChild(this.fileInputElement);
                }
            }
        };
        Toolbar.prototype.wireEvent = function () {
            if (this.fileInputElement) {
                this.fileInputElement.addEventListener('change', this.loadDocument);
            }
            if (!ej2_base_1.isBlazor()) {
                if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                    this.toolbarElement.addEventListener('mouseup', this.toolbarOnMouseup.bind(this));
                    this.currentPageBoxElement.addEventListener('focusout', this.textBoxFocusOut);
                    this.currentPageBoxElement.addEventListener('keypress', this.navigateToPage);
                    this.zoomDropDown.change = this.zoomPercentSelect.bind(this);
                    this.zoomDropDown.element.addEventListener('keypress', this.onZoomDropDownInput.bind(this));
                    this.zoomDropDown.element.addEventListener('click', this.onZoomDropDownInputClick.bind(this));
                }
            }
        };
        Toolbar.prototype.unWireEvent = function () {
            if (this.fileInputElement) {
                this.fileInputElement.removeEventListener('change', this.loadDocument);
            }
            if ((!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) && !ej2_base_1.isBlazor()) {
                if (!ej2_base_1.isNullOrUndefined(this.toolbarElement)) {
                    this.toolbarElement.removeEventListener('mouseup', this.toolbarOnMouseup.bind(this));
                }
                if (!ej2_base_1.isNullOrUndefined(this.currentPageBoxElement)) {
                    this.currentPageBoxElement.removeEventListener('focusout', this.textBoxFocusOut);
                    this.currentPageBoxElement.removeEventListener('keypress', this.navigateToPage);
                }
                if (!ej2_base_1.isNullOrUndefined(this.zoomDropDown)) {
                    this.zoomDropDown.removeEventListener('change', this.zoomPercentSelect);
                    this.zoomDropDown.element.removeEventListener('keypress', this.onZoomDropDownInput);
                    this.zoomDropDown.element.removeEventListener('click', this.onZoomDropDownInputClick);
                }
            }
        };
        Toolbar.prototype.onToolbarResize = function (viewerWidth) {
            if (ej2_base_1.Browser.isDevice && !this.pdfViewer.enableDesktopMode) {
                this.pdfViewerBase.navigationPane.toolbarResize();
            }
            else {
                if (!ej2_base_1.isNullOrUndefined(this.toolbar)) {
                    this.toolbar.refreshOverflow();
                }
            }
        };
        Toolbar.prototype.toolbarOnMouseup = function (event) {
            if (event.target === this.itemsContainer || event.target === this.toolbarElement) {
                this.pdfViewerBase.focusViewerContainer();
            }
        };
        Toolbar.prototype.applyHideToToolbar = function (show, startIndex, endIndex) {
            var isHide = !show;
            for (var index = startIndex; index <= endIndex; index++) {
                if (!ej2_base_1.isNullOrUndefined(this.toolbar) && this.toolbar.items[parseInt(index.toString(), 10)]) {
                    var className = this.toolbar.items[parseInt(index.toString(), 10)].cssClass;
                    if (className && className !== '') {
                        var element = this.toolbar.element.querySelector('.' + className);
                        if (element) {
                            this.toolbar.hideItem(element, isHide);
                        }
                    }
                    else {
                        this.toolbar.hideItem(index, isHide);
                    }
                }
            }
        };
        Toolbar.prototype.handleOpenIconClick = function (args, isKeyBoardEvent) {
            this.fileInputElement.click();
            if (ej2_base_1.Browser.isDevice && !this.pdfViewer.enableDesktopMode && !isKeyBoardEvent) {
                if (!ej2_base_1.isBlazor()) {
                    args.originalEvent.target.blur();
                }
                this.pdfViewerBase.focusViewerContainer();
            }
        };
        Toolbar.prototype.handleToolbarBtnClick = function (args, isKeyBoardEvent) {
            this.addInkAnnotation();
            this.deSelectCommentAnnotation();
            switch (args.originalEvent.target.id || (!ej2_base_1.isNullOrUndefined(args.item) &&
                args.item.id)) {
                case this.pdfViewer.element.id + '_open':
                case this.pdfViewer.element.id + '_openIcon':
                case this.pdfViewer.element.id + '_openText':
                    this.handleOpenIconClick(args, isKeyBoardEvent);
                    break;
                case this.pdfViewer.element.id + '_download':
                case this.pdfViewer.element.id + '_downloadIcon':
                case this.pdfViewer.element.id + '_downloadText':
                    this.pdfViewerBase.download();
                    break;
                case this.pdfViewer.element.id + '_print':
                case this.pdfViewer.element.id + '_printIcon':
                case this.pdfViewer.element.id + '_printText':
                    if (this.pdfViewer.printModule) {
                        this.pdfViewer.firePrintStart();
                    }
                    break;
                case this.pdfViewer.element.id + '_undo':
                case this.pdfViewer.element.id + '_undoIcon':
                case this.pdfViewer.element.id + '_undoText':
                    if (this.pdfViewer.annotationModule) {
                        this.pdfViewer.annotationModule.undo();
                    }
                    break;
                case this.pdfViewer.element.id + '_redo':
                case this.pdfViewer.element.id + '_redoIcon':
                case this.pdfViewer.element.id + '_redoText':
                    if (this.pdfViewer.annotationModule) {
                        this.pdfViewer.annotationModule.redo();
                    }
                    break;
                case this.pdfViewer.element.id + '_firstPage':
                case this.pdfViewer.element.id + '_firstPageIcon':
                case this.pdfViewer.element.id + '_firstPageText':
                    if (this.pdfViewer.navigationModule) {
                        this.pdfViewer.navigationModule.goToFirstPage();
                    }
                    break;
                case this.pdfViewer.element.id + '_previousPage':
                case this.pdfViewer.element.id + '_previousPageIcon':
                case this.pdfViewer.element.id + '_previousPageText':
                    if (this.pdfViewer.navigationModule) {
                        this.pdfViewer.navigationModule.goToPreviousPage();
                    }
                    break;
                case this.pdfViewer.element.id + '_nextPage':
                case this.pdfViewer.element.id + '_nextPageIcon':
                case this.pdfViewer.element.id + '_nextPageText':
                    if (this.pdfViewer.navigationModule) {
                        this.pdfViewer.navigationModule.goToNextPage();
                    }
                    break;
                case this.pdfViewer.element.id + '_lastPage':
                case this.pdfViewer.element.id + '_lastPageIcon':
                case this.pdfViewer.element.id + '_lastPageText':
                    if (this.pdfViewer.navigationModule) {
                        this.pdfViewer.navigationModule.goToLastPage();
                    }
                    break;
                case this.pdfViewer.element.id + '_zoomIn':
                case this.pdfViewer.element.id + '_zoomInIcon':
                case this.pdfViewer.element.id + '_zoomInText':
                    this.pdfViewer.magnificationModule.zoomIn();
                    break;
                case this.pdfViewer.element.id + '_zoomOut':
                case this.pdfViewer.element.id + '_zoomOutIcon':
                case this.pdfViewer.element.id + '_zoomOutText':
                    this.pdfViewer.magnificationModule.zoomOut();
                    break;
                case this.pdfViewer.element.id + '_selectTool':
                case this.pdfViewer.element.id + '_selectToolIcon':
                case this.pdfViewer.element.id + '_selectToolText':
                    if (!this.isSelectionToolDisabled) {
                        this.pdfViewerBase.initiateTextSelectMode();
                        this.updateInteractionTools(true);
                        this.annotationToolbarModule.selectAnnotationDeleteItem(true);
                    }
                    break;
                case this.pdfViewer.element.id + '_handTool':
                case this.pdfViewer.element.id + '_handToolIcon':
                case this.pdfViewer.element.id + '_handToolText':
                    if (!(this.isScrollingToolDisabled || this.getStampMode())) {
                        this.pdfViewerBase.initiatePanning();
                        this.updateInteractionTools(false);
                        this.annotationToolbarModule.selectAnnotationDeleteItem(true);
                    }
                    break;
                case this.pdfViewer.element.id + '_search':
                case this.pdfViewer.element.id + '_searchIcon':
                case this.pdfViewer.element.id + '_searchText':
                    this.textSearchButtonHandler();
                    break;
                case this.pdfViewer.element.id + '_annotation':
                case this.pdfViewer.element.id + '_annotationIcon':
                case this.pdfViewer.element.id + '_annotationText':
                    this.initiateAnnotationMode(args.originalEvent.target.id, isKeyBoardEvent);
                    break;
                case this.pdfViewer.element.id + '_redaction':
                case this.pdfViewer.element.id + '_redactionIcon':
                case this.pdfViewer.element.id + '_redactionText':
                    this.initiateRedactionMode(args.originalEvent.target.id, isKeyBoardEvent);
                    break;
                case this.pdfViewer.element.id + '_formdesigner':
                case this.pdfViewer.element.id + '_formdesignerIcon':
                case this.pdfViewer.element.id + '_formdesignerText':
                    this.initiateFormDesignerMode(isKeyBoardEvent);
                    this.formDesignerToolbarModule.showHideDeleteIcon(false);
                    break;
                case this.pdfViewer.element.id + '_comment':
                case this.pdfViewer.element.id + '_commentIcon':
                case this.pdfViewer.element.id + '_commentText':
                    this.pdfViewerBase.isAddComment = true;
                    this.pdfViewerBase.isCommentIconAdded = true;
                    this.annotationToolbarModule.deselectAllItems();
                    this.pdfViewer.annotation.triggerAnnotationUnselectEvent();
                    this.pdfViewer.annotation.triggerSignatureUnselectEvent();
                    this.addComments(args.originalEvent.target);
                    break;
                case this.pdfViewer.element.id + '_submitForm':
                case this.pdfViewer.element.id + '_submitFormSpan': {
                    var data = void 0;
                    this.pdfViewerBase.exportFormFields(data, types_1.FormFieldDataFormat.Json);
                    break;
                }
                case this.pdfViewer.element.id + '_menu_organize':
                    if (!ej2_base_1.isNullOrUndefined(this.pdfViewer.pageOrganizer)) {
                        this.pdfViewer.pageOrganizer.createOrganizeWindowForMobile();
                    }
                    break;
                default:
                    this.pdfViewer.fireCustomToolbarClickEvent(args);
                    break;
            }
        };
        Toolbar.prototype.addInkAnnotation = function () {
            if (this.pdfViewer.annotationModule && this.pdfViewer.annotationModule.inkAnnotationModule) {
                var currentPageNumber = parseInt(this.pdfViewer.annotationModule.inkAnnotationModule.currentPageNumber, 10);
                this.pdfViewer.annotationModule.inkAnnotationModule.drawInkAnnotation(currentPageNumber);
            }
            if (this.annotationToolbarModule) {
                this.pdfViewer.toolbar.annotationToolbarModule.deselectInkAnnotation();
                this.annotationToolbarModule.inkAnnotationSelected = false;
            }
        };
        Toolbar.prototype.deSelectCommentAnnotation = function () {
            if (!ej2_base_1.isBlazor()) {
                this.pdfViewer.toolbar.deSelectItem(this.commentItem);
            }
            else {
                this.pdfViewer.toolbar.deSelectItem(this.CommentElement);
            }
            this.pdfViewerBase.isCommentIconAdded = false;
        };
        Toolbar.prototype.addComments = function (targetElement) {
            if (!ej2_base_1.isBlazor()) {
                if (targetElement.id === this.pdfViewer.element.id + '_comment' || targetElement.id === this.pdfViewer.element.id + '_commentIcon' || targetElement.id === this.pdfViewer.element.id + '_commentText') {
                    if ((targetElement.id === this.pdfViewer.element.id + '_commentIcon' || targetElement.id === this.pdfViewer.element.id + '_commentText') && targetElement.parentElement) {
                        targetElement.parentElement.classList.add('e-pv-select');
                    }
                    else {
                        targetElement.classList.add('e-pv-select');
                    }
                }
                else {
                    if (this.pdfViewer.enableRtl) {
                        targetElement.className = 'e-pv-comment-selection-icon e-pv-icon e-icon-left e-right';
                    }
                    else {
                        targetElement.className = 'e-pv-comment-selection-icon e-pv-icon e-icon-left';
                    }
                }
            }
            else {
                this.pdfViewerBase.isCommentIconAdded = true;
                this.pdfViewerBase.isAddComment = true;
                this.annotationToolbarModule.deselectAllItemsInBlazor();
                var commentsButton = this.CommentElement;
                commentsButton.classList.add('e-pv-select');
            }
            this.updateStampItems();
            document.getElementById(this.pdfViewer.element.id + '_pageDiv_' + (this.pdfViewerBase.currentPageNumber - 1)).addEventListener('mousedown', this.pdfViewer.annotationModule.stickyNotesAnnotationModule.drawIcons.bind(this));
        };
        Toolbar.prototype.openZoomDropdown = function () {
            var toolbarData = this;
            if (document.fullscreen) {
                if (ej2_base_1.isBlazor()) {
                    var fullscreenElement = document.fullscreenElement;
                    if (fullscreenElement && fullscreenElement.tagName !== 'BODY' && fullscreenElement.tagName !== 'HTML') {
                        setTimeout(function () {
                            var popupElement = document.getElementById(toolbarData.pdfViewer.element.id + '_zoomCombo_popup');
                            var targetElement = document.getElementById(toolbarData.toolbarElement.id);
                            if (popupElement && targetElement && popupElement.ej2_instances) {
                                targetElement.appendChild(popupElement);
                                popupElement.ej2_instances[0].refreshPosition();
                            }
                        }, 100);
                    }
                }
                else {
                    var popupElement = document.getElementById(this.pdfViewer.element.id + '_zoomDropDown_popup');
                    var targetElement = document.getElementById(this.toolbarElement.id);
                    if (popupElement) {
                        targetElement.appendChild(popupElement);
                    }
                }
            }
        };
        Toolbar.prototype.onZoomDropDownInput = function (event) {
            var isDigit = event.key >= '0' && event.key <= '9';
            var allowedKeys = ['Backspace', 'Enter', ' '];
            if (!isDigit && allowedKeys.indexOf(event.key) === -1) {
                event.preventDefault();
                return false;
            }
            else {
                if (event.key === 'Enter' || event.code === 'Enter') {
                    event.preventDefault();
                    var value = this.zoomDropDown.element.value.trim();
                    this.zoomDropDownChange(value);
                }
                return true;
            }
        };
        Toolbar.prototype.onZoomDropDownInputClick = function () {
            this.zoomDropDown.element.select();
        };
        Toolbar.prototype.zoomPercentSelect = function (args) {
            if (this.pdfViewerBase.pageCount > 0) {
                if (args.isInteracted) {
                    if (args.itemData) {
                        var zoomText = args.itemData.percent;
                        this.zoomDropDownChange(zoomText);
                    }
                }
                else {
                    this.updateZoomPercentage(this.pdfViewer.magnificationModule.zoomFactor);
                }
            }
        };
        Toolbar.prototype.zoomDropDownChange = function (zoomText) {
            var _this = this;
            if (zoomText !== this.pdfViewer.localeObj.getConstant('Fit Width') && zoomText !== this.pdfViewer.localeObj.getConstant('Fit Page') && zoomText !== this.pdfViewer.localeObj.getConstant('Automatic')) {
                this.pdfViewer.magnificationModule.isAutoZoom = false;
                this.pdfViewerBase.previousScrollbarWidth = this.pdfViewerBase.navigationPane.getViewerContainerScrollbarWidth();
                this.pdfViewer.magnificationModule.zoomTo(parseFloat(zoomText));
                this.updateZoomPercentage(this.pdfViewer.magnificationModule.zoomFactor);
                setTimeout(function () {
                    _this.zoomDropDown.focusOut();
                });
            }
            else if (zoomText === this.pdfViewer.localeObj.getConstant('Fit Width')) {
                this.pdfViewer.magnificationModule.isAutoZoom = false;
                this.pdfViewer.magnificationModule.fitToWidth();
                setTimeout(function () {
                    _this.zoomDropDown.focusOut();
                });
            }
            else if (zoomText === this.pdfViewer.localeObj.getConstant('Fit Page')) {
                this.pdfViewer.magnificationModule.fitToPage();
                setTimeout(function () {
                    _this.zoomDropDown.focusOut();
                });
            }
            else if (zoomText === this.pdfViewer.localeObj.getConstant('Automatic')) {
                this.pdfViewer.magnificationModule.isAutoZoom = true;
                this.pdfViewer.magnificationModule.fitToAuto();
                setTimeout(function () {
                    _this.zoomDropDown.focusOut();
                });
            }
        };
        Toolbar.prototype.updateZoomPercentage = function (zoomFactor) {
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                var currentPercent = parseInt((zoomFactor * 100).toString(), 10) + '%';
                if (ej2_base_1.isBlazor()) {
                    var blazorZoomDropDown = this.pdfViewerBase.getElement('_zoomDropDown');
                    if (blazorZoomDropDown && blazorZoomDropDown.children.length > 0) {
                        blazorZoomDropDown.children[0].children[0].value = currentPercent;
                    }
                }
                else if (!ej2_base_1.isNullOrUndefined(this.zoomDropDown)) {
                    if (this.zoomDropDown.text === currentPercent) {
                        this.zoomDropDown.element.value = currentPercent;
                    }
                    if (this.zoomDropDown.index === 11) {
                        this.zoomDropDown.value = 4;
                    }
                    if (zoomFactor <= 0.25) {
                        this.pdfViewerBase.isMinimumZoom = true;
                    }
                    else {
                        this.pdfViewerBase.isMinimumZoom = false;
                    }
                    this.zoomDropDown.text = currentPercent;
                    this.zoomDropDown.dataBind();
                }
            }
        };
        Toolbar.prototype.updateInteractionItems = function () {
            if (this.pdfViewer.textSelectionModule) {
                if (this.pdfViewer.enableTextSelection) {
                    this.enableItems(this.textSelectItem.parentElement, true);
                }
                else {
                    this.enableItems(this.textSelectItem.parentElement, false);
                }
            }
            else {
                this.enableItems(this.textSelectItem.parentElement, false);
            }
            this.enableItems(this.panItem.parentElement, true);
            if (this.pdfViewer.interactionMode === 'TextSelection' && this.pdfViewer.enableTextSelection) {
                this.selectItem(this.textSelectItem);
                this.textSelectItem.setAttribute('tabindex', '-1');
                this.deSelectItem(this.panItem);
                this.panItem.setAttribute('tabindex', '0');
                this.pdfViewerBase.initiateTextSelectMode();
            }
            else {
                this.selectItem(this.panItem);
                this.panItem.setAttribute('tabindex', '-1');
                this.deSelectItem(this.textSelectItem);
                this.textSelectItem.setAttribute('tabindex', '0');
                this.pdfViewerBase.initiatePanning();
            }
        };
        Toolbar.prototype.textSearchButtonHandler = function (iskeyboardClick) {
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                if (this.pdfViewer.textSearchModule && this.pdfViewerBase.pageCount > 0) {
                    this.isTextSearchBoxDisplayed = !this.isTextSearchBoxDisplayed;
                    this.pdfViewer.textSearchModule.showSearchBox(this.isTextSearchBoxDisplayed);
                    if (this.isTextSearchBoxDisplayed) {
                        if (!ej2_base_1.isBlazor()) {
                            this.selectItem(this.textSearchItem);
                            this.textSearchItem.setAttribute('tabindex', '0');
                        }
                        var searchInputElement = document.getElementById(this.pdfViewer.element.id + '_search_input');
                        searchInputElement.select();
                        searchInputElement.focus();
                    }
                    else {
                        if (!ej2_base_1.isBlazor()) {
                            this.deSelectItem(this.textSearchItem);
                            this.textSearchItem.blur();
                        }
                        else {
                            var searchItem = this.pdfViewerBase.getElement('_search');
                            if (iskeyboardClick) {
                                searchItem.firstElementChild.focus();
                            }
                            else {
                                searchItem.firstElementChild.blur();
                                this.pdfViewerBase.focusViewerContainer();
                            }
                        }
                    }
                }
            }
            else {
                this.showToolbar(false);
                this.pdfViewerBase.navigationPane.createNavigationPaneMobile('search');
            }
        };
        Toolbar.prototype.initiateAnnotationMode = function (id, isKeyBoardEvent) {
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                if (this.annotationToolbarModule && this.pdfViewer.enableAnnotationToolbar) {
                    this.annotationToolbarModule.showAnnotationToolbar(this.annotationItem);
                    this.pdfViewer.viewerBase.showAnnotationPropertiesToolbar(true);
                    this.pdfViewer.toolbarModule.annotationToolbarModule.toolbar.refreshOverflow();
                    if (isKeyBoardEvent || this.pdfViewer.toolbarModule.annotationToolbarModule.toolbar.items.length > 0) {
                        document.getElementById(this.pdfViewer.toolbarModule.annotationToolbarModule.toolbar.items[0].id).focus();
                    }
                    if (this.pdfViewer.isAnnotationToolbarVisible &&
                        (this.pdfViewer.isFormDesignerToolbarVisible || this.pdfViewer.isRedactionToolbarVisible)) {
                        var formDesignerMainDiv = document.getElementById(this.pdfViewer.element.id + '_formdesigner_toolbar');
                        if (formDesignerMainDiv) {
                            formDesignerMainDiv.style.display = 'none';
                        }
                        var redactionMainDiv = document.getElementById(this.pdfViewer.element.id + '_redaction_toolbar');
                        if (redactionMainDiv) {
                            redactionMainDiv.style.display = 'none';
                        }
                        if (this.formDesignerToolbarModule) {
                            this.formDesignerToolbarModule.isToolbarHidden = false;
                            this.formDesignerToolbarModule.showFormDesignerToolbar(this.formDesignerItem);
                        }
                        if (this.redactionToolbarModule) {
                            this.redactionToolbarModule.isToolbarHidden = false;
                            this.redactionToolbarModule.showRedactionToolbar(this.redactionItem);
                        }
                        this.annotationToolbarModule.adjustViewer(true);
                    }
                }
            }
            else {
                if (!ej2_base_1.isBlazor()) {
                    if (id === this.pdfViewer.element.id + '_annotation') {
                        id = this.pdfViewer.element.id + '_annotationIcon';
                    }
                    this.annotationToolbarModule.createAnnotationToolbarForMobile(id);
                }
            }
        };
        Toolbar.prototype.initiateRedactionMode = function (id, isKeyBoardEvent) {
            if (!ej2_base_1.Browser.isDevice || this.pdfViewer.enableDesktopMode) {
                if (this.redactionToolbarModule && this.pdfViewer.enableRedactionToolbar) {
                    this.redactionToolbarModule.showRedactionToolbar(this.redactionItem);
                    if (this.pdfViewer.isRedactionToolbarVisible &&
                        (this.pdfViewer.isAnnotationToolbarVisible || this.pdfViewer.isFormDesignerToolbarVisible)) {
                        var annotationMainDiv = document.getElementById(this.pdfViewer.element.id + '_annotation_toolbar');
                        annotationMainDiv.style.display = 'none';
                        var formDesignerMainDiv = document.getElementById(this.pdfViewer.element.id + '_formdesigner_toolbar');
                        if (formDesignerMainDiv) {
                            formDesignerMainDiv.style.display = 'none';
                        }
                        var commentPanel = document.getElementById(this.pdfViewer.element.id + '_commantPanel');
                        if (!ej2_base_1.isNullOrUndefined(commentPanel) && !ej2_base_1.isNullOrUndefined(this.pdfViewerBase.navigationPane)) {
                            if (commentPanel.style.display === 'block') {
                                this.pdfViewerBase.navigationPane.closeCommentPanelContainer();
                            }
                        }
                        if (this.annotationToolbarModule) {
                            this.annotationToolbarModule.isToolbarHidden = false;
                            this.annotationToolbarModule.showAnnotationToolbar(this.annotationItem);
                        }
                        if (this.formDesignerToolbarModule) {
                            this.formDesignerToolbarModule.isToolbarHidden = false;
                            this.formDesignerToolbarModule.showFormDesignerToolbar(this.formDesignerItem);
                        }
                        this.redactionToolbarModule.adjustViewer(true);
                    }
                    if (isKeyBoardEvent && this.pdfViewer.toolbarModule.redactionToolbarModule.toolbar.items.length > 0) {
                        document.getElementById(this.pdfViewer.toolbarModule.redactionToolbarModule.toolbar.items[0].id).focus();
                    }
                }
            }
            else {
                if (!ej2_base_1.isBlazor()) {
                    if (id === this.pdfViewer.element.id + '_redaction') {
                        id = this.pdfViewer.element.id + '_redactionIcon';
                    }
                    this.redactionToolbarModule.createRedactionToolbarForMobile(id);
                }
            }
        };
        Toolbar.prototype.initiateFormDesignerMode = function (isKeyBoardEvent) {
            if (this.formDesignerToolbarModule && this.pdfViewer.enableFormDesignerToolbar) {
                this.formDesignerToolbarModule.showFormDesignerToolbar(this.formDesignerItem);
                if (this.pdfViewer.isFormDesignerToolbarVisible &&
                    (this.pdfViewer.isAnnotationToolbarVisible || this.pdfViewer.isRedactionToolbarVisible)) {
                    var annotationMainDiv = document.getElementById(this.pdfViewer.element.id + '_annotation_toolbar');
                    annotationMainDiv.style.display = 'none';
                    var redactionMainDiv = document.getElementById(this.pdfViewer.element.id + '_redaction_toolbar');
                    if (redactionMainDiv) {
                        redactionMainDiv.style.display = 'none';
                    }
                    var commentPanel = document.getElementById(this.pdfViewer.element.id + '_commantPanel');
                    if (!ej2_base_1.isNullOrUndefined(commentPanel) && !ej2_base_1.isNullOrUndefined(this.pdfViewerBase.navigationPane)) {
                        if (commentPanel.style.display === 'block') {
                            this.pdfViewerBase.navigationPane.closeCommentPanelContainer();
                        }
                    }
                    if (this.annotationToolbarModule) {
                        this.annotationToolbarModule.isToolbarHidden = false;
                        this.annotationToolbarModule.showAnnotationToolbar(this.annotationItem);
                    }
                    if (this.redactionToolbarModule) {
                        this.redactionToolbarModule.isToolbarHidden = false;
                        this.redactionToolbarModule.showRedactionToolbar(this.redactionItem);
                    }
                    this.formDesignerToolbarModule.adjustViewer(true);
                }
                if (isKeyBoardEvent && this.pdfViewer.toolbarModule.formDesignerToolbarModule.toolbar.items.length > 0) {
                    document.getElementById(this.pdfViewer.toolbarModule.formDesignerToolbarModule.toolbar.items[0].id).focus();
                }
            }
        };
        Toolbar.prototype.DisableInteractionTools = function () {
            this.deSelectItem(this.textSelectItem);
            this.deSelectItem(this.panItem);
        };
        Toolbar.prototype.selectItem = function (element) {
            if (element) {
                element.classList.add('e-pv-select');
            }
        };
        Toolbar.prototype.deSelectItem = function (element) {
            if (element) {
                element.classList.remove('e-pv-select');
            }
        };
        Toolbar.prototype.updateInteractionTools = function (isTextSelect) {
            var isBlazorPlatform = ej2_base_1.isBlazor();
            if (isTextSelect) {
                if (isBlazorPlatform) {
                    this.selectItem(this.SelectToolElement);
                    this.deSelectItem(this.PanElement);
                }
                else {
                    this.selectItem(this.textSelectItem);
                    if (!ej2_base_1.isNullOrUndefined(this.textSelectItem)) {
                        this.textSelectItem.setAttribute('tabindex', '-1');
                    }
                    this.deSelectItem(this.panItem);
                    if (!ej2_base_1.isNullOrUndefined(this.panItem)) {
                        this.panItem.setAttribute('tabindex', '0');
                    }
                }
            }
            else {
                if (isBlazorPlatform) {
                    this.selectItem(this.PanElement);
                    this.deSelectItem(this.SelectToolElement);
                }
                else {
                    this.selectItem(this.panItem);
                    if (!ej2_base_1.isNullOrUndefined(this.panItem)) {
                        this.panItem.setAttribute('tabindex', '-1');
                    }
                    this.deSelectItem(this.textSelectItem);
                    if (!ej2_base_1.isNullOrUndefined(this.textSelectItem)) {
                        this.textSelectItem.setAttribute('tabindex', '0');
                    }
                }
            }
        };
        Toolbar.prototype.initialEnableItems = function () {
            if (this.pdfViewer.enableToolbar) {
                this.showToolbar(true);
            }
            else {
                this.showToolbar(false);
            }
            if (this.pdfViewer.enableNavigationToolbar) {
                this.showNavigationToolbar(true);
            }
            else {
                this.showNavigationToolbar(false);
            }
            if (this.pdfViewer.pageOrganizer) {
                this.showPageOrganizerToolbar(true);
            }
            else {
                this.showPageOrganizerToolbar(false);
            }
            if (!ej2_base_1.isBlazor()) {
                if (this.isPrintBtnVisible) {
                    this.showPrintOption(true);
                }
                else {
                    this.showPrintOption(false);
                }
                if (this.isDownloadBtnVisible) {
                    this.showDownloadOption(true);
                }
                else {
                    this.showDownloadOption(false);
                }
                if (this.isSearchBtnVisible) {
                    this.showSearchOption(true);
                }
                else {
                    this.showSearchOption(false);
                }
                if (this.isCommentBtnVisible) {
                    this.showCommentOption(true);
                }
                else {
                    this.showCommentOption(false);
                }
                if (this.isRedactionEditBtnVisible && this.pdfViewerBase.clientSideRendering) {
                    this.showRedactionEditTool(true);
                }
                else {
                    this.showRedactionEditTool(false);
                }
            }
        };
        Toolbar.prototype.showSeparator = function (toolbarItems) {
            if (!this.isOpenBtnVisible || (!this.isNavigationToolVisible && !this.isMagnificationToolVisible &&
                !this.isSelectionBtnVisible && !this.isScrollingBtnVisible && !this.isUndoRedoBtnsVisible)) {
                this.applyHideToToolbar(false, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[0]) ? this.itemsIndexArray[0].endIndex + 1 : 1, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[0]) ? this.itemsIndexArray[0].endIndex + 1 : 1);
            }
            if (((!this.isNavigationToolVisible && !this.isMagnificationToolVisible) && !this.isOpenBtnVisible) ||
                (this.isOpenBtnVisible && !this.isNavigationToolVisible) ||
                ((!this.isOpenBtnVisible && !this.isNavigationToolVisible) || (!this.isMagnificationToolVisible &&
                    !this.isScrollingBtnVisible && !this.isSelectionBtnVisible))) {
                this.applyHideToToolbar(false, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[1]) ? this.itemsIndexArray[1].endIndex + 1 : 8, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[1]) ? this.itemsIndexArray[1].endIndex + 1 : 8);
            }
            if ((!this.isMagnificationToolVisible && !this.isSelectionBtnVisible && !this.isScrollingBtnVisible) ||
                (this.isMagnificationToolVisible && (!this.isSelectionBtnVisible && !this.isScrollingBtnVisible)) ||
                (!this.isMagnificationToolVisible && (this.isSelectionBtnVisible || this.isScrollingBtnVisible))) {
                this.applyHideToToolbar(false, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[2]) ?
                    this.itemsIndexArray[2].endIndex + 1 : 12, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[2]) ?
                    this.itemsIndexArray[2].endIndex + 1 : 12);
            }
            if (((!this.isMagnificationToolVisible && !this.isNavigationToolVisible && !this.isScrollingBtnVisible
                && !this.isSelectionBtnVisible) && this.isUndoRedoBtnsVisible || !this.isUndoRedoBtnsVisible)) {
                this.applyHideToToolbar(false, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[4]) ?
                    this.itemsIndexArray[4].endIndex + 1 : 15, !ej2_base_1.isNullOrUndefined(this.itemsIndexArray[4]) ?
                    this.itemsIndexArray[4].endIndex + 1 : 15);
            }
            if ((!this.isUndoRedoBtnsVisible || (this.isUndoRedoBtnsVisible && !this.isCommentBtnVisible &&
                !this.isSubmitbtnvisible)) && (!ej2_base_1.isNullOrUndefined(this.itemsIndexArray[5]))) {
                this.applyHideToToolbar(false, this.itemsIndexArray[5].endIndex + 1, this.itemsIndexArray[5].endIndex + 1);
            }
        };
        Toolbar.prototype.applyToolbarSettings = function () {
            var toolbarSettingsItems = this.pdfViewer.toolbarSettings.toolbarItems;
            if (toolbarSettingsItems) {
                if (toolbarSettingsItems.indexOf('OpenOption') !== -1) {
                    this.showOpenOption(true);
                }
                else {
                    this.showOpenOption(false);
                }
                if (toolbarSettingsItems.indexOf('PageNavigationTool') !== -1) {
                    this.showPageNavigationTool(true);
                }
                else {
                    this.showPageNavigationTool(false);
                }
                if (toolbarSettingsItems.indexOf('MagnificationTool') !== -1) {
                    this.showMagnificationTool(true);
                }
                else {
                    this.showMagnificationTool(false);
                }
                if (toolbarSettingsItems.indexOf('SelectionTool') !== -1) {
                    this.showSelectionTool(true);
                }
                else {
                    this.showSelectionTool(false);
                }
                if (toolbarSettingsItems.indexOf('PanTool') !== -1) {
                    this.showScrollingTool(true);
                }
                else {
                    this.showScrollingTool(false);
                }
                if (toolbarSettingsItems.indexOf('PrintOption') !== -1) {
                    this.showPrintOption(true);
                }
                else {
                    this.showPrintOption(false);
                }
                if (toolbarSettingsItems.indexOf('DownloadOption') !== -1) {
                    this.showDownloadOption(true);
                }
                else {
                    this.showDownloadOption(false);
                }
                if (toolbarSettingsItems.indexOf('SearchOption') !== -1) {
                    this.showSearchOption(true);
                }
                else {
                    this.showSearchOption(false);
                }
                if (toolbarSettingsItems.indexOf('UndoRedoTool') !== -1) {
                    this.showUndoRedoTool(true);
                }
                else {
                    this.showUndoRedoTool(false);
                }
                if (toolbarSettingsItems.indexOf('AnnotationEditTool') !== -1) {
                    this.showAnnotationEditTool(true);
                }
                else {
                    this.showAnnotationEditTool(false);
                }
                if (this.pdfViewerBase.clientSideRendering && toolbarSettingsItems.indexOf('RedactionEditTool') !== -1) {
                    this.showRedactionEditTool(true);
                }
                else {
                    this.showRedactionEditTool(false);
                }
                if (toolbarSettingsItems.indexOf('FormDesignerEditTool') !== -1) {
                    this.showFormDesignerEditTool(true);
                }
                else {
                    this.showFormDesignerEditTool(false);
                }
                if (toolbarSettingsItems.indexOf('CommentTool') !== -1) {
                    this.showCommentOption(true);
                }
                else {
                    this.showCommentOption(false);
                }
                if (toolbarSettingsItems.indexOf('SubmitForm') !== -1) {
                    this.showSubmitForm(true);
                }
                else {
                    this.showSubmitForm(false);
                }
                this.showSeparator(toolbarSettingsItems);
            }
        };
        Toolbar.prototype.applyToolbarSettingsForMobile = function () {
            var toolbarSettingsItems = this.pdfViewer.toolbarSettings.toolbarItems;
            if (toolbarSettingsItems) {
                if (toolbarSettingsItems.indexOf('OpenOption') !== -1) {
                    this.showOpenOption(true);
                }
                else {
                    this.showOpenOption(false);
                }
                if (toolbarSettingsItems.indexOf('UndoRedoTool') !== -1) {
                    this.showUndoRedoTool(true);
                }
                else {
                    this.showUndoRedoTool(false);
                }
                if (toolbarSettingsItems.indexOf('AnnotationEditTool') !== -1) {
                    this.showAnnotationEditTool(true);
                }
                else {
                    this.showAnnotationEditTool(false);
                }
                if (this.pdfViewerBase.clientSideRendering && toolbarSettingsItems.indexOf('RedactionEditTool') !== -1) {
                    this.showRedactionEditTool(true);
                }
                else {
                    this.showRedactionEditTool(false);
                }
                if (toolbarSettingsItems.indexOf('SearchOption') !== -1) {
                    this.showSearchOption(true);
                }
                else {
                    this.showSearchOption(false);
                }
            }
        };
        Toolbar.prototype.getStampMode = function () {
            if (this.pdfViewer.annotation && this.pdfViewer.annotation.stampAnnotationModule) {
                return this.pdfViewer.annotation.stampAnnotationModule.isStampAddMode;
            }
            else {
                return false;
            }
        };
        Toolbar.prototype.stampBeforeOpen = function (args) {
            this.annotationToolbarModule.resetFreeTextAnnot();
            if (args.ParentItem.Text === '' && this.pdfViewer.customStampSettings.isAddToMenu && args.Items.length > 0) {
                var currentElements = null;
                for (var i = 0; i < args.Items.length; i++) {
                    if (args.Items[parseInt(i.toString(), 10)].Text === 'Custom Stamp') {
                        args.Items[parseInt(i.toString(), 10)].Items = [];
                        currentElements = args.Items[parseInt(i.toString(), 10)];
                        break;
                    }
                }
                var elements = this.pdfViewerBase.customStampCollection;
                var stampElements = this.pdfViewer.customStampSettings.customStamps;
                if (elements.length === 0 && stampElements && stampElements.length > 0) {
                    for (var n = 0; n < stampElements.length; n++) {
                        elements.push({ customStampName: stampElements[parseInt(n.toString(), 10)].customStampName,
                            customStampImageSource: stampElements[parseInt(n.toString(), 10)].customStampImageSource });
                    }
                }
                for (var m = 0; m < elements.length; m++) {
                    if (currentElements != null) {
                        currentElements.Items.push({ text: elements[parseInt(m.toString(), 10)].customStampName });
                    }
                }
            }
        };
        Toolbar.prototype.stampBeforeClose = function (args, showItemOnClick) {
            if ((args.ParentItem && args.ParentItem.Text !== 'Custom Stamp' && args.ParentItem.Text !== 'Standard Business' && args.ParentItem.Text !== 'Dynamic' && args.ParentItem.Text !== 'Sign Here') || !args.ParentItem) {
                showItemOnClick = true;
            }
        };
        Toolbar.prototype.updateStampItems = function () {
            if (this.pdfViewer.annotationModule && this.pdfViewer.annotationModule.stampAnnotationModule &&
                this.pdfViewer.annotationModule.stampAnnotationModule.isNewStampAnnot) {
                if (this.pdfViewer.selectedItems.annotations[0]) {
                    this.pdfViewer.remove(this.pdfViewer.selectedItems.annotations[0]);
                    this.pdfViewer.clearSelection(this.pdfViewer.currentPageNumber - 1);
                    this.pdfViewer.renderDrawing();
                    this.pdfViewerBase.tool = null;
                }
                this.pdfViewerBase.isAlreadyAdded = false;
                this.pdfViewer.annotationModule.stampAnnotationModule.isNewStampAnnot = false;
            }
        };
        Toolbar.prototype.stampSelect = function (args, stampParentID) {
            this.pdfViewerBase.isAlreadyAdded = false;
            this.updateStampItems();
            if (args.Item.Text === 'Custom Stamp') {
                this.annotationToolbarModule.checkStampAnnotations();
                this.pdfViewer.annotation.stampAnnotationModule.isStampAddMode = true;
                var stampImage = ej2_base_1.createElement('input', { id: this.pdfViewer.element.id + '_stampElement', attrs: { 'type': 'file' } });
                stampImage.setAttribute('accept', '.jpg,.jpeg,.png');
                stampImage.style.position = 'absolute';
                stampImage.style.left = '0px';
                stampImage.style.top = '0px';
                stampImage.style.visibility = 'hidden';
                document.body.appendChild(stampImage);
                stampImage.click();
                stampImage.addEventListener('change', this.annotationToolbarModule.addStampImage);
                document.body.removeChild(stampImage);
            }
            else if (stampParentID === 'Custom Stamp' && args.Item.Text !== '') {
                var elements = this.pdfViewerBase.customStampCollection;
                for (var n = 0; n < elements.length; n++) {
                    if (elements[parseInt(n.toString(), 10)].customStampName === args.Item.Text) {
                        this.pdfViewer.annotationModule.stampAnnotationModule.customStampName = args.Item.Text;
                        this.annotationToolbarModule.checkStampAnnotations();
                        this.pdfViewer.annotation.stampAnnotationModule.isStampAddMode = true;
                        this.pdfViewer.annotationModule.stampAnnotationModule.isStampAnnotSelected = true;
                        this.pdfViewerBase.stampAdded = true;
                        this.pdfViewerBase.isAlreadyAdded = true;
                        this.pdfViewer.annotationModule.stampAnnotationModule.
                            createCustomStampAnnotation(elements[parseInt(n.toString(), 10)].customStampImageSource);
                        this.pdfViewerBase.stampAdded = false;
                    }
                }
            }
            else if (args.Item.Text !== 'Dynamic' && args.Item.Text !== '' && args.Item.Text !== 'Standard Business' && (stampParentID === 'Sign Here' || args.Item.Text !== 'Sign Here')) {
                this.annotationToolbarModule.checkStampAnnotations();
                this.pdfViewer.annotation.stampAnnotationModule.isStampAddMode = true;
                this.pdfViewer.annotationModule.stampAnnotationModule.isStampAnnotSelected = true;
                this.pdfViewerBase.stampAdded = true;
                if (stampParentID === 'Dynamic') {
                    this.pdfViewerBase.isDynamicStamp = true;
                    this.pdfViewer.annotationModule.stampAnnotationModule.retrieveDynamicStampAnnotation(args.Item.Text);
                }
                else {
                    this.pdfViewerBase.isDynamicStamp = false;
                    this.pdfViewer.annotationModule.stampAnnotationModule.retrievestampAnnotation(args.Item.Text);
                }
            }
        };
        Toolbar.prototype.enableItems = function (element, isEnable) {
            this.toolbar.enableItems(element, isEnable);
            if (element && element.id === this.pdfViewer.element.id + '_zoomDropDownContainer') {
                this.pdfViewerBase.getElement('_zoomDropDown').setAttribute('tabindex', isEnable ? '0' : '-1');
                this.pdfViewerBase.getElement('_zoomDropDown').setAttribute('data-tabindex', isEnable ? '0' : '-1');
            }
            else if (element.firstElementChild && element.id !== this.pdfViewer.element.id + '_zoomDropDownContainer') {
                element.firstElementChild.setAttribute('tabindex', isEnable ? '0' : '-1');
                element.firstElementChild.setAttribute('data-tabindex', isEnable ? '0' : '-1');
            }
        };
        Toolbar.prototype.getModuleName = function () {
            return 'Toolbar';
        };
        return Toolbar;
    }());
    exports.Toolbar = Toolbar;
});