text: // node_modules/.pnpm/@polymer/polymer@3.2.0/node_modules/@polymer/polymer/lib/utils/async.js
  var microtaskCurrHandle = 0;
  var microtaskLastHandle = 0;
  var microtaskCallbacks = [];
  var microtaskNodeContent = 0;
  var microtaskNode = document.createTextNode("");
  new window.MutationObserver(microtaskFlush).observe(microtaskNode, { characterData: true });
  function microtaskFlush() {
    const len = microtaskCallbacks.length;
    for (let i = 0; i < len; i++) {
      let cb = microtaskCallbacks[i];
      if (cb) {
        try {
          cb();
        } catch (e) {
          setTimeout(() => {
            throw e;
          });
        }
      }
    }
    microtaskCallbacks.splice(0, len);
    microtaskLastHandle += len;
  }
  var timeOut = {
    after(delay) {
      return {
        run(fn) {
          return window.setTimeout(fn, delay);
        },
        cancel(handle) {
          window.clearTimeout(handle);
        }
      };
    },
    run(fn, delay) {
      return window.setTimeout(fn, delay);
    },
    cancel(handle) {
      window.clearTimeout(handle);
    }
  };
  var animationFrame = {
    run(fn) {
      return window.requestAnimationFrame(fn);
    },
    cancel(handle) {
      window.cancelAnimationFrame(handle);
    }
  };
  var idlePeriod = {
    run(fn) {
      return window.requestIdleCallback ? window.requestIdleCallback(fn) : window.setTimeout(fn, 16);
    },
    cancel(handle) {
      window.cancelIdleCallback ? window.cancelIdleCallback(handle) : window.clearTimeout(handle);
    }
  };
  var microTask = {
    run(callback) {
      microtaskNode.textContent = microtaskNodeContent++;
      microtaskCallbacks.push(callback);
      return microtaskCurrHandle++;
    },
    cancel(handle) {
      const idx = handle - microtaskLastHandle;
      if (idx >= 0) {
        if (!microtaskCallbacks[idx]) {
          throw new Error("invalid async handle: " + handle);
        }
        microtaskCallbacks[idx] = null;
      }
    }
  };
  
  export {
    timeOut,
    animationFrame,
    idlePeriod,
    microTask
  };
  /**
  @license
  Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
  This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
  The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
  The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
  Code distributed by Google as part of the polymer project is also
  subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
  */
  //# sourceMappingURL=chunk-HDWYYSVS.js.map
  