{"version":3,"file":"vendor-e120b974.chunk.js","sources":["../../node_modules/lwc/dist/engine-dom/esm/es2017/engine-dom.js","../../node_modules/@devforce/th-components/node_modules/@devforce/trailhead-client-env/dist/index.js","../../node_modules/@devforce/th-components/node_modules/@devforce/trailhead-client-logger/dist/index.js","../../node_modules/@devforce/th-components/modules/common/effectAdapter/effectAdapter.js","../../node_modules/@devforce/th-components/modules/common/helpers/helpers.js","../../node_modules/@devforce/th-components/modules/tds/icon/icon.js","../../node_modules/@devforce/th-components/modules/tds/sanitizedHtml/sanitizedHtml.js","../../node_modules/@devforce/th-components/modules/common/slot/slot.js","../../node_modules/@devforce/th-components/modules/common/a11y/a11y.js","../../node_modules/@devforce/th-components/modules/common/popover/popover.js","../../node_modules/@devforce/th-components/modules/tds/tooltip/tooltip.js","../../node_modules/@devforce/th-components/modules/tds/chunk_index/chunk_index.js","../../node_modules/@devforce/th-components/modules/common/mediaQueryAdapter/mediaQueryAdapter.js","../../node_modules/@devforce/th-components/modules/common/animationAdapter/animationAdapter.js","../../node_modules/@devforce/th-components/modules/tds/button/button.js","../../node_modules/@devforce/th-components/modules/tds/buttonIcon/buttonIcon.js","../../node_modules/@devforce/th-components/node_modules/i18n-js/app/assets/javascripts/i18n.js","../../node_modules/@devforce/th-components/node_modules/@devforce/trailhead-client-locale/dist/index.js","../../node_modules/@devforce/th-components/modules/common/labelsAdapter/labelsAdapter.js","../../node_modules/@devforce/th-components/modules/tds/toast/toast.js","../../node_modules/@devforce/th-components/modules/tds/toaster/toaster.js","../../node_modules/@devforce/th-components/modules/tds/spinner/spinner.js","../../node_modules/@devforce/th-components/modules/ui/focusTrap/focusTrap.js","../../node_modules/@devforce/th-components/modules/tds/modal/modal.js","../../node_modules/croppie/croppie.js","../../node_modules/i18n-js/app/assets/javascripts/i18n.js","../../node_modules/@apollo/client/node_modules/tslib/tslib.es6.js","../../node_modules/@apollo/client/node_modules/ts-invariant/lib/invariant.js","../../node_modules/@apollo/client/utilities/globals/maybe.js","../../@lwc/resources/empty_html.js","../../node_modules/@apollo/client/utilities/globals/global.js","../../node_modules/@apollo/client/utilities/globals/DEV.js","../../node_modules/@apollo/client/node_modules/ts-invariant/process/index.js","../../node_modules/graphql/jsutils/isObjectLike.mjs","../../node_modules/graphql/polyfills/symbols.mjs","../../node_modules/graphql/language/location.mjs","../../node_modules/graphql/language/printLocation.mjs","../../node_modules/graphql/error/GraphQLError.mjs","../../node_modules/graphql/error/syntaxError.mjs","../../node_modules/graphql/language/kinds.mjs","../../node_modules/graphql/jsutils/nodejsCustomInspectSymbol.mjs","../../node_modules/graphql/jsutils/defineInspect.mjs","../../node_modules/graphql/jsutils/invariant.mjs","../../node_modules/graphql/language/ast.mjs","../../node_modules/graphql/language/tokenKind.mjs","../../node_modules/graphql/jsutils/inspect.mjs","../../node_modules/graphql/jsutils/devAssert.mjs","../../node_modules/graphql/language/source.mjs","../../node_modules/graphql/language/directiveLocation.mjs","../../node_modules/graphql/language/blockString.mjs","../../node_modules/graphql/language/lexer.mjs","../../node_modules/graphql/language/parser.mjs","../../node_modules/graphql/language/visitor.mjs","../../node_modules/graphql/language/printer.mjs","../../node_modules/graphql/language/predicates.mjs","../../node_modules/@apollo/client/utilities/graphql/directives.js","../../node_modules/@apollo/client/utilities/graphql/fragments.js","../../node_modules/@apollo/client/utilities/common/objects.js","../../node_modules/@apollo/client/utilities/graphql/storeUtils.js","../../node_modules/@apollo/client/utilities/globals/fix-graphql.js","../../node_modules/@apollo/client/utilities/globals/index.js","../../node_modules/@apollo/client/utilities/graphql/getFromAST.js","../../node_modules/@apollo/client/utilities/common/arrays.js","../../node_modules/@apollo/client/utilities/graphql/transform.js","../../node_modules/@apollo/client/utilities/common/mergeDeep.js","../../node_modules/@apollo/client/utilities/policies/pagination.js","../../node_modules/zen-observable-ts/module.js","../../node_modules/symbol-observable/es/index.js","../../node_modules/symbol-observable/es/ponyfill.js","../../node_modules/@apollo/client/utilities/observables/Observable.js","../../node_modules/@apollo/client/utilities/common/cloneDeep.js","../../node_modules/@apollo/client/utilities/common/maybeDeepFreeze.js","../../node_modules/@apollo/client/utilities/observables/iteration.js","../../node_modules/@apollo/client/utilities/observables/asyncMap.js","../../node_modules/@apollo/client/utilities/common/canUse.js","../../node_modules/@apollo/client/utilities/observables/subclassing.js","../../node_modules/@apollo/client/utilities/observables/Concast.js","../../node_modules/@apollo/client/utilities/common/incrementalResult.js","../../node_modules/@apollo/client/utilities/common/errorHandling.js","../../node_modules/@apollo/client/utilities/common/compact.js","../../node_modules/@apollo/client/utilities/common/makeUniqueId.js","../../node_modules/@apollo/client/utilities/common/stringifyForDisplay.js","../../node_modules/@apollo/client/utilities/common/mergeOptions.js","../../node_modules/@apollo/client/link/utils/fromError.js","../../node_modules/@apollo/client/link/utils/throwServerError.js","../../node_modules/@apollo/client/link/core/ApolloLink.js","../../node_modules/@apollo/client/link/utils/createOperation.js","../../node_modules/@apollo/client/link/utils/transformOperation.js","../../node_modules/@apollo/client/link/utils/validateOperation.js","../../node_modules/@apollo/client/link/core/execute.js","../../node_modules/@apollo/client/link/http/iterators/nodeStream.js","../../node_modules/@apollo/client/link/http/iterators/reader.js","../../node_modules/@apollo/client/link/http/responseIterator.js","../../node_modules/@apollo/client/link/http/iterators/promise.js","../../node_modules/@apollo/client/utilities/common/responseIterator.js","../../node_modules/@apollo/client/link/http/iterators/async.js","../../node_modules/@apollo/client/errors/index.js","../../node_modules/@apollo/client/link/http/parseAndCheckHttpResponse.js","../../node_modules/@apollo/client/link/http/serializeFetchParameter.js","../../node_modules/@apollo/client/link/http/selectHttpOptionsAndBody.js","../../node_modules/@apollo/client/link/http/createHttpLink.js","../../node_modules/@apollo/client/link/http/checkFetcher.js","../../node_modules/@apollo/client/link/http/selectURI.js","../../node_modules/@apollo/client/link/http/createSignalIfSupported.js","../../node_modules/@apollo/client/link/http/rewriteURIForGET.js","../../node_modules/@apollo/client/link/http/HttpLink.js","../../node_modules/@wry/equality/lib/equality.esm.js","../../node_modules/@apollo/client/node_modules/optimism/node_modules/@wry/trie/lib/trie.esm.js","../../node_modules/@apollo/client/node_modules/@wry/context/lib/slot.js","../../node_modules/@apollo/client/node_modules/optimism/lib/bundle.esm.js","../../node_modules/@apollo/client/cache/core/cache.js","../../node_modules/@apollo/client/cache/core/types/common.js","../../node_modules/@apollo/client/node_modules/@wry/trie/lib/index.js","../../node_modules/@apollo/client/cache/inmemory/helpers.js","../../node_modules/@apollo/client/cache/inmemory/entityStore.js","../../node_modules/@apollo/client/cache/inmemory/object-canon.js","../../node_modules/@apollo/client/cache/inmemory/readFromStore.js","../../node_modules/@apollo/client/cache/inmemory/reactiveVars.js","../../node_modules/@apollo/client/cache/inmemory/key-extractor.js","../../node_modules/@apollo/client/cache/inmemory/policies.js","../../node_modules/@apollo/client/cache/inmemory/writeToStore.js","../../node_modules/@apollo/client/cache/inmemory/inMemoryCache.js","../../node_modules/@apollo/client/core/networkStatus.js","../../node_modules/@apollo/client/core/ObservableQuery.js","../../node_modules/@apollo/client/core/LocalState.js","../../node_modules/@apollo/client/core/QueryInfo.js","../../node_modules/@apollo/client/core/QueryManager.js","../../node_modules/@apollo/client/core/ApolloClient.js","../../node_modules/@apollo/client/version.js","../../node_modules/graphql-tag/node_modules/tslib/tslib.es6.js","../../node_modules/graphql-tag/lib/index.js","../../node_modules/lodash/_listCacheClear.js","../../node_modules/lodash/eq.js","../../node_modules/lodash/_assocIndexOf.js","../../node_modules/lodash/_listCacheDelete.js","../../node_modules/lodash/_listCacheGet.js","../../node_modules/lodash/_listCacheHas.js","../../node_modules/lodash/_listCacheSet.js","../../node_modules/lodash/_ListCache.js","../../node_modules/lodash/_stackClear.js","../../node_modules/lodash/_stackDelete.js","../../node_modules/lodash/_stackGet.js","../../node_modules/lodash/_stackHas.js","../../node_modules/lodash/_freeGlobal.js","../../node_modules/lodash/_root.js","../../node_modules/lodash/_Symbol.js","../../node_modules/lodash/_getRawTag.js","../../node_modules/lodash/_objectToString.js","../../node_modules/lodash/_baseGetTag.js","../../node_modules/lodash/isObject.js","../../node_modules/lodash/isFunction.js","../../node_modules/lodash/_coreJsData.js","../../node_modules/lodash/_isMasked.js","../../node_modules/lodash/_toSource.js","../../node_modules/lodash/_baseIsNative.js","../../node_modules/lodash/_getValue.js","../../node_modules/lodash/_getNative.js","../../node_modules/lodash/_Map.js","../../node_modules/lodash/_nativeCreate.js","../../node_modules/lodash/_hashClear.js","../../node_modules/lodash/_hashDelete.js","../../node_modules/lodash/_hashGet.js","../../node_modules/lodash/_hashHas.js","../../node_modules/lodash/_hashSet.js","../../node_modules/lodash/_Hash.js","../../node_modules/lodash/_mapCacheClear.js","../../node_modules/lodash/_isKeyable.js","../../node_modules/lodash/_getMapData.js","../../node_modules/lodash/_mapCacheDelete.js","../../node_modules/lodash/_mapCacheGet.js","../../node_modules/lodash/_mapCacheHas.js","../../node_modules/lodash/_mapCacheSet.js","../../node_modules/lodash/_MapCache.js","../../node_modules/lodash/_stackSet.js","../../node_modules/lodash/_Stack.js","../../node_modules/lodash/_setCacheAdd.js","../../node_modules/lodash/_setCacheHas.js","../../node_modules/lodash/_SetCache.js","../../node_modules/lodash/_arraySome.js","../../node_modules/lodash/_cacheHas.js","../../node_modules/lodash/_equalArrays.js","../../node_modules/lodash/_Uint8Array.js","../../node_modules/lodash/_mapToArray.js","../../node_modules/lodash/_setToArray.js","../../node_modules/lodash/_equalByTag.js","../../node_modules/lodash/_arrayPush.js","../../node_modules/lodash/isArray.js","../../node_modules/lodash/_baseGetAllKeys.js","../../node_modules/lodash/_arrayFilter.js","../../node_modules/lodash/stubArray.js","../../node_modules/lodash/_getSymbols.js","../../node_modules/lodash/_baseTimes.js","../../node_modules/lodash/isObjectLike.js","../../node_modules/lodash/_baseIsArguments.js","../../node_modules/lodash/isArguments.js","../../node_modules/lodash/stubFalse.js","../../node_modules/lodash/isBuffer.js","../../node_modules/lodash/_isIndex.js","../../node_modules/lodash/isLength.js","../../node_modules/lodash/_baseIsTypedArray.js","../../node_modules/lodash/_baseUnary.js","../../node_modules/lodash/_nodeUtil.js","../../node_modules/lodash/isTypedArray.js","../../node_modules/lodash/_arrayLikeKeys.js","../../node_modules/lodash/_isPrototype.js","../../node_modules/lodash/_overArg.js","../../node_modules/lodash/_nativeKeys.js","../../node_modules/lodash/_baseKeys.js","../../node_modules/lodash/isArrayLike.js","../../node_modules/lodash/keys.js","../../node_modules/lodash/_getAllKeys.js","../../node_modules/lodash/_equalObjects.js","../../node_modules/lodash/_DataView.js","../../node_modules/lodash/_Promise.js","../../node_modules/lodash/_Set.js","../../node_modules/lodash/_WeakMap.js","../../node_modules/lodash/_getTag.js","../../node_modules/lodash/_baseIsEqualDeep.js","../../node_modules/lodash/_baseIsEqual.js","../../node_modules/lodash/isEqual.js","../../node_modules/lodash/_defineProperty.js","../../node_modules/lodash/_baseAssignValue.js","../../node_modules/lodash/_assignValue.js","../../node_modules/lodash/isSymbol.js","../../node_modules/lodash/_isKey.js","../../node_modules/lodash/memoize.js","../../node_modules/lodash/_memoizeCapped.js","../../node_modules/lodash/_stringToPath.js","../../node_modules/lodash/_arrayMap.js","../../node_modules/lodash/_baseToString.js","../../node_modules/lodash/toString.js","../../node_modules/lodash/_castPath.js","../../node_modules/lodash/_toKey.js","../../node_modules/lodash/_baseSet.js","../../node_modules/lodash/set.js","../../node_modules/@devforce/trailhead-client-locale/node_modules/i18n-js/app/assets/javascripts/i18n.js","../../node_modules/@devforce/trailhead-client-env/dist/index.js","../../node_modules/@devforce/trailhead-client-locale/node_modules/@devforce/trailhead-client-logger/dist/index.js","../../node_modules/@devforce/trailhead-client-locale/dist/index.js","../../node_modules/@apollo/client/link/context/index.js","../../node_modules/@devforce/th-components/modules/common/context/context.js","../../node_modules/@devforce/trailhead-client-logger/dist/index.js","../../node_modules/@devforce/trailhead-client-fetch/dist/index.js","../../node_modules/lodash/lodash.js","../../node_modules/@devforce/th-components/modules/tds/input/input.js","../../node_modules/@devforce/th-components/modules/common/reflectedElement/reflectedElement.js","../../node_modules/@devforce/th-components/modules/tds/select/select.js","../../node_modules/@devforce/th-components/modules/tds/textarea/textarea.js","../../node_modules/libphonenumber-js/metadata.min.json.js","../../node_modules/libphonenumber-js/min/exports/withMetadataArgument.js","../../node_modules/libphonenumber-js/es6/ParseError.js","../../node_modules/libphonenumber-js/es6/constants.js","../../node_modules/libphonenumber-js/es6/tools/semver-compare.js","../../node_modules/libphonenumber-js/es6/helpers/isObject.js","../../node_modules/libphonenumber-js/es6/metadata.js","../../node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js","../../node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js","../../node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js","../../node_modules/libphonenumber-js/es6/helpers/parseDigits.js","../../node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js","../../node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js","../../node_modules/libphonenumber-js/es6/helpers/mergeArrays.js","../../node_modules/libphonenumber-js/es6/isPossible.js","../../node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js","../../node_modules/libphonenumber-js/es6/helpers/getNumberType.js","../../node_modules/libphonenumber-js/es6/helpers/getPossibleCountriesForNumber.js","../../node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js","../../node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js","../../node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js","../../node_modules/libphonenumber-js/es6/format.js","../../node_modules/libphonenumber-js/es6/helpers/RFC3966.js","../../node_modules/libphonenumber-js/es6/PhoneNumber.js","../../node_modules/libphonenumber-js/es6/isValid.js","../../node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js","../../node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js","../../node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js","../../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js","../../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js","../../node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js","../../node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js","../../node_modules/libphonenumber-js/es6/helpers/extractPhoneContext.js","../../node_modules/libphonenumber-js/es6/helpers/extractFormattedPhoneNumberFromPossibleRfc3966NumberUri.js","../../node_modules/libphonenumber-js/es6/parse.js","../../node_modules/libphonenumber-js/es6/parsePhoneNumberWithError_.js","../../node_modules/libphonenumber-js/es6/normalizeArguments.js","../../node_modules/libphonenumber-js/es6/parsePhoneNumber_.js","../../node_modules/libphonenumber-js/es6/parsePhoneNumber.js","../../node_modules/libphonenumber-js/es6/isPossiblePhoneNumber.js","../../node_modules/libphonenumber-js/es6/validatePhoneNumberLength.js","../../node_modules/libphonenumber-js/min/exports/parsePhoneNumber.js","../../node_modules/libphonenumber-js/min/exports/isPossiblePhoneNumber.js","../../node_modules/libphonenumber-js/min/exports/validatePhoneNumberLength.js","../../node_modules/@sfdc-www/digital-i18n/node_modules/i18n-js/app/assets/javascripts/i18n.js","../../node_modules/@sfdc-www/digital-i18n/dist/localeFormatting.js","../../node_modules/@sfdc-www/digital-i18n/dist/i18n.js","../../node_modules/@sfdc-www/digital-i18n/dist/countryOptions.js","../../node_modules/@sfdc-www/digital-i18n/dist/commonLocales.js","../../node_modules/@devforce/th-components/modules/tds/buttonLink/buttonLink.js","../../node_modules/@devforce/th-components/modules/common/track/track.js","../../node_modules/@devforce/th-components/modules/common/chunk_debounce/chunk_debounce.js","../../node_modules/@devforce/th-components/modules/common/resizeObserverAdapter/resizeObserverAdapter.js","../../node_modules/@devforce/th-components/modules/tds/truncate/truncate.js","../../node_modules/classnames/index.js","../../node_modules/fast-deep-equal/index.js","../../node_modules/lodash/_assignMergeValue.js","../../node_modules/lodash/_createBaseFor.js","../../node_modules/lodash/_baseFor.js","../../node_modules/lodash/_cloneBuffer.js","../../node_modules/lodash/_cloneArrayBuffer.js","../../node_modules/lodash/_cloneTypedArray.js","../../node_modules/lodash/_copyArray.js","../../node_modules/lodash/_baseCreate.js","../../node_modules/lodash/_getPrototype.js","../../node_modules/lodash/_initCloneObject.js","../../node_modules/lodash/isArrayLikeObject.js","../../node_modules/lodash/isPlainObject.js","../../node_modules/lodash/_safeGet.js","../../node_modules/lodash/_copyObject.js","../../node_modules/lodash/_nativeKeysIn.js","../../node_modules/lodash/_baseKeysIn.js","../../node_modules/lodash/keysIn.js","../../node_modules/lodash/toPlainObject.js","../../node_modules/lodash/_baseMergeDeep.js","../../node_modules/lodash/_baseMerge.js","../../node_modules/lodash/identity.js","../../node_modules/lodash/_apply.js","../../node_modules/lodash/_overRest.js","../../node_modules/lodash/constant.js","../../node_modules/lodash/_baseSetToString.js","../../node_modules/lodash/_shortOut.js","../../node_modules/lodash/_setToString.js","../../node_modules/lodash/_baseRest.js","../../node_modules/lodash/_isIterateeCall.js","../../node_modules/lodash/_createAssigner.js","../../node_modules/lodash/merge.js","../../node_modules/@devforce/th-components/modules/common/environment/environment.js","../../node_modules/@devforce/th-components/modules/tds/contextAdapter/contextAdapter.js","../../node_modules/@devforce/th-components/modules/tds/dangerousHtml/dangerousHtml.js","../../node_modules/@apollo/client/testing/core/mocking/mockLink.js","../../node_modules/@devforce/th-components/modules/tds/badge/badge.js","../../node_modules/lit-html/lib/directive.js","../../node_modules/lit-html/lib/dom.js","../../node_modules/lit-html/lib/part.js","../../node_modules/lit-html/lib/template.js","../../node_modules/lit-html/lib/template-instance.js","../../node_modules/lit-html/lib/template-result.js","../../node_modules/lit-html/lib/parts.js","../../node_modules/lit-html/lib/default-template-processor.js","../../node_modules/lit-html/lib/template-factory.js","../../node_modules/lit-html/lib/render.js","../../node_modules/lit-html/lit-html.js","../../node_modules/@devforce/th-components/modules/tds/themeProvider/themeProvider.js","../../node_modules/@devforce/th-components/modules/tds/avatar/avatar.js","../../node_modules/@devforce/th-components/modules/tds/headerLogo/headerLogo.js","../../node_modules/@devforce/th-components/modules/tds/buttonIconLink/buttonIconLink.js","../../node_modules/@devforce/th-components/modules/tds/headerHelpButton/headerHelpButton.js","../../node_modules/@devforce/th-components/modules/tds/buttonIconCount/buttonIconCount.js","../../node_modules/@devforce/th-components/modules/ui/focusVisible/focusVisible.js","../../node_modules/@devforce/th-components/modules/common/menu/menu.js","../../node_modules/@devforce/th-components/modules/common/menuAdapter/menuAdapter.js","../../node_modules/@devforce/th-components/modules/tds/appLauncher/appLauncher.js","../../node_modules/@devforce/trailhead-client-auth/node_modules/@devforce/trailhead-client-env/dist/index.js","../../node_modules/@devforce/trailhead-client-auth/node_modules/@devforce/trailhead-client-logger/dist/index.js","../../node_modules/@devforce/trailhead-client-auth/dist/index.js","../../node_modules/@devforce/th-components/modules/common/withImageProxy/withImageProxy.js","../../node_modules/@devforce/th-components/modules/tds/headerAvatar/headerAvatar.js","../../node_modules/@devforce/th-components/modules/tds/headerProfileSummary/headerProfileSummary.js","../../node_modules/@devforce/th-components/modules/tds/promo/promo.js","../../node_modules/@devforce/th-components/modules/tds/headerNavItem/headerNavItem.js","../../node_modules/@devforce/th-components/modules/tds/headerNav/headerNav.js","../../node_modules/@devforce/th-components/modules/tds/headerMobile/headerMobile.js","../../node_modules/@devforce/th-components/modules/tds/userMenu/userMenu.js","../../node_modules/@devforce/th-components/modules/tds/headerProfile/headerProfile.js","../../node_modules/@devforce/th-components/modules/common/resizeAdapter/resizeAdapter.js","../../node_modules/@devforce/th-components/modules/tds/headerDesktop/headerDesktop.js","../../node_modules/@devforce/th-components/modules/tds/header/header.js","../../node_modules/@sfdc-www/wes-lwc-components/dist/modules/wes/icon/icon.js","../../node_modules/@sfdc-www/wes-lwc-components/dist/modules/wes/sanitizedHtml/sanitizedHtml.js","../../node_modules/@sfdc-www/wes-lwc-components/dist/modules/wes/chunk_index/chunk_index.js","../../node_modules/@sfdc-www/wes-lwc-components/dist/modules/wes/select/select.js","../../node_modules/@sfdc-www/digital-i18n/dist/modules/i18n/labelsAdapter/labelsAdapter.js","../../node_modules/@sfdc-www/wes-lwc-components/dist/modules/wes/chunk_countryOptions/chunk_countryOptions.js","../../node_modules/@sfdc-www/wes-lwc-components/dist/modules/wes/footer/footer.js","../../node_modules/@sfdc-www/wes-lwc-components/dist/modules/common/clientLogger/clientLogger.js","../../node_modules/@devforce/th-components/modules/tds/alert/alert.js","../../node_modules/@devforce/th-components/modules/tds/chunk_debounce/chunk_debounce.js","../../node_modules/@devforce/th-components/modules/tds/search/search.js","../../node_modules/@sfdc-www/wes-lwc-components/dist/modules/common/chunk_index/chunk_index.js"],"sourcesContent":["/* proxy-compat-disable */\n\n/**\n * Copyright (C) 2018 salesforce.com, inc.\n */\n\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\nfunction invariant(value, msg) {\n if (!value) {\n throw new Error(`Invariant Violation: ${msg}`);\n }\n}\n\nfunction isTrue$1(value, msg) {\n if (!value) {\n throw new Error(`Assert Violation: ${msg}`);\n }\n}\n\nfunction isFalse$1(value, msg) {\n if (value) {\n throw new Error(`Assert Violation: ${msg}`);\n }\n}\n\nfunction fail(msg) {\n throw new Error(msg);\n}\n\nvar assert = /*#__PURE__*/Object.freeze({\n __proto__: null,\n invariant: invariant,\n isTrue: isTrue$1,\n isFalse: isFalse$1,\n fail: fail\n});\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\nconst {\n assign,\n create,\n defineProperties,\n defineProperty,\n freeze,\n getOwnPropertyDescriptor: getOwnPropertyDescriptor$1,\n getOwnPropertyNames: getOwnPropertyNames$1,\n getPrototypeOf: getPrototypeOf$1,\n hasOwnProperty: hasOwnProperty$1,\n isFrozen,\n keys,\n seal,\n setPrototypeOf\n} = Object;\nconst {\n isArray: isArray$1\n} = Array;\nconst {\n filter: ArrayFilter,\n find: ArrayFind,\n indexOf: ArrayIndexOf,\n join: ArrayJoin,\n map: ArrayMap,\n push: ArrayPush$1,\n reduce: ArrayReduce,\n reverse: ArrayReverse,\n slice: ArraySlice,\n splice: ArraySplice,\n unshift: ArrayUnshift,\n forEach\n} = Array.prototype;\nconst {\n fromCharCode: StringFromCharCode\n} = String;\nconst {\n charCodeAt: StringCharCodeAt,\n replace: StringReplace,\n slice: StringSlice,\n toLowerCase: StringToLowerCase\n} = String.prototype;\n\nfunction isUndefined$1(obj) {\n return obj === undefined;\n}\n\nfunction isNull(obj) {\n return obj === null;\n}\n\nfunction isTrue(obj) {\n return obj === true;\n}\n\nfunction isFalse(obj) {\n return obj === false;\n}\n\nfunction isBoolean(obj) {\n return typeof obj === 'boolean';\n}\n\nfunction isFunction$1(obj) {\n return typeof obj === 'function';\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object';\n}\n\nfunction isString(obj) {\n return typeof obj === 'string';\n}\n\nfunction isNumber(obj) {\n return typeof obj === 'number';\n}\n\nfunction noop() {\n /* Do nothing */\n}\n\nconst OtS$1 = {}.toString;\n\nfunction toString$1(obj) {\n if (obj && obj.toString) {\n // Arrays might hold objects with \"null\" prototype So using\n // Array.prototype.toString directly will cause an error Iterate through\n // all the items and handle individually.\n if (isArray$1(obj)) {\n return ArrayJoin.call(ArrayMap.call(obj, toString$1), ',');\n }\n\n return obj.toString();\n } else if (typeof obj === 'object') {\n return OtS$1.call(obj);\n } else {\n return obj + '';\n }\n}\n\nfunction getPropertyDescriptor(o, p) {\n do {\n const d = getOwnPropertyDescriptor$1(o, p);\n\n if (!isUndefined$1(d)) {\n return d;\n }\n\n o = getPrototypeOf$1(o);\n } while (o !== null);\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n/**\n * According to the following list, there are 48 aria attributes of which two (ariaDropEffect and\n * ariaGrabbed) are deprecated:\n * https://www.w3.org/TR/wai-aria-1.1/#x6-6-definitions-of-states-and-properties-all-aria-attributes\n *\n * The above list of 46 aria attributes is consistent with the following resources:\n * https://github.com/w3c/aria/pull/708/files#diff-eacf331f0ffc35d4b482f1d15a887d3bR11060\n * https://wicg.github.io/aom/spec/aria-reflection.html\n */\n\n\nconst AriaPropertyNames = ['ariaActiveDescendant', 'ariaAtomic', 'ariaAutoComplete', 'ariaBusy', 'ariaChecked', 'ariaColCount', 'ariaColIndex', 'ariaColSpan', 'ariaControls', 'ariaCurrent', 'ariaDescribedBy', 'ariaDetails', 'ariaDisabled', 'ariaErrorMessage', 'ariaExpanded', 'ariaFlowTo', 'ariaHasPopup', 'ariaHidden', 'ariaInvalid', 'ariaKeyShortcuts', 'ariaLabel', 'ariaLabelledBy', 'ariaLevel', 'ariaLive', 'ariaModal', 'ariaMultiLine', 'ariaMultiSelectable', 'ariaOrientation', 'ariaOwns', 'ariaPlaceholder', 'ariaPosInSet', 'ariaPressed', 'ariaReadOnly', 'ariaRelevant', 'ariaRequired', 'ariaRoleDescription', 'ariaRowCount', 'ariaRowIndex', 'ariaRowSpan', 'ariaSelected', 'ariaSetSize', 'ariaSort', 'ariaValueMax', 'ariaValueMin', 'ariaValueNow', 'ariaValueText', 'role'];\n\nconst {\n AriaAttrNameToPropNameMap,\n AriaPropNameToAttrNameMap\n} = /*@__PURE__*/(() => {\n const AriaAttrNameToPropNameMap = create(null);\n const AriaPropNameToAttrNameMap = create(null); // Synthetic creation of all AOM property descriptors for Custom Elements\n\n forEach.call(AriaPropertyNames, propName => {\n const attrName = StringToLowerCase.call(StringReplace.call(propName, /^aria/, () => 'aria-'));\n AriaAttrNameToPropNameMap[attrName] = propName;\n AriaPropNameToAttrNameMap[propName] = attrName;\n });\n return {\n AriaAttrNameToPropNameMap,\n AriaPropNameToAttrNameMap\n };\n})();\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n// Inspired from: https://mathiasbynens.be/notes/globalthis\n\n\nconst _globalThis = /*@__PURE__*/function () {\n // On recent browsers, `globalThis` is already defined. In this case return it directly.\n if (typeof globalThis === 'object') {\n return globalThis;\n }\n\n let _globalThis;\n\n try {\n // eslint-disable-next-line no-extend-native\n Object.defineProperty(Object.prototype, '__magic__', {\n get: function () {\n return this;\n },\n configurable: true\n }); // __magic__ is undefined in Safari 10 and IE10 and older.\n // @ts-ignore\n // eslint-disable-next-line no-undef\n\n _globalThis = __magic__; // @ts-ignore\n\n delete Object.prototype.__magic__;\n } catch (ex) {// In IE8, Object.defineProperty only works on DOM objects.\n } finally {\n // If the magic above fails for some reason we assume that we are in a legacy browser.\n // Assume `window` exists in this case.\n if (typeof _globalThis === 'undefined') {\n // @ts-ignore\n _globalThis = window;\n }\n }\n\n return _globalThis;\n}();\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst KEY__IS_NATIVE_SHADOW_ROOT_DEFINED = '$isNativeShadowRootDefined$';\nconst KEY__SHADOW_RESOLVER = '$shadowResolver$';\nconst KEY__SHADOW_TOKEN = '$shadowToken$';\nconst KEY__SYNTHETIC_MODE = '$$lwc-synthetic-mode';\nconst KEY__SCOPED_CSS = '$scoped$';\n/**\n * Map composed of properties to attributes not following the HTML property to attribute mapping\n * convention.\n */\n\nconst NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING = new Map([['accessKey', 'accesskey'], ['readOnly', 'readonly'], ['tabIndex', 'tabindex'], ['bgColor', 'bgcolor'], ['colSpan', 'colspan'], ['rowSpan', 'rowspan'], ['contentEditable', 'contenteditable'], ['crossOrigin', 'crossorigin'], ['dateTime', 'datetime'], ['formAction', 'formaction'], ['isMap', 'ismap'], ['maxLength', 'maxlength'], ['minLength', 'minlength'], ['noValidate', 'novalidate'], ['useMap', 'usemap'], ['htmlFor', 'for']]);\n/**\n * Map associating previously transformed HTML property into HTML attribute.\n */\n\nconst CACHED_PROPERTY_ATTRIBUTE_MAPPING = new Map();\n\nfunction htmlPropertyToAttribute(propName) {\n const ariaAttributeName = AriaPropNameToAttrNameMap[propName];\n\n if (!isUndefined$1(ariaAttributeName)) {\n return ariaAttributeName;\n }\n\n const specialAttributeName = NO_STANDARD_PROPERTY_ATTRIBUTE_MAPPING.get(propName);\n\n if (!isUndefined$1(specialAttributeName)) {\n return specialAttributeName;\n }\n\n const cachedAttributeName = CACHED_PROPERTY_ATTRIBUTE_MAPPING.get(propName);\n\n if (!isUndefined$1(cachedAttributeName)) {\n return cachedAttributeName;\n }\n\n let attributeName = '';\n\n for (let i = 0, len = propName.length; i < len; i++) {\n const code = StringCharCodeAt.call(propName, i);\n\n if (code >= 65 && // \"A\"\n code <= 90 // \"Z\"\n ) {\n attributeName += '-' + StringFromCharCode(code + 32);\n } else {\n attributeName += StringFromCharCode(code);\n }\n }\n\n CACHED_PROPERTY_ATTRIBUTE_MAPPING.set(propName, attributeName);\n return attributeName;\n}\n\nconst XML_NAMESPACE = 'http://www.w3.org/XML/1998/namespace';\nconst SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nconst XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';\n/** version: 2.9.0 */\n\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\nfunction detect(propName) {\n return Object.getOwnPropertyDescriptor(Element.prototype, propName) === undefined;\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst nodeToAriaPropertyValuesMap = new WeakMap();\n\nfunction getAriaPropertyMap(elm) {\n let map = nodeToAriaPropertyValuesMap.get(elm);\n\n if (map === undefined) {\n map = {};\n nodeToAriaPropertyValuesMap.set(elm, map);\n }\n\n return map;\n}\n\nfunction getNormalizedAriaPropertyValue(value) {\n return value == null ? null : String(value);\n}\n\nfunction createAriaPropertyPropertyDescriptor(propName, attrName) {\n return {\n get() {\n const map = getAriaPropertyMap(this);\n\n if (hasOwnProperty$1.call(map, propName)) {\n return map[propName];\n } // otherwise just reflect what's in the attribute\n\n\n return this.hasAttribute(attrName) ? this.getAttribute(attrName) : null;\n },\n\n set(newValue) {\n const normalizedValue = getNormalizedAriaPropertyValue(newValue);\n const map = getAriaPropertyMap(this);\n map[propName] = normalizedValue; // reflect into the corresponding attribute\n\n if (newValue === null) {\n this.removeAttribute(attrName);\n } else {\n this.setAttribute(attrName, newValue);\n }\n },\n\n configurable: true,\n enumerable: true\n };\n}\n\nfunction patch(propName) {\n // Typescript is inferring the wrong function type for this particular\n // overloaded method: https://github.com/Microsoft/TypeScript/issues/27972\n // @ts-ignore type-mismatch\n const attrName = AriaPropNameToAttrNameMap[propName];\n const descriptor = createAriaPropertyPropertyDescriptor(propName, attrName);\n Object.defineProperty(Element.prototype, propName, descriptor);\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst ElementPrototypeAriaPropertyNames = keys(AriaPropNameToAttrNameMap);\n\nfor (let i = 0, len = ElementPrototypeAriaPropertyNames.length; i < len; i += 1) {\n const propName = ElementPrototypeAriaPropertyNames[i];\n\n if (detect(propName)) {\n patch(propName);\n }\n}\n/**\n * Copyright (C) 2018 salesforce.com, inc.\n */\n\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst features = {\n ENABLE_REACTIVE_SETTER: null,\n ENABLE_HMR: null,\n ENABLE_INNER_OUTER_TEXT_PATCH: null,\n ENABLE_ELEMENT_PATCH: null,\n ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST: null,\n ENABLE_NODE_LIST_PATCH: null,\n ENABLE_HTML_COLLECTIONS_PATCH: null,\n ENABLE_NODE_PATCH: null,\n ENABLE_WIRE_SYNC_EMIT: null\n};\n\nif (!_globalThis.lwcRuntimeFlags) {\n Object.defineProperty(_globalThis, 'lwcRuntimeFlags', {\n value: create(null)\n });\n}\n\nconst runtimeFlags = _globalThis.lwcRuntimeFlags;\n/**\n * Set the value at runtime of a given feature flag. This method only be invoked once per feature\n * flag. It is meant to be used during the app initialization.\n */\n\nfunction setFeatureFlag(name, value) {\n if (!isBoolean(value)) {\n const message = `Failed to set the value \"${value}\" for the runtime feature flag \"${name}\". Runtime feature flags can only be set to a boolean value.`;\n\n if (process.env.NODE_ENV !== 'production') {\n throw new TypeError(message);\n } else {\n // eslint-disable-next-line no-console\n console.error(message);\n return;\n }\n }\n\n if (isUndefined$1(features[name])) {\n const availableFlags = keys(features).map(name => `\"${name}\"`).join(', '); // eslint-disable-next-line no-console\n\n console.warn(`Failed to set the value \"${value}\" for the runtime feature flag \"${name}\" because it is undefined. Available flags: ${availableFlags}.`);\n return;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // Allow the same flag to be set more than once outside of production to enable testing\n runtimeFlags[name] = value;\n } else {\n // Disallow the same flag to be set more than once in production\n const runtimeValue = runtimeFlags[name];\n\n if (!isUndefined$1(runtimeValue)) {\n // eslint-disable-next-line no-console\n console.error(`Failed to set the value \"${value}\" for the runtime feature flag \"${name}\". \"${name}\" has already been set with the value \"${runtimeValue}\".`);\n return;\n }\n\n defineProperty(runtimeFlags, name, {\n value\n });\n }\n}\n/**\n * Set the value at runtime of a given feature flag. This method should only be used for testing\n * purposes. It is a no-op when invoked in production mode.\n */\n\n\nfunction setFeatureFlagForTest(name, value) {\n if (process.env.NODE_ENV !== 'production') {\n setFeatureFlag(name, value);\n }\n}\n/** version: 2.9.0 */\n\n/* proxy-compat-disable */\n\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nlet nextTickCallbackQueue = [];\nconst SPACE_CHAR = 32;\nconst EmptyObject = seal(create(null));\nconst EmptyArray = seal([]);\n\nfunction flushCallbackQueue() {\n if (process.env.NODE_ENV !== 'production') {\n if (nextTickCallbackQueue.length === 0) {\n throw new Error(`Internal Error: If callbackQueue is scheduled, it is because there must be at least one callback on this pending queue.`);\n }\n }\n\n const callbacks = nextTickCallbackQueue;\n nextTickCallbackQueue = []; // reset to a new queue\n\n for (let i = 0, len = callbacks.length; i < len; i += 1) {\n callbacks[i]();\n }\n}\n\nfunction addCallbackToNextTick(callback) {\n if (process.env.NODE_ENV !== 'production') {\n if (!isFunction$1(callback)) {\n throw new Error(`Internal Error: addCallbackToNextTick() can only accept a function callback`);\n }\n }\n\n if (nextTickCallbackQueue.length === 0) {\n Promise.resolve().then(flushCallbackQueue);\n }\n\n ArrayPush$1.call(nextTickCallbackQueue, callback);\n}\n\nfunction guid() {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);\n }\n\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4();\n} // Borrowed from Vue template compiler.\n// https://github.com/vuejs/vue/blob/531371b818b0e31a989a06df43789728f23dc4e8/src/platforms/web/util/style.js#L5-L16\n\n\nconst DECLARATION_DELIMITER = /;(?![^(]*\\))/g;\nconst PROPERTY_DELIMITER = /:(.+)/;\n\nfunction parseStyleText(cssText) {\n const styleMap = {};\n const declarations = cssText.split(DECLARATION_DELIMITER);\n\n for (const declaration of declarations) {\n if (declaration) {\n const [prop, value] = declaration.split(PROPERTY_DELIMITER);\n\n if (prop !== undefined && value !== undefined) {\n styleMap[prop.trim()] = value.trim();\n }\n }\n }\n\n return styleMap;\n} // Make a shallow copy of an object but omit the given key\n\n\nfunction cloneAndOmitKey(object, keyToOmit) {\n const result = {};\n\n for (const key of Object.keys(object)) {\n if (key !== keyToOmit) {\n result[key] = object[key];\n }\n }\n\n return result;\n} //\n// Primitives\n//\n\n\nlet ssr$1;\n\nfunction setSsr(ssrImpl) {\n ssr$1 = ssrImpl;\n}\n\nlet isNativeShadowDefined$1;\n\nfunction setIsNativeShadowDefined(isNativeShadowDefinedImpl) {\n isNativeShadowDefined$1 = isNativeShadowDefinedImpl;\n}\n\nlet isSyntheticShadowDefined$1;\n\nfunction setIsSyntheticShadowDefined(isSyntheticShadowDefinedImpl) {\n isSyntheticShadowDefined$1 = isSyntheticShadowDefinedImpl;\n}\n\nlet HTMLElementExported$1;\n\nfunction setHTMLElement(HTMLElementImpl) {\n HTMLElementExported$1 = HTMLElementImpl;\n}\n\nlet isHydrating$1;\n\nfunction setIsHydrating$1(isHydratingImpl) {\n isHydrating$1 = isHydratingImpl;\n}\n\nlet insert$1;\n\nfunction setInsert(insertImpl) {\n insert$1 = insertImpl;\n}\n\nlet remove$1;\n\nfunction setRemove(removeImpl) {\n remove$1 = removeImpl;\n}\n\nlet createElement$2;\n\nfunction setCreateElement(createElementImpl) {\n createElement$2 = createElementImpl;\n}\n\nlet createText$1;\n\nfunction setCreateText(createTextImpl) {\n createText$1 = createTextImpl;\n}\n\nlet createComment$1;\n\nfunction setCreateComment(createCommentImpl) {\n createComment$1 = createCommentImpl;\n}\n\nlet nextSibling$1;\n\nfunction setNextSibling(nextSiblingImpl) {\n nextSibling$1 = nextSiblingImpl;\n}\n\nlet attachShadow$1;\n\nfunction setAttachShadow(attachShadowImpl) {\n attachShadow$1 = attachShadowImpl;\n}\n\nlet getProperty$1;\n\nfunction setGetProperty(getPropertyImpl) {\n getProperty$1 = getPropertyImpl;\n}\n\nlet setProperty$1;\n\nfunction setSetProperty(setPropertyImpl) {\n setProperty$1 = setPropertyImpl;\n}\n\nlet setText$1;\n\nfunction setSetText(setTextImpl) {\n setText$1 = setTextImpl;\n}\n\nlet getAttribute$1;\n\nfunction setGetAttribute(getAttributeImpl) {\n getAttribute$1 = getAttributeImpl;\n}\n\nlet setAttribute$1;\n\nfunction setSetAttribute(setAttributeImpl) {\n setAttribute$1 = setAttributeImpl;\n}\n\nlet removeAttribute$1;\n\nfunction setRemoveAttribute(removeAttributeImpl) {\n removeAttribute$1 = removeAttributeImpl;\n}\n\nlet addEventListener$1;\n\nfunction setAddEventListener(addEventListenerImpl) {\n addEventListener$1 = addEventListenerImpl;\n}\n\nlet removeEventListener$1;\n\nfunction setRemoveEventListener(removeEventListenerImpl) {\n removeEventListener$1 = removeEventListenerImpl;\n}\n\nlet dispatchEvent$1;\n\nfunction setDispatchEvent(dispatchEventImpl) {\n dispatchEvent$1 = dispatchEventImpl;\n}\n\nlet getClassList$1;\n\nfunction setGetClassList(getClassListImpl) {\n getClassList$1 = getClassListImpl;\n}\n\nlet setCSSStyleProperty$1;\n\nfunction setSetCSSStyleProperty(setCSSStylePropertyImpl) {\n setCSSStyleProperty$1 = setCSSStylePropertyImpl;\n}\n\nlet getBoundingClientRect$1;\n\nfunction setGetBoundingClientRect(getBoundingClientRectImpl) {\n getBoundingClientRect$1 = getBoundingClientRectImpl;\n}\n\nlet querySelector$1;\n\nfunction setQuerySelector(querySelectorImpl) {\n querySelector$1 = querySelectorImpl;\n}\n\nlet querySelectorAll$1;\n\nfunction setQuerySelectorAll(querySelectorAllImpl) {\n querySelectorAll$1 = querySelectorAllImpl;\n}\n\nlet getElementsByTagName$1;\n\nfunction setGetElementsByTagName(getElementsByTagNameImpl) {\n getElementsByTagName$1 = getElementsByTagNameImpl;\n}\n\nlet getElementsByClassName$1;\n\nfunction setGetElementsByClassName(getElementsByClassNameImpl) {\n getElementsByClassName$1 = getElementsByClassNameImpl;\n}\n\nlet getChildren$1;\n\nfunction setGetChildren(getChildrenImpl) {\n getChildren$1 = getChildrenImpl;\n}\n\nlet getChildNodes$1;\n\nfunction setGetChildNodes(getChildNodesImpl) {\n getChildNodes$1 = getChildNodesImpl;\n}\n\nlet getFirstChild$1;\n\nfunction setGetFirstChild(getFirstChildImpl) {\n getFirstChild$1 = getFirstChildImpl;\n}\n\nlet getFirstElementChild$1;\n\nfunction setGetFirstElementChild(getFirstElementChildImpl) {\n getFirstElementChild$1 = getFirstElementChildImpl;\n}\n\nlet getLastChild$1;\n\nfunction setGetLastChild(getLastChildImpl) {\n getLastChild$1 = getLastChildImpl;\n}\n\nlet getLastElementChild$1;\n\nfunction setGetLastElementChild(getLastElementChildImpl) {\n getLastElementChild$1 = getLastElementChildImpl;\n}\n\nlet isConnected$1;\n\nfunction setIsConnected(isConnectedImpl) {\n isConnected$1 = isConnectedImpl;\n}\n\nlet insertGlobalStylesheet$1;\n\nfunction setInsertGlobalStylesheet(insertGlobalStylesheetImpl) {\n insertGlobalStylesheet$1 = insertGlobalStylesheetImpl;\n}\n\nlet insertStylesheet$1;\n\nfunction setInsertStylesheet(insertStylesheetImpl) {\n insertStylesheet$1 = insertStylesheetImpl;\n}\n\nlet assertInstanceOfHTMLElement$1;\n\nfunction setAssertInstanceOfHTMLElement(assertInstanceOfHTMLElementImpl) {\n assertInstanceOfHTMLElement$1 = assertInstanceOfHTMLElementImpl;\n}\n\nlet defineCustomElement$1;\n\nfunction setDefineCustomElement(defineCustomElementImpl) {\n defineCustomElement$1 = defineCustomElementImpl;\n}\n\nlet getCustomElement$1;\n\nfunction setGetCustomElement(getCustomElementImpl) {\n getCustomElement$1 = getCustomElementImpl;\n}\n/*\n * Copyright (c) 2019, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst TargetToReactiveRecordMap = new WeakMap();\n\nfunction getReactiveRecord(target) {\n let reactiveRecord = TargetToReactiveRecordMap.get(target);\n\n if (isUndefined$1(reactiveRecord)) {\n const newRecord = create(null);\n reactiveRecord = newRecord;\n TargetToReactiveRecordMap.set(target, newRecord);\n }\n\n return reactiveRecord;\n}\n\nlet currentReactiveObserver = null;\n\nfunction valueMutated(target, key) {\n const reactiveRecord = TargetToReactiveRecordMap.get(target);\n\n if (!isUndefined$1(reactiveRecord)) {\n const reactiveObservers = reactiveRecord[key];\n\n if (!isUndefined$1(reactiveObservers)) {\n for (let i = 0, len = reactiveObservers.length; i < len; i += 1) {\n const ro = reactiveObservers[i];\n ro.notify();\n }\n }\n }\n}\n\nfunction valueObserved(target, key) {\n // We should determine if an active Observing Record is present to track mutations.\n if (currentReactiveObserver === null) {\n return;\n }\n\n const ro = currentReactiveObserver;\n const reactiveRecord = getReactiveRecord(target);\n let reactiveObservers = reactiveRecord[key];\n\n if (isUndefined$1(reactiveObservers)) {\n reactiveObservers = [];\n reactiveRecord[key] = reactiveObservers;\n } else if (reactiveObservers[0] === ro) {\n return; // perf optimization considering that most subscriptions will come from the same record\n }\n\n if (ArrayIndexOf.call(reactiveObservers, ro) === -1) {\n ro.link(reactiveObservers);\n }\n}\n\nclass ReactiveObserver {\n constructor(callback) {\n this.listeners = [];\n this.callback = callback;\n }\n\n observe(job) {\n const inceptionReactiveRecord = currentReactiveObserver;\n currentReactiveObserver = this;\n let error;\n\n try {\n job();\n } catch (e) {\n error = Object(e);\n } finally {\n currentReactiveObserver = inceptionReactiveRecord;\n\n if (error !== undefined) {\n throw error; // eslint-disable-line no-unsafe-finally\n }\n }\n }\n /**\n * This method is responsible for disconnecting the Reactive Observer\n * from any Reactive Record that has a reference to it, to prevent future\n * notifications about previously recorded access.\n */\n\n\n reset() {\n const {\n listeners\n } = this;\n const len = listeners.length;\n\n if (len > 0) {\n for (let i = 0; i < len; i += 1) {\n const set = listeners[i];\n const pos = ArrayIndexOf.call(listeners[i], this);\n ArraySplice.call(set, pos, 1);\n }\n\n listeners.length = 0;\n }\n } // friend methods\n\n\n notify() {\n this.callback.call(undefined, this);\n }\n\n link(reactiveObservers) {\n ArrayPush$1.call(reactiveObservers, this); // we keep track of observing records where the observing record was added to so we can do some clean up later on\n\n ArrayPush$1.call(this.listeners, reactiveObservers);\n }\n\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction componentValueMutated(vm, key) {\n valueMutated(vm.component, key);\n}\n\nfunction componentValueObserved(vm, key) {\n valueObserved(vm.component, key);\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction getComponentTag(vm) {\n return `<${StringToLowerCase.call(vm.tagName)}>`;\n} // TODO [#1695]: Unify getComponentStack and getErrorComponentStack\n\n\nfunction getComponentStack(vm) {\n const stack = [];\n let prefix = '';\n\n while (!isNull(vm.owner)) {\n ArrayPush$1.call(stack, prefix + getComponentTag(vm));\n vm = vm.owner;\n prefix += '\\t';\n }\n\n return ArrayJoin.call(stack, '\\n');\n}\n\nfunction getErrorComponentStack(vm) {\n const wcStack = [];\n let currentVm = vm;\n\n while (!isNull(currentVm)) {\n ArrayPush$1.call(wcStack, getComponentTag(currentVm));\n currentVm = currentVm.owner;\n }\n\n return wcStack.reverse().join('\\n\\t');\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction addErrorComponentStack(vm, error) {\n if (!isFrozen(error) && isUndefined$1(error.wcStack)) {\n const wcStack = getErrorComponentStack(vm);\n defineProperty(error, 'wcStack', {\n get() {\n return wcStack;\n }\n\n });\n }\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction log(method, message, vm) {\n let msg = `[LWC ${method}]: ${message}`;\n\n if (!isUndefined$1(vm)) {\n msg = `${msg}\\n${getComponentStack(vm)}`;\n }\n\n if (process.env.NODE_ENV === 'test') {\n /* eslint-disable-next-line no-console */\n console[method](msg);\n return;\n }\n\n try {\n throw new Error(msg);\n } catch (e) {\n /* eslint-disable-next-line no-console */\n console[method](e);\n }\n}\n\nfunction logError(message, vm) {\n log('error', message, vm);\n}\n\nfunction logWarn(message, vm) {\n log('warn', message, vm);\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n// This is a temporary workaround to get the @lwc/engine-server to evaluate in node without having\n// to inject at runtime.\n\n\nconst HTMLElementConstructor$1 = typeof HTMLElement !== 'undefined' ? HTMLElement : function () {};\nconst HTMLElementPrototype = HTMLElementConstructor$1.prototype;\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\nconst defaultDefHTMLPropertyNames = ['accessKey', 'dir', 'draggable', 'hidden', 'id', 'lang', 'spellcheck', 'tabIndex', 'title'];\n\nfunction offsetPropertyErrorMessage(name) {\n return `Using the \\`${name}\\` property is an anti-pattern because it rounds the value to an integer. Instead, use the \\`getBoundingClientRect\\` method to obtain fractional values for the size of an element and its position relative to the viewport.`;\n} // Global HTML Attributes & Properties\n// https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes\n// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement\n\n\nconst globalHTMLProperties = assign(create(null), {\n accessKey: {\n attribute: 'accesskey'\n },\n accessKeyLabel: {\n readOnly: true\n },\n className: {\n attribute: 'class',\n error: 'Using the `className` property is an anti-pattern because of slow runtime behavior and potential conflicts with classes provided by the owner element. Use the `classList` API instead.'\n },\n contentEditable: {\n attribute: 'contenteditable'\n },\n dataset: {\n readOnly: true,\n error: \"Using the `dataset` property is an anti-pattern because it can't be statically analyzed. Expose each property individually using the `@api` decorator instead.\"\n },\n dir: {\n attribute: 'dir'\n },\n draggable: {\n attribute: 'draggable'\n },\n dropzone: {\n attribute: 'dropzone',\n readOnly: true\n },\n hidden: {\n attribute: 'hidden'\n },\n id: {\n attribute: 'id'\n },\n inputMode: {\n attribute: 'inputmode'\n },\n lang: {\n attribute: 'lang'\n },\n slot: {\n attribute: 'slot',\n error: 'Using the `slot` property is an anti-pattern.'\n },\n spellcheck: {\n attribute: 'spellcheck'\n },\n style: {\n attribute: 'style'\n },\n tabIndex: {\n attribute: 'tabindex'\n },\n title: {\n attribute: 'title'\n },\n translate: {\n attribute: 'translate'\n },\n // additional \"global attributes\" that are not present in the link above.\n isContentEditable: {\n readOnly: true\n },\n offsetHeight: {\n readOnly: true,\n error: offsetPropertyErrorMessage('offsetHeight')\n },\n offsetLeft: {\n readOnly: true,\n error: offsetPropertyErrorMessage('offsetLeft')\n },\n offsetParent: {\n readOnly: true\n },\n offsetTop: {\n readOnly: true,\n error: offsetPropertyErrorMessage('offsetTop')\n },\n offsetWidth: {\n readOnly: true,\n error: offsetPropertyErrorMessage('offsetWidth')\n },\n role: {\n attribute: 'role'\n }\n});\nlet controlledElement = null;\nlet controlledAttributeName;\n\nfunction isAttributeLocked(elm, attrName) {\n return elm !== controlledElement || attrName !== controlledAttributeName;\n}\n\nfunction lockAttribute(_elm, _key) {\n controlledElement = null;\n controlledAttributeName = undefined;\n}\n\nfunction unlockAttribute(elm, key) {\n controlledElement = elm;\n controlledAttributeName = key;\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n/**\n * This is a descriptor map that contains\n * all standard properties that a Custom Element can support (including AOM properties), which\n * determines what kind of capabilities the Base HTML Element and\n * Base Lightning Element should support.\n */\n\n\nconst HTMLElementOriginalDescriptors = create(null);\nforEach.call(keys(AriaPropNameToAttrNameMap), propName => {\n // Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because\n // in IE11, some properties are on Element.prototype instead of HTMLElement, just to be sure.\n const descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);\n\n if (!isUndefined$1(descriptor)) {\n HTMLElementOriginalDescriptors[propName] = descriptor;\n }\n});\nforEach.call(defaultDefHTMLPropertyNames, propName => {\n // Note: intentionally using our in-house getPropertyDescriptor instead of getOwnPropertyDescriptor here because\n // in IE11, id property is on Element.prototype instead of HTMLElement, and we suspect that more will fall into\n // this category, so, better to be sure.\n const descriptor = getPropertyDescriptor(HTMLElementPrototype, propName);\n\n if (!isUndefined$1(descriptor)) {\n HTMLElementOriginalDescriptors[propName] = descriptor;\n }\n});\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\nfunction generateDataDescriptor(options) {\n return assign({\n configurable: true,\n enumerable: true,\n writable: true\n }, options);\n}\n\nfunction generateAccessorDescriptor(options) {\n return assign({\n configurable: true,\n enumerable: true\n }, options);\n}\n\nlet isDomMutationAllowed = false;\n\nfunction unlockDomMutation() {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n isDomMutationAllowed = true;\n}\n\nfunction lockDomMutation() {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n isDomMutationAllowed = false;\n}\n\nfunction logMissingPortalError(name, type) {\n return logError(`The \\`${name}\\` ${type} is available only on elements that use the \\`lwc:dom=\"manual\"\\` directive.`);\n}\n\nfunction patchElementWithRestrictions(elm, options) {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n const originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');\n const descriptors = {\n outerHTML: generateAccessorDescriptor({\n get() {\n return originalOuterHTMLDescriptor.get.call(this);\n },\n\n set(_value) {\n throw new TypeError(`Invalid attempt to set outerHTML on Element.`);\n }\n\n })\n }; // Apply extra restriction related to DOM manipulation if the element is not a portal.\n\n if (!options.isLight && !options.isPortal) {\n const {\n appendChild,\n insertBefore,\n removeChild,\n replaceChild\n } = elm;\n const originalNodeValueDescriptor = getPropertyDescriptor(elm, 'nodeValue');\n const originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');\n const originalTextContentDescriptor = getPropertyDescriptor(elm, 'textContent');\n assign(descriptors, {\n appendChild: generateDataDescriptor({\n value(aChild) {\n logMissingPortalError('appendChild', 'method');\n return appendChild.call(this, aChild);\n }\n\n }),\n insertBefore: generateDataDescriptor({\n value(newNode, referenceNode) {\n if (!isDomMutationAllowed) {\n logMissingPortalError('insertBefore', 'method');\n }\n\n return insertBefore.call(this, newNode, referenceNode);\n }\n\n }),\n removeChild: generateDataDescriptor({\n value(aChild) {\n if (!isDomMutationAllowed) {\n logMissingPortalError('removeChild', 'method');\n }\n\n return removeChild.call(this, aChild);\n }\n\n }),\n replaceChild: generateDataDescriptor({\n value(newChild, oldChild) {\n logMissingPortalError('replaceChild', 'method');\n return replaceChild.call(this, newChild, oldChild);\n }\n\n }),\n nodeValue: generateAccessorDescriptor({\n get() {\n return originalNodeValueDescriptor.get.call(this);\n },\n\n set(value) {\n if (!isDomMutationAllowed) {\n logMissingPortalError('nodeValue', 'property');\n }\n\n originalNodeValueDescriptor.set.call(this, value);\n }\n\n }),\n textContent: generateAccessorDescriptor({\n get() {\n return originalTextContentDescriptor.get.call(this);\n },\n\n set(value) {\n logMissingPortalError('textContent', 'property');\n originalTextContentDescriptor.set.call(this, value);\n }\n\n }),\n innerHTML: generateAccessorDescriptor({\n get() {\n return originalInnerHTMLDescriptor.get.call(this);\n },\n\n set(value) {\n logMissingPortalError('innerHTML', 'property');\n return originalInnerHTMLDescriptor.set.call(this, value);\n }\n\n })\n });\n }\n\n defineProperties(elm, descriptors);\n}\n\nfunction getShadowRootRestrictionsDescriptors(sr) {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n } // Disallowing properties in dev mode only to avoid people doing the wrong\n // thing when using the real shadow root, because if that's the case,\n // the component will not work when running with synthetic shadow.\n\n\n const originalAddEventListener = sr.addEventListener;\n const originalInnerHTMLDescriptor = getPropertyDescriptor(sr, 'innerHTML');\n const originalTextContentDescriptor = getPropertyDescriptor(sr, 'textContent');\n return {\n innerHTML: generateAccessorDescriptor({\n get() {\n return originalInnerHTMLDescriptor.get.call(this);\n },\n\n set(_value) {\n throw new TypeError(`Invalid attempt to set innerHTML on ShadowRoot.`);\n }\n\n }),\n textContent: generateAccessorDescriptor({\n get() {\n return originalTextContentDescriptor.get.call(this);\n },\n\n set(_value) {\n throw new TypeError(`Invalid attempt to set textContent on ShadowRoot.`);\n }\n\n }),\n addEventListener: generateDataDescriptor({\n value(type, listener, options) {\n // TODO [#420]: this is triggered when the component author attempts to add a listener\n // programmatically into its Component's shadow root\n if (!isUndefined$1(options)) {\n logError('The `addEventListener` method on ShadowRoot does not support any options.', getAssociatedVMIfPresent(this));\n } // Typescript does not like it when you treat the `arguments` object as an array\n // @ts-ignore type-mismatch\n\n\n return originalAddEventListener.apply(this, arguments);\n }\n\n })\n };\n} // Custom Elements Restrictions:\n// -----------------------------\n\n\nfunction getCustomElementRestrictionsDescriptors(elm) {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n const originalAddEventListener = elm.addEventListener;\n const originalInnerHTMLDescriptor = getPropertyDescriptor(elm, 'innerHTML');\n const originalOuterHTMLDescriptor = getPropertyDescriptor(elm, 'outerHTML');\n const originalTextContentDescriptor = getPropertyDescriptor(elm, 'textContent');\n return {\n innerHTML: generateAccessorDescriptor({\n get() {\n return originalInnerHTMLDescriptor.get.call(this);\n },\n\n set(_value) {\n throw new TypeError(`Invalid attempt to set innerHTML on HTMLElement.`);\n }\n\n }),\n outerHTML: generateAccessorDescriptor({\n get() {\n return originalOuterHTMLDescriptor.get.call(this);\n },\n\n set(_value) {\n throw new TypeError(`Invalid attempt to set outerHTML on HTMLElement.`);\n }\n\n }),\n textContent: generateAccessorDescriptor({\n get() {\n return originalTextContentDescriptor.get.call(this);\n },\n\n set(_value) {\n throw new TypeError(`Invalid attempt to set textContent on HTMLElement.`);\n }\n\n }),\n addEventListener: generateDataDescriptor({\n value(type, listener, options) {\n // TODO [#420]: this is triggered when the component author attempts to add a listener\n // programmatically into a lighting element node\n if (!isUndefined$1(options)) {\n logError('The `addEventListener` method in `LightningElement` does not support any options.', getAssociatedVMIfPresent(this));\n } // Typescript does not like it when you treat the `arguments` object as an array\n // @ts-ignore type-mismatch\n\n\n return originalAddEventListener.apply(this, arguments);\n }\n\n })\n };\n}\n\nfunction getComponentRestrictionsDescriptors() {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n return {\n tagName: generateAccessorDescriptor({\n get() {\n throw new Error(`Usage of property \\`tagName\\` is disallowed because the component itself does` + ` not know which tagName will be used to create the element, therefore writing` + ` code that check for that value is error prone.`);\n },\n\n configurable: true,\n enumerable: false // no enumerable properties on component\n\n })\n };\n}\n\nfunction getLightningElementPrototypeRestrictionsDescriptors(proto) {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n const originalDispatchEvent = proto.dispatchEvent;\n const descriptors = {\n dispatchEvent: generateDataDescriptor({\n value(event) {\n const vm = getAssociatedVM(this);\n\n if (!isNull(event) && isObject(event)) {\n const {\n type\n } = event;\n\n if (!/^[a-z][a-z0-9_]*$/.test(type)) {\n logError(`Invalid event type \"${type}\" dispatched in element ${getComponentTag(vm)}.` + ` Event name must start with a lowercase letter and followed only lowercase` + ` letters, numbers, and underscores`, vm);\n }\n } // Typescript does not like it when you treat the `arguments` object as an array\n // @ts-ignore type-mismatch\n\n\n return originalDispatchEvent.apply(this, arguments);\n }\n\n })\n };\n forEach.call(getOwnPropertyNames$1(globalHTMLProperties), propName => {\n if (propName in proto) {\n return; // no need to redefine something that we are already exposing\n }\n\n descriptors[propName] = generateAccessorDescriptor({\n get() {\n const {\n error,\n attribute\n } = globalHTMLProperties[propName];\n const msg = [];\n msg.push(`Accessing the global HTML property \"${propName}\" is disabled.`);\n\n if (error) {\n msg.push(error);\n } else if (attribute) {\n msg.push(`Instead access it via \\`this.getAttribute(\"${attribute}\")\\`.`);\n }\n\n logError(msg.join('\\n'), getAssociatedVM(this));\n },\n\n set() {\n const {\n readOnly\n } = globalHTMLProperties[propName];\n\n if (readOnly) {\n logError(`The global HTML property \\`${propName}\\` is read-only.`, getAssociatedVM(this));\n }\n }\n\n });\n });\n return descriptors;\n} // This routine will prevent access to certain properties on a shadow root instance to guarantee\n// that all components will work fine in IE11 and other browsers without shadow dom support.\n\n\nfunction patchShadowRootWithRestrictions(sr) {\n defineProperties(sr, getShadowRootRestrictionsDescriptors(sr));\n}\n\nfunction patchCustomElementWithRestrictions(elm) {\n const restrictionsDescriptors = getCustomElementRestrictionsDescriptors(elm);\n const elmProto = getPrototypeOf$1(elm);\n setPrototypeOf(elm, create(elmProto, restrictionsDescriptors));\n}\n\nfunction patchComponentWithRestrictions(cmp) {\n defineProperties(cmp, getComponentRestrictionsDescriptors());\n}\n\nfunction patchLightningElementPrototypeWithRestrictions(proto) {\n defineProperties(proto, getLightningElementPrototypeRestrictionsDescriptors(proto));\n}\n/**\n * Copyright (C) 2017 salesforce.com, inc.\n */\n\n\nconst {\n isArray\n} = Array;\nconst {\n prototype: ObjectDotPrototype,\n getPrototypeOf,\n create: ObjectCreate,\n defineProperty: ObjectDefineProperty,\n isExtensible,\n getOwnPropertyDescriptor,\n getOwnPropertyNames,\n getOwnPropertySymbols,\n preventExtensions,\n hasOwnProperty\n} = Object;\nconst {\n push: ArrayPush,\n concat: ArrayConcat\n} = Array.prototype;\nconst OtS = {}.toString;\n\nfunction toString(obj) {\n if (obj && obj.toString) {\n return obj.toString();\n } else if (typeof obj === 'object') {\n return OtS.call(obj);\n } else {\n return obj + '';\n }\n}\n\nfunction isUndefined(obj) {\n return obj === undefined;\n}\n\nfunction isFunction(obj) {\n return typeof obj === 'function';\n}\n\nconst proxyToValueMap = new WeakMap();\n\nfunction registerProxy(proxy, value) {\n proxyToValueMap.set(proxy, value);\n}\n\nconst unwrap$1 = replicaOrAny => proxyToValueMap.get(replicaOrAny) || replicaOrAny;\n\nclass BaseProxyHandler {\n constructor(membrane, value) {\n this.originalTarget = value;\n this.membrane = membrane;\n } // Shared utility methods\n\n\n wrapDescriptor(descriptor) {\n if (hasOwnProperty.call(descriptor, 'value')) {\n descriptor.value = this.wrapValue(descriptor.value);\n } else {\n const {\n set: originalSet,\n get: originalGet\n } = descriptor;\n\n if (!isUndefined(originalGet)) {\n descriptor.get = this.wrapGetter(originalGet);\n }\n\n if (!isUndefined(originalSet)) {\n descriptor.set = this.wrapSetter(originalSet);\n }\n }\n\n return descriptor;\n }\n\n copyDescriptorIntoShadowTarget(shadowTarget, key) {\n const {\n originalTarget\n } = this; // Note: a property might get defined multiple times in the shadowTarget\n // but it will always be compatible with the previous descriptor\n // to preserve the object invariants, which makes these lines safe.\n\n const originalDescriptor = getOwnPropertyDescriptor(originalTarget, key); // TODO: it should be impossible for the originalDescriptor to ever be undefined, this `if` can be removed\n\n /* istanbul ignore else */\n\n if (!isUndefined(originalDescriptor)) {\n const wrappedDesc = this.wrapDescriptor(originalDescriptor);\n ObjectDefineProperty(shadowTarget, key, wrappedDesc);\n }\n }\n\n lockShadowTarget(shadowTarget) {\n const {\n originalTarget\n } = this;\n const targetKeys = ArrayConcat.call(getOwnPropertyNames(originalTarget), getOwnPropertySymbols(originalTarget));\n targetKeys.forEach(key => {\n this.copyDescriptorIntoShadowTarget(shadowTarget, key);\n });\n const {\n membrane: {\n tagPropertyKey\n }\n } = this;\n\n if (!isUndefined(tagPropertyKey) && !hasOwnProperty.call(shadowTarget, tagPropertyKey)) {\n ObjectDefineProperty(shadowTarget, tagPropertyKey, ObjectCreate(null));\n }\n\n preventExtensions(shadowTarget);\n } // Shared Traps\n // TODO: apply() is never called\n\n /* istanbul ignore next */\n\n\n apply(shadowTarget, thisArg, argArray) {\n /* No op */\n } // TODO: construct() is never called\n\n /* istanbul ignore next */\n\n\n construct(shadowTarget, argArray, newTarget) {\n /* No op */\n }\n\n get(shadowTarget, key) {\n const {\n originalTarget,\n membrane: {\n valueObserved\n }\n } = this;\n const value = originalTarget[key];\n valueObserved(originalTarget, key);\n return this.wrapValue(value);\n }\n\n has(shadowTarget, key) {\n const {\n originalTarget,\n membrane: {\n tagPropertyKey,\n valueObserved\n }\n } = this;\n valueObserved(originalTarget, key); // since key is never going to be undefined, and tagPropertyKey might be undefined\n // we can simply compare them as the second part of the condition.\n\n return key in originalTarget || key === tagPropertyKey;\n }\n\n ownKeys(shadowTarget) {\n const {\n originalTarget,\n membrane: {\n tagPropertyKey\n }\n } = this; // if the membrane tag key exists and it is not in the original target, we add it to the keys.\n\n const keys = isUndefined(tagPropertyKey) || hasOwnProperty.call(originalTarget, tagPropertyKey) ? [] : [tagPropertyKey]; // small perf optimization using push instead of concat to avoid creating an extra array\n\n ArrayPush.apply(keys, getOwnPropertyNames(originalTarget));\n ArrayPush.apply(keys, getOwnPropertySymbols(originalTarget));\n return keys;\n }\n\n isExtensible(shadowTarget) {\n const {\n originalTarget\n } = this; // optimization to avoid attempting to lock down the shadowTarget multiple times\n\n if (!isExtensible(shadowTarget)) {\n return false; // was already locked down\n }\n\n if (!isExtensible(originalTarget)) {\n this.lockShadowTarget(shadowTarget);\n return false;\n }\n\n return true;\n }\n\n getPrototypeOf(shadowTarget) {\n const {\n originalTarget\n } = this;\n return getPrototypeOf(originalTarget);\n }\n\n getOwnPropertyDescriptor(shadowTarget, key) {\n const {\n originalTarget,\n membrane: {\n valueObserved,\n tagPropertyKey\n }\n } = this; // keys looked up via getOwnPropertyDescriptor need to be reactive\n\n valueObserved(originalTarget, key);\n let desc = getOwnPropertyDescriptor(originalTarget, key);\n\n if (isUndefined(desc)) {\n if (key !== tagPropertyKey) {\n return undefined;\n } // if the key is the membrane tag key, and is not in the original target,\n // we produce a synthetic descriptor and install it on the shadow target\n\n\n desc = {\n value: undefined,\n writable: false,\n configurable: false,\n enumerable: false\n };\n ObjectDefineProperty(shadowTarget, tagPropertyKey, desc);\n return desc;\n }\n\n if (desc.configurable === false) {\n // updating the descriptor to non-configurable on the shadow\n this.copyDescriptorIntoShadowTarget(shadowTarget, key);\n } // Note: by accessing the descriptor, the key is marked as observed\n // but access to the value, setter or getter (if available) cannot observe\n // mutations, just like regular methods, in which case we just do nothing.\n\n\n return this.wrapDescriptor(desc);\n }\n\n}\n\nconst getterMap$1 = new WeakMap();\nconst setterMap$1 = new WeakMap();\nconst reverseGetterMap = new WeakMap();\nconst reverseSetterMap = new WeakMap();\n\nclass ReactiveProxyHandler extends BaseProxyHandler {\n wrapValue(value) {\n return this.membrane.getProxy(value);\n }\n\n wrapGetter(originalGet) {\n const wrappedGetter = getterMap$1.get(originalGet);\n\n if (!isUndefined(wrappedGetter)) {\n return wrappedGetter;\n }\n\n const handler = this;\n\n const get = function () {\n // invoking the original getter with the original target\n return handler.wrapValue(originalGet.call(unwrap$1(this)));\n };\n\n getterMap$1.set(originalGet, get);\n reverseGetterMap.set(get, originalGet);\n return get;\n }\n\n wrapSetter(originalSet) {\n const wrappedSetter = setterMap$1.get(originalSet);\n\n if (!isUndefined(wrappedSetter)) {\n return wrappedSetter;\n }\n\n const set = function (v) {\n // invoking the original setter with the original target\n originalSet.call(unwrap$1(this), unwrap$1(v));\n };\n\n setterMap$1.set(originalSet, set);\n reverseSetterMap.set(set, originalSet);\n return set;\n }\n\n unwrapDescriptor(descriptor) {\n if (hasOwnProperty.call(descriptor, 'value')) {\n // dealing with a data descriptor\n descriptor.value = unwrap$1(descriptor.value);\n } else {\n const {\n set,\n get\n } = descriptor;\n\n if (!isUndefined(get)) {\n descriptor.get = this.unwrapGetter(get);\n }\n\n if (!isUndefined(set)) {\n descriptor.set = this.unwrapSetter(set);\n }\n }\n\n return descriptor;\n }\n\n unwrapGetter(redGet) {\n const reverseGetter = reverseGetterMap.get(redGet);\n\n if (!isUndefined(reverseGetter)) {\n return reverseGetter;\n }\n\n const handler = this;\n\n const get = function () {\n // invoking the red getter with the proxy of this\n return unwrap$1(redGet.call(handler.wrapValue(this)));\n };\n\n getterMap$1.set(get, redGet);\n reverseGetterMap.set(redGet, get);\n return get;\n }\n\n unwrapSetter(redSet) {\n const reverseSetter = reverseSetterMap.get(redSet);\n\n if (!isUndefined(reverseSetter)) {\n return reverseSetter;\n }\n\n const handler = this;\n\n const set = function (v) {\n // invoking the red setter with the proxy of this\n redSet.call(handler.wrapValue(this), handler.wrapValue(v));\n };\n\n setterMap$1.set(set, redSet);\n reverseSetterMap.set(redSet, set);\n return set;\n }\n\n set(shadowTarget, key, value) {\n const {\n originalTarget,\n membrane: {\n valueMutated\n }\n } = this;\n const oldValue = originalTarget[key];\n\n if (oldValue !== value) {\n originalTarget[key] = value;\n valueMutated(originalTarget, key);\n } else if (key === 'length' && isArray(originalTarget)) {\n // fix for issue #236: push will add the new index, and by the time length\n // is updated, the internal length is already equal to the new length value\n // therefore, the oldValue is equal to the value. This is the forking logic\n // to support this use case.\n valueMutated(originalTarget, key);\n }\n\n return true;\n }\n\n deleteProperty(shadowTarget, key) {\n const {\n originalTarget,\n membrane: {\n valueMutated\n }\n } = this;\n delete originalTarget[key];\n valueMutated(originalTarget, key);\n return true;\n }\n\n setPrototypeOf(shadowTarget, prototype) {\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`Invalid setPrototypeOf invocation for reactive proxy ${toString(this.originalTarget)}. Prototype of reactive objects cannot be changed.`);\n }\n }\n\n preventExtensions(shadowTarget) {\n if (isExtensible(shadowTarget)) {\n const {\n originalTarget\n } = this;\n preventExtensions(originalTarget); // if the originalTarget is a proxy itself, it might reject\n // the preventExtension call, in which case we should not attempt to lock down\n // the shadow target.\n // TODO: It should not actually be possible to reach this `if` statement.\n // If a proxy rejects extensions, then calling preventExtensions will throw an error:\n // https://codepen.io/nolanlawson-the-selector/pen/QWMOjbY\n\n /* istanbul ignore if */\n\n if (isExtensible(originalTarget)) {\n return false;\n }\n\n this.lockShadowTarget(shadowTarget);\n }\n\n return true;\n }\n\n defineProperty(shadowTarget, key, descriptor) {\n const {\n originalTarget,\n membrane: {\n valueMutated,\n tagPropertyKey\n }\n } = this;\n\n if (key === tagPropertyKey && !hasOwnProperty.call(originalTarget, key)) {\n // To avoid leaking the membrane tag property into the original target, we must\n // be sure that the original target doesn't have yet.\n // NOTE: we do not return false here because Object.freeze and equivalent operations\n // will attempt to set the descriptor to the same value, and expect no to throw. This\n // is an small compromise for the sake of not having to diff the descriptors.\n return true;\n }\n\n ObjectDefineProperty(originalTarget, key, this.unwrapDescriptor(descriptor)); // intentionally testing if false since it could be undefined as well\n\n if (descriptor.configurable === false) {\n this.copyDescriptorIntoShadowTarget(shadowTarget, key);\n }\n\n valueMutated(originalTarget, key);\n return true;\n }\n\n}\n\nconst getterMap = new WeakMap();\nconst setterMap = new WeakMap();\n\nclass ReadOnlyHandler extends BaseProxyHandler {\n wrapValue(value) {\n return this.membrane.getReadOnlyProxy(value);\n }\n\n wrapGetter(originalGet) {\n const wrappedGetter = getterMap.get(originalGet);\n\n if (!isUndefined(wrappedGetter)) {\n return wrappedGetter;\n }\n\n const handler = this;\n\n const get = function () {\n // invoking the original getter with the original target\n return handler.wrapValue(originalGet.call(unwrap$1(this)));\n };\n\n getterMap.set(originalGet, get);\n return get;\n }\n\n wrapSetter(originalSet) {\n const wrappedSetter = setterMap.get(originalSet);\n\n if (!isUndefined(wrappedSetter)) {\n return wrappedSetter;\n }\n\n const handler = this;\n\n const set = function (v) {\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n const {\n originalTarget\n } = handler;\n throw new Error(`Invalid mutation: Cannot invoke a setter on \"${originalTarget}\". \"${originalTarget}\" is read-only.`);\n }\n };\n\n setterMap.set(originalSet, set);\n return set;\n }\n\n set(shadowTarget, key, value) {\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n const {\n originalTarget\n } = this;\n const msg = isArray(originalTarget) ? `Invalid mutation: Cannot mutate array at index ${key.toString()}. Array is read-only.` : `Invalid mutation: Cannot set \"${key.toString()}\" on \"${originalTarget}\". \"${originalTarget}\" is read-only.`;\n throw new Error(msg);\n }\n /* istanbul ignore next */\n\n\n return false;\n }\n\n deleteProperty(shadowTarget, key) {\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n const {\n originalTarget\n } = this;\n throw new Error(`Invalid mutation: Cannot delete \"${key.toString()}\" on \"${originalTarget}\". \"${originalTarget}\" is read-only.`);\n }\n /* istanbul ignore next */\n\n\n return false;\n }\n\n setPrototypeOf(shadowTarget, prototype) {\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n const {\n originalTarget\n } = this;\n throw new Error(`Invalid prototype mutation: Cannot set prototype on \"${originalTarget}\". \"${originalTarget}\" prototype is read-only.`);\n }\n }\n\n preventExtensions(shadowTarget) {\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n const {\n originalTarget\n } = this;\n throw new Error(`Invalid mutation: Cannot preventExtensions on ${originalTarget}\". \"${originalTarget} is read-only.`);\n }\n /* istanbul ignore next */\n\n\n return false;\n }\n\n defineProperty(shadowTarget, key, descriptor) {\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n const {\n originalTarget\n } = this;\n throw new Error(`Invalid mutation: Cannot defineProperty \"${key.toString()}\" on \"${originalTarget}\". \"${originalTarget}\" is read-only.`);\n }\n /* istanbul ignore next */\n\n\n return false;\n }\n\n}\n\nfunction extract(objectOrArray) {\n if (isArray(objectOrArray)) {\n return objectOrArray.map(item => {\n const original = unwrap$1(item);\n\n if (original !== item) {\n return extract(original);\n }\n\n return item;\n });\n }\n\n const obj = ObjectCreate(getPrototypeOf(objectOrArray));\n const names = getOwnPropertyNames(objectOrArray);\n return ArrayConcat.call(names, getOwnPropertySymbols(objectOrArray)).reduce((seed, key) => {\n const item = objectOrArray[key];\n const original = unwrap$1(item);\n\n if (original !== item) {\n seed[key] = extract(original);\n } else {\n seed[key] = item;\n }\n\n return seed;\n }, obj);\n}\n\nconst formatter = {\n header: plainOrProxy => {\n const originalTarget = unwrap$1(plainOrProxy); // if originalTarget is falsy or not unwrappable, exit\n\n if (!originalTarget || originalTarget === plainOrProxy) {\n return null;\n }\n\n const obj = extract(plainOrProxy);\n return ['object', {\n object: obj\n }];\n },\n hasBody: () => {\n return false;\n },\n body: () => {\n return null;\n }\n}; // Inspired from paulmillr/es6-shim\n// https://github.com/paulmillr/es6-shim/blob/master/es6-shim.js#L176-L185\n\n/* istanbul ignore next */\n\nfunction getGlobal() {\n // the only reliable means to get the global object is `Function('return this')()`\n // However, this causes CSP violations in Chrome apps.\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n }\n\n if (typeof self !== 'undefined') {\n return self;\n }\n\n if (typeof window !== 'undefined') {\n return window;\n }\n\n if (typeof global !== 'undefined') {\n return global;\n } // Gracefully degrade if not able to locate the global object\n\n\n return {};\n}\n\nfunction init() {\n /* istanbul ignore if */\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n const global = getGlobal(); // Custom Formatter for Dev Tools. To enable this, open Chrome Dev Tools\n // - Go to Settings,\n // - Under console, select \"Enable custom formatters\"\n // For more information, https://docs.google.com/document/d/1FTascZXT9cxfetuPRT2eXPQKXui4nWFivUnS_335T3U/preview\n\n const devtoolsFormatters = global.devtoolsFormatters || [];\n ArrayPush.call(devtoolsFormatters, formatter);\n global.devtoolsFormatters = devtoolsFormatters;\n}\n/* istanbul ignore else */\n\n\nif (process.env.NODE_ENV !== 'production') {\n init();\n}\n\nfunction defaultValueIsObservable(value) {\n // intentionally checking for null\n if (value === null) {\n return false;\n } // treat all non-object types, including undefined, as non-observable values\n\n\n if (typeof value !== 'object') {\n return false;\n }\n\n if (isArray(value)) {\n return true;\n }\n\n const proto = getPrototypeOf(value);\n return proto === ObjectDotPrototype || proto === null || getPrototypeOf(proto) === null;\n}\n\nconst defaultValueObserved = (obj, key) => {\n /* do nothing */\n};\n\nconst defaultValueMutated = (obj, key) => {\n /* do nothing */\n};\n\nfunction createShadowTarget(value) {\n return isArray(value) ? [] : {};\n}\n\nclass ObservableMembrane {\n constructor(options = {}) {\n this.readOnlyObjectGraph = new WeakMap();\n this.reactiveObjectGraph = new WeakMap();\n const {\n valueMutated,\n valueObserved,\n valueIsObservable,\n tagPropertyKey\n } = options;\n this.valueMutated = isFunction(valueMutated) ? valueMutated : defaultValueMutated;\n this.valueObserved = isFunction(valueObserved) ? valueObserved : defaultValueObserved;\n this.valueIsObservable = isFunction(valueIsObservable) ? valueIsObservable : defaultValueIsObservable;\n this.tagPropertyKey = tagPropertyKey;\n }\n\n getProxy(value) {\n const unwrappedValue = unwrap$1(value);\n\n if (this.valueIsObservable(unwrappedValue)) {\n // When trying to extract the writable version of a readonly we return the readonly.\n if (this.readOnlyObjectGraph.get(unwrappedValue) === value) {\n return value;\n }\n\n return this.getReactiveHandler(unwrappedValue);\n }\n\n return unwrappedValue;\n }\n\n getReadOnlyProxy(value) {\n value = unwrap$1(value);\n\n if (this.valueIsObservable(value)) {\n return this.getReadOnlyHandler(value);\n }\n\n return value;\n }\n\n unwrapProxy(p) {\n return unwrap$1(p);\n }\n\n getReactiveHandler(value) {\n let proxy = this.reactiveObjectGraph.get(value);\n\n if (isUndefined(proxy)) {\n // caching the proxy after the first time it is accessed\n const handler = new ReactiveProxyHandler(this, value);\n proxy = new Proxy(createShadowTarget(value), handler);\n registerProxy(proxy, value);\n this.reactiveObjectGraph.set(value, proxy);\n }\n\n return proxy;\n }\n\n getReadOnlyHandler(value) {\n let proxy = this.readOnlyObjectGraph.get(value);\n\n if (isUndefined(proxy)) {\n // caching the proxy after the first time it is accessed\n const handler = new ReadOnlyHandler(this, value);\n proxy = new Proxy(createShadowTarget(value), handler);\n registerProxy(proxy, value);\n this.readOnlyObjectGraph.set(value, proxy);\n }\n\n return proxy;\n }\n\n}\n/** version: 2.0.0 */\n\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst lockerLivePropertyKey = Symbol.for('@@lockerLiveValue');\nconst reactiveMembrane = new ObservableMembrane({\n valueObserved,\n valueMutated,\n tagPropertyKey: lockerLivePropertyKey\n});\n/**\n * EXPERIMENTAL: This function implements an unwrap mechanism that\n * works for observable membrane objects. This API is subject to\n * change or being removed.\n */\n\nfunction unwrap(value) {\n return reactiveMembrane.unwrapProxy(value);\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n/**\n * This operation is called with a descriptor of an standard html property\n * that a Custom Element can support (including AOM properties), which\n * determines what kind of capabilities the Base Lightning Element should support. When producing the new descriptors\n * for the Base Lightning Element, it also include the reactivity bit, so the standard property is reactive.\n */\n\n\nfunction createBridgeToElementDescriptor(propName, descriptor) {\n const {\n get,\n set,\n enumerable,\n configurable\n } = descriptor;\n\n if (!isFunction$1(get)) {\n if (process.env.NODE_ENV !== 'production') {\n assert.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard getter.`);\n }\n\n throw new TypeError();\n }\n\n if (!isFunction$1(set)) {\n if (process.env.NODE_ENV !== 'production') {\n assert.fail(`Detected invalid public property descriptor for HTMLElement.prototype.${propName} definition. Missing the standard setter.`);\n }\n\n throw new TypeError();\n }\n\n return {\n enumerable,\n configurable,\n\n get() {\n const vm = getAssociatedVM(this);\n\n if (isBeingConstructed(vm)) {\n if (process.env.NODE_ENV !== 'production') {\n logError(`The value of property \\`${propName}\\` can't be read from the constructor because the owner component hasn't set the value yet. Instead, use the constructor to set a default value for the property.`, vm);\n }\n\n return;\n }\n\n componentValueObserved(vm, propName);\n return get.call(vm.elm);\n },\n\n set(newValue) {\n const vm = getAssociatedVM(this);\n\n if (process.env.NODE_ENV !== 'production') {\n const vmBeingRendered = getVMBeingRendered();\n assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${propName}`);\n assert.invariant(!isUpdatingTemplate, `When updating the template of ${vmBeingRendered}, one of the accessors used by the template has side effects on the state of ${vm}.${propName}`);\n assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);\n assert.invariant(!isObject(newValue) || isNull(newValue), `Invalid value \"${newValue}\" for \"${propName}\" of ${vm}. Value cannot be an object, must be a primitive value.`);\n }\n\n if (newValue !== vm.cmpProps[propName]) {\n vm.cmpProps[propName] = newValue;\n componentValueMutated(vm, propName);\n }\n\n return set.call(vm.elm, newValue);\n }\n\n };\n}\n/**\n * This class is the base class for any LWC element.\n * Some elements directly extends this class, others implement it via inheritance.\n **/\n// @ts-ignore\n\n\nconst LightningElement = function () {\n // This should be as performant as possible, while any initialization should be done lazily\n if (isNull(vmBeingConstructed)) {\n throw new ReferenceError('Illegal constructor');\n }\n\n const vm = vmBeingConstructed;\n const {\n def,\n elm\n } = vm;\n const {\n bridge\n } = def;\n\n if (process.env.NODE_ENV !== 'production') {\n assertInstanceOfHTMLElement$1(vm.elm, `Component creation requires a DOM element to be associated to ${vm}.`);\n }\n\n const component = this;\n setPrototypeOf(elm, bridge.prototype);\n vm.component = this; // Locker hooks assignment. When the LWC engine run with Locker, Locker intercepts all the new\n // component creation and passes hooks to instrument all the component interactions with the\n // engine. We are intentionally hiding this argument from the formal API of LightningElement\n // because we don't want folks to know about it just yet.\n\n if (arguments.length === 1) {\n const {\n callHook,\n setHook,\n getHook\n } = arguments[0];\n vm.callHook = callHook;\n vm.setHook = setHook;\n vm.getHook = getHook;\n } // Making the component instance a live value when using Locker to support expandos.\n\n\n this[lockerLivePropertyKey] = undefined; // Linking elm, shadow root and component with the VM.\n\n associateVM(component, vm);\n associateVM(elm, vm);\n\n if (vm.renderMode === 1\n /* Shadow */\n ) {\n vm.renderRoot = doAttachShadow(vm);\n } else {\n vm.renderRoot = elm;\n } // Adding extra guard rails in DEV mode.\n\n\n if (process.env.NODE_ENV !== 'production') {\n patchCustomElementWithRestrictions(elm);\n patchComponentWithRestrictions(component);\n }\n\n return this;\n};\n\nfunction doAttachShadow(vm) {\n const {\n elm,\n mode,\n shadowMode,\n def: {\n ctor\n }\n } = vm;\n const shadowRoot = attachShadow$1(elm, {\n [KEY__SYNTHETIC_MODE]: shadowMode === 1\n /* Synthetic */\n ,\n delegatesFocus: Boolean(ctor.delegatesFocus),\n mode\n });\n vm.shadowRoot = shadowRoot;\n associateVM(shadowRoot, vm);\n\n if (process.env.NODE_ENV !== 'production') {\n patchShadowRootWithRestrictions(shadowRoot);\n }\n\n return shadowRoot;\n}\n\nfunction warnIfInvokedDuringConstruction(vm, methodOrPropName) {\n if (isBeingConstructed(vm)) {\n logError(`this.${methodOrPropName} should not be called during the construction of the custom element for ${getComponentTag(vm)} because the element is not yet in the DOM or has no children yet.`);\n }\n} // @ts-ignore\n\n\nLightningElement.prototype = {\n constructor: LightningElement,\n\n dispatchEvent(event) {\n const {\n elm\n } = getAssociatedVM(this);\n return dispatchEvent$1(elm, event);\n },\n\n addEventListener(type, listener, options) {\n const vm = getAssociatedVM(this);\n const {\n elm\n } = vm;\n\n if (process.env.NODE_ENV !== 'production') {\n const vmBeingRendered = getVMBeingRendered();\n assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm} by adding an event listener for \"${type}\".`);\n assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm} by adding an event listener for \"${type}\".`);\n assert.invariant(isFunction$1(listener), `Invalid second argument for this.addEventListener() in ${vm} for event \"${type}\". Expected an EventListener but received ${listener}.`);\n }\n\n const wrappedListener = getWrappedComponentsListener(vm, listener);\n addEventListener$1(elm, type, wrappedListener, options);\n },\n\n removeEventListener(type, listener, options) {\n const vm = getAssociatedVM(this);\n const {\n elm\n } = vm;\n const wrappedListener = getWrappedComponentsListener(vm, listener);\n removeEventListener$1(elm, type, wrappedListener, options);\n },\n\n hasAttribute(name) {\n const {\n elm\n } = getAssociatedVM(this);\n return !isNull(getAttribute$1(elm, name));\n },\n\n hasAttributeNS(namespace, name) {\n const {\n elm\n } = getAssociatedVM(this);\n return !isNull(getAttribute$1(elm, name, namespace));\n },\n\n removeAttribute(name) {\n const {\n elm\n } = getAssociatedVM(this);\n unlockAttribute(elm, name);\n removeAttribute$1(elm, name);\n lockAttribute();\n },\n\n removeAttributeNS(namespace, name) {\n const {\n elm\n } = getAssociatedVM(this);\n unlockAttribute(elm, name);\n removeAttribute$1(elm, name, namespace);\n lockAttribute();\n },\n\n getAttribute(name) {\n const {\n elm\n } = getAssociatedVM(this);\n return getAttribute$1(elm, name);\n },\n\n getAttributeNS(namespace, name) {\n const {\n elm\n } = getAssociatedVM(this);\n return getAttribute$1(elm, name, namespace);\n },\n\n setAttribute(name, value) {\n const vm = getAssociatedVM(this);\n const {\n elm\n } = vm;\n\n if (process.env.NODE_ENV !== 'production') {\n assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);\n }\n\n unlockAttribute(elm, name);\n setAttribute$1(elm, name, value);\n lockAttribute();\n },\n\n setAttributeNS(namespace, name, value) {\n const vm = getAssociatedVM(this);\n const {\n elm\n } = vm;\n\n if (process.env.NODE_ENV !== 'production') {\n assert.isFalse(isBeingConstructed(vm), `Failed to construct '${getComponentTag(vm)}': The result must not have attributes.`);\n }\n\n unlockAttribute(elm, name);\n setAttribute$1(elm, name, value, namespace);\n lockAttribute();\n },\n\n getBoundingClientRect() {\n const vm = getAssociatedVM(this);\n const {\n elm\n } = vm;\n\n if (process.env.NODE_ENV !== 'production') {\n warnIfInvokedDuringConstruction(vm, 'getBoundingClientRect()');\n }\n\n return getBoundingClientRect$1(elm);\n },\n\n get isConnected() {\n const {\n elm\n } = getAssociatedVM(this);\n return isConnected$1(elm);\n },\n\n get classList() {\n const vm = getAssociatedVM(this);\n const {\n elm\n } = vm;\n\n if (process.env.NODE_ENV !== 'production') {\n // TODO [#1290]: this still fails in dev but works in production, eventually, we should\n // just throw in all modes\n assert.isFalse(isBeingConstructed(vm), `Failed to construct ${vm}: The result must not have attributes. Adding or tampering with classname in constructor is not allowed in a web component, use connectedCallback() instead.`);\n }\n\n return getClassList$1(elm);\n },\n\n get template() {\n const vm = getAssociatedVM(this);\n\n if (process.env.NODE_ENV !== 'production') {\n if (vm.renderMode === 0\n /* Light */\n ) {\n logError('`this.template` returns null for light DOM components. Since there is no shadow, the rendered content can be accessed via `this` itself. e.g. instead of `this.template.querySelector`, use `this.querySelector`.');\n }\n }\n\n return vm.shadowRoot;\n },\n\n get shadowRoot() {\n // From within the component instance, the shadowRoot is always reported as \"closed\".\n // Authors should rely on this.template instead.\n return null;\n },\n\n render() {\n const vm = getAssociatedVM(this);\n return vm.def.template;\n },\n\n toString() {\n const vm = getAssociatedVM(this);\n return `[object ${vm.def.name}]`;\n }\n\n};\nconst queryAndChildGetterDescriptors = create(null); // The reason we don't just call `import * as renderer from '../renderer'` here is that the bundle size\n// is smaller if we reference each function individually. Otherwise Rollup will create one big frozen\n// object representing the renderer, with a lot of methods we don't actually need.\n\nconst childGetters = ['children', 'childNodes', 'firstChild', 'firstElementChild', 'lastChild', 'lastElementChild'];\n\nfunction getChildGetter(methodName) {\n switch (methodName) {\n case 'children':\n return getChildren$1;\n\n case 'childNodes':\n return getChildNodes$1;\n\n case 'firstChild':\n return getFirstChild$1;\n\n case 'firstElementChild':\n return getFirstElementChild$1;\n\n case 'lastChild':\n return getLastChild$1;\n\n case 'lastElementChild':\n return getLastElementChild$1;\n }\n} // Generic passthrough for child getters on HTMLElement to the relevant Renderer APIs\n\n\nfor (const childGetter of childGetters) {\n queryAndChildGetterDescriptors[childGetter] = {\n get() {\n const vm = getAssociatedVM(this);\n const {\n elm\n } = vm;\n\n if (process.env.NODE_ENV !== 'production') {\n warnIfInvokedDuringConstruction(vm, childGetter);\n }\n\n return getChildGetter(childGetter)(elm);\n },\n\n configurable: true,\n enumerable: true\n };\n}\n\nconst queryMethods = ['getElementsByClassName', 'getElementsByTagName', 'querySelector', 'querySelectorAll'];\n\nfunction getQueryMethod(methodName) {\n switch (methodName) {\n case 'getElementsByClassName':\n return getElementsByClassName$1;\n\n case 'getElementsByTagName':\n return getElementsByTagName$1;\n\n case 'querySelector':\n return querySelector$1;\n\n case 'querySelectorAll':\n return querySelectorAll$1;\n }\n} // Generic passthrough for query APIs on HTMLElement to the relevant Renderer APIs\n\n\nfor (const queryMethod of queryMethods) {\n queryAndChildGetterDescriptors[queryMethod] = {\n value(arg) {\n const vm = getAssociatedVM(this);\n const {\n elm\n } = vm;\n\n if (process.env.NODE_ENV !== 'production') {\n warnIfInvokedDuringConstruction(vm, `${queryMethod}()`);\n }\n\n return getQueryMethod(queryMethod)(elm, arg);\n },\n\n configurable: true,\n enumerable: true,\n writable: true\n };\n}\n\ndefineProperties(LightningElement.prototype, queryAndChildGetterDescriptors);\nconst lightningBasedDescriptors = create(null);\n\nfor (const propName in HTMLElementOriginalDescriptors) {\n lightningBasedDescriptors[propName] = createBridgeToElementDescriptor(propName, HTMLElementOriginalDescriptors[propName]);\n}\n\ndefineProperties(LightningElement.prototype, lightningBasedDescriptors);\ndefineProperty(LightningElement, 'CustomElementConstructor', {\n get() {\n // If required, a runtime-specific implementation must be defined.\n throw new ReferenceError('The current runtime does not support CustomElementConstructor.');\n },\n\n configurable: true\n});\n\nif (process.env.NODE_ENV !== 'production') {\n patchLightningElementPrototypeWithRestrictions(LightningElement.prototype);\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n/**\n * @wire decorator to wire fields and methods to a wire adapter in\n * LWC Components. This function implements the internals of this\n * decorator.\n */\n\n\nfunction wire(_adapter, _config) {\n if (process.env.NODE_ENV !== 'production') {\n assert.fail('@wire(adapter, config?) may only be used as a decorator.');\n }\n\n throw new Error();\n}\n\nfunction internalWireFieldDecorator(key) {\n return {\n get() {\n const vm = getAssociatedVM(this);\n componentValueObserved(vm, key);\n return vm.cmpFields[key];\n },\n\n set(value) {\n const vm = getAssociatedVM(this);\n /**\n * Reactivity for wired fields is provided in wiring.\n * We intentionally add reactivity here since this is just\n * letting the author to do the wrong thing, but it will keep our\n * system to be backward compatible.\n */\n\n if (value !== vm.cmpFields[key]) {\n vm.cmpFields[key] = value;\n componentValueMutated(vm, key);\n }\n },\n\n enumerable: true,\n configurable: true\n };\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction track(target) {\n if (arguments.length === 1) {\n return reactiveMembrane.getProxy(target);\n }\n\n if (process.env.NODE_ENV !== 'production') {\n assert.fail(`@track decorator can only be used with one argument to return a trackable object, or as a decorator function.`);\n }\n\n throw new Error();\n}\n\nfunction internalTrackDecorator(key) {\n return {\n get() {\n const vm = getAssociatedVM(this);\n componentValueObserved(vm, key);\n return vm.cmpFields[key];\n },\n\n set(newValue) {\n const vm = getAssociatedVM(this);\n\n if (process.env.NODE_ENV !== 'production') {\n const vmBeingRendered = getVMBeingRendered();\n assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);\n assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);\n }\n\n const reactiveOrAnyValue = reactiveMembrane.getProxy(newValue);\n\n if (reactiveOrAnyValue !== vm.cmpFields[key]) {\n vm.cmpFields[key] = reactiveOrAnyValue;\n componentValueMutated(vm, key);\n }\n },\n\n enumerable: true,\n configurable: true\n };\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction api$1() {\n if (process.env.NODE_ENV !== 'production') {\n assert.fail(`@api decorator can only be used as a decorator function.`);\n }\n\n throw new Error();\n}\n\nfunction createPublicPropertyDescriptor(key) {\n return {\n get() {\n const vm = getAssociatedVM(this);\n\n if (isBeingConstructed(vm)) {\n if (process.env.NODE_ENV !== 'production') {\n logError(`Can’t read the value of property \\`${toString$1(key)}\\` from the constructor because the owner component hasn’t set the value yet. Instead, use the constructor to set a default value for the property.`, vm);\n }\n\n return;\n }\n\n componentValueObserved(vm, key);\n return vm.cmpProps[key];\n },\n\n set(newValue) {\n const vm = getAssociatedVM(this);\n\n if (process.env.NODE_ENV !== 'production') {\n const vmBeingRendered = getVMBeingRendered();\n assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);\n assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);\n }\n\n vm.cmpProps[key] = newValue;\n componentValueMutated(vm, key);\n },\n\n enumerable: true,\n configurable: true\n };\n}\n\nclass AccessorReactiveObserver extends ReactiveObserver {\n constructor(vm, set) {\n super(() => {\n if (isFalse(this.debouncing)) {\n this.debouncing = true;\n addCallbackToNextTick(() => {\n if (isTrue(this.debouncing)) {\n const {\n value\n } = this;\n const {\n isDirty: dirtyStateBeforeSetterCall,\n component,\n idx\n } = vm;\n set.call(component, value); // de-bouncing after the call to the original setter to prevent\n // infinity loop if the setter itself is mutating things that\n // were accessed during the previous invocation.\n\n this.debouncing = false;\n\n if (isTrue(vm.isDirty) && isFalse(dirtyStateBeforeSetterCall) && idx > 0) {\n // immediate rehydration due to a setter driven mutation, otherwise\n // the component will get rendered on the second tick, which it is not\n // desirable.\n rerenderVM(vm);\n }\n }\n });\n }\n });\n this.debouncing = false;\n }\n\n reset(value) {\n super.reset();\n this.debouncing = false;\n\n if (arguments.length > 0) {\n this.value = value;\n }\n }\n\n}\n\nfunction createPublicAccessorDescriptor(key, descriptor) {\n const {\n get,\n set,\n enumerable,\n configurable\n } = descriptor;\n\n if (!isFunction$1(get)) {\n if (process.env.NODE_ENV !== 'production') {\n assert.invariant(isFunction$1(get), `Invalid compiler output for public accessor ${toString$1(key)} decorated with @api`);\n }\n\n throw new Error();\n }\n\n return {\n get() {\n if (process.env.NODE_ENV !== 'production') {\n // Assert that the this value is an actual Component with an associated VM.\n getAssociatedVM(this);\n }\n\n return get.call(this);\n },\n\n set(newValue) {\n const vm = getAssociatedVM(this);\n\n if (process.env.NODE_ENV !== 'production') {\n const vmBeingRendered = getVMBeingRendered();\n assert.invariant(!isInvokingRender, `${vmBeingRendered}.render() method has side effects on the state of ${vm}.${toString$1(key)}`);\n assert.invariant(!isUpdatingTemplate, `Updating the template of ${vmBeingRendered} has side effects on the state of ${vm}.${toString$1(key)}`);\n }\n\n if (set) {\n if (runtimeFlags.ENABLE_REACTIVE_SETTER) {\n let ro = vm.oar[key];\n\n if (isUndefined$1(ro)) {\n ro = vm.oar[key] = new AccessorReactiveObserver(vm, set);\n } // every time we invoke this setter from outside (through this wrapper setter)\n // we should reset the value and then debounce just in case there is a pending\n // invocation the next tick that is not longer relevant since the value is changing\n // from outside.\n\n\n ro.reset(newValue);\n ro.observe(() => {\n set.call(this, newValue);\n });\n } else {\n set.call(this, newValue);\n }\n } else if (process.env.NODE_ENV !== 'production') {\n assert.fail(`Invalid attempt to set a new value for property ${toString$1(key)} of ${vm} that does not has a setter decorated with @api.`);\n }\n },\n\n enumerable,\n configurable\n };\n}\n\nfunction createObservedFieldPropertyDescriptor(key) {\n return {\n get() {\n const vm = getAssociatedVM(this);\n componentValueObserved(vm, key);\n return vm.cmpFields[key];\n },\n\n set(newValue) {\n const vm = getAssociatedVM(this);\n\n if (newValue !== vm.cmpFields[key]) {\n vm.cmpFields[key] = newValue;\n componentValueMutated(vm, key);\n }\n },\n\n enumerable: true,\n configurable: true\n };\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction getClassDescriptorType(descriptor) {\n if (isFunction$1(descriptor.value)) {\n return \"method\"\n /* Method */\n ;\n } else if (isFunction$1(descriptor.set) || isFunction$1(descriptor.get)) {\n return \"accessor\"\n /* Accessor */\n ;\n } else {\n return \"field\"\n /* Field */\n ;\n }\n}\n\nfunction validateObservedField(Ctor, fieldName, descriptor) {\n if (!isUndefined$1(descriptor)) {\n const type = getClassDescriptorType(descriptor);\n const message = `Invalid observed ${fieldName} field. Found a duplicate ${type} with the same name.`; // [W-9927596] Ideally we always throw an error when detecting duplicate observed field.\n // This branch is only here for backward compatibility reasons.\n\n if (type === \"accessor\"\n /* Accessor */\n ) {\n logError(message);\n } else {\n assert.fail(message);\n }\n }\n}\n\nfunction validateFieldDecoratedWithTrack(Ctor, fieldName, descriptor) {\n if (!isUndefined$1(descriptor)) {\n const type = getClassDescriptorType(descriptor);\n assert.fail(`Invalid @track ${fieldName} field. Found a duplicate ${type} with the same name.`);\n }\n}\n\nfunction validateFieldDecoratedWithWire(Ctor, fieldName, descriptor) {\n if (!isUndefined$1(descriptor)) {\n const type = getClassDescriptorType(descriptor);\n assert.fail(`Invalid @wire ${fieldName} field. Found a duplicate ${type} with the same name.`);\n }\n}\n\nfunction validateMethodDecoratedWithWire(Ctor, methodName, descriptor) {\n if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {\n assert.fail(`Invalid @wire ${methodName} method.`);\n }\n}\n\nfunction validateFieldDecoratedWithApi(Ctor, fieldName, descriptor) {\n if (!isUndefined$1(descriptor)) {\n const type = getClassDescriptorType(descriptor);\n const message = `Invalid @api ${fieldName} field. Found a duplicate ${type} with the same name.`; // [W-9927596] Ideally we always throw an error when detecting duplicate public properties.\n // This branch is only here for backward compatibility reasons.\n\n if (type === \"accessor\"\n /* Accessor */\n ) {\n logError(message);\n } else {\n assert.fail(message);\n }\n }\n}\n\nfunction validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor) {\n if (isUndefined$1(descriptor)) {\n assert.fail(`Invalid @api get ${fieldName} accessor.`);\n } else if (isFunction$1(descriptor.set)) {\n assert.isTrue(isFunction$1(descriptor.get), `Missing getter for property ${fieldName} decorated with @api in ${Ctor}. You cannot have a setter without the corresponding getter.`);\n } else if (!isFunction$1(descriptor.get)) {\n assert.fail(`Missing @api get ${fieldName} accessor.`);\n }\n}\n\nfunction validateMethodDecoratedWithApi(Ctor, methodName, descriptor) {\n if (isUndefined$1(descriptor) || !isFunction$1(descriptor.value) || isFalse(descriptor.writable)) {\n assert.fail(`Invalid @api ${methodName} method.`);\n }\n}\n/**\n * INTERNAL: This function can only be invoked by compiled code. The compiler\n * will prevent this function from being imported by user-land code.\n */\n\n\nfunction registerDecorators(Ctor, meta) {\n const proto = Ctor.prototype;\n const {\n publicProps,\n publicMethods,\n wire,\n track,\n fields\n } = meta;\n const apiMethods = create(null);\n const apiFields = create(null);\n const wiredMethods = create(null);\n const wiredFields = create(null);\n const observedFields = create(null);\n const apiFieldsConfig = create(null);\n let descriptor;\n\n if (!isUndefined$1(publicProps)) {\n for (const fieldName in publicProps) {\n const propConfig = publicProps[fieldName];\n apiFieldsConfig[fieldName] = propConfig.config;\n descriptor = getOwnPropertyDescriptor$1(proto, fieldName);\n\n if (propConfig.config > 0) {\n // accessor declaration\n if (process.env.NODE_ENV !== 'production') {\n validateAccessorDecoratedWithApi(Ctor, fieldName, descriptor);\n }\n\n if (isUndefined$1(descriptor)) {\n throw new Error();\n }\n\n descriptor = createPublicAccessorDescriptor(fieldName, descriptor);\n } else {\n // field declaration\n if (process.env.NODE_ENV !== 'production') {\n validateFieldDecoratedWithApi(Ctor, fieldName, descriptor);\n } // [W-9927596] If a component has both a public property and a private setter/getter\n // with the same name, the property is defined as a public accessor. This branch is\n // only here for backward compatibility reasons.\n\n\n if (!isUndefined$1(descriptor) && !isUndefined$1(descriptor.get)) {\n descriptor = createPublicAccessorDescriptor(fieldName, descriptor);\n } else {\n descriptor = createPublicPropertyDescriptor(fieldName);\n }\n }\n\n apiFields[fieldName] = descriptor;\n defineProperty(proto, fieldName, descriptor);\n }\n }\n\n if (!isUndefined$1(publicMethods)) {\n forEach.call(publicMethods, methodName => {\n descriptor = getOwnPropertyDescriptor$1(proto, methodName);\n\n if (process.env.NODE_ENV !== 'production') {\n validateMethodDecoratedWithApi(Ctor, methodName, descriptor);\n }\n\n if (isUndefined$1(descriptor)) {\n throw new Error();\n }\n\n apiMethods[methodName] = descriptor;\n });\n }\n\n if (!isUndefined$1(wire)) {\n for (const fieldOrMethodName in wire) {\n const {\n adapter,\n method,\n config: configCallback,\n dynamic = []\n } = wire[fieldOrMethodName];\n descriptor = getOwnPropertyDescriptor$1(proto, fieldOrMethodName);\n\n if (method === 1) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(adapter, `@wire on method \"${fieldOrMethodName}\": adapter id must be truthy.`);\n validateMethodDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);\n }\n\n if (isUndefined$1(descriptor)) {\n throw new Error();\n }\n\n wiredMethods[fieldOrMethodName] = descriptor;\n storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic);\n } else {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(adapter, `@wire on field \"${fieldOrMethodName}\": adapter id must be truthy.`);\n validateFieldDecoratedWithWire(Ctor, fieldOrMethodName, descriptor);\n }\n\n descriptor = internalWireFieldDecorator(fieldOrMethodName);\n wiredFields[fieldOrMethodName] = descriptor;\n storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic);\n defineProperty(proto, fieldOrMethodName, descriptor);\n }\n }\n }\n\n if (!isUndefined$1(track)) {\n for (const fieldName in track) {\n descriptor = getOwnPropertyDescriptor$1(proto, fieldName);\n\n if (process.env.NODE_ENV !== 'production') {\n validateFieldDecoratedWithTrack(Ctor, fieldName, descriptor);\n }\n\n descriptor = internalTrackDecorator(fieldName);\n defineProperty(proto, fieldName, descriptor);\n }\n }\n\n if (!isUndefined$1(fields)) {\n for (let i = 0, n = fields.length; i < n; i++) {\n const fieldName = fields[i];\n descriptor = getOwnPropertyDescriptor$1(proto, fieldName);\n\n if (process.env.NODE_ENV !== 'production') {\n validateObservedField(Ctor, fieldName, descriptor);\n } // [W-9927596] Only mark a field as observed whenever it isn't a duplicated public nor\n // tracked property. This is only here for backward compatibility purposes.\n\n\n const isDuplicatePublicProp = !isUndefined$1(publicProps) && fieldName in publicProps;\n const isDuplicateTrackedProp = !isUndefined$1(track) && fieldName in track;\n\n if (!isDuplicatePublicProp && !isDuplicateTrackedProp) {\n observedFields[fieldName] = createObservedFieldPropertyDescriptor(fieldName);\n }\n }\n }\n\n setDecoratorsMeta(Ctor, {\n apiMethods,\n apiFields,\n apiFieldsConfig,\n wiredMethods,\n wiredFields,\n observedFields\n });\n return Ctor;\n}\n\nconst signedDecoratorToMetaMap = new Map();\n\nfunction setDecoratorsMeta(Ctor, meta) {\n signedDecoratorToMetaMap.set(Ctor, meta);\n}\n\nconst defaultMeta = {\n apiMethods: EmptyObject,\n apiFields: EmptyObject,\n apiFieldsConfig: EmptyObject,\n wiredMethods: EmptyObject,\n wiredFields: EmptyObject,\n observedFields: EmptyObject\n};\n\nfunction getDecoratorsMeta(Ctor) {\n const meta = signedDecoratorToMetaMap.get(Ctor);\n return isUndefined$1(meta) ? defaultMeta : meta;\n}\n\nconst signedTemplateSet = new Set();\n\nfunction defaultEmptyTemplate() {\n return [];\n}\n\nsignedTemplateSet.add(defaultEmptyTemplate);\n\nfunction isTemplateRegistered(tpl) {\n return signedTemplateSet.has(tpl);\n}\n/**\n * INTERNAL: This function can only be invoked by compiled code. The compiler\n * will prevent this function from being imported by userland code.\n */\n\n\nfunction registerTemplate(tpl) {\n signedTemplateSet.add(tpl); // chaining this method as a way to wrap existing\n // assignment of templates easily, without too much transformation\n\n return tpl;\n}\n/**\n * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar\n * libraries to sanitize vulnerable attributes.\n */\n\n\nfunction sanitizeAttribute(tagName, namespaceUri, attrName, attrValue) {\n // locker-service patches this function during runtime to sanitize vulnerable attributes. When\n // ran off-core this function becomes a noop and returns the user authored value.\n return attrValue;\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n// from the element instance, and get the value or set a new value on the component.\n// This means that across different elements, similar names can get the exact same\n// descriptor, so we can cache them:\n\n\nconst cachedGetterByKey = create(null);\nconst cachedSetterByKey = create(null);\n\nfunction createGetter(key) {\n let fn = cachedGetterByKey[key];\n\n if (isUndefined$1(fn)) {\n fn = cachedGetterByKey[key] = function () {\n const vm = getAssociatedVM(this);\n const {\n getHook\n } = vm;\n return getHook(vm.component, key);\n };\n }\n\n return fn;\n}\n\nfunction createSetter(key) {\n let fn = cachedSetterByKey[key];\n\n if (isUndefined$1(fn)) {\n fn = cachedSetterByKey[key] = function (newValue) {\n const vm = getAssociatedVM(this);\n const {\n setHook\n } = vm;\n newValue = reactiveMembrane.getReadOnlyProxy(newValue);\n setHook(vm.component, key, newValue);\n };\n }\n\n return fn;\n}\n\nfunction createMethodCaller(methodName) {\n return function () {\n const vm = getAssociatedVM(this);\n const {\n callHook,\n component\n } = vm;\n const fn = component[methodName];\n return callHook(vm.component, fn, ArraySlice.call(arguments));\n };\n}\n\nfunction createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback) {\n return function attributeChangedCallback(attrName, oldValue, newValue) {\n if (oldValue === newValue) {\n // Ignore same values.\n return;\n }\n\n const propName = attributeToPropMap[attrName];\n\n if (isUndefined$1(propName)) {\n if (!isUndefined$1(superAttributeChangedCallback)) {\n // delegate unknown attributes to the super.\n // Typescript does not like it when you treat the `arguments` object as an array\n // @ts-ignore type-mismatch\n superAttributeChangedCallback.apply(this, arguments);\n }\n\n return;\n }\n\n if (!isAttributeLocked(this, attrName)) {\n // Ignore changes triggered by the engine itself during:\n // * diffing when public props are attempting to reflect to the DOM\n // * component via `this.setAttribute()`, should never update the prop\n // Both cases, the setAttribute call is always wrapped by the unlocking of the\n // attribute to be changed\n return;\n } // Reflect attribute change to the corresponding property when changed from outside.\n\n\n this[propName] = newValue;\n };\n}\n\nfunction HTMLBridgeElementFactory(SuperClass, props, methods) {\n let HTMLBridgeElement;\n /**\n * Modern browsers will have all Native Constructors as regular Classes\n * and must be instantiated with the new keyword. In older browsers,\n * specifically IE11, those are objects with a prototype property defined,\n * since they are not supposed to be extended or instantiated with the\n * new keyword. This forking logic supports both cases, specifically because\n * wc.ts relies on the construction path of the bridges to create new\n * fully qualifying web components.\n */\n\n if (isFunction$1(SuperClass)) {\n HTMLBridgeElement = class extends SuperClass {};\n } else {\n HTMLBridgeElement = function () {\n // Bridge classes are not supposed to be instantiated directly in\n // browsers that do not support web components.\n throw new TypeError('Illegal constructor');\n }; // prototype inheritance dance\n\n\n setPrototypeOf(HTMLBridgeElement, SuperClass);\n setPrototypeOf(HTMLBridgeElement.prototype, SuperClass.prototype);\n defineProperty(HTMLBridgeElement.prototype, 'constructor', {\n writable: true,\n configurable: true,\n value: HTMLBridgeElement\n });\n } // generating the hash table for attributes to avoid duplicate fields and facilitate validation\n // and false positives in case of inheritance.\n\n\n const attributeToPropMap = create(null);\n const {\n attributeChangedCallback: superAttributeChangedCallback\n } = SuperClass.prototype;\n const {\n observedAttributes: superObservedAttributes = []\n } = SuperClass;\n const descriptors = create(null); // expose getters and setters for each public props on the new Element Bridge\n\n for (let i = 0, len = props.length; i < len; i += 1) {\n const propName = props[i];\n attributeToPropMap[htmlPropertyToAttribute(propName)] = propName;\n descriptors[propName] = {\n get: createGetter(propName),\n set: createSetter(propName),\n enumerable: true,\n configurable: true\n };\n } // expose public methods as props on the new Element Bridge\n\n\n for (let i = 0, len = methods.length; i < len; i += 1) {\n const methodName = methods[i];\n descriptors[methodName] = {\n value: createMethodCaller(methodName),\n writable: true,\n configurable: true\n };\n } // creating a new attributeChangedCallback per bridge because they are bound to the corresponding\n // map of attributes to props. We do this after all other props and methods to avoid the possibility\n // of getting overrule by a class declaration in user-land, and we make it non-writable, non-configurable\n // to preserve this definition.\n\n\n descriptors.attributeChangedCallback = {\n value: createAttributeChangedCallback(attributeToPropMap, superAttributeChangedCallback)\n }; // Specify attributes for which we want to reflect changes back to their corresponding\n // properties via attributeChangedCallback.\n\n defineProperty(HTMLBridgeElement, 'observedAttributes', {\n get() {\n return [...superObservedAttributes, ...keys(attributeToPropMap)];\n }\n\n });\n defineProperties(HTMLBridgeElement.prototype, descriptors);\n return HTMLBridgeElement;\n}\n\nconst BaseBridgeElement = HTMLBridgeElementFactory(HTMLElementConstructor$1, getOwnPropertyNames$1(HTMLElementOriginalDescriptors), []);\nfreeze(BaseBridgeElement);\nseal(BaseBridgeElement.prototype);\n/*\n * Copyright (c) 2020, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\nfunction resolveCircularModuleDependency(fn) {\n const module = fn();\n return (module === null || module === void 0 ? void 0 : module.__esModule) ? module.default : module;\n}\n\nfunction isCircularModuleDependency(obj) {\n return isFunction$1(obj) && hasOwnProperty$1.call(obj, '__circular__');\n}\n/*\n * Copyright (c) 2020, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst swappedTemplateMap = new WeakMap();\nconst swappedComponentMap = new WeakMap();\nconst swappedStyleMap = new WeakMap();\nconst activeTemplates = new WeakMap();\nconst activeComponents = new WeakMap();\nconst activeStyles = new WeakMap();\n\nfunction rehydrateHotTemplate(tpl) {\n const list = activeTemplates.get(tpl);\n\n if (!isUndefined$1(list)) {\n list.forEach(vm => {\n if (isFalse(vm.isDirty)) {\n // forcing the vm to rehydrate in the micro-task:\n markComponentAsDirty(vm);\n scheduleRehydration(vm);\n }\n }); // resetting the Set to release the memory of those vm references\n // since they are not longer related to this template, instead\n // they will get re-associated once these instances are rehydrated.\n\n list.clear();\n }\n\n return true;\n}\n\nfunction rehydrateHotStyle(style) {\n const list = activeStyles.get(style);\n\n if (!isUndefined$1(list)) {\n list.forEach(vm => {\n // if a style definition is swapped, we must reset\n // vm's template content in the next micro-task:\n forceRehydration(vm);\n }); // resetting the Set to release the memory of those vm references\n // since they are not longer related to this style, instead\n // they will get re-associated once these instances are rehydrated.\n\n list.clear();\n }\n\n return true;\n}\n\nfunction rehydrateHotComponent(Ctor) {\n const list = activeComponents.get(Ctor);\n let canRefreshAllInstances = true;\n\n if (!isUndefined$1(list)) {\n list.forEach(vm => {\n const {\n owner\n } = vm;\n\n if (!isNull(owner)) {\n // if a component class definition is swapped, we must reset\n // owner's template content in the next micro-task:\n forceRehydration(owner);\n } else {\n // the hot swapping for components only work for instances of components\n // created from a template, root elements can't be swapped because we\n // don't have a way to force the creation of the element with the same state\n // of the current element.\n // Instead, we can report the problem to the caller so it can take action,\n // for example: reload the entire page.\n canRefreshAllInstances = false;\n }\n }); // resetting the Set to release the memory of those vm references\n // since they are not longer related to this constructor, instead\n // they will get re-associated once these instances are rehydrated.\n\n list.clear();\n }\n\n return canRefreshAllInstances;\n}\n\nfunction flattenStylesheets(stylesheets) {\n const list = [];\n\n for (const stylesheet of stylesheets) {\n if (!Array.isArray(stylesheet)) {\n list.push(stylesheet);\n } else {\n list.push(...flattenStylesheets(stylesheet));\n }\n }\n\n return list;\n}\n\nfunction getTemplateOrSwappedTemplate(tpl) {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n if (runtimeFlags.ENABLE_HMR) {\n const visited = new Set();\n\n while (swappedTemplateMap.has(tpl) && !visited.has(tpl)) {\n visited.add(tpl);\n tpl = swappedTemplateMap.get(tpl);\n }\n }\n\n return tpl;\n}\n\nfunction getComponentOrSwappedComponent(Ctor) {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n if (runtimeFlags.ENABLE_HMR) {\n const visited = new Set();\n\n while (swappedComponentMap.has(Ctor) && !visited.has(Ctor)) {\n visited.add(Ctor);\n Ctor = swappedComponentMap.get(Ctor);\n }\n }\n\n return Ctor;\n}\n\nfunction getStyleOrSwappedStyle(style) {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n if (runtimeFlags.ENABLE_HMR) {\n const visited = new Set();\n\n while (swappedStyleMap.has(style) && !visited.has(style)) {\n visited.add(style);\n style = swappedStyleMap.get(style);\n }\n }\n\n return style;\n}\n\nfunction setActiveVM(vm) {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n if (runtimeFlags.ENABLE_HMR) {\n // tracking active component\n const Ctor = vm.def.ctor;\n let componentVMs = activeComponents.get(Ctor);\n\n if (isUndefined$1(componentVMs)) {\n componentVMs = new Set();\n activeComponents.set(Ctor, componentVMs);\n } // this will allow us to keep track of the hot components\n\n\n componentVMs.add(vm); // tracking active template\n\n const tpl = vm.cmpTemplate;\n\n if (tpl) {\n let templateVMs = activeTemplates.get(tpl);\n\n if (isUndefined$1(templateVMs)) {\n templateVMs = new Set();\n activeTemplates.set(tpl, templateVMs);\n } // this will allow us to keep track of the templates that are\n // being used by a hot component\n\n\n templateVMs.add(vm); // tracking active styles associated to template\n\n const stylesheets = tpl.stylesheets;\n\n if (!isUndefined$1(stylesheets)) {\n flattenStylesheets(stylesheets).forEach(stylesheet => {\n // this is necessary because we don't hold the list of styles\n // in the vm, we only hold the selected (already swapped template)\n // but the styles attached to the template might not be the actual\n // active ones, but the swapped versions of those.\n stylesheet = getStyleOrSwappedStyle(stylesheet);\n let stylesheetVMs = activeStyles.get(stylesheet);\n\n if (isUndefined$1(stylesheetVMs)) {\n stylesheetVMs = new Set();\n activeStyles.set(stylesheet, stylesheetVMs);\n } // this will allow us to keep track of the stylesheet that are\n // being used by a hot component\n\n\n stylesheetVMs.add(vm);\n });\n }\n }\n }\n}\n\nfunction removeActiveVM(vm) {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n if (runtimeFlags.ENABLE_HMR) {\n // tracking inactive component\n const Ctor = vm.def.ctor;\n let list = activeComponents.get(Ctor);\n\n if (!isUndefined$1(list)) {\n // deleting the vm from the set to avoid leaking memory\n list.delete(vm);\n } // removing inactive template\n\n\n const tpl = vm.cmpTemplate;\n\n if (tpl) {\n list = activeTemplates.get(tpl);\n\n if (!isUndefined$1(list)) {\n // deleting the vm from the set to avoid leaking memory\n list.delete(vm);\n } // removing active styles associated to template\n\n\n const styles = tpl.stylesheets;\n\n if (!isUndefined$1(styles)) {\n flattenStylesheets(styles).forEach(style => {\n list = activeStyles.get(style);\n\n if (!isUndefined$1(list)) {\n // deleting the vm from the set to avoid leaking memory\n list.delete(vm);\n }\n });\n }\n }\n }\n}\n\nfunction swapTemplate(oldTpl, newTpl) {\n if (process.env.NODE_ENV !== 'production') {\n if (isTemplateRegistered(oldTpl) && isTemplateRegistered(newTpl)) {\n swappedTemplateMap.set(oldTpl, newTpl);\n return rehydrateHotTemplate(oldTpl);\n } else {\n throw new TypeError(`Invalid Template`);\n }\n }\n\n if (!runtimeFlags.ENABLE_HMR) {\n throw new Error('HMR is not enabled');\n }\n\n return false;\n}\n\nfunction swapComponent(oldComponent, newComponent) {\n if (process.env.NODE_ENV !== 'production') {\n if (isComponentConstructor(oldComponent) && isComponentConstructor(newComponent)) {\n swappedComponentMap.set(oldComponent, newComponent);\n return rehydrateHotComponent(oldComponent);\n } else {\n throw new TypeError(`Invalid Component`);\n }\n }\n\n if (!runtimeFlags.ENABLE_HMR) {\n throw new Error('HMR is not enabled');\n }\n\n return false;\n}\n\nfunction swapStyle(oldStyle, newStyle) {\n if (process.env.NODE_ENV !== 'production') {\n // TODO [#1887]: once the support for registering styles is implemented\n // we can add the validation of both styles around this block.\n swappedStyleMap.set(oldStyle, newStyle);\n return rehydrateHotStyle(oldStyle);\n }\n\n if (!runtimeFlags.ENABLE_HMR) {\n throw new Error('HMR is not enabled');\n }\n\n return false;\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst CtorToDefMap = new WeakMap();\n\nfunction getCtorProto(Ctor) {\n let proto = getPrototypeOf$1(Ctor);\n\n if (isNull(proto)) {\n throw new ReferenceError(`Invalid prototype chain for ${Ctor.name}, you must extend LightningElement.`);\n } // covering the cases where the ref is circular in AMD\n\n\n if (isCircularModuleDependency(proto)) {\n const p = resolveCircularModuleDependency(proto);\n\n if (process.env.NODE_ENV !== 'production') {\n if (isNull(p)) {\n throw new ReferenceError(`Circular module dependency for ${Ctor.name}, must resolve to a constructor that extends LightningElement.`);\n }\n } // escape hatch for Locker and other abstractions to provide their own base class instead\n // of our Base class without having to leak it to user-land. If the circular function returns\n // itself, that's the signal that we have hit the end of the proto chain, which must always\n // be base.\n\n\n proto = p === proto ? LightningElement : p;\n }\n\n return proto;\n}\n\nfunction createComponentDef(Ctor) {\n const {\n shadowSupportMode: ctorShadowSupportMode,\n renderMode: ctorRenderMode\n } = Ctor;\n\n if (process.env.NODE_ENV !== 'production') {\n const ctorName = Ctor.name; // Removing the following assert until https://bugs.webkit.org/show_bug.cgi?id=190140 is fixed.\n // assert.isTrue(ctorName && isString(ctorName), `${toString(Ctor)} should have a \"name\" property with string value, but found ${ctorName}.`);\n\n assert.isTrue(Ctor.constructor, `Missing ${ctorName}.constructor, ${ctorName} should have a \"constructor\" property.`);\n\n if (!isUndefined$1(ctorShadowSupportMode)) {\n assert.invariant(ctorShadowSupportMode === \"any\"\n /* Any */\n || ctorShadowSupportMode === \"reset\"\n /* Default */\n , `Invalid value for static property shadowSupportMode: '${ctorShadowSupportMode}'`);\n }\n\n if (!isUndefined$1(ctorRenderMode)) {\n assert.invariant(ctorRenderMode === 'light' || ctorRenderMode === 'shadow', `Invalid value for static property renderMode: '${ctorRenderMode}'. renderMode must be either 'light' or 'shadow'.`);\n }\n }\n\n const decoratorsMeta = getDecoratorsMeta(Ctor);\n const {\n apiFields,\n apiFieldsConfig,\n apiMethods,\n wiredFields,\n wiredMethods,\n observedFields\n } = decoratorsMeta;\n const proto = Ctor.prototype;\n let {\n connectedCallback,\n disconnectedCallback,\n renderedCallback,\n errorCallback,\n render\n } = proto;\n const superProto = getCtorProto(Ctor);\n const superDef = superProto !== LightningElement ? getComponentInternalDef(superProto) : lightingElementDef;\n const bridge = HTMLBridgeElementFactory(superDef.bridge, keys(apiFields), keys(apiMethods));\n const props = assign(create(null), superDef.props, apiFields);\n const propsConfig = assign(create(null), superDef.propsConfig, apiFieldsConfig);\n const methods = assign(create(null), superDef.methods, apiMethods);\n const wire = assign(create(null), superDef.wire, wiredFields, wiredMethods);\n connectedCallback = connectedCallback || superDef.connectedCallback;\n disconnectedCallback = disconnectedCallback || superDef.disconnectedCallback;\n renderedCallback = renderedCallback || superDef.renderedCallback;\n errorCallback = errorCallback || superDef.errorCallback;\n render = render || superDef.render;\n let shadowSupportMode = superDef.shadowSupportMode;\n\n if (!isUndefined$1(ctorShadowSupportMode)) {\n shadowSupportMode = ctorShadowSupportMode;\n }\n\n let renderMode = superDef.renderMode;\n\n if (!isUndefined$1(ctorRenderMode)) {\n renderMode = ctorRenderMode === 'light' ? 0\n /* Light */\n : 1\n /* Shadow */\n ;\n }\n\n const template = getComponentRegisteredTemplate(Ctor) || superDef.template;\n const name = Ctor.name || superDef.name; // installing observed fields into the prototype.\n\n defineProperties(proto, observedFields);\n const def = {\n ctor: Ctor,\n name,\n wire,\n props,\n propsConfig,\n methods,\n bridge,\n template,\n renderMode,\n shadowSupportMode,\n connectedCallback,\n disconnectedCallback,\n renderedCallback,\n errorCallback,\n render\n };\n\n if (process.env.NODE_ENV !== 'production') {\n freeze(Ctor.prototype);\n }\n\n return def;\n}\n/**\n * EXPERIMENTAL: This function allows for the identification of LWC constructors. This API is\n * subject to change or being removed.\n */\n\n\nfunction isComponentConstructor(ctor) {\n if (!isFunction$1(ctor)) {\n return false;\n } // Fast path: LightningElement is part of the prototype chain of the constructor.\n\n\n if (ctor.prototype instanceof LightningElement) {\n return true;\n } // Slow path: LightningElement is not part of the prototype chain of the constructor, we need\n // climb up the constructor prototype chain to check in case there are circular dependencies\n // to resolve.\n\n\n let current = ctor;\n\n do {\n if (isCircularModuleDependency(current)) {\n const circularResolved = resolveCircularModuleDependency(current); // If the circular function returns itself, that's the signal that we have hit the end\n // of the proto chain, which must always be a valid base constructor.\n\n if (circularResolved === current) {\n return true;\n }\n\n current = circularResolved;\n }\n\n if (current === LightningElement) {\n return true;\n }\n } while (!isNull(current) && (current = getPrototypeOf$1(current))); // Finally return false if the LightningElement is not part of the prototype chain.\n\n\n return false;\n}\n\nfunction getComponentInternalDef(Ctor) {\n if (process.env.NODE_ENV !== 'production') {\n Ctor = getComponentOrSwappedComponent(Ctor);\n }\n\n let def = CtorToDefMap.get(Ctor);\n\n if (isUndefined$1(def)) {\n if (isCircularModuleDependency(Ctor)) {\n const resolvedCtor = resolveCircularModuleDependency(Ctor);\n def = getComponentInternalDef(resolvedCtor); // Cache the unresolved component ctor too. The next time if the same unresolved ctor is used,\n // look up the definition in cache instead of re-resolving and recreating the def.\n\n CtorToDefMap.set(Ctor, def);\n return def;\n }\n\n if (!isComponentConstructor(Ctor)) {\n throw new TypeError(`${Ctor} is not a valid component, or does not extends LightningElement from \"lwc\". You probably forgot to add the extend clause on the class declaration.`);\n }\n\n def = createComponentDef(Ctor);\n CtorToDefMap.set(Ctor, def);\n }\n\n return def;\n}\n\nfunction getComponentHtmlPrototype(Ctor) {\n const def = getComponentInternalDef(Ctor);\n return def.bridge;\n}\n\nconst lightingElementDef = {\n ctor: LightningElement,\n name: LightningElement.name,\n props: lightningBasedDescriptors,\n propsConfig: EmptyObject,\n methods: EmptyObject,\n renderMode: 1\n /* Shadow */\n ,\n shadowSupportMode: \"reset\"\n /* Default */\n ,\n wire: EmptyObject,\n bridge: BaseBridgeElement,\n template: defaultEmptyTemplate,\n render: LightningElement.prototype.render\n};\n/**\n * EXPERIMENTAL: This function allows for the collection of internal component metadata. This API is\n * subject to change or being removed.\n */\n\nfunction getComponentDef(Ctor) {\n const def = getComponentInternalDef(Ctor); // From the internal def object, we need to extract the info that is useful\n // for some external services, e.g.: Locker Service, usually, all they care\n // is about the shape of the constructor, the internals of it are not relevant\n // because they don't have a way to mess with that.\n\n const {\n ctor,\n name,\n props,\n propsConfig,\n methods\n } = def;\n const publicProps = {};\n\n for (const key in props) {\n // avoid leaking the reference to the public props descriptors\n publicProps[key] = {\n config: propsConfig[key] || 0,\n type: \"any\"\n /* any */\n ,\n attr: htmlPropertyToAttribute(key)\n };\n }\n\n const publicMethods = {};\n\n for (const key in methods) {\n // avoid leaking the reference to the public method descriptors\n publicMethods[key] = methods[key].value;\n }\n\n return {\n ctor,\n name,\n props: publicProps,\n methods: publicMethods\n };\n}\n/*\n * Copyright (c) 2020, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction getUpgradableConstructor(tagName) {\n // Should never get a tag with upper case letter at this point, the compiler should\n // produce only tags with lowercase letters\n // But, for backwards compatibility, we will lower case the tagName\n tagName = tagName.toLowerCase();\n let CE = getCustomElement$1(tagName);\n\n if (!isUndefined$1(CE)) {\n return CE;\n }\n /**\n * LWC Upgradable Element reference to an element that was created\n * via the scoped registry mechanism, and that is ready to be upgraded.\n */\n\n\n CE = class LWCUpgradableElement extends HTMLElementExported$1 {\n constructor(upgradeCallback) {\n super();\n\n if (isFunction$1(upgradeCallback)) {\n upgradeCallback(this); // nothing to do with the result for now\n }\n }\n\n };\n defineCustomElement$1(tagName, CE);\n return CE;\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction isVBaseElement(vnode) {\n const {\n type\n } = vnode;\n return type === 2\n /* Element */\n || type === 3\n /* CustomElement */\n ;\n}\n\nfunction isSameVnode(vnode1, vnode2) {\n return vnode1.key === vnode2.key && vnode1.sel === vnode2.sel;\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst ColonCharCode = 58;\n\nfunction patchAttributes(oldVnode, vnode) {\n const {\n attrs\n } = vnode.data;\n\n if (isUndefined$1(attrs)) {\n return;\n }\n\n const oldAttrs = isNull(oldVnode) ? EmptyObject : oldVnode.data.attrs;\n\n if (oldAttrs === attrs) {\n return;\n }\n\n const {\n elm\n } = vnode;\n\n for (const key in attrs) {\n const cur = attrs[key];\n const old = oldAttrs[key];\n\n if (old !== cur) {\n unlockAttribute(elm, key);\n\n if (StringCharCodeAt.call(key, 3) === ColonCharCode) {\n // Assume xml namespace\n setAttribute$1(elm, key, cur, XML_NAMESPACE);\n } else if (StringCharCodeAt.call(key, 5) === ColonCharCode) {\n // Assume xlink namespace\n setAttribute$1(elm, key, cur, XLINK_NAMESPACE);\n } else if (isNull(cur) || isUndefined$1(cur)) {\n removeAttribute$1(elm, key);\n } else {\n setAttribute$1(elm, key, cur);\n }\n\n lockAttribute();\n }\n }\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction isLiveBindingProp(sel, key) {\n // For properties with live bindings, we read values from the DOM element\n // instead of relying on internally tracked values.\n return sel === 'input' && (key === 'value' || key === 'checked');\n}\n\nfunction patchProps(oldVnode, vnode) {\n const {\n props\n } = vnode.data;\n\n if (isUndefined$1(props)) {\n return;\n }\n\n const oldProps = isNull(oldVnode) ? EmptyObject : oldVnode.data.props;\n\n if (oldProps === props) {\n return;\n }\n\n const isFirstPatch = isNull(oldVnode);\n const {\n elm,\n sel\n } = vnode;\n\n for (const key in props) {\n const cur = props[key]; // Set the property if it's the first time is is patched or if the previous property is\n // different than the one previously set.\n\n if (isFirstPatch || cur !== (isLiveBindingProp(sel, key) ? getProperty$1(elm, key) : oldProps[key])) {\n setProperty$1(elm, key, cur);\n }\n }\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst classNameToClassMap = create(null);\n\nfunction getMapFromClassName(className) {\n // Intentionally using == to match undefined and null values from computed style attribute\n if (className == null) {\n return EmptyObject;\n } // computed class names must be string\n\n\n className = isString(className) ? className : className + '';\n let map = classNameToClassMap[className];\n\n if (map) {\n return map;\n }\n\n map = create(null);\n let start = 0;\n let o;\n const len = className.length;\n\n for (o = 0; o < len; o++) {\n if (StringCharCodeAt.call(className, o) === SPACE_CHAR) {\n if (o > start) {\n map[StringSlice.call(className, start, o)] = true;\n }\n\n start = o + 1;\n }\n }\n\n if (o > start) {\n map[StringSlice.call(className, start, o)] = true;\n }\n\n classNameToClassMap[className] = map;\n\n if (process.env.NODE_ENV !== 'production') {\n // just to make sure that this object never changes as part of the diffing algo\n freeze(map);\n }\n\n return map;\n}\n\nfunction patchClassAttribute(oldVnode, vnode) {\n const {\n elm,\n data: {\n className: newClass\n }\n } = vnode;\n const oldClass = isNull(oldVnode) ? undefined : oldVnode.data.className;\n\n if (oldClass === newClass) {\n return;\n }\n\n const classList = getClassList$1(elm);\n const newClassMap = getMapFromClassName(newClass);\n const oldClassMap = getMapFromClassName(oldClass);\n let name;\n\n for (name in oldClassMap) {\n // remove only if it is not in the new class collection and it is not set from within the instance\n if (isUndefined$1(newClassMap[name])) {\n classList.remove(name);\n }\n }\n\n for (name in newClassMap) {\n if (isUndefined$1(oldClassMap[name])) {\n classList.add(name);\n }\n }\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction patchStyleAttribute(oldVnode, vnode) {\n const {\n elm,\n data: {\n style: newStyle\n }\n } = vnode;\n const oldStyle = isNull(oldVnode) ? undefined : oldVnode.data.style;\n\n if (oldStyle === newStyle) {\n return;\n }\n\n if (!isString(newStyle) || newStyle === '') {\n removeAttribute$1(elm, 'style');\n } else {\n setAttribute$1(elm, 'style', newStyle);\n }\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction applyEventListeners(vnode) {\n const {\n elm,\n data: {\n on\n }\n } = vnode;\n\n if (isUndefined$1(on)) {\n return;\n }\n\n for (const name in on) {\n const handler = on[name];\n addEventListener$1(elm, name, handler);\n }\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n// The compiler takes care of transforming the inline classnames into an object. It's faster to set the\n// different classnames properties individually instead of via a string.\n\n\nfunction applyStaticClassAttribute(vnode) {\n const {\n elm,\n data: {\n classMap\n }\n } = vnode;\n\n if (isUndefined$1(classMap)) {\n return;\n }\n\n const classList = getClassList$1(elm);\n\n for (const name in classMap) {\n classList.add(name);\n }\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n// The compiler takes care of transforming the inline style into an object. It's faster to set the\n// different style properties individually instead of via a string.\n\n\nfunction applyStaticStyleAttribute(vnode) {\n const {\n elm,\n data: {\n styleDecls\n }\n } = vnode;\n\n if (isUndefined$1(styleDecls)) {\n return;\n }\n\n for (let i = 0; i < styleDecls.length; i++) {\n const [prop, value, important] = styleDecls[i];\n setCSSStyleProperty$1(elm, prop, value, important);\n }\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst TextHook = {\n create: vnode => {\n const {\n owner\n } = vnode;\n const elm = createText$1(vnode.text);\n linkNodeToShadow(elm, owner);\n vnode.elm = elm;\n },\n update: updateNodeHook,\n insert: insertNode,\n move: insertNode,\n remove: removeNode\n};\nconst CommentHook = {\n create: vnode => {\n const {\n owner,\n text\n } = vnode;\n const elm = createComment$1(text);\n linkNodeToShadow(elm, owner);\n vnode.elm = elm;\n },\n update: updateNodeHook,\n insert: insertNode,\n move: insertNode,\n remove: removeNode\n}; // insert is called after update, which is used somewhere else (via a module)\n// to mark the vm as inserted, that means we cannot use update as the main channel\n// to rehydrate when dirty, because sometimes the element is not inserted just yet,\n// which breaks some invariants. For that reason, we have the following for any\n// Custom Element that is inserted via a template.\n\nconst ElementHook = {\n create: vnode => {\n const {\n sel,\n owner,\n data: {\n svg\n }\n } = vnode;\n const namespace = isTrue(svg) ? SVG_NAMESPACE : undefined;\n const elm = createElement$2(sel, namespace);\n linkNodeToShadow(elm, owner);\n fallbackElmHook(elm, vnode);\n vnode.elm = elm;\n patchElementPropsAndAttrs$1(null, vnode);\n },\n update: (oldVnode, vnode) => {\n patchElementPropsAndAttrs$1(oldVnode, vnode);\n patchChildren(vnode.elm, oldVnode.children, vnode.children);\n },\n insert: (vnode, parentNode, referenceNode) => {\n insertNode(vnode, parentNode, referenceNode);\n createChildrenHook(vnode);\n },\n move: insertNode,\n remove: (vnode, parentNode) => {\n removeNode(vnode, parentNode);\n removeChildren(vnode);\n }\n};\nconst CustomElementHook = {\n create: vnode => {\n const {\n sel,\n owner\n } = vnode;\n const UpgradableConstructor = getUpgradableConstructor(sel);\n /**\n * Note: if the upgradable constructor does not expect, or throw when we new it\n * with a callback as the first argument, we could implement a more advanced\n * mechanism that only passes that argument if the constructor is known to be\n * an upgradable custom element.\n */\n\n let vm;\n const elm = new UpgradableConstructor(elm => {\n // the custom element from the registry is expecting an upgrade callback\n vm = createViewModelHook(elm, vnode);\n });\n linkNodeToShadow(elm, owner);\n vnode.elm = elm;\n\n if (vm) {\n allocateChildren(vnode, vm);\n } else if (vnode.ctor !== UpgradableConstructor) {\n throw new TypeError(`Incorrect Component Constructor`);\n }\n\n patchElementPropsAndAttrs$1(null, vnode);\n },\n update: (oldVnode, vnode) => {\n patchElementPropsAndAttrs$1(oldVnode, vnode);\n const vm = getAssociatedVMIfPresent(vnode.elm);\n\n if (vm) {\n // in fallback mode, the allocation will always set children to\n // empty and delegate the real allocation to the slot elements\n allocateChildren(vnode, vm);\n } // in fallback mode, the children will be always empty, so, nothing\n // will happen, but in native, it does allocate the light dom\n\n\n patchChildren(vnode.elm, oldVnode.children, vnode.children);\n\n if (vm) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);\n } // this will probably update the shadowRoot, but only if the vm is in a dirty state\n // this is important to preserve the top to bottom synchronous rendering phase.\n\n\n rerenderVM(vm);\n }\n },\n insert: (vnode, parentNode, referenceNode) => {\n insertNode(vnode, parentNode, referenceNode);\n const vm = getAssociatedVMIfPresent(vnode.elm);\n\n if (vm) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(vm.state === 0\n /* created */\n , `${vm} cannot be recycled.`);\n }\n\n runConnectedCallback(vm);\n }\n\n createChildrenHook(vnode);\n\n if (vm) {\n appendVM(vm);\n }\n },\n move: insertNode,\n remove: (vnode, parentNode) => {\n removeNode(vnode, parentNode);\n const vm = getAssociatedVMIfPresent(vnode.elm);\n\n if (vm) {\n // for custom elements we don't have to go recursively because the removeVM routine\n // will take care of disconnecting any child VM attached to its shadow as well.\n removeVM(vm);\n }\n }\n};\n\nfunction isVNode(vnode) {\n return vnode != null;\n}\n\nfunction observeElementChildNodes(elm) {\n elm.$domManual$ = true;\n}\n\nfunction setElementShadowToken(elm, token) {\n elm.$shadowToken$ = token;\n} // Set the scope token class for *.scoped.css styles\n\n\nfunction setScopeTokenClassIfNecessary(elm, owner) {\n const {\n cmpTemplate,\n context\n } = owner;\n const token = cmpTemplate === null || cmpTemplate === void 0 ? void 0 : cmpTemplate.stylesheetToken;\n\n if (!isUndefined$1(token) && context.hasScopedStyles) {\n getClassList$1(elm).add(token);\n }\n}\n\nfunction linkNodeToShadow(elm, owner) {\n const {\n renderRoot,\n renderMode,\n shadowMode\n } = owner; // TODO [#1164]: this should eventually be done by the polyfill directly\n\n if (isSyntheticShadowDefined$1) {\n if (shadowMode === 1\n /* Synthetic */\n || renderMode === 0\n /* Light */\n ) {\n elm[KEY__SHADOW_RESOLVER] = renderRoot[KEY__SHADOW_RESOLVER];\n }\n }\n}\n\nfunction updateNodeHook(oldVnode, vnode) {\n const {\n elm,\n text\n } = vnode;\n\n if (oldVnode.text !== text) {\n if (process.env.NODE_ENV !== 'production') {\n unlockDomMutation();\n }\n\n setText$1(elm, text);\n\n if (process.env.NODE_ENV !== 'production') {\n lockDomMutation();\n }\n }\n}\n\nfunction insertNode(vnode, parentNode, referenceNode) {\n if (process.env.NODE_ENV !== 'production') {\n unlockDomMutation();\n }\n\n insert$1(vnode.elm, parentNode, referenceNode);\n\n if (process.env.NODE_ENV !== 'production') {\n lockDomMutation();\n }\n}\n\nfunction removeNode(vnode, parentNode) {\n if (process.env.NODE_ENV !== 'production') {\n unlockDomMutation();\n }\n\n remove$1(vnode.elm, parentNode);\n\n if (process.env.NODE_ENV !== 'production') {\n lockDomMutation();\n }\n}\n\nfunction patchElementPropsAndAttrs$1(oldVnode, vnode) {\n if (isNull(oldVnode)) {\n applyEventListeners(vnode);\n applyStaticClassAttribute(vnode);\n applyStaticStyleAttribute(vnode);\n } // Attrs need to be applied to element before props IE11 will wipe out value on radio inputs if\n // value is set before type=radio.\n\n\n patchClassAttribute(oldVnode, vnode);\n patchStyleAttribute(oldVnode, vnode);\n patchAttributes(oldVnode, vnode);\n patchProps(oldVnode, vnode);\n}\n\nfunction fallbackElmHook(elm, vnode) {\n const {\n owner\n } = vnode;\n setScopeTokenClassIfNecessary(elm, owner);\n\n if (owner.shadowMode === 1\n /* Synthetic */\n ) {\n const {\n data: {\n context\n }\n } = vnode;\n const {\n stylesheetToken\n } = owner.context;\n\n if (!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === \"manual\"\n /* Manual */\n ) {\n // this element will now accept any manual content inserted into it\n observeElementChildNodes(elm);\n }\n\n if (!isUndefined$1(stylesheetToken)) {\n // when running in synthetic shadow mode, we need to set the shadowToken value\n // into each element from the template, so they can be styled accordingly.\n setElementShadowToken(elm, stylesheetToken);\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n const {\n data: {\n context\n }\n } = vnode;\n const isPortal = !isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === \"manual\"\n /* Manual */\n ;\n const isLight = owner.renderMode === 0\n /* Light */\n ;\n patchElementWithRestrictions(elm, {\n isPortal,\n isLight\n });\n }\n}\n\nfunction patchChildren(parent, oldCh, newCh) {\n if (hasDynamicChildren(newCh)) {\n updateDynamicChildren(parent, oldCh, newCh);\n } else {\n updateStaticChildren(parent, oldCh, newCh);\n }\n}\n\nfunction allocateChildren(vnode, vm) {\n // A component with slots will re-render because:\n // 1- There is a change of the internal state.\n // 2- There is a change on the external api (ex: slots)\n //\n // In case #1, the vnodes in the cmpSlots will be reused since they didn't changed. This routine emptied the\n // slotted children when those VCustomElement were rendered and therefore in subsequent calls to allocate children\n // in a reused VCustomElement, there won't be any slotted children.\n // For those cases, we will use the reference for allocated children stored when rendering the fresh VCustomElement.\n //\n // In case #2, we will always get a fresh VCustomElement.\n const children = vnode.aChildren || vnode.children;\n vm.aChildren = children;\n const {\n renderMode,\n shadowMode\n } = vm;\n\n if (shadowMode === 1\n /* Synthetic */\n || renderMode === 0\n /* Light */\n ) {\n // slow path\n allocateInSlot(vm, children); // save the allocated children in case this vnode is reused.\n\n vnode.aChildren = children; // every child vnode is now allocated, and the host should receive none directly, it receives them via the shadow!\n\n vnode.children = EmptyArray;\n }\n}\n\nfunction createViewModelHook(elm, vnode) {\n let vm = getAssociatedVMIfPresent(elm); // There is a possibility that a custom element is registered under tagName, in which case, the\n // initialization is already carry on, and there is nothing else to do here since this hook is\n // called right after invoking `document.createElement`.\n\n if (!isUndefined$1(vm)) {\n return vm;\n }\n\n const {\n sel,\n mode,\n ctor,\n owner\n } = vnode;\n setScopeTokenClassIfNecessary(elm, owner);\n\n if (owner.shadowMode === 1\n /* Synthetic */\n ) {\n const {\n stylesheetToken\n } = owner.context; // when running in synthetic shadow mode, we need to set the shadowToken value\n // into each element from the template, so they can be styled accordingly.\n\n if (!isUndefined$1(stylesheetToken)) {\n setElementShadowToken(elm, stylesheetToken);\n }\n }\n\n vm = createVM(elm, ctor, {\n mode,\n owner,\n tagName: sel\n });\n\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(isArray$1(vnode.children), `Invalid vnode for a custom element, it must have children defined.`);\n }\n\n return vm;\n}\n\nfunction createChildrenHook(vnode) {\n const {\n elm,\n children\n } = vnode;\n\n for (let j = 0; j < children.length; ++j) {\n const ch = children[j];\n\n if (ch != null) {\n ch.hook.create(ch);\n ch.hook.insert(ch, elm, null);\n }\n }\n}\n\nfunction removeChildren(vnode) {\n // this method only needs to search on child vnodes from template\n // to trigger the remove hook just in case some of those children\n // are custom elements.\n const {\n children,\n elm\n } = vnode;\n\n for (let j = 0, len = children.length; j < len; ++j) {\n const ch = children[j];\n\n if (!isNull(ch)) {\n ch.hook.remove(ch, elm);\n }\n }\n}\n\nfunction allocateInSlot(vm, children) {\n var _a;\n\n const {\n cmpSlots: oldSlots\n } = vm;\n const cmpSlots = vm.cmpSlots = create(null);\n\n for (let i = 0, len = children.length; i < len; i += 1) {\n const vnode = children[i];\n\n if (isNull(vnode)) {\n continue;\n }\n\n let slotName = '';\n\n if (isVBaseElement(vnode)) {\n slotName = ((_a = vnode.data.attrs) === null || _a === void 0 ? void 0 : _a.slot) || '';\n }\n\n const vnodes = cmpSlots[slotName] = cmpSlots[slotName] || []; // re-keying the vnodes is necessary to avoid conflicts with default content for the slot\n // which might have similar keys. Each vnode will always have a key that\n // starts with a numeric character from compiler. In this case, we add a unique\n // notation for slotted vnodes keys, e.g.: `@foo:1:1`\n\n if (!isUndefined$1(vnode.key)) {\n vnode.key = `@${slotName}:${vnode.key}`;\n }\n\n ArrayPush$1.call(vnodes, vnode);\n }\n\n if (isFalse(vm.isDirty)) {\n // We need to determine if the old allocation is really different from the new one\n // and mark the vm as dirty\n const oldKeys = keys(oldSlots);\n\n if (oldKeys.length !== keys(cmpSlots).length) {\n markComponentAsDirty(vm);\n return;\n }\n\n for (let i = 0, len = oldKeys.length; i < len; i += 1) {\n const key = oldKeys[i];\n\n if (isUndefined$1(cmpSlots[key]) || oldSlots[key].length !== cmpSlots[key].length) {\n markComponentAsDirty(vm);\n return;\n }\n\n const oldVNodes = oldSlots[key];\n const vnodes = cmpSlots[key];\n\n for (let j = 0, a = cmpSlots[key].length; j < a; j += 1) {\n if (oldVNodes[j] !== vnodes[j]) {\n markComponentAsDirty(vm);\n return;\n }\n }\n }\n }\n} // Using a WeakMap instead of a WeakSet because this one works in IE11 :(\n\n\nconst FromIteration = new WeakMap(); // dynamic children means it was generated by an iteration\n// in a template, and will require a more complex diffing algo.\n\nfunction markAsDynamicChildren(children) {\n FromIteration.set(children, 1);\n}\n\nfunction hasDynamicChildren(children) {\n return FromIteration.has(children);\n}\n\nfunction createKeyToOldIdx(children, beginIdx, endIdx) {\n const map = {}; // TODO [#1637]: simplify this by assuming that all vnodes has keys\n\n for (let j = beginIdx; j <= endIdx; ++j) {\n const ch = children[j];\n\n if (isVNode(ch)) {\n const {\n key\n } = ch;\n\n if (key !== undefined) {\n map[key] = j;\n }\n }\n }\n\n return map;\n}\n\nfunction addVnodes(parentElm, before, vnodes, startIdx, endIdx) {\n for (; startIdx <= endIdx; ++startIdx) {\n const ch = vnodes[startIdx];\n\n if (isVNode(ch)) {\n ch.hook.create(ch);\n ch.hook.insert(ch, parentElm, before);\n }\n }\n}\n\nfunction removeVnodes(parentElm, vnodes, startIdx, endIdx) {\n for (; startIdx <= endIdx; ++startIdx) {\n const ch = vnodes[startIdx]; // text nodes do not have logic associated to them\n\n if (isVNode(ch)) {\n ch.hook.remove(ch, parentElm);\n }\n }\n}\n\nfunction updateDynamicChildren(parentElm, oldCh, newCh) {\n let oldStartIdx = 0;\n let newStartIdx = 0;\n let oldEndIdx = oldCh.length - 1;\n let oldStartVnode = oldCh[0];\n let oldEndVnode = oldCh[oldEndIdx];\n const newChEnd = newCh.length - 1;\n let newEndIdx = newChEnd;\n let newStartVnode = newCh[0];\n let newEndVnode = newCh[newEndIdx];\n let oldKeyToIdx;\n let idxInOld;\n let elmToMove;\n let before;\n let clonedOldCh = false;\n\n while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {\n if (!isVNode(oldStartVnode)) {\n oldStartVnode = oldCh[++oldStartIdx]; // Vnode might have been moved left\n } else if (!isVNode(oldEndVnode)) {\n oldEndVnode = oldCh[--oldEndIdx];\n } else if (!isVNode(newStartVnode)) {\n newStartVnode = newCh[++newStartIdx];\n } else if (!isVNode(newEndVnode)) {\n newEndVnode = newCh[--newEndIdx];\n } else if (isSameVnode(oldStartVnode, newStartVnode)) {\n patchVnode(oldStartVnode, newStartVnode);\n oldStartVnode = oldCh[++oldStartIdx];\n newStartVnode = newCh[++newStartIdx];\n } else if (isSameVnode(oldEndVnode, newEndVnode)) {\n patchVnode(oldEndVnode, newEndVnode);\n oldEndVnode = oldCh[--oldEndIdx];\n newEndVnode = newCh[--newEndIdx];\n } else if (isSameVnode(oldStartVnode, newEndVnode)) {\n // Vnode moved right\n patchVnode(oldStartVnode, newEndVnode);\n newEndVnode.hook.move(oldStartVnode, parentElm, nextSibling$1(oldEndVnode.elm));\n oldStartVnode = oldCh[++oldStartIdx];\n newEndVnode = newCh[--newEndIdx];\n } else if (isSameVnode(oldEndVnode, newStartVnode)) {\n // Vnode moved left\n patchVnode(oldEndVnode, newStartVnode);\n newStartVnode.hook.move(oldEndVnode, parentElm, oldStartVnode.elm);\n oldEndVnode = oldCh[--oldEndIdx];\n newStartVnode = newCh[++newStartIdx];\n } else {\n if (oldKeyToIdx === undefined) {\n oldKeyToIdx = createKeyToOldIdx(oldCh, oldStartIdx, oldEndIdx);\n }\n\n idxInOld = oldKeyToIdx[newStartVnode.key];\n\n if (isUndefined$1(idxInOld)) {\n // New element\n newStartVnode.hook.create(newStartVnode);\n newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);\n newStartVnode = newCh[++newStartIdx];\n } else {\n elmToMove = oldCh[idxInOld];\n\n if (isVNode(elmToMove)) {\n if (elmToMove.sel !== newStartVnode.sel) {\n // New element\n newStartVnode.hook.create(newStartVnode);\n newStartVnode.hook.insert(newStartVnode, parentElm, oldStartVnode.elm);\n } else {\n patchVnode(elmToMove, newStartVnode); // Delete the old child, but copy the array since it is read-only.\n // The `oldCh` will be GC'ed after `updateDynamicChildren` is complete,\n // so we only care about the `oldCh` object inside this function.\n // To avoid cloning over and over again, we check `clonedOldCh`\n // and only clone once.\n\n if (!clonedOldCh) {\n clonedOldCh = true;\n oldCh = [...oldCh];\n } // We've already cloned at least once, so it's no longer read-only\n\n\n oldCh[idxInOld] = undefined;\n newStartVnode.hook.move(elmToMove, parentElm, oldStartVnode.elm);\n }\n }\n\n newStartVnode = newCh[++newStartIdx];\n }\n }\n }\n\n if (oldStartIdx <= oldEndIdx || newStartIdx <= newEndIdx) {\n if (oldStartIdx > oldEndIdx) {\n // There's some cases in which the sub array of vnodes to be inserted is followed by null(s) and an\n // already processed vnode, in such cases the vnodes to be inserted should be before that processed vnode.\n let i = newEndIdx;\n let n;\n\n do {\n n = newCh[++i];\n } while (!isVNode(n) && i < newChEnd);\n\n before = isVNode(n) ? n.elm : null;\n addVnodes(parentElm, before, newCh, newStartIdx, newEndIdx);\n } else {\n removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);\n }\n }\n}\n\nfunction updateStaticChildren(parentElm, oldCh, newCh) {\n const oldChLength = oldCh.length;\n const newChLength = newCh.length;\n\n if (oldChLength === 0) {\n // the old list is empty, we can directly insert anything new\n addVnodes(parentElm, null, newCh, 0, newChLength);\n return;\n }\n\n if (newChLength === 0) {\n // the old list is nonempty and the new list is empty so we can directly remove all old nodes\n // this is the case in which the dynamic children of an if-directive should be removed\n removeVnodes(parentElm, oldCh, 0, oldChLength);\n return;\n } // if the old list is not empty, the new list MUST have the same\n // amount of nodes, that's why we call this static children\n\n\n let referenceElm = null;\n\n for (let i = newChLength - 1; i >= 0; i -= 1) {\n const vnode = newCh[i];\n const oldVNode = oldCh[i];\n\n if (vnode !== oldVNode) {\n if (isVNode(oldVNode)) {\n if (isVNode(vnode)) {\n // both vnodes must be equivalent, and se just need to patch them\n patchVnode(oldVNode, vnode);\n referenceElm = vnode.elm;\n } else {\n // removing the old vnode since the new one is null\n oldVNode.hook.remove(oldVNode, parentElm);\n }\n } else if (isVNode(vnode)) {\n // this condition is unnecessary\n vnode.hook.create(vnode); // insert the new node one since the old one is null\n\n vnode.hook.insert(vnode, parentElm, referenceElm);\n referenceElm = vnode.elm;\n }\n }\n }\n}\n\nfunction patchVnode(oldVnode, vnode) {\n if (oldVnode !== vnode) {\n vnode.elm = oldVnode.elm;\n vnode.hook.update(oldVnode, vnode);\n }\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst SymbolIterator = Symbol.iterator;\n\nfunction addVNodeToChildLWC(vnode) {\n ArrayPush$1.call(getVMBeingRendered().velements, vnode);\n} // [h]tml node\n\n\nfunction h(sel, data, children = EmptyArray) {\n const vmBeingRendered = getVMBeingRendered();\n\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(isString(sel), `h() 1st argument sel must be a string.`);\n assert.isTrue(isObject(data), `h() 2nd argument data must be an object.`);\n assert.isTrue(isArray$1(children), `h() 3rd argument children must be an array.`);\n assert.isTrue('key' in data, ` <${sel}> \"key\" attribute is invalid or missing for ${vmBeingRendered}. Key inside iterator is either undefined or null.`); // checking reserved internal data properties\n\n assert.isFalse(data.className && data.classMap, `vnode.data.className and vnode.data.classMap ambiguous declaration.`);\n assert.isFalse(data.styleDecls && data.style, `vnode.data.styleDecls and vnode.data.style ambiguous declaration.`);\n\n if (data.style && !isString(data.style)) {\n logError(`Invalid 'style' attribute passed to <${sel}> is ignored. This attribute must be a string value.`, vmBeingRendered);\n }\n\n forEach.call(children, childVnode => {\n if (childVnode != null) {\n assert.isTrue('type' in childVnode && 'sel' in childVnode && 'elm' in childVnode && 'key' in childVnode, `${childVnode} is not a vnode.`);\n }\n });\n }\n\n let elm;\n const {\n key\n } = data;\n return {\n type: 2\n /* Element */\n ,\n sel,\n data,\n children,\n elm,\n key,\n hook: ElementHook,\n owner: vmBeingRendered\n };\n} // [t]ab[i]ndex function\n\n\nfunction ti(value) {\n // if value is greater than 0, we normalize to 0\n // If value is an invalid tabIndex value (null, undefined, string, etc), we let that value pass through\n // If value is less than -1, we don't care\n const shouldNormalize = value > 0 && !(isTrue(value) || isFalse(value));\n\n if (process.env.NODE_ENV !== 'production') {\n const vmBeingRendered = getVMBeingRendered();\n\n if (shouldNormalize) {\n logError(`Invalid tabindex value \\`${toString$1(value)}\\` in template for ${vmBeingRendered}. This attribute must be set to 0 or -1.`, vmBeingRendered);\n }\n }\n\n return shouldNormalize ? 0 : value;\n} // [s]lot element node\n\n\nfunction s(slotName, data, children, slotset) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(isString(slotName), `s() 1st argument slotName must be a string.`);\n assert.isTrue(isObject(data), `s() 2nd argument data must be an object.`);\n assert.isTrue(isArray$1(children), `h() 3rd argument children must be an array.`);\n }\n\n if (!isUndefined$1(slotset) && !isUndefined$1(slotset[slotName]) && slotset[slotName].length !== 0) {\n children = slotset[slotName];\n }\n\n const vmBeingRendered = getVMBeingRendered();\n const {\n renderMode,\n shadowMode\n } = vmBeingRendered;\n\n if (renderMode === 0\n /* Light */\n ) {\n sc(children);\n return children;\n }\n\n if (shadowMode === 1\n /* Synthetic */\n ) {\n // TODO [#1276]: compiler should give us some sort of indicator when a vnodes collection is dynamic\n sc(children);\n }\n\n return h('slot', data, children);\n} // [c]ustom element node\n\n\nfunction c(sel, Ctor, data, children = EmptyArray) {\n const vmBeingRendered = getVMBeingRendered();\n\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(isString(sel), `c() 1st argument sel must be a string.`);\n assert.isTrue(isFunction$1(Ctor), `c() 2nd argument Ctor must be a function.`);\n assert.isTrue(isObject(data), `c() 3nd argument data must be an object.`);\n assert.isTrue(arguments.length === 3 || isArray$1(children), `c() 4nd argument data must be an array.`); // checking reserved internal data properties\n\n assert.isFalse(data.className && data.classMap, `vnode.data.className and vnode.data.classMap ambiguous declaration.`);\n assert.isFalse(data.styleDecls && data.style, `vnode.data.styleDecls and vnode.data.style ambiguous declaration.`);\n\n if (data.style && !isString(data.style)) {\n logError(`Invalid 'style' attribute passed to <${sel}> is ignored. This attribute must be a string value.`, vmBeingRendered);\n }\n\n if (arguments.length === 4) {\n forEach.call(children, childVnode => {\n if (childVnode != null) {\n assert.isTrue('type' in childVnode && 'sel' in childVnode && 'elm' in childVnode && 'key' in childVnode, `${childVnode} is not a vnode.`);\n }\n });\n }\n }\n\n const {\n key\n } = data;\n let elm;\n const vnode = {\n type: 3\n /* CustomElement */\n ,\n sel,\n data,\n children,\n elm,\n key,\n hook: CustomElementHook,\n ctor: Ctor,\n owner: vmBeingRendered,\n mode: 'open' // TODO [#1294]: this should be defined in Ctor\n\n };\n addVNodeToChildLWC(vnode);\n return vnode;\n} // [i]terable node\n\n\nfunction i(iterable, factory) {\n const list = []; // TODO [#1276]: compiler should give us some sort of indicator when a vnodes collection is dynamic\n\n sc(list);\n const vmBeingRendered = getVMBeingRendered();\n\n if (isUndefined$1(iterable) || iterable === null) {\n if (process.env.NODE_ENV !== 'production') {\n logError(`Invalid template iteration for value \"${toString$1(iterable)}\" in ${vmBeingRendered}. It must be an Array or an iterable Object.`, vmBeingRendered);\n }\n\n return list;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n assert.isFalse(isUndefined$1(iterable[SymbolIterator]), `Invalid template iteration for value \\`${toString$1(iterable)}\\` in ${vmBeingRendered}. It must be an array-like object and not \\`null\\` nor \\`undefined\\`.`);\n }\n\n const iterator = iterable[SymbolIterator]();\n\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(iterator && isFunction$1(iterator.next), `Invalid iterator function for \"${toString$1(iterable)}\" in ${vmBeingRendered}.`);\n }\n\n let next = iterator.next();\n let j = 0;\n let {\n value,\n done: last\n } = next;\n let keyMap;\n let iterationError;\n\n if (process.env.NODE_ENV !== 'production') {\n keyMap = create(null);\n }\n\n while (last === false) {\n // implementing a look-back-approach because we need to know if the element is the last\n next = iterator.next();\n last = next.done; // template factory logic based on the previous collected value\n\n const vnode = factory(value, j, j === 0, last === true);\n\n if (isArray$1(vnode)) {\n ArrayPush$1.apply(list, vnode);\n } else {\n ArrayPush$1.call(list, vnode);\n }\n\n if (process.env.NODE_ENV !== 'production') {\n const vnodes = isArray$1(vnode) ? vnode : [vnode];\n forEach.call(vnodes, childVnode => {\n if (!isNull(childVnode) && isObject(childVnode) && !isUndefined$1(childVnode.sel)) {\n const {\n key\n } = childVnode;\n\n if (isString(key) || isNumber(key)) {\n if (keyMap[key] === 1 && isUndefined$1(iterationError)) {\n iterationError = `Duplicated \"key\" attribute value for \"<${childVnode.sel}>\" in ${vmBeingRendered} for item number ${j}. A key with value \"${childVnode.key}\" appears more than once in the iteration. Key values must be unique numbers or strings.`;\n }\n\n keyMap[key] = 1;\n } else if (isUndefined$1(iterationError)) {\n iterationError = `Invalid \"key\" attribute value in \"<${childVnode.sel}>\" in ${vmBeingRendered} for item number ${j}. Set a unique \"key\" value on all iterated child elements.`;\n }\n }\n });\n } // preparing next value\n\n\n j += 1;\n value = next.value;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!isUndefined$1(iterationError)) {\n logError(iterationError, vmBeingRendered);\n }\n }\n\n return list;\n}\n/**\n * [f]lattening\n */\n\n\nfunction f(items) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(isArray$1(items), 'flattening api can only work with arrays.');\n }\n\n const len = items.length;\n const flattened = []; // TODO [#1276]: compiler should give us some sort of indicator when a vnodes collection is dynamic\n\n sc(flattened);\n\n for (let j = 0; j < len; j += 1) {\n const item = items[j];\n\n if (isArray$1(item)) {\n ArrayPush$1.apply(flattened, item);\n } else {\n ArrayPush$1.call(flattened, item);\n }\n }\n\n return flattened;\n} // [t]ext node\n\n\nfunction t(text) {\n let sel, key, elm;\n return {\n type: 0\n /* Text */\n ,\n sel,\n text,\n elm,\n key,\n hook: TextHook,\n owner: getVMBeingRendered()\n };\n} // [co]mment node\n\n\nfunction co(text) {\n let sel, key, elm;\n return {\n type: 1\n /* Comment */\n ,\n sel,\n text,\n elm,\n key,\n hook: CommentHook,\n owner: getVMBeingRendered()\n };\n} // [d]ynamic text\n\n\nfunction d(value) {\n return value == null ? '' : String(value);\n} // [b]ind function\n\n\nfunction b(fn) {\n const vmBeingRendered = getVMBeingRendered();\n\n if (isNull(vmBeingRendered)) {\n throw new Error();\n }\n\n const vm = vmBeingRendered;\n return function (event) {\n invokeEventListener(vm, fn, vm.component, event);\n };\n} // [k]ey function\n\n\nfunction k(compilerKey, obj) {\n switch (typeof obj) {\n case 'number':\n case 'string':\n return compilerKey + ':' + obj;\n\n case 'object':\n if (process.env.NODE_ENV !== 'production') {\n assert.fail(`Invalid key value \"${obj}\" in ${getVMBeingRendered()}. Key must be a string or number.`);\n }\n\n }\n} // [g]lobal [id] function\n\n\nfunction gid(id) {\n const vmBeingRendered = getVMBeingRendered();\n\n if (isUndefined$1(id) || id === '') {\n if (process.env.NODE_ENV !== 'production') {\n logError(`Invalid id value \"${id}\". The id attribute must contain a non-empty string.`, vmBeingRendered);\n }\n\n return id;\n } // We remove attributes when they are assigned a value of null\n\n\n if (isNull(id)) {\n return null;\n }\n\n const {\n idx,\n shadowMode\n } = vmBeingRendered;\n\n if (shadowMode === 1\n /* Synthetic */\n ) {\n return StringReplace.call(id, /\\S+/g, id => `${id}-${idx}`);\n }\n\n return id;\n} // [f]ragment [id] function\n\n\nfunction fid(url) {\n const vmBeingRendered = getVMBeingRendered();\n\n if (isUndefined$1(url) || url === '') {\n if (process.env.NODE_ENV !== 'production') {\n if (isUndefined$1(url)) {\n logError(`Undefined url value for \"href\" or \"xlink:href\" attribute. Expected a non-empty string.`, vmBeingRendered);\n }\n }\n\n return url;\n } // We remove attributes when they are assigned a value of null\n\n\n if (isNull(url)) {\n return null;\n }\n\n const {\n idx,\n shadowMode\n } = vmBeingRendered; // Apply transformation only for fragment-only-urls, and only in shadow DOM\n\n if (shadowMode === 1\n /* Synthetic */\n && /^#/.test(url)) {\n return `${url}-${idx}`;\n }\n\n return url;\n}\n/**\n * Map to store an index value assigned to any dynamic component reference ingested\n * by dc() api. This allows us to generate a unique unique per template per dynamic\n * component reference to avoid diffing algo mismatches.\n */\n\n\nconst DynamicImportedComponentMap = new Map();\nlet dynamicImportedComponentCounter = 0;\n/**\n * create a dynamic component via ``\n */\n\nfunction dc(sel, Ctor, data, children = EmptyArray) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(isString(sel), `dc() 1st argument sel must be a string.`);\n assert.isTrue(isObject(data), `dc() 3nd argument data must be an object.`);\n assert.isTrue(arguments.length === 3 || isArray$1(children), `dc() 4nd argument data must be an array.`);\n } // null or undefined values should produce a null value in the VNodes\n\n\n if (Ctor == null) {\n return null;\n }\n\n if (!isComponentConstructor(Ctor)) {\n throw new Error(`Invalid LWC Constructor ${toString$1(Ctor)} for custom element <${sel}>.`);\n }\n\n let idx = DynamicImportedComponentMap.get(Ctor);\n\n if (isUndefined$1(idx)) {\n idx = dynamicImportedComponentCounter++;\n DynamicImportedComponentMap.set(Ctor, idx);\n } // the new vnode key is a mix of idx and compiler key, this is required by the diffing algo\n // to identify different constructors as vnodes with different keys to avoid reusing the\n // element used for previous constructors.\n // Shallow clone is necessary here becuase VElementData may be shared across VNodes due to\n // hoisting optimization.\n\n\n const newData = Object.assign(Object.assign({}, data), {\n key: `dc:${idx}:${data.key}`\n });\n return c(sel, Ctor, newData, children);\n}\n/**\n * slow children collection marking mechanism. this API allows the compiler to signal\n * to the engine that a particular collection of children must be diffed using the slow\n * algo based on keys due to the nature of the list. E.g.:\n *\n * - slot element's children: the content of the slot has to be dynamic when in synthetic\n * shadow mode because the `vnode.children` might be the slotted\n * content vs default content, in which case the size and the\n * keys are not matching.\n * - children that contain dynamic components\n * - children that are produced by iteration\n *\n */\n\n\nfunction sc(vnodes) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(isArray$1(vnodes), 'sc() api can only work with arrays.');\n } // We have to mark the vnodes collection as dynamic so we can later on\n // choose to use the snabbdom virtual dom diffing algo instead of our\n // static dummy algo.\n\n\n markAsDynamicChildren(vnodes);\n return vnodes;\n}\n/**\n * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar\n * libraries to sanitize HTML content. This hook process the content passed via the template to\n * lwc:inner-html directive.\n * It is meant to be overridden with setSanitizeHtmlContentHook, it throws an error by default.\n */\n\n\nlet sanitizeHtmlContentHook = () => {\n // locker-service patches this function during runtime to sanitize HTML content.\n throw new Error('sanitizeHtmlContent hook must be implemented.');\n};\n/**\n * Sets the sanitizeHtmlContentHook.\n */\n\n\nfunction setSanitizeHtmlContentHook(newHookImpl) {\n sanitizeHtmlContentHook = newHookImpl;\n} // [s]anitize [h]tml [c]ontent\n\n\nfunction shc(content) {\n return sanitizeHtmlContentHook(content);\n}\n\nconst api = freeze({\n s,\n h,\n c,\n i,\n f,\n t,\n d,\n b,\n k,\n co,\n dc,\n ti,\n gid,\n fid,\n shc\n});\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\nfunction makeHostToken(token) {\n return `${token}-host`;\n}\n\nfunction createInlineStyleVNode(content) {\n return api.h('style', {\n key: 'style',\n attrs: {\n type: 'text/css'\n }\n }, [api.t(content)]);\n}\n\nfunction updateStylesheetToken(vm, template) {\n const {\n elm,\n context,\n renderMode,\n shadowMode\n } = vm;\n const {\n stylesheets: newStylesheets,\n stylesheetToken: newStylesheetToken\n } = template;\n const isSyntheticShadow = renderMode === 1\n /* Shadow */\n && shadowMode === 1\n /* Synthetic */\n ;\n const {\n hasScopedStyles\n } = context;\n let newToken;\n let newHasTokenInClass;\n let newHasTokenInAttribute; // Reset the styling token applied to the host element.\n\n const {\n stylesheetToken: oldToken,\n hasTokenInClass: oldHasTokenInClass,\n hasTokenInAttribute: oldHasTokenInAttribute\n } = context;\n\n if (!isUndefined$1(oldToken)) {\n if (oldHasTokenInClass) {\n getClassList$1(elm).remove(makeHostToken(oldToken));\n }\n\n if (oldHasTokenInAttribute) {\n removeAttribute$1(elm, makeHostToken(oldToken));\n }\n } // Apply the new template styling token to the host element, if the new template has any\n // associated stylesheets. In the case of light DOM, also ensure there is at least one scoped stylesheet.\n\n\n if (!isUndefined$1(newStylesheets) && newStylesheets.length !== 0) {\n newToken = newStylesheetToken;\n } // Set the new styling token on the host element\n\n\n if (!isUndefined$1(newToken)) {\n if (hasScopedStyles) {\n getClassList$1(elm).add(makeHostToken(newToken));\n newHasTokenInClass = true;\n }\n\n if (isSyntheticShadow) {\n setAttribute$1(elm, makeHostToken(newToken), '');\n newHasTokenInAttribute = true;\n }\n } // Update the styling tokens present on the context object.\n\n\n context.stylesheetToken = newToken;\n context.hasTokenInClass = newHasTokenInClass;\n context.hasTokenInAttribute = newHasTokenInAttribute;\n}\n\nfunction evaluateStylesheetsContent(stylesheets, stylesheetToken, vm) {\n const content = [];\n let root;\n\n for (let i = 0; i < stylesheets.length; i++) {\n let stylesheet = stylesheets[i];\n\n if (isArray$1(stylesheet)) {\n ArrayPush$1.apply(content, evaluateStylesheetsContent(stylesheet, stylesheetToken, vm));\n } else {\n if (process.env.NODE_ENV !== 'production') {\n // in dev-mode, we support hot swapping of stylesheet, which means that\n // the component instance might be attempting to use an old version of\n // the stylesheet, while internally, we have a replacement for it.\n stylesheet = getStyleOrSwappedStyle(stylesheet);\n }\n\n const isScopedCss = stylesheet[KEY__SCOPED_CSS]; // Apply the scope token only if the stylesheet itself is scoped, or if we're rendering synthetic shadow.\n\n const scopeToken = isScopedCss || vm.shadowMode === 1\n /* Synthetic */\n && vm.renderMode === 1\n /* Shadow */\n ? stylesheetToken : undefined; // Use the actual `:host` selector if we're rendering global CSS for light DOM, or if we're rendering\n // native shadow DOM. Synthetic shadow DOM never uses `:host`.\n\n const useActualHostSelector = vm.renderMode === 0\n /* Light */\n ? !isScopedCss : vm.shadowMode === 0\n /* Native */\n ; // Use the native :dir() pseudoclass only in native shadow DOM. Otherwise, in synthetic shadow,\n // we use an attribute selector on the host to simulate :dir().\n\n let useNativeDirPseudoclass;\n\n if (vm.renderMode === 1\n /* Shadow */\n ) {\n useNativeDirPseudoclass = vm.shadowMode === 0\n /* Native */\n ;\n } else {\n // Light DOM components should only render `[dir]` if they're inside of a synthetic shadow root.\n // At the top level (root is null) or inside of a native shadow root, they should use `:dir()`.\n if (isUndefined$1(root)) {\n // Only calculate the root once as necessary\n root = getNearestShadowComponent(vm);\n }\n\n useNativeDirPseudoclass = isNull(root) || root.shadowMode === 0\n /* Native */\n ;\n }\n\n ArrayPush$1.call(content, stylesheet(scopeToken, useActualHostSelector, useNativeDirPseudoclass));\n }\n }\n\n return content;\n}\n\nfunction getStylesheetsContent(vm, template) {\n const {\n stylesheets,\n stylesheetToken\n } = template;\n let content = [];\n\n if (!isUndefined$1(stylesheets) && stylesheets.length !== 0) {\n content = evaluateStylesheetsContent(stylesheets, stylesheetToken, vm);\n }\n\n return content;\n} // It might be worth caching this to avoid doing the lookup repeatedly, but\n// perf testing has not shown it to be a huge improvement yet:\n// https://github.com/salesforce/lwc/pull/2460#discussion_r691208892\n\n\nfunction getNearestShadowComponent(vm) {\n let owner = vm;\n\n while (!isNull(owner)) {\n if (owner.renderMode === 1\n /* Shadow */\n ) {\n return owner;\n }\n\n owner = owner.owner;\n }\n\n return owner;\n}\n\nfunction getNearestNativeShadowComponent(vm) {\n const owner = getNearestShadowComponent(vm);\n\n if (!isNull(owner) && owner.shadowMode === 1\n /* Synthetic */\n ) {\n // Synthetic-within-native is impossible. So if the nearest shadow component is\n // synthetic, we know we won't find a native component if we go any further.\n return null;\n }\n\n return owner;\n}\n\nfunction createStylesheet(vm, stylesheets) {\n const {\n renderMode,\n shadowMode\n } = vm;\n\n if (renderMode === 1\n /* Shadow */\n && shadowMode === 1\n /* Synthetic */\n ) {\n for (let i = 0; i < stylesheets.length; i++) {\n insertGlobalStylesheet$1(stylesheets[i]);\n }\n } else if (ssr$1 || isHydrating$1()) {\n // Note: We need to ensure that during hydration, the stylesheets method is the same as those in ssr.\n // This works in the client, because the stylesheets are created, and cached in the VM\n // the first time the VM renders.\n // native shadow or light DOM, SSR\n const combinedStylesheetContent = ArrayJoin.call(stylesheets, '\\n');\n return createInlineStyleVNode(combinedStylesheetContent);\n } else {\n // native shadow or light DOM, DOM renderer\n const root = getNearestNativeShadowComponent(vm);\n const isGlobal = isNull(root);\n\n for (let i = 0; i < stylesheets.length; i++) {\n if (isGlobal) {\n insertGlobalStylesheet$1(stylesheets[i]);\n } else {\n // local level\n insertStylesheet$1(stylesheets[i], root.shadowRoot);\n }\n }\n }\n\n return null;\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst operationIdNameMapping = ['constructor', 'render', 'patch', 'connectedCallback', 'renderedCallback', 'disconnectedCallback', 'errorCallback', 'lwc-hydrate', 'lwc-rehydrate']; // Even if all the browser the engine supports implements the UserTiming API, we need to guard the measure APIs.\n// JSDom (used in Jest) for example doesn't implement the UserTiming APIs.\n\nconst isUserTimingSupported = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function' && typeof performance.measure === 'function' && typeof performance.clearMeasures === 'function';\nconst start = !isUserTimingSupported ? noop : markName => {\n performance.mark(markName);\n};\nconst end = !isUserTimingSupported ? noop : (measureName, markName) => {\n performance.measure(measureName, markName); // Clear the created marks and measure to avoid filling the performance entries buffer.\n // Note: Even if the entries get deleted, existing PerformanceObservers preserve a copy of those entries.\n\n performance.clearMarks(markName);\n performance.clearMeasures(measureName);\n};\n\nfunction getOperationName(opId) {\n return operationIdNameMapping[opId];\n}\n\nfunction getMeasureName(opId, vm) {\n return `${getComponentTag(vm)} - ${getOperationName(opId)}`;\n}\n\nfunction getMarkName(opId, vm) {\n // Adding the VM idx to the mark name creates a unique mark name component instance. This is necessary to produce\n // the right measures for components that are recursive.\n return `${getMeasureName(opId, vm)} - ${vm.idx}`;\n}\n/** Indicates if operations should be logged via the User Timing API. */\n\n\nconst isMeasureEnabled = process.env.NODE_ENV !== 'production';\n/** Indicates if operations should be logged by the profiler. */\n\nlet isProfilerEnabled = false;\n/** The currently assigned profiler dispatcher. */\n\nlet currentDispatcher = noop;\nconst profilerControl = {\n enableProfiler() {\n isProfilerEnabled = true;\n },\n\n disableProfiler() {\n isProfilerEnabled = false;\n },\n\n attachDispatcher(dispatcher) {\n currentDispatcher = dispatcher;\n this.enableProfiler();\n },\n\n detachDispatcher() {\n const dispatcher = currentDispatcher;\n currentDispatcher = noop;\n this.disableProfiler();\n return dispatcher;\n }\n\n};\n\nfunction logOperationStart(opId, vm) {\n if (isMeasureEnabled) {\n const markName = getMarkName(opId, vm);\n start(markName);\n }\n\n if (isProfilerEnabled) {\n currentDispatcher(opId, 0\n /* Start */\n , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);\n }\n}\n\nfunction logOperationEnd(opId, vm) {\n if (isMeasureEnabled) {\n const markName = getMarkName(opId, vm);\n const measureName = getMeasureName(opId, vm);\n end(measureName, markName);\n }\n\n if (isProfilerEnabled) {\n currentDispatcher(opId, 1\n /* Stop */\n , vm.tagName, vm.idx, vm.renderMode, vm.shadowMode);\n }\n}\n\nfunction logGlobalOperationStart(opId, vm) {\n if (isMeasureEnabled) {\n const opName = getOperationName(opId);\n const markName = isUndefined$1(vm) ? opName : getMarkName(opId, vm);\n start(markName);\n }\n\n if (isProfilerEnabled) {\n currentDispatcher(opId, 0\n /* Start */\n , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx, vm === null || vm === void 0 ? void 0 : vm.renderMode, vm === null || vm === void 0 ? void 0 : vm.shadowMode);\n }\n}\n\nfunction logGlobalOperationEnd(opId, vm) {\n if (isMeasureEnabled) {\n const opName = getOperationName(opId);\n const markName = isUndefined$1(vm) ? opName : getMarkName(opId, vm);\n end(opName, markName);\n }\n\n if (isProfilerEnabled) {\n currentDispatcher(opId, 1\n /* Stop */\n , vm === null || vm === void 0 ? void 0 : vm.tagName, vm === null || vm === void 0 ? void 0 : vm.idx, vm === null || vm === void 0 ? void 0 : vm.renderMode, vm === null || vm === void 0 ? void 0 : vm.shadowMode);\n }\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nlet isUpdatingTemplate = false;\nlet vmBeingRendered = null;\n\nfunction getVMBeingRendered() {\n return vmBeingRendered;\n}\n\nfunction setVMBeingRendered(vm) {\n vmBeingRendered = vm;\n}\n\nfunction validateSlots(vm, html) {\n if (process.env.NODE_ENV === 'production') {\n // this method should never leak to prod\n throw new ReferenceError();\n }\n\n const {\n cmpSlots\n } = vm;\n const {\n slots = EmptyArray\n } = html;\n\n for (const slotName in cmpSlots) {\n // eslint-disable-next-line lwc-internal/no-production-assert\n assert.isTrue(isArray$1(cmpSlots[slotName]), `Slots can only be set to an array, instead received ${toString$1(cmpSlots[slotName])} for slot \"${slotName}\" in ${vm}.`);\n\n if (slotName !== '' && ArrayIndexOf.call(slots, slotName) === -1) {\n // TODO [#1297]: this should never really happen because the compiler should always validate\n // eslint-disable-next-line lwc-internal/no-production-assert\n logError(`Ignoring unknown provided slot name \"${slotName}\" in ${vm}. Check for a typo on the slot attribute.`, vm);\n }\n }\n}\n\nfunction validateLightDomTemplate(template, vm) {\n if (template === defaultEmptyTemplate) return;\n\n if (vm.renderMode === 0\n /* Light */\n ) {\n assert.isTrue(template.renderMode === 'light', `Light DOM components can't render shadow DOM templates. Add an 'lwc:render-mode=\"light\"' directive to the root template tag of ${getComponentTag(vm)}.`);\n } else {\n assert.isTrue(isUndefined$1(template.renderMode), `Shadow DOM components template can't render light DOM templates. Either remove the 'lwc:render-mode' directive from ${getComponentTag(vm)} or set it to 'lwc:render-mode=\"shadow\"`);\n }\n}\n\nfunction evaluateTemplate(vm, html) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(isFunction$1(html), `evaluateTemplate() second argument must be an imported template instead of ${toString$1(html)}`); // in dev-mode, we support hot swapping of templates, which means that\n // the component instance might be attempting to use an old version of\n // the template, while internally, we have a replacement for it.\n\n html = getTemplateOrSwappedTemplate(html);\n }\n\n const isUpdatingTemplateInception = isUpdatingTemplate;\n const vmOfTemplateBeingUpdatedInception = vmBeingRendered;\n let vnodes = [];\n runWithBoundaryProtection(vm, vm.owner, () => {\n // pre\n vmBeingRendered = vm;\n logOperationStart(1\n /* Render */\n , vm);\n }, () => {\n // job\n const {\n component,\n context,\n cmpSlots,\n cmpTemplate,\n tro\n } = vm;\n tro.observe(() => {\n // Reset the cache memoizer for template when needed.\n if (html !== cmpTemplate) {\n if (process.env.NODE_ENV !== 'production') {\n validateLightDomTemplate(html, vm);\n } // Perf opt: do not reset the shadow root during the first rendering (there is\n // nothing to reset).\n\n\n if (!isNull(cmpTemplate)) {\n // It is important to reset the content to avoid reusing similar elements\n // generated from a different template, because they could have similar IDs,\n // and snabbdom just rely on the IDs.\n resetComponentRoot(vm);\n } // Check that the template was built by the compiler.\n\n\n if (!isTemplateRegistered(html)) {\n throw new TypeError(`Invalid template returned by the render() method on ${vm}. It must return an imported template (e.g.: \\`import html from \"./${vm.def.name}.html\"\\`), instead, it has returned: ${toString$1(html)}.`);\n }\n\n vm.cmpTemplate = html; // Create a brand new template cache for the swapped templated.\n\n context.tplCache = create(null); // Set the computeHasScopedStyles property in the context, to avoid recomputing it repeatedly.\n\n context.hasScopedStyles = computeHasScopedStyles(html); // Update the scoping token on the host element.\n\n updateStylesheetToken(vm, html); // Evaluate, create stylesheet and cache the produced VNode for future\n // re-rendering.\n\n const stylesheetsContent = getStylesheetsContent(vm, html);\n context.styleVNode = stylesheetsContent.length === 0 ? null : createStylesheet(vm, stylesheetsContent);\n }\n\n if (process.env.NODE_ENV !== 'production') {\n // validating slots in every rendering since the allocated content might change over time\n validateSlots(vm, html); // add the VM to the list of host VMs that can be re-rendered if html is swapped\n\n setActiveVM(vm);\n } // right before producing the vnodes, we clear up all internal references\n // to custom elements from the template.\n\n\n vm.velements = []; // Set the global flag that template is being updated\n\n isUpdatingTemplate = true;\n vnodes = html.call(undefined, api, component, cmpSlots, context.tplCache);\n const {\n styleVNode\n } = context;\n\n if (!isNull(styleVNode)) {\n ArrayUnshift.call(vnodes, styleVNode);\n }\n });\n }, () => {\n // post\n isUpdatingTemplate = isUpdatingTemplateInception;\n vmBeingRendered = vmOfTemplateBeingUpdatedInception;\n logOperationEnd(1\n /* Render */\n , vm);\n });\n\n if (process.env.NODE_ENV !== 'production') {\n assert.invariant(isArray$1(vnodes), `Compiler should produce html functions that always return an array.`);\n }\n\n return vnodes;\n}\n\nfunction computeHasScopedStyles(template) {\n const {\n stylesheets\n } = template;\n\n if (!isUndefined$1(stylesheets)) {\n for (let i = 0; i < stylesheets.length; i++) {\n if (isTrue(stylesheets[i][KEY__SCOPED_CSS])) {\n return true;\n }\n }\n }\n\n return false;\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nlet isInvokingRender = false;\nlet vmBeingConstructed = null;\n\nfunction isBeingConstructed(vm) {\n return vmBeingConstructed === vm;\n}\n\nfunction invokeComponentCallback(vm, fn, args) {\n const {\n component,\n callHook,\n owner\n } = vm;\n runWithBoundaryProtection(vm, owner, noop, () => {\n callHook(component, fn, args);\n }, noop);\n}\n\nfunction invokeComponentConstructor(vm, Ctor) {\n const vmBeingConstructedInception = vmBeingConstructed;\n let error;\n logOperationStart(0\n /* Constructor */\n , vm);\n vmBeingConstructed = vm;\n /**\n * Constructors don't need to be wrapped with a boundary because for root elements\n * it should throw, while elements from template are already wrapped by a boundary\n * associated to the diffing algo.\n */\n\n try {\n // job\n const result = new Ctor(); // Check indirectly if the constructor result is an instance of LightningElement. Using\n // the \"instanceof\" operator would not work here since Locker Service provides its own\n // implementation of LightningElement, so we indirectly check if the base constructor is\n // invoked by accessing the component on the vm.\n\n if (vmBeingConstructed.component !== result) {\n throw new TypeError('Invalid component constructor, the class should extend LightningElement.');\n }\n } catch (e) {\n error = Object(e);\n } finally {\n logOperationEnd(0\n /* Constructor */\n , vm);\n vmBeingConstructed = vmBeingConstructedInception;\n\n if (!isUndefined$1(error)) {\n addErrorComponentStack(vm, error); // re-throwing the original error annotated after restoring the context\n\n throw error; // eslint-disable-line no-unsafe-finally\n }\n }\n}\n\nfunction invokeComponentRenderMethod(vm) {\n const {\n def: {\n render\n },\n callHook,\n component,\n owner\n } = vm;\n const isRenderBeingInvokedInception = isInvokingRender;\n const vmBeingRenderedInception = getVMBeingRendered();\n let html;\n let renderInvocationSuccessful = false;\n runWithBoundaryProtection(vm, owner, () => {\n // pre\n isInvokingRender = true;\n setVMBeingRendered(vm);\n }, () => {\n // job\n vm.tro.observe(() => {\n html = callHook(component, render);\n renderInvocationSuccessful = true;\n });\n }, () => {\n // post\n isInvokingRender = isRenderBeingInvokedInception;\n setVMBeingRendered(vmBeingRenderedInception);\n }); // If render() invocation failed, process errorCallback in boundary and return an empty template\n\n return renderInvocationSuccessful ? evaluateTemplate(vm, html) : [];\n}\n\nfunction invokeEventListener(vm, fn, thisValue, event) {\n const {\n callHook,\n owner\n } = vm;\n runWithBoundaryProtection(vm, owner, noop, () => {\n // job\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(isFunction$1(fn), `Invalid event handler for event '${event.type}' on ${vm}.`);\n }\n\n callHook(thisValue, fn, [event]);\n }, noop);\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst signedTemplateMap = new Map();\n/**\n * INTERNAL: This function can only be invoked by compiled code. The compiler\n * will prevent this function from being imported by userland code.\n */\n\nfunction registerComponent(Ctor, {\n tmpl\n}) {\n signedTemplateMap.set(Ctor, tmpl); // chaining this method as a way to wrap existing assignment of component constructor easily,\n // without too much transformation\n\n return Ctor;\n}\n\nfunction getComponentRegisteredTemplate(Ctor) {\n return signedTemplateMap.get(Ctor);\n}\n\nfunction getTemplateReactiveObserver(vm) {\n return new ReactiveObserver(() => {\n const {\n isDirty\n } = vm;\n\n if (isFalse(isDirty)) {\n markComponentAsDirty(vm);\n scheduleRehydration(vm);\n }\n });\n}\n\nfunction renderComponent(vm) {\n if (process.env.NODE_ENV !== 'production') {\n assert.invariant(vm.isDirty, `${vm} is not dirty.`);\n }\n\n vm.tro.reset();\n const vnodes = invokeComponentRenderMethod(vm);\n vm.isDirty = false;\n vm.isScheduled = false;\n return vnodes;\n}\n\nfunction markComponentAsDirty(vm) {\n if (process.env.NODE_ENV !== 'production') {\n const vmBeingRendered = getVMBeingRendered();\n assert.isFalse(vm.isDirty, `markComponentAsDirty() for ${vm} should not be called when the component is already dirty.`);\n assert.isFalse(isInvokingRender, `markComponentAsDirty() for ${vm} cannot be called during rendering of ${vmBeingRendered}.`);\n assert.isFalse(isUpdatingTemplate, `markComponentAsDirty() for ${vm} cannot be called while updating template of ${vmBeingRendered}.`);\n }\n\n vm.isDirty = true;\n}\n\nconst cmpEventListenerMap = new WeakMap();\n\nfunction getWrappedComponentsListener(vm, listener) {\n if (!isFunction$1(listener)) {\n throw new TypeError(); // avoiding problems with non-valid listeners\n }\n\n let wrappedListener = cmpEventListenerMap.get(listener);\n\n if (isUndefined$1(wrappedListener)) {\n wrappedListener = function (event) {\n invokeEventListener(vm, listener, undefined, event);\n };\n\n cmpEventListenerMap.set(listener, wrappedListener);\n }\n\n return wrappedListener;\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst Services = create(null);\nconst hooks = ['rendered', 'connected', 'disconnected'];\n/**\n * EXPERIMENTAL: This function allows for the registration of \"services\"\n * in LWC by exposing hooks into the component life-cycle. This API is\n * subject to change or being removed.\n */\n\nfunction register(service) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(isObject(service), `Invalid service declaration, ${service}: service must be an object`);\n }\n\n for (let i = 0; i < hooks.length; ++i) {\n const hookName = hooks[i];\n\n if (hookName in service) {\n let l = Services[hookName];\n\n if (isUndefined$1(l)) {\n Services[hookName] = l = [];\n }\n\n ArrayPush$1.call(l, service[hookName]);\n }\n }\n}\n\nfunction invokeServiceHook(vm, cbs) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(isArray$1(cbs) && cbs.length > 0, `Optimize invokeServiceHook() to be invoked only when needed`);\n }\n\n const {\n component,\n def,\n context\n } = vm;\n\n for (let i = 0, len = cbs.length; i < len; ++i) {\n cbs[i].call(undefined, component, {}, def, context);\n }\n}\n/*\n * Copyright (c) 2022, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction hydrate$1(vnode, node) {\n switch (vnode.type) {\n case 0\n /* Text */\n :\n hydrateText(vnode, node);\n break;\n\n case 1\n /* Comment */\n :\n hydrateComment(vnode, node);\n break;\n\n case 2\n /* Element */\n :\n hydrateElement(vnode, node);\n break;\n\n case 3\n /* CustomElement */\n :\n hydrateCustomElement(vnode, node);\n break;\n }\n}\n\nfunction hydrateText(vnode, node) {\n var _a;\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line lwc-internal/no-global-node\n validateNodeType(vnode, node, Node.TEXT_NODE);\n\n if (node.nodeValue !== vnode.text && !(node.nodeValue === '\\u200D' && vnode.text === '')) {\n logWarn('Hydration mismatch: text values do not match, will recover from the difference', vnode.owner);\n }\n } // always set the text value to the one from the vnode.\n\n\n node.nodeValue = (_a = vnode.text) !== null && _a !== void 0 ? _a : null;\n vnode.elm = node;\n}\n\nfunction hydrateComment(vnode, node) {\n var _a;\n\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line lwc-internal/no-global-node\n validateNodeType(vnode, node, Node.COMMENT_NODE);\n\n if (node.nodeValue !== vnode.text) {\n logWarn('Hydration mismatch: comment values do not match, will recover from the difference', vnode.owner);\n }\n } // always set the text value to the one from the vnode.\n\n\n node.nodeValue = (_a = vnode.text) !== null && _a !== void 0 ? _a : null;\n vnode.elm = node;\n}\n\nfunction hydrateElement(vnode, node) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line lwc-internal/no-global-node\n validateNodeType(vnode, node, Node.ELEMENT_NODE);\n validateElement(vnode, node);\n }\n\n const elm = node;\n vnode.elm = elm;\n const {\n context\n } = vnode.data;\n const isDomManual = Boolean(!isUndefined$1(context) && !isUndefined$1(context.lwc) && context.lwc.dom === \"manual\"\n /* Manual */\n );\n\n if (isDomManual) {\n // it may be that this element has lwc:inner-html, we need to diff and in case are the same,\n // remove the innerHTML from props so it reuses the existing dom elements.\n const {\n props\n } = vnode.data;\n\n if (!isUndefined$1(props) && !isUndefined$1(props.innerHTML)) {\n if (elm.innerHTML === props.innerHTML) {\n // Do a shallow clone since VNodeData may be shared across VNodes due to hoist optimization\n vnode.data = Object.assign(Object.assign({}, vnode.data), {\n props: cloneAndOmitKey(props, 'innerHTML')\n });\n } else {\n logWarn(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: innerHTML values do not match for element, will recover from the difference`, vnode.owner);\n }\n }\n }\n\n patchElementPropsAndAttrs(vnode);\n\n if (!isDomManual) {\n hydrateChildren(vnode.elm.childNodes, vnode.children, vnode.owner);\n }\n}\n\nfunction hydrateCustomElement(vnode, node) {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line lwc-internal/no-global-node\n validateNodeType(vnode, node, Node.ELEMENT_NODE);\n validateElement(vnode, node);\n }\n\n const elm = node;\n vnode.elm = elm;\n const {\n sel,\n mode,\n ctor,\n owner\n } = vnode;\n const vm = createVM(elm, ctor, {\n mode,\n owner,\n tagName: sel\n });\n allocateChildren(vnode, vm);\n patchElementPropsAndAttrs(vnode); // Insert hook section:\n\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(vm.state === 0\n /* created */\n , `${vm} cannot be recycled.`);\n }\n\n runConnectedCallback(vm);\n\n if (vm.renderMode !== 0\n /* Light */\n ) {\n // VM is not rendering in Light DOM, we can proceed and hydrate the slotted content.\n // Note: for Light DOM, this is handled while hydrating the VM\n hydrateChildren(vnode.elm.childNodes, vnode.children, vm);\n }\n\n hydrateVM(vm);\n}\n\nfunction hydrateChildren(elmChildren, children, vm) {\n if (process.env.NODE_ENV !== 'production') {\n const filteredVNodes = ArrayFilter.call(children, vnode => !!vnode);\n\n if (elmChildren.length !== filteredVNodes.length) {\n logError(`Hydration mismatch: incorrect number of rendered nodes, expected ${filteredVNodes.length} but found ${elmChildren.length}.`, vm);\n throwHydrationError();\n }\n }\n\n let childNodeIndex = 0;\n\n for (let i = 0; i < children.length; i++) {\n const childVnode = children[i];\n\n if (!isNull(childVnode)) {\n const childNode = elmChildren[childNodeIndex];\n hydrate$1(childVnode, childNode);\n childNodeIndex++;\n }\n }\n}\n\nfunction patchElementPropsAndAttrs(vnode) {\n applyEventListeners(vnode);\n patchProps(null, vnode);\n}\n\nfunction throwHydrationError() {\n assert.fail('Server rendered elements do not match client side generated elements');\n}\n\nfunction validateNodeType(vnode, node, nodeType) {\n if (node.nodeType !== nodeType) {\n logError('Hydration mismatch: incorrect node type received', vnode.owner);\n assert.fail('Hydration mismatch: incorrect node type received.');\n }\n}\n\nfunction validateElement(vnode, elm) {\n if (vnode.sel.toLowerCase() !== elm.tagName.toLowerCase()) {\n logError(`Hydration mismatch: expecting element with tag \"${vnode.sel.toLowerCase()}\" but found \"${elm.tagName.toLowerCase()}\".`, vnode.owner);\n throwHydrationError();\n }\n\n const hasIncompatibleAttrs = validateAttrs(vnode, elm);\n const hasIncompatibleClass = validateClassAttr(vnode, elm);\n const hasIncompatibleStyle = validateStyleAttr(vnode, elm);\n const isVNodeAndElementCompatible = hasIncompatibleAttrs && hasIncompatibleClass && hasIncompatibleStyle;\n\n if (!isVNodeAndElementCompatible) {\n throwHydrationError();\n }\n}\n\nfunction validateAttrs(vnode, elm) {\n const {\n data: {\n attrs = {}\n }\n } = vnode;\n let nodesAreCompatible = true; // Validate attributes, though we could always recovery from those by running the update mods.\n // Note: intentionally ONLY matching vnodes.attrs to elm.attrs, in case SSR is adding extra attributes.\n\n for (const [attrName, attrValue] of Object.entries(attrs)) {\n const elmAttrValue = getAttribute$1(elm, attrName);\n\n if (String(attrValue) !== elmAttrValue) {\n logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute \"${attrName}\" has different values, expected \"${attrValue}\" but found \"${elmAttrValue}\"`, vnode.owner);\n nodesAreCompatible = false;\n }\n }\n\n return nodesAreCompatible;\n}\n\nfunction validateClassAttr(vnode, elm) {\n const {\n data: {\n className,\n classMap\n }\n } = vnode;\n let nodesAreCompatible = true;\n let vnodeClassName;\n\n if (!isUndefined$1(className) && String(className) !== elm.className) {\n // className is used when class is bound to an expr.\n nodesAreCompatible = false;\n vnodeClassName = className;\n } else if (!isUndefined$1(classMap)) {\n // classMap is used when class is set to static value.\n const classList = getClassList$1(elm);\n let computedClassName = ''; // all classes from the vnode should be in the element.classList\n\n for (const name in classMap) {\n computedClassName += ' ' + name;\n\n if (!classList.contains(name)) {\n nodesAreCompatible = false;\n }\n }\n\n vnodeClassName = computedClassName.trim();\n\n if (classList.length > keys(classMap).length) {\n nodesAreCompatible = false;\n }\n }\n\n if (!nodesAreCompatible) {\n logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute \"class\" has different values, expected \"${vnodeClassName}\" but found \"${elm.className}\"`, vnode.owner);\n }\n\n return nodesAreCompatible;\n}\n\nfunction validateStyleAttr(vnode, elm) {\n const {\n data: {\n style,\n styleDecls\n }\n } = vnode;\n const elmStyle = getAttribute$1(elm, 'style') || '';\n let vnodeStyle;\n let nodesAreCompatible = true;\n\n if (!isUndefined$1(style) && style !== elmStyle) {\n nodesAreCompatible = false;\n vnodeStyle = style;\n } else if (!isUndefined$1(styleDecls)) {\n const parsedVnodeStyle = parseStyleText(elmStyle);\n const expectedStyle = []; // styleMap is used when style is set to static value.\n\n for (let i = 0, n = styleDecls.length; i < n; i++) {\n const [prop, value, important] = styleDecls[i];\n expectedStyle.push(`${prop}: ${value + (important ? ' important!' : '')}`);\n const parsedPropValue = parsedVnodeStyle[prop];\n\n if (isUndefined$1(parsedPropValue)) {\n nodesAreCompatible = false;\n } else if (!parsedPropValue.startsWith(value)) {\n nodesAreCompatible = false;\n } else if (important && !parsedPropValue.endsWith('!important')) {\n nodesAreCompatible = false;\n }\n }\n\n if (keys(parsedVnodeStyle).length > styleDecls.length) {\n nodesAreCompatible = false;\n }\n\n vnodeStyle = ArrayJoin.call(expectedStyle, ';');\n }\n\n if (!nodesAreCompatible) {\n // style is used when class is bound to an expr.\n logError(`Mismatch hydrating element <${elm.tagName.toLowerCase()}>: attribute \"style\" has different values, expected \"${vnodeStyle}\" but found \"${elmStyle}\".`, vnode.owner);\n }\n\n return nodesAreCompatible;\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nlet idx = 0;\n/** The internal slot used to associate different objects the engine manipulates with the VM */\n\nconst ViewModelReflection = new WeakMap();\n\nfunction callHook(cmp, fn, args = []) {\n return fn.apply(cmp, args);\n}\n\nfunction setHook(cmp, prop, newValue) {\n cmp[prop] = newValue;\n}\n\nfunction getHook(cmp, prop) {\n return cmp[prop];\n}\n\nfunction rerenderVM(vm) {\n rehydrate(vm);\n}\n\nfunction connectRootElement(elm) {\n const vm = getAssociatedVM(elm);\n logGlobalOperationStart(7\n /* GlobalHydrate */\n , vm); // Usually means moving the element from one place to another, which is observable via\n // life-cycle hooks.\n\n if (vm.state === 1\n /* connected */\n ) {\n disconnectRootElement(elm);\n }\n\n runConnectedCallback(vm);\n rehydrate(vm);\n logGlobalOperationEnd(7\n /* GlobalHydrate */\n , vm);\n}\n\nfunction hydrateRootElement(elm) {\n const vm = getAssociatedVM(elm);\n runConnectedCallback(vm);\n hydrateVM(vm);\n}\n\nfunction disconnectRootElement(elm) {\n const vm = getAssociatedVM(elm);\n resetComponentStateWhenRemoved(vm);\n}\n\nfunction appendVM(vm) {\n rehydrate(vm);\n}\n\nfunction hydrateVM(vm) {\n hydrate(vm);\n} // just in case the component comes back, with this we guarantee re-rendering it\n// while preventing any attempt to rehydration until after reinsertion.\n\n\nfunction resetComponentStateWhenRemoved(vm) {\n const {\n state\n } = vm;\n\n if (state !== 2\n /* disconnected */\n ) {\n const {\n oar,\n tro\n } = vm; // Making sure that any observing record will not trigger the rehydrated on this vm\n\n tro.reset(); // Making sure that any observing accessor record will not trigger the setter to be reinvoked\n\n for (const key in oar) {\n oar[key].reset();\n }\n\n runDisconnectedCallback(vm); // Spec: https://dom.spec.whatwg.org/#concept-node-remove (step 14-15)\n\n runChildNodesDisconnectedCallback(vm);\n runLightChildNodesDisconnectedCallback(vm);\n }\n\n if (process.env.NODE_ENV !== 'production') {\n removeActiveVM(vm);\n }\n} // this method is triggered by the diffing algo only when a vnode from the\n// old vnode.children is removed from the DOM.\n\n\nfunction removeVM(vm) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(vm.state === 1\n /* connected */\n || vm.state === 2\n /* disconnected */\n , `${vm} must have been connected.`);\n }\n\n resetComponentStateWhenRemoved(vm);\n}\n\nfunction getNearestShadowAncestor(vm) {\n let ancestor = vm.owner;\n\n while (!isNull(ancestor) && ancestor.renderMode === 0\n /* Light */\n ) {\n ancestor = ancestor.owner;\n }\n\n return ancestor;\n}\n\nfunction createVM(elm, ctor, options) {\n const {\n mode,\n owner,\n tagName\n } = options;\n const def = getComponentInternalDef(ctor);\n const vm = {\n elm,\n def,\n idx: idx++,\n state: 0\n /* created */\n ,\n isScheduled: false,\n isDirty: true,\n tagName,\n mode,\n owner,\n children: EmptyArray,\n aChildren: EmptyArray,\n velements: EmptyArray,\n cmpProps: create(null),\n cmpFields: create(null),\n cmpSlots: create(null),\n oar: create(null),\n cmpTemplate: null,\n renderMode: def.renderMode,\n context: {\n stylesheetToken: undefined,\n hasTokenInClass: undefined,\n hasTokenInAttribute: undefined,\n hasScopedStyles: undefined,\n styleVNode: null,\n tplCache: EmptyObject,\n wiredConnecting: EmptyArray,\n wiredDisconnecting: EmptyArray\n },\n // Properties set right after VM creation.\n tro: null,\n shadowMode: null,\n // Properties set by the LightningElement constructor.\n component: null,\n shadowRoot: null,\n renderRoot: null,\n callHook,\n setHook,\n getHook\n };\n vm.shadowMode = computeShadowMode(vm);\n vm.tro = getTemplateReactiveObserver(vm);\n\n if (process.env.NODE_ENV !== 'production') {\n vm.toString = () => {\n return `[object:vm ${def.name} (${vm.idx})]`;\n };\n\n if (runtimeFlags.ENABLE_FORCE_NATIVE_SHADOW_MODE_FOR_TEST) {\n vm.shadowMode = 0\n /* Native */\n ;\n }\n } // Create component instance associated to the vm and the element.\n\n\n invokeComponentConstructor(vm, def.ctor); // Initializing the wire decorator per instance only when really needed\n\n if (hasWireAdapters(vm)) {\n installWireAdapters(vm);\n }\n\n return vm;\n}\n\nfunction computeShadowMode(vm) {\n const {\n def\n } = vm;\n let shadowMode;\n\n if (isSyntheticShadowDefined$1) {\n if (def.renderMode === 0\n /* Light */\n ) {\n // ShadowMode.Native implies \"not synthetic shadow\" which is consistent with how\n // everything defaults to native when the synthetic shadow polyfill is unavailable.\n shadowMode = 0\n /* Native */\n ;\n } else if (isNativeShadowDefined$1) {\n if (def.shadowSupportMode === \"any\"\n /* Any */\n ) {\n shadowMode = 0\n /* Native */\n ;\n } else {\n const shadowAncestor = getNearestShadowAncestor(vm);\n\n if (!isNull(shadowAncestor) && shadowAncestor.shadowMode === 0\n /* Native */\n ) {\n // Transitive support for native Shadow DOM. A component in native mode\n // transitively opts all of its descendants into native.\n shadowMode = 0\n /* Native */\n ;\n } else {\n // Synthetic if neither this component nor any of its ancestors are configured\n // to be native.\n shadowMode = 1\n /* Synthetic */\n ;\n }\n }\n } else {\n // Synthetic if there is no native Shadow DOM support.\n shadowMode = 1\n /* Synthetic */\n ;\n }\n } else {\n // Native if the synthetic shadow polyfill is unavailable.\n shadowMode = 0\n /* Native */\n ;\n }\n\n return shadowMode;\n}\n\nfunction assertIsVM(obj) {\n if (isNull(obj) || !isObject(obj) || !('renderRoot' in obj)) {\n throw new TypeError(`${obj} is not a VM.`);\n }\n}\n\nfunction associateVM(obj, vm) {\n ViewModelReflection.set(obj, vm);\n}\n\nfunction getAssociatedVM(obj) {\n const vm = ViewModelReflection.get(obj);\n\n if (process.env.NODE_ENV !== 'production') {\n assertIsVM(vm);\n }\n\n return vm;\n}\n\nfunction getAssociatedVMIfPresent(obj) {\n const maybeVm = ViewModelReflection.get(obj);\n\n if (process.env.NODE_ENV !== 'production') {\n if (!isUndefined$1(maybeVm)) {\n assertIsVM(maybeVm);\n }\n }\n\n return maybeVm;\n}\n\nfunction rehydrate(vm) {\n if (isTrue(vm.isDirty)) {\n const children = renderComponent(vm);\n patchShadowRoot(vm, children);\n }\n}\n\nfunction hydrate(vm) {\n if (isTrue(vm.isDirty)) {\n // manually diffing/patching here.\n // This routine is:\n // patchShadowRoot(vm, children);\n // -> addVnodes.\n const children = renderComponent(vm);\n vm.children = children;\n const vmChildren = vm.renderMode === 0\n /* Light */\n ? vm.elm.childNodes : vm.elm.shadowRoot.childNodes;\n hydrateChildren(vmChildren, children, vm);\n runRenderedCallback(vm);\n }\n}\n\nfunction patchShadowRoot(vm, newCh) {\n const {\n renderRoot,\n children: oldCh\n } = vm; // caching the new children collection\n\n vm.children = newCh;\n\n if (newCh.length > 0 || oldCh.length > 0) {\n // patch function mutates vnodes by adding the element reference,\n // however, if patching fails it contains partial changes.\n if (oldCh !== newCh) {\n runWithBoundaryProtection(vm, vm, () => {\n // pre\n logOperationStart(2\n /* Patch */\n , vm);\n }, () => {\n // job\n patchChildren(renderRoot, oldCh, newCh);\n }, () => {\n // post\n logOperationEnd(2\n /* Patch */\n , vm);\n });\n }\n }\n\n if (vm.state === 1\n /* connected */\n ) {\n // If the element is connected, that means connectedCallback was already issued, and\n // any successive rendering should finish with the call to renderedCallback, otherwise\n // the connectedCallback will take care of calling it in the right order at the end of\n // the current rehydration process.\n runRenderedCallback(vm);\n }\n}\n\nfunction runRenderedCallback(vm) {\n const {\n def: {\n renderedCallback\n }\n } = vm;\n\n if (isTrue(ssr$1)) {\n return;\n }\n\n const {\n rendered\n } = Services;\n\n if (rendered) {\n invokeServiceHook(vm, rendered);\n }\n\n if (!isUndefined$1(renderedCallback)) {\n logOperationStart(4\n /* RenderedCallback */\n , vm);\n invokeComponentCallback(vm, renderedCallback);\n logOperationEnd(4\n /* RenderedCallback */\n , vm);\n }\n}\n\nlet rehydrateQueue = [];\n\nfunction flushRehydrationQueue() {\n logGlobalOperationStart(8\n /* GlobalRehydrate */\n );\n\n if (process.env.NODE_ENV !== 'production') {\n assert.invariant(rehydrateQueue.length, `If rehydrateQueue was scheduled, it is because there must be at least one VM on this pending queue instead of ${rehydrateQueue}.`);\n }\n\n const vms = rehydrateQueue.sort((a, b) => a.idx - b.idx);\n rehydrateQueue = []; // reset to a new queue\n\n for (let i = 0, len = vms.length; i < len; i += 1) {\n const vm = vms[i];\n\n try {\n rehydrate(vm);\n } catch (error) {\n if (i + 1 < len) {\n // pieces of the queue are still pending to be rehydrated, those should have priority\n if (rehydrateQueue.length === 0) {\n addCallbackToNextTick(flushRehydrationQueue);\n }\n\n ArrayUnshift.apply(rehydrateQueue, ArraySlice.call(vms, i + 1));\n } // we need to end the measure before throwing.\n\n\n logGlobalOperationEnd(8\n /* GlobalRehydrate */\n ); // re-throwing the original error will break the current tick, but since the next tick is\n // already scheduled, it should continue patching the rest.\n\n throw error; // eslint-disable-line no-unsafe-finally\n }\n }\n\n logGlobalOperationEnd(8\n /* GlobalRehydrate */\n );\n}\n\nfunction runConnectedCallback(vm) {\n const {\n state\n } = vm;\n\n if (state === 1\n /* connected */\n ) {\n return; // nothing to do since it was already connected\n }\n\n vm.state = 1\n /* connected */\n ; // reporting connection\n\n const {\n connected\n } = Services;\n\n if (connected) {\n invokeServiceHook(vm, connected);\n }\n\n if (hasWireAdapters(vm)) {\n connectWireAdapters(vm);\n }\n\n const {\n connectedCallback\n } = vm.def;\n\n if (!isUndefined$1(connectedCallback)) {\n logOperationStart(3\n /* ConnectedCallback */\n , vm);\n invokeComponentCallback(vm, connectedCallback);\n logOperationEnd(3\n /* ConnectedCallback */\n , vm);\n }\n}\n\nfunction hasWireAdapters(vm) {\n return getOwnPropertyNames$1(vm.def.wire).length > 0;\n}\n\nfunction runDisconnectedCallback(vm) {\n if (process.env.NODE_ENV !== 'production') {\n assert.isTrue(vm.state !== 2\n /* disconnected */\n , `${vm} must be inserted.`);\n }\n\n if (isFalse(vm.isDirty)) {\n // this guarantees that if the component is reused/reinserted,\n // it will be re-rendered because we are disconnecting the reactivity\n // linking, so mutations are not automatically reflected on the state\n // of disconnected components.\n vm.isDirty = true;\n }\n\n vm.state = 2\n /* disconnected */\n ; // reporting disconnection\n\n const {\n disconnected\n } = Services;\n\n if (disconnected) {\n invokeServiceHook(vm, disconnected);\n }\n\n if (hasWireAdapters(vm)) {\n disconnectWireAdapters(vm);\n }\n\n const {\n disconnectedCallback\n } = vm.def;\n\n if (!isUndefined$1(disconnectedCallback)) {\n logOperationStart(5\n /* DisconnectedCallback */\n , vm);\n invokeComponentCallback(vm, disconnectedCallback);\n logOperationEnd(5\n /* DisconnectedCallback */\n , vm);\n }\n}\n\nfunction runChildNodesDisconnectedCallback(vm) {\n const {\n velements: vCustomElementCollection\n } = vm; // Reporting disconnection for every child in inverse order since they are\n // inserted in reserved order.\n\n for (let i = vCustomElementCollection.length - 1; i >= 0; i -= 1) {\n const {\n elm\n } = vCustomElementCollection[i]; // There are two cases where the element could be undefined:\n // * when there is an error during the construction phase, and an error\n // boundary picks it, there is a possibility that the VCustomElement\n // is not properly initialized, and therefore is should be ignored.\n // * when slotted custom element is not used by the element where it is\n // slotted into it, as a result, the custom element was never\n // initialized.\n\n if (!isUndefined$1(elm)) {\n const childVM = getAssociatedVMIfPresent(elm); // The VM associated with the element might be associated undefined\n // in the case where the VM failed in the middle of its creation,\n // eg: constructor throwing before invoking super().\n\n if (!isUndefined$1(childVM)) {\n resetComponentStateWhenRemoved(childVM);\n }\n }\n }\n}\n\nfunction runLightChildNodesDisconnectedCallback(vm) {\n const {\n aChildren: adoptedChildren\n } = vm;\n recursivelyDisconnectChildren(adoptedChildren);\n}\n/**\n * The recursion doesn't need to be a complete traversal of the vnode graph,\n * instead it can be partial, when a custom element vnode is found, we don't\n * need to continue into its children because by attempting to disconnect the\n * custom element itself will trigger the removal of anything slotted or anything\n * defined on its shadow.\n */\n\n\nfunction recursivelyDisconnectChildren(vnodes) {\n for (let i = 0, len = vnodes.length; i < len; i += 1) {\n const vnode = vnodes[i];\n\n if (!isNull(vnode) && !isUndefined$1(vnode.elm)) {\n switch (vnode.type) {\n case 2\n /* Element */\n :\n recursivelyDisconnectChildren(vnode.children);\n break;\n\n case 3\n /* CustomElement */\n :\n {\n const vm = getAssociatedVM(vnode.elm);\n resetComponentStateWhenRemoved(vm);\n break;\n }\n }\n }\n }\n} // This is a super optimized mechanism to remove the content of the root node (shadow root\n// for shadow DOM components and the root element itself for light DOM) without having to go\n// into snabbdom. Especially useful when the reset is a consequence of an error, in which case the\n// children VNodes might not be representing the current state of the DOM.\n\n\nfunction resetComponentRoot(vm) {\n const {\n children,\n renderRoot\n } = vm;\n\n for (let i = 0, len = children.length; i < len; i++) {\n const child = children[i];\n\n if (!isNull(child) && !isUndefined$1(child.elm)) {\n remove$1(child.elm, renderRoot);\n }\n }\n\n vm.children = EmptyArray;\n runChildNodesDisconnectedCallback(vm);\n vm.velements = EmptyArray;\n}\n\nfunction scheduleRehydration(vm) {\n if (isTrue(ssr$1) || isTrue(vm.isScheduled)) {\n return;\n }\n\n vm.isScheduled = true;\n\n if (rehydrateQueue.length === 0) {\n addCallbackToNextTick(flushRehydrationQueue);\n }\n\n ArrayPush$1.call(rehydrateQueue, vm);\n}\n\nfunction getErrorBoundaryVM(vm) {\n let currentVm = vm;\n\n while (!isNull(currentVm)) {\n if (!isUndefined$1(currentVm.def.errorCallback)) {\n return currentVm;\n }\n\n currentVm = currentVm.owner;\n }\n}\n\nfunction runWithBoundaryProtection(vm, owner, pre, job, post) {\n let error;\n pre();\n\n try {\n job();\n } catch (e) {\n error = Object(e);\n } finally {\n post();\n\n if (!isUndefined$1(error)) {\n addErrorComponentStack(vm, error);\n const errorBoundaryVm = isNull(owner) ? undefined : getErrorBoundaryVM(owner);\n\n if (isUndefined$1(errorBoundaryVm)) {\n throw error; // eslint-disable-line no-unsafe-finally\n }\n\n resetComponentRoot(vm); // remove offenders\n\n logOperationStart(6\n /* ErrorCallback */\n , vm); // error boundaries must have an ErrorCallback\n\n const errorCallback = errorBoundaryVm.def.errorCallback;\n invokeComponentCallback(errorBoundaryVm, errorCallback, [error, error.wcStack]);\n logOperationEnd(6\n /* ErrorCallback */\n , vm);\n }\n }\n}\n\nfunction forceRehydration(vm) {\n // if we must reset the shadowRoot content and render the template\n // from scratch on an active instance, the way to force the reset\n // is by replacing the value of old template, which is used during\n // to determine if the template has changed or not during the rendering\n // process. If the template returned by render() is different from the\n // previous stored template, the styles will be reset, along with the\n // content of the shadowRoot, this way we can guarantee that all children\n // elements will be throw away, and new instances will be created.\n vm.cmpTemplate = () => [];\n\n if (isFalse(vm.isDirty)) {\n // forcing the vm to rehydrate in the next tick\n markComponentAsDirty(vm);\n scheduleRehydration(vm);\n }\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst DeprecatedWiredElementHost = '$$DeprecatedWiredElementHostKey$$';\nconst DeprecatedWiredParamsMeta = '$$DeprecatedWiredParamsMetaKey$$';\nconst WireMetaMap = new Map();\n\nclass WireContextRegistrationEvent extends CustomEvent {\n constructor(adapterToken, {\n setNewContext,\n setDisconnectedCallback\n }) {\n super(adapterToken, {\n bubbles: true,\n composed: true\n });\n defineProperties(this, {\n setNewContext: {\n value: setNewContext\n },\n setDisconnectedCallback: {\n value: setDisconnectedCallback\n }\n });\n }\n\n}\n\nfunction createFieldDataCallback(vm, name) {\n const {\n cmpFields\n } = vm;\n return value => {\n if (value !== vm.cmpFields[name]) {\n // storing the value in the underlying storage\n cmpFields[name] = value;\n componentValueMutated(vm, name);\n }\n };\n}\n\nfunction createMethodDataCallback(vm, method) {\n return value => {\n // dispatching new value into the wired method\n runWithBoundaryProtection(vm, vm.owner, noop, () => {\n // job\n method.call(vm.component, value);\n }, noop);\n };\n}\n\nfunction createConfigWatcher(component, configCallback, callbackWhenConfigIsReady) {\n let hasPendingConfig = false; // creating the reactive observer for reactive params when needed\n\n const ro = new ReactiveObserver(() => {\n if (hasPendingConfig === false) {\n hasPendingConfig = true; // collect new config in the micro-task\n\n Promise.resolve().then(() => {\n hasPendingConfig = false; // resetting current reactive params\n\n ro.reset(); // dispatching a new config due to a change in the configuration\n\n computeConfigAndUpdate();\n });\n }\n });\n\n const computeConfigAndUpdate = () => {\n let config;\n ro.observe(() => config = configCallback(component)); // eslint-disable-next-line lwc-internal/no-invalid-todo\n // TODO: dev-mode validation of config based on the adapter.configSchema\n // @ts-ignore it is assigned in the observe() callback\n\n callbackWhenConfigIsReady(config);\n };\n\n return {\n computeConfigAndUpdate,\n ro\n };\n}\n\nfunction createContextWatcher(vm, wireDef, callbackWhenContextIsReady) {\n const {\n adapter\n } = wireDef;\n const adapterContextToken = getAdapterToken(adapter);\n\n if (isUndefined$1(adapterContextToken)) {\n return; // no provider found, nothing to be done\n }\n\n const {\n elm,\n context: {\n wiredConnecting,\n wiredDisconnecting\n }\n } = vm; // waiting for the component to be connected to formally request the context via the token\n\n ArrayPush$1.call(wiredConnecting, () => {\n // This event is responsible for connecting the host element with another\n // element in the composed path that is providing contextual data. The provider\n // must be listening for a special dom event with the name corresponding to the value of\n // `adapterContextToken`, which will remain secret and internal to this file only to\n // guarantee that the linkage can be forged.\n const contextRegistrationEvent = new WireContextRegistrationEvent(adapterContextToken, {\n setNewContext(newContext) {\n // eslint-disable-next-line lwc-internal/no-invalid-todo\n // TODO: dev-mode validation of config based on the adapter.contextSchema\n callbackWhenContextIsReady(newContext);\n },\n\n setDisconnectedCallback(disconnectCallback) {\n // adds this callback into the disconnect bucket so it gets disconnected from parent\n // the the element hosting the wire is disconnected\n ArrayPush$1.call(wiredDisconnecting, disconnectCallback);\n }\n\n });\n dispatchEvent$1(elm, contextRegistrationEvent);\n });\n}\n\nfunction createConnector(vm, name, wireDef) {\n const {\n method,\n adapter,\n configCallback,\n dynamic\n } = wireDef;\n const dataCallback = isUndefined$1(method) ? createFieldDataCallback(vm, name) : createMethodDataCallback(vm, method);\n let context;\n let connector; // Workaround to pass the component element associated to this wire adapter instance.\n\n defineProperty(dataCallback, DeprecatedWiredElementHost, {\n value: vm.elm\n });\n defineProperty(dataCallback, DeprecatedWiredParamsMeta, {\n value: dynamic\n });\n runWithBoundaryProtection(vm, vm, noop, () => {\n // job\n connector = new adapter(dataCallback);\n }, noop);\n\n const updateConnectorConfig = config => {\n // every time the config is recomputed due to tracking,\n // this callback will be invoked with the new computed config\n runWithBoundaryProtection(vm, vm, noop, () => {\n // job\n connector.update(config, context);\n }, noop);\n }; // Computes the current wire config and calls the update method on the wire adapter.\n // If it has params, we will need to observe changes in the next tick.\n\n\n const {\n computeConfigAndUpdate,\n ro\n } = createConfigWatcher(vm.component, configCallback, updateConnectorConfig); // if the adapter needs contextualization, we need to watch for new context and push it alongside the config\n\n if (!isUndefined$1(adapter.contextSchema)) {\n createContextWatcher(vm, wireDef, newContext => {\n // every time the context is pushed into this component,\n // this callback will be invoked with the new computed context\n if (context !== newContext) {\n context = newContext; // Note: when new context arrives, the config will be recomputed and pushed along side the new\n // context, this is to preserve the identity characteristics, config should not have identity\n // (ever), while context can have identity\n\n if (vm.state === 1\n /* connected */\n ) {\n computeConfigAndUpdate();\n }\n }\n });\n }\n\n return {\n // @ts-ignore the boundary protection executes sync, connector is always defined\n connector,\n computeConfigAndUpdate,\n resetConfigWatcher: () => ro.reset()\n };\n}\n\nconst AdapterToTokenMap = new Map();\n\nfunction getAdapterToken(adapter) {\n return AdapterToTokenMap.get(adapter);\n}\n\nfunction setAdapterToken(adapter, token) {\n AdapterToTokenMap.set(adapter, token);\n}\n\nfunction storeWiredMethodMeta(descriptor, adapter, configCallback, dynamic) {\n // support for callable adapters\n if (adapter.adapter) {\n adapter = adapter.adapter;\n }\n\n const method = descriptor.value;\n const def = {\n adapter,\n method,\n configCallback,\n dynamic\n };\n WireMetaMap.set(descriptor, def);\n}\n\nfunction storeWiredFieldMeta(descriptor, adapter, configCallback, dynamic) {\n // support for callable adapters\n if (adapter.adapter) {\n adapter = adapter.adapter;\n }\n\n const def = {\n adapter,\n configCallback,\n dynamic\n };\n WireMetaMap.set(descriptor, def);\n}\n\nfunction installWireAdapters(vm) {\n const {\n context,\n def: {\n wire\n }\n } = vm;\n const wiredConnecting = context.wiredConnecting = [];\n const wiredDisconnecting = context.wiredDisconnecting = [];\n\n for (const fieldNameOrMethod in wire) {\n const descriptor = wire[fieldNameOrMethod];\n const wireDef = WireMetaMap.get(descriptor);\n\n if (process.env.NODE_ENV !== 'production') {\n assert.invariant(wireDef, `Internal Error: invalid wire definition found.`);\n }\n\n if (!isUndefined$1(wireDef)) {\n const {\n connector,\n computeConfigAndUpdate,\n resetConfigWatcher\n } = createConnector(vm, fieldNameOrMethod, wireDef);\n const hasDynamicParams = wireDef.dynamic.length > 0;\n ArrayPush$1.call(wiredConnecting, () => {\n connector.connect();\n\n if (!runtimeFlags.ENABLE_WIRE_SYNC_EMIT) {\n if (hasDynamicParams) {\n Promise.resolve().then(computeConfigAndUpdate);\n return;\n }\n }\n\n computeConfigAndUpdate();\n });\n ArrayPush$1.call(wiredDisconnecting, () => {\n connector.disconnect();\n resetConfigWatcher();\n });\n }\n }\n}\n\nfunction connectWireAdapters(vm) {\n const {\n wiredConnecting\n } = vm.context;\n\n for (let i = 0, len = wiredConnecting.length; i < len; i += 1) {\n wiredConnecting[i]();\n }\n}\n\nfunction disconnectWireAdapters(vm) {\n const {\n wiredDisconnecting\n } = vm.context;\n runWithBoundaryProtection(vm, vm, noop, () => {\n // job\n for (let i = 0, len = wiredDisconnecting.length; i < len; i += 1) {\n wiredDisconnecting[i]();\n }\n }, noop);\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nfunction createContextProvider(adapter) {\n let adapterContextToken = getAdapterToken(adapter);\n\n if (!isUndefined$1(adapterContextToken)) {\n throw new Error(`Adapter already has a context provider.`);\n }\n\n adapterContextToken = guid();\n setAdapterToken(adapter, adapterContextToken);\n const providers = new WeakSet();\n return (elm, options) => {\n if (providers.has(elm)) {\n throw new Error(`Adapter was already installed on ${elm}.`);\n }\n\n providers.add(elm);\n const {\n consumerConnectedCallback,\n consumerDisconnectedCallback\n } = options;\n elm.addEventListener(adapterContextToken, evt => {\n const {\n setNewContext,\n setDisconnectedCallback\n } = evt;\n const consumer = {\n provide(newContext) {\n setNewContext(newContext);\n }\n\n };\n\n const disconnectCallback = () => {\n if (!isUndefined$1(consumerDisconnectedCallback)) {\n consumerDisconnectedCallback(consumer);\n }\n };\n\n setDisconnectedCallback(disconnectCallback);\n consumerConnectedCallback(consumer);\n evt.stopImmediatePropagation();\n });\n };\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n/**\n * EXPERIMENTAL: This function allows you to create a reactive readonly\n * membrane around any object value. This API is subject to change or\n * being removed.\n */\n\n\nfunction readonly(obj) {\n if (process.env.NODE_ENV !== 'production') {\n // TODO [#1292]: Remove the readonly decorator\n if (arguments.length !== 1) {\n assert.fail('@readonly cannot be used as a decorator just yet, use it as a function with one argument to produce a readonly version of the provided value.');\n }\n }\n\n return reactiveMembrane.getReadOnlyProxy(obj);\n}\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nlet hooksAreSet = false;\n\nfunction setHooks(hooks) {\n assert.isFalse(hooksAreSet, 'Hooks are already overridden, only one definition is allowed.');\n hooksAreSet = true;\n setSanitizeHtmlContentHook(hooks.sanitizeHtmlContent);\n}\n/* version: 2.9.0 */\n\n/*\n * Copyright (c) 2018, salesforce.com, inc.\n * All rights reserved.\n * SPDX-License-Identifier: MIT\n * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT\n */\n\n\nconst globalStylesheets = create(null);\n\nif (process.env.NODE_ENV === 'development') {\n // @ts-ignore\n window.__lwcResetGlobalStylesheets = () => {\n for (const key of Object.keys(globalStylesheets)) {\n delete globalStylesheets[key];\n }\n };\n}\n\nconst globalStylesheetsParentElement = document.head || document.body || document; // This check for constructable stylesheets is similar to Fast's:\n// https://github.com/microsoft/fast/blob/d49d1ec/packages/web-components/fast-element/src/dom.ts#L51-L53\n// See also: https://github.com/whatwg/webidl/issues/1027#issuecomment-934510070\n\nconst supportsConstructableStyleSheets = isFunction$1(CSSStyleSheet.prototype.replaceSync) && isArray$1(document.adoptedStyleSheets);\nconst styleElements = create(null);\nconst styleSheets = create(null);\nconst nodesToStyleSheets = new WeakMap();\nlet getCustomElement;\nlet defineCustomElement;\nlet HTMLElementConstructor;\n\nfunction isCustomElementRegistryAvailable() {\n if (typeof customElements === 'undefined') {\n return false;\n }\n\n try {\n // dereference HTMLElement global because babel wraps globals in compat mode with a\n // _wrapNativeSuper()\n // This is a problem because LWCUpgradableElement extends renderer.HTMLElement which does not\n // get wrapped by babel.\n const HTMLElementAlias = HTMLElement; // In case we use compat mode with a modern browser, the compat mode transformation\n // invokes the DOM api with an .apply() or .call() to initialize any DOM api sub-classing,\n // which are not equipped to be initialized that way.\n\n class clazz extends HTMLElementAlias {}\n\n customElements.define('lwc-test-' + Math.floor(Math.random() * 1000000), clazz);\n new clazz();\n return true;\n } catch (_a) {\n return false;\n }\n}\n\nfunction insertConstructableStyleSheet(content, target) {\n // It's important for CSSStyleSheets to be unique based on their content, so that\n // `shadowRoot.adoptedStyleSheets.includes(sheet)` works.\n let styleSheet = styleSheets[content];\n\n if (isUndefined$1(styleSheet)) {\n styleSheet = new CSSStyleSheet();\n styleSheet.replaceSync(content);\n styleSheets[content] = styleSheet;\n }\n\n if (!target.adoptedStyleSheets.includes(styleSheet)) {\n target.adoptedStyleSheets = [...target.adoptedStyleSheets, styleSheet];\n }\n}\n\nfunction insertStyleElement(content, target) {\n // Avoid inserting duplicate `