{"version":3,"file":"chunk.725.161fa84c8df4c3ab9f75.js","names":["WAITERS","symbolName","symbol","Symbol","for","global","globalThis","self","window","Error","waiters","undefined","Map","register","waiter","set","name","unregister","delete","getWaiters","result","forEach","value","push","_reset","isRegistered","clear","getPendingWaiterState","pending","waitUntil","debugInfo","hasPendingWaiters","WAITER_NAMES","_resetWaiterNames","Set","NoopTestWaiter","constructor","this","beginAsync","endAsync","reset","buildWaiter","waitForPromise","promise","label","waitFor","args","length","fn","descriptor","props","fns","async","waitForFetch","fetchPromise","response","Proxy","get","target","prop","receiver","maybeProp","some","original","Reflect","maybeFn","call","onerror","onErrorTarget","getOnerror","setOnerror","handler","dispatchOverride","getDispatchOverride","setDispatchOverride","getOwner","getOwner$1","setOwner","setOwner$1","Application","Engine","super","w","buildRegistry","namespace","registry","EmberRouter","create","makeDictionary","Route","EventDispatcher","HashLocation","HistoryLocation","NoneLocation","privatize","BucketCache","RouterService","setupApplicationRegistry","init","properties","rootElement","_document","eventDispatcher","customEvents","autoboot","hasDOM","document","_readinessDeferrals","_booted","_applicationInstances","Boolean","Router","extend","_buildDeprecatedInstance","waitForDOMReady","buildInstance","options","ApplicationInstance","base","application","_watchInstance","instance","add","_unwatchInstance","__deprecatedInstance__","__container__","readyState","schedule","domReady","callback","removeEventListener","run","addEventListener","isDestroying","isDestroyed","_bootSync","deferReadiness","advanceReadiness","once","didBecomeReady","boot","_bootPromise","_","defer","_bootResolver","RSVP","runInitializers","error","reject","join","ready","startRouting","resolve","willDestroy","size","i","destroy","visit","url","then","catch","_defineProperty","buildInitializerMethod","currentRunLoop","_getCurrentRunLoop","_rsvpErrorQueue","Math","random","Date","now","replace","_queues","_backburner","Backburner","defaultQueue","onBegin","current","onEnd","_current","next","flushAsyncObservers","r","onErrorMethod","flush","queueName","methodOrTarget","methodOrArg","additionalArgs","bind","curried","concat","begin","end","_hasScheduledTimers","hasTimers","_cancelTimers","cancelTimers","later","scheduleOnce","cancel","timer","debounce","throttle","registerTestImplementation","EmberTesting","Adapter","EmberObject","asyncStart","asyncEnd","exception","Test","registerWaiter","unregisterWaiter","checkWaiters","contexts","callbacks","checkedCallback","checkedContext","indexOf","context","arguments","splice"],"sources":["webpack://__ember_auto_import__/src/waiter-manager.ts","webpack://__ember_auto_import__/src/build-waiter.ts","webpack://__ember_auto_import__/src/wait-for-promise.ts","webpack://__ember_auto_import__/src/wait-for.ts","webpack://__ember_auto_import__/src/wait-for-fetch.ts","webpack://__ember_auto_import__/node_modules/.pnpm/ember-source@7.4.0_@glimmer+component@2.2.1/node_modules/ember-source/dist/prod/packages/@ember/-internals/error-handling/index.js","webpack://__ember_auto_import__/node_modules/.pnpm/ember-source@7.4.0_@glimmer+component@2.2.1/node_modules/ember-source/dist/prod/packages/@ember/application/index.js","webpack://__ember_auto_import__/node_modules/.pnpm/ember-source@7.4.0_@glimmer+component@2.2.1/node_modules/ember-source/dist/prod/packages/@ember/runloop/index.js","webpack://__ember_auto_import__/node_modules/.pnpm/ember-source@7.4.0_@glimmer+component@2.2.1/node_modules/ember-source/dist/prod/packages/ember-testing/index.js","webpack://__ember_auto_import__/node_modules/.pnpm/ember-source@7.4.0_@glimmer+component@2.2.1/node_modules/ember-source/dist/prod/packages/ember-testing/lib/adapters/adapter.js","webpack://__ember_auto_import__/node_modules/.pnpm/ember-source@7.4.0_@glimmer+component@2.2.1/node_modules/ember-source/dist/prod/packages/ember-testing/lib/test.js","webpack://__ember_auto_import__/node_modules/.pnpm/ember-source@7.4.0_@glimmer+component@2.2.1/node_modules/ember-source/dist/prod/packages/ember-testing/lib/test/waiters.js"],"sourcesContent":["import type { PendingWaiterState, Waiter, WaiterName } from './types/index.ts';\n\ntype Indexable = Record<any, unknown>;\n\n// this ensures that if @ember/test-waiters exists in multiple places in the\n// build output we will still use a single map of waiters (there really should\n// only be one of them, or else `settled` will not work at all)\nconst WAITERS: Map<WaiterName, Waiter> = (function () {\n  const HAS_SYMBOL = typeof Symbol !== 'undefined';\n\n  const symbolName = 'TEST_WAITERS';\n  const symbol = HAS_SYMBOL ? (Symbol.for(symbolName) as any) : symbolName;\n\n  const global = getGlobal();\n\n  let waiters = global[symbol];\n  if (waiters === undefined) {\n    waiters = global[symbol] = new Map<WaiterName, Waiter>();\n  }\n\n  return waiters as Map<WaiterName, Waiter>;\n})();\n\nfunction indexable<T extends object>(input: T): T & Indexable {\n  return input as T & Indexable;\n}\n\nfunction getGlobal(): Indexable {\n  if (typeof globalThis !== 'undefined') return indexable(globalThis);\n  if (typeof self !== 'undefined') return indexable(self);\n  if (typeof window !== 'undefined') return indexable(window);\n\n  throw new Error('unable to locate global object');\n}\n\n/**\n * Registers a waiter.\n *\n * @public\n * @param waiter {Waiter} A test waiter instance\n */\nexport function register(waiter: Waiter): void {\n  WAITERS.set(waiter.name, waiter);\n}\n\n/**\n * Un-registers a waiter.\n *\n * @public\n * @param waiter {Waiter} A test waiter instance\n */\nexport function unregister(waiter: Waiter): void {\n  WAITERS.delete(waiter.name);\n}\n\n/**\n * Gets an array of all waiters current registered.\n *\n * @public\n * @returns {Waiter[]}\n */\nexport function getWaiters(): Waiter[] {\n  const result: Waiter[] = [];\n\n  WAITERS.forEach((value) => {\n    result.push(value);\n  });\n\n  return result;\n}\n\n/**\n * Clears all waiters.\n *\n * @private\n */\nexport function _reset(): void {\n  for (const waiter of getWaiters()) {\n    (waiter as any).isRegistered = false;\n  }\n\n  WAITERS.clear();\n}\n\n/**\n * Gets the current state of all waiters. Any waiters whose\n * `waitUntil` method returns false will be considered `pending`.\n *\n * @returns {PendingWaiterState} An object containing a count of all waiters\n * pending and a `waiters` object containing the name of all pending waiters\n * and their debug info.\n */\nexport function getPendingWaiterState(): PendingWaiterState {\n  const result: PendingWaiterState = {\n    pending: 0,\n    waiters: {},\n  };\n\n  WAITERS.forEach((waiter) => {\n    if (!waiter.waitUntil()) {\n      result.pending++;\n\n      const debugInfo = waiter.debugInfo();\n      result.waiters[waiter.name] = debugInfo || true;\n    }\n  });\n\n  return result;\n}\n\n/**\n * Determines if there are any pending waiters.\n *\n * @returns {boolean} `true` if there are pending waiters, otherwise `false`.\n */\nexport function hasPendingWaiters(): boolean {\n  const state = getPendingWaiterState();\n\n  return state.pending > 0;\n}\n","import type { Primitive, TestWaiter, TestWaiterDebugInfo, WaiterName } from './types/index.ts';\nimport { macroCondition, isDevelopingApp } from '@embroider/macros';\nimport { warn } from '@ember/debug';\nimport Token from './token.ts';\nimport { register } from './waiter-manager.ts';\n\nconst WAITER_NAME_PATTERN = /^[^:]*:?.*/;\nlet WAITER_NAMES = macroCondition(isDevelopingApp()) ? new Set() : undefined;\n\nexport function _resetWaiterNames() {\n  WAITER_NAMES = new Set();\n}\n\nfunction getNextToken(): Token {\n  return new Token();\n}\n\nclass TestWaiterImpl<T extends object | Primitive = Token> implements TestWaiter<T> {\n  public name: WaiterName;\n  private nextToken: () => T;\n  private isRegistered = false;\n\n  items = new Map<T, TestWaiterDebugInfo>();\n  completedOperationsForTokens = new WeakMap<Token, boolean>();\n  completedOperationsForPrimitives = new Map<Primitive, boolean>();\n\n  constructor(name: WaiterName, nextToken?: () => T) {\n    this.name = name;\n    // @ts-ignore\n    this.nextToken = nextToken || getNextToken;\n  }\n\n  beginAsync(token: T = this.nextToken(), label?: string): T {\n    this._register();\n\n    if (this.items.has(token)) {\n      // SAFETY: force stringification of a potential symbol\n      throw new Error(`beginAsync called for ${token as string} but it is already pending.`);\n    }\n\n    const error = new Error();\n\n    this.items.set(token, {\n      get stack() {\n        return error.stack;\n      },\n      label,\n    });\n\n    return token;\n  }\n\n  endAsync(token: T): void {\n    if (!this.items.has(token) && !this._getCompletedOperations(token).has(token)) {\n      throw new Error(\n        `testWaiter.endAsync called with no preceding testWaiter.beginAsync call.\n        Test waiter calls should always be paired. This can occur when a test waiter's paired calls are invoked in a non-deterministic order.\n\n        See https://github.com/emberjs/ember-test-waiters#keep-beginasyncendasync-in-same-block-scope for more information.`\n      );\n    }\n\n    this.items.delete(token);\n    // Mark when a waiter operation has completed so we can distinguish\n    // whether endAsync is being called before a prior beginAsync call above.\n    this._getCompletedOperations(token).set(token, true);\n  }\n\n  waitUntil(): boolean {\n    return this.items.size === 0;\n  }\n\n  debugInfo(): TestWaiterDebugInfo[] {\n    const result: TestWaiterDebugInfo[] = [];\n\n    this.items.forEach((value) => {\n      result.push(value);\n    });\n\n    return result;\n  }\n\n  reset(): void {\n    this.items.clear();\n  }\n\n  private _register(): void {\n    if (!this.isRegistered) {\n      register(this);\n      this.isRegistered = true;\n    }\n  }\n\n  private _getCompletedOperations(token: T) {\n    const type = typeof token;\n\n    const isFunction = type === 'function';\n    const isObject = token !== null && type === 'object';\n    const isPrimitive = !isFunction && !isObject;\n\n    return isPrimitive ? this.completedOperationsForPrimitives : this.completedOperationsForTokens;\n  }\n}\n\nclass NoopTestWaiter implements TestWaiter {\n  name: string;\n  constructor(name: string) {\n    this.name = name;\n  }\n\n  beginAsync(): Token {\n    return this;\n  }\n\n  endAsync(): void {}\n\n  waitUntil(): boolean {\n    return true;\n  }\n\n  debugInfo(): TestWaiterDebugInfo[] {\n    return [];\n  }\n\n  reset(): void {}\n}\n\n/**\n * Builds and returns a test waiter. The type of the\n * returned waiter is dependent on whether the app or\n * addon is in `isDevelopingApp()` mode or not.\n *\n * @public\n *\n * @param name {string} The name of the test waiter\n * @returns {TestWaiter}\n *\n * @example\n *\n * import Component from '@ember/component';\n * import { buildWaiter } from '@ember/test-waiters';\n *\n * if (macroCondition(isDevelopingApp())) {\n *   let waiter = buildWaiter('friend-waiter');\n * }\n *\n * export default class Friendz extends Component {\n *   didInsertElement() {\n *     let token = waiter.beginAsync(this);\n *\n *     someAsyncWork().then(() => {\n *       waiter.endAsync(token);\n *     });\n *   }\n * }\n */\nexport default function buildWaiter(name: string): TestWaiter {\n  if (macroCondition(isDevelopingApp())) {\n    warn(`The waiter name '${name}' is already in use`, !WAITER_NAMES!.has(name), {\n      id: '@ember/test-waiters.duplicate-waiter-name',\n    });\n    WAITER_NAMES!.add(name);\n  }\n\n  if (macroCondition(!isDevelopingApp())) {\n    return new NoopTestWaiter(name);\n  } else {\n    warn(\n      `You must provide a name that contains a descriptive prefix separated by a colon.\n\n        Example: ember-fictitious-addon:some-file\n\n        You passed: ${name}`,\n      WAITER_NAME_PATTERN.test(name),\n      { id: '@ember/test-waiters.invalid-waiter-name' }\n    );\n\n    return new TestWaiterImpl(name);\n  }\n}\n","import { macroCondition, isDevelopingApp } from '@embroider/macros';\nimport buildWaiter from './build-waiter.ts';\n\nimport type { PromiseType, Thenable } from './types/index.ts';\n\nconst PROMISE_WAITER = buildWaiter('@ember/test-waiters:promise-waiter');\n\n/**\n * A convenient utility function to simplify waiting for a promise.\n *\n * @public\n * @param promise {Promise<T> | RSVP.Promise<T>} The promise to track async operations for\n * @param label {string} An optional string to identify the promise\n *\n * @example\n *\n * import Component from '@ember/component';\n * import { waitForPromise } from '@ember/test-waiters';\n *\n * export default class Friendz extends Component {\n *   didInsertElement() {\n *     waitForPromise(new Promise(resolve => {\n *       doSomeWork();\n *       resolve();\n *     }));\n *   }\n * }\n */\nexport default function waitForPromise<T, KindOfPromise extends PromiseType<T>>(\n  promise: KindOfPromise,\n  label?: string\n): KindOfPromise {\n  let result = promise;\n\n  if (macroCondition(isDevelopingApp())) {\n    PROMISE_WAITER.beginAsync(promise, label);\n\n    result = (promise as unknown as Thenable<T, KindOfPromise>).then(\n      (value: T) => {\n        PROMISE_WAITER.endAsync(promise);\n        return value;\n      },\n      (error: Error) => {\n        PROMISE_WAITER.endAsync(promise);\n        throw error;\n      }\n    );\n  }\n\n  return result;\n}\n","import { macroCondition, isDevelopingApp } from '@embroider/macros';\nimport waitForPromise from './wait-for-promise.ts';\nimport buildWaiter from './build-waiter.ts';\nimport type { PromiseType } from './types/index.ts';\n\ntype AsyncFunction<A extends Array<any>, PromiseReturn> = (...args: A) => Promise<PromiseReturn>;\ntype AsyncFunctionArguments = [AsyncFunction<any[], any>, string?];\n\ntype CoroutineGenerator<T> = Generator<any, T, any>;\ntype CoroutineFunction<A extends Array<any>, T> = (...args: A) => CoroutineGenerator<T>;\ntype CoroutineFunctionArguments = [CoroutineFunction<any[], any>, string?];\n\ntype DecoratorArguments = [object, string, PropertyDescriptor, string?];\n\n/**\n * A convenient utility function to simplify waiting for async. Can be used\n * in both decorator and function form. When applied to an async function, it\n * will cause tests to wait until the returned promise has resolves. When\n * applied to a generator function, it will cause tests to wait until the\n * returned iterator has run to completion, which is useful for wrapping\n * ember-concurrency task functions.\n *\n *\n * @public\n * @param promise {Function} An async function or a generator function\n * @param label {string} An optional string to identify the promise\n *\n * @example\n *\n * import Component from '@ember/component';\n * import { waitFor } from '@ember/test-waiters';\n *\n * export default Component.extend({\n *   doAsyncStuff: waitFor(async function doAsyncStuff() {\n *     await somethingAsync();\n *   }\n * });\n *\n * @example\n *\n * import Component from '@ember/component';\n * import { waitFor } from '@ember/test-waiters';\n *\n * export default class Friendz extends Component {\n *   @waitFor\n *   async doAsyncStuff() {\n *     await somethingAsync();\n *   }\n * }\n *\n */\nexport default function waitFor<A extends Array<any>, PromiseReturn>(\n  fn: AsyncFunction<A, PromiseReturn>,\n  label?: string\n): AsyncFunction<A, PromiseReturn>;\nexport default function waitFor<A extends Array<any>, T>(\n  fn: CoroutineFunction<A, T>,\n  label?: string\n): CoroutineFunction<A, T>;\nexport default function waitFor(\n  target: object,\n  _key: string,\n  descriptor: PropertyDescriptor,\n  label?: string\n): PropertyDescriptor;\nexport default function waitFor(\n  ...args: AsyncFunctionArguments | CoroutineFunctionArguments | DecoratorArguments\n): PropertyDescriptor | Function | CoroutineFunction<any[], any> {\n  const isFunction = args.length < 3;\n\n  if (isFunction) {\n    const [fn, label] = args as AsyncFunctionArguments | CoroutineFunctionArguments;\n\n    return wrapFunction(fn, label);\n  } else {\n    const [, , descriptor, label] = args as DecoratorArguments;\n\n    if (macroCondition(!isDevelopingApp())) {\n      return descriptor;\n    }\n\n    const fn = descriptor.value;\n\n    descriptor.value = wrapFunction(fn, label);\n\n    return descriptor;\n  }\n}\n\nfunction wrapFunction(fn: Function, label?: string) {\n  if (macroCondition(!isDevelopingApp())) {\n    return fn;\n  }\n\n  return function (this: any, ...args: any[]) {\n    const result = fn.call(this, ...args);\n\n    if (isThenable(result)) {\n      return waitForPromise(result, label);\n    } else if (isGenerator(result)) {\n      return waitForGenerator(result, label);\n    } else {\n      return result;\n    }\n  };\n}\n\nfunction isThenable(\n  maybePromise: any | PromiseType<unknown>\n): maybePromise is PromiseType<unknown> {\n  const type = typeof maybePromise;\n\n  return (\n    ((maybePromise !== null && type === 'object') || type === 'function') &&\n    typeof maybePromise.then === 'function'\n  );\n}\n\nfunction isGenerator(\n  maybeGenerator: any | CoroutineGenerator<unknown>\n): maybeGenerator is CoroutineGenerator<unknown> {\n  // Because we don't have Symbol.iterator in IE11\n  return (\n    typeof maybeGenerator.next === 'function' &&\n    typeof maybeGenerator.return === 'function' &&\n    typeof maybeGenerator.throw === 'function'\n  );\n}\n\nconst GENERATOR_WAITER = buildWaiter('@ember/test-waiters:generator-waiter');\n\nfunction waitForGenerator<T>(\n  generator: CoroutineGenerator<T>,\n  label?: string\n): CoroutineGenerator<T> {\n  GENERATOR_WAITER.beginAsync(generator, label);\n\n  let isWaiting = true;\n  function stopWaiting() {\n    if (isWaiting) {\n      GENERATOR_WAITER.endAsync(generator);\n      isWaiting = false;\n    }\n  }\n\n  return {\n    next(...args) {\n      let hasErrored = true;\n      try {\n        const val = generator.next(...args);\n        hasErrored = false;\n\n        if (val.done) {\n          stopWaiting();\n        }\n        return val;\n      } finally {\n        // If generator.next() throws, we need to stop waiting. But if we catch\n        // and re-throw exceptions, it could move the location from which the\n        // uncaught exception is thrown, interfering with the developer\n        // debugging experience if they have break-on-exceptions enabled. So we\n        // use a boolean flag and a finally block to emulate a catch block.\n        if (hasErrored) {\n          stopWaiting();\n        }\n      }\n    },\n    return(...args) {\n      stopWaiting();\n      return generator.return(...args);\n    },\n    throw(...args) {\n      stopWaiting();\n      return generator.throw(...args);\n    },\n  } as CoroutineGenerator<T>;\n}\n","import { default as waitForPromise } from './wait-for-promise.ts';\n\nconst props = [\n  'body',\n  'bodyUsed',\n  'headers',\n  'ok',\n  'redirected',\n  'status',\n  'statusText',\n  'type',\n  'url',\n] as const satisfies (keyof Response)[];\ntype ResponseProp = (typeof props)[number];\nfunction isResponseProperty(maybeProp: string): maybeProp is ResponseProp {\n  return props.some((prop) => maybeProp === prop);\n}\n\nconst fns = [\n  'arrayBuffer',\n  'blob',\n  'bytes',\n  'clone',\n  'formData',\n  'json',\n  'text',\n] as const satisfies (keyof Response)[];\ntype ResponseFn = (typeof fns)[number];\nfunction isResponseFn(maybeFn: string): maybeFn is ResponseFn {\n  return fns.some((fn) => maybeFn === fn);\n}\n\n/**\n * Wraps the fetch promise in a test waiter, and also wraps the returned promises' async functions (like json()) in a\n * test waiter.\n */\nexport async function waitForFetch(fetchPromise: ReturnType<typeof fetch>) {\n  const response = await waitForPromise(fetchPromise);\n\n  return new Proxy(response, {\n    get(target, prop, receiver) {\n      /* Depending on the stack, Response is often already a Proxy. Reflect.get() will error for property values, when\n       * using a Proxy as the _receiver_ arg, so just return the value the normal way to avoid that issue. */\n      if (typeof prop === 'string' && isResponseProperty(prop)) {\n        return target[prop];\n      }\n      const original = Reflect.get(target, prop, receiver);\n\n      // Wrap Response functions in test waiter\n      if (typeof prop === 'string' && isResponseFn(prop)) {\n        // clone() is sync, no need to wrap in test-waiter\n        if (prop === 'clone') {\n          return (...args: unknown[]) => {\n            return original.call(target, ...args);\n          };\n        }\n        return (...args: unknown[]) => {\n          return waitForPromise(original.call(target, ...args));\n        };\n      }\n      // return the Reflect.get() result for anything else\n      return original;\n    },\n  });\n}\n","let onerror;\nconst onErrorTarget = {\n  get onerror() {\n    return onerror;\n  }\n};\n\n// Ember.onerror getter\nfunction getOnerror() {\n  return onerror;\n}\n// Ember.onerror setter\nfunction setOnerror(handler) {\n  onerror = handler;\n}\nlet dispatchOverride = null;\n\n// allows testing adapter to override dispatch\nfunction getDispatchOverride() {\n  return dispatchOverride;\n}\nfunction setDispatchOverride(handler) {\n  dispatchOverride = handler;\n}\n\nexport { getDispatchOverride, getOnerror, onErrorTarget, setDispatchOverride, setOnerror };\n","import { setOwner as setOwner$1 } from '../-internals/owner/index.js';\nimport { getOwner as getOwner$1 } from '../owner/index.js';\nimport { m as makeDictionary } from '../../shared-chunks/dictionary-gc5gpyOG.js';\nimport '../../shared-chunks/env-DXxsTFkM.js';\nimport { h as hasDOM } from '../../shared-chunks/has-dom-DdQORPzI.js';\nimport { assert } from '../debug/lib/assert.js';\nimport { schedule, once, join, run } from '../runloop/index.js';\nimport '../../shared-chunks/libraries-Dx5DiBJv.js';\nimport '../-internals/runtime/lib/ext/rsvp.js';\nimport EventDispatcher from '../-internals/views/lib/system/event_dispatcher.js';\nimport Route from '../routing/route.js';\nimport EmberRouter from '../routing/router.js';\nimport HashLocation from '../routing/hash-location.js';\nimport HistoryLocation from '../routing/history-location.js';\nimport NoneLocation from '../routing/none-location.js';\nimport '../../shared-chunks/property_get-DuDs6rLg.js';\nimport '../engine/instance.js';\nimport '../../route-recognizer/index.js';\nimport { R as RSVP } from '../../shared-chunks/rsvp-aLN_pQtn.js';\nimport '../../shared-chunks/unrecognized-url-error-xC654tCo.js';\nimport '../routing/lib/routing-service.js';\nimport BucketCache from '../routing/lib/cache.js';\nimport ApplicationInstance from './instance.js';\nimport Engine, { buildInitializerMethod } from '../engine/index.js';\nimport { privatize } from '../-internals/container/index.js';\nimport { s as setupApplicationRegistry } from '../../shared-chunks/setup-registry-C7HGofi1.js';\nimport RouterService from '../routing/router-service.js';\n\n/**\n@module @ember/application\n*/\n\n/**\n * @deprecated Use `import { getOwner } from '@ember/owner';` instead.\n */\nconst getOwner = getOwner$1;\n\n/**\n * @deprecated Use `import { setOwner } from '@ember/owner';` instead.\n */\nconst setOwner = setOwner$1;\n\n/**\n  An instance of `Application` is the starting point for every Ember\n  application. It instantiates, initializes and coordinates the\n  objects that make up your app.\n\n  Each Ember app has one and only one `Application` object. Although\n  Ember CLI creates this object implicitly, the `Application` class\n  is defined in the `app/app.js`. You can define a `ready` method on the\n  `Application` class, which will be run by Ember when the application is\n  initialized.\n\n  ```app/app.js\n  export default class App extends Application {\n    ready() {\n      // your code here\n    }\n  }\n  ```\n\n  Because `Application` ultimately inherits from `Ember.Namespace`, any classes\n  you create will have useful string representations when calling `toString()`.\n  See the `Ember.Namespace` documentation for more information.\n\n  While you can think of your `Application` as a container that holds the\n  other classes in your application, there are several other responsibilities\n  going on under-the-hood that you may want to understand. It is also important\n  to understand that an `Application` is different from an `ApplicationInstance`.\n  Refer to the Guides to understand the difference between these.\n\n  ### Event Delegation\n\n  Ember uses a technique called _event delegation_. This allows the framework\n  to set up a global, shared event listener instead of requiring each view to\n  do it manually. For example, instead of each view registering its own\n  `mousedown` listener on its associated element, Ember sets up a `mousedown`\n  listener on the `body`.\n\n  If a `mousedown` event occurs, Ember will look at the target of the event and\n  start walking up the DOM node tree, finding corresponding views and invoking\n  their `mouseDown` method as it goes.\n\n  `Application` has a number of default events that it listens for, as\n  well as a mapping from lowercase events to camel-cased view method names. For\n  example, the `keypress` event causes the `keyPress` method on the view to be\n  called, the `dblclick` event causes `doubleClick` to be called, and so on.\n\n  If there is a bubbling browser event that Ember does not listen for by\n  default, you can specify custom events and their corresponding view method\n  names by setting the application's `customEvents` property:\n\n  ```app/app.js\n  import Application from '@ember/application';\n\n  export default class App extends Application {\n    customEvents = {\n      // add support for the paste event\n      paste: 'paste'\n    }\n  }\n  ```\n\n  To prevent Ember from setting up a listener for a default event,\n  specify the event name with a `null` value in the `customEvents`\n  property:\n\n  ```app/app.js\n  import Application from '@ember/application';\n\n  export default class App extends Application {\n    customEvents = {\n      // prevent listeners for mouseenter/mouseleave events\n      mouseenter: null,\n      mouseleave: null\n    }\n  }\n  ```\n\n  By default, the application sets up these event listeners on the document\n  body. However, in cases where you are embedding an Ember application inside\n  an existing page, you may want it to set up the listeners on an element\n  inside the body.\n\n  For example, if only events inside a DOM element with the ID of `ember-app`\n  should be delegated, set your application's `rootElement` property:\n\n  ```app/app.js\n  import Application from '@ember/application';\n\n  export default class App extends Application {\n    rootElement = '#ember-app'\n  }\n  ```\n\n  The `rootElement` can be either a DOM element or a CSS selector\n  string. Note that *views appended to the DOM outside the root element will\n  not receive events.* If you specify a custom root element, make sure you only\n  append views inside it!\n\n  To learn more about the events Ember components use, see\n\n  [components/handling-events](https://guides.emberjs.com/release/components/handling-events/#toc_event-names).\n\n  ### Initializers\n\n  To add behavior to the Application's boot process, you can define initializers in\n  the `app/initializers` directory, or with `ember generate initializer` using Ember CLI.\n  These files should export a named `initialize` function which will receive the created `application`\n  object as its first argument.\n\n  ```javascript\n  export function initialize(application) {\n    // application.inject('route', 'foo', 'service:foo');\n  }\n  ```\n\n  Application initializers can be used for a variety of reasons including:\n\n  - setting up external libraries\n  - injecting dependencies\n  - setting up event listeners in embedded apps\n  - deferring the boot process using the `deferReadiness` and `advanceReadiness` APIs.\n\n  ### Routing\n\n  In addition to creating your application's router, `Application` is\n  also responsible for telling the router when to start routing. Transitions\n  between routes can be logged with the `LOG_TRANSITIONS` flag, and more\n  detailed intra-transition logging can be logged with\n  the `LOG_TRANSITIONS_INTERNAL` flag:\n\n  ```javascript\n  import Application from '@ember/application';\n\n  let App = Application.create({\n    LOG_TRANSITIONS: true, // basic logging of successful transitions\n    LOG_TRANSITIONS_INTERNAL: true // detailed logging of all routing steps\n  });\n  ```\n\n  By default, the router will begin trying to translate the current URL into\n  application state once the browser emits the `DOMContentReady` event. If you\n  need to defer routing, you can call the application's `deferReadiness()`\n  method. Once routing can begin, call the `advanceReadiness()` method.\n\n  If there is any setup required before routing begins, you can implement a\n  `ready()` method on your app that will be invoked immediately before routing\n  begins.\n\n  @class Application\n  @extends Engine\n  @public\n*/\n\nclass Application extends Engine {\n  /**\n    This creates a registry with the default Ember naming conventions.\n     It also configures the registry:\n     * registered views are created every time they are looked up (they are\n      not singletons)\n    * registered templates are not factories; the registered value is\n      returned directly.\n    * the router receives the application as its `namespace` property\n    * all controllers receive the router as their `target` and `controllers`\n      properties\n    * all controllers receive the application as their `namespace` property\n    * the application view receives the application controller as its\n      `controller` property\n    * the application view receives the application template as its\n      `defaultTemplate` property\n     @method buildRegistry\n    @static\n    @param {Application} namespace the application for which to\n      build the registry\n    @return {Ember.Registry} the built registry\n    @private\n  */\n  static buildRegistry(namespace) {\n    let registry = super.buildRegistry(namespace);\n    commonSetupRegistry(registry);\n    setupApplicationRegistry(registry);\n    return registry;\n  }\n  static initializer = buildInitializerMethod('initializers');\n  static instanceInitializer = buildInitializerMethod('instanceInitializers');\n\n  /**\n    The root DOM element of the Application. This can be specified as an\n    element or a [selector string](https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Selectors#reference_table_of_selectors).\n     This is the element that will be passed to the Application's,\n    `eventDispatcher`, which sets up the listeners for event delegation. Every\n    view in your application should be a child of the element you specify here.\n     @property rootElement\n    @type DOMElement\n    @default 'body'\n    @public\n  */\n\n  /**\n     @property _document\n    @type Document | null\n    @default 'window.document'\n    @private\n  */\n\n  /**\n    The `EventDispatcher` responsible for delegating events to this\n    application's views.\n     The event dispatcher is created by the application at initialization time\n    and sets up event listeners on the DOM element described by the\n    application's `rootElement` property.\n     See the documentation for `EventDispatcher` for more information.\n     @property eventDispatcher\n    @type Ember.EventDispatcher\n    @default null\n    @public\n  */\n\n  /**\n    The DOM events for which the event dispatcher should listen.\n     By default, the application's `Ember.EventDispatcher` listens\n    for a set of standard DOM events, such as `mousedown` and\n    `keyup`, and delegates them to your application's `Ember.View`\n    instances.\n     If you would like additional bubbling events to be delegated to your\n    views, set your `Application`'s `customEvents` property\n    to a hash containing the DOM event name as the key and the\n    corresponding view method name as the value. Setting an event to\n    a value of `null` will prevent a default event listener from being\n    added for that event.\n     To add new events to be listened to:\n     ```app/app.js\n    import Application from '@ember/application';\n     let App = Application.extend({\n      customEvents: {\n        // add support for the paste event\n        paste: 'paste'\n      }\n    });\n    ```\n     To prevent default events from being listened to:\n     ```app/app.js\n    import Application from '@ember/application';\n     let App = Application.extend({\n      customEvents: {\n        // remove support for mouseenter / mouseleave events\n        mouseenter: null,\n        mouseleave: null\n      }\n    });\n    ```\n    @property customEvents\n    @type Object\n    @default null\n    @public\n  */\n\n  /**\n    Whether the application should automatically start routing and render\n    templates to the `rootElement` on DOM ready. While default by true,\n    other environments such as FastBoot or a testing harness can set this\n    property to `false` and control the precise timing and behavior of the boot\n    process.\n     @property autoboot\n    @type Boolean\n    @default true\n    @private\n  */\n\n  /**\n    An array of application instances created by `buildInstance()`. Used\n    internally to ensure that all instances get destroyed.\n     @property _applicationInstances\n    @type Array\n    @private\n  */\n\n  init(properties) {\n    super.init(properties);\n    this.rootElement ??= 'body';\n    this._document ??= null;\n    this.eventDispatcher ??= null;\n    this.customEvents ??= null;\n    this.autoboot ??= true;\n    this._document ??= hasDOM ? window.document : null;\n\n    // Start off the number of deferrals at 1. This will be decremented by\n    // the Application's own `boot` method.\n    this._readinessDeferrals = 1;\n    this._booted = false;\n    this._applicationInstances = new Set();\n    this.autoboot = Boolean(this.autoboot);\n    if (this.autoboot) {\n      // Create subclass of Router for this Application instance.\n      // This is to ensure that someone reopening `App.Router` does not\n      // tamper with the default `Router`.\n      this.Router = (this.Router || EmberRouter).extend();\n      this._buildDeprecatedInstance();\n      this.waitForDOMReady();\n    }\n  }\n\n  /**\n    Create an ApplicationInstance for this application.\n     @public\n    @method buildInstance\n    @return {ApplicationInstance} the application instance\n  */\n  buildInstance(options = {}) {\n    return ApplicationInstance.create({\n      ...options,\n      base: this,\n      application: this\n    });\n  }\n\n  /**\n    Start tracking an ApplicationInstance for this application.\n    Used when the ApplicationInstance is created.\n     @private\n    @method _watchInstance\n  */\n  _watchInstance(instance) {\n    this._applicationInstances.add(instance);\n  }\n\n  /**\n    Stop tracking an ApplicationInstance for this application.\n    Used when the ApplicationInstance is about to be destroyed.\n     @private\n    @method _unwatchInstance\n  */\n  _unwatchInstance(instance) {\n    return this._applicationInstances.delete(instance);\n  }\n  Router;\n  __deprecatedInstance__;\n  __container__;\n\n  /*\n    Build the deprecated instance for legacy globals mode support.\n    Called when creating and resetting the application.\n     This is orthogonal to autoboot: the deprecated instance needs to\n    be created at Application construction (not boot) time to expose\n    App.__container__. If autoboot sees that this instance exists,\n    it will continue booting it to avoid doing unncessary work (as\n    opposed to building a new instance at boot time), but they are\n    otherwise unrelated.\n     @private\n    @method _buildDeprecatedInstance\n  */\n  _buildDeprecatedInstance() {\n    // Build a default instance\n    let instance = this.buildInstance();\n\n    // Legacy support for App.__container__ and other global methods\n    // on App that rely on a single, default instance.\n    this.__deprecatedInstance__ = instance;\n    this.__container__ = instance.__container__;\n  }\n\n  /**\n    Automatically kick-off the boot process for the application once the\n    DOM has become ready.\n     The initialization itself is scheduled on the actions queue which\n    ensures that code-loading finishes before booting.\n     If you are asynchronously loading code, you should call `deferReadiness()`\n    to defer booting, and then call `advanceReadiness()` once all of your code\n    has finished loading.\n     @private\n    @method waitForDOMReady\n  */\n  waitForDOMReady() {\n    const document = this._document;\n\n    // SAFETY: Casting as Document should be safe since we're just reading a property.\n    // If it's not actually a Document then it will evaluate false which is fine for our\n    // purposes.\n    if (document === null || document.readyState !== 'loading') {\n      schedule('actions', this, this.domReady);\n    } else {\n      let callback = () => {\n        document.removeEventListener('DOMContentLoaded', callback);\n        run(this, this.domReady);\n      };\n      document.addEventListener('DOMContentLoaded', callback);\n    }\n  }\n\n  /**\n    This is the autoboot flow:\n     1. Boot the app by calling `this.boot()`\n    2. Create an instance (or use the `__deprecatedInstance__` in globals mode)\n    3. Boot the instance by calling `instance.boot()`\n    4. Invoke the `App.ready()` callback\n    5. Kick-off routing on the instance\n     Ideally, this is all we would need to do:\n     ```javascript\n    _autoBoot() {\n      this.boot().then(() => {\n        let instance = this.__deprecatedInstance__;\n        return instance.boot();\n      }).then((instance) => {\n        App.ready();\n        instance.startRouting();\n      });\n    }\n    ```\n     Unfortunately, we cannot actually write this because we need to participate\n    in the \"synchronous\" boot process. While the code above would work fine on\n    the initial boot (i.e. DOM ready), when `App.reset()` is called, we need to\n    boot a new instance synchronously (see the documentation on `_bootSync()`\n    for details).\n     Because of this restriction, the actual logic of this method is located\n    inside `didBecomeReady()`.\n     @private\n    @method domReady\n  */\n  domReady() {\n    if (this.isDestroying || this.isDestroyed) {\n      return;\n    }\n    this._bootSync();\n\n    // Continues to `didBecomeReady`\n  }\n\n  /**\n    Use this to defer readiness until some condition is true.\n     Example:\n     ```javascript\n    import Application from '@ember/application';\n     let App = Application.create();\n     App.deferReadiness();\n     fetch('/auth-token')\n    .then(response => response.json())\n    .then(data => {\n      App.token = data.token;\n      App.advanceReadiness();\n    });\n    ```\n     This allows you to perform asynchronous setup logic and defer\n    booting your application until the setup has finished.\n     However, if the setup requires a loading UI, it might be better\n    to use the router for this purpose.\n     @method deferReadiness\n    @public\n  */\n  deferReadiness() {\n    this._readinessDeferrals++;\n  }\n\n  /**\n    Call `advanceReadiness` after any asynchronous setup logic has completed.\n    Each call to `deferReadiness` must be matched by a call to `advanceReadiness`\n    or the application will never become ready and routing will not begin.\n     @method advanceReadiness\n    @see {Application#deferReadiness}\n    @public\n  */\n  advanceReadiness() {\n    this._readinessDeferrals--;\n    if (this._readinessDeferrals === 0) {\n      once(this, this.didBecomeReady);\n    }\n  }\n  _bootPromise = null;\n\n  /**\n    Initialize the application and return a promise that resolves with the `Application`\n    object when the boot process is complete.\n     Run any application initializers and run the application load hook. These hooks may\n    choose to defer readiness. For example, an authentication hook might want to defer\n    readiness until the auth token has been retrieved.\n     By default, this method is called automatically on \"DOM ready\"; however, if autoboot\n    is disabled, this is automatically called when the first application instance is\n    created via `visit`.\n     @public\n    @method boot\n    @return {Promise<Application,Error>}\n  */\n  boot() {\n    if (this._bootPromise) {\n      return this._bootPromise;\n    }\n    try {\n      this._bootSync();\n    } catch (_) {\n      // Ignore the error: in the asynchronous boot path, the error is already reflected\n      // in the promise rejection\n    }\n    return this._bootPromise;\n  }\n  _bootResolver = null;\n\n  /**\n    Unfortunately, a lot of existing code assumes the booting process is\n    \"synchronous\". Specifically, a lot of tests assumes the last call to\n    `app.advanceReadiness()` or `app.reset()` will result in the app being\n    fully-booted when the current runloop completes.\n     We would like new code (like the `visit` API) to stop making this assumption,\n    so we created the asynchronous version above that returns a promise. But until\n    we have migrated all the code, we would have to expose this method for use\n    *internally* in places where we need to boot an app \"synchronously\".\n     @private\n  */\n  _bootSync() {\n    if (this._booted || this.isDestroying || this.isDestroyed) {\n      return;\n    }\n\n    // Even though this returns synchronously, we still need to make sure the\n    // boot promise exists for book-keeping purposes: if anything went wrong in\n    // the boot process, we need to store the error as a rejection on the boot\n    // promise so that a future caller of `boot()` can tell what failed.\n    let defer = this._bootResolver = RSVP.defer();\n    this._bootPromise = defer.promise;\n    try {\n      this.runInitializers();\n      this.advanceReadiness();\n      // Continues to `didBecomeReady`\n    } catch (error) {\n      // For the asynchronous boot path\n      defer.reject(error);\n\n      // For the synchronous boot path\n      throw error;\n    }\n  }\n\n  /**\n    Reset the application. This is typically used only in tests. It cleans up\n    the application in the following order:\n     1. Deactivate existing routes\n    2. Destroy all objects in the container\n    3. Create a new application container\n    4. Re-route to the existing url\n     Typical Example:\n     ```javascript\n    import Application from '@ember/application';\n    let App;\n     run(function() {\n      App = Application.create();\n    });\n     module('acceptance test', {\n      setup: function() {\n        App.reset();\n      }\n    });\n     test('first test', function() {\n      // App is freshly reset\n    });\n     test('second test', function() {\n      // App is again freshly reset\n    });\n    ```\n     Advanced Example:\n     Occasionally you may want to prevent the app from initializing during\n    setup. This could enable extra configuration, or enable asserting prior\n    to the app becoming ready.\n     ```javascript\n    import Application from '@ember/application';\n    let App;\n     run(function() {\n      App = Application.create();\n    });\n     module('acceptance test', {\n      setup: function() {\n        run(function() {\n          App.reset();\n          App.deferReadiness();\n        });\n      }\n    });\n     test('first test', function() {\n      ok(true, 'something before app is initialized');\n       run(function() {\n        App.advanceReadiness();\n      });\n       ok(true, 'something after app is initialized');\n    });\n    ```\n     @method reset\n    @public\n  */\n  reset() {\n    let instance = this.__deprecatedInstance__;\n    this._readinessDeferrals = 1;\n    this._bootPromise = null;\n    this._bootResolver = null;\n    this._booted = false;\n    function handleReset() {\n      run(instance, 'destroy');\n      this._buildDeprecatedInstance();\n      schedule('actions', this, '_bootSync');\n    }\n    join(this, handleReset);\n  }\n\n  /**\n    @private\n    @method didBecomeReady\n  */\n  didBecomeReady() {\n    if (this.isDestroying || this.isDestroyed) {\n      return;\n    }\n    try {\n      // See documentation on `_autoboot()` for details\n      if (this.autoboot) {\n        // If we already have the __deprecatedInstance__ lying around, boot it to\n        // avoid unnecessary work\n        let instance = this.__deprecatedInstance__;\n        (false && !(instance) && assert('expected instance', instance));\n        instance._bootSync();\n\n        // TODO: App.ready() is not called when autoboot is disabled, is this correct?\n        this.ready();\n        instance.startRouting();\n      }\n\n      // For the asynchronous boot path\n      this._bootResolver.resolve(this);\n\n      // For the synchronous boot path\n      this._booted = true;\n    } catch (error) {\n      // For the asynchronous boot path\n      this._bootResolver.reject(error);\n\n      // For the synchronous boot path\n      throw error;\n    }\n  }\n\n  /**\n    Called when the Application has become ready, immediately before routing\n    begins. The call will be delayed until the DOM has become ready.\n     @event ready\n    @public\n  */\n  ready() {\n    return this;\n  }\n\n  // This method must be moved to the application instance object\n  willDestroy() {\n    super.willDestroy();\n    if (this._applicationInstances.size) {\n      this._applicationInstances.forEach(i => i.destroy());\n      this._applicationInstances.clear();\n    }\n  }\n\n  /**\n    Boot a new instance of `ApplicationInstance` for the current\n    application and navigate it to the given `url`. Returns a `Promise` that\n    resolves with the instance when the initial routing and rendering is\n    complete, or rejects with any error that occurred during the boot process.\n     When `autoboot` is disabled, calling `visit` would first cause the\n    application to boot, which runs the application initializers.\n     This method also takes a hash of boot-time configuration options for\n    customizing the instance's behavior. See the documentation on\n    `ApplicationInstance.BootOptions` for details.\n     `ApplicationInstance.BootOptions` is an interface class that exists\n    purely to document the available options; you do not need to construct it\n    manually. Simply pass a regular JavaScript object containing of the\n    desired options:\n     ```javascript\n    MyApp.visit(\"/\", { location: \"none\", rootElement: \"#container\" });\n    ```\n     ### Supported Scenarios\n     While the `BootOptions` class exposes a large number of knobs, not all\n    combinations of them are valid; certain incompatible combinations might\n    result in unexpected behavior.\n     For example, booting the instance in the full browser environment\n    while specifying a foreign `document` object (e.g. `{ isBrowser: true,\n    document: iframe.contentDocument }`) does not work correctly today,\n    largely due to Ember's jQuery dependency.\n     Currently, there are three officially supported scenarios/configurations.\n    Usages outside of these scenarios are not guaranteed to work, but please\n    feel free to file bug reports documenting your experience and any issues\n    you encountered to help expand support.\n     #### Browser Applications (Manual Boot)\n     The setup is largely similar to how Ember works out-of-the-box. Normally,\n    Ember will boot a default instance for your Application on \"DOM ready\".\n    However, you can customize this behavior by disabling `autoboot`.\n     For example, this allows you to render a miniture demo of your application\n    into a specific area on your marketing website:\n     ```javascript\n    import MyApp from 'my-app';\n     $(function() {\n      let App = MyApp.create({ autoboot: false });\n       let options = {\n        // Override the router's location adapter to prevent it from updating\n        // the URL in the address bar\n        location: 'none',\n         // Override the default `rootElement` on the app to render into a\n        // specific `div` on the page\n        rootElement: '#demo'\n      };\n       // Start the app at the special demo URL\n      App.visit('/demo', options);\n    });\n    ```\n     Or perhaps you might want to boot two instances of your app on the same\n    page for a split-screen multiplayer experience:\n     ```javascript\n    import MyApp from 'my-app';\n     $(function() {\n      let App = MyApp.create({ autoboot: false });\n       let sessionId = MyApp.generateSessionID();\n       let player1 = App.visit(`/matches/join?name=Player+1&session=${sessionId}`, { rootElement: '#left', location: 'none' });\n      let player2 = App.visit(`/matches/join?name=Player+2&session=${sessionId}`, { rootElement: '#right', location: 'none' });\n       Promise.all([player1, player2]).then(() => {\n        // Both apps have completed the initial render\n        $('#loading').fadeOut();\n      });\n    });\n    ```\n     Do note that each app instance maintains their own registry/container, so\n    they will run in complete isolation by default.\n     #### Server-Side Rendering (also known as FastBoot)\n     This setup allows you to run your Ember app in a server environment using\n    Node.js and render its content into static HTML for SEO purposes.\n     ```javascript\n    const HTMLSerializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap);\n     function renderURL(url) {\n      let dom = new SimpleDOM.Document();\n      let rootElement = dom.body;\n      let options = { isBrowser: false, document: dom, rootElement: rootElement };\n       return MyApp.visit(options).then(instance => {\n        try {\n          return HTMLSerializer.serialize(rootElement.firstChild);\n        } finally {\n          instance.destroy();\n        }\n      });\n    }\n    ```\n     In this scenario, because Ember does not have access to a global `document`\n    object in the Node.js environment, you must provide one explicitly. In practice,\n    in the non-browser environment, the stand-in `document` object only needs to\n    implement a limited subset of the full DOM API. The `SimpleDOM` library is known\n    to work.\n     Since there is no DOM access in the non-browser environment, you must also\n    specify a DOM `Element` object in the same `document` for the `rootElement` option\n    (as opposed to a selector string like `\"body\"`).\n     See the documentation on the `isBrowser`, `document` and `rootElement` properties\n    on `ApplicationInstance.BootOptions` for details.\n     #### Server-Side Resource Discovery\n     This setup allows you to run the routing layer of your Ember app in a server\n    environment using Node.js and completely disable rendering. This allows you\n    to simulate and discover the resources (i.e. AJAX requests) needed to fulfill\n    a given request and eagerly \"push\" these resources to the client.\n     ```app/initializers/network-service.js\n    import BrowserNetworkService from 'app/services/network/browser';\n    import NodeNetworkService from 'app/services/network/node';\n     // Inject a (hypothetical) service for abstracting all AJAX calls and use\n    // the appropriate implementation on the client/server. This also allows the\n    // server to log all the AJAX calls made during a particular request and use\n    // that for resource-discovery purpose.\n     export function initialize(application) {\n      if (window) { // browser\n        application.register('service:network', BrowserNetworkService);\n      } else { // node\n        application.register('service:network', NodeNetworkService);\n      }\n    };\n     export default {\n      name: 'network-service',\n      initialize: initialize\n    };\n    ```\n     ```app/routes/post.js\n    import Route from '@ember/routing/route';\n    import { service } from '@ember/service';\n     // An example of how the (hypothetical) service is used in routes.\n     export default class IndexRoute extends Route {\n      @service network;\n       model(params) {\n        return this.network.fetch(`/api/posts/${params.post_id}.json`);\n      }\n       afterModel(post) {\n        if (post.isExternalContent) {\n          return this.network.fetch(`/api/external/?url=${post.externalURL}`);\n        } else {\n          return post;\n        }\n      }\n    }\n    ```\n     ```javascript\n    // Finally, put all the pieces together\n     function discoverResourcesFor(url) {\n      return MyApp.visit(url, { isBrowser: false, shouldRender: false }).then(instance => {\n        let networkService = instance.lookup('service:network');\n        return networkService.requests; // => { \"/api/posts/123.json\": \"...\" }\n      });\n    }\n    ```\n     @public\n    @method visit\n    @param url {String} The initial URL to navigate to\n    @param options {ApplicationInstance.BootOptions}\n    @return {Promise<ApplicationInstance, Error>}\n  */\n  visit(url, options) {\n    return this.boot().then(() => {\n      let instance = this.buildInstance();\n      return instance.boot(options).then(() => instance.visit(url)).catch(error => {\n        run(instance, 'destroy');\n        throw error;\n      });\n    });\n  }\n}\nfunction commonSetupRegistry(registry) {\n  registry.register('router:main', EmberRouter);\n  registry.register('-view-registry:main', {\n    create() {\n      return makeDictionary(null);\n    }\n  });\n  registry.register('route:basic', Route);\n  registry.register('event_dispatcher:main', EventDispatcher);\n  registry.register('location:hash', HashLocation);\n  registry.register('location:history', HistoryLocation);\n  registry.register('location:none', NoneLocation);\n  registry.register(privatize`-bucket-cache:main`, {\n    create() {\n      return new BucketCache();\n    }\n  });\n  registry.register('service:router', RouterService);\n}\n\nexport { Application as default, getOwner, setOwner };\n","import { onErrorTarget } from '../-internals/error-handling/index.js';\nimport { f as flushAsyncObservers } from '../../shared-chunks/observers-B1wiwQeH.js';\nimport Backburner from '../../backburner.js/index.js';\n\n// Partial types from https://medium.com/codex/currying-in-typescript-ca5226c85b85\n\nlet currentRunLoop = null;\nfunction _getCurrentRunLoop() {\n  return currentRunLoop;\n}\nfunction onBegin(current) {\n  currentRunLoop = current;\n}\nfunction onEnd(_current, next) {\n  currentRunLoop = next;\n  flushAsyncObservers(schedule);\n}\nfunction flush(queueName, next) {\n  if (queueName === 'render' || queueName === _rsvpErrorQueue) {\n    flushAsyncObservers(schedule);\n  }\n  next();\n}\nconst _rsvpErrorQueue = `${Math.random()}${Date.now()}`.replace('.', '');\n\n/**\n  Array of named queues. This array determines the order in which queues\n  are flushed at the end of the RunLoop. You can define your own queues by\n  simply adding the queue name to this array. Normally you should not need\n  to inspect or modify this property.\n\n  @property queues\n  @type Array\n  @default ['actions', 'destroy']\n  @private\n*/\nconst _queues = ['actions',\n// used in router transitions to prevent unnecessary loading state entry\n// if all context promises resolve on the 'actions' queue first\n'routerTransitions', 'render', 'afterRender', 'destroy',\n// used to re-throw unhandled RSVP rejection errors specifically in this\n// position to avoid breaking anything rendered in the other sections\n_rsvpErrorQueue];\n\n/**\n * @internal\n * @private\n */\nconst _backburner = new Backburner(_queues, {\n  defaultQueue: 'actions',\n  onBegin,\n  onEnd,\n  onErrorTarget,\n  onErrorMethod: 'onerror',\n  flush\n});\n\n/**\n @module @ember/runloop\n*/\n// ..........................................................\n// run - this is ideally the only public API the dev sees\n//\n\n/**\n  Runs the passed target and method inside of a RunLoop, ensuring any\n  deferred actions including bindings and views updates are flushed at the\n  end.\n\n  Normally you should not need to invoke this method yourself. However if\n  you are implementing raw event handlers when interfacing with other\n  libraries or plugins, you should probably wrap all of your code inside this\n  call.\n\n  ```javascript\n  import { run } from '@ember/runloop';\n\n  run(function() {\n    // code to be executed within a RunLoop\n  });\n  ```\n  @method run\n  @for @ember/runloop\n  @static\n  @param {Object} [target] target of method to call\n  @param {Function|String} method Method to invoke.\n    May be a function or a string. If you pass a string\n    then it will be looked up on the passed target.\n  @param {Object} [args*] Any additional arguments you wish to pass to the method.\n  @return {Object} return value from invoking the passed function.\n  @public\n*/\n\nfunction run(...args) {\n  // @ts-expect-error TS doesn't like our spread args\n  return _backburner.run(...args);\n}\n\n/**\n  If no run-loop is present, it creates a new one. If a run loop is\n  present it will queue itself to run on the existing run-loops action\n  queue.\n\n  Please note: This is not for normal usage, and should be used sparingly.\n\n  If invoked when not within a run loop:\n\n  ```javascript\n  import { join } from '@ember/runloop';\n\n  join(function() {\n    // creates a new run-loop\n  });\n  ```\n\n  Alternatively, if called within an existing run loop:\n\n  ```javascript\n  import { run, join } from '@ember/runloop';\n\n  run(function() {\n    // creates a new run-loop\n\n    join(function() {\n      // joins with the existing run-loop, and queues for invocation on\n      // the existing run-loops action queue.\n    });\n  });\n  ```\n\n  @method join\n  @static\n  @for @ember/runloop\n  @param {Object} [target] target of method to call\n  @param {Function|String} method Method to invoke.\n    May be a function or a string. If you pass a string\n    then it will be looked up on the passed target.\n  @param {Object} [args*] Any additional arguments you wish to pass to the method.\n  @return {Object} Return value from invoking the passed function. Please note,\n  when called within an existing loop, no return value is possible.\n  @public\n*/\n\nfunction join(methodOrTarget, methodOrArg, ...additionalArgs) {\n  return _backburner.join(methodOrTarget, methodOrArg, ...additionalArgs);\n}\n\n/**\n  Allows you to specify which context to call the specified function in while\n  adding the execution of that function to the Ember run loop. This ability\n  makes this method a great way to asynchronously integrate third-party libraries\n  into your Ember application.\n\n  `bind` takes two main arguments, the desired context and the function to\n  invoke in that context. Any additional arguments will be supplied as arguments\n  to the function that is passed in.\n\n  Let's use the creation of a TinyMCE component as an example. Currently,\n  TinyMCE provides a setup configuration option we can use to do some processing\n  after the TinyMCE instance is initialized but before it is actually rendered.\n  We can use that setup option to do some additional setup for our component.\n  The component itself could look something like the following:\n\n  ```app/components/rich-text-editor.js\n  import Component from '@ember/component';\n  import { on } from '@ember/object/evented';\n  import { bind } from '@ember/runloop';\n\n  export default Component.extend({\n    initializeTinyMCE: on('didInsertElement', function() {\n      tinymce.init({\n        selector: '#' + this.$().prop('id'),\n        setup: bind(this, this.setupEditor)\n      });\n    }),\n\n    didInsertElement() {\n      tinymce.init({\n        selector: '#' + this.$().prop('id'),\n        setup: bind(this, this.setupEditor)\n      });\n    }\n\n    setupEditor(editor) {\n      this.set('editor', editor);\n\n      editor.on('change', function() {\n        console.log('content changed!');\n      });\n    }\n  });\n  ```\n\n  In this example, we use `bind` to bind the setupEditor method to the\n  context of the RichTextEditor component and to have the invocation of that\n  method be safely handled and executed by the Ember run loop.\n\n  @method bind\n  @static\n  @for @ember/runloop\n  @param {Object} [target] target of method to call\n  @param {Function|String} method Method to invoke.\n    May be a function or a string. If you pass a string\n    then it will be looked up on the passed target.\n  @param {Object} [args*] Any additional arguments you wish to pass to the method.\n  @return {Function} returns a new function that will always have a particular context\n  @since 1.4.0\n  @public\n*/\n\n// This final fallback is the equivalent of the (quite unsafe!) type for `bind`\n// from TS' defs for `Function.prototype.bind`. In general, it means we have a\n// loss of safety if we do not\n\nfunction bind(...curried) {\n  return (...args) => join(...curried.concat(args));\n}\n\n/**\n  Begins a new RunLoop. Any deferred actions invoked after the begin will\n  be buffered until you invoke a matching call to `end()`. This is\n  a lower-level way to use a RunLoop instead of using `run()`.\n\n  ```javascript\n  import { begin, end } from '@ember/runloop';\n\n  begin();\n  // code to be executed within a RunLoop\n  end();\n  ```\n\n  @method begin\n  @static\n  @for @ember/runloop\n  @return {void}\n  @public\n*/\nfunction begin() {\n  _backburner.begin();\n}\n\n/**\n  Ends a RunLoop. This must be called sometime after you call\n  `begin()` to flush any deferred actions. This is a lower-level way\n  to use a RunLoop instead of using `run()`.\n\n  ```javascript\n  import { begin, end } from '@ember/runloop';\n\n  begin();\n  // code to be executed within a RunLoop\n  end();\n  ```\n\n  @method end\n  @static\n  @for @ember/runloop\n  @return {void}\n  @public\n*/\nfunction end() {\n  _backburner.end();\n}\n\n/**\n  Adds the passed target/method and any optional arguments to the named\n  queue to be executed at the end of the RunLoop. If you have not already\n  started a RunLoop when calling this method one will be started for you\n  automatically.\n\n  At the end of a RunLoop, any methods scheduled in this way will be invoked.\n  Methods will be invoked in an order matching the named queues defined in\n  the `queues` property.\n\n  ```javascript\n  import { schedule } from '@ember/runloop';\n\n  schedule('afterRender', this, function() {\n    // this will be executed in the 'afterRender' queue\n    console.log('scheduled on afterRender queue');\n  });\n\n  schedule('actions', this, function() {\n    // this will be executed in the 'actions' queue\n    console.log('scheduled on actions queue');\n  });\n\n  // Note the functions will be run in order based on the run queues order.\n  // Output would be:\n  //   scheduled on actions queue\n  //   scheduled on afterRender queue\n  ```\n\n  @method schedule\n  @static\n  @for @ember/runloop\n  @param {String} queue The name of the queue to schedule against. Default queues is 'actions'\n  @param {Object} [target] target object to use as the context when invoking a method.\n  @param {String|Function} method The method to invoke. If you pass a string it\n    will be resolved on the target object at the time the scheduled item is\n    invoked allowing you to change the target function.\n  @param {Object} [arguments*] Optional arguments to be passed to the queued method.\n  @return {*} Timer information for use in canceling, see `cancel`.\n  @public\n*/\n\nfunction schedule(...args) {\n  // @ts-expect-error TS doesn't like the rest args here\n  return _backburner.schedule(...args);\n}\n\n// Used by global test teardown\nfunction _hasScheduledTimers() {\n  return _backburner.hasTimers();\n}\n\n// Used by global test teardown\nfunction _cancelTimers() {\n  _backburner.cancelTimers();\n}\n\n/**\n  Invokes the passed target/method and optional arguments after a specified\n  period of time. The last parameter of this method must always be a number\n  of milliseconds.\n\n  You should use this method whenever you need to run some action after a\n  period of time instead of using `setTimeout()`. This method will ensure that\n  items that expire during the same script execution cycle all execute\n  together, which is often more efficient than using a real setTimeout.\n\n  ```javascript\n  import { later } from '@ember/runloop';\n\n  later(myContext, function() {\n    // code here will execute within a RunLoop in about 500ms with this == myContext\n  }, 500);\n  ```\n\n  @method later\n  @static\n  @for @ember/runloop\n  @param {Object} [target] target of method to invoke\n  @param {Function|String} method The method to invoke.\n    If you pass a string it will be resolved on the\n    target at the time the method is invoked.\n  @param {Object} [args*] Optional arguments to pass to the timeout.\n  @param {Number} wait Number of milliseconds to wait.\n  @return {*} Timer information for use in canceling, see `cancel`.\n  @public\n*/\n\nfunction later(...args) {\n  return _backburner.later(...args);\n}\n\n/**\n Schedule a function to run one time during the current RunLoop. This is equivalent\n  to calling `scheduleOnce` with the \"actions\" queue.\n\n  @method once\n  @static\n  @for @ember/runloop\n  @param {Object} [target] The target of the method to invoke.\n  @param {Function|String} method The method to invoke.\n    If you pass a string it will be resolved on the\n    target at the time the method is invoked.\n  @param {Object} [args*] Optional arguments to pass to the timeout.\n  @return {Object} Timer information for use in canceling, see `cancel`.\n  @public\n*/\n\nfunction once(...args) {\n  // @ts-expect-error TS doesn't like the rest args here\n  return _backburner.scheduleOnce('actions', ...args);\n}\n\n/**\n  Schedules a function to run one time in a given queue of the current RunLoop.\n  Calling this method with the same queue/target/method combination will have\n  no effect (past the initial call).\n\n  Note that although you can pass optional arguments these will not be\n  considered when looking for duplicates. New arguments will replace previous\n  calls.\n\n  ```javascript\n  import { run, scheduleOnce } from '@ember/runloop';\n\n  function sayHi() {\n    console.log('hi');\n  }\n\n  run(function() {\n    scheduleOnce('afterRender', myContext, sayHi);\n    scheduleOnce('afterRender', myContext, sayHi);\n    // sayHi will only be executed once, in the afterRender queue of the RunLoop\n  });\n  ```\n\n  Also note that for `scheduleOnce` to prevent additional calls, you need to\n  pass the same function instance. The following case works as expected:\n\n  ```javascript\n  function log() {\n    console.log('Logging only once');\n  }\n\n  function scheduleIt() {\n    scheduleOnce('actions', myContext, log);\n  }\n\n  scheduleIt();\n  scheduleIt();\n  ```\n\n  But this other case will schedule the function multiple times:\n\n  ```javascript\n  import { scheduleOnce } from '@ember/runloop';\n\n  function scheduleIt() {\n    scheduleOnce('actions', myContext, function() {\n      console.log('Closure');\n    });\n  }\n\n  scheduleIt();\n  scheduleIt();\n\n  // \"Closure\" will print twice, even though we're using `scheduleOnce`,\n  // because the function we pass to it won't match the\n  // previously scheduled operation.\n  ```\n\n  Available queues, and their order, can be found at `queues`\n\n  @method scheduleOnce\n  @static\n  @for @ember/runloop\n  @param {String} [queue] The name of the queue to schedule against. Default queues is 'actions'.\n  @param {Object} [target] The target of the method to invoke.\n  @param {Function|String} method The method to invoke.\n    If you pass a string it will be resolved on the\n    target at the time the method is invoked.\n  @param {Object} [args*] Optional arguments to pass to the timeout.\n  @return {Object} Timer information for use in canceling, see `cancel`.\n  @public\n*/\n\nfunction scheduleOnce(...args) {\n  // @ts-expect-error TS doesn't like the rest args here\n  return _backburner.scheduleOnce(...args);\n}\n\n/**\n  Schedules an item to run from within a separate run loop, after\n  control has been returned to the system. This is equivalent to calling\n  `later` with a wait time of 1ms.\n\n  ```javascript\n  import { next } from '@ember/runloop';\n\n  next(myContext, function() {\n    // code to be executed in the next run loop,\n    // which will be scheduled after the current one\n  });\n  ```\n\n  Multiple operations scheduled with `next` will coalesce\n  into the same later run loop, along with any other operations\n  scheduled by `later` that expire right around the same\n  time that `next` operations will fire.\n\n  Note that there are often alternatives to using `next`.\n  For instance, if you'd like to schedule an operation to happen\n  after all DOM element operations have completed within the current\n  run loop, you can make use of the `afterRender` run loop queue (added\n  by the `ember-views` package, along with the preceding `render` queue\n  where all the DOM element operations happen).\n\n  Example:\n\n  ```app/components/my-component.js\n  import Component from '@ember/component';\n  import { scheduleOnce } from '@ember/runloop';\n\n  export default class MyComponent extends Component {\n    didInsertElement() {\n      super.didInsertElement();\n      scheduleOnce('afterRender', this, 'processChildElements');\n    },\n\n    processChildElements() {\n      // ... do something with component's child component\n      // elements after they've finished rendering, which\n      // can't be done within this component's\n      // `didInsertElement` hook because that gets run\n      // before the child elements have been added to the DOM.\n    }\n  }\n  ```\n\n  One benefit of the above approach compared to using `next` is\n  that you will be able to perform DOM/CSS operations before unprocessed\n  elements are rendered to the screen, which may prevent flickering or\n  other artifacts caused by delaying processing until after rendering.\n\n  The other major benefit to the above approach is that `next`\n  introduces an element of non-determinism, which can make things much\n  harder to test, due to its reliance on `setTimeout`; it's much harder\n  to guarantee the order of scheduled operations when they are scheduled\n  outside of the current run loop, i.e. with `next`.\n\n  @method next\n  @static\n  @for @ember/runloop\n  @param {Object} [target] target of method to invoke\n  @param {Function|String} method The method to invoke.\n    If you pass a string it will be resolved on the\n    target at the time the method is invoked.\n  @param {Object} [args*] Optional arguments to pass to the timeout.\n  @return {Object} Timer information for use in canceling, see `cancel`.\n  @public\n*/\n\nfunction next(...args) {\n  return _backburner.later(...args, 1);\n}\n\n/**\n  Cancels a scheduled item. Must be a value returned by `later()`,\n  `once()`, `scheduleOnce()`, `next()`, `debounce()`, or\n  `throttle()`.\n\n  ```javascript\n  import {\n    next,\n    cancel,\n    later,\n    scheduleOnce,\n    once,\n    throttle,\n    debounce\n  } from '@ember/runloop';\n\n  let runNext = next(myContext, function() {\n    // will not be executed\n  });\n\n  cancel(runNext);\n\n  let runLater = later(myContext, function() {\n    // will not be executed\n  }, 500);\n\n  cancel(runLater);\n\n  let runScheduleOnce = scheduleOnce('afterRender', myContext, function() {\n    // will not be executed\n  });\n\n  cancel(runScheduleOnce);\n\n  let runOnce = once(myContext, function() {\n    // will not be executed\n  });\n\n  cancel(runOnce);\n\n  let throttle = throttle(myContext, function() {\n    // will not be executed\n  }, 1, false);\n\n  cancel(throttle);\n\n  let debounce = debounce(myContext, function() {\n    // will not be executed\n  }, 1);\n\n  cancel(debounce);\n\n  let debounceImmediate = debounce(myContext, function() {\n    // will be executed since we passed in true (immediate)\n  }, 100, true);\n\n  // the 100ms delay until this method can be called again will be canceled\n  cancel(debounceImmediate);\n  ```\n\n  @method cancel\n  @static\n  @for @ember/runloop\n  @param {Object} [timer] Timer object to cancel\n  @return {Boolean} true if canceled or false/undefined if it wasn't found\n  @public\n*/\nfunction cancel(timer) {\n  return _backburner.cancel(timer);\n}\n\n/**\n  Delay calling the target method until the debounce period has elapsed\n  with no additional debounce calls. If `debounce` is called again before\n  the specified time has elapsed, the timer is reset and the entire period\n  must pass again before the target method is called.\n\n  This method should be used when an event may be called multiple times\n  but the action should only be called once when the event is done firing.\n  A common example is for scroll events where you only want updates to\n  happen once scrolling has ceased.\n\n  ```javascript\n  import { debounce } from '@ember/runloop';\n\n  function whoRan() {\n    console.log(this.name + ' ran.');\n  }\n\n  let myContext = { name: 'debounce' };\n\n  debounce(myContext, whoRan, 150);\n\n  // less than 150ms passes\n  debounce(myContext, whoRan, 150);\n\n  // 150ms passes\n  // whoRan is invoked with context myContext\n  // console logs 'debounce ran.' one time.\n  ```\n\n  Immediate allows you to run the function immediately, but debounce\n  other calls for this function until the wait time has elapsed. If\n  `debounce` is called again before the specified time has elapsed,\n  the timer is reset and the entire period must pass again before\n  the method can be called again.\n\n  ```javascript\n  import { debounce } from '@ember/runloop';\n\n  function whoRan() {\n    console.log(this.name + ' ran.');\n  }\n\n  let myContext = { name: 'debounce' };\n\n  debounce(myContext, whoRan, 150, true);\n\n  // console logs 'debounce ran.' one time immediately.\n  // 100ms passes\n  debounce(myContext, whoRan, 150, true);\n\n  // 150ms passes and nothing else is logged to the console and\n  // the debouncee is no longer being watched\n  debounce(myContext, whoRan, 150, true);\n\n  // console logs 'debounce ran.' one time immediately.\n  // 150ms passes and nothing else is logged to the console and\n  // the debouncee is no longer being watched\n  ```\n\n  @method debounce\n  @static\n  @for @ember/runloop\n  @param {Object} [target] target of method to invoke\n  @param {Function|String} method The method to invoke.\n    May be a function or a string. If you pass a string\n    then it will be looked up on the passed target.\n  @param {Object} [args*] Optional arguments to pass to the timeout.\n  @param {Number} wait Number of milliseconds to wait.\n  @param {Boolean} immediate Trigger the function on the leading instead\n    of the trailing edge of the wait interval. Defaults to false.\n  @return {Array} Timer information for use in canceling, see `cancel`.\n  @public\n*/\n\nfunction debounce(...args) {\n  // @ts-expect-error TS doesn't like the rest args here\n  return _backburner.debounce(...args);\n}\n\n/**\n  Ensure that the target method is never called more frequently than\n  the specified spacing period. The target method is called immediately.\n\n  ```javascript\n  import { throttle } from '@ember/runloop';\n\n  function whoRan() {\n    console.log(this.name + ' ran.');\n  }\n\n  let myContext = { name: 'throttle' };\n\n  throttle(myContext, whoRan, 150);\n  // whoRan is invoked with context myContext\n  // console logs 'throttle ran.'\n\n  // 50ms passes\n  throttle(myContext, whoRan, 150);\n\n  // 50ms passes\n  throttle(myContext, whoRan, 150);\n\n  // 150ms passes\n  throttle(myContext, whoRan, 150);\n  // whoRan is invoked with context myContext\n  // console logs 'throttle ran.'\n  ```\n\n  @method throttle\n  @static\n  @for @ember/runloop\n  @param {Object} [target] target of method to invoke\n  @param {Function|String} method The method to invoke.\n    May be a function or a string. If you pass a string\n    then it will be looked up on the passed target.\n  @param {Object} [args*] Optional arguments to pass to the timeout.\n  @param {Number} spacing Number of milliseconds to space out requests.\n  @param {Boolean} immediate Trigger the function on the leading instead\n    of the trailing edge of the wait interval. Defaults to true.\n  @return {Array} Timer information for use in canceling, see `cancel`.\n  @public\n*/\n\nfunction throttle(...args) {\n  // @ts-expect-error TS doesn't like the rest args here\n  return _backburner.throttle(...args);\n}\n\nexport { _backburner, _cancelTimers, _getCurrentRunLoop, _hasScheduledTimers, _queues, _rsvpErrorQueue, begin, bind, cancel, debounce, end, join, later, next, once, run, schedule, scheduleOnce, throttle };\n","import { E as EmberTesting } from '../shared-chunks/public-api-C3KlJmEr.js';\nimport { registerTestImplementation } from '../@ember/test/index.js';\nexport { default as Adapter } from './lib/adapters/adapter.js';\nexport { default as Test } from './lib/test.js';\n\nregisterTestImplementation(EmberTesting);\n","import EmberObject from '../../../@ember/object/index.js';\n\n/**\n @module @ember/test\n*/\n\n/**\n  The primary purpose of this class is to create hooks that can be implemented\n  by an adapter for various test frameworks.\n\n  @class TestAdapter\n  @public\n*/\n\nconst Adapter = EmberObject.extend({\n  /**\n    This callback will be called whenever an async operation is about to start.\n     Override this to call your framework's methods that handle async\n    operations.\n     @public\n    @method asyncStart\n  */\n  asyncStart() {},\n  /**\n    This callback will be called whenever an async operation has completed.\n     @public\n    @method asyncEnd\n  */\n  asyncEnd() {},\n  /**\n    Override this method with your testing framework's false assertion.\n    This function is called whenever an exception occurs causing the testing\n    promise to fail.\n     QUnit example:\n     ```javascript\n      exception: function(error) {\n        ok(false, error);\n      };\n    ```\n     @public\n    @method exception\n    @param {String} error The exception to be raised.\n  */\n  exception(error) {\n    throw error;\n  }\n});\n\nexport { Adapter as default };\n","import { checkWaiters, unregisterWaiter, registerWaiter } from './test/waiters.js';\n\n/**\n  @module ember\n*/\n\n/**\n  This is a container for an assortment of testing related functionality:\n\n  * Choose your default test adapter (for your framework of choice).\n  * Register/Unregister additional test helpers.\n  * Setup callbacks to be fired when the test helpers are injected into\n    your application.\n\n  @class Test\n  @namespace Ember\n  @public\n*/\nconst Test = {\n  registerWaiter,\n  unregisterWaiter,\n  checkWaiters\n};\n\nexport { Test as default };\n","/**\n @module @ember/test\n*/\nconst contexts = [];\nconst callbacks = [];\n\n/**\n   This allows ember-testing to play nicely with other asynchronous\n   events, such as an application that is waiting for a CSS3\n   transition or an IndexDB transaction. The waiter runs periodically\n   after each async helper (i.e. `click`, `andThen`, `visit`, etc) has executed,\n   until the returning result is truthy. After the waiters finish, the next async helper\n   is executed and the process repeats.\n\n   For example:\n\n   ```javascript\n   import { registerWaiter } from '@ember/test';\n\n   registerWaiter(function() {\n     return myPendingTransactions() === 0;\n   });\n   ```\n   The `context` argument allows you to optionally specify the `this`\n   with which your callback will be invoked.\n\n   For example:\n\n   ```javascript\n   import { registerWaiter } from '@ember/test';\n\n   registerWaiter(MyDB, MyDB.hasPendingTransactions);\n   ```\n\n   @public\n   @for @ember/test\n   @static\n   @method registerWaiter\n   @param {Object} context (optional)\n   @param {Function} callback\n   @since 1.2.0\n*/\n\nfunction registerWaiter(\n// Formatting makes a pretty big difference in how readable this is.\n// prettier-ignore\n...args) {\n  let checkedCallback;\n  let checkedContext;\n  if (args.length === 1) {\n    checkedContext = null;\n    checkedCallback = args[0];\n  } else {\n    checkedContext = args[0];\n    checkedCallback = args[1];\n  }\n  if (indexOf(checkedContext, checkedCallback) > -1) {\n    return;\n  }\n  contexts.push(checkedContext);\n  callbacks.push(checkedCallback);\n}\n\n/**\n   `unregisterWaiter` is used to unregister a callback that was\n   registered with `registerWaiter`.\n\n   @public\n   @for @ember/test\n   @static\n   @method unregisterWaiter\n   @param {Object} context (optional)\n   @param {Function} callback\n   @since 1.2.0\n*/\nfunction unregisterWaiter(context, callback) {\n  if (!callbacks.length) {\n    return;\n  }\n  if (arguments.length === 1) {\n    callback = context;\n    context = null;\n  }\n  let i = indexOf(context, callback);\n  if (i === -1) {\n    return;\n  }\n  contexts.splice(i, 1);\n  callbacks.splice(i, 1);\n}\n\n/**\n  Iterates through each registered test waiter, and invokes\n  its callback. If any waiter returns false, this method will return\n  true indicating that the waiters have not settled yet.\n\n  This is generally used internally from the acceptance/integration test\n  infrastructure.\n\n  @public\n  @for @ember/test\n  @static\n  @method checkWaiters\n*/\nfunction checkWaiters() {\n  if (!callbacks.length) {\n    return false;\n  }\n  for (let i = 0; i < callbacks.length; i++) {\n    let context = contexts[i];\n    let callback = callbacks[i];\n    // SAFETY: The loop ensures that this exists\n    if (!callback.call(context)) {\n      return true;\n    }\n  }\n  return false;\n}\nfunction indexOf(context, callback) {\n  for (let i = 0; i < callbacks.length; i++) {\n    if (callbacks[i] === callback && contexts[i] === context) {\n      return i;\n    }\n  }\n  return -1;\n}\n\nexport { checkWaiters, registerWaiter, unregisterWaiter };\n"],"mappings":";AAOA,MAAMA,EAAoC,WACxC,MAEMC,EAAa,eACbC,EAH+B,oBAAXC,OAGGA,OAAOC,IAAIH,GAAsBA,EAExDI,EAcR,WACE,GAA0B,oBAAfC,WAA4B,OAAiBA;AACxD,GAAoB,oBAATC,KAAsB,OAAiBA;AAClD,GAAsB,oBAAXC,OAAwB,OAAiBA;AAEpD,MAAM,IAAIC,MAAM,iCAClB,CANA;AAZE,IAAIC,EAAUL,EAAOH;AAKrB,YAJgBS,IAAZD,IACFA,EAAUL,EAAOH,GAAU,IAAIU,KAG1BF,CACT,CAd0C;AAkCnC,SAASG,EAASC,GACvBd,EAAQe,IAAID,EAAOE,KAAMF,EAC3B,CAQO,SAASG,EAAWH,GACzBd,EAAQkB,OAAOJ,EAAOE,KACxB,CAQO,SAASG,IACd,MAAMC,EAAmB;AAMzB,OAJApB,EAAQqB,QAASC,IACfF,EAAOG,KAAKD,KAGPF,CACT,CAOO,SAASI,IACd,IAAK,MAAMV,KAAUK,IAClBL,EAAeW;AAGlBzB,EAAQ0B,OACV,CAUO,SAASC,IACd,MAAMP,EAA6B,CACjCQ,QAAS,EACTlB,QAAS,CAAC;AAYZ,OATAV,EAAQqB,QAASP,IACf,IAAKA,EAAOe,YAAa,CACvBT,EAAOQ;AAEP,MAAME,EAAYhB,EAAO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