| 7571 | this._initialRotation = null; |
| 7572 | } |
| 7573 | push({ |
| 7574 | namedDest = null, |
| 7575 | explicitDest, |
| 7576 | pageNumber |
| 7577 | }) { |
| 7578 | if (!this._initialized) { |
| 7579 | return; |
| 7580 | } |
| 7581 | if (namedDest && typeof namedDest !== "string") { |
| 7582 | console.error("PDFHistory.push: " + `"${namedDest}" is not a valid namedDest parameter.`); |
| 7583 | return; |
| 7584 | } else if (!Array.isArray(explicitDest)) { |
| 7585 | console.error("PDFHistory.push: " + `"${explicitDest}" is not a valid explicitDest parameter.`); |
| 7586 | return; |
| 7587 | } else if (!this.#isValidPage(pageNumber)) { |
| 7588 | if (pageNumber !== null || this._destination) { |
| 7589 | console.error("PDFHistory.push: " + `"${pageNumber}" is not a valid pageNumber parameter.`); |
| 7590 | return; |
| 7591 | } |
| 7592 | } |
| 7593 | const hash = namedDest || JSON.stringify(explicitDest); |
| 7594 | if (!hash) { |
| 7595 | return; |
| 7596 | } |
| 7597 | let forceReplace = false; |
| 7598 | if (this._destination && (isDestHashesEqual(this._destination.hash, hash) || isDestArraysEqual(this._destination.dest, explicitDest))) { |
| 7599 | if (this._destination.page) { |
| 7600 | return; |
| 7601 | } |
| 7602 | forceReplace = true; |
| 7603 | } |
| 7604 | if (this._popStateInProgress && !forceReplace) { |
| 7605 | return; |
| 7606 | } |
| 7607 | this.#pushOrReplaceState({ |
| 7608 | dest: explicitDest, |
| 7609 | hash, |
| 7610 | page: pageNumber, |
| 7611 | rotation: this.linkService.rotation |
| 7612 | }, forceReplace); |
| 7613 | if (!this._popStateInProgress) { |
| 7614 | this._popStateInProgress = true; |
| 7615 | Promise.resolve().then(() => { |
| 7616 | this._popStateInProgress = false; |
| 7617 | }); |
| 7618 | } |
| 7619 | } |
| 7620 | pushPage(pageNumber) { |
| 7621 | if (!this._initialized) { |
| 7622 | return; |