let globalElement = null;

export function assertNodeList(nodeList, selector) {
  if (!nodeList || !nodeList.length) {
    throw new Error(
      `react-modal: No elements were found for selector ${selector}.`
    );
  }
}

export function setElement(element) {
  let useElement = element;
  if (typeof useElement === "string") {
    const el = document.querySelectorAll(useElement);
    assertNodeList(el, useElement);
    useElement = "length" in el ? el[0] : el;
  }
  globalElement = useElement || globalElement;
  return globalElement;
}

export function tryForceFallback() {
  if (document && document.body) {
    // force fallback to document.body
    setElement(document.body);
    return true;
  }
  return false;
}

export function validateElement(appElement) {
  if (!appElement && !globalElement && !tryForceFallback()) {
    throw new Error([
      'react-modal: Cannot fallback to `document.body`, because it is not',
      'ready or available. If you are doing server-side rendering, use this',
      'function to defined an element. `Modal.setAppElement(el)` to make',
      'this accessible',
    ].join(' '));
  }
}

export function hide(appElement) {
  validateElement(appElement);
  (appElement || globalElement).setAttribute("aria-hidden", "true");
}

export function show(appElement) {
  validateElement(appElement);
  (appElement || globalElement).removeAttribute("aria-hidden");
}

export function documentNotReadyOrSSRTesting() {
  globalElement = null;
}

export function resetForTesting() {
  globalElement = document.body;
}

@@ -851,16 +851,23 @@
 ror(
+%0A      
 %5B%0A      
 'rea
@@ -862,17 +862,19 @@
 %5B%0A      
-'
+  %22
 react-mo
@@ -931,25 +931,25 @@
 t is not
-'
+%22
 ,%0A      
 'ready o
@@ -940,17 +940,19 @@
 ,%0A      
-'
+  %22
 ready or
@@ -1011,25 +1011,25 @@
 use this
-'
+%22
 ,%0A      
 'functio
@@ -1020,17 +1020,19 @@
 ,%0A      
-'
+  %22
 function
@@ -1092,17 +1092,17 @@
 make
-'
+%22
 ,%0A      
 'thi
@@ -1097,17 +1097,19 @@
 ,%0A      
-'
+  %22
 this acc
@@ -1119,26 +1119,32 @@
 ible
-',%0A
+%22%0A 
     
+ 
 %5D.join(
-' ')
+%22 %22)%0A    
 );%0A 

fix prettier linting after merge issue