import { Nullable } from '../../types/general';
/**
 * Simulate a selection for browsers that don't support shadow selection.
 * Cypress test case added in https://github.com/heartlandpayments/Vega/pull/1561/files#diff-83bdbaaf47fc156ab878099aa1f21b0e8ab92abe5852521299f1fb6efab001c2R300
 */
export declare class ShadowSelection {
  rangeCount: number;
  private ranges;
  constructor();
  /**
   * Returns a Range object at a specified index.
   *
   * @param {number} index - A specified index.
   * @returns {Range} - A Range object.
   */
  getRangeAt(index: number): Range;
  /**
   * Adds a Range to ranges array.
   *
   * @param {Range} range - The range of selection.
   */
  addRange(range: Range): void;
  /**
   * Clears all ranges.
   */
  removeAllRanges(): void;
}
/**
 * Due to the ShadowRoot.getSelection is not a standard API, we add this polyfill to achieve this function.
 *
 * - On Chromium, calling document.getSelection will not pierce into the Shadow DOM and gives you some unhelpful high-level element.
 *   But it does expose the non-standard getSelection method on the ShadowRoot.
 *
 * - On Firefox, it does not implement ShadowRoot.getSelection,
 *   but document.getSelection will pierce through shadow dom and give you the exact element.
 *
 * - On Safari, Selection.getComposedRanges is supported as of v17. On versions before that,
 *   ShadowRoot.getSelection is not supported and apparently document.getSelection does not pierce the Shadow DOM, meaning you are just out of luck.
 *
 * https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot#shadowroot.getselection
 * https://stackoverflow.com/a/70523247
 */
export declare class ShadowSelectionPolyfill {
  private supportShadowSelection;
  private isFirefox;
  private supportBeforeInput;
  private polyfilledShadowSelection;
  constructor();
  /**
   * For Firefox, we directly use document.getSelection()
   * For other browser which not support shadowroot.getSelection, we use this.selection which is built by us.
   * For browser which supported shadowroot.getSelection, we use shadowRoot.getselection().
   *
   * @param {ShadowRoot} shadow - A shadow.
   * @returns {Nullable<Selection>} - The shadow selection.
   */
  getSelection(shadow: ShadowRoot): Nullable<Selection>;
  /**
   * Get selection in firefox.
   *
   * Example:
   *
   * <span>span1</span><span>span2</span><span>span3</span>
   *
   * In firefox, while selected `span2`, the range be likely to:
   * range:
   *   startContainer: #text 'span1'
   *   startOffset: 5
   * 	 endContainer: #text 'span3'
   *   endOffset: 0
   * start is end of brefore node and end is start of after node.
   *
   * So we should modify the startContainer and endContainer here.
   *
   * modified range:
   *   startContainer: #text 'span2'
   *   startOffset: 0
   * 	 endContainer: #text 'span2'
   *   endOffset: 5
   *
   * @returns {Selection} - document selection
   */
  private getFirefoxSelection;
  /**
   * Sets up event listeners for `selectionchange` and `beforeinput` events to simulate shadow selection.
   */
  private listen;
}
declare const _default: ShadowSelectionPolyfill;
export default _default;
